easel-canvas 0.4.0 → 0.5.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.
@@ -0,0 +1,75 @@
1
+ var xx=Object.defineProperty;var wx=(n,o,r)=>o in n?xx(n,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[o]=r;var hy=(n,o,r)=>wx(n,typeof o!="symbol"?o+"":o,r);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))f(m);new MutationObserver(m=>{for(const p of m)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 r(m){const p={};return m.integrity&&(p.integrity=m.integrity),m.referrerPolicy&&(p.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?p.credentials="include":m.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function f(m){if(m.ep)return;m.ep=!0;const p=r(m);fetch(m.href,p)}})();var sm={exports:{}},mu={};/**
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 my;function jx(){if(my)return mu;my=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(f,m,p){var v=null;if(p!==void 0&&(v=""+p),m.key!==void 0&&(v=""+m.key),"key"in m){p={};for(var S in m)S!=="key"&&(p[S]=m[S])}else p=m;return m=p.ref,{$$typeof:n,type:f,key:v,ref:m!==void 0?m:null,props:p}}return mu.Fragment=o,mu.jsx=r,mu.jsxs=r,mu}var py;function Nx(){return py||(py=1,sm.exports=jx()),sm.exports}var s=Nx(),om={exports:{}},Ie={};/**
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 gy;function Sx(){if(gy)return Ie;gy=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),v=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),E=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),M=Symbol.for("react.view_transition"),$=Symbol.iterator;function L(D){return D===null||typeof D!="object"?null:(D=$&&D[$]||D["@@iterator"],typeof D=="function"?D:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,_={};function W(D,Y,ue){this.props=D,this.context=Y,this.refs=_,this.updater=ue||I}W.prototype.isReactComponent={},W.prototype.setState=function(D,Y){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,Y,"setState")},W.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function X(){}X.prototype=W.prototype;function ne(D,Y,ue){this.props=D,this.context=Y,this.refs=_,this.updater=ue||I}var te=ne.prototype=new X;te.constructor=ne,k(te,W.prototype),te.isPureReactComponent=!0;var ie=Array.isArray;function le(){}var he={H:null,A:null,T:null,S:null},ce=Object.prototype.hasOwnProperty;function pe(D,Y,ue){var ge=ue.ref;return{$$typeof:n,type:D,key:Y,ref:ge!==void 0?ge:null,props:ue}}function we(D,Y){return pe(D.type,Y,D.props)}function Ze(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function Ce(D){var Y={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ue){return Y[ue]})}var Nt=/\/+/g;function at(D,Y){return typeof D=="object"&&D!==null&&D.key!=null?Ce(""+D.key):Y.toString(36)}function me(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(le,le):(D.status="pending",D.then(function(Y){D.status==="pending"&&(D.status="fulfilled",D.value=Y)},function(Y){D.status==="pending"&&(D.status="rejected",D.reason=Y)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ke(D,Y,ue,ge,De){var He=typeof D;(He==="undefined"||He==="boolean")&&(D=null);var G=!1;if(D===null)G=!0;else switch(He){case"bigint":case"string":case"number":G=!0;break;case"object":switch(D.$$typeof){case n:case o:G=!0;break;case x:return G=D._init,ke(G(D._payload),Y,ue,ge,De)}}if(G)return De=De(D),G=ge===""?"."+at(D,0):ge,ie(De)?(ue="",G!=null&&(ue=G.replace(Nt,"$&/")+"/"),ke(De,Y,ue,"",function(Kt){return Kt})):De!=null&&(Ze(De)&&(De=we(De,ue+(De.key==null||D&&D.key===De.key?"":(""+De.key).replace(Nt,"$&/")+"/")+G)),Y.push(De)),1;G=0;var de=ge===""?".":ge+":";if(ie(D))for(var xe=0;xe<D.length;xe++)ge=D[xe],He=de+at(ge,xe),G+=ke(ge,Y,ue,He,De);else if(xe=L(D),typeof xe=="function")for(D=xe.call(D),xe=0;!(ge=D.next()).done;)ge=ge.value,He=de+at(ge,xe++),G+=ke(ge,Y,ue,He,De);else if(He==="object"){if(typeof D.then=="function")return ke(me(D),Y,ue,ge,De);throw Y=String(D),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return G}function $e(D,Y,ue){if(D==null)return D;var ge=[],De=0;return ke(D,ge,"","",function(He){return Y.call(ue,He,De++)}),ge}function qe(D){if(D._status===-1){var Y=D._result,ue=Y();ue.then(function(ge){(D._status===0||D._status===-1)&&(D._status=1,D._result=ge,ue.status===void 0&&(ue.status="fulfilled",ue.value=ge))},function(ge){(D._status===0||D._status===-1)&&(D._status=2,D._result=ge,ue.status===void 0&&(ue.status="rejected",ue.reason=ge))}),D._status===-1&&(D._status=0,D._result=ue)}if(D._status===1)return D._result.default;throw D._result}var fe=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function re(D){var Y=he.T,ue={};ue.types=Y!==null?Y.types:null,he.T=ue;try{var ge=D(),De=he.S;De!==null&&De(ue,ge),typeof ge=="object"&&ge!==null&&typeof ge.then=="function"&&ge.then(le,fe)}catch(He){fe(He)}finally{Y!==null&&ue.types!==null&&(Y.types=ue.types),he.T=Y}}function Fe(D){var Y=he.T;if(Y!==null){var ue=Y.types;ue===null?Y.types=[D]:ue.indexOf(D)===-1&&ue.push(D)}else re(Fe.bind(null,D))}var ht={map:$e,forEach:function(D,Y,ue){$e(D,function(){Y.apply(this,arguments)},ue)},count:function(D){var Y=0;return $e(D,function(){Y++}),Y},toArray:function(D){return $e(D,function(Y){return Y})||[]},only:function(D){if(!Ze(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ie.Activity=j,Ie.Children=ht,Ie.Component=W,Ie.Fragment=r,Ie.Profiler=m,Ie.PureComponent=ne,Ie.StrictMode=f,Ie.Suspense=N,Ie.ViewTransition=M,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=he,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(D){return he.H.useMemoCache(D)}},Ie.addTransitionType=Fe,Ie.cache=function(D){return function(){return D.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(D,Y,ue){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ge=k({},D.props),De=D.key;if(Y!=null)for(He in Y.key!==void 0&&(De=""+Y.key),Y)!ce.call(Y,He)||He==="key"||He==="__self"||He==="__source"||He==="ref"&&Y.ref===void 0||(ge[He]=Y[He]);var He=arguments.length-2;if(He===1)ge.children=ue;else if(1<He){for(var G=Array(He),de=0;de<He;de++)G[de]=arguments[de+2];ge.children=G}return pe(D.type,De,ge)},Ie.createContext=function(D){return D={$$typeof:v,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:p,_context:D},D},Ie.createElement=function(D,Y,ue){var ge,De={},He=null;if(Y!=null)for(ge in Y.key!==void 0&&(He=""+Y.key),Y)ce.call(Y,ge)&&ge!=="key"&&ge!=="__self"&&ge!=="__source"&&(De[ge]=Y[ge]);var G=arguments.length-2;if(G===1)De.children=ue;else if(1<G){for(var de=Array(G),xe=0;xe<G;xe++)de[xe]=arguments[xe+2];De.children=de}if(D&&D.defaultProps)for(ge in G=D.defaultProps,G)De[ge]===void 0&&(De[ge]=G[ge]);return pe(D,He,De)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(D){return{$$typeof:S,render:D}},Ie.isValidElement=Ze,Ie.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:qe}},Ie.memo=function(D,Y){return{$$typeof:E,type:D,compare:Y===void 0?null:Y}},Ie.startTransition=re,Ie.unstable_useCacheRefresh=function(){return he.H.useCacheRefresh()},Ie.use=function(D){return he.H.use(D)},Ie.useActionState=function(D,Y,ue){return he.H.useActionState(D,Y,ue)},Ie.useCallback=function(D,Y){return he.H.useCallback(D,Y)},Ie.useContext=function(D){return he.H.useContext(D)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(D,Y){return he.H.useDeferredValue(D,Y)},Ie.useEffect=function(D,Y){return he.H.useEffect(D,Y)},Ie.useEffectEvent=function(D){return he.H.useEffectEvent(D)},Ie.useId=function(){return he.H.useId()},Ie.useImperativeHandle=function(D,Y,ue){return he.H.useImperativeHandle(D,Y,ue)},Ie.useInsertionEffect=function(D,Y){return he.H.useInsertionEffect(D,Y)},Ie.useLayoutEffect=function(D,Y){return he.H.useLayoutEffect(D,Y)},Ie.useMemo=function(D,Y){return he.H.useMemo(D,Y)},Ie.useOptimistic=function(D,Y){return he.H.useOptimistic(D,Y)},Ie.useReducer=function(D,Y,ue){return he.H.useReducer(D,Y,ue)},Ie.useRef=function(D){return he.H.useRef(D)},Ie.useState=function(D){return he.H.useState(D)},Ie.useSyncExternalStore=function(D,Y,ue){return he.H.useSyncExternalStore(D,Y,ue)},Ie.useTransition=function(){return he.H.useTransition()},Ie.version="19.3.0",Ie}var yy;function Hm(){return yy||(yy=1,om.exports=Sx()),om.exports}var b=Hm(),im={exports:{}},pu={},cm={exports:{}},rm={};/**
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 by;function kx(){return by||(by=1,(function(n){function o(me,ke){var $e=me.length;me.push(ke);e:for(;0<$e;){var qe=$e-1>>>1,fe=me[qe];if(0<m(fe,ke))me[qe]=ke,me[$e]=fe,$e=qe;else break e}}function r(me){return me.length===0?null:me[0]}function f(me){if(me.length===0)return null;var ke=me[0],$e=me.pop();if($e!==ke){me[0]=$e;e:for(var qe=0,fe=me.length,re=fe>>>1;qe<re;){var Fe=2*(qe+1)-1,ht=me[Fe],D=Fe+1,Y=me[D];if(0>m(ht,$e))D<fe&&0>m(Y,ht)?(me[qe]=Y,me[D]=$e,qe=D):(me[qe]=ht,me[Fe]=$e,qe=Fe);else if(D<fe&&0>m(Y,$e))me[qe]=Y,me[D]=$e,qe=D;else break e}}return ke}function m(me,ke){var $e=me.sortIndex-ke.sortIndex;return $e!==0?$e:me.id-ke.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var p=performance;n.unstable_now=function(){return p.now()}}else{var v=Date,S=v.now();n.unstable_now=function(){return v.now()-S}}var N=[],E=[],x=1,j=null,M=3,$=!1,L=!1,I=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function ne(me){for(var ke=r(E);ke!==null;){if(ke.callback===null)f(E);else if(ke.startTime<=me)f(E),ke.sortIndex=ke.expirationTime,o(N,ke);else break;ke=r(E)}}function te(me){if(I=!1,ne(me),!L)if(r(N)!==null)L=!0,ie||(ie=!0,Ze());else{var ke=r(E);ke!==null&&at(te,ke.startTime-me)}}var ie=!1,le=-1,he=5,ce=-1;function pe(){return k?!0:!(n.unstable_now()-ce<he)}function we(){if(k=!1,ie){var me=n.unstable_now();ce=me;var ke=!0;try{e:{L=!1,I&&(I=!1,W(le),le=-1),$=!0;var $e=M;try{t:{for(ne(me),j=r(N);j!==null&&!(j.expirationTime>me&&pe());){var qe=j.callback;if(typeof qe=="function"){j.callback=null,M=j.priorityLevel;var fe=qe(j.expirationTime<=me);if(me=n.unstable_now(),typeof fe=="function"){j.callback=fe,ne(me),ke=!0;break t}j===r(N)&&f(N),ne(me)}else f(N);j=r(N)}if(j!==null)ke=!0;else{var re=r(E);re!==null&&at(te,re.startTime-me),ke=!1}}break e}finally{j=null,M=$e,$=!1}ke=void 0}}finally{ke?Ze():ie=!1}}}var Ze;if(typeof X=="function")Ze=function(){X(we)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,Nt=Ce.port2;Ce.port1.onmessage=we,Ze=function(){Nt.postMessage(null)}}else Ze=function(){_(we,0)};function at(me,ke){le=_(function(){me(n.unstable_now())},ke)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(me){me.callback=null},n.unstable_forceFrameRate=function(me){0>me||125<me?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):he=0<me?Math.floor(1e3/me):5},n.unstable_getCurrentPriorityLevel=function(){return M},n.unstable_next=function(me){switch(M){case 1:case 2:case 3:var ke=3;break;default:ke=M}var $e=M;M=ke;try{return me()}finally{M=$e}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(me,ke){switch(me){case 1:case 2:case 3:case 4:case 5:break;default:me=3}var $e=M;M=me;try{return ke()}finally{M=$e}},n.unstable_scheduleCallback=function(me,ke,$e){var qe=n.unstable_now();switch(typeof $e=="object"&&$e!==null?($e=$e.delay,$e=typeof $e=="number"&&0<$e?qe+$e:qe):$e=qe,me){case 1:var fe=-1;break;case 2:fe=250;break;case 5:fe=1073741823;break;case 4:fe=1e4;break;default:fe=5e3}return fe=$e+fe,me={id:x++,callback:ke,priorityLevel:me,startTime:$e,expirationTime:fe,sortIndex:-1},$e>qe?(me.sortIndex=$e,o(E,me),r(N)===null&&me===r(E)&&(I?(W(le),le=-1):I=!0,at(te,$e-qe))):(me.sortIndex=fe,o(N,me),L||$||(L=!0,ie||(ie=!0,Ze()))),me},n.unstable_shouldYield=pe,n.unstable_wrapCallback=function(me){var ke=M;return function(){var $e=M;M=ke;try{return me.apply(this,arguments)}finally{M=$e}}}})(rm)),rm}var vy;function Tx(){return vy||(vy=1,cm.exports=kx()),cm.exports}var um={exports:{}},pa={};/**
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 xy;function Cx(){if(xy)return pa;xy=1;var n=Hm();function o(x){var j="https://react.dev/errors/"+x;if(1<arguments.length){j+="?args[]="+encodeURIComponent(arguments[1]);for(var M=2;M<arguments.length;M++)j+="&args[]="+encodeURIComponent(arguments[M])}return"Minified React error #"+x+"; visit "+j+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var f={d:{f:r,r:function(){throw Error(o(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},m=Symbol.for("react.portal"),p=Symbol.for("react.recoverable"),v=Symbol.for("react.optimistic_key");function S(x,j,M){var $=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:$==null?null:$===v?v:""+$,children:x,containerInfo:j,implementation:M}}var N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function E(x,j){if(x==="font")return"";if(typeof j=="string")return j==="use-credentials"?j:""}return pa.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=f,pa.browser=function(x){return{$$typeof:p,_reason:x}},pa.createPortal=function(x,j){var M=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!j||j.nodeType!==1&&j.nodeType!==9&&j.nodeType!==11)throw Error(o(299));return S(x,j,null,M)},pa.flushSync=function(x){var j=N.T,M=f.p;try{if(N.T=null,f.p=2,x)return x()}finally{N.T=j,f.p=M,f.d.f()}},pa.preconnect=function(x,j){typeof x=="string"&&(j?(j=j.crossOrigin,j=typeof j=="string"?j==="use-credentials"?j:"":void 0):j=null,f.d.C(x,j))},pa.prefetchDNS=function(x){typeof x=="string"&&f.d.D(x)},pa.preinit=function(x,j){if(typeof x=="string"&&j&&typeof j.as=="string"){var M=j.as,$=E(M,j.crossOrigin),L=typeof j.integrity=="string"?j.integrity:void 0,I=typeof j.fetchPriority=="string"?j.fetchPriority:void 0;M==="style"?f.d.S(x,typeof j.precedence=="string"?j.precedence:void 0,{crossOrigin:$,integrity:L,fetchPriority:I}):M==="script"&&f.d.X(x,{crossOrigin:$,integrity:L,fetchPriority:I,nonce:typeof j.nonce=="string"?j.nonce:void 0})}},pa.preinitModule=function(x,j){if(typeof x=="string")if(typeof j=="object"&&j!==null){if(j.as==null||j.as==="script"){var M=E(j.as,j.crossOrigin);f.d.M(x,{crossOrigin:M,integrity:typeof j.integrity=="string"?j.integrity:void 0,nonce:typeof j.nonce=="string"?j.nonce:void 0,fetchPriority:typeof j.fetchPriority=="string"?j.fetchPriority:void 0})}}else j==null&&f.d.M(x)},pa.preload=function(x,j){if(typeof x=="string"&&typeof j=="object"&&j!==null&&typeof j.as=="string"){var M=j.as,$=E(M,j.crossOrigin);f.d.L(x,M,{crossOrigin:$,integrity:typeof j.integrity=="string"?j.integrity:void 0,nonce:typeof j.nonce=="string"?j.nonce:void 0,type:typeof j.type=="string"?j.type:void 0,fetchPriority:typeof j.fetchPriority=="string"?j.fetchPriority:void 0,referrerPolicy:typeof j.referrerPolicy=="string"?j.referrerPolicy:void 0,imageSrcSet:typeof j.imageSrcSet=="string"?j.imageSrcSet:void 0,imageSizes:typeof j.imageSizes=="string"?j.imageSizes:void 0,media:typeof j.media=="string"?j.media:void 0})}},pa.preloadModule=function(x,j){if(typeof x=="string")if(j){var M=E(j.as,j.crossOrigin);f.d.m(x,{as:typeof j.as=="string"&&j.as!=="script"?j.as:void 0,crossOrigin:M,integrity:typeof j.integrity=="string"?j.integrity:void 0,nonce:typeof j.nonce=="string"?j.nonce:void 0,fetchPriority:typeof j.fetchPriority=="string"?j.fetchPriority:void 0})}else f.d.m(x)},pa.requestFormReset=function(x){f.d.r(x)},pa.unstable_batchedUpdates=function(x,j){return x(j)},pa.useFormState=function(x,j,M){return N.H.useFormState(x,j,M)},pa.useFormStatus=function(){return N.H.useHostTransitionStatus()},pa.version="19.3.0",pa}var wy;function pb(){if(wy)return um.exports;wy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),um.exports=Cx(),um.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 jy;function Ex(){if(jy)return pu;jy=1;var n=Tx(),o=Hm(),r=pb();function f(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 m(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function p(e){for(var t=e,a=t;a&&!a.alternate;)t=a,(t.flags&4098)!==0&&(e=t.return),a=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 S(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 E(e){var t=e.alternate;if(!t){if(t=p(e),t===null)throw Error(f(188));return t!==e?null:e}for(var a=e,l=t;;){var c=a.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){a=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===a)return N(c),e;if(u===l)return N(c),t;u=u.sibling}throw Error(f(188))}if(a.return!==l.return)a=c,l=u;else{for(var y=!1,C=c.child;C;){if(C===a){y=!0,a=c,l=u;break}if(C===l){y=!0,l=c,a=u;break}C=C.sibling}if(!y){for(C=u.child;C;){if(C===a){y=!0,a=u,l=c;break}if(C===l){y=!0,l=u,a=c;break}C=C.sibling}if(!y)throw Error(f(189))}}if(a.alternate!==l)throw Error(f(190))}if(a.tag!==3)throw Error(f(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}function j(e,t,a,l,c,u){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&a(e,l,c,u)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&j(e.child,t,a,l,c,u))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 $(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 L(e){var t=[null,null],a=M(e);return a===null||I(t,e,a.child,{foundSelf:!1}),t}function I(e,t,a,l){for(;a!==null;){if(a===t)l.foundSelf=!0;else if(a.tag===5||a.tag===27||a.tag===6){if(l.foundSelf)return e[1]=a,!0;e[0]=a}else if((a.tag!==22||a.memoizedState===null)&&I(e,t,a.child,l))return!0;a=a.sibling}return!1}function k(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 _=null,W=null;function X(e,t,a){return e===a?!0:e===t?(_=e,!0):!1}function ne(e,t,a){return e===a?(W=e,!1):e===t?(W!==null&&(_=e),!0):!1}function te(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,a){for(var l=0,c=e;c;c=a(c))l++;c=0;for(var u=t;u;u=a(u))c++;for(;0<l-c;)e=a(e),l--;for(;0<c-l;)t=a(t),c--;for(;l--;){if(e===t||t!==null&&e===t.alternate)return e;e=a(e),t=a(t)}return null}var le=Object.assign,he=Symbol.for("react.element"),ce=Symbol.for("react.transitional.element"),pe=Symbol.for("react.portal"),we=Symbol.for("react.fragment"),Ze=Symbol.for("react.strict_mode"),Ce=Symbol.for("react.profiler"),Nt=Symbol.for("react.consumer"),at=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),ke=Symbol.for("react.suspense"),$e=Symbol.for("react.suspense_list"),qe=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),Fe=Symbol.for("react.legacy_hidden"),ht=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),Y=Symbol.for("react.recoverable"),ue=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var De=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===De?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case we:return"Fragment";case Ce:return"Profiler";case Ze:return"StrictMode";case ke:return"Suspense";case $e:return"SuspenseList";case re:return"Activity";case D:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case pe:return"Portal";case at:return e.displayName||"Context";case Nt:return(e._context.displayName||"Context")+".Consumer";case me:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case qe:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case fe:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var G=Array.isArray,de=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Kt={pending:!1,data:null,method:null,action:null},Ge=[],Wt=-1;function Zt(e){return{current:e}}function rt(e){0>Wt||(e.current=Ge[Wt],Ge[Wt]=null,Wt--)}function Ye(e,t){Wt++,Ge[Wt]=e.current,e.current=t}var mn=Zt(null),en=Zt(null),Pn=Zt(null),ut=Zt(null);function Gn(e,t){switch(Ye(Pn,t),Ye(en,e),Ye(mn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?jg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=jg(t),e=Ng(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}rt(mn),Ye(mn,e)}function B(){rt(mn),rt(en),rt(Pn)}function K(e){var t=e.memoizedState;t!==null&&(sr._currentValue=t.memoizedState,Ye(ut,e)),t=mn.current;var a=Ng(t,e.type);t!==a&&(Ye(en,e),Ye(mn,a))}function ae(e){en.current===e&&(rt(mn),rt(en)),ut.current===e&&(rt(ut),sr._currentValue=Kt)}var Oe,Le;function tt(e){if(Oe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Oe=t&&t[1]||"",Le=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Oe+e+Le}var mt=!1;function vt(e,t){if(!e||mt)return"";mt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Ee){var U=Ee}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(Ee){U=Ee}oe=!1;try{var Q=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),oe=!0,new e}finally{oe&&(Q!==void 0?Object.defineProperty(e.prototype,"props",Q):delete e.prototype.props)}}}else{try{throw Error()}catch(Ee){U=Ee}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Ee){if(Ee&&U&&typeof Ee.stack=="string")return[Ee.stack,U.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),y=u[0],C=u[1];if(y&&C){var O=y.split(`
44
+ `),V=C.split(`
45
+ `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<V.length&&!V[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===V.length)for(l=O.length-1,c=V.length-1;1<=l&&0<=c&&O[l]!==V[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==V[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==V[c]){var J=`
46
+ `+O[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=c);break}}}finally{mt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?tt(a):""}function rn(e,t){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==t&&t!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return vt(e.type,!1);case 11:return vt(e.type.render,!1);case 1:return vt(e.type,!0);case 31:return tt("Activity");case 30:return tt("ViewTransition");default:return""}}function tn(e){try{var t="",a=null;do t+=rn(e,a),a=e,e=e.return;while(e);return t}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var It=Object.prototype.hasOwnProperty,Yn=n.unstable_scheduleCallback,Qe=n.unstable_cancelCallback,Mn=n.unstable_shouldYield,ln=n.unstable_requestPaint,st=n.unstable_now,St=n.unstable_getCurrentPriorityLevel,$t=n.unstable_ImmediatePriority,Ct=n.unstable_UserBlockingPriority,cl=n.unstable_NormalPriority,rl=n.unstable_LowPriority,io=n.unstable_IdlePriority,ii=n.log,va=n.unstable_setDisableYieldValue,ul=null,ia=null;function Ta(e){if(typeof ii=="function"&&va(e),ia&&typeof ia.setStrictMode=="function")try{ia.setStrictMode(ul,e)}catch{}}var pn=Math.clz32?Math.clz32:Os,xa=Math.log,ts=Math.LN2;function Os(e){return e>>>=0,e===0?32:31-(xa(e)/ts|0)|0}var ns=256,Qa=262144,Rs=4194304;function Ht(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 as(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var C=l&134217727;return C!==0?(l=C&~u,l!==0?c=Ht(l):(y&=C,y!==0?c=Ht(y):a||(a=C&~e,a!==0&&(c=Ht(a))))):(C=l&~u,C!==0?c=Ht(C):y!==0?c=Ht(y):a||(a=l&~e,a!==0&&(c=Ht(a)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:c}function kt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fi(e,t){(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-pn(a),c=1<<l;t|=e[l],a&=~c}return t}function Ou(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 Et(){var e=Rs;return Rs<<=1,(Rs&62914560)===0&&(Rs=4194304),e}function Oa(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function z(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function P(e,t,a,l,c,u){var y=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var C=e.entanglements,O=e.expirationTimes,V=e.hiddenUpdates;for(a=y&~a;0<a;){var J=31-pn(a),oe=1<<J;C[J]=0,O[J]=-1;var U=V[J];if(U!==null)for(V[J]=null,J=0;J<U.length;J++){var Q=U[J];Q!==null&&(Q.lane&=-536870913)}a&=~oe}l!==0&&_e(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(y&~t))}function _e(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-pn(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function ye(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-pn(a),c=1<<l;c&t|e[l]&t&&(e[l]|=t),a&=~c}}function Me(e,t){var a=t&-t;return a=(a&42)!==0?1:Lt(a),(a&(e.suspendedLanes|t))!==0?0:a}function Lt(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 Ve(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function sn(){var e=xe.p;return e!==0?e:(e=window.event,e===void 0?32:oy(e.type))}function Ra(e,t){var a=xe.p;try{return xe.p=e,t()}finally{xe.p=a}}var Ot=Math.random().toString(36).slice(2),nn="__reactFiber$"+Ot,Jn="__reactProps$"+Ot,ls="__reactContainer$"+Ot,ci="__reactEvents$"+Ot,Ru="__reactListeners$"+Ot,An="__reactHandles$"+Ot,Al="__reactResources$"+Ot,co="__reactMarker$"+Ot,ri="__reactLoad$"+Ot;function Qi(e){delete e[nn],delete e[Jn],delete e[Ru],delete e[An]}function ss(e){var t;if(t=e[nn])return t;for(var a=e.parentNode;a;){if(t=a[ls]||a[nn]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Ug(e);e!==null;){if(a=e[nn])return a;e=Ug(e)}return t}e=a,a=e.parentNode}return null}function zl(e){if(e=e[nn]||e[ls]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ui(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(f(33))}function $l(e){var t=e[Al];return t||(t=e[Al]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Xn(e){e[co]=!0}function dr(e){e[ri]=void 0}var Pi=new Set,dl={};function Pa(e,t){Ds(e,t),Ds(e+"Capture",t)}function Ds(e,t){for(dl[e]=t,e=0;e<t.length;e++)Pi.add(t[e])}var kf=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]*$"),di={},os={};function na(e){return It.call(os,e)?!0:It.call(di,e)?!1:kf.test(e)?os[e]=!0:(di[e]=!0,!1)}var ot=!1;function is(){var e=ot;return ot=!1,e}function fi(e,t,a){if(na(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,a)}}function hi(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,a)}}function fl(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,l)}}function Rt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ol(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Du(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){a=""+y,u.call(this,y)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function hl(e){if(!e._valueTracker){var t=Ol(e)?"checked":"value";e._valueTracker=Du(e,t,""+e[t])}}function Rl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Ol(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}var fr=/[\n"\\]/g;function Ln(e){return e.replace(fr,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ji(e,t,a,l,c,u,y,C){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rt(t)):e.value!==""+Rt(t)&&(e.value=""+Rt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?y==="number"&&e.value==t?Wi(e,Rt(e.value)):Wi(e,Rt(t)):a!=null?Wi(e,Rt(a)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Rt(C):e.removeAttribute("name")}function Ii(e,t,a,l,c,u,y,C){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){hl(e);return}a=a!=null?""+Rt(a):"",t=t!=null?""+Rt(t):a,C||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=C?e.checked:!!l,e.defaultChecked=!!l,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),hl(e)}function Wi(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Bs(e,t,a,l){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Rt(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function hr(e,t,a){if(t!=null&&(t=""+Rt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Rt(a):""}function ro(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(f(92));if(G(l)){if(1<l.length)throw Error(f(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=Rt(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),hl(e)}function uo(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var mi=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 ml(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||mi.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Hs(e,t,a){if(t!=null&&typeof t!="object")throw Error(f(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="",ot=!0);for(var c in t)l=t[c],t.hasOwnProperty(c)&&a[c]!==l&&(ml(e,c,l),ot=!0)}else for(var u in t)t.hasOwnProperty(u)&&ml(e,u,t[u])}function lt(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 fo=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"]]),Tf=/^[\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 pi(e){return Tf.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Da(){}var ve=null;function In(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mt=null,Ls=null;function cs(e){var t=zl(e);if(t&&(e=t.stateNode)){var a=e[Jn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ji(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ln(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var c=l[Jn]||null;if(!c)throw Error(f(90));Ji(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Rl(l)}break e;case"textarea":hr(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Bs(e,!!a.multiple,t,!1)}}}var ho=!1;function mo(e,t,a){if(ho)return e(t,a);ho=!0;try{var l=e(t);return l}finally{if(ho=!1,(Mt!==null||Ls!==null)&&(Dd(),Mt&&(t=Mt,e=Ls,Ls=Mt=null,cs(t),e)))for(t=0;t<e.length;t++)cs(e[t])}}function po(e,t){var a=e.stateNode;if(a===null)return null;var l=a[Jn]||null;if(l===null)return null;a=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(f(231,t,typeof a));return a}var Dl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mr=!1;if(Dl)try{var Bl={};Object.defineProperty(Bl,"passive",{get:function(){mr=!0}}),window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch{mr=!1}var zn=null,_s=null,on=null;function pr(){if(on)return on;var e,t=_s,a=t.length,l,c="value"in zn?zn.value:zn.textContent,u=c.length;for(e=0;e<a&&t[e]===c[e];e++);var y=a-e;for(l=1;l<=y&&t[a-l]===c[u-l];l++);return on=c.slice(e,1<l?1-l:void 0)}function rs(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 ca(){return!0}function gi(){return!1}function nt(e){function t(a,l,c,u,y){this._reactName=a,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=y,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(a=e[C],this[C]=a?a(u):u[C]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ca:gi,this.isPropagationStopped=gi,this}return le(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ca)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ca)},persist:function(){},isPersistent:ca}),t}var At={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ja=nt(At),Ca=le({},At,{view:0,detail:0}),Bu=nt(Ca),go,ec,Ea,tc=le({},Ca,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sc,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!==Ea&&(Ea&&e.type==="mousemove"?(go=e.screenX-Ea.screenX,ec=e.screenY-Ea.screenY):ec=go=0,Ea=e),go)},movementY:function(e){return"movementY"in e?e.movementY:ec}}),pl=nt(tc),us=le({},tc,{dataTransfer:0}),Cf=nt(us),Hu=le({},Ca,{relatedTarget:0}),nc=nt(Hu),Lu=le({},At,{animationName:0,elapsedTime:0,pseudoElement:0}),_u=nt(Lu),gr=le({},At,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yr=nt(gr),Ef=le({},At,{data:0}),ac=nt(Ef),Uu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lc={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"},Ba={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qu(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ba[e])?!!t[e]:!1}function sc(){return qu}var br=le({},Ca,{key:function(e){if(e.key){var t=Uu[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?lc[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sc,charCode:function(e){return e.type==="keypress"?rs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vu=nt(br),Mf=le({},tc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gn=nt(Mf),gl=le({},At,{submitter:0}),$n=nt(gl),yn=le({},Ca,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sc}),Gu=nt(yn),Ha=le({},At,{propertyName:0,elapsedTime:0,pseudoElement:0}),Yu=nt(Ha),Xu=le({},tc,{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}),Ku=nt(Xu),Zu=le({},At,{newState:0,oldState:0,source:0}),Us=nt(Zu),je=[9,13,27,32],oc=Dl&&"CompositionEvent"in window,qs=null;Dl&&"documentMode"in document&&(qs=document.documentMode);var We=Dl&&"TextEvent"in window&&!qs,un=Dl&&(!oc||qs&&8<qs&&11>=qs),ds=" ",gt=!1;function ic(e,t){switch(e){case"keyup":return je.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jn(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yo=!1;function Af(e,t){switch(e){case"compositionend":return jn(t);case"keypress":return t.which!==32?null:(gt=!0,ds);case"textInput":return e=t.data,e===ds&&gt?null:e;default:return null}}function yl(e,t){if(yo)return e==="compositionend"||!oc&&ic(e,t)?(e=pr(),on=_s=zn=null,yo=!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 un&&t.locale!=="ko"?null:t.data;default:return null}}var zf={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 vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!zf[e.type]:t==="textarea"}function xr(e,t,a,l){Mt?Ls?Ls.push(l):Ls=[l]:Mt=l,t=qd(t,"onChange"),0<t.length&&(a=new Ja("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var yi=null,Hl=null;function fs(e){gg(e,0)}function Ll(e){var t=ui(e);if(Rl(t))return e}function cc(e,t){if(e==="change")return t}var Ia=!1;if(Dl){var Vs;if(Dl){var bo="oninput"in document;if(!bo){var bi=document.createElement("div");bi.setAttribute("oninput","return;"),bo=typeof bi.oninput=="function"}Vs=bo}else Vs=!1;Ia=Vs&&(!document.documentMode||9<document.documentMode)}function rc(){yi&&(yi.detachEvent("onpropertychange",vi),Hl=yi=null)}function vi(e){if(e.propertyName==="value"&&Ll(Hl)){var t=[];xr(t,Hl,e,In(e)),mo(fs,t)}}function Fu(e,t,a){e==="focusin"?(rc(),yi=t,Hl=a,yi.attachEvent("onpropertychange",vi)):e==="focusout"&&rc()}function $f(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ll(Hl)}function Of(e,t){if(e==="click")return Ll(t)}function hs(e,t){if(e==="input"||e==="change")return Ll(t)}function vo(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bn=typeof Object.is=="function"?Object.is:vo;function wa(e,t){if(bn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var c=a[l];if(!It.call(t,c)||!bn(e[c],t[c]))return!1}return!0}function uc(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 xo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qu(e,t){var a=xo(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=xo(a)}}function Pu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=uc(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=uc(e.document)}return t}function xi(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 Ju=Dl&&"documentMode"in document&&11>=document.documentMode,_l=null,dc=null,La=null,wr=!1;function wi(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wr||_l==null||_l!==uc(l)||(l=_l,"selectionStart"in l&&xi(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),La&&wa(La,l)||(La=l,l=qd(dc,"onSelect"),0<l.length&&(t=new Ja("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=_l)))}function Gs(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Ys={animationend:Gs("Animation","AnimationEnd"),animationiteration:Gs("Animation","AnimationIteration"),animationstart:Gs("Animation","AnimationStart"),transitionrun:Gs("Transition","TransitionRun"),transitionstart:Gs("Transition","TransitionStart"),transitioncancel:Gs("Transition","TransitionCancel"),transitionend:Gs("Transition","TransitionEnd")},ji={},jo={};Dl&&(jo=document.createElement("div").style,"AnimationEvent"in window||(delete Ys.animationend.animation,delete Ys.animationiteration.animation,delete Ys.animationstart.animation),"TransitionEvent"in window||delete Ys.transitionend.transition);function ja(e){if(ji[e])return ji[e];if(!Ys[e])return e;var t=Ys[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in jo)return ji[e]=t[a];return e}var jr=ja("animationend"),Nr=ja("animationiteration"),Sr=ja("animationstart"),fc=ja("transitionrun"),hc=ja("transitionstart"),mc=ja("transitioncancel"),Iu=ja("transitionend"),kr=new Map,ms="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(" ");ms.push("scrollEnd");function _a(e,t){kr.set(e,t),Pa(t,[e])}var Rf=0;function Ul(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Il.identifierPrefix;var a=Rf++;return e="_"+e+"t_"+a.toString(32)+"_",t.autoName=e}function pc(e){if(e==null||typeof e=="string")return e;var t=null,a=Qc;if(a!==null)for(var l=0;l<a.length;l++){var c=e[a[l]];if(c!=null){if(c==="none")return"none";t=t==null?c:t+(" "+c)}}return t??e.default}function bl(e,t){return e=pc(e),t=pc(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var ps=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)},Ma=[],No=0,So=0;function Xs(){for(var e=No,t=So=No=0;t<e;){var a=Ma[t];Ma[t++]=null;var l=Ma[t];Ma[t++]=null;var c=Ma[t];Ma[t++]=null;var u=Ma[t];if(Ma[t++]=null,l!==null&&c!==null){var y=l.pending;y===null?c.next=c:(c.next=y.next,y.next=c),l.pending=c}u!==0&&Ni(a,c,u)}}function ko(e,t,a,l){Ma[No++]=e,Ma[No++]=t,Ma[No++]=a,Ma[No++]=l,So|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function gc(e,t,a,l){return ko(e,t,a,l),ys(e)}function gs(e,t){return ko(e,null,null,t),ys(e)}function Ni(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var c=!1,u=e.return;u!==null;)u.childLanes|=a,l=u.alternate,l!==null&&(l.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-pn(a),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=a|536870912),u):null}function ys(e){if(50<nu)throw nu=0,Rd=null,Error(f(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ql={};function yc(e,t,a,l){this.tag=e,this.key=a,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Na(e,t,a,l){return new yc(e,t,a,l)}function bc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ua(e,t){var a=e.alternate;return a===null?(a=Na(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&1206910976,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Wu(e,t){e.flags&=1206910978;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function vc(e,t,a,l,c,u){var y=0;if(l=e,typeof l=="function")bc(l)&&(y=1);else if(typeof l=="string")y=ix(e,a,mn.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(l){case re:return e=Na(31,a,t,c),e.elementType=re,e.lanes=u,e;case we:return Vl(a.children,c,u,t);case Ze:y=8,c|=24;break;case Ce:return e=Na(12,a,t,c|2),e.elementType=Ce,e.lanes=u,e;case ke:return e=Na(13,a,t,c),e.elementType=ke,e.lanes=u,e;case $e:return e=Na(19,a,t,c),e.elementType=$e,e.lanes=u,e;case Fe:case D:return e=c|32,e=Na(30,a,t,e),e.elementType=D,e.lanes=u,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case at:y=10;break e;case Nt:y=9;break e;case me:y=11;break e;case qe:y=14;break e;case fe:y=16,l=null;break e}y=29,a=Error(f(130,e===null?"null":typeof e,"")),l=null}return t=Na(y,a,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function Vl(e,t,a,l){return e=Na(7,e,l,t),e.lanes=a,e}function To(e,t,a){return e=Na(6,e,null,t),e.lanes=a,e}function ed(e){var t=Na(18,null,null,0);return t.stateNode=e,t}function xc(e,t,a){return t=Na(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Tr=new WeakMap;function Sa(e,t){if(typeof e=="object"&&e!==null){var a=Tr.get(e);return a!==void 0?a:(t={value:e,source:t,stack:tn(t)},Tr.set(e,t),t)}return{value:e,source:t,stack:tn(t)}}var Ks=[],Co=0,Gl=null,Eo=0,_n=[],On=0,Zs=null,qa=1,Nn="";function ra(e,t){Ks[Co++]=Eo,Ks[Co++]=Gl,Gl=e,Eo=t}function bs(e,t,a){_n[On++]=qa,_n[On++]=Nn,_n[On++]=Zs,Zs=e;var l=qa;e=Nn;var c=32-pn(l)-1;l&=~(1<<c),a+=1;var u=32-pn(t)+c;if(30<u){var y=c-c%5;u=(l&(1<<y)-1).toString(32),l>>=y,c-=y,qa=1<<32-pn(t)+c|a<<c|l,Nn=u+e}else qa=1<<u|a<<c|l,Nn=e}function Mo(e){e.return!==null&&(ra(e,1),bs(e,1,0))}function wc(e){for(;e===Gl;)Gl=Ks[--Co],Ks[Co]=null,Eo=Ks[--Co],Ks[Co]=null;for(;e===Zs;)Zs=_n[--On],_n[On]=null,Nn=_n[--On],_n[On]=null,qa=_n[--On],_n[On]=null}function Ao(e,t){_n[On++]=qa,_n[On++]=Nn,_n[On++]=Zs,qa=t.id,Nn=t.overflow,Zs=e}var Un=null,pt=null,Pe=!1,Kn=null,aa=!1,jc=Error(f(519));function Yl(e){var t=Error(f(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Si(Sa(t,e)),jc}function td(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[nn]=e,t[Jn]=l,a){case"dialog":bt("cancel",t),bt("close",t);break;case"iframe":case"object":case"embed":bt("load",t);break;case"video":case"audio":for(a=0;a<lu.length;a++)bt(lu[a],t);break;case"source":bt("error",t);break;case"img":case"image":case"link":bt("error",t),bt("load",t);break;case"details":bt("toggle",t);break;case"input":bt("invalid",t),Ii(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":bt("invalid",t);break;case"textarea":bt("invalid",t),ro(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||xg(t.textContent,a)?(l.popover!=null&&(bt("beforetoggle",t),bt("toggle",t)),l.onScroll!=null&&bt("scroll",t),l.onScrollEnd!=null&&bt("scrollend",t),l.onClick!=null&&(t.onclick=Da),t=!0):t=!1,t||Yl(e,!0)}function Nc(e){for(Un=e.return;Un;)switch(Un.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:Un=Un.return}}function zo(e){if(e!==Un)return!1;if(!Pe)return Nc(e),Pe=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||_h(e.type,e.memoizedProps)),a=!a),a&&pt&&Yl(e),Nc(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));pt=_g(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));pt=_g(e)}else t===27?(t=pt,Jo(e.type)?(e=Fh,Fh=null,pt=e):pt=t):pt=Un?Tl(e.stateNode.nextSibling):null;return!0}function vs(){pt=Un=null,Pe=!1}function nd(){var e=Kn;return e!==null&&(Ka===null?Ka=e:Ka.push.apply(Ka,e),Kn=null),e}function Si(e){Kn===null?Kn=[e]:Kn.push(e)}var $o=Zt(null),Fs=null,Xl=null;function Kl(e,t,a){Ye($o,t._currentValue),t._currentValue=a}function Sn(e){e._currentValue=$o.current,rt($o)}function ki(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Sc(e,t,a,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var y=c.child;u=u.firstContext;e:for(;u!==null;){var C=u;u=c;for(var O=0;O<t.length;O++)if(C.context===t[O]){u.lanes|=a,C=u.alternate,C!==null&&(C.lanes|=a),ki(u.return,a,e),l||(y=null);break e}u=C.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(f(341));y.lanes|=a,u=y.alternate,u!==null&&(u.lanes|=a),ki(y,a,e),y=null}else c.tag===13&&c.memoizedState!==null&&c.memoizedState.dehydrated===null?(c.lanes|=a,y=c.alternate,y!==null&&(y.lanes|=a),ki(c.return,a,e),y=c.child,y=y!==null?y.sibling:null):y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function xs(e,t,a,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(f(387));if(y=y.memoizedProps,y!==null){var C=c.type;bn(c.pendingProps.value,y.value)||(e!==null?e.push(C):e=[C])}}else if(c===ut.current){if(y=c.alternate,y===null)throw Error(f(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(sr):e=[sr])}c=c.return}return e!==null&&Sc(t,e,a,l),t.flags|=262144,e!==null}function kn(e){for(e=e.firstContext;e!==null;){if(!bn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ws(e){Fs=e,Xl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qn(e){return ad(Fs,e)}function kc(e,t){return Fs===null&&ws(e),ad(e,t)}function ad(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Xl===null){if(e===null)throw Error(f(308));Xl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xl=Xl.next=t;return a}var ld=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},sd=n.unstable_scheduleCallback,Df=n.unstable_NormalPriority,Tn={$$typeof:at,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cr(){return{controller:new ld,data:new Map,refCount:0}}function Ti(e){e.refCount--,e.refCount===0&&sd(Df,function(){e.controller.abort()})}function od(e,t){if((e.pendingLanes&4194048)!==0){var a=e.transitionTypes;for(a===null&&(a=e.transitionTypes=[]),e=0;e<t.length;e++){var l=t[e];a.indexOf(l)===-1&&a.push(l)}}}var Ci=null;function Bf(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Oo=null,Tc=0,vl=0,Qs=null;function id(e,t){if(Oo===null){var a=Oo=[];Tc=0,vl=Ah(),Qs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Tc++,t.then(Er,Er),t}function Er(){if(--Tc===0&&(Ci=null,Oo!==null)){Qs!==null&&(Qs.status="fulfilled");var e=Oo;Oo=null,vl=0,Qs=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Mr(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),l}var cd=de.S;de.S=function(e,t){if(Qp=st(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&id(e,t),Ci!==null)for(var a=Wc;a!==null;)od(a,Ci),a=a.next;if(a=e.types,a!==null){for(var l=Wc;l!==null;)od(l,a),l=l.next;if(vl!==0){l=Ci,l===null&&(l=Ci=[]);for(var c=0;c<a.length;c++){var u=a[c];l.indexOf(u)===-1&&l.push(u)}}}cd!==null&&cd(e,t)};var Ps=Zt(null);function Cc(){var e=Ps.current;return e!==null?e:an.pooledCache}function Ei(e,t){t===null?Ye(Ps,Ps.current):Ye(Ps,t.pool)}function Ar(){var e=Cc();return e===null?null:{parent:Tn._currentValue,pool:e}}var Js=Error(f(460)),zr=Error(f(474)),Ro=Error(f(542)),Ec={then:function(){}};function rd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function it(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Da,Da),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Or(e),e===void 0&&!("reason"in t)?Error(f(600)):e;default:if(typeof t.status=="string")t.then(Da,Da);else{if(e=an,e!==null&&100<e.shellSuspendCounter)throw Error(f(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Or(e),e}throw Is=t,Js}}function Wa(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Is=a,Js):a}}var Is=null;function $r(){if(Is===null)throw Error(f(459));var e=Is;return Is=null,e}function Or(e){if(e===Js||e===Ro)throw Error(f(483))}var Do=null,Tt=0;function Rn(e){var t=Tt;return Tt+=1,Do===null&&(Do=[]),it(Do,e,t)}function vn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xl(e,t){throw t.$$typeof===he?Error(f(525)):(e=Object.prototype.toString.call(t),Error(f(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Mc(e){function t(q,H){if(e){var Z=q.deletions;Z===null?(q.deletions=[H],q.flags|=16):Z.push(H)}}function a(q,H){if(!e)return null;for(;H!==null;)t(q,H),H=H.sibling;return null}function l(q){for(var H=new Map;q!==null;)q.key===null?H.set(q.index,q):H.set(q.key,q),q=q.sibling;return H}function c(q,H){return q=Ua(q,H),q.index=0,q.sibling=null,q}function u(q,H,Z){return q.index=Z,e?(Z=q.alternate,Z!==null?(Z=Z.index,Z<H?(q.flags|=2,H):Z):(q.flags|=134217730,H)):(q.flags|=1048576,H)}function y(q){return e&&q.alternate===null&&(q.flags|=134217730),q}function C(q,H,Z,se){return H===null||H.tag!==6?(H=To(Z,q.mode,se),H.return=q,H):(H=c(H,Z),H.return=q,H)}function O(q,H,Z,se){var Re=Z.type;return Re===we?(q=J(q,H,Z.props.children,se,Z.key),vn(q,Z),q):H!==null&&(H.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===fe&&Wa(Re)===H.type)?(H=c(H,Z.props),vn(H,Z),H.return=q,H):(H=vc(Z.type,Z.key,Z.props,null,q.mode,se),vn(H,Z),H.return=q,H)}function V(q,H,Z,se){return H===null||H.tag!==4||H.stateNode.containerInfo!==Z.containerInfo||H.stateNode.implementation!==Z.implementation?(H=xc(Z,q.mode,se),H.return=q,H):(H=c(H,Z.children||[]),H.return=q,H)}function J(q,H,Z,se,Re){return H===null||H.tag!==7?(H=Vl(Z,q.mode,se,Re),H.return=q,H):(H=c(H,Z),H.return=q,H)}function oe(q,H,Z){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=To(""+H,q.mode,Z),H.return=q,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case ce:return Z=vc(H.type,H.key,H.props,null,q.mode,Z),vn(Z,H),Z.return=q,Z;case pe:return H=xc(H,q.mode,Z),H.return=q,H;case fe:return H=Wa(H),oe(q,H,Z)}if(G(H)||ge(H))return H=Vl(H,q.mode,Z,null),H.return=q,H;if(typeof H.then=="function")return oe(q,Rn(H),Z);if(H.$$typeof===at)return oe(q,kc(q,H),Z);xl(q,H)}return null}function U(q,H,Z,se){var Re=H!==null?H.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Re!==null?null:C(q,H,""+Z,se);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case ce:return Z.key===Re?O(q,H,Z,se):null;case pe:return Z.key===Re?V(q,H,Z,se):null;case fe:return Z=Wa(Z),U(q,H,Z,se)}if(G(Z)||ge(Z))return Re!==null?null:J(q,H,Z,se,null);if(typeof Z.then=="function")return U(q,H,Rn(Z),se);if(Z.$$typeof===at)return U(q,H,kc(q,Z),se);xl(q,Z)}return null}function Q(q,H,Z,se,Re){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return q=q.get(Z)||null,C(H,q,""+se,Re);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case ce:return q=q.get(se.key===null?Z:se.key)||null,O(H,q,se,Re);case pe:return q=q.get(se.key===null?Z:se.key)||null,V(H,q,se,Re);case fe:return se=Wa(se),Q(q,H,Z,se,Re)}if(G(se)||ge(se))return q=q.get(Z)||null,J(H,q,se,Re,null);if(typeof se.then=="function")return Q(q,H,Z,Rn(se),Re);if(se.$$typeof===at)return Q(q,H,Z,kc(H,se),Re);xl(H,se)}return null}function Ee(q,H,Z,se){for(var Re=null,wt=null,Ue=H,Ke=H=0,Qn=null;Ue!==null&&Ke<Z.length;Ke++){Ue.index>Ke?(Qn=Ue,Ue=null):Qn=Ue.sibling;var zt=U(q,Ue,Z[Ke],se);if(zt===null){Ue===null&&(Ue=Qn);break}e&&Ue&&zt.alternate===null&&t(q,Ue),H=u(zt,H,Ke),wt===null?Re=zt:wt.sibling=zt,wt=zt,Ue=Qn}if(Ke===Z.length)return a(q,Ue),Pe&&ra(q,Ke),Re;if(Ue===null){for(;Ke<Z.length;Ke++)Ue=oe(q,Z[Ke],se),Ue!==null&&(H=u(Ue,H,Ke),wt===null?Re=Ue:wt.sibling=Ue,wt=Ue);return Pe&&ra(q,Ke),Re}for(Ue=l(Ue);Ke<Z.length;Ke++)Qn=Q(Ue,q,Ke,Z[Ke],se),Qn!==null&&(e&&(zt=Qn.alternate,zt!==null&&Ue.delete(zt.key===null?Ke:zt.key)),H=u(Qn,H,Ke),wt===null?Re=Qn:wt.sibling=Qn,wt=Qn);return e&&Ue.forEach(function(ni){return t(q,ni)}),Pe&&ra(q,Ke),Re}function Be(q,H,Z,se){if(Z==null)throw Error(f(151));for(var Re=null,wt=null,Ue=H,Ke=H=0,Qn=null,zt=Z.next();Ue!==null&&!zt.done;Ke++,zt=Z.next()){Ue.index>Ke?(Qn=Ue,Ue=null):Qn=Ue.sibling;var ni=U(q,Ue,zt.value,se);if(ni===null){Ue===null&&(Ue=Qn);break}e&&Ue&&ni.alternate===null&&t(q,Ue),H=u(ni,H,Ke),wt===null?Re=ni:wt.sibling=ni,wt=ni,Ue=Qn}if(zt.done)return a(q,Ue),Pe&&ra(q,Ke),Re;if(Ue===null){for(;!zt.done;Ke++,zt=Z.next())zt=oe(q,zt.value,se),zt!==null&&(H=u(zt,H,Ke),wt===null?Re=zt:wt.sibling=zt,wt=zt);return Pe&&ra(q,Ke),Re}for(Ue=l(Ue);!zt.done;Ke++,zt=Z.next())zt=Q(Ue,q,Ke,zt.value,se),zt!==null&&(e&&(Qn=zt.alternate,Qn!==null&&Ue.delete(Qn.key===null?Ke:Qn.key)),H=u(zt,H,Ke),wt===null?Re=zt:wt.sibling=zt,wt=zt);return e&&Ue.forEach(function(vx){return t(q,vx)}),Pe&&ra(q,Ke),Re}function ct(q,H,Z,se){if(typeof Z=="object"&&Z!==null&&Z.type===we&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case ce:e:{for(var Re=Z.key;H!==null;){if(H.key===Re){if(Re=Z.type,Re===we){if(H.tag===7){a(q,H.sibling),se=c(H,Z.props.children),vn(se,Z),se.return=q,q=se;break e}}else if(H.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===fe&&Wa(Re)===H.type){a(q,H.sibling),se=c(H,Z.props),vn(se,Z),se.return=q,q=se;break e}a(q,H);break}else t(q,H);H=H.sibling}Z.type===we?(se=Vl(Z.props.children,q.mode,se,Z.key),vn(se,Z),se.return=q,q=se):(se=vc(Z.type,Z.key,Z.props,null,q.mode,se),vn(se,Z),se.return=q,q=se)}return y(q);case pe:e:{for(Re=Z.key;H!==null;){if(H.key===Re)if(H.tag===4&&H.stateNode.containerInfo===Z.containerInfo&&H.stateNode.implementation===Z.implementation){a(q,H.sibling),se=c(H,Z.children||[]),se.return=q,q=se;break e}else{a(q,H);break}else t(q,H);H=H.sibling}se=xc(Z,q.mode,se),se.return=q,q=se}return y(q);case fe:return Z=Wa(Z),ct(q,H,Z,se)}if(G(Z))return Ee(q,H,Z,se);if(ge(Z)){if(Re=ge(Z),typeof Re!="function")throw Error(f(150));return Z=Re.call(Z),Be(q,H,Z,se)}if(typeof Z.then=="function")return ct(q,H,Rn(Z),se);if(Z.$$typeof===at)return ct(q,H,kc(q,Z),se);xl(q,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,H!==null&&H.tag===6?(a(q,H.sibling),se=c(H,Z),se.return=q,q=se):(a(q,H),se=To(Z,q.mode,se),se.return=q,q=se),y(q)):a(q,H)}return function(q,H,Z,se){try{Tt=0;var Re=ct(q,H,Z,se);return Do=null,Re}catch(Ue){if(Ue===Js||Ue===Ro)throw Ue;var wt=Na(29,Ue,null,q.mode);return wt.lanes=se,wt.return=q,wt}finally{}}}var wl=Mc(!0),Rr=Mc(!1),jl=!1;function Dr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mi(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 js(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Zl(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Gt&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ys(e),Ni(e,null,a),t}return ko(e,l,t,a),ys(e)}function Bo(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ye(e,a)}}function Br(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?c=u=y:u=u.next=y,a=a.next}while(a!==null);u===null?c=u=t:u=u.next=t}else c=u=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Ho=!1;function Ai(){if(Ho){var e=Qs;if(e!==null)throw e}}function Ns(e,t,a,l){Ho=!1;var c=e.updateQueue;jl=!1;var u=c.firstBaseUpdate,y=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var O=C,V=O.next;O.next=null,y===null?u=V:y.next=V,y=O;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=V:C.next=V,J.lastBaseUpdate=O))}if(u!==null){var oe=c.baseState;y=0,J=V=O=null,C=u;do{var U=C.lane&-536870913,Q=U!==C.lane;if(Q?(xt&U)===U:(l&U)===U){U!==0&&U===vl&&(Ho=!0),J!==null&&(J=J.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Ee=e,Be=C;U=t;var ct=a;switch(Be.tag){case 1:if(Ee=Be.payload,typeof Ee=="function"){oe=Ee.call(ct,oe,U);break e}oe=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Be.payload,U=typeof Ee=="function"?Ee.call(ct,oe,U):Ee,U==null)break e;oe=le({},oe,U);break e;case 2:jl=!0}}U=C.callback,U!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=c.callbacks,Q===null?c.callbacks=[U]:Q.push(U))}else Q={lane:U,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(V=J=Q,O=oe):J=J.next=Q,y|=U;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,c.lastBaseUpdate=Q,c.shared.pending=null}}while(!0);J===null&&(O=oe),c.baseState=O,c.firstBaseUpdate=V,c.lastBaseUpdate=J,u===null&&(c.shared.lanes=0),Zo|=y,e.lanes=y,e.memoizedState=oe}}function zi(e,t){if(typeof e!="function")throw Error(f(191,e));e.call(t)}function Hf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)zi(a[e],t)}var Va=Zt(null),$i=Zt(0);function Hr(e,t){e=lo,Ye($i,e),Ye(Va,t),lo=e|t.baseLanes}function Oi(){Ye($i,lo),Ye(Va,Va.current)}function el(){lo=$i.current,rt(Va),rt($i)}var Dn=Zt(null),Zn=null;function Nl(e){var t=e.alternate;Ye(Wn,Wn.current&1),Ye(Dn,e),Zn===null&&(t===null||Va.current!==null||t.memoizedState!==null)&&(Zn=e)}function Lo(e){Ye(Wn,Wn.current),Ye(Dn,e),Zn===null&&(Zn=e)}function ka(e){e.tag===22?(Ye(Wn,Wn.current),Ye(Dn,e),Zn===null&&(Zn=e)):Bn()}function Bn(){Ye(Wn,Wn.current),Ye(Dn,Dn.current)}function ua(e){rt(Dn),Zn===e&&(Zn=null),rt(Wn)}var Wn=Zt(0);function Ri(e,t){Ye(Dn,Dn.current),Ye(Wn,t)}function Ac(e){rt(Wn),rt(Dn),Zn===e&&(Zn=null)}function zc(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Kh(a)||Zh(a)))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 Fl=0,Je=null,_t=null,Cn=null,Di=!1,Ws=!1,_o=!1,Lr=0,Uo=0,eo=null,da=0;function dn(){throw Error(f(321))}function $c(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!bn(e[a],t[a]))return!1;return!0}function qo(e,t,a,l,c,u){return Fl=u,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,de.H=e===null||e.memoizedState===null?Jm:Im,_o=!1,u=a(l,c),_o=!1,Ws&&(u=Ur(t,a,l,c)),_r(e),u}function _r(e){de.H=md;var t=_t!==null&&_t.next!==null;if(Fl=0,Cn=_t=Je=null,Di=!1,Uo=0,eo=null,t)throw Error(f(300));e===null||Fn||(e=e.dependencies,e!==null&&kn(e)&&(Fn=!0))}function Ur(e,t,a,l){Je=e;var c=0;do{if(Ws&&(eo=null),Uo=0,Ws=!1,25<=c)throw Error(f(301));if(c+=1,Cn=_t=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}de.H=Fb,u=t(a,l)}while(Ws);return u}function ud(){var e=de.H,t=e.useState()[0];return t=typeof t.then=="function"?Vo(t):t,e=e.useState()[0],(_t!==null?_t.memoizedState:null)!==e&&(Je.flags|=1024),t}function Oc(){var e=Lr!==0;return Lr=0,e}function Rc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Dc(e){if(Di){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Di=!1}Fl=0,Cn=_t=Je=null,Ws=!1,Uo=Lr=0,eo=null}function la(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Je.memoizedState=Cn=e:Cn=Cn.next=e,Cn}function xn(){if(_t===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Cn===null?Je.memoizedState:Cn.next;if(t!==null)Cn=t,_t=e;else{if(e===null)throw Je.alternate===null?Error(f(467)):Error(f(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Cn===null?Je.memoizedState=Cn=e:Cn=Cn.next=e}return Cn}function Bi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(e){var t=Uo;return Uo+=1,eo===null&&(eo=[]),e=it(eo,e,t),t=Je,(Cn===null?t.memoizedState:Cn.next)===null&&(t=t.alternate,de.H=t===null||t.memoizedState===null?Jm:Im),e}function Hi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Vo(e);if(e.$$typeof===Y)return;if(e.$$typeof===at)return qn(e)}throw Error(f(438,String(e)))}function Bc(e){var t=null,a=Je.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=Je.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Bi(),Je.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=ht;return t.index++,a}function Sl(e,t){return typeof t=="function"?t(e):t}function Li(e){var t=xn();return Hc(t,_t,e)}function Hc(e,t,a){var l=e.queue;if(l===null)throw Error(f(311));l.lastRenderedReducer=a;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var y=c.next;c.next=u.next,u.next=y}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var C=y=null,O=null,V=t,J=!1;do{var oe=V.lane&-536870913;if(oe!==V.lane?(xt&oe)===oe:(Fl&oe)===oe){var U=V.revertLane;if(U===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),oe===vl&&(J=!0);else if((Fl&U)===U){V=V.next,U===vl&&(J=!0);continue}else oe={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},O===null?(C=O=oe,y=u):O=O.next=oe,Je.lanes|=U,Zo|=U;oe=V.action,_o&&a(u,oe),u=V.hasEagerState?V.eagerState:a(u,oe)}else U={lane:oe,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},O===null?(C=O=U,y=u):O=O.next=U,Je.lanes|=oe,Zo|=oe;V=V.next}while(V!==null&&V!==t);if(O===null?y=u:O.next=C,!bn(u,e.memoizedState)&&(Fn=!0,J&&(a=Qs,a!==null)))throw a;e.memoizedState=u,e.baseState=y,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Lc(e){var t=xn(),a=t.queue;if(a===null)throw Error(f(311));a.lastRenderedReducer=e;var l=a.dispatch,c=a.pending,u=t.memoizedState;if(c!==null){a.pending=null;var y=c=c.next;do u=e(u,y.action),y=y.next;while(y!==c);bn(u,t.memoizedState)||(Fn=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,l]}function qr(e,t,a){var l=Je,c=xn(),u=Pe;if(u){if(a===void 0)throw Error(f(407));a=a()}else a=t();var y=!bn((_t||c).memoizedState,a);if(y&&(c.memoizedState=a,Fn=!0),c=c.queue,Ft(Yr.bind(null,l,c,e),[e]),e=c.getSnapshot!==t||y||Cn!==null&&(Cn.memoizedState.tag&1)!==0,Vt(e?9:8,{destroy:void 0},Gr.bind(null,l,c,a,t),null),e){if(l.flags|=2048,an===null)throw Error(f(349));u||(Fl&127)!==0||Vr(l,t,a)}return a}function Vr(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Je.updateQueue,t===null?(t=Bi(),Je.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Gr(e,t,a,l){t.value=a,t.getSnapshot=l,Xr(t)&&Kr(e)}function Yr(e,t,a){return a(function(){Xr(t)&&Kr(e)})}function Xr(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!bn(e,a)}catch{return!0}}function Kr(e){var t=gs(e,2);t!==null&&Za(t,e,2)}function i(e){var t=la();if(typeof e=="function"){var a=e;if(e=a(),_o){Ta(!0);try{a()}finally{Ta(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:e},t}function h(e,t,a,l){return e.baseState=a,Hc(e,_t,typeof l=="function"?l:Sl)}function g(e,t,a,l,c){if(hd(e))throw Error(f(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){u.listeners.push(y)}};de.T!==null?a(!0):u.isTransition=!1,l(u),a=t.pending,a===null?(u.next=t.pending=u,w(t,u)):(u.next=a.next,t.pending=a.next=u)}}function w(e,t){var a=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=de.T,y={};y.types=u!==null?u.types:null,de.T=y;try{var C=a(c,l),O=de.S;O!==null&&O(y,C),T(e,t,C)}catch(V){R(e,t,V)}finally{u!==null&&y.types!==null&&(u.types=y.types),de.T=u}}else try{u=a(c,l),T(e,t,u)}catch(V){R(e,t,V)}}function T(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){A(e,t,l)},function(l){return R(e,t,l)}):A(e,t,a)}function A(e,t,a){t.status="fulfilled",t.value=a,ee(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,w(e,a)))}function R(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,ee(t),t=t.next;while(t!==l)}e.action=null}function ee(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ne(e,t){return t}function Ae(e,t){if(Pe){var a=an.formState;if(a!==null){e:{var l=Je;if(Pe){if(pt){t:{for(var c=pt,u=aa;c.nodeType!==8;){if(!u){c=null;break t}if(c=Tl(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){pt=Tl(c.nextSibling),l=c.data==="F!";break e}}Yl(l)}l=!1}l&&(t=a[0])}}return a=la(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ne,lastRenderedState:t},a.queue=l,a=Fm.bind(null,Je,l),l.dispatch=a,l=i(!1),u=Uf.bind(null,Je,!1,l.queue),l=la(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,a=g.bind(null,Je,c,u,a),c.dispatch=a,l.memoizedState=e,[t,a,!1]}function ze(e){var t=xn();return et(t,_t,e)}function et(e,t,a){if(t=Hc(e,t,Ne)[0],e=Li(Sl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Vo(t)}catch(y){throw y===Js?Ro:y}else l=t;t=xn();var c=t.queue,u=c.dispatch;return a!==t.memoizedState&&(Je.flags|=2048,Vt(9,{destroy:void 0},fn.bind(null,c,a),null)),[l,u,e]}function fn(e,t){e.action=t}function Se(e){var t=xn(),a=_t;if(a!==null)return et(t,a,e);xn(),t=t.memoizedState,a=xn();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function Vt(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=Je.updateQueue,t===null&&(t=Bi(),Je.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Vn(){return xn().memoizedState}function Yt(e,t,a,l){var c=la();Je.flags|=e,c.memoizedState=Vt(1|t,{destroy:void 0},a,l===void 0?null:l)}function tl(e,t,a,l){var c=xn();l=l===void 0?null:l;var u=c.memoizedState.inst;_t!==null&&l!==null&&$c(l,_t.memoizedState.deps)?c.memoizedState=Vt(t,u,a,l):(Je.flags|=e,c.memoizedState=Vt(1|t,u,a,l))}function Xe(e,t){Yt(8390656,8,e,t)}function Ft(e,t){tl(2048,8,e,t)}function dt(e){Je.flags|=4;var t=Je.updateQueue;if(t===null)t=Bi(),Je.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function fa(e){var t=xn().memoizedState;return dt({ref:t,nextImpl:e}),function(){if((Gt&2)!==0)throw Error(f(440));return t.impl.apply(void 0,arguments)}}function ea(e,t){return tl(4,2,e,t)}function Go(e,t){return tl(4,4,e,t)}function Dt(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function to(e,t,a){a=a!=null?a.concat([e]):null,tl(4,4,Dt.bind(null,t,e),a)}function Ga(){}function _i(e,t){var a=xn();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&$c(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function dd(e,t){var a=xn();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&$c(t,l[1]))return l[0];if(l=e(),_o){Ta(!0);try{e()}finally{Ta(!1)}}return a.memoizedState=[l,t],l}function _c(e,t,a){return a===void 0||(Fl&1073741824)!==0&&(xt&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Jp(),Je.lanes|=e,Zo|=e,a)}function Uc(e,t,a,l){return bn(a,t)?a:Va.current!==null?(e=_c(e,a,l),bn(e,t)||(Fn=!0),e):(Fl&106)===0||(Fl&1073741824)!==0&&(xt&261930)===0?(Fn=!0,e.memoizedState=a):(e=Jp(),Je.lanes|=e,Zo|=e,t)}function fd(e,t,a,l,c){var u=xe.p;xe.p=u!==0&&8>u?u:8;var y=de.T,C={};C.types=y!==null?y.types:null,de.T=C,Uf(e,!1,t,a);try{var O=c(),V=de.S;if(V!==null&&V(C,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var J=Mr(O,l);Zr(e,t,J,sl(e))}else Zr(e,t,l,sl(e))}catch(oe){Zr(e,t,{then:function(){},status:"rejected",reason:oe},sl())}finally{xe.p=u,y!==null&&C.types!==null&&(y.types=C.types),de.T=y}}function Xb(){}function Lf(e,t,a,l){if(e.tag!==5)throw Error(f(476));var c=Ym(e).queue;fd(e,c,t,Kt,a===null?Xb:function(){return Xm(e),a(l)})}function Ym(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Kt,baseState:Kt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:Kt},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xm(e){var t=Ym(e);t.next===null&&(t=e.alternate.memoizedState),Zr(e,t.next.queue,{},sl())}function _f(){return qn(sr)}function Km(){return xn().memoizedState}function Zm(){return xn().memoizedState}function Kb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=sl();e=js(a);var l=Zl(t,e,a);l!==null&&(Za(l,t,a),Bo(l,t,a)),t={cache:Cr()},e.payload=t;return}t=t.return}}function Zb(e,t,a){var l=sl();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},hd(e)?Qm(t,a):(a=gc(e,t,a,l),a!==null&&(Za(a,e,l),Pm(a,t,l)))}function Fm(e,t,a){var l=sl();Zr(e,t,a,l)}function Zr(e,t,a,l){var c={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(hd(e))Qm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var y=t.lastRenderedState,C=u(y,a);if(c.hasEagerState=!0,c.eagerState=C,bn(C,y))return ko(e,t,c,0),an===null&&Xs(),!1}catch{}finally{}if(a=gc(e,t,c,l),a!==null)return Za(a,e,l),Pm(a,t,l),!0}return!1}function Uf(e,t,a,l){if(l={lane:2,revertLane:Ah(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},hd(e)){if(t)throw Error(f(479))}else t=gc(e,a,l,2),t!==null&&Za(t,e,2)}function hd(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Qm(e,t){Ws=Di=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Pm(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ye(e,a)}}var md={readContext:qn,use:Hi,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useLayoutEffect:dn,useInsertionEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useSyncExternalStore:dn,useId:dn,useHostTransitionStatus:dn,useFormState:dn,useActionState:dn,useOptimistic:dn,useMemoCache:dn,useCacheRefresh:dn,useEffectEvent:dn},Jm={readContext:qn,use:Hi,useCallback:function(e,t){return la().memoizedState=[e,t===void 0?null:t],e},useContext:qn,useEffect:Xe,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Yt(4194308,4,Dt.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Yt(4194308,4,e,t)},useInsertionEffect:function(e,t){Yt(4,2,e,t)},useMemo:function(e,t){var a=la();t=t===void 0?null:t;var l=e();if(_o){Ta(!0);try{e()}finally{Ta(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=la();if(a!==void 0){var c=a(t);if(_o){Ta(!0);try{a(t)}finally{Ta(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=Zb.bind(null,Je,e),[l.memoizedState,e]},useRef:function(e){var t=la();return e={current:e},t.memoizedState=e},useState:function(e){e=i(e);var t=e.queue,a=Fm.bind(null,Je,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Ga,useDeferredValue:function(e,t){var a=la();return _c(a,e,t)},useTransition:function(){var e=i(!1);return e=fd.bind(null,Je,e.queue,!0,!1),la().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=Je,c=la();if(Pe){if(a===void 0)throw Error(f(407));a=a()}else{if(a=t(),an===null)throw Error(f(349));(xt&127)!==0||Vr(l,t,a)}c.memoizedState=a;var u={value:a,getSnapshot:t};return c.queue=u,Xe(Yr.bind(null,l,u,e),[e]),l.flags|=2048,Vt(9,{destroy:void 0},Gr.bind(null,l,u,a,t),null),a},useId:function(){var e=la(),t=an.identifierPrefix;if(Pe){var a=Nn,l=qa;a=(l&~(1<<32-pn(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Lr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=da++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:_f,useFormState:Ae,useActionState:Ae,useOptimistic:function(e){var t=la();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Uf.bind(null,Je,!0,a),a.dispatch=t,[e,t]},useMemoCache:Bc,useCacheRefresh:function(){return la().memoizedState=Kb.bind(null,Je)},useEffectEvent:function(e){var t=la(),a={impl:e};return t.memoizedState=a,function(){if((Gt&2)!==0)throw Error(f(440));return a.impl.apply(void 0,arguments)}}},Im={readContext:qn,use:Hi,useCallback:_i,useContext:qn,useEffect:Ft,useImperativeHandle:to,useInsertionEffect:ea,useLayoutEffect:Go,useMemo:dd,useReducer:Li,useRef:Vn,useState:function(){return Li(Sl)},useDebugValue:Ga,useDeferredValue:function(e,t){var a=xn();return Uc(a,_t.memoizedState,e,t)},useTransition:function(){var e=Li(Sl)[0],t=xn().memoizedState;return[typeof e=="boolean"?e:Vo(e),t]},useSyncExternalStore:qr,useId:Km,useHostTransitionStatus:_f,useFormState:ze,useActionState:ze,useOptimistic:function(e,t){var a=xn();return h(a,_t,e,t)},useMemoCache:Bc,useCacheRefresh:Zm,useEffectEvent:fa},Fb={readContext:qn,use:Hi,useCallback:_i,useContext:qn,useEffect:Ft,useImperativeHandle:to,useInsertionEffect:ea,useLayoutEffect:Go,useMemo:dd,useReducer:Lc,useRef:Vn,useState:function(){return Lc(Sl)},useDebugValue:Ga,useDeferredValue:function(e,t){var a=xn();return _t===null?_c(a,e,t):Uc(a,_t.memoizedState,e,t)},useTransition:function(){var e=Lc(Sl)[0],t=xn().memoizedState;return[typeof e=="boolean"?e:Vo(e),t]},useSyncExternalStore:qr,useId:Km,useHostTransitionStatus:_f,useFormState:Se,useActionState:Se,useOptimistic:function(e,t){var a=xn();return _t!==null?h(a,_t,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Bc,useCacheRefresh:Zm,useEffectEvent:fa};function qf(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:le({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Vf={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=sl(),c=js(l);c.payload=t,a!=null&&(c.callback=a),t=Zl(e,c,l),t!==null&&(Za(t,e,l),Bo(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=sl(),c=js(l);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=Zl(e,c,l),t!==null&&(Za(t,e,l),Bo(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=sl(),l=js(a);l.tag=2,t!=null&&(l.callback=t),t=Zl(e,l,a),t!==null&&(Za(t,e,a),Bo(t,e,a))}};function Wm(e,t,a,l,c,u,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,y):t.prototype&&t.prototype.isPureReactComponent?!wa(a,l)||!wa(c,u):!0}function ep(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&Vf.enqueueReplaceState(t,t.state,null)}function Ui(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=le({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function tp(e){ps(e)}function np(e){console.error(e)}function ap(e){ps(e)}function pd(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function lp(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Gf(e,t,a){return a=js(a),a.tag=3,a.payload={element:null},a.callback=function(){pd(e,t)},a}function sp(e){return e=js(e),e.tag=3,e}function op(e,t,a,l){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){lp(t,a,l)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){lp(t,a,l),typeof c!="function"&&(Fo===null?Fo=new Set([this]):Fo.add(this));var C=l.stack;this.componentDidCatch(l.value,{componentStack:C!==null?C:""})})}function Qb(e,t,a,l,c){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&xs(t,a,c,!0),a=Dn.current,a!==null){switch(a.tag){case 31:case 13:case 19:return Zn===null?Bd():a.alternate===null&&Hn===0&&(Hn=3),a.flags&=-257,a.flags|=65536,a.lanes=c,l===Ec?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Ch(e,l,c)),!1;case 22:return a.flags|=65536,l===Ec?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Ch(e,l,c)),!1}throw Error(f(435,a.tag))}return Ch(e,l,c),Bd(),!1}if(Pe)return t=Dn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==jc&&(e=Error(f(422),{cause:l}),Si(Sa(e,a)))):(l!==jc&&(t=Error(f(423),{cause:l}),Si(Sa(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=Sa(l,a),c=Gf(e.stateNode,l,c),Br(e,c),Hn!==4&&(Hn=2)),!1;var u=Error(f(520),{cause:l});if(u=Sa(u,a),tu===null?tu=[u]:tu.push(u),Hn!==4&&(Hn=2),t===null)return!0;l=Sa(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=Gf(a.stateNode,l,e),Br(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Fo===null||!Fo.has(u))))return a.flags|=65536,c&=-c,a.lanes|=c,c=sp(c),op(c,e,a,l),Br(a,c),!1;break;case 22:if(a.memoizedState!==null)return a.flags|=65536,!1}a=a.return}while(a!==null);return!1}var Yf=Error(f(461)),Fn=!1;function ta(e,t,a,l){t.child=e===null?Rr(t,null,a,l):wl(t,e.child,a,l)}function ip(e,t,a,l,c){a=a.render;var u=t.ref;if("ref"in l){var y={};for(var C in l)C!=="ref"&&(y[C]=l[C])}else y=l;return ws(t),l=qo(e,t,a,y,u,c),C=Oc(),e!==null&&!Fn?(Rc(e,t,c),no(e,t,c)):(Pe&&C&&Mo(t),t.flags|=1,ta(e,t,l,c),t.child)}function cp(e,t,a,l,c){if(e===null){var u=a.type;return typeof u=="function"&&!bc(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,rp(e,t,u,l,c)):(e=vc(a.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!If(e,c)){var y=u.memoizedProps;if(a=a.compare,a=a!==null?a:wa,a(y,l)&&e.ref===t.ref)return no(e,t,c)}return t.flags|=1,e=Ua(u,l),e.ref=t.ref,e.return=t,t.child=e}function rp(e,t,a,l,c){if(e!==null){var u=e.memoizedProps;if(wa(u,l)&&e.ref===t.ref)if(Fn=!1,t.pendingProps=l=u,If(e,c))(e.flags&131072)!==0&&(Fn=!0);else return t.lanes=e.lanes,no(e,t,c)}return Xf(e,t,a,l,c)}function up(e,t,a,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|a:a,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return dp(e,t,u,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ei(t,u!==null?u.cachePool:null),u!==null?Hr(t,u):Oi(),ka(t);else return l=t.lanes=536870912,dp(e,t,u!==null?u.baseLanes|a:a,a,l)}else u!==null?(Ei(t,u.cachePool),Hr(t,u),Bn(),t.memoizedState=null):(e!==null&&Ei(t,null),Oi(),Bn());return ta(e,t,c,a),t.child}function Fr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dp(e,t,a,l,c){var u=Cc();return u=u===null?null:{parent:Tn._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&Ei(t,null),Oi(),ka(t),e!==null&&xs(e,t,l,!0),t.childLanes=c,null}function gd(e,t){return t=yd({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fp(e,t,a){return wl(t,e.child,null,a),e=gd(t,t.pendingProps),e.flags|=2,ua(t),t.memoizedState=null,e}function Pb(e,t,a){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Pe){if(l.mode==="hidden")return e=gd(t,l),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Fr(null,e);if(Lo(t),(e=pt)?(e=Lg(e,aa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zs!==null?{id:qa,overflow:Nn}:null,retryLane:536870912,hydrationErrors:null},a=ed(e),a.return=t,t.child=a,Un=t,pt=null)):e=null,e===null)throw Yl(t);return t.lanes=536870912,null}return gd(t,l)}var u=e.memoizedState;if(u!==null){var y=u.dehydrated;if(Lo(t),c)if(t.flags&256)t.flags&=-257,t=fp(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(f(558));else if(Fn||xs(e,t,a,!1),c=(a&e.childLanes)!==0,Fn||c){if(Va.current===null){if(l=an,l!==null&&(y=Me(l,a),y!==0&&y!==u.retryLane))throw u.retryLane=y,gs(e,y),Za(l,e,y),Yf;Bd()}t=fp(e,t,a)}else e=u.treeContext,pt=Tl(y.nextSibling),Un=t,Pe=!0,Kn=null,aa=!1,e!==null&&Ao(t,e),t=gd(t,l),t.flags|=134221824;return t}return e=Ua(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qc(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(f(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Xf(e,t,a,l,c){return ws(t),a=qo(e,t,a,l,void 0,c),l=Oc(),e!==null&&!Fn?(Rc(e,t,c),no(e,t,c)):(Pe&&l&&Mo(t),t.flags|=1,ta(e,t,a,c),t.child)}function hp(e,t,a,l,c,u){return ws(t),t.updateQueue=null,a=Ur(t,l,a,c),_r(e),l=Oc(),e!==null&&!Fn?(Rc(e,t,u),no(e,t,u)):(Pe&&l&&Mo(t),t.flags|=1,ta(e,t,a,u),t.child)}function mp(e,t,a,l,c){if(ws(t),t.stateNode===null){var u=ql,y=a.contextType;typeof y=="object"&&y!==null&&(u=qn(y)),u=new a(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Vf,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Dr(t),y=a.contextType,u.context=typeof y=="object"&&y!==null?qn(y):ql,u.state=t.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(qf(t,a,y,l),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(y=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),y!==u.state&&Vf.enqueueReplaceState(u,u.state,null),Ns(t,l,u,c),Ai(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var C=t.memoizedProps,O=Ui(a,C);u.props=O;var V=u.context,J=a.contextType;y=ql,typeof J=="object"&&J!==null&&(y=qn(J));var oe=a.getDerivedStateFromProps;J=typeof oe=="function"||typeof u.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,J||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(C||V!==y)&&ep(t,u,l,y),jl=!1;var U=t.memoizedState;u.state=U,Ns(t,l,u,c),Ai(),V=t.memoizedState,C||U!==V||jl?(typeof oe=="function"&&(qf(t,a,oe,l),V=t.memoizedState),(O=jl||Wm(t,a,O,l,U,V,y))?(J||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=V),u.props=l,u.state=V,u.context=y,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Mi(e,t),y=t.memoizedProps,J=Ui(a,y),u.props=J,oe=t.pendingProps,U=u.context,V=a.contextType,O=ql,typeof V=="object"&&V!==null&&(O=qn(V)),C=a.getDerivedStateFromProps,(V=typeof C=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y!==oe||U!==O)&&ep(t,u,l,O),jl=!1,U=t.memoizedState,u.state=U,Ns(t,l,u,c),Ai();var Q=t.memoizedState;y!==oe||U!==Q||jl||e!==null&&e.dependencies!==null&&kn(e.dependencies)?(typeof C=="function"&&(qf(t,a,C,l),Q=t.memoizedState),(J=jl||Wm(t,a,J,l,U,Q,O)||e!==null&&e.dependencies!==null&&kn(e.dependencies))?(V||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,Q,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,Q,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Q),u.props=l,u.state=Q,u.context=O,l=J):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,qc(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=wl(t,e.child,null,c),t.child=wl(t,null,a,c)):ta(e,t,a,c),t.memoizedState=u.state,e=t.child):e=no(e,t,c),e}function pp(e,t,a,l){return vs(),t.flags|=256,ta(e,t,a,l),t.child}var Kf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zf(e){return{baseLanes:e,cachePool:Ar()}}function Ff(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=ll),e}function gp(e,t,a){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,y;if((y=u)||(y=e!==null&&e.memoizedState===null?!1:(Wn.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Pe){if(c?Nl(t):Bn(),(e=pt)?(e=Lg(e,aa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zs!==null?{id:qa,overflow:Nn}:null,retryLane:536870912,hydrationErrors:null},a=ed(e),a.return=t,t.child=a,Un=t,pt=null)):e=null,e===null)throw Yl(t);return Zh(e)?t.lanes=32:t.lanes=536870912,null}return u=l.children,l=l.fallback,c?(Bn(),c=t.mode,u=yd({mode:"hidden",children:u},c),l=Vl(l,c,a,null),u.return=t,l.return=t,u.sibling=l,t.child=u,l=t.child,l.memoizedState=Zf(a),l.childLanes=Ff(e,y,a),t.memoizedState=Kf,Fr(null,l)):(Nl(t),Qf(t,u))}var C=e.memoizedState;if(C!==null){var O=C.dehydrated;if(O!==null)return Jb(e,t,u,y,l,O,C,a)}return c?(Bn(),c=l.fallback,u=t.mode,C=e.child,O=C.sibling,l=Ua(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&1206910976,O!==null?c=Ua(O,c):(c=Vl(c,u,a,null),c.flags|=2),c.return=t,l.return=t,l.sibling=c,t.child=l,Fr(null,l),l=t.child,c=e.child.memoizedState,c===null?c=Zf(a):(u=c.cachePool,u!==null?(C=Tn._currentValue,u=u.parent!==C?{parent:C,pool:C}:u):u=Ar(),c={baseLanes:c.baseLanes|a,cachePool:u}),l.memoizedState=c,l.childLanes=Ff(e,y,a),t.memoizedState=Kf,Fr(e.child,l)):(Nl(t),a=e.child,e=a.sibling,a=Ua(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=a,t.memoizedState=null,a)}function Qf(e,t){return t=yd({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function yd(e,t){return e=Na(22,e,null,t),e.lanes=0,e}function bd(e,t,a){return wl(t,e.child,null,a),e=Qf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jb(e,t,a,l,c,u,y,C){if(a)return t.flags&256?(Nl(t),t.flags&=-257,bd(e,t,C)):t.memoizedState!==null?(Bn(),t.child=e.child,t.flags|=128,null):(Bn(),u=c.fallback,y=t.mode,c=yd({mode:"visible",children:c.children},y),u=Vl(u,y,C,null),u.flags|=2,c.return=t,u.return=t,c.sibling=u,t.child=c,wl(t,e.child,null,C),c=t.child,c.memoizedState=Zf(C),c.childLanes=Ff(e,l,C),t.memoizedState=Kf,Fr(null,c));if(Nl(t),Zh(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var O=l.dgst;return l=O,l!==""&&(c=Error(f(419)),c.stack="",c.digest=l,Si({value:c,source:null,stack:null})),bd(e,t,C)}if(Fn||xs(e,t,C,!1),l=(C&e.childLanes)!==0,Fn||l){if(Va.current!==null)return bd(e,t,C);if(l=an,l!==null&&(c=Me(l,C),c!==0&&c!==y.retryLane))throw y.retryLane=c,gs(e,c),Za(l,e,c),Yf;return Kh(u)||Bd(),bd(e,t,C)}return Kh(u)?(t.flags|=192,t.child=e.child,null):(e=y.treeContext,pt=Tl(u.nextSibling),Un=t,Pe=!0,Kn=null,aa=!1,e!==null&&Ao(t,e),t=Qf(t,c.children),t.flags|=134221824,t)}function yp(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ki(e.return,t,a)}function bp(e){for(var t=null;e!==null;){var a=e.alternate;a!==null&&zc(a)===null&&(t=e),e=e.sibling}return t}function vd(e,t,a,l,c,u){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:c,treeForkCount:u}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=l,y.tail=a,y.tailMode=c,y.treeForkCount=u)}function Pf(e){var t=e.child;for(e.child=null;t!==null;){var a=t.sibling;t.sibling=e.child,e.child=t,t=a}}function Jf(e,t,a){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var y=Wn.current;if(t.flags&128)return Ri(t,y),null;var C=(y&2)!==0;if(C?(y=y&1|2,t.flags|=128):y&=1,Ri(t,y),c==="backwards"&&e!==null?(Pf(e),ta(e,t,l,a),Pf(e)):ta(e,t,l,a),l=Pe?Eo:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yp(e,a,t);else if(e.tag===19)yp(e,a,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(c){case"backwards":a=bp(t.child),a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null,Pf(t)),vd(t,!0,c,null,u,l);break;case"unstable_legacy-backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&zc(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}vd(t,!0,a,null,u,l);break;case"together":vd(t,!1,null,null,void 0,l);break;case"independent":t.memoizedState=null;break;default:a=bp(t.child),a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),vd(t,!1,c,a,u,l)}return t.child}function vp(e,t,a){var l=t.pendingProps;return Kl(t,t.type,l.value),ta(e,t,l.children,a),t.child}function no(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Zo|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(xs(e,t,a,!1),(a&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,a=Ua(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Ua(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function If(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&kn(e)))}function Ib(e,t,a){switch(t.tag){case 3:Gn(t,t.stateNode.containerInfo),Kl(t,Tn,e.memoizedState.cache),vs();break;case 27:case 5:K(t);break;case 4:Gn(t,t.stateNode.containerInfo);break;case 10:Kl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lo(t),null;break;case 13:var l=t.memoizedState;if(l!==null){if(l.dehydrated!==null)return Nl(t),t.flags|=128,null;l=xs(e,t,a,!1);var c=t.child.childLanes;return l||(a&c)!==0?gp(e,t,a):(Nl(t),e=no(e,t,a),e!==null?e.sibling:null)}Nl(t);break;case 19:if(t.flags&128)return Jf(e,t,a);if(c=(e.flags&128)!==0,l=(a&t.childLanes)!==0,l||(xs(e,t,a,!1),l=(a&t.childLanes)!==0),c){if(l)return Jf(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Ri(t,Wn.current),l)break;return null;case 22:return t.lanes=0,up(e,t,a,t.pendingProps);case 24:Kl(t,Tn,e.memoizedState.cache)}return no(e,t,a)}function xp(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Fn=!0;else{if(!If(e,a)&&(t.flags&128)===0)return Fn=!1,Ib(e,t,a);Fn=(e.flags&131072)!==0}else Fn=!1,Pe&&(t.flags&1048576)!==0&&bs(t,Eo,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Wa(t.elementType),t.type=e,typeof e=="function")bc(e)?(l=Ui(e,l),t.tag=1,t=mp(null,t,e,l,a)):(t.tag=0,t=Xf(null,t,e,l,a));else{if(e!=null){var c=e.$$typeof;if(c===me){t.tag=11,t=ip(null,t,e,l,a);break e}else if(c===qe){t.tag=14,t=cp(null,t,e,l,a);break e}else if(c===at){t.tag=10,t.type=e,t=vp(null,t,a);break e}}throw t=He(e)||e,Error(f(306,t,""))}}return t;case 0:return Xf(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,c=Ui(l,t.pendingProps),mp(e,t,l,c,a);case 3:e:{if(Gn(t,t.stateNode.containerInfo),e===null)throw Error(f(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Mi(e,t),Ns(t,l,null,a);var y=t.memoizedState;if(l=y.cache,Kl(t,Tn,l),l!==u.cache&&Sc(t,[Tn],a,!0),Ai(),l=y.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=pp(e,t,l,a);break e}else if(l!==c){c=Sa(Error(f(424)),t),Si(c),t=pp(e,t,l,a);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(pt=Tl(e.firstChild),Un=t,Pe=!0,Kn=null,aa=!0,a=Rr(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|134221824,a=a.sibling}else{if(vs(),l===c){t=no(e,t,a);break e}ta(e,t,l,a)}t=t.child}return t;case 26:return qc(e,t),e===null?(a=Xg(t.type,null,t.pendingProps,null))?t.memoizedState=a:Pe||(t.stateNode=Sg(t.type,t.pendingProps,Pn.current,t)):t.memoizedState=Xg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),e===null&&Pe&&(l=t.stateNode=qg(t.type,t.pendingProps,Pn.current),Un=t,aa=!0,c=pt,Jo(t.type)?(Fh=c,pt=Tl(l.firstChild)):pt=c),ta(e,t,t.pendingProps.children,a),qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pe&&((c=l=pt)&&(l=Kv(l,t.type,t.pendingProps,aa),l!==null?(t.stateNode=l,Un=t,pt=Tl(l.firstChild),aa=!1,c=!0):c=!1),c||Yl(t)),K(t),c=t.type,u=t.pendingProps,y=e!==null?e.memoizedProps:null,l=u.children,_h(c,u)?l=null:y!==null&&_h(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=qo(e,t,ud,null,null,a),sr._currentValue=c),qc(e,t),ta(e,t,l,a),t.child;case 6:return e===null&&Pe&&((e=a=pt)&&(a=Zv(a,t.pendingProps,aa),a!==null?(t.stateNode=a,Un=t,pt=null,e=!0):e=!1),e||Yl(t)),null;case 13:return gp(e,t,a);case 4:return Gn(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=wl(t,null,l,a):ta(e,t,l,a),t.child;case 11:return ip(e,t,t.type,t.pendingProps,a);case 7:return l=t.pendingProps,qc(e,t),ta(e,t,l,a),t.child;case 8:return ta(e,t,t.pendingProps.children,a),t.child;case 12:return ta(e,t,t.pendingProps.children,a),t.child;case 10:return vp(e,t,a);case 9:return c=t.type._context,l=t.pendingProps.children,ws(t),c=qn(c),l=l(c),t.flags|=1,ta(e,t,l,a),t.child;case 14:return cp(e,t,t.type,t.pendingProps,a);case 15:return rp(e,t,t.type,t.pendingProps,a);case 19:return Jf(e,t,a);case 31:return Pb(e,t,a);case 22:return up(e,t,a,t.pendingProps);case 24:return ws(t),l=qn(Tn),e===null?(c=Cc(),c===null&&(c=an,u=Cr(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=a),c=u),t.memoizedState={parent:l,cache:c},Dr(t),Kl(t,Tn,c)):((e.lanes&a)!==0&&(Mi(e,t),Ns(t,null,null,a),Ai()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Kl(t,Tn,l)):(l=u.cache,Kl(t,Tn,l),l!==c.cache&&Sc(t,[Tn],a,!0))),ta(e,t,t.pendingProps.children,a),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),l=t.pendingProps,l.name!=null&&l.name!=="auto"?t.flags|=e===null?18882560:18874368:Pe&&Mo(t),e!==null&&e.memoizedProps.name!==l.name?t.flags|=4194816:qc(e,t),ta(e,t,l.children,a),t.child;case 29:throw t.pendingProps}throw Error(f(156,t.tag))}function ao(e){e.flags|=4}function Wf(e,t,a,l,c){var u;if((u=(e.mode&32)!==0)&&(u=a===null?Qg(t,l):Qg(t,l)&&(l.src!==a.src||l.srcSet!==a.srcSet)),u){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(tg())e.flags|=8192;else throw Is=Ec,zr}else e.flags&=-16777217}function wp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pg(t))if(tg())e.flags|=8192;else throw Is=Ec,zr}function xd(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Et():536870912,e.lanes|=t,Kc|=t)}function Qr(e,t){if(!Pe)switch(e.tailMode){case"visible":break;case"collapsed":for(var a=e.tail,l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null;break;default:for(t=e.tail,a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null}}function cn(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags&1206910976,l|=c.flags&1206910976,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function Wb(e,t,a){var l=t.pendingProps;switch(wc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(t),null;case 1:return cn(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Sn(Tn),B(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(zo(t)?ao(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,nd())),cn(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ao(t),u!==null?(cn(t),wp(t,u)):(cn(t),Wf(t,c,null,l,a))):u?u!==e.memoizedState?(ao(t),cn(t),wp(t,u)):(cn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ao(t),cn(t),Wf(t,c,e,l,a)),null;case 27:if(ae(t),a=Pn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ao(t);else{if(!l){if(t.stateNode===null)throw Error(f(166));return cn(t),t.subtreeFlags&=-33554433,null}e=mn.current,zo(t)?td(t):(e=qg(c,l,a),t.stateNode=e,ao(t))}return cn(t),t.subtreeFlags&=-33554433,null;case 5:if(ae(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ao(t);else{if(!l){if(t.stateNode===null)throw Error(f(166));return cn(t),t.subtreeFlags&=-33554433,null}if(u=mn.current,zo(t))td(t);else{var y=ou(Pn.current);switch(u){case 1:u=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=y.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?y.createElement("select",{is:l.is}):y.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?y.createElement(c,{is:l.is}):y.createElement(c)}}u[nn]=t,u[Jn]=l;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)u.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=u;e:switch(ma(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ao(t)}}return cn(t),t.subtreeFlags&=-33554433,Wf(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ao(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(f(166));if(e=Pn.current,zo(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,c=Un,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[nn]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||xg(e.nodeValue,a)),e||Yl(t,!0)}else e=ou(e).createTextNode(l),e[nn]=t,t.stateNode=e}return cn(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=zo(t),a!==null){if(e===null){if(!l)throw Error(f(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(557));e[nn]=t}else vs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;cn(t),e=!1}else a=nd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ua(t),t):(ua(t),null);if((t.flags&128)!==0)throw Error(f(558))}return cn(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=zo(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(f(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(f(317));c[nn]=t}else vs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;cn(t),c=!1}else c=nd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(ua(t),t):(ua(t),null)}return ua(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),xd(t,t.updateQueue),cn(t),null);case 4:return B(),e===null&&Rh(t.stateNode.containerInfo),t.flags|=67108864,cn(t),null;case 10:return Sn(t.type),cn(t),null;case 19:if(Ac(t),l=t.memoizedState,l===null)return cn(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)Qr(l,!1);else{if(Hn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=zc(e),u!==null){for(t.flags|=128,Qr(l,!1),e=u.updateQueue,t.updateQueue=e,xd(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Wu(a,e),a=a.sibling;return Ri(t,Wn.current&1|2),Pe&&ra(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&st()>$d&&(t.flags|=128,c=!0,Qr(l,!1),t.lanes=4194304)}else{if(!c)if(e=zc(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,xd(t,e),Qr(l,!0),l.tail===null&&l.tailMode!=="collapsed"&&l.tailMode!=="visible"&&!u.alternate&&!Pe)return cn(t),null}else 2*st()-l.renderingStartTime>$d&&a!==536870912&&(t.flags|=128,c=!0,Qr(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}if(l.tail!==null){e=l.tail;e:{for(a=e;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return l.rendering=e,l.tail=e.sibling,l.renderingStartTime=st(),e.sibling=null,u=Wn.current,u=c?u&1|2:u&1,l.tailMode==="visible"||l.tailMode==="collapsed"||!a||Pe?Ri(t,u):(a=u,Ye(Dn,t),Ye(Wn,a),Zn===null&&(Zn=t)),Pe&&ra(t,l.treeForkCount),e}return cn(t),null;case 22:case 23:return ua(t),el(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(cn(t),t.subtreeFlags&6&&(t.flags|=8192)):cn(t),a=t.updateQueue,a!==null&&xd(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&rt(Ps),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Sn(Tn),cn(t),null;case 25:return null;case 30:return t.flags|=33554432,cn(t),null}throw Error(f(156,t.tag))}function ev(e,t){switch(wc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sn(Tn),B(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ae(t),null;case 31:if(t.memoizedState!==null){if(ua(t),t.alternate===null)throw Error(f(340));vs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ua(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(f(340));vs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ac(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 B(),null;case 10:return Sn(t.type),null;case 22:case 23:return ua(t),el(),e!==null&&rt(Ps),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sn(Tn),null;case 25:return null;default:return null}}function jp(e,t){switch(wc(t),t.tag){case 3:Sn(Tn),B();break;case 26:case 27:case 5:ae(t);break;case 4:B();break;case 31:t.memoizedState!==null&&ua(t);break;case 13:ua(t);break;case 19:Ac(t);break;case 10:Sn(t.type);break;case 22:case 23:ua(t),el(),e!==null&&rt(Ps);break;case 24:Sn(Tn)}}function Pr(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&e)===e){l=void 0;var u=a.create,y=a.inst;l=u(),y.destroy=l}a=a.next}while(a!==c)}}catch(C){Pt(t,t.return,C)}}function Yo(e,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var y=l.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,c=t;var O=a,V=C;try{V()}catch(J){Pt(c,O,J)}}}l=l.next}while(l!==u)}}catch(J){Pt(t,t.return,J)}}function Np(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Hf(t,a)}catch(l){Pt(e,e.return,l)}}}function Sp(e,t,a){a.props=Ui(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Pt(e,t,l)}}function Ss(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:var c=e.stateNode,u=Ul(e.memoizedProps,c);(c.ref===null||c.ref.name!==u)&&(c.ref=zg(u)),l=c.ref;break;case 7:if(e.stateNode===null){var y=new ol(e);j(e.child,!1,Yv,y,void 0,void 0),e.stateNode=y}l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(C){Pt(e,t,C)}}function ha(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){Pt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Pt(e,t,c)}else a.current=null}function wd(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var a=0;a<t.length;a++)Hg(e.stateNode,t[a])}function kp(e){for(var t=e.return;t!==null&&(th(t)&&Hg(e.stateNode,t.stateNode),!eh(t));)t=t.return}function Jr(e){for(var t=e.return;t!==null&&(th(t)&&Xv(e.stateNode,t.stateNode),!eh(t));)t=t.return}function eh(e){return e.tag===5||e.tag===3||e.tag===27}function th(e){return e&&e.tag===7&&e.stateNode!==null}function nh(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){Pt(e,e.return,c)}}function ah(e,t,a){try{var l=e.stateNode;Tv(l,e.type,a,t),l[Jn]=t}catch(c){Pt(e,e.return,c)}}function Tp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jo(e.type)||e.tag===4}function lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tp(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&&Jo(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 sh(e,t,a,l){var c=e.tag;if(c===5||c===6)c=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(c,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(c),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Da)),wd(e,l),ot=!0;else if(c!==4&&(c===27&&(wd(e,l),l=null,Jo(e.type)&&(a=e.stateNode,t=null)),e=e.child,e!==null))for(sh(e,t,a,l),e=e.sibling;e!==null;)sh(e,t,a,l),e=e.sibling}function jd(e,t,a,l){var c=e.tag;if(c===5||c===6)c=e.stateNode,t?a.insertBefore(c,t):a.appendChild(c),wd(e,l),ot=!0;else if(c!==4&&(c===27&&(wd(e,l),l=null,Jo(e.type)&&(a=e.stateNode)),e=e.child,e!==null))for(jd(e,t,a,l),e=e.sibling;e!==null;)jd(e,t,a,l),e=e.sibling}function Cp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);ma(t,l,a),t[nn]=e,t[Jn]=a}catch(u){Pt(e,e.return,u)}}var Nd=!1,nl=null;function Ep(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(Nd=!0)}var ks=null;function Mp(){var e=ks;return ks=null,e}var Ya=0;function Vc(e,t,a,l,c){return Ya=0,Ap(e.child,t,a,l,c)}function Ap(e,t,a,l,c){for(var u=!1;e!==null;){if(e.tag===5){var y=e.stateNode;if(l!==null){var C=Vh(y);l.push(C),C.view&&(u=!0)}else u||Vh(y).view&&(u=!0);Nd=!0,Mg(y,Ya===0?t:t+"_"+Ya,a),Ya++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&c||Ap(e.child,t,a,l,c)&&(u=!0));e=e.sibling}return u}function Ts(e,t){for(;e!==null;)e.tag===5?Ag(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Ts(e.child,t)),e=e.sibling}function Sd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Sd(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 a=t.name;t=bl(t.default,t.share),t!=="none"&&(Vc(e,a,t,null,!1)||Ts(e.child,!1))}e=e.sibling}}function oh(e,t){if(e.tag===30){var a=e.stateNode,l=e.memoizedProps,c=Ul(l,a),u=bl(l.default,a.paired?l.share:l.enter);u!=="none"?Vc(e,c,u,null,!1)?(Sd(e),a.paired||t||Pc(e,l.onEnter)):Ts(e.child,!1):Sd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)oh(e,t),e=e.sibling;else Sd(e)}function ih(e){if(nl!==null&&nl.size!==0){var t=nl;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 a=e.memoizedProps,l=a.name;if(l!=null&&l!=="auto"){var c=t.get(l);if(c!==void 0){var u=bl(a.default,a.share);if(u!=="none"&&(Vc(e,l,u,null,!1)?(u=e.stateNode,c.paired=u,u.paired=c,Pc(e,a.onShare)):Ts(e.child,!1)),t.delete(l),t.size===0)break}}}ih(e)}e=e.sibling}}}function ch(e){if(e.tag===30){var t=e.memoizedProps,a=Ul(t,e.stateNode),l=nl!==null?nl.get(a):void 0,c=bl(t.default,l!==void 0?t.share:t.exit);c!=="none"&&(Vc(e,a,c,null,!1)?l!==void 0?(c=e.stateNode,l.paired=c,c.paired=l,nl.delete(a),Pc(e,t.onShare)):Pc(e,t.onExit):Ts(e.child,!1)),nl!==null&&ih(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)ch(e),e=e.sibling;else nl!==null&&ih(e)}function zp(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,a=Ul(t,e.stateNode);t=bl(t.default,t.update),e.flags&=-5,t!=="none"&&Vc(e,a,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&zp(e);e=e.sibling}}function rh(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,Ts(e.child,!1))}rh(e)}e=e.sibling}}function kd(e){if(e.tag===30)e.stateNode.paired=null,Ts(e.child,!1),rh(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)kd(e),e=e.sibling;else rh(e)}function $p(e){for(e=e.child;e!==null;)e.tag===30?Ts(e.child,!1):(e.subtreeFlags&33554432)!==0&&$p(e),e=e.sibling}function uh(e,t,a,l,c,u,y){for(var C=!1;t!==null;){if(t.tag===5){var O=t.stateNode;if(u!==null&&Ya<u.length){var V=u[Ya],J=Vh(O);(V.view||J.view)&&(C=!0);var oe;if(oe=(e.flags&4)===0)if(J.clip)oe=!0;else{oe=V.rect;var U=J.rect;oe=oe.y!==U.y||oe.x!==U.x||oe.height!==U.height||oe.width!==U.width}oe&&(e.flags|=4),J.abs?J=!V.abs:(V=V.rect,J=J.rect,J=V.height!==J.height||V.width!==J.width),J&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Mg(O,Ya===0?a:a+"_"+Ya,c),C&&(e.flags&4)!==0||(ks===null&&(ks=[]),ks.push(O,Ya===0?l:l+"_"+Ya,t.memoizedProps)),Ya++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&y?e.flags|=t.flags&32:uh(e,t.child,a,l,c,u,y)&&(C=!0));t=t.sibling}return C}function Op(e,t){for(e=e.child;e!==null;){if(e.tag===30){var a=e.memoizedProps,l=e.stateNode,c=Ul(a,l),u=bl(a.default,a.update),y;y=e.memoizedState,e.memoizedState=null,l=e;var C=e.child;Ya=0,c=uh(l,C,c,c,u,y,!1),(e.flags&4)!==0&&c&&Pc(e,a.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Op(e);e=e.sibling}}var sa=!1,Xt=!1,Cs=!1,dh=!1,Rp=typeof WeakSet=="function"?WeakSet:Set,oa=null,Es=!1,Ir=!1,Td=!1,fh=!1;function tv(e,t,a){if(e=e.containerInfo,Hh=or,e=wo(e),xi(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var u=c.anchorOffset,y=c.focusNode;c=c.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var C=0,O=-1,V=-1,J=0,oe=0,U=e,Q=null;t:for(;;){for(var Ee;U!==l||u!==0&&U.nodeType!==3||(O=C+u),U!==y||c!==0&&U.nodeType!==3||(V=C+c),U.nodeType===3&&(C+=U.nodeValue.length),(Ee=U.firstChild)!==null;)Q=U,U=Ee;for(;;){if(U===e)break t;if(Q===l&&++J===u&&(O=C),Q===y&&++oe===c&&(V=C),(Ee=U.nextSibling)!==null)break;U=Q,Q=U.parentNode}U=Ee}l=O===-1||V===-1?null:{start:O,end:V}}else l=null}l=l||{start:0,end:0}}else l=null;for(Lh={focusedElem:e,selectionRange:l},or=!1,a=(a&335544064)===a,oa=t,t=a?9270:1024;oa!==null;){if(e=oa,a&&(l=e.deletions,l!==null))for(u=0;u<l.length;u++)a&&ch(l[u]);if(e.alternate===null&&(e.flags&2)!==0)a&&Ep(e),Cd(a);else{if(e.tag===22){if(l=e.alternate,e.memoizedState!==null){l!==null&&l.memoizedState===null&&a&&ch(l),Cd(a);continue}else if(l!==null&&l.memoizedState!==null){a&&Ep(e),Cd(a);continue}}l=e.child,(e.subtreeFlags&t)!==0&&l!==null?(l.return=e,oa=l):(a&&zp(e),Cd(a))}}nl=null}function Cd(e){for(;oa!==null;){var t=oa,a=e,l=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((c&1024)!==0&&l!==null){a=void 0,c=l.memoizedProps,l=l.memoizedState;var u=t.stateNode;try{var y=Ui(t.type,c);a=u.getSnapshotBeforeUpdate(y,l),u.__reactInternalSnapshotBeforeUpdate=a}catch(C){Pt(t,t.return,C)}}break;case 3:if((c&1024)!==0){if(l=t.stateNode.containerInfo,a=l.nodeType,a===9)Xh(l);else if(a===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":Xh(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:a&&l!==null&&(a=Ul(l.memoizedProps,l.stateNode),c=t.memoizedProps,c=bl(c.default,c.update),c!=="none"&&Vc(l,a,c,l.memoizedState=[],!0));break;default:if((c&1024)!==0)throw Error(f(163))}if(l=t.sibling,l!==null){l.return=t.return,oa=l;break}oa=t.return}}function Dp(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ms(e,a),l&4&&Pr(5,a);break;case 1:if(Ms(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(y){Pt(a,a.return,y)}else{var c=Ui(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Pt(a,a.return,y)}}l&64&&Np(a),l&512&&Ss(a,a.return);break;case 3:if(Ms(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Hf(e,t)}catch(y){Pt(a,a.return,y)}}break;case 27:t===null&&l&4&&Cp(a);case 26:case 5:Ms(e,a),t===null&&l&4&&nh(a),l&512&&Ss(a,a.return);break;case 12:Ms(e,a);break;case 31:Ms(e,a),l&4&&_p(e,a);break;case 13:Ms(e,a),l&4&&Up(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=hv.bind(null,a),Fv(e,a))));break;case 22:if(l=a.memoizedState!==null||sa,!l){var u=t!==null&&t.memoizedState!==null||Xt;t=sa,c=Xt,sa=l,(Xt=u)&&!c?(l=2,(a.subtreeFlags&8772)!==0&&(l|=1),Jl(e,a,l)):Ms(e,a),sa=t,Xt=c}break;case 30:Ms(e,a),l&512&&Ss(a,a.return);break;case 7:l&512&&Ss(a,a.return);default:Ms(e,a)}}function hh(e,t){for(e=e.child;e!==null;)Bp(e,t),e=e.sibling}function Bp(e,t){switch(e.tag){case 5:case 26:try{var a=e.stateNode;if(t){var l=a.style;typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"}else{var c=e.stateNode,u=e.memoizedProps.style,y=u!=null&&u.hasOwnProperty("display")?u.display:null;c.style.display=y==null||typeof y=="boolean"?"":(""+y).trim()}}catch(O){Pt(e,e.return,O)}mh(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,ot=!0}catch(O){Pt(e,e.return,O)}break;case 18:try{var C=e.stateNode;t?Eg(C,!0):Eg(e.stateNode,!1)}catch(O){Pt(e,e.return,O)}break;case 22:case 23:e.memoizedState===null&&hh(e,t);break;default:hh(e,t)}}function mh(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var a=e,l=t;switch(a.tag){case 4:Bp(a,l);break e;case 22:a.memoizedState===null&&mh(a,l);break e;default:mh(a,l)}}e=e.sibling}}function Hp(e){var t=e.alternate;t!==null&&(e.alternate=null,Hp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Qi(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 wn=null,Xa=!1;function Ql(e,t,a){for(a=a.child;a!==null;)Lp(e,t,a),a=a.sibling}function Lp(e,t,a){if(ia&&typeof ia.onCommitFiberUnmount=="function")try{ia.onCommitFiberUnmount(ul,a)}catch{}switch(a.tag){case 26:Xt||ha(a,t),Ql(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&!Xt&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Xt||ha(a,t),Jr(a);var l=wn,c=Xa;Jo(a.type)&&(wn=a.stateNode,Xa=!1),Ql(e,t,a),Vg(a.stateNode,a.type,a.memoizedProps),wn=l,Xa=c;break;case 5:Xt||ha(a,t),Jr(a);case 6:if(a.tag===6&&Jr(a),l=wn,c=Xa,wn=null,Ql(e,t,a),wn=l,Xa=c,wn!==null)if(Xa)try{(wn.nodeType===9?wn.body:wn.nodeName==="HTML"?wn.ownerDocument.body:wn).removeChild(a.stateNode),ot=!0}catch(u){Pt(a,t,u)}else try{wn.removeChild(a.stateNode),ot=!0}catch(u){Pt(a,t,u)}break;case 18:wn!==null&&(Xa?(e=wn,Cg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ir(e)):Cg(wn,a.stateNode));break;case 4:l=wn,c=Xa,wn=a.stateNode.containerInfo,Xa=!0,Ql(e,t,a),wn=l,Xa=c;break;case 0:case 11:case 14:case 15:Yo(2,a,t),Xt||Yo(4,a,t),Ql(e,t,a);break;case 1:Xt||(ha(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Sp(a,t,l)),Ql(e,t,a);break;case 21:Ql(e,t,a);break;case 22:Xt=(l=Xt)||a.memoizedState!==null,Ql(e,t,a),Xt=l;break;case 30:ha(a,t),Ql(e,t,a);break;case 7:Xt||ha(a,t),Ql(e,t,a);break;default:Ql(e,t,a)}}function _p(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ir(e)}catch(a){Pt(t,t.return,a)}}}function Up(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ir(e)}catch(a){Pt(t,t.return,a)}}function nv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rp),t;default:throw Error(f(435,e.tag))}}function Ed(e,t){var a=nv(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var c=mv.bind(null,e,l);l.then(c,c)}})}function Aa(e,t,a){var l=t.deletions;if(l!==null)for(var c=0;c<l.length;c++){var u=l[c],y=e,C=t,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(Jo(O.type)){wn=O.stateNode,Xa=!1;break e}break;case 5:wn=O.stateNode,Xa=!1;break e;case 3:case 4:wn=O.stateNode.containerInfo,Xa=!0;break e}O=O.return}if(wn===null)throw Error(f(160));Lp(y,C,u),wn=null,Xa=!1,y=u.alternate,y!==null&&(y.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)qp(t,e,a),t=t.sibling}var Pl=null;function qp(e,t,a){var l=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(c&4&&(l=e.updateQueue,l=l!==null?l.events:null,l!==null))for(var u=0;u<l.length;u++){var y=l[u];y.ref.impl=y.nextImpl}Aa(t,e,a),za(e),c&4&&(Yo(3,e,e.return),Pr(3,e),Yo(5,e,e.return));break;case 1:Aa(t,e,a),za(e),c&512&&(Xt||l===null||ha(l,l.return)),c&64&&sa&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?t:a.concat(t))));break;case 26:if(u=Pl,Aa(t,e,a),za(e),c&512&&(Xt||l===null||ha(l,l.return)),c&4)if(c=l!==null?l.memoizedState:null,a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null)if(sa)e.stateNode=Sg(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,a=e.memoizedProps,c=u.ownerDocument||u;t:switch(t){case"title":l=c.getElementsByTagName("title")[0],(!l||l[co]||l[nn]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=c.createElement(t),c.head.insertBefore(l,c.querySelector("head > title"))),ma(l,t,a),l[nn]=e,Xn(l),t=l;break e;case"link":if(u=Fg("link","href",c).get(t+(a.href||""))){for(y=0;y<u.length;y++)if(l=u[y],l.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&l.getAttribute("rel")===(a.rel==null?null:a.rel)&&l.getAttribute("title")===(a.title==null?null:a.title)&&l.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){u.splice(y,1);break t}}l=c.createElement(t),ma(l,t,a),c.head.appendChild(l);break;case"meta":if(u=Fg("meta","content",c).get(t+(a.content||""))){for(y=0;y<u.length;y++)if(l=u[y],l.getAttribute("content")===(a.content==null?null:""+a.content)&&l.getAttribute("name")===(a.name==null?null:a.name)&&l.getAttribute("property")===(a.property==null?null:a.property)&&l.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&l.getAttribute("charset")===(a.charSet==null?null:a.charSet)){u.splice(y,1);break t}}l=c.createElement(t),ma(l,t,a),c.head.appendChild(l);break;default:throw Error(f(468,t))}l[nn]=e,Xn(l),t=l}e.stateNode=t}else sa||Ih(u,e.type,e.stateNode);else e.stateNode=Zg(u,a,e.memoizedProps);else c!==a?(c===null?(t=l.stateNode,t===null||Xt||t.parentNode.removeChild(t)):c.count--,a===null?sa||Ih(u,e.type,e.stateNode):Zg(u,a,e.memoizedProps)):a===null&&e.stateNode!==null&&ah(e,e.memoizedProps,l.memoizedProps);break;case 27:Aa(t,e,a),za(e),c&512&&(Xt||l===null||ha(l,l.return)),l!==null&&c&4&&ah(e,e.memoizedProps,l.memoizedProps);break;case 5:if(u=Cs,Cs=!1,Aa(t,e,a),Cs=u,za(e),c&512&&(Xt||l===null||ha(l,l.return)),e.flags&32){t=e.stateNode;try{uo(t,""),ot=!0}catch(J){Pt(e,e.return,J)}}c&4&&e.stateNode!=null&&(t=e.memoizedProps,ah(e,t,l!==null?l.memoizedProps:t)),c&1024&&(dh=!0);break;case 6:if(Aa(t,e,a),za(e),c&4){if(e.stateNode===null)throw Error(f(162));t=e.memoizedProps,a=e.stateNode;try{a.nodeValue=t,ot=!0}catch(J){Pt(e,e.return,J)}}break;case 3:if(ot=!1,Gd=null,u=Pl,Pl=iu(t.containerInfo),Aa(t,e,a),Pl=u,za(e),c&4&&l!==null&&l.memoizedState.isDehydrated)try{ir(t.containerInfo)}catch(J){Pt(e,e.return,J)}dh&&(dh=!1,Vp(e)),ot=!1;break;case 4:c=Cs,Cs=sa,l=is(),u=Pl,Pl=iu(e.stateNode.containerInfo),Aa(t,e,a),za(e),Pl=u,ot&&Ir&&(Td=!0),ot=l,Cs=c;break;case 12:Aa(t,e,a),za(e);break;case 31:Aa(t,e,a),za(e),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ed(e,t)));break;case 13:Aa(t,e,a),za(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(zd=st()),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ed(e,t)));break;case 22:u=e.memoizedState!==null,y=l!==null&&l.memoizedState!==null;var C=sa,O=Xt,V=Cs;sa=C||u,Cs=V||u,Xt=O||y,Aa(t,e,a),Xt=O,Cs=V,sa=C,za(e),c&8192&&(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,!u||l===null||y||sa||Xt||(t=y||Xt,a=sa,l=Xt,sa=u||sa,Xt=t,Xo(e,2),sa=a,Xt=l),!u&&Cs||hh(e,u)),c&4&&(t=e.updateQueue,t!==null&&(a=t.retryQueue,a!==null&&(t.retryQueue=null,Ed(e,a))));break;case 19:Aa(t,e,a),za(e),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ed(e,t)));break;case 30:c&512&&(Xt||l===null||ha(l,l.return)),c=is(),u=Ir,y=(a&335544064)===a,C=e.memoizedProps,Ir=y&&bl(C.default,C.update)!=="none",Aa(t,e,a),za(e),y&&l!==null&&ot&&(e.flags|=4),Ir=u,ot=c;break;case 21:break;case 7:c&512&&(Xt||l===null||ha(l,l.return)),l&&l.stateNode!==null&&(l.stateNode._fragmentFiber=e);default:Aa(t,e,a),za(e)}}function za(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(Tp(l)){a=l;break}l=l.return}l=null;for(var c=e.return;c!==null;){if(th(c)){var u=c.stateNode;l===null?l=[u]:l.push(u)}if(eh(c))break;c=c.return}var y=l;if(a==null)throw Error(f(160));switch(a.tag){case 27:var C=a.stateNode,O=lh(e);jd(e,O,C,y);break;case 5:var V=a.stateNode;a.flags&32&&(uo(V,""),a.flags&=-33);var J=lh(e);jd(e,J,V,y);break;case 3:case 4:var oe=a.stateNode.containerInfo,U=lh(e);sh(e,U,oe,y);break;default:throw Error(f(161))}}catch(Q){Pt(e,e.return,Q)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Vp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Vp(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,or=!0,t.reset(),or=!1),e=e.sibling}}function Gc(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Gp(t,e),t=t.sibling;else Op(t)}function Gp(e,t){var a=e.alternate;if(a===null)oh(e,!1);else switch(e.tag){case 3:if(fh=Es=!1,Mp(),Gc(t,e),!Es&&!Td){if(e=ks,e!==null)for(var l=0;l<e.length;l+=3){a=e[l];var c=e[l+1];Ag(a,e[l+2]),a=a.ownerDocument.documentElement,a!==null&&a.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+c+")"})}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"})),fh=!0}ks=null;break;case 5:Gc(t,e);break;case 4:l=Es,Es=!1,Gc(t,e),Es&&(Td=!0),Es=l;break;case 22:e.memoizedState===null&&(a.memoizedState!==null?oh(e,!1):Gc(t,e));break;case 30:l=Es,c=Mp(),Es=!1,Gc(t,e),Es&&(e.flags|=4);var u=e.memoizedProps,y=e.stateNode;t=Ul(u,y),y=Ul(a.memoizedProps,y);var C=bl(u.default,u.update);C==="none"?t=!1:(u=a.memoizedState,a.memoizedState=null,a=e.child,Ya=0,t=uh(e,a,t,y,C,u,!0),Ya!==(u===null?0:u.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Pc(e,e.memoizedProps.onUpdate),ks=c):c!==null&&(c.push.apply(c,ks),ks=c),Es=(e.flags&32)!==0?!0:l;break;default:Gc(t,e)}}function Ms(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Dp(e,t.alternate,t),t=t.sibling}function Xo(e,t){for(e=e.child;e!==null;){var a=e,l=t;switch(a.tag){case 0:case 11:case 14:case 15:Yo(4,a,a.return),Xo(a,l);break;case 1:ha(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Sp(a,a.return,c),Xo(a,l);break;case 27:(l&2)!==0&&Vg(a.stateNode,a.type,a.memoizedProps);case 5:ha(a,a.return),a.tag!==5&&a.tag!==27||Jr(a),Xo(a,l);break;case 6:Jr(a);break;case 26:ha(a,a.return),c=a.stateNode,a.memoizedState!==null||c===null||Xt||c.parentNode.removeChild(c),Xo(a,l);break;case 22:a.memoizedState===null&&Xo(a,l);break;case 30:ha(a,a.return),Xo(a,l);break;case 7:ha(a,a.return);default:Xo(a,l)}e=e.sibling}}function Jl(e,t,a){for(a=(t.subtreeFlags&8772)!==0?a:a&-2,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,y=u.flags,C=(a&1)!==0;switch(u.tag){case 0:case 11:case 15:Jl(c,u,a),Pr(4,u);break;case 1:if(Jl(c,u,a),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(J){Pt(l,l.return,J)}if(l=u,c=l.updateQueue,c!==null){var O=l.stateNode;try{var V=c.shared.hiddenCallbacks;if(V!==null)for(c.shared.hiddenCallbacks=null,c=0;c<V.length;c++)zi(V[c],O)}catch(J){Pt(l,l.return,J)}}C&&y&64&&Np(u),Ss(u,u.return);break;case 27:(a&2)!==0&&Cp(u);case 5:u.tag!==5&&u.tag!==27||kp(u),Jl(c,u,a),C&&l===null&&y&4&&nh(u),Ss(u,u.return);break;case 6:kp(u);break;case 26:O=u.stateNode,u.memoizedState!==null||O===null||sa||Ih(iu(O.ownerDocument),u.type,O),Jl(c,u,a),C&&l===null&&y&4&&nh(u),Ss(u,u.return);break;case 12:Jl(c,u,a);break;case 31:Jl(c,u,a),C&&y&4&&_p(c,u);break;case 13:Jl(c,u,a),C&&y&4&&Up(c,u);break;case 22:u.memoizedState===null&&Jl(c,u,a),Ss(u,u.return);break;case 30:Jl(c,u,a),Ss(u,u.return);break;case 7:Ss(u,u.return);default:Jl(c,u,a)}t=t.sibling}}function ph(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ti(a))}function gh(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ti(e))}function kl(e,t,a,l){var c=(a&335544064)===a;if(t.subtreeFlags&(c?10262:10256))for(t=t.child;t!==null;)Yp(e,t,a,l),t=t.sibling;else c&&$p(t)}function Yp(e,t,a,l){var c=(a&335544064)===a;c&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&kd(t);var u=t.flags;switch(t.tag){case 0:case 11:case 15:kl(e,t,a,l),u&2048&&Pr(9,t);break;case 1:kl(e,t,a,l);break;case 3:kl(e,t,a,l),c&&fh&&(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="")),u&2048&&(u=null,t.alternate!==null&&(u=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==u&&(t.refCount++,u!=null&&Ti(u)));break;case 12:if(u&2048){kl(e,t,a,l),u=t.stateNode;try{var y=t.memoizedProps,C=y.id,O=y.onPostCommit;typeof O=="function"&&O(C,t.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(V){Pt(t,t.return,V)}}else kl(e,t,a,l);break;case 31:kl(e,t,a,l);break;case 13:kl(e,t,a,l);break;case 23:break;case 22:y=t.stateNode,C=t.alternate,t.memoizedState!==null?(c&&C!==null&&C.memoizedState===null&&kd(C),y._visibility&2?kl(e,t,a,l):Wr(e,t)):(c&&C!==null&&C.memoizedState!==null&&kd(t),y._visibility&2?kl(e,t,a,l):(y._visibility|=2,Yc(e,t,a,l,(t.subtreeFlags&10256)!==0||!1))),u&2048&&ph(C,t);break;case 24:kl(e,t,a,l),u&2048&&gh(t.alternate,t);break;case 30:c&&(u=t.alternate,u!==null&&(Ts(u.child,!0),Ts(t.child,!0))),kl(e,t,a,l);break;default:kl(e,t,a,l)}}function Yc(e,t,a,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,y=t,C=a,O=l,V=y.flags;switch(y.tag){case 0:case 11:case 15:Yc(u,y,C,O,c),Pr(8,y);break;case 23:break;case 22:var J=y.stateNode;y.memoizedState!==null?J._visibility&2?Yc(u,y,C,O,c):Wr(u,y):(J._visibility|=2,Yc(u,y,C,O,c)),c&&V&2048&&ph(y.alternate,y);break;case 24:Yc(u,y,C,O,c),c&&V&2048&&gh(y.alternate,y);break;default:Yc(u,y,C,O,c)}t=t.sibling}}function Wr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,c=l.flags;switch(l.tag){case 22:Wr(a,l),c&2048&&ph(l.alternate,l);break;case 24:Wr(a,l),c&2048&&gh(l.alternate,l);break;default:Wr(a,l)}t=t.sibling}}var qi=8192;function Vi(e,t,a){if(e.subtreeFlags&qi)for(e=e.child;e!==null;)Xp(e,t,a),e=e.sibling}function Xp(e,t,a){switch(e.tag){case 26:Vi(e,t,a),e.flags&qi&&(e.memoizedState!==null?cx(a,Pl,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&Ig(a,e)));break;case 5:Vi(e,t,a),e.flags&qi&&(e=e.stateNode,(t&335544128)===t&&Ig(a,e));break;case 3:case 4:var l=Pl;Pl=iu(e.stateNode.containerInfo),Vi(e,t,a),Pl=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=qi,qi=16777216,Vi(e,t,a),qi=l):Vi(e,t,a));break;case 30:if((e.flags&qi)!==0&&(l=e.memoizedProps.name,l!=null&&l!=="auto")){var c=e.stateNode;c.paired=null,nl===null&&(nl=new Map),nl.set(l,c)}Vi(e,t,a);break;default:Vi(e,t,a)}}function Kp(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 eu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];oa=l,Fp(l,e)}Kp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zp(e),e=e.sibling}function Zp(e){switch(e.tag){case 0:case 11:case 15:eu(e),e.flags&2048&&Yo(9,e,e.return);break;case 3:eu(e);break;case 12:eu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Md(e)):eu(e);break;default:eu(e)}}function Md(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];oa=l,Fp(l,e)}Kp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yo(8,t,t.return),Md(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Md(t));break;default:Md(t)}e=e.sibling}}function Fp(e,t){for(;oa!==null;){var a=oa;switch(a.tag){case 0:case 11:case 15:Yo(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ti(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,oa=l;else e:for(a=e;oa!==null;){l=oa;var c=l.sibling,u=l.return;if(Hp(l),l===a){oa=null;break e}if(c!==null){c.return=u,oa=c;break e}oa=u}}}var av={getCacheForType:function(e){var t=qn(Tn),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return qn(Tn).controller.signal}},lv=typeof WeakMap=="function"?WeakMap:Map,Gt=0,an=null,yt=null,xt=0,Qt=0,al=null,Ko=!1,Xc=!1,yh=!1,lo=0,Hn=0,Zo=0,Gi=0,Ad=0,ll=0,Kc=0,tu=null,Ka=null,bh=!1,zd=0,Qp=0,$d=1/0,Od=null,Fo=null,En=0,Il=null,Yi=null,As=0,vh=0,xh=null,Pp=null,Zc=null,Fc=null,Qc=null,nu=0,Rd=null;function sl(){return(Gt&2)!==0&&xt!==0?xt&-xt:de.T!==null?Ah():sn()}function Jp(){if(ll===0)if((xt&536870912)===0||Pe){var e=Qa;Qa<<=1,(Qa&3932160)===0&&(Qa=262144),ll=e}else ll=536870912;return e=Dn.current,e!==null&&(e.flags|=32),ll}function Pc(e,t){if(t!=null){var a=e.stateNode,l=a.ref;l===null&&(l=a.ref=zg(Ul(e.memoizedProps,a))),Fc===null&&(Fc=[]),Fc.push(t.bind(null,l))}}function Za(e,t,a){(e===an&&(Qt===2||Qt===9)||e.cancelPendingCommit!==null)&&(Jc(e,0),Qo(e,xt,ll,!1)),z(e,a),((Gt&2)===0||e!==an)&&(e===an&&((Gt&2)===0&&(Gi|=a),Hn===4&&Qo(e,xt,ll,!1)),zs(e))}function Ip(e,t,a){if((Gt&6)!==0)throw Error(f(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||kt(e,t),c=l?iv(e,t):jh(e,t,!0),u=l;do{if(c===0){Xc&&!l&&Qo(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!sv(a)){c=jh(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var C=e;c=tu;var O=C.current.memoizedState.isDehydrated;if(O&&(Jc(C,y).flags|=256),y=jh(C,y,!1),y!==2&&y!==6){if(yh&&!O){C.errorRecoveryDisabledLanes|=u,Gi|=u,c=4;break e}u=Ka,Ka=c,u!==null&&(Ka===null?Ka=u:Ka.push.apply(Ka,u))}c=y}if(u=!1,c!==2)continue}}if(c===1){Jc(e,0),Qo(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(f(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Qo(l,t,ll,!Ko);break e;case 2:Ka=null;break;case 3:case 5:break;default:throw Error(f(329))}if((t&62914560)===t&&(c=zd+300-st(),10<c)){if(Qo(l,t,ll,!Ko),as(l,0,!0)!==0)break e;As=t,l.timeoutHandle=qh(Wp.bind(null,l,a,Ka,Od,bh,t,ll,Gi,Kc,Ko,u,"Throttled",-0,0),c);break e}Wp(l,a,Ka,Od,bh,t,ll,Gi,Kc,Ko,u,null,-0,0)}}break}while(!0);zs(e)}function Wp(e,t,a,l,c,u,y,C,O,V,J,oe,U,Q){e.timeoutHandle=-1;var Ee=t.subtreeFlags,Be=(u&335544064)===u;if(oe=null,(Be||Ee&8192||(Ee&16785408)===16785408)&&(oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Da},nl=null,Xp(t,u,oe),Be&&(Ee=oe,Be=e.containerInfo,Be=(Be.nodeType===9?Be:Be.ownerDocument).__reactViewTransition,Be!=null&&(Ee.count++,Ee.waitingForViewTransition=!0,Ee=uu.bind(Ee),Be.finished.then(Ee,Ee))),Ee=(u&62914560)===u?zd-st():(u&4194048)===u?Qp-st():0,Ee=rx(oe,Ee),Ee!==null)){As=u,e.cancelPendingCommit=Ee(ig.bind(null,e,t,u,a,l,c,y,C,O,V,J,oe,null,U,Q)),Qo(e,u,y,!V);return}ig(e,t,u,a,l,c,y,C,O,V,J,oe)}function sv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var c=a[l],u=c.getSnapshot;c=c.value;try{if(!bn(u(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 Qo(e,t,a,l){t=Fi(e,t),t&=~Ad,t&=~Gi,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-pn(c),y=1<<u;l[u]=-1,c&=~y}a!==0&&_e(e,a,t)}function Dd(){return(Gt&6)===0?(au(0),!1):!0}function wh(){if(yt!==null){if(Qt===0)var e=yt.return;else e=yt,Xl=Fs=null,Dc(e),Do=null,Tt=0,e=yt;for(;e!==null;)jp(e.alternate,e),e=e.return;yt=null}}function Jc(e,t){var a=e.timeoutHandle;return a!==-1&&(e.timeoutHandle=-1,Mv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),As=0,wh(),an=e,yt=a=Ua(e.current,null),xt=t,Qt=0,al=null,Ko=!1,Xc=kt(e,t),yh=!1,Kc=ll=Ad=Gi=Zo=Hn=0,Ka=tu=null,bh=!1,lo=Fi(e,t),Xs(),a}function eg(e,t){Je=null,de.H=md,t===Js||t===Ro?(t=$r(),Qt=3):t===zr?(t=$r(),Qt=4):Qt=t===Yf?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,al=t,yt===null&&(Hn=1,pd(e,Sa(t,e.current)))}function tg(){var e=Dn.current;return e===null?!0:(xt&4194048)===xt?Zn===null:(xt&62914560)===xt||(xt&536870912)!==0?e===Zn:!1}function ng(){var e=de.H;return de.H=md,e===null?md:e}function ag(){var e=de.A;return de.A=av,e}function Bd(){Hn=4,Ko||(xt&4194048)!==xt&&Dn.current!==null||(Xc=!0),(Zo&134217727)===0&&(Gi&134217727)===0||an===null||Qo(an,xt,ll,!1)}function jh(e,t,a){var l=Gt;Gt|=2;var c=ng(),u=ag();(an!==e||xt!==t)&&(Od=null,Jc(e,t)),t=!1;var y=Hn;e:do try{if(Qt!==0&&yt!==null){var C=yt,O=al;switch(Qt){case 8:wh(),y=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(t=!0);var V=Qt;if(Qt=0,al=null,Ic(e,C,O,V),a&&Xc){y=0;break e}break;default:V=Qt,Qt=0,al=null,Ic(e,C,O,V)}}ov(),y=Hn;break}catch(J){eg(e,J)}while(!0);return t&&e.shellSuspendCounter++,Xl=Fs=null,Gt=l,de.H=c,de.A=u,yt===null&&(an=null,xt=0,Xs()),y}function ov(){for(;yt!==null;)lg(yt)}function iv(e,t){var a=Gt;Gt|=2;var l=ng(),c=ag();an!==e||xt!==t?(Od=null,$d=st()+500,Jc(e,t)):Xc=kt(e,t);e:do try{if(Qt!==0&&yt!==null){t=yt;var u=al;t:switch(Qt){case 1:Qt=0,al=null,Ic(e,t,u,1);break;case 2:case 9:if(rd(u)){Qt=0,al=null,sg(t);break}t=function(){Qt!==2&&Qt!==9||an!==e||(Qt=7),zs(e)},u.then(t,t);break e;case 3:Qt=7;break e;case 4:Qt=5;break e;case 7:rd(u)?(Qt=0,al=null,sg(t)):(Qt=0,al=null,Ic(e,t,u,7));break;case 5:var y=null;switch(yt.tag){case 26:y=yt.memoizedState;case 5:case 27:var C=yt;if(y?Pg(y):C.stateNode.complete){Qt=0,al=null;var O=C.sibling;if(O!==null)yt=O;else{var V=C.return;V!==null?(yt=V,Hd(V)):yt=null}break t}}Qt=0,al=null,Ic(e,t,u,5);break;case 6:Qt=0,al=null,Ic(e,t,u,6);break;case 8:wh(),Hn=6;break e;default:throw Error(f(462))}}cv();break}catch(J){eg(e,J)}while(!0);return Xl=Fs=null,de.H=l,de.A=c,Gt=a,yt!==null?0:(an=null,xt=0,Xs(),Hn)}function cv(){for(;yt!==null&&!Mn();)lg(yt)}function lg(e){var t=xp(e.alternate,e,lo);e.memoizedProps=e.pendingProps,t===null?Hd(e):yt=t}function sg(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=hp(a,t,t.pendingProps,t.type,void 0,xt);break;case 11:t=hp(a,t,t.pendingProps,t.type.render,t.ref,xt);break;case 5:Dc(t);var l=t;l===Un&&(Pe?(Nc(l),l.tag===5&&l.stateNode!=null&&(pt=l.stateNode)):(Nc(l),Pe=!0));default:jp(a,t),t=yt=Wu(t,lo),t=xp(a,t,lo)}e.memoizedProps=e.pendingProps,t===null?Hd(e):yt=t}function Ic(e,t,a,l){Xl=Fs=null,Dc(t),Do=null,Tt=0;var c=t.return;try{if(Qb(e,c,t,a,xt)){Hn=1,pd(e,Sa(a,e.current)),yt=null;return}}catch(u){if(c!==null)throw yt=c,u;Hn=1,pd(e,Sa(a,e.current)),yt=null;return}t.flags&32768?(Pe||l===1?e=!0:Xc||(xt&536870912)!==0?e=!1:(Ko=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),og(t,e)):Hd(t)}function Hd(e){var t=e;do{if((t.flags&32768)!==0){og(t,Ko);return}e=t.return;var a=Wb(t.alternate,t,lo);if(a!==null){yt=a;return}if(t=t.sibling,t!==null){yt=t;return}yt=t=e}while(t!==null);Hn===0&&(Hn=5)}function og(e,t){do{var a=ev(e.alternate,e);if(a!==null){a.flags&=32767,yt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){yt=e;return}yt=e=a}while(e!==null);Hn=6,yt=null}function ig(e,t,a,l,c,u,y,C,O,V,J,oe){e.cancelPendingCommit=null;do Ld();while(En!==0);if((Gt&6)!==0)throw Error(f(327));if(t!==null){if(t===e.current)throw Error(f(177));e===an&&(yt=an=null,xt=0),Yi=t,Il=e,As=a,xh=c,Pp=l,rv(e,t,a,y,C,O,oe)}}function rv(e,t,a,l,c,u,y){var C=t.lanes|t.childLanes;if(vh=C,C|=So,P(e,a,C,l,c,u),Fc=null,(a&335544064)===a?(Qc=Bf(e),l=10262):(Qc=null,l=10256),(t.subtreeFlags&l)!==0||(t.flags&l)!==0?(e.callbackNode=null,e.callbackPriority=0,pv(cl,function(){return Th(),null})):(e.callbackNode=null,e.callbackPriority=0),Nd=!1,l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=de.T,de.T=null,c=xe.p,xe.p=2,u=Gt,Gt|=4;try{tv(e,t,a)}finally{Gt=u,xe.p=c,de.T=l}}En=1,Nd?Zc=Dv(y,e.containerInfo,Qc,Nh,Sh,dv,kh,Th,uv):(Nh(),Sh(),kh())}function uv(e){if(En!==0){var t=Il.onRecoverableError;t(e,{componentStack:null})}}function dv(){En===3&&(En=0,Gp(Yi,Il),En=4)}function Nh(){if(En===1){En=0;var e=Il,t=Yi,a=As,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=de.T,de.T=null;var c=xe.p;xe.p=2;var u=Gt;Gt|=4;try{Ir=Td=!1,qp(t,e,a),a=Lh;var y=wo(e.containerInfo),C=a.focusedElem,O=a.selectionRange;if(y!==C&&C&&C.ownerDocument&&Pu(C.ownerDocument.documentElement,C)){if(O!==null&&xi(C)){var V=O.start,J=O.end;if(J===void 0&&(J=V),"selectionStart"in C)C.selectionStart=V,C.selectionEnd=Math.min(J,C.value.length);else{var oe=C.ownerDocument||document,U=oe&&oe.defaultView||window;if(U.getSelection){var Q=U.getSelection(),Ee=C.textContent.length,Be=Math.min(O.start,Ee),ct=O.end===void 0?Be:Math.min(O.end,Ee);!Q.extend&&Be>ct&&(y=ct,ct=Be,Be=y);var q=Qu(C,Be),H=Qu(C,ct);if(q&&H&&(Q.rangeCount!==1||Q.anchorNode!==q.node||Q.anchorOffset!==q.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)){var Z=oe.createRange();Z.setStart(q.node,q.offset),Q.removeAllRanges(),Be>ct?(Q.addRange(Z),Q.extend(H.node,H.offset)):(Z.setEnd(H.node,H.offset),Q.addRange(Z))}}}}for(oe=[],Q=C;Q=Q.parentNode;)Q.nodeType===1&&oe.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<oe.length;C++){var se=oe[C];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}or=!!Hh,Lh=Hh=null}finally{Gt=u,xe.p=c,de.T=l}}e.current=t,En=2}}function Sh(){if(En===2){En=0;var e=Il,t=Yi,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=de.T,de.T=null;var l=xe.p;xe.p=2;var c=Gt;Gt|=4;try{Dp(e,t.alternate,t)}finally{Gt=c,xe.p=l,de.T=a}}En=3}}function kh(){if(En===4||En===3){En=0;var e=Zc;Zc=null,ln();var t=Il,a=Yi,l=As,c=Pp,u=(l&335544064)===l?10262:10256;if((a.subtreeFlags&u)!==0||(a.flags&u)!==0?En=5:(En=0,Yi=Il=null,cg(t,t.pendingLanes)),u=t.pendingLanes,u===0&&(Fo=null),Ve(l),a=a.stateNode,ia&&typeof ia.onCommitFiberRoot=="function")try{ia.onCommitFiberRoot(ul,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=de.T,u=xe.p,xe.p=2,de.T=null;try{for(var y=t.onRecoverableError,C=0;C<c.length;C++){var O=c[C];y(O.value,{componentStack:O.stack})}}finally{de.T=a,xe.p=u}}if(c=Fc,y=Qc,Qc=null,c!==null&&(Fc=null,y===null&&(y=[]),e!==null))for(O=0;O<c.length;O++)a=(0,c[O])(y),a!==void 0&&e.finished.finally(a);(As&3)!==0&&Ld(),zs(t),u=t.pendingLanes,(l&261930)!==0&&(u&42)!==0?t===Rd?nu++:(nu=0,Rd=t):(nu=0,Rd=null),au(0)}}function cg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ti(t)))}function Ld(){return Zc!==null&&(Zc.skipTransition(),Zc=null),Nh(),Sh(),kh(),Th()}function Th(){if(En!==5)return!1;var e=Il,t=vh;vh=0;var a=Ve(As),l=de.T,c=xe.p;try{xe.p=32>a?32:a,de.T=null,a=xh,xh=null;var u=Il,y=As;if(En=0,Yi=Il=null,As=0,(Gt&6)!==0)throw Error(f(331));var C=Gt;if(Gt|=4,Zp(u.current),Yp(u,u.current,y,a),Gt=C,au(0,!1),ia&&typeof ia.onPostCommitFiberRoot=="function")try{ia.onPostCommitFiberRoot(ul,u)}catch{}return!0}finally{xe.p=c,de.T=l,cg(e,t)}}function rg(e,t,a){t=Sa(a,t),t=Gf(e.stateNode,t,2),e=Zl(e,t,2),e!==null&&(z(e,2),zs(e))}function Pt(e,t,a){if(e.tag===3)rg(e,e,a);else for(;t!==null;){if(t.tag===3){rg(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Fo===null||!Fo.has(l))){e=Sa(a,e),a=sp(2),l=Zl(t,a,2),l!==null&&(op(a,l,t,e),z(l,2),zs(l));break}}t=t.return}}function Ch(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new lv;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(yh=!0,c.add(a),e=fv.bind(null,e,t,a),t.then(e,e))}function fv(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,an===e&&(xt&a)===a&&((Hn===4||Hn===3&&(xt&62914560)===xt&&300>st()-zd)&&(Gt&2)===0?Jc(e,0):Ad|=a,Kc===xt&&(Kc=0)),zs(e)}function ug(e,t){t===0&&(t=Et()),e=gs(e,t),e!==null&&(z(e,t),zs(e))}function hv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),ug(e,a)}function mv(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(f(314))}l!==null&&l.delete(t),ug(e,a)}function pv(e,t){return Yn(e,t)}var Wc=null,er=null,Eh=!1,_d=!1,Mh=!1,Po=0;function zs(e){e!==er&&e.next===null&&(er===null?Wc=er=e:er=er.next=e),_d=!0,Eh||(Eh=!0,yv())}function au(e,t){if(!Mh&&_d){Mh=!0;do for(var a=!1,l=Wc;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var y=l.suspendedLanes,C=l.pingedLanes;u=(1<<31-pn(42|e)+1)-1,u&=c&~(y&~C),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,mg(l,u))}else u=xt,u=as(l,l===an?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||kt(l,u)||(a=!0,mg(l,u));l=l.next}while(a);Mh=!1}}function gv(){dg()}function dg(){_d=Eh=!1;var e=0;Po!==0&&Ev()&&(e=Po);for(var t=st(),a=null,l=Wc;l!==null;){var c=l.next,u=fg(l,t);u===0?(l.next=null,a===null?Wc=c:a.next=c,c===null&&(er=a)):(a=l,(e!==0||(u&3)!==0)&&(_d=!0)),l=c}En!==0&&En!==5||au(e),Po!==0&&(Po=0)}function fg(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var y=31-pn(u),C=1<<y,O=c[y];O===-1?((C&a)===0||(C&l)!==0)&&(c[y]=Ou(C,t)):O<=t&&(e.expiredLanes|=C),u&=~C}if(t=an,a=xt,a=as(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(Qt===2||Qt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Qe(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||kt(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&Qe(l),Ve(a)){case 2:case 8:a=Ct;break;case 32:a=cl;break;case 268435456:a=io;break;default:a=cl}return l=hg.bind(null,e),a=Yn(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&Qe(l),e.callbackPriority=2,e.callbackNode=null,2}function hg(e,t){if(En!==0&&En!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Ld()&&e.callbackNode!==a)return null;var l=xt;return l=as(e,e===an?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Ip(e,l,t),fg(e,st()),e.callbackNode!=null&&e.callbackNode===a?hg.bind(null,e):null)}function mg(e,t){if(Ld())return null;Ip(e,t,!0)}function yv(){Av(function(){(Gt&6)!==0?Yn($t,gv):dg()})}function Ah(){if(Po===0){var e=vl;e===0&&(e=ns,ns<<=1,(ns&261888)===0&&(ns=256)),Po=e}return Po}function pg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pi(e)}function bv(e,t,a,l,c){if(t==="submit"&&a&&a.stateNode===c){var u=pg((c[Jn]||null).action),y=l.submitter;y&&(t=(t=y[Jn]||null)?pg(t.formAction):y.getAttribute("formAction"),t!==null&&(u=t,y=null));var C=new Ja("action","action",null,l,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Po!==0){var O=new FormData(c,y);Lf(a,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(C.preventDefault(),O=new FormData(c,y),Lf(a,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var zh=0;zh<ms.length;zh++){var $h=ms[zh],vv=$h.toLowerCase(),xv=$h[0].toUpperCase()+$h.slice(1);_a(vv,"on"+xv)}_a(jr,"onAnimationEnd"),_a(Nr,"onAnimationIteration"),_a(Sr,"onAnimationStart"),_a("dblclick","onDoubleClick"),_a("focusin","onFocus"),_a("focusout","onBlur"),_a(fc,"onTransitionRun"),_a(hc,"onTransitionStart"),_a(mc,"onTransitionCancel"),_a(Iu,"onTransitionEnd"),Ds("onMouseEnter",["mouseout","mouseover"]),Ds("onMouseLeave",["mouseout","mouseover"]),Ds("onPointerEnter",["pointerout","pointerover"]),Ds("onPointerLeave",["pointerout","pointerover"]),Pa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Pa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Pa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Pa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Pa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Pa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lu="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(" "),wv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(lu));function gg(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var y=l.length-1;0<=y;y--){var C=l[y],O=C.instance,V=C.currentTarget;if(C=C.listener,O!==u&&c.isPropagationStopped())break e;u=C,c.currentTarget=V;try{u(c)}catch(J){ps(J)}c.currentTarget=null,u=O}else for(y=0;y<l.length;y++){if(C=l[y],O=C.instance,V=C.currentTarget,C=C.listener,O!==u&&c.isPropagationStopped())break e;u=C,c.currentTarget=V;try{u(c)}catch(J){ps(J)}c.currentTarget=null,u=O}}}}function bt(e,t){var a=t[ci];a===void 0&&(a=t[ci]=new Set);var l=e+"__bubble";a.has(l)||(yg(t,e,2,!1),a.add(l))}function Oh(e,t,a){var l=0;t&&(l|=4),yg(a,e,l,t)}var Ud="_reactListening"+Math.random().toString(36).slice(2);function Rh(e){if(!e[Ud]){e[Ud]=!0,Pi.forEach(function(a){a!=="selectionchange"&&(wv.has(a)||Oh(a,!1,e),Oh(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ud]||(t[Ud]=!0,Oh("selectionchange",!1,t))}}function yg(e,t,a,l){switch(oy(t)){case 2:var c=hx;break;case 8:c=mx;break;default:c=em}a=c.bind(null,t,a,e),c=void 0,!mr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function Dh(e,t,a,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var y=l.tag;if(y===3||y===4){var C=l.stateNode.containerInfo;if(C===c)break;if(y===4)for(y=l.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;C!==null;){if(y=ss(C),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){l=u=y;continue e}C=C.parentNode}}l=l.return}mo(function(){var V=u,J=In(a),oe=[];e:{var U=kr.get(e);if(U!==void 0){var Q=Ja,Ee=e;switch(e){case"keypress":if(rs(a)===0)break e;case"keydown":case"keyup":Q=Vu;break;case"focusin":Ee="focus",Q=nc;break;case"focusout":Ee="blur",Q=nc;break;case"beforeblur":case"afterblur":Q=nc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=pl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=Cf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Gu;break;case jr:case Nr:case Sr:Q=_u;break;case Iu:Q=Yu;break;case"scroll":case"scrollend":Q=Bu;break;case"wheel":Q=Ku;break;case"copy":case"cut":case"paste":Q=yr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=gn;break;case"submit":Q=$n;break;case"toggle":case"beforetoggle":Q=Us}var Be=(t&4)!==0,ct=!Be&&(e==="scroll"||e==="scrollend"),q=Be?U!==null?U+"Capture":null:U;Be=[];for(var H=V,Z;H!==null;){var se=H;if(Z=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||Z===null||q===null||(se=po(H,q),se!=null&&Be.push(su(H,se,Z))),ct)break;H=H.return}0<Be.length&&(U=new Q(U,Ee,null,a,J),oe.push({event:U,listeners:Be}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",Q&&a!==ve&&(Ee=a.relatedTarget||a.fromElement)&&(ss(Ee)||Ee[ls]))break e;(U||Q)&&(Ee=J.window===J?J:(Q=J.ownerDocument)?Q.defaultView||Q.parentWindow:window,U?(Q=a.relatedTarget||a.toElement,U=V,Q=Q?ss(Q):null,Q!==null&&(ct=p(Q),Be=Q.tag,Q!==ct||Be!==5&&Be!==27&&Be!==6)&&(Q=null)):(U=null,Q=V),U!==Q&&(Be=pl,se="onMouseLeave",q="onMouseEnter",H="mouse",(e==="pointerout"||e==="pointerover")&&(Be=gn,se="onPointerLeave",q="onPointerEnter",H="pointer"),ct=U==null?Ee:ui(U),Z=Q==null?Ee:ui(Q),Ee=new Be(se,H+"leave",U,a,J),Ee.target=ct,Ee.relatedTarget=Z,se=null,ss(J)===V&&(Be=new Be(q,H+"enter",Q,a,J),Be.target=Z,Be.relatedTarget=ct,se=Be),ct=se,Be=U&&Q?ie(U,Q,jv):null,U!==null&&bg(oe,Ee,U,Be,!1),Q!==null&&ct!==null&&bg(oe,ct,Q,Be,!0)))}e:{if(U=V?ui(V):window,Q=U.nodeName&&U.nodeName.toLowerCase(),Q==="select"||Q==="input"&&U.type==="file")var Re=cc;else if(vr(U))if(Ia)Re=hs;else{Re=$f;var wt=Fu}else Q=U.nodeName,!Q||Q.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?V&&lt(V.elementType)&&(Re=cc):Re=Of;if(Re&&(Re=Re(e,V))){xr(oe,Re,a,J);break e}wt&&wt(e,U,V)}switch(wt=V?ui(V):window,e){case"focusin":(vr(wt)||wt.contentEditable==="true")&&(_l=wt,dc=V,La=null);break;case"focusout":La=dc=_l=null;break;case"mousedown":wr=!0;break;case"contextmenu":case"mouseup":case"dragend":wr=!1,wi(oe,a,J);break;case"selectionchange":if(Ju)break;case"keydown":case"keyup":wi(oe,a,J)}var Ue;if(oc)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else yo?ic(e,a)&&(Ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ke="onCompositionStart");Ke&&(un&&a.locale!=="ko"&&(yo||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&yo&&(Ue=pr()):(zn=J,_s="value"in zn?zn.value:zn.textContent,yo=!0)),wt=qd(V,Ke),0<wt.length&&(Ke=new ac(Ke,e,null,a,J),oe.push({event:Ke,listeners:wt}),Ue?Ke.data=Ue:(Ue=jn(a),Ue!==null&&(Ke.data=Ue)))),(Ue=We?Af(e,a):yl(e,a))&&(Ke=qd(V,"onBeforeInput"),0<Ke.length&&(wt=new ac("onBeforeInput","beforeinput",null,a,J),oe.push({event:wt,listeners:Ke}),wt.data=Ue)),bv(oe,e,V,a,J)}gg(oe,t)})}function su(e,t,a){return{instance:e,listener:t,currentTarget:a}}function qd(e,t){for(var a=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=po(e,a),c!=null&&l.unshift(su(e,c,u)),c=po(e,t),c!=null&&l.push(su(e,c,u))),e.tag===3)return l;e=e.return}return[]}function jv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function bg(e,t,a,l,c){for(var u=t._reactName,y=[];a!==null&&a!==l;){var C=a,O=C.alternate,V=C.stateNode;if(C=C.tag,O!==null&&O===l)break;C!==5&&C!==26&&C!==27||V===null||(O=V,c?(V=po(a,u),V!=null&&y.unshift(su(a,V,O))):c||(V=po(a,u),V!=null&&y.push(su(a,V,O)))),a=a.return}y.length!==0&&e.push({event:t,listeners:y})}var Nv=/\r\n?/g,Sv=/\u0000|\uFFFD/g;function vg(e){return(typeof e=="string"?e:""+e).replace(Nv,`
49
+ `).replace(Sv,"")}function xg(e,t){return t=vg(t),vg(e)===t}function Jt(e,t,a,l,c,u){switch(a){case"children":if(typeof l=="string")t==="body"||t==="textarea"&&l===""||uo(e,l);else if(typeof l=="number"||typeof l=="bigint")t!=="body"&&uo(e,""+l);else return;break;case"className":hi(e,"class",l);break;case"tabIndex":hi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":hi(e,a,l);break;case"style":Hs(e,l,u);return;case"data":if(t!=="object"){hi(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=pi(l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"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 u=="function"&&(a==="formAction"?(t!=="input"&&Jt(e,t,"name",c.name,c,null),Jt(e,t,"formEncType",c.formEncType,c,null),Jt(e,t,"formMethod",c.formMethod,c,null),Jt(e,t,"formTarget",c.formTarget,c,null)):(Jt(e,t,"encType",c.encType,c,null),Jt(e,t,"method",c.method,c,null),Jt(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=pi(l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Da);return;case"onScroll":l!=null&&bt("scroll",e);return;case"onScrollEnd":l!=null&&bt("scrollend",e);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(f(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(f(60));(u!=null?u.__html:void 0)!==a&&(e.innerHTML=a)}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=pi(l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":bt("beforetoggle",e),bt("toggle",e),fi(e,"popover",l);break;case"xlinkActuate":fl(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":fl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":fl(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":fl(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":fl(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":fl(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":fl(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":fl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":fl(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":fi(e,"is",l);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=fo.get(a)||a,fi(e,a,l);else return}ot=!0}function Bh(e,t,a,l,c,u){switch(a){case"style":Hs(e,l,u);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(f(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(f(60));(u!=null?u.__html:void 0)!==a&&(e.innerHTML=a)}}break;case"children":if(typeof l=="string")uo(e,l);else if(typeof l=="number"||typeof l=="bigint")uo(e,""+l);else return;break;case"onScroll":l!=null&&bt("scroll",e);return;case"onScrollEnd":l!=null&&bt("scrollend",e);return;case"onClick":l!=null&&(e.onclick=Da);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!dl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),u=a.slice(2,c?a.length-7:void 0),t=e[Jn]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(u,t,c),typeof l=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(u,l,c);break e}ot=!0,a in e?e[a]=l:l===!0?e.setAttribute(a,""):fi(e,a,l)}return}ot=!0}function ma(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":bt("error",e),bt("load",e);var l=!1,c=!1,u;for(u in a)if(a.hasOwnProperty(u)){var y=a[u];if(y!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:Jt(e,t,u,y,a,null)}}c&&Jt(e,t,"srcSet",a.srcSet,a,null),l&&Jt(e,t,"src",a.src,a,null);return;case"input":bt("invalid",e);var C=u=y=c=null,O=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var J=a[l];if(J!=null)switch(l){case"name":c=J;break;case"type":y=J;break;case"checked":O=J;break;case"defaultChecked":V=J;break;case"value":u=J;break;case"defaultValue":C=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(f(137,t));break;default:Jt(e,t,l,J,a,null)}}Ii(e,u,C,O,V,y,c,!1);return;case"select":bt("invalid",e),l=y=u=null;for(c in a)if(a.hasOwnProperty(c)&&(C=a[c],C!=null))switch(c){case"value":u=C;break;case"defaultValue":y=C;break;case"multiple":l=C;default:Jt(e,t,c,C,a,null)}t=u,a=y,e.multiple=!!l,t!=null?Bs(e,!!l,t,!1):a!=null&&Bs(e,!!l,a,!0);return;case"textarea":bt("invalid",e),u=c=l=null;for(y in a)if(a.hasOwnProperty(y)&&(C=a[y],C!=null))switch(y){case"value":l=C;break;case"defaultValue":c=C;break;case"children":u=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(f(91));break;default:Jt(e,t,y,C,a,null)}ro(e,l,c,u);return;case"option":for(O in a)if(a.hasOwnProperty(O)&&(l=a[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Jt(e,t,O,l,a,null)}return;case"dialog":bt("beforetoggle",e),bt("toggle",e),bt("cancel",e),bt("close",e);break;case"iframe":case"object":bt("load",e);break;case"video":case"audio":for(l=0;l<lu.length;l++)bt(lu[l],e);break;case"image":bt("error",e),bt("load",e);break;case"details":bt("toggle",e);break;case"embed":case"source":case"link":bt("error",e),bt("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(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:Jt(e,t,V,l,a,null)}return;default:if(lt(t)){for(J in a)a.hasOwnProperty(J)&&(l=a[J],l!==void 0&&Bh(e,t,J,l,a,void 0));return}}for(C in a)a.hasOwnProperty(C)&&(l=a[C],l!=null&&Jt(e,t,C,l,a,null))}var kv={};function Tv(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,y=null,C=null,O=null,V=null,J=null;for(Q in a){var oe=a[Q];if(a.hasOwnProperty(Q)&&oe!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":O=oe;default:l.hasOwnProperty(Q)||Jt(e,t,Q,null,l,oe)}}for(var U in l){var Q=l[U];if(oe=a[U],l.hasOwnProperty(U)&&(Q!=null||oe!=null))switch(U){case"type":Q!==oe&&(ot=!0),u=Q;break;case"name":Q!==oe&&(ot=!0),c=Q;break;case"checked":Q!==oe&&(ot=!0),V=Q;break;case"defaultChecked":Q!==oe&&(ot=!0),J=Q;break;case"value":Q!==oe&&(ot=!0),y=Q;break;case"defaultValue":Q!==oe&&(ot=!0),C=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(f(137,t));break;default:Q!==oe&&Jt(e,t,U,Q,l,oe)}}Ji(e,y,C,O,V,J,u,c);return;case"select":Q=y=C=U=null;for(u in a)if(O=a[u],a.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":Q=O;default:l.hasOwnProperty(u)||Jt(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=a[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":u!==O&&(ot=!0),U=u;break;case"defaultValue":u!==O&&(ot=!0),C=u;break;case"multiple":u!==O&&(ot=!0),y=u;default:u!==O&&Jt(e,t,c,u,l,O)}t=C,a=y,l=Q,U!=null?Bs(e,!!a,U,!1):!!l!=!!a&&(t!=null?Bs(e,!!a,t,!0):Bs(e,!!a,a?[]:"",!1));return;case"textarea":Q=U=null;for(C in a)if(c=a[C],a.hasOwnProperty(C)&&c!=null&&!l.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Jt(e,t,C,null,l,c)}for(y in l)if(c=l[y],u=a[y],l.hasOwnProperty(y)&&(c!=null||u!=null))switch(y){case"value":c!==u&&(ot=!0),U=c;break;case"defaultValue":c!==u&&(ot=!0),Q=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(f(91));break;default:c!==u&&Jt(e,t,y,c,l,u)}hr(e,U,Q);return;case"option":for(var Ee in a)if(U=a[Ee],a.hasOwnProperty(Ee)&&U!=null&&!l.hasOwnProperty(Ee))switch(Ee){case"selected":e.selected=!1;break;default:Jt(e,t,Ee,null,l,U)}for(O in l)if(U=l[O],Q=a[O],l.hasOwnProperty(O)&&U!==Q&&(U!=null||Q!=null))switch(O){case"selected":U!==Q&&(ot=!0),e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Jt(e,t,O,U,l,Q)}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 Be in a)U=a[Be],a.hasOwnProperty(Be)&&U!=null&&!l.hasOwnProperty(Be)&&Jt(e,t,Be,null,l,U);for(V in l)if(U=l[V],Q=a[V],l.hasOwnProperty(V)&&U!==Q&&(U!=null||Q!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,t));break;default:Jt(e,t,V,U,l,Q)}return;default:if(lt(t)){for(var ct in a)U=a[ct],a.hasOwnProperty(ct)&&U!==void 0&&!l.hasOwnProperty(ct)&&Bh(e,t,ct,void 0,l,U);for(J in l)U=l[J],Q=a[J],!l.hasOwnProperty(J)||U===Q||U===void 0&&Q===void 0||Bh(e,t,J,U,l,Q);return}}for(var q in a)U=a[q],a.hasOwnProperty(q)&&U!=null&&!l.hasOwnProperty(q)&&Jt(e,t,q,null,l,U);for(oe in l)U=l[oe],Q=a[oe],!l.hasOwnProperty(oe)||U===Q||U==null&&Q==null||Jt(e,t,oe,U,l,Q)}function wg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Cv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var c=a[l],u=c.transferSize,y=c.initiatorType,C=c.duration;if(u&&C&&wg(y)){for(y=0,C=c.responseEnd,l+=1;l<a.length;l++){var O=a[l],V=O.startTime;if(V>C)break;var J=O.transferSize,oe=O.initiatorType;J&&wg(oe)&&(O=O.responseEnd,y+=J*(O<C?1:(C-V)/(O-V)))}if(--l,t+=8*(u+y)/(c.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 Hh=null,Lh=null;function ou(e){return e.nodeType===9?e:e.ownerDocument}function jg(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 Ng(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 Sg(e,t,a,l){return a=ou(a).createElement(e),a[nn]=l,a[Jn]=t,ma(a,e,t),Xn(a),a}function _h(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 Uh=null;function Ev(){var e=window.event;return e&&e.type==="popstate"?e===Uh?!1:(Uh=e,!0):(Uh=null,!1)}var qh=typeof setTimeout=="function"?setTimeout:void 0,Mv=typeof clearTimeout=="function"?clearTimeout:void 0,kg=typeof Promise=="function"?Promise:void 0,Tg=typeof requestAnimationFrame=="function"?requestAnimationFrame:qh,Av=typeof queueMicrotask=="function"?queueMicrotask:typeof kg<"u"?function(e){return kg.resolve(null).then(e).catch(zv)}:qh;function zv(e){setTimeout(function(){throw e})}function Jo(e){return e==="head"}function Cg(e,t){var a=t,l=0;do{var c=a.nextSibling;if(e.removeChild(a),c&&c.nodeType===8)if(a=c.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(c),ir(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Qh(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Qh(a);for(var u=a.firstChild;u;){var y=u.nextSibling,C=u.nodeName;u[co]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=y}}else a==="body"&&Qh(e.ownerDocument.body);a=c}while(a);ir(t)}function Eg(e,t){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Mg(e,t,a){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,a!=null&&(e.style.viewTransitionClass=a),a=getComputedStyle(e),a.display==="inline"){if(t=e.getClientRects(),t.length===1)var l=1;else for(var c=l=0;c<t.length;c++){var u=t[c];0<u.width&&0<u.height&&l++}l===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function Ag(e,t){e=e.style,t=t.style;var a=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(a=t.display,e.display=a==null||typeof a=="boolean"?"":a,a=t.margin,a!=null?e.margin=a:(a=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=a==null||typeof a=="boolean"?"":a,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function $v(e,t,a){return a=a.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<=a.innerHeight&&e.left<=a.innerWidth}}function Vh(e){var t=e.getBoundingClientRect(),a=getComputedStyle(e);return $v(t,a,e)}function Ov(e){return e.documentElement.clientHeight}function Rv(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Dv(e,t,a,l,c,u,y,C,O){var V=t.nodeType===9?t:t.ownerDocument;try{var J=V.startViewTransition({update:function(){var U=V.defaultView,Q=U.navigation&&U.navigation.transition,Ee=V.fonts.status;l();var Be=[];if(Ee==="loaded"&&(Ov(V),V.fonts.status==="loading"&&Be.push(V.fonts.ready)),Ee=Be.length,e!==null)for(var ct=e.suspenseyImages,q=0,H=0;H<ct.length;H++){var Z=ct[H];if(!Z.complete){var se=Z.getBoundingClientRect();if(0<se.bottom&&0<se.right&&se.top<U.innerHeight&&se.left<U.innerWidth){if(q+=Jg(Z),q>Yd){Be.length=Ee;break}Z=new Promise(Rv.bind(Z)),Be.push(Z)}}}if(0<Be.length)return U=Promise.race([Promise.all(Be),new Promise(function(Re){return setTimeout(Re,500)})]).then(c,c),(Q?Promise.allSettled([Q.finished,U]):U).then(u,u);if(c(),Q)return Q.finished.then(u,u);u()},types:a});V.__reactViewTransition=J;var oe=[];return J.ready.then(function(){for(var U=V.documentElement.getAnimations({subtree:!0}),Q=0;Q<U.length;Q++){var Ee=U[Q],Be=Ee.effect,ct=Be.pseudoElement;if(ct!=null&&ct.startsWith("::view-transition")){oe.push(Ee),Ee=Be.getKeyframes();for(var q=ct=void 0,H=!0,Z=0;Z<Ee.length;Z++){var se=Ee[Z],Re=se.width;if(ct===void 0)ct=Re;else if(ct!==Re){H=!1;break}if(Re=se.height,q===void 0)q=Re;else if(q!==Re){H=!1;break}delete se.width,delete se.height,se.transform==="none"&&delete se.transform}H&&ct!==void 0&&q!==void 0&&(Be.setKeyframes(Ee),H=getComputedStyle(Be.target,Be.pseudoElement),H.width!==ct||H.height!==q)&&(H=Ee[0],H.width=ct,H.height=q,H=Ee[Ee.length-1],H.width=ct,H.height=q,Be.setKeyframes(Ee))}}y()},function(U){V.__reactViewTransition===J&&(V.__reactViewTransition=null);try{if(typeof U=="object"&&U!==null)switch(U.name){case"InvalidStateError":(U.message==="View transition was skipped because document visibility state is hidden."||U.message==="Skipping view transition because document visibility state has become hidden."||U.message==="Skipping view transition because viewport size changed."||U.message==="Transition was aborted because of invalid state")&&(U=null)}U!==null&&O(U)}finally{l(),c(),y()}}),J.finished.finally(function(){for(var U=0;U<oe.length;U++)oe[U].cancel();V.__reactViewTransition===J&&(V.__reactViewTransition=null),C()}),J}catch{return l(),c(),y(),null}}function Xi(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Xi.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:le({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Xi.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),l=[],c=0;c<a.length;c++){var u=a[c].effect;u!==null&&u.target===e&&u.pseudoElement===t&&l.push(a[c])}return l},Xi.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function zg(e){return{name:e,group:new Xi("group",e),imagePair:new Xi("image-pair",e),old:new Xi("old",e),new:new Xi("new",e)}}function ol(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}ol.prototype.addEventListener=function(e,t,a){var l=null,c=null;if(!(a!=null&&typeof a!="boolean"&&(l=a.signal||null,l!==null&&l.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var u=this._eventListeners;if(Og(u,e,t,a)===-1){var y=this,C=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(C=function(O){y.removeEventListener(e,t,a),typeof t=="function"?t.call(this,O):t.handleEvent(O)}),l!==null&&(c=y.removeEventListener.bind(y,e,t,a),l.addEventListener("abort",c,{once:!0}),c=l.removeEventListener.bind(l,"abort",c)),l=tr(a),u.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:C,cleanup:c}),j(this._fragmentFiber.child,!1,Bv,e,C,l)}this._eventListeners=u}};function Bv(e,t,a,l){return k(e).addEventListener(t,a,l),!1}ol.prototype.removeEventListener=function(e,t,a){var l=this._eventListeners;if(l!==null&&(t=Og(l,e,t,a),t!==-1)){var c=l[t];a=c.attachedListener;var u=c.cleanup;c=tr(c.optionsOrUseCapture),j(this._fragmentFiber.child,!1,Hv,e,a,c),l.splice(t,1),u!==null&&u()}};function Hv(e,t,a,l){return k(e).removeEventListener(t,a,l),!1}function tr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function $g(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Og(e,t,a,l){if(e.length===0)return-1;l=$g(l);for(var c=0;c<e.length;c++){var u=e[c];if(u.type===t&&u.listener===a&&$g(u.optionsOrUseCapture)===l)return c}return-1}ol.prototype.dispatchEvent=function(e){var t=M(this._fragmentFiber);if(t===null)return!0;t=k(t);var a=this._eventListeners;if(a!==null&&0<a.length||!e.bubbles){var l=t.nodeType===9?t.createComment(""):document.createTextNode("");if(a)for(var c=0;c<a.length;c++){var u=a[c];l.addEventListener(u.type,u.attachedListener,tr(u.optionsOrUseCapture))}if(t.appendChild(l),e=l.dispatchEvent(e),a)for(c=0;c<a.length;c++)u=a[c],l.removeEventListener(u.type,u.attachedListener,tr(u.optionsOrUseCapture));return t.removeChild(l),e}return t.dispatchEvent(e)},ol.prototype.focus=function(e){j(this._fragmentFiber.child,!0,Rg,e,void 0,void 0)};function Rg(e,t){return e.tag===6?!1:(e=k(e),Qv(e,t))}ol.prototype.focusLast=function(e){var t=[];j(this._fragmentFiber.child,!0,Gh,t,void 0,void 0);for(var a=t.length-1;0<=a&&!Rg(t[a],e);a--);};function Gh(e,t){return t.push(e),!1}ol.prototype.blur=function(){var e=M(this._fragmentFiber);e!==null&&(e=k(e),e=ou(e).activeElement,e!==null&&j(this._fragmentFiber.child,!1,Lv,e,void 0,void 0))};function Lv(e,t){return e.tag===6?!1:(e=k(e),e===t||e.contains(t)?(t.blur(),!0):!1)}ol.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),j(this._fragmentFiber.child,!1,_v,e,void 0,void 0)};function _v(e,t){return e.tag===6||(e=k(e),t.observe(e)),!1}ol.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),j(this._fragmentFiber.child,!1,Uv,e,void 0,void 0);for(var a=t=0;a<Wl.length;a++){var l=Wl[a];l.fragmentInstance===this&&l.observer===e?e.unobserve(l.instance):Wl[t++]=l}Wl.length=t}};function Uv(e,t){return e.tag===6||(e=k(e),t.unobserve(e)),!1}var Wl=[],Yh=!1;function qv(e,t,a){Wl.push({fragmentInstance:e,observer:t,instance:a}),Yh||(Yh=!0,Pv(function(){Yh=!1;var l=Wl;Wl=[];for(var c=0;c<l.length;c++){var u=l[c];u.observer.unobserve(u.instance)}}))}ol.prototype.getClientRects=function(){var e=[];return j(this._fragmentFiber.child,!1,Vv,e,void 0,void 0),e};function Vv(e,t){if(e.tag===6){e=e.stateNode;var a=e.ownerDocument.createRange();a.selectNodeContents(e),t.push.apply(t,a.getClientRects())}else e=k(e),t.push.apply(t,e.getClientRects());return!1}ol.prototype.getRootNode=function(e){var t=M(this._fragmentFiber);return t===null?this:k(t).getRootNode(e)},ol.prototype.compareDocumentPosition=function(e){var t=M(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];j(this._fragmentFiber.child,!1,Gh,a,void 0,void 0);var l=k(t);if(a.length===0){if(a=l,$(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&&(a=t)}t=this._fragmentFiber;var c=l=a.compareDocumentPosition(e);return a===e?c=Node.DOCUMENT_POSITION_CONTAINS:l&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=L(t)[1],a===null?c=Node.DOCUMENT_POSITION_PRECEDING:(e=k(a).compareDocumentPosition(e),c=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),c|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=k(a[0]),c=k(a[a.length-1]);var u=$(this._fragmentFiber)?t.parentElement:l;if(u==null)return Node.DOCUMENT_POSITION_DISCONNECTED;l=u.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,u=u.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_CONTAINED_BY;var y=t.compareDocumentPosition(e),C=c.compareDocumentPosition(e),O=y&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=l&&u&&y&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,t=l&&t===e||u&&c===e||O||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!l&&t===e||!u&&c===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:y,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Gv(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Gv(e,t,a,l,c){var u=ss(c);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!u)e:{for(;u!==null;){if(u.tag===7&&(u===t||u.alternate===t)){a=!0;break e}u=u.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(u===null)return u=c.ownerDocument,c===u||c===u.documentElement||c===u.body;e:{for(u=t,t=M(t);u!==null;){if(!(u.tag!==5&&u.tag!==3&&u.tag!==27||u!==t&&u.alternate!==t)){u=!0;break e}u=u.return}u=!1}return u}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!u)&&!(t=u===a)&&(t=ie(a,u,te),t===null?t=!1:(j(t,!0,X,u,a),u=_,_=null,t=u!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!u)&&!(t=u===l)&&(t=ie(l,u,te),t===null?t=!1:(j(t,!0,ne,u,l),u=_,W=_=null,t=u!==null)),t):!1}function Dg(e,t){var a=e.ownerDocument.createRange();a.selectNodeContents(e),e=a.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}ol.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(f(566));var t=[];j(this._fragmentFiber.child,!1,Gh,t,void 0,void 0);var a=e!==!1;if(t.length===0){var l=L(this._fragmentFiber);if(l=a?l[1]||l[0]||M(this._fragmentFiber):l[0]||l[1],l===null)return;if(l.tag===6){e=k(l),Dg(e,a);return}if(l=k(l),l.nodeType!==9){if(l.nodeType===11){a="host"in l?l.host:null,a!==null&&a.scrollIntoView(e);return}l.scrollIntoView(e)}}for(l=a?t.length-1:0;l!==(a?-1:t.length);){var c=t[l];c.tag===6?(c=k(c),Dg(c,a)):k(c).scrollIntoView(e),l+=a?-1:1}};function Yv(e,t){return e=k(e),Bg(e,t),!1}function Bg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Hg(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var c=a[l];e.addEventListener(c.type,c.attachedListener,tr(c.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(u){for(var y=0,C=0;C<Wl.length;C++){var O=Wl[C];(O.fragmentInstance!==t||O.observer!==u||O.instance!==e)&&(Wl[y++]=O)}Wl.length=y,u.observe(e)}),Bg(e,t))}function Xv(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var c=a[l];e.removeEventListener(c.type,c.attachedListener,tr(c.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(u){typeof u.rootMargin=="string"?qv(t,u,e):u.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Xh(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Xh(a),Qi(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Kv(e,t,a,l){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[co])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Tl(e.nextSibling),e===null)break}return null}function Zv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Tl(e.nextSibling),e===null))return null;return e}function Lg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Tl(e.nextSibling),e===null))return null;return e}function Kh(e){return e.data==="$?"||e.data==="$~"}function Zh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Fv(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Tl(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 Fh=null;function _g(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Tl(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Ug(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Qv(e,t){function a(){l=!0}if(e.ownerDocument.activeElement===e)return!0;var l=!1;try{e.ownerDocument.addEventListener("focus",a,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",a,!0)}return l}function Pv(e){Tg(function(){Tg(function(t){return e(t)})})}function qg(e,t,a){switch(t=ou(a),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 Vg(e,t,a){for(var l in a){var c=a[l];a.hasOwnProperty(l)&&c!=null&&Jt(e,t,l,null,kv,c)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Da&&(e.onclick=null),Qi(e)}function Qh(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Qi(e)}var Cl=new Map,Gg=new Set;function iu(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 so=xe.d;xe.d={f:Jv,r:Iv,D:Wv,C:ex,L:tx,m:nx,X:lx,S:ax,M:sx};function Jv(){var e=so.f(),t=Dd();return e||t}function Iv(e){var t=zl(e);t!==null&&t.tag===5&&t.type==="form"?Xm(t):so.r(e)}var nr=typeof document>"u"?null:document;function Yg(e,t,a){var l=nr;if(l&&typeof t=="string"&&t){var c=Ln(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Gg.has(c)||(Gg.add(c),e={rel:e,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),ma(t,"link",e),Xn(t),l.head.appendChild(t)))}}function Wv(e){so.D(e),Yg("dns-prefetch",e,null)}function ex(e,t){so.C(e,t),Yg("preconnect",e,t)}function tx(e,t,a){so.L(e,t,a);var l=nr;if(l&&e&&t){var c='link[rel="preload"][as="'+Ln(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+Ln(a.imageSizes)+'"]')):c+='[href="'+Ln(e)+'"]';var u=c;switch(t){case"style":u=ar(e);break;case"script":u=lr(e)}if(!(Cl.has(u)||(e=le({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Cl.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(cu(u))||t==="script"&&l.querySelector(ru(u))))){var y=l.createElement("link");ma(y,"link",e),t==="style"&&(y[ri]=!0,y.onload=y.onerror=function(){dr(y)}),Xn(y),l.head.appendChild(y)}}}function nx(e,t){so.m(e,t);var a=nr;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Ln(l)+'"][href="'+Ln(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=lr(e)}if(!Cl.has(u)&&(e=le({rel:"modulepreload",href:e},t),Cl.set(u,e),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ru(u)))return}l=a.createElement("link"),ma(l,"link",e),Xn(l),a.head.appendChild(l)}}}function ax(e,t,a){so.S(e,t,a);var l=nr;if(l&&e){var c=$l(l).hoistableStyles,u=ar(e);t=t||"default";var y=c.get(u);if(!y){var C={loading:0,preload:null};if(y=l.querySelector(cu(u)))C.loading=5;else{e=le({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Cl.get(u))&&Ph(e,a);var O=y=l.createElement("link");Xn(O),ma(O,"link",e),O._p=new Promise(function(V,J){O.onload=V,O.onerror=J}),O.addEventListener("load",function(){C.loading|=1}),O.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Vd(y,t,l)}y={type:"stylesheet",instance:y,count:1,state:C},c.set(u,y)}}}function lx(e,t){so.X(e,t);var a=nr;if(a&&e){var l=$l(a).hoistableScripts,c=lr(e),u=l.get(c);u||(u=a.querySelector(ru(c)),u||(e=le({src:e,async:!0},t),(t=Cl.get(c))&&Jh(e,t),u=a.createElement("script"),Xn(u),ma(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function sx(e,t){so.M(e,t);var a=nr;if(a&&e){var l=$l(a).hoistableScripts,c=lr(e),u=l.get(c);u||(u=a.querySelector(ru(c)),u||(e=le({src:e,async:!0,type:"module"},t),(t=Cl.get(c))&&Jh(e,t),u=a.createElement("script"),Xn(u),ma(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Xg(e,t,a,l){var c=(c=Pn.current)?iu(c):null;if(!c)throw Error(f(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=ar(a.href),t=$l(c).hoistableStyles,l=t.get(a),l||(l={type:"style",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ar(a.href);var u=$l(c).hoistableStyles,y=u.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,y),(u=c.querySelector(cu(e)))?u._p||(y.instance=u,y.state.loading=5):(u=Cl.get(e),u||(u={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Cl.set(e,u)),ox(c,e,u,y.state))),t&&l===null)throw Error(f(528,""));return y}if(t&&l!==null)throw Error(f(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=lr(a),t=$l(c).hoistableScripts,l=t.get(a),l||(l={type:"script",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,e))}}function ar(e){return'href="'+Ln(e)+'"'}function cu(e){return'link[rel="stylesheet"]['+e+"]"}function Kg(e){return le({},e,{"data-precedence":e.precedence,precedence:null})}function ox(e,t,a,l){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[ri]!==!0){l.loading=1;return}}else t=e.createElement("link"),t[ri]=!0,t.onload=t.onerror=dr.bind(null,t),ma(t,"link",a),Xn(t),e.head.appendChild(t);l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2})}function lr(e){return'[src="'+Ln(e)+'"]'}function ru(e){return"script[async]"+e}function Zg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(l)return t.instance=l,Xn(l),l;var c=le({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Xn(l),ma(l,"style",c),Vd(l,a.precedence,e),t.instance=l;case"stylesheet":c=ar(a.href);var u=e.querySelector(cu(c));if(u)return t.state.loading|=4,t.instance=u,Xn(u),u;l=Kg(a),(c=Cl.get(c))&&Ph(l,c),u=(e.ownerDocument||e).createElement("link"),Xn(u);var y=u;return y._p=new Promise(function(C,O){y.onload=C,y.onerror=O}),ma(u,"link",l),t.state.loading|=4,Vd(u,a.precedence,e),t.instance=u;case"script":return u=lr(a.src),(c=e.querySelector(ru(u)))?(t.instance=c,Xn(c),c):(l=a,(c=Cl.get(u))&&(l=le({},a),Jh(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),Xn(c),ma(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(f(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Vd(l,a.precedence,e));return t.instance}function Vd(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,y=0;y<l.length;y++){var C=l[y];if(C.dataset.precedence===t)u=C;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ph(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Jh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Gd=null;function Fg(e,t,a){if(Gd===null){var l=new Map,c=Gd=new Map;c.set(a,l)}else c=Gd,l=c.get(a),l||(l=new Map,c.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var u=a[c];if(!(u[co]||u[nn]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var y=u.getAttribute(t)||"";y=e+y;var C=l.get(y);C?C.push(u):l.set(y,[u])}}return l}function Ih(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function ix(e,t,a){if(a===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 Qg(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Pg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Jg(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Ig(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Jg(t),e.suspenseyImages.push(t)),e=ux.bind(e),t.decode().then(e,e))}function cx(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=ar(l.href),u=t.querySelector(cu(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=uu.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,Xn(u);return}u=t.ownerDocument||t,l=Kg(l),(c=Cl.get(c))&&Ph(l,c),u=u.createElement("link"),Xn(u);var y=u;y._p=new Promise(function(C,O){y.onload=C,y.onerror=O}),ma(u,"link",l),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=uu.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Yd=0;function rx(e,t){return e.stylesheets&&e.count===0&&Kd(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Kd(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Yd===0&&(Yd=62500*Cv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Kd(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Yd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function Wg(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Kd(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function uu(){this.count--,Wg(this)}function ux(){this.imgCount--,Wg(this)}var Xd=null;function Kd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xd=new Map,t.forEach(dx,e),Xd=null,uu.call(e))}function dx(e,t){if(!(t.state.loading&4)){var a=Xd.get(e);if(a)var l=a.get(null);else{a=new Map,Xd.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var y=c[u];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),l=y)}l&&a.set(null,l)}c=t.instance,y=c.getAttribute("data-precedence"),u=a.get(y)||l,u===l&&a.set(null,c),a.set(y,c),this.count++,l=uu.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var sr={$$typeof:at,Provider:null,Consumer:null,_currentValue:Kt,_currentValue2:Kt,_threadCount:0};function fx(e,t,a,l,c,u,y,C,O){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=Oa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oa(0),this.hiddenUpdates=Oa(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.transitionTypes=null,this.incompleteTransitions=new Map}function ey(e,t,a,l,c,u,y,C,O,V,J,oe){return e=new fx(e,t,a,y,O,V,J,oe,C),t=1,u===!0&&(t|=24),u=Na(3,null,null,t),e.current=u,u.stateNode=e,t=Cr(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:a,cache:t},Dr(u),e}function ty(e){return e?(e=ql,e):ql}function ny(e,t,a,l,c,u){c=ty(c),l.context===null?l.context=c:l.pendingContext=c,l=js(t),l.payload={element:a},u=u===void 0?null:u,u!==null&&(l.callback=u),a=Zl(e,l,t),a!==null&&(Za(a,e,t),Bo(a,e,t))}function ay(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Wh(e,t){ay(e,t),(e=e.alternate)&&ay(e,t)}function ly(e){if(e.tag===13||e.tag===31){var t=gs(e,67108864);t!==null&&Za(t,e,67108864),Wh(e,67108864)}}function sy(e){if(e.tag===13||e.tag===31){var t=sl();t=Lt(t);var a=gs(e,t);a!==null&&Za(a,e,t),Wh(e,t)}}var or=!0;function hx(e,t,a,l){var c=de.T;de.T=null;var u=xe.p;try{xe.p=2,em(e,t,a,l)}finally{xe.p=u,de.T=c}}function mx(e,t,a,l){var c=de.T;de.T=null;var u=xe.p;try{xe.p=8,em(e,t,a,l)}finally{xe.p=u,de.T=c}}function em(e,t,a,l){if(or){var c=tm(l);if(c===null)Dh(e,t,l,Zd,a),iy(e,l);else if(gx(c,e,t,a,l))l.stopPropagation();else if(iy(e,l),t&4&&-1<px.indexOf(e)){for(;c!==null;){var u=zl(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var y=Ht(u.pendingLanes);if(y!==0){var C=u;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var O=1<<31-pn(y);C.entanglements[1]|=O,y&=~O}zs(u),(Gt&6)===0&&($d=st()+500,au(0))}}break;case 31:case 13:C=gs(u,2),C!==null&&Za(C,u,2),Dd(),Wh(u,2)}if(u=tm(l),u===null&&Dh(e,t,l,Zd,a),u===c)break;c=u}c!==null&&l.stopPropagation()}else Dh(e,t,l,null,a)}}function tm(e){return e=In(e),nm(e)}var Zd=null;function nm(e){if(Zd=null,e=ss(e),e!==null){var t=p(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=v(t),e!==null)return e;e=null}else if(a===31){if(e=S(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Zd=e,null}function oy(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(St()){case $t:return 2;case Ct:return 8;case cl:case rl:return 32;case io:return 268435456;default:return 32}default:return 32}}var am=!1,Io=null,Wo=null,ei=null,du=new Map,fu=new Map,ti=[],px="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 iy(e,t){switch(e){case"focusin":case"focusout":Io=null;break;case"dragenter":case"dragleave":Wo=null;break;case"mouseover":case"mouseout":ei=null;break;case"pointerover":case"pointerout":du.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":fu.delete(t.pointerId)}}function hu(e,t,a,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=zl(t),t!==null&&ly(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function gx(e,t,a,l,c){switch(t){case"focusin":return Io=hu(Io,e,t,a,l,c),!0;case"dragenter":return Wo=hu(Wo,e,t,a,l,c),!0;case"mouseover":return ei=hu(ei,e,t,a,l,c),!0;case"pointerover":var u=c.pointerId;return du.set(u,hu(du.get(u)||null,e,t,a,l,c)),!0;case"gotpointercapture":return u=c.pointerId,fu.set(u,hu(fu.get(u)||null,e,t,a,l,c)),!0}return!1}function cy(e){var t=ss(e.target);if(t!==null){var a=p(t);if(a!==null){if(t=a.tag,t===13){if(t=v(a),t!==null){e.blockedOn=t,Ra(e.priority,function(){sy(a)});return}}else if(t===31){if(t=S(a),t!==null){e.blockedOn=t,Ra(e.priority,function(){sy(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=tm(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);ve=l,a.target.dispatchEvent(l),ve=null}else return t=zl(a),t!==null&&ly(t),e.blockedOn=a,!1;t.shift()}return!0}function ry(e,t,a){Fd(e)&&a.delete(t)}function yx(){am=!1,Io!==null&&Fd(Io)&&(Io=null),Wo!==null&&Fd(Wo)&&(Wo=null),ei!==null&&Fd(ei)&&(ei=null),du.forEach(ry),fu.forEach(ry)}function Qd(e,t){e.blockedOn===t&&(e.blockedOn=null,am||(am=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,yx)))}var Pd=null;function uy(e){Pd!==e&&(Pd=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Pd===e&&(Pd=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nm(l||a)===null)continue;break}var u=zl(a);u!==null&&(e.splice(t,3),t-=3,Lf(u,{pending:!0,data:c,method:a.method,action:l},l,c))}}))}function ir(e){function t(O){return Qd(O,e)}Io!==null&&Qd(Io,e),Wo!==null&&Qd(Wo,e),ei!==null&&Qd(ei,e),du.forEach(t),fu.forEach(t);for(var a=0;a<ti.length;a++){var l=ti[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ti.length&&(a=ti[0],a.blockedOn===null);)cy(a),a.blockedOn===null&&ti.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var c=a[l],u=a[l+1],y=c[Jn]||null;if(typeof u=="function")y||uy(a);else if(y){var C=null;if(u&&u.hasAttribute("formAction")){if(c=u,y=u[Jn]||null)C=y.formAction;else if(nm(c)!==null)continue}else C=y.action;typeof C=="function"?a[l+1]=C:(a.splice(l,3),l-=3),uy(a)}}}function dy(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(y){return c=y})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function lm(e){this._internalRoot=e}Jd.prototype.render=lm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(f(409));var a=t.current,l=sl();ny(a,l,e,t,null,null)},Jd.prototype.unmount=lm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ny(e.current,2,null,e,null,null),Dd(),t[ls]=null}};function Jd(e){this._internalRoot=e}Jd.prototype.unstable_scheduleHydration=function(e){if(e){var t=sn();e={blockedOn:null,target:e,priority:t};for(var a=0;a<ti.length&&t!==0&&t<ti[a].priority;a++);ti.splice(a,0,e),a===0&&cy(e)}};var fy=o.version;if(fy!=="19.3.0")throw Error(f(527,fy,"19.3.0"));xe.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=E(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var bx={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:de,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Id=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Id.isDisabled&&Id.supportsFiber)try{ul=Id.inject(bx),ia=Id}catch{}}return pu.createRoot=function(e,t){if(!m(e))throw Error(f(299));var a=!1,l="",c=tp,u=np,y=ap;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=ey(e,1,!1,null,null,a,l,null,c,u,y,dy),e[ls]=t.current,Rh(e),new lm(t)},pu.hydrateRoot=function(e,t,a){if(!m(e))throw Error(f(299));var l=!1,c="",u=tp,y=np,C=ap,O=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError),a.formState!==void 0&&(O=a.formState)),t=ey(e,1,!0,t,a??null,l,c,O,u,y,C,dy),t.context=ty(null),a=t.current,l=sl(),l=Lt(l),c=js(l),c.callback=null,Zl(a,c,l),a=l,t.current.lanes=a,z(t,a),zs(t),e[ls]=t.current,Rh(e),new Jd(t)},pu.version="19.3.0",pu}var Ny;function Mx(){if(Ny)return im.exports;Ny=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),im.exports=Ex(),im.exports}var Ax=Mx();const Lm=Math.random().toString(36).slice(2),wf=(()=>{try{let n=localStorage.getItem("design-canvas:browser");return n||localStorage.setItem("design-canvas:browser",n=Math.random().toString(36).slice(2)),n}catch{return Lm}})();let pf="";const zx=n=>void(pf=n),Wd=()=>({"X-Easel-Client":wf,...pf?{"X-Easel-Author":encodeURIComponent(pf)}:{}});async function ai(n){const o=await n.json().catch(()=>({}));if(!n.ok)throw Object.assign(new Error(o.error??n.statusText),{status:n.status,body:o});return o}const Te={board:()=>fetch("/api/board").then(n=>ai(n)),update:()=>fetch("/api/update").then(n=>ai(n)),applyUpdate:()=>fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(async n=>({status:n.status,body:await n.json().catch(()=>({}))})),health:()=>fetch("/api/health",{cache:"no-store"}).then(n=>ai(n)),saveBoard:(n,o)=>fetch("/api/board",{method:"PUT",headers:{"Content-Type":"application/json",...Wd()},body:JSON.stringify({...n,clientId:Lm,...o?{label:o}:{}})}).then(r=>ai(r)),post:(n,o)=>fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...Wd()},body:JSON.stringify(o)}).then(r=>ai(r)),put:(n,o)=>fetch(n,{method:"PUT",headers:{"Content-Type":"application/json",...Wd()},body:JSON.stringify(o)}).then(r=>ai(r)),get:n=>fetch(n).then(o=>ai(o)),blob:(n,o)=>fetch(n,{method:"POST",headers:{"Content-Type":"application/json",...Wd()},body:JSON.stringify(o)}).then(r=>r.ok?r.blob():ai(r))};let vu=null,km=null;function gb(n){km=n,(vu==null?void 0:vu.readyState)===1&&vu.send(JSON.stringify({type:"editing",file:n,client:wf,person:pf||void 0}))}function $x(n){let o=null,r=!1;const f=()=>{o=vu=new WebSocket(`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`),o.onopen=()=>km&&gb(km),o.onmessage=m=>{try{n(JSON.parse(m.data))}catch{}},o.onclose=()=>{r||setTimeout(f,1e3)}};return f(),()=>{r=!0,o==null||o.close()}}function il(n){const o=n.ownerDocument,r=[];let f=n;for(;f&&f!==o.body;){const m=f.parentElement;if(!m)return null;r.unshift(Array.prototype.indexOf.call(m.children,f)),f=m}return f===o.body?r.join("/"):null}function hn(n,o){let r=n.body;if(!o)return r;for(const f of o.split("/"))if(r=(r==null?void 0:r.children[Number(f)])??null,!r)return null;return r}function Ml(n){const o=n.getBoundingClientRect();return{x:o.left,y:o.top,w:o.width,h:o.height}}const Ox=["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 Rx(n){const o=n.ownerDocument.defaultView.getComputedStyle(n),r={};for(const f of Ox)r[f]=o.getPropertyValue(f);return r}function Sy(n){const o={},r=n.style;if(!r)return o;for(let f=0;f<r.length;f++)o[r[f]]=r.getPropertyValue(r[f]);return o}function Dx(n,o,r,f){const m=f.replace(/\s+/g," ").trim().slice(0,40);return`${n} ${o} ${m?`"${m}" `:""}(${r})`}const Bx={board:{d:"M3 4.5H15A0.5 0.5 0 0 1 15.5 5V13A0.5 0.5 0 0 1 15 13.5H3A0.5 0.5 0 0 1 2.5 13V5A0.5 0.5 0 0 1 3 4.5ZM3 7.5H15"},compare:{d:"M3 4.5H7A0.5 0.5 0 0 1 7.5 5V13A0.5 0.5 0 0 1 7 13.5H3A0.5 0.5 0 0 1 2.5 13V5A0.5 0.5 0 0 1 3 4.5ZM3 7.5H7M11 4.5H15A0.5 0.5 0 0 1 15.5 5V13A0.5 0.5 0 0 1 15 13.5H11A0.5 0.5 0 0 1 10.5 13V5A0.5 0.5 0 0 1 11 4.5ZM11 7.5H15"},fit:{d:"M2.5 6V2.5H6M12 2.5H15.5V6M15.5 12V15.5H12M6 15.5H2.5V12"},focus:{d:"M2.5 6V2.5H6M12 2.5H15.5V6M15.5 12V15.5H12M6 15.5H2.5V12M6 6.5H12A0.5 0.5 0 0 1 12.5 7V11A0.5 0.5 0 0 1 12 11.5H6A0.5 0.5 0 0 1 5.5 11V7A0.5 0.5 0 0 1 6 6.5Z"},panel:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM6.5 3.5V14.5"},panelRight:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM11.5 3.5V14.5"},canvas:{d:"M3 2.5H7A0.5 0.5 0 0 1 7.5 3V7A0.5 0.5 0 0 1 7 7.5H3A0.5 0.5 0 0 1 2.5 7V3A0.5 0.5 0 0 1 3 2.5ZM11 2.5H15A0.5 0.5 0 0 1 15.5 3V7A0.5 0.5 0 0 1 15 7.5H11A0.5 0.5 0 0 1 10.5 7V3A0.5 0.5 0 0 1 11 2.5ZM3 10.5H7A0.5 0.5 0 0 1 7.5 11V15A0.5 0.5 0 0 1 7 15.5H3A0.5 0.5 0 0 1 2.5 15V11A0.5 0.5 0 0 1 3 10.5ZM11 10.5H15A0.5 0.5 0 0 1 15.5 11V15A0.5 0.5 0 0 1 15 15.5H11A0.5 0.5 0 0 1 10.5 15V11A0.5 0.5 0 0 1 11 10.5Z"},copy:{d:"M3 2.5H9A0.5 0.5 0 0 1 9.5 3V9A0.5 0.5 0 0 1 9 9.5H3A0.5 0.5 0 0 1 2.5 9V3A0.5 0.5 0 0 1 3 2.5ZM9 8.5H15A0.5 0.5 0 0 1 15.5 9V15A0.5 0.5 0 0 1 15 15.5H9A0.5 0.5 0 0 1 8.5 15V9A0.5 0.5 0 0 1 9 8.5Z"},front:{d:"M8 7.5H15A0.5 0.5 0 0 1 15.5 8V15A0.5 0.5 0 0 1 15 15.5H8A0.5 0.5 0 0 1 7.5 15V8A0.5 0.5 0 0 1 8 7.5Z",cells:"M5 10h1v1h-1zM4 10h1v1h-1zM2 10h1v1h-1zM2 9h1v1h-1zM2 7h1v1h-1zM2 6h1v1h-1zM2 4h1v1h-1zM2 3h1v1h-1zM3 2h1v1h-1zM4 2h1v1h-1zM6 2h1v1h-1zM7 2h1v1h-1zM9 2h1v1h-1zM10 2h1v1h-1zM10 4h1v1h-1zM10 5h1v1h-1z"},back:{d:"M3 2.5H10A0.5 0.5 0 0 1 10.5 3V10A0.5 0.5 0 0 1 10 10.5H3A0.5 0.5 0 0 1 2.5 10V3A0.5 0.5 0 0 1 3 2.5Z",cells:"M12 7h1v1h-1zM13 7h1v1h-1zM15 7h1v1h-1zM15 8h1v1h-1zM15 10h1v1h-1zM15 11h1v1h-1zM15 13h1v1h-1zM15 14h1v1h-1zM14 15h1v1h-1zM13 15h1v1h-1zM11 15h1v1h-1zM10 15h1v1h-1zM8 15h1v1h-1zM7 15h1v1h-1zM7 13h1v1h-1zM7 12h1v1h-1z"},sticky:{d:"M3.5 3.5H14.5V11.5L11.5 14.5H3.5ZM11.5 14.5V11.5H14.5"},file:{d:"M4.5 2.5H10.5L13.5 5.5V15.5H4.5ZM10.5 2.5V5.5H13.5"},pdf:{d:"M4.5 2.5H10.5L13.5 5.5V15.5H4.5ZM10.5 2.5V5.5H13.5M7 9.5H11M7 12.5H10"},folder:{d:"M2.5 14.5V3.5H7.5V5.5H15.5V14.5Z"},select:{d:"M4.5 3V14L7.6 11.2L9.8 15L11.4 14.1L9.3 10.4H13Z"},hand:{d:"M6.5 10V4.5a1 1 0 0 1 2 0V9V3a1 1 0 0 1 2 0V9V4a1 1 0 0 1 2 0V9.5V6a1 1 0 0 1 2 0V11a4.5 4.5 0 0 1-4.5 4.5H9.5a4 4 0 0 1-3-1.4L3.5 10.5L5 9.5L6.5 11"},title:{d:"M3 3.5H14M8.5 3.5V15"},bold:{d:"M5.5 3.5H9.5a2.5 2.5 0 0 1 0 5H5.5ZM5.5 8.5H10.5a3 3 0 0 1 0 6H5.5Z"},italic:{d:"M8 3.5H14M4 14.5H10M11.5 3.5L6.5 14.5"},textLeft:{d:"M3 5.5H15M3 9.5H11M3 13.5H13"},textCenter:{d:"M3 5.5H15M5 9.5H13M4 13.5H14"},textRight:{d:"M3 5.5H15M7 9.5H15M5 13.5H15"},underline:{d:"M5.5 2.5V8a3.5 3.5 0 0 0 7 0V2.5M3 15.5H15"},rect:{d:"M3 5.5H15A0.5 0.5 0 0 1 15.5 6V12A0.5 0.5 0 0 1 15 12.5H3A0.5 0.5 0 0 1 2.5 12V6A0.5 0.5 0 0 1 3 5.5Z"},oval:{d:"M9 4.5c3.6 0 6.5 2 6.5 4.5S12.6 13.5 9 13.5 2.5 11.5 2.5 9 5.4 4.5 9 4.5Z"},line:{d:"M3.5 14.5L14.5 3.5"},arrow:{d:"M3.5 14.5L14.5 3.5M9.5 3.5H14.5V8.5"},pen:{d:"M2.5 12.5C4.5 6.5 5.8 5 7 5c2 0 .5 7 3 7c1.6 0 2.8-2.2 5-6.5"},image:{d:"M3 3.5H15A0.5 0.5 0 0 1 15.5 4V14A0.5 0.5 0 0 1 15 14.5H3A0.5 0.5 0 0 1 2.5 14V4A0.5 0.5 0 0 1 3 3.5ZM2.5 13.5L6.5 9.5L10 13L12 11L15.5 14.5"},person:{d:"M9 8.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM3.5 15.5c.6-3 2.8-4.5 5.5-4.5s4.9 1.5 5.5 4.5"},ai:{d:"M3.5 4.5L8 9L3.5 13.5M9 13.5H15"},comment:{d:"M2.5 3.5H15.5V12.5H7.5L4.5 15.5V12.5H2.5Z"},undo:{d:"M6.5 3.5L3.5 6.5L6.5 9.5M3.5 6.5H11a3.5 3.5 0 0 1 0 7H7.5"},redo:{d:"M11.5 3.5L14.5 6.5L11.5 9.5M14.5 6.5H7a3.5 3.5 0 0 0 0 7h3.5"},share:{d:"M8.5 3V12M5.5 5.5L8.5 2.5L11.5 5.5M3.5 9.5V15.5H13.5V9.5"},download:{d:"M8.5 2.5V11.5M5.5 8.5L8.5 11.5L11.5 8.5M3.5 9.5V15.5H13.5V9.5"},expand:{d:"M10.5 2.5H15.5V7.5M15.5 2.5L10.5 7.5M7.5 15.5H2.5V10.5M2.5 15.5L7.5 10.5"},sliders:{d:"M2 5.5H10M13 5.5H16M11 3.5H12A0.5 0.5 0 0 1 12.5 4V7A0.5 0.5 0 0 1 12 7.5H11A0.5 0.5 0 0 1 10.5 7V4A0.5 0.5 0 0 1 11 3.5ZM2 12.5H5M8 12.5H16M6 10.5H7A0.5 0.5 0 0 1 7.5 11V14A0.5 0.5 0 0 1 7 14.5H6A0.5 0.5 0 0 1 5.5 14V11A0.5 0.5 0 0 1 6 10.5Z"},restore:{d:"M10.5 4.5A5 5 0 1 1 5.5 9.5V7.5M2.5 10.5L5.5 7.5L8.5 10.5"},parent:{d:"M13.5 14.5H7.5V3M4.5 5.5L7.5 2.5L10.5 5.5"},link:{d:"M7.5 11.5H5.5a3 3 0 0 1 0-6h2M10.5 5.5h2a3 3 0 0 1 0 6h-2M6 8.5H12"},chevronDown:{d:"M5.5 7L9 10.5L12.5 7"},chevronRight:{d:"M7 5.5L10.5 9L7 12.5"},chevronLeft:{d:"M11 5.5L7.5 9L11 12.5"},lock:{d:"M5 8.5H13A0.5 0.5 0 0 1 13.5 9V15A0.5 0.5 0 0 1 13 15.5H5A0.5 0.5 0 0 1 4.5 15V9A0.5 0.5 0 0 1 5 8.5ZM6.5 8V5.5a2.5 2.5 0 0 1 5 0V8"},edit:{d:"M3.5 14.5V11.5L11.5 3.5L14.5 6.5L6.5 14.5ZM9.5 5.5L12.5 8.5"},radius:{d:"M3.5 15V9.5a6 6 0 0 1 6-6H15"},spacing:{d:"M2.5 3V15M15.5 3V15M5 8.5H13"},alignLeft:{d:"M2.5 2V16M5 5.5H15M5 11.5H11"},alignHcenter:{d:"M8.5 2V16M3 5.5H15M5 11.5H13"},alignRight:{d:"M15.5 2V16M3 5.5H13M7 11.5H13"},alignTop:{d:"M2 2.5H16M5.5 5V15M11.5 5V11"},alignVcenter:{d:"M2 8.5H16M5.5 3V15M11.5 5V13"},alignBottom:{d:"M2 15.5H16M5.5 3V13M11.5 7V13"},search:{d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11ZM12 12L15.5 15.5"},plus:{d:"M3 8.5H15M8.5 3V15"},minus:{d:"M3 8.5H15"},close:{d:"M4.5 4.5L13.5 13.5M13.5 4.5L4.5 13.5"},check:{d:"M3.5 9.5L7 13L14.5 5.5"},warn:{d:"M9 3.5L15 14.5H3ZM8.5 7V11",fill:"M8 12h1v1h-1z"},info:{d:"M9 15.5a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13ZM8.5 8V13",fill:"M8 5h1.5v1.5h-1.5z"},more:{d:"",fill:"M4 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM9 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM14 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},trash:{d:"M2 4.5H16M6.5 4V2.5H11.5V4M4.5 5V14.5A1 1 0 0 0 5.5 15.5H12.5A1 1 0 0 0 13.5 14.5V5"},play:{d:"M5.5 3.5V14.5L14.5 9Z"},stop:{d:"M5 4.5H13A0.5 0.5 0 0 1 13.5 5V13A0.5 0.5 0 0 1 13 13.5H5A0.5 0.5 0 0 1 4.5 13V5A0.5 0.5 0 0 1 5 4.5Z"},clock:{d:"M9 15.5a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13ZM8.5 5V9.5H12"},eye:{d:"M2.5 9c1.9-3.2 4-4.5 6.5-4.5s4.6 1.3 6.5 4.5c-1.9 3.2-4 4.5-6.5 4.5S4.4 12.2 2.5 9ZM9 11a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}},Hx=n=>n>=28?36:n>=15?18:14;function F({name:n,size:o=18,...r}){const f=Hx(o),m=Bx[n];return s.jsxs("svg",{width:f,height:f,viewBox:f===14?"2 2 14 14":"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,"aria-hidden":"true",...r,children:[m.d&&s.jsx("path",{d:m.d}),m.cells&&s.jsx("path",{d:m.cells,fill:"currentColor",stroke:"none"}),m.fill&&s.jsx("path",{d:m.fill,fill:"currentColor",stroke:"none"})]})}const $a=(n,o,r)=>n===1?`1 ${o}`:`${n} ${r}`,dm=n=>$a(n,"variant","variants"),Lx={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"},ky=(n,o)=>Lx[n??""]??(/^h[1-6]$/.test(n??"")?"Heading":o?`.${o}`:n?`<${n}>`:"Element"),_x={app:{title:"Easel",docTitle:n=>`${n} — 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:(n,o,r)=>`${n} selected, ${o}/${r}. Enter to select inside`,firstRunEdit:"Click anything on a board to select it · double-click text to edit it",firstRunAi:n=>`Press ${n}J to ask the AI for a change`,cleanOn:"Clean view: only the canvas. Press Esc to bring the tools back",cleanOff:"Tools are back"},templates:{blank:"Blank",mobile:"Mobile screen",desktop:"Desktop screen",doc:"Document",tablet:"Tablet screen",watch:"Watch screen",email:"Email"},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:n=>`Left panel (${n}\\)`,canvasTools:"Canvas tools",shapes:"Shapes",tool:(n,o)=>`${n} (${o})`,shapeToolTitle:(n,o)=>`${n} (${o}) · Shift for square or circle`,insertImage:"Insert image",insertImageTitle:"Insert image (you can also paste onto the canvas)",undo:"Undo",redo:"Redo",undoTitle:(n,o)=>n?`Undo: ${n} (${o}Z)`:`Undo (${o}Z)`,redoTitle:(n,o)=>n?`Redo: ${n} (⇧${o}Z)`:`Redo (⇧${o}Z)`,newBoard:"New board",newBoardTitle:"New board (choose a template)",themeTitle:"Design system theme (used by swatches, token check and AI)",theme:"Theme",themeOption:n=>`Theme: ${n}`,snapshot:"Snapshot (git)",snapshotTitle:"Snapshot: save the design folder as a git commit",erroredBoards:"Boards with errors",erroredBoardsN:n=>`Boards with errors ${n}`,errors:n=>`Errors ${n}`,zoomOut:"Zoom out",zoomOutTitle:n=>`Zoom out (${n}-)`,zoomIn:"Zoom in",zoomInTitle:n=>`Zoom in (${n}+)`,zoom100:"Zoom to 100%",zoom100Title:n=>`Zoom to 100% (${n}0)`,fitAll:"Fit all",fitAllTitle:"Fit all (⇧1)",aiChat:"AI chat",askAi:"Ask AI",aiChatTitle:n=>`AI chat (${n}J)`,guides:"Show layout guides",guidesTitle:"Show layout guides (⌃G)",appearance:n=>`Appearance: ${n==="system"?"System":n==="light"?"Light":"Dark"}`,appearanceTitle:n=>`Appearance: ${n==="system"?"Follow system":n==="light"?"Light":"Dark"} (click to change)`,minimap:"Minimap",minimapTitle:"Minimap (M)",viewMenu:"View",viewMenuTitle:"View: guides, minimap, appearance, theme, language, snapshot",viewMenuTitleNarrow:"View: zoom, history, guides, minimap, appearance, language, snapshot",language:n=>`Language: ${n}`,project:"Project",history:"History",cleanView:"Clean view",showTools:"Show tools",showToolsTitle:n=>`Show tools (Esc or ⇧${n}\\)`,canvasHints:"Canvas hints",comments:"Comments",commentsTitle:n=>n?`Comments, ${n} open`:"Comments",boardsPanel:"Boards, assets, tokens",viewToggle:"View",viewCanvas:"Canvas",viewPrototype:"Prototype",viewPrototypeTitle:"Prototype (F)",play:"Play",playTitle:"Play (full screen)",panelToggle:"Properties panel",panelToggleTitle:n=>`Properties panel (${n}\\)`,zoomMenu:n=>`Zoom ${n}%`,zoomToSelection:"Zoom to selection",zoomNow:n=>`Now ${n}%`,layoutGuides:"Layout guides",pageCount:n=>`${n} pages`,copyPageLink:"Copy page link",copyLink:"Copy link",restart:"Restart",shortcuts:"Keyboard shortcuts",projectMenu:n=>`${n}: project menu`,shareMenu:"Share…",otherProjects:"Running projects",protoMore:"More",playMenu:"Play",protoHeading:"Prototypes",staticHeading:"Static boards",noBoards:"No boards",protoBoard:n=>`Board: ${n}. Switch board`,protoBoards:"Boards",prevBoard:"Previous board (←)",nextBoard:"Next board (→)"},tabs:{left:"Left panel",boards:"Boards",assets:"Assets",tokens:"Tokens",right:"Right panel",closePanel:"Close panel",properties:"Properties",ai:"AI",code:"Code",tweaks:"Tweaks",layers:"Layers",codeEmpty:"Pick an element to edit its code",tweaksEmpty:"No adjustable values yet. Ask the AI to add some"},boardList:{aria:"Pages and boards",pages:"Pages",addPage:"Add page",newPage:"New page",pageSwitch:n=>`Page: ${n}. Switch page`,pageMore:n=>`More for ${n}`,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:n=>`No boards match "${n}". 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:n=>`${$a(n,"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:{print:"Print",printMode:"Pages",printModes:{continuous:"Continuous",fixed:"Paper"},paper:"Paper size",papers:{letter:"Letter",a4:"A4"},bg:"Background",bgNone:"None",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:"Show Play button",interactiveTitle:"Keeps the ▶ on the board's label always visible, with a dot. Without it the ▶ shows when the board is selected or hovered; any board plays with P or right-click",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:n=>`${$a(n,"board","boards")} selected`,frontTitleMod:n=>`Bring to front (${n}])`,backTitleMod:n=>`Send to back (${n}[)`,goToSelected:"Go to selected boards",goToSelectedTitle:"Go to selected boards (⇧2)",deleteTitleKey:"Delete (⌫)"},full:{aria:n=>`${n}, full window`,back:"Back to the canvas (Esc)",fill:"Fill",fillTitle:"Fill the window",fit:"Fit",fitTitle:"The board's own size, scaled down to fit",mode:"Size"},focus:{aria:n=>`${n} 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:n=>`Selected boards (${n})`,webTitle:"Web folder",webHint:"Static files. Host on Vercel, GitHub Pages or a PR preview.",singleTitle:"Single file",singleHint:n=>` · ${n} · 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:n=>`Copies ${n} (run it in the project folder)`,copied:n=>`Copied: ${n}`,copyFailed:"Couldn't copy to the clipboard",attachHint:"Attach it to Slack, email or a PR.",skipped:n=>`${n} reference${n===1?"":"s"} could not be included`,largeFiles:"Large canvases make large files. No live updates.",sameAs:"Same as:",unavailable:"Unavailable here."},viewer:{docTitle:n=>`${n} — 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:n=>`View only · exported ${n}`,stampTitle:"A read-only copy. Changes happen in the design files, then export again.",madeWith:"Made with Easel",comments:"Comments",commentsN:n=>`Comments ${n}`,noComments:"No comments",replies:n=>n===1?"1 reply":`${n} replies`,pin:(n,o)=>`Comment ${n} by ${o}`,threadOf:(n,o)=>`${n} of ${o}`,closeThread:"Close comment",boardsPanel:"Boards",commentsPanel:"Comments panel",empty:"Nothing on this page",embedGate:"Use the canvas: pan, zoom, open a board, press Play. Esc gives the page back.",embedHint:"Click the canvas to pan and zoom",embedHintLive:"Esc or a click outside gives the page back"},canvas:{aria:"Design canvas",board:(n,o,r,f)=>`Board ${n}${o?" (selected)":""}${r?" editing":""}${f?" playing":""}`,interactive:"Marked as playable",hint:"Click selects · Double-click edits text · Esc deselects",notLoaded:"Scroll closer to load",fileMissing:n=>`File missing · ${n}`,playing:"▶ Playing · Esc",exportingPng:"Exporting PNG…",play:"Play",playTitle:"Play (P)",stopPlay:"Stop Play",stopPlayTitle:"Stop Play (P or Esc)",playShort:"Play",edit:"Edit",exportBoard:"Export this board (PNG)",fullWindow:"Open in full window",tweaks:"This board's adjustable values",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"},extra:{letterSpacing:"Letter spacing",size:"Size",width:"Width",height:"Height",fixed:"Fixed",hug:"Hug",fill:"Fill",mode:n=>`${n} mode`,position:"Position",flow:"Normal flow",absolute:"Absolute",look:"Appearance",opacity:"Opacity",border:"Border",borderStyles:{none:"None",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},shadow:"Shadow",shadows:{none:"None",small:"Small",medium:"Medium",large:"Large",custom:"Custom"},link:"Link",href:"Address",newTab:"New tab",export:"Export",exportPng:"PNG 2×",exporting:"Exporting…"},code:{inline:"Inline style",placeholder:"property: value;",bad:n=>`Not understood: ${n}`,computed:"Computed"},layers:{collapse:"Collapse",expand:"Expand",title:"Layers",outline:"Page outline",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."},keys:{sections:{tools:"Tools",edit:"Edit",element:"Element",move:"Move around",view:"View",ai:"AI and comments"},rows:{select:"Select",hand:"Hand",board:"Draw a board",title:"Title",note:"Note",rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",penOrPlay:"Pen · play the picked board in place",undo:"Undo",redo:"Redo",copy:"Copy element",paste:"Paste after",duplicate:"Duplicate",delete:"Delete",selectAll:"Select all",lock:"Lock / unlock",rename:"Rename board",front:"Bring to front",back:"Send to back",copyPng:"Copy as PNG",copyProps:"Copy properties",pasteProps:"Paste properties",flipH:"Flip horizontally",flipV:"Flip vertically",wrap:"Group in a flex box",reorder:"Move among siblings",enter:"Into the board · first child",next:"Next element or board",arrows:"Nudge · walk the elements",escape:"Let go · close",regions:"Next area of the app",zoomIn:"Zoom in",zoomOut:"Zoom out",zoom100:"Zoom to 100%",fitAll:"Fit all",zoomSel:"Zoom to selection",guides:"Layout guides",minimap:"Minimap",prototype:"Prototype view",panel:"Properties panel",clean:"Canvas only",ai:"Ask AI",find:"Find a board",comments:"Comment mode"}},inline:{title:"Ask AI",placeholder:"What should change?",send:"Send",history:"Conversation",visible:n=>n===1?"1 board in view":`${n} boards in view`,result:"AI result",done:"Done.",failed:"It did not finish.",cancelled:"Cancelled.",undo:"Undo",undone:"Undone",open:"Open conversation",close:"Close",running:"Working…",agentItem:n=>`AI agent: ${n}`,modelItem:n=>`Model: ${n||"default"}`,modelTitle:"Model",modelLabel:"Model name (empty for the agent's default)"},select:{toolbar:"Element",text:"Text",textOff:"No text in this element",fill:"Fill",textColor:"Text colour",radius:"Radius",spacing:"Spacing",askAi:"Ask AI",askAiAria:"Ask AI",askAiTitle:"Ask AI about this element",comment:"Comment",commentTitle:"Comment on this element",more:"More",textStyle:"Style and alignment",textAlign:"Alignment",bold:"Bold",italic:"Italic",underline:"Underline",align:n=>({left:"Align left",center:"Align centre",right:"Align right"})[n]??"Align",tokens:"Tokens",custom:"Custom…",hex:"Hex colour",picker:"Pick a colour",tokenNow:n=>`${n} · token`,decrease:n=>`Decrease ${n.toLowerCase()}`,increase:n=>`Increase ${n.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:n=>`(${n})`,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:n=>n>=7?"AAA":n>=4.5?"AA":n>=3?"AA large text only":"too low",contrastWith:(n,o,r)=>`Contrast ${n}:1 with ${o} text · ${r}`,contrastOn:(n,o,r)=>`Contrast ${n}:1 on ${o} · ${r}`,openFill:n=>`${n}: 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:n=>`Off tokens: ${n}`,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:n=>`${n} 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:n=>`${n} 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:n=>`${n} 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:(n,o)=>`Layout guides ${n}/${o}`,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:(n,o)=>n>1?`Delete ${n} boards?`:`Delete board "${o}"?`,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:n=>`Links or iframes pointing to this file: ${n}`,renameFileNoRefs:"No links or iframes point to this file.",renameFileExtra:n=>`Also update ${$a(n,"reference","references")} to the new name`,newPageTitle:"New page",newPageName:n=>`Page ${n}`,create:"Create",renamePageTitle:"Rename page",deletePageTitle:n=>`Delete page "${n}"?`,deletePageBody:n=>`Its ${$a(n,"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:n=>`docs(design): design snapshot ${n}`,snapshotHint:"Commits only the design folder. The author comes from your git config, and nothing else you staged is included.",commit:"Commit"},toast:{linkCopied:"Link copied",copiedPng:"Copied as PNG",copiedHtml:"Copied as HTML",copiedProps:"Properties copied",saveFailed:n=>`Save failed: ${n}`,undoRedoDone:(n,o)=>`${n==="undo"?"Undo":"Redo"}: ${o}`,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:(n,o)=>`Copied <${n}> — paste it into another board while editing with ${o}V`,nothingCopied:"No element copied. Select an element while editing and press ⌘C",pasted:(n,o)=>`Pasted <${o}> from ${n}`,imageReplaced:n=>`Replaced the image with ${n}`,boardCreated:n=>`Created board ${n}`,boardCreateFailed:n=>`Couldn't create the board: ${n}`,boardsDeleted:n=>`Deleted ${$a(n,"board","boards")}`,duplicated:n=>`Duplicated as ${n}`,renamed:"Renamed",fileRenamed:(n,o)=>`Renamed to ${n}${o?" (references updated)":""}`,notesMax:n=>`You can have up to ${n} notes`,noteDeleted:"Note deleted",shapeDeleted:"Shape deleted",shapesDeleted:n=>`Deleted ${$a(n,"shape","shapes")}`,imageReadFailed:"Couldn't read the image",importOnly:n=>`${n}: only HTML or images can be imported`,imported:n=>`Imported ${$a(n,"board","boards")}`,pagesMax:"You can have up to 40 pages",pageDeleted:"Page deleted",copied:"Copied",elementDeleted:"Element deleted",wrapped:n=>`Wrapped in ${n}`,theme:n=>`Theme: ${n}`,tokensSaved:"Tokens saved",nothingChanged:"Nothing changed",snapshot:n=>`Snapshot ${n}`,cleanedUp:n=>`Cleaned up ${$a(n,"board","boards")}`,uploaded:n=>`Uploaded ${n}`,tweaksSaved:"Saved tweaks to source",blockFlow:"Vertical alignment doesn't apply in block flow. Try changing the parent to flex",pngExporting:n=>`Rendering ${n}…`,pngExported:n=>`Downloaded ${n}`,pngNeedsBrowser:"PNG export needs a headless browser:",pngFailed:n=>`Couldn't render the PNG: ${n}`},history:{lock:"Lock",unlock:"Unlock",flip:"Flip",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:{openProps:"Open properties",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:n=>`Move ${$a(n,"selected board","selected boards")} to this page`,delete:"Delete",selectInside:"Select inside",playInPlace:"Play in place",stopPlay:"Stop Play",playFullScreen:"Play full screen",lock:"Lock",unlock:"Unlock",copyPng:"Copy as PNG",copyHtml:"Copy as HTML",copyProps:"Copy properties",pasteProps:"Paste properties",flipH:"Flip horizontal",flipV:"Flip vertical",locked:"Locked",askReview:"Ask AI for a review",focusView:"Prototype view",askAI:"Ask AI",askAIAria:"Ask AI",askFixErrors:"Ask AI to fix errors",goToBoard:"Go to board",exportPng:"Export PNG",exportingPng:"Exporting PNG…",renameFile:"Rename file…",duplicate:"Duplicate",front:"Bring to front",back:"Send to back",deleteBoards:n=>`Delete ${n} 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",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:(n,o)=>`Snapshot · ${n} · ${$a(o,"changed file","changed files")}`,snapshotNow:"Save snapshot now (git commit)…",nothingChanged:"Nothing changed",fileMissing:"File is missing",askFixAll:"Ask AI to fix all",cleanMissing:n=>`Clean up ${$a(n,"board","boards")} with missing files`},prompts:{fixErrors:n=>`Fix these errors:
50
+ ${n}`,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:n=>`Replace off-token values with tokens (verify with check_tokens):
51
+ ${n}`,fixA11y:n=>`Fix the accessibility issues (keep the visible size; enlarge touch targets with padding):
52
+ ${n}`,line:"Line "},checks:{tokenCheck:n=>`Token check · ${n}`,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:n=>`Select ${n} on the board`,line:n=>`Line ${n}`,more:n=>`+${n} more`,colorNotInTokens:"Color not in tokens",tokenFontSizes:n=>`Token font sizes: ${n}`,tokenRadii:n=>`Token radius: ${n}`,notMultipleOf4:"Not a multiple of 4",tokenWeights:n=>`Token weights: ${n}`,smallTarget:(n,o,r,f)=>`<${n}> touch target ${o}×${r} (under ${f})`,noName:n=>`<${n}> has no name (aria-label, text or label)`,noAlt:'<img> has no alt (use alt="" if decorative)',lowContrast:(n,o,r)=>`Contrast ${n}:1 (needs ${o}) "${r}"`},tokens:{import:"Import tokens (tokens.json or Figma variables JSON)",importFailed:n=>`Couldn't import: ${n}`,theme:"Theme",addTheme:"Add theme (copy current theme)",newTheme:"New theme",newThemeN:n=>`New theme ${n}`,activeTheme:"Active theme",themeName:"Theme name",importedTheme:"Imported",colors:n=>`Colors ${n}`,addColor:"Add color",colorN:n=>`Color ${n}`,colorOf:n=>`${n} color`,colorName:"Color name",remove:n=>`Remove ${n}`,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:n=>`Failed: ${n}`,kindName:n=>({text:"Text",button:"Button",link:"Link",image:"Image",input:"Input",icon:"Icon",container:"Container"})[n]??n,crumbs:"Selection path",crumbBoard:"Select the board",crumbParent:n=>`Select ${n}`,crumbElement:(n,o)=>`<${n}> ${o}`,more:n=>`+${n} 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:{pinLabel:(n,o,r)=>`Comment ${n} by ${o}: ${r}`,title:"Comments",placeholderElement:n=>`Comment on the selected element (${n})`,placeholderBoard:"Comment on the board",placeholder:"Add a comment",add:"Comment",authorTitle:"Change comment author name",author:n=>`Author: ${n}`,replyPlaceholder:n=>`Reply as ${n} (⌘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",openThread:"Show this comment on its own",allOnBoard:n=>`All ${n} on this board`,mode:"Comment mode",modeTitle:"Comment mode (⌥C)",allTitle:"All comments",thisPage:"This page",allPages:"All pages",showResolved:"Resolved",scope:"Which comments",edit:"Edit",deleteThread:"Delete",more:"Edit or delete",none:"No comments",nothingSelected:"Nothing selected"},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:(n,o)=>o?`Agent: ${n} — ${o}`:`Agent: ${n}`,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:n=>`Model for ${n}: 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:n=>`Sends the selected boards and elements, plus the boards visible on screen, to ${n} 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:(n,o)=>`${n} is not signed in. Run \`${o}\` in a terminal.`,remedyMissing:n=>`\`${n}\` command not found. Install it, then Check again.`,copyCommand:"Copy command",copy:"Copy",copied:"Copied",sendNeedsSignin:n=>`Sign in to ${n} to send`,sendNeedsInstall:n=>`Install ${n} to send`,running:"Running",cancelled:"Cancelled",failed:"Failed",retry:"Retry",switchTo:n=>`Switch to ${n}`,details:"Details",noFilesChanged:"No files were changed.",restored:"Restored from the failed message",madeVariants:n=>`Made ${dm(n)} side by side · View`,thinking:"Thinking…",chipElement:n=>`Element <${n}>`,chipElementText:(n,o)=>`Element <${n}> ${o}`,chipBoards:n=>`${n} boards`,chipVisible:n=>`Visible boards ${n}`,chipComment:n=>`Comment "${n}"`,variants:dm,tooBig:n=>`${n}: 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:n=>`Remove ${n}`,howToInstall:"How to install",customCommand:"Custom command…",checkedAt:(n,o)=>o?`Checked when the AI tab opened · ${n}`:`Checked again at ${n}`,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:n=>`Runs without a shell: ${n}`,waiting:"Waiting for you",waitingHint:"answer the request above",permAsk:(n,o,r)=>o==="command"?`${n} asks to run a command`:o==="edit"?`${n} asks to ${r==="Write"?"write":"edit"} a file`:o==="fetch"?`${n} asks to fetch a page`:`${n} asks to use ${r}`,permIn:"in",permOutside:"outside the design folder",allowOnce:"Allow once",alwaysAllow:n=>`Always allow ${n}`,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:(n,o)=>n&&o?`Changed ${n} board${n===1?"":"s"} · added ${o}`:o?`Added ${o} board${o===1?"":"s"}`:n?`Changed ${n} board${n===1?"":"s"}`:"Changed the canvas",chipNew:n=>`${n} (new)`,chipRemoved:n=>`${n} (removed)`,undoRun:"Undo this run",compare:"Compare",redo:"Redo",runUndone:n=>`Run undone · ${n} board${n===1?"":"s"} restored`,conflictUndo:n=>`Changed since this run: ${n}. Undo the rest and keep those, or undo all and overwrite them?`,conflictRedo:n=>`Changed since the undo: ${n}. 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:n=>`Saved ${n}`,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:n=>`This puts the whole canvas back to ${n}, 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:n=>`Easel restarted · ${n}`},compare:{title:n=>`Compare · ${n}`,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:{stepName:n=>String(n),outside:"Outside Easel",ago:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"now":o<60?`${o}m`:o<1440?`${Math.floor(o/60)}h`:`${Math.floor(o/1440)}d`},agoLong:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"just now":o<60?`${o} min ago`:o<1440?`${Math.floor(o/60)} h ago`:`${Math.floor(o/1440)} d ago`},tag:(n,o,r,f)=>`${n} · ${o} · ${f&&r===1?"new board":$a(r,"change","changes")}`,tagTitle:n=>`${n} — click for the change, Before / After and Undo`,tagsAria:n=>`${$a(n,"change","changes")} by others`,popAria:n=>`Change by ${n}`,element:ky,change:n=>{const o=ky(n.tag,n.cls);switch(n.kind){case"style":return`Style changed on ${o}`;case"attr":return`${o} attributes changed`;case"edited":return`${o} changed`;case"added":return n.count>1?`${n.count} elements added`:`${o} added`;case"removed":return n.count>1?`${n.count} elements removed`:`${o} removed`;case"replaced":return`${o} replaced`;case"many":return`${n.count}${n.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:n=>`${$a(n,"change","changes")} on this board`,quote:n=>`“${n}”`,arrow:"→",beforeAfter:"Before / After",undo:"Undo",undoTitle:n=>n===1?"Undo this change":`Undo these ${n} changes`,conflict:n=>`Changed since: ${n}. 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:(n,o,r)=>`${n} by ${o}, ${r} · Go back to here`,nowAria:(n,o,r)=>`${n} by ${o}, ${r} · current`,undoneAria:(n,o,r)=>`${n} by ${o}, ${r} · undone`,wentBack:n=>`Back to: ${n}`},occupancy:{editing:n=>`${n} is editing…`,you:"You · editing",personEditing:n=>`${n} · editing`,done:(n,o)=>`${n} · done ${o}`,someone:"Someone",clock:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),tagsAria:"Who is on this board",listDot:n=>`${n} is editing`,youListDot:"You are editing",forked:(n,o,r)=>`Forked ${n} — ${o} started while ${r} was editing`,forkBlock:(n,o)=>n===1?`Fork of ${o}`:`${n} forks of ${o}`,forkBlockWhile:(n,o,r)=>`${n===1?`Fork of ${o}`:`${n} forks of ${o}`} · made while ${r} was editing`,forkBlockShort:n=>n===1?"Fork":`${n} forks`,useThis:"Use this",useThisOne:"Use this one",useThisTitle:"Make this variant the original board; the other variants go to trash",useThisOneTitle:n=>`Keep this version as the board; ${n===1?"the other version goes":`the other ${n} versions go`} to trash`,waitFor:n=>`Wait until ${n} is done editing`,confirmVariant:(n,o)=>`Apply "${n}" to ${o}?`,confirmVariantBody:(n,o)=>`${n} is replaced.${o?` The other ${o===1?"variant goes":`${o} variants go`} to trash.`:""}`,confirmFork:(n,o)=>`Use "${n}" for ${o}?`,confirmForkBody:(n,o)=>`${n} is replaced by this version. ${o?`This fork and the other ${o===1?"fork go":`${o} forks go`} to trash.`:"The fork goes to trash."}`,confirmKeep:n=>`Keep "${n}"?`,confirmKeepBody:(n,o)=>`${n} ${o===1?"goes":"go"} to trash.`,apply:"Apply",keepAll:"Keep all",keepBoth:"Keep both",applied:(n,o)=>`Applied ${n} to ${o}`,kept:(n,o)=>`Kept ${n}; ${o===1?"the other version is":`the other ${o} versions are`} in trash`,keptAll:(n,o)=>n==="variant"?`Kept all ${dm(o)} as boards`:o===1?"Kept both versions as boards":`Kept all ${o+1} versions as boards`,undo:"Undo"},requests:{goTo:"AI requests go to",easelChat:"Easel chat",easelChatNote:"Easel runs Claude Code itself.",host:"The agent you're talking to",hostNote:"Requests wait on the canvas.",connected:"Connected",noneConnected:"No agent connected",thisFolder:"this folder",otherFolder:"another folder",since:n=>`since ${n}`,sendTo:"Send to",anyAgent:"Any agent",sayTitle:"Say",line:"handle the Easel requests",quote:n=>`“${n}”`,copy:"Copy",copied:"Copied",copyTitle:"Copy the line for your agent's chat (or run /easel:requests)",forAi:"For AI",forAgent:n=>`For ${n}`,addForAi:"Leave",forAiCheck:"For AI",forAiCheckTitle:"Leave this comment as a request for the agent you're talking to",composerTitle:"Ask your agent",composerAria:"Request for your agent",composerPlaceholder:"What should change here?",cancel:"Cancel",waiting:"Waiting",waitingFor:n=>`Waiting for ${n}`,took:(n,o)=>`${n} working · ${o}`,failed:n=>`${n} couldn't finish`,left:n=>`Waiting (${n} left)`,cancelRequest:"Cancel",useChat:"Use Easel chat",more:"More",retry:"Again",undoChange:"Undo",undone:"Undone",undoGone:"Can't be undone now",changedTitle:n=>`Go to ${n}, the board it changed`,waitingTag:n=>`${n} waiting`,pinLabel:(n,o,r)=>o?`Request ${n} waiting for your agent: ${r}`:`Request ${n} for AI: ${r}`,countAria:n=>n===1?"1 request waiting for your agent":`${n} requests waiting for your agent`,filterAria:"Which comments",filterAll:"All",filterForAi:"For AI",listTitle:"For AI",allBoards:"all boards",listEmpty:"No requests",introTitle:"Leave requests for the agent in this window?",switchTo:"Switch",keepChat:"Keep Easel chat",backToRequests:"Back to requests",hostShort:"your agent",easelChatShort:"Easel chat",goesTo:"Requests go to",connectedN:n=>n?`${n} connected`:"none connected",chatOnce:"Easel chat, for this request",menuHost:"AI requests: your agent",menuChat:"AI requests: Easel chat",added:"Left for your agent",cancelled:"Cancelled. The comment stays.",markerWaiting:"Sent to your agent · waiting",markerWaitingFor:n=>`Sent to ${n} · waiting`,markerWorking:n=>`Working… · ${n}`,markerSay:n=>`Tell your agent “${n}”`,markerDone:"Done",markerCount:n=>n===1?"1 request here":`${n} requests here`,markerAria:"Request for your agent",dismiss:"Dismiss",openComment:"Open comment",kind:{element:"Element",board:"Board",tokens:"Token check",a11y:"Accessibility",errors:"Errors",review:"Review",comment:"Comment"},frameBoard:n=>`Easel board ${n}`,frameElement:(n,o)=>`Easel board ${n}, selected: ${o}`},update:{out:n=>`Easel ${n} is out`,copy:"Copy command",copied:"Copied. Run it, then restart Easel",row:n=>`Update to ${n}`,versions:(n,o)=>`${n} → ${o}`,copyRow:"Copy the update command",retry:"Try updating again",updating:n=>`Updating to ${n}…`,done:n=>`Updated to ${n}`,failed:(n,o)=>`Could not update to ${n}. ${o}`,dotTitle:n=>`Easel ${n} is out`,why:{busy:"Waits for the AI run to finish",permission:"No permission to install there without admin rights",network:"Could not reach the npm registry",nonpm:"npm was not found",failed:"The install did not finish",restart:"The new version did not start; this one keeps running",project:"Installed in this project: update it with npm",source:"Running from source: update it with git",other:"Run the command, then restart Easel"}}},Ux={button:"버튼",a:"링크",img:"이미지",input:"입력란",textarea:"입력란",select:"선택 메뉴",label:"라벨",p:"문단",span:"텍스트",li:"목록 항목",ul:"목록",ol:"목록",nav:"내비게이션",header:"헤더",footer:"푸터",main:"본문",section:"섹션",form:"폼",svg:"아이콘",style:"스타일",script:"스크립트"},Ty=(n,o)=>Ux[n??""]??(/^h[1-6]$/.test(n??"")?"제목":o?`.${o}`:n?`<${n}>`:"요소");function qx(n,o){const r=n.replace(/[\s>)"'”’\]]+$/,"").slice(-1),f=r.charCodeAt(0);let m=null;f>=44032&&f<=55203?m=(f-44032)%28:/[0-9]/.test(r)?m=[21,8,0,16,0,0,1,8,8,0][Number(r)]:/[lmn]/i.test(r)?m=/l/i.test(r)?8:/m/i.test(r)?16:4:/[a-z]/i.test(r)&&(m=0);const[p,v]=o.split("/");return m==null?o==="으로/로"?"(으)로":`${p}(${v})`:o==="으로/로"?m===0||m===8?"로":"으로":m?p:v}const jt=(n,o)=>n+qx(n,o),Cy=n=>n==="system"?"시스템":n==="light"?"라이트":"다크",yb={app:{title:"Easel",docTitle:n=>`${n} — Easel`,loadFailed:"불러오지 못했어요:",retry:"다시 시도",crashed:"캔버스에 오류가 나서 멈췄어요:",reload:"새로고침",loadingBoards:"보드를 불러오는 중…",loading:"불러오는 중…",emptyPage:"이 페이지는 비어 있어요",drawBoard:"보드 그리기",defaultAuthor:"나",tokensAside:"디자인 토큰",assetsAside:"에셋",inspectorAside:"인스펙터",navigation:"내비게이션",announceBoard:(n,o,r)=>`${n} 선택됨, ${o}/${r}. Enter를 누르면 안쪽을 선택해요`,firstRunEdit:"보드에서 무엇이든 클릭해 선택하고, 텍스트는 더블클릭해 고쳐요",firstRunAi:n=>`${n}J를 눌러 AI에게 수정을 요청해요`,cleanOn:"캔버스만 보여요. Esc를 누르면 도구가 다시 보여요",cleanOff:"도구가 다시 보여요"},templates:{blank:"빈 보드",mobile:"모바일 화면",desktop:"데스크톱 화면",doc:"문서",tablet:"태블릿 화면",watch:"워치 화면",email:"이메일"},tools:{select:"선택",hand:"손",board:"보드 그리기",title:"제목",sticky:"메모",rect:"사각형",oval:"타원",line:"선",arrow:"화살표",pen:"펜"},toolHints:{select:"보드를 선택하고 옮겨요",hand:"끌어서 캔버스를 움직여요",board:"끌어서 보드를 그려요",title:"클릭해 제목을 넣어요",sticky:"클릭해 스티키 노트를 붙여요",rect:"끌어서 사각형을 그려요",oval:"끌어서 타원을 그려요",line:"끌어서 선을 그려요",arrow:"끌어서 화살표를 그려요",pen:"끌어서 자유롭게 그려요"},toolbar:{aria:"도구",leftPanel:"왼쪽 패널",leftPanelTitle:n=>`왼쪽 패널 (${n}\\)`,canvasTools:"캔버스 도구",shapes:"도형",tool:(n,o)=>`${n} (${o})`,shapeToolTitle:(n,o)=>`${n} (${o}) · Shift를 누르면 정사각형이나 원`,insertImage:"이미지 넣기",insertImageTitle:"이미지 넣기 (캔버스에 붙여 넣어도 돼요)",undo:"실행 취소",redo:"다시 실행",undoTitle:(n,o)=>n?`실행 취소: ${n} (${o}Z)`:`실행 취소 (${o}Z)`,redoTitle:(n,o)=>n?`다시 실행: ${n} (⇧${o}Z)`:`다시 실행 (⇧${o}Z)`,newBoard:"새 보드",newBoardTitle:"새 보드 (템플릿 고르기)",themeTitle:"디자인 시스템 테마 (색 견본, 토큰 검사, AI가 써요)",theme:"테마",themeOption:n=>`테마: ${n}`,snapshot:"스냅샷 (git)",snapshotTitle:"스냅샷: 디자인 폴더를 git 커밋으로 저장해요",erroredBoards:"오류가 있는 보드",erroredBoardsN:n=>`오류가 있는 보드 ${n}`,errors:n=>`오류 ${n}`,zoomOut:"축소",zoomOutTitle:n=>`축소 (${n}-)`,zoomIn:"확대",zoomInTitle:n=>`확대 (${n}+)`,zoom100:"100%로 보기",zoom100Title:n=>`100%로 보기 (${n}0)`,fitAll:"전체 보기",fitAllTitle:"전체 보기 (⇧1)",aiChat:"AI에게 요청",askAi:"AI",aiChatTitle:n=>`AI에게 요청 (${n}J)`,guides:"레이아웃 가이드 보기",guidesTitle:"레이아웃 가이드 보기 (⌃G)",appearance:n=>`화면 모드: ${Cy(n)}`,appearanceTitle:n=>`화면 모드: ${n==="system"?"시스템 설정 따르기":Cy(n)} (클릭해 바꾸기)`,minimap:"미니맵",minimapTitle:"미니맵 (M)",viewMenu:"보기",viewMenuTitle:"보기: 가이드, 미니맵, 화면 모드, 테마, 언어, 스냅샷",viewMenuTitleNarrow:"보기: 확대/축소, 기록, 가이드, 미니맵, 화면 모드, 언어, 스냅샷",language:n=>`언어: ${n}`,project:"프로젝트",history:"기록",cleanView:"캔버스만 보기",showTools:"도구 보이기",showToolsTitle:n=>`도구 보이기 (Esc 또는 ⇧${n}\\)`,canvasHints:"캔버스 도움말",comments:"댓글",commentsTitle:n=>n?`댓글, 열린 것 ${n}`:"댓글",boardsPanel:"보드·에셋·토큰",viewToggle:"보기",viewCanvas:"캔버스",viewPrototype:"프로토타입",viewPrototypeTitle:"프로토타입 (F)",play:"재생",playTitle:"재생 (전체 화면)",panelToggle:"속성 패널",panelToggleTitle:n=>`속성 패널 (${n}\\)`,zoomMenu:n=>`확대 ${n}%`,zoomToSelection:"선택 항목에 맞추기",zoomNow:n=>`현재 ${n}%`,layoutGuides:"레이아웃 가이드",pageCount:n=>`페이지 ${n}개`,copyPageLink:"페이지 링크 복사",copyLink:"링크 복사",restart:"처음부터",shortcuts:"키보드 단축키",projectMenu:n=>`${n}: 프로젝트 메뉴`,shareMenu:"공유…",otherProjects:"실행 중인 프로젝트",protoMore:"더 보기",playMenu:"재생",protoHeading:"프로토타입",staticHeading:"정적 보드",noBoards:"보드 없음",protoBoard:n=>`보드: ${n}. 다른 보드로`,protoBoards:"보드",prevBoard:"이전 보드 (←)",nextBoard:"다음 보드 (→)"},tabs:{left:"왼쪽 패널",boards:"보드",assets:"에셋",tokens:"토큰",right:"오른쪽 패널",closePanel:"패널 닫기",properties:"속성",ai:"AI",code:"코드",tweaks:"조정",layers:"레이어",codeEmpty:"요소를 고르면 코드를 고칠 수 있어요",tweaksEmpty:"아직 조정 값이 없어요. AI에게 추가해 달라고 하세요"},boardList:{aria:"페이지와 보드",pages:"페이지",addPage:"페이지 추가",newPage:"새 페이지",pageSwitch:n=>`페이지: ${n}. 페이지 바꾸기`,pageMore:n=>`${n} 메뉴`,singlePage:"모든 보드를 한 페이지로 보고 있어요. +를 눌러 페이지를 나눠요.",pageTabTitle:"끌어서 순서 바꾸기 · 오른쪽 클릭으로 이름 바꾸기나 삭제",boardsHead:"보드",searchPlaceholder:"보드 찾기 (⌘K)",search:"보드 찾기",noMatch:n=>`"${n}"에 맞는 보드가 없어요. 파일 이름의 일부로 찾아 보세요.`,emptyPage:"이 페이지에는 아직 보드가 없어요. B를 누르고 캔버스에서 끌어 그려요.",fileMissing:"파일 없음",otherGroup:"기타",mainPage:"기본",groupTitle:n=>`보드 ${n}개 · 클릭해 접고 펼치기 · 더블클릭해 이름 바꾸기`,groupMenu:"그룹 메뉴"},minimap:{aria:"미니맵: 클릭한 곳으로 이동"},sections:{board:"보드",comments:"댓글",guides:"레이아웃 가이드",tweaks:"조정 값",tokenCheck:"토큰 검사",a11y:"접근성",checks:"검사",properties:"속성",layers:"레이어"},boardOptions:{print:"인쇄",printMode:"쪽",printModes:{continuous:"연속",fixed:"용지"},paper:"용지 크기",papers:{letter:"레터",a4:"A4"},bg:"배경",bgNone:"없음",aria:"보드 옵션",positionAndSize:"위치와 크기",position:"위치",size:"크기",options:"옵션",renameTitle:"이름 바꾸기 (F2)",renameFileTitle:"파일 이름 바꾸기",width:"너비",height:"높이",radius:"모서리",interactive:"재생 버튼 표시",interactiveTitle:"보드 라벨의 ▶를 점과 함께 늘 보여 줘요. 끄면 보드를 선택하거나 마우스를 올렸을 때만 ▶가 보여요. 어떤 보드든 P나 오른쪽 클릭으로 재생할 수 있어요",frameless:"프레임 없음",fill:"창에 맞춰 늘이기",launch:"시작 화면으로 열기",page:"페이지",focus:"포커스 보기",focusTitle:"포커스 보기 (F)",front:"맨 앞으로 가져오기",frontTitle:"맨 앞으로 가져오기 (⌘])",back:"맨 뒤로 보내기",backTitle:"맨 뒤로 보내기 (⌘[)",duplicate:"복제",duplicateTitle:"복제 (⌘D)",delete:"삭제",deleteTitle:"삭제 (Delete)",selectedN:n=>`보드 ${n}개 선택됨`,frontTitleMod:n=>`맨 앞으로 가져오기 (${n}])`,backTitleMod:n=>`맨 뒤로 보내기 (${n}[)`,goToSelected:"선택한 보드로 이동",goToSelectedTitle:"선택한 보드로 이동 (⇧2)",deleteTitleKey:"삭제 (⌫)"},full:{aria:n=>`${n} 전체 창`,back:"캔버스로 (Esc)",fill:"채우기",fillTitle:"창 채우기",fit:"맞추기",fitTitle:"보드 원래 크기로, 창에 맞게 축소",mode:"크기"},focus:{aria:n=>`${n} 포커스 보기`,prev:"이전 보드",next:"다음 보드",pageStyle:" · 페이지형",close:"닫기"},play:{back:"뒤로",forward:"앞으로",viewOnCanvas:"캔버스에서 보기",closeTitle:"닫기 (Esc)",close:"닫기"},share:{button:"공유",buttonTitle:"보기 전용 사본 공유 (웹 폴더, 파일 하나, PDF, PNG)",title:"보기 전용 사본 공유",scope:"내보낼 범위",whole:"캔버스 전체",page:"이 페이지",pageNone:"이 캔버스는 페이지가 하나예요",selected:n=>`선택한 보드 (${n})`,webTitle:"웹 폴더",webHint:"정적 파일이에요. Vercel, GitHub Pages, PR 미리보기에 올려요.",singleTitle:"파일 하나",singleHint:n=>` · ${n} · 호스팅 없이 어느 브라우저에서나 열려요`,singleSwitch:".html 파일 하나로",measuring:"크기 재는 중…",pdfTitle:"PDF",pdfHint:"한 페이지에 보드 하나",pngTitle:"PNG",pngHint:"보드마다 이미지 하나, 2배",export:"내보내기",save:"저장",working:"내보내는 중…",exported:"내보냄",saved:"저장함",reveal:"폴더 보기",revealTitle:"파일 관리자에서 폴더를 보여 줘요",copyDeploy:"배포 명령 복사",copyDeployTitle:n=>`${jt(n,"을/를")} 복사해요 (프로젝트 폴더에서 실행해요)`,copied:n=>`복사함: ${n}`,copyFailed:"클립보드에 복사하지 못했어요",attachHint:"Slack, 이메일, PR에 첨부해요.",skipped:n=>`참조 ${n}개는 넣지 못했어요`,largeFiles:"캔버스가 크면 파일도 커져요. 실시간으로 바뀌지 않아요.",sameAs:"같은 명령:",unavailable:"여기서는 쓸 수 없어요."},viewer:{docTitle:n=>`${n} — 보기 전용`,noData:"Easel에서 내보낸 페이지지만 데이터가 없어요 (easel-viewer/data.js).",bar:"뷰어",pages:"페이지",play:"재생",playTitle:"선택한 보드(없으면 첫 보드)를 전체 화면으로 재생해요",stamp:n=>`보기 전용 · ${n}에 내보냄`,stampTitle:"읽기 전용 사본이에요. 디자인 파일을 고친 뒤 다시 내보내요.",madeWith:"Easel로 만듦",comments:"댓글",commentsN:n=>`댓글 ${n}`,noComments:"댓글 없음",replies:n=>`답글 ${n}개`,pin:(n,o)=>`${o}의 댓글 ${n}`,threadOf:(n,o)=>`${n}/${o}`,closeThread:"댓글 닫기",boardsPanel:"보드",commentsPanel:"댓글 패널",empty:"이 페이지에는 아무것도 없어요",embedGate:"캔버스를 직접 써 볼 수 있어요. 화면 이동, 확대/축소, 보드 열기, 재생. Esc를 누르면 페이지로 돌아가요.",embedHint:"클릭하면 캔버스를 움직이고 확대/축소할 수 있어요",embedHintLive:"Esc를 누르거나 바깥을 클릭하면 페이지로 돌아가요"},canvas:{aria:"디자인 캔버스",board:(n,o,r,f)=>`보드 ${n}${o?" (선택됨)":""}${r?" 편집 중":""}${f?" 재생 중":""}`,interactive:"재생할 수 있는 보드",hint:"클릭해 선택 · 더블클릭해 텍스트 고치기 · Esc로 선택 해제",notLoaded:"가까이 가면 불러와요",fileMissing:n=>`파일 없음 · ${n}`,playing:"▶ 재생 중 · Esc",exportingPng:"PNG 내보내는 중…",play:"재생",playTitle:"재생 (P)",stopPlay:"재생 중지",stopPlayTitle:"재생 중지 (P 또는 Esc)",playShort:"재생",edit:"편집",exportBoard:"이 보드 내보내기 (PNG)",fullWindow:"전체 창으로 열기",tweaks:"이 보드의 조정 값",boardSize:"보드 크기",titleMaxWidth:"최대 너비",stickySize:"스티키 노트 크기",deleteNote:"메모 삭제"},editMode:{fileChanged:"다른 사람이 먼저 이 파일을 바꿨어요. 요소를 다시 선택해 주세요."},elementDrag:{moveAria:"요소 옮기기 (Alt: 가리킨 상자 안으로)",moveTitle:"끌어서 옮기기 · Alt를 누르고 있으면 가리킨 상자 안에 넣어요",width:"너비",height:"높이",size:"크기"},extra:{letterSpacing:"자간",size:"크기",width:"너비",height:"높이",fixed:"고정",hug:"콘텐츠 맞춤",fill:"채우기",mode:n=>`${n} 방식`,position:"위치",flow:"일반 흐름",absolute:"절대",look:"모양",opacity:"불투명도",border:"테두리",borderStyles:{none:"없음",solid:"실선",dashed:"파선",dotted:"점선"},shadow:"그림자",shadows:{none:"없음",small:"작게",medium:"보통",large:"크게",custom:"사용자 지정"},link:"링크",href:"주소",newTab:"새 탭",export:"내보내기",exportPng:"PNG 2×",exporting:"내보내는 중…"},code:{inline:"인라인 스타일",placeholder:"속성: 값;",bad:n=>`읽을 수 없는 선언: ${n}`,computed:"계산값"},layers:{collapse:"접기",expand:"펼치기",title:"레이어",outline:"페이지 개요",hint:"항목을 다른 항목 위에 놓으면 그 앞으로 옮겨요. Shift+클릭으로 여러 개를 골라 감쌀 수 있어요. 목록을 클릭한 뒤 ↑↓로 옮기고 ←→로 접고 펼쳐요."},keys:{sections:{tools:"도구",edit:"편집",element:"요소",move:"이동",view:"보기",ai:"AI와 댓글"},rows:{select:"선택",hand:"손",board:"보드 그리기",title:"제목",note:"메모",rect:"사각형",oval:"타원",line:"선",arrow:"화살표",penOrPlay:"펜 · 고른 보드는 제자리에서 재생",undo:"실행 취소",redo:"다시 실행",copy:"요소 복사",paste:"뒤에 붙여넣기",duplicate:"복제",delete:"삭제",selectAll:"모두 선택",lock:"잠금 / 풀기",rename:"보드 이름 바꾸기",front:"맨 앞으로",back:"맨 뒤로",copyPng:"PNG로 복사",copyProps:"속성 복사",pasteProps:"속성 붙여넣기",flipH:"좌우 반전",flipV:"상하 반전",wrap:"flex 상자로 묶기",reorder:"형제 사이에서 옮기기",enter:"보드 안으로 · 첫 자식",next:"다음 요소나 보드",arrows:"조금씩 옮기기 · 요소 사이 이동",escape:"선택 풀기 · 닫기",regions:"앱의 다음 영역",zoomIn:"확대",zoomOut:"축소",zoom100:"100%로 보기",fitAll:"전체 보기",zoomSel:"선택 항목에 맞추기",guides:"레이아웃 가이드",minimap:"미니맵",prototype:"프로토타입 보기",panel:"속성 패널",clean:"캔버스만 보기",ai:"AI에게 요청",find:"보드 찾기",comments:"댓글 모드"}},inline:{title:"AI에게 요청",placeholder:"무엇을 바꿀까요?",send:"보내기",history:"대화",visible:n=>`보이는 보드 ${n}개`,result:"AI 결과",done:"끝났어요.",failed:"끝내지 못했어요.",cancelled:"취소했어요.",undo:"되돌리기",undone:"되돌림",open:"대화 보기",close:"닫기",running:"작업 중…",agentItem:n=>`AI 에이전트: ${n}`,modelItem:n=>`모델: ${n||"기본값"}`,modelTitle:"모델",modelLabel:"모델 이름(비우면 에이전트 기본값)"},select:{toolbar:"요소",text:"텍스트",textOff:"이 요소에는 텍스트가 없어요",fill:"채우기",textColor:"글자색",radius:"모서리",spacing:"간격",askAi:"AI",askAiAria:"AI에게 요청",askAiTitle:"이 요소에 대해 AI에게 요청",comment:"댓글",commentTitle:"이 요소에 댓글 달기",more:"더 보기",textStyle:"스타일과 정렬",textAlign:"정렬",bold:"굵게",italic:"기울임",underline:"밑줄",align:n=>({left:"왼쪽 정렬",center:"가운데 정렬",right:"오른쪽 정렬"})[n]??"정렬",tokens:"토큰",custom:"직접 입력…",hex:"Hex 색",picker:"색 고르기",tokenNow:n=>`${n} · 토큰`,decrease:n=>`${n} 줄이기`,increase:n=>`${n} 늘리기`},design:{fill:"채우기",text:"텍스트",font:"글꼴",size:"크기",weight:"굵기",color:"색",cornerRadius:"모서리 반경",padding:"패딩",gap:"간격",more:"더 보기 (CSS)",none:"없음",inherited:n=>`(${n})`,weights:{100:"Thin",200:"Extra light",300:"Light",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Extra bold",900:"Black"},white:"흰색",black:"검은색",grade:n=>n>=7?"AAA":n>=4.5?"AA":n>=3?"AA 큰 글자만":"너무 낮음",contrastWith:(n,o,r)=>`${o} 글자와 명도 대비 ${n}:1 · ${r}`,contrastOn:(n,o,r)=>`${o} 위 명도 대비 ${n}:1 · ${r}`,openFill:n=>`${n}: 바꾸기`},properties:{tokenColors:{text:"텍스트",secondaryText:"보조 텍스트",background:"배경",surface:"표면",divider:"구분선",accent:"강조",error:"오류"},fields:{width:"너비",height:"높이",fontSize:"글자 크기",fontWeight:"굵기",color:"색",background:"배경",radius:"모서리",flexDirection:"Flex 방향",alignItems:"항목 정렬",justifyContent:"콘텐츠 배치",flexWrap:"줄바꿈",flexGrow:"늘이기",alignSelf:"자기 정렬",lineHeight:"줄 높이",textAlign:"텍스트 정렬",border:"테두리",boxShadow:"그림자",opacity:"불투명도"},alignButtons:{left:"왼쪽 정렬",hcenter:"가운데 정렬",right:"오른쪽 정렬",top:"위쪽 정렬",vcenter:"세로 가운데 정렬",bottom:"아래쪽 정렬"},columns:"열",rows:"행",align:"정렬",layout:"레이아웃",wrap:"감싸기",image:"이미지",replaceImage:"이미지 바꾸기…",wrapTitle:"같은 부모 아래 이어진 형제 요소를 먼저 선택해요",wrapFlex:"Flex로 감싸기",wrapGrid:"Grid로 감싸기",duplicate:"복제",delete:"삭제",offToken:n=>`토큰 밖: ${n}`,none:"없음",contrastTitle:"배경과의 명도 대비 (본문 4.5 이상, 큰 글자 3 이상)",contrast:"명도 대비",largeTextOnly:"큰 글자만",tooLow:"너무 낮음"},shapes:{selectedN:n=>`도형 ${n}개 선택됨`,deleteAll:"선택한 도형 삭제",stickyColors:{yellow:"노랑",orange:"주황",pink:"분홍",purple:"보라",blue:"파랑",green:"초록",gray:"회색",white:"흰색"},shapeSize:"도형 크기",drawShape:"도형 그리기",kinds:{rect:"사각형",oval:"타원",line:"선",arrow:"화살표",pen:"펜",image:"이미지"},none:"없음",options:"도형 옵션",strokeColor:"선 색",fill:"채우기",weight:"굵기",strokeWeight:"선 굵기",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",deleteShape:"도형 삭제",deleteTitle:"삭제 (⌫)"},notes:{selectedN:n=>`메모 ${n}개 선택됨`,deleteAll:"선택한 메모 삭제",options:"메모 옵션",title:"제목",sticky:"스티키 노트",fontSize:"글자 크기",defaultSuffix:" (기본)",textStyle:"텍스트 스타일",bold:"굵게",italic:"기울임",color:"색",stickyColor:n=>`${n} 스티키 노트`,maxWidth:"최대 너비",maxHeight:"최대 높이",width:"너비",height:"높이",titleHint:"최대 너비나 높이를 넘으면 글자가 작아져요 (0은 제한 없음).",stickyHint:"높이를 정하면 넘치는 글은 스크롤돼요 (0은 내용에 맞춤).",deleteNote:"메모 삭제",deleteTitle:"삭제 (⌫)"},guides:{aria:"레이아웃 가이드",heading:(n,o)=>`레이아웃 가이드 ${n}/${o}`,types:{columns:"열",rows:"행",grid:"그리드"},add:{columns:"열 가이드 추가",rows:"행 가이드 추가",grid:"그리드 가이드 추가"},empty:"열, 행, 그리드 가이드를 6개까지 넣을 수 있어요. 캔버스에만 보이고 화면 HTML에는 들어가지 않아요. 모두 숨기기: ⌃G",color:"가이드 색",show:"보이기",hide:"숨기기",deleteGuide:"가이드 삭제",delete:"삭제",cell:"칸",count:"개수",gutter:"거터",margin:"여백",cellSize:"칸 크기",align:"정렬",alignAria:"가이드 정렬",stretch:"늘이기",left:"왼쪽",top:"위",center:"가운데",right:"오른쪽",bottom:"아래"},dialog:{renameGroupTitle:"그룹 이름 바꾸기",menu:"메뉴",cancel:"취소",ok:"확인",deleteBoardsTitle:(n,o)=>n>1?`보드 ${n}개를 삭제할까요?`:`"${o}" 보드를 삭제할까요?`,deleteBoardsBody:"HTML 파일도 함께 지워져요. 사본은 휴지통(docs/design/.trash)에 남고, 실행 취소(⌘Z)로 바로 되돌릴 수 있어요.",delete:"삭제",renameBoardTitle:"보드 이름 바꾸기",name:"이름",rename:"이름 바꾸기",renameFileTitle:"파일 이름 바꾸기",fileName:"파일 이름",renameFileRefs:n=>`이 파일을 가리키는 링크나 iframe: ${n}`,renameFileNoRefs:"이 파일을 가리키는 링크나 iframe이 없어요.",renameFileExtra:n=>`참조 ${n}개도 새 이름으로 바꾸기`,newPageTitle:"새 페이지",newPageName:n=>`페이지 ${n}`,create:"만들기",renamePageTitle:"페이지 이름 바꾸기",deletePageTitle:n=>`"${n}" 페이지를 삭제할까요?`,deletePageBody:n=>`보드 ${n}개와 메모는 지워지지 않고 첫 페이지로 옮겨져요. ⌘Z로 되돌릴 수 있어요.`,authorTitle:"댓글 작성자",save:"저장",snapshotTitle:"스냅샷 저장",snapshotLabel:"메시지",snapshotMessage:n=>`docs(design): design snapshot ${n}`,snapshotHint:"디자인 폴더만 커밋해요. 작성자는 git 설정을 따르고, 따로 스테이징한 다른 파일은 들어가지 않아요.",commit:"커밋"},toast:{linkCopied:"링크를 복사했어요",copiedPng:"PNG로 복사했어요",copiedHtml:"HTML로 복사했어요",copiedProps:"속성을 복사했어요",saveFailed:n=>`저장하지 못했어요: ${n}`,undoRedoDone:(n,o)=>`${n==="undo"?"실행 취소":"다시 실행"}: ${o}`,nothingToUndo:"되돌릴 작업이 없어요",nothingToRedo:"다시 실행할 작업이 없어요",undoAction:"실행 취소",textOnly:"텍스트(와 줄바꿈)만 든 요소만 그 자리에서 고칠 수 있어요",moved:"옮겼어요",movedFrozen:"옮겼어요 (원래 자리의 크기를 유지했어요)",copiedElement:(n,o)=>`${jt(`<${n}>`,"을/를")} 복사했어요. 다른 보드를 편집하면서 ${o}V로 붙여 넣어요`,nothingCopied:"복사한 요소가 없어요. 편집 중에 요소를 선택하고 ⌘C를 눌러요",pasted:(n,o)=>`${n}에서 ${jt(`<${o}>`,"을/를")} 붙여 넣었어요`,imageReplaced:n=>`이미지를 ${jt(n,"으로/로")} 바꿨어요`,boardCreated:n=>`${n} 보드를 만들었어요`,boardCreateFailed:n=>`보드를 만들지 못했어요: ${n}`,boardsDeleted:n=>`보드 ${n}개를 삭제했어요`,duplicated:n=>`${jt(n,"으로/로")} 복제했어요`,renamed:"이름을 바꿨어요",fileRenamed:(n,o)=>`${jt(n,"으로/로")} 이름을 바꿨어요${o?" (참조도 바꿨어요)":""}`,notesMax:n=>`메모는 ${n}개까지 둘 수 있어요`,noteDeleted:"메모를 삭제했어요",shapeDeleted:"도형을 삭제했어요",shapesDeleted:n=>`도형 ${n}개를 삭제했어요`,imageReadFailed:"이미지를 읽지 못했어요",importOnly:n=>`${n}: HTML이나 이미지만 가져올 수 있어요`,imported:n=>`보드 ${n}개를 가져왔어요`,pagesMax:"페이지는 40개까지 만들 수 있어요",pageDeleted:"페이지를 삭제했어요",copied:"복사했어요",elementDeleted:"요소를 삭제했어요",wrapped:n=>`${jt(n,"으로/로")} 감쌌어요`,theme:n=>`테마: ${n}`,tokensSaved:"토큰을 저장했어요",nothingChanged:"바뀐 것이 없어요",snapshot:n=>`스냅샷 ${n}`,cleanedUp:n=>`보드 ${n}개를 정리했어요`,uploaded:n=>`${jt(n,"을/를")} 올렸어요`,tweaksSaved:"조정 값을 소스에 저장했어요",blockFlow:"블록 흐름에서는 세로 정렬이 적용되지 않아요. 부모를 flex로 바꿔 보세요",pngExporting:n=>`${n} 만드는 중…`,pngExported:n=>`${jt(n,"을/를")} 내려받았어요`,pngNeedsBrowser:"PNG로 내보내려면 헤드리스 브라우저가 필요해요:",pngFailed:n=>`PNG를 만들지 못했어요: ${n}`},history:{lock:"잠금",unlock:"잠금 해제",flip:"뒤집기",renameGroup:"그룹 이름 바꾸기",pageFromGroup:"그룹으로 페이지 만들기",boardOptions:"보드 옵션",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",moveBoard:"보드 옮기기",resizeBoard:"보드 크기 바꾸기",addTitle:"제목 추가",addNote:"메모 추가",deleteNote:"메모 삭제",duplicateNote:"메모 복제",moveNote:"메모 옮기기",editNote:"메모 고치기",noteStyle:"메모 스타일",addShape:"도형 추가",deleteShape:"도형 삭제",moveShape:"도형 옮기기",resizeShape:"도형 크기 바꾸기",shapeStyle:"도형 스타일",shapeFront:"도형 맨 앞으로",shapeBack:"도형 맨 뒤로",addImage:"이미지 추가",launchPage:"시작 페이지",moveToPage:"페이지로 옮기기",launchScreen:"시작 화면 정하기",changeTheme:"테마 바꾸기",cleanMissing:"파일 없는 보드 정리",editGuide:"레이아웃 가이드 고치기",addGuide:"레이아웃 가이드 추가",deleteGuide:"레이아웃 가이드 삭제",saveTokens:"토큰 저장",registerTokens:"토큰 등록"},defaults:{newTitle:"새 제목",note:"메모",pastedImage:"pasted-image.png"},menu:{openProps:"속성 패널 열기",newBoard:"새 보드",renameGroup:"그룹 이름 바꾸기…",pageFromGroup:"이 그룹으로 페이지 만들기",drawWithB:"B로 그리기",rename:"이름 바꾸기",moveUp:"위로 옮기기",moveDown:"아래로 옮기기",unsetLaunchPage:"시작 페이지 해제",setLaunchPage:"시작 페이지로 정하기",moveSelectedToPage:n=>`선택한 보드 ${n}개를 이 페이지로 옮기기`,delete:"삭제",selectInside:"안쪽 선택",playInPlace:"제자리에서 재생",stopPlay:"재생 중지",playFullScreen:"전체 화면으로 재생",lock:"잠금",unlock:"잠금 해제",copyPng:"PNG로 복사",copyHtml:"HTML로 복사",copyProps:"속성 복사",pasteProps:"속성 붙여넣기",flipH:"좌우 반전",flipV:"상하 반전",locked:"잠김",askReview:"AI에게 리뷰 요청",focusView:"프로토타입 보기",askAI:"AI",askAIAria:"AI에게 요청",askFixErrors:"AI에게 오류 수정 요청",goToBoard:"보드로 이동",exportPng:"PNG로 내보내기",exportingPng:"PNG 내보내는 중…",renameFile:"파일 이름 바꾸기…",duplicate:"복제",front:"맨 앞으로 가져오기",back:"맨 뒤로 보내기",deleteBoards:n=>`보드 ${n}개 삭제`,title:"제목",note:"메모",duplicateInFront:"앞에 복제",newBoardHere:"여기에 새 보드",mobileFrameHere:"여기에 모바일 화면 프레임",titleHere:"여기에 제목",noteHere:"여기에 메모",selectAll:"이 페이지 모두 선택",fitAll:"전체 보기",zoom100:"100%로 보기",undo:"실행 취소",redo:"다시 실행",element:"요소",editText:"텍스트 고치기",selectParent:"부모 선택",copy:"복사",pasteAfter:"뒤에 붙여넣기",replaceImage:"이미지 바꾸기…",copyForAI:"AI용 설명 복사",shape:"도형",snapshot:"스냅샷",notGit:"디자인 폴더가 git 저장소 안에 있지 않아요",snapshotStatus:(n,o)=>`스냅샷 · ${n} · 바뀐 파일 ${o}개`,snapshotNow:"지금 스냅샷 저장 (git 커밋)…",nothingChanged:"바뀐 것 없음",fileMissing:"파일이 없어요",askFixAll:"AI에게 모두 수정 요청",cleanMissing:n=>`파일 없는 보드 ${n}개 정리`},prompts:{fixErrors:n=>`이 오류들을 고쳐 줘:
53
+ ${n}`,error:"오류",review:"이 화면을 리뷰해 줘: 접근성(48px 터치 영역, 명도 대비 4.5, 라벨), 정보 위계, 토큰 위반(get_tokens, check_tokens)을 짚고 우선순위대로 고칠 방법을 알려 줘. 아무것도 고치지 말고 제안만 해 줘.",fixComment:"이 댓글이 말하는 대로 그 부분만 고쳐 줘",fixTokens:n=>`토큰 밖의 값을 토큰으로 바꿔 줘 (check_tokens로 확인해 줘):
54
+ ${n}`,fixA11y:n=>`접근성 문제를 고쳐 줘 (보이는 크기는 그대로 두고 터치 영역은 패딩으로 넓혀 줘):
55
+ ${n}`,line:"줄 "},checks:{tokenCheck:n=>`토큰 검사 · ${n}`,noOffToken:"토큰 밖의 값이 없어요",off:"꺼짐",tokensOffTitle:"등록된 토큰이 없어 검사가 꺼져 있어요",tokensOffBody:"색과 크기를 검사하지 않고, AI에게 기본 팔레트도 주지 않아요.",setUpTokens:"토큰 설정",a11y:"접근성",a11yOk:"터치 영역, 명도 대비, 라벨 문제가 없어요",askFix:"AI에게 수정 요청",notVisible:"보드가 화면에 보일 때 검사해요.",pickInEdit:n=>`보드에서 ${n} 선택`,line:n=>`${n}번째 줄`,more:n=>`외 ${n}개`,colorNotInTokens:"토큰에 없는 색",tokenFontSizes:n=>`토큰 글자 크기: ${n}`,tokenRadii:n=>`토큰 모서리: ${n}`,notMultipleOf4:"4의 배수가 아님",tokenWeights:n=>`토큰 굵기: ${n}`,smallTarget:(n,o,r,f)=>`<${n}> 터치 영역 ${o}×${r} (${f} 미만)`,noName:n=>`<${n}>에 이름이 없어요 (aria-label, 텍스트, label)`,noAlt:'<img>에 alt가 없어요 (장식용이면 alt="")',lowContrast:(n,o,r)=>`명도 대비 ${n}:1 (${o} 필요) "${r}"`},tokens:{import:"토큰 가져오기 (tokens.json 또는 Figma 변수 JSON)",importFailed:n=>`가져오지 못했어요: ${n}`,theme:"테마",addTheme:"테마 추가 (지금 테마 복사)",newTheme:"새 테마",newThemeN:n=>`새 테마 ${n}`,activeTheme:"사용 중인 테마",themeName:"테마 이름",importedTheme:"가져온 테마",colors:n=>`색 ${n}`,addColor:"색 추가",colorN:n=>`색 ${n}`,colorOf:n=>`${n} 색`,colorName:"색 이름",remove:n=>`${n} 삭제`,fontSizes:"글자 크기",fontWeights:"글자 굵기",radii:"모서리",spacing:"간격",touchTarget:"터치 영역",minTouchTarget:"최소 터치 영역",saveTitle:"docs/design/tokens.json에 저장",save:"저장",register:"토큰 등록",registeredHint:"속성 패널의 색 견본, 토큰 검사, AI(get_tokens)가 선택한 테마의 값을 써요.",defaultHint:"아직 쓰이지 않는 시작 값이에요. 등록하면 tokens.json에 저장되고 토큰 검사와 AI 팔레트가 켜져요.",noColors:"색 값을 찾지 못했어요"},tweaks:{revert:"되돌리기",save:"소스에 저장",hint:"CSS 변수로 바로 적용돼요. 저장하면 board-tweaks JSON의 값만 바뀌어요."},inspector:{shotFailed:n=>`실패: ${n}`,kindName:n=>({text:"텍스트",button:"버튼",link:"링크",image:"이미지",input:"입력란",icon:"아이콘",container:"컨테이너"})[n]??n,crumbs:"선택 경로",crumbBoard:"보드 선택",crumbParent:n=>`${n} 선택`,crumbElement:(n,o)=>`<${n}> ${o}`,more:n=>`외 ${n}개`,copy:"복사",copied:"복사함",capturing:"캡처하는 중…",screenshot:"스크린샷",boardScreenshot:"보드 스크린샷",boardScreenshotTitle:"이 보드의 PNG를 디자인 폴더 옆에 저장해요",screenshotTitle:"이 요소의 PNG를 저장해요",actions:"요소 작업",boardActions:"보드 작업"},comments:{pinLabel:(n,o,r)=>`${o}의 댓글 ${n}: ${r}`,title:"댓글",placeholderElement:n=>`선택한 요소(${n})에 댓글 달기`,placeholderBoard:"보드에 댓글 달기",placeholder:"댓글 달기",add:"댓글",authorTitle:"댓글 작성자 이름 바꾸기",author:n=>`작성자: ${n}`,replyPlaceholder:n=>`${jt(n,"으로/로")} 답글 달기 (⌘Enter)`,reply:"답글",replyResolve:"답글 달고 해결",reopen:"다시 열기",resolve:"해결",sendToAI:"AI에게 보내기",sendToAITitle:"이 댓글이 가리키는 곳만 고치도록 AI에게 보내요",openThread:"이 댓글만 보기",allOnBoard:n=>`이 보드 댓글 ${n}개 모두`,mode:"댓글 모드",modeTitle:"댓글 모드 (⌥C)",allTitle:"모든 댓글",thisPage:"이 페이지",allPages:"모든 페이지",showResolved:"해결됨",scope:"보일 댓글",edit:"편집",deleteThread:"삭제",more:"편집·삭제",none:"댓글 없음",nothingSelected:"선택 없음"},assets:{uploading:"올리는 중…",upload:"올리기 (이미지와 글꼴, 끌어다 놓아도 돼요)",loading:"불러오는 중…",empty:"아직 에셋이 없어요. 올린 이미지는 docs/design/assets/에 저장되고 화면에서는 ../assets/이름 으로 써요.",copyPath:" · 클릭해 경로 복사",file:"파일",pickImage:"이미지 고르기",pickLabel:", 이 이미지 쓰기",close:"닫기"},chat:{aria:"AI 채팅",agent:"에이전트",agentHint:"파일을 고칠 에이전트",agentButton:(n,o)=>o?`에이전트: ${n} — ${o}`:`에이전트: ${n}`,agentStatus:{ready:"준비됨",signin:"로그인 필요",missing:"설치 안 됨",unknown:"확인하지 못함"},checking:"확인하는 중…",checkedOnOpen:"AI 탭을 열 때 확인함",checkAgain:"다시 확인",model:"모델",modelDefault:"기본값 (CLI 설정)",modelTitle:n=>`${n}의 모델: 별칭이나 전체 모델 ID. 비워 두면 CLI 기본값을 써요.`,continuing:"대화 이어 가는 중",newConversation:"새 대화",newChat:"새 채팅",intro:n=>`선택한 보드와 요소, 화면에 보이는 보드를 맥락으로 ${n}에게 보내요. 에이전트가 소스 HTML을 바로 고치고, 캔버스는 곧바로 다시 그려져요.`,suggestions:[{label:"AI 리뷰: 접근성, 명도 대비, 위계",text:"선택한 화면을 리뷰해 줘: 접근성(48px 터치 영역, 명도 대비 4.5, 라벨), 정보 위계, 토큰 위반(get_tokens, check_tokens). 아무것도 고치지 말고 우선순위대로 제안만 해 줘.",n:1},{label:"이 화면의 시안 3개",text:"선택한 화면을 서로 다른 방향으로 시안 3개 만들어 줘 (레이아웃, 위계, 강조점을 각각 다르게).",n:3},{label:"선택한 버튼 문구 줄이기",text:"선택한 버튼 문구를 줄여 줘",n:1},{label:"새 빈 상태 화면 만들기",text:"새 빈 상태 화면을 만들어 줘",n:1}],remedySignin:(n,o)=>`${n}에 로그인되어 있지 않아요. 터미널에서 \`${o}\` 명령을 실행해요.`,remedyMissing:n=>`\`${n}\` 명령을 찾지 못했어요. 설치한 뒤 다시 확인해요.`,copyCommand:"명령 복사",copy:"복사",copied:"복사함",sendNeedsSignin:n=>`보내려면 ${n}에 로그인해요`,sendNeedsInstall:n=>`보내려면 ${jt(n,"을/를")} 설치해요`,running:"실행 중",cancelled:"취소됨",failed:"실패",retry:"다시 시도",switchTo:n=>`${jt(n,"으로/로")} 바꾸기`,details:"자세히",noFilesChanged:"바뀐 파일이 없어요.",restored:"실패한 메시지에서 되살렸어요",madeVariants:n=>`시안 ${n}개를 나란히 만들었어요 · 보기`,thinking:"생각하는 중…",chipElement:n=>`요소 <${n}>`,chipElementText:(n,o)=>`요소 <${n}> ${o}`,chipBoards:n=>`보드 ${n}개`,chipVisible:n=>`보이는 보드 ${n}`,chipComment:n=>`댓글 "${n}"`,variants:n=>`시안 ${n}개`,tooBig:n=>`${n}: 15MB보다 커요`,refLink:"참고 링크",placeholderRunning:"실행 중… (Esc로 취소)",placeholder:"무엇을 바꿀까요? (Enter로 보내기 · Shift+Enter로 줄바꿈)",input:"AI에게 보낼 메시지",attach:"파일이나 이미지 첨부",attachTitle:"파일이나 이미지 첨부 (끌어다 놓거나 붙여 넣어도 돼요)",addLink:"참고 링크 추가",variantsTitle:"선택한 보드를 복사해 서로 다른 시안을 나란히 만들어요",variantsDisabledTitle:"보드를 하나 선택하면 쓸 수 있어요",variantsAria:"시안 개수",cancel:"취소",cancelTitle:"취소 (Esc)",send:"보내기",chipRemoveTitle:"클릭해 빼기",chipAddTitle:"클릭해 첨부",remove:n=>`${n} 빼기`,howToInstall:"설치 방법",customCommand:"직접 지정한 명령…",checkedAt:(n,o)=>o?`AI 탭을 열 때 확인함 · ${n}`:`${n}에 다시 확인함`,customTitle:"직접 지정한 명령",customName:"이름",customCommandLabel:"명령",customNamePlaceholder:"Aider",customCommandPlaceholder:"aider --message {prompt} --yes",customHint:"`{prompt}`는 요청과 캔버스 맥락으로 바뀌어요. 출력은 일반 텍스트로 보여요.",customSave:"저장",customCommandTitle:n=>`셸 없이 실행해요: ${n}`,waiting:"응답 기다리는 중",waitingHint:"위의 요청에 답해 주세요",permAsk:(n,o,r)=>o==="command"?`${jt(n,"이/가")} 명령 실행을 요청해요`:o==="edit"?`${jt(n,"이/가")} 파일 ${r==="Write"?"쓰기를":"수정을"} 요청해요`:o==="fetch"?`${jt(n,"이/가")} 페이지 가져오기를 요청해요`:`${jt(n,"이/가")} ${r} 사용을 요청해요`,permIn:"위치",permOutside:"디자인 폴더 밖",allowOnce:"한 번 허용",alwaysAllow:n=>`${n} 항상 허용`,alwaysAllowTitle:"Easel을 다시 시작할 때까지, 이 캔버스에서만",deny:"거부",permDone:{once:"허용함",always:"항상 허용함",deny:"거부함"},permDoneOutside:"(디자인 폴더 밖)",noPause:{codex:"Codex exec는 멈추고 물어볼 수 없어서 샌드박스 설정을 따라요.",cursor:"Cursor Agent는 여기서 멈추고 물어볼 수 없어서 --force로 실행돼요.",gemini:"Gemini CLI는 여기서 멈추고 물어볼 수 없어서 수정을 스스로 받아들여요."},runChanged:(n,o)=>n&&o?`보드 ${n}개 바꿈 · ${o}개 추가`:o?`보드 ${o}개 추가`:n?`보드 ${n}개 바꿈`:"캔버스를 바꿈",chipNew:n=>`${n} (새로 만듦)`,chipRemoved:n=>`${n} (삭제됨)`,undoRun:"이 실행 취소",compare:"비교",redo:"다시 실행",runUndone:n=>`실행을 취소했어요 · 보드 ${n}개를 되돌렸어요`,conflictUndo:n=>`이 실행 뒤에 바뀐 보드: ${n}. 나머지만 취소하고 이 보드는 그대로 둘까요, 모두 취소하고 덮어쓸까요?`,conflictRedo:n=>`취소한 뒤에 바뀐 보드: ${n}. 나머지만 다시 실행하고 이 보드는 그대로 둘까요, 모두 다시 실행하고 덮어쓸까요?`,undoRest:"나머지만 취소",undoAll:"그래도 모두 취소",redoRest:"나머지만 다시 실행",redoAll:"그래도 모두 다시 실행",restoreCopy:"이 실행 전 사본으로 되돌리기",savedAt:n=>`${n}에 저장함`,copyGone:"이 실행 전 사본이 없어요 (최근 10개만 보관해요).",restoredCopy:"캔버스를 이 실행 전 사본으로 되돌렸어요",restoreTitle:"이 실행 전 사본으로 되돌릴까요?",restoreBody:n=>`캔버스 전체를 이 실행 전인 ${n} 상태로 되돌려요. 모든 화면과 board.json이 바뀌고, 그 뒤에 내가 바꾸거나 다른 실행이 바꾼 것도 포함돼요. 실행 취소로 되돌리기를 취소할 수 있어요.`,restoreOk:"되돌리기",restarted:n=>`Easel 다시 시작됨 · ${n}`},compare:{title:n=>`비교 · ${n}`,boards:"보드",before:"전",after:"후",notBefore:"실행 전에는 없던 보드예요.",notAfter:"이 실행이 보드를 삭제했어요.",notBeforeChange:"이 변경 전에는 없던 보드예요.",close:"닫기"},activity:{stepName:n=>{const o=String(n),r={text:"텍스트",heading:"제목","button copy":"버튼 글","link text":"링크 글",label:"라벨",style:"스타일",attribute:"속성",tweaks:"조정 값",colour:"글자색",fill:"채우기","text size":"글자 크기",weight:"굵기",italic:"기울임",underline:"밑줄",alignment:"정렬",radius:"모서리",padding:"패딩",gap:"간격",opacity:"불투명도","letter spacing":"자간",size:"크기",position:"위치",shadow:"그림자",border:"테두리"},f={Delete:"요소 삭제",Duplicate:"요소 복제",Move:"요소 이동",Add:"요소 추가"},m={"Add board":"보드 추가","Duplicate board":"보드 복제","Delete board":"보드 삭제","Rename board":"보드 이름 변경","Move board":"보드 이동","Resize board":"보드 크기 변경","Change board":"보드 변경","Board options":"보드 옵션","Bring to front":"맨 앞으로","Send to back":"맨 뒤로","Move to page":"페이지로 이동","Set launch screen":"시작 화면 지정"};let p;if(p=o.match(/^Undo (\d+) changes$/))return`변경 ${p[1]}개 실행 취소`;if(p=o.match(/^Undo (.+)$/))return`실행 취소: ${yb.activity.stepName(p[1])}`;if((p=o.match(/^Change (.+) on (.+)$/))&&r[p[1]])return`${p[2]} · ${r[p[1]]} 변경`;if(p=o.match(/^(Delete|Duplicate|Move|Add) element on (.+)$/))return`${p[2]} · ${f[p[1]]}`;if(p=o.match(/^Group elements on (.+)$/))return`${p[1]} · 요소 묶기`;if(p=o.match(/^(Add|Delete|Move|Resize|Change) (\d+) boards$/))return`보드 ${p[2]}개 ${{Add:"추가",Delete:"삭제",Move:"이동",Resize:"크기 변경",Change:"변경"}[p[1]]}`;for(const[v,S]of Object.entries(m))if(o.startsWith(v+" "))return`${S} · ${o.slice(v.length+1)}`;return(p=o.match(/^Edit (.+)$/))?`${p[1]} · 편집`:(p=o.match(/^Change (.+)$/))?`${p[1]} · 변경`:o},outside:"Easel 밖",ago:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"방금":o<60?`${o}분`:o<1440?`${Math.floor(o/60)}시간`:`${Math.floor(o/1440)}일`},agoLong:n=>{const o=Math.floor(Math.max(0,n)/6e4);return o<1?"방금":o<60?`${o}분 전`:o<1440?`${Math.floor(o/60)}시간 전`:`${Math.floor(o/1440)}일 전`},tag:(n,o,r,f)=>`${n} · ${o} · ${f&&r===1?"새 보드":`변경 ${r}개`}`,tagTitle:n=>`${n} — 클릭해 변경 내용, 전/후, 실행 취소 보기`,tagsAria:n=>`다른 사람의 변경 ${n}개`,popAria:n=>`${n}의 변경`,element:Ty,change:n=>{const o=Ty(n.tag,n.cls);switch(n.kind){case"style":return`${o} 스타일 바뀜`;case"attr":return`${o} 속성 바뀜`;case"edited":return`${o} 바뀜`;case"added":return n.count>1?`요소 ${n.count}개 추가됨`:`${o} 추가됨`;case"removed":return n.count>1?`요소 ${n.count}개 삭제됨`:`${o} 삭제됨`;case"replaced":return`${o} 교체됨`;case"many":return`요소 ${n.count}${n.more?"+":""}개 바뀜`;case"page":return"페이지 스타일이나 제목 바뀜";case"source":return"소스의 공백이나 주석만 바뀜";case"new":return"새 보드";case"deleted":return"보드 삭제됨";case"moved":return"보드 옮겨짐";case"resized":return"보드 크기 바뀜";case"renamed":return"보드 이름 바뀜";case"options":return"보드 옵션 바뀜";default:return"바뀜"}},changes:n=>`이 보드의 변경 ${n}개`,quote:n=>`“${n}”`,arrow:"→",beforeAfter:"전 / 후",undo:"실행 취소",undoTitle:n=>n===1?"이 변경 실행 취소":`이 변경 ${n}개 실행 취소`,conflict:n=>`그 뒤에 바뀐 보드: ${n}. 나머지만 취소하고 이 보드는 그대로 둘까요, 모두 취소하고 덮어쓸까요?`,undoRest:"나머지만 취소",undoAll:"그래도 모두 취소",cancel:"취소",close:"닫기",historyButton:"기록",historyTitle:"기록 · 최신순",historyEmpty:"아직 없어요. 이 세션에서 바꾼 것이 여기에 보여요.",historyFoot:"기록은 이 세션 동안 보관돼요.",now:"지금",goBack:"여기로 돌아가기",goBackAria:(n,o,r)=>`${o}, ${r}: ${n} · 여기로 돌아가기`,nowAria:(n,o,r)=>`${o}, ${r}: ${n} · 지금`,undoneAria:(n,o,r)=>`${o}, ${r}: ${n} · 취소됨`,wentBack:n=>`되돌아감: ${n}`},occupancy:{editing:n=>`${n} 편집 중…`,you:"나 · 편집 중",personEditing:n=>`${n} · 편집 중`,done:(n,o)=>`${n} · ${o} 완료`,someone:"누군가",clock:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),tagsAria:"이 보드에 있는 사람",listDot:n=>`${n} 편집 중`,youListDot:"내가 편집 중",forked:(n,o,r)=>`${n}에 포크됨 — ${jt(r,"이/가")} 편집하는 동안 ${jt(o,"이/가")} 시작함`,forkBlock:(n,o)=>n===1?`${o}의 포크`:`${o}의 포크 ${n}개`,forkBlockWhile:(n,o,r)=>`${n===1?`${o}의 포크`:`${o}의 포크 ${n}개`} · ${jt(r,"이/가")} 편집하는 동안 만듦`,forkBlockShort:n=>n===1?"포크":`포크 ${n}개`,useThis:"이걸로 쓰기",useThisOne:"이 버전으로 쓰기",useThisTitle:"이 시안을 원래 보드로 만들고 나머지 시안은 휴지통으로 보내요",useThisOneTitle:n=>`이 버전을 보드로 남기고 다른 버전 ${n}개는 휴지통으로 보내요`,waitFor:n=>`${jt(n,"이/가")} 편집을 마칠 때까지 기다려요`,confirmVariant:(n,o)=>`${jt(`"${n}"`,"을/를")} ${o}에 적용할까요?`,confirmVariantBody:(n,o)=>`${jt(n,"이/가")} 바뀌어요.${o?` 다른 시안 ${o}개는 휴지통으로 가요.`:""}`,confirmFork:(n,o)=>`${o}에 ${jt(`"${n}"`,"을/를")} 쓸까요?`,confirmForkBody:(n,o)=>`${jt(n,"이/가")} 이 버전으로 바뀌어요. ${o?`이 포크와 다른 포크 ${o}개는 휴지통으로 가요.`:"포크는 휴지통으로 가요."}`,confirmKeep:n=>`${jt(`"${n}"`,"을/를")} 남길까요?`,confirmKeepBody:(n,o)=>`${jt(n,"은/는")} 휴지통으로 가요.`,apply:"적용",keepAll:"모두 남기기",keepBoth:"둘 다 남기기",applied:(n,o)=>`${jt(n,"을/를")} ${o}에 적용했어요`,kept:(n,o)=>`${jt(n,"을/를")} 남겼어요. 다른 버전 ${o}개는 휴지통에 있어요`,keptAll:(n,o)=>n==="variant"?`시안 ${o}개를 모두 보드로 남겼어요`:`버전 ${o+1}개를 모두 보드로 남겼어요`,undo:"실행 취소"},requests:{goTo:"AI 요청 보낼 곳",easelChat:"Easel 채팅",easelChatNote:"Easel이 Claude Code를 직접 실행해요.",host:"대화 중인 에이전트",hostNote:"요청이 캔버스에 남아요.",connected:"연결됨",noneConnected:"연결된 에이전트 없음",thisFolder:"이 폴더",otherFolder:"다른 폴더",since:n=>`${n}부터`,sendTo:"받는 에이전트",anyAgent:"아무 에이전트",sayTitle:"에이전트에게",line:"Easel 요청 처리해 줘",quote:n=>`“${n}”`,copy:"복사",copied:"복사됨",copyTitle:"에이전트 채팅에 붙여 넣을 말 복사 (또는 /easel:requests)",forAi:"AI용",forAgent:n=>`${n}용`,addForAi:"남기기",forAiCheck:"AI용",forAiCheckTitle:"이 댓글을 대화 중인 에이전트에게 남기는 요청으로",composerTitle:"AI에게 요청",composerAria:"AI에게 남길 요청",composerPlaceholder:"여기서 무엇을 바꿀까요?",cancel:"취소",waiting:"대기 중",waitingFor:n=>`${n} 대기 중`,took:(n,o)=>`${n} 작업 중 · ${o}`,failed:n=>`${jt(n,"이/가")} 끝내지 못함`,left:n=>`대기 중 (${n} 나감)`,cancelRequest:"취소",useChat:"Easel 채팅으로",more:"더 보기",retry:"다시",undoChange:"되돌리기",undone:"되돌림",undoGone:"지금은 되돌릴 수 없음",changedTitle:n=>`바뀐 보드 ${jt(n,"으로/로")} 가기`,waitingTag:n=>`대기 ${n}`,pinLabel:(n,o,r)=>o?`에이전트를 기다리는 요청 ${n}: ${r}`:`AI용 요청 ${n}: ${r}`,countAria:n=>`에이전트를 기다리는 요청 ${n}개`,filterAria:"보일 댓글",filterAll:"전체",filterForAi:"AI용",listTitle:"AI용",allBoards:"모든 보드",listEmpty:"요청 없음",introTitle:"이 창의 에이전트에게 요청을 남길까요?",switchTo:"바꾸기",keepChat:"Easel 채팅 유지",backToRequests:"요청으로 돌아가기",hostShort:"대화 중인 에이전트",easelChatShort:"Easel 채팅",goesTo:"요청 보낼 곳",connectedN:n=>n?`${n}개 연결됨`:"연결 없음",chatOnce:"Easel 채팅, 이 요청만",menuHost:"AI 요청: 대화 중인 에이전트",menuChat:"AI 요청: Easel 채팅",added:"에이전트에게 남겼어요",cancelled:"취소했어요. 댓글은 남아요.",markerWaiting:"에이전트에게 보냄 · 대기 중",markerWaitingFor:n=>`${n}에게 보냄 · 대기 중`,markerWorking:n=>`작업 중… · ${n}`,markerSay:n=>`채팅에 “${n}”라고 하세요`,markerDone:"끝났어요",markerCount:n=>`요청 ${n}개`,markerAria:"에이전트에게 보낸 요청",dismiss:"닫기",openComment:"댓글 보기",kind:{element:"요소",board:"보드",tokens:"토큰 검사",a11y:"접근성",errors:"오류",review:"검토",comment:"댓글"},frameBoard:n=>`Easel 보드 ${n}`,frameElement:(n,o)=>`Easel 보드 ${n}, 선택: ${o}`},update:{out:n=>`Easel ${jt(n,"이/가")} 나왔어요`,copy:"명령 복사",copied:"복사했어요. 실행한 뒤 Easel을 다시 시작해요",row:n=>`${jt(n,"으로/로")} 업데이트`,versions:(n,o)=>`${n} → ${o}`,copyRow:"업데이트 명령 복사",retry:"다시 업데이트해 보기",updating:n=>`${jt(n,"으로/로")} 업데이트 중…`,done:n=>`${jt(n,"으로/로")} 업데이트했어요`,failed:(n,o)=>`${jt(n,"으로/로")} 업데이트하지 못했어요. ${o}`,dotTitle:n=>`Easel ${jt(n,"이/가")} 나왔어요`,why:{busy:"AI 작업이 끝나면 할 수 있어요",permission:"관리자 권한 없이는 그곳에 설치할 수 없어요",network:"npm 레지스트리에 닿지 않았어요",nonpm:"npm을 찾지 못했어요",failed:"설치가 끝나지 않았어요",restart:"새 버전이 시작되지 않아 지금 버전을 그대로 써요",project:"이 프로젝트에 설치돼 있어요. npm으로 올려 주세요",source:"소스에서 실행 중이에요. git으로 올려 주세요",other:"명령을 실행한 뒤 Easel을 다시 시작해요"}}},ef=[{id:"en",name:"English"},{id:"ko",name:"한국어"}],bb="design-canvas:lang";function Vx(n,o){return n==="en"||n==="ko"?n:/^ko($|[-_])/i.test(o??"")?"ko":"en"}function Gx(){if(typeof window>"u")return"en";let n=null;try{n=localStorage.getItem(bb)}catch{}return Vx(n,navigator.language)}const gf=Gx();function Yx(n){try{localStorage.setItem(bb,n)}catch{}location.reload()}const Xx={en:_x,ko:yb},d=Xx[gf],Kx=1440*60*1e3,fm=n=>`design-canvas:seen:${n}`,jf=n=>n.by?"ai":n.person||!n.outside?"person":"file",_m=(n,o)=>n.by??n.person??(n.outside?d.activity.outside:o);function Zx(n){const[o,r]=b.useState(null),[f,m]=b.useState(()=>Date.now()),[p,v]=b.useState({}),S=b.useRef(null),N=b.useCallback(()=>{S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{Te.get(`/api/activity?client=${encodeURIComponent(wf)}`).then(r).catch(()=>{})},120)},[]);b.useEffect(()=>{N();const M=window.setInterval(()=>m(Date.now()),3e4);return()=>window.clearInterval(M)},[N]),b.useEffect(()=>{if(!(!n||!o))try{const M=JSON.parse(localStorage.getItem(fm(n))??"{}"),$=Object.fromEntries(Object.entries(M).filter(([L])=>L.startsWith(`${o.boot}:`)));v($),Object.keys($).length!==Object.keys(M).length&&localStorage.setItem(fm(n),JSON.stringify($))}catch{}},[n,o==null?void 0:o.boot]);const E=b.useCallback(M=>{!o||!M.length||v($=>{const L=M.filter(k=>!$[`${o.boot}:${k}`]);if(!L.length)return $;const I={...$,...Object.fromEntries(L.map(k=>[`${o.boot}:${k}`,Date.now()]))};try{n&&localStorage.setItem(fm(n),JSON.stringify(I))}catch{}return I})},[o,n]),x=b.useCallback(M=>{if(!o)return"fresh";const $=M.steps.map(L=>p[`${o.boot}:${L}`]);return $.some(L=>!L)?"fresh":f-Math.max(...$)>Kx?"gone":"seen"},[o,p,f]),j=b.useCallback(M=>((o==null?void 0:o.tags[M])??[]).filter($=>x($)!=="gone"),[o,x]);return{data:o,now:f,reload:N,markSeen:E,stateOf:x,tagsOf:j}}function Fx({file:n,act:o,me:r,onOpen:f,lead:m,open:p}){const v=o.tagsOf(n);return!v.length&&!m?null:s.jsxs("span",{className:"act-tags",role:"group","aria-label":v.length?d.activity.tagsAria(v.reduce((S,N)=>S+N.count,0)):d.occupancy.tagsAria,children:[m,v.map(S=>{const N=d.activity.tag(_m(S,r),d.activity.ago(o.now-S.at),S.count,S.newBoard);return s.jsxs("button",{className:`act-tag ${o.stateOf(S)==="seen"?"seen":""}`,"data-tag":`${n}|${S.key}`,title:d.activity.tagTitle(N),"aria-haspopup":"dialog","aria-expanded":p===S.key,onPointerDown:E=>E.stopPropagation(),onDoubleClick:E=>E.stopPropagation(),onClick:E=>{E.stopPropagation(),f(n,S.key)},children:[s.jsx(F,{name:jf(S),size:16}),s.jsx("span",{className:"act-tag-text",children:N})]},S.key)})]})}function Qx({tag:n}){const o=n.change;return n.count>1?s.jsx("div",{className:"callout-diff",children:d.activity.changes(n.count)}):(o==null?void 0:o.kind)==="text"?s.jsxs("div",{className:"callout-diff",children:[s.jsx("span",{className:"diff-old",children:d.activity.quote(o.from??"")})," ",d.activity.arrow," ",s.jsx("span",{className:"diff-new",children:d.activity.quote(o.to??"")})]}):s.jsx("div",{className:"callout-diff",children:o?d.activity.change(o):d.activity.change({kind:"",count:1})})}function Px(n){const o=b.useRef(null),[r,f]=b.useState(null),m=()=>document.querySelector(`[data-tag="${CSS.escape(`${n.file}|${n.tag.key}`)}"]`);b.useLayoutEffect(()=>{var M,$;const v=m();if(!v)return void n.onClose();const S=v.getBoundingClientRect(),N=((M=o.current)==null?void 0:M.offsetWidth)??280,E=(($=o.current)==null?void 0:$.offsetHeight)??140,x=Math.max(8,Math.min(S.left,window.innerWidth-N-8)),j=S.bottom+8+E>window.innerHeight-8?Math.max(8,S.top-E-8):S.bottom+8;(!r||Math.abs(r.x-x)>.5||Math.abs(r.y-j)>.5)&&f({x,y:j})}),b.useEffect(()=>{var S,N;(N=(S=o.current)==null?void 0:S.querySelector("button"))==null||N.focus();const v=E=>{var j,M;const x=E.target;(j=o.current)!=null&&j.contains(x)||(M=m())!=null&&M.contains(x)||x instanceof Element&&x.closest(".dialog-backdrop")||n.onClose()};return window.addEventListener("pointerdown",v,!0),()=>window.removeEventListener("pointerdown",v,!0)},[n.file,n.tag.key]);const p=_m(n.tag,n.me);return s.jsxs("div",{ref:o,className:"callout",role:"dialog","aria-label":d.activity.popAria(p),style:{left:(r==null?void 0:r.x)??-9999,top:(r==null?void 0:r.y)??-9999},onKeyDown:v=>{var S;v.key==="Escape"&&(v.stopPropagation(),n.onClose(),(S=m())==null||S.focus())},children:[s.jsxs("div",{className:"callout-top",children:[s.jsx(F,{name:jf(n.tag),size:16}),p," ",s.jsxs("span",{className:"muted",children:["· ",d.activity.agoLong(n.now-n.tag.at)]}),s.jsx("button",{className:"icon-btn sm callout-x","aria-label":d.activity.close,title:d.activity.close,onClick:n.onClose,children:s.jsx(F,{name:"close",size:14})})]}),s.jsx(Qx,{tag:n.tag}),s.jsxs("div",{className:"callout-actions",children:[s.jsxs("button",{onClick:n.onCompare,children:[s.jsx(F,{name:"compare",size:14})," ",d.activity.beforeAfter]}),s.jsxs("button",{disabled:n.busy,title:d.activity.undoTitle(n.tag.steps.length),onClick:()=>n.onUndo(),children:[s.jsx(F,{name:"undo",size:14})," ",d.activity.undo]})]}),n.conflict&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:d.activity.conflict(n.conflict.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{onClick:()=>n.onUndo("rest"),children:d.activity.undoRest}),s.jsx("button",{className:"danger",onClick:()=>n.onUndo("all"),children:d.activity.undoAll}),s.jsx("button",{onClick:n.onCancelConflict,children:d.activity.cancel})]})]})]})}function Jx({frame:n,paths:o,zoom:r}){const[f,m]=b.useState([]),p=o.join(",");b.useEffect(()=>{if(!n)return m([]);const S=()=>{const E=n.isConnected?n.contentDocument:null;if(!(E!=null&&E.body))return m([]);m(o.map(x=>hn(E,x)).filter(x=>!!x&&x!==E.body).map(Ml))};S();const N=window.setTimeout(S,300);return n.addEventListener("load",S),n.addEventListener("dc-reloaded",S),n.addEventListener("dc-patched",S),()=>{n.removeEventListener("dc-patched",S),window.clearTimeout(N),n.removeEventListener("load",S),n.removeEventListener("dc-reloaded",S)}},[n,p]);const v=1/Math.max(r,.05);return s.jsx(s.Fragment,{children:f.map((S,N)=>s.jsx("div",{className:"box change-outline",style:{left:S.x,top:S.y,width:S.w,height:S.h,"--px":`${v}px`}},N))})}function Ix(n){var E;const o=b.useRef(null),r=Math.max(0,n.steps.findIndex(x=>x.now)),[f,m]=b.useState(r),p=b.useRef([]),v=(E=n.steps[r])==null?void 0:E.id;b.useEffect(()=>{var x;(x=p.current[r])==null||x.focus(),m(r)},[v]),b.useEffect(()=>{const x=j=>{var $;const M=j.target;($=o.current)!=null&&$.contains(M)||M instanceof Element&&M.closest(".caret-btn")||n.onClose()};return window.addEventListener("pointerdown",x,!0),()=>window.removeEventListener("pointerdown",x,!0)},[n.onClose]);const S=x=>{var M;const j=Math.max(0,Math.min(n.steps.length-1,x));m(j),(M=p.current[j])==null||M.focus()},N=b.useMemo(()=>{var $;const x=(($=document.querySelector(".oc-dock"))==null?void 0:$.getBoundingClientRect())??n.anchor,j=Math.min(448,window.innerWidth-16);if(!x)return{left:8,bottom:76,width:j};const M=Math.round(window.innerHeight-x.top+8);return{left:Math.round(Math.max(8,Math.min(x.right-j,window.innerWidth-j-8))),bottom:M,width:j,maxHeight:Math.round(window.innerHeight-M-8)}},[n.anchor]);return s.jsxs("div",{ref:o,className:"menu oc-hist entering",role:"menu","aria-label":d.activity.historyTitle,style:N,onKeyDown:x=>{var j;["Escape","ArrowDown","ArrowUp","Home","End","Enter"," "].includes(x.key)&&x.stopPropagation(),x.key==="Escape"?(x.preventDefault(),n.onClose(),(j=document.querySelector(".caret-btn"))==null||j.focus()):x.key==="ArrowDown"||x.key==="ArrowUp"?(x.preventDefault(),S(f+(x.key==="ArrowDown"?1:-1))):(x.key==="Home"||x.key==="End")&&(x.preventDefault(),S(x.key==="Home"?0:n.steps.length-1))},children:[s.jsx("div",{className:"oc-menu-h",children:d.activity.historyTitle}),!n.steps.length&&s.jsx("p",{className:"hist-empty",children:d.activity.historyEmpty}),s.jsx("div",{className:"hist-rows",children:n.steps.map((x,j)=>{const M=_m(x,n.me),$=d.activity.ago(n.now-x.at);return s.jsxs("button",{ref:L=>void(p.current[j]=L),role:"menuitem",className:`menu-item oc-hrow ${x.now?"now":""} ${x.undone?"past":""} ${f===j?"active":""}`,"aria-label":(x.now?d.activity.nowAria:x.undone?d.activity.undoneAria:d.activity.goBackAria)(d.activity.stepName(x.name),M,$),"aria-current":x.now?"step":void 0,title:x.label,"aria-disabled":n.busy||void 0,onMouseEnter:()=>m(j),onFocus:()=>m(j),onClick:()=>!x.now&&!n.busy&&n.onGo(x),children:[s.jsx("span",{className:"oc-now-dot","aria-hidden":"true"}),s.jsxs("span",{className:"oc-who",children:[s.jsx(F,{name:jf(x),size:16}),s.jsx("span",{children:M})]}),s.jsx("span",{className:"oc-what",children:d.activity.stepName(x.name)}),x.now?s.jsx("span",{className:"oc-mark",children:d.activity.now}):f===j?s.jsx("span",{className:"oc-mark go",children:d.activity.goBack}):s.jsx("span",{}),s.jsx("span",{className:"oc-when",children:$})]},x.id)})}),s.jsx("div",{className:"menu-foot",children:s.jsx("span",{children:d.activity.historyFoot})})]})}const Wx=3,Ey=(n,o,r=Wx)=>Math.abs(n)+Math.abs(o)>=r;function e0(n,o,r=8,f=n){const m=(o.full??o.w)>Math.min(n,f)-r*2;let p=Math.max(r,Math.round((n-o.w)/2));return p+o.w>f-r&&(p=Math.max(r,Math.round((f-o.w)/2))),{x:p,icons:m}}function t0(n,o=2){const r=n.split("/"),f=r.slice(1).map((m,p)=>r.slice(0,p+1).join("/"));return{paths:f.slice(-o),skipped:f.length>o}}function Fa(n){const o=(n??"").trim(),r=o.match(/^(-?\d+(?:\.\d+)?)px$/);return r?String(Number(r[1])):o}const Tm=n=>(n??"").trim().split(/\s+/).filter(Boolean).map(Fa).join(" · ");function n0(n){return n.replace(/·/g," ").trim().split(/\s+/).filter(Boolean).map(r=>/^-?\d+(?:\.\d+)?$/.test(r)?`${Number(r)}px`:r).join(" ")}function Cm(n,o){const r=Number(n);return!n||!Number.isFinite(r)?String(n??""):o[r]?`${o[r]} · ${r}`:String(r)}const a0=/^(system-ui|-apple-system|blinkmacsystemfont|ui-sans-serif)$/i;function My(n){var r;const o=((r=(n??"").split(",")[0])==null?void 0:r.trim().replace(/^["']|["']$/g,""))??"";return a0.test(o)?"System UI":o}function l0(n){const o=n.trim();return/^system ui$/i.test(o)?"system-ui":o.includes(",")||/^["'].*["']$/.test(o)||!/\s/.test(o)?o:`"${o}"`}function ya(n){const o=(n??"").trim().toLowerCase();let r=o.match(/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/);if(r){let f=r[1];return f.length<=4&&(f=[...f].map(m=>m+m).join("")),f.length===8&&f.slice(6)!=="ff"?null:"#"+f.slice(0,6).toUpperCase()}return r=o.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+%?))?\s*\)$/),r?r[4]!=null&&parseFloat(r[4])<(r[4].endsWith("%")?100:1)?null:"#"+[r[1],r[2],r[3]].map(f=>Math.round(Number(f)).toString(16).padStart(2,"0")).join("").toUpperCase():null}const vb=n=>n.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"token";function zu(n,o){var p;const r=(n??"").trim(),f=r.match(/^var\(\s*--([a-z0-9-]+)/i);if(f){const v=o.find(N=>vb(N.name)===f[1].toLowerCase());if(v)return v;const S=(p=r.match(/,\s*([^)]+)\)\s*$/))==null?void 0:p[1];return S?zu(S,o):null}const m=ya(r);return m?o.find(v=>ya(v.value)===m)??null:null}function s0(n,o){const r=vb(n.name);if(o[`--${r}`]!=null)return`var(--${r})`;const f=ya(n.value),m=Object.keys(o).find(p=>f&&ya(o[p])===f);return m?`var(${m})`:`var(--${r}, ${f??n.value})`}const o0=(n,o)=>n==="text"&&ya(o)==null?"color":"background";function df(n,o,r=1,f=0){const m=parseFloat(n),p=Number.isFinite(m)?m:0;return Math.max(f,Math.round((p+o*r)*100)/100)}function i0(n,o,r=4){return(n||"0px").trim().split(/\s+/).map(m=>`${df(m,o,r)}px`).join(" ")}const Em=[{id:"yellow",label:d.shapes.stickyColors.yellow,bg:"#FFF1A8"},{id:"orange",label:d.shapes.stickyColors.orange,bg:"#FFD9BC"},{id:"pink",label:d.shapes.stickyColors.pink,bg:"#FFD6E2"},{id:"purple",label:d.shapes.stickyColors.purple,bg:"#E5DAFF"},{id:"blue",label:d.shapes.stickyColors.blue,bg:"#D2E4FF"},{id:"green",label:d.shapes.stickyColors.green,bg:"#D5F0D3"},{id:"gray",label:d.shapes.stickyColors.gray,bg:"#ECEBE7"},{id:"white",label:d.shapes.stickyColors.white,bg:"#FFFFFF"}],c0=n=>{var o;return((o=Em.find(r=>r.id===n))==null?void 0:o.bg)??Em[0].bg},Ay=200,zy=6,r0=["#111111","#6B6B6B","#C94F0C","#B42318","#1E7A4C","#2F6FDE","#FFFFFF","none"];function xb({s:n,id:o}){var E;const r=n.strokeWidth??4,f=n.stroke??"#111111",m=n.fill??"none",p=r,v=Math.max(1,n.w),S=Math.max(1,n.h),N=(n.points??[]).map(([x,j])=>`${x},${j}`).join(" ");return s.jsxs("svg",{width:v+p*2,height:S+p*2,viewBox:`${-p} ${-p} ${v+p*2} ${S+p*2}`,style:{position:"absolute",left:-p,top:-p,overflow:"visible"},children:[n.kind==="arrow"&&s.jsx("defs",{children:s.jsx("marker",{id:`ah-${o}`,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})})}),n.kind==="rect"&&s.jsx("rect",{x:0,y:0,width:v,height:S,rx:8,fill:m,stroke:f,strokeWidth:r}),n.kind==="oval"&&s.jsx("ellipse",{cx:v/2,cy:S/2,rx:v/2,ry:S/2,fill:m,stroke:f,strokeWidth:r}),(n.kind==="line"||n.kind==="arrow")&&s.jsx("polyline",{points:N,fill:"none",stroke:f,strokeWidth:r,strokeLinecap:"round",markerEnd:n.kind==="arrow"?`url(#ah-${o})`:void 0}),n.kind==="pen"&&s.jsx("polyline",{points:N,fill:"none",stroke:f,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),n.kind==="image"&&s.jsx("image",{href:(E=n.src)==null?void 0:E.replace(/^\.\.\//,"/"),x:0,y:0,width:v,height:S,preserveAspectRatio:"xMidYMid slice"})]})}function u0(n){const o=b.useRef(null),r=(m,p)=>v=>{v.button!==0||!n.interactive||(v.stopPropagation(),n.onSelect(m,v.shiftKey),!v.shiftKey&&(o.current={id:m,mode:p,sx:v.clientX,sy:v.clientY,o:n.shapes[m],moved:!1},v.currentTarget.setPointerCapture(v.pointerId)))},f=(m,p=!1)=>{const v=o.current;if(!v)return;const S=(m.clientX-v.sx)/n.zoom,N=(m.clientY-v.sy)/n.zoom;if(!v.moved&&Math.abs(S)+Math.abs(N)<2/n.zoom){p&&(o.current=null);return}if(v.moved=!0,v.mode==="move")n.onChange(v.id,{x:Math.round(v.o.x+S),y:Math.round(v.o.y+N)},p);else{const E=Math.max(8,v.o.w+S),x=Math.max(8,v.o.h+N),j=E/Math.max(1,v.o.w),M=x/Math.max(1,v.o.h),$={w:Math.round(E),h:Math.round(x)};v.o.points&&($.points=v.o.points.map(([L,I])=>[Math.round(L*j),Math.round(I*M)])),n.onChange(v.id,$,p)}p&&(o.current=null)};return s.jsx(s.Fragment,{children:n.ids.map(m=>{const p=n.shapes[m],v=n.selected.includes(m);return s.jsxs("div",{className:`shape ${v?"selected":""}`,"data-shape":m,style:{left:p.x,top:p.y,width:Math.max(1,p.w),height:Math.max(1,p.h),pointerEvents:n.interactive?"auto":"none"},onPointerDown:r(m,"move"),onPointerMove:S=>f(S),onPointerUp:S=>f(S,!0),onContextMenu:S=>{S.preventDefault(),S.stopPropagation(),n.selected.includes(m)||n.onSelect(m),n.onContext(m,S)},children:[s.jsx(xb,{s:p,id:m}),v&&s.jsx("div",{className:"shape-resize",role:"slider","aria-label":d.shapes.shapeSize,"aria-valuetext":`${p.w} × ${p.h}`,style:{width:12/n.zoom,height:12/n.zoom,right:-6/n.zoom,bottom:-6/n.zoom,borderWidth:1.5/n.zoom},onPointerDown:r(m,"resize"),onPointerMove:S=>f(S),onPointerUp:S=>f(S,!0)})]},m)})})}function d0({tool:n,view:o,onDone:r}){const[f,m]=b.useState(null),p=b.useRef(null),v=N=>{const E=N.currentTarget.getBoundingClientRect();return{x:(N.clientX-E.left-o.x)/o.zoom,y:(N.clientY-E.top-o.y)/o.zoom}},S=(N,E,x,j,M,$)=>{if($&&(n==="rect"||n==="oval")){const W=Math.max(Math.abs(x-N),Math.abs(j-E));x=N+Math.sign(x-N||1)*W,j=E+Math.sign(j-E||1)*W}if(n==="pen"){const W=M.map(ie=>ie[0]),X=M.map(ie=>ie[1]),ne=Math.min(...W),te=Math.min(...X);return{kind:"pen",x:ne,y:te,w:Math.max(...W)-ne,h:Math.max(...X)-te,points:M.map(([ie,le])=>[Math.round(ie-ne),Math.round(le-te)])}}const L=Math.min(N,x),I=Math.min(E,j),k=Math.abs(x-N),_=Math.abs(j-E);return n==="line"||n==="arrow"?{kind:n,x:L,y:I,w:k,h:_,points:[[Math.round(N-L),Math.round(E-I)],[Math.round(x-L),Math.round(j-I)]]}:{kind:n,x:L,y:I,w:k,h:_}};return s.jsx("div",{className:"shape-drawer","aria-label":d.shapes.drawShape,onPointerDown:N=>{if(N.button!==0)return;N.currentTarget.setPointerCapture(N.pointerId);const E=v(N);p.current={x0:E.x,y0:E.y,pts:[[E.x,E.y]]}},onPointerMove:N=>{const E=p.current;if(!E)return;const x=v(N);n==="pen"&&E.pts.push([x.x,x.y]),m(S(E.x0,E.y0,x.x,x.y,E.pts,N.shiftKey))},onPointerUp:N=>{const E=p.current;if(p.current=null,m(null),!E)return;const x=v(N);let j=S(E.x0,E.y0,x.x,x.y,E.pts,N.shiftKey);if(j.w<4&&j.h<4){if(n==="pen")return;j=n==="line"||n==="arrow"?{kind:n,x:E.x0,y:E.y0,w:200,h:0,points:[[0,0],[200,0]]}:{kind:n,x:E.x0,y:E.y0,w:200,h:140}}r({...j,x:Math.round(j.x),y:Math.round(j.y),w:Math.round(j.w),h:Math.round(j.h)})},children:f&&s.jsx("div",{className:"world",style:{transform:`translate(${o.x}px, ${o.y}px) scale(${o.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(xb,{s:{...f,strokeWidth:4},id:"draft"})})})})}function f0({shape:n,onPatch:o,onDelete:r,onFront:f,onBack:m}){const p=d.shapes.kinds,v=({value:S,onPick:N,allowNone:E})=>s.jsx("span",{className:"swatches",children:r0.filter(x=>E||x!=="none").map(x=>s.jsx("button",{className:`swatch ${S===x?"on":""} ${x==="none"?"none":""}`,title:x==="none"?d.shapes.none:x,"aria-label":x==="none"?d.shapes.none:x,style:{background:x==="none"?void 0:x},onClick:()=>N(x)},x))});return s.jsxs("section",{className:"board-opts","aria-label":d.shapes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:p[n.kind]})}),n.kind!=="image"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.shapes.strokeColor}),s.jsx(v,{value:n.stroke??"#111111",onPick:S=>o({stroke:S})})]}),(n.kind==="rect"||n.kind==="oval")&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.shapes.fill}),s.jsx(v,{value:n.fill??"none",onPick:S=>o({fill:S}),allowNone:!0})]}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:d.shapes.weight}),s.jsx("input",{type:"range",min:1,max:24,value:n.strokeWidth??4,onChange:S=>o({strokeWidth:Number(S.target.value)}),"aria-label":d.shapes.strokeWeight})]})]}),s.jsxs("div",{className:"muted small",children:[n.w," × ",n.h," · (",n.x,", ",n.y,")"]}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":d.shapes.front,title:d.shapes.front,onClick:f,children:s.jsx(F,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":d.shapes.back,title:d.shapes.back,onClick:m,children:s.jsx(F,{name:"back"})}),s.jsx("button",{className:"icon-btn danger","aria-label":d.shapes.deleteShape,title:d.shapes.deleteTitle,onClick:r,children:s.jsx(F,{name:"trash"})})]})]})}function h0({note:n,onPatch:o,onDelete:r}){const f=n.kind==="title",m=f?72:22;return s.jsxs("section",{className:"board-opts","aria-label":d.notes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:f?d.notes.title:d.notes.sticky})}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:d.notes.fontSize}),s.jsx("select",{value:n.size??m,onChange:p=>o({size:Number(p.target.value)===m?void 0:Number(p.target.value)}),"aria-label":d.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===m?d.notes.defaultSuffix:""]},p))})]}),s.jsxs("div",{className:"btn-row",role:"group","aria-label":d.notes.textStyle,children:[s.jsx("button",{className:`icon-btn ${n.bold??f?"on":""}`,"aria-pressed":!!(n.bold??f),"aria-label":d.notes.bold,title:d.notes.bold,onClick:()=>o({bold:!(n.bold??f)}),children:s.jsx("strong",{children:"B"})}),s.jsx("button",{className:`icon-btn ${n.italic?"on":""}`,"aria-pressed":!!n.italic,"aria-label":d.notes.italic,title:d.notes.italic,onClick:()=>o({italic:!n.italic||void 0}),children:s.jsx("em",{children:"I"})})]}),!f&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:d.notes.color}),s.jsx("span",{className:"swatches",children:Em.map(p=>s.jsx("button",{className:`swatch ${(n.color??"yellow")===p.id?"on":""}`,title:p.label,"aria-label":d.notes.stickyColor(p.label),style:{background:p.bg},onClick:()=>o({color:p.id==="yellow"?void 0:p.id})},p.id))})]}),f?s.jsxs("div",{className:"grid2",children:[s.jsx(oo,{label:d.notes.maxWidth,value:n.maxW??2e3,onCommit:p=>o({maxW:p})}),s.jsx(oo,{label:d.notes.maxHeight,value:n.maxH??0,onCommit:p=>o({maxH:p||void 0})})]}):s.jsxs("div",{className:"grid2",children:[s.jsx(oo,{label:d.notes.width,value:n.w??400,onCommit:p=>o({w:p})}),s.jsx(oo,{label:d.notes.height,value:n.h??0,onCommit:p=>o({h:p||void 0})})]}),s.jsx("p",{className:"muted small",children:f?d.notes.titleHint:d.notes.stickyHint}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.notes.deleteNote,title:d.notes.deleteTitle,onClick:r,children:s.jsx(F,{name:"trash"})})})]})}function oo({label:n,value:o,onCommit:r}){return s.jsxs("label",{className:"num",children:[s.jsx("span",{children:n}),s.jsx("input",{inputMode:"numeric",defaultValue:o,onBlur:f=>{const m=Math.max(0,Math.round(Number(f.target.value)));Number.isFinite(m)&&m!==o&&r(m)},onKeyDown:f=>!f.nativeEvent.isComposing&&f.key==="Enter"&&f.target.blur()},o)]})}const m0=n=>n==="grid"?{type:n,count:0,gutter:0,margin:0,align:"stretch",size:8,color:"#C94F0C"}:{type:n,count:n==="columns"?4:6,gutter:16,margin:20,align:"stretch",size:80,color:"#C94F0C"};function p0(n,o){const r=Math.max(1,Math.round(o.count));if(o.align==="stretch"){const v=(n-o.margin*2-o.gutter*(r-1))/r;return Array.from({length:r},(S,N)=>[o.margin+N*(v+o.gutter),v])}const f=r*o.size+(r-1)*o.gutter,m=o.align==="start"?o.margin:o.align==="end"?n-o.margin-f:(n-f)/2;return Array.from({length:r},(p,v)=>[m+v*(o.size+o.gutter),o.size])}function g0({guides:n,w:o,h:r}){return s.jsx("div",{className:"layout-guides","aria-hidden":"true",children:n.filter(f=>!f.hidden).map((f,m)=>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`}},m):p0(f.type==="columns"?o:r,f).map(([p,v],S)=>s.jsx("div",{className:"lg-track",style:f.type==="columns"?{left:p,top:0,width:v,height:r,background:`${f.color}1f`}:{top:p,left:0,height:v,width:o,background:`${f.color}1f`}},`${m}-${S}`)))})}function y0({guides:n,onChange:o}){const r=(m,p)=>o(n.map((v,S)=>S===m?{...v,...p}:v),d.history.editGuide),f=d.guides.types;return s.jsxs("section",{className:"board-opts guides-editor","aria-label":d.guides.aria,children:[s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.guides.heading(n.length,zy)}),s.jsx("span",{className:"btn-row",children:["columns","rows","grid"].map(m=>s.jsx("button",{className:"icon-btn sm",disabled:n.length>=zy,title:d.guides.add[m],"aria-label":d.guides.add[m],onClick:()=>o([...n,m0(m)],d.history.addGuide),children:s.jsx("span",{className:"small",children:f[m]})},m))})]}),n.length===0&&s.jsx("p",{className:"muted small",children:d.guides.empty}),n.map((m,p)=>s.jsxs("div",{className:"guide-row",children:[s.jsxs("div",{className:"guide-head",children:[s.jsx("strong",{children:f[m.type]}),s.jsx("input",{type:"color",value:m.color,onChange:v=>r(p,{color:v.target.value}),"aria-label":d.guides.color}),s.jsx("div",{className:"spacer"}),s.jsx("button",{className:"icon-btn sm","aria-label":m.hidden?d.guides.show:d.guides.hide,title:m.hidden?d.guides.show:d.guides.hide,onClick:()=>r(p,{hidden:!m.hidden||void 0}),children:s.jsx(F,{name:m.hidden?"close":"check",size:14})}),s.jsx("button",{className:"icon-btn sm danger","aria-label":d.guides.deleteGuide,title:d.guides.delete,onClick:()=>o(n.filter((v,S)=>S!==p),d.history.deleteGuide),children:s.jsx(F,{name:"trash",size:14})})]}),m.type==="grid"?s.jsx("div",{className:"grid2",children:s.jsx(oo,{label:d.guides.cell,value:m.size,onCommit:v=>r(p,{size:Math.max(2,v)})})}):s.jsxs("div",{className:"grid2",children:[s.jsx(oo,{label:d.guides.count,value:m.count,onCommit:v=>r(p,{count:Math.max(1,Math.min(48,v))})}),s.jsx(oo,{label:d.guides.gutter,value:m.gutter,onCommit:v=>r(p,{gutter:v})}),s.jsx(oo,{label:d.guides.margin,value:m.margin,onCommit:v=>r(p,{margin:v})}),m.align!=="stretch"&&s.jsx(oo,{label:d.guides.cellSize,value:m.size,onCommit:v=>r(p,{size:Math.max(1,v)})}),s.jsxs("label",{className:"field-row span2",children:[s.jsx("span",{children:d.guides.align}),s.jsxs("select",{value:m.align,onChange:v=>r(p,{align:v.target.value}),"aria-label":d.guides.alignAria,children:[s.jsx("option",{value:"stretch",children:d.guides.stretch}),s.jsx("option",{value:"start",children:m.type==="columns"?d.guides.left:d.guides.top}),s.jsx("option",{value:"center",children:d.guides.center}),s.jsx("option",{value:"end",children:m.type==="columns"?d.guides.right:d.guides.bottom})]})]})]})]},p))]})}const $y={paths:[],rects:[],selection:null,error:null};function b0(n,o){const[r,f]=b.useState($y),m=b.useRef([]);m.current=r.paths;const p=b.useCallback(()=>{var E;if(!n)return;const N=(E=o(n))==null?void 0:E.contentDocument;N&&f(x=>{const j=x.paths.map(M=>hn(N,M));return j.some(M=>!M)?{...x,paths:[],rects:[],selection:null,error:d.editMode.fileChanged}:{...x,rects:j.map(M=>Ml(M))}})},[n,o]),v=b.useCallback(async N=>{var M;if(!n)return;const E=(M=o(n))==null?void 0:M.contentDocument,x=E?N.map($=>hn(E,$)):[];if(!E||!N.length||x.some($=>!$)){f($=>({...$,paths:[],rects:[],selection:null})),await Te.put("/api/selection",{file:null}).catch(()=>{});return}const j=N[N.length-1];f($=>({...$,paths:N,rects:x.map(L=>Ml(L)),error:null}));try{const{selection:$}=await Te.put("/api/selection",{file:n,path:j,paths:N,styles:Rx(hn(E,j)),...xu(hn(E,j))});f(L=>L.paths===N||L.paths.join()===N.join()?{...L,selection:$}:L)}catch($){f(L=>({...L,selection:null,error:String($.message)}))}},[n,o]),S=b.useRef(!0);return b.useEffect(()=>{f($y),S.current?S.current=!1:n||Te.put("/api/selection",{file:null}).catch(()=>{})},[n]),b.useEffect(()=>{var $;if(!n)return;const N=o(n);if(!N)return;let E=()=>{};const x=()=>{E();const L=N.contentDocument,I=N.contentWindow;if(!L||!I)return;const k=W=>{var X;W.isComposing||(X=W.target)!=null&&X.isContentEditable||(window.dispatchEvent(new KeyboardEvent("keydown",{key:W.key,code:W.code,metaKey:W.metaKey,ctrlKey:W.ctrlKey,shiftKey:W.shiftKey,altKey:W.altKey})),(/^(Arrow|Delete|Backspace|Tab|Enter|Escape)/.test(W.key)||(W.metaKey||W.ctrlKey)&&/^[zydcvg]$/i.test(W.key))&&W.preventDefault())},_=()=>p();L.addEventListener("keydown",k,!0),I.addEventListener("scroll",_,!0),E=()=>{L.removeEventListener("keydown",k,!0),I.removeEventListener("scroll",_,!0)}},j=()=>{x(),m.current.length&&v(m.current)},M=()=>m.current.length&&void v(m.current);return(($=N.contentDocument)==null?void 0:$.readyState)==="complete"&&x(),N.addEventListener("load",j),N.addEventListener("dc-patched",M),()=>{N.removeEventListener("load",j),N.removeEventListener("dc-patched",M),E()}},[n,o,v,p]),{state:r,select:v,refresh:p,setError:N=>f(E=>({...E,error:N}))}}function tf(n,o,r){const f=n==null?void 0:n.contentDocument;if(!n||!(f!=null&&f.body))return null;const m=n.getBoundingClientRect(),p=m.width/(n.offsetWidth||m.width)||1,v=f.elementFromPoint((o-m.left)/p,(r-m.top)/p);if(!v||v===f.body||v===f.documentElement)return null;const S=il(v);return S==null?null:{el:v,path:S}}function v0(n,o,r,f,m){const p=n==null?void 0:n.contentDocument,v=n==null?void 0:n.contentWindow;if(!n||!(p!=null&&p.body)||!v)return!1;const S=n.getBoundingClientRect(),N=S.width/(n.offsetWidth||S.width)||1,E=p.scrollingElement??p.documentElement,x=$=>{const L=$===E?null:v.getComputedStyle($),I=(!L||/auto|scroll/.test(L.overflowY))&&(m<0?$.scrollTop>0:m>0&&$.scrollTop+$.clientHeight<$.scrollHeight-1),k=(!L||/auto|scroll/.test(L.overflowX))&&(f<0?$.scrollLeft>0:f>0&&$.scrollLeft+$.clientWidth<$.scrollWidth-1);return I||k};let j=p.elementFromPoint((o-S.left)/N,(r-S.top)/N);for(;j&&j!==E&&j!==p.body&&!x(j);)j=j.parentElement;const M=j&&j!==p.body&&x(j)?j:x(E)?E:null;return M?(M.scrollBy(f/N,m/N),!0):!1}function x0(n,o){const r=p=>{const v=p.getBoundingClientRect();return v.width>0&&v.height>0&&v.left>=o.x&&v.top>=o.y&&v.right<=o.x+o.w&&v.bottom<=o.y+o.h},f=[],m=p=>{for(const v of Array.from(p.children))if(!/^(script|style|template)$/i.test(v.tagName))if(r(v)){const S=il(v);S!=null&&f.push(S)}else m(v)};return m(n.body),f}function xu(n){var p,v,S;const o=n.tagName.toLowerCase(),r=n.getAttribute("role"),f=o==="img"||o==="picture"||(v=(p=n.style)==null?void 0:p.backgroundImage)!=null&&v.includes("url(")?"image":o==="button"||r==="button"?"button":o==="a"?"link":/^(input|textarea|select)$/.test(o)?"input":o==="svg"?"icon":!n.children.length&&((S=n.textContent)!=null&&S.trim())?"text":"container",m=(n.getAttribute("aria-label")||n.getAttribute("alt")||n.getAttribute("title")||n.getAttribute("placeholder")||n.innerText||n.textContent||"").trim().replace(/\s+/g," ").slice(0,60);return{kind:f,label:m}}function w0(n){let o=n;const r=new Set;return{get:()=>o,set(f){const m=typeof f=="function"?f(o):f;if(!(m===o||m.x===o.x&&m.y===o.y&&m.zoom===o.zoom)){o=m;for(const p of[...r])p()}},subscribe(f){return r.add(f),()=>r.delete(f)}}}function j0(n){const o=b.useRef(null);return o.current||(o.current=w0(n)),o.current}function Um(n){return b.useSyncExternalStore(n.subscribe,n.get,n.get)}function yf(n,o){const r=()=>o(n.get());return b.useSyncExternalStore(n.subscribe,r,r)}function N0(n,o){const r=()=>o?n.get():null;return b.useSyncExternalStore(n.subscribe,r,r)}const qm=.04,Vm=4,S0=.25,k0=640,hm=.5,Oy=150,T0=40,Cu=[600,1200,2400],C0=n=>Cu.find(o=>o>=n)??Cu[Cu.length-1],E0=6,wb={url:n=>`/screens/${n}`,thumbs:!0};function M0(n){var Gn;const o=Um(n.view),r=n.view.set,f=b.useRef(null),m=b.useRef(null),[p,v]=b.useState({w:1200,h:800}),[S,N]=b.useState(!1),[E,x]=b.useState([]),[j,M]=b.useState(null),$=b.useRef(null),L=b.useRef(null);b.useLayoutEffect(()=>{const B=f.current,K=()=>{var Le;const Oe={w:B.clientWidth,h:B.clientHeight};!Oe.w||!Oe.h||(v(tt=>tt.w===Oe.w&&tt.h===Oe.h?tt:Oe),(Le=n.onSize)==null||Le.call(n,Oe))},ae=new ResizeObserver(K);return ae.observe(B),document.addEventListener("visibilitychange",K),()=>{ae.disconnect(),document.removeEventListener("visibilitychange",K)}},[]);const I=b.useRef(!1);b.useEffect(()=>{const B=m.current;if(!B)return;if(!I.current){I.current=!0;return}B.style.willChange="transform";const K=setTimeout(()=>B.style.willChange="",200);return()=>clearTimeout(K)},[o.x,o.y,o.zoom]),b.useEffect(()=>{const B=f.current,K=ae=>{var mt,vt,rn;ae.preventDefault();const Oe=B.getBoundingClientRect(),Le=ae.clientX-Oe.left,tt=ae.clientY-Oe.top;if(ae.ctrlKey||ae.metaKey)r(tn=>{const It=ur(tn.zoom*Math.exp(-ae.deltaY*.01),qm,Vm),Yn=(Le-tn.x)/tn.zoom,Qe=(tt-tn.y)/tn.zoom;return{zoom:It,x:Le-Yn*It,y:tt-Qe*It}});else{const tn=((rn=(vt=(mt=ae.target)==null?void 0:mt.closest)==null?void 0:vt.call(mt,".board-frame[data-inside]"))==null?void 0:rn.querySelector("iframe"))??null;if(v0(tn,ae.clientX,ae.clientY,ae.deltaX,ae.deltaY))return;r(It=>({...It,x:It.x-ae.deltaX,y:It.y-ae.deltaY}))}};return B.addEventListener("wheel",K,{passive:!1}),()=>B.removeEventListener("wheel",K)},[r]),b.useEffect(()=>{const B=ae=>{ae.code==="Space"&&!wu(ae)&&!ae.repeat&&(ae.preventDefault(),N(!0))},K=ae=>ae.code==="Space"&&N(!1);return window.addEventListener("keydown",B),window.addEventListener("keyup",K),()=>{window.removeEventListener("keydown",B),window.removeEventListener("keyup",K)}},[]);const k=(B,K)=>{const ae=f.current.getBoundingClientRect();return{x:(B-ae.left-o.x)/o.zoom,y:(K-ae.top-o.y)/o.zoom}},_=B=>{$.current=B,M(B)},W=S||n.tool==="hand"||!!n.readOnly,X=n.screens??wb,ne=B=>{if(B.target!==B.currentTarget&&B.button!==1)return;if(B.currentTarget.setPointerCapture(B.pointerId),B.button===1||W){L.current={kind:"pan",sx:B.clientX,sy:B.clientY,vx:o.x,vy:o.y};return}if(B.button!==0)return;const K=k(B.clientX,B.clientY);if(n.tool==="title"||n.tool==="sticky"){n.onCreateNote(n.tool,{x:Math.round(K.x),y:Math.round(K.y)}),n.setTool("select");return}L.current={kind:n.tool==="board"?"draw":"marquee",sx:K.x,sy:K.y,additive:B.shiftKey,moved:!1}},te=B=>{const K=L.current;if(!K)return;if(K.kind==="pan"){r(Le=>({...Le,x:K.vx+B.clientX-K.sx,y:K.vy+B.clientY-K.sy}));return}const ae=k(B.clientX,B.clientY),Oe={x:Math.min(K.sx,ae.x),y:Math.min(K.sy,ae.y),w:Math.abs(ae.x-K.sx),h:Math.abs(ae.y-K.sy)};(Oe.w+Oe.h)*o.zoom>4&&(K.moved=!0),K.moved&&_(Oe)},ie=B=>{const K=L.current;if(L.current=null,(K==null?void 0:K.kind)==="pan"&&n.readOnly&&Math.abs(B.clientX-K.sx)+Math.abs(B.clientY-K.sy)<4&&n.onSelect([],"replace"),!K||K.kind==="pan")return;const ae=$.current;if(_(null),K.kind==="draw"){const mt=k(B.clientX,B.clientY);n.onCreateBoard(K.moved&&ae&&ae.w>20&&ae.h>20?O0(ae):{x:Math.round(mt.x),y:Math.round(mt.y),w:390,h:844}),n.setTool("select");return}if(!K.moved||!ae){K.additive||(n.onSelect([],"replace"),n.onSelectNote(null));return}const Oe=n.visibleBoards.filter(mt=>!n.board.boards[mt].locked&&mm(n.board.boards[mt],ae)),Le=n.visibleNotes.filter(mt=>{var Yn,Qe;if((Yn=n.board.notes[mt])!=null&&Yn.locked)return!1;const vt=(Qe=f.current)==null?void 0:Qe.querySelector(`[data-note="${mt}"]`);if(!vt)return!1;const rn=vt.getBoundingClientRect(),tn=k(rn.left,rn.top),It=k(rn.right,rn.bottom);return mm({x:tn.x,y:tn.y,w:It.x-tn.x,h:It.y-tn.y},ae)}),tt=Object.entries(n.board.shapes??{}).filter(([,mt])=>mm({x:mt.x,y:mt.y,w:Math.max(1,mt.w),h:Math.max(1,mt.h)},ae)).map(([mt])=>mt);n.onMarquee({boards:Oe,notes:Le,shapes:tt},K.additive)},le=b.useRef(null),he=(B,K)=>{const ae=n.selected.includes(K)?n.selected:[K],Oe={};for(const Le of ae)n.board.boards[Le].locked||(Oe[Le]={x:n.board.boards[Le].x,y:n.board.boards[Le].y});le.current={sx:B.clientX,sy:B.clientY,origins:Oe,moved:!1},B.currentTarget.setPointerCapture(B.pointerId)},ce=(B,K=!1)=>{const ae=le.current;if(!ae)return;let Oe=(B.clientX-ae.sx)/o.zoom,Le=(B.clientY-ae.sy)/o.zoom;if(!ae.moved&&!Ey(B.clientX-ae.sx,B.clientY-ae.sy))return;ae.moved=!0;const tt=Object.keys(ae.origins),mt=tt.map(Qe=>({...n.board.boards[Qe],x:ae.origins[Qe].x+Oe,y:ae.origins[Qe].y+Le})),vt=jb(mt),rn=n.visibleBoards.filter(Qe=>!tt.includes(Qe)).map(Qe=>n.board.boards[Qe]),tn=E0/o.zoom,It=[];if(!B.altKey){const Qe=Dy([vt.x,vt.x+vt.w/2,vt.x+vt.w],rn.flatMap(ln=>[ln.x,ln.x+ln.w/2,ln.x+ln.w]),tn),Mn=Dy([vt.y,vt.y+vt.h/2,vt.y+vt.h],rn.flatMap(ln=>[ln.y,ln.y+ln.h/2,ln.y+ln.h]),tn);if(Qe){Oe+=Qe.d;const ln=rn.filter(st=>[st.x,st.x+st.w/2,st.x+st.w].some(St=>Math.abs(St-Qe.at)<.5));It.push({axis:"x",at:Qe.at,from:Math.min(vt.y+((Mn==null?void 0:Mn.d)??0),...ln.map(st=>st.y)),to:Math.max(vt.y+vt.h+((Mn==null?void 0:Mn.d)??0),...ln.map(st=>st.y+st.h))})}if(Mn){Le+=Mn.d;const ln=rn.filter(st=>[st.y,st.y+st.h/2,st.y+st.h].some(St=>Math.abs(St-Mn.at)<.5));It.push({axis:"y",at:Mn.at,from:Math.min(vt.x+((Qe==null?void 0:Qe.d)??0),...ln.map(st=>st.x)),to:Math.max(vt.x+vt.w+((Qe==null?void 0:Qe.d)??0),...ln.map(st=>st.x+st.w))})}}x(K?[]:It);const Yn={};for(const Qe of tt)Yn[Qe]={x:Math.round(ae.origins[Qe].x+Oe),y:Math.round(ae.origins[Qe].y+Le)};n.onMoveBoards(Yn,K)},pe=B=>{const K=le.current;K!=null&&K.moved&&ce(B,!0),le.current=null,x([])},we=p.w/o.zoom,Ze=p.h/o.zoom,Ce=-o.x/o.zoom,Nt=-o.y/o.zoom,at=B=>B.x+B.w>Ce-200&&B.x<Ce+we+200&&B.y+B.h>Nt-200&&B.y<Nt+Ze+200,me=B=>{B.currentTarget.setPointerCapture(B.pointerId),L.current={kind:"pan",sx:B.clientX,sy:B.clientY,vx:o.x,vy:o.y}},ke=b.useRef(null),$e=!!n.onPickElement&&!n.readOnly&&!W&&n.tool==="select",qe=(B,K,ae,Oe)=>{var tt;if(B.button!==0)return;if(B.stopPropagation(),n.readOnly||W)return n.readOnly&&n.onSelect([K],"replace"),me(B);const Le=n.selected.includes(K);if((tt=n.onHoverElement)==null||tt.call(n,null),ae==="frame"&&$e&&Oe&&B.shiftKey&&n.editFile===K){B.currentTarget.setPointerCapture(B.pointerId),ke.current={file:K,kind:"elements",sx:B.clientX,sy:B.clientY,moved:!1};return}if(B.shiftKey)return n.onSelect([K],"toggle");Le||n.onSelect([K],"replace"),he(B,K),ke.current={file:K,kind:ae==="frame"&&$e&&Oe?"board":"label",sx:B.clientX,sy:B.clientY,moved:!1}},fe=(B,K)=>({x:Math.min(B.sx,K.clientX),y:Math.min(B.sy,K.clientY),w:Math.abs(K.clientX-B.sx),h:Math.abs(K.clientY-B.sy)}),re=(B,K,ae)=>{var Le,tt,mt;if(n.readOnly||((Le=L.current)==null?void 0:Le.kind)==="pan")return te(B);ke.current&&B.buttons===0&&(ke.current=null,le.current=null);const Oe=ke.current;if(!Oe){B.buttons===0&&$e&&ae&&((tt=n.onHoverElement)==null||tt.call(n,K,B));return}if(Oe.kind==="elements"){if(!Oe.moved&&!Ey(B.clientX-Oe.sx,B.clientY-Oe.sy))return;Oe.moved=!0,(mt=n.onElementMarquee)==null||mt.call(n,Oe.file,fe(Oe,B),!1);return}ce(B)},Fe=(B,K)=>{var Le,tt,mt,vt,rn;if(n.readOnly||((Le=L.current)==null?void 0:Le.kind)==="pan")return void(L.current=null);const ae=ke.current;if(ke.current=null,(ae==null?void 0:ae.kind)==="elements"){ae.moved?(tt=n.onElementMarquee)==null||tt.call(n,ae.file,fe(ae,B),!0):(mt=n.onPickElement)==null||mt.call(n,K,B,{add:!0,double:!1});return}const Oe=!!((vt=le.current)!=null&&vt.moved);pe(B),!(!ae||Oe)&&(ae.kind==="board"?(rn=n.onPickElement)==null||rn.call(n,K,B,{add:!1,double:!1}):ae.kind==="label"&&n.editFile===K&&n.onSelect([K],"replace"))},ht=new Set(n.visibleBoards),D=new Set;for(const B of n.visibleBoards){const K=(Gn=n.board.boards[B])==null?void 0:Gn.origin;(K==null?void 0:K.kind)==="fork"&&(D.add(B),ht.has(K.of)&&D.add(K.of))}const Y=b.useRef(new Set),ue=b.useRef([]),ge=b.useRef(!1),De=b.useRef(0),[,He]=b.useState(0),G=()=>{if(De.current||!ge.current)return;const B=ue.current.find(K=>!Y.current.has(K));B&&(Y.current.add(B),He(K=>K+1),De.current=window.setTimeout(()=>{De.current=0,G()},T0))},de=b.useRef(0);b.useEffect(()=>{ge.current=!1;const B=performance.now(),K=B-de.current;de.current=B;const ae=window.setTimeout(()=>{ge.current=!0,G()},K<400?Math.max(Oy,K*3):Oy);return()=>window.clearTimeout(ae)},[o.x,o.y,o.zoom]),b.useEffect(()=>()=>window.clearTimeout(De.current),[]);const xe=[],Kt=Ce+we/2,Ge=Nt+Ze/2;b.useEffect(()=>{const B=new Set(xe.map(K=>K.f));for(const K of Y.current)B.has(K)||Y.current.delete(K);ue.current=xe.sort((K,ae)=>K.d-ae.d).map(K=>K.f),G()});const Wt=b.useRef({p:n,pressBoard:qe,moveBoardPress:re,releaseBoard:Fe,picking:$e});Wt.current={p:n,pressBoard:qe,moveBoardPress:re,releaseBoard:Fe,picking:$e};const Zt=b.useMemo(()=>{const B=()=>Wt.current;return{press:(K,ae,Oe,Le)=>B().pressBoard(K,ae,Oe,Le),pressMove:(K,ae,Oe)=>B().moveBoardPress(K,ae,Oe),release:(K,ae)=>B().releaseBoard(K,ae),leave:()=>{var K,ae;return!ke.current&&((ae=(K=B().p).onHoverElement)==null?void 0:ae.call(K,null))},doubleClickFrame:(K,ae)=>{var Oe,Le;return(Le=(Oe=B().p).onPickElement)==null?void 0:Le.call(Oe,ae,K,{add:!1,double:!0})},contextFrame:(K,ae,Oe)=>{var Le,tt;return B().picking&&Oe&&!!((tt=(Le=B().p).onElementContext)!=null&&tt.call(Le,ae,K))},resize:(K,ae,Oe)=>B().p.onMoveBoards({[K]:ae},Oe),play:K=>B().p.onPlay(K),action:(K,ae,Oe)=>{var Le,tt;return(tt=(Le=B().p).onBoardAction)==null?void 0:tt.call(Le,K,ae,Oe)},rename:K=>B().p.onRename(K),context:(K,ae)=>B().p.onContext({type:"board",file:K},ae),iframeRef:(K,ae)=>{var Oe,Le;return(Le=(Oe=B().p).iframeRef)==null?void 0:Le.call(Oe,K,ae)},selectNote:(K,ae)=>B().p.onSelectNote(K,ae),moveNote:(K,ae,Oe)=>B().p.onMoveNote(K,ae,Oe),deleteNote:K=>B().p.onDeleteNote(K),contextNote:(K,ae)=>B().p.onContext({type:"note",id:K},ae)}},[]),rt=b.useMemo(()=>new Set(n.files),[n.files]),Ye=b.useRef({zoom:0,of:new Map,pins:new Map});(Ye.current.fn!==n.renderBoardOverlay||Ye.current.pf!==n.renderBoardPins||Ye.current.zoom!==o.zoom)&&(Ye.current={fn:n.renderBoardOverlay,pf:n.renderBoardPins,zoom:o.zoom,of:new Map,pins:new Map});const mn=B=>{var ae;const K=Ye.current.pins;return K.has(B)||K.set(B,(ae=n.renderBoardPins)==null?void 0:ae.call(n,B,o.zoom)),K.get(B)},en=B=>{var ae;const K=Ye.current.of;return K.has(B)||K.set(B,(ae=n.renderBoardOverlay)==null?void 0:ae.call(n,B,o.zoom)),K.get(B)},Pn=b.useMemo(()=>{var B;return(B=n.underLayer)==null?void 0:B.call(n,o.zoom)},[n.underLayer,o.zoom]),ut=b.useMemo(()=>{var B;return(B=n.worldLayer)==null?void 0:B.call(n,o.zoom)},[n.worldLayer,o.zoom]);return s.jsxs("div",{ref:f,className:`canvas tool-${W?"hand":n.tool}`,onPointerDown:ne,onPointerMove:te,onPointerUp:ie,onAuxClick:B=>B.preventDefault(),onContextMenu:B=>{if(B.target!==B.currentTarget)return;B.preventDefault();const K=k(B.clientX,B.clientY);n.onContext({type:"canvas",x:Math.round(K.x),y:Math.round(K.y)},B)},role:"application","aria-label":d.canvas.aria,children:[s.jsxs("div",{ref:m,className:"world",style:{transform:`translate(${o.x}px, ${o.y}px) scale(${o.zoom})`},children:[Pn,n.visibleNotes.map(B=>s.jsx($0,{note:n.board.notes[B],zoom:o.zoom,id:B,selected:n.selectedNotes.includes(B),readOnly:n.readOnly,h:Zt},B)),n.visibleBoards.map(B=>{var rn,tn,It,Yn,Qe,Mn;const K=n.board.boards[B],ae=n.playing===B||n.editFile===B||n.typing===B,Oe=ae||at(K),Le=ae||Oe&&(!X.thumbs||o.zoom>=S0||Math.max(K.w,K.h)*o.zoom>=k0);Le&&xe.push({f:B,d:ae?-1:Math.hypot(K.x+K.w/2-Kt,K.y+K.h/2-Ge)}),ae&&Y.current.add(B);const tt=ae||Le&&Y.current.has(B),mt=Le&&!tt,vt=n.selected.includes(B);return s.jsx(A0,{file:B,item:K,exists:rt.has(B),zoom:o.zoom,live:tt,selected:vt,single:vt&&n.selected.length===1&&!n.readOnly,readOnly:n.readOnly,screens:X,editing:n.editFile===B,typing:n.typing===B,playing:n.playing===B,near:Oe,waiting:mt,reloadKey:n.reloadKeys[B]??0,stamp:(rn=n.stamps)==null?void 0:rn[B],pickable:$e&&tt,h:Zt,overlay:en(B),pins:mn(B),compact:K.w*o.zoom>=48&&o.zoom<hm&&D.has(B),forkScene:D.has(B),tags:K.w*o.zoom>=48&&!(o.zoom<hm&&D.has(B))&&n.playing!==B?(tn=n.renderBoardTags)==null?void 0:tn.call(n,B):null,buttons:n.readOnly?null:(It=n.renderBoardButtons)==null?void 0:It.call(n,B,o.zoom<hm&&D.has(B)),ring:((Yn=n.boardRing)==null?void 0:Yn.call(n,B))??null,pick:((Qe=n.frameInfo)==null?void 0:Qe.call(n,B))??null,actions:!n.readOnly&&!!n.onBoardAction,tweaks:!!((Mn=n.hasTweaks)!=null&&Mn.call(n,B))},B)}),ut,E.map((B,K)=>B.axis==="x"?s.jsx("div",{className:"guide",style:{left:B.at,top:B.from,width:1/o.zoom,height:B.to-B.from}},K):s.jsx("div",{className:"guide",style:{left:B.from,top:B.at,height:1/o.zoom,width:B.to-B.from}},K)),j&&s.jsx("div",{className:n.tool==="board"?"draft-board":"marquee",style:{left:j.x,top:j.y,width:j.w,height:j.h,borderWidth:1/o.zoom},children:n.tool==="board"&&s.jsxs("span",{style:{transform:`scale(${1/o.zoom})`},children:[Math.round(j.w)," × ",Math.round(j.h)]})})]}),S&&s.jsx("div",{className:"pan-capture",onPointerDown:me,onPointerMove:te,onPointerUp:()=>L.current=null})]})}const A0=b.memo(function(o){var ie,le,he,ce,pe,we,Ze;const{item:r,zoom:f,file:m,h:p,live:v}=o,S=Mm(f),N=r.title??o.file,[E,x]=b.useState(!1);b.useEffect(()=>{o.live||x(!1)},[o.live]);const j=r.w*f<48,M=!j&&!!o.compact,$=((ie=r.origin)==null?void 0:ie.kind)==="fork"&&r.origin.by?r.origin:null,L=$?d.occupancy.forked(d.occupancy.clock(Date.parse($.at??"")||Date.now()),$.by,$.while??d.occupancy.someone):null,I=Ce=>{Ce.preventDefault(),Ce.stopPropagation(),p.context(m,Ce)},k=Ce=>Ce.stopPropagation(),_=r.w*f,W=!!o.actions&&_>=180,X=Ce=>Nt=>{var me;Nt.stopPropagation();const at=Nt.currentTarget.getBoundingClientRect();(me=p.action)==null||me.call(p,m,Ce,{clientX:at.left,clientY:at.bottom+4})},ne=_>=110&&s.jsxs("button",{className:`icon-btn sm board-play ${W?"pill":""} ${r.is_interactive?"always":""} ${o.playing?"pressed":""}`,"aria-label":o.playing?o.actions?d.canvas.edit:d.canvas.stopPlay:d.canvas.play,"aria-haspopup":o.actions&&!o.playing?"menu":void 0,title:o.playing?d.canvas.stopPlayTitle:d.canvas.playTitle,onPointerDown:k,onClick:Ce=>{if(Ce.stopPropagation(),o.actions&&!o.playing)return X("playMenu")(Ce);p.play(m)},children:[o.playing&&W?s.jsx("span",{className:"pill-label",children:d.canvas.edit}):s.jsx(F,{name:o.playing?"stop":"play",size:14}),W&&!o.playing&&s.jsx("span",{className:"pill-label",children:d.canvas.playShort})]}),te=o.actions&&_>=220&&s.jsxs(s.Fragment,{children:[o.tweaks&&s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.tweaks,title:d.canvas.tweaks,onPointerDown:k,onClick:X("tweaks"),children:s.jsx(F,{name:"sliders",size:14})}),s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.fullWindow,title:d.canvas.fullWindow,onPointerDown:k,onClick:X("expand"),children:s.jsx(F,{name:"expand",size:14})}),s.jsx("button",{className:"icon-btn sm board-tool","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onPointerDown:k,onClick:X("export"),children:s.jsx(F,{name:"download",size:14})})]});return s.jsxs("div",{className:`board ${o.selected?"selected":""} ${o.editing?"editing":""} ${o.playing?"playing":""} ${r.frameless?"frameless":""} ${r.is_interactive?"interactive":""} ${o.ring?"held":""}`,style:{left:r.x,top:r.y,width:r.w,height:r.h,...o.ring?{"--ring":o.ring}:{}},"data-file":o.file,role:"group","aria-label":d.canvas.board(N,!!o.selected,!!o.editing,!!o.playing),"aria-description":L??void 0,children:[s.jsxs("div",{className:`board-label ${j?"tiny":""} ${M?"compact":""} ${o.tags?"tagged":""} ${o.forkScene?"fork-scene":""}`,style:{transform:`scale(${1/f})`,width:r.w*f},onPointerDown:Ce=>p.press(Ce,m,"label",v),onPointerMove:Ce=>p.pressMove(Ce,m,v),onPointerUp:Ce=>p.release(Ce,m),onContextMenu:I,title:`${N} · ${o.file}${L?`
56
+ ${L}`:""}`,children:[o.tags,s.jsxs("span",{className:"lab-row",children:[r.is_interactive&&s.jsx("span",{className:"dot","aria-label":d.canvas.interactive}),M&&$?s.jsxs("span",{className:`occ-tag fork-who ${o.ring?"":"done"}`,onDoubleClick:Ce=>Ce.stopPropagation(),children:[o.ring?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(F,{name:"ai",size:14}),s.jsx("span",{className:"act-tag-text",children:$.by})]}):s.jsx("span",{className:"board-title",onDoubleClick:Ce=>{Ce.stopPropagation(),o.readOnly||p.rename(m)},children:N}),r.locked&&s.jsx("span",{className:"board-lock",role:"img","aria-label":d.menu.locked,title:d.menu.locked,children:s.jsx(F,{name:"lock",size:14})}),r.w*f>=160&&N!==o.file&&!(M&&$)&&s.jsx("span",{className:"board-file",children:o.file}),M&&o.selected&&(o.buttons||ne)&&s.jsxs("span",{className:"board-btns pinned",children:[o.buttons,ne]}),!M&&r.w*f>=110&&s.jsxs("span",{className:`board-btns ${o.buttons?"pinned":""}`,children:[o.buttons,te,ne]})]})]}),s.jsxs("div",{className:"board-frame","data-inside":o.editing&&!o.readOnly?"":void 0,"data-easel-file":(le=o.pick)==null?void 0:le.file,"data-easel-path":(he=o.pick)==null?void 0:he.path,"data-easel-element":(ce=o.pick)==null?void 0:ce.element,"aria-label":(pe=o.pick)==null?void 0:pe.label,style:{borderRadius:r.radius??0,background:r.bg||void 0},onDoubleClick:Ce=>{o.playing||o.typing||!o.pickable||(Ce.stopPropagation(),p.doubleClickFrame(Ce,m))},onPointerDown:Ce=>!o.playing&&!o.typing&&p.press(Ce,m,"frame",v),onPointerMove:Ce=>!o.playing&&!o.typing&&p.pressMove(Ce,m,v),onPointerUp:Ce=>!o.playing&&!o.typing&&p.release(Ce,m),onPointerLeave:p.leave,onContextMenu:Ce=>{o.playing||o.typing||(p.contextFrame(Ce,m,v)?(Ce.preventDefault(),Ce.stopPropagation()):I(Ce))},children:[o.exists?o.live?s.jsxs(s.Fragment,{children:[s.jsx(z0,{reloadKey:o.reloadKey,iframeRef:Ce=>p.iframeRef(m,Ce),src:o.screens.url(o.file),html:(Ze=(we=o.screens).html)==null?void 0:Ze.call(we,o.file),title:N,interactive:!!o.playing||!!o.typing,onLoad:()=>x(!0)}),!E&&o.screens.thumbs&&s.jsx("div",{className:"board-placeholder loading board-cover",style:{position:"absolute",inset:0,pointerEvents:"none",fontSize:Math.min(64,14/f)},"aria-hidden":"true",children:s.jsx(Ry,{file:o.file,s:o.stamp,px:Cu[0]})})]}):s.jsxs("div",{className:`board-placeholder ${o.near?"loading":"far"}`,style:{fontSize:Math.min(64,14/f)},children:[o.near&&o.screens.thumbs&&s.jsx(Ry,{file:o.file,s:o.stamp,px:o.waiting?Cu[0]:C0(Math.max(r.w,r.h)*f*(window.devicePixelRatio||1))}),s.jsx("span",{className:"ph-title","data-hint":o.near?"":d.canvas.notLoaded,children:N}),o.near&&s.jsx("span",{className:"ph-bar",style:{height:3/Math.max(f,.05)},"aria-hidden":"true"})]}):s.jsx("div",{className:"board-missing",children:d.canvas.fileMissing(o.file)}),o.playing&&!o.actions&&s.jsx("div",{className:"playing-badge",style:{transform:`scale(${1/Math.max(f,.25)})`},children:d.canvas.playing}),o.overlay]}),o.single&&!r.locked&&s.jsx("div",{className:"board-resize",role:"slider","aria-label":d.canvas.boardSize,"aria-valuetext":`${r.w} × ${r.h}`,style:{width:12/f,height:12/f,right:-6/f,bottom:-6/f,borderWidth:1.5/f},onPointerDown:Ce=>{Ce.button===0&&(Ce.stopPropagation(),S.start(Ce,{x:r.w,y:r.h},(Nt,at)=>p.resize(m,{w:ur(Math.round(Nt.x),40,8e3),h:ur(Math.round(Nt.y),40,8e3)},at)))},onPointerMove:S.move,onPointerUp:S.end}),o.pins&&s.jsx("div",{className:"pin-layer",children:o.pins})]})});function Ry({file:n,s:o,px:r}){const[f,m]=b.useState(!1),[p,v]=b.useState(r);b.useEffect(()=>v(j=>Math.max(j,r)),[r]);const S=`/api/thumb?f=${encodeURIComponent(n)}${o?`&s=${o}`:""}&px=${p}`,[N,E]=b.useState(null),x=b.useRef(null);return b.useEffect(()=>{if(S===x.current)return;const j=new Image;return j.onload=()=>E(x.current=S),j.onerror=()=>!x.current&&m(!0),j.src=S,()=>{j.onload=j.onerror=null}},[S]),f||!N?null:s.jsx("img",{className:"board-thumb",src:N,alt:"",decoding:"async",draggable:!1,onLoad:j=>{var M;j.currentTarget.classList.add("loaded"),(M=j.currentTarget.parentElement)==null||M.classList.remove("loading")}})}function z0(n){const o=b.useRef(null),r=b.useRef(!0);return b.useEffect(()=>{if(r.current){r.current=!1;return}const f=o.current,m=f==null?void 0:f.contentWindow;if(!f||!m)return;const p=m.document,v=[];p.querySelectorAll("*").forEach((x,j)=>{(x.scrollTop||x.scrollLeft)&&v.push([j,x.scrollTop,x.scrollLeft])});const S=m.scrollX,N=m.scrollY,E=()=>{f.removeEventListener("load",E);const x=f.contentWindow;x.scrollTo(S,N);const j=x.document.querySelectorAll("*");for(const[M,$,L]of v){const I=j[M];I&&(I.scrollTop=$,I.scrollLeft=L)}f.dispatchEvent(new CustomEvent("dc-reloaded"))};f.addEventListener("load",E),m.location.reload()},[n.reloadKey]),s.jsx("iframe",{ref:f=>{o.current=f,n.iframeRef(f)},src:n.html==null?n.src:void 0,srcDoc:n.html??void 0,title:n.title,onLoad:n.onLoad,style:{pointerEvents:n.interactive?"auto":"none"}})}const $0=b.memo(function(o){const{note:r,h:f,id:m}=o,p=(X,ne)=>f.moveNote(m,X,ne),v=Mm(o.zoom),[S,N]=b.useState(!1),E=b.useRef(null);b.useEffect(()=>{if(S&&E.current){E.current.focus();const X=document.createRange();X.selectNodeContents(E.current);const ne=getSelection();ne==null||ne.removeAllRanges(),ne==null||ne.addRange(X)}},[S]);const x=b.useRef(!1),j=b.useRef(!1),M=X=>{N(!1);const ne=X.innerText;ne!==r.text&&p({text:ne},!0)},$=r.size??(r.kind==="title"?72:22),[L,I]=b.useState($);b.useLayoutEffect(()=>{const X=E.current;if(!X||r.kind!=="title"||S)return I($);let ne=$;X.style.fontSize=`${ne}px`;const te=r.maxW??4e3,ie=r.maxH||1/0;for(let le=0;le<40&&ne>12&&(X.scrollWidth>te+1||X.scrollHeight>ie+1);le++)ne=Math.max(12,Math.floor(ne*.92)),X.style.fontSize=`${ne}px`;I(ne)},[r.text,$,r.maxW,r.maxH,r.kind,S]);const k=Mm(o.zoom),_=r.kind==="title"?{left:r.x,top:r.y,maxWidth:r.maxW??4e3,maxHeight:r.maxH||void 0}:{left:r.x,top:r.y,width:r.w??320,height:r.h||void 0,background:c0(r.color)},W={fontSize:L,fontWeight:r.bold??r.kind==="title"?700:400,fontStyle:r.italic?"italic":void 0};return r.kind==="title"&&L*o.zoom<12&&Object.assign(_,{transform:`scale(${12/(L*o.zoom)})`,transformOrigin:"0 0"}),s.jsxs("div",{className:`note note-${r.kind} ${o.selected?"selected":""} ${o.readOnly?"read-only":""}`,"data-note":o.id,style:_,onPointerDown:X=>{S||X.button!==0||o.readOnly||(X.stopPropagation(),X.shiftKey?f.selectNote(m,!0):o.selected||f.selectNote(m,!1),r.locked||v.start(X,{x:r.x,y:r.y},(ne,te)=>p({x:Math.round(ne.x),y:Math.round(ne.y)},te)))},onPointerMove:v.move,onPointerUp:v.end,onDoubleClick:X=>{X.stopPropagation(),o.readOnly||N(!0)},onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),!o.readOnly&&(f.selectNote(m,!1),f.contextNote(m,X))},children:[s.jsx("div",{ref:E,className:"note-text",style:W,contentEditable:S,suppressContentEditableWarning:!0,onCompositionStart:()=>x.current=!0,onCompositionEnd:X=>{x.current=!1,j.current&&(j.current=!1,M(X.currentTarget))},onBlur:X=>{x.current?j.current=!0:M(X.currentTarget)},onKeyDown:X=>{X.nativeEvent.isComposing||X.key==="Escape"&&X.currentTarget.blur()},children:r.text}),r.locked&&s.jsx("span",{className:"note-lock",role:"img","aria-label":d.menu.locked,title:d.menu.locked,style:{transform:`scale(${1/Math.max(o.zoom,.25)})`},children:s.jsx(F,{name:"lock",size:14})}),o.selected&&o.zoom>=.2&&!S&&!r.locked&&s.jsx("div",{className:"note-resize",role:"slider","aria-label":r.kind==="title"?d.canvas.titleMaxWidth:d.canvas.stickySize,style:{width:12/o.zoom,height:12/o.zoom,right:-6/o.zoom,bottom:-6/o.zoom,borderWidth:1.5/o.zoom},onPointerDown:X=>{if(X.button!==0)return;X.stopPropagation();const ne=X.currentTarget.parentElement.getBoundingClientRect(),te=ne.width/o.zoom,ie=ne.height/o.zoom;k.start(X,{x:te,y:ie},(le,he)=>p(r.kind==="title"?{maxW:Math.max(80,Math.round(le.x))}:{w:Math.max(80,Math.round(le.x)),h:Math.max(60,Math.round(le.y))},he))},onPointerMove:k.move,onPointerUp:k.end}),o.selected&&!S&&o.zoom>=.2&&s.jsx("button",{className:"note-del icon-btn","aria-label":d.canvas.deleteNote,style:{transform:`scale(${1/o.zoom})`},onPointerDown:X=>X.stopPropagation(),onClick:X=>{X.stopPropagation(),f.deleteNote(m)},children:s.jsx(F,{name:"close",size:14})})]})});function Mm(n){const o=b.useRef(null);return{start(r,f,m){o.current={sx:r.clientX,sy:r.clientY,ox:f.x,oy:f.y,cb:m,moved:!1},r.currentTarget.setPointerCapture(r.pointerId)},move(r){const f=o.current;if(!f)return;const m=(r.clientX-f.sx)/n,p=(r.clientY-f.sy)/n;!f.moved&&Math.abs(m)+Math.abs(p)<2/n||(f.moved=!0,f.cb({x:f.ox+m,y:f.oy+p},!1))},end(r){const f=o.current;o.current=null,!(!f||!f.moved)&&f.cb({x:f.ox+(r.clientX-f.sx)/n,y:f.oy+(r.clientY-f.sy)/n},!0)}}}function Dy(n,o,r){let f=null;for(const m of n)for(const p of o){const v=p-m;Math.abs(v)<=r&&(!f||Math.abs(v)<Math.abs(f.d))&&(f={d:v,at:p})}return f}const jb=n=>{const o=Math.min(...n.map(f=>f.x)),r=Math.min(...n.map(f=>f.y));return{x:o,y:r,w:Math.max(...n.map(f=>f.x+f.w))-o,h:Math.max(...n.map(f=>f.y+f.h))-r}},mm=(n,o)=>n.x<o.x+o.w&&n.x+n.w>o.x&&n.y<o.y+o.h&&n.y+n.h>o.y,O0=n=>({x:Math.round(n.x),y:Math.round(n.y),w:Math.round(n.w),h:Math.round(n.h)});function ur(n,o,r){return Math.min(r,Math.max(o,n))}function wu(n){const o=n.target;return o?o.tagName==="INPUT"?!/^(checkbox|radio|button|range|color)$/.test(o.type):o.isContentEditable||/^(TEXTAREA|SELECT)$/.test(o.tagName):!1}function Ki(n,o,r=60,f){if(!n.length)return{x:0,y:0,zoom:1};(o.w<100||o.h<100)&&(o={w:window.innerWidth,h:Math.max(200,window.innerHeight)});const m=f&&f.w>=100&&f.h>=100?f:{x:0,y:0,w:o.w,h:o.h};r=Math.min(r,m.w*.08,m.h*.08);const p=jb(n),v=ur(Math.min((m.w-r*2)/p.w,(m.h-r*2)/p.h),qm,Vm);return{zoom:v,x:Math.round(m.x+r-p.x*v+(m.w-r*2-p.w*v)/2),y:Math.round(m.y+r-p.y*v+(m.h-r*2-p.h*v)/2)}}function R0(n){const[o,r]=b.useState(null),f=b.useCallback(()=>Te.get("/api/assets").then(m=>r(m.assets)).catch(()=>r([])),[]);return b.useEffect(()=>{f()},[f,n]),{list:o,reload:f}}async function Am(n){const o=[];for(const r of Array.from(n)){const f=await new Promise(m=>{const p=new FileReader;p.onload=()=>m(String(p.result).split(",")[1]??""),p.readAsDataURL(r)});o.push(await Te.post("/api/assets",{name:r.name,data:f}))}return o}const D0=n=>n>1024*1024?`${(n/1024/1024).toFixed(1)}MB`:`${Math.max(1,Math.round(n/1024))}KB`;function Nb(n){const{list:o,reload:r}=R0(n.version),[f,m]=b.useState(!1),[p,v]=b.useState(!1),S=async E=>{var x;m(!0);try{const j=await Am(E);await r(),(x=n.onUploaded)==null||x.call(n,j)}catch(j){n.onError(j.message)}finally{m(!1)}},N=(o??[]).filter(E=>!n.only||E.kind===n.only);return s.jsxs("div",{className:`assets ${p?"over":""}`,onDragOver:E=>{E.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:E=>{E.preventDefault(),v(!1),E.dataTransfer.files.length&&S(E.dataTransfer.files)},children:[s.jsxs("label",{className:"upload",children:[s.jsx(F,{name:"plus",size:14})," ",f?d.assets.uploading:d.assets.upload,s.jsx("input",{type:"file",hidden:!0,multiple:!0,accept:"image/*,.woff,.woff2,.ttf,.otf",onChange:E=>E.target.files&&void S(E.target.files)})]}),o==null?s.jsxs("p",{className:"empty",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",d.assets.loading]}):N.length===0?s.jsx("p",{className:"empty",children:d.assets.empty}):s.jsx("ul",{className:"asset-grid",children:N.map(E=>s.jsx("li",{children:s.jsxs("button",{className:"asset",title:`${E.ref} · ${D0(E.size)}${n.onPick?"":d.assets.copyPath}`,"aria-label":`${E.name}${n.pickLabel??""}`,onClick:()=>n.onPick?n.onPick(E):void navigator.clipboard.writeText(E.ref).catch(()=>{}),children:[E.kind==="image"?s.jsx("img",{src:E.url,alt:"",loading:"lazy"}):s.jsx("span",{className:"asset-font",children:E.kind==="font"?"Aa":d.assets.file}),s.jsx("span",{className:"asset-name",children:E.name})]})},E.name))})]})}function B0({open:n,version:o,onClose:r,onPick:f,onError:m}){return b.useEffect(()=>{if(!n)return;const p=v=>v.key==="Escape"&&r();return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n,r]),n?s.jsx("div",{className:"dialog-backdrop",onPointerDown:p=>p.target===p.currentTarget&&r(),children:s.jsxs("div",{className:"dialog wide",role:"dialog","aria-modal":"true","aria-label":d.assets.pickImage,children:[s.jsx("h2",{children:d.assets.pickImage}),s.jsx(Nb,{version:o,only:"image",pickLabel:d.assets.pickLabel,onPick:f,onError:m,onUploaded:p=>p[0]&&p[0].kind==="image"&&f(p[0])}),s.jsx("div",{className:"dialog-actions",children:s.jsx("button",{onClick:r,children:d.assets.close})})]})}):null}var pm=pb();function By({label:n,src:o,empty:r,w:f,h:m}){const p=b.useRef(null),[v,S]=b.useState(0);return b.useEffect(()=>{const N=p.current;if(!N)return;const E=()=>S(Math.min(1,(N.clientWidth-16)/f,(N.clientHeight-16)/m));E();const x=new ResizeObserver(E);return x.observe(N),()=>x.disconnect()},[f,m]),s.jsxs("figure",{className:"cmp-pane",children:[s.jsx("figcaption",{children:n}),s.jsx("div",{className:"cmp-stage",ref:p,children:o?s.jsx("div",{className:"cmp-frame",style:{width:f*v,height:m*v},children:v>0&&s.jsx("iframe",{title:n,src:o,style:{width:f,height:m,transform:`scale(${v})`}})}):s.jsx("p",{className:"muted",children:r})})]})}const H0=n=>o=>`/api/chat/run-file?id=${encodeURIComponent(n)}&f=${encodeURIComponent(`screens/${o}`)}`,L0=n=>o=>`/api/history/step-file?id=${encodeURIComponent(n)}&f=${encodeURIComponent(o)}`;function Sb({before:n,boards:o,onClose:r,notBefore:f=d.compare.notBefore}){const[m,p]=b.useState(()=>Math.max(0,o.findIndex(N=>N.kind==="changed"))),v=o[m];if(!v)return null;const S=N=>N.split("/").map(encodeURIComponent).join("/");return s.jsx("div",{className:"dialog-backdrop",onPointerDown:N=>N.target===N.currentTarget&&r(),children:s.jsxs("div",{className:"dialog cmp",role:"dialog","aria-modal":"true","aria-label":d.compare.title(v.title),onKeyDown:N=>{N.key==="Escape"&&(N.stopPropagation(),r())},children:[s.jsxs("div",{className:"cmp-head",children:[s.jsx("h2",{children:d.compare.title(v.title)}),s.jsx("button",{className:"icon-btn sm","aria-label":d.compare.close,title:d.compare.close,autoFocus:!0,onClick:r,children:s.jsx(F,{name:"close",size:14})})]}),o.length>1&&s.jsx("div",{className:"chips",role:"tablist","aria-label":d.compare.boards,children:o.map((N,E)=>s.jsx("button",{role:"tab","aria-selected":E===m,className:`chip cmp-tab ${E===m?"on":""}`,onClick:()=>p(E),children:N.kind==="added"?d.chat.chipNew(N.title):N.title},N.file))}),s.jsxs("div",{className:"cmp-panes",children:[s.jsx(By,{label:d.compare.before,src:v.kind==="added"?null:n(v.file),empty:f,w:v.w,h:v.h},`b-${v.file}`),s.jsx(By,{label:d.compare.after,src:v.kind==="removed"?null:`/screens/${S(v.file)}`,empty:d.compare.notAfter,w:v.w,h:v.h},`a-${v.file}`)]})]})})}const _0=/^ {0,3}(`{3,}|~{3,})\s*([\w#+.-]*)/,U0=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,ju=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,q0=/^ {0,3}([-*_])(\s*\1){2,}\s*$/,V0=n=>/^https?:\/\/[^\s<>"]+$/i.test(n)?n:null;function G0(n){const o=String(n??"").replace(/\r\n?/g,`
57
+ `).split(`
58
+ `),r=[];let f=[];const m=()=>{f.length&&r.push({t:"p",c:Zi(f.join(`
59
+ `))}),f=[]};for(let p=0;p<o.length;p++){const v=o[p],S=_0.exec(v);if(S){m();const E=S[1],x=[];let j=!0;for(p++;p<o.length;p++){if(new RegExp(`^ {0,3}${E[0]==="`"?"`":"~"}{${E.length},}\\s*$`).test(o[p])){j=!1;break}x.push(o[p])}r.push({t:"code",lang:S[2]??"",v:x.join(`
60
+ `),open:j});continue}if(!v.trim()){m();continue}const N=U0.exec(v);if(N){m(),r.push({t:"h",level:N[1].length,c:Zi(N[2])});continue}if(q0.test(v)&&!f.length){r.push({t:"hr"});continue}if(ju.test(v)&&(!f.length||!/^\s/.test(v))){m(),p=Y0(o,p,r)-1;continue}f.push(v.trim())}return m(),r}const gu=n=>/\d/.test(n)?"ol":"ul";function Y0(n,o,r){var N;const f=ju.exec(n[o]),m=f[1].length,p={t:gu(f[2]),start:gu(f[2])==="ol"?parseInt(f[2],10):1,items:[]},v=[],S=[];for(;o<n.length;o++){const E=n[o];if(!E.trim()){const M=n.slice(o+1).find($=>$.trim());if(M&&ju.test(M)&&ju.exec(M)[1].length>=m)continue;break}const x=ju.exec(E);if(x&&x[1].length<=m+1){if(gu(x[2])!==p.t)break;p.items.push({c:[]}),v.push([x[3]]),S.push({list:{t:"ul",start:1,items:[]},texts:[]});continue}if(!p.items.length)break;const j=S[S.length-1];if(x){j.list.items.length||(j.list={t:gu(x[2]),start:gu(x[2])==="ol"?parseInt(x[2],10):1,items:[]}),j.list.items.push({c:[]}),j.texts.push([x[3]]);continue}if(!/^\s/.test(E)&&!((N=n[o-1])!=null&&N.trim()))break;(j.texts.length?j.texts[j.texts.length-1]:v[v.length-1]).push(E.trim())}return p.items.forEach((E,x)=>{E.c=Zi(v[x].join(`
61
+ `));const j=S[x];j.list.items.length&&(j.list.items.forEach((M,$)=>M.c=Zi(j.texts[$].join(`
62
+ `))),E.sub=j.list)}),r.push(p),o}function Zi(n){const o=[];let r="";const f=p=>{r&&o.push({t:"text",v:r}),r="",o.push(p)};let m=0;for(;m<n.length;){const p=n[m];if(p==="\\"&&m+1<n.length&&/[\\`*_[\]()#+\-.!>~|]/.test(n[m+1])){r+=n[m+1],m+=2;continue}if(p===`
63
+ `){f({t:"br"}),m++;continue}if(p==="`"){let v=1;for(;n[m+v]==="`";)v++;const S="`".repeat(v),N=n.indexOf(S,m+v);if(N>m){const E=n.slice(m+v,N);f({t:"code",v:E.length>2&&E.startsWith(" ")&&E.endsWith(" ")?E.slice(1,-1):E}),m=N+v;continue}r+=S,m+=v;continue}if((p==="*"||p==="_")&&n[m+1]===p){const v=n.indexOf(p+p,m+2);if(v>m+2&&n[m+2]!==" "){f({t:"b",c:Zi(n.slice(m+2,v))}),m=v+2;continue}}else if(p==="*"||p==="_"){const v=p==="*"||!/\w/.test(n[m-1]??"");let S=-1;for(let N=m+1;N<n.length;N++)if(n[N]===p&&n[N+1]!==p&&n[N-1]!==" "&&(p==="*"||!/\w/.test(n[N+1]??""))){S=N;break}if(v&&S>m+1&&n[m+1]!==" "&&!n.slice(m+1,S).includes(`
64
+ `)){f({t:"i",c:Zi(n.slice(m+1,S))}),m=S+1;continue}}if(p==="["){const v=/^\[([^\]\n]*)\]\(([^)\s]*)\)/.exec(n.slice(m));if(v){const S=V0(v[2]),N=Zi(v[1]);if(S)f({t:"a",href:S,c:N});else for(const E of N)E.t==="text"?r+=E.v:f(E);m+=v[0].length;continue}}if((p==="h"||p==="H")&&!/\w/.test(n[m-1]??"")){const v=/^https?:\/\/[^\s<>"`]+/i.exec(n.slice(m));if(v){const S=v[0].replace(/[.,;:!?)\]'"]+$/,"");f({t:"a",href:S,c:[{t:"text",v:S}]}),m+=S.length;continue}}r+=p,m++}return r&&o.push({t:"text",v:r}),o}const kb=b.createContext(()=>{}),Tb=()=>b.useContext(kb);function X0({children:n}){const[o,r]=b.useState([]),f=b.useCallback(m=>{const p=Date.now()+Math.random();r(v=>[...v.filter(S=>!m.slot||S.slot!==m.slot).slice(-3),{...m,id:p}]),setTimeout(()=>r(v=>v.filter(S=>S.id!==p)),m.ms??(m.tone==="error"?6e3:3200))},[]);return s.jsxs(kb.Provider,{value:f,children:[n,s.jsx("div",{className:"toasts",role:"status","aria-live":"polite",children:o.map(m=>s.jsxs("div",{className:`toast ${m.tone??"info"}`,children:[m.tone==="error"?s.jsx(F,{name:"warn"}):m.tone==="ok"?s.jsx(F,{name:"check"}):null,m.dot&&s.jsx("span",{className:"toast-dot","aria-hidden":"true"}),s.jsx("span",{children:m.text}),m.code&&s.jsx("code",{className:"toast-code",children:m.code}),m.action&&s.jsx("button",{className:"toast-action",onClick:()=>{m.action.run(),r(p=>p.filter(v=>v.id!==m.id))},children:m.action.label}),m.close&&s.jsx("button",{className:"icon-btn oc-ib toast-close","aria-label":m.close.label,title:m.close.label,onClick:()=>{var p,v;(v=(p=m.close).run)==null||v.call(p),r(S=>S.filter(N=>N.id!==m.id))},children:s.jsx(F,{name:"close",size:16})})]},m.id))})]})}function Cb({icon:n,text:o,alt:r}){return s.jsxs("span",{className:"swap-label",children:[s.jsxs("span",{children:[n," ",o]}),s.jsxs("span",{"aria-hidden":"true",children:[n," ",r]})]})}function K0({menu:n,onClose:o,head:r}){const f=b.useRef(null),[m,p]=b.useState({x:0,y:0}),[v,S]=b.useState(-1);if(b.useLayoutEffect(()=>{if(!n||!f.current)return;const x=f.current.getBoundingClientRect(),j=n.right?n.x-x.width:n.x,M=n.up?n.y-x.height:n.y;p({x:Math.round(Math.max(8,Math.min(j,window.innerWidth-x.width-8))),y:Math.round(Math.max(8,Math.min(M,window.innerHeight-x.height-8)))}),S(-1),f.current.focus()},[n]),b.useEffect(()=>{if(!n)return;const x=j=>{f.current&&j.target instanceof Node&&f.current.contains(j.target)||o()};return window.addEventListener("pointerdown",x,!0),window.addEventListener("blur",o),()=>{window.removeEventListener("pointerdown",x,!0),window.removeEventListener("blur",o)}},[n,o]),!n)return null;const N=n.items,E=N.map((x,j)=>x!=="sep"&&!x.disabled&&!x.heading?j:-1).filter(x=>x>=0);return s.jsxs("div",{ref:f,className:`menu entering ${n.className??""}`,role:"menu",tabIndex:-1,"aria-label":n.title??d.dialog.menu,style:{left:m.x,top:m.y},onKeyDown:x=>{var j,M;if(["Escape","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"].includes(x.key)&&x.stopPropagation(),x.key==="Escape")o();else if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const $=E.indexOf(v),L=x.key==="ArrowDown"?E[($+1)%E.length]:E[($-1+E.length)%E.length];S(L)}else if((x.key==="ArrowRight"||x.key==="F10"&&x.shiftKey)&&v>=0){const $=N[v],L=$!=="sep"&&$.more,I=L&&((M=(j=f.current)==null?void 0:j.querySelector(`[data-more="${v}"]`))==null?void 0:M.getBoundingClientRect());L&&I&&(x.preventDefault(),o(),L.open({clientX:I.left,clientY:I.bottom+4}))}else if(x.key==="Enter"&&v>=0){const $=N[v];$!=="sep"&&(o(),$.run())}},children:[n.title&&s.jsx("div",{className:"menu-title",children:n.title}),r??n.head,N.map((x,j)=>x==="sep"?s.jsx("div",{className:"menu-sep",role:"separator"},j):x.heading?s.jsx("div",{className:"menu-title menu-heading",role:"presentation",children:x.label},j):x.more?s.jsxs("div",{className:`menu-row ${v===j?"active":""}`,role:"none",children:[s.jsx(Z0,{it:x,icons:!!n.icons,active:v===j,onHover:()=>S(j),onClose:o}),s.jsx("button",{className:"icon-btn menu-more",role:"menuitem",tabIndex:-1,"data-more":j,"aria-haspopup":"menu","aria-label":x.more.label,title:x.more.label,onMouseEnter:()=>S(j),onClick:M=>{const $=M.currentTarget.getBoundingClientRect();o(),x.more.open({clientX:$.left,clientY:$.bottom+4})},children:s.jsx(F,{name:"more",size:16})})]},j):s.jsxs("button",{role:x.check===void 0?"menuitem":"menuitemcheckbox","aria-checked":x.check===void 0?void 0:x.check,"aria-label":x.aria&&x.aria!==x.label?x.aria:void 0,title:x.aria&&x.aria!==x.label?x.shortcut?`${x.aria} (${x.shortcut})`:x.aria:x.tip,className:`menu-item ${v===j?"active":""} ${x.danger?"danger":""}`,disabled:x.disabled,onMouseEnter:()=>S(j),onClick:()=>{o(),x.run()},children:[n.icons&&s.jsx("span",{className:"menu-icon",children:x.icon&&s.jsx(F,{name:x.icon})}),x.note?s.jsxs("span",{className:"menu-label menu-two",children:[s.jsxs("span",{children:[x.dot&&s.jsx("span",{className:"menu-dot","aria-hidden":"true"}),x.label]}),s.jsx("span",{className:"menu-note",children:x.note})]}):s.jsxs("span",{className:"menu-label",children:[x.dot&&s.jsx("span",{className:"menu-dot","aria-hidden":"true"}),x.label]}),x.check!==void 0&&s.jsx("span",{className:`menu-check ${x.check?"on":""}`,"aria-hidden":"true",children:s.jsx(F,{name:"check",size:14})}),x.shortcut&&s.jsx("kbd",{children:x.shortcut})]},j))]})}function Z0({it:n,icons:o,active:r,onHover:f,onClose:m}){return s.jsxs("button",{role:n.check===void 0?"menuitem":"menuitemcheckbox","aria-checked":n.check===void 0?void 0:n.check,"aria-label":n.aria&&n.aria!==n.label?n.aria:void 0,className:`menu-item ${r?"active":""} ${n.danger?"danger":""}`,disabled:n.disabled,title:n.aria&&n.aria!==n.label?n.aria:n.tip,onMouseEnter:f,onClick:()=>{m(),n.run()},children:[o&&s.jsx("span",{className:"menu-icon",children:n.icon&&s.jsx(F,{name:n.icon})}),s.jsxs("span",{className:"menu-label",children:[n.dot&&s.jsx("span",{className:"menu-dot","aria-hidden":"true"}),n.label]}),n.check!==void 0&&s.jsx("span",{className:`menu-check ${n.check?"on":""}`,"aria-hidden":"true",children:s.jsx(F,{name:"check",size:14})})]})}function F0({state:n,onClose:o}){const[r,f]=b.useState(""),[m,p]=b.useState(!1),v=b.useRef(null),S=b.useRef(null);if(b.useEffect(()=>{var x;n&&(n.kind==="prompt"?(f(n.value),p(((x=n.extra)==null?void 0:x.checked)??!1),setTimeout(()=>{var j;return(j=v.current)==null?void 0:j.select()},0)):setTimeout(()=>{var j;return(j=S.current)==null?void 0:j.focus()},0))},[n]),!n)return null;const N=()=>{n.kind==="prompt"?n.resolve(null):n.resolve(!1),o()},E=()=>{n.kind==="prompt"?n.resolve({value:r,extra:m}):n.resolve(!0),o()};return s.jsx("div",{className:"dialog-backdrop",onPointerDown:x=>x.target===x.currentTarget&&N(),children:s.jsxs("div",{className:"dialog",role:"dialog","aria-modal":"true","aria-label":n.title,onKeyDown:x=>{x.key==="Escape"&&N(),x.key==="Enter"&&!x.nativeEvent.isComposing&&E()},children:[s.jsx("h2",{children:n.title}),n.kind==="prompt"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"dialog-field",children:[n.label&&s.jsx("span",{children:n.label}),s.jsx("input",{ref:v,value:r,onChange:x=>f(x.target.value)})]}),n.hint&&s.jsx("p",{className:"muted",children:n.hint}),n.extra&&s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:m,onChange:x=>p(x.target.checked)}),n.extra.label]})]}):s.jsx("p",{children:n.body}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:N,children:d.dialog.cancel}),s.jsx("button",{ref:S,className:n.kind==="confirm"&&n.danger?"danger primary":"primary",onClick:E,children:n.ok})]})]})})}function Q0(){const[n,o]=b.useState(null);return{state:n,close:()=>o(null),prompt:m=>new Promise(p=>o({kind:"prompt",value:m.value??"",ok:m.ok??d.dialog.ok,...m,resolve:p})),confirm:m=>new Promise(p=>o({kind:"confirm",ok:m.ok??d.dialog.ok,...m,resolve:p}))}}const Hy=n=>`design-canvas:open:${n}`;function Nu({id:n,title:o,count:r,defaultOpen:f=!1,right:m,variant:p="head",children:v}){const[S,N]=b.useState(()=>{try{const M=localStorage.getItem(Hy(n));return M==null?f:M==="1"}catch{return f}}),E=()=>{N(M=>{try{localStorage.setItem(Hy(n),M?"0":"1")}catch{}return!M})},j=r!==void 0&&r!==""&&s.jsx("span",{className:`collapsible-count ${typeof r=="string"?"oc-off":""}`,children:r});return p==="row"?s.jsxs("div",{className:`pp-foldset ${S?"open":""}`,children:[s.jsxs("button",{className:"pp-fold","aria-expanded":S,"aria-controls":`sec-${n}`,onClick:E,children:[s.jsx("span",{className:"pp-l",children:o}),s.jsxs("span",{className:"pp-v",children:[j,s.jsx(F,{name:"chevronRight",size:14,className:"chev"})]})]}),S&&s.jsx("div",{className:"pp-fold-body",id:`sec-${n}`,children:v})]}):s.jsxs("section",{className:`pp-group collapsible ${S?"open":""}`,"data-collapsible":n,children:[s.jsxs("div",{className:"collapsible-head",children:[s.jsxs("button",{className:"pp-fold-h","aria-expanded":S,"aria-controls":`sec-${n}`,onClick:E,children:[s.jsx(F,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"collapsible-title",children:o}),j]}),m&&s.jsx("span",{className:"collapsible-right",children:m})]}),S&&s.jsx("div",{className:"pp-fold-body",id:`sec-${n}`,children:v})]})}function es(n,o="button"){var v,S;if(!n)return;const r=Array.from(n.querySelectorAll(o)),f=`${window.innerWidth}|${(v=document.fonts)==null?void 0:v.status}|${((S=n.closest(".app"))==null?void 0:S.className)??""}|${r.map(N=>`${N.className}${N.textContent}`).join("")}`,m=gm.get(n);if(m&&m.key===f&&m.els.length===r.length&&m.els.every((N,E)=>N===r[E]))return;for(const N of r)N.style.width="";const p=r.map(N=>N.getBoundingClientRect().width);r.forEach((N,E)=>{p[E]%1>.01&&(N.style.width=`${Math.ceil(p[E])}px`)}),p.some(N=>N===0)?gm.delete(n):gm.set(n,{key:f,els:r})}const gm=new WeakMap;function Eb(n,o,r=o){const[f,m]=b.useState(null);return b.useLayoutEffect(()=>{const p=n.current;if(!p)return;es(p);let v=Math.max(8,Math.round((o-p.offsetWidth)/2));v+p.offsetWidth>r-8&&(v=Math.max(8,Math.round((r-p.offsetWidth)/2))),v!==f&&m(v)}),f}function rr({c:n}){return s.jsx(s.Fragment,{children:n.map((o,r)=>o.t==="text"?o.v:o.t==="code"?s.jsx("code",{className:o.v.length>24?"long":void 0,children:o.v},r):o.t==="b"?s.jsx("strong",{children:s.jsx(rr,{c:o.c})},r):o.t==="i"?s.jsx("em",{children:s.jsx(rr,{c:o.c})},r):o.t==="a"?s.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",children:s.jsx(rr,{c:o.c})},r):s.jsx("br",{},r))})}function Mb({list:n}){const o=n.items.map((r,f)=>s.jsxs("li",{children:[s.jsx(rr,{c:r.c}),r.sub&&s.jsx(Mb,{list:r.sub})]},f));return n.t==="ol"?s.jsx("ol",{start:n.start,children:o}):s.jsx("ul",{children:o})}function P0({v:n}){const[o,r]=b.useState(!1);return s.jsxs("div",{className:"codeblock",children:[s.jsx("button",{className:"copy",onClick:()=>{var f;return void((f=navigator.clipboard)==null?void 0:f.writeText(n).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)}))},children:s.jsx(Cb,{icon:s.jsx(F,{name:"copy",size:12}),text:o?d.chat.copied:d.chat.copy,alt:o?d.chat.copy:d.chat.copied})}),s.jsx("pre",{children:s.jsx("code",{children:n})})]})}const J0=({b:n})=>n.t==="p"?s.jsx("p",{children:s.jsx(rr,{c:n.c})}):n.t==="h"?s.jsx("p",{className:`md-h h${Math.min(n.level,3)}`,role:"heading","aria-level":n.level,children:s.jsx(rr,{c:n.c})}):n.t==="code"?s.jsx(P0,{v:n.v}):n.t==="hr"?s.jsx("hr",{}):s.jsx(Mb,{list:n});function I0({text:n,className:o=""}){const r=b.useMemo(()=>G0(n),[n]);return s.jsx("div",{className:`md ${o}`,children:r.map((f,m)=>s.jsx(J0,{b:f},m))})}const cr={claude:"Claude Code",codex:"Codex",cursor:"Cursor Agent",gemini:"Gemini CLI"},W0=Object.entries(cr).map(([n,o])=>({id:n,label:o,ok:!0})),e1={claude:"claude",codex:"codex",cursor:"cursor-agent",gemini:"gemini"},Ly={claude:"claude auth login",codex:"codex login",cursor:"cursor-agent login",gemini:"gemini"},t1={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"},n1={claude:["opus","sonnet","haiku"],codex:[],cursor:[],gemini:["gemini-2.5-pro","gemini-2.5-flash"]},nf={changed:0,added:1,removed:2},a1=n=>cr[n]?`var(--agent-${n})`:"var(--line-strong)",_y=(n,o)=>{try{const r=localStorage.getItem(n);return r==null?o:JSON.parse(r)}catch{return o}},Uy=(n,o)=>{try{localStorage.setItem(n,JSON.stringify(o))}catch{}},qy=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),Vy=n=>new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}),l1=n=>(n.split(/[\\/]/).filter(Boolean).pop()??n)+"/";function ym({text:n}){return s.jsx(s.Fragment,{children:n.split("`").map((o,r)=>r%2?s.jsx("code",{children:o},r):o)})}function af(n,o){const r=[...n.parts],f=r[r.length-1],m={...n};if(o.kind==="delta")(f==null?void 0:f.t)==="text"?r[r.length-1]={t:"text",text:f.text+o.text}:r.push({t:"text",text:o.text});else if(o.kind==="break")(f==null?void 0:f.t)==="text"&&f.text&&r.push({t:"text",text:""});else if(o.kind==="text")r.push({t:"text",text:o.text});else if(o.kind==="plain")(f==null?void 0:f.t)==="plain"?r[r.length-1]={t:"plain",text:`${f.text}
65
+ ${o.text}`}:r.push({t:"plain",text:o.text});else if(o.kind==="tool")r.push({t:"tool",name:o.name,detail:o.detail});else if(o.kind==="permission"){const{kind:p,...v}=o,S=r.findIndex(N=>N.t==="perm"&&N.id===o.id);S>=0?r[S]={...r[S],...v}:r.push({t:"perm",...v})}else if(o.kind==="permission-answered"){const p=r.findIndex(v=>v.t==="perm"&&v.id===o.id);p>=0&&(r[p]={...r[p],decision:o.decision})}else if(o.kind==="error"&&o.cause){for(let p=r.length-1;p>=0;p--)r[p].t==="error"&&r.splice(p,1);r.push({t:"error",text:o.text,cause:o.cause,raw:o.raw,changed:o.changed})}else o.kind==="error"?r.push({t:"error",text:o.text}):o.kind==="done"?m.cost=o.cost:o.kind==="start"?m.variants=o.variants:o.kind==="run-undo"?m.undone=o.undone:o.kind==="end"&&(m.status=o.status,m.step=o.step,m.boards=o.boards);return m.parts=r.filter(p=>p.t!=="text"&&p.t!=="plain"||p.text),m}function s1(n){const[o,r]=b.useState([]),[f,m]=b.useState(!1),[p,v]=b.useState(null),[S,N]=b.useState(!1),[E,x]=b.useState(null),[j,M]=b.useState(!1),[$,L]=b.useState(()=>_y("design-canvas:models",{})),[I,k]=b.useState(!1),[_,W]=b.useState(null),[X,ne]=b.useState(()=>{try{return localStorage.getItem("design-canvas:agent")??"claude"}catch{return"claude"}}),[te,ie]=b.useState([]),[le,he]=b.useState(null),[ce,pe]=b.useState({}),[we,Ze]=b.useState(!0),[Ce,Nt]=b.useState(!0),[at,me]=b.useState(!0),[ke,$e]=b.useState(1),[qe,fe]=b.useState(null),[re,Fe]=b.useState(null),[ht,D]=b.useState(null),[Y,ue]=b.useState(null),[ge,De]=b.useState(!1),[He,G]=b.useState({}),[de,xe]=b.useState(null),[Kt,Ge]=b.useState(null),[Wt,Zt]=b.useState(null),[rt,Ye]=b.useState(null),mn=b.useRef(null),en=b.useRef(null),Pn=b.useRef(null),ut=b.useRef(null),Gn=b.useRef(null),B=b.useRef(null);B.current=le;const K=b.useRef(new Map),ae=n.storeKey?`easel:chat:${n.storeKey}`:null,Oe=b.useRef(0),Le=b.useCallback((z=!1)=>{m(!0);const P=++Oe.current;Te.get("/api/agents").then(_e=>{P===Oe.current&&(r(_e.agents),v({at:_e.checkedAt,onOpen:z}))}).catch(()=>{}).finally(()=>P===Oe.current&&m(!1))},[]);b.useEffect(()=>{n.open&&Le(!0)},[n.open,Le]),b.useEffect(()=>{try{localStorage.setItem("design-canvas:agent",X)}catch{}},[X]),b.useEffect(()=>Uy("design-canvas:models",$),[$]),b.useEffect(()=>{if(!S)return;const z=_e=>{const ye=Me=>Me.current&&_e.target instanceof Node&&Me.current.contains(_e.target);ye(Pn)||ye(ut)||N(!1)},P=()=>N(!1);return window.addEventListener("pointerdown",z,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("pointerdown",z,!0),window.removeEventListener("resize",P)}},[S]),b.useEffect(()=>{var z,P;S&&((P=(z=ut.current)==null?void 0:z.querySelector('[aria-checked="true"], [role^="menuitem"]'))==null||P.focus())},[S]);const tt=()=>{var z,P;N(!1),(P=(z=Pn.current)==null?void 0:z.querySelector(".agent-btn"))==null||P.focus()},mt=z=>{if(z.key==="Escape")return tt();if(z.key!=="Tab"||!ut.current)return;const P=Array.from(ut.current.querySelectorAll("button:not(:disabled), a[href]"));z.target===P[z.shiftKey?0:P.length-1]&&(z.preventDefault(),tt())},vt=z=>{const P=z.getBoundingClientRect();x({right:Math.round(window.innerWidth-P.right),top:Math.round(P.bottom+4)}),N(_e=>!_e)},rn=(z,P)=>{var _e;(_e=navigator.clipboard)==null||_e.writeText(P).then(()=>{W(z),window.setTimeout(()=>W(ye=>ye===z?null:ye),1500)})},tn=b.useRef(new Set),It=b.useRef(new Map),Yn=b.useRef(()=>{});b.useEffect(()=>n.subscribe((z,P)=>{if(P.kind==="boot")return D(P.boot);if(!tn.current.has(z)){It.current.set(z,[...It.current.get(z)??[],P]);return}Yn.current(z,P)}),[n.subscribe]),Yn.current=(z,P)=>{if(ie(ye=>ye.map(Me=>Me.role==="ai"&&Me.id===z?af(Me,P):Me)),P.kind==="end"&&n.onRunEnd){const ye=te.find(Ve=>Ve.role==="ai"&&Ve.id===z),Me=ye?af(ye,P):null,Lt=((Me==null?void 0:Me.parts)??[]).filter(Ve=>Ve.t==="text").map(Ve=>Ve.text).join("").trim();n.onRunEnd({id:z,status:P.status,reply:Lt,files:(P.boards??(Me==null?void 0:Me.boards)??[]).map(Ve=>Ve.file)})}if(P.kind==="end"&&he(ye=>ye===z?null:ye),P.kind==="session"){const ye=te.find(Me=>Me.role==="ai"&&Me.id===z);ye&&pe(Me=>({...Me,[ye.agent]:P.id}))}P.kind==="error"&&(P.cause==="signin"||P.cause==="missing")&&Le();const _e=K.current.get(z);P.kind==="end"&&P.status==="error"&&_e&&!n.draft.trim()&&!n.attach.comments.length&&!n.attach.refs.length&&(n.setDraft(_e.text),n.setAttach(()=>_e.attach),k(!0))},b.useEffect(()=>{Te.get("/api/chat/runs?ids=").then(z=>D(P=>P??z.boot)).catch(()=>{})},[]),b.useEffect(()=>{var P;if(!ae||ge)return;const z=_y(ae,null);(P=z==null?void 0:z.msgs)!=null&&P.length&&(ie(z.msgs),pe(z.sessions??{})),ue((z==null?void 0:z.boot)??null),De(!0)},[ae,ge]),b.useEffect(()=>{ge&&ae&&Uy(ae,{msgs:te.slice(-100),sessions:ce,boot:ht??Y})},[ge,ae,te,ce,ht,Y]),b.useEffect(()=>{if(!ge||!ht)return;const z=!!Y&&Y!==ht;ue(ht),ie(ye=>{if(!z||!ye.length)return ye;const Me=ye.map(Lt=>Lt.role==="ai"&&Lt.status==="running"?{...Lt,status:"cancelled"}:Lt);return Me[Me.length-1].role==="restart"?Me:[...Me,{role:"restart",at:ht}]});const P=te.filter(ye=>ye.role==="ai");for(const ye of P)ye.status==="running"&&!z&&!tn.current.has(ye.id)&&Te.get(`/api/chat?id=${encodeURIComponent(ye.id)}`).then(Me=>{tn.current.add(ye.id),ie(Lt=>Lt.map(Ve=>Ve.role==="ai"&&Ve.id===ye.id?Me.events.reduce(af,{...Ve,parts:[]}):Ve)),Me.events.some(Lt=>Lt.kind==="end")||he(ye.id)});const _e=P.filter(ye=>ye.step).map(ye=>ye.id);_e.length&&Te.get(`/api/chat/runs?ids=${_e.join(",")}`).then(ye=>G(Me=>({...Me,...ye.runs}))).catch(()=>{})},[ge,ht]),b.useEffect(()=>{const z=mn.current;z&&z.scrollHeight-z.scrollTop-z.clientHeight<160&&(z.scrollTop=z.scrollHeight)},[te]);const Qe=we?n.selection:null,Mn=Ce?n.boards:[],ln=Mn.length===1||!Mn.length&&!!Qe,st=o.length?o:W0,St=st.find(z=>z.id===X),$t=(St==null?void 0:St.label)??cr[X]??X,Ct=X.startsWith("custom:"),cl=$[X]??"",rl=(St==null?void 0:St.status)==="signin"?d.chat.sendNeedsSignin($t):(St==null?void 0:St.status)==="missing"?d.chat.sendNeedsInstall($t):null,io=te.find(z=>z.role==="ai"&&z.id===le),ii=!!(io!=null&&io.parts.some(z=>z.t==="perm"&&!z.decision)),va=async(z=n.draft.trim(),P=n.attach,_e=!1)=>{if(!z)return{error:""};if(le)return{error:d.chat.running};if(rl)return{error:rl};Fe(null);const ye=[...Qe?[d.chat.chipElement(Qe.tag)]:[],...Mn.map(Me=>n.titleOf(Me)),...at&&n.visibleCount?[d.chat.chipVisible(n.visibleCount)]:[],...P.comments.map(Me=>d.chat.chipComment(Me.text.slice(0,16))),...P.refs.map(Me=>Me.name??Me.value),...ke>1?[d.chat.variants(ke)]:[]];try{const Me=await Te.post("/api/chat",{agent:X,text:z,model:Ct?void 0:cl.trim()||void 0,resume:ce[X],variants:ln?ke:0,attach:{selection:!!Qe,boards:Mn,visible:at,comments:P.comments.map(Lt=>Lt.id),refs:P.refs}});K.current.set(Me.id,{text:z,attach:P}),k(!1),ie(Lt=>[...Lt,{role:"user",text:z,chips:ye},{role:"ai",id:Me.id,agent:X,label:$t,parts:[],status:"running",boot:ht??void 0}]),he(Me.id),tn.current.add(Me.id);for(const Lt of It.current.get(Me.id)??[])Yn.current(Me.id,Lt);return It.current.delete(Me.id),_e||(n.setDraft(""),n.setAttach(()=>({comments:[],refs:[]}))),$e(1),Me.variants.length&&n.onLocate(Me.variants),{id:Me.id}}catch(Me){return Fe(Me.message),{error:Me.message}}};n.handle&&(n.handle.current={send:z=>va(z,{comments:[],refs:[]},!0),undo:z=>xa(z,"undo"),check:()=>Le(),agent:X,label:$t,model:cl,isCustom:Ct,setModel:z=>L(P=>({...P,[X]:z})),openAgentMenu:z=>{Le(),x(z),N(!0)},running:le});const ul=()=>le&&Te.post("/api/chat/cancel",{id:le}).catch(()=>{}),ia=z=>{const P=K.current.get(z);n.draft.trim()||!P?va():va(P.text,P.attach)},Ta=(z,P)=>ie(_e=>_e.map(ye=>ye.role==="ai"&&ye.id===z?P(ye):ye)),pn=(z,P,_e)=>{Ta(z,ye=>af(ye,{kind:"permission-answered",id:P,decision:_e})),Te.post("/api/chat/permission/answer",{id:P,decision:_e}).catch(ye=>Fe(ye.message))},xa=async(z,P,_e)=>{var ye;Ge(z);try{await Te.post(`/api/chat/${P}-run`,{id:z,mode:_e}),xe(null),Ta(z,Me=>({...Me,undone:P==="undo"}))}catch(Me){const Lt=Me;Lt.status===409&&((ye=Lt.body)!=null&&ye.conflicts)?xe({id:z,kind:P,names:[...new Set(Lt.body.conflicts.map(Ve=>Ve.file.endsWith(".html")?n.titleOf(Ve.file):Ve.file))]}):Fe(Lt.message)}finally{Ge(null)}},ts=async(z,P)=>{if(await n.confirm({title:d.chat.restoreTitle,body:d.chat.restoreBody(Vy(P)),ok:d.chat.restoreOk,danger:!0}))try{await Te.post("/api/chat/revert",{id:z.id}),Ta(z.id,_e=>({..._e,restored:!0}))}catch(_e){Fe(_e.message)}},Os=z=>Zt({id:z.id,boards:[...z.boards??[]].sort((P,_e)=>nf[P.kind]-nf[_e.kind]).map(P=>({...P,title:n.titleOf(P.file),...n.sizeOf(P.file)??{w:390,h:844}}))}),ns=async()=>{if(rt)try{const z=await Te.post("/api/agents/custom",{name:rt.name,command:rt.command});r(P=>[...P.filter(_e=>_e.id!==z.agent.id),z.agent]),ne(z.agent.id),Ye(null)}catch(z){Ye(P=>P&&{...P,error:z.message})}},Qa=async z=>{await Te.post("/api/agents/custom",{action:"delete",id:z}).catch(()=>{}),r(P=>P.filter(_e=>_e.id!==z)),X===z&&ne("claude")},Rs=z=>z.status?d.chat.agentStatus[z.status]:f?d.chat.checking:"",Ht=(St==null?void 0:St.status)==="signin"?{text:d.chat.remedySignin($t,Ly[X]??`${X} login`),cmd:Ly[X]??`${X} login`}:(St==null?void 0:St.status)==="missing"?{text:d.chat.remedyMissing(Ct?(St.command??"").split(/\s+/)[0]:e1[X]??X),cmd:Ct?null:t1[X]??X}:null,as=async z=>{for(const P of Array.from(z)){if(P.size>15*1024*1024){Fe(d.chat.tooBig(P.name));continue}const _e=await new Promise(ye=>{const Me=new FileReader;Me.onload=()=>ye(String(Me.result).split(",")[1]??""),Me.readAsDataURL(P)});try{const ye=await Te.post("/api/refs",{name:P.name||d.defaults.pastedImage,data:_e});n.setAttach(Me=>({...Me,refs:[...Me.refs,ye]}))}catch(ye){Fe(ye.message)}}},kt=z=>{const P=[...z.boards??[]].sort((Ot,nn)=>nf[Ot.kind]-nf[nn.kind]),_e=P.filter(Ot=>Ot.kind!=="added").length,ye=P.filter(Ot=>Ot.kind==="added").length,Me=d.chat.runChanged(_e,ye),Lt=!!ht&&!!z.boot&&z.boot!==ht,Ve=He[z.id],sn=(de==null?void 0:de.id)===z.id?de: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(F,{name:"restore",size:14})," ",d.chat.restoredCopy]})})});if(Lt)return s.jsxs("div",{className:"run-result",children:[s.jsx("div",{className:"oc-rr-top",children:s.jsx("span",{className:"rr-line",children:Me})}),Ve===void 0?null:Ve.copy?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",onClick:()=>void ts(z,Ve.copy.at),children:[s.jsx(F,{name:"restore",size:14})," ",d.chat.restoreCopy]})}),s.jsx("p",{className:"sub",children:d.chat.savedAt(Vy(Ve.copy.at))})]}):s.jsx("p",{className:"sub",children:d.chat.copyGone})]});const Ra=sn&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:(sn.kind==="undo"?d.chat.conflictUndo:d.chat.conflictRedo)(sn.names.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",onClick:()=>void xa(z.id,sn.kind,"rest"),children:sn.kind==="undo"?d.chat.undoRest:d.chat.redoRest}),s.jsx("button",{className:"btn danger",onClick:()=>void xa(z.id,sn.kind,"all"),children:sn.kind==="undo"?d.chat.undoAll:d.chat.redoAll}),s.jsx("button",{className:"btn",onClick:()=>xe(null),children:d.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(F,{name:"undo",size:14})," ",d.chat.runUndone(P.length)]})}),s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",disabled:Kt===z.id||!!le,onClick:()=>void xa(z.id,"redo"),children:[s.jsx(F,{name:"redo",size:14})," ",d.chat.redo]})}),Ra]}):s.jsxs("div",{className:"run-result",children:[s.jsxs("div",{className:"oc-rr-top",children:[s.jsx("span",{className:"rr-line",children:Me}),P.map(Ot=>Ot.kind==="removed"?s.jsxs("span",{className:"chip",children:[s.jsx(F,{name:"board",size:12})," ",d.chat.chipRemoved(n.titleOf(Ot.file))]},Ot.file):s.jsxs("button",{className:"chip",title:Ot.file,onClick:()=>n.onLocate([Ot.file]),children:[s.jsx(F,{name:"board",size:12})," ",Ot.kind==="added"?d.chat.chipNew(n.titleOf(Ot.file)):n.titleOf(Ot.file)]},Ot.file))]}),s.jsxs("div",{className:"btn-row",children:[s.jsxs("button",{className:"btn",disabled:Kt===z.id||!!le,onClick:()=>void xa(z.id,"undo"),children:[s.jsx(F,{name:"undo",size:14})," ",d.chat.undoRun]}),P.length>0&&s.jsxs("button",{className:"btn",onClick:()=>Os(z),children:[s.jsx(F,{name:"compare",size:14})," ",d.chat.compare]})]}),Ra]})},Fi=(z,P)=>P.decision?s.jsxs("div",{className:"perm-done",title:P.subject,children:[s.jsx(F,{name:P.decision==="deny"?"close":"check",size:14,className:P.decision==="deny"?"no":"ok"}),s.jsxs("span",{children:[d.chat.permDone[P.decision]," · ",P.tool," ",P.what==="tool"?null:s.jsx("code",{children:P.subject}),P.outside?` ${d.chat.permDoneOutside}`:""]})]}):s.jsxs("div",{className:"perm",role:"group","aria-label":d.chat.permAsk(z.label??cr[z.agent]??z.agent,P.what,P.tool),children:[s.jsxs("div",{className:"perm-head",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),d.chat.permAsk(z.label??cr[z.agent]??z.agent,P.what,P.tool)]}),s.jsx("div",{className:"perm-cmd",children:P.subject}),s.jsxs("div",{className:"perm-where",title:P.where,children:[s.jsx(F,{name:"folder",size:14})," ",d.chat.permIn," ",s.jsx("code",{children:l1(P.where)}),P.outside&&s.jsxs("span",{className:"perm-outside",children:["· ",d.chat.permOutside]})]}),s.jsxs("div",{className:`btn-row ${P.rule?"":"oc-one"}`,children:[s.jsx("button",{className:"btn primary",onClick:()=>pn(z.id,P.id,"once"),children:d.chat.allowOnce}),P.rule&&s.jsx("button",{className:"btn",title:d.chat.alwaysAllowTitle,onClick:()=>pn(z.id,P.id,"always"),children:d.chat.alwaysAllow(P.rule)}),s.jsx("button",{className:"btn",onClick:()=>pn(z.id,P.id,"deny"),children:d.chat.deny})]})]}),Ou=te.map(z=>z.role==="ai"?`${z.status}${z.undone?"u":""}${z.restored?"r":""}${z.parts.length}`:z.role).join(),Et=b.useCallback(()=>{es(Gn.current,".chat-head .new-chat, .rr-line, .chip, .bubble, .btn-row .btn, .oc-variants, .run-status > *"),es(ut.current,".agent-status, .menu-foot .btn")},[]);b.useLayoutEffect(Et,[Et,Ou,le,X,S,n.open,n.attach,n.selection,n.boards,n.visibleCount,_,He,de,f,o,we,Ce,at]),b.useEffect(()=>{const z=Gn.current;if(!z)return;const P=new ResizeObserver(Et);return P.observe(z),()=>P.disconnect()},[Et]);const Oa=(z,P)=>{const _e=[];let ye=[],Me=0;const Lt=()=>{ye.length&&_e.push(s.jsx("div",{className:"oc-tools",children:ye},`t${Me}`)),ye=[]};return z.parts.forEach((Ve,sn)=>{if(Ve.t==="tool"||Ve.t==="perm"&&Ve.decision){ye.length||(Me=sn);const Ra=z.status==="running"&&sn===z.parts.length-1;ye.push(Ve.t==="tool"?s.jsxs("div",{className:`ai-tool ${Ra?"is-current":""}`,children:[s.jsx(F,{name:"edit",size:14}),s.jsx("span",{children:Ve.name}),Ve.detail&&s.jsx("code",{children:Ve.detail})]},sn):s.jsx(b.Fragment,{children:Fi(z,Ve)},sn));return}Lt(),_e.push(Ve.t==="text"?s.jsx(I0,{className:"ai-text",text:Ve.text},sn):Ve.t==="plain"?s.jsx("pre",{className:"ai-plain",children:Ve.text},sn):Ve.t==="perm"?s.jsx(b.Fragment,{children:Fi(z,Ve)},sn):Ve.cause?s.jsxs("div",{className:"ai-fail",children:[s.jsx("div",{className:"ai-error",children:s.jsx("span",{children:s.jsx(ym,{text:Ve.text})})}),P&&s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",disabled:!!le||!!rl,title:rl??void 0,onClick:()=>ia(z.id),children:d.chat.retry}),(()=>{const Ra=st.find(Ot=>Ot.id!==z.agent&&Ot.status!=="missing"&&Ot.ok&&!Ot.custom);return Ra&&Ra.id!==X?s.jsx("button",{className:"btn",onClick:()=>ne(Ra.id),children:d.chat.switchTo(Ra.label)}):null})()]}),Ve.raw&&s.jsxs("details",{className:"ai-details",children:[s.jsxs("summary",{children:[s.jsx(F,{name:"chevronDown",size:14}),d.chat.details]}),s.jsx("div",{className:"ai-details-bar",children:s.jsx("button",{className:"btn copy",onClick:()=>rn(`raw-${z.id}`,Ve.raw),children:s.jsx(Cb,{icon:s.jsx(F,{name:"copy",size:12}),text:_===`raw-${z.id}`?d.chat.copied:d.chat.copy,alt:_===`raw-${z.id}`?d.chat.copy:d.chat.copied})})}),s.jsx("pre",{children:Ve.raw})]}),Ve.changed===!1&&s.jsx("p",{className:"muted small",children:d.chat.noFilesChanged})]},sn):s.jsxs("div",{className:"ai-error",children:[s.jsx(F,{name:"warn",size:14})," ",Ve.text]},sn))}),Lt(),_e};return s.jsxs("section",{className:"chat","aria-label":d.chat.aria,ref:Gn,children:[s.jsxs("div",{className:`chat-head ${j?"is-scrolled":""}`,children:[!n.settingsElsewhere&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:d.chat.agent}),s.jsx("div",{className:"agent-pick",ref:Pn,children:s.jsxs("button",{className:`agent-btn ${S?"is-open":""}`,"aria-haspopup":"menu","aria-expanded":S,"aria-label":d.chat.agentButton($t,St?Rs(St):""),title:d.chat.agentHint,disabled:!!le,onClick:z=>vt(z.currentTarget),onKeyDown:z=>z.key==="Escape"&&N(!1),children:[s.jsx("span",{className:`dot ${(St==null?void 0:St.status)??""}`,"aria-hidden":"true"}),s.jsx("span",{className:"agent-name",children:$t}),s.jsx(F,{name:"chevronDown",size:14})]})})]}),s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:Ct?d.chat.customCommandLabel:d.chat.model}),Ct?s.jsx("span",{className:"model-field mono custom-cmd",title:St==null?void 0:St.command,children:St==null?void 0:St.command}):s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"model-field",list:`models-${X}`,value:cl,placeholder:d.chat.modelDefault,"aria-label":d.chat.model,title:d.chat.modelTitle($t),disabled:!!le,spellCheck:!1,onChange:z=>L(P=>({...P,[X]:z.target.value}))}),s.jsx("datalist",{id:`models-${X}`,children:(n1[X]??[]).map(z=>s.jsx("option",{value:z},z))})]})]})]}),s.jsxs("div",{className:"chat-head-row sub",children:[s.jsx("span",{className:"muted small",children:le?d.chat.running:ce[X]?d.chat.continuing:d.chat.newConversation}),s.jsx("div",{className:"spacer"}),s.jsxs("button",{className:"icon-btn sm new-chat","aria-label":d.chat.newChat,title:d.chat.newChat,disabled:!!le||!te.length&&!ce[X],onClick:()=>{ie([]),pe({}),k(!1),xe(null),M(!1)},children:[s.jsx(F,{name:"plus",size:14})," ",s.jsx("span",{children:d.chat.newChat})]})]})]}),S&&E&&pm.createPortal(s.jsxs("div",{ref:ut,className:"menu agent-menu oc-agent-menu entering",role:"menu","aria-label":d.chat.agent,style:{right:E.right,top:E.top},onKeyDown:mt,children:[st.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===X,className:"agent-choose",title:z.custom&&z.command?d.chat.customCommandTitle(z.command):void 0,onClick:()=>{ne(z.id),N(!1)},children:[s.jsx("span",{className:`menu-check ${z.id===X?"on":""}`,"aria-hidden":"true",children:s.jsx(F,{name:"check",size:14})}),s.jsx("span",{className:"idot",style:{background:a1(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"}),Rs(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:d.chat.howToInstall})]})]}),z.custom&&s.jsx("button",{className:"icon-btn sm oc-remove","aria-label":d.chat.remove(z.label),title:d.chat.remove(z.label),onClick:()=>void Qa(z.id),children:s.jsx(F,{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),Ye({name:"",command:""})},children:[s.jsx("span",{className:"menu-check on muted","aria-hidden":"true",children:s.jsx(F,{name:"plus",size:14})}),s.jsx("span",{className:"menu-label",children:d.chat.customCommand})]}),s.jsxs("div",{className:"menu-foot",children:[s.jsx("span",{children:f?d.chat.checking:p?d.chat.checkedAt(qy(p.at),p.onOpen):d.chat.checkedOnOpen}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>Le(),children:d.chat.checkAgain})]})]}),document.body),rt&&pm.createPortal(s.jsx("div",{className:"dialog-backdrop",onPointerDown:z=>z.target===z.currentTarget&&Ye(null),children:s.jsxs("div",{className:"dialog cf",role:"dialog","aria-modal":"true","aria-label":d.chat.customTitle,onKeyDown:z=>z.key==="Escape"&&Ye(null),children:[s.jsxs("h2",{className:"cf-title",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),d.chat.customTitle]}),s.jsxs("label",{className:"dialog-field",children:[d.chat.customName,s.jsx("input",{autoFocus:!0,value:rt.name,placeholder:d.chat.customNamePlaceholder,onChange:z=>Ye({...rt,name:z.target.value,error:void 0})})]}),s.jsxs("label",{className:"dialog-field",children:[d.chat.customCommandLabel,s.jsx("input",{className:"mono",value:rt.command,spellCheck:!1,placeholder:d.chat.customCommandPlaceholder,onChange:z=>Ye({...rt,command:z.target.value,error:void 0}),onKeyDown:z=>z.key==="Enter"&&!z.nativeEvent.isComposing&&void ns()})]}),s.jsx("p",{className:"cf-hint",children:s.jsx(ym,{text:d.chat.customHint})}),rt.error&&s.jsxs("p",{className:"cf-error",children:[s.jsx(F,{name:"warn",size:14})," ",rt.error]}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:()=>Ye(null),children:d.chat.cancel}),s.jsx("button",{className:"primary",disabled:!rt.name.trim()||!rt.command.trim(),onClick:()=>void ns(),children:d.chat.customSave})]})]})}),document.body),s.jsx("div",{className:"chat-list",ref:mn,"aria-live":"polite",onScroll:z=>M(z.currentTarget.scrollTop>0),children:te.length===0?s.jsxs("div",{className:"chat-empty",children:[s.jsx("p",{children:d.chat.intro($t)}),s.jsx("div",{className:"chat-suggest",children:d.chat.suggestions.map(z=>s.jsx("button",{className:"btn",onClick:()=>{n.setDraft(z.text),$e(z.n)},children:z.label},z.label))})]}):te.map((z,P)=>{var _e;return z.role==="restart"?s.jsx("div",{className:"restart",role:"separator",children:d.chat.restarted(qy(z.at))},P):z.role==="user"?s.jsxs("div",{className:"msg user",children:[z.chips.length>0&&s.jsx("div",{className:"chips",children:z.chips.map((ye,Me)=>s.jsx("span",{className:"chip",children:ye},Me))}),s.jsx("div",{className:"bubble",children:z.text})]},P):s.jsxs("div",{className:`msg ai ${z.status}`,children:[s.jsxs("div",{className:"msg-head",children:[s.jsx("strong",{children:z.label??cr[z.agent]??z.agent}),z.status==="running"&&(z.parts.some(ye=>ye.t==="perm"&&!ye.decision)?s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),d.chat.waiting]}):s.jsx("span",{className:"spinner",role:"img","aria-label":d.chat.running})),z.status==="cancelled"&&s.jsx("span",{className:"muted",children:d.chat.cancelled}),z.status==="error"&&s.jsxs("span",{className:"oc-failed",children:[s.jsx(F,{name:"warn",size:14}),d.chat.failed]}),z.status==="done"&&z.cost!=null&&s.jsxs("span",{className:"muted small",children:["$",z.cost.toFixed(3)]})]}),(_e=z.variants)!=null&&_e.length?s.jsxs("button",{className:"btn oc-variants",onClick:()=>n.onLocate(z.variants),children:[s.jsx(F,{name:"board",size:14})," ",d.chat.madeVariants(z.variants.length)]}):null,Oa(z,P===te.length-1),z.status==="running"&&!z.parts.length&&s.jsx("div",{className:"muted oc-thinking",children:d.chat.thinking}),d.chat.noPause[z.agent]&&z.parts.some(ye=>ye.t==="tool")&&s.jsx("p",{className:"ai-note",children:d.chat.noPause[z.agent]}),z.status!=="running"&&z.step&&kt(z)]},P)})}),Ht&&s.jsxs("div",{className:"remedy",role:"status",children:[s.jsx(F,{name:"warn",size:16}),s.jsxs("div",{children:[s.jsx("p",{children:s.jsx(ym,{text:Ht.text})}),s.jsxs("div",{className:"btn-row",children:[Ht.cmd&&s.jsxs("button",{className:"btn",onClick:()=>rn("cmd",Ht.cmd),title:Ht.cmd,children:[s.jsx(F,{name:"copy",size:14})," ",_==="cmd"?d.chat.copied:d.chat.copyCommand]}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>Le(),children:f?d.chat.checking:d.chat.checkAgain})]})]})]}),s.jsxs("div",{className:"composer",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.dataTransfer.files.length&&as(z.dataTransfer.files)},children:[ii&&s.jsxs("div",{className:"run-status",role:"status",children:[s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),d.chat.waiting]}),s.jsxs("span",{className:"muted",children:["· ",d.chat.waitingHint]})]}),s.jsxs("div",{className:"chips",children:[n.selection&&s.jsx(yu,{on:we,onToggle:()=>Ze(z=>!z),icon:"select",label:d.chat.chipElementText(n.selection.tag,n.selection.text.slice(0,14))}),n.boards.length>0&&s.jsx(yu,{on:Ce,onToggle:()=>Nt(z=>!z),icon:"board",label:n.boards.length===1?n.titleOf(n.boards[0]):d.chat.chipBoards(n.boards.length)}),n.visibleCount>0&&s.jsx(yu,{on:at,onToggle:()=>me(z=>!z),icon:"fit",label:d.chat.chipVisible(n.visibleCount)}),n.attach.comments.map(z=>s.jsx(yu,{on:!0,icon:"comment",label:d.chat.chipComment(z.text.slice(0,14)),onRemove:()=>n.setAttach(P=>({...P,comments:P.comments.filter(_e=>_e.id!==z.id)}))},z.id)),n.attach.refs.map((z,P)=>s.jsx(yu,{on:!0,icon:z.kind==="url"?"link":"file",label:z.name??z.value,onRemove:()=>n.setAttach(_e=>({..._e,refs:_e.refs.filter((ye,Me)=>Me!==P)}))},P))]}),qe!=null&&s.jsx("div",{className:"url-row",children:s.jsx("input",{autoFocus:!0,value:qe,placeholder:"https://","aria-label":d.chat.refLink,onChange:z=>fe(z.target.value),onKeyDown:z=>{z.nativeEvent.isComposing||(z.key==="Enter"&&/^https?:\/\/\S+$/.test(qe.trim())&&(n.setAttach(P=>({...P,refs:[...P.refs,{kind:"url",value:qe.trim()}]})),fe(null)),z.key==="Escape"&&fe(null))}})}),I&&n.draft.trim()&&s.jsx("span",{className:"restored muted small",children:d.chat.restored}),s.jsx("textarea",{ref:n.inputRef,value:n.draft,rows:3,placeholder:le?d.chat.placeholderRunning:d.chat.placeholder,"aria-label":d.chat.input,onChange:z=>n.setDraft(z.target.value),onPaste:z=>{const P=Array.from(z.clipboardData.files);P.length&&(z.preventDefault(),as(P))},onKeyDown:z=>{z.nativeEvent.isComposing||z.keyCode===229||(z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),va()),z.key==="Escape"&&(le?ul():z.target.blur()))}}),re&&s.jsxs("p",{className:"warn small oc-err",children:[s.jsx(F,{name:"warn",size:14})," ",re]}),rl&&!le&&s.jsxs("p",{className:"send-why",children:[s.jsx(F,{name:"warn",size:14})," ",rl]}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("button",{className:"icon-btn sm","aria-label":d.chat.attach,title:d.chat.attachTitle,onClick:()=>{var z;return(z=en.current)==null?void 0:z.click()},children:s.jsx(F,{name:"plus",size:14})}),s.jsx("button",{className:"icon-btn sm","aria-label":d.chat.addLink,title:d.chat.addLink,onClick:()=>fe(""),children:s.jsx(F,{name:"link",size:14})}),s.jsx("input",{ref:en,type:"file",multiple:!0,hidden:!0,accept:"image/*,.pdf,.md,.txt,.html,.csv,.json",onChange:z=>z.target.files&&void as(z.target.files)}),s.jsx("label",{className:"variants",title:ln?d.chat.variantsTitle:d.chat.variantsDisabledTitle,children:s.jsxs("select",{value:ke,disabled:!ln||!!le,onChange:z=>$e(Number(z.target.value)),"aria-label":d.chat.variantsAria,children:[s.jsx("option",{value:1,children:d.chat.variants(1)}),s.jsx("option",{value:2,children:d.chat.variants(2)}),s.jsx("option",{value:3,children:d.chat.variants(3)}),s.jsx("option",{value:4,children:d.chat.variants(4)})]})}),s.jsx("div",{className:"spacer"}),le?s.jsxs("button",{className:"btn oc-cancel",title:d.chat.cancelTitle,onClick:ul,children:[s.jsx(F,{name:"close",size:14})," ",d.chat.cancel]}):s.jsx("button",{className:"primary",disabled:!n.draft.trim()||!!rl,title:rl??void 0,onClick:()=>void va(),children:d.chat.send})]})]}),Wt&&pm.createPortal(s.jsx(Sb,{before:H0(Wt.id),boards:Wt.boards,onClose:()=>Zt(null)}),document.body)]})}function yu({on:n,onToggle:o,onRemove:r,icon:f,label:m}){return s.jsxs("span",{className:`chip ${n?"on":"off"}`,children:[s.jsxs("button",{className:"chip-main",onClick:o,disabled:!o,"aria-pressed":o?n:void 0,title:o?n?d.chat.chipRemoveTitle:d.chat.chipAddTitle:void 0,children:[s.jsx(F,{name:f,size:12}),s.jsx("span",{children:m})]}),r&&s.jsx("button",{className:"chip-x","aria-label":d.chat.remove(m),onClick:r,children:s.jsx(F,{name:"close",size:12})})]})}function o1(n,o,r,f=8){const m=typeof f=="number"?{above:f,below:f}:f;let p=!1,v=n.y-m.above-o.h;if(typeof f!="number"&&f.side==="right"){const S=Math.min(o.h,36),N=Math.max(r.left,Math.min(n.x+n.w+m.above,r.right-o.w)),E=Math.max(r.top,Math.min(n.y+n.h/2-S/2,r.bottom-o.h));return{x:Math.round(N),y:Math.round(E),below:!0}}if(typeof f!="number"&&f.first==="below"&&n.y+n.h+m.below+o.h<=r.bottom)return{...bf(n,o,r),y:Math.round(Math.max(r.top,n.y+n.h+m.below)),below:!0};if(v<r.top){const S=n.y+n.h+m.below;S+o.h<=r.bottom?(v=S,p=!0):v=r.top}return v=Math.max(r.top,Math.min(v,r.bottom-o.h)),{...bf(n,o,r),y:Math.round(v),below:p}}function i1(n,o,r,f,m,p=[],v=24){const S=Math.round(Math.max(f.top,Math.min(n.y+n.h/2-r.h/2,f.bottom-r.h))),N=M=>M>=f.left&&M+r.w<=f.right&&!p.some($=>M<$.x+$.w&&$.x<M+r.w&&S<$.y+$.h&&$.y<S+r.h),E=o.x+o.w+v;if(N(E))return{x:Math.round(E),y:S,below:!0,side:"right"};const x=o.x-v-r.w;if(N(x))return{x:Math.round(x),y:S,below:!0,side:"left"};const j=n.y-8-r.h;return!m&&j>=Math.max(f.top,o.y)?{...bf(n,r,f),y:Math.round(j),below:!1,side:"above"}:{...bf(n,r,f),y:Math.round(Math.max(f.top,Math.min(n.y+n.h+8,f.bottom-r.h))),below:!0,side:"below"}}const bf=(n,o,r)=>({x:Math.round(Math.max(r.left,Math.min(n.x+n.w/2-o.w/2,r.right-o.w)))});function $u(n,o,r,f,m=8,p,v){const S=b.useRef({target:r,bounds:f,gap:m,avoid:p,placer:v});S.current={target:r,bounds:f,gap:m,avoid:p,placer:v};const N=()=>{const E=n.current;if(!E)return;const x=S.current.target();if(!x){E.style.visibility="hidden";return}const j={w:E.offsetWidth,h:E.offsetHeight},M=S.current.placer?S.current.placer(x,j,S.current.bounds):o1(x,j,S.current.bounds,S.current.gap);if(S.current.avoid)for(const $ of document.querySelectorAll(S.current.avoid)){if($===E)break;if($.style.visibility==="hidden")continue;const L=parseFloat($.style.left),I=parseFloat($.style.top);M.x<L+$.offsetWidth&&L<M.x+E.offsetWidth&&M.y<I+$.offsetHeight&&I<M.y+E.offsetHeight&&(M.y=M.below?I+$.offsetHeight+6:I-6-E.offsetHeight)}E.style.left=`${M.x}px`,E.style.top=`${M.y}px`,E.style.visibility="",E.dataset.below=M.below?"true":"false"};return b.useLayoutEffect(N),b.useEffect(()=>o.subscribe(N),[o]),N}const Su={above:28,below:12},ga=d.inline;function c1(n){const o=b.useRef(null),r=b.useRef(null),[f,m]=b.useState(n.initial??""),[p,v]=b.useState(!1),[S,N]=b.useState(null),E=Math.min(380,n.bounds.right-n.bounds.left),x=$u(o,n.store,n.target,n.bounds,n.gap??8);b.useEffect(()=>{var M;return(M=r.current)==null?void 0:M.focus()},[]),b.useEffect(()=>{const M=r.current;M&&(M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,132)}px`,x())},[f]),b.useEffect(()=>{const M=$=>{var L,I;(L=o.current)!=null&&L.contains($.target)||(I=r.current)!=null&&I.value.trim()||n.onClose()};return window.addEventListener("pointerdown",M,!0),()=>window.removeEventListener("pointerdown",M,!0)},[]);const j=async()=>{const M=f.trim();if(!M||p)return;v(!0),N(null);const $=await n.onSend(M);v(!1),$!=null&&N($||null)};return s.jsxs("div",{ref:o,className:"oc-ask oc-anchored",role:"dialog","aria-label":ga.title,style:{width:E},onPointerDown:M=>M.stopPropagation(),children:[s.jsxs("div",{className:"oc-ask-top",children:[s.jsx("span",{className:"oc-ask-about",title:n.about,children:n.about}),n.onHistory&&s.jsx("button",{className:"link oc-ask-history",onClick:n.onHistory,children:ga.history})]}),s.jsxs("div",{className:"oc-ask-row",children:[s.jsx("textarea",{ref:r,rows:1,value:f,placeholder:ga.placeholder,"aria-label":ga.title,onChange:M=>m(M.target.value),onKeyDown:M=>{M.stopPropagation(),!(M.nativeEvent.isComposing||M.keyCode===229)&&(M.key==="Enter"&&!M.shiftKey?(M.preventDefault(),j()):M.key==="Escape"&&(M.preventDefault(),n.onClose()))}}),s.jsx("button",{className:`oc-ask-send ${f.trim()?"is-ready":""}`,disabled:!f.trim()||p,onClick:()=>void j(),children:n.sendLabel??ga.send})]}),S&&s.jsxs("p",{className:"oc-ask-err",children:[s.jsx(F,{name:"warn",size:14})," ",S]})]})}function r1(n){const o=b.useRef(null);return $u(o,n.store,n.target,n.bounds,n.gap??8),s.jsx("div",{ref:o,className:"oc-result oc-anchored is-running",role:"status","aria-label":ga.running,onPointerDown:r=>r.stopPropagation(),children:s.jsxs("div",{className:"oc-result-head",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"}),s.jsx("p",{className:"oc-result-text",children:ga.running}),s.jsx("button",{className:"link oc-result-open",onClick:n.onOpen,children:ga.open})]})})}function u1(n){const o=b.useRef(null),[r,f]=b.useState(!1);$u(o,n.store,n.target,n.bounds,n.gap??8),b.useEffect(()=>{const p=v=>{var S;return!((S=o.current)!=null&&S.contains(v.target))&&n.onClose()};return window.addEventListener("pointerdown",p,!0),()=>window.removeEventListener("pointerdown",p,!0)},[]);const m=n.reply||(n.status==="done"?ga.done:n.status==="cancelled"?ga.cancelled:ga.failed);return s.jsxs("div",{ref:o,className:`oc-result oc-anchored is-${n.status}`,role:"status","aria-label":ga.result,onPointerDown:p=>p.stopPropagation(),children:[s.jsxs("div",{className:"oc-result-head",children:[s.jsx("span",{className:`dot ${n.status==="done"?"ok":"bad"}`,"aria-hidden":"true"}),s.jsx("p",{className:"oc-result-text",children:m}),s.jsx("button",{className:"icon-btn sm","aria-label":ga.close,title:ga.close,onClick:n.onClose,children:s.jsx(F,{name:"close",size:14})})]}),s.jsxs("div",{className:"oc-result-acts",children:[n.onUndo&&n.status==="done"&&s.jsx("button",{className:"btn",disabled:r,onClick:()=>void n.onUndo().then(()=>{f(!0)}),children:r?ga.undone:ga.undo}),s.jsx("button",{className:"btn",onClick:n.onOpen,children:ga.open})]})]})}const Nf=n=>(n==null?void 0:n.querySelector("script[data-dc-probe]"))??null;function Gm(n,o){const r=n!=null&&n.isConnected?n.contentDocument:null;if(!r||r.readyState!=="complete"||!r.body)return null;try{if(decodeURIComponent(r.location.pathname)!==`/screens/${o}`)return null}catch{return null}return r}function Ab(n,o){const r=Nf(Gm(n,o));return!r||r.hasAttribute("data-dc-dirty")?null:r.getAttribute("data-dc-src")}const Gy=(n,o)=>{var r;return!!((r=Nf(Gm(n,o)))!=null&&r.hasAttribute("data-dc-patched"))},d1=n=>{var o;return(o=Nf(n))==null?void 0:o.setAttribute("data-dc-dirty","")};function f1(n,o,r){var v;if(!((v=r.live)!=null&&v.length)||!r.base||!r.hash||r.forked)return!1;const f=Gm(n,o);if(!f||Ab(n,o)!==r.base)return!1;const m=r.live.map(S=>hn(f,S.path));if(m.some((S,N)=>!S||S===f.body||S.localName!==r.live[N].tag||S.namespaceURI!=="http://www.w3.org/1999/xhtml"))return!1;r.live.forEach((S,N)=>{const E=m[N];for(const[x,j]of S.attrs??[])j==null?E.removeAttribute(x):E.setAttribute(x,j);S.inner!=null&&(E.innerHTML=S.inner)});const p=Nf(f);return p.setAttribute("data-dc-src",r.hash),p.setAttribute("data-dc-patched",""),n.dispatchEvent(new CustomEvent("dc-patched")),!0}function h1(){const n=new Map,o=new Map,r=new Map;return{begin(f){n.set(f,(n.get(f)??0)+1)},end(f){const m=(n.get(f)??1)-1;if(m>0)return n.set(f,m),[];n.delete(f);const p=o.get(f)??[];return o.delete(f),p},patched(f,m,p){const v=r.get(f)??new Set;v.add(m).add(p),r.set(f,v)},reset(f){r.delete(f)},decide(f,m,p,v=!1){var S;return n.get(f)?(o.set(f,[...o.get(f)??[],m]),"queue"):m?v?m===p.shown?"keep":"reload":!p.patched||!p.shown?"reload":m===p.shown?"keep":(S=r.get(f))!=null&&S.has(m)?"check":"reload":"reload"}}}function m1(n){const[o,r]=b.useState(null);return b.useEffect(()=>{Te.get("/api/tokens").then(r).catch(()=>{})},[n]),o}const zb=n=>Object.entries((n==null?void 0:n.themes[n.active])??{}).map(([o,r])=>({name:o,value:r}));function vf(n){const o=n.trim().toLowerCase();let r=o.match(/^#([0-9a-f]{3,8})$/);if(r){let f=r[1];return f.length<=4&&(f=[...f].map(m=>m+m).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 r=o.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+))?\s*\)$/),r?[Number(r[1]),Number(r[2]),Number(r[3]),r[4]==null?1:Number(r[4])]:o==="transparent"?[0,0,0,0]:null}const Yy=([n,o,r])=>{const f=m=>{const p=m/255;return p<=.03928?p/12.92:((p+.055)/1.055)**2.4};return .2126*f(n)+.7152*f(o)+.0722*f(r)};function ff(n,o){const r=vf(n),f=vf(o);if(!r||!f)return null;const[m,p]=[Yy(r),Yy(f)].sort((v,S)=>S-v);return(m+.05)/(p+.05)}const zm=n=>{const o=vf(n);return o&&o[3]===1?"#"+o.slice(0,3).map(r=>Math.round(r).toString(16).padStart(2,"0")).join("").toUpperCase():null};function Xy(n,o,r){if(!(r!=null&&r.registered)||!o)return null;const f=new Set(zb(r).map(p=>zm(p.value)));if(/^(color|background|background-color|border-color)$/.test(n)){const p=zm(o);if(p&&!f.has(p))return d.checks.colorNotInTokens}const m=[...o.matchAll(/(-?\d+(?:\.\d+)?)px/g)].map(p=>Number(p[1]));return n==="font-size"&&m.some(p=>!r.fontSizes.includes(p))?d.checks.tokenFontSizes(r.fontSizes.join("·")):n==="border-radius"&&m.some(p=>!r.radii.includes(p)&&p<999)?d.checks.tokenRadii(r.radii.join("·")):/^(gap|padding|margin)/.test(n)&&m.some(p=>p%4!==0)?d.checks.notMultipleOf4:n==="font-weight"&&/^\d+$/.test(o)&&!r.fontWeights.includes(Number(o))?d.checks.tokenWeights(r.fontWeights.join("·")):null}function p1(n,o=48){var E,x;const r=n.defaultView,f=[],m=j=>{for(let M=j;M&&M.nodeType===1;M=M.parentElement){const $=r.getComputedStyle(M),L=vf($.backgroundColor);if($.backgroundImage!=="none")return"";if(L&&L[3]>.5)return $.backgroundColor}return"rgb(255,255,255)"},p=j=>{const M=j.getBoundingClientRect(),$=r.getComputedStyle(j);return M.width>0&&M.height>0&&$.visibility!=="hidden"&&$.display!=="none"},v=n.body.querySelectorAll("a[href], button, input:not([type=hidden]), select, textarea, [role=button], [role=tab], [onclick]");for(const j of Array.from(v)){if(!p(j))continue;const M=il(j);if(M==null)continue;const $=j.getBoundingClientRect();$.width<o&&$.height<o&&f.push({path:M,kind:"target",message:d.checks.smallTarget(j.tagName.toLowerCase(),Math.round($.width),Math.round($.height),o)});const L=(j.getAttribute("aria-label")||j.getAttribute("title")||j.getAttribute("placeholder")||j.innerText||((E=j.querySelector("img[alt]"))==null?void 0:E.getAttribute("alt"))||"").trim(),I=j.getAttribute("aria-labelledby")||j.id&&n.querySelector(`label[for="${j.id}"]`)||j.closest("label");!L&&!I&&f.push({path:M,kind:"label",message:d.checks.noName(j.tagName.toLowerCase())})}for(const j of Array.from(n.body.querySelectorAll("img")))if(!j.hasAttribute("alt")&&p(j)){const M=il(j);M!=null&&f.push({path:M,kind:"label",message:d.checks.noAlt})}const S=n.createTreeWalker(n.body,NodeFilter.SHOW_TEXT),N=new Set;for(let j=S.nextNode();j;j=S.nextNode()){const M=j.parentElement;if(!M||N.has(M)||!((x=j.textContent)!=null&&x.trim())||/^(SCRIPT|STYLE)$/.test(M.tagName)||!p(M))continue;N.add(M);const $=r.getComputedStyle(M),L=m(M);if(!L)continue;const I=ff($.color,L);if(I==null)continue;const k=parseFloat($.fontSize),W=k>=24||k>=18.66&&Number($.fontWeight)>=700?3:4.5;if(I<W){const X=il(M);X!=null&&f.push({path:X,kind:"contrast",message:d.checks.lowContrast(I.toFixed(2),W,j.textContent.trim().slice(0,16))})}}return f}function g1({tokens:n,onSave:o}){const[r,f]=b.useState(n);b.useEffect(()=>f(n),[n]);const m=r.themes[r.active]??{},p=JSON.stringify(r)!==JSON.stringify(n)||!n.registered,v=N=>f({...r,themes:{...r.themes,[r.active]:N}}),S=(N,E)=>s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:E}),s.jsx("input",{defaultValue:r[N].join(", "),"aria-label":E,onBlur:x=>f({...r,[N]:x.target.value.split(/[,\s]+/).map(Number).filter(j=>Number.isFinite(j))})},r[N].join())]});return s.jsxs("div",{className:"tokens",children:[s.jsxs("label",{className:"upload small",children:[s.jsx(F,{name:"plus",size:14})," ",d.tokens.import,s.jsx("input",{type:"file",hidden:!0,accept:".json,application/json",onChange:async N=>{var x;const E=(x=N.target.files)==null?void 0:x[0];if(E)try{f(y1(JSON.parse(await E.text()),r))}catch(j){alert(d.tokens.importFailed(j.message))}}})]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.tokens.theme}),s.jsx("button",{className:"icon-btn sm","aria-label":d.tokens.addTheme,title:d.tokens.addTheme,onClick:()=>{let N=d.tokens.newTheme;for(let E=2;r.themes[N];E++)N=d.tokens.newThemeN(E);f({...r,themes:{...r.themes,[N]:{...m}},active:N})},children:s.jsx(F,{name:"plus",size:14})})]}),s.jsxs("div",{className:"theme-row",children:[s.jsx("select",{value:r.active,onChange:N=>f({...r,active:N.target.value}),"aria-label":d.tokens.activeTheme,children:Object.keys(r.themes).map(N=>s.jsx("option",{children:N},N))}),s.jsx("input",{defaultValue:r.active,"aria-label":d.tokens.themeName,onBlur:N=>{const E=N.target.value.trim();if(!E||E===r.active||r.themes[E])return;const{[r.active]:x,...j}=r.themes;f({...r,themes:{...j,[E]:x},active:E})}},r.active)]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:d.tokens.colors(Object.keys(m).length)}),s.jsx("button",{className:"icon-btn sm","aria-label":d.tokens.addColor,title:d.tokens.addColor,onClick:()=>v({...m,[d.tokens.colorN(Object.keys(m).length+1)]:"#111111"}),children:s.jsx(F,{name:"plus",size:14})})]}),s.jsx("ul",{className:"tok-colors",children:Object.entries(m).map(([N,E])=>{var x;return s.jsxs("li",{children:[s.jsx("input",{type:"color",value:((x=zm(E))==null?void 0:x.toLowerCase())??"#000000","aria-label":d.tokens.colorOf(N),onChange:j=>v({...m,[N]:j.target.value.toUpperCase()})}),s.jsx("input",{defaultValue:N,"aria-label":d.tokens.colorName,onBlur:j=>{const M=j.target.value.trim();!M||M===N||m[M]||v(Object.fromEntries(Object.entries(m).map(([$,L])=>$===N?[M,L]:[$,L])))}}),s.jsx("code",{children:E}),s.jsx("button",{className:"icon-btn sm danger","aria-label":d.tokens.remove(N),onClick:()=>v(Object.fromEntries(Object.entries(m).filter(([j])=>j!==N))),children:s.jsx(F,{name:"close",size:12})})]},N)})}),S("fontSizes",d.tokens.fontSizes),S("fontWeights",d.tokens.fontWeights),S("radii",d.tokens.radii),S("spacing",d.tokens.spacing),s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:d.tokens.touchTarget}),s.jsx("input",{type:"number",value:r.minTarget,onChange:N=>f({...r,minTarget:Number(N.target.value)||48}),"aria-label":d.tokens.minTouchTarget})]}),s.jsx("button",{disabled:!p,title:d.tokens.saveTitle,onClick:()=>o(r,n.registered?d.history.saveTokens:d.history.registerTokens),children:n.registered?d.tokens.save:d.tokens.register}),s.jsx("p",{className:"muted small",children:n.registered?d.tokens.registeredHint:d.tokens.defaultHint})]})}function y1(n,o){const r=n;if(r&&typeof r=="object"&&r.themes&&typeof r.themes=="object")return{...o,...r,active:r.active??Object.keys(r.themes)[0]};const f={},m=(p,v)=>{if(typeof p=="string"&&/^#|^rgb/i.test(p))f[v]=p.toUpperCase();else if(p&&typeof p=="object"){const S=p.value??p.$value;if(typeof S=="string")m(S,v);else for(const[N,E]of Object.entries(p))m(E,v?`${v} ${N}`:N)}};if(m(n,""),!Object.keys(f).length)throw new Error(d.tokens.noColors);return{...o,themes:{...o.themes,[d.tokens.importedTheme]:f},active:d.tokens.importedTheme}}function Ky({title:n,items:o,empty:r,onPick:f,onAskAI:m}){return s.jsxs("section",{className:"board-opts","aria-label":n,children:[s.jsxs("div",{className:"sec-head",children:[s.jsxs("span",{children:[n," ",o?o.length:""]}),m&&o&&o.length>0&&s.jsx("button",{className:"link",onClick:m,children:d.checks.askFix})]}),o==null?s.jsx("p",{className:"muted small",children:d.checks.notVisible}):o.length===0?s.jsxs("p",{className:"ok-line",children:[s.jsx(F,{name:"check",size:14})," ",r]}):s.jsxs("ul",{className:"check-list",children:[o.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?d.checks.pickInEdit(p.path):d.checks.line(p.line),children:[s.jsx(F,{name:"warn",size:12}),s.jsx("span",{children:p.message}),s.jsx("code",{children:p.path??d.checks.line(p.line)})]})},v)),o.length>30&&s.jsx("li",{className:"muted small",children:d.checks.more(o.length-30)})]})]})}function b1({onSetUp:n}){const o=b.useRef(null);return b.useLayoutEffect(()=>es(o.current,".btn"),[]),s.jsxs("div",{ref:o,className:"oc-tc-off",role:"note","aria-label":d.checks.tokensOffTitle,children:[s.jsx(F,{name:"info",size:16}),s.jsxs("div",{children:[s.jsx("strong",{children:d.checks.tokensOffTitle}),s.jsx("p",{children:d.checks.tokensOffBody})]}),s.jsx("button",{className:"btn",onClick:n,children:d.checks.setUpTokens})]})}function Eu(n){const o=n==null?void 0:n.getElementById("board-tweaks");if(!o)return null;try{return JSON.parse(o.textContent??"")}catch{return null}}function Zy(n,o,r){d1(n);const f=r.type==="boolean"?r.value?"1":"0":String(r.value)+(r.type==="number"&&r.unit?r.unit:"");r.var&&n.documentElement.style.setProperty(r.var,f),n.documentElement.setAttribute(`data-tweak-${o}`,r.type==="boolean"?r.value?"on":"off":String(r.value))}function v1({doc:n,onSave:o}){const[r,f]=b.useState(()=>Eu(n)),[m,p]=b.useState(()=>JSON.stringify(Eu(n)));if(b.useEffect(()=>{const N=Eu(n);f(N),p(JSON.stringify(N))},[n]),!r)return null;const v=(N,E)=>{const x={...r,[N]:{...r[N],value:E}};f(x),n&&Zy(n,N,x[N])},S=JSON.stringify(r)!==m;return s.jsxs("section",{className:"tweaks","aria-label":d.tabs.tweaks,children:[Object.entries(r).map(([N,E])=>{const x=E.label??N;return s.jsxs("div",{className:"pp-row tw-row",children:[s.jsx("span",{className:"pp-l",title:E.var??N,children:x}),s.jsx("span",{className:"pp-v",children:E.type==="boolean"?s.jsx("button",{type:"button",role:"switch","aria-checked":!!E.value,"aria-label":x,className:`switch ${E.value?"on":""}`,onClick:()=>v(N,!E.value)}):E.type==="color"?s.jsxs("span",{className:"tw-color",children:[s.jsx("label",{className:"sw-btn",style:{background:String(E.value)},children:s.jsx("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(String(E.value))?String(E.value):"#000000",onChange:j=>v(N,j.target.value.toUpperCase()),"aria-label":x})}),s.jsx("input",{className:"tw-hex",value:String(E.value),"aria-label":`${x} (hex)`,spellCheck:!1,onChange:j=>v(N,j.target.value)})]}):E.type==="enum"?s.jsx("select",{value:String(E.value),onChange:j=>v(N,j.target.value),"aria-label":x,children:(E.options??[]).map(j=>s.jsx("option",{children:j},j))}):E.type==="number"?s.jsxs("span",{className:"num tw-num",children:[s.jsx("input",{type:"number",min:E.min,max:E.max,step:E.step??1,value:Number(E.value),onChange:j=>j.target.value!==""&&v(N,Number(j.target.value)),"aria-label":x}),E.unit&&s.jsx("span",{children:E.unit})]}):s.jsx("input",{value:String(E.value),onChange:j=>v(N,j.target.value),"aria-label":x})})]},N)}),S&&s.jsxs("div",{className:"tw-foot",children:[s.jsx("button",{className:"btn",onClick:()=>{const N=JSON.parse(m);if(f(N),n)for(const[E,x]of Object.entries(N))Zy(n,E,x)},children:d.tweaks.revert}),s.jsx("button",{className:"btn primary",onClick:()=>void o(Object.fromEntries(Object.entries(r).map(([N,E])=>[N,E.value]))).then(()=>p(JSON.stringify(r))),children:d.tweaks.save})]})]})}const qt=d.select,$s=d.design,$b=n=>n!=null&&n.registered?zb(n):[];function x1(n){const o={};if(!(n!=null&&n.documentElement))return o;const r=f=>{for(let m=0;m<f.length;m++)f[m].startsWith("--")&&(o[f[m]]=f.getPropertyValue(f[m]).trim())};for(const f of Array.from(n.styleSheets)){let m=null;try{m=f.cssRules}catch{continue}for(const p of Array.from(m??[])){const v=p;v.selectorText&&v.style&&/(^|,)\s*(:root|html|body)\s*(,|$)/.test(v.selectorText)&&r(v.style)}}return r(n.documentElement.style),o}function Ob(n,o){const r=o0(n.kind,n.styles["background-color"]);if(r==="color")return{prop:r,css:"color",value:o.color||n.styles.color||""};const f=o.background!=null?"background":"background-color";return{prop:r,css:f,value:o.background||o["background-color"]||n.styles["background-color"]||""}}function $m(n){const o=zu(n.value,n.colors),r=ya(n.value)??(o?ya(o.value):null)??"",[f,m]=b.useState(r);b.useEffect(()=>m(r),[r]);const p=b.useRef(null);b.useEffect(()=>{var S,N;n.autoFocus&&((N=(S=p.current)==null?void 0:S.querySelector("button, input"))==null||N.focus())},[]);const v=()=>{const S=ya(f.startsWith("#")?f:`#${f}`);S&&S!==r?n.onPick(S):m(r)};return s.jsxs("div",{className:"fill-picker",ref:p,children:[s.jsxs("div",{className:"pop-top",children:[s.jsx("strong",{children:n.title}),s.jsx("span",{className:"muted",children:o?qt.tokenNow(o.name):r||$s.none})]}),n.colors.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pop-h",children:qt.tokens}),s.jsx("div",{className:"tok-row",role:"group","aria-label":qt.tokens,children:n.colors.map(S=>s.jsxs("button",{className:`tok ${(o==null?void 0:o.name)===S.name?"on":""}`,"aria-pressed":(o==null?void 0:o.name)===S.name,title:`${S.name} ${ya(S.value)??S.value}`,onClick:()=>n.onPick(s0(S,n.vars)),children:[s.jsx("i",{style:{background:S.value}}),s.jsx("span",{children:S.name})]},S.name))}),s.jsx("div",{className:"pop-sep"})]}),s.jsx("div",{className:"custom-row",children:s.jsx("span",{children:qt.custom})}),s.jsxs("div",{className:"hex",children:[s.jsx("input",{type:"color",className:"sw","aria-label":qt.picker,value:(ya(f)??(r||"#000000")).toLowerCase(),onChange:S=>m(S.target.value.toUpperCase()),onBlur:v}),s.jsx("input",{className:"num","aria-label":qt.hex,value:f,spellCheck:!1,onChange:S=>m(S.target.value),onBlur:v,onKeyDown:S=>{S.nativeEvent.isComposing||S.key==="Enter"&&v()}})]})]})}function lf(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=()=>o.trim()!==n.value.trim()&&n.onCommit(o.trim());return s.jsxs("div",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:n.css,children:n.label}),n.chips&&n.chips.length>0&&s.jsx("span",{className:"chips-row",children:n.chips.map(m=>s.jsx("button",{className:`tchip ${Fa(n.value||n.placeholder)===String(m)?"on":""}`,onClick:()=>n.onCommit(String(m)),children:m},m))}),s.jsxs("span",{className:"stepper",children:[s.jsx("button",{className:"icon-btn sm","aria-label":qt.decrease(n.label),onClick:()=>n.onStep(-1),children:s.jsx(F,{name:"minus",size:14})}),s.jsx("input",{"aria-label":n.label,title:n.css,value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:f,onKeyDown:m=>{m.nativeEvent.isComposing||m.key==="Enter"&&f()}}),s.jsx("button",{className:"icon-btn sm","aria-label":qt.increase(n.label),onClick:()=>n.onStep(1),children:s.jsx(F,{name:"plus",size:14})})]})]})}const sf=n=>/^-?\d+(?:\.\d+)?$/.test(n)?`${Number(n)}px`:n;function w1(n){var D,Y,ue,ge,De,He;const o=n.selection,r=b.useRef(null),f=b.useRef(null),[m,p]=b.useState({w:420,h:36}),v=b.useRef(0),[S,N]=b.useState(null),[E,x]=b.useState(null),[j,M]=b.useState(0),$=b.useRef([]),[L,I]=b.useState({});b.useEffect(()=>I({}),[o.hash,o.path,o.file]);const k=G=>L[G]??n.inline[G]??o.styles[G]??"",_=(G,de)=>{I(xe=>({...xe,[G]:de})),n.onStyle(G,de)},W={icons:(v.current||m.w)>n.bounds.right-n.bounds.left};b.useLayoutEffect(()=>{const G=r.current;G&&(es(G),W.icons||(v.current=G.offsetWidth),(G.offsetWidth!==m.w||G.offsetHeight!==m.h)&&p({w:G.offsetWidth,h:G.offsetHeight}))}),$u(r,n.store,n.target,n.bounds,Su),b.useEffect(()=>S?n.store.subscribe(()=>N(null)):void 0,[S,n.store]),b.useLayoutEffect(()=>{if(!S)return x(null);const G=f.current,de=$.current[Ze.findIndex(B=>B.pop===S)],xe=r.current;if(!G||!de||!xe)return;const Kt=xe.getBoundingClientRect(),Ge=G.offsetWidth,Wt=G.offsetHeight,Zt=n.bounds,rt=Math.round(Math.max(Zt.left,Math.min(Kt.left+de.offsetLeft,Zt.right-Ge))),Ye=xe.dataset.below==="true",mn=Kt.top-8-Wt,en=Kt.bottom+8,Pn=mn>=Zt.top,ut=en+Wt<=Zt.bottom,Gn=Math.round(Ye?ut?en:Pn?mn:Math.max(Zt.top,Math.min(en,Zt.bottom-Wt)):Pn?mn:ut?en:Math.max(Zt.top,Math.min(en,Zt.bottom-Wt)));(!E||E.x!==rt||E.y!==Gn)&&x({x:rt,y:Gn})}),b.useEffect(()=>{if(!S)return;const G=de=>{var Kt,Ge;const xe=de.target;(Kt=f.current)!=null&&Kt.contains(xe)||(Ge=r.current)!=null&&Ge.contains(xe)||N(null)};return window.addEventListener("pointerdown",G,!0),()=>window.removeEventListener("pointerdown",G,!0)},[S]);const X=$b(n.tokens),ne=!!o.text.trim(),te=Ob(o,n.inline),ie=te.prop==="color"?qt.textColor:qt.fill,le=L[te.css]??te.value,he=ya(le)??ya((D=zu(le,X))==null?void 0:D.value)??null,ce=Number(k("font-weight"))>=600,pe=k("font-style")==="italic",we=/underline/.test(k("text-decoration-line")||k("text-decoration")),Ze=[{id:"text",label:qt.text,icon:"title",pop:"text",disabled:!ne,title:ne?qt.text:qt.textOff},...ne?[{id:"bold",label:qt.bold,icon:"bold",iconOnly:!0,on:ce,title:qt.bold,run:()=>_("font-weight",ce?"400":"700")},{id:"italic",label:qt.italic,icon:"italic",iconOnly:!0,on:pe,title:qt.italic,run:()=>_("font-style",pe?"normal":"italic")},{id:"underline",label:qt.underline,icon:"underline",iconOnly:!0,on:we,title:qt.underline,run:()=>_("text-decoration-line",we?"none":"underline")}]:[],{id:"fill",label:ie,pop:"fill",title:`${ie} (${te.css})`},{id:"radius",label:qt.radius,icon:"radius",pop:"radius",title:`${$s.cornerRadius} (border-radius)`},{id:"spacing",label:qt.spacing,icon:"spacing",pop:"spacing",title:`${$s.padding} · ${$s.gap}`},{id:"ask",label:qt.askAi,aria:qt.askAiAria,icon:"ai",cls:"accent",title:qt.askAiTitle,run:n.onAskAi},{id:"comment",label:qt.comment,icon:"comment",title:qt.commentTitle,run:n.onComment},{id:"more",label:qt.more,icon:"more",title:qt.more,run:()=>{var de;const G=(de=$.current[Ze.length-1])==null?void 0:de.getBoundingClientRect();G&&n.onMore({clientX:G.left,clientY:G.bottom+8})}}],Ce=Ze.map((G,de)=>G.disabled?-1:de).filter(G=>G>=0),Nt=Ce.includes(j)?j:Ce[0],at=G=>{var de;return G.pop?N(xe=>xe===G.pop?null:G.pop):(de=G.run)==null?void 0:de.call(G)},me=()=>{var de;const G=Ze.findIndex(xe=>xe.pop===S);N(null),(de=$.current[G])==null||de.focus()},ke=G=>{if(!G.nativeEvent.isComposing){if(G.key==="Escape"){S&&(G.preventDefault(),G.stopPropagation(),me());return}G.metaKey||G.ctrlKey||/^(Arrow|Home$|End$|Enter$| $|Delete$|Backspace$)/.test(G.key)&&G.stopPropagation()}},$e=G=>{const de=Ce.indexOf(Nt),xe=Kt=>{var Wt;G.preventDefault();const Ge=Ce[(Kt+Ce.length)%Ce.length];M(Ge),(Wt=$.current[Ge])==null||Wt.focus()};G.key==="ArrowRight"?xe(de+1):G.key==="ArrowLeft"?xe(de-1):G.key==="Home"?xe(0):G.key==="End"&&xe(Ce.length-1)},qe=(Y=n.tokens)!=null&&Y.registered?n.tokens.fontSizes:[],fe=[...new Set([...(ue=n.tokens)!=null&&ue.registered?n.tokens.fontWeights:[],400,500,600,700])].sort((G,de)=>G-de),re=(ge=n.tokens)!=null&&ge.registered?n.tokens.radii.filter(G=>G<999):[],Fe=(De=n.tokens)!=null&&De.registered?n.tokens.spacing.filter(G=>G<=64):[];let ht=null;return S==="text"?ht=s.jsxs(s.Fragment,{children:[s.jsx(lf,{label:$s.size,css:"font-size",value:Fa(k("font-size")),chips:qe,onStep:G=>_("font-size",`${df(k("font-size"),G,1,1)}px`),onCommit:G=>_("font-size",sf(G))}),s.jsxs("label",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:"font-weight",children:$s.weight}),s.jsx("select",{className:"pop-select",value:String(Number(k("font-weight"))||""),onChange:G=>_("font-weight",G.target.value),children:fe.map(G=>s.jsx("option",{value:String(G),children:Cm(G,$s.weights)},G))})]}),s.jsx("div",{className:"pop-row",role:"group","aria-label":qt.textAlign,children:[["left","textLeft"],["center","textCenter"],["right","textRight"]].map(([G,de])=>s.jsx("button",{className:`pop-tog ${k("text-align")===G||G==="left"&&/^(start|left|)$/.test(k("text-align"))?"on":""}`,"aria-pressed":k("text-align")===G,"aria-label":qt.align(G),title:qt.align(G),onClick:()=>_("text-align",G),children:s.jsx(F,{name:de,size:14})},G))})]}):S==="fill"?ht=s.jsx($m,{title:ie,value:le,colors:X,vars:n.vars,autoFocus:!0,onPick:G=>_(te.css,G)}):S==="radius"?ht=s.jsx(lf,{label:$s.cornerRadius,css:"border-radius",value:Fa(k("border-radius")),chips:re,onStep:G=>_("border-radius",`${df(k("border-radius"),G)}px`),onCommit:G=>_("border-radius",sf(G))}):S==="spacing"&&(ht=s.jsxs(s.Fragment,{children:[s.jsx(lf,{label:$s.padding,css:"padding",value:Tm(k("padding")),chips:Fe,onStep:G=>_("padding",i0(k("padding"),G)),onCommit:G=>_("padding",G.replace(/·/g," ").trim().split(/\s+/).map(sf).join(" "))}),s.jsx(lf,{label:$s.gap,css:"gap",value:Fa(k("gap")==="normal"?"0px":k("gap")),chips:Fe,onStep:G=>_("gap",`${df(k("gap"),G,4)}px`),onCommit:G=>_("gap",sf(G))})]})),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:r,className:`etb oc-anchored ${W.icons?"is-icons":""}`,role:"toolbar","aria-label":qt.toolbar,"aria-orientation":"horizontal",onKeyDown:G=>{ke(G),$e(G)},onPointerDown:G=>G.stopPropagation(),children:Ze.map((G,de)=>s.jsxs("span",{className:"etb-item",children:[G.id==="ask"&&s.jsx("span",{className:"sep","aria-hidden":"true"}),s.jsxs("button",{ref:xe=>void($.current[de]=xe),className:`${G.cls??""} ${S&&S===G.pop||G.on?"on":""} ${G.iconOnly?"is-icon":""}`,tabIndex:de===Nt?0:-1,disabled:G.disabled,title:G.title,"aria-pressed":G.iconOnly?!!G.on:void 0,"aria-label":G.id==="fill"?ie:G.id==="more"||G.iconOnly?G.label:G.aria&&G.aria!==G.label?G.aria:W.icons?G.label:void 0,"aria-haspopup":G.pop?"dialog":void 0,"aria-expanded":G.pop?S===G.pop:void 0,onFocus:()=>M(de),onClick:()=>at(G),children:[G.id==="fill"?s.jsx("span",{className:"sw",style:{background:he??"transparent"}}):s.jsx(F,{name:G.icon,size:14}),G.id!=="fill"&&G.id!=="more"&&!G.iconOnly&&!W.icons&&G.label,(G.id==="text"||G.id==="fill")&&s.jsx(F,{name:"chevronDown",size:14})]})]},G.id))}),S&&s.jsx("div",{ref:f,className:"menu pop",role:"dialog","aria-label":(He=Ze.find(G=>G.pop===S))==null?void 0:He.label,style:E?{left:E.x,top:E.y}:{visibility:"hidden",left:0,top:0},onKeyDown:ke,onPointerDown:G=>G.stopPropagation(),children:ht})]})}function j1(n){return s.jsxs("nav",{className:"crumb","aria-label":d.inspector.crumbs,children:[s.jsx("button",{className:"link",title:d.inspector.crumbBoard,onClick:n.onBoard,children:n.board}),n.skipped&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("span",{children:"…"})]}),n.parents.map(o=>s.jsxs("span",{className:"crumb-step",children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("button",{className:"link",title:d.inspector.crumbParent(o.name),onClick:()=>n.onPath(o.path),children:o.name})]},o.path)),s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("b",{"aria-current":"true",title:n.title,children:n.current})]})}const N1=n=>n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",ku=n=>`${Math.round(n)}px`;function S1(n,o,r,f,m){const p=o.style.pointerEvents;o.style.pointerEvents="none";const v=n.elementFromPoint(r,f);if(o.style.pointerEvents=p,!v||v===n.documentElement||o.contains(v))return null;const S=n.defaultView,N=X=>{const ne=S.getComputedStyle(X);return/flex/.test(ne.display)&&!ne.flexDirection.startsWith("column")},E=/^(img|input|br|hr|textarea|select|svg|path|video|iframe)$/i,x=X=>{const ne=X===n.body?"":il(X);if(ne==null)return null;const te=N(X),ie=Array.from(X.children).filter(pe=>{var we;return pe!==o&&!((we=pe.hasAttribute)!=null&&we.call(pe,"data-dc-probe"))});let le=ie.length;for(let pe=0;pe<ie.length;pe++){const we=Ml(ie[pe]);if(te?r<we.x+we.w/2:f<we.y+we.h/2){le=pe;break}}const he=Ml(X);let ce;if(le<ie.length){const pe=Ml(ie[le]);ce=te?{x:pe.x-1,y:pe.y,w:2,h:pe.h}:{x:pe.x,y:pe.y-1,w:pe.w,h:2}}else if(ie.length){const pe=Ml(ie[ie.length-1]);ce=te?{x:pe.x+pe.w,y:pe.y,w:2,h:pe.h}:{x:pe.x,y:pe.y+pe.h,w:pe.w,h:2}}else ce={x:he.x,y:he.y+he.h-2,w:he.w,h:2};return{toParentPath:ne,index:le,freeze:[],line:ce}};if(v.contains(o)||v===n.body)return x(v===n.body?n.body:v);if(m&&!E.test(v.tagName))return x(v);const j=v.parentElement,M=j===n.body?"":il(j);if(M==null)return null;const $=N(j),L=Ml(v),I=$?r>L.x+L.w/2:f>L.y+L.h/2,_=Array.from(j.children).filter(X=>X!==o).indexOf(v)+(I?1:0),W=$?{x:I?L.x+L.w:L.x-1,y:L.y,w:2,h:L.h}:{x:L.x,y:I?L.y+L.h:L.y-1,w:L.w,h:2};return{toParentPath:M,index:_,freeze:[],line:W}}function k1(n,o,r){const f=o.parentElement;if(!f||f===n.body)return[];const m=il(f);if(m==null||m===r)return[];const p=n.defaultView.getComputedStyle(f);if(!/flex|grid/.test(p.display))return[];const v=[],S=(x,j)=>{const M=il(x),$=x.style,L=x.getBoundingClientRect(),I={};for(const k of j)$.getPropertyValue(k)||(I[k]=ku(k==="width"?L.width:L.height));M!=null&&Object.keys(I).length&&v.push({path:M,props:I})};S(f,["width","height"]);const N=p.display.includes("grid"),E=!p.flexDirection.startsWith("column");for(const x of Array.from(f.children))x!==o&&S(x,N?["width","height"]:E?["width"]:["height"]);return v}function T1(n){const[o,r]=b.useState(null),[f,m]=b.useState(null),p=b.useRef(null),v=1/Math.max(n.zoom,.25),S=M=>$=>{if($.button!==0)return;$.stopPropagation(),$.preventDefault();const L=hn(n.doc,n.path);if(!L)return;const I=n.doc.defaultView.getComputedStyle(L),k=I.position==="absolute"||I.position==="fixed",_=L.getBoundingClientRect();p.current={kind:M,sx:$.clientX,sy:$.clientY,el:L,abs:k,left:parseFloat(I.left)||0,top:parseFloat(I.top)||0,w:_.width,h:_.height,plan:null,moved:!1},$.currentTarget.setPointerCapture($.pointerId)},N=M=>{var k,_;const $=p.current;if(!$)return;const L=(M.clientX-$.sx)/n.zoom,I=(M.clientY-$.sy)/n.zoom;if(!(!$.moved&&Math.abs(L)+Math.abs(I)<3)){if($.moved=!0,$.kind==="move"){if($.abs){$.el.style.left=ku($.left+L),$.el.style.top=ku($.top+I);return}m({...n.rect,x:n.rect.x+L,y:n.rect.y+I});const W=(_=(k=n.doc.defaultView)==null?void 0:k.frameElement)==null?void 0:_.getBoundingClientRect(),X=W?W.width/(n.doc.defaultView.innerWidth||W.width):n.zoom,ne=W?(M.clientX-W.left)/X:n.rect.x+L,te=W?(M.clientY-W.top)/X:n.rect.y+I,ie=S1(n.doc,$.el,ne,te,M.altKey);$.plan=ie?{toParentPath:ie.toParentPath,index:ie.index,freeze:[]}:null,r((ie==null?void 0:ie.line)??null);return}$.kind!=="s"&&($.el.style.width=ku(Math.max(8,$.w+L))),$.kind!=="e"&&($.el.style.height=ku(Math.max(8,$.h+I)))}},E=M=>{const $=p.current;if(p.current=null,r(null),m(null),!$||!$.moved)return;const L=(M.clientX-$.sx)/n.zoom,I=(M.clientY-$.sy)/n.zoom;if($.kind==="move"){if($.abs)return n.onPosition(Math.round($.left+L),Math.round($.top+I));if(!$.plan||$.plan.toParentPath===N1(n.path)&&$.plan.index===Array.from($.el.parentElement.children).indexOf($.el))return;n.onMove({...$.plan,freeze:k1(n.doc,$.el,$.plan.toParentPath)});return}n.onResize(Math.round($.kind==="s"?$.w:Math.max(8,$.w+L)),Math.round($.kind==="e"?$.h:Math.max(8,$.h+I)))},x=n.rect,j=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}}),o&&s.jsx("div",{className:"drop-line",style:{left:o.x,top:o.y,width:Math.max(o.w,2*v),height:Math.max(o.h,2*v)}}),s.jsx("button",{className:"el-move","aria-label":d.elementDrag.moveAria,title:d.elementDrag.moveTitle,style:{left:Math.max(0,x.x),top:x.y>=22*v?x.y-22*v:Math.max(0,x.y),transform:`scale(${v})`,transformOrigin:x.y>=22*v?"0 100%":"0 0"},onPointerDown:S("move"),onPointerMove:N,onPointerUp:E,children:s.jsx(F,{name:"hand",size:12})}),["e","s","se"].map(M=>s.jsx("div",{className:`el-resize ${M}`,role:"slider","aria-label":M==="e"?d.elementDrag.width:M==="s"?d.elementDrag.height:d.elementDrag.size,"aria-valuetext":`${Math.round(x.w)} × ${Math.round(x.h)}`,style:{left:M==="s"?x.x+x.w/2-j/2:x.x+x.w-j/2,top:M==="e"?x.y+x.h/2-j/2:x.y+x.h-j/2,width:j,height:j,borderWidth:1.5*v},onPointerDown:S(M),onPointerMove:N,onPointerUp:E},M))]})}function C1(n,o,r,f){const m=hn(n,o),p=m==null?void 0:m.parentElement;if(!m||!p)return null;const v=n.defaultView.getComputedStyle(p),S=/flex/.test(v.display),N=S&&v.flexDirection.startsWith("column"),E=f==="left"||f==="hcenter"||f==="right",x=f==="left"||f==="top"?"start":f==="right"||f==="bottom"?"end":"center",j={start:"flex-start",center:"center",end:"flex-end"}[x],M=($,L)=>({op:"setStyle",path:o,hash:r,prop:$,value:L});return S&&(E?N:!N)?[M("align-self",j)]:E?x==="start"?[M("margin-left","0"),M("margin-right","auto")]:x==="end"?[M("margin-left","auto"),M("margin-right","0")]:[M("margin-left","auto"),M("margin-right","auto")]:S?x==="start"?[M("margin-top","0"),M("margin-bottom","auto")]:x==="end"?[M("margin-top","auto"),M("margin-bottom","0")]:[M("margin-top","auto"),M("margin-bottom","auto")]:null}const be=d.requests,Mu=n=>{var o;return((o=n.request)==null?void 0:o.state)==="done"&&n.request.replyId?(n.replies??[]).find(r=>r.id===n.request.replyId):void 0},ba=n=>!!n.forAgent&&!!n.request,E1=n=>ba(n)&&(n.request.state==="waiting"||n.request.state==="taken"),Fy=(n,o)=>n.filter(r=>ba(r)&&r.request.state==="waiting"&&(!o||r.file===o)).length,M1=()=>/\bClaude\/\d/.test(navigator.userAgent),Sf=n=>d.occupancy.clock(n?Date.parse(n):Date.now());function A1(){const[n,o]=b.useState({mode:"chat",to:"any",intro:!1}),[r,f]=b.useState([]),[m,p]=b.useState(!1),v=b.useCallback(()=>{Te.get("/api/requests/settings").then(N=>(o(N),p(!0))).catch(()=>{}),Te.get("/api/agents/connected").then(N=>f(N.agents)).catch(()=>{})},[]);b.useEffect(()=>{v();const N=window.setInterval(v,6e4);return()=>window.clearInterval(N)},[v]);const S=b.useCallback(async N=>{o(E=>({...E,...N})),o(await Te.post("/api/requests/settings",N))},[]);return{settings:n,agents:r,ready:m,reload:v,save:S,host:n.mode==="host"}}function Om({comments:n}){const[o,r]=b.useState(!1);return!n.some(f=>ba(f)&&f.request.state==="waiting")||n.some(f=>ba(f)&&f.request.state==="taken")?null:s.jsxs("p",{className:"req-say1",children:[s.jsxs("span",{className:"req-say1-text",children:[be.sayTitle," ",s.jsx("strong",{children:be.quote(be.line)})]}),s.jsx("button",{className:"icon-btn req-say1-copy","aria-label":o?be.copied:be.copy,title:be.copyTitle,onClick:()=>void navigator.clipboard.writeText(be.line).catch(()=>{}).then(()=>{r(!0),window.setTimeout(()=>r(!1),1400)}),children:s.jsx(F,{name:o?"check":"copy",size:16})})]})}function Rb({req:n,inLine:o=!1}){const{settings:r,agents:f}=n,m=p=>void n.save({mode:p,intro:!0});return s.jsxs("section",{className:`req-mode ${o?"in-line":""}`,"aria-label":be.goTo,id:o?"req-mode-more":void 0,children:[!o&&s.jsx("h3",{className:"req-h",children:be.goTo}),s.jsx("div",{className:"req-opts",role:"radiogroup","aria-label":be.goTo,children:["chat","host"].map(p=>s.jsxs("button",{role:"radio","aria-checked":r.mode===p,className:`req-opt ${r.mode===p?"on":""}`,onClick:()=>m(p),children:[s.jsx("span",{className:"req-radio","aria-hidden":"true"}),s.jsxs("span",{className:"req-opt-text",children:[s.jsx("strong",{children:p==="chat"?be.easelChat:be.host}),s.jsx("span",{children:p==="chat"?be.easelChatNote:be.hostNote})]})]},p))}),r.mode==="host"&&s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"req-h",children:be.connected}),f.length?s.jsx("ul",{className:"req-agents",children:f.map(p=>s.jsxs("li",{children:[s.jsx("span",{className:"req-dot","aria-hidden":"true"}),s.jsx("span",{className:"req-agent",children:p.label}),s.jsxs("span",{className:"req-agent-where",children:[p.here?be.thisFolder:be.otherFolder," · ",be.since(d.occupancy.clock(p.at))]})]},p.client))}):s.jsx("p",{className:"req-note",children:be.noneConnected}),new Set(f.map(p=>p.label)).size>=2&&s.jsxs("label",{className:"req-to",children:[s.jsx("span",{children:be.sendTo}),s.jsxs("select",{value:r.to,onChange:p=>void n.save({to:p.target.value}),children:[s.jsx("option",{value:"any",children:be.anyAgent}),[...new Set(f.map(p=>p.label))].map(p=>s.jsx("option",{value:p,children:p},p))]})]})]})]})}function z1({req:n}){const[o,r]=b.useState(!1),f=n.settings.mode==="host"?be.hostShort:be.easelChatShort,m=n.agents.length;return s.jsxs("section",{className:`req-mode-line ${o?"is-open":""}`,children:[s.jsxs("button",{className:"req-line","aria-expanded":o,"aria-controls":"req-mode-more",title:be.connectedN(m),onClick:()=>r(p=>!p),children:[s.jsx("span",{className:"req-line-k",children:be.goesTo}),s.jsx("span",{className:"req-line-v",children:f}),n.host&&s.jsx("span",{className:`req-dot ${m?"":"is-off"}`,"aria-hidden":"true"}),n.host&&s.jsx("span",{className:"sr-only",children:be.connectedN(m)}),s.jsx(F,{name:"chevronDown",size:16,className:"chev"})]}),o&&s.jsx(Rb,{req:n,inLine:!0})]})}const Db=({c:n})=>ba(n)?s.jsx("span",{className:"req-badge",children:n.forAgent===!0?be.forAi:be.forAgent(String(n.forAgent))}):null;function Bb({c:n,a:o}){var v,S;if(!ba(n))return null;const r=n.request,f=n.forAgent===!0?null:String(n.forAgent),m=r.state==="done"?((v=o.undoFor)==null?void 0:v.call(o,n))??null:null,p=r.state==="waiting"?r.left?be.left(r.left):f?be.waitingFor(f):be.waiting:r.state==="taken"?be.took(r.by??"AI",Sf(r.takenAt)):r.state==="failed"?r.reason??be.failed(r.by??"AI"):null;return s.jsxs("div",{className:`req-status is-${r.state}`,"data-req":n.id,children:[p&&s.jsx("span",{className:"req-state",role:"status",children:p}),r.state==="done"&&((((S=r.changed)==null?void 0:S.length)??0)>0||m||r.undo)&&s.jsxs("div",{className:"req-done",children:[(r.changed??[]).map(N=>s.jsxs("button",{className:"req-chip",title:be.changedTitle(o.titleOf(N)),onClick:()=>o.onBoard(N),children:[s.jsx(F,{name:"board",size:14}),s.jsx("span",{className:"req-chip-title",children:o.titleOf(N)})]},N)),m&&s.jsx("button",{className:"btn oc-plain req-undo",onClick:m,children:be.undoChange}),!m&&r.undo==="undone"&&s.jsx("span",{className:"req-undone",role:"status",children:be.undone}),!m&&r.undo==="gone"&&s.jsx("span",{className:"req-undone",children:be.undoGone})]})]})}function Hb({c:n,a:o}){const[r,f]=b.useState(!1);if(!ba(n))return null;const m=n.request.state;return m!=="waiting"&&m!=="failed"?null:s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn oc-plain",onClick:()=>m==="waiting"?o.onCancel(n):o.onRetry(n),children:m==="waiting"?be.cancelRequest:be.retry}),r?s.jsx("button",{className:"btn oc-plain",onClick:()=>o.onChat(n),children:be.useChat}):s.jsx("button",{className:"icon-btn req-more","aria-label":be.more,title:be.useChat,"aria-expanded":!1,onClick:()=>f(!0),children:s.jsx(F,{name:"more",size:16})})]})}function Qy({all:n,forAi:o,value:r,onChange:f}){return s.jsxs("span",{className:"req-filter",role:"group","aria-label":be.filterAria,children:[s.jsxs("button",{"aria-pressed":r==="all",className:r==="all"?"on":"",onClick:()=>f("all"),children:[be.filterAll," ",s.jsx("span",{className:"req-n",children:n})]}),s.jsxs("button",{"aria-pressed":r==="ai",className:r==="ai"?"on":"",onClick:()=>f("ai"),children:[be.filterForAi," ",s.jsx("span",{className:"req-n",children:o})]})]})}const $1=({n,working:o,short:r,onOpen:f})=>{if(!(n>0)&&!o)return null;const m=o?be.markerWorking(o):be.waitingTag(n),p=s.jsxs(s.Fragment,{children:[o?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(F,{name:"clock",size:16}),s.jsx("span",{className:o&&r?"sr-only":"act-tag-text",children:m}),!o&&s.jsx("span",{className:"req-tag-n","aria-hidden":"true",children:n})]});return f?s.jsx("button",{className:`occ-tag req-tag is-button ${o?"is-taken":""}`,title:m,"aria-label":`${m}. ${be.markerAria}`,onPointerDown:v=>v.stopPropagation(),onDoubleClick:v=>v.stopPropagation(),onClick:f,children:p}):s.jsx("span",{className:"occ-tag req-tag",title:m,children:p})},O1=({n})=>n>0?s.jsx("span",{className:"req-count","aria-label":be.countAria(n),title:be.countAria(n),children:n}):null,R1=(n,o)=>{var f;const r=(f=n.request)==null?void 0:f.attach;return r!=null&&r.label?r.label.startsWith(o)?r.label:`${o} · ${r.label}`:r!=null&&r.kind&&r.kind!=="element"?`${o} · ${be.kind[r.kind]}`:o};function D1({req:n,comments:o,actions:r,onOpen:f,chatBack:m,compact:p=!1}){const v=new Date().toDateString(),S=o.filter(N=>ba(N)&&(N.request.state!=="done"||new Date(N.request.doneAt??0).toDateString()===v)).sort((N,E)=>+(E.request.state!=="done")-+(N.request.state!=="done")||Date.parse(E.createdAt)-Date.parse(N.createdAt));return s.jsx("div",{className:`pp req-panel ${p?"is-compact":""}`,children:s.jsxs("div",{className:"pp-scroll",children:[m,!p&&s.jsx(Rb,{req:n}),n.host&&s.jsxs("section",{className:"req-list","aria-label":be.listTitle,children:[s.jsxs("h3",{className:"req-h",children:[be.listTitle," ",s.jsx("span",{className:"oc-count",children:S.filter(N=>N.request.state!=="done").length}),s.jsx("span",{className:"req-h-side",children:be.allBoards})]}),s.jsx(Om,{comments:S}),S.length===0?s.jsx("p",{className:"req-note",children:be.listEmpty}):s.jsx("ul",{className:"req-items",children:S.map(N=>s.jsxs("li",{className:"req-item",children:[s.jsxs("button",{className:"req-item-head",onClick:()=>f(N),children:[s.jsx("span",{className:"who",children:N.author}),N.forAgent!==!0&&s.jsx(Db,{c:N}),s.jsx("span",{className:"when",children:Sf(N.createdAt)})]}),s.jsx("div",{className:"req-item-text",children:N.text}),s.jsx("div",{className:"req-where",children:R1(N,r.titleOf(N.file))}),Mu(N)&&s.jsxs("div",{className:"req-reply",children:[s.jsx("span",{className:"who",children:Mu(N).author})," ",Mu(N).text]}),s.jsx(Bb,{c:N,a:r}),(N.request.state==="waiting"||N.request.state==="failed")&&s.jsx("div",{className:"oc-cmt-bar req-actions",children:s.jsx(Hb,{c:N,a:r})})]},N.id))})]}),p&&s.jsx(z1,{req:n})]})})}function B1(n){const o=Math.min(360,n.win.w-16),r=n.room<n.win.w?Math.max(8,Math.round((n.room-o)/2)):e0(n.win.w,{w:o},8,n.room).x;return s.jsxs("div",{className:"req-composer req-intro",role:"dialog","aria-label":be.introTitle,style:{left:r,width:o,bottom:n.bottom},onPointerDown:f=>f.stopPropagation(),children:[s.jsx("strong",{className:"req-intro-title",children:be.introTitle}),s.jsxs("div",{className:"req-comp-foot",children:[s.jsx("span",{className:"req-comp-hint"}),s.jsx("button",{className:"btn oc-plain",onClick:n.onKeep,children:be.keepChat}),s.jsx("button",{className:"btn req-primary",autoFocus:!0,onClick:n.onSwitch,children:be.switchTo})]})]})}const Py={taken:0,waiting:1,failed:2,done:3},H1=n=>!!n&&new Date(n).toDateString()===new Date().toDateString(),bu=(n,o)=>ba(n)&&(E1(n)||(n.request.state==="done"||n.request.state==="failed")&&H1(n.request.doneAt)&&!o.has(n.id)),Jy="easel:request-markers-dismissed";function L1(){const[n,o]=b.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem(Jy)??"[]"))}catch{return new Set}}),r=b.useCallback(f=>{o(m=>{const p=[...m,...f.filter(v=>!m.has(v))].slice(-200);try{localStorage.setItem(Jy,JSON.stringify(p))}catch{}return new Set(p)})},[]);return[n,r]}const Lb=n=>{var r;const o=n.request;return o.state==="waiting"?n.forAgent===!0?be.markerWaiting:be.markerWaitingFor(String(n.forAgent)):o.state==="taken"?be.markerWorking(o.by??"AI"):o.state==="done"?((r=Mu(n))==null?void 0:r.text)??be.markerDone:o.reason??be.failed(o.by??"AI")},_b=({state:n})=>n==="taken"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):n==="waiting"?s.jsx(F,{name:"ai",size:14,className:"req-mk-ai"}):s.jsx("span",{className:`dot ${n==="done"?"ok":"bad"}`,"aria-hidden":"true"});function _1(){const[n,o]=b.useState(!1);return s.jsxs("button",{className:"btn req-mk-copy",title:be.copyTitle,onClick:()=>void navigator.clipboard.writeText(be.line).catch(()=>{}).then(()=>{o(!0),window.setTimeout(()=>o(!1),1400)}),children:[s.jsx(F,{name:n?"check":"copy",size:14}),s.jsx("span",{children:n?be.copied:be.copy})]})}function U1(n){const o=b.useRef(null),r=$u(o,n.store,n.target,n.bounds,n.gap??8,".req-mk",n.open?void 0:n.placer),f=[...n.items].sort((S,N)=>Py[S.request.state]-Py[N.request.state]||Date.parse(N.createdAt)-Date.parse(S.createdAt)),m=f[0],p=n.open;b.useEffect(r,[p,f.length]),b.useEffect(()=>{if(!n.open)return;const S=N=>{var E;return!((E=o.current)!=null&&E.contains(N.target))&&n.onOpen(!1)};return window.addEventListener("pointerdown",S,!0),()=>window.removeEventListener("pointerdown",S,!0)},[n.open]);const v=f.filter(S=>S.request.state==="done"||S.request.state==="failed");return s.jsxs("div",{ref:o,className:`oc-result oc-anchored req-mk is-${m.request.state} ${p?"is-open":""}`,role:"group","aria-label":be.markerAria,"data-req-marker":m.file+"|"+(m.path||""),onPointerDown:S=>S.stopPropagation(),children:[s.jsxs("div",{className:"oc-result-head req-mk-line",children:[s.jsx(_b,{state:m.request.state}),s.jsx("button",{className:"req-mk-text","aria-expanded":p,onClick:()=>n.onOpen(!n.open),title:m.text,children:s.jsx("span",{className:"oc-result-text",role:"status",children:Lb(m)})}),f.length>1&&s.jsx("span",{className:"req-mk-n",title:be.markerCount(f.length),"aria-label":be.markerCount(f.length),children:f.length}),v.length===f.length&&s.jsx("button",{className:"icon-btn sm","aria-label":be.dismiss,title:be.dismiss,onClick:()=>n.onDismiss(v.map(S=>S.id)),children:s.jsx(F,{name:"close",size:14})})]}),p&&s.jsx("div",{className:"req-mk-more",children:f.length===1?s.jsx(q1,{c:m,a:n.a,onComment:n.onComment}):s.jsxs(s.Fragment,{children:[s.jsx("ul",{className:"req-mk-rows",children:f.map(S=>s.jsx(V1,{c:S,a:n.a,onDismiss:n.onDismiss,onComment:n.onComment},S.id))}),f.some(S=>S.request.state==="waiting")&&s.jsx(Ub,{})]})})]})}const Ub=()=>s.jsxs("p",{className:"req-mk-how",children:[s.jsx("span",{children:be.markerSay(be.line)}),s.jsx(_1,{})]});function qb({c:n,a:o}){var m;const r=n.request,f=r.state==="done"?((m=o.undoFor)==null?void 0:m.call(o,n))??null:null;return f?s.jsx("button",{className:"btn",onClick:f,children:be.undoChange}):r.state==="done"&&r.undo==="undone"?s.jsx("span",{className:"req-undone",children:be.undone}):r.state==="done"&&r.undo==="gone"?s.jsx("span",{className:"req-undone",children:be.undoGone}):null}function q1({c:n,a:o,onComment:r}){const f=n.request;return s.jsxs("div",{className:`req-mk-row is-${f.state}`,"data-req":n.id,children:[s.jsx("p",{className:"req-mk-ask",title:n.text,children:n.text}),f.state==="taken"&&s.jsx("p",{className:"req-mk-state",children:be.took(f.by??"AI",Sf(f.takenAt))}),f.state==="waiting"&&s.jsx(Ub,{}),s.jsxs("div",{className:"oc-result-acts",children:[f.state==="waiting"&&s.jsx("button",{className:"btn",onClick:()=>o.onCancel(n),children:be.cancelRequest}),f.state==="failed"&&s.jsx("button",{className:"btn",onClick:()=>o.onRetry(n),children:be.retry}),s.jsx(qb,{c:n,a:o}),s.jsx("button",{className:"btn oc-plain req-mk-cmt",onClick:()=>r(n),children:be.openComment})]})]})}function V1({c:n,a:o,onDismiss:r,onComment:f}){var v;const m=n.request,p=m.state==="done"?(v=Mu(n))==null?void 0:v.text:m.state==="failed"?Lb(n):m.state==="taken"?be.took(m.by??"AI",Sf(m.takenAt)):null;return s.jsxs("li",{className:`req-mk-item is-${m.state}`,"data-req":n.id,children:[s.jsx(_b,{state:m.state}),s.jsxs("div",{className:"req-mk-item-text",children:[s.jsx("button",{className:"req-mk-ask is-own",title:`${n.text}
66
+ ${be.openComment}`,onClick:()=>f(n),children:n.text}),p&&s.jsx("p",{className:"req-mk-sub",children:p})]}),s.jsxs("span",{className:"req-mk-item-act",children:[m.state==="waiting"&&s.jsx("button",{className:"btn oc-plain",onClick:()=>o.onCancel(n),children:be.cancelRequest}),m.state==="failed"&&s.jsx("button",{className:"btn oc-plain",onClick:()=>o.onRetry(n),children:be.retry}),m.state==="done"&&s.jsx(qb,{c:n,a:o}),(m.state==="done"||m.state==="failed")&&s.jsx("button",{className:"icon-btn sm","aria-label":be.dismiss,title:be.dismiss,onClick:()=>r([n.id]),children:s.jsx(F,{name:"close",size:14})})]})]})}function Iy(n){const[o,r]=b.useState(""),[f,m]=b.useState(null),[p,v]=b.useState(!1),[S,N]=b.useState(!1),[E,x]=b.useState(null),[j,M]=b.useState(""),[$,L]=b.useState(!1),[I,k]=b.useState("all"),[_,W]=b.useState("page"),[X,ne]=b.useState(!1),te=b.useRef(null),ie=b.useRef(null);b.useLayoutEffect(()=>{es(te.current),es(ie.current,".crumb button, .crumb span[aria-hidden], .oc-cmt button")});const le=async(re,Fe=!1)=>{j.trim()&&(await Te.post("/api/comments",{action:"reply",id:re,text:j,author:n.author,resolve:Fe}),M(""),x(null))},he=re=>new Date(re).toLocaleString("ko-KR",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}),ce=n.selection,pe=!!ce&&!!n.file&&ce.file===n.file,we=n.comments.filter(re=>(!n.file||re.file===n.file)&&(!n.listAll||(_==="all"||!n.pageFiles||n.pageFiles.includes(re.file))&&(X||!re.resolved))),Ze=we.filter(ba).length,Ce=I==="ai"&&Ze?we.filter(ba):we,Nt=we.filter(re=>!re.resolved).length,at=b.useRef(null);b.useEffect(()=>{var re;n.focusComment&&(!Ce.some(Fe=>Fe.id===n.focusComment)&&we.some(Fe=>Fe.id===n.focusComment)&&k("all"),(re=at.current)==null||re.scrollIntoView({block:"nearest"}))},[n.focusComment,n.file,Ce.length]);const me=n.threadOnly?n.comments.find(re=>re.id===n.focusComment):void 0,ke=async()=>{ce&&(await navigator.clipboard.writeText(Dx(ce.file,ce.path,ce.tag,ce.text)).catch(()=>{}),N(!0),setTimeout(()=>N(!1),1200))},$e=async()=>{if(n.file){v(!0);try{const re=await Te.post("/api/screenshot",{file:n.file,path:ce==null?void 0:ce.path});m(re.path)}catch(re){m(d.inspector.shotFailed(re.message))}finally{v(!1)}}},qe=async()=>{if(!n.file||!o.trim())return;const re=(ce==null?void 0:ce.file)===n.file?ce.path:"";n.host&&$&&n.onAddForAi?await n.onAddForAi(o,re):await Te.post("/api/comments",{file:n.file,path:re,text:o,author:n.author}),r("")},fe=re=>{var Fe,ht,D,Y;return s.jsxs("li",{ref:re.id===n.focusComment?at:void 0,className:`oc-cmt-item ${re.resolved?"resolved":""} ${re.id===n.focusComment&&!n.threadOnly?"on":""}`,"aria-current":re.id===n.focusComment?"true":void 0,children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:re.author}),s.jsx(Db,{c:re}),re.path&&s.jsx("button",{className:"btn oc-plain c-path",title:re.path,onClick:()=>n.onSelectPath(re.path),children:((ht=(Fe=re.request)==null?void 0:Fe.attach)==null?void 0:ht.label)??((D=n.nameOf)==null?void 0:D.call(n,re.file,re.path))??re.path}),n.listAll&&s.jsx("span",{className:"c-file",children:((Y=n.titleOf)==null?void 0:Y.call(n,re.file))??re.file}),s.jsx("span",{className:"when",children:he(re.createdAt)})]}),(n.compact||n.listAll)&&!n.threadOnly&&n.onOpenThread?s.jsx("button",{className:"c-open",title:d.comments.openThread,onClick:()=>n.onOpenThread(re),children:re.text}):s.jsx("div",{children:re.text}),n.reqActions&&s.jsx(Bb,{c:re,a:n.reqActions}),(re.replies??[]).length>0&&s.jsx("ul",{className:"replies",children:re.replies.map(ue=>s.jsxs("li",{children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:ue.author}),s.jsx("span",{className:"when",children:he(ue.createdAt)})]}),s.jsx("div",{children:ue.text})]},ue.id))}),E===re.id&&s.jsxs("div",{className:"reply-box",children:[s.jsx("textarea",{autoFocus:!0,value:j,placeholder:d.comments.replyPlaceholder(n.author),"aria-label":d.comments.reply,onChange:ue=>M(ue.target.value),onKeyDown:ue=>{ue.nativeEvent.isComposing||(ue.key==="Enter"&&(ue.metaKey||ue.ctrlKey)&&le(re.id),ue.key==="Escape"&&x(null))}}),s.jsxs("div",{className:"oc-cmt-bar",children:[s.jsx("button",{className:"btn",onClick:()=>void le(re.id),disabled:!j.trim(),children:d.comments.reply}),s.jsx("button",{className:"btn",onClick:()=>void le(re.id,!0),disabled:!j.trim(),children:d.comments.replyResolve})]})]}),s.jsxs("div",{className:"oc-cmt-bar",children:[n.reqActions&&s.jsx(Hb,{c:re,a:n.reqActions}),E!==re.id&&s.jsx("button",{className:"btn oc-plain",onClick:()=>x(re.id),children:d.comments.reply}),s.jsx("button",{className:"btn oc-plain",onClick:()=>Te.post("/api/comments",{action:"resolve",id:re.id,resolved:!re.resolved}),children:re.resolved?d.comments.reopen:d.comments.resolve}),!re.resolved&&n.onAskAI&&!(ba(re)&&re.request.state!=="done")&&s.jsx("button",{className:"btn oc-plain",onClick:()=>n.onAskAI(re),title:d.comments.sendToAITitle,children:d.comments.sendToAI}),n.onCommentMenu&&s.jsx("button",{className:"icon-btn oc-ib c-more","aria-haspopup":"menu","aria-label":d.comments.more,title:d.comments.more,onClick:ue=>{const ge=ue.currentTarget.getBoundingClientRect();n.onCommentMenu(re,{clientX:ge.left,clientY:ge.bottom+4})},children:s.jsx(F,{name:"more",size:16})})]})]},re.id)};return me?s.jsx("div",{className:"pp inspector is-thread",children:s.jsx("div",{className:"pp-scroll",ref:ie,children:s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("h3",{className:"pp-group-h",children:[d.comments.title,s.jsx("span",{className:"c-file",children:me.file}),n.onAllComments&&we.length>1&&s.jsx("button",{className:"btn oc-plain c-all",onClick:n.onAllComments,children:d.comments.allOnBoard(we.length)})]}),s.jsx("ul",{className:"comments",children:fe(me)})]})})}):n.listAll&&!me?s.jsx("div",{className:`pp inspector is-all ${n.listAll==="comments"?"is-comments":""}`,children:s.jsxs("div",{className:"pp-scroll",ref:ie,children:[n.listAll==="empty"&&s.jsx("p",{className:"pp-note muted pp-nothing",children:d.comments.nothingSelected}),s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("div",{className:"cmt-filters",role:"group","aria-label":d.comments.scope,children:[s.jsx("span",{className:"pp-seg",children:["page","all"].map(re=>s.jsx("button",{"aria-pressed":_===re,className:_===re?"on":"",onClick:()=>W(re),children:re==="page"?d.comments.thisPage:d.comments.allPages},re))}),s.jsx("button",{"aria-pressed":X,className:`cmt-resolved ${X?"on":""}`,onClick:()=>ne(re=>!re),children:d.comments.showResolved})]}),Ze>0&&s.jsx(Qy,{all:we.length,forAi:Ze,value:I,onChange:k}),n.host&&s.jsx(Om,{comments:we}),Ce.length?s.jsx("ul",{className:"comments",children:Ce.map(fe)}):s.jsx("p",{className:"oc-empty oc-cmt-none",children:d.comments.none})]})]})}):s.jsxs("div",{className:"pp inspector",children:[s.jsxs("div",{className:"pp-scroll",ref:ie,children:[pe&&ce&&s.jsxs("header",{className:"pp-head",children:[s.jsx("span",{className:"pp-file",children:ce.file}),s.jsx("h2",{className:"pp-name",children:s.jsxs("span",{children:[d.inspector.kindName(ce.kind??ce.tag),ce.label&&` · ${ce.label.slice(0,40)}`,n.multi>1&&s.jsxs("span",{className:"muted",children:[" ",d.inspector.more(n.multi-1)]})]})}),s.jsxs("div",{className:"pp-crumb",children:[n.crumbs,ce.path.includes("/")&&s.jsx("button",{className:"icon-btn pp-ib","aria-label":d.menu.selectParent,title:d.menu.selectParent,onClick:()=>n.onSelectPath(ce.path.slice(0,ce.path.lastIndexOf("/"))),children:s.jsx(F,{name:"parent",size:16})})]}),ce.text&&!ce.label&&s.jsxs("p",{className:"pp-note sel-text",children:["“",ce.text.slice(0,120),"”"]})]}),n.error&&s.jsx("p",{className:"pp-note warn",children:n.error}),f&&s.jsx("p",{className:"pp-note muted shot",children:f}),n.section!=="comments"&&n.children,n.file&&n.section!=="props"&&s.jsxs("section",{className:"pp-group oc-cmt","aria-label":d.comments.title,children:[s.jsxs("h3",{className:"pp-group-h",children:[d.comments.title,Nt>0&&s.jsx("span",{className:"oc-count",children:Nt}),Ze>0&&s.jsx(Qy,{all:we.length,forAi:Ze,value:I,onChange:k})]}),s.jsx("textarea",{ref:n.commentRef,value:o,"aria-label":d.comments.title,placeholder:pe&&ce?d.comments.placeholderElement(ce.path):d.comments.placeholderBoard,onChange:re=>r(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&qe()}}),s.jsxs("div",{className:"oc-cmt-bar",children:[n.host&&n.onAddForAi&&s.jsxs("label",{className:"req-check",title:d.requests.forAiCheckTitle,children:[s.jsx("input",{type:"checkbox",checked:$,onChange:re=>L(re.target.checked)}),d.requests.forAiCheck]}),s.jsx("button",{className:`btn ${n.host&&$?"req-primary":""}`,onClick:qe,disabled:!o.trim(),children:n.host&&$?d.requests.addForAi:d.comments.add}),s.jsx("button",{className:"btn oc-plain",onClick:n.onAuthor,title:d.comments.authorTitle,children:d.comments.author(n.author)}),!pe&&s.jsx("button",{className:"btn oc-plain shot-link",onClick:$e,disabled:p,title:d.inspector.boardScreenshotTitle,children:p?d.inspector.capturing:d.inspector.boardScreenshot})]}),n.host&&s.jsx(Om,{comments:we}),s.jsx("ul",{className:"comments",children:Ce.map(fe)})]})]}),n.section==="comments"?null:pe?s.jsxs("footer",{className:"pp-actions","aria-label":d.inspector.actions,ref:te,children:[n.onDuplicate&&s.jsx("button",{className:"btn",onClick:n.onDuplicate,children:d.properties.duplicate}),s.jsx("button",{className:"btn",onClick:ke,children:S?d.inspector.copied:d.inspector.copy}),s.jsx("button",{className:"btn",onClick:$e,disabled:p,title:d.inspector.screenshotTitle,children:p?d.inspector.capturing:d.inspector.screenshot}),n.onDelete&&s.jsx("button",{className:"icon-btn pp-del","aria-label":d.properties.delete,title:d.boardOptions.deleteTitleKey,onClick:n.onDelete,children:s.jsx(F,{name:"trash"})})]}):n.footer]})}const G1=(n,o)=>n.x<o.x+o.w+(n.w+o.w)/2&&o.x<n.x+n.w+(n.w+o.w)/2&&n.y<o.y+o.h+(n.h+o.h)/2&&o.y<n.y+n.h+(n.h+o.h)/2;function Y1(n){const o=new Set,r=[];for(const f of n){if(o.has(f))continue;const m=[f];o.add(f);for(let p=0;p<m.length;p++)for(const v of n)!o.has(v)&&G1(v,m[p])&&(o.add(v),m.push(v));r.push(n.filter(p=>m.includes(p)))}return r}function X1(n){const o=Math.min(...n.map(r=>r.y));return n.filter(r=>r.y-o<r.h/2).reduce((r,f)=>f.x<r.x?f:r)}function K1(n){const o=Math.min(...n.map(f=>f.x)),r=Math.min(...n.map(f=>f.y));return{x:o,y:r,w:Math.max(...n.map(f=>f.x+f.w))-o,h:Math.max(...n.map(f=>f.y+f.h))-r}}function Z1(n,o,r,f){const m=new Set(r.map(p=>p??"")).size===1&&r[0]?r[0]:null;return{long:m?f.forkBlockWhile(n,o,m):null,medium:f.forkBlock(n,o),short:f.forkBlockShort(n)}}function F1(n,o,r,f){if(n.long&&r(n.long)<=o&&!f(r(n.long)))return n.long;for(const m of[n.medium,n.short])if(!f(r(m)))return m;return null}const Rm=n=>n.kind==="person"&&n.client===wf,Au=n=>n.by??n.person??d.occupancy.someone,Vb=(n,o)=>(n[o]??[]).filter(r=>r.kind==="agent"&&r.state==="editing");function Q1({list:n}){return s.jsx(s.Fragment,{children:n.map(o=>{const r=Rm(o),f=r?d.occupancy.you:o.state==="done"?d.occupancy.done(Au(o),d.occupancy.clock(o.doneAt??Date.now())):o.kind==="person"?d.occupancy.personEditing(Au(o)):d.occupancy.editing(Au(o));return s.jsxs("span",{className:`occ-tag ${r?"you":""} ${o.state==="done"?"done":""}`,"data-occ":o.key,title:f,children:[r?s.jsx("span",{className:"idot","aria-hidden":"true"}):o.state==="editing"&&o.kind==="agent"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(F,{name:jf(o.kind==="agent"?{by:o.by??""}:{person:o.person??""}),size:16}),s.jsx("span",{className:"act-tag-text",children:f})]},o.key)})})}function P1(n,o){const r=(n[o]??[]).find(f=>f.state==="editing");return r?{color:Rm(r)?"var(--select)":"var(--text)",label:Rm(r)?d.occupancy.youListDot:d.occupancy.listDot(Au(r))}:null}function of(n,o){var p;const r=n.boards[o];if(!r)return null;const f=(v,S)=>Object.keys(n.boards).filter(N=>{var E,x;return N!==v&&((E=n.boards[N].origin)==null?void 0:E.of)===v&&((x=n.boards[N].origin)==null?void 0:x.kind)===S});if((p=r.origin)!=null&&p.of&&n.boards[r.origin.of])return{original:r.origin.of,kind:r.origin.kind,chosen:o,alts:f(r.origin.of,r.origin.kind)};const m=f(o,"fork");return m.length?{original:o,kind:"fork",chosen:o,alts:m}:null}const J1=(n,o)=>[o.original,...o.alts].flatMap(r=>Vb(n,r))[0]??null,I1=n=>n.replace(/:.*$/,"");function W1({file:n,group:o,busy:r,open:f,onOpen:m,compact:p=!1}){const v=o.kind==="variant"?d.occupancy.useThis:d.occupancy.useThisOne;return s.jsxs("button",{className:`icon-btn sm use-btn ${r?"":"ready"} ${f?"pressed":""} ${p?"icon-only":""}`,"data-use":n,"aria-disabled":r?!0:void 0,"aria-haspopup":"dialog","aria-expanded":f,"aria-label":p?v:void 0,title:r?d.occupancy.waitFor(Au(r)):p?v:o.kind==="variant"?d.occupancy.useThisTitle:d.occupancy.useThisOneTitle(o.alts.length),onPointerDown:S=>S.stopPropagation(),onDoubleClick:S=>S.stopPropagation(),onClick:S=>{S.stopPropagation(),r||m()},children:[s.jsx(F,{name:"check",size:14}),!p&&s.jsx("span",{className:"use-label",children:v})]})}function ew(n){const o=b.useRef(null),[r,f]=b.useState(null),m=()=>document.querySelector(`[data-use="${CSS.escape(n.file)}"]`),p=j=>{var M;return((M=n.board.boards[j])==null?void 0:M.title)??j},v=n.group,S=p(v.original),N=d.occupancy,[E,x]=v.kind==="variant"?[N.confirmVariant(p(v.chosen),S),N.confirmVariantBody(S,v.alts.length-1)]:v.chosen===v.original?[N.confirmKeep(S),N.confirmKeepBody(v.alts.map(p).join(", "),v.alts.length)]:[N.confirmFork(p(v.chosen),S),N.confirmForkBody(S,v.alts.length-1)];return b.useLayoutEffect(()=>{var _,W;const j=m();if(!j)return void n.onClose();const M=j.getBoundingClientRect(),$=((_=o.current)==null?void 0:_.offsetWidth)??288,L=Math.round(Math.max(8,Math.min(M.right-$,window.innerWidth-$-8))),I=((W=o.current)==null?void 0:W.offsetHeight)??120,k=Math.round(Math.max(8,Math.min(M.bottom+8,window.innerHeight-I-8)));(!r||r.x!==L||r.y!==k)&&f({x:L,y:k})}),b.useEffect(()=>{var M,$;($=(M=o.current)==null?void 0:M.querySelector("button"))==null||$.focus();const j=L=>{var k,_;const I=L.target;(k=o.current)!=null&&k.contains(I)||(_=m())!=null&&_.contains(I)||n.onClose()};return window.addEventListener("pointerdown",j,!0),()=>window.removeEventListener("pointerdown",j,!0)},[n.file]),s.jsxs("div",{ref:o,className:"menu confirm entering",role:"dialog","aria-label":E,style:{left:(r==null?void 0:r.x)??-9999,top:(r==null?void 0:r.y)??-9999},onKeyDown:j=>{var M;j.key==="Escape"&&(j.stopPropagation(),n.onClose(),(M=m())==null||M.focus())},children:[s.jsx("p",{className:"c-title",children:E}),s.jsx("p",{className:"c-body",children:x}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn oc-strong",disabled:n.busy,onClick:n.onApply,children:N.apply}),s.jsx("button",{className:"btn oc-plain",disabled:n.busy,onClick:n.onKeepAll,children:v.kind==="variant"||v.alts.length>1?N.keepAll:N.keepBoth})]})]})}function tw({board:n,files:o,zoom:r}){const f=new Set(o),m=new Map;for(const p of o){const v=n.boards[p].origin;(v==null?void 0:v.kind)==="fork"&&f.has(v.of)&&n.boards[v.of]&&m.set(v.of,[...m.get(v.of)??[],{...n.boards[p],f:p}])}return m.size?s.jsx(s.Fragment,{children:[...m].flatMap(([p,v])=>Y1(v).map(S=>s.jsx(nw,{of:p,from:n.boards[p],forks:S,zoom:Math.max(r,.05),board:n},S.map(N=>N.f).join(" "))))}):null}function nw({of:n,from:o,forks:r,zoom:f,board:m}){const p=b.useRef(null),v=b.useRef(null),S=X1(r),N=K1(r),E=r.length,x=o.title??n,j=Z1(E,x,r.map(he=>{var ce;return(ce=he.origin)==null?void 0:ce.while}),d.occupancy),[M,$]=b.useState(j.medium),L={left:N.x,top:N.y+N.h+10/f,transform:`scale(${1/f})`,transformOrigin:"0 0"};b.useLayoutEffect(()=>{var $e;const he=v.current,ce=($e=p.current)==null?void 0:$e.getBoundingClientRect();if(!he||!ce)return;const pe=document.createElement("canvas").getContext("2d"),we=getComputedStyle(he),Ze=parseFloat(we.paddingLeft)+parseFloat(we.paddingRight);pe&&(pe.font=`${we.fontWeight} ${we.fontSize} ${we.fontFamily}`);const Ce=parseFloat(we.lineHeight)||16,Nt=ce.left+N.x*f,at=ce.top+(N.y+N.h)*f+10,me=[...document.querySelectorAll(".canvas .note, .canvas .board-frame, .canvas .board-label")].map(qe=>qe.getBoundingClientRect()),ke=F1(j,N.w*f,qe=>(pe?pe.measureText(qe).width:qe.length*7)+Ze,qe=>me.some(fe=>fe.left<Nt+qe&&fe.right>Nt&&fe.top<at+Ce&&fe.bottom>at));ke!==M&&$(ke)},[f,N.x,N.y,N.w,N.h,j.long,j.medium,j.short,m]);const I=aw(o,S),k=I[I.length-1],_=I[0];if(Math.hypot(k.x-_.x,k.y-_.y)<4)return null;const W=1.5/f,X=I[I.length-2],ne=Math.atan2(k.y-X.y,k.x-X.x),te=6/f,ie=Math.min(...I.map(he=>he.x))-te,le=Math.min(...I.map(he=>he.y))-te;return s.jsxs("div",{ref:p,className:"fork-link","data-fork":S.f,"data-forks":r.map(he=>he.f).join(" "),"aria-label":j.long??j.medium,role:"img",children:[s.jsx("svg",{className:"fork-svg",style:{left:ie,top:le,width:Math.max(...I.map(he=>he.x))+te-ie,height:Math.max(...I.map(he=>he.y))+te-le},"aria-hidden":"true",children:s.jsxs("g",{transform:`translate(${-ie} ${-le})`,children:[s.jsx("path",{d:I.map((he,ce)=>`${ce?"L":"M"}${he.x} ${he.y}`).join(""),strokeWidth:W,strokeDasharray:`${4*W} ${4*W}`}),s.jsx("path",{d:`M${k.x-te*Math.cos(ne-.6)} ${k.y-te*Math.sin(ne-.6)}L${k.x} ${k.y}L${k.x-te*Math.cos(ne+.6)} ${k.y-te*Math.sin(ne+.6)}`,strokeWidth:W})]})}),s.jsx("div",{className:"fork-caption",style:{...L,visibility:M?void 0:"hidden"},"aria-hidden":"true",children:s.jsx("span",{ref:v,children:M??j.short})})]})}function aw(n,o){const r=Math.max(n.y,o.y)+Math.min(48,Math.min(n.h,o.h)/4),f=r<Math.min(n.y+n.h,o.y+o.h);if(f&&o.x>=n.x+n.w)return[{x:n.x+n.w+8,y:r},{x:o.x-8,y:r}];if(f&&o.x+o.w<=n.x)return[{x:n.x-8,y:r},{x:o.x+o.w+8,y:r}];const m=S=>Math.min(48,S.h/4);if(o.x<n.x+n.w&&o.x+o.w>n.x){const S=Math.min(n.x,o.x)-40,N=o.y>=n.y,E=N?n.y+n.h-m(n):n.y+m(n),x=N?o.y+m(o):o.y+o.h-m(o);return[{x:n.x-8,y:E},{x:S,y:E},{x:S,y:x},{x:o.x-8,y:x}]}const p={x:n.x+n.w/2,y:n.y+n.h/2},v={x:o.x+o.w/2,y:o.y+o.h/2};return o.y>=n.y+n.h?[{x:p.x,y:n.y+n.h+8},{x:v.x,y:o.y-8}]:[{x:p.x,y:n.y-8},{x:v.x,y:o.y+o.h+8}]}const bm=n=>n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",Wy=n=>Number(n.split("/").pop());function Dm(n){var ne;const[o,r]=b.useState([]),[f,m]=b.useState(()=>n.bare?{}:{0:!0}),[p,v]=b.useState(null),[S,N]=b.useState(null),[E,x]=b.useState(null);b.useEffect(()=>{Te.get(`/api/outline?f=${encodeURIComponent(n.file)}`).then(te=>r(te.tree)).catch(()=>r([]))},[n.file,n.version]),b.useEffect(()=>{const te={};for(const ie of n.selected){const le=ie.split("/");for(let he=1;he<le.length;he++)te[le.slice(0,he).join("/")]=!0}Object.keys(te).length&&m(ie=>({...ie,...te}))},[n.selected.join("|")]);const j=te=>{if(!p||p===te||te.startsWith(p+"/"))return;const ie=bm(te);let le=Wy(te);bm(p)===ie&&Wy(p)<le&&(le-=1),n.onMove(p,ie,le)},M=[],$=new Map,L=te=>{for(const ie of te)M.push(ie),$.set(ie.path,ie),ie.children.length&&f[ie.path]&&L(ie.children)};L(o);const I=E??n.selected[n.selected.length-1]??((ne=M[0])==null?void 0:ne.path)??null,k=te=>{te==null||!$.has(te)||(x(te),n.onSelect(te,!1))},_=te=>{if(!I)return;const ie=M.findIndex(pe=>pe.path===I),le=$.get(I),ce={ArrowDown:()=>{var pe;return k((pe=M[ie+1])==null?void 0:pe.path)},ArrowUp:()=>{var pe;return k((pe=M[ie-1])==null?void 0:pe.path)},ArrowRight:()=>le!=null&&le.children.length?f[I]?k(le.children[0].path):m(pe=>({...pe,[I]:!0})):void 0,ArrowLeft:()=>le!=null&&le.children.length&&f[I]?m(pe=>({...pe,[I]:!1})):k(I.includes("/")?bm(I):null),Home:()=>{var pe;return k((pe=M[0])==null?void 0:pe.path)},End:()=>{var pe;return k((pe=M[M.length-1])==null?void 0:pe.path)},Enter:()=>k(I)," ":()=>k(I)}[te.key];ce&&(te.preventDefault(),te.stopPropagation(),ce())},W=(te,ie)=>{const le=te.children.length>0,he=f[te.path];return s.jsxs("li",{children:[s.jsxs("div",{role:"treeitem","aria-selected":n.selected.includes(te.path),"aria-expanded":le?!!he:void 0,"aria-level":ie+1,className:`layer ${n.selected.includes(te.path)?"on":""} ${S===te.path?"over":""} ${I===te.path?"kbd-focus":""}`,style:{paddingLeft:8+(ie+(n.bare?1:0))*16},draggable:!0,onDragStart:ce=>{v(te.path),ce.dataTransfer.effectAllowed="move"},onDragEnd:()=>{v(null),N(null)},onDragOver:ce=>{p&&(ce.preventDefault(),N(te.path))},onDragLeave:()=>N(ce=>ce===te.path?null:ce),onDrop:ce=>{ce.preventDefault(),j(te.path),N(null)},onClick:ce=>{x(te.path),n.onSelect(te.path,ce.shiftKey)},children:[s.jsx("button",{className:"twisty",tabIndex:-1,"aria-label":he?d.layers.collapse:d.layers.expand,style:{visibility:le?"visible":"hidden"},onClick:ce=>{ce.stopPropagation(),m(pe=>({...pe,[te.path]:!he}))},children:s.jsx(F,{name:he?"chevronDown":"chevronRight",size:14})}),s.jsx("span",{className:"tag",children:te.tag}),s.jsxs("span",{className:"lname",children:[te.cls&&`.${te.cls}`,te.cls&&te.text&&" · ",te.text]})]}),le&&he&&s.jsx("ul",{children:te.children.map(ce=>W(ce,ie+1))})]},te.path)},X=s.jsx("ul",{className:"layer-tree",role:n.bare?"group":"tree","aria-label":n.bare?void 0:d.layers.title,title:d.layers.hint,tabIndex:0,onKeyDown:_,children:o.map(te=>W(te,0))});return n.bare?X:s.jsxs("section",{className:"pp-group layers",children:[s.jsx("h3",{className:"pp-group-h",title:d.layers.hint,children:d.layers.title}),X]})}function eb(n){const[o,r]=b.useState({});return n.boards.length?s.jsx("section",{className:"pp-group layers page-outline","aria-label":d.layers.outline,children:s.jsx("ul",{className:"layer-tree",role:"tree","aria-label":d.layers.outline,children:n.boards.map(f=>s.jsxs("li",{children:[s.jsxs("div",{role:"treeitem","aria-expanded":!!o[f.file],"aria-level":1,className:"layer board-layer",style:{paddingLeft:8},onClick:()=>n.onPickBoard(f.file),children:[s.jsx("button",{className:"twisty",tabIndex:-1,"aria-label":o[f.file]?d.layers.collapse:d.layers.expand,onClick:m=>{m.stopPropagation(),r(p=>({...p,[f.file]:!p[f.file]}))},children:s.jsx(F,{name:o[f.file]?"chevronDown":"chevronRight",size:14})}),s.jsx(F,{name:"board",size:14,className:"layer-icon"}),s.jsx("span",{className:"lname",children:f.title})]}),o[f.file]&&s.jsx(Dm,{bare:!0,file:f.file,version:n.versions[f.file]??0,selected:[],onSelect:m=>n.onPickElement(f.file,m),onMove:()=>{}})]},f.file))})}):s.jsx("p",{className:"oc-empty pp-nothing",children:d.comments.nothingSelected})}const lw=12,tb=n=>{var o;return((o=/^([a-z]+)[-_]/i.exec(n))==null?void 0:o[1].toUpperCase())??""},sw=b.forwardRef(function(o,r){var k;const[f,m]=b.useState(""),[p,v]=b.useState(null),[S,N]=b.useState(null),E=(k=o.pages[0])==null?void 0:k.id,x=b.useMemo(()=>{const _=f.trim().toLowerCase();return[...new Set(o.board.order)].filter(W=>{const X=o.board.boards[W];return X?_?W.toLowerCase().includes(_)||(X.title??"").toLowerCase().includes(_):!o.pages.length||(X.page??E)===o.currentPage:!1})},[f,o.board,o.pages,o.currentPage,E]),j=b.useMemo(()=>{if(f.trim()||x.length<lw)return null;const _=new Map;for(const ne of x){const te=tb(ne);_.has(te)||_.set(te,[]),_.get(te).push(ne)}const W=[..._.keys()].filter(ne=>ne&&_.get(ne).length>=2);if(W.length<2)return null;const X=x.filter(ne=>!W.includes(tb(ne)));return[...W.map(ne=>({key:ne,label:ne,files:_.get(ne)})),...X.length?[{key:"",label:d.boardList.otherGroup,files:X}]:[]]},[x,f]),[M,$]=b.useState(()=>{try{return JSON.parse(localStorage.getItem("design-canvas:groups-closed")??"{}")}catch{return{}}}),L=_=>$(W=>{const X={...W,[_]:!W[_]};try{localStorage.setItem("design-canvas:groups-closed",JSON.stringify(X))}catch{}return X}),I=_=>{var te;const W=o.board.boards[_],X=!!W.title&&W.title!==_.replace(/\.html$/,""),ne=(te=o.dotOf)==null?void 0:te.call(o,_);return s.jsx("li",{children:s.jsxs("button",{className:`row oc-row ${o.selected.includes(_)?"on":""}`,"aria-current":o.selected.includes(_)||void 0,onClick:ie=>o.onPick(_,ie.shiftKey||ie.metaKey),onContextMenu:ie=>{o.onBoardMenu&&(ie.preventDefault(),o.onBoardMenu(_,ie))},title:_,children:[s.jsx("span",{className:"row-title",children:W.title??_}),o.missing.includes(_)&&s.jsx(F,{name:"warn",size:14,className:"warn-icon","aria-label":d.boardList.fileMissing}),ne&&s.jsx("span",{className:"idot occ-dot",style:{background:ne.color},role:"img","aria-label":ne.label,title:ne.label}),X&&s.jsx("span",{className:"row-file",children:_})]})},_)};return s.jsxs("aside",{ref:o.cardRef,className:o.className??"left",style:o.style,"aria-label":d.boardList.aria,children:[o.header,o.showPages!==!1&&s.jsxs("section",{className:"left-pages",children:[s.jsxs("div",{className:"oc-sec",children:[s.jsx("span",{children:d.boardList.pages}),o.onAddPage&&s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.boardList.addPage,title:d.boardList.addPage,onClick:o.onAddPage,children:s.jsx(F,{name:"plus",size:16})})]}),o.pages.length===0?s.jsx("p",{className:"oc-empty",children:d.boardList.singlePage}):s.jsx("ul",{className:"oc-list",role:"tablist","aria-label":d.boardList.pages,children:o.pages.map((_,W)=>s.jsx("li",{draggable:!!o.onMovePage,onDragStart:X=>{v(_.id),X.dataTransfer.effectAllowed="move"},onDragOver:X=>{p&&(X.preventDefault(),N(W))},onDragEnd:()=>{v(null),N(null)},onDrop:X=>{var te;X.preventDefault();const ne=o.pages.findIndex(ie=>ie.id===p);p&&ne!==W&&((te=o.onMovePage)==null||te.call(o,p,W)),v(null),N(null)},children:s.jsxs("button",{role:"tab",title:d.boardList.pageTabTitle,"aria-selected":_.id===o.currentPage,className:`row oc-row ${_.id===o.currentPage?"on":""} ${S===W&&p!==_.id?"drop-before":""}`,onClick:()=>o.onPage(_.id),onContextMenu:X=>{o.onPageMenu&&(X.preventDefault(),o.onPageMenu(_.id,X))},children:[s.jsx("span",{className:"row-title",children:_.name}),s.jsx("span",{className:"row-count",children:Object.values(o.board.boards).filter(X=>(X.page??E)===_.id).length})]})},_.id))})]}),s.jsxs("section",{className:"left-boards",children:[s.jsx("div",{className:"oc-sec",children:s.jsxs("span",{children:[d.boardList.boardsHead,s.jsx("span",{className:"oc-count",children:x.length})]})}),s.jsxs("label",{className:"oc-search",children:[s.jsx(F,{name:"search",size:16}),s.jsx("input",{ref:r,value:f,placeholder:d.boardList.searchPlaceholder,"aria-label":d.boardList.search,onChange:_=>m(_.target.value),onKeyDown:_=>{_.nativeEvent.isComposing||(_.key==="Enter"&&x[0]&&o.onPick(x[0],!1),_.key==="Escape"&&(m(""),_.target.blur()))}})]}),x.length===0?s.jsx("p",{className:"oc-empty",children:f?d.boardList.noMatch(f):d.boardList.emptyPage}):j?s.jsx("ul",{className:"oc-list board-list",children:j.map(_=>{var X;const W=!M[_.key]||_.files.some(ne=>o.selected.includes(ne));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:d.boardList.groupTitle(_.files.length),onClick:()=>L(_.key),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),L(_.key))},onDoubleClick:()=>{var ne;return _.key&&((ne=o.onGroupRename)==null?void 0:ne.call(o,_.key))},onContextMenu:ne=>{o.onGroupMenu&&(ne.preventDefault(),o.onGroupMenu(_.key,_.files,ne))},children:[s.jsx(F,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"row-title",children:_.key&&((X=o.board.groupNames)==null?void 0:X[_.key])||_.label}),s.jsx("span",{className:"row-count",children:_.files.length}),o.onGroupMenu&&s.jsx("button",{className:"icon-btn sm group-more","aria-label":d.boardList.groupMenu,title:d.boardList.groupMenu,onClick:ne=>{ne.stopPropagation();const te=ne.currentTarget.getBoundingClientRect();o.onGroupMenu(_.key,_.files,{clientX:te.left,clientY:te.bottom+4})},children:s.jsx(F,{name:"more",size:14})})]}),W&&s.jsx("ul",{className:"oc-list oc-sub",children:_.files.map(I)})]},_.key)})}):s.jsx("ul",{className:"oc-list board-list",children:x.map(I)})]}),o.footer]})});function ow({rects:n,selected:o,view:r,size:f,onJump:m,w:p=200,h:v=130,inset:S=0,reserve:N=0,className:E="minimap"}){const x=b.useMemo(()=>{if(!n.length)return{x:0,y:0,w:1,h:1};const W=Math.min(...n.map(ne=>ne.x)),X=Math.min(...n.map(ne=>ne.y));return{x:W,y:X,w:Math.max(...n.map(ne=>ne.x+ne.w))-W,h:Math.max(...n.map(ne=>ne.y+ne.h))-X}},[n]),j=v-S-Math.max(S,N),M=Math.min((p-S*2)/x.w,j/x.h),$=(p-x.w*M)/2,L=S+(j-x.h*M)/2,I={x:(-r.x/r.zoom-x.x)*M+$,y:(-r.y/r.zoom-x.y)*M+L,w:Math.max(0,f.w/r.zoom*M),h:Math.max(0,f.h/r.zoom*M)},k=b.useRef(!1),_=W=>{const X=W.currentTarget.getBoundingClientRect(),ne=X.width/p;m(((W.clientX-X.left)/ne-$)/M+x.x,((W.clientY-X.top)/ne-L)/M+x.y)};return s.jsx("div",{className:`${E} ${n.length>30?"many":""}`,role:"img","aria-label":d.minimap.aria,onPointerDown:W=>{k.current=!0,W.currentTarget.setPointerCapture(W.pointerId),_(W)},onPointerMove:W=>k.current&&_(W),onPointerUp:()=>k.current=!1,children:s.jsxs("svg",{width:p,height:v,children:[n.map(W=>s.jsx("rect",{x:(W.x-x.x)*M+$,y:(W.y-x.y)*M+L,width:Math.max(1,W.w*M),height:Math.max(1,W.h*M),rx:2,className:o.includes(W.file)?"mm-sel":"mm-board"},W.file)),N>0&&s.jsx("clipPath",{id:`mm-clip-${p}`,children:s.jsx("rect",{x:0,y:0,width:p,height:v-N+2})}),s.jsx("rect",{x:Math.round(I.x)+.5,y:Math.round(I.y)+.5,width:Math.max(0,Math.round(I.w)-1),height:Math.max(0,Math.round(I.h)-1),rx:3,className:"mm-view",clipPath:N>0?`url(#mm-clip-${p})`:void 0})]})})}function iw(n){const o=n.item,r=d.boardOptions,f=(m,p,v,S,N=!1)=>s.jsx(uw,{label:p,bare:N,value:o[m]??0,min:v,max:S,onCommit:E=>n.onPatch({[m]:E})},m+n.file+(o[m]??""));return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"pp-head","aria-label":r.aria,children:[s.jsx("button",{className:"pp-file",onClick:n.onRenameFile,title:r.renameFileTitle,children:n.file}),s.jsxs("h2",{className:"pp-name",children:[s.jsx("span",{children:o.title??n.file}),s.jsx("button",{className:"icon-btn pp-ib","aria-label":d.menu.rename,title:r.renameTitle,onClick:n.onRename,children:s.jsx(F,{name:"edit",size:16})})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.positionAndSize}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.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:d.boardOptions.size}),s.jsxs("span",{className:"pp-two",children:[f("w",r.width,40,8e3),f("h",r.height,40,8e3)]})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.radius}),s.jsx("span",{className:"pp-two",children:f("radius",r.radius,0,200,!0)})]}),s.jsxs("div",{className:"pp-row",title:"bg",children:[s.jsx("span",{className:"pp-l",children:r.bg}),s.jsxs("span",{className:"tw-color",children:[s.jsx("label",{className:"sw-btn",style:{background:o.bg??"transparent"},children:s.jsx("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(o.bg??"")?o.bg:"#ffffff","aria-label":r.bg,onChange:m=>n.onPatch({bg:m.target.value.toUpperCase()})})}),s.jsx(cw,{value:o.bg??"",placeholder:r.bgNone,label:`${r.bg} (hex)`,onCommit:m=>n.onPatch({bg:m||void 0})},n.file+(o.bg??""))]})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.print}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.printMode}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":r.print,children:["continuous","fixed"].map(m=>s.jsx("button",{role:"radio","aria-checked":(o.print??"continuous")===m,className:(o.print??"continuous")===m?"on":"",onClick:()=>n.onPatch({print:m==="fixed"?"fixed":void 0,...m==="continuous"?{paper:void 0}:{}}),children:r.printModes[m]},m))})]}),o.print==="fixed"&&s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.paper}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":r.paper,children:["letter","a4"].map(m=>s.jsx("button",{role:"radio","aria-checked":(o.paper??"letter")===m,className:(o.paper??"letter")===m?"on":"",onClick:()=>n.onPatch({paper:m==="letter"?void 0:m}),children:r.papers[m]},m))})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.options}),s.jsx(cf,{on:!!o.is_interactive,label:r.interactive,title:r.interactiveTitle,onChange:m=>n.onPatch({is_interactive:m||void 0})}),s.jsx(cf,{on:!!o.frameless,label:r.frameless,onChange:m=>n.onPatch({frameless:m||void 0})}),s.jsx(cf,{on:o.expand==="fill",label:r.fill,onChange:m=>n.onPatch({expand:m?"fill":void 0})}),s.jsx(cf,{on:n.isLaunch,label:r.launch,onChange:n.onLaunch}),n.pages.length>0&&s.jsxs("label",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.page}),s.jsx("select",{value:o.page??n.pages[0].id,onChange:m=>n.onPatch({page:m.target.value}),children:n.pages.map(m=>s.jsx("option",{value:m.id,children:m.name},m.id))})]})]})]})}function cw(n){const[o,r]=b.useState(n.value);return s.jsx("input",{className:"tw-hex","aria-label":n.label,value:o,placeholder:n.placeholder,spellCheck:!1,onChange:f=>r(f.target.value),onBlur:()=>o.trim()!==n.value&&n.onCommit(o.trim()),onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur(),f.key==="Escape"&&r(n.value)}})}function rw(n){const o=d.boardOptions;return s.jsxs("footer",{className:"pp-actions","aria-label":d.inspector.boardActions,children:[s.jsx("button",{className:"icon-btn","aria-label":o.focus,title:o.focusTitle,onClick:n.onFocus,children:s.jsx(F,{name:"focus"})}),s.jsx("button",{className:"icon-btn","aria-label":o.duplicate,title:o.duplicateTitle,onClick:n.onDuplicate,children:s.jsx(F,{name:"copy"})}),s.jsx("button",{className:"icon-btn","aria-label":o.front,title:o.frontTitle,onClick:n.onFront,children:s.jsx(F,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":o.back,title:o.backTitle,onClick:n.onBack,children:s.jsx(F,{name:"back"})}),s.jsx("button",{className:"icon-btn pp-del","aria-label":o.delete,title:o.deleteTitleKey,onClick:n.onDelete,children:s.jsx(F,{name:"trash"})})]})}function cf(n){return s.jsxs("label",{className:"check",title:n.title,children:[s.jsx("input",{type:"checkbox",checked:n.on,onChange:o=>n.onChange(o.target.checked)}),s.jsx("i",{className:n.on?"on":"","aria-hidden":"true",children:n.on&&s.jsx(F,{name:"check",size:12})}),n.label]})}function uw({label:n,value:o,min:r,max:f,bare:m,onCommit:p}){const[v,S]=b.useState(String(o));b.useEffect(()=>S(String(o)),[o]);const N=()=>{let E=Math.round(Number(v));if(!Number.isFinite(E))return S(String(o));r!=null&&(E=Math.max(r,E)),f!=null&&(E=Math.min(f,E)),E!==o&&p(E),S(String(E))};return s.jsxs("label",{className:"num",children:[!m&&s.jsx("span",{children:n}),s.jsx("input",{inputMode:"numeric","aria-label":m?n:void 0,value:v,onChange:E=>S(E.target.value),onBlur:N,onKeyDown:E=>{if(!E.nativeEvent.isComposing&&(E.key==="Enter"&&E.target.blur(),E.key==="ArrowUp"||E.key==="ArrowDown")){E.preventDefault();const x=Number(v)+(E.key==="ArrowUp"?1:-1)*(E.shiftKey?10:1);S(String(x))}}})]})}function dw({store:n,...o}){return s.jsx(ow,{...o,view:Um(n)})}const nb="https://screens.invalid/",fw=n=>n.split("/").map(encodeURIComponent).join("/");function hw({board:n,file:o,onClose:r,onLocate:f,screens:m=wb}){var k;const p=b.useRef(null),[v,S]=b.useState(o),[N,E]=b.useState({list:[o],i:0}),x=!!m.html,j=x?N.list[N.i]:v,M=n.boards[j]??n.boards[o],$=_=>E(W=>({list:[...W.list.slice(0,W.i+1),_],i:W.i+1})),L=_=>{var W,X,ne,te;if(x)return E(ie=>({...ie,i:Math.max(0,Math.min(ie.list.length-1,ie.i+_))}));try{_<0?(X=(W=p.current)==null?void 0:W.contentWindow)==null||X.history.back():(te=(ne=p.current)==null?void 0:ne.contentWindow)==null||te.history.forward()}catch{}},I=()=>{var W,X,ne;let _=null;try{_=((W=p.current)==null?void 0:W.contentDocument)??null}catch{}if(_==null||_.addEventListener("click",te=>{var he,ce,pe;const ie=(ce=(he=te.target)==null?void 0:he.closest)==null?void 0:ce.call(he,"a[href]");if(!ie)return;if(x){const we=new URL(ie.getAttribute("href")??"",nb+fw(j));if(we.href.startsWith(nb)){const Ze=decodeURIComponent(we.pathname.slice(1));if(Ze===j&&we.hash)return;te.preventDefault(),((pe=m.html)==null?void 0:pe.call(m,Ze))!=null&&$(Ze);return}te.preventDefault(),window.open(we.href,"_blank","noopener");return}const le=new URL(ie.href,_.baseURI);le.origin!==location.origin&&(te.preventDefault(),window.open(le.href,"_blank","noopener"))}),!x)try{const te=new URL(m.url(""),location.href).href,ie=((ne=(X=p.current)==null?void 0:X.contentWindow)==null?void 0:ne.location.href)??"";ie.startsWith(te)&&S(decodeURIComponent(ie.slice(te.length).split(/[?#]/)[0]))}catch{}};return b.useEffect(()=>{const _=W=>W.key==="Escape"&&r();return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]),s.jsxs("div",{className:"play",onPointerDown:_=>_.target===_.currentTarget&&r(),children:[s.jsxs("div",{className:"play-bar",children:[s.jsx("button",{onClick:()=>L(-1),title:d.play.back,disabled:x&&N.i===0,children:"←"}),s.jsx("button",{onClick:()=>L(1),title:d.play.forward,disabled:x&&N.i>=N.list.length-1,children:"→"}),s.jsx("strong",{children:(M==null?void 0:M.title)??j}),s.jsx("span",{className:"muted",children:j}),s.jsx("div",{className:"spacer"}),s.jsx("button",{onClick:()=>{f(j),r()},children:d.play.viewOnCanvas}),s.jsx("button",{onClick:r,title:d.play.closeTitle,children:d.play.close})]}),s.jsx("iframe",{ref:p,className:"play-frame",src:x?void 0:m.url(o),srcDoc:x?(k=m.html)==null?void 0:k.call(m,j):void 0,title:d.viewer.play,onLoad:I,style:{width:Math.min((M==null?void 0:M.w)??390,window.innerWidth-32)}})]})}function mw(n,o){return n.length===1&&Object.hasOwn(o,n[0])?"play":"pen"}function ab(n){return(n.split(/[\\/]/).pop()||"board.html").replace(/\.html?$/i,"")+".png"}function vm(n,o){return n===501||/executable doesn't exist|playwright install|playwright is not installed|failed to launch|browserType\.launch/i.test(o)?"browser":"render"}const xm=n=>(n.split(`
67
+ `)[0]??"").trim().slice(0,140),Ut=d.design,pw=[{prop:"width",label:d.properties.fields.width},{prop:"height",label:d.properties.fields.height},{prop:"margin",label:"margin"},{prop:"color",label:d.properties.fields.color,color:!0},{prop:"background",label:d.properties.fields.background,color:!0},{prop:"display",label:"display",options:["","block","flex","grid","inline-flex","none"]},{prop:"flex-direction",label:d.properties.fields.flexDirection,options:["","row","column"]},{prop:"align-items",label:d.properties.fields.alignItems,options:["","flex-start","center","flex-end","stretch","baseline"]},{prop:"justify-content",label:d.properties.fields.justifyContent,options:["","flex-start","center","flex-end","space-between"]},{prop:"flex-wrap",label:d.properties.fields.flexWrap,options:["","nowrap","wrap"]},{prop:"flex-grow",label:d.properties.fields.flexGrow,options:["","0","1"]},{prop:"align-self",label:d.properties.fields.alignSelf,options:["","auto","flex-start","center","flex-end","stretch"]},{prop:"line-height",label:d.properties.fields.lineHeight},{prop:"text-align",label:d.properties.fields.textAlign,options:["","left","center","right"]},{prop:"border",label:d.properties.fields.border},{prop:"box-shadow",label:d.properties.fields.boxShadow},{prop:"opacity",label:d.properties.fields.opacity}];function lb(n){if(!n||n==="none")return null;const o=n.match(/^\s*repeat\(\s*(\d+)\s*,/);if(o)return Number(o[1]);let r=0,f=0,m=!1;for(const p of n)p==="("&&r++,p===")"&&r--,/\s/.test(p)&&r===0?m=!1:m||(m=!0,f++);return f||null}const gw=n=>`repeat(${n}, minmax(0, 1fr))`,yw=[{dir:"left",label:d.properties.alignButtons.left,icon:"alignLeft"},{dir:"hcenter",label:d.properties.alignButtons.hcenter,icon:"alignHcenter"},{dir:"right",label:d.properties.alignButtons.right,icon:"alignRight"},{dir:"top",label:d.properties.alignButtons.top,icon:"alignTop"},{dir:"vcenter",label:d.properties.alignButtons.vcenter,icon:"alignVcenter"},{dir:"bottom",label:d.properties.alignButtons.bottom,icon:"alignBottom"}],bw={a:["href"],img:["src","alt"],input:["placeholder"],button:["aria-label"]};function vw(n){var I;const o=n.selection,r=bw[o.tag]??[],f=$b(n.tokens),m=Ob(o,n.inline),p=!!o.text.trim(),[v,S]=b.useState(null);b.useEffect(()=>S(null),[o.file,o.path]);const N=o.path+o.hash,E=k=>Xy(k,n.inline[k]??"",n.tokens),x=k=>{var W;const _=ya(k);return _==="#FFFFFF"?Ut.white:_==="#000000"?Ut.black:((W=zu(k,f))==null?void 0:W.name)??_??k},j=ya(o.styles["background-color"]),M=p?m.prop==="background"?ff(o.styles.color??"",j??n.bg):ff(o.styles.color??"",n.bg):null,$=M==null?null:m.prop==="background"?Ut.contrastWith(M.toFixed(1),x(o.styles.color??""),Ut.grade(M)):Ut.contrastOn(M.toFixed(1),x(n.bg),Ut.grade(M)),L=[...new Set([...(I=n.tokens)!=null&&I.registered?n.tokens.fontWeights:[],100,200,300,400,500,600,700,800,900])].sort((k,_)=>k-_);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:Ut.fill}),s.jsx(El,{word:Ut.color,css:m.css,children:s.jsx(ob,{value:m.value,computed:m.prop==="color"?o.styles.color:o.styles["background-color"],colors:f,css:m.css,label:Ut.fill,open:v==="fill",onToggle:()=>S(k=>k==="fill"?null:"fill")})}),$&&s.jsx("div",{className:"pp-row",children:s.jsx("span",{className:`pp-note contrast ${M>=4.5?"ok":M>=3?"mid":"bad"}`,title:d.properties.contrastTitle,children:$})}),v==="fill"&&s.jsx($m,{title:Ut.fill,value:m.value,colors:f,vars:n.vars,onPick:k=>n.onStyle(m.css,k)})]}),p&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:Ut.text}),s.jsx(El,{word:Ut.font,css:"font-family",children:s.jsx(si,{label:Ut.font,value:My(n.inline["font-family"]),placeholder:My(o.styles["font-family"]),onCommit:k=>n.onStyle("font-family",k?l0(k):"")},"ff"+N)}),s.jsx(El,{word:Ut.size,css:"font-size",warn:E("font-size"),children:s.jsx(si,{label:Ut.size,value:Fa(n.inline["font-size"]),placeholder:Fa(o.styles["font-size"]),onCommit:k=>n.onStyle("font-size",hf(k))},"fs"+N)}),s.jsx(El,{word:Ut.weight,css:"font-weight",warn:E("font-weight"),children:s.jsxs("select",{"aria-label":Ut.weight,defaultValue:n.inline["font-weight"]??"",onChange:k=>n.onStyle("font-weight",k.target.value),children:[s.jsx("option",{value:"",children:Ut.inherited(Cm(o.styles["font-weight"],Ut.weights))}),L.map(k=>s.jsx("option",{value:String(k),children:Cm(k,Ut.weights)},k))]},"fw"+N)}),s.jsx(El,{word:Bt.letterSpacing,css:"letter-spacing",children:s.jsx(si,{label:Bt.letterSpacing,value:Fa(n.inline["letter-spacing"]),placeholder:o.styles["letter-spacing"]==="normal"?"0":Fa(o.styles["letter-spacing"]),onCommit:k=>n.onStyle("letter-spacing",xw(k))},"ls"+N)}),m.prop==="background"&&s.jsxs(s.Fragment,{children:[s.jsx(El,{word:Ut.color,css:"color",children:s.jsx(ob,{value:n.inline.color??"",computed:o.styles.color,colors:f,css:"color",label:Ut.color,open:v==="color",onToggle:()=>S(k=>k==="color"?null:"color")})}),v==="color"&&s.jsx($m,{title:Ut.color,value:n.inline.color||o.styles.color||"",colors:f,vars:n.vars,onPick:k=>n.onStyle("color",k)})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.properties.layout}),s.jsx(El,{word:Ut.cornerRadius,css:"border-radius",warn:E("border-radius"),children:s.jsx(si,{label:Ut.cornerRadius,value:Fa(n.inline["border-radius"]),placeholder:Fa(o.styles["border-radius"]),onCommit:k=>n.onStyle("border-radius",hf(k))},"br"+N)}),s.jsx(El,{word:Ut.padding,css:"padding",warn:E("padding"),children:s.jsx(si,{label:Ut.padding,value:Tm(n.inline.padding),placeholder:Tm(o.styles.padding),onCommit:k=>n.onStyle("padding",n0(k))},"pd"+N)}),s.jsx(El,{word:Ut.gap,css:"gap",warn:E("gap"),children:s.jsx(si,{label:Ut.gap,value:Fa(n.inline.gap),placeholder:Fa(o.styles.gap==="normal"?"":o.styles.gap),onCommit:k=>n.onStyle("gap",hf(k))},"gp"+N)}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.align}),s.jsx("span",{className:"align-set",role:"group","aria-label":d.properties.align,children:yw.map(k=>s.jsx("button",{className:"icon-btn","aria-label":k.label,title:k.label,onClick:()=>n.onAlign(k.dir),children:s.jsx(F,{name:k.icon,size:16})},k.dir))})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.wrap}),s.jsxs("span",{className:"pp-btns",children:[s.jsx("button",{className:"btn",onClick:()=>n.onWrap("flex"),disabled:!n.canWrap,title:d.properties.wrapTitle,children:d.properties.wrapFlex}),s.jsx("button",{className:"btn",onClick:()=>n.onWrap("grid"),disabled:!n.canWrap,title:d.properties.wrapTitle,children:d.properties.wrapGrid})]})]}),n.onReplaceImage&&s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:d.properties.image}),s.jsx("span",{className:"pp-btns",children:s.jsx("button",{className:"btn",onClick:n.onReplaceImage,children:d.properties.replaceImage})})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:Bt.size}),["width","height"].map(k=>s.jsx(ww,{axis:k,inline:n.inline[k]??"",computed:o.styles[k]??"",onStyle:n.onStyle},k+N)),s.jsx(El,{word:Bt.position,css:"position",children:s.jsxs("select",{"aria-label":Bt.position,value:n.inline.position==="absolute"?"absolute":"",onChange:k=>n.onStyle("position",k.target.value),children:[s.jsx("option",{value:"",children:Bt.flow}),s.jsx("option",{value:"absolute",children:Bt.absolute})]},"ps"+N)})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:Bt.look}),s.jsx(jw,{inline:n.inline.opacity??"",computed:o.styles.opacity??"1",onStyle:n.onStyle},"op"+N),s.jsxs("div",{className:"pp-row",title:"border-style",children:[s.jsx("span",{className:"pp-l",children:Bt.border}),s.jsx("span",{className:"pp-seg",role:"radiogroup","aria-label":Bt.border,children:["none","solid","dashed","dotted"].map(k=>{const _=n.inline["border-style"]||(n.inline.border??"").split(/\s+/).find(W=>["solid","dashed","dotted","none"].includes(W))||(o.styles["border-style"]&&o.styles["border-width"]!=="0px"?o.styles["border-style"]:"none");return s.jsx("button",{role:"radio","aria-checked":_===k,className:_===k?"on":"",onClick:()=>{if(k==="none")return n.onStyle("border-style",n.inline.border?"none":"");!n.inline.border&&(o.styles["border-width"]??"0px").startsWith("0")?n.onStyle("border",`1px ${k} currentColor`):n.onStyle("border-style",k)},children:Bt.borderStyles[k]},k)})})]}),s.jsx(El,{word:Bt.shadow,css:"box-shadow",children:s.jsxs("select",{"aria-label":Bt.shadow,value:sb(n.inline["box-shadow"]??""),onChange:k=>n.onStyle("box-shadow",Bm[k.target.value]??""),children:[Object.keys(Bm).map(k=>s.jsx("option",{value:k,children:Bt.shadows[k]},k)),sb(n.inline["box-shadow"]??"")==="custom"&&s.jsx("option",{value:"custom",disabled:!0,children:Bt.shadows.custom})]},"sh"+N)})]}),o.tag==="a"&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:Bt.link}),s.jsx(El,{word:Bt.href,css:"href",children:s.jsx(si,{label:Bt.href,value:n.attrs.href??"",placeholder:"https://",onCommit:k=>n.onAttr("href",k||null)},"hr"+N)}),s.jsxs("div",{className:"pp-row",title:"target",children:[s.jsx("span",{className:"pp-l",children:Bt.newTab}),s.jsx("span",{className:"pp-v",children:s.jsx("button",{type:"button",role:"switch","aria-checked":n.attrs.target==="_blank","aria-label":Bt.newTab,className:`switch ${n.attrs.target==="_blank"?"on":""}`,onClick:()=>n.onAttr("target",n.attrs.target==="_blank"?null:"_blank")})})]})]}),n.onExport&&s.jsx(Nw,{onExport:n.onExport},"ex"+N),n.children,s.jsx(Nu,{id:"more-css",title:Ut.more,children:s.jsxs("div",{className:"more-css",children:[pw.map(k=>s.jsx(wm,{label:k.label,value:n.inline[k.prop]??(k.prop==="background"?n.inline["background-color"]??"":""),placeholder:o.styles[k.prop==="background"?"background-color":k.prop]??"",options:k.options,color:k.color,swatches:k.color?f:void 0,warn:Xy(k.prop,n.inline[k.prop]??(k.prop==="background"?n.inline["background-color"]??"":""),n.tokens),ratio:k.prop==="color"?ff(n.inline.color||o.styles.color||"",n.bg):null,onCommit:_=>n.onStyle(k.prop,_)},k.prop+N)),(n.inline.display??o.styles.display??"").includes("grid")&&["grid-template-columns","grid-template-rows"].map(k=>s.jsx(wm,{label:k.endsWith("columns")?d.properties.columns:d.properties.rows,value:String(lb(n.inline[k])??""),placeholder:String(lb(o.styles[k])??""),onCommit:_=>n.onStyle(k,/^\d+$/.test(_)&&Number(_)>0?gw(Math.min(24,Number(_))):_)},k+N)),r.map(k=>s.jsx(wm,{label:k,value:n.attrs[k]??"",placeholder:"",onCommit:_=>n.onAttr(k,_===""?null:_)},k+N))]})})]})}const Bt=d.extra,Bm={none:"",small:"0 1px 2px rgba(0, 0, 0, 0.12)",medium:"0 4px 12px rgba(0, 0, 0, 0.16)",large:"0 12px 32px rgba(0, 0, 0, 0.2)"},sb=n=>{var o;return((o=Object.entries(Bm).find(([,r])=>r.replace(/\s+/g,"")===n.replace(/\s+/g,"")))==null?void 0:o[0])??(n?"custom":"none")},xw=n=>/^-?\d*(?:\.\d+)?$/.test(n.trim())&&n.trim()?`${Number(n)}em`:n.trim();function ww(n){const o=n.inline==="fit-content"||n.inline==="auto"?"hug":n.inline==="100%"?"fill":n.inline?"fixed":"hug",r=n.axis==="width"?Bt.width:Bt.height,f=Math.round(parseFloat(n.computed)||0);return s.jsxs("div",{className:"pp-row",title:n.axis,children:[s.jsx("span",{className:"pp-l",children:r}),s.jsxs("span",{className:"pp-two",children:[s.jsx(si,{label:r,value:o==="fixed"?Fa(n.inline):"",placeholder:String(f),onCommit:m=>n.onStyle(n.axis,hf(m))}),s.jsxs("select",{"aria-label":Bt.mode(r),value:o,onChange:m=>n.onStyle(n.axis,m.target.value==="hug"?n.inline?"fit-content":"":m.target.value==="fill"?"100%":`${f}px`),children:[s.jsx("option",{value:"fixed",children:Bt.fixed}),s.jsx("option",{value:"hug",children:Bt.hug}),s.jsx("option",{value:"fill",children:Bt.fill})]})]})]})}function jw(n){const o=Math.round(Number(n.inline||n.computed||1)*100),[r,f]=b.useState(o);b.useEffect(()=>f(o),[o]);const m=p=>{const v=Math.max(0,Math.min(100,Math.round(p)));v!==o&&n.onStyle("opacity",v===100?"":String(v/100))};return s.jsxs("div",{className:"pp-row",title:"opacity",children:[s.jsx("span",{className:"pp-l",children:Bt.opacity}),s.jsxs("span",{className:"pp-v op-row",children:[s.jsxs("span",{className:"num",children:[s.jsx("input",{type:"number",min:0,max:100,value:r,"aria-label":Bt.opacity,onChange:p=>f(Number(p.target.value)),onBlur:()=>m(r),onKeyDown:p=>p.key==="Enter"&&m(r)}),s.jsx("span",{children:"%"})]}),s.jsx("input",{type:"range",min:0,max:100,value:r,"aria-label":`${Bt.opacity} (slider)`,onChange:p=>f(Number(p.target.value)),onPointerUp:()=>m(r),onKeyUp:()=>m(r)})]})]})}function Nw(n){const[o,r]=b.useState(!1);return s.jsx("section",{className:"pp-group","aria-label":Bt.export,children:s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:Bt.export}),s.jsx("span",{className:"pp-btns",children:s.jsx("button",{className:"btn",disabled:o,onClick:()=>{r(!0),n.onExport().finally(()=>r(!1))},children:o?Bt.exporting:Bt.exportPng})})]})})}const hf=n=>/^-?\d+(?:\.\d+)?$/.test(n.trim())?`${Number(n)}px`:n.trim();function El(n){return s.jsxs("label",{className:"pp-row",title:n.css,children:[s.jsxs("span",{className:"pp-l",children:[n.word,n.warn&&s.jsxs("span",{className:"tok-warn",title:n.warn,"aria-label":d.properties.offToken(n.warn),children:[" ","⚠"]})]}),n.children]})}function si(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=()=>o.trim()!==n.value.trim()&&n.onCommit(o.trim());return s.jsx("input",{"aria-label":n.label,value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:f,onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(r(n.value),m.stopPropagation()))}})}function ob(n){const o=n.value||n.computed||"",r=zu(o,n.colors),f=ya(o)??ya(n.computed)??(r?ya(r.value):null);return s.jsxs("button",{className:`fillv ${n.open?"on":""}`,"aria-expanded":n.open,"aria-label":Ut.openFill(n.label),title:n.css,onClick:m=>{m.preventDefault(),n.onToggle()},children:[s.jsx("span",{className:"sw",style:{background:f??"transparent"}}),s.jsx("span",{className:"fillv-name",children:(r==null?void 0:r.name)??f??Ut.none}),r&&f&&s.jsx("span",{className:"muted",children:f})]})}function wm(n){const[o,r]=b.useState(n.value);b.useEffect(()=>r(n.value),[n.value]);const f=(m=o)=>{m.trim()!==n.value.trim()&&n.onCommit(m.trim())};return s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:[n.label,n.warn&&s.jsxs("span",{className:"tok-warn",title:n.warn,"aria-label":d.properties.offToken(n.warn),children:[" ","⚠"]})]}),n.options?s.jsx("select",{value:o,onChange:m=>{r(m.target.value),f(m.target.value)},children:n.options.map(m=>s.jsx("option",{value:m,children:m||`(${n.placeholder||d.properties.none})`},m))}):s.jsx("input",{value:o,placeholder:n.placeholder,onChange:m=>r(m.target.value),onBlur:()=>f(),onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(r(n.value),m.currentTarget.blur()))}}),n.ratio!=null&&s.jsxs("span",{className:`ratio ${n.ratio>=4.5?"ok":n.ratio>=3?"mid":"bad"}`,title:d.properties.contrastTitle,children:[d.properties.contrast," ",n.ratio.toFixed(2),":1 · ",n.ratio>=7?"AAA":n.ratio>=4.5?"AA":n.ratio>=3?d.properties.largeTextOnly:d.properties.tooLow]}),n.chips&&s.jsx("span",{className:"chips-row",children:n.chips.map(m=>s.jsx("button",{className:`tchip ${o===m?"on":""}`,onClick:p=>{p.preventDefault(),r(m),f(m)},children:m.replace("px","")},m))}),n.color&&s.jsx("span",{className:"swatches",children:(n.swatches??[]).map(m=>s.jsx("button",{className:`swatch ${o.toUpperCase()===m.value?"on":""}`,title:`${m.name} ${m.value}`,style:{background:m.value},onClick:p=>{p.preventDefault(),r(m.value),f(m.value)}},m.value))})]})}const ib=384,cb=n=>/^[\w./@:,=+-]+$/.test(n)?n:`'${n.replace(/'/g,"'\\''")}'`,Sw=n=>n>=1048576?`${(n/1048576).toFixed(1)} MB`:`${Math.max(1,Math.round(n/1024))} KB`;function kw(n){const o=["npx easel-canvas export"];return n.dirFlag&&o.push(n.dirFlag),n.scope==="page"&&n.page&&o.push(`--page ${cb(n.pages.filter(r=>r.name===n.page.name).length>1?n.page.id:n.page.name)}`),n.scope==="boards"&&n.boards.length&&o.push(`--boards ${cb(n.boards.join(","))}`),n.single&&o.push("--single-file"),o.join(" ")}function Tw({pages:n,currentPage:o,selected:r}){const f=Tb(),[m,p]=b.useState(!1),[v,S]=b.useState("all"),[N,E]=b.useState(!1),[x,j]=b.useState(null),[M,$]=b.useState(null),[L,I]=b.useState(null),[k,_]=b.useState({}),[W,X]=b.useState({}),[ne,te]=b.useState({left:0,top:0,width:ib}),ie=b.useRef(null),le=b.useRef(null),he=n.find(Y=>Y.id===o)??n[0],ce=v==="boards"&&!r.length||v==="page"&&!n.length?"all":v,pe={scope:ce,page:ce==="page"?he==null?void 0:he.id:void 0,boards:ce==="boards"?r:void 0},we=(Y=!0)=>{var ue;p(!1),Y&&((ue=ie.current)==null||ue.focus())},Ze=()=>{if(m)return we();S(r.length?"boards":"all"),p(!0)};b.useLayoutEffect(()=>{if(!m)return;const Y=()=>{var He;const ue=ie.current.getBoundingClientRect(),ge=((He=ie.current.closest(".oc-card"))==null?void 0:He.getBoundingClientRect())??ue,De=Math.min(ib,window.innerWidth-16);te({width:De,top:Math.round(ue.bottom+8),left:Math.round(Math.max(8,Math.min(ge.right-De,window.innerWidth-De-8)))})};return Y(),window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[m]),b.useLayoutEffect(()=>{m&&es(le.current,".oc-seg button, .btn")}),b.useEffect(()=>{var ge,De;if(!m)return;(De=(ge=le.current)==null?void 0:ge.querySelector(".oc-seg [aria-checked='true']"))==null||De.focus();const Y=He=>{var de,xe;const G=He.target;!((de=le.current)!=null&&de.contains(G))&&!((xe=ie.current)!=null&&xe.contains(G))&&we(!1)},ue=He=>{He.key==="Escape"&&(He.stopPropagation(),we())};return document.addEventListener("pointerdown",Y,!0),window.addEventListener("keydown",ue,!0),()=>{document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("keydown",ue,!0)}},[m]),b.useEffect(()=>{m&&!x&&Te.get("/api/export").then(j,()=>{})},[m]);const Ce=JSON.stringify(pe);b.useEffect(()=>{if(!m||!N)return;let Y=!0;return $(null),Te.post("/api/export/estimate",pe).then(ue=>Y&&$(ue.bytes),()=>{}),()=>{Y=!1}},[m,N,Ce]);const Nt=async Y=>{if(!L){I(Y),X(ue=>({...ue,[Y]:void 0}));try{const ue=await Te.post("/api/export",{...pe,format:Y==="pdf"||Y==="png"?Y:"web",singleFile:Y==="single"});_(ge=>({...ge,[Y]:ue})),Y==="single"&&$(ue.bytes)}catch(ue){X(ge=>({...ge,[Y]:ue.message}))}finally{I(null)}}},at=()=>Te.post("/api/export/reveal",{}).catch(Y=>f({tone:"error",text:Y.message})),me=async Y=>{try{await navigator.clipboard.writeText(Y),f({tone:"ok",text:d.share.copied(Y)})}catch{f({tone:"error",text:d.share.copyFailed})}},ke=N?"single":"web",$e=k[ke],qe=x&&!x.browser.ok?x.browser.reason??"":null,fe=(x==null?void 0:x.project)??"",re=Y=>`${fe?fe+"/":""}${Y.mainRel.endsWith("/")||Y.kind==="web"?Y.outRel:Y.mainRel}`,Fe=(x==null?void 0:x.single)??`${fe}-canvas.html`,ht=(Y,ue)=>s.jsxs("span",{className:"oc-res",role:"status",children:[s.jsxs("span",{className:"oc-rline",children:[s.jsx(F,{name:"check",size:16}),s.jsx("code",{children:Y.kind==="single"?Y.mainRel.split("/").pop():re(Y)})," ",Y.kind==="single"?d.share.saved:d.share.exported]}),s.jsxs("span",{className:"oc-racts",children:[s.jsx("button",{className:"btn",title:d.share.revealTitle,onClick:()=>void at(),children:d.share.reveal}),ue.deploy&&Y.deploy&&s.jsx("button",{className:"btn",title:d.share.copyDeployTitle(Y.deploy),onClick:()=>void me(Y.deploy),children:d.share.copyDeploy})]}),ue.hint&&s.jsx("span",{className:"oc-rhint",children:d.share.attachHint}),Y.skipped.length>0&&s.jsx("span",{className:"oc-rhint",title:Y.skipped.map(ge=>`${ge.ref} (${ge.from}): ${ge.reason}`).join(`
68
+ `),children:d.share.skipped(Y.skipped.length)})]}),D=(Y,ue,ge,De)=>s.jsxs("div",{className:"oc-orow",children:[s.jsx("span",{className:"out-ic",children:s.jsx(F,{name:ue})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:ge}),s.jsx("span",{children:qe?`${d.share.unavailable} ${qe}`:De})]}),s.jsx("button",{className:"btn",disabled:!!qe,"aria-busy":L===Y,onClick:()=>void Nt(Y),children:L===Y?d.share.working:d.share.export}),W[Y]&&s.jsx(rb,{text:W[Y]}),k[Y]&&!W[Y]&&ht(k[Y],{})]});return s.jsxs("div",{className:"share-wrap",children:[s.jsxs("button",{ref:ie,className:`share-btn ${m?"on":""}`,"aria-haspopup":"dialog","aria-expanded":m,"aria-label":d.share.button,title:d.share.buttonTitle,onClick:Ze,children:[s.jsx(F,{name:"share",size:16})," ",s.jsx("span",{className:"share-label",children:d.share.button})]}),m&&s.jsxs("div",{ref:le,className:"share-pop oc-share entering",role:"dialog","aria-label":d.share.title,style:{left:ne.left,top:ne.top,width:ne.width},onKeyDown:Y=>{Y.stopPropagation()},children:[s.jsx("h4",{children:d.share.title}),s.jsxs("div",{className:"oc-seg",role:"radiogroup","aria-label":d.share.scope,children:[s.jsx("button",{role:"radio","aria-checked":ce==="all",className:ce==="all"?"on":"",onClick:()=>S("all"),children:d.share.whole}),s.jsx("button",{role:"radio","aria-checked":ce==="page",className:ce==="page"?"on":"",disabled:!n.length,title:n.length?he==null?void 0:he.name:d.share.pageNone,onClick:()=>S("page"),children:d.share.page}),r.length>0&&s.jsx("button",{role:"radio","aria-checked":ce==="boards",className:ce==="boards"?"on":"",onClick:()=>S("boards"),children:d.share.selected(r.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(F,{name:N?"file":"folder"})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:N?d.share.singleTitle:d.share.webTitle}),s.jsx("span",{children:N?s.jsxs(s.Fragment,{children:[s.jsx("code",{children:Fe}),d.share.singleHint(M==null?d.share.measuring:Sw(M))]}):d.share.webHint}),s.jsxs("label",{className:"oc-sw",children:[s.jsx("button",{type:"button",role:"switch","aria-checked":N,className:`switch ${N?"on":""}`,onClick:()=>E(Y=>!Y)}),s.jsx("span",{children:d.share.singleSwitch})]})]}),s.jsx("button",{className:"btn","aria-busy":L===ke,onClick:()=>void Nt(ke),children:L===ke?d.share.working:N?d.share.save:d.share.export}),W[ke]&&s.jsx(rb,{text:W[ke]}),$e&&!W[ke]&&ht($e,{deploy:!N,hint:N})]}),D("pdf","pdf",d.share.pdfTitle,d.share.pdfHint),D("png","image",d.share.pngTitle,d.share.pngHint)]}),s.jsxs("div",{className:"oc-pfoot",children:[N&&s.jsx("span",{children:d.share.largeFiles}),s.jsxs("span",{children:[d.share.sameAs," ",s.jsx("code",{children:kw({dirFlag:x==null?void 0:x.dirFlag,scope:ce,page:he,pages:n,boards:r,single:N})})]})]})]})]})}function rb({text:n}){return s.jsxs("span",{className:"oc-err",role:"alert",children:[s.jsx(F,{name:"warn",size:16}),s.jsx("span",{children:n})]})}function ub(n){const o=n.board.boards[n.file],r=b.useRef(null),[f,m]=b.useState({w:0,h:0});b.useLayoutEffect(()=>{const j=r.current;if(!j)return;const M=()=>m({w:j.clientWidth,h:j.clientHeight});M();const $=new ResizeObserver(M);return $.observe(j),()=>$.disconnect()},[]);const p=b.useRef(null);b.useEffect(()=>{var j;n.bare||(j=p.current)==null||j.focus({preventScroll:!0})},[n.bare]);const v=b.useRef(n.onKey);v.current=n.onKey;const S=j=>{const M=j.contentDocument;M&&M.addEventListener("keydown",$=>{if(!v.current||!["Escape","ArrowLeft","ArrowRight"].includes($.key))return;const L=$.target;L&&(L.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(L.tagName))||($.preventDefault(),v.current($.key))})};if(!o)return null;const N=o.title??n.file,E=24,x=Math.min(1,(f.w-E*2)/o.w,(f.h-E*2)/o.h);return s.jsxs("div",{className:`oc-full ${n.bare?"bare":""} ${n.className??""}`,style:n.style,role:"dialog","aria-label":d.full.aria(N),children:[!n.bare&&s.jsxs("div",{className:"oc-full-bar",children:[s.jsx("button",{ref:p,className:"icon-btn oc-ib","aria-label":d.full.back,title:d.full.back,onClick:n.onClose,children:s.jsx(F,{name:"chevronLeft"})}),n.title??s.jsx("strong",{className:"oc-full-name",title:`${N} · ${n.file}`,children:N}),n.nav,s.jsx("span",{className:"oc-full-gap"}),n.onExport&&s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onClick:n.onExport,children:s.jsx(F,{name:"download"})}),s.jsx("div",{className:"oc-seg oc-full-mode",role:"radiogroup","aria-label":d.full.mode,children:["fill","fit"].map(j=>s.jsx("button",{role:"radio","aria-checked":n.mode===j,className:n.mode===j?"on":"",title:j==="fill"?d.full.fillTitle:d.full.fitTitle,onClick:()=>n.onMode(j),children:j==="fill"?d.full.fill:d.full.fit},j))})]}),s.jsx("div",{ref:r,className:`oc-full-stage ${n.mode}`,children:n.mode==="fill"?s.jsx("iframe",{src:`/screens/${n.file}`,title:N,className:"oc-full-fill",onLoad:j=>S(j.currentTarget)},`${n.file}-fill-${n.reloadKey??0}`):f.w>0&&s.jsx("div",{className:"oc-full-frame",style:{width:Math.round(o.w*x),height:Math.round(o.h*x),borderRadius:(o.radius??0)*x},children:s.jsx("iframe",{src:`/screens/${n.file}`,title:N,style:{width:o.w,height:o.h,transform:`scale(${x})`,transformOrigin:"0 0"},onLoad:j=>S(j.currentTarget)},`${n.file}-fit-${n.reloadKey??0}`)})})]})}function Gb(n,o){const r=b.useRef(null),[f,m]=b.useState({left:n.x+12,top:n.y-8});return b.useLayoutEffect(()=>{const p=r.current;if(!p)return;const v=p.getBoundingClientRect(),S=n.x+12+o>window.innerWidth-8?n.x-12-o:n.x+12,N=Math.min(Math.max(48,n.y-8),window.innerHeight-v.height-8);m({left:Math.max(8,Math.round(S)),top:Math.round(N)})},[n.x,n.y,o]),{ref:r,pos:f}}function Cw(n){const{ref:r,pos:f}=Gb(n.at,300),[m,p]=b.useState(""),[v,S]=b.useState(!1),[N,E]=b.useState(!1),x=async()=>{if(!(!m.trim()||N)){E(!0);try{await n.onSubmit(m.trim(),v)}finally{E(!1)}}};return s.jsxs("div",{ref:r,className:"cmt-pop cmt-composer",role:"dialog","aria-label":d.comments.title,style:{left:f.left,top:f.top,width:300},onPointerDown:j=>j.stopPropagation(),children:[s.jsx("p",{className:"cmt-crumbs",title:n.crumbs.join(" › "),children:n.crumbs.map((j,M)=>s.jsxs("span",{children:[M>0&&s.jsx("span",{className:"cmt-sep","aria-hidden":"true",children:" › "}),j]},M))}),s.jsx("textarea",{autoFocus:!0,value:m,"aria-label":d.comments.title,placeholder:d.comments.placeholder,onChange:j=>p(j.target.value),onKeyDown:j=>{j.nativeEvent.isComposing||(j.key==="Enter"&&(j.metaKey||j.ctrlKey)&&x(),j.key==="Escape"&&(j.stopPropagation(),n.onCancel()))}}),s.jsxs("div",{className:"cmt-bar",children:[n.host&&s.jsxs("label",{className:"check req-check",title:d.requests.forAiCheckTitle,children:[s.jsx("input",{type:"checkbox",checked:v,onChange:j=>S(j.target.checked)}),s.jsx("i",{className:v?"on":"","aria-hidden":"true",children:v&&s.jsx(F,{name:"check",size:12})}),d.requests.forAiCheck]}),s.jsx("span",{className:"cmt-gap"}),s.jsx("button",{className:"btn",onClick:n.onCancel,children:d.requests.cancel}),s.jsx("button",{className:"btn primary",disabled:!m.trim()||N,onClick:()=>void x(),children:d.comments.add})]})]})}function Ew(n){const{ref:r,pos:f}=Gb(n.at,320);return b.useEffect(()=>{const m=v=>{var N;const S=v.target;S&&((N=r.current)!=null&&N.contains(S)||S.closest(".pin, .menu, .dialog"))||n.onClose()},p=v=>{v.key==="Escape"&&!(document.activeElement instanceof HTMLTextAreaElement)&&n.onClose()};return window.addEventListener("pointerdown",m,!0),window.addEventListener("keydown",p),()=>{window.removeEventListener("pointerdown",m,!0),window.removeEventListener("keydown",p)}},[n.onClose]),s.jsx("div",{ref:r,className:"cmt-pop cmt-thread",style:{left:f.left,top:f.top,width:320},onPointerDown:m=>m.stopPropagation(),children:n.children})}const Mw=["font-family","font-size","font-weight","line-height","letter-spacing","color","text-align"];function jm(n){return n.split(";").map(o=>o.trim()).filter(Boolean).map(o=>{const r=o.indexOf(":");return r<0?`${o};`:`${o.slice(0,r).trim()}: ${o.slice(r+1).trim()};`}).join(`
69
+ `)}function Aw(n){const o=document.createElement("div").style;return n.split(/;|\n/).map(r=>r.trim()).filter(Boolean).filter(r=>{const f=r.indexOf(":");if(f<=0)return!0;const m=r.slice(0,f).trim(),p=r.slice(f+1).trim();return m.startsWith("--")?!p:(o.cssText="",o.setProperty(m,p),!o.getPropertyValue(m))})}function zw(n){var $;const o=n.el.getAttribute("style")??"",[r,f]=b.useState(()=>jm(o)),[m,p]=b.useState([]),v=b.useRef(jm(o)),S=b.useRef(null);b.useEffect(()=>{const L=jm(o);(document.activeElement!==S.current||L!==v.current)&&(f(L),p([])),v.current=L},[n.path,o]);const N=async()=>{if(r.trim()===v.current.trim())return;const L=Aw(r);p(L),!L.length&&await n.onSave(r)&&(v.current=r)},E=($=n.el.ownerDocument.defaultView)==null?void 0:$.getComputedStyle(n.el),x=new Set(o.split(";").map(L=>L.split(":")[0].trim().toLowerCase())),j=E?Mw.filter(L=>!x.has(L)).map(L=>[L,E.getPropertyValue(L)]):[],M=Math.max(3,r.split(`
70
+ `).length+1);return s.jsx("div",{className:"pp inspector oc-code",children:s.jsxs("div",{className:"pp-scroll",children:[s.jsxs("p",{className:"code-target",children:[s.jsxs("code",{children:["<",n.tag,">"]}),n.label&&s.jsxs("span",{children:[" “",n.label.slice(0,40),"”"]})]}),s.jsx("textarea",{ref:S,className:"code-css","aria-label":d.code.inline,spellCheck:!1,rows:M,value:r,placeholder:d.code.placeholder,onChange:L=>{f(L.target.value),m.length&&p([])},onBlur:()=>void N(),onKeyDown:L=>{L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),N()),L.key==="Escape"&&(L.stopPropagation(),f(v.current),p([]))}}),m.length>0&&s.jsx("p",{className:"pp-note warn code-bad",role:"alert",children:d.code.bad(m.join("; "))}),j.length>0&&s.jsxs("section",{className:"pp-group code-inh","aria-label":d.code.computed,children:[s.jsx("h3",{className:"pp-group-h",children:d.code.computed}),j.map(([L,I])=>s.jsxs("div",{className:"code-row",children:[s.jsx("span",{className:"code-k",children:L}),s.jsxs("span",{className:"code-v",title:I,children:[L==="color"&&s.jsx("i",{className:"sw",style:{background:I}}),I]})]},L))]})]})})}const Yb="design-canvas:hint",Nm={picks:2,edits:2,sessions:3},mf={picks:0,edits:0,sessions:0};function $w(){try{const n=JSON.parse(localStorage.getItem(Yb)??"null");return n&&typeof n=="object"?{...mf,...n}:mf}catch{return mf}}let Tu=typeof window>"u"?mf:$w();const Ow=new Set;function Rw(n){Tu=n;try{localStorage.setItem(Yb,JSON.stringify(n))}catch{}for(const o of Ow)o()}const Dw=n=>!n.on&&(!!n.off||n.picks>=Nm.picks&&n.edits>=Nm.edits||n.sessions>=Nm.sessions);function db(n){Dw(Tu)||Tu.on||Rw({...Tu,[n]:Tu[n]+1})}const Bw=["tools","edit","element","move","view","ai"],Hw=[{id:"select",section:"tools",combos:["v"]},{id:"hand",section:"tools",combos:["h"]},{id:"board",section:"tools",combos:["b"]},{id:"title",section:"tools",combos:["t"]},{id:"note",section:"tools",combos:["n"]},{id:"rect",section:"tools",combos:["r"]},{id:"oval",section:"tools",combos:["o"]},{id:"line",section:"tools",combos:["l"]},{id:"arrow",section:"tools",combos:["a"]},{id:"penOrPlay",section:"tools",combos:["p"]},{id:"undo",section:"edit",combos:["cmd+z"]},{id:"redo",section:"edit",combos:["cmd+shift+z","cmd+y"]},{id:"copy",section:"edit",combos:["cmd+c"]},{id:"paste",section:"edit",combos:["cmd+v"]},{id:"duplicate",section:"edit",combos:["cmd+d"]},{id:"delete",section:"edit",combos:["delete","backspace"]},{id:"selectAll",section:"edit",combos:["cmd+a"]},{id:"lock",section:"edit",combos:["cmd+l"]},{id:"rename",section:"edit",combos:["f2"]},{id:"front",section:"edit",combos:["cmd+]"]},{id:"back",section:"edit",combos:["cmd+["]},{id:"copyPng",section:"element",combos:["cmd+shift+c"]},{id:"copyProps",section:"element",combos:["cmd+alt+c"]},{id:"pasteProps",section:"element",combos:["cmd+alt+v"]},{id:"flipH",section:"element",combos:["shift+h"]},{id:"flipV",section:"element",combos:["shift+v"]},{id:"wrap",section:"element",combos:["cmd+g"]},{id:"reorder",section:"element",combos:["alt+arrowup","alt+arrowdown"]},{id:"enter",section:"move",combos:["enter"]},{id:"next",section:"move",combos:["tab"]},{id:"arrows",section:"move",combos:["arrowup","arrowdown","arrowleft","arrowright"]},{id:"escape",section:"move",combos:["escape"]},{id:"regions",section:"move",combos:["f6"]},{id:"zoomIn",section:"view",combos:["cmd+="]},{id:"zoomOut",section:"view",combos:["cmd+-"]},{id:"zoom100",section:"view",combos:["cmd+0"]},{id:"fitAll",section:"view",combos:["shift+1","cmd+1"]},{id:"zoomSel",section:"view",combos:["shift+2"]},{id:"guides",section:"view",combos:["ctrl+g"]},{id:"minimap",section:"view",combos:["m"]},{id:"prototype",section:"view",combos:["f"]},{id:"panel",section:"view",combos:["cmd+\\"]},{id:"clean",section:"view",combos:["cmd+shift+\\"]},{id:"ai",section:"ai",combos:["cmd+j"]},{id:"find",section:"ai",combos:["cmd+k"]},{id:"comments",section:"ai",combos:["alt+c"]}],Lw={arrowup:"↑",arrowdown:"↓",arrowleft:"←",arrowright:"→",escape:"Esc",enter:"↵",tab:"Tab",delete:"⌦",backspace:"⌫",f2:"F2",f6:"F6","=":"+"};function _w(n,o){const r=n.split("+"),f=n.endsWith("+")?"+":r[r.length-1],m=p=>r.slice(0,-1).includes(p);return`${m("ctrl")?"⌃":""}${m("alt")?"⌥":""}${m("shift")?"⇧":""}${m("cmd")?o:""}${Lw[f]??f.toUpperCase()}`}const Uw=400,rf="design-canvas:updating",ft=navigator.platform.includes("Mac")?"⌘":"Ctrl+",fb=1200,Sm=7,qw=120,li=335,xf=n=>`design-canvas:${n}`;function Vw(n){try{return JSON.parse(sessionStorage.getItem(xf(n))??localStorage.getItem(xf(n))??"{}")}catch{return{}}}const hb=[{id:"blank",label:d.templates.blank,size:"390×844",w:390,h:844,group:0},{id:"watch",label:d.templates.watch,size:"198×242",w:198,h:242,group:1},{id:"mobile",label:d.templates.mobile,size:"390×844",w:390,h:844,group:1},{id:"tablet",label:d.templates.tablet,size:"834×1194",w:834,h:1194,group:1},{id:"desktop",label:d.templates.desktop,size:"1440×900",w:1440,h:900,group:1},{id:"doc",label:d.templates.doc,size:"800×1000",w:800,h:1e3,group:2},{id:"email",label:d.templates.email,size:"600×1200",w:600,h:1200,group:2}],oi=[{id:"select",icon:"select",label:d.tools.select,hint:d.toolHints.select,key:"V"},{id:"hand",icon:"hand",label:d.tools.hand,hint:d.toolHints.hand,key:"H"},{id:"board",icon:"board",label:d.tools.board,hint:d.toolHints.board,key:"B"},{id:"title",icon:"title",label:d.tools.title,hint:d.toolHints.title,key:"T"},{id:"sticky",icon:"sticky",label:d.tools.sticky,hint:d.toolHints.sticky,key:"N"},{id:"rect",icon:"rect",label:d.tools.rect,hint:d.toolHints.rect,key:"R"},{id:"oval",icon:"oval",label:d.tools.oval,hint:d.toolHints.oval,key:"O"},{id:"line",icon:"line",label:d.tools.line,hint:d.toolHints.line,key:"L"},{id:"arrow",icon:"arrow",label:d.tools.arrow,hint:d.toolHints.arrow,key:"A"},{id:"pen",icon:"pen",label:d.tools.pen,hint:d.toolHints.pen,key:"P"}],Gw=["rect","oval","line","arrow","pen"];function Yw(){var _r,Ur,ud,Oc,Rc,Dc,la,xn,Bi,Vo,Hi,Bc,Sl,Li,Hc,Lc,qr,Vr,Gr,Yr,Xr,Kr;const[n,o]=b.useState(null),[r,f]=b.useState(null),m=j0({x:0,y:0,zoom:.1}),p=m.set,[v,S]=b.useState(null),[N,E]=b.useState("select"),[x,j]=b.useState([]),[M,$]=b.useState([]),L=M.length===1?M[0]:null,I=i=>$(i?[i]:[]),[k,_]=b.useState(null),[W,X]=b.useState(null),[ne,te]=b.useState(null),[ie,le]=b.useState(null),he=b.useRef(null),[ce,pe]=b.useState(null),[we,Ze]=b.useState(null),Ce=b.useRef(new Set),[Nt,at]=b.useState([]),[me,ke]=b.useState(!1),[$e,qe]=b.useState(""),[fe,re]=b.useState(null),[Fe,ht]=b.useState(null),[D,Y]=b.useState("fit"),[ue,ge]=b.useState(0),[De,He]=b.useState(!0),[G,de]=b.useState(()=>({w:window.innerWidth,h:window.innerHeight}));b.useEffect(()=>{const i=()=>de({w:window.innerWidth,h:window.innerHeight});return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const xe=G.w<=1e3,Kt=G.w<=480,Ge=G.w<=fb,Wt=36,Zt=Ge?32:36,rt=Kt?8:12,Ye=rt+40+8,mn=b.useRef(!0),[en,Pn]=b.useState(!1),ut=G,[Gn,B]=b.useState(null),[K,ae]=b.useState(!0),[Oe,Le]=b.useState(null),[tt,mt]=b.useState(0);b.useLayoutEffect(()=>{if(!Oe)return;const i=()=>mt(Math.round(Oe.getBoundingClientRect().bottom));i();const h=new ResizeObserver(i);return h.observe(Oe),()=>h.disconnect()},[Oe,ut.w,ut.h]);const[vt,rn]=b.useState(0),[tn,It]=b.useState(0),Yn=b.useCallback((i,h)=>{rn(i),It(h)},[]),[Qe,Mn]=b.useState(0),ln=b.useRef(null),[st,St]=b.useState(!1);b.useLayoutEffect(()=>{var w;const i=((w=document.querySelector(".oc .oc-dock"))==null?void 0:w.offsetWidth)??0;i!==Qe&&Mn(i);const h=ln.current,g=!!h&&[...document.querySelectorAll(".oc .etb.oc-anchored, .oc .canvas-hint, .oc .oc-ask, .oc .oc-result")].some(T=>{const A=T.getBoundingClientRect();return A.width>0&&A.left<h.right+8&&A.right>h.left-8&&A.top<h.bottom+8&&A.bottom>h.top-8});g!==st&&St(g)});const[$t,Ct]=b.useState(null),[cl,rl]=b.useState({canUndo:!1,canRedo:!1,undo:[],redo:[]}),[io,ii]=b.useState({}),[va,ul]=b.useState({}),[ia,Ta]=b.useState({}),pn=i=>h=>({...h,[i]:(h[i]??0)+1}),xa=b.useRef(h1()).current,ts=b.useRef(()=>{});ts.current=(i,h,g=!1)=>{const w=lt.current.get(i),T=xa.decide(i,h,{shown:Ab(w,i),patched:Gy(w,i)},g);if(!(T==="queue"||T==="keep")){if(T==="check")return void Te.get(`/api/file-hash?f=${encodeURIComponent(i)}`).then(A=>ts.current(i,A.hash,!0)).catch(()=>ts.current(i,void 0));xa.reset(i),ii(pn(i))}};const[Os,ns]=b.useState(null),[Qa,Rs]=b.useState(null),[Ht,as]=b.useState([]),kt=A1(),[Fi,Ou]=b.useState(null),[Et,Oa]=b.useState(null),z=b.useRef(null),[P,_e]=b.useState(null),[ye,Me]=b.useState(null),[Lt,Ve]=b.useState(new Set),[sn,Ra]=L1(),Ot=b.useRef(null),nn=b.useRef(null),[Jn,ls]=b.useState(null),[ci,Ru]=b.useState(!1),[An,Al]=b.useState("inspect"),[co,ri]=b.useState(""),[Qi,ss]=b.useState({comments:[],refs:[]}),[zl,ui]=b.useState({}),$l=b.useRef(new Set),Xn=b.useCallback(i=>($l.current.add(i),()=>void $l.current.delete(i)),[]),dr=b.useRef(null),Pi=b.useRef(0),[dl,Pa]=b.useState("boards"),[Ds,kf]=b.useState(0),[di,os]=b.useState(null),[na,ot]=b.useState([]),is=na.length===1?na[0]:null,fi=i=>ot(i?[i]:[]),[hi,fl]=b.useState(0),Rt=m1(hi),[Ol,Du]=b.useState(()=>{try{return localStorage.getItem("design-canvas:author")??""}catch{return""}});b.useEffect(()=>{Ol||Te.get("/api/me").then(i=>i.name&&Du(i.name)).catch(()=>{})},[]),b.useEffect(()=>zx(Ol),[Ol]);const hl=Ol||d.app.defaultAuthor;b.useEffect(()=>{if(!pr.current)return;const i=new Map(Ht.filter(ba).map(w=>[w.id,w.request.state])),h=Ot.current;if(Ot.current=i,!h)return;const g=Ht.filter(w=>{if(!ba(w))return!1;const T=h.get(w.id),A=w.request.state;return T?T!==A&&(A==="done"||A==="failed"):A==="waiting"&&w.author===hl});g.length&&Ve(w=>new Set([...w,...g.map(T=>T.id)]))},[Ht]);const[Rl,fr]=b.useState(null),[Ln,Ji]=b.useState(null),Ii=b.useRef(null),Wi=b.useRef(()=>{}),[Bs,hr]=b.useState(!0),[ro,uo]=b.useState(()=>{try{return localStorage.getItem("design-canvas:theme")||"system"}catch{return"system"}});b.useEffect(()=>{ro==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",ro);try{localStorage.setItem("design-canvas:theme",ro)}catch{}},[ro]);const[mi,ml]=b.useState(null),Hs=b.useRef(!1),lt=b.useRef(new Map),[fo,Tf]=b.useState(0),pi=Iw(),Da=b.useRef(null),ve=Tb(),In=Q0(),[Mt,Ls]=b.useState(null),cs=b.useCallback(()=>Te.update().then(i=>(Ls(i),i),()=>null),[]);b.useEffect(()=>{cs().then(h=>{let g=null;try{g=JSON.parse(sessionStorage.getItem(rf)??"null"),sessionStorage.removeItem(rf)}catch{}g&&h&&h.current===g.to&&ve({tone:"ok",text:d.update.done(g.to),ms:6e3})});const i=window.setInterval(()=>void cs(),10800*1e3);return()=>window.clearInterval(i)},[cs,ve]);const ho=i=>i&&d.update.why[i]||d.update.why.failed,mo=i=>void navigator.clipboard.writeText(i).then(()=>ve({tone:"ok",text:d.update.copied,code:i,ms:8e3}),()=>ve({text:d.update.copied,code:i,ms:12e3})),po=async()=>{var w;const i=Mt==null?void 0:Mt.update;if(!i)return;if(!i.self)return mo(i.command);const{pid:h}=await Te.health().catch(()=>({pid:0})),g=await Te.applyUpdate().catch(()=>({status:0,body:{}}));if(g.status!==202)return cs(),ve({tone:"error",text:d.update.failed(i.latest,ho(g.body.why)),action:{label:d.update.copy,run:()=>mo(g.body.command??i.command)},ms:12e3,slot:"update"});try{sessionStorage.setItem(rf,JSON.stringify({to:i.latest}))}catch{}Ls(T=>T&&{...T,state:{phase:"installing",to:i.latest}}),ve({dot:!0,text:d.update.updating(i.latest),ms:6e5,slot:"update"});for(let T=0;T<600;T++){await new Promise(ee=>setTimeout(ee,1e3));const A=await Te.health().catch(()=>null);if(A&&h&&A.pid!==h)return window.location.reload();if(!A)continue;const R=await cs();if(((w=R==null?void 0:R.state)==null?void 0:w.phase)==="failed"){try{sessionStorage.removeItem(rf)}catch{}return ve({tone:"error",text:d.update.failed(i.latest,ho(R.state.why)),action:{label:d.update.copy,run:()=>{var ee;return mo(((ee=R.state)==null?void 0:ee.command)??i.command)}},ms:15e3,slot:"update"})}}},Dl=(i=Mt)=>{const h=i==null?void 0:i.update;if(!h)return[];const g=i==null?void 0:i.state,T=g&&g.phase!=="failed"?{label:d.update.updating(h.latest),note:d.update.versions(h.current,h.latest),dot:!0,disabled:!0,run:()=>{}}:(g==null?void 0:g.phase)==="failed"?{label:d.update.copyRow,note:ho(g.why),dot:!0,run:()=>mo(g.command??h.command)}:h.self?i!=null&&i.busy?{label:d.update.row(h.latest),note:d.update.why.busy,dot:!0,disabled:!0,run:()=>{}}:{label:d.update.row(h.latest),note:d.update.versions(h.current,h.latest),dot:!0,run:()=>void po()}:{label:d.update.row(h.latest),note:`${d.update.versions(h.current,h.latest)} · ${ho(h.why)}`,dot:!0,tip:h.command,run:()=>mo(h.command)},A=(g==null?void 0:g.phase)==="failed"&&h.self&&!(i!=null&&i.busy)?[{label:d.update.retry,run:()=>void po()}]:[];return[T,...A,"sep"]},mr=b.useCallback(i=>lt.current.get(i)??null,[fo]),Bl=b.useRef(null),zn=b.useRef(null);zn.current=r;const _s=b.useRef(null),on=b.useCallback(async()=>{try{const i=await Te.board();o(i),Ta(i.stamps??{}),f(h=>Ww(h,i.board)),ns(null)}catch(i){ns(String(i.message))}},[]),pr=b.useRef(!1),rs=b.useCallback(()=>Te.get("/api/comments").then(i=>{pr.current=!0,as(i.comments)}).catch(()=>{}),[]),ca=b.useCallback(()=>Te.get("/api/history").then(rl).catch(()=>{}),[]),gi=b.useCallback(()=>Te.get("/api/errors").then(i=>ui(h=>JSON.stringify(h)===JSON.stringify(i.errors)?h:i.errors)).catch(()=>{}),[]),nt=Zx((n==null?void 0:n.dir)??null),[At,Ja]=b.useState(null),[Ca,Bu]=b.useState(null),[go,ec]=b.useState(!1),[Ea,tc]=b.useState({}),[pl,us]=b.useState(null),[Cf,Hu]=b.useState(!1),nc=b.useRef(null),Lu=b.useRef(null),_u=b.useRef(null),gr=b.useRef(null);b.useLayoutEffect(()=>{var ea,Go;es(Lu.current),es(_u.current),es(gr.current);const i=gr.current,h=i==null?void 0:i.querySelector(".oc-cmts");if(!i||!h)return;const g=[...i.children].filter(Dt=>Dt.getClientRects().length).pop();if(!g||!h.getClientRects().length)return;const w=Math.ceil(g.getBoundingClientRect().right-h.getBoundingClientRect().left),T=((ea=i.closest(".oc-right.is-rest"))==null?void 0:ea.offsetWidth)??0;T!==yr&&Ef(T);const A=document.querySelector(".oc-left .oc-head"),R=A==null?void 0:A.closest(".oc-left");if(!A||!R)return;const ee=(Dt,to)=>[...Dt.children].filter(_i=>_i.getClientRects().length).pop().getBoundingClientRect().right-Dt.getBoundingClientRect().left+parseFloat(getComputedStyle(Dt).paddingRight)-to.getBoundingClientRect().width,Ne=(Dt,to)=>{const Ga=Dt==null?void 0:Dt.querySelector(to);return Dt&&Ga?Math.ceil(ee(Dt,Ga)+Math.max(Ga.scrollWidth,Ga.getBoundingClientRect().width)):0},Ae=A.querySelector(".oc-project"),ze=A.querySelector(".oc-page"),et=((Ae==null?void 0:Ae.getBoundingClientRect().width)??0)+((ze==null?void 0:ze.getBoundingClientRect().width)??0),fn=(Dt,to)=>{const Ga=Dt==null?void 0:Dt.querySelector(to);if(!Dt||!Ga)return 0;const _i=[...Ga.textContent??""];let dd=0;const _c=_i.findIndex(fd=>/\S/.test(fd)&&++dd>4);if(_c<0)return Ne(Dt,to);const Uc=br.current??(br.current=document.createElement("canvas").getContext("2d"));return Uc?(Uc.font=getComputedStyle(Ga).font,Math.ceil(ee(Dt,Ga)+Uc.measureText(_i.slice(0,_c).join("").trimEnd()+"…").width)):0},Se=fn(Ae,".app-title"),Vt=fn(ze,".oc-page-name");Ae&&Ae.style.minWidth!==`${Se}px`&&(Ae.style.minWidth=`${Se}px`),ze&&ze.style.minWidth!==`${Vt}px`&&(ze.style.minWidth=`${Vt}px`);const Vn=Dt=>Dt<2?Math.min(Ne(Ae,".app-title"),qw)+Ne(ze,".oc-page-name"):Dt<6?Se+Vt:Vt,tl=(((Go=[...A.children].filter(Dt=>Dt.getClientRects().length).pop())==null?void 0:Go.getBoundingClientRect().right)??0)-A.getBoundingClientRect().left+parseFloat(getComputedStyle(A).paddingRight)-et,Xe=R.classList.contains("is-collapsed"),Ft=Math.ceil(tl+Math.min(200,Ne(Ae,".app-title"))+Ne(ze,".oc-page-name"));Ft!==Vu&&Mf(Ft);const dt=Dt=>Dt>=Sm?1/0:Math.min(fe?1/0:li-4-16,G.w-rt*2-8-8-(Xe?tl+Vn(Dt):R.offsetWidth)),fa=[G.w,Xe,fe,r==null?void 0:r.title,un,qo,Tt].join("|");if(fa!==sc.current&&(sc.current=fa,Ba!==0))return qu(0);w>dt(Ba)&&Ba<Sm&&qu(Ba+1)});const[yr,Ef]=b.useState(0),[ac,Uu]=b.useState([]),lc=()=>Te.get("/api/projects").then(i=>Uu(i.projects),()=>Uu([]));b.useEffect(()=>(lc(),window.addEventListener("focus",lc),()=>window.removeEventListener("focus",lc)),[]);const[Ba,qu]=b.useState(0),sc=b.useRef(""),br=b.useRef(null),[Vu,Mf]=b.useState(240);b.useEffect(()=>{on(),rs(),ca(),gi()},[on,rs,ca,gi]),b.useEffect(()=>{document.title=r!=null&&r.title?d.app.docTitle(r.title):d.app.title},[r==null?void 0:r.title]),b.useEffect(()=>{const i=new Map,h=w=>{const T=i.get(w);window.clearTimeout(T.t),T.t=window.setTimeout(()=>void Te.put("/api/errors",{file:w,errors:T.list}).catch(()=>{}),200)},g=w=>{const T=w.data;if(!T||T.type!=="dc-error"||typeof T.file!="string")return;if(T.start)return void i.set(T.file,{list:[],loaded:!1});const A=i.get(T.file)??{list:[],loaded:!0};if(i.set(T.file,A),T.loaded)return A.loaded=!0,h(T.file);A.list.length<20&&!A.list.some(R=>R.message===T.message)&&A.list.push({kind:T.kind,message:T.message,line:T.line}),A.loaded&&h(T.file)};return window.addEventListener("message",g),()=>window.removeEventListener("message",g)},[]);const gn=b.useCallback((i,h)=>{const g=zn.current;if(!g)return;const w=i(g);if(zn.current=w,f(w),!h)return;_s.current&&window.clearTimeout(_s.current);const T=()=>(Pi.current++,Te.saveBoard(zn.current,h==="draft"?void 0:h).catch(A=>ve({tone:"error",text:d.toast.saveFailed(A.message)})).finally(()=>Pi.current--));h==="draft"?_s.current=window.setTimeout(()=>{_s.current=null,T()},Uw):T()},[ve]),gl=b.useCallback(async i=>{try{const h=await Te.post(`/api/history/${i}`,{});h.label?ve({text:d.toast.undoRedoDone(i,d.activity.stepName(h.label))}):ve({text:i==="undo"?d.toast.nothingToUndo:d.toast.nothingToRedo}),await on()}catch(h){ve({tone:"error",text:String(h.message)})}ca()},[ve,on,ca]),$n={label:d.toast.undoAction,run:()=>void gl("undo")},yn=b.useCallback(async(i,h=k)=>{var g;if(!h)return!1;xa.begin(h);try{const w=await Te.post("/api/edit",{file:h,...i});return w.base&&w.hash&&f1(lt.current.get(h),h,w)&&(xa.patched(h,w.base,w.hash),ul(pn(h))),!0}catch(w){return(g=Bl.current)==null||g.setError(String(w.message)),ve({tone:"error",text:String(w.message)}),!1}finally{for(const w of xa.end(h))ts.current(h,w)}},[k,ve,xa]),Gu=b.useCallback((i,h,g)=>{var tl,Xe,Ft;if(Array.from(h.children).some(dt=>dt.tagName!=="BR")){(tl=Bl.current)==null||tl.setError(d.toast.textOnly);return}const w=h.innerText??"";db("edits"),X(i);const T=h.getAttribute("contenteditable");h.contentEditable="true",h.focus();const A=h.ownerDocument,R=A.createRange();R.selectNodeContents(h),(Xe=A.getSelection())==null||Xe.removeAllRanges(),(Ft=A.getSelection())==null||Ft.addRange(R);const ee=dt=>{if(h.contains(dt.target))return void(dt.type==="click"&&dt.preventDefault());dt.preventDefault(),dt.stopPropagation(),dt.type==="mousedown"&&h.blur()};A.addEventListener("mousedown",ee,!0),A.addEventListener("click",ee,!0);let Ne=!1;const Ae=async()=>{var ea;h.removeEventListener("keydown",ze),A.removeEventListener("mousedown",ee,!0),A.removeEventListener("click",ee,!0),T==null?h.removeAttribute("contenteditable"):h.setAttribute("contenteditable",T),X(null),document.activeElement===((ea=A.defaultView)==null?void 0:ea.frameElement)&&mb();const dt=(h.innerText??"").replace(/\n$/,"");if(Ne||dt===w){Ne&&(h.innerText=w);return}const fa=await Ha(i,g);await yn({op:"setText",path:g,hash:fa,text:dt},i)||(h.innerText=w)},ze=dt=>{dt.isComposing||dt.keyCode===229||(dt.key==="Enter"&&!dt.shiftKey?(dt.preventDefault(),h.blur()):dt.key==="Escape"&&(Ne=!0,h.blur()))};let et=!1,fn=!1;const Se=()=>et=!0,Vt=()=>{et=!1,fn&&Vn()},Vn=()=>{h.removeEventListener("compositionstart",Se),h.removeEventListener("compositionend",Vt),h.removeEventListener("blur",Yt),Ae()},Yt=()=>{et?fn=!0:Vn()};h.addEventListener("compositionstart",Se),h.addEventListener("compositionend",Vt),h.addEventListener("keydown",ze),h.addEventListener("blur",Yt)},[yn]),Ha=(i,h)=>Te.get(`/api/element?f=${encodeURIComponent(i)}&path=${encodeURIComponent(h)}`).then(g=>(g.fileHash&&Gy(lt.current.get(i),i)&&ts.current(i,g.fileHash,!0),g.hash)),Yu=async(i,h)=>{var w;if(!k)return;const g=await Ha(k,i);await yn({op:"move",path:i,hash:g,...h})&&((w=Bl.current)==null||w.select([Xw(i,h.toParentPath,h.index)]),ve({text:h.freeze.length?d.toast.movedFrozen:d.toast.moved,action:$n}))},Xu=async()=>{var g;const i=je.state.selection;if(!k||!i)return;const{source:h}=await Te.get(`/api/element?f=${encodeURIComponent(k)}&path=${encodeURIComponent(i.path)}&full=1`);try{localStorage.setItem("design-canvas:clip",JSON.stringify({source:h,file:k,path:i.path,tag:i.tag}))}catch{}await((g=navigator.clipboard)==null?void 0:g.writeText(h).catch(()=>{})),ve({tone:"ok",text:d.toast.copiedElement(i.tag,ft)})},Ku=async()=>{if(!k)return;let i=null;try{i=JSON.parse(localStorage.getItem("design-canvas:clip")??"null")}catch{i=null}if(!i)return ve({text:d.toast.nothingCopied});const h=je.state.selection,g=(h==null?void 0:h.file)===k?h.path:"";if(await yn({op:"insert",path:g,hash:g?h.hash:void 0,position:"after",html:i.source})&&(ve({tone:"ok",text:d.toast.pasted(i.file,i.tag),action:$n}),g)){const w=g.split("/");w[w.length-1]=String(Number(w[w.length-1])+1),setTimeout(()=>{var T;return void((T=Bl.current)==null?void 0:T.select([w.join("/")]))},600)}},Zu=(i,h)=>os(()=>async g=>{if(os(null),!k)return;const w=await Ha(k,i);(h?await yn({op:"setAttr",path:i,hash:w,name:"src",value:g.ref}):await yn({op:"setStyle",path:i,hash:w,prop:"background-image",value:`url("${g.ref}")`}))&&ve({tone:"ok",text:d.toast.imageReplaced(g.name),action:$n})}),Us=b.useRef(null),je=b0(k,mr);Bl.current=je;const oc=b.useRef(Promise.resolve()),qs=(i,h)=>{var T;const g=k,w=(T=je.state.selection)==null?void 0:T.path;!g||!w||(oc.current=oc.current.then(async()=>{const A=await Ha(g,w).catch(()=>null);A&&await yn({op:"setStyle",path:w,hash:A,prop:i,value:h},g)}))};b.useEffect(()=>$x(i=>{if(i.type==="file-changed")ul(pn(i.file)),i.stamp&&Ta(h=>h[i.file]===i.stamp?h:{...h,[i.file]:i.stamp}),i.kind!=="change"?(xa.reset(i.file),ii(pn(i.file)),on()):ts.current(i.file,i.hash);else if(i.type==="board-changed"&&i.source!==Lm)on(),nt.reload();else if(i.type==="comments-changed")rs();else if(i.type==="update-state")cs();else if(i.type==="history-changed")rs(),ca(),nt.reload();else if(i.type==="errors-changed")gi();else if(i.type==="assets-changed")kf(h=>h+1);else if(i.type==="tokens-changed")fl(h=>h+1);else if(i.type==="app-changed")window.location.reload();else if(i.type==="chat")for(const h of $l.current)h(i.id,i.ev);else if(i.type==="hello")for(const h of $l.current)h("",{kind:"boot",boot:i.boot});else i.type==="occupancy"?tc(i.boards):(i.type==="requests-settings"||i.type==="agents-changed")&&kt.reload()}),[on,rs,ca,gi,nt.reload,kt.reload]);const We=(r==null?void 0:r.pages)??[],un=((_r=We.find(i=>i.id===v))==null?void 0:_r.id)??((Ur=We[0])==null?void 0:Ur.id)??null,ds=b.useCallback(i=>!We.length||(i.page??We[0].id)===un,[We,un]),gt=b.useMemo(()=>r?[...new Set(r.order)].filter(i=>r.boards[i]&&ds(r.boards[i])):[],[r,ds]),ic=b.useMemo(()=>r?Object.keys(r.notes).filter(i=>ds(r.notes[i])):[],[r,ds]),jn=Qa??ut,yo=yf(m,i=>i.zoom>=.25),Af=b.useCallback(i=>r?s.jsx(tw,{board:r,files:gt,zoom:i}):null,[r,gt]),yl=()=>{const i=rt;if(en)return{x:0,y:0,w:jn.w,h:jn.h};const h=!Ge&&De?i+240+i:0,g=!Ge&&_n?jn.w-li:jn.w,w=i+Wt,T=jn.h-Ye-Zt;return{x:h,y:w,w:g-h,h:T-w}},zf=(i,h)=>{const g=yl();p(w=>({...w,x:Math.round(g.x+g.w/2-i*w.zoom),y:Math.round(g.y+g.h/2-h*w.zoom)}))};b.useEffect(()=>{if(Hs.current||!r||!Qa)return;Hs.current=!0;const i=Vw(r.title);i.left!=null&&(mn.current=i.left),window.innerWidth<=fb?He(i.leftPane??!1):i.left!=null&&He(i.left),i.minimap!=null&&ae(i.minimap);const h=r.launch;if(h!=null&&h.page?S(h.page):i.page&&S(i.page),(h==null?void 0:h.view)==="focused"&&h.file&&r.boards[h.file]&&re(h.file),i.view&&!(h!=null&&h.page))p(i.view);else if(!i.view&&r.order.length>0){const g=r.order.find(T=>r.boards[T]&&ds(r.boards[T]))??r.order[0],w=r.boards[g];if(w){const T=Ki([w],Qa,80,yl());p({...T,zoom:Math.min(T.zoom,1)}),ke(!0)}else p(Ki(Object.values(r.boards),Qa,60,yl()))}else p(Ki(Object.values(r.boards),Qa,60,yl()));location.hash&&gc(location.hash)},[r,Qa]),b.useEffect(()=>{const i=()=>gc(location.hash);return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)});const vr=b.useRef(null);b.useEffect(()=>{if(!r||!Hs.current)return;const i=k??(x.length===1?x[0]:null),h=fe?`#play-${encodeURIComponent(fe)}`:i?`#artboard-${encodeURIComponent(i)}`:un&&We.length>1?`#page-${encodeURIComponent(un)}`:"",g=`${fe?"play":"canvas"}:${un??""}:${fe??""}`,w=vr.current;if(vr.current={hash:h,step:g},location.hash===h||!h&&!location.hash)return;const T=`${location.pathname}${location.search}${h}`;w&&w.step!==g&&!ko.current?history.pushState(null,"",T):history.replaceState(null,"",T)},[r,un,fe,x,k,We.length]),b.useEffect(()=>{if(!r)return;let i=0;const h=()=>{window.clearTimeout(i),Hs.current&&(i=window.setTimeout(()=>{try{const w={view:m.get(),page:un,left:Ge?mn.current:De,minimap:K};localStorage.setItem(xf(r.title),JSON.stringify(w)),sessionStorage.setItem(xf(r.title),JSON.stringify({...w,leftPane:Ge?De:void 0}))}catch{}},300))};h();const g=m.subscribe(h);return()=>{g(),window.clearTimeout(i)}},[un,De,K,r==null?void 0:r.title,Ge]);const xr=b.useRef(Ge);b.useEffect(()=>{if(xr.current!==Ge){xr.current=Ge,Hs.current&&He(Ge?!1:mn.current);return}!Ge&&Hs.current&&(mn.current=De)},[Ge,De]),b.useEffect(()=>{if(!r)return;let i=0;const h=()=>{window.clearTimeout(i),i=window.setTimeout(()=>{var Ae;const w=m.get(),T=-w.x/w.zoom,A=-w.y/w.zoom,R=jn.w/w.zoom,ee=jn.h/w.zoom,Ne=Fe?[Fe]:fe?[fe]:gt.filter(ze=>{const et=r.boards[ze];return et.x<T+R&&et.x+et.w>T&&et.y<A+ee&&et.y+et.h>A});Te.put("/api/context",{mode:ce?"play":fe||Fe?"focus":k?"edit":"canvas",page:un,pageName:((Ae=We.find(ze=>ze.id===un))==null?void 0:Ae.name)??null,visibleArtboards:Ne,selectedArtboards:x,dirty:Pi.current>0||!!_s.current}).catch(()=>{})},300)};h();const g=m.subscribe(h);return()=>{g(),window.clearTimeout(i)}},[un,x,k,fe,Fe,ce,gt,jn.w,jn.h]),b.useEffect(()=>{!mi||!r||!mi.every(i=>r.boards[i])||(j(mi),p(Ki(mi.map(i=>r.boards[i]),jn,80,yl())),ml(null))},[mi,r]);const yi=i=>({x:i.x,y:i.y,w:i.w??i.maxW??400,h:i.kind==="title"?90:200}),Hl=()=>{r&&p(Ki([...gt.map(i=>r.boards[i]),...ic.map(i=>yi(r.notes[i]))],jn,60,yl()))},fs=i=>{!r||!i.length||p(Ki(i.map(h=>r.boards[h]).filter(Boolean),jn,80,yl()))},Ll=i=>p(h=>{const g=ur(h.zoom*i,qm,Vm),w=yl(),T=w.x+w.w/2,A=w.y+w.h/2;return{zoom:g,x:Math.round(T-(T-h.x)/h.zoom*g),y:Math.round(A-(A-h.y)/h.zoom*g)}}),cc=i=>Ll(i/m.get().zoom);b.useEffect(()=>{if(!me)return;let i=!1;const h=window.setTimeout(()=>i=!0,1500),g=()=>i&&ke(!1),w=window.setTimeout(()=>ke(!1),8e3);return window.addEventListener("pointerdown",g,!0),window.addEventListener("keydown",g,!0),()=>{window.clearTimeout(h),window.clearTimeout(w),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("keydown",g,!0)}},[me]);const Ia=(i,h="replace")=>{j(g=>h==="replace"?i:h==="add"?[...new Set([...g,...i])]:i.reduce((w,T)=>w.includes(T)?w.filter(A=>A!==T):[...w,T],g)),h==="replace"&&_(null),i.length&&h==="replace"&&($([]),ot([]))},Vs=()=>We.length&&un?{page:un}:{},bo=async(i,h="blank")=>{try{const g=await Te.post("/api/boards/create",{...i,template:h,...Vs()});return await on(),j([g.file]),E("select"),ve({tone:"ok",text:d.toast.boardCreated(g.file),action:$n}),g}catch(g){return ve({tone:"error",text:d.toast.boardCreateFailed(g.message)}),null}},bi=async i=>{if(!i.length||!r)return;const h=i.map(w=>{var T;return((T=r.boards[w])==null?void 0:T.title)??w});if(await In.confirm({title:d.dialog.deleteBoardsTitle(i.length,h[0]),body:d.dialog.deleteBoardsBody,ok:d.dialog.delete,danger:!0}))try{await Te.post("/api/boards/delete",{files:i}),k&&i.includes(k)&&_(null),j([]),await on(),ve({text:d.toast.boardsDeleted(i.length),action:$n})}catch(w){ve({tone:"error",text:String(w.message)})}},rc=async i=>{try{const h=await Te.post("/api/boards/duplicate",{file:i});await on(),j([h.file]),ve({tone:"ok",text:d.toast.duplicated(h.file),action:$n})}catch(h){ve({tone:"error",text:String(h.message)})}},vi=async i=>{var w;const h=(w=zn.current)==null?void 0:w.boards[i];if(!h)return;const g=await In.prompt({title:d.dialog.renameBoardTitle,label:d.dialog.name,value:h.title??i.replace(/\.html$/,""),ok:d.dialog.rename});if(!(!g||g.value.trim()===(h.title??"")))try{await Te.post("/api/boards/rename",{file:i,title:g.value.trim()}),await on(),ve({tone:"ok",text:d.toast.renamed,action:$n})}catch(T){ve({tone:"error",text:String(T.message)})}},Fu=async i=>{const{refs:h}=await Te.get(`/api/boards/refs?file=${encodeURIComponent(i)}`).catch(()=>({refs:[]})),g=await In.prompt({title:d.dialog.renameFileTitle,label:d.dialog.fileName,value:i,hint:h.length?d.dialog.renameFileRefs(h.map(T=>T.file).join(", ")):d.dialog.renameFileNoRefs,ok:d.dialog.rename,extra:h.length?{label:d.dialog.renameFileExtra(h.reduce((T,A)=>T+(A.count??1),0)),checked:!0}:void 0});if(!g)return;let w=g.value.trim();if(w.endsWith(".html")||(w+=".html"),w!==i)try{await Te.post("/api/boards/rename",{file:i,newFile:w,updateRefs:g.extra}),k===i&&_(w),j([w]),await on(),ve({tone:"ok",text:d.toast.fileRenamed(w,!!g.extra),action:$n})}catch(T){ve({tone:"error",text:String(T.message)})}},$f=i=>{const h=yl(),g=m.get(),w=(h.x+h.w/2-g.x)/g.zoom,T=(h.y+h.h/2-g.y)/g.zoom,A=x.length===1&&(r!=null&&r.boards[x[0]])?x[0]:null,R=A?{beside:A,w:i.w,h:i.h}:{x:Math.round(w-i.w/2),y:Math.round(T-i.h/2),w:i.w,h:i.h,near:!0};bo(R,i.id).then(ee=>ee&&p(Ki([{x:ee.x,y:ee.y,w:ee.w,h:ee.h}],jn,80,yl())))},Of=i=>Ct({x:i.clientX,y:i.clientY,up:!0,title:d.menu.newBoard,items:hb.flatMap((h,g)=>[...g&&hb[g-1].group!==h.group?["sep"]:[],{label:`${h.label} · ${h.size}`,shortcut:h.id==="blank"?d.menu.drawWithB:void 0,run:()=>$f(h)}])}),hs=(i,h)=>{Al("chat"),On(!0),h!=null&&h.length&&j(h),i!=null&&ri(i),setTimeout(()=>{var g;return(g=dr.current)==null?void 0:g.focus()},0)},vo=()=>{const i=je.state.selection;if(!k||!i||i.file!==k)return null;const h=d.inspector.kindName(i.kind??i.tag);return{file:k,path:i.path,kind:"element",label:i.label?`${h} “${i.label.slice(0,40)}”`:h}},bn=(i,h="board",g,w)=>{var T,A;return{file:i,path:"",kind:h,label:h==="board"?((T=r==null?void 0:r.boards[i])==null?void 0:T.title)??i:`${((A=r==null?void 0:r.boards[i])==null?void 0:A.title)??i} · ${d.requests.kind[h]}`,...g?{text:g}:{},...w&&w.length>1?{boards:w}:{}}},wa=(i,h)=>{if(kt.host)return uc(i);if(kt.ready&&!kt.settings.intro&&M1()&&kt.agents.some(g=>g.here))return void ls({target:i,chat:h});h()},uc=i=>{ls(null),typeof i=="function"?i():xo(i)},xo=i=>{var ee;if(Me(null),(ee=nn.current)==null||ee.check(),i&&i.kind==="element")return Oa({kind:"element",file:i.file,path:i.path,about:i.label,target:i});if(i)return Oa({kind:"board",file:i.file,about:i.label,target:i});const h=m.get(),g=-h.x/h.zoom,w=-h.y/h.zoom,T=jn.w/h.zoom,A=jn.h/h.zoom,R=gt.filter(Ne=>{const Ae=r.boards[Ne];return Ae.x<g+T&&Ae.x+Ae.w>g&&Ae.y<w+A&&Ae.y+Ae.h>w});Oa({kind:"canvas",about:d.inline.visible(R.length),target:R.length?bn(R[0],"board",void 0,R):null})},Qu=async(i,h)=>{if(kt.host){const T=i.target??(gt[0]?bn(gt[0],"board",void 0,gt):null);if(!T)return d.app.emptyPage;try{return await Te.post("/api/requests",{action:"create",file:T.file,path:T.path,text:h,author:hl,attach:{kind:T.kind,label:T.label,...T.boards?{boards:T.boards}:{}}}),Oa(null),null}catch(A){return A.message}}const g=nn.current;if(!g)return"";const w=await g.send(h);return"error"in w?w.error:(z.current={id:w.id,at:i},_e({id:w.id,at:i}),Oa(null),null)},Pu=i=>{var h;((h=z.current)==null?void 0:h.id)===i.id&&(Me({...i,at:z.current.at}),_e(null),z.current=null)},wo=i=>ve({tone:"error",text:i.message}),xi=i=>{ss(h=>({...h,comments:h.comments.some(g=>g.id===i.id)?h.comments:[...h.comments,{id:i.id,text:i.text,file:i.file}]})),hs(co||d.prompts.fixComment,[i.file])},Ju=i=>void Te.post("/api/requests",{action:"mark",id:i.id,attach:{kind:i.path?"element":"comment"}}).then(()=>ve({tone:"ok",text:d.requests.added})).catch(wo),_l={onCancel:i=>void Te.post("/api/requests",{action:"cancel",id:i.id}).then(()=>ve({text:d.requests.cancelled})).catch(wo),onChat:i=>void Te.post("/api/requests",{action:"chat",id:i.id}).then(()=>{Ru(!0),xi(i)}).catch(wo),onRetry:i=>void Te.post("/api/requests",{action:"retry",id:i.id}).catch(wo),undoFor:i=>{var T,A,R;const h=i.request,g=(T=h==null?void 0:h.changed)==null?void 0:T[0];if(!h||!g||(A=h.steps)!=null&&A.length&&h.undo!=="ready")return null;if((R=h.steps)!=null&&R.length)return()=>void Te.post("/api/history/undo-steps",{ids:h.steps}).then(async()=>{var ee;ve({text:d.toast.undoRedoDone("undo",h.steps.length===1?((ee=r==null?void 0:r.boards[g])==null?void 0:ee.title)??g:d.activity.changes(h.steps.length)),action:{label:d.toolbar.redo,run:()=>void gl("redo")}}),await on(),ca(),nt.reload()}).catch(wo);const w=nt.tagsOf(g).find(ee=>h.by?ee.by===h.by:ee.outside);return w?()=>{ml([g]),window.setTimeout(()=>Er(g,w.key),450)}:null},onBoard:i=>{j([i]),ml([i])},titleOf:i=>{var h;return((h=r==null?void 0:r.boards[i])==null?void 0:h.title)??i},connected:kt.agents.length},dc=i=>{const h=d.prompts.fixErrors(i.map(w=>`- ${w}: ${(zl[w]??[{message:n!=null&&n.missing.includes(w)?d.menu.fileMissing:d.prompts.error}])[0].message}`).join(`
71
+ `)),g=i.filter(w=>r==null?void 0:r.boards[w]);wa(g.length?bn(g[0],"errors",h,g):null,()=>hs(h,g))},La=(i,h)=>gn(g=>{const w=g.order.filter(A=>!i.includes(A)),T=g.order.filter(A=>i.includes(A));return{...g,order:h==="front"?[...w,...T]:[...T,...w]}},h==="front"?d.history.front:d.history.back),wr=(i,h,g=d.history.boardOptions)=>gn(w=>{const T={...w.boards[i],...h};for(const A of Object.keys(T))T[A]===void 0&&delete T[A];return{...w,boards:{...w.boards,[i]:T}}},g),wi=(i,h,g,w=x,T=M,A=na)=>({...i,boards:{...i.boards,...Object.fromEntries(w.filter(R=>i.boards[R]).map(R=>[R,{...i.boards[R],x:i.boards[R].x+h,y:i.boards[R].y+g,autoPlaced:void 0}]))},notes:{...i.notes,...Object.fromEntries(T.filter(R=>i.notes[R]).map(R=>[R,{...i.notes[R],x:i.notes[R].x+h,y:i.notes[R].y+g}]))},shapes:{...i.shapes??{},...Object.fromEntries(A.filter(R=>{var ee;return(ee=i.shapes)==null?void 0:ee[R]}).map(R=>[R,{...i.shapes[R],x:i.shapes[R].x+h,y:i.shapes[R].y+g}]))}}),Gs=(i,h)=>gn(g=>wi(g,i,h,x.filter(w=>{var T;return!((T=g.boards[w])!=null&&T.locked)}),M.filter(w=>{var T;return!((T=g.notes[w])!=null&&T.locked)})),x.length?d.history.moveBoard:M.length?d.history.moveNote:d.history.moveShape),Ys=()=>{var h;let i="";do i=`n${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while((h=zn.current)!=null&&h.notes[i]);return i},ji=(i,h)=>{var A;if(Object.keys(((A=zn.current)==null?void 0:A.notes)??{}).length>=Ay)return ve({tone:"error",text:d.toast.notesMax(Ay)});const g=Ys(),w=Math.round(h.x),T=Math.round(h.y);gn(R=>({...R,notes:{...R.notes,[g]:i==="title"?{kind:i,x:w,y:T,text:d.defaults.newTitle,maxW:2e3,...Vs()}:{kind:i,x:w,y:T,text:d.defaults.note,w:400,...Vs()}}}),i==="title"?d.history.addTitle:d.history.addNote),I(g),j([]),E("select")},jo=i=>{gn(h=>{const g={...h.notes};for(const w of i)delete g[w];return{...h,notes:g}},d.history.deleteNote),$([]),ve({text:d.toast.noteDeleted,action:$n})},ja=(r==null?void 0:r.shapes)??{},jr=b.useMemo(()=>Object.keys(ja).filter(i=>ds(ja[i])).sort((i,h)=>(ja[i].z??0)-(ja[h].z??0)||(i<h?-1:1)),[ja,ds]),Nr=(i,h=d.history.addShape)=>{var T,A,R;let g="";do g=`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while((A=(T=zn.current)==null?void 0:T.shapes)!=null&&A[g]);const w=Math.max(0,...Object.values(((R=zn.current)==null?void 0:R.shapes)??{}).map(ee=>ee.z??0))+1;return gn(ee=>({...ee,shapes:{...ee.shapes??{},[g]:{...i,z:w,...Vs()}}}),h),fi(g),j([]),I(null),E("select"),g},Sr=(i,h,g)=>gn(w=>({...w,shapes:{...w.shapes??{},[i]:{...w.shapes[i],...h}}}),g),fc=i=>{gn(h=>{const g={...h.shapes??{}};for(const w of i)delete g[w];return{...h,shapes:g}},d.history.deleteShape),ot([]),ve({text:i.length===1?d.toast.shapeDeleted:d.toast.shapesDeleted(i.length),action:$n})},hc=(i,h)=>{var w;const g=Object.values(((w=zn.current)==null?void 0:w.shapes)??{}).map(T=>T.z??0);Sr(i,{z:h==="front"?Math.max(0,...g)+1:Math.min(0,...g)-1},h==="front"?d.history.shapeFront:d.history.shapeBack)},mc=(i,h)=>{const g=new Image;g.onload=()=>{const w=Math.min(1,600/Math.max(g.naturalWidth,g.naturalHeight)),T=Math.round(g.naturalWidth*w)||300,A=Math.round(g.naturalHeight*w)||200,R=m.get(),ee=h??{x:(jn.w/2-R.x)/R.zoom-T/2,y:(jn.h/2-R.y)/R.zoom-A/2};Nr({kind:"image",x:Math.round(ee.x),y:Math.round(ee.y),w:T,h:A,src:i.ref},d.history.addImage)},g.onerror=()=>ve({tone:"error",text:d.toast.imageReadFailed}),g.src=i.url};b.useEffect(()=>{const i=async h=>{var w,T,A;if(k||(T=(w=h.target)==null?void 0:w.closest)!=null&&T.call(w,"input,textarea,[contenteditable=true]"))return;const g=Array.from(((A=h.clipboardData)==null?void 0:A.files)??[]).filter(R=>R.type.startsWith("image/"));if(g.length){h.preventDefault();try{const[R]=await Am(g.map(ee=>ee.name?ee:new File([ee],d.defaults.pastedImage,{type:ee.type})));mc(R)}catch(R){ve({tone:"error",text:String(R.message)})}}};return window.addEventListener("paste",i),()=>window.removeEventListener("paste",i)});const Iu=async(i,h)=>{var T,A;let g=Math.round(h.x);const w=[];for(const R of i)try{if(/\.html?$/i.test(R.name)){const ee=await R.text(),Ne=ee.match(/<meta[^>]+name=["']board-size["'][^>]+content=["'](\d+)x(\d+)/i),Ae=Ne?Number(Ne[1]):390,ze=Ne?Number(Ne[2]):844,et=((A=(T=ee.match(/<title>([^<]*)<\/title>/i))==null?void 0:T[1])==null?void 0:A.trim())||R.name.replace(/\.html?$/i,""),fn=R.name.toLowerCase().replace(/\.htm$/,".html").replace(/[^a-z0-9._-]+/g,"-"),Se=await Te.post("/api/boards/create",{file:fn,html:ee,title:et,x:g,y:Math.round(h.y),w:Ae,h:ze,...Vs()});w.push(Se.file),g+=Ae+80}else if(R.type.startsWith("image/")){const[ee]=await Am([R]);mc(ee,{x:g,y:h.y}),g+=400}else ve({tone:"error",text:d.toast.importOnly(R.name)})}catch(ee){ve({tone:"error",text:`${R.name}: ${ee.message}`})}w.length&&(await on(),ml(w),ve({tone:"ok",text:d.toast.imported(w.length),action:$n}))},kr=async i=>{var g;if(!r)return;const h=await In.prompt({title:d.dialog.renameGroupTitle,label:d.dialog.name,value:((g=r.groupNames)==null?void 0:g[i])??i,ok:d.dialog.save});h!=null&&h.value.trim()&&gn(w=>({...w,groupNames:{...w.groupNames??{},[i]:h.value.trim()}}),d.history.renameGroup)},ms=async(i,h)=>{try{const g=await Te.post("/api/pages",i);return await on(),h&&ve({tone:"ok",text:h,action:$n}),g}catch(g){return ve({tone:"error",text:String(g.message)}),null}},_a=async()=>{if(We.length>=40)return ve({tone:"error",text:d.toast.pagesMax});const i=await In.prompt({title:d.dialog.newPageTitle,label:d.dialog.name,value:d.dialog.newPageName(Math.max(We.length,1)+1),ok:d.dialog.create});if(!(i!=null&&i.value.trim()))return;const h=await ms({action:"add",name:i.value.trim()});h!=null&&h.id&&S(h.id)},Rf=async i=>{const h=We.find(w=>w.id===i),g=await In.prompt({title:d.dialog.renamePageTitle,label:d.dialog.name,value:(h==null?void 0:h.name)??"",ok:d.dialog.rename});!(g!=null&&g.value.trim())||g.value.trim()===(h==null?void 0:h.name)||await ms({action:"rename",id:i,name:g.value.trim()})},Ul=async i=>{const h=We.find(w=>w.id===i),g=Object.values((r==null?void 0:r.boards)??{}).filter(w=>{var T;return(w.page??((T=We[0])==null?void 0:T.id))===i}).length;await In.confirm({title:d.dialog.deletePageTitle((h==null?void 0:h.name)??""),body:d.dialog.deletePageBody(g),ok:d.dialog.delete,danger:!0})&&(un===i&&S(null),await ms({action:"delete",id:i},d.toast.pageDeleted))},pc=(i,h)=>void ms({action:"move",id:i,index:h}),bl=(i,h)=>{var w,T;const g=We.findIndex(A=>A.id===i);Ct({x:h.clientX,y:h.clientY,title:(w=We[g])==null?void 0:w.name,items:[{label:d.toolbar.copyPageLink,run:()=>void Xs(So("page",i))},{label:d.menu.rename,run:()=>void Rf(i)},{label:d.menu.moveUp,disabled:g<=0,run:()=>pc(i,g-1)},{label:d.menu.moveDown,disabled:g>=We.length-1,run:()=>pc(i,g+1)},{label:((T=r==null?void 0:r.launch)==null?void 0:T.page)===i?d.menu.unsetLaunchPage:d.menu.setLaunchPage,run:()=>gn(A=>{var R;return{...A,launch:{...A.launch??{view:"canvas"},page:((R=A.launch)==null?void 0:R.page)===i?void 0:i}}},d.history.launchPage)},...x.length?[{label:d.menu.moveSelectedToPage(x.length),run:()=>gn(A=>({...A,boards:{...A.boards,...Object.fromEntries(x.map(R=>{var ee;return[R,{...A.boards[R],page:i===((ee=We[0])==null?void 0:ee.id)?void 0:i}]}))}}),d.history.moveToPage)}]:[],"sep",{label:d.menu.delete,danger:!0,disabled:We.length<=1,run:()=>void Ul(i)}]})},ps=async i=>{if(Ce.current.has(i))return;Ce.current.add(i),at([...Ce.current]);const h=ab(i);ve({text:d.toast.pngExporting(h)});try{const g=await Te.blob("/api/screenshot",{file:i,inline:!0}),w=URL.createObjectURL(g),T=document.createElement("a");T.href=w,T.download=h,document.body.append(T),T.click(),T.remove(),setTimeout(()=>URL.revokeObjectURL(w),1e4),ve({tone:"ok",text:d.toast.pngExported(h)})}catch(g){const w=g;vm(w.status,w.message)==="browser"?ve({tone:"error",text:d.toast.pngNeedsBrowser,code:"npx playwright install chromium",ms:1e4}):ve({tone:"error",text:d.toast.pngFailed(xm(w.message))})}finally{Ce.current.delete(i),at([...Ce.current])}},Ma=b.useRef(new WeakMap),No=b.useCallback(i=>{var w;const h=(w=lt.current.get(i))==null?void 0:w.contentDocument;if(!h)return!1;let g=Ma.current.get(h);return g===void 0&&(g=!!Eu(h),h.readyState==="complete"&&Ma.current.set(h,g)),g},[]),So=(i,h)=>`${location.origin}${location.pathname}${location.search}#${i}-${encodeURIComponent(h)}`,Xs=async i=>{try{await navigator.clipboard.writeText(i),ve({tone:"ok",text:d.toast.linkCopied})}catch(h){ve({tone:"error",text:String(h.message)})}},ko=b.useRef(!1),gc=i=>{if(!r)return!1;const h=/^#(page|artboard|play)-(.+)$/.exec(i);if(!h)return!1;const g=decodeURIComponent(h[2]),w=T=>{var A,R;return((A=r.boards[T])==null?void 0:A.page)??((R=We[0])==null?void 0:R.id)??null};return ko.current=!0,window.setTimeout(()=>ko.current=!1,0),h[1]==="page"?We.some(T=>T.id===g)?(ht(null),re(null),S(g),!0):!1:r.boards[g]?(ht(null),S(w(g)),h[1]==="play"?(re(g),!0):(re(null),_(null),ml([g]),!0)):!1},gs=()=>{Fe&&j([Fe]),ht(null)},Ni=b.useMemo(()=>r?(We.length?We.map(h=>h.id):[null]).map(h=>({page:h,files:r.order.filter(g=>{var w;return r.boards[g]&&(h===null||(r.boards[g].page??((w=We[0])==null?void 0:w.id))===h)})})):[],[r,We]),ys=i=>{xl(),ht(null),re(i)},ql=()=>{fe&&j([fe]),re(null)},yc=i=>{const h=Ni.flatMap(T=>T.files),g=h.indexOf(fe??""),w=h[g+i];w&&re(w)},Na=i=>Ct({x:i.clientX,y:i.clientY,title:Ua(d.toolbar.protoBoards,i).title,className:"proto-menu",items:[...Ua(d.toolbar.protoBoards,i).items,...Ni.flatMap(h=>{var g;return[...We.length>1?[{label:((g=We.find(w=>w.id===h.page))==null?void 0:g.name)??"",heading:!0,run:()=>{}}]:[],...h.files.map(w=>({label:r.boards[w].title??w,tip:w,check:w===fe,run:()=>re(w)}))]})]}),bc=i=>Ba===6&&r?[{label:r.title??"",shortcut:"›",dot:!!(Mt!=null&&Mt.update),aria:d.toolbar.projectMenu(r.title??""),tip:(n==null?void 0:n.dir)??r.title,run:()=>window.setTimeout(()=>void Tn(i),0)},"sep"]:[],Ua=(i,h)=>bc(h).length?{items:[...bc(h),{label:i,heading:!0,run:()=>{}}]}:{title:i,items:[]},Wu=i=>{const h=gt.filter(T=>{var A;return(A=r.boards[T])==null?void 0:A.is_interactive}),g=gt.filter(T=>{var A;return!((A=r.boards[T])!=null&&A.is_interactive)}),w=T=>({label:r.boards[T].title??T,tip:T,check:fe?T===fe:void 0,run:()=>ys(T)});Ct({x:i.clientX,y:i.clientY,right:!0,className:"play-menu oc-menu",title:d.toolbar.playMenu,items:[...h.length?[{label:d.toolbar.protoHeading,heading:!0,run:()=>{}},...h.map(w)]:[],...h.length&&g.length?["sep"]:[],...g.length?[{label:d.toolbar.staticHeading,heading:!0,run:()=>{}},...g.map(w)]:[],...gt.length?[]:[{label:d.toolbar.noBoards,disabled:!0,run:()=>{}}]]})},vc=(i,h,g)=>{if(h==="export")return void ps(i);if(h==="expand")return ht(i);if(h==="tweaks"){Mo("tweaks"),ra(!1),_(null),j([i]),$([]),ot([]),Al("inspect"),On(!0);return}Ct({x:g.clientX,y:g.clientY,className:"play-menu",items:[{label:d.menu.playInPlace,shortcut:"P",run:()=>we===i?Gl():Ze(i)},{label:d.menu.playFullScreen,run:()=>pe(i)}]})},Vl=(i=x,h=M)=>{if(!r||!i.length&&!h.length)return;const g=i.every(T=>{var A;return(A=r.boards[T])==null?void 0:A.locked})&&h.every(T=>{var A;return(A=r.notes[T])==null?void 0:A.locked}),w=T=>{const A={...T};return g?delete A.locked:A.locked=!0,A};gn(T=>({...T,boards:{...T.boards,...Object.fromEntries(i.filter(A=>T.boards[A]).map(A=>[A,w(T.boards[A])]))},notes:{...T.notes,...Object.fromEntries(h.filter(A=>T.notes[A]).map(A=>[A,w(T.notes[A])]))}}),g?d.history.unlock:d.history.lock)},To=async(i,h)=>{try{const g=await Te.blob("/api/screenshot",{file:i,path:h??"",inline:!0});await navigator.clipboard.write([new ClipboardItem({"image/png":g})]),ve({tone:"ok",text:d.toast.copiedPng})}catch(g){const w=g;ve({tone:"error",text:vm(w.status,w.message)==="browser"?d.toast.pngNeedsBrowser:d.toast.pngFailed(xm(w.message))})}},ed=async i=>{const h=(await(await fetch(`/screens/${encodeURIComponent(i)}`)).text()).replace(/<script data-dc-probe[\s\S]*?<\/script>/,"");await navigator.clipboard.writeText(h),ve({tone:"ok",text:d.toast.copiedHtml})},xc=()=>{var w;const i=je.state.selection,h=k?(w=lt.current.get(k))==null?void 0:w.contentDocument:null,g=i&&h?hn(h,i.path):null;if(g){try{localStorage.setItem("design-canvas:props",g.getAttribute("style")??"")}catch{}ve({tone:"ok",text:d.toast.copiedProps})}},Tr=async()=>{let i=null;try{i=localStorage.getItem("design-canvas:props")}catch{}if(!(i==null||!k))for(const h of je.state.paths){const g=await Ha(k,h).catch(()=>null);g&&await yn({op:"setStyleText",path:h,hash:g,text:i},k)}},Sa=i=>{var ee;const h=je.state.selection,g=k?(ee=lt.current.get(k))==null?void 0:ee.contentDocument:null,w=h&&g?hn(g,h.path):null;if(!w)return;const T=i==="x"?"scaleX(-1)":"scaleY(-1)",A=w.style.transform||"",R=A.includes(T)?A.replace(T,"").trim():`${A} ${T}`.trim();qs("transform",R)},Ks=i=>{const h=x.includes(i)?x:[i],g=h.length>1;return[{label:d.menu.selectInside,shortcut:"Enter",disabled:g,run:()=>xs(i)},{label:d.menu.focusView,shortcut:"F",disabled:g,run:()=>ys(i)},{label:d.menu.goToBoard,shortcut:"⇧2",run:()=>fs(h)},"sep",{label:we===i?d.menu.stopPlay:d.menu.playInPlace,shortcut:"P",disabled:g,run:()=>we===i?Gl():Ze(i)},{label:d.menu.playFullScreen,disabled:g,run:()=>pe(i)},"sep",{label:d.menu.rename,shortcut:"F2",disabled:g,run:()=>void vi(i)},{label:d.menu.renameFile,disabled:g,run:()=>void Fu(i)},{label:d.menu.duplicate,shortcut:`${ft}D`,disabled:g,run:()=>void rc(i)},{label:h.every(w=>{var T;return(T=r==null?void 0:r.boards[w])==null?void 0:T.locked})?d.menu.unlock:d.menu.lock,shortcut:`${ft}L`,run:()=>Vl(h,[])},"sep",{label:d.toolbar.copyLink,disabled:g,run:()=>void Xs(So("artboard",i))},{label:d.menu.copyPng,shortcut:`⇧${ft}C`,disabled:g||!!(n!=null&&n.missing.includes(i)),run:()=>void To(i)},{label:d.menu.copyHtml,disabled:g,run:()=>void ed(i)},{label:Nt.includes(i)?d.menu.exportingPng:d.menu.exportPng,disabled:g||Nt.includes(i)||!!(n!=null&&n.missing.includes(i)),run:()=>void ps(i)},"sep",{label:d.menu.front,shortcut:`${ft}]`,run:()=>La(h,"front")},{label:d.menu.back,shortcut:`${ft}[`,run:()=>La(h,"back")},"sep",{label:d.menu.askReview,run:()=>wa(bn(i,"review",d.prompts.review,h),()=>hs(d.prompts.review,h))},{label:d.menu.askAI,aria:d.menu.askAIAria,shortcut:`${ft}J`,run:()=>wa(bn(i,"board",void 0,h),()=>xo(bn(i,"board",void 0,h)))},...zl[i]||n!=null&&n.missing.includes(i)?[{label:d.menu.askFixErrors,run:()=>dc([i])}]:[],"sep",{label:g?d.menu.deleteBoards(h.length):d.menu.delete,shortcut:"⌫",danger:!0,run:()=>void bi(h)}]},Co=(i,h)=>{var g,w,T;r&&(i.type==="board"?(x.includes(i.file)||Ia([i.file]),Ct({x:h.clientX,y:h.clientY,title:((g=r.boards[i.file])==null?void 0:g.title)??i.file,items:Ks(i.file)})):i.type==="note"?(I(i.id),Ct({x:h.clientX,y:h.clientY,title:((w=r.notes[i.id])==null?void 0:w.kind)==="title"?d.menu.title:d.menu.note,items:[{label:d.menu.duplicateInFront,shortcut:`${ft}D`,run:()=>{const A=r.notes[i.id],R=Ys();gn(ee=>({...ee,notes:{...ee.notes,[R]:{...A,x:A.x+40,y:A.y+40}}}),d.history.duplicateNote),I(R)}},{label:(T=r.notes[i.id])!=null&&T.locked?d.menu.unlock:d.menu.lock,shortcut:`${ft}L`,run:()=>Vl([],[i.id])},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:()=>jo([i.id])}]})):Ct({x:h.clientX,y:h.clientY,items:[{label:d.menu.newBoardHere,shortcut:"B",run:()=>void bo({x:Math.round(i.x),y:Math.round(i.y),w:390,h:844})},{label:d.menu.mobileFrameHere,run:()=>void bo({x:Math.round(i.x),y:Math.round(i.y)},"mobile")},{label:d.menu.titleHere,shortcut:"T",run:()=>ji("title",i)},{label:d.menu.noteHere,shortcut:"N",run:()=>ji("sticky",i)},"sep",{label:d.menu.selectAll,shortcut:`${ft}A`,run:()=>Ia(gt)},{label:d.menu.fitAll,shortcut:"⇧1",run:Hl},{label:d.menu.zoom100,shortcut:`${ft}0`,run:()=>cc(1)},"sep",{label:d.menu.undo,shortcut:`${ft}Z`,disabled:!cl.canUndo,run:()=>void gl("undo")},{label:d.menu.redo,shortcut:`⇧${ft}Z`,disabled:!cl.canRedo,run:()=>void gl("redo")}]}))};Us.current=(i,h)=>{var A;if(!k)return;const g=()=>Ha(k,i),w=(A=lt.current.get(k))!=null&&A.contentDocument?hn(lt.current.get(k).contentDocument,i):null,T=i.includes("/")?i.slice(0,i.lastIndexOf("/")):null;Ct({x:h.clientX,y:h.clientY,title:w?`<${w.tagName.toLowerCase()}>`:d.menu.element,items:[{label:d.menu.openProps,shortcut:`${ft}\\`,run:()=>{Al("inspect"),Mo("props"),ra(!1),qa(!0),On(!0)}},"sep",{label:d.menu.editText,disabled:!w||w.children.length>0,run:()=>w&&Gu(k,w,i)},{label:d.menu.selectParent,shortcut:"↑",disabled:T==null,run:()=>T!=null&&void je.select([T])},...(w==null?void 0:w.tagName)==="IMG"?[{label:d.menu.replaceImage,run:()=>Zu(i,!0)}]:[],"sep",{label:d.menu.copy,shortcut:`${ft}C`,run:()=>void Xu()},{label:d.menu.pasteAfter,shortcut:`${ft}V`,run:()=>void Ku()},{label:d.menu.duplicate,shortcut:`${ft}D`,run:async()=>void yn({op:"duplicate",path:i,hash:await g()})},"sep",{label:d.menu.copyPng,shortcut:`⇧${ft}C`,run:()=>void To(k,i)},{label:d.menu.copyProps,shortcut:`⌥${ft}C`,run:xc},{label:d.menu.pasteProps,shortcut:`⌥${ft}V`,run:()=>void Tr()},{label:d.menu.copyForAI,run:()=>void navigator.clipboard.writeText(`${k} ${i} <${w==null?void 0:w.tagName.toLowerCase()}> "${((w==null?void 0:w.textContent)??"").trim().slice(0,60)}"`).then(()=>ve({tone:"ok",text:d.toast.copied}))},"sep",{label:d.menu.flipH,shortcut:"⇧H",run:()=>Sa("x")},{label:d.menu.flipV,shortcut:"⇧V",run:()=>Sa("y")},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:async()=>{await yn({op:"delete",path:i,hash:await g()})&&(je.select([]),ve({text:d.toast.elementDeleted,action:$n}))}}]})};const Gl=()=>{var h,g;const i=we;Ze(null),(g=(h=document.activeElement)==null?void 0:h.blur)==null||g.call(h),mb(),i&&(xa.reset(i),ii(pn(i)),ul(pn(i)))};b.useEffect(()=>{if(!we)return;const i=lt.current.get(we);if(!i)return;const h=T=>T.key==="Escape"&&Eo.current();let g=null;const w=()=>{g==null||g.removeEventListener("keydown",h,!0),g=i.contentDocument,g==null||g.addEventListener("keydown",h,!0)};return w(),i.addEventListener("load",w),()=>{i.removeEventListener("load",w),g==null||g.removeEventListener("keydown",h,!0)}},[we,fo]);const Eo=b.useRef(()=>{});Eo.current=Gl;const[_n,On]=b.useState(!1),[Zs,qa]=b.useState(!1),[Nn,ra]=b.useState(!1),[bs,Mo]=b.useState("props"),wc=b.useRef(0),[Ao,Un]=b.useState(!1),[pt,Pe]=b.useState(null),[Kn,aa]=b.useState(null),jc=b.useRef(!1),Yl=b.useRef(Ge);b.useEffect(()=>{if(Yl.current!==Ge){Yl.current=Ge,On(Ge?!1:jc.current);return}Ge||(jc.current=_n)},[Ge,_n]);const td=yf(m,i=>{if(!r||!_n||An!=="chat")return 0;const h=-i.x/i.zoom,g=-i.y/i.zoom,w=jn.w/i.zoom,T=jn.h/i.zoom;return gt.filter(A=>{const R=r.boards[A];return R.x<h+w&&R.x+R.w>h&&R.y<g+T&&R.y+R.h>g}).length}),Nc=N0(m,Kt&&_n),zo=b.useRef(!1);b.useEffect(()=>{const i=setTimeout(()=>zo.current=!0,1500);return()=>clearTimeout(i)},[]);const vs=b.useRef(!1),[nd,Si]=b.useState(0);!k||((ud=je.state.selection)==null||ud.file),b.useEffect(()=>{Date.now()-wc.current<600||(k||x.length||M.length||na.length)&&ra(!1)},[k,x,M,na]),b.useEffect(()=>{xe&&De&&On(!1)},[xe,De]),b.useEffect(()=>{xe&&_n&&He(!1)},[xe,_n]);const $o=()=>{qe(en?d.app.cleanOff:d.app.cleanOn),Pn(!en)},Fs=i=>{const h=[".oc-left",".canvas",".oc-right",".oc-dock"].map(A=>document.querySelector(A)).filter(Boolean),g=h.findIndex(A=>A.contains(document.activeElement)),w=h[(g+(i?-1:1)+h.length)%h.length],T=w.matches(".canvas")?w:w.querySelector("button:not([disabled]), input, select, textarea, [tabindex]");w.matches(".canvas")&&(w.tabIndex=-1),(T??w).focus()},Xl=async i=>{if(!k)return;const h=[...je.state.paths].sort((w,T)=>Number(w.split("/").pop())-Number(T.split("/").pop())),g=await Promise.all(h.map(w=>Ha(k,w)));await yn({op:"wrap",paths:h,hashes:g,display:i})&&(je.select([h[0]]),ve({tone:"ok",text:d.toast.wrapped(i),action:$n}))},Kl=async(i,h)=>{try{await Te.put("/api/tokens",{...i,label:h}),fl(g=>g+1),ve({tone:"ok",text:h===d.history.changeTheme?d.toast.theme(i.active):d.toast.tokensSaved,action:$n})}catch(g){ve({tone:"error",text:String(g.message)})}},Sn=(i,h)=>{if(k===i){h.join()!==je.state.paths.join()&&je.select(h);return}Ii.current={file:i,paths:h},_(i),j([i]),$([]),ot([])},ki=(i,h)=>Sn(i,[h]),Sc=(i,h,g)=>{const w=tf(lt.current.get(i),h.clientX,h.clientY);if(!w)return void(!g.add&&k===i&&_(null));if(g.add&&k===i){const T=je.state.paths;return void je.select(T.includes(w.path)?T.filter(A=>A!==w.path):[...T,w.path])}Sn(i,[w.path]),g.double||db("picks"),g.double&&Gu(i,w.el,w.path)};Wi.current=Sc,b.useEffect(()=>{var w,T;const i=Ii.current,h=i&&k===i.file?lt.current.get(i.file):null;if(!i||!h)return;const g=()=>{Ii.current=null,je.select(i.paths)};return((w=h.contentDocument)==null?void 0:w.readyState)==="complete"&&((T=h.contentDocument.body)!=null&&T.childElementCount)?g():(h.addEventListener("load",g,{once:!0}),()=>h.removeEventListener("load",g))},[k,fo]);const xs=i=>{var T,A;const h=(T=lt.current.get(i))==null?void 0:T.contentDocument,g=h?Array.from(((A=h.body)==null?void 0:A.children)??[]).find(R=>!/^(SCRIPT|STYLE|TEMPLATE)$/.test(R.tagName)):null,w=g?il(g):"0";w!=null&&Sn(i,[w])};b.useEffect(()=>{k&&!(x.length===1&&x[0]===k)&&_(null)},[x]),b.useEffect(()=>{te(null),le(null)},[k,N]),b.useEffect(()=>{we&&k===we&&_(null)},[we]);const kn=k??(x.length===1?x[0]:null),ws=b.useMemo(()=>{var i;return x1(k?(i=lt.current.get(k))==null?void 0:i.contentDocument:null)},[k,fo,va[k??""],(Oc=je.state.selection)==null?void 0:Oc.hash]);b.useEffect(()=>{if(!kn)return fr(null);Te.get(`/api/lint?f=${encodeURIComponent(kn)}`).then(i=>fr(i.files[kn]??[])).catch(()=>fr(null))},[kn,va[kn??""],hi]),b.useEffect(()=>{if(!kn)return Ji(null);const i=()=>{var w;const g=(w=lt.current.get(kn))==null?void 0:w.contentDocument;Ji((g==null?void 0:g.readyState)==="complete"?p1(g,(Rt==null?void 0:Rt.minTarget)??48):null)},h=window.setTimeout(i,600);return()=>window.clearTimeout(h)},[kn,fo,va[kn??""],Rt==null?void 0:Rt.minTarget,yo]);const qn=i=>{var w;const h=i.currentTarget.getBoundingClientRect(),g=((w=i.currentTarget.closest(".oc-dock"))==null?void 0:w.getBoundingClientRect())??h;return{clientX:h.left,clientY:g.top-8}},kc=i=>Ct({x:i.clientX,y:i.clientY,up:!0,title:d.toolbar.canvasTools,icons:!0,items:oi.slice(0,5).map(h=>({label:h.label,icon:h.icon,shortcut:h.key,check:N===h.id,run:()=>E(h.id)}))}),ad=i=>Ct({x:i.clientX,y:i.clientY,up:!0,title:d.toolbar.shapes,icons:!0,items:[...oi.slice(5).map(h=>({label:h.label,icon:h.icon,shortcut:h.key,check:N===h.id,run:()=>E(h.id)})),"sep",{label:d.toolbar.insertImage,icon:"image",run:()=>os(()=>h=>{os(null),mc(h)})}]}),ld=(i,h=!1)=>{const g=Math.round(m.get().zoom*100);Ct({x:i.clientX,y:i.clientY,right:!h,up:h,className:"zoom-menu oc-menu",items:[{label:d.toolbar.zoomIn,shortcut:`${ft}+`,run:()=>Ll(2)},{label:d.toolbar.zoomOut,shortcut:`${ft}−`,run:()=>Ll(1/2)},{label:d.toolbar.fitAll,shortcut:"⇧1",run:Hl},{label:d.toolbar.zoomToSelection,shortcut:"⇧2",disabled:!x.length,run:()=>fs(x)},"sep",{label:d.toolbar.zoomNow(g),disabled:!0,run:()=>{}},...[50,100,200].map(w=>({label:`${w}%`,shortcut:w===100?`${ft}0`:void 0,check:g===w,run:()=>cc(w/100)})),"sep",{label:d.toolbar.layoutGuides,shortcut:"⌃G",check:Bs,run:()=>hr(w=>!w)},{label:d.toolbar.minimap,shortcut:"M",check:K,run:sd},{label:d.toolbar.cleanView,shortcut:`⇧${ft}\\`,check:en,run:$o}]})},sd=()=>ae(i=>!i),Df=i=>Ct({x:i.clientX,y:i.clientY,title:d.toolbar.shortcuts,className:"keys-menu",items:Bw.flatMap(h=>[{label:d.keys.sections[h],heading:!0,run:()=>{}},...Hw.filter(g=>g.section===h).map(g=>({label:d.keys.rows[g.id],shortcut:g.combos.map(w=>_w(w,ft)).join(" "),run:()=>{}}))])}),Tn=async i=>{const h=Mt!=null&&Mt.update?await Promise.race([cs(),new Promise(A=>setTimeout(A,400))]).then(A=>A??Mt):Mt,g=Rt?Object.keys(Rt.themes):[];lc();const w=A=>A.split(/[\\/]/).filter(Boolean).pop()??A,T=A=>ac.some(R=>R!==A&&R.title===A.title)||A.title===(r==null?void 0:r.title)?`${A.title} · ${w(A.root)}`:A.title;Ct({x:i.clientX,y:i.clientY,title:(n==null?void 0:n.dir)??(r==null?void 0:r.title),className:"project-menu oc-menu",items:[...Dl(h),{label:d.boardList.search,shortcut:`${ft}K`,run:()=>{Pa("boards"),He(!0),setTimeout(()=>{var A;return(A=Da.current)==null?void 0:A.focus()},0)}},{label:d.toolbar.shareMenu,run:()=>{var A;return(A=document.querySelector(".oc-rhead .share-btn"))==null?void 0:A.click()}},{label:d.toolbar.snapshot,run:()=>void od(i)},...xe?[{label:d.toolbar.history,run:()=>Ei()}]:[],"sep",{label:d.toolbar.appearance(ro),run:()=>uo(A=>A==="system"?"light":A==="light"?"dark":"system")},...g.length>1?g.map(A=>({label:d.toolbar.themeOption(A),check:Rt.active===A,run:()=>void Kl({...Rt,active:A},d.history.changeTheme)})):[],{label:d.toolbar.language(ef.find(A=>A.id===gf).name),run:()=>Yx(ef[(ef.findIndex(A=>A.id===gf)+1)%ef.length].id)},"sep",{label:d.requests.menuChat,check:!kt.host,run:()=>void kt.save({mode:"chat",intro:!0})},{label:d.requests.menuHost,check:kt.host,run:()=>void kt.save({mode:"host",intro:!0})},...!kt.host&&nn.current?(()=>{const A=nn.current;return[{label:d.inline.agentItem(A.label),run:()=>window.setTimeout(()=>A.openAgentMenu({right:Math.max(8,window.innerWidth-i.clientX-340),top:i.clientY}),0)},...A.isCustom?[]:[{label:d.inline.modelItem(A.model),run:()=>void In.prompt({title:d.inline.modelTitle,label:d.inline.modelLabel,value:A.model,ok:d.dialog.ok}).then(R=>{var ee;return R&&((ee=nn.current)==null?void 0:ee.setModel(R.value.trim()))})}]]})():[],"sep",{label:d.toolbar.shortcuts,run:()=>window.setTimeout(()=>Df(i),0)},...ac.length?["sep",{label:d.toolbar.otherProjects,heading:!0,run:()=>{}},...ac.map(A=>({label:T(A),tip:A.root,run:()=>window.location.assign(`http://localhost:${A.port}/`)}))]:[]]})},Cr=i=>Ct({x:i.clientX,y:i.clientY,title:Ua(d.boardList.pages,i).title,className:"pages-menu",items:[...Ua(d.boardList.pages,i).items,...We.length?We.map(h=>({label:h.name,tip:h.name,check:h.id===un,run:()=>S(h.id),more:{label:d.boardList.pageMore(h.name),open:g=>bl(h.id,g)}})):[{label:d.boardList.mainPage,check:!0,run:()=>{}}],"sep",{label:d.boardList.newPage,disabled:We.length>=40,run:()=>void _a()}]}),Ti=(i,h)=>{!r||!n||Ct({x:i.clientX,y:i.clientY,title:d.toolbar.erroredBoardsN(h.length),items:[...h.slice(0,12).map(g=>{var w,T,A;return{label:`${((w=r.boards[g])==null?void 0:w.title)??g} — ${(((A=(T=zl[g])==null?void 0:T[0])==null?void 0:A.message)??d.menu.fileMissing).slice(0,40)}`,run:()=>{Ia([g]),fs([g])}}}),"sep",{label:d.menu.askFixAll,run:()=>dc(h)},...n.missing.length?[{label:d.menu.cleanMissing(n.missing.length),danger:!0,run:()=>{gn(g=>{const w={...g.boards};for(const T of n.missing)delete w[T];return{...g,boards:w,order:g.order.filter(T=>!n.missing.includes(T))}},d.history.cleanMissing),ve({text:d.toast.cleanedUp(n.missing.length),action:$n})}}]:[]]})},od=async(i,h=!1)=>{const g=await Te.get("/api/snapshots").catch(()=>null);if(!(g!=null&&g.git))return Ct({x:i.clientX,y:i.clientY,right:h,title:d.menu.snapshot,items:[{label:d.menu.notGit,disabled:!0,run:()=>{}}]});Ct({x:i.clientX,y:i.clientY,right:h,title:d.menu.snapshotStatus(g.branch??"",g.changed),items:[{label:g.changed?d.menu.snapshotNow:d.menu.nothingChanged,disabled:!g.changed,run:async()=>{const w=await In.prompt({title:d.dialog.snapshotTitle,label:d.dialog.snapshotLabel,value:d.dialog.snapshotMessage(new Date().toLocaleDateString("en-CA")),hint:d.dialog.snapshotHint,ok:d.dialog.commit});if(w)try{const T=await Te.post("/api/snapshot",{message:w.value});ve({tone:"ok",text:T.nothing?d.toast.nothingChanged:d.toast.snapshot(T.hash??"")})}catch(T){ve({tone:"error",text:String(T.message)})}}},"sep",...g.snapshots.slice(0,10).map(w=>({label:`${w.hash} ${w.subject.slice(0,40)} · ${w.when}`,disabled:!0,run:()=>{}}))]})};b.useEffect(()=>gb(k),[k]);const Ci=async i=>{const h=zn.current,g=h&&of(h,i);if(!h||!g)return;const w=T=>{var A;return((A=h.boards[T])==null?void 0:A.title)??T};us(T=>T&&{...T,busy:!0});try{const T=await Te.post("/api/boards/use",{file:i});us(null),k&&g.alts.includes(k)&&_(null),await on(),ml([g.original]);const A=g.chosen===g.original?d.occupancy.kept(w(g.original),g.alts.length):d.occupancy.applied(I1(w(g.chosen)),w(g.original));ve({tone:"ok",text:A,action:T.step?{label:d.occupancy.undo,run:()=>void Oo(T.step,A,[g.original,...g.alts])}:$n})}catch(T){us(A=>A&&{...A,busy:!1}),ve({tone:"error",text:String(T.message)})}ca(),nt.reload()},Bf=async i=>{const h=zn.current,g=h&&of(h,i);if(!(!h||!g)){us(w=>w&&{...w,busy:!0});try{const w=await Te.post("/api/boards/keep",{file:i});us(null),await on();const T=d.occupancy.keptAll(g.kind,g.alts.length);ve({text:T,action:w.step?{label:d.occupancy.undo,run:()=>void Oo(w.step,T)}:$n})}catch(w){us(T=>T&&{...T,busy:!1}),ve({tone:"error",text:String(w.message)})}ca(),nt.reload()}},Oo=async(i,h,g=[])=>{try{await Te.post("/api/history/undo-steps",{ids:[i],mode:"rest"}),await on(),g.length&&ml(g),ve({text:d.toast.undoRedoDone("undo",h),action:{label:d.toolbar.redo,run:()=>void gl("redo")}})}catch(w){ve({tone:"error",text:String(w.message)})}ca(),nt.reload()},Tc=b.useRef([]);b.useEffect(()=>{const i=[...x,...k?[k]:[]],h=i.filter(g=>!Tc.current.includes(g));Tc.current=i;for(const g of h)nt.markSeen(nt.tagsOf(g).flatMap(w=>w.steps))},[x,k]);const vl=(i,h)=>nt.tagsOf(i).find(g=>g.key===h)??null,Qs=(i,h)=>{vl(i,h)&&Ja(g=>(g==null?void 0:g.file)===i&&g.key===h?null:{file:i,key:h,conflict:null,busy:!1})},id=b.useRef(Qs);id.current=Qs;const Er=b.useCallback((i,h)=>id.current(i,h),[]),Mr=b.useRef(null);b.useEffect(()=>{var g;const i=Mr.current,h=At&&vl(At.file,At.key);Mr.current=h?{id:`${At.file}|${h.key}`,steps:h.steps}:null,i&&i.id!==((g=Mr.current)==null?void 0:g.id)&&nt.markSeen(i.steps)},[At==null?void 0:At.file,At==null?void 0:At.key]);const cd=async(i,h,g)=>{var T,A,R;Ja(ee=>ee&&{...ee,busy:!0});const w=d.activity.stepName(((A=(T=nt.data)==null?void 0:T.steps.find(ee=>ee.id===h.steps[0]))==null?void 0:A.name)??"");try{const ee=()=>Te.post("/api/history/undo-steps",{ids:h.steps,mode:g});h.run?await Te.post("/api/chat/undo-run",{id:h.run,mode:g}).catch(Ne=>Ne.status===404?ee():Promise.reject(Ne)):await ee(),Ja(null),ve({text:d.toast.undoRedoDone("undo",h.steps.length===1?w:d.activity.changes(h.steps.length)),action:{label:d.toolbar.redo,run:()=>void gl("redo")}}),await on()}catch(ee){const Ne=ee,Ae=Ne.status===409?(R=Ne.body)==null?void 0:R.conflicts:void 0;Ae?Ja(ze=>ze&&{...ze,busy:!1,conflict:[...new Set(Ae.map(et=>{var fn,Se;return et.file.endsWith(".html")?((Se=(fn=zn.current)==null?void 0:fn.boards[et.file])==null?void 0:Se.title)??et.file:et.file}))]}):(Ja(ze=>ze&&{...ze,busy:!1}),ve({tone:"error",text:Ne.message}))}ca(),nt.reload()},Ps=async i=>{Hu(!0);try{await Te.post("/api/history/goto",{id:i.id}),ve({text:d.activity.wentBack(d.activity.stepName(i.name))}),await on()}catch(h){ve({tone:"error",text:String(h.message)})}finally{Hu(!1),ca(),nt.reload()}},Cc=b.useCallback(()=>ec(!1),[]),Ei=()=>{nt.reload(),ec(!0)};b.useEffect(()=>{At&&!vl(At.file,At.key)&&Ja(null)},[nt.data,nt.now]);const Ar=b.useRef(()=>{});Ar.current=i=>{var Ne,Ae,ze,et,fn,Se,Vt,Vn,Yt,tl;if(!r||In.state||ce)return;if(fe){if(wu(i)||$t||(Ne=document.activeElement)!=null&&Ne.closest(".menu"))return;if(i.altKey&&i.code==="KeyC")return i.preventDefault(),jl();(i.key==="Escape"||i.key==="ArrowLeft"||i.key==="ArrowRight")&&(i.preventDefault(),i.key==="Escape"?ql():yc(i.key==="ArrowLeft"?-1:1));return}if(Fe){i.key==="Escape"&&!wu(i)&&(i.preventDefault(),gs());return}if((i.metaKey||i.ctrlKey)&&!i.shiftKey&&i.key==="\\"&&!i.isComposing&&wu(i))return i.preventDefault(),Mc();if(wu(i)||i.isComposing||(i.key==="Enter"||i.key===" ")&&i.target instanceof Element&&i.target.closest("button, a[href], [role=button]"))return;const h=i.metaKey||i.ctrlKey,g=i.key.toLowerCase(),w=x.length===1?x[0]:null,T=Xe=>{i.preventDefault(),Xe()};if(h&&g==="z")return T(()=>void gl(i.shiftKey?"redo":"undo"));if(h&&g==="y")return T(()=>void gl("redo"));if(h&&g==="j")return T(()=>An==="chat"&&Ge&&!Tt?xl():An==="chat"&&!Ge?Al("inspect"):wa(vo()??(w?bn(w):null),()=>xo(vo()??(w?bn(w):null))));if(h&&g==="k")return T(()=>{He(!0),setTimeout(()=>{var Xe;return(Xe=Da.current)==null?void 0:Xe.focus()},0)});if(h&&g==="a"&&!k)return T(()=>Ia(gt));if(h&&g==="a"&&k){const Xe=(Ae=lt.current.get(k))==null?void 0:Ae.contentDocument,Ft=(ze=je.state.selection)==null?void 0:ze.path,dt=Xe&&(Ft?(et=hn(Xe,Ft))==null?void 0:et.parentElement:Xe.body.firstElementChild),fa=dt?Array.from(dt.children).filter(ea=>!/^(SCRIPT|STYLE)$/.test(ea.tagName)).map(ea=>il(ea)).filter(ea=>ea!=null):[];return T(()=>fa.length&&void je.select(fa))}if(h&&g==="l"&&(x.length||M.length))return T(()=>Vl());if(h&&i.altKey&&i.code==="KeyC"&&k&&je.state.selection)return T(xc);if(h&&i.altKey&&i.code==="KeyV"&&k&&je.state.paths.length)return T(()=>void Tr());if(h&&i.shiftKey&&g==="c"&&k&&je.state.selection)return T(()=>void To(k,je.state.selection.path));if(h&&i.shiftKey&&g==="c"&&w&&!k)return T(()=>void To(w));if(!h&&i.shiftKey&&(g==="h"||g==="v")&&k&&je.state.selection)return T(()=>Sa(g==="h"?"x":"y"));if(h&&g==="c"&&k&&je.state.selection)return T(()=>void Xu());if(h&&g==="v"&&k)return T(()=>void Ku());if(h&&g==="d"&&k&&je.state.selection){const Xe=je.state.selection;return T(()=>void yn({op:"duplicate",path:Xe.path,hash:Xe.hash}))}if(h&&g==="d"&&w&&!k)return T(()=>void rc(w));if(h&&i.key==="]"&&x.length)return T(()=>La(x,"front"));if(h&&i.key==="["&&x.length)return T(()=>La(x,"back"));if(h&&i.key==="0")return T(()=>cc(1));if(h&&i.key==="1")return T(Hl);if(h&&(i.key==="="||i.key==="+"))return T(()=>Ll(2));if(h&&i.key==="-")return T(()=>Ll(1/2));if(h&&i.shiftKey&&i.code==="Backslash")return T(()=>$o());if(h&&i.key==="\\")return T(()=>Mc());if(i.ctrlKey&&!i.metaKey&&g==="g")return T(()=>hr(Xe=>!Xe));if(h&&g==="g"&&k&&je.state.paths.length>=2)return T(()=>void Xl("flex"));if(h)return;if(i.shiftKey&&i.code==="Digit1")return T(Hl);if(i.shiftKey&&i.code==="Digit2")return T(()=>fs(x));if(i.altKey&&!h&&i.code==="KeyC")return T(jl);if(i.key==="Escape"){if(pt)return T(()=>Pe(null));if(Kn)return T(wl);if(Ao)return T(()=>Un(!1));if(en)return T(()=>$o());if(we)return T(()=>Gl());if(Ge&&De)return T(()=>He(!1));const Xe=!!((fn=document.activeElement)!=null&&fn.closest(".oc-right"))&&!((Se=document.activeElement)!=null&&Se.closest(".oc-rhead"));if(!Tt&&(Ge||(Or||Nn||An==="chat")&&!Xe))return T(xl);if(k)return T(()=>_(null));if(N!=="select")return T(()=>E("select"));j([]),I(null),fi(null);return}if(i.key==="F6")return T(()=>Fs(i.shiftKey));const A=document.activeElement,R=!A||A===document.body||!!((Vt=A.closest)!=null&&Vt.call(A,".canvas"))||A.tagName==="IFRAME";if(i.key==="Tab"&&!i.shiftKey&&R&&k&&je.state.selection){const Xe=document.querySelector('.etb button[tabindex="0"]');if(Xe)return T(()=>Xe.focus())}if(i.key==="Tab"&&R&&!k&&gt.length){const Xe=x.length?gt.indexOf(x[x.length-1]):-1,Ft=gt[(Xe+(i.shiftKey?-1:1)+gt.length)%gt.length];return T(()=>{var dt;Ia([Ft]),fs([Ft]),qe(d.app.announceBoard(((dt=r.boards[Ft])==null?void 0:dt.title)??Ft,gt.indexOf(Ft)+1,gt.length))})}if(i.key==="Enter"&&!k&&x.length===1&&R)return T(()=>xs(x[0]));if(i.key==="Enter"&&k&&je.state.selection){const Xe=(Vn=lt.current.get(k))==null?void 0:Vn.contentDocument,Ft=Xe&&hn(Xe,je.state.selection.path),dt=i.shiftKey?Ft==null?void 0:Ft.parentElement:Ft==null?void 0:Ft.firstElementChild,fa=dt&&dt!==(Xe==null?void 0:Xe.body)?il(dt):null;return fa!=null?T(()=>void je.select([fa])):void 0}if(g==="p"&&!h&&mw(x,r.boards)==="play")return T(()=>we===x[0]?Gl():Ze(x[0]));if((i.key==="Delete"||i.key==="Backspace")&&na.length&&!k)return T(()=>fc(na));if(i.key==="Delete"||i.key==="Backspace"){if(k&&je.state.selection){const Xe=je.state.selection;return T(async()=>{await yn({op:"delete",path:Xe.path,hash:Xe.hash})&&(je.select([]),ve({text:d.toast.elementDeleted,action:$n}))})}return M.length||x.length&&!k?T(()=>{M.length&&jo(M),x.length&&!k&&bi(x)}):void 0}if((i.key.startsWith("Arrow")||i.key==="Enter")&&k&&je.state.selection){const Xe=je.state.selection,Ft=(Yt=lt.current.get(k))==null?void 0:Yt.contentDocument,dt=Ft&&hn(Ft,Xe.path);if(!dt)return;if(i.altKey&&(i.key==="ArrowUp"||i.key==="ArrowDown")){const ea=Xe.path.includes("/")?Xe.path.slice(0,Xe.path.lastIndexOf("/")):"",Go=Number(Xe.path.split("/").pop()),Dt=i.key==="ArrowUp"?Go-1:Go+1;return Dt<0||Dt>=(((tl=dt.parentElement)==null?void 0:tl.children.length)??0)?T(()=>{}):T(()=>void Yu(Xe.path,{toParentPath:ea,index:Dt,freeze:[]}))}const fa=i.key==="ArrowUp"||i.key==="Enter"&&i.shiftKey?dt.parentElement:i.key==="ArrowDown"||i.key==="Enter"?dt.firstElementChild:i.key==="ArrowRight"?dt.nextElementSibling:dt.previousElementSibling;if(fa&&fa!==Ft.body){const ea=il(fa);if(ea!=null)return T(()=>void je.select([ea]))}return T(()=>{})}if(i.key.startsWith("Arrow")&&(x.length||M.length||na.length)&&!k){const Xe=i.altKey?100:i.shiftKey?10:1;return T(()=>Gs(i.key==="ArrowLeft"?-Xe:i.key==="ArrowRight"?Xe:0,i.key==="ArrowUp"?-Xe:i.key==="ArrowDown"?Xe:0))}if(i.key==="F2"&&w)return T(()=>void vi(w));if(g==="f"&&w)return T(()=>ys(w));if(g==="m")return T(sd);const ee=oi.find(Xe=>Xe.key.toLowerCase()===g);if(ee)return T(()=>E(ee.id))},b.useEffect(()=>{const i=h=>Ar.current(h);return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]);const Js=b.useRef(new Map),zr=i=>{var ee,Ne;if(!n||!r)return null;const h=((ee=r.boards[i])==null?void 0:ee.title)??i,g=k===i&&((Ne=je.state.selection)==null?void 0:Ne.file)===i?je.state.selection:null,w=g?`${d.inspector.kindName(g.kind??g.tag)}${g.label?` "${g.label.slice(0,40)}"`:""}`:void 0,T={file:`${n.screens??"screens"}/${i}`,...g?{path:g.path,element:w}:{},label:w?d.requests.frameElement(h,w):d.requests.frameBoard(h)},A=JSON.stringify(T),R=Js.current.get(i);return(R==null?void 0:R.sig)===A?R.v:(Js.current.set(i,{sig:A,v:T}),T)},Ro=i=>{var h;if(Tt){const g=(h=document.querySelector(`.pin-layer [data-comment="${i.id}"]`))==null?void 0:h.getBoundingClientRect();aa({id:i.id,x:g?g.right:ut.w/2,y:g?g.top:80}),B(i.id);return}aa(null),B(i.id),On(!0),Al("inspect"),wc.current=Date.now(),ra(!0),i.path?Sn(i.file,[i.path]):(_(null),j([i.file]),$([]),ot([])),window.setTimeout(()=>{var A,R;const g=(A=document.querySelector(`.pin-layer [data-comment="${i.id}"]`))==null?void 0:A.getBoundingClientRect(),w=(R=document.querySelector(".oc-right"))==null?void 0:R.getBoundingClientRect();if(!g||!w||g.right+12<=w.left||g.left>=w.right)return;const T=g.right+24-w.left;p(ee=>({...ee,x:ee.x-T}))},260)},Ec=(i,h)=>{var A;const g=Ht.filter(R=>R.file===i&&(!R.resolved||bu(R,sn)));if(!g.length)return null;const w=(A=lt.current.get(i))==null?void 0:A.contentDocument,T=N==="select"&&!en&&we!==i&&!ce;return s.jsx("div",{className:`pins ${T?"live":""}`,children:g.map((R,ee)=>{const Ne=w&&R.path?hn(w,R.path):null,Ae=Ne?Ml(Ne):null,ze=1/Math.max(h,.25);return s.jsxs("button",{className:`pin ${ba(R)?`req-pin is-${R.request.state}`:""} ${Gn===R.id?"on":""}`,title:R.text,"aria-label":ba(R)?d.requests.pinLabel(ee+1,R.request.state==="waiting",R.text.split(`
72
+ `)[0].slice(0,80)):d.comments.pinLabel(ee+1,R.author,R.text.split(`
73
+ `)[0].slice(0,80)),"aria-pressed":Gn===R.id,tabIndex:T?0:-1,"data-comment":R.id,onPointerDown:et=>et.stopPropagation(),onDoubleClick:et=>et.stopPropagation(),onClick:()=>bu(R,sn)?zc(R):Ro(R),style:Ae?{left:Ae.x+Ae.w-12,top:Math.max(Ae.y-12,24/Math.max(h,.25)-24),transform:`scale(${1/Math.max(h,.25)})`}:{right:32*ze-24,top:(8+ee*30)*ze+24*ze-24,transform:`scale(${ze})`},children:[ee+1,ba(R)&&s.jsx("span",{className:"req-flag","aria-hidden":"true",title:d.requests.forAi,children:R.request.state==="taken"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(F,{name:R.request.state==="waiting"?"clock":R.request.state==="done"?"check":"warn",size:14})})]},R.id)})})},rd=(i,h)=>{var et,fn;const g=(et=lt.current.get(i))==null?void 0:et.contentDocument,w=k===i,T=Bs?(((fn=r==null?void 0:r.guides)==null?void 0:fn[i])??[]).filter(Se=>!Se.hidden):[],A=we===i?void 0:nt.tagsOf(i).find(Se=>Se.paths.length&&nt.stateOf(Se)==="fresh"),R=(ne==null?void 0:ne.file)===i&&we!==i&&!(w&&je.state.paths.includes(ne.path))?ne:null,ee=(ie==null?void 0:ie.file)===i?ie.rect:null,Ne=Nt.includes(i),Ae=g&&!en&&we!==i?[...new Set(Ht.filter(Se=>{var Vt;return Se.file===i&&Se.path&&((Vt=Se.request)==null?void 0:Vt.state)!=="done"&&bu(Se,sn)}).map(Se=>Se.path))].map(Se=>hn(g,Se)).filter(Se=>!!Se):[];if(!w&&!T.length&&!A&&!R&&!ee&&!Ne&&!Ae.length)return null;const ze=1/Math.max(h,.05);return s.jsxs("div",{className:"overlay",children:[Ne&&s.jsx("div",{className:"export-badge",role:"status",style:{transform:`scale(${1/Math.max(h,.25)})`},children:d.canvas.exportingPng}),A&&s.jsx(Jx,{frame:lt.current.get(i)??null,paths:A.paths,zoom:h}),T.length>0&&r&&s.jsx(g0,{guides:T,w:r.boards[i].w,h:r.boards[i].h}),Ae.map((Se,Vt)=>s.jsx(uf,{r:Ml(Se),cls:"req-out",px:ze},`req${Vt}`)),R&&s.jsx(uf,{r:R.rect,cls:"hover",px:ze}),w&&je.state.rects.map((Se,Vt)=>s.jsx(uf,{r:Se,cls:"sel",px:ze},Vt)),ee&&s.jsx(uf,{r:ee,cls:"marquee-el",px:ze}),w&&W!==i&&g&&je.state.paths.length===1&&je.state.rects[0]&&s.jsx(T1,{doc:g,path:je.state.paths[0],rect:je.state.rects[0],zoom:h,onMove:Se=>void Yu(je.state.paths[0],Se),onPosition:async(Se,Vt)=>{const Vn=je.state.paths[0],Yt=await Ha(i,Vn);await yn({op:"batch",ops:[{op:"setStyle",path:Vn,hash:Yt,prop:"left",value:`${Se}px`},{op:"setStyle",path:Vn,hash:Yt,prop:"top",value:`${Vt}px`}]})},onResize:async(Se,Vt)=>{const Vn=je.state.paths[0],Yt=await Ha(i,Vn);await yn({op:"batch",ops:[{op:"setStyle",path:Vn,hash:Yt,prop:"width",value:`${Se}px`},{op:"setStyle",path:Vn,hash:Yt,prop:"height",value:`${Vt}px`}]})}})]})};if(!r||!n)return s.jsx("div",{className:"loading",role:"status",children:Os?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"warn"})," ",d.app.loadFailed," ",Os,s.jsx("button",{onClick:()=>void on(),children:d.app.retry})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",d.app.loadingBoards]})});const it=x.length===1?x[0]:null,Wa=[...new Set([...n.missing,...Object.keys(zl)])],Is=s.jsxs("div",{className:"oc-tabs",role:"tablist","aria-label":d.tabs.left,ref:Lu,children:[s.jsx("button",{role:"tab","aria-selected":dl==="boards",className:dl==="boards"?"on":"",onClick:()=>Pa("boards"),children:d.tabs.boards}),s.jsx("button",{role:"tab","aria-selected":dl==="assets",className:dl==="assets"?"on":"",onClick:()=>Pa("assets"),children:d.tabs.assets}),s.jsx("button",{role:"tab","aria-selected":dl==="tokens",className:dl==="tokens"?"on":"",onClick:()=>Pa("tokens"),children:d.tabs.tokens})]}),$r=gt.map(i=>({file:i,...r.boards[i]})),Or=!k&&!x.length&&!M.length&&!na.length,Do=Ge&&An==="inspect"&&!!k&&!(((Rc=je.state.selection)==null?void 0:Rc.file)===k&&je.state.paths.length>0),Tt=!_n||Do,Rn=Kt&&!Tt,vn=rt,xl=()=>{On(!1),B(null),qa(!1),ra(!1)},Mc=()=>{if(!Tt)return xl();Al("inspect"),ra(!1),qa(!0),On(!0)},wl=()=>{aa(null),B(null)},Rr=(i,h)=>Ct({x:h.clientX,y:h.clientY,items:[{label:d.comments.edit,run:async()=>{const g=await In.prompt({title:d.comments.edit,label:d.comments.title,value:i.text,ok:d.dialog.save});g!=null&&g.value.trim()&&g.value.trim()!==i.text&&await Te.post("/api/comments",{action:"edit",id:i.id,text:g.value.trim()})}},"sep",{label:d.comments.deleteThread,danger:!0,run:async()=>{(Kn==null?void 0:Kn.id)===i.id&&wl(),await Te.post("/api/comments",{action:"delete",id:i.id})}}]}),jl=()=>{Pe(null),aa(null),Un(i=>!i)},Dr=()=>{if(Nn&&!Tt)return xl();B(null),Al("inspect"),ra(!0),On(!0)},Mi=k??it??gt[0]??null,js=An==="chat"&&(!kt.host||ci),Zl=Ge&&An==="inspect"&&!!Gn&&Ht.some(i=>i.id===Gn),Bo=i=>{if(!Ge||en)return;const h=i.target instanceof Element?i.target:null;if(!h||h.closest(".pin, .oc-card, .etb, .req-composer, .oc-dock"))return;if(Tt){i.type==="pointerdown"&&i.button===0&&!h.matches(".canvas, .pan-capture")&&h.closest(".board")&&!document.querySelector(".canvas.tool-hand")&&(B(null),Si(T=>T+1));return}const g=An==="chat"&&!js||Zl;i.type==="wheel"||i.button===1||document.querySelector(".canvas.tool-hand")||(h.matches(".canvas, .pan-capture")||g)&&xl()},Br=li,Ho=!Tt&&!Rn,Ai=Ye+Math.max(Zt,vt)+8,Ns=Ge?144:192,zi=Ge?96:128,Va=Qe>0&&Math.floor((ut.w-Qe)/2)>=vn+Ns+8?vn:Ye,$i=Qe>0&&ut.h-Va-zi>=vn+Wt+8;ln.current=$i?{left:vn,right:vn+Ns,top:ut.h-Va-zi,bottom:ut.h-Va}:null;const Hr=$i&&K&&$r.length>0&&(!De||!Ge)&&!Rn&&!fe&&!st,Oi=Math.max(Wt,ut.h-vn-(Hr&&!Ge?Va+zi+8:Ai)),el=De&&!fe,Dn=`oc-card oc-left ${el?"":"is-collapsed"} ${el&&dl!=="boards"?"is-tall":""}`,Zn=Math.max(0,ut.w-vn-8-(!Tt&&!Rn?li:Ba>=Sm?vn-8:yr>0?yr+vn:0)),Nl=Math.max(240,Math.min(Vu,Zn)),Lo=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"oc-head",children:[s.jsxs("div",{className:"oc-views",role:"radiogroup","aria-label":d.toolbar.viewToggle,children:[s.jsx("button",{role:"radio","aria-checked":!fe,className:`icon-btn oc-vb ${fe?"":"on"}`,"aria-label":d.toolbar.viewCanvas,title:d.toolbar.viewCanvas,onClick:()=>fe&&ql(),children:s.jsx(F,{name:"canvas"})}),s.jsx("button",{role:"radio","aria-checked":!!fe,className:`icon-btn oc-vb ${fe?"on":""}`,"aria-label":d.toolbar.viewPrototype,title:d.toolbar.viewPrototypeTitle,disabled:!Mi,onClick:()=>!fe&&Mi&&ys(Mi),children:s.jsx(F,{name:"focus"})})]}),!fe&&s.jsx("button",{className:`icon-btn oc-ib oc-lp ${el?"on":""}`,"aria-label":d.toolbar.boardsPanel,"aria-pressed":el,title:d.toolbar.boardsPanel,onClick:()=>He(i=>!i),children:s.jsx(F,{name:"panel"})}),s.jsx("span",{className:"oc-hsep","aria-hidden":"true"}),Ba!==6&&s.jsxs("button",{className:"oc-project",title:(n==null?void 0:n.dir)??r.title,"aria-haspopup":"menu","aria-label":d.toolbar.projectMenu(r.title??""),"aria-expanded":!!((Dc=$t==null?void 0:$t.className)!=null&&Dc.startsWith("project")),onClick:i=>{const h=i.currentTarget.closest(".oc-head").getBoundingClientRect();Tn({clientX:h.left,clientY:h.bottom+8})},children:[s.jsx("span",{className:"app-title",children:r.title}),s.jsx(F,{name:"chevronDown",size:16}),(Mt==null?void 0:Mt.update)&&s.jsx("span",{className:"oc-news",role:"img","aria-label":d.update.dotTitle(Mt.update.latest),title:d.update.dotTitle(Mt.update.latest)})]}),Ba!==6&&s.jsx("span",{className:"oc-crumb","aria-hidden":"true",children:s.jsx(F,{name:"chevronRight",size:14})}),fe&&r.boards[fe]?s.jsxs("button",{className:"oc-page oc-proto-board",title:`${r.boards[fe].title??fe} · ${fe}`,"aria-haspopup":"menu","aria-label":d.toolbar.protoBoard(r.boards[fe].title??fe),onClick:i=>{const h=i.currentTarget.closest(".oc-head").getBoundingClientRect();Na({clientX:h.left,clientY:h.bottom+8})},children:[s.jsx("span",{className:"oc-page-name",children:r.boards[fe].title??fe}),s.jsx(F,{name:"chevronDown",size:16}),Ba===6&&(Mt==null?void 0:Mt.update)&&s.jsx("span",{className:"oc-news",role:"img","aria-label":d.update.dotTitle(Mt.update.latest),title:d.update.dotTitle(Mt.update.latest)})]}):s.jsxs("button",{className:"oc-page",title:((la=We.find(i=>i.id===un))==null?void 0:la.name)??d.boardList.mainPage,"aria-haspopup":"menu","aria-label":d.boardList.pageSwitch(((xn=We.find(i=>i.id===un))==null?void 0:xn.name)??d.boardList.mainPage),onClick:i=>{const h=i.currentTarget.closest(".oc-head").getBoundingClientRect();Cr({clientX:h.left,clientY:h.bottom+8})},children:[We.length>1&&s.jsx("span",{className:"oc-pcount","aria-label":d.toolbar.pageCount(We.length),children:We.length}),s.jsx("span",{className:"oc-page-name",children:((Bi=We.find(i=>i.id===un))==null?void 0:Bi.name)??d.boardList.mainPage}),s.jsx(F,{name:"chevronDown",size:16}),Ba===6&&(Mt==null?void 0:Mt.update)&&s.jsx("span",{className:"oc-news",role:"img","aria-label":d.update.dotTitle(Mt.update.latest),title:d.update.dotTitle(Mt.update.latest)})]})]}),(Wa.length>0||Os)&&s.jsxs("div",{className:"oc-status",children:[Wa.length>0&&s.jsxs("button",{className:"err-chip","aria-haspopup":"menu",title:d.toolbar.erroredBoards,onClick:i=>{const h=i.currentTarget.getBoundingClientRect();Ti({clientX:h.left,clientY:h.bottom+8},Wa)},children:[s.jsx(F,{name:"warn",size:16})," ",d.toolbar.errors(Wa.length)]}),Os&&s.jsx("span",{className:"warn",children:Os})]}),el&&Is]}),ka=je.state.selection,Bn={left:vn,top:rt+Wt+8,right:ut.w-vn-(!Tt&&!Rn?li:0),bottom:ut.h-Ye},ua=()=>{const i=k?je.state.rects[0]:null,h=k?r.boards[k]:null;if(!i||!h)return null;const g=m.get();return{x:g.x+(h.x+i.x)*g.zoom,y:g.y+(h.y+i.y)*g.zoom,w:i.w*g.zoom,h:i.h*g.zoom}},Wn=i=>{const h=r.boards[i];if(!h)return null;const g=m.get();return{x:g.x+h.x*g.zoom,y:g.y+h.y*g.zoom-28,w:h.w*g.zoom,h:h.h*g.zoom+28}},Ri=()=>{var h;const i=(h=document.querySelector(".oc-rhead .ask-ai"))==null?void 0:h.getBoundingClientRect();return i?{x:i.left,y:i.top,w:i.width,h:i.height}:null},Ac=(()=>{var g;if(Rn||ce)return[];const i=new Set(gt),h=new Map;for(const w of Ht){if(!i.has(w.file)||!bu(w,sn))continue;const T=w.path?(g=lt.current.get(w.file))==null?void 0:g.contentDocument:null,A=`${w.file}|${T&&hn(T,w.path)?w.path:""}`;h.set(A,[...h.get(A)??[],w])}return[...h].map(([w,T])=>({key:w,file:T[0].file,path:w.slice(T[0].file.length+1),items:T})).sort((w,T)=>+!w.path-+!T.path)})(),zc=i=>{const h=Ac.find(g=>g.items.some(w=>w.id===i.id));Ve(new Set(((h==null?void 0:h.items)??[i]).map(g=>g.id)))},Fl=(i,h)=>{var R,ee;const g=r.boards[i];if(!g)return null;const w=h?(R=lt.current.get(i))==null?void 0:R.contentDocument:null,T=w?hn(w,h):null;let A;if(T){const Ne=Ml(T),Ae=m.get();A={x:Ae.x+(g.x+Ne.x)*Ae.zoom,y:Ae.y+(g.y+Ne.y)*Ae.zoom,w:Ne.w*Ae.zoom,h:Ne.h*Ae.zoom}}else{const Ne=document.querySelector(`.board[data-file="${CSS.escape(i)}"] .board-label`),Ae=[...(Ne==null?void 0:Ne.querySelectorAll(".act-tags > *"))??[]].map(Yt=>Yt.getBoundingClientRect()).filter(Yt=>Yt.width>0),ze=Ae.length?Ae.filter(Yt=>Math.abs(Yt.top-Ae[0].top)<4):[(ee=Ne==null?void 0:Ne.querySelector(".board-title"))==null?void 0:ee.getBoundingClientRect()].filter(Yt=>!!Yt&&Yt.width>0);if(!ze.length)return null;const et=Math.min(...ze.map(Yt=>Yt.left)),fn=Math.max(...ze.map(Yt=>Yt.right));A={x:et,y:ze[0].top,w:fn-et,h:ze[0].height};const Se=m.get(),Vt=Se.x+g.x*Se.zoom,Vn=Se.y+g.y*Se.zoom;return Vt+g.w*Se.zoom<Bn.left||Vt>Bn.right||Vn+g.h*Se.zoom<Bn.top||Vn-56>Bn.bottom?null:A}return!A||A.x+A.w<Bn.left||A.x>Bn.right||A.y+A.h<Bn.top||A.y>Bn.bottom?null:A},Je=i=>{var h;return i.kind==="element"&&i.file===k&&((h=je.state.selection)==null?void 0:h.path)===i.path?ua():i.file?Wn(i.file):Ri()},_t=!!k&&!!r.boards[k]&&!!ka&&ka.file===k&&je.state.paths.length===1&&!W&&N==="select"&&we!==k,Cn=go||!!($t!=null&&$t.up),Di=me&&gt.length>0,Ws=!_t&&N==="select"&&!W&&!Cn&&!(it&&we===it)&&Di,Uo=Qe>0&&(ut.w+Qe)/2>ut.w-li?!Rn&&(!!Jn||Ws)?Ye+Zt+8:Ye:0,eo=(()=>{if(!Rn)return 0;const i=k?r.boards[k]:it?r.boards[it]:null,h=k?je.state.rects[0]:null,g=Nc??m.get(),w=i?g.y+(i.y+(h?h.y+h.h:i.h))*g.zoom+4:0;return Math.round(ur(w+8,vn+Wt+vn,ut.h-8-(An==="chat"?480:280)))})(),da=k&&((Vo=je.state.selection)==null?void 0:Vo.file)===k?je.state.selection:null,dn=()=>!Rn&&(k??(na.length||M.length?null:it))&&(()=>{const i=k??it;return s.jsx(Dm,{file:i,version:va[i]??0,selected:k?je.state.paths:[],onSelect:(h,g)=>{const w=k?je.state.paths:[];Sn(i,g?w.includes(h)?w.filter(T=>T!==h):[...w,h]:[h])},onMove:async(h,g,w)=>{const T=await Ha(i,h);await yn({op:"move",path:h,hash:T,toParentPath:g,index:w},i)&&Sn(i,[g?`${g}/${w}`:String(w)])}})})(),$c=kn&&r.boards[kn]&&((Rl==null?void 0:Rl.length)??0)+((Ln==null?void 0:Ln.length)??0)>0&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.sections.checks}),Rt&&!Rt.registered?s.jsx(Nu,{variant:"row",id:"token-check",title:d.sections.tokenCheck,count:d.checks.off,children:s.jsx(b1,{onSetUp:()=>{Pa("tokens"),He(!0)}})}):s.jsx(Nu,{variant:"row",id:"token-check",title:d.sections.tokenCheck,count:(Rl==null?void 0:Rl.length)??0,children:s.jsx(Ky,{title:d.checks.tokenCheck((Rt==null?void 0:Rt.active)??""),items:Rl,empty:d.checks.noOffToken,onPick:i=>ki(kn,i),onAskAI:()=>{const i=d.prompts.fixTokens((Rl??[]).slice(0,12).map(h=>`- ${h.path??d.prompts.line+h.line}: ${h.message}`).join(`
74
+ `));wa(bn(kn,"tokens",i),()=>hs(i,[kn]))}})}),s.jsx(Nu,{variant:"row",id:"a11y",title:d.sections.a11y,count:(Ln==null?void 0:Ln.length)??0,children:s.jsx(Ky,{title:d.checks.a11y,items:Ln,empty:d.checks.a11yOk,onPick:i=>ki(kn,i),onAskAI:()=>{const i=d.prompts.fixA11y((Ln??[]).slice(0,12).map(h=>`- ${h.path}: ${h.message}`).join(`
75
+ `));wa(bn(kn,"a11y",i),()=>hs(i,[kn]))}})})]}),qo=Ht.filter(i=>!i.resolved&&gt.includes(i.file)).length;return s.jsx(s.Fragment,{children:s.jsxs("div",{className:`app oc oc-cd rs-${Ba} ${Ao?"is-cmt-mode":""} ${xe?"oc-n":""} ${Ge?"oc-pane":""} ${ut.w<=760?"narrow":""} ${Kt?"oc-phone":""} ${en?"oc-clean":""} ${fe?"is-proto":""} ${we?"is-playing":""}`,children:[el&&dl==="tokens"?s.jsxs("aside",{ref:Le,className:Dn,style:{maxHeight:Oi,width:Nl},"aria-label":d.app.tokensAside,children:[Lo,Rt?s.jsx(g1,{tokens:Rt,onSave:(i,h)=>void Kl(i,h)}):s.jsx("p",{className:"oc-empty",children:d.app.loading})]}):el&&dl==="assets"?s.jsxs("aside",{ref:Le,className:Dn,style:{maxHeight:Oi,width:Nl},"aria-label":d.app.assetsAside,children:[Lo,s.jsx(Nb,{version:Ds,onError:i=>ve({tone:"error",text:i}),onUploaded:i=>ve({tone:"ok",text:d.toast.uploaded(i.map(h=>h.name).join(", "))})})]}):el?s.jsx(sw,{cardRef:Le,className:Dn,style:{maxHeight:Oi,width:Nl},header:Lo,ref:Da,board:r,pages:We,currentPage:un,selected:x,missing:Wa,onPage:S,onAddPage:()=>void _a(),onPageMenu:bl,onMovePage:pc,onPick:(i,h)=>{const g=r.boards[i];We.length&&g&&(g.page??We[0].id)!==un&&S(g.page??We[0].id),Ia([i],h?"toggle":"replace"),h||fs([i]),Ge&&!h&&He(!1)},onGroupRename:i=>void kr(i),onGroupMenu:(i,h,g)=>{var w;return Ct({x:g.clientX,y:g.clientY,title:i&&((w=r.groupNames)==null?void 0:w[i])||i||d.boardList.otherGroup,items:[...i?[{label:d.menu.renameGroup,run:()=>void kr(i)}]:[],{label:d.menu.pageFromGroup,run:async()=>{var A;if(!We.length&&!await ms({action:"add",name:d.boardList.mainPage}))return;const T=await ms({action:"add",name:i&&((A=r.groupNames)==null?void 0:A[i])||i||d.boardList.otherGroup});T!=null&&T.id&&(gn(R=>({...R,boards:{...R.boards,...Object.fromEntries(h.filter(ee=>R.boards[ee]).map(ee=>[ee,{...R.boards[ee],page:T.id}]))}}),d.history.pageFromGroup),S(T.id))}}]})},dotOf:i=>P1(Ea,i),onBoardMenu:(i,h)=>{var g;x.includes(i)||Ia([i]),Ct({x:h.clientX,y:h.clientY,title:((g=r.boards[i])==null?void 0:g.title)??i,items:Ks(i)})}}):s.jsx("aside",{ref:Le,className:Dn,style:!el&&Zn>0?{maxWidth:Zn}:void 0,"aria-label":d.boardList.aria,children:Lo}),s.jsxs("div",{className:"canvas-wrap",onPointerDownCapture:i=>{var w;const h=i.target instanceof Element?i.target:null,g=h==null?void 0:h.closest(".board");if(Ao&&N==="select"&&i.button===0&&g&&!h.closest(".pin, .board-btns, .board-resize")){i.stopPropagation(),i.preventDefault();const T=g.dataset.file,A=tf(lt.current.get(T),i.clientX,i.clientY),R=A&&h.closest(".board-frame")?A:null,ee=R?(()=>{const{kind:Ne,label:Ae}=xu(R.el);return Ae?`${d.inspector.kindName(Ne)} “${Ae.slice(0,24)}”`:d.inspector.kindName(Ne)})():null;aa(null),Pe({file:T,path:(R==null?void 0:R.path)??"",x:i.clientX,y:i.clientY,crumbs:[((w=r.boards[T])==null?void 0:w.title)??T,...ee?[ee]:[]]});return}Ge&&De&&He(!1),Bo(i)},onWheelCapture:Bo,onDragOver:i=>{Array.from(i.dataTransfer.items).some(h=>h.kind==="file")&&i.preventDefault()},onDrop:i=>{const h=Array.from(i.dataTransfer.files);if(!h.length)return;i.preventDefault();const g=i.currentTarget.getBoundingClientRect(),w=m.get(),T={x:(i.clientX-g.left-w.x)/w.zoom,y:(i.clientY-g.top-w.y)/w.zoom};Iu(h,T)},children:[s.jsx(M0,{board:r,files:n.files,view:m,tool:N,setTool:E,visibleBoards:gt,visibleNotes:ic,selected:x,selectedNotes:M,editFile:k,reloadKeys:io,stamps:ia,onSelect:Ia,onSelectNote:(i,h)=>{if(!i)return $([]);$(g=>h?g.includes(i)?g.filter(w=>w!==i):[...g,i]:[i]),h||(j([]),ot([]))},onMarquee:(i,h)=>{j(g=>h?[...new Set([...g,...i.boards])]:i.boards),$(g=>h?[...new Set([...g,...i.notes])]:i.notes),ot(g=>h?[...new Set([...g,...i.shapes])]:i.shapes)},onMoveBoards:(i,h)=>gn(g=>{const w=Object.entries(i),T=w.length>0&&w.every(([,ze])=>ze.w==null&&ze.h==null&&ze.x!=null&&ze.y!=null),[A,R]=w[0]??[],ee=T&&A&&g.boards[A]?R.x-g.boards[A].x:0,Ne=T&&A&&g.boards[A]?R.y-g.boards[A].y:0,Ae=T&&M.length&&w.every(([ze])=>x.includes(ze))?wi(g,ee,Ne,[],M):g;return{...Ae,boards:{...Ae.boards,...Object.fromEntries(w.map(([ze,et])=>[ze,{...Ae.boards[ze],...et,autoPlaced:void 0}]))}}},h?Object.values(i).some(g=>g.w!=null)?d.history.resizeBoard:d.history.moveBoard:void 0),onMoveNote:(i,h,g)=>gn(w=>{const T=w.notes[i],A=h.x!=null?h.x-T.x:0,R=h.y!=null?h.y-T.y:0,Ne=(A||R)&&!("text"in h)&&M.includes(i)?wi(w,A,R,x,M.filter(Ae=>Ae!==i)):w;return{...Ne,notes:{...Ne.notes,[i]:{...T,...h}}}},g?"text"in h?d.history.editNote:d.history.moveNote:void 0),onDeleteNote:i=>jo([i]),onPlay:i=>we===i?Gl():Ze(i),onBoardAction:vc,hasTweaks:No,playing:we,typing:W,onPickElement:(i,h,g)=>{const w=lt.current.get(i),T=w==null?void 0:w.contentDocument;if(w&&(!(T!=null&&T.body)||T.readyState==="loading")){const A={clientX:h.clientX,clientY:h.clientY};return w.addEventListener("load",()=>Wi.current(i,A,g),{once:!0})}Sc(i,h,g)},onHoverElement:(i,h)=>{const g=i&&h?tf(lt.current.get(i),h.clientX,h.clientY):null;te(w=>!g||!i?null:(w==null?void 0:w.file)===i&&w.path===g.path?w:{file:i,path:g.path,rect:Ml(g.el)})},onElementMarquee:(i,h,g)=>{const w=lt.current.get(i),T=w==null?void 0:w.contentDocument;if(!w||!T||!h)return le(null);const A=w.getBoundingClientRect(),R=A.width/(w.offsetWidth||A.width)||1,ee={x:(h.x-A.left)/R,y:(h.y-A.top)/R,w:h.w/R,h:h.h/R};if(!g)return le({file:i,rect:ee});le(null);const Ne=k===i?je.state.paths:[],Ae=x0(T,ee);Sn(i,[...Ne,...Ae.filter(ze=>!Ne.includes(ze))])},onElementContext:(i,h)=>{const g=tf(lt.current.get(i),h.clientX,h.clientY);return g?(k===i&&je.state.paths.includes(g.path)||Sn(i,[g.path]),window.setTimeout(()=>{var w;return(w=Us.current)==null?void 0:w.call(Us,g.path,h)},0),!0):!1},onRename:i=>void vi(i),onCreateBoard:i=>void bo(i),onCreateNote:ji,onContext:Co,onSize:Rs,renderBoardOverlay:rd,renderBoardPins:Ec,frameInfo:zr,renderBoardTags:i=>{var Ae,ze,et,fn;const h=nt.tagsOf(i),g=kt.host?Fy(Ht,i):0,w=Ht.filter(Se=>Se.file===i&&!Se.path&&bu(Se,sn)),T=w.find(Se=>Se.request.state==="taken"),A=T?T.request.by??"AI":null;if(!h.length&&!((Ae=Ea[i])!=null&&Ae.length)&&!g&&!A)return null;const R=(At==null?void 0:At.file)===i?At.key:null,ee=JSON.stringify([Ea[i],hl,R,g,A,w.map(Se=>Se.id),h.map(Se=>[Se.key,Se.by,Se.person,Se.outside,Se.count,Se.newBoard,d.activity.ago(nt.now-Se.at),nt.stateOf(Se)])]),Ne=g||A||(ze=Ea[i])!=null&&ze.length?s.jsxs(s.Fragment,{children:[s.jsx($1,{n:g,working:A,short:!!((et=Ea[i])!=null&&et.length),onOpen:w.length?()=>Ve(new Set(w.map(Se=>Se.id))):void 0}),(fn=Ea[i])!=null&&fn.length?s.jsx(Q1,{list:Ea[i]}):null]}):null;return pi(`tags:${i}`,ee,()=>s.jsx(Fx,{file:i,act:nt,me:hl,onOpen:Er,open:R,lead:Ne}))},renderBoardButtons:(i,h)=>{const g=of(r,i);if(!g)return null;const w=J1(Ea,g),T=(pl==null?void 0:pl.file)===i;return pi(`use:${i}`,JSON.stringify([g,w,h,T]),()=>s.jsx(W1,{file:i,group:g,busy:w,compact:h,open:T,onOpen:()=>us(A=>(A==null?void 0:A.file)===i?null:{file:i,busy:!1})}))},boardRing:i=>Vb(Ea,i).length?"var(--line-strong)":null,underLayer:Af,worldLayer:i=>s.jsx(s.Fragment,{children:s.jsx(u0,{shapes:ja,ids:jr,zoom:i,selected:na,interactive:N==="select",onSelect:(h,g)=>{ot(w=>g?w.includes(h)?w.filter(T=>T!==h):[...w,h]:w.includes(h)?w:[h]),g||(j([]),$([]))},onChange:(h,g,w)=>gn(T=>{var ze;const A=(ze=T.shapes)==null?void 0:ze[h];if(!A)return T;const R=g.x!=null?g.x-A.x:0,ee=g.y!=null?g.y-A.y:0,Ae=(R||ee)&&g.w==null&&na.includes(h)?wi(T,R,ee,x,M,na.filter(et=>et!==h)):T;return{...Ae,shapes:{...Ae.shapes??{},[h]:{...A,...g}}}},w?g.w!=null?d.history.resizeShape:d.history.moveShape:void 0),onContext:(h,g)=>Ct({x:g.clientX,y:g.clientY,title:d.menu.shape,items:[{label:d.menu.front,shortcut:`${ft}]`,run:()=>hc(h,"front")},{label:d.menu.back,shortcut:`${ft}[`,run:()=>hc(h,"back")},"sep",{label:d.menu.delete,shortcut:"⌫",danger:!0,run:()=>fc([h])}]})})}),iframeRef:(i,h)=>{h&&lt.current.get(i)!==h&&(lt.current.set(i,h),(i===k||i===we||i===kn||i===it||Ht.some(w=>w.file===i&&!w.resolved)||nt.tagsOf(i).some(w=>w.paths.length))&&Tf(w=>w+1))}}),Gw.includes(N)&&s.jsx(Jw,{store:m,tool:N,onDone:i=>Nr(i)}),gt.length===0&&ic.length===0&&jr.length===0&&s.jsxs("div",{className:"canvas-empty",children:[s.jsx(F,{name:"board",size:32}),s.jsx("p",{children:d.app.emptyPage}),s.jsxs("button",{className:"primary",onClick:()=>E("board"),children:[d.app.drawBoard," ",s.jsx("kbd",{children:"B"})]})]})]}),!Rn&&Jn?s.jsx(B1,{win:ut,bottom:Ye,room:xe&&!Tt?ut.w-vn-Br:ut.w,onSwitch:()=>{const i=Jn.target;kt.save({mode:"host",intro:!0}).then(()=>uc(i))},onKeep:()=>{const i=Jn.chat;ls(null),kt.save({intro:!0}),i()}}):!Rn&&Ws&&s.jsx(Fw,{win:ut,first:Di,onSize:Yn}),!Rn&&_t&&ka&&!Cn&&!Et&&!ye&&!(P&&P.at.kind==="element"&&P.at.file===k&&P.at.path===ka.path)&&s.jsx(w1,{store:m,target:ua,bounds:Bn,selection:ka,inline:(()=>{var g;const i=(g=lt.current.get(k))==null?void 0:g.contentDocument,h=i?hn(i,ka.path):null;return h?Sy(h):{}})(),tokens:Rt,vars:ws,onStyle:qs,onAskAi:()=>wa(vo(),()=>xo(vo())),onComment:()=>{var g;const i=ua(),h=k;Pe({file:h,path:ka.path,x:i?i.x+i.w:ut.w/2,y:i?i.y:80,crumbs:[((g=r.boards[h])==null?void 0:g.title)??h,...ka.label?[ka.label]:[]]})},onMore:i=>{var h;return(h=Us.current)==null?void 0:h.call(Us,ka.path,i)}}),Et&&s.jsx(c1,{store:m,target:()=>Je(Et),bounds:Bn,gap:Et.kind==="element"?Su:8,about:Et.about,onSend:i=>Qu(Et,i),onClose:()=>Oa(null),onHistory:Et.kind==="canvas"?()=>{Oa(null),hs()}:void 0,initial:(Hi=Et.target)==null?void 0:Hi.text,sendLabel:kt.host?d.requests.addForAi:void 0},`${Et.kind}:${Et.file??""}:${Et.path??""}`),P&&!ye&&!Et&&s.jsx(r1,{store:m,target:()=>Je(P.at),bounds:Bn,gap:P.at.kind==="element"&&P.at.file===k&&((Bc=je.state.selection)==null?void 0:Bc.path)===P.at.path?Su:8,onOpen:()=>hs()},P.id),ye&&!Et&&s.jsx(u1,{store:m,target:()=>Je(ye.at),bounds:Bn,gap:ye.at.kind==="element"&&ye.at.file===k&&((Sl=je.state.selection)==null?void 0:Sl.path)===ye.at.path?Su:8,status:ye.status,reply:ye.reply,onUndo:ye.files.length||ye.at.file?()=>{var i;return((i=nn.current)==null?void 0:i.undo(ye.id))??Promise.resolve()}:void 0,onOpen:()=>{Me(null),hs()},onClose:()=>Me(null)},ye.id),Ac.map(i=>{var A;if(Et&&Et.file===i.file&&(Et.kind==="element"?Et.path===i.path:!i.path))return null;const h=!!i.path&&_t&&k===i.file&&(ka==null?void 0:ka.path)===i.path,g=!!i.path&&k===i.file&&((A=je.state.selection)==null?void 0:A.path)===i.path,w=i.items.some(R=>Lt.has(R.id)),T=!!i.path&&i.items.some(R=>R.request.state==="taken");return!w&&!T?null:s.jsx(U1,{store:m,target:()=>Fl(i.file,i.path),bounds:Bn,gap:i.path?{...h||g?Su:{above:8,below:8},first:"below"}:{above:8,below:8,side:"right"},placer:(R,ee,Ne)=>{const Ae=r.boards[i.file],ze=m.get(),et=Se=>({x:ze.x+Se.x*ze.zoom,y:ze.y+Se.y*ze.zoom,w:Se.w*ze.zoom,h:Se.h*ze.zoom}),fn=gt.filter(Se=>Se!==i.file&&r.boards[Se]).map(Se=>et(r.boards[Se])).map(Se=>({...Se,y:Se.y-56,h:Se.h+56}));return i1(R,et(Ae),ee,Ne,h,fn)},items:i.items,open:w,onOpen:R=>Ve(ee=>{const Ne=new Set(ee);for(const Ae of i.items)R?Ne.add(Ae.id):Ne.delete(Ae.id);return Ne}),a:_l,onDismiss:Ra,onComment:R=>{Ve(new Set),window.setTimeout(()=>Ro(R),0)}},i.key)}),Hr&&s.jsxs("nav",{className:"oc-card oc-nav oc-nav-c",style:{left:vn,bottom:Va,width:Ns},"aria-label":d.app.navigation,children:[s.jsx(dw,{store:m,className:"oc-map",w:Ns,h:zi,inset:6,reserve:32,rects:$r,selected:x,size:jn,onJump:zf}),s.jsx(Pw,{store:m,onZoom:Ll,onPct:i=>{const h=i.currentTarget.getBoundingClientRect();ld({clientX:h.left,clientY:h.top-8},!0)},onFit:Hl,over:!0})]}),s.jsxs("aside",{className:`oc-card oc-right ${Tt?"is-rest":""} ${Rn?"oc-sheet":""} ${Ho?"is-col":""} ${Ho&&Uo?"is-short":""}`,"aria-label":d.app.inspectorAside,style:Rn?{top:eo,height:ut.h-eo-8}:Ho?{width:li,bottom:0,paddingBottom:Uo}:void 0,children:[s.jsxs("div",{className:"oc-rhead",ref:gr,children:[s.jsxs("span",{className:"oc-cmts-pair",children:[s.jsxs("button",{className:`oc-abtn oc-cmts ${Ao?"on":""}`,"aria-label":d.toolbar.commentsTitle(qo),"aria-pressed":Ao,title:d.comments.modeTitle,onClick:jl,children:[s.jsx(F,{name:"comment"}),qo>0&&s.jsx("span",{className:"oc-acount",children:qo})]}),s.jsx("button",{className:`oc-abtn oc-cmts-all ${Nn&&!Tt?"on":""}`,"aria-label":d.comments.allTitle,"aria-pressed":Nn&&!Tt,title:d.comments.allTitle,onClick:Dr,children:s.jsx(F,{name:"chevronDown",size:14})})]}),s.jsxs("button",{className:`ask-ai ${An==="chat"&&!Tt||(Et==null?void 0:Et.kind)==="canvas"?"on":""}`,"aria-label":d.toolbar.aiChat,"aria-pressed":An==="chat"&&!Tt||(Et==null?void 0:Et.kind)==="canvas",title:d.toolbar.aiChatTitle(ft),onClick:()=>(Et==null?void 0:Et.kind)==="canvas"?Oa(null):An==="chat"&&!Tt?Ge?xl():Al("inspect"):wa(null,()=>xo(null)),children:[s.jsx("span",{className:"ask-ai-label",children:d.toolbar.askAi}),s.jsx("span",{className:"ask-ai-short","aria-hidden":"true",children:"AI"}),kt.host&&s.jsx(O1,{n:Fy(Ht)})]}),s.jsx(Tw,{pages:We,currentPage:un,selected:x}),!fe&&s.jsx("button",{className:`icon-btn oc-ib oc-play ${(Li=$t==null?void 0:$t.className)!=null&&Li.startsWith("play-menu")?"on":""}`,"aria-label":d.toolbar.playMenu,"aria-haspopup":"menu","aria-expanded":!!((Hc=$t==null?void 0:$t.className)!=null&&Hc.startsWith("play-menu")),title:d.toolbar.playMenu,disabled:!gt.length,onClick:i=>{const h=i.currentTarget.closest(".oc-rhead").getBoundingClientRect();Wu({clientX:h.right,clientY:h.bottom+8})},children:s.jsx(F,{name:"play"})}),fe?s.jsxs(s.Fragment,{children:[Ba>=5?s.jsx("button",{className:`icon-btn oc-ib oc-proto-more ${($t==null?void 0:$t.className)==="proto-more"?"on":""}`,"aria-label":d.toolbar.protoMore,"aria-haspopup":"menu",title:d.toolbar.protoMore,onClick:i=>{const h=i.currentTarget.getBoundingClientRect();Ct({x:h.left,y:h.bottom+8,className:"proto-more",items:[{label:d.toolbar.restart,run:()=>ge(g=>g+1)},{label:d.canvas.exportBoard,run:()=>void ps(fe)},{label:d.toolbar.copyLink,run:()=>void Xs(So("play",fe))}]})},children:s.jsx(F,{name:"more"})}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"icon-btn oc-ib oc-restart","aria-label":d.toolbar.restart,title:d.toolbar.restart,onClick:()=>ge(i=>i+1),children:s.jsx(F,{name:"restore"})}),s.jsx("button",{className:"icon-btn oc-ib oc-export","aria-label":d.canvas.exportBoard,title:d.canvas.exportBoard,onClick:()=>void ps(fe),children:s.jsx(F,{name:"download"})}),s.jsx("button",{className:"icon-btn oc-ib oc-copylink","aria-label":d.toolbar.copyLink,title:d.toolbar.copyLink,onClick:()=>void Xs(So("play",fe)),children:s.jsx(F,{name:"link"})})]}),s.jsx("button",{className:"icon-btn oc-ib oc-prev","aria-label":d.toolbar.prevBoard,title:d.toolbar.prevBoard,disabled:Ni.flatMap(i=>i.files)[0]===fe,onClick:()=>yc(-1),children:s.jsx(F,{name:"chevronLeft"})}),s.jsx("button",{className:"icon-btn oc-ib oc-next","aria-label":d.toolbar.nextBoard,title:d.toolbar.nextBoard,disabled:Ni.flatMap(i=>i.files).slice(-1)[0]===fe,onClick:()=>yc(1),children:s.jsx(F,{name:"chevronRight"})}),s.jsx("div",{className:"oc-seg oc-full-mode",role:"radiogroup","aria-label":d.full.mode,children:["fill","fit"].map(i=>s.jsx("button",{role:"radio","aria-checked":D===i,className:D===i?"on":"",title:i==="fill"?d.full.fillTitle:d.full.fitTitle,onClick:()=>Y(i),children:i==="fill"?d.full.fill:d.full.fit},i))})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`icon-btn oc-ib oc-ptoggle ${Tt?"":"on"}`,"aria-label":d.toolbar.panelToggle,"aria-pressed":!Tt,title:d.toolbar.panelToggleTitle(ft),onClick:Mc,children:s.jsx(F,{name:"panelRight"})}),s.jsx(Zw,{store:m,expanded:!!((Lc=$t==null?void 0:$t.className)!=null&&Lc.startsWith("zoom")),onOpen:i=>{const h=i.currentTarget.getBoundingClientRect();ld({clientX:h.right,clientY:h.bottom+8})}})]})]}),!Tt&&s.jsx("div",{className:"oc-col-head",children:An==="chat"?s.jsx("h2",{className:"oc-col-title",children:d.tabs.ai}):Nn?s.jsx("h2",{className:"oc-col-title",children:d.comments.title}):s.jsx("div",{className:"oc-tabs oc-col-tabs",role:"tablist","aria-label":d.tabs.right,ref:_u,children:(Rn?["props","layers","code","tweaks"]:["props","code","tweaks"]).map(i=>s.jsx("button",{role:"tab","aria-selected":bs===i,className:bs===i?"on":"",onClick:()=>Mo(i),children:i==="props"?d.tabs.properties:i==="code"?d.tabs.code:i==="tweaks"?d.tabs.tweaks:d.tabs.layers},i))})}),An==="chat"&&!Tt&&kt.host&&!ci&&s.jsx(D1,{req:kt,comments:Ht,actions:_l,compact:Ge,onOpen:i=>{vs.current=!0,window.setTimeout(()=>vs.current=!1,0),j([i.file]),ml([i.file])}}),s.jsxs("div",{className:"chat-wrap",hidden:Tt||An!=="chat"||kt.host&&!ci,children:[kt.host&&ci&&s.jsxs("button",{className:"req-back",onClick:()=>Ru(!1),children:[s.jsx(F,{name:"parent",size:14})," ",d.requests.backToRequests]}),s.jsx(s1,{selection:k&&((qr=je.state.selection)==null?void 0:qr.file)===k?je.state.selection:null,boards:k?[k]:x,visibleCount:td,titleOf:i=>{var h;return((h=r.boards[i])==null?void 0:h.title)??i},sizeOf:i=>r.boards[i]?{w:r.boards[i].w,h:r.boards[i].h}:null,storeKey:(n==null?void 0:n.dir)??null,confirm:In.confirm,attach:Qi,setAttach:ss,draft:co,setDraft:ri,subscribe:Xn,onLocate:ml,inputRef:dr,open:An==="chat"&&!Tt,handle:nn,onRunEnd:Pu,settingsElsewhere:!0})]}),An==="inspect"&&!Tt&&!Nn&&bs==="code"&&(()=>{var g;const i=k?(g=lt.current.get(k))==null?void 0:g.contentDocument:null,h=da&&k&&i?hn(i,da.path):null;return h&&da&&k?s.jsx(zw,{el:h,tag:da.tag,label:da.label,path:da.path,onSave:async w=>{const T=await Ha(k,da.path).catch(()=>null);return!!T&&!!await yn({op:"setStyleText",path:da.path,hash:T,text:w},k)}},`${k}:${da.path}`):s.jsx("div",{className:"pp inspector oc-code",children:s.jsx("p",{className:"oc-empty oc-col-empty",children:d.tabs.codeEmpty})})})(),An==="inspect"&&!Tt&&!Nn&&bs==="tweaks"&&(()=>{var g;const i=k??it,h=i?(g=lt.current.get(i))==null?void 0:g.contentDocument:null;return s.jsx("div",{className:"pp inspector oc-tweaks",children:i&&Eu(h)?s.jsx("div",{className:"pp-scroll",children:s.jsx(v1,{doc:h,onSave:async w=>{try{await Te.post("/api/edit",{file:i,op:"setTweaks",values:w}),ve({tone:"ok",text:d.toast.tweaksSaved,action:$n})}catch(T){ve({tone:"error",text:String(T.message)})}}},`${i}-${va[i]??0}-${fo}`)}):s.jsx("p",{className:"oc-empty oc-col-empty",children:d.tabs.tweaksEmpty})})})(),An==="inspect"&&!Tt&&!Nn&&bs==="layers"&&Rn&&s.jsx("div",{className:"pp inspector oc-layers-tab",children:s.jsx("div",{className:"pp-scroll",children:k??it?s.jsx(Dm,{file:k??it,version:va[k??it]??0,selected:k?je.state.paths:[],onSelect:(i,h)=>{const g=k??it,w=k?je.state.paths:[];Sn(g,h?w.includes(i)?w.filter(T=>T!==i):[...w,i]:[i])},onMove:()=>{}}):s.jsx(eb,{boards:gt.map(i=>({file:i,title:r.boards[i].title??i})),versions:va,onPickBoard:i=>Ia([i]),onPickElement:(i,h)=>Sn(i,[h])})})}),An==="inspect"&&!Tt&&(Nn||bs==="props"||bs==="layers"&&!Rn)&&s.jsxs(Iy,{section:Nn?"comments":"props",author:Ol||d.app.defaultAuthor,onAuthor:async()=>{const i=await In.prompt({title:d.dialog.authorTitle,label:d.dialog.name,value:Ol,ok:d.dialog.save});if(i!=null&&i.value.trim()){Du(i.value.trim());try{localStorage.setItem("design-canvas:author",i.value.trim())}catch{}}},onAskAI:i=>wa(()=>Ju(i),()=>xi(i)),host:kt.host,onAddForAi:async(i,h)=>{var g;await Te.post("/api/requests",{action:"create",file:k??it,path:h,text:i,author:hl,attach:{kind:h?"element":"board",...h&&((g=vo())==null?void 0:g.path)===h?{label:vo().label}:{}}}),ve({tone:"ok",text:d.requests.added})},reqActions:_l,file:k??it,selection:je.state.selection,crumbs:(()=>{var A,R;const i=je.state.selection,h=k?(A=lt.current.get(k))==null?void 0:A.contentDocument:null;if(!k||!i||i.file!==k||!h)return null;const g=ee=>{if(!ee)return"";const{kind:Ne,label:Ae}=xu(ee);if(Ne!=="container")return Ae?`${d.inspector.kindName(Ne)} "${Ae.slice(0,24)}"`:d.inspector.kindName(Ne);const ze=ee.classList[0];return`${d.inspector.kindName(Ne)}${ee.id?` #${ee.id}`:ze?` .${ze}`:""}`},{paths:w,skipped:T}=t0(i.path);return s.jsx(j1,{board:((R=r.boards[k])==null?void 0:R.title)??k,parents:w.map(ee=>({path:ee,name:g(hn(h,ee))})),skipped:T,current:g(hn(h,i.path)),title:d.inspector.crumbElement(i.tag,i.path),onBoard:()=>_(null),onPath:ee=>void je.select([ee])})})(),commentRef:he,multi:je.state.paths.length,error:je.state.error,comments:Ht,listAll:Nn&&!(k??it)?"comments":null,titleOf:i=>{var h;return((h=r.boards[i])==null?void 0:h.title)??i},pageFiles:gt,onCommentMenu:Rr,focusComment:Gn,nameOf:(i,h)=>{var R;const g=(R=lt.current.get(i))==null?void 0:R.contentDocument,w=g?hn(g,h):null;if(!w)return null;const{kind:T,label:A}=xu(w);return A?`${d.inspector.kindName(T)} “${A.slice(0,24)}”`:d.inspector.kindName(T)},compact:Ge,threadOnly:Zl,onOpenThread:i=>Nn&&!(k??it)?Ro(i):B(i.id),onAllComments:()=>B(null),onSelectPath:i=>{const h=k??it;h&&Sn(h,[i])},onDuplicate:da?()=>void yn({op:"duplicate",path:da.path,hash:da.hash}):void 0,onDelete:da?async()=>{await yn({op:"delete",path:da.path,hash:da.hash})&&je.select([])}:void 0,footer:!k&&it&&r.boards[it]?s.jsx(rw,{onFocus:()=>ys(it),onDuplicate:()=>void rc(it),onFront:()=>La([it],"front"),onBack:()=>La([it],"back"),onDelete:()=>void bi([it])}):void 0,children:[Or&&s.jsx(eb,{boards:gt.map(i=>({file:i,title:r.boards[i].title??i})),versions:va,onPickBoard:i=>Ia([i]),onPickElement:(i,h)=>Sn(i,[h])}),k&&dn(),!k&&is&&ja[is]&&s.jsx(f0,{shape:ja[is],onPatch:i=>Sr(is,i,d.history.shapeStyle),onDelete:()=>fc([is]),onFront:()=>hc(is,"front"),onBack:()=>hc(is,"back")}),!k&&L&&r.notes[L]&&s.jsx(h0,{note:r.notes[L],onPatch:i=>gn(h=>{const g={...h.notes[L],...i};for(const w of Object.keys(g))g[w]===void 0&&delete g[w];return{...h,notes:{...h.notes,[L]:g}}},d.history.noteStyle),onDelete:()=>jo([L])}),!k&&it&&r.boards[it]&&s.jsx(iw,{file:it,item:r.boards[it],pages:We,isLaunch:((Vr=r.launch)==null?void 0:Vr.view)==="focused"&&r.launch.file===it,onPatch:i=>wr(it,i),onRename:()=>void vi(it),onRenameFile:()=>void Fu(it),onLaunch:i=>gn(h=>({...h,launch:i?{view:"focused",file:it}:{view:"canvas"}}),d.history.launchScreen)}),!k&&$c,!k&&it&&r.boards[it]&&s.jsx(Nu,{id:"guides",title:d.sections.guides,count:(((Gr=r.guides)==null?void 0:Gr[it])??[]).length,children:s.jsx(y0,{guides:((Yr=r.guides)==null?void 0:Yr[it])??[],onChange:(i,h)=>gn(g=>({...g,guides:{...g.guides??{},[it]:i}}),h)})}),!k&&na.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.shapes.selectedN(na.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.shapes.deleteAll,title:d.shapes.deleteAll,onClick:()=>fc(na),children:s.jsx(F,{name:"trash"})})})]}),!k&&M.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.notes.selectedN(M.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":d.notes.deleteAll,title:d.notes.deleteAll,onClick:()=>jo(M),children:s.jsx(F,{name:"trash"})})})]}),!k&&x.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:d.boardOptions.selectedN(x.length)}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.front,title:d.boardOptions.frontTitleMod(ft),onClick:()=>La(x,"front"),children:s.jsx(F,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.back,title:d.boardOptions.backTitleMod(ft),onClick:()=>La(x,"back"),children:s.jsx(F,{name:"back"})}),s.jsx("button",{className:"icon-btn","aria-label":d.boardOptions.goToSelected,title:d.boardOptions.goToSelectedTitle,onClick:()=>fs(x),children:s.jsx(F,{name:"fit"})}),s.jsx("button",{className:"icon-btn danger","aria-label":d.boardOptions.delete,title:d.boardOptions.deleteTitleKey,onClick:()=>void bi(x),children:s.jsx(F,{name:"trash"})})]})]}),k&&je.state.selection&&je.state.selection.file===k&&(()=>{var T;const i=je.state.selection,h=(T=lt.current.get(k))!=null&&T.contentDocument?hn(lt.current.get(k).contentDocument,i.path):null,g={};if(h)for(const A of Array.from(h.attributes))g[A.name]=A.value;const w=je.state.paths;return s.jsx(vw,{tokens:Rt,bg:(()=>{let A=h;const R=h==null?void 0:h.ownerDocument.defaultView;for(;A&&R;A=A.parentElement){const ee=R.getComputedStyle(A).backgroundColor;if(ee&&!/rgba\(0, 0, 0, 0\)|transparent/.test(ee))return ee}return"rgb(255, 255, 255)"})(),onAlign:async A=>{var Ne;const R=(Ne=lt.current.get(k))==null?void 0:Ne.contentDocument,ee=R&&C1(R,i.path,i.hash,A);if(!ee)return ve({text:d.toast.blockFlow});await yn({op:"batch",ops:ee})},onExport:async()=>{try{const A=await Te.blob("/api/screenshot",{file:k,path:i.path,inline:!0}),R=URL.createObjectURL(A),ee=document.createElement("a");ee.href=R,ee.download=`${ab(k).replace(/\.png$/,"")}-${i.tag}.png`,document.body.append(ee),ee.click(),ee.remove(),setTimeout(()=>URL.revokeObjectURL(R),1e4)}catch(A){const R=A;vm(R.status,R.message)==="browser"?ve({tone:"error",text:d.toast.pngNeedsBrowser,code:"npx playwright install chromium",ms:1e4}):ve({tone:"error",text:d.toast.pngFailed(xm(R.message))})}},onReplaceImage:i.tag==="img"||/url\(/.test(i.styles["background-image"]??"")?()=>Zu(i.path,i.tag==="img"):null,selection:i,inline:h?Sy(h):{},attrs:g,canWrap:w.length>=2,vars:ws,onStyle:qs,onAttr:(A,R)=>void yn({op:"setAttr",path:i.path,hash:i.hash,name:A,value:R}),onWrap:async A=>{const R=[...w].sort((Ne,Ae)=>Number(Ne.split("/").pop())-Number(Ae.split("/").pop())),ee=await Promise.all(R.map(Ne=>Ha(k,Ne)));await yn({op:"wrap",paths:R,hashes:ee,display:A})&&je.select([R[0]])},children:$c})})(),!k&&dn()]})]}),!Rn&&s.jsx(Qw,{tool:N,setTool:E,phone:Kt,foldShapes:!0,win:ut,room:ut.w,hist:cl,histOpen:go,caretRef:nc,onNewBoard:i=>Of(qn(i)),onToolsMenu:i=>kc(qn(i)),onShapesMenu:i=>ad(qn(i)),onInsertImage:()=>os(()=>i=>{os(null),mc(i)}),onUndo:()=>void gl("undo"),onRedo:()=>void gl("redo"),onHistory:()=>go?Cc():Ei()}),ce&&s.jsx(hw,{board:r,file:ce,onClose:()=>pe(null),onLocate:i=>{j([i]),fs([i])}}),Fe&&r.boards[Fe]&&s.jsx(ub,{board:r,file:Fe,mode:D,onMode:Y,onClose:gs,onExport:()=>void ps(Fe)}),fe&&r.boards[fe]&&s.jsx(ub,{bare:!0,className:"is-proto",board:r,file:fe,mode:D,onMode:Y,onClose:ql,reloadKey:ue,style:Ho?{right:li}:void 0,onKey:i=>i==="Escape"?ql():yc(i==="ArrowLeft"?-1:1)}),s.jsx(B0,{open:!!di,version:Ds,onClose:()=>os(null),onPick:i=>di==null?void 0:di(i),onError:i=>ve({tone:"error",text:i})}),en&&s.jsx("button",{className:"icon-btn calm-handle","aria-label":d.toolbar.showTools,title:d.toolbar.showToolsTitle(ft),onClick:$o,children:s.jsx(F,{name:"eye",size:16})}),s.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:$e}),s.jsx(K0,{menu:$t,onClose:()=>Ct(null)}),At&&!ce&&(()=>{const i=vl(At.file,At.key);return i?s.jsx(Px,{file:At.file,tag:i,me:hl,now:nt.now,conflict:At.conflict,busy:At.busy,onCompare:()=>Bu({file:At.file,step:i.steps[i.steps.length-1],added:i.newBoard}),onUndo:h=>void cd(At.file,i,h),onCancelConflict:()=>Ja(h=>h&&{...h,conflict:null}),onClose:()=>Ja(null)}):null})(),pl&&!ce&&(()=>{const i=of(r,pl.file);return i?s.jsx(ew,{file:pl.file,group:i,board:r,busy:pl.busy,onApply:()=>void Ci(pl.file),onKeepAll:()=>void Bf(pl.file),onClose:()=>us(null)}):null})(),Ca&&r.boards[Ca.file]&&s.jsx(Sb,{before:L0(Ca.step),notBefore:d.compare.notBeforeChange,boards:[{file:Ca.file,kind:Ca.added?"added":"changed",title:r.boards[Ca.file].title??Ca.file,w:r.boards[Ca.file].w,h:r.boards[Ca.file].h}],onClose:()=>Bu(null)}),go&&s.jsx(Ix,{steps:((Xr=nt.data)==null?void 0:Xr.steps)??[],me:hl,now:nt.now,anchor:((Kr=nc.current)==null?void 0:Kr.getBoundingClientRect())??null,busy:Cf,onGo:i=>void Ps(i),onClose:Cc}),pt&&r.boards[pt.file]&&s.jsx(Cw,{at:{x:pt.x,y:pt.y},crumbs:pt.crumbs,host:kt.host,onCancel:()=>Pe(null),onSubmit:async(i,h)=>{kt.host&&h?await Te.post("/api/requests",{action:"create",file:pt.file,path:pt.path,text:i,author:hl,attach:{kind:pt.path?"element":"board"}}):await Te.post("/api/comments",{file:pt.file,path:pt.path,text:i,author:Ol||d.app.defaultAuthor}),Pe(null)}}),Kn&&Tt&&Ht.some(i=>i.id===Kn.id)&&s.jsx(Ew,{at:{x:Kn.x,y:Kn.y},onClose:wl,children:s.jsx(Iy,{author:Ol||d.app.defaultAuthor,onAuthor:()=>{},file:Ht.find(i=>i.id===Kn.id).file,selection:null,multi:0,error:null,comments:Ht,focusComment:Kn.id,threadOnly:!0,section:"comments",host:kt.host,reqActions:_l,onAskAI:i=>wa(()=>Ju(i),()=>xi(i)),onCommentMenu:Rr,nameOf:(i,h)=>{var R;const g=(R=lt.current.get(i))==null?void 0:R.contentDocument,w=g?hn(g,h):null;if(!w)return null;const{kind:T,label:A}=xu(w);return A?`${d.inspector.kindName(T)} “${A.slice(0,24)}”`:d.inspector.kindName(T)},onSelectPath:i=>{const h=Ht.find(g=>g.id===Kn.id);wl(),Sn(h.file,[i])}})}),s.jsx(F0,{state:In.state,onClose:In.close})]})})}function Xw(n,o,r){const f=n.split("/").map(Number),m=o===""?[]:o.split("/").map(Number),p=f.length-1;return m.length>p&&m.slice(0,p).every((v,S)=>v===f[S])&&m[p]>f[p]&&m[p]--,[...m,r].join("/")}function uf({r:n,cls:o,px:r=1}){return s.jsx("div",{className:`box ${o}`,style:{left:n.x,top:n.y,width:n.w,height:n.h,"--px":`${r}px`}})}function mb(){const n=document.querySelector(".canvas");n&&(n.tabIndex=-1,n.focus({preventScroll:!0}))}function Kw(n){return s.jsxs("div",{className:`oc-zoom ${n.over?"is-over":""}`,children:[s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.toolbar.zoomOut,title:d.toolbar.zoomOutTitle(ft),onClick:()=>n.onZoom(1/2),children:s.jsx(F,{name:"minus"})}),s.jsxs("button",{className:"zoom","aria-haspopup":"menu","aria-label":d.toolbar.zoomMenu(Math.round(n.zoom*100)),onClick:n.onPct,children:[Math.round(n.zoom*100),"%"]}),s.jsx("button",{className:"icon-btn oc-ib","aria-label":d.toolbar.zoomIn,title:d.toolbar.zoomInTitle(ft),onClick:()=>n.onZoom(2),children:s.jsx(F,{name:"plus"})}),s.jsx("button",{className:"icon-btn oc-ib oc-fit","aria-label":d.toolbar.fitAll,title:d.toolbar.fitAllTitle,onClick:n.onFit,children:s.jsx(F,{name:"fit"})})]})}function Zw({store:n,expanded:o,onOpen:r}){const f=Math.round(yf(n,m=>m.zoom)*100);return s.jsxs("button",{className:`oc-zoom-btn ${o?"on":""}`,"aria-haspopup":"menu","aria-expanded":o,"aria-label":d.toolbar.zoomMenu(f),onClick:r,children:[s.jsxs("span",{className:"zoom-pct",children:[f,"%"]}),s.jsx(F,{name:"chevronDown",size:16})]})}function Fw({win:n,first:o,onSize:r}){const f=b.useRef(null),[m,p]=b.useState(!1),[v,S]=b.useState(0);b.useLayoutEffect(()=>p(!1),[n.w,o]),b.useLayoutEffect(()=>{f.current&&(r==null||r(f.current.offsetHeight,f.current.offsetWidth))}),b.useEffect(()=>()=>r==null?void 0:r(0,0),[]),b.useLayoutEffect(()=>{var I;const $=f.current;if(!o||!$)return;const L=((I=document.querySelector(".oc-dock"))==null?void 0:I.offsetWidth)??0;L!==v&&S(L),!m&&$.scrollWidth>n.w-16&&p(!0)});const N=Eb(f,n.w),E={left:N??void 0,visibility:N==null?"hidden":void 0};if(!o)return s.jsx("div",{ref:f,className:"canvas-hint","aria-hidden":"true",style:E,children:d.canvas.hint});const x=`${ft}J`,[j,M]=d.app.firstRunAi(ft).split(x);return s.jsxs("div",{ref:f,className:`canvas-hint oc-first ${m?"is-stacked":""}`,role:"status",style:{...E,minWidth:m?void 0:v||void 0},children:[s.jsxs("span",{className:"oc-fr",children:[s.jsx(F,{name:"select"}),s.jsx("span",{children:d.app.firstRunEdit})]}),s.jsx("span",{className:"oc-fr-sep","aria-hidden":"true"}),s.jsxs("span",{className:"oc-fr",children:[s.jsx(F,{name:"ai"}),s.jsxs("span",{children:[j,s.jsx("kbd",{children:x}),M]})]})]})}function Qw(n){const o=b.useRef(null),r=Eb(o,n.win.w,n.room),f=(v,S)=>s.jsx("button",{role:"radio","aria-checked":n.tool===v.id,"aria-label":d.toolbar.tool(v.label,v.key),title:S,className:`icon-btn tool ${n.tool===v.id?"on":""}`,onClick:()=>n.setTool(v.id),children:s.jsx(F,{name:v.icon})},v.id),m=oi.slice(0,5).find(v=>v.id===n.tool),p=oi.slice(5).find(v=>v.id===n.tool);return s.jsxs("div",{ref:o,className:"oc-dock",role:"toolbar","aria-label":d.toolbar.aria,style:{left:r??void 0,visibility:r==null?"hidden":void 0},children:[s.jsxs("button",{className:"new-board","aria-haspopup":"menu","aria-label":n.phone?d.toolbar.newBoard:void 0,title:d.toolbar.newBoardTitle,onClick:n.onNewBoard,children:[s.jsx(F,{name:"plus"}),!n.phone&&s.jsx("span",{children:d.toolbar.newBoard}),s.jsx(F,{name:"chevronDown",size:16,className:"s"})]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),n.phone?s.jsxs("button",{className:`icon-btn tool oc-fold ${m?"on":""}`,"aria-label":d.toolbar.canvasTools,"aria-haspopup":"menu",title:d.toolbar.canvasTools,onClick:n.onToolsMenu,children:[s.jsx(F,{name:(m==null?void 0:m.icon)??"select"}),s.jsx(F,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":d.toolbar.canvasTools,children:[oi.slice(0,2).map(v=>f(v,d.toolbar.tool(v.hint,v.key))),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),oi.slice(2,5).map(v=>f(v,d.toolbar.tool(v.hint,v.key)))]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),n.foldShapes?s.jsxs("button",{className:`icon-btn tool oc-fold ${p?"on":""}`,"aria-label":d.toolbar.shapes,"aria-haspopup":"menu",title:d.toolbar.shapes,onClick:n.onShapesMenu,children:[s.jsx(F,{name:(p==null?void 0:p.icon)??"rect"}),s.jsx(F,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":d.toolbar.shapes,children:[oi.slice(5).map(v=>f(v,d.toolbar.shapeToolTitle(v.hint,v.key))),s.jsx("button",{className:"icon-btn","aria-label":d.toolbar.insertImage,title:d.toolbar.insertImageTitle,onClick:n.onInsertImage,children:s.jsx(F,{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":d.toolbar.undo,title:d.toolbar.undoTitle(n.hist.undo.length?d.activity.stepName(n.hist.undo[n.hist.undo.length-1]):void 0,ft),disabled:!n.hist.canUndo,onClick:n.onUndo,children:s.jsx(F,{name:"undo"})}),s.jsx("button",{ref:n.caretRef,className:`icon-btn caret-btn ${n.histOpen?"on":""}`,"aria-label":d.activity.historyButton,"aria-haspopup":"menu","aria-expanded":n.histOpen,title:d.activity.historyButton,onClick:n.onHistory,children:s.jsx(F,{name:"chevronDown",size:16})}),s.jsx("button",{className:"icon-btn","aria-label":d.toolbar.redo,title:d.toolbar.redoTitle(n.hist.redo.length?d.activity.stepName(n.hist.redo[n.hist.redo.length-1]):void 0,ft),disabled:!n.hist.canRedo,onClick:n.onRedo,children:s.jsx(F,{name:"redo"})})]})]})}function Pw({store:n,...o}){return s.jsx(Kw,{...o,zoom:yf(n,r=>r.zoom)})}function Jw({store:n,...o}){return s.jsx(d0,{...o,view:Um(n)})}function Iw(){const n=b.useRef(new Map);return b.useCallback((o,r,f)=>{const m=n.current.get(o);if(m&&m.sig===r)return m.node;const p=f();return n.current.set(o,{sig:r,node:p}),p},[])}function Ww(n,o){if(!n)return o;if(JSON.stringify(n)===JSON.stringify(o))return n;const r=(f,m)=>{if(!f||!m)return m;const p={};for(const[v,S]of Object.entries(m))p[v]=f[v]!==void 0&&JSON.stringify(f[v])===JSON.stringify(S)?f[v]:S;return p};return{...o,boards:r(n.boards,o.boards),notes:r(n.notes,o.notes),shapes:r(n.shapes,o.shapes)}}class ej extends b.Component{constructor(){super(...arguments);hy(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.jsxs("div",{className:"loading",role:"alert",children:[s.jsx(F,{name:"warn"})," ",d.app.crashed," ",this.state.error.message,s.jsx("button",{onClick:()=>location.reload(),children:d.app.reload})]}):this.props.children}}document.documentElement.lang=gf;Ax.createRoot(document.getElementById("root")).render(s.jsx(ej,{children:s.jsx(X0,{children:s.jsx(Yw,{})})}));