@clipen/clipen-cli 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +53 -43
  2. package/README.zh-TW.md +99 -0
  3. package/apps/web/dist/assets/index-BHFCflzf.js +15 -0
  4. package/apps/web/dist/assets/index-BtenOBwP.css +1 -0
  5. package/apps/web/dist/favicon.svg +1 -1
  6. package/apps/web/dist/index.html +2 -2
  7. package/bin/clipen.js +4 -2
  8. package/package.json +2 -2
  9. package/pyproject.toml +1 -1
  10. package/src/clipen/__init__.py +1 -1
  11. package/src/clipen/annotations/suggestions.py +1 -1
  12. package/src/clipen/bootstrap.py +70 -15
  13. package/src/clipen/cli.py +4 -1
  14. package/src/clipen/controller/app.py +102 -1
  15. package/src/clipen/controller/server.py +14 -6
  16. package/src/clipen/editing/agent_repository.py +29 -3
  17. package/src/clipen/editing/agent_tools.py +1 -0
  18. package/src/clipen/editing/aspect.py +27 -0
  19. package/src/clipen/editing/production_catalog.py +10 -3
  20. package/src/clipen/editing/production_media.py +1 -1
  21. package/src/clipen/editing/production_preview.py +7 -0
  22. package/src/clipen/editing/production_tools.py +7 -2
  23. package/src/clipen/editing/skill_tools.py +8 -0
  24. package/src/clipen/editing/slip.py +109 -0
  25. package/src/clipen/editing/tool_receipts.py +1 -0
  26. package/src/clipen/editing/versions.py +2 -0
  27. package/src/clipen/editing/visual_preview.py +11 -3
  28. package/src/clipen/editing/workbench.py +33 -1
  29. package/src/clipen/locale_en.py +18 -0
  30. package/src/clipen/mcp_editing/server.py +3 -1
  31. package/src/clipen/media/discovery.py +2 -2
  32. package/src/clipen/media/preview.py +5 -0
  33. package/src/clipen/media/storage.py +5 -2
  34. package/src/clipen/projects/models.py +2 -0
  35. package/src/clipen/projects/storage.py +84 -4
  36. package/src/clipen/providers/account.py +37 -6
  37. package/src/clipen/providers/claude.py +5 -3
  38. package/src/clipen/providers/claude_editing.py +5 -6
  39. package/src/clipen/providers/codex.py +19 -7
  40. package/src/clipen/providers/codex_editing.py +2 -1
  41. package/src/clipen/providers/editing_agent.py +24 -2
  42. package/src/clipen/providers/model_selection.py +67 -0
  43. package/src/clipen/rendering/cover.py +1 -1
  44. package/src/clipen/rendering/program_subtitles.py +3 -1
  45. package/src/clipen/rendering/renderer.py +13 -3
  46. package/src/clipen/skills/builtin/references/graphics.md +1 -1
  47. package/src/clipen/skills/builtin/templates.json +9 -0
  48. package/src/clipen/workspace.py +21 -0
  49. package/apps/web/dist/assets/index-DPgSvXZ1.js +0 -15
  50. package/apps/web/dist/assets/index-DmPWV61v.css +0 -1
  51. package/src/clipen/editing/EDITORIAL_REGRESSIONS.md +0 -38
  52. package/src/clipen/editing/REFACTOR_DESIGN.md +0 -241
  53. package/src/clipen/editing/REFACTOR_HANDOFF.md +0 -73
@@ -0,0 +1,15 @@
1
+ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(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 d(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 f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},R=[],te=-1;function z(e){return{current:e}}function B(e){0>te||(e.current=R[te],R[te]=null,te--)}function V(e,t){te++,R[te]=e.current,e.current=t}var ne=z(null),re=z(null),ie=z(null),H=z(null);function ae(e,t){switch(V(ie,t),V(re,e),V(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(ne),V(ne,e)}function oe(){B(ne),B(re),B(ie)}function se(e){e.memoizedState!==null&&V(H,e);var t=ne.current,n=Hd(t,e.type);t!==n&&(V(re,e),V(ne,n))}function ce(e){re.current===e&&(B(ne),B(re)),H.current===e&&(B(H),Qf._currentValue=ee)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+le+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?de(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return e.child!==t&&t!==null?de(`Suspense Fallback`):de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return de(`Activity`);default:return``}}function U(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,W=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,G=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,K=t.unstable_NormalPriority,Se=t.unstable_LowPriority,Ce=t.unstable_IdlePriority,we=t.log,Te=t.unstable_setDisableYieldValue,q=null,J=null;function Ee(e){if(typeof we==`function`&&Te(e),J&&typeof J.setStrictMode==`function`)try{J.setStrictMode(q,e)}catch{}}var De=Math.clz32?Math.clz32:Ae,Oe=Math.log,ke=Math.LN2;function Ae(e){return e>>>=0,e===0?32:31-(Oe(e)/ke|0)|0}var je=256,Me=262144,Ne=4194304;function Pe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Fe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Pe(n))):i=Pe(o):i=Pe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Pe(n))):i=Pe(o)):i=Pe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ie(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Le(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 Re(){var e=Ne;return Ne<<=1,!(Ne&62914560)&&(Ne=4194304),e}function ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Be(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ve(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-De(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&He(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function He(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-De(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ue(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-De(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function We(e,t){var n=t&-t;return n=n&42?1:Ge(n),(n&(e.suspendedLanes|t))===0?n:0}function Ge(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 Ke(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function qe(){var e=L.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Je(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Ye=Math.random().toString(36).slice(2),Xe=`__reactFiber$`+Ye,Ze=`__reactProps$`+Ye,Qe=`__reactContainer$`+Ye,$e=`__reactEvents$`+Ye,et=`__reactListeners$`+Ye,tt=`__reactHandles$`+Ye,nt=`__reactResources$`+Ye,rt=`__reactMarker$`+Ye;function it(e){delete e[Xe],delete e[Ze],delete e[$e],delete e[et],delete e[tt]}function at(e){var t=e[Xe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Qe]||n[Xe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Xe])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function ot(e){if(e=e[Xe]||e[Qe]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function st(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function ct(e){var t=e[nt];return t||=e[nt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function lt(e){e[rt]=!0}var ut=new Set,dt={};function ft(e,t){pt(e,t),pt(e+`Capture`,t)}function pt(e,t){for(dt[e]=t,e=0;e<t.length;e++)ut.add(t[e])}var mt=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]*$`),ht={},gt={};function _t(e){return he.call(gt,e)?!0:he.call(ht,e)?!1:mt.test(e)?gt[e]=!0:(ht[e]=!0,!1)}function vt(e,t,n){if(_t(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function yt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function bt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function xt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function St(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ct(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wt(e){if(!e._valueTracker){var t=St(e)?`checked`:`value`;e._valueTracker=Ct(e,t,``+e[t])}}function Tt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=St(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Et(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Dt=/[\n"\\]/g;function Ot(e){return e.replace(Dt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function kt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+xt(t)):e.value!==``+xt(t)&&(e.value=``+xt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):At(e,o,xt(n)):At(e,o,xt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+xt(s):e.removeAttribute(`name`)}function Y(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){wt(e);return}n=n==null?``:``+xt(n),t=t==null?n:``+xt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),wt(e)}function At(e,t,n){t===`number`&&Et(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function jt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+xt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Mt(e,t,n){if(t!=null&&(t=``+xt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+xt(n)}function Nt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(F(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=xt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),wt(e)}function Pt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ft=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 It(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ft.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Lt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&It(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&It(e,a,t[a])}function Rt(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 zt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Bt=/^[\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 Vt(e){return Bt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Ht(){}var Ut=null;function Wt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gt=null,Kt=null;function qt(e){var t=ot(e);if(t&&(e=t.stateNode)){var n=e[Ze]||null;a:switch(e=t.stateNode,t.type){case`input`:if(kt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ot(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Ze]||null;if(!i)throw Error(s(90));kt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Tt(r)}break a;case`textarea`:Mt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&jt(e,!!n.multiple,t,!1)}}}var Jt=!1;function Yt(e,t,n){if(Jt)return e(t,n);Jt=!0;try{return e(t)}finally{if(Jt=!1,(Gt!==null||Kt!==null)&&(vu(),Gt&&(t=Gt,e=Kt,Kt=Gt=null,qt(t),e)))for(t=0;t<e.length;t++)qt(e[t])}}function Xt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ze]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var Zt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Qt=!1;if(Zt)try{var $t={};Object.defineProperty($t,"passive",{get:function(){Qt=!0}}),window.addEventListener(`test`,$t,$t),window.removeEventListener(`test`,$t,$t)}catch{Qt=!1}var en=null,tn=null,nn=null;function rn(){if(nn)return nn;var e,t=tn,n=t.length,r,i=`value`in en?en.value:en.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return nn=i.slice(e,1<r?1-r:void 0)}function an(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 on(){return!0}function sn(){return!1}function cn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?on:sn,this.isPropagationStopped=sn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=on)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=on)},persist:function(){},isPersistent:on}),t}var ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=cn(ln),dn=h({},ln,{view:0,detail:0}),fn=cn(dn),pn,mn,hn,gn=h({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dn,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!==hn&&(hn&&e.type===`mousemove`?(pn=e.screenX-hn.screenX,mn=e.screenY-hn.screenY):mn=pn=0,hn=e),pn)},movementY:function(e){return`movementY`in e?e.movementY:mn}}),_n=cn(gn),vn=cn(h({},gn,{dataTransfer:0})),yn=cn(h({},dn,{relatedTarget:0})),bn=cn(h({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),xn=cn(h({},ln,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Sn=cn(h({},ln,{data:0})),Cn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},wn={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`},Tn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function En(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Tn[e])?!!t[e]:!1}function Dn(){return En}var On=cn(h({},dn,{key:function(e){if(e.key){var t=Cn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=an(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?wn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dn,charCode:function(e){return e.type===`keypress`?an(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?an(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),kn=cn(h({},gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),An=cn(h({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dn})),jn=cn(h({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),Mn=cn(h({},gn,{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})),Nn=cn(h({},ln,{newState:0,oldState:0})),Pn=[9,13,27,32],Fn=Zt&&`CompositionEvent`in window,In=null;Zt&&`documentMode`in document&&(In=document.documentMode);var Ln=Zt&&`TextEvent`in window&&!In,Rn=Zt&&(!Fn||In&&8<In&&11>=In),zn=` `,Bn=!1;function Vn(e,t){switch(e){case`keyup`:return Pn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Hn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Un=!1;function Wn(e,t){switch(e){case`compositionend`:return Hn(t);case`keypress`:return t.which===32?(Bn=!0,zn):null;case`textInput`:return e=t.data,e===zn&&Bn?null:e;default:return null}}function Gn(e,t){if(Un)return e===`compositionend`||!Fn&&Vn(e,t)?(e=rn(),nn=tn=en=null,Un=!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 Rn&&t.locale!==`ko`?null:t.data;default:return null}}var Kn={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 qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Kn[e.type]:t===`textarea`}function Jn(e,t,n,r){Gt?Kt?Kt.push(r):Kt=[r]:Gt=r,t=Td(t,`onChange`),0<t.length&&(n=new un(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Yn=null,Xn=null;function Zn(e){vd(e,0)}function Qn(e){if(Tt(st(e)))return e}function $n(e,t){if(e===`change`)return t}var er=!1;if(Zt){var tr;if(Zt){var nr=`oninput`in document;if(!nr){var rr=document.createElement(`div`);rr.setAttribute(`oninput`,`return;`),nr=typeof rr.oninput==`function`}tr=nr}else tr=!1;er=tr&&(!document.documentMode||9<document.documentMode)}function ir(){Yn&&(Yn.detachEvent(`onpropertychange`,ar),Xn=Yn=null)}function ar(e){if(e.propertyName===`value`&&Qn(Xn)){var t=[];Jn(t,Xn,e,Wt(e)),Yt(Zn,t)}}function or(e,t,n){e===`focusin`?(ir(),Yn=t,Xn=n,Yn.attachEvent(`onpropertychange`,ar)):e===`focusout`&&ir()}function sr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Qn(Xn)}function cr(e,t){if(e===`click`)return Qn(t)}function lr(e,t){if(e===`input`||e===`change`)return Qn(t)}function ur(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var dr=typeof Object.is==`function`?Object.is:ur;function fr(e,t){if(dr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!he.call(t,i)||!dr(e[i],t[i]))return!1}return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mr(e,t){var n=pr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=pr(n)}}function hr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Et(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Et(e.document)}return t}function _r(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 vr=Zt&&`documentMode`in document&&11>=document.documentMode,yr=null,br=null,xr=null,Sr=!1;function Cr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sr||yr==null||yr!==Et(r)||(r=yr,`selectionStart`in r&&_r(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xr&&fr(xr,r)||(xr=r,r=Td(br,`onSelect`),0<r.length&&(t=new un(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Tr={animationend:wr(`Animation`,`AnimationEnd`),animationiteration:wr(`Animation`,`AnimationIteration`),animationstart:wr(`Animation`,`AnimationStart`),transitionrun:wr(`Transition`,`TransitionRun`),transitionstart:wr(`Transition`,`TransitionStart`),transitioncancel:wr(`Transition`,`TransitionCancel`),transitionend:wr(`Transition`,`TransitionEnd`)},Er={},Dr={};Zt&&(Dr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Tr.animationend.animation,delete Tr.animationiteration.animation,delete Tr.animationstart.animation),`TransitionEvent`in window||delete Tr.transitionend.transition);function Or(e){if(Er[e])return Er[e];if(!Tr[e])return e;var t=Tr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Dr)return Er[e]=t[n];return e}var kr=Or(`animationend`),Ar=Or(`animationiteration`),jr=Or(`animationstart`),Mr=Or(`transitionrun`),Nr=Or(`transitionstart`),Pr=Or(`transitioncancel`),Fr=Or(`transitionend`),Ir=new Map,Lr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Lr.push(`scrollEnd`);function Rr(e,t){Ir.set(e,t),ft(t,[e])}var zr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Br=[],Vr=0,Hr=0;function Ur(){for(var e=Vr,t=Hr=Vr=0;t<e;){var n=Br[t];Br[t++]=null;var r=Br[t];Br[t++]=null;var i=Br[t];Br[t++]=null;var a=Br[t];if(Br[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&qr(n,i,a)}}function Wr(e,t,n,r){Br[Vr++]=e,Br[Vr++]=t,Br[Vr++]=n,Br[Vr++]=r,Hr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Gr(e,t,n,r){return Wr(e,t,n,r),Jr(e)}function Kr(e,t){return Wr(e,null,null,t),Jr(e)}function qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-De(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Jr(e){if(50<lu)throw lu=0,uu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yr={};function Xr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zr(e,t,n,r){return new Xr(e,t,n,r)}function Qr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $r(e,t){var n=e.alternate;return n===null?(n=Zr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ei(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ti(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)Qr(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,ne.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=Zr(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return ni(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=Zr(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=Zr(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=Zr(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case D:o=14;break a;case O:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=Zr(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ni(e,t,n,r){return e=Zr(7,e,r,t),e.lanes=n,e}function ri(e,t,n){return e=Zr(6,e,null,t),e.lanes=n,e}function ii(e){var t=Zr(18,null,null,0);return t.stateNode=e,t}function ai(e,t,n){return t=Zr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var oi=new WeakMap;function si(e,t){if(typeof e==`object`&&e){var n=oi.get(e);return n===void 0?(t={value:e,source:t,stack:U(t)},oi.set(e,t),t):n}return{value:e,source:t,stack:U(t)}}var ci=[],li=0,ui=null,di=0,fi=[],pi=0,mi=null,hi=1,gi=``;function _i(e,t){ci[li++]=di,ci[li++]=ui,ui=e,di=t}function vi(e,t,n){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,mi=e;var r=hi;e=gi;var i=32-De(r)-1;r&=~(1<<i),n+=1;var a=32-De(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,hi=1<<32-De(t)+i|n<<i|r,gi=a+e}else hi=1<<a|n<<i|r,gi=e}function yi(e){e.return!==null&&(_i(e,1),vi(e,1,0))}function bi(e){for(;e===ui;)ui=ci[--li],ci[li]=null,di=ci[--li],ci[li]=null;for(;e===mi;)mi=fi[--pi],fi[pi]=null,gi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null}function xi(e,t){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,hi=t.id,gi=t.overflow,mi=e}var Si=null,Ci=null,wi=!1,Ti=null,Ei=!1,Di=Error(s(519));function Oi(e){throw Pi(si(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Di}function ki(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Xe]=e,t[Ze]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Y(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Nt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Ht),t=!0):t=!1,t||Oi(e,!0)}function Ai(e){for(Si=e.return;Si;)switch(Si.tag){case 5:case 31:case 13:Ei=!1;return;case 27:case 3:Ei=!0;return;default:Si=Si.return}}function ji(e){if(e!==Si)return!1;if(!wi)return Ai(e),wi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&Ci&&Oi(e),Ai(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ci=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ci=uf(e)}else t===27?(t=Ci,Zd(e.type)?(e=lf,lf=null,Ci=e):Ci=t):Ci=Si?cf(e.stateNode.nextSibling):null;return!0}function Mi(){Ci=Si=null,wi=!1}function Ni(){var e=Ti;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Ti=null),e}function Pi(e){Ti===null?Ti=[e]:Ti.push(e)}var Fi=z(null),Ii=null,Li=null;function Ri(e,t,n){V(Fi,t._currentValue),t._currentValue=n}function zi(e){e._currentValue=Fi.current,B(Fi)}function Bi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Vi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Bi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Bi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function Hi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;dr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===H.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&Vi(t,e,n,r),t.flags|=262144}function Ui(e){for(e=e.firstContext;e!==null;){if(!dr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wi(e){Ii=e,Li=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gi(e){return qi(Ii,e)}function Ki(e,t){return Ii===null&&Wi(e),qi(e,t)}function qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Li===null){if(e===null)throw Error(s(308));Li=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Li=Li.next=t;return n}var Ji=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Yi=t.unstable_scheduleCallback,Xi=t.unstable_NormalPriority,Zi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qi(){return{controller:new Ji,data:new Map,refCount:0}}function $i(e){e.refCount--,e.refCount===0&&Yi(Xi,function(){e.controller.abort()})}var ea=null,ta=0,na=0,ra=null;function ia(e,t){if(ea===null){var n=ea=[];ta=0,na=ud(),ra={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ta++,t.then(aa,aa),t}function aa(){if(--ta===0&&ea!==null){ra!==null&&(ra.status=`fulfilled`);var e=ea;ea=null,na=0,ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function oa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var sa=I.S;I.S=function(e,t){Ql=ye(),typeof t==`object`&&t&&typeof t.then==`function`&&ia(e,t),sa!==null&&sa(e,t)};var ca=z(null);function la(){var e=ca.current;return e===null?Fl.pooledCache:e}function ua(e,t){t===null?V(ca,ca.current):V(ca,t.pool)}function da(){var e=la();return e===null?null:{parent:Zi._currentValue,pool:e}}var fa=Error(s(460)),pa=Error(s(474)),ma=Error(s(542)),ha={then:function(){}};function ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function _a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ht,Ht),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e;default:if(typeof t.status==`string`)t.then(Ht,Ht);else{if(e=Fl,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e}throw ya=t,fa}}function va(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ya=e,fa):e}}var ya=null;function ba(){if(ya===null)throw Error(s(459));var e=ya;return ya=null,e}function xa(e){if(e===fa||e===ma)throw Error(s(483))}var Sa=null,Ca=0;function wa(e){var t=Ca;return Ca+=1,Sa===null&&(Sa=[]),_a(Sa,e,t)}function Ta(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ea(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Da(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=$r(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ri(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&va(a)===t.type)?(t=i(t,n.props),Ta(t,n),t.return=e,t):(t=ti(n.type,n.key,n.props,null,e.mode,r),Ta(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ai(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ni(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ti(t.type,t.key,t.props,null,e.mode,n),Ta(n,t),n.return=e,n;case v:return t=ai(t,e.mode,n),t.return=e,t;case O:return t=va(t),f(e,t,n)}if(F(t)||M(t))return t=ni(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,wa(t),n);if(t.$$typeof===C)return f(e,Ki(e,t),n);Ea(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=va(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,wa(n),r);if(n.$$typeof===C)return p(e,t,Ki(e,n),r);Ea(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=va(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,wa(r),i);if(r.$$typeof===C)return m(e,t,n,Ki(t,r),i);Ea(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),wi&&_i(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return wi&&_i(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),wi&&_i(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),wi&&_i(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return wi&&_i(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),wi&&_i(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&va(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ta(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=ni(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ti(a.type,a.key,a.props,null,e.mode,c),Ta(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ai(a,e.mode,c),c.return=e,e=c}return o(e);case O:return a=va(a),b(e,r,a,c)}if(F(a))return h(e,r,a,c);if(M(a)){if(l=M(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,wa(a),c);if(a.$$typeof===C)return b(e,r,Ki(e,a),c);Ea(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=ri(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Ca=0;var i=b(e,t,n,r);return Sa=null,i}catch(t){if(t===fa||t===ma)throw t;var a=Zr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Oa=Da(!0),ka=Da(!1),Aa=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ma(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Jr(e),qr(e,null,n),t}return Wr(e,r,t,n),Jr(e)}function Fa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ue(e,n)}}function Ia(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var La=!1;function Ra(){if(La){var e=ra;if(e!==null)throw e}}function za(e,t,n,r){La=!1;var i=e.updateQueue;Aa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===na&&(La=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Aa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ba(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Va(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ba(n[e],t)}var Ha=z(null),Ua=z(0);function Wa(e,t){e=Vl,V(Ua,e),V(Ha,t),Vl=e|t.baseLanes}function Ga(){V(Ua,Vl),V(Ha,Ha.current)}function Ka(){Vl=Ua.current,B(Ha),B(Ua)}var qa=z(null),Ja=null;function Ya(e){var t=e.alternate;V(eo,eo.current&1),V(qa,e),Ja===null&&(t===null||Ha.current!==null||t.memoizedState!==null)&&(Ja=e)}function Xa(e){V(eo,eo.current),V(qa,e),Ja===null&&(Ja=e)}function Za(e){e.tag===22?(V(eo,eo.current),V(qa,e),Ja===null&&(Ja=e)):Qa(e)}function Qa(){V(eo,eo.current),V(qa,qa.current)}function $a(e){B(qa),Ja===e&&(Ja=null),B(eo)}var eo=z(0);function to(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)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 no=0,X=null,ro=null,io=null,ao=!1,oo=!1,so=!1,co=0,lo=0,uo=null,fo=0;function po(){throw Error(s(321))}function mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!dr(e[n],t[n]))return!1;return!0}function ho(e,t,n,r,i,a){return no=a,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ms:Ns,so=!1,a=n(r,i),so=!1,oo&&(a=_o(t,n,r,i)),go(e),a}function go(e){I.H=js;var t=ro!==null&&ro.next!==null;if(no=0,io=ro=X=null,ao=!1,lo=0,uo=null,t)throw Error(s(300));e===null||Xs||(e=e.dependencies,e!==null&&Ui(e)&&(Xs=!0))}function _o(e,t,n,r){X=e;var i=0;do{if(oo&&(uo=null),lo=0,oo=!1,25<=i)throw Error(s(301));if(i+=1,io=ro=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}I.H=Ps,a=t(n,r)}while(oo);return a}function vo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?To(t):t,e=e.useState()[0],(ro===null?null:ro.memoizedState)!==e&&(X.flags|=1024),t}function yo(){var e=co!==0;return co=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function xo(e){if(ao){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ao=!1}no=0,io=ro=X=null,oo=!1,lo=co=0,uo=null}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?X.memoizedState=io=e:io=io.next=e,io}function Co(){if(ro===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=ro.next;var t=io===null?X.memoizedState:io.next;if(t!==null)io=t,ro=e;else{if(e===null)throw X.alternate===null?Error(s(467)):Error(s(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},io===null?X.memoizedState=io=e:io=io.next=e}return io}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(e){var t=lo;return lo+=1,uo===null&&(uo=[]),e=_a(uo,e,t),t=X,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ms:Ns),e}function Eo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return To(e);if(e.$$typeof===C)return Gi(e)}throw Error(s(438,String(e)))}function Do(e){var t=null,n=X.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=X.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=wo(),X.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Oo(e,t){return typeof t==`function`?t(e):t}function ko(e){return Ao(Co(),ro,e)}function Ao(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(no&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===na&&(d=!0);else if((no&p)===p){u=u.next,p===na&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,X.lanes|=p,Ul|=p;f=u.action,so&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,X.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!dr(a,e.memoizedState)&&(Xs=!0,d&&(n=ra,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function jo(e){var t=Co(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);dr(a,t.memoizedState)||(Xs=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Mo(e,t,n){var r=X,i=Co(),a=wi;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!dr((ro||i).memoizedState,n);if(o&&(i.memoizedState=n,Xs=!0),i=i.queue,rs(Fo.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||io!==null&&io.memoizedState.tag&1){if(r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,i,n,t),null),Fl===null)throw Error(s(349));a||no&127||No(r,t,n)}return n}function No(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t=wo(),X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Po(e,t,n,r){t.value=n,t.getSnapshot=r,Io(t)&&Lo(e)}function Fo(e,t,n){return n(function(){Io(t)&&Lo(e)})}function Io(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!dr(e,n)}catch{return!0}}function Lo(e){var t=Kr(e,2);t!==null&&pu(t,e,2)}function Ro(e){var t=So();if(typeof e==`function`){var n=e;if(e=n(),so){Ee(!0);try{n()}finally{Ee(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t}function zo(e,t,n,r){return e.baseState=n,Ao(e,ro,typeof r==`function`?r:Oo)}function Bo(e,t,n,r,i){if(Os(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};I.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Vo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Vo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ho(e,t,s)}catch(n){Wo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ho(e,t,a)}catch(n){Wo(e,t,n)}}function Ho(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Uo(e,t,n)},function(n){return Wo(e,t,n)}):Uo(e,t,n)}function Uo(e,t,n){t.status=`fulfilled`,t.value=n,Go(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vo(e,n)))}function Wo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Go(t),t=t.next;while(t!==r)}e.action=null}function Go(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ko(e,t){return t}function qo(e,t){if(wi){var n=Fl.formState;if(n!==null){a:{var r=X;if(wi){if(Ci){b:{for(var i=Ci,a=Ei;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ci=cf(i.nextSibling),r=i.data===`F!`;break a}}Oi(r)}r=!1}r&&(t=n[0])}}return n=So(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},n.queue=r,n=Ts.bind(null,X,r),r.dispatch=n,r=Ro(!1),a=Ds.bind(null,X,!1,r.queue),r=So(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Bo.bind(null,X,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jo(e){return Yo(Co(),ro,e)}function Yo(e,t,n){if(t=Ao(e,t,Ko)[0],e=ko(Oo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=To(t)}catch(e){throw e===fa?ma:e}else r=t;t=Co();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(X.flags|=2048,Qo(9,{destroy:void 0},Xo.bind(null,i,n),null)),[r,a,e]}function Xo(e,t){e.action=t}function Zo(e){var t=Co(),n=ro;if(n!==null)return Yo(t,n,e);Co(),t=t.memoizedState,n=Co();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Qo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=X.updateQueue,t===null&&(t=wo(),X.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function $o(){return Co().memoizedState}function es(e,t,n,r){var i=So();X.flags|=e,i.memoizedState=Qo(1|t,{destroy:void 0},n,r===void 0?null:r)}function ts(e,t,n,r){var i=Co();r=r===void 0?null:r;var a=i.memoizedState.inst;ro!==null&&r!==null&&mo(r,ro.memoizedState.deps)?i.memoizedState=Qo(t,a,n,r):(X.flags|=e,i.memoizedState=Qo(1|t,a,n,r))}function ns(e,t){es(8390656,8,e,t)}function rs(e,t){ts(2048,8,e,t)}function is(e){X.flags|=4;var t=X.updateQueue;if(t===null)t=wo(),X.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function as(e){var t=Co().memoizedState;return is({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function os(e,t){return ts(4,2,e,t)}function ss(e,t){return ts(4,4,e,t)}function cs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ls(e,t,n){n=n==null?null:n.concat([e]),ts(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&mo(t,r[1]))return r[0];if(r=e(),so){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[r,t],r}function ps(e,t,n){return n===void 0||no&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),X.lanes|=e,Ul|=e,n)}function ms(e,t,n,r){return dr(n,t)?n:Ha.current===null?!(no&42)||no&1073741824&&!(Q&261930)?(Xs=!0,e.memoizedState=n):(e=fu(),X.lanes|=e,Ul|=e,t):(e=ps(e,n,r),dr(e,t)||(Xs=!0),e)}function hs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Ds(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Es(e,t,oa(c,r),du(e)):Es(e,t,r,du(e))}catch(n){Es(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=vs(e).queue;hs(e,i,t,ee,n===null?gs:function(){return ys(e),n(r)})}function vs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Es(e,t.next.queue,{},du())}function bs(){return Gi(Qf)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Na(n);var r=Pa(t,e,n);r!==null&&(pu(r,t,n),Fa(r,t,n)),t={cache:Qi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=Gr(e,t,n,r),n!==null&&(pu(n,e,r),As(n,t,r)))}function Ts(e,t,n){Es(e,t,n,du())}function Es(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,dr(s,o))return Wr(e,t,i,0),Fl===null&&Ur(),!1}catch{}if(n=Gr(e,t,i,r),n!==null)return pu(n,e,r),As(n,t,r),!0}return!1}function Ds(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(s(479))}else t=Gr(e,n,r,2),t!==null&&pu(t,e,2)}function Os(e){var t=e.alternate;return e===X||t!==null&&t===X}function ks(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ue(e,n)}}var js={readContext:Gi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};js.useEffectEvent=po;var Ms={readContext:Gi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Gi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){Ee(!0);try{n(t)}finally{Ee(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ws.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Ts.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,X,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=X,i=So();if(wi){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Fl===null)throw Error(s(349));Q&127||No(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ns(Fo.bind(null,r,a,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,a,n,t),null),n},useId:function(){var e=So(),t=Fl.identifierPrefix;if(wi){var n=gi,r=hi;n=(r&~(1<<32-De(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:bs,useFormState:qo,useActionState:qo,useOptimistic:function(e){var t=So();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ds.bind(null,X,!0,n),n.dispatch=t,[e,t]},useMemoCache:Do,useCacheRefresh:function(){return So().memoizedState=Cs.bind(null,X)},useEffectEvent:function(e){var t=So(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:ko,useRef:$o,useState:function(){return ko(Oo)},useDebugValue:us,useDeferredValue:function(e,t){return ms(Co(),ro.memoizedState,e,t)},useTransition:function(){var e=ko(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e,t){return zo(Co(),ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ns.useEffectEvent=as;var Ps={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:jo,useRef:$o,useState:function(){return jo(Oo)},useDebugValue:us,useDeferredValue:function(e,t){var n=Co();return ro===null?ps(n,e,t):ms(n,ro.memoizedState,e,t)},useTransition:function(){var e=jo(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){var n=Co();return ro===null?(n.baseState=e,[e,n.queue.dispatch]):zo(n,ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ps.useEffectEvent=as;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Na(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(pu(t,e,n),Fa(t,e,n))}};function Ls(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!fr(n,r)||!fr(i,a):!0}function Rs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){zr(e)}function Vs(e){console.error(e)}function Hs(e){zr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){return n=Na(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Na(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Hi(t,n,i,!0),n=qa.current,n!==null){switch(n.tag){case 31:case 13:return Ja===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,i)),!1;case 22:return n.flags|=65536,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,i)),!1}throw Error(s(435,n.tag))}return Wu(e,r,i),Tu(),!1}if(wi)return t=qa.current,t===null?(r!==Di&&(t=Error(s(423),{cause:r}),Pi(si(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=si(r,n),i=Gs(e.stateNode,r,i),Ia(e,i),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Di&&(e=Error(s(422),{cause:r}),Pi(si(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=si(a,n),Jl===null?Jl=[a]:Jl.push(a),Hl!==4&&(Hl=2),t===null)return!0;r=si(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Gs(n.stateNode,r,e),Ia(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(tu===null||!tu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Ks(i),qs(i,e,n,r),Ia(n,i),!1}n=n.return}while(n!==null);return!1}var Ys=Error(s(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?ka(t,null,n,r):Oa(t,e.child,n,r)}function Qs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Wi(t),r=ho(e,t,n,o,a,i),s=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&s&&yi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Qr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ti(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?fr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=$r(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(fr(a,r)&&e.ref===t.ref){if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}}return cc(e,t,n,r,i)}function tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ua(t,a===null?null:a.cachePool),a===null?Ga():Wa(t,a),Za(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ua(t,null),Ga(),Qa(t)):(ua(t,a.cachePool),Wa(t,a),Qa(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=la();return a=a===null?null:{parent:Zi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ua(t,null),Ga(),Za(t),e!==null&&Hi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Oa(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,$a(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(wi){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Xa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return t.lanes=536870912,null}return ic(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(Xa(t),i){if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558))}else if(Xs||Hi(e,t,n,!1),i=(n&e.childLanes)!==0,Xs||i){if(r=Fl,r!==null&&(o=We(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Kr(e,o),pu(r,e,o),Ys;Tu(),t=ac(e,t,n)}else e=a.treeContext,Ci=cf(o.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=ic(t,r),t.flags|=4096;return t}return e=$r(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,r,i){return Wi(t),n=ho(e,t,n,r,void 0,i),r=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Wi(t),t.updateQueue=null,n=_o(t,r,n,i),go(e),r=yo(),e!==null&&!Xs?(bo(e,t,a),Sc(e,t,a)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Wi(t),t.stateNode===null){var a=Yr,o=n.contextType;typeof o==`object`&&o&&(a=Gi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ja(t),o=n.contextType,a.context=typeof o==`object`&&o?Gi(o):Yr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Is.enqueueReplaceState(a,a.state,null),za(t,r,a,i),Ra(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Yr,typeof u==`object`&&u&&(o=Gi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Rs(t,a,r,o),Aa=!1;var f=t.memoizedState;a.state=f,za(t,r,a,i),Ra(),l=t.memoizedState,s||f!==l||Aa?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=Aa||Ls(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ma(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Yr,typeof l==`object`&&l&&(c=Gi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Rs(t,a,r,c),Aa=!1,f=t.memoizedState,a.state=f,za(t,r,a,i),Ra();var p=t.memoizedState;o!==d||f!==p||Aa||e!==null&&e.dependencies!==null&&Ui(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=Aa||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ui(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,sc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Oa(t,e.child,null,i),t.child=Oa(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Mi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:da()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function hc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(eo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(wi){if(i?Ya(t):Qa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(Qa(t),i=t.mode,c=_c({mode:`hidden`,children:c},i),r=ni(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,o,n),t.memoizedState=fc,nc(null,r)):(Ya(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(Ya(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(Qa(t),c=r.fallback,i=t.mode,r=_c({mode:`visible`,children:r.children},i),c=ni(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Oa(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,o,n),t.memoizedState=fc,t=nc(null,r)):(Qa(t),t.child=e.child,t.flags|=128,t=null);else if(Ya(t),of(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,Pi({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Hi(e,t,n,!1),o=(n&e.childLanes)!==0,Xs||o){if(o=Fl,o!==null&&(r=We(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Kr(e,r),pu(o,e,r),Ys;af(c)||Tu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ci=cf(c.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=gc(t,r.children),t.flags|=4096);return t}return i?(Qa(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=$r(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ni(c,i,n,null),c.flags|=2):c=$r(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(i=c.cachePool,i===null?i=da():(l=Zi._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=mc(e,o,n),t.memoizedState=fc,nc(e.child,r)):(Ya(t),n=e.child,e=n.sibling,n=$r(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=Zr(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Oa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=eo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,V(eo,o),Zs(e,t,r,n),r=wi?di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&to(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&to(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Hi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=$r(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$r(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ui(e)))}function wc(e,t,n){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),Ri(t,Zi,e.memoizedState.cache),Mi();break;case 27:case 5:se(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:Ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Xa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ya(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Ya(t),t.flags|=128,null);Ya(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Hi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),V(eo,eo.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Ri(t,Zi,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}}else Xs=!1,wi&&t.flags&1048576&&vi(t,di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=va(t.elementType),t.type=e,typeof e==`function`)Qr(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=Qs(null,t,e,r,n);break a}if(i===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=P(e)||e,Error(s(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=zs(r,t.pendingProps),uc(e,t,r,i,n);case 3:a:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Ma(e,t),za(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Ri(t,Zi,r),r!==a.cache&&Vi(t,[Zi],n,!0),Ra(),r=o.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=dc(e,t,r,n);break a}if(r!==i){i=si(Error(s(424)),t),Pi(i),t=dc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ci=cf(e.firstChild),Si=t,wi=!0,Ti=null,Ei=!0,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Mi(),r===i){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:wi||(n=t.type,e=t.pendingProps,r=Bd(ie.current).createElement(n),r[Xe]=t,r[Ze]=e,Pd(r,n,e),lt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return se(t),e===null&&wi&&(r=t.stateNode=ff(t.type,t.pendingProps,ie.current),Si=t,Ei=!0,i=Ci,Zd(t.type)?(lf=i,Ci=cf(r.firstChild)):Ci=i),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&wi&&((i=r=Ci)&&(r=tf(r,t.type,t.pendingProps,Ei),r===null?i=!1:(t.stateNode=r,Si=t,Ci=cf(r.firstChild),Ei=!1,i=!0)),i||Oi(t)),se(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:o!==null&&Ud(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=ho(e,t,vo,null,null,n),Qf._currentValue=i),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&wi&&((e=n=Ci)&&(n=nf(n,t.pendingProps,Ei),n===null?e=!1:(t.stateNode=n,Si=t,Ci=null,e=!0)),e||Oi(t)),null;case 13:return hc(e,t,n);case 4:return ae(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ri(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Wi(t),i=Gi(i),r=r(i),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Wi(t),r=Gi(Zi),e===null?(i=la(),i===null&&(i=Fl,a=Qi(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},ja(t),Ri(t,Zi,i)):((e.lanes&n)!==0&&(Ma(e,t),za(t,null,null,n),Ra()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ri(t,Zi,r),r!==i.cache&&Vi(t,[Zi],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ri(t,Zi,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw ya=ha,pa}}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(Su())e.flags|=8192;else throw ya=ha,pa}}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Re(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!wi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(bi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),zi(Zi),oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ji(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ni())),jc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Ec(t),a===null?(jc(t),Dc(t,i,null,r,n)):(jc(t),Oc(t,a))):a?a===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,a)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,i,e,r,n)),null;case 27:if(ce(t),n=ie.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}e=ne.current,ji(t)?ki(t,e):(e=ff(i,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(ce(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}if(a=ne.current,ji(t))ki(t,a);else{var o=Bd(ie.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[Xe]=t,a[Ze]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ie.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Si,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Xe]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Oi(t,!0)}else e=Bd(e).createTextNode(r),e[Xe]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[Xe]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(s(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ji(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[Xe]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),i=!1}else i=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?($a(t),t):($a(t),null)}return $a(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return oe(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return zi(t.type),jc(t),null;case 19:if(B(eo),r=t.memoizedState,r===null)return jc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=to(e),a!==null){for(t.flags|=128,Ac(r,!1),e=a.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ei(n,e),n=n.sibling;return V(eo,eo.current&1|2),wi&&_i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>$l&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304)}}else{if(!i){if(e=to(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!wi)return jc(t),null}else 2*ye()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=eo.current,V(eo,i?n&1|2:n&1),wi&&_i(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ka(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&B(ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Zi),jc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Nc(e,t){switch(bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Zi),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(s(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(eo),null;case 4:return oe(),null;case 10:return zi(t.type),null;case 22:case 23:return $a(t),Ka(),e!==null&&B(ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Zi),null;case 25:return null;default:return null}}function Pc(e,t){switch(bi(t),t.tag){case 3:zi(Zi),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:B(eo);break;case 10:zi(t.type);break;case 22:case 23:$a(t),Ka(),e!==null&&B(ca);break;case 24:zi(Zi)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Va(t,n)}catch(t){Uu(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Vc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[Ze]=t}catch(t){Uu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(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&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ht));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[Xe]=e,t[Ze]=n}catch(t){Uu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=gr(e),_r(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=zs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Va(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,!!(n.subtreeFlags&8772)):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&it(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 nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(J&&typeof J.onCommitFiberUnmount==`function`)try{J.onCommitFiberUnmount(q,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null){if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(s(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(s(160));al(a,o,i),nl=null,rl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[rt]||a[Xe]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Pd(a,r,n),a[Xe]=e,lt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[Xe]=e,lt(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode)}else e.stateNode=If(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){i=e.stateNode;try{Pt(i,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Hc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,i=dl,dl=gf(t.containerInfo),ul(t,e),dl=i,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=ye()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||i,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Jc||Yc||gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;Kc(e,Wc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Pt(a,``),n.flags&=-33),Kc(e,Wc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Gc(e,Wc(e),o);break;default:throw Error(s(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ba(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&$i(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e)));break;case 12:if(i&2048){bl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Uu(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(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 Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:$i(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=Gi(Zi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Gi(Zi).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:I.T===null?qe():ud()}function fu(){if(Kl===0){if(!(Q&536870912)||wi){var e=Me;Me<<=1,!(Me&3932160)&&(Me=262144),Kl=e}else Kl=536870912}return e=qa.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Be(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(Pl&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ie(e,t),i=r?Ou(e,t):Eu(e,t,!0),a=r;do{if(i===0){zl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,a&&!gu(n)){i=Eu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,o).flags|=256),o=Eu(c,o,!1),o!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=a,Wl|=a,i=4;break a}a=Yl,Yl=i,a!==null&&(Yl===null?Yl=a:Yl.push.apply(Yl,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=Zl+300-ye(),10<i)){if(_u(r,t,Kl,!Rl),Fe(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,`Throttled`,-0,0),i);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,null,-0,0)}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ht},El(t,a,d);var m=(a&62914560)===a?Zl-ye():(a&4194048)===a?Ql-ye():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!dr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-De(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&He(e,n,t)}function vu(){return Pl&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Li=Ii=null,xo(e),Sa=null,Ca=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=$r(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=Ie(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-De(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Ur(),n}function xu(e,t){X=null,I.H=js,t===fa||t===ma?(t=ba(),Il=3):t===pa?(t=ba(),Il=4):Il=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Us(e,si(t,e.current)))}function Su(){var e=qa.current;return e===null?!0:(Q&4194048)===Q?Ja===null:(Q&62914560)===Q||Q&536870912?e===Ja:!1}function Cu(){var e=I.H;return I.H=js,e===null?js:e}function wu(){var e=I.A;return I.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&qa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:qa.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Li=Ii=null,Pl=r,I.H=i,I.A=a,Z===null&&(Fl=null,Q=0,Ur()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),i=wu();Fl!==e||Q!==t?(eu=null,$l=ye()+500,bu(e,t)):zl=Ie(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var a=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,a,1);break;case 2:case 9:if(ga(a)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},a.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:ga(a)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,a,7));break;case 5:var o=null;switch(Z.tag){case 26:o=Z.memoizedState;case 5:case 27:var c=Z;if(o?Wf(o):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,a,5);break;case 6:Il=0,Ll=null,Mu(e,t,a,6);break;case 8:yu(),Hl=6;break a;default:throw Error(s(462))}}ku();break}catch(t){xu(e,t)}while(1);return Li=Ii=null,I.H=r,I.A=i,Pl=n,Z===null?(Fl=null,Q=0,Ur(),Hl):0}function ku(){for(;Z!==null&&!ve();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:xo(t);default:Pc(n,t),t=Z=ei(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Li=Ii=null,xo(t),Sa=null,Ca=0;var i=t.return;try{if(Js(e,i,t,n,Q)){Hl=1,Us(e,si(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Us(e,si(n,e.current)),Z=null;return}t.flags&32768?(wi||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Hr,Ve(e,n,a,o,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=a,su=i,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(K,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,i=L.p,L.p=2,o=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=o,L.p=i,I.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=gr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&hr(s.ownerDocument.documentElement,s)){if(c!==null&&_r(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=mr(s,h),v=mr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Pl=i,L.p=r,I.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,L.p=r,I.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,W();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),Ke(n),t=t.stateNode,J&&typeof J.onCommitFiberRoot==`function`)try{J.onCommitFiberRoot(q,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$i(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=Ke(au),r=I.T,i=L.p;try{L.p=32>n?32:n,I.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(s(331));var c=Pl;if(Pl|=4,kl(a.current),xl(a,a.current,o,n),Pl=c,rd(0,!1),J&&typeof J.onPostCommitFiberRoot==`function`)try{J.onPostCommitFiberRoot(q,a)}catch{}return!0}finally{L.p=i,I.T=r,zu(e,t)}}function Hu(e,t,n){t=si(n,t),t=Gs(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(Be(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=si(n,e),n=Ks(2),r=Pa(t,n,2),r!==null&&(qs(n,r,t,e),Be(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>ye()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Re()),e=Kr(e,t),e!==null&&(Be(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return ge(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-De(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Fe(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ie(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=ye(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-De(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Le(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Fe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ie(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Ke(n)){case 2:case 8:n=xe;break;case 32:n=K;break;case 268435456:n=Ce;break;default:n=K}return r=sd.bind(null,e),n=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Fe(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,ye()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Pl&6?ge(G,id):ad()})}function ud(){if(td===0){var e=na;e===0&&(e=je,je<<=1,!(je&261888)&&(je=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Vt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[Ze]||null).action),o=r.submitter;o&&(t=(t=o[Ze]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new un(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);_s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),_s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Lr.length;md++){var hd=Lr[md];Rr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Rr(kr,`onAnimationEnd`),Rr(Ar,`onAnimationIteration`),Rr(jr,`onAnimationStart`),Rr(`dblclick`,`onDoubleClick`),Rr(`focusin`,`onFocus`),Rr(`focusout`,`onBlur`),Rr(Mr,`onTransitionRun`),Rr(Nr,`onTransitionStart`),Rr(Pr,`onTransitionCancel`),Rr(Fr,`onTransitionEnd`),pt(`onMouseEnter`,[`mouseout`,`mouseover`]),pt(`onMouseLeave`,[`mouseout`,`mouseover`]),pt(`onPointerEnter`,[`pointerout`,`pointerover`]),pt(`onPointerLeave`,[`pointerout`,`pointerover`]),ft(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ft(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ft(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ft(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ft(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ft(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`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(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){zr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){zr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[$e];n===void 0&&(n=t[$e]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,ut.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!Qt||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=at(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Yt(function(){var r=a,i=Wt(n),o=[];a:{var s=Ir.get(e);if(s!==void 0){var c=un,u=e;switch(e){case`keypress`:if(an(n)===0)break a;case`keydown`:case`keyup`:c=On;break;case`focusin`:u=`focus`,c=yn;break;case`focusout`:u=`blur`,c=yn;break;case`beforeblur`:case`afterblur`:c=yn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=_n;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=vn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=An;break;case kr:case Ar:case jr:c=bn;break;case Fr:c=jn;break;case`scroll`:case`scrollend`:c=fn;break;case`wheel`:c=Mn;break;case`copy`:case`cut`:case`paste`:c=xn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=kn;break;case`toggle`:case`beforetoggle`:c=Nn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Xt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ut&&(u=n.relatedTarget||n.fromElement)&&(at(u)||u[Qe]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?at(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=_n,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:st(c),h=u==null?s:st(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,at(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Ed,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Dd(o,s,c,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?st(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=$n;else if(qn(s)){if(er)v=lr;else{v=sr;var y=or}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Rt(r.elementType)&&(v=$n):v=cr;if(v&&=v(e,r)){Jn(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&At(s,`number`,s.value)}switch(y=r?st(r):window,e){case`focusin`:(qn(y)||y.contentEditable===`true`)&&(yr=y,br=r,xr=null);break;case`focusout`:xr=br=yr=null;break;case`mousedown`:Sr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Sr=!1,Cr(o,n,i);break;case`selectionchange`:if(vr)break;case`keydown`:case`keyup`:Cr(o,n,i)}var b;if(Fn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Un?Vn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Rn&&n.locale!==`ko`&&(Un||x!==`onCompositionStart`?x===`onCompositionEnd`&&Un&&(b=rn()):(en=i,tn=`value`in en?en.value:en.textContent,Un=!0)),y=Td(r,x),0<y.length&&(x=new Sn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Hn(n),b!==null&&(x.data=b)))),(b=Ln?Wn(e,n):Gn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Sn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),pd(o,e,r,n,i)}vd(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Xt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Xt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Xt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Xt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Pt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Pt(e,``+r);break;case`className`:yt(e,`class`,r);break;case`tabIndex`:yt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:yt(e,n,r);break;case`style`:Lt(e,r,a);break;case`data`:if(t!==`object`){yt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Vt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Vt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Ht);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Vt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),vt(e,`popover`,r);break;case`xlinkActuate`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:vt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=zt.get(n)||n,vt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Lt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Pt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Pt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Ht);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[Ze]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):vt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,a,o,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:Md(e,t,r,d,n,null)}}Y(e,a,c,l,u,o,i,!1);return;case`select`:for(i in $(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&jt(e,!!r,n,!0):jt(e,!!r,t,!1);return;case`textarea`:for(o in $(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:Md(e,t,o,c,n,null)}Nt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Rt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}kt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Md(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&Md(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?jt(e,!!n,n?[]:``,!1):jt(e,!!n,t,!0)):jt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&Md(e,t,o,i,r,a)}Mt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Rt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Hd(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 Ud(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 Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[rt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),it(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[rt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(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 lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);it(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=L.d;L.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=ot(e);t!==null&&t.tag===5&&t.type===`form`?ys(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ot(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),lt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ot(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ot(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ot(n.imageSizes)+`"]`)):i+=`[href="`+Ot(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),lt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ot(r)+`"][href="`+Ot(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),lt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ct(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);lt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),lt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),lt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ie.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=ct(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=ct(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=ct(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Ot(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),lt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ot(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ot(n.href)+`"]`);if(r)return t.instance=r,lt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),lt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,lt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),lt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,lt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),lt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[rt]||a[Xe]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,lt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ze(0),this.hiddenUpdates=ze(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Zr(3,null,null,t),e.current=a,a.stateNode=e,t=Qi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ja(a),e}function tp(e){return e?(e=Yr,e):Yr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Na(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Pa(e,r,t),n!==null&&(pu(n,e,t),Fa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Kr(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=Ge(t);var n=Kr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,up(e,t,n,r)}finally{L.p=a,I.T=i}}function lp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,up(e,t,n,r)}finally{L.p=a,I.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ot(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Pe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-De(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Pl&6)&&($l=ye()+500,rd(0,!1))}}break;case 31:case 13:s=Kr(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Wt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=at(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(be()){case G:return 2;case xe:return 8;case K:case Se:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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 Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ot(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=at(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,Je(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,Je(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ut=r,n.target.dispatchEvent(r),Ut=null}else return t=ot(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ot(n);a!==null&&(e.splice(t,3),t-=3,_s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ze]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ze]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[Qe]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=qe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.8`)throw Error(s(527,Lp,`19.2.8`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{q=zp.inject(Rp),J=zp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Bs,a=Vs,o=Hs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,o,Pp),e[Qe]=t.current,xd(e),new Fp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=`clipen:locale`;function f(){if(typeof window>`u`)return`zh-TW`;let e=new URLSearchParams(window.location.search).get(`lang`);if(e===`zh-TW`||e===`en`)return e;try{let e=localStorage.getItem(d);if(e===`zh-TW`||e===`en`)return e}catch{}let t=navigator.languages?.length?navigator.languages:[navigator.language];for(let e of t){let t=(e??``).toLowerCase();if(t.startsWith(`zh`))return`zh-TW`;if(t.startsWith(`en`))return`en`}return`en`}var p=f(),m=p===`en`,h=m?`en-US`:`zh-TW`;typeof document<`u`&&(document.documentElement.lang=p);function g(e,t){return m?t:e}function _(e){if(e===p)return;let t=new URL(window.location.href);try{localStorage.setItem(d,e),t.searchParams.delete(`lang`)}catch{t.searchParams.set(`lang`,e)}window.location.replace(t)}function v(e,t,n){return e===1?t:n}async function y(){return(await S(`/api/production/skills`)).skills}async function b(e,t,n,r,i,a,o,s,c,l){return(await C(`/api/projects/${t}/production/commands/start`,e,{request_id:crypto.randomUUID(),consent:!0,skill_id:n,intent:r,...i?{visual_style_id:i}:{},...a?{font_style_id:a}:{},...o?{target_duration_seconds:o}:{},...s?{music_asset_id:s}:{},...c?{template_id:c}:{},...l?{aspect_ratio:l}:{}})).run}var x=class extends Error{code;status;constructor(e,t,n){super(t),this.name=`ApiError`,this.code=e,this.status=n}};async function S(e,t={}){let n=new Headers(t.headers);n.set(`X-Clipen-Locale`,p);let r=await fetch(e,{credentials:`same-origin`,cache:`no-store`,...t,headers:n});if(r.status===204)return null;let i;try{i=await r.json()}catch{throw new x(`response_invalid`,g(`Clipen 回傳了無法辨識的資料。`,`Clipen sent back something it could not read.`),r.status)}if(!r.ok){let e=i;throw new x(typeof e.error?.code==`string`?e.error.code:`request_failed`,typeof e.error?.message==`string`?e.error.message:g(`Clipen 無法完成這次操作。`,`Clipen could not finish that.`),r.status)}return i}async function C(e,t,n){return S(e,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Clipen-CSRF":t},body:JSON.stringify(n)})}function w(e,t,n,r){return new Promise((i,a)=>{let o=new XMLHttpRequest;o.open(`POST`,`/api/projects/${t}/footage?filename=${encodeURIComponent(n.name)}`),o.setRequestHeader(`Content-Type`,`application/octet-stream`),o.setRequestHeader(`X-Clipen-CSRF`,e),o.setRequestHeader(`X-Clipen-Locale`,p),o.upload.onprogress=e=>{e.lengthComputable&&r?.(e.loaded/e.total)},o.onerror=()=>a(new x(`request_failed`,g(`Clipen 沒有回應,請確認它還開著。`,`Clipen did not answer; check it is still running.`),0)),o.onload=()=>{let e={};try{e=JSON.parse(o.responseText)}catch{}o.status>=200&&o.status<300&&typeof e.name==`string`?i({name:e.name,size_bytes:e.size_bytes??0}):a(new x(typeof e.error?.code==`string`?e.error.code:`request_failed`,typeof e.error?.message==`string`?e.error.message:g(`Clipen 無法完成這次操作。`,`Clipen could not finish that.`),o.status))},o.send(n)})}async function T(){await S(`/api/session/connect`,{method:`POST`})}async function E(){return S(`/api/system/power`)}async function D(){return S(`/api/provider/account`)}function O(){return S(`/api/provider/model-selection`)}async function k(e,t){await C(`/api/provider/commands/choose-model`,e,{model:t})}async function A(){return S(`/api/status`)}async function j(){return(await S(`/api/projects`)).projects}async function M(e){return(await S(`/api/projects/${e}`)).project}async function N(e,t){return(await C(`/api/commands/create-project`,e,{request_id:crypto.randomUUID(),name:t})).project}async function P(e,t,n,r){return(await C(`/api/projects/${t.project_id}/commands/update-details`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,name:n,brief:r})).project}async function F(e,t){return(await C(`/api/system/commands/select-directory`,e,{request_id:crypto.randomUUID(),role:t}))?.selection??null}async function I(e,t,n,r){return(await C(`/api/projects/${t.project_id}/commands/set-directory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,role:n,selection_token:r})).project}async function L(e,t,n){return(await C(`/api/projects/${t.project_id}/commands/remove-directory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,role:n})).project}async function ee(e,t,n){return(await C(`/api/projects/${t.project_id}/commands/delete`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,confirmation_name:n})).deleted_project_id}async function R(e){return S(`/api/projects/${e}/inventory`)}async function te(e,t,n=0){return S(`/api/projects/${e}/inventories/${t}?offset=${n}&limit=100`)}async function z(e,t){return(await C(`/api/projects/${t.project_id}/commands/start-inventory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision})).inventory}async function B(e,t,n){return(await C(`/api/projects/${t}/inventories/${n}/commands/cancel`,e,{})).inventory}async function V(e){return S(`/api/projects/${e}/analysis`)}async function ne(e){return S(`/api/projects/${e}/edit-agent`)}async function re(e,t,n){return(await C(`/api/projects/${t}/edit-agent/${n}/commands/cancel`,e,{})).run}async function ie(e,t,n=0,r={}){let i=new URLSearchParams({offset:String(n),limit:`12`});return r.tripDay&&i.set(`trip_day`,String(r.tripDay)),r.reviewState&&r.reviewState!==`all`&&i.set(`review_state`,r.reviewState),(await S(`/api/projects/${e}/analyses/${t}/results?${i.toString()}`)).results}async function H(e,t,n,r,i=0){return(await S(`/api/projects/${e}/analyses/${t}/items/${n}/${r}/transcript?offset=${i}&limit=100`)).transcript}async function ae(e,t,n){return(await S(`/api/projects/${e}/annotations/${t}/${n}`)).annotation}async function oe(e,t,n){return(await C(`/api/projects/${t}/annotation/commands/save`,e,{request_id:crypto.randomUUID(),version_id:n.material.version_id,stream_index:n.transcript?.stream_index??-1,expected_material_revision:n.material.revision,expected_transcript_revision:n.transcript?.revision??0,material:{people:n.material.people,location:n.material.location,trip_day:n.material.trip_day,day_part:n.material.day_part,note:n.material.note,usage:n.material.usage},transcript:n.transcript&&{source_revision_id:n.transcript.source_revision_id,confirmed:n.transcript.confirmed,discarded:n.transcript.discarded,corrections:n.transcript.corrections}})).annotation}async function se(e){return(await C(`/api/system/commands/remove-asr`,e,{})).runtime}async function ce(e,t,n){return(await C(`/api/projects/${t.project_id}/commands/start-analysis`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,scope_id:n})).analysis}async function le(e,t,n){return(await C(`/api/projects/${t}/analyses/${n}/commands/cancel`,e,{})).analysis}async function ue(e,t,n){return(await C(`/api/projects/${t}/analyses/${n}/commands/resume`,e,{request_id:crypto.randomUUID()})).analysis}function de(e,t=0){return S(`/api/projects/${e}/evidence?offset=${t}`)}function fe(e,t,n,r){return C(`/api/projects/${e}/evidence/commands/${n}`,t,r)}async function pe(e,t,n){return(await C(`/api/projects/${encodeURIComponent(t)}/production/commands/resume/${encodeURIComponent(n)}`,e,{consent:!0})).run}function me(e,t){return S(`/api/projects/${e}/production/${t}/workbench`)}function U(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`restore_revision`,arguments:{revision_id:i,summary:g(`使用者還原影片版本`,`Restored an earlier version`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function he(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`edit_component`,arguments:{...i,summary:g(`使用者修改元件`,`Edited a graphic`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function ge(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`edit_caption`,arguments:{...i,summary:g(`使用者修改字幕`,`Edited a caption`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function _e(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`edit_component_look`,arguments:{...i,summary:g(`使用者修改元件外觀`,`Changed a graphic's look`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function ve(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`remove_program_component`,arguments:{element_id:i,summary:g(`使用者刪除元件`,`Removed a graphic`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function W(e,t,n,r){return C(`/api/projects/${t}/production/${n}/workbench/render`,e,{expected_revision_id:r})}function ye(e,t,n,r,i,a,o){return C(`/api/projects/${t}/production/${n}/workbench/refine`,e,{request_id:crypto.randomUUID(),expected_revision_id:r,instruction:i,consent:!0,...a?{music_asset_id:a}:{},...o===void 0?{}:{expected_references_version:o}})}async function be(e){return(await S(`/api/projects/${e}/production/music`)).assets}async function G(e,t,n){return(await S(`/api/projects/${t}/production/music?filename=${encodeURIComponent(n.name)}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`,"X-Clipen-CSRF":e},body:n})).asset}function xe(e,t=0){return S(`/api/production/prompts?${new URLSearchParams({offset:String(t),limit:`30`,...e?{project_id:e}:{}})}`)}function K(e,t,n,r){return C(`/api/projects/${t}/production/prompts`,e,{request_id:crypto.randomUUID(),kind:n,text:r})}function Se(e,t,n,r,i,a,o,s){return S(`/api/projects/${t}/production/${n}/workbench/frame`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Clipen-CSRF":e},body:JSON.stringify({expected_revision_id:r,frame:i,...o?{component:o}:{},...s?{slip:s}:{}}),signal:a})}function Ce(e,t,n,r,i){return C(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`slip_clip`,arguments:{...i,summary:g(`使用者微調鏡頭片段`,`Slipped a shot`)},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function we(e,t,n,r,i,a){return C(`/api/projects/${t}/production/${n}/workbench/reference`,e,{expected_revision_id:r,expected_version:i,mutation_id:crypto.randomUUID(),...a})}var Te=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),q=e(((e,t)=>{t.exports=Te()}))(),J=m?{minimal:`minimal`,low:`low`,medium:`medium`,high:`high`,xhigh:`very high`,max:`max`,ultra:`ultra`}:{minimal:`最低`,low:`低`,medium:`中`,high:`高`,xhigh:`很高`,max:`最高`,ultra:`極高`},Ee=m?{five_hour:`5-hour limit`,weekly:`Weekly limit`,other:`Usage`}:{five_hour:`5 小時額度`,weekly:`每週額度`,other:`額度`};function De(e){if(!e)return null;let t=new Date(e*1e3),n=t.getTime()-Date.now()<864e5?t.toLocaleTimeString(h,{hour12:!1,hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString(h,{month:`numeric`,day:`numeric`});return g(`${n} 重置`,`resets ${n}`)}function Oe(e){return Math.max(0,100-e.used_percent)}function ke({label:e,ready:t,providerReady:n,providerName:r,csrf:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(``),_=(0,l.useRef)(0),v=(0,l.useCallback)(()=>{_.current++},[]),y=(0,l.useCallback)(async()=>{let e=++_.current;try{let t=await D();e===_.current&&o(t)}catch{}},[]);(0,l.useEffect)(()=>{if(!n)return;let e=window.setTimeout(y,0),t=window.setInterval(y,12e4);return window.addEventListener(`focus`,y),()=>{v(),window.clearTimeout(e),window.clearInterval(t),window.removeEventListener(`focus`,y)}},[n,y,v]),(0,l.useEffect)(()=>{if(!n||!s)return;let e=!1,t=async()=>{try{let t=await O();e||d(t.locked)}catch{e||d(null)}};t();let r=window.setInterval(t,1e3);return()=>{e=!0,window.clearInterval(r)}},[s,n]);async function b(e){if(!(u!==!1||f)){p(!0),h(``);try{await k(i,e||null),v(),o(t=>t&&{...t,selected_model:e||null}),await y()}catch(e){if(e instanceof x&&e.code===`model_selection_locked`){d(!0);return}h(e instanceof Error?e.message:g(`無法儲存模型選擇。`,`Could not save the model selection.`))}finally{p(!1)}}}let S=a?.model,C=r===`Claude`?`Claude Code`:r,w=a?.quota,T=w?.windows[0],E=w?.limited||T!==void 0&&Oe(T)<20,A=t?n?[r,S?.name].filter(Boolean).join(` · `):g(`${r} 需要處理`,`${r} needs attention`):e,j=w?.limited?g(`額度已用完`,`Limit reached`):T?g(`剩 ${Oe(T)}%`,`${Oe(T)}% left`):null;return!t||!n?(0,q.jsxs)(`div`,{className:`connection-badge`,"aria-live":`polite`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`}),A]}):(0,q.jsxs)(`details`,{className:`provider-badge`,onToggle:e=>{d(null),c(e.currentTarget.open)},children:[(0,q.jsxs)(`summary`,{className:`connection-badge is-ready ${E?`is-low`:``}`,"aria-label":g(`目前使用 ${A}${j?`,${j}`:``},查看模型與額度`,`Using ${A}${j?`, ${j}`:``}. See model and usage`),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`}),A,j&&(0,q.jsx)(`em`,{className:`provider-quota-pill`,children:j})]}),(0,q.jsxs)(`div`,{className:`provider-popover`,children:[a&&(!!a.models?.length||a.selected_model)&&(0,q.jsxs)(`div`,{className:`provider-model-setting`,children:[(0,q.jsx)(`label`,{htmlFor:`provider-model`,children:g(`下次啟動的模型`,`Model for new AI runs`)}),(0,q.jsxs)(`select`,{id:`provider-model`,value:a.selected_model??``,disabled:f||u!==!1||!i,onChange:e=>void b(e.target.value),children:[(0,q.jsx)(`option`,{value:``,children:g(`沿用 ${C} 設定`,`Use ${C} settings`)}),a.selected_model&&!a.models?.some(({id:e})=>e===a.selected_model)&&(0,q.jsx)(`option`,{value:a.selected_model,disabled:!0,children:a.selected_model}),a.models?.map(({id:e,name:t})=>(0,q.jsx)(`option`,{value:e,children:t},e))]}),u===!0&&(0,q.jsx)(`p`,{role:`status`,children:g(`AI 正在執行,完成後即可切換。`,`You can switch models when the AI finishes.`)}),f&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在儲存…`,`Saving…`)}),m&&(0,q.jsx)(`p`,{role:`alert`,children:m})]}),a?.provider.id===`codex`&&!a.models?.length&&(0,q.jsx)(`p`,{children:g(`暫時讀不到 Codex 模型清單。`,`The Codex model list is temporarily unavailable.`)}),(0,q.jsxs)(`dl`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`AI`}),(0,q.jsxs)(`dd`,{children:[r,w?.plan?g(`(${w.plan.charAt(0).toUpperCase()}${w.plan.slice(1)} 方案)`,` (${w.plan.charAt(0).toUpperCase()}${w.plan.slice(1)} plan)`):``]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`模型`,`Model`)}),(0,q.jsx)(`dd`,{children:S?(0,q.jsxs)(q.Fragment,{children:[S.name,S.effort?g(`,推理強度${J[S.effort]??S.effort}`,`, ${J[S.effort]??S.effort} reasoning`):``]}):g(`第一次製作後顯示`,`Shown after the first film`)})]}),w?.source===`live`&&w.windows.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:Ee[e.kind]}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`meter`,{min:0,max:100,low:20,high:50,optimum:100,value:Oe(e),"aria-label":g(`${Ee[e.kind]}剩 ${Oe(e)}%`,`${Ee[e.kind]}: ${Oe(e)}% left`)}),(0,q.jsxs)(`span`,{children:[g(`剩 ${Oe(e)}%`,`${Oe(e)}% left`),De(e.resets_at)?g(`,${De(e.resets_at)}`,`, ${De(e.resets_at)}`):``]})]})]},e.kind)),w?.source===`last_run`&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`額度`,`Usage`)}),(0,q.jsxs)(`dd`,{children:[w.limited?g(`已達上限`,`Limit reached`):w.warning?g(`快用完了`,`Almost used up`):g(`可以使用`,`Available`),De(w.resets_at)?g(`,${De(w.resets_at)}`,`, ${De(w.resets_at)}`):``]})]}),!w&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`額度`,`Usage`)}),(0,q.jsx)(`dd`,{children:r===`Claude`?g(`等下次製作時回報`,`Reported on the next film`):g(`暫時讀不到`,`Not available right now`)})]})]}),w?.source===`last_run`&&(0,q.jsx)(`p`,{children:g(`Claude Code 不提供剩餘百分比,這是最近一次製作時回報的狀態。`,`Claude Code does not report a percentage left; this is what it said during the last film.`)}),S?.source===`clipen`&&S.unavailable&&(0,q.jsx)(`p`,{children:g(`此模型已不在帳號清單中,請選擇其他模型。`,`This model is no longer listed for your account. Select another model.`)}),S?.source!==`clipen`&&S?.unavailable&&(0,q.jsx)(`p`,{children:g(`你在 ${C} 設定的模型 ${S.unavailable} 目前不能用在這個帳號,改用預設模型${S.source===`codex_config`?`;推理強度沿用你的設定`:``}。`,`The model you set in ${C}, ${S.unavailable}, is not available on this account, so the default model is used${S.source===`codex_config`?` with your reasoning setting`:``}.`)}),S&&!S.unavailable&&(S.source===`codex_config`||S.source===`claude_config`)&&(0,q.jsx)(`p`,{children:g(`沿用你在 ${C} 設定的模型與推理強度。`,`Uses the model and reasoning you set in ${C}.`)}),S&&S.source==="default"&&!S.unavailable&&(0,q.jsx)(`p`,{children:g(`你沒有在 ${C} 設定模型,使用帳號的預設模型。`,`No model is set in ${C}, so your account's default is used.`)}),!S&&r===`Claude`&&(0,q.jsx)(`p`,{children:g(`你沒有在 Claude Code 設定模型;第一次製作後會顯示實際使用的模型。`,`No model is set in Claude Code; the model actually used shows after the first film.`)})]})]})}var Ae=(0,l.createContext)({name:`Codex`});function je(){return(0,l.useContext)(Ae)}var Me={codex:`Codex`,claude:`Claude`};function Ne(e){return e&&Me[e]||`AI`}var Pe=m?{running:`Working`,succeeded:`Done`,failed:`Not finished`,cancelled:`Stopped`,interrupted:`Interrupted`}:{running:`處理中`,succeeded:`已完成`,failed:`未完成`,cancelled:`已停止`,interrupted:`已中斷`},Fe={evidence_disk_full:g(`Clipen 儲存磁碟空間不足,請釋放空間後再試;毛片不會被刪除。`,`Clipen's disk is full. Free some space and try again; your footage is not deleted.`),source_changed:g(`來源檔案已改變,請重新檢查素材。`,`The source file changed. Check the footage again.`),time_metadata_missing:g(`缺少可靠的來源時間資訊,未推測時間位置。`,`There is no reliable source timing, so no time was guessed.`),frame_decode_failed:g(`無法解碼畫面。`,`Could not decode the picture.`),scene_decode_failed:g(`無法取得場景變化。`,`Could not read scene changes.`),frame_time_mapping_invalid:g(`無法可靠對應來源時間,結果未採用。`,`Could not map to source time reliably; the result was not used.`),audio_decode_failed:g(`無法解碼音訊。`,`Could not decode the audio.`),evidence_scope_changed:g(`素材範圍已改變,請重新擷取。`,`The footage changed. Sample it again.`),outcome_unknown:g(`中斷時無法確認 AI 是否完成;不會自動重送,可能已使用額度。`,`It stopped before Clipen could tell whether the AI finished. It is not resent automatically; usage may have been spent.`),controller_stopped:g(`Clipen 已關閉,已完成的本機成果保留。`,`Clipen closed; finished local results are kept.`)};function Ie(e,t){if(!e.source)return g(`時間未知`,`time unknown`);let n=BigInt(t)-BigInt(e.source.start_pts),r=Number(n)*e.source.time_base.num/e.source.time_base.den;return g(`${r.toFixed(2)} 秒`,`${r.toFixed(2)} s`)}function Le({projectId:e,csrf:t,inventoryId:n}){let r=je(),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(0),[h,_]=(0,l.useState)(0),v=i?.latest?.state===`running`||i?.latest?.observations.some(e=>e.state===`running`);(0,l.useEffect)(()=>{let t=!0,n;async function r(){try{let i=await de(e,h);if(!t)return;a(i),s(``),(i.latest?.state===`running`||i.latest?.observations.some(e=>e.state===`running`))&&(n=setTimeout(()=>void r(),1500))}catch(e){t&&s(e instanceof Error?e.message:g(`無法讀取分析狀態。`,`Could not read the analysis status.`))}}return r(),()=>{t=!1,clearTimeout(n)}},[e,n,v,p,h]);async function y(n,r){if(!(c||!i)){u(!0),s(``);try{await fe(e,t,n,n===`start`?{request_id:crypto.randomUUID(),expected_revision:i.scope?.project_revision,scope_id:i.scope?.scope_id}:n===`observe`?{run_id:i.latest?.run_id,request_id:crypto.randomUUID(),item_key:r,consent:!0}:{run_id:i.latest?.run_id}),a(await de(e,h)),f(null),m(e=>e+1)}catch(e){s(e instanceof Error?e.message:g(`操作失敗,請重新讀取狀態。`,`That failed. Read the status again.`))}finally{u(!1)}}}let b=i?.latest,x=Math.max(0,(i?.limits.ai_calls_per_run??3)-(b?.observations.length??0));return(0,q.jsxs)(`section`,{className:`analysis-section evidence-section`,"aria-labelledby":`evidence-title`,children:[(0,q.jsx)(`div`,{className:`analysis-heading`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`畫面與聲音證據`,`Picture and sound evidence`)}),(0,q.jsx)(`h2`,{id:`evidence-title`,children:g(`先看取樣,再決定是否交給 AI`,`See the samples, then decide whether to show the AI`)})]})}),(0,q.jsx)(`p`,{children:g(`在本機取樣代表畫面與音量,不花 AI 額度,也不改動毛片。`,`Samples key frames and loudness on this Mac; no AI usage, and your footage is untouched.`)}),o&&(0,q.jsxs)(`div`,{role:`alert`,children:[(0,q.jsx)(`p`,{children:o}),(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,onClick:()=>m(e=>e+1),children:g(`重新讀取狀態`,`Read the status again`)})]}),!i&&!o&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在讀取證據分析狀態…`,`Reading the evidence status…`)}),i?.blocked_reason&&(0,q.jsx)(`p`,{children:i.blocked_reason}),i?.scope&&(0,q.jsxs)(`div`,{className:`evidence-actions`,children:[(0,q.jsx)(`span`,{children:g(`${i.scope.total} 個影音串流`,`${i.scope.total} audio and video streams`)}),(0,q.jsx)(`button`,{className:`button primary`,type:`button`,disabled:c||v,onClick:()=>void y(`start`),children:b?g(`更新本機證據`,`Update the samples`):g(`擷取本機證據`,`Take samples`)}),v&&(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c,onClick:()=>void y(`cancel`),children:g(`停止分析`,`Stop`)}),b&&!b.stale&&[`interrupted`,`cancelled`].includes(b.state)&&(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c||v,onClick:()=>void y(`resume`),children:g(`接續本機擷取`,`Continue sampling`)})]}),b&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{role:`status`,children:g(`本機擷取:${Pe[b.state]??b.state} · ${b.completed_count} / ${b.total} 個串流已處理 · ${b.issue_count} 個需注意`,`Sampling: ${Pe[b.state]??b.state} · ${b.completed_count} of ${b.total} streams done · ${b.issue_count} need attention`)}),b.state===`running`&&b.progress.display_name&&(0,q.jsxs)(`p`,{role:`status`,children:[g(`正在處理 ${b.progress.display_name}:`,`Working on ${b.progress.display_name}: `),b.progress.phase===`frames`?g(`取樣畫面 ${b.progress.frames}(動態,上限 ${i.limits.frames_per_stream})`,`sampling frame ${b.progress.frames} (adaptive, up to ${i.limits.frames_per_stream})`):b.progress.phase===`scenes`?g(`讀取全片的稀疏壓縮關鍵幀資訊`,`reading sparse keyframe data across the clip`):g(`量測前 120 秒的音訊能量`,`measuring loudness over the first 120 seconds`)]}),b.state===`running`&&(0,q.jsx)(`progress`,{value:b.completed_count,max:b.total,"aria-label":g(`本機證據擷取進度`,`Sampling progress`)}),b.error_code&&(0,q.jsx)(`p`,{children:Fe[b.error_code]??g(`未完成,已保存的成果仍保留。`,`Not finished; saved results are kept.`)}),b.stale&&(0,q.jsx)(`p`,{role:`alert`,children:g(`以下是舊素材範圍的結果,不能再送出 AI 觀察。請重新擷取。`,`These results are for older footage and cannot go to the AI. Sample again.`)}),(0,q.jsx)(`p`,{children:g(`AI 觀察剩餘 ${x} 次`,`${x} AI looks left`)}),(0,q.jsxs)(`details`,{className:`evidence-samples`,children:[(0,q.jsx)(`summary`,{children:g(`查看取樣畫面與技術資訊`,`Samples and technical details`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{children:g(`每支影片依片長取樣,略過相似畫面,保留 1~${i.limits.frames_per_stream} 張代表畫面;音量只量前 120 秒,不逐幀掃描,也不是完整的影片理解。未變更的成果會重用;本機語音辨識執行中時,擷取會等它。每次 AI 觀察最多 8 張縮圖、120 秒;Token 用量不等於帳號 Quota 百分比,無法保證固定額度成本。`,`Each video is sampled by length, skipping similar frames, keeping 1 to ${i.limits.frames_per_stream} key frames; loudness covers the first 120 seconds only. This is not frame-by-frame and not a full understanding of the video. Unchanged results are reused; sampling waits while local speech recognition runs. Each AI look takes up to 8 thumbnails and 120 seconds; tokens are not a percentage of your plan, so the cost is not fixed.`)}),b.total>b.page_size&&(0,q.jsxs)(`nav`,{className:`evidence-actions`,"aria-label":g(`證據結果分頁`,`Result pages`),children:[(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:h===0||c,onClick:()=>_(e=>Math.max(0,e-b.page_size)),children:g(`上一頁`,`Previous`)}),(0,q.jsx)(`span`,{children:g(`第 ${Math.floor(h/b.page_size)+1} / ${Math.ceil(b.total/b.page_size)} 頁`,`Page ${Math.floor(h/b.page_size)+1} of ${Math.ceil(b.total/b.page_size)}`)}),(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:h+b.page_size>=b.total||c,onClick:()=>_(e=>e+b.page_size),children:g(`下一頁`,`Next`)})]}),b.results.length===0&&b.state===`running`&&(0,q.jsx)(`p`,{children:g(`此頁的串流尚待處理。`,`The streams on this page are still waiting.`)}),b.results.map(t=>{let n=b.observations.find(e=>e.item_key===t.key);return(0,q.jsxs)(`details`,{className:`evidence-item`,children:[(0,q.jsxs)(`summary`,{children:[t.role===`reference`?g(`範例作品`,`Reference`):g(`毛片`,`Footage`),` · `,t.display_name,` · `,t.kind===`video`?g(`${t.frames.length} 張畫面取樣`,`${t.frames.length} frames sampled`):g(`音訊能量`,`loudness`),t.error_code?g(` · 需注意`,` · needs attention`):``]}),t.error_code?(0,q.jsx)(`p`,{role:`alert`,children:Fe[t.error_code]??g(`無法擷取此串流,請確認來源磁碟可讀取。`,`Could not sample this stream. Check the source drive can be read.`)}):(0,q.jsxs)(q.Fragment,{children:[t.kind===`video`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{children:g(`畫面:僅在下列時間點有取樣。語音請見本機逐字稿分析區;圖片無法證明聲音或畫面間的動作;預覽色彩不適合用來判斷精確調色。`,`Picture: sampled only at these times. For speech, see the transcripts; still frames say nothing of sound or motion between them, and preview colour is not good enough for grading.`)}),(0,q.jsx)(`div`,{className:`evidence-frames`,children:t.frames.map((n,r)=>(0,q.jsxs)(`figure`,{children:[(0,q.jsx)(`img`,{loading:`lazy`,width:`240`,height:`160`,src:`/api/projects/${e}/evidence/${b.run_id}/images/${n.artifact_id}`,alt:g(`${t.display_name},${Ie(t,n.pts)}的取樣畫面`,`${t.display_name}, frame at ${Ie(t,n.pts)}`)}),(0,q.jsxs)(`figcaption`,{children:[r+1,` · `,Ie(t,n.pts)]})]},n.artifact_id))}),(0,q.jsx)(`p`,{children:t.scene_error_code?g(`舊版場景變化分析未完成;已取得的畫面取樣仍保留。`,`The older scene-change analysis did not finish; the frames sampled are kept.`):t.keyframe_fallback_code?g(`壓縮關鍵幀資訊無法使用,已自動改用整段時間覆蓋取樣。`,`Keyframe data was not usable, so frames were sampled evenly across the clip instead.`):g(`在全片 ${t.keyframe_candidates?.probe_count??0} 個稀疏時間點讀到 ${t.keyframe_candidates?.candidate_pts.length??0} 個 codec 關鍵幀候選點${t.keyframe_candidates?.candidate_limit_reached?`(已達 256 點上限)`:``},再與整段時間錨點共同選擇;封包大小只代表壓縮內容複雜度,不代表語意或真正換場。`,`Read ${t.keyframe_candidates?.candidate_pts.length??0} codec keyframe candidates at ${t.keyframe_candidates?.probe_count??0} sparse points across the clip${t.keyframe_candidates?.candidate_limit_reached?` (the 256-point limit)`:``}, then chose together with evenly spaced anchors. Packet size reflects compression complexity only, not meaning or real scene changes.`)}),t.keyframe_selection&&(0,q.jsx)(`p`,{children:g(`這支影片去除相似畫面後最多保留 ${t.keyframe_selection.retained_limit??t.keyframe_selection.frame_budget??8} 張;從 ${t.keyframe_selection.candidate_count} 個候選時間點解出 ${t.keyframe_selection.decoded_count??t.keyframe_selection.selected.length} 張,略過 ${t.keyframe_selection.duplicate_count??0} 張相似畫面,並補取 ${t.keyframe_selection.backfill_attempts??0} 張後,保留 ${t.frames.length} 張代表畫面。${t.keyframe_selection.semantic_relevance?`包含本機語意相關性訊號。`:`目前僅使用本機時間、壓縮內容複雜度與縮圖相似度訊號。`}`,`This video keeps up to ${t.keyframe_selection.retained_limit??t.keyframe_selection.frame_budget??8} frames after dropping similar ones: ${t.keyframe_selection.decoded_count??t.keyframe_selection.selected.length} decoded from ${t.keyframe_selection.candidate_count} candidate times, ${t.keyframe_selection.duplicate_count??0} similar ones skipped and ${t.keyframe_selection.backfill_attempts??0} filled in, leaving ${t.frames.length}. ${t.keyframe_selection.semantic_relevance?`Includes a local relevance signal.`:`Uses only local timing, compression complexity and thumbnail similarity.`}`)})]}):(0,q.jsx)(`p`,{children:g(`聲音:已量測 ${t.audio_features?.windows.length??0} 個音訊能量視窗,其中 ${t.audio_features?.windows.filter(e=>e.low_energy).length??0} 個低能量視窗;未判斷音樂、人聲或音效種類。`,`Sound: measured ${t.audio_features?.windows.length??0} loudness windows, ${t.audio_features?.windows.filter(e=>e.low_energy).length??0} of them quiet. Music, voice and effects are not told apart.`)}),(0,q.jsxs)(`p`,{children:[g(`連續覆蓋:`,`Coverage: `),t.coverage?.complete?g(`此聲音串流的能量量測完成`,`loudness measured for the whole stream`):g(`仍有未分析範圍`,`some ranges are not measured yet`),g(`。`,`.`)]}),!!t.coverage?.uncovered.length&&(0,q.jsxs)(`p`,{children:[g(`未連續分析:`,`Not measured: `),t.coverage.uncovered.map(e=>`${Ie(t,e.start_pts)}~${Ie(t,e.end_pts)}`).join(g(`、`,`, `))]}),t.kind===`video`&&!n&&!b.stale&&(0,q.jsx)(q.Fragment,{children:d===t.key?(0,q.jsxs)(`div`,{className:`evidence-consent`,children:[(0,q.jsx)(`p`,{children:g(`將從上方 ${t.frames.length} 張本機縮圖中,依時間平均選出最多 ${i.limits.ai_images_per_call} 張傳給 ${r.name},包含圖片中可見的私人資訊。不會傳送原始影片、音訊、完整逐字稿或 Repo。這會使用 AI 額度;失敗不會自動重試。`,`Up to ${i.limits.ai_images_per_call} of the ${t.frames.length} thumbnails above, spread over time, go to ${r.name}, including any private details they show. No original video, audio, full transcript or repository is sent. This uses AI usage; a failure is not retried automatically.`)}),(0,q.jsx)(`button`,{className:`button primary`,type:`button`,disabled:c||v,onClick:()=>void y(`observe`,t.key),children:g(`同意傳送並開始觀察`,`Agree and send`)}),(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c,onClick:()=>f(null),children:g(`先不要`,`Not now`)})]}):(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c||v||b.state!==`succeeded`||x===0||!i?.provider_available,onClick:()=>f(t.key),children:g(`讓 AI 觀察這批畫面`,`Let the AI look at these frames`)})})]}),n&&(0,q.jsxs)(`div`,{className:`evidence-observation`,children:[(0,q.jsxs)(`h3`,{children:[g(`AI 圖片觀察:`,`AI look: `),Pe[n.state]??n.state]}),n.error_code&&(0,q.jsx)(`p`,{children:Fe[n.error_code]??g(`此次觀察未完成,不會自動重送。`,`This look did not finish and is not resent automatically.`)}),(0,q.jsx)(`p`,{children:n.usage?g(`實際 input ${n.usage.input_tokens.toLocaleString()} · cached input ${n.usage.cached_input_tokens.toLocaleString()} · output ${n.usage.output_tokens.toLocaleString()} tokens`,`Actual usage: ${n.usage.input_tokens.toLocaleString()} input · ${n.usage.cached_input_tokens.toLocaleString()} cached · ${n.usage.output_tokens.toLocaleString()} output tokens`):g(`尚無可確認的 Token 用量,不代表沒有消耗。`,`Token usage is not known yet; that does not mean none was used.`)}),n.result&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`ol`,{children:n.result.observations.map(e=>(0,q.jsxs)(`li`,{children:[e.description,(0,q.jsxs)(`p`,{children:[g(`不確定處:`,`Unsure about: `),e.uncertainty]})]},e.index))}),(0,q.jsx)(`h4`,{children:t.role===`reference`?g(`範例風格證據`,`Reference style`):g(`畫面風格觀察`,`Visual style`)}),(0,q.jsx)(`p`,{children:n.result.style_summary}),(0,q.jsxs)(`p`,{children:[g(`限制:`,`Limits: `),n.result.limitations]})]})]})]},t.key)})]})]})]})]})}var Re=[{value:`dawn`,label:g(`清晨`,`Dawn`)},{value:`morning`,label:g(`早上`,`Morning`)},{value:`noon`,label:g(`中午`,`Noon`)},{value:`afternoon`,label:g(`下午`,`Afternoon`)},{value:`evening`,label:g(`傍晚`,`Evening`)},{value:`night`,label:g(`晚上`,`Night`)},{value:`late_night`,label:g(`深夜`,`Late night`)}],ze=[{value:`normal`,label:g(`交給 AI 判斷`,`Let the AI decide`),help:g(`依剪輯計畫選用`,`Used as the edit needs`)},{value:`must_use`,label:g(`優先使用`,`Use it`),help:g(`這段對成片很重要`,`This matters for the film`)},{value:`ambient_only`,label:g(`只取畫面`,`Picture only`),help:g(`不採用這段逐字稿`,`Ignore what is said`)},{value:`exclude`,label:g(`不要使用`,`Don't use`),help:g(`排除這段素材`,`Leave this clip out`)}];function Be(e){return[...new Set(e.split(/[,,、\n]/).map(e=>e.trim()).filter(Boolean))]}function Ve(e){return e.material.revision===0?{...e,material:{...e.material,location:e.suggestion.location,trip_day:e.suggestion.trip_day,day_part:e.suggestion.day_part}}:e}function He({csrf:e,projectId:t,initial:n,transcript:r,mediaKind:i,formatTime:a,onSaved:o}){let s=(0,l.useMemo)(()=>Ve(n),[n]),[c,u]=(0,l.useState)(s),[d,f]=(0,l.useState)(n.material.people.join(`、`)),[p,h]=(0,l.useState)(!1),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),C=(0,l.useRef)(null),w=(0,l.useMemo)(()=>new Map(c.transcript?.corrections.map(e=>[e.ordinal,e.text])??[]),[c.transcript?.corrections]),T=(0,l.useMemo)(()=>({...c,material:{...c.material,people:Be(d)}}),[c,d]),E=JSON.stringify(T)!==JSON.stringify(s),D=n.material.revision===0&&(n.transcript?.revision??0)===0,O=Re.find(e=>e.value===c.material.day_part)?.label,k=[c.material.trip_day?g(`第 ${c.material.trip_day} 天`,`Day ${c.material.trip_day}`):null,O??null,c.material.location,...Be(d).slice(0,2)].filter(Boolean).join(` · `);function A(e,t){v(!1),u(n=>({...n,material:{...n.material,[e]:t}}))}function j(e,t,n){if(!c.transcript)return;let r=c.transcript.corrections.filter(t=>t.ordinal!==e);n!==t&&r.push({ordinal:e,text:n}),r.sort((e,t)=>e.ordinal-t.ordinal),v(!1),u(e=>({...e,transcript:e.transcript&&{...e.transcript,corrections:r,confirmed:!1}}))}async function M(n){h(!0),b(null);try{let r=await oe(e,t,n);u(r),f(r.material.people.join(`、`)),v(!0),o(r)}catch(e){b(e instanceof Error?e.message:g(`無法保存素材資訊。`,`Could not save the clip details.`))}finally{h(!1)}}async function N(){await M(T)}async function P(e){if(!c.transcript||e&&!window.confirm(g(`確定要移除這份逐字稿?
10
+
11
+ 素材與原始辨識紀錄不會被刪除,之後仍可恢復;移除後 AI 不會使用這份文字。`,`Remove this transcript?
12
+
13
+ The clip and the original recognition are kept and can be restored; once removed, the AI will not use this text.`)))return;let t={...T,transcript:{...c.transcript,discarded:e,confirmed:!e&&c.transcript.confirmed}};u(t),v(!1),await M(t)}function F(e){if(!C.current||!r)return;let t=Number(BigInt(e)-BigInt(r.source_start_pts));C.current.currentTime=Math.max(0,t*r.time_base.num/r.time_base.den),C.current.play()}return(0,q.jsxs)(`div`,{className:`annotation-editor`,children:[(0,q.jsxs)(`div`,{className:`annotation-workbench`,children:[(0,q.jsxs)(`div`,{className:`material-player`,children:[i===`video`?(0,q.jsx)(`video`,{ref:e=>{C.current=e},controls:!0,preload:`metadata`,onError:()=>S(!0),src:`/api/projects/${t}/media/${n.material.version_id}`,children:g(`目前的瀏覽器無法直接播放這個素材。`,`This browser cannot play this clip directly.`)}):(0,q.jsx)(`audio`,{ref:e=>{C.current=e},controls:!0,preload:`metadata`,onError:()=>S(!0),src:`/api/projects/${t}/media/${n.material.version_id}`,children:g(`目前的瀏覽器無法直接播放這個素材。`,`This browser cannot play this clip directly.`)}),(0,q.jsx)(`p`,{children:x?g(`無法直接播放。請確認外接硬碟仍連接;若素材編碼不受瀏覽器支援,後續可建立本機預覽檔。`,`Cannot play it directly. Check the external drive is still connected; if the browser cannot decode the clip, a local preview can be made later.`):g(`本機唯讀播放,不會上傳或建立副本。`,`Played locally and read-only; nothing is uploaded or copied.`)})]}),(0,q.jsxs)(`div`,{className:`annotation-decision`,children:[(0,q.jsxs)(`div`,{className:`annotation-intro`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`整理這段素材`,`About this clip`)}),(0,q.jsx)(`p`,{children:g(`先決定怎麼使用,再補充必要線索。`,`Decide how to use it, then add any clues it needs.`)})]}),(0,q.jsx)(`div`,{className:`annotation-origin`,children:n.material.revision===0&&n.suggestion.capture_time&&(0,q.jsxs)(`span`,{children:[g(`拍攝於 `,`Shot `),n.suggestion.capture_time.replace(`T`,` `).slice(5,16)]})})]}),(0,q.jsxs)(`fieldset`,{className:`annotation-usage`,children:[(0,q.jsx)(`legend`,{children:g(`這段要怎麼用?`,`How should it be used?`)}),(0,q.jsx)(`div`,{className:`usage-options`,children:ze.map(e=>(0,q.jsxs)(`label`,{className:c.material.usage===e.value?`is-selected`:``,children:[(0,q.jsx)(`input`,{type:`radio`,name:`usage-${n.material.version_id}`,value:e.value,checked:c.material.usage===e.value,onChange:()=>A(`usage`,e.value)}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{children:e.label}),(0,q.jsx)(`small`,{children:e.help})]})]},e.value))})]})]})]}),(0,q.jsxs)(`details`,{className:`annotation-context-disclosure`,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`場景資訊與備註`,`Scene details and notes`)}),(0,q.jsx)(`span`,{children:k||g(`沒有補充資訊`,`Nothing added`)})]}),(0,q.jsxs)(`span`,{className:`disclosure-action`,children:[(0,q.jsx)(`span`,{className:`when-closed`,children:g(`選填 · 展開`,`Optional · open`)}),(0,q.jsx)(`span`,{className:`when-open`,children:g(`收合`,`Close`)})]})]}),(0,q.jsxs)(`div`,{className:`annotation-context`,children:[(0,q.jsxs)(`div`,{className:`annotation-grid compact`,children:[(0,q.jsxs)(`label`,{className:`annotation-field`,children:[(0,q.jsx)(`span`,{children:g(`人物`,`People`)}),(0,q.jsx)(`input`,{value:d,maxLength:800,placeholder:g(`例如:我、朋友`,`For example: me, a friend`),onChange:e=>{f(e.target.value),v(!1)}})]}),(0,q.jsxs)(`label`,{className:`annotation-field`,children:[(0,q.jsxs)(`span`,{children:[g(`地點`,`Place`),` `,n.material.revision===0&&n.suggestion.location&&(0,q.jsx)(`small`,{className:`auto-label`,children:g(`自動`,`auto`)})]}),(0,q.jsx)(`input`,{value:c.material.location??``,maxLength:160,placeholder:g(`未指定`,`Not set`),onChange:e=>A(`location`,e.target.value||null)})]}),(0,q.jsxs)(`label`,{className:`annotation-field`,children:[(0,q.jsxs)(`span`,{children:[g(`旅行日`,`Trip day`),` `,n.material.revision===0&&n.suggestion.capture_time&&(0,q.jsx)(`small`,{className:`auto-label`,children:g(`自動`,`auto`)})]}),(0,q.jsxs)(`div`,{className:`day-input`,children:[(0,q.jsx)(`span`,{children:g(`第`,`Day`)}),(0,q.jsx)(`input`,{"aria-label":g(`旅行第幾天`,`Day of the trip`),type:`number`,min:`1`,max:`365`,value:c.material.trip_day??``,placeholder:`—`,onChange:e=>A(`trip_day`,e.target.value?Number(e.target.value):null)}),!m&&(0,q.jsx)(`span`,{children:`天`})]})]}),(0,q.jsxs)(`label`,{className:`annotation-field`,children:[(0,q.jsxs)(`span`,{children:[g(`時段`,`Time of day`),` `,n.material.revision===0&&n.suggestion.capture_time&&(0,q.jsx)(`small`,{className:`auto-label`,children:g(`自動`,`auto`)})]}),(0,q.jsxs)(`select`,{value:c.material.day_part??``,onChange:e=>A(`day_part`,e.target.value||null),children:[(0,q.jsx)(`option`,{value:``,children:g(`未指定`,`Not set`)}),Re.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),(0,q.jsxs)(`label`,{className:`annotation-field annotation-note`,children:[(0,q.jsxs)(`span`,{children:[g(`給剪輯 AI 的備註 `,`A note for the editing AI `),(0,q.jsx)(`small`,{children:g(`選填`,`optional`)})]}),(0,q.jsx)(`textarea`,{rows:2,maxLength:2e3,value:c.material.note,placeholder:g(`例如:進店前的轉場,希望保留笑聲`,`For example: the transition before we walk in; keep the laughter`),onChange:e=>A(`note`,e.target.value)}),(0,q.jsxs)(`small`,{children:[c.material.note.length.toLocaleString(),` / 2,000`]})]})]})]}),r&&c.transcript&&(0,q.jsxs)(`div`,{className:`transcript-review`,children:[c.transcript.stale&&(0,q.jsx)(`p`,{className:`annotation-stale`,role:`status`,children:g(`逐字稿已重新分析;舊修正沒有自動套用,請依目前文字重新核對。`,`The transcript was analysed again; earlier corrections were not carried over. Check the current text again.`)}),(0,q.jsxs)(`div`,{className:`transcript-review-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:c.transcript.discarded?g(`逐字稿已移除`,`Transcript removed`):g(`核對逐字稿`,`Check the transcript`)}),(0,q.jsx)(`p`,{children:c.transcript.discarded?g(`AI 不會使用這份文字;素材仍可依畫面內容參與剪輯。`,`The AI will not use this text; the clip can still be used for its picture.`):g(`只改錯字;時間碼仍以原始分析為準。`,`Fix typos only; the timing stays as analysed.`)})]}),(0,q.jsxs)(`div`,{className:`transcript-heading-actions`,children:[!c.transcript.discarded&&(0,q.jsxs)(`label`,{className:`confirm-transcript`,children:[(0,q.jsx)(`input`,{type:`checkbox`,disabled:r.next_offset!==null,checked:c.transcript.confirmed,onChange:e=>{v(!1),u(t=>({...t,transcript:t.transcript&&{...t.transcript,confirmed:e.target.checked}}))}}),(0,q.jsx)(`span`,{children:r.next_offset===null?g(`我已核對全部文字`,`I have checked all the text`):g(`載入全部文字後可確認`,`Load all the text to confirm`)})]}),(0,q.jsx)(`button`,{className:`button transcript-discard ${c.transcript.discarded?`restore`:``}`,type:`button`,disabled:p,onClick:()=>void P(!c.transcript?.discarded),children:c.transcript.discarded?g(`恢復逐字稿`,`Restore transcript`):g(`移除逐字稿`,`Remove transcript`)})]})]}),c.transcript.discarded?(0,q.jsxs)(`div`,{className:`transcript-discarded-message`,children:[(0,q.jsx)(`strong`,{children:g(`已從剪輯計畫的文字線索中移除`,`Removed from what the edit reads`)}),(0,q.jsx)(`p`,{children:g(`適合背景談話、路人聲音或與作品無關的收音。原始影片與辨識資料都還在。`,`Good for background chatter, passers-by or sound unrelated to the film. The original video and recognition are still there.`)})]}):(0,q.jsx)(`ol`,{className:`transcript-segments editable`,children:r.segments.map(e=>{let t=w.get(e.ordinal),n=t===``;return(0,q.jsxs)(`li`,{className:n?`is-removed`:``,children:[(0,q.jsx)(`button`,{className:`transcript-seek`,type:`button`,onClick:()=>F(e.start_pts),children:a(e.start_pts)}),n?(0,q.jsxs)(`div`,{className:`transcript-segment-removed`,children:[(0,q.jsx)(`strong`,{children:g(`這段逐字稿已移除`,`This part was removed`)}),(0,q.jsx)(`span`,{children:g(`不會提供給剪輯 AI`,`The editing AI will not see it`)})]}):(0,q.jsx)(`textarea`,{rows:2,"aria-label":g(`逐字稿片段 ${e.ordinal+1}`,`Transcript part ${e.ordinal+1}`),value:t??e.text,onChange:t=>j(e.ordinal,e.text,t.target.value)}),(0,q.jsxs)(`div`,{className:`transcript-segment-actions`,children:[!n&&(0,q.jsx)(`span`,{className:w.has(e.ordinal)?`corrected`:``,children:w.has(e.ordinal)?g(`已修正`,`Corrected`):g(`原始辨識`,`As recognised`)}),(0,q.jsx)(`button`,{type:`button`,className:`transcript-segment-remove ${n?`restore`:``}`,onClick:()=>j(e.ordinal,e.text,n?e.text:``),children:n?g(`恢復這段`,`Restore this part`):g(`移除這段`,`Remove this part`)})]})]},e.ordinal)})})]}),(0,q.jsxs)(`div`,{className:`annotation-actions ${E?`has-changes`:``}`,children:[(0,q.jsxs)(`div`,{"aria-live":`polite`,children:[y&&(0,q.jsx)(`p`,{className:`form-error`,role:`alert`,children:y}),_&&(0,q.jsx)(`p`,{className:`save-success`,children:g(`已保存。AI 製作時會參考這些標註。`,`Saved. The AI uses these notes when it makes the film.`)}),!y&&!_&&E&&(0,q.jsx)(`p`,{className:`unsaved-hint`,children:g(`有尚未保存的修改`,`Unsaved changes`)})]}),E||p?(0,q.jsx)(`button`,{className:`button primary`,type:`button`,disabled:p,onClick:()=>void N(),children:p?g(`正在保存…`,`Saving…`):g(`保存修改`,`Save changes`)}):D?(0,q.jsx)(`button`,{className:`button secondary mark-reviewed`,type:`button`,onClick:()=>void N(),children:g(`標記為已看過`,`Mark as seen`)}):(0,q.jsx)(`span`,{className:`annotation-current`,children:g(`✓ 目前設定已套用`,`✓ Current settings applied`)})]})]})}var Ue={pending:g(`尚未處理`,`Not done`),prepared:g(`等待辨識`,`Waiting`),transcribed:g(`有逐字稿`,`Transcribed`),needs_review:g(`辨識不確定`,`Unsure`),no_audio:g(`沒有音軌`,`No audio`),no_speech:g(`未偵測到人聲`,`No speech`),failed:g(`需要處理`,`Needs attention`)},We={root_changed:g(`外接磁碟重新掛載後的素材位置無法確認,這個項目沒有進行辨識。`,`The footage could not be confirmed after the drive was remounted, so this was not transcribed.`),root_unavailable:g(`目前無法讀取素材磁碟,這個項目沒有進行辨識。`,`The footage drive cannot be read, so this was not transcribed.`),source_changed:g(`分析期間素材有變動,這份結果未被採用。`,`The clip changed during analysis, so this result was not used.`),audio_decode_failed:g(`無法從這個素材讀取音訊。`,`Could not read audio from this clip.`),audio_decode_timeout:g(`音訊準備時間過長,已安全停止這個項目。`,`Preparing the audio took too long and was stopped.`),audio_output_missing:g(`沒有取得可供辨識的音訊。`,`No audio to recognise was produced.`),audio_artifact_too_large:g(`音訊衍生成果超過安全大小限制。`,`The prepared audio is larger than allowed.`),audio_time_mapping_invalid:g(`無法把音訊時間可靠地對回原始素材。`,`The audio timing could not be mapped back to the clip reliably.`),normalized_audio_invalid:g(`轉換後的音訊格式無法驗證。`,`The converted audio could not be verified.`),ffmpeg_unavailable:g(`找不到 FFmpeg,無法準備音訊。`,`FFmpeg was not found, so the audio could not be prepared.`),ffmpeg_unsupported:g(`目前的 FFmpeg 版本不支援這個素材。`,`This FFmpeg version does not support this clip.`),ffmpeg_output_too_large:g(`音訊轉換輸出超過安全大小限制。`,`The audio conversion output is larger than allowed.`),asr_failed:g(`本機語音辨識沒有完成這個項目。`,`Local speech recognition did not finish this one.`),asr_timeout:g(`語音辨識時間過長,已安全停止這個項目。`,`Speech recognition took too long and was stopped.`),asr_result_invalid:g(`語音辨識結果格式無法驗證。`,`The recognition result could not be verified.`),asr_result_too_large:g(`逐字稿結果超過安全大小限制。`,`The transcript is larger than allowed.`),asr_output_too_large:g(`語音辨識輸出超過安全大小限制。`,`The recognition output is larger than allowed.`),asr_model_changed:g(`辨識期間模型內容有變動,結果未被採用。`,`The model changed during recognition, so the result was not used.`),asr_model_unavailable:g(`本機語音辨識模型暫時無法使用。`,`The local speech model is not available right now.`),asr_runtime_unavailable:g(`本機語音辨識環境暫時無法使用。`,`Local speech recognition is not available right now.`),asr_runtime_unsupported:g(`目前的語音辨識環境不受支援。`,`This speech recognition setup is not supported.`),transcript_low_confidence:g(`原始收音與有限的增強比對沒有得到穩定結果,或無法確認人聲是否屬於拍攝主體。這份逐字稿不會被當成可信口語,請搭配畫面與原音確認。`,`The original sound and a limited enhanced pass did not agree, or the voice may not be the person filmed. This transcript is not treated as reliable speech; check it against the picture and sound.`),transcript_quality_unverified:g(`這是舊版產生的逐字稿,品質尚未驗證,請先核對。`,`An older version made this transcript and its quality is not verified. Check it first.`),preparation_item_internal_error:g(`處理這個項目時發生未預期的本機錯誤。`,`An unexpected local error happened on this one.`)},Ge={normal:g(`一般素材`,`Normal`),must_use:g(`優先使用`,`Use it`),exclude:g(`不要使用`,`Don't use`),ambient_only:g(`只取畫面/環境音`,`Picture and ambient sound only`)},Ke={pending:g(`尚未處理`,`Not done`),reviewed:g(`已看過`,`Seen`),confirmed:g(`已核對`,`Checked`),priority:g(`優先使用`,`Use it`),excluded:g(`不要使用`,`Don't use`)};function qe(e){return`${e.version_id}:${e.stream_index}`}function Je(e,t){try{let n=BigInt(e)*BigInt(t.num)*1000n/BigInt(t.den),r=n<0n,i=r?-n:n,a=i/3600000n;i%=3600000n;let o=i/60000n;i%=60000n;let s=i/1000n,c=i%1000n,l=a>0n?`${a}:${o.toString().padStart(2,`0`)}:${s.toString().padStart(2,`0`)}`:`${o}:${s.toString().padStart(2,`0`)}`;return`${r?`−`:``}${l}.${c.toString().padStart(3,`0`)}`}catch{return g(`時間未知`,`time unknown`)}}function Ye({csrf:e,projectId:t,run:n,refreshToken:r=0}){let[i,a]=(0,l.useState)(0),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`all`),[d,f]=(0,l.useState)(0),[p,m]=(0,l.useState)(null),[h,_]=(0,l.useState)({}),[v,y]=(0,l.useState)({}),b=`${n.run_id}:${i}:${o??`all`}:${c}:${r}:${d}`,x=p?.requestKey===b?p:null,S=x?.state===`ready`?x.page??null:null,C=x===null,w=x?.state===`failed`?x.message??g(`無法讀取逐字稿清單。`,`Could not read the transcript list.`):null;(0,l.useEffect)(()=>{let e=!0;return ie(t,n.run_id,i,{tripDay:o,reviewState:c}).then(t=>{e&&m({requestKey:b,state:`ready`,page:t})}).catch(t=>{e&&m({requestKey:b,state:`failed`,message:t instanceof Error?t.message:g(`無法讀取逐字稿清單。`,`Could not read the transcript list.`)})}),()=>{e=!1}},[i,t,b,c,n.run_id,o]);function T(e,r){if(!r)return;let i=qe(e);v[i]||(y(e=>({...e,[i]:{state:`loading`}})),ae(t,e.version_id,e.stream_index).then(e=>y(t=>({...t,[i]:{state:`ready`,annotation:e}}))).catch(e=>y(t=>({...t,[i]:{state:`failed`,message:e instanceof Error?e.message:g(`無法讀取素材資訊。`,`Could not read the clip details.`)}})))),!(![`transcribed`,`needs_review`].includes(e.status)||h[i])&&(_(e=>({...e,[i]:{state:`loading`}})),H(t,n.run_id,e.version_id,e.stream_index).then(e=>{_(t=>({...t,[i]:{state:`ready`,page:e}}))}).catch(e=>{_(t=>({...t,[i]:{state:`failed`,message:e instanceof Error?e.message:g(`無法讀取這份逐字稿。`,`Could not read this transcript.`)}}))}))}function E(e){let r=qe(e),i=h[r];i?.state!==`ready`||!i.page||i.page.next_offset===null||(_(e=>({...e,[r]:{...i,loadingMore:!0}})),H(t,n.run_id,e.version_id,e.stream_index,i.page.next_offset).then(e=>{_(t=>({...t,[r]:{state:`ready`,page:{...e,offset:0,segments:[...i.page.segments,...e.segments]}}}))}).catch(e=>{_(t=>({...t,[r]:{...i,loadingMore:!1,message:e instanceof Error?e.message:g(`無法讀取更多逐字稿。`,`Could not load more of the transcript.`)}}))}))}let D=S?Math.floor(S.offset/S.limit)+1:1,O=S?Math.max(1,Math.ceil(S.total/S.limit)):1;return(0,q.jsxs)(`section`,{className:`transcript-results`,"aria-labelledby":`transcript-results-title`,children:[(0,q.jsxs)(`div`,{className:`transcript-results-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{id:`transcript-results-title`,children:g(`挑重要素材,補充剪輯線索`,`Pick the clips that matter and add clues`)}),(0,q.jsx)(`p`,{children:g(`只處理想放進成片、或 AI 容易誤解的片段,其餘交給 AI 判斷。`,`Only touch clips you want in the film or the AI could misread; leave the rest to the AI.`)})]}),S&&(0,q.jsx)(`span`,{children:g(`共 ${S.total.toLocaleString()} 支素材`,`${S.total.toLocaleString()} clips`)})]}),S&&(0,q.jsxs)(`div`,{className:`review-filters`,"aria-label":g(`篩選素材`,`Filter clips`),children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:g(`旅行日`,`Trip day`)}),(0,q.jsxs)(`select`,{value:o??``,onChange:e=>{a(0),s(e.target.value?Number(e.target.value):null)},children:[(0,q.jsx)(`option`,{value:``,children:g(`全部日期`,`All days`)}),(S.filters?.trip_days??[]).map(e=>(0,q.jsx)(`option`,{value:e.day,children:g(`第 ${e.day} 天(${e.count})`,`Day ${e.day} (${e.count})`)},e.day))]})]}),(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:g(`處理狀態`,`Status`)}),(0,q.jsxs)(`select`,{value:c,onChange:e=>{a(0),u(e.target.value)},children:[(0,q.jsx)(`option`,{value:`all`,children:g(`全部狀態`,`All`)}),(0,q.jsx)(`option`,{value:`pending`,children:g(`尚未處理`,`Not done`)}),(0,q.jsx)(`option`,{value:`reviewed`,children:g(`已處理`,`Done`)})]})]}),(o!==null||c!==`all`)&&(0,q.jsx)(`span`,{children:g(`符合條件:${S.total.toLocaleString()} 支`,`${S.total.toLocaleString()} match`)})]}),C&&(0,q.jsx)(`p`,{className:`transcript-list-state`,role:`status`,children:g(`正在讀取分析結果…`,`Reading the results…`)}),w&&(0,q.jsx)(`p`,{className:`transcript-list-state has-error`,role:`alert`,children:w}),S&&!C&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`transcript-list`,children:[S.items.length===0&&(0,q.jsx)(`p`,{className:`transcript-list-state`,children:g(`這次分析沒有可顯示的項目。`,`Nothing to show from this analysis.`)}),S.items.map(n=>{let r=qe(n),i=h[r],a=v[r],o=[`transcribed`,`needs_review`].includes(n.status),s=n.user_state??`pending`,c=n.source&&n.preview_start_pts?Je(n.preview_start_pts,n.source.time_base):null,l=c===`0:00.000`?null:c,u=[n.role===`reference`?g(`參考作品`,`Reference`):null,n.stream_index>1?g(`音軌 ${n.stream_index}`,`Track ${n.stream_index}`):null].filter(Boolean).join(` · `);return(0,q.jsxs)(`details`,{className:`transcript-item status-${n.status} user-${s}`,onToggle:e=>T(n,e.currentTarget.open),children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`div`,{className:`transcript-item-main`,children:[(0,q.jsx)(`strong`,{children:n.display_name}),u&&(0,q.jsx)(`span`,{children:u}),a?.state===`ready`&&a.annotation&&(0,q.jsxs)(`div`,{className:`annotation-summary`,children:[a.annotation.material.usage!==`normal`&&(0,q.jsx)(`span`,{children:Ge[a.annotation.material.usage]}),a.annotation.material.trip_day&&(0,q.jsx)(`span`,{children:g(`第 ${a.annotation.material.trip_day} 天`,`Day ${a.annotation.material.trip_day}`)}),a.annotation.material.location&&(0,q.jsx)(`span`,{children:a.annotation.material.location}),a.annotation.material.people.map(e=>(0,q.jsx)(`span`,{children:e},e)),a.annotation.transcript?.discarded&&(0,q.jsx)(`span`,{children:g(`逐字稿已移除`,`Transcript removed`)}),a.annotation.transcript?.confirmed&&(0,q.jsx)(`span`,{children:g(`逐字稿已核對`,`Transcript checked`)})]}),n.preview_text&&(0,q.jsxs)(`p`,{children:[n.preview_text,n.preview_truncated?`…`:``]})]}),(0,q.jsxs)(`div`,{className:`transcript-item-meta`,children:[l&&(0,q.jsx)(`span`,{children:g(`${l} 起`,`from ${l}`)}),n.trip_day&&(0,q.jsx)(`span`,{className:`trip-day-badge`,children:g(`第 ${n.trip_day} 天`,`Day ${n.trip_day}`)}),n.transcript_discarded&&(0,q.jsx)(`span`,{className:`user-state state-discarded`,children:g(`逐字稿已移除`,`Transcript removed`)}),s!==`pending`&&(0,q.jsx)(`span`,{className:`user-state state-${s}`,children:Ke[s]}),(0,q.jsx)(`span`,{className:`transcript-status`,children:Ue[n.status]})]})]}),(0,q.jsxs)(`div`,{className:`transcript-item-body`,children:[n.status===`failed`&&(0,q.jsx)(`p`,{className:`transcript-issue`,children:n.issue_code?We[n.issue_code]??g(`這個項目沒有產生可靠逐字稿,可以重新分析後再確認。`,`No reliable transcript came out of this; analyse it again to check.`):g(`這個項目沒有產生可靠逐字稿。`,`No reliable transcript came out of this.`)}),n.status===`no_speech`&&(0,q.jsx)(`p`,{children:g(`這段有音軌,但本機辨識沒有找到可轉錄的人聲。`,`This has audio, but local recognition found no speech to transcribe.`)}),n.status===`no_audio`&&(0,q.jsx)(`p`,{children:g(`這個素材沒有可供語音辨識的音軌。`,`This clip has no audio track to recognise.`)}),n.status===`needs_review`&&(0,q.jsx)(`p`,{className:`transcript-issue`,children:n.issue_code?We[n.issue_code]??We.transcript_low_confidence:We.transcript_low_confidence}),o&&i?.state===`loading`&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在載入逐字稿…`,`Loading the transcript…`)}),o&&i?.state===`failed`&&(0,q.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:i.message}),a?.state===`loading`&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在載入素材資訊…`,`Loading the clip details…`)}),a?.state===`failed`&&(0,q.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:a.message}),a?.state===`ready`&&a.annotation&&(!o||i?.state===`ready`)&&(0,q.jsx)(He,{csrf:e,projectId:t,initial:a.annotation,transcript:i?.page,mediaKind:n.kind,formatTime:e=>Je(e,i?.page?.time_base??{num:1,den:1}),onSaved:e=>{y(t=>({...t,[r]:{state:`ready`,annotation:e}})),f(e=>e+1)}},`${a.annotation.material.revision}:${a.annotation.transcript?.revision??0}`),o&&i?.state===`ready`&&i.page?.next_offset!==null&&(0,q.jsx)(`button`,{className:`button secondary load-transcript`,onClick:()=>E(n),disabled:i.loadingMore,children:i.loadingMore?g(`正在載入…`,`Loading…`):g(`載入更多逐字稿`,`Load more`)}),i?.message&&(0,q.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:i.message})]})]},r)})]}),(0,q.jsxs)(`nav`,{className:`transcript-pagination`,"aria-label":g(`逐字稿結果分頁`,`Transcript pages`),children:[(0,q.jsx)(`button`,{className:`button secondary`,disabled:S.offset===0||C,onClick:()=>a(Math.max(0,S.offset-S.limit)),children:g(`上一頁`,`Previous`)}),(0,q.jsx)(`span`,{children:g(`第 ${D} / ${O} 頁`,`Page ${D} of ${O}`)}),(0,q.jsx)(`button`,{className:`button secondary`,disabled:S.next_offset===null||C,onClick:()=>S.next_offset!==null&&a(S.next_offset),children:g(`下一頁`,`Next`)})]})]})]})}function Xe(){let[e,t]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1,n=()=>void E().then(n=>{e||t(n)}).catch(()=>{});n();let r=window.setInterval(n,6e4);return window.addEventListener(`focus`,n),()=>{e=!0,window.clearInterval(r),window.removeEventListener(`focus`,n)}},[]),e?.on_battery?(0,q.jsxs)(`p`,{className:`power-notice`,role:`note`,children:[(0,q.jsx)(`strong`,{children:g(`Mac 目前使用電池${e.percent===null?``:`(${e.percent}%)`}。`,`Your Mac is on battery${e.percent===null?``:` (${e.percent}%)`}.`)}),g(`製作期間闔上螢幕會讓 Mac 睡著,製作也會跟著暫停;建議先接上電源,或保持螢幕打開。`,` Closing the lid while a film is made puts the Mac to sleep and pauses the work. Plug in, or keep the lid open.`)]}):null}var Ze=o(),Qe=[[`16:9`,16,9,()=>g(`橫式・YouTube`,`Landscape · YouTube`)],[`9:16`,9,16,()=>g(`直式・Reels、Shorts、TikTok`,`Vertical · Reels, Shorts, TikTok`)],[`1:1`,1,1,()=>g(`方形・貼文`,`Square · Posts`)],[`4:5`,4,5,()=>g(`直式貼文・Instagram`,`Portrait post · Instagram`)]];function $e({value:e,disabled:t,onChange:n}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`aspect-picker`,role:`radiogroup`,"aria-label":g(`畫面比例`,`Shape`),children:Qe.map(([r,i,a,o])=>(0,q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e===r,disabled:t,onClick:()=>n(r),children:[(0,q.jsx)(`span`,{className:`aspect-frame`,"aria-hidden":`true`,children:(0,q.jsx)(`span`,{className:`aspect-shape`,style:{aspectRatio:`${i} / ${a}`,[i>=a?`width`:`height`]:`26px`}})}),(0,q.jsx)(`strong`,{children:r}),(0,q.jsx)(`small`,{children:o()})]},r))}),(0,q.jsx)(`p`,{className:`production-hint`,children:g(`之後的每次修改都沿用這個比例。比例不同的素材會裁切填滿,AI 依畫面內容決定保留哪一塊。`,`Every later revision keeps this shape. Footage of another shape is cropped to fill it; the AI chooses which part to keep.`)})]})}var et={provider_protocol_error:{title:`AI 未正常完成製作流程`,reason:`AI 的回傳結果未能完成 Clipen 的交付流程。`,next:`先確認保留的製作結果,再決定是否重新製作。`},delivery_blocked:{title:`影片還沒通過交付檢查`,reason:`AI 做出了草稿,但下方列出的項目還沒通過 Clipen 的檢查,所以不算完成。`,next:`草稿已保留,可以先看影片。到「審片修改」說明要怎麼處理尚待完成的項目,例如快剪段落改用配樂、對話段落保留完整句子。`},provider_stopped_early:{title:`AI 先停下來了`,reason:`AI 在完成前結束了這次工作,通常是需要你提供檔案、做決定,或遇到做不到的要求。`,next:`先看下方 AI 的說明。照說明處理後,到「審片修改」再送出一次修改;如果只是中途停下,也可以按「繼續這份草稿」。`},provider_usage_limit:{title:`{provider} 額度暫時不足`,reason:`這次 AI 工作因用量限制而停止。`,next:`草稿已保留。待 {provider} 額度恢復後按「繼續這份草稿」接續製作;額度還沒恢復時會再次停止,草稿不受影響。`},provider_authentication_required:{title:`{provider} 需要重新登入`,reason:`{provider} 的登入在製作途中過期了,這次工作因此停下。`,next:`在終端機執行 {login} 完成登入,再按「繼續這份草稿」接著做;不用重新啟動 Clipen,草稿不受影響。`},provider_network_error:{title:`與 AI 的連線中斷`,reason:`這次工作未能維持與 {provider} 的網路連線。`,next:`確認網路恢復,再重新製作。`},provider_timed_out:{title:`AI 工作逾時`,reason:`這次工作超過執行時間限制,尚未完成交付。`,next:`草稿已保留,按「繼續這份草稿」接續製作。`},tool_budget_exhausted:{title:`這次製作尚未完成`,reason:`AI 已達這次工作允許的操作上限,並非影片已經完成。`,next:`先查看保留的結果,試著縮小製作範圍後重新製作。`},preview_budget_exhausted:{title:`這次影片尚未完成`,reason:`AI 已達這次工作允許的預覽輸出上限。`,next:`先查看目前預覽,再以明確的修改需求建立新工作。`},provider_permission_error:{title:`AI 無法執行需要的操作`,reason:`{provider} 回報權限問題。`,next:`查看詳細資訊與 {provider} 的權限設定,處理後再重新製作。`},provider_unavailable:{title:`目前無法使用 {provider}`,reason:`Clipen 無法使用 AI 執行環境。`,next:`確認 {provider} 可以啟動,重啟 Clipen 後再試。`},provider_launch_failed:{title:`AI 工作未能啟動`,reason:`Clipen 啟動 AI 執行程序時失敗。`,next:`確認 {provider} 可以啟動,重啟 Clipen 後再試。`},provider_mismatch:{title:`這份工作屬於另一個 AI`,reason:`這個工作是用其他 AI 建立的,Clipen 不會改用目前的 AI 接續。`,next:`用建立它的 AI 重新啟動 Clipen 再繼續,或建立新的製作工作。`},controller_stopped:{title:`Clipen 關閉時中斷了製作`,reason:`上次關閉 Clipen 時,這個工作尚未完成。`,next:`先檢查已保留的草稿;重新製作會建立另一個工作。`},controller_restarted:{title:`上次製作尚未完成`,reason:`Clipen 重新啟動時發現未結束的工作。`,next:`先檢查已保留的草稿;重新製作會建立另一個工作。`},root_unavailable:{title:`讀不到素材磁碟`,reason:`製作需要的來源資料夾目前無法存取。`,next:`重新連接磁碟,回到素材頁確認位置並完成檢查。`},root_changed:{title:`素材位置已改變`,reason:`原先授權的資料夾已改變。`,next:`回到素材頁重新選擇資料夾並完成檢查。`},ffmpeg_unavailable:{title:`找不到影片處理工具`,reason:`本機無法啟動 FFmpeg。`,next:`確認 FFmpeg 已安裝並可使用,再重新製作。`}},tt={provider_protocol_error:{title:`The AI did not finish the production properly`,reason:`What the AI sent back did not complete Clipen's delivery steps.`,next:`Look at the draft that was kept, then decide whether to make it again.`},delivery_blocked:{title:`The film has not passed the delivery checks`,reason:`The AI made a draft, but the items below have not passed Clipen's checks yet, so it is not finished.`,next:`The draft is kept and you can watch it. In “Review”, say how to handle what is left, for example: let music carry the fast cuts, keep whole sentences where people talk.`},provider_stopped_early:{title:`The AI stopped early`,reason:`The AI ended this job before finishing, usually because it needs a file or a decision from you, or was asked for something it cannot do.`,next:`Read the AI's explanation below. Do what it asks, then send a revision from “Review”; if it just stopped midway, press “Continue this draft”.`},provider_usage_limit:{title:`{provider} is out of usage for now`,reason:`This AI job stopped at a usage limit.`,next:`The draft is kept. Once {provider} has usage again, press “Continue this draft”; before then it will stop again, and the draft stays safe.`},provider_authentication_required:{title:`{provider} needs you to sign in again`,reason:`The {provider} sign-in expired during the production, so this job stopped.`,next:`Run {login} in Terminal, then press “Continue this draft”. No need to restart Clipen; the draft stays safe.`},provider_network_error:{title:`The connection to the AI dropped`,reason:`This job lost its network connection to {provider}.`,next:`Check the network is back, then make it again.`},provider_timed_out:{title:`The AI job ran out of time`,reason:`This job passed its time limit before delivering.`,next:`The draft is kept. Press “Continue this draft” to carry on.`},tool_budget_exhausted:{title:`This production is not finished`,reason:`The AI used every operation this job allows; the film is not done.`,next:`Look at the result that was kept, then try again with a smaller scope.`},preview_budget_exhausted:{title:`This film is not finished`,reason:`The AI used every preview render this job allows.`,next:`Watch the current preview, then start a new job with a clear change.`},provider_permission_error:{title:`The AI could not do what it needed`,reason:`{provider} reported a permissions problem.`,next:`Check the details and {provider}'s permission settings, then make it again.`},provider_unavailable:{title:`{provider} is not available`,reason:`Clipen cannot use the AI right now.`,next:`Check {provider} starts, restart Clipen and try again.`},provider_launch_failed:{title:`The AI job did not start`,reason:`Clipen could not start the AI.`,next:`Check {provider} starts, restart Clipen and try again.`},provider_mismatch:{title:`This job belongs to another AI`,reason:`This job was started with another AI, and Clipen will not continue it with the current one.`,next:`Restart Clipen with the AI that started it to continue, or start a new production.`},controller_stopped:{title:`Clipen closed during the production`,reason:`This job was not finished when Clipen last closed.`,next:`Look at the draft that was kept; making it again starts another job.`},controller_restarted:{title:`The last production did not finish`,reason:`Clipen found an unfinished job when it restarted.`,next:`Look at the draft that was kept; making it again starts another job.`},root_unavailable:{title:`The footage drive cannot be read`,reason:`The footage folder this production needs is not available.`,next:`Reconnect the drive, then check the folder and the footage on the Footage page.`},root_changed:{title:`The footage folder changed`,reason:`The folder Clipen was allowed to use has changed.`,next:`Choose the folder again on the Footage page and check it.`},ffmpeg_unavailable:{title:`The video tools are missing`,reason:`FFmpeg cannot start on this Mac.`,next:`Make sure FFmpeg is installed and works, then make it again.`}};function nt(e,t=`Codex`){let n=(m?tt:et)[e??``]??(m?{title:`This production is not finished`,reason:`There is not enough information to tell why it stopped.`,next:`Look at the result that was kept, or make it again later.`}:{title:`這次製作尚未完成`,reason:`目前資料不足以確認中斷原因。`,next:`可以先查看保留的結果,或稍後重新製作。`}),r=t===`Claude`?`claude auth login`:`codex login`,i=e=>e.replaceAll(`{provider}`,t).replaceAll(`{login}`,r);return{title:i(n.title),reason:i(n.reason),next:i(n.next)}}var rt={subtitle_coverage_incomplete:`部分對話仍缺字幕,還需要補齊。`,subtitle_source_range_unresolved:`部分對話的辨識與時間尚未修好,還無法完成字幕。`,production_music_required:`尚未完成配樂:需要加入有來源與授權資料的音樂。`,production_transition_required:`尚未完成轉場:剪點之間還缺少轉場安排。`,production_editing_required:`尚未完成精剪:還需要選材、剪點與段落安排。`,program_graphics_missing:`尚未完成畫面設計:目前還沒有節目元件。`,program_component_collision:`畫面元件互相重疊,需要調整位置或出現時間。`,component_anchor_missing:`畫面元件失去對應鏡頭,需要重新連結。`,component_anchor_out_of_bounds:`畫面元件超出對應鏡頭的時間,需要調整。`,program_component_overflow:`文字超出版面,需要縮短或調整位置。`,text_layout_collision:`字幕或文字互相遮擋,需要重新排版。`,source_speech_evidence_missing:`部分口語尚未辨識,還無法確認字幕是否完整。`,subtitle_alignment_required:`字幕時間尚未核對,或修改文字後需要重新確認對齊。`,program_subtitles_missing:`保留的口語還沒有對應字幕。`,subtitle_muted_source:`字幕對應的原音已靜音,需要確認聲音與字幕安排。`,subtitle_source_changed:`口語內容已更正,對應字幕尚未更新。`,retimed_speech_mapping_unavailable:`變速片段的口語與字幕時間尚無法可靠對應。`,mix_review_required:`預覽的混音尚未完成檢查。`,hdr_preview_unsupported:`這段 HDR 素材目前無法使用此預覽流程。`,program_component_missing_glyph:`這個字型無法顯示部分文字,需要更換文字或字型。`,text_style_missing:`文字缺少可渲染的樣式,需要修復。`,audio_out_of_bounds:`音樂或音效超出片段範圍,需要調整時間。`},it={subtitle_coverage_incomplete:`Some speech still has no captions.`,subtitle_source_range_unresolved:`Some speech has not been recognised and timed yet, so its captions cannot be finished.`,production_music_required:`Music is missing: add music with a known source and license.`,production_transition_required:`Transitions are missing between some cuts.`,production_editing_required:`The edit is not done: shots, cuts and sections still need arranging.`,program_graphics_missing:`There are no on-screen graphics yet.`,program_component_collision:`Graphics overlap; move them or change when they appear.`,component_anchor_missing:`A graphic lost its shot and needs linking again.`,component_anchor_out_of_bounds:`A graphic runs past its shot.`,program_component_overflow:`Text runs off the layout; shorten or move it.`,text_layout_collision:`Captions or text cover each other; lay them out again.`,source_speech_evidence_missing:`Some speech has not been recognised, so the captions cannot be checked.`,subtitle_alignment_required:`Caption timing has not been checked, or needs checking again after a text change.`,program_subtitles_missing:`Speech that is kept has no captions.`,subtitle_muted_source:`A caption sits on muted sound; check the sound and captions.`,subtitle_source_changed:`The speech was corrected but its caption was not updated.`,retimed_speech_mapping_unavailable:`Speech in a sped-up or slowed clip cannot be matched to captions reliably.`,mix_review_required:`The preview mix has not been checked.`,hdr_preview_unsupported:`This HDR footage cannot use this preview yet.`,program_component_missing_glyph:`This font cannot draw some of the text; change the text or the font.`,text_style_missing:`Some text has no style it can be drawn with.`,audio_out_of_bounds:`Music or a sound effect runs past its range.`};function at(e){return(m?it:rt)[e]??g(`有一項聲畫或來源檢查尚未通過;詳細資訊保留了原始檢查內容。`,`A picture, sound or source check has not passed; the details keep the original check.`)}var ot=m?{understand:`Brief`,sources:`Footage`,edit:`Edit`,graphics:`Captions & graphics`,music:`Music`,render:`Render`,review:`Check`}:{understand:`理解需求`,sources:`選素材`,edit:`剪輯`,graphics:`字幕與畫面`,music:`配樂`,render:`輸出影片`,review:`檢查`},st=m?{understand:`Brief`,sources:`Clips`,edit:`Edit`,graphics:`Text`,music:`Music`,render:`Render`,review:`Check`}:{understand:`理解`,sources:`選材`,edit:`剪輯`,graphics:`字幕`,music:`配樂`,render:`輸出`,review:`檢查`};function ct(e,t){let n=e?new Date(e).getTime():NaN;if(Number.isNaN(n))return null;let r=Math.max(0,Math.floor((t-n)/1e3)),i=Math.floor(r/60);return i<1?g(`已進行 ${r} 秒`,`${r}s so far`):i<60?g(`已進行 ${i} 分 ${String(r%60).padStart(2,`0`)} 秒`,`${i}m ${String(r%60).padStart(2,`0`)}s so far`):g(`已進行 ${Math.floor(i/60)} 小時 ${i%60} 分`,`${Math.floor(i/60)}h ${i%60}m so far`)}var lt=90,ut=480;function dt(e,t){let n=Math.max(...e.map(e=>e?new Date(e).getTime():NaN).filter(e=>!Number.isNaN(e)));if(!Number.isFinite(n))return null;let r=Math.max(0,Math.floor((t-n)/1e3)),i=r<60?g(`${r} 秒前`,`${r}s ago`):g(`${Math.floor(r/60)} 分鐘前`,`${Math.floor(r/60)} min ago`);return r<lt?{tone:`working`,text:g(`AI 正在工作 · ${i}有動作`,`The AI is working · last move ${i}`)}:r<ut?{tone:`thinking`,text:g(`AI 正在想下一步 · ${i}有動作`,`The AI is thinking about its next step · last move ${i}`),hint:g(`複雜的步驟可能要想好幾分鐘,這是正常的。`,`A hard step can take a few minutes of thinking. That is normal.`)}:{tone:`quiet`,text:g(`已經 ${Math.floor(r/60)} 分鐘沒有新動作`,`Nothing new for ${Math.floor(r/60)} minutes`),hint:g(`可以再等一下。如果一直沒變化,按「停止製作」:草稿會保留,之後在「審片修改」交給 AI 接著改。`,`You can wait a little longer. If nothing changes, press “Stop”: the draft is kept, and you can hand it back to the AI from “Review”.`)}}function ft({stages:e,reached:t,active:n}){let r=Math.max(0,Math.min(t,e.length-1));return(0,q.jsx)(`ol`,{className:`production-stages`,"aria-label":g(`製作階段`,`Production stages`),children:e.map((i,a)=>{let o=t>=e.length||a<r?`done`:a===r&&n?`current`:a===r?`stopped`:`pending`,s=ot[i]??i;return(0,q.jsxs)(`li`,{className:`is-${o}`,"aria-current":o===`current`?`step`:void 0,"aria-label":o===`done`?g(`${s},已完成`,`${s}, done`):s,children:[(0,q.jsx)(`span`,{className:`production-stage-dot`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`production-stage-name`,"aria-hidden":`true`,children:s}),(0,q.jsx)(`span`,{className:`production-stage-short`,"aria-hidden":`true`,children:st[i]??s})]},i)})})}function pt(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString(h,{hour12:!1,hour:`2-digit`,minute:`2-digit`})}function mt({status:e,busy:t,onResume:n,onCancel:r,onRefresh:i,onEdit:a,onView:o,onRefine:s,compact:c=!1}){let u=je(),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(()=>Date.now()),h=e.latest_run&&[`queued`,`running`].includes(e.latest_run.state);(0,l.useEffect)(()=>{if(!h)return;let e=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(e)},[h]);let _=e.production,v=_?e.latest_run:null;if(!_||!v)return null;let y=[`queued`,`running`].includes(v.state),b=[`failed`,`interrupted`].includes(v.state),x=v.state===`failed`&&[`provider_timed_out`,`provider_usage_limit`,`provider_stopped_early`,`provider_authentication_required`].includes(v.error_code??``),S=v.state===`failed`&&v.error_code===`delivery_blocked`,C=v.state===`failed`&&[`delivery_blocked`,`provider_stopped_early`,`provider_mismatch`].includes(v.error_code??``),w=v.state===`failed`&&v.error_code===`provider_mismatch`,T=w?{title:g(`這支片是用 ${Ne(v.provider)} 做的`,`This film was made with ${Ne(v.provider)}`),reason:g(`Clipen 現在用的是 ${u.name}。中斷的工作只會由原本的 AI 接續,避免花到另一個帳號的額度。`,`Clipen is using ${u.name} now. A stopped job is continued only by the AI that started it, so another account's usage is never spent.`),next:g(`到「審片修改」送出修改,就會改由 ${u.name} 接手,從目前的版本繼續;想讓 ${Ne(v.provider)} 繼續,請用 clipen ${v.provider} 重新啟動 Clipen。`,`Send a revision from “Review” and ${u.name} takes over from the current version. To let ${Ne(v.provider)} carry on, restart Clipen with clipen ${v.provider}.`)}:nt(v.error_code,u.name),E=_.progress,D=E?.activity??[],O=(!b||[`provider_stopped_early`,`delivery_blocked`].includes(v.error_code??``))&&E?.ai_message?.trim()||null,k=_.local_jobs.find(e=>e.state===`running`),A=_.preview&&[`queued`,`running`].includes(_.preview.state),j=b?T.title:v.state===`cancelled`?g(`已停止製作`,`Production stopped`):v.phase===`user_edit`?g(`修改已儲存`,`Your change is saved`):v.state===`succeeded`?g(`影片完成了`,`Your film is ready`):v.state===`queued`?g(`等待開始製作`,`Waiting to start`):g(`AI 正在製作`,`The AI is making your film`),M=k?k.kind===`setup`?g(`首次使用,正在準備語音功能。`,`First run: preparing speech recognition.`):g(`正在整理對話與字幕。`,`Working through speech and captions.`):A?g(`正在輸出影片。`,`Rendering the film.`):D.at(-1)?.label??g(`正在準備製作。`,`Getting ready.`),N=k?.kind===`setup`&&k.total_bytes&&k.total_bytes>0?Math.max(0,Math.min(100,Math.round((k.completed_bytes??0)/k.total_bytes*100))):null,P=ct(E?.started_at,p),F=y&&v.state===`running`&&!k&&!A?dt([E?.ai_output_at,E?.updated_at,E?.started_at],p):null,I=D.at(-1)?.count??0,L=E?.slept_seconds??0,ee=Math.max(1,Math.round(L/60)),R=ee<60?g(`${ee} 分鐘`,`${ee} min`):g(`${Math.floor(ee/60)} 小時 ${ee%60} 分鐘`,`${Math.floor(ee/60)} h ${ee%60} min`),te=[...new Map((_.validation?.issues??[]).map(e=>[e.code,e])).values()],z=b&&O!==null,B=JSON.stringify({run_id:v.run_id,state:v.state,phase:v.phase,error_code:v.error_code,tool_calls:v.budget.tool_calls,max_tool_calls:v.budget.max_tool_calls,preview_error:_.preview?.error_code??null,local_jobs:_.local_jobs,validation:_.validation,recent_tools:D.filter(e=>e.tool).map(e=>({tool:e.tool,at:e.created_at}))},null,2);async function V(){try{await navigator.clipboard.writeText(B),f(!0)}catch{f(!1)}}if(c){let e=b?T.title:y&&!A?g(`${j}:${M}`,`${j}: ${M}`):j;return(0,q.jsxs)(`section`,{className:`production-status-line ${b?`has-problem`:``} ${y?`is-active`:``} ${F?`is-${F.tone}`:``}`,"aria-label":g(`製作狀態`,`Production status`),children:[(0,q.jsx)(`span`,{className:`production-status-dot`,"aria-hidden":`true`}),(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{role:`status`,children:e}),F?(0,q.jsx)(`small`,{children:F.text}):y&&P?(0,q.jsx)(`small`,{children:P}):null]}),x&&(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:t,onClick:n,children:g(`繼續這份草稿`,`Continue this draft`)}),y&&(0,q.jsx)(`button`,{className:`button ghost`,type:`button`,disabled:t,onClick:r,children:g(`停止製作`,`Stop`)}),o&&(0,q.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:o,children:g(`查看詳情`,`Details`)})]})}return(0,q.jsxs)(`section`,{className:`production-status-panel ${b?`has-problem`:``} ${y?`is-active`:``}`,"aria-labelledby":`production-status-heading`,children:[(0,q.jsxs)(`div`,{className:`production-status-heading`,children:[(0,q.jsxs)(`h3`,{id:`production-status-heading`,role:`status`,children:[y&&(0,q.jsx)(`span`,{className:`production-live ${F?`is-${F.tone}`:``}`,"aria-hidden":`true`}),j]}),y&&P&&(0,q.jsx)(`span`,{className:`production-elapsed`,children:P})]}),(y||b)&&!w&&E?.stages&&(0,q.jsx)(ft,{stages:E.stages,reached:E.reached??-1,active:y}),(0,q.jsx)(`p`,{className:`production-now`,children:b?T.next:y?(0,q.jsxs)(q.Fragment,{children:[v.state===`queued`?g(`排隊中,馬上開始。`,`Queued; starting shortly.`):M,I>1&&!k&&!A?(0,q.jsx)(`small`,{children:g(`這一步做了 ${I} 次操作`,`${I} actions in this step`)}):null]}):v.state===`cancelled`?g(`草稿已保留。可以先看影片,或到「審片修改」交給 AI 接著改。`,`The draft is kept. Watch it, or hand it back to the AI from “Review”.`):g(`滿意就按「下載影片」存到電腦;想改的話按「審片並交給 AI 修改」。`,`Happy with it? Press “Download the film”. To change it, press “Review and have the AI change it”.`)}),F&&(0,q.jsxs)(`p`,{className:`production-pulse is-${F.tone}`,children:[F.text,F.hint&&(0,q.jsx)(`small`,{children:F.hint})]}),y&&A&&(0,q.jsxs)(`div`,{className:`production-job`,children:[(0,q.jsx)(`progress`,{"aria-label":g(`輸出影片進度`,`Render progress`),value:_.preview?.progress??0,max:1}),(0,q.jsxs)(`span`,{children:[g(`輸出影片`,`Rendering`),` `,Math.round((_.preview?.progress??0)*100),`%`,_.preview?.stage?` · ${_.preview.stage}`:``]})]}),L>=60&&(0,q.jsx)(`p`,{className:`production-slept`,role:`note`,children:g(`這次製作期間 Mac 睡眠了約 ${R},製作在這段時間暫停${b?`,這可能是沒有完成的原因`:``}。製作時請接上電源,或不要闔上螢幕。`,`The Mac slept for about ${R} during this production, and the work paused meanwhile${b?`, which may be why it did not finish`:``}. Plug in, or keep the lid open, while a film is made.`)}),y&&/Mac/.test(navigator.platform)&&(0,q.jsx)(`p`,{className:`production-status-note`,children:g(`製作時別闔上螢幕:用電池時闔上會讓 Mac 睡著,製作也會暫停。`,`Keep the lid open: on battery, closing it puts the Mac to sleep and pauses the work.`)}),y&&N!==null&&(0,q.jsxs)(`div`,{className:`production-job`,children:[(0,q.jsx)(`progress`,{"aria-label":g(`準備語音功能`,`Preparing speech recognition`),value:N,max:100}),(0,q.jsx)(`span`,{children:g(`語音功能準備進度 ${N}%`,`Preparing speech recognition ${N}%`)})]}),z&&(0,q.jsxs)(`blockquote`,{className:`production-ai-message`,children:[(0,q.jsx)(`strong`,{children:g(`AI 的說明`,`What the AI says`)}),(0,q.jsx)(`p`,{children:O})]}),S&&te.length>0&&(0,q.jsx)(`ul`,{className:`production-blockers`,children:te.map(e=>(0,q.jsx)(`li`,{children:at(e.code)},e.code))}),(0,q.jsxs)(`div`,{className:`production-recovery-actions`,children:[b&&(_.preview?.state===`succeeded`||_.last_successful_preview?.state===`succeeded`)&&(0,q.jsx)(`a`,{className:`button secondary`,href:`#production-output`,onClick:o,children:g(`查看影片`,`Watch the film`)}),C&&s&&(0,q.jsx)(`button`,{className:`button primary`,type:`button`,disabled:t,onClick:s,children:w?g(`審片後用 ${u.name} 修改`,`Review, then revise with ${u.name}`):g(`審片並交給 AI 修改`,`Review and hand to the AI`)}),x&&(0,q.jsx)(`button`,{className:`button ${C&&s?`secondary`:`primary`}`,type:`button`,disabled:t,onClick:n,children:g(`繼續這份草稿`,`Continue this draft`)}),b&&(0,q.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:t,onClick:a,children:g(`重新製作`,`Make it again`)}),y&&(0,q.jsx)(`button`,{className:`button ghost`,type:`button`,disabled:t,onClick:r,children:g(`停止製作`,`Stop`)})]}),(0,q.jsxs)(`details`,{className:`production-more`,children:[(0,q.jsx)(`summary`,{children:g(`查看製作詳情`,`Production details`)}),E?.request&&(0,q.jsxs)(`div`,{className:`production-detail`,children:[(0,q.jsx)(`strong`,{children:g(`你這次的要求`,`What you asked for`)}),(0,q.jsx)(`p`,{children:E.request})]}),b&&(0,q.jsxs)(`div`,{className:`production-detail`,children:[(0,q.jsx)(`strong`,{children:g(`發生了什麼`,`What happened`)}),(0,q.jsx)(`p`,{children:T.reason}),(0,q.jsx)(`p`,{children:g(`你的草稿都還在,沒有被刪掉。${x?`「繼續這份草稿」會接著目前的進度做,`:``}「重新製作」會另外做一支新影片。`,`Your draft is safe. ${x?`“Continue this draft” carries on from where it got to; `:``}“Make it again” makes a separate new film.`)})]}),O&&!z&&(0,q.jsxs)(`div`,{className:`production-detail`,children:[(0,q.jsx)(`strong`,{children:g(`AI 的說明`,`What the AI says`)}),(0,q.jsx)(`p`,{className:`production-ai-text`,children:O})]}),te.length>0&&!S&&(0,q.jsxs)(`div`,{className:`production-checks`,children:[(0,q.jsx)(`strong`,{children:y?g(`AI 還在處理的事`,`What the AI is still working on`):g(`還需要處理的事`,`What is left to do`)}),(0,q.jsx)(`ul`,{children:te.map(e=>(0,q.jsx)(`li`,{children:at(e.code)},e.code))})]}),D.length>0&&(0,q.jsxs)(`div`,{className:`production-activity`,children:[(0,q.jsx)(`strong`,{children:g(`AI 做了哪些事`,`What the AI did`)}),(0,q.jsx)(`ol`,{children:D.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`time`,{dateTime:e.created_at,children:pt(e.created_at)}),(0,q.jsx)(`span`,{children:e.label})]},e.sequence))}),(0,q.jsx)(`p`,{children:g(`這是製作過程的步驟,實際結果請以影片為準。`,`These are steps along the way; the film itself is what counts.`)})]}),(0,q.jsxs)(`div`,{className:`production-detail-footer`,children:[(0,q.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:i,children:g(`重新整理`,`Refresh`)}),(0,q.jsxs)(`details`,{className:`production-diagnostics`,children:[(0,q.jsx)(`summary`,{children:g(`回報問題用的技術資料`,`Technical details for bug reports`)}),(0,q.jsx)(`p`,{children:g(`一般不需要看這裡。向我們回報問題時,可以複製這段資料一起附上,裡面不含你的影片或聲音檔案。`,`You normally will not need this. When you report a problem, copy it in; it contains none of your video or sound.`)}),(0,q.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:()=>void V(),children:d?g(`已複製`,`Copied`):g(`複製技術資料`,`Copy details`)}),(0,q.jsx)(`pre`,{children:B})]})]})]})]})}function ht(e,t){let n=new Map;for(let t of e){let e=t.duplicate_group||t.asset_id,r=n.get(e)??[];r.push(t),n.set(e,r)}let r=[...n.values()].map(e=>({asset:e.find(e=>e.asset_id===t)??e[0],copies:e.length})),i=new Map;return r.map(({asset:e,copies:t})=>{let n=g(`${e.name}(${Math.round(e.duration_seconds)} 秒)`,`${e.name} (${Math.round(e.duration_seconds)} s)`),r=(i.get(n)??0)+1;return i.set(n,r),{asset:e,copies:t,label:`${n}${r>1?g(` · 版本 ${r}`,` · version ${r}`):``}`}})}function gt({projectId:e,csrf:t,value:n,onChange:r,disabled:i,defaultLabel:a=g(`讓 AI 尋找配樂`,`Let the AI find music`)}){let o=(0,l.useId)(),[s,c]=(0,l.useState)([]),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),_=ht(s,n),v=_.filter(({asset:e})=>e.asset_id===n||e.name.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase()));(0,l.useEffect)(()=>{let t=!1;return be(e).then(e=>{t||c(e)}).catch(e=>{t||p(String(e))}),()=>{t=!0}},[e,n]);async function y(n){if(!(!n||i)){if(n.size>134217728){p(g(`音樂檔上限為 128 MB。`,`Music files can be up to 128 MB.`));return}d(!0),p(``);try{let i=await G(t,e,n);c(e=>[...e.filter(e=>e.asset_id!==i.asset_id),i]),r(i.asset_id)}catch(e){p(e instanceof Error?e.message:g(`音樂上傳失敗。`,`The music upload failed.`))}finally{d(!1)}}}return(0,q.jsxs)(`fieldset`,{className:`production-music-picker`,disabled:i||u,children:[(0,q.jsx)(`legend`,{children:g(`配樂`,`Music`)}),_.length>5&&(0,q.jsxs)(`label`,{children:[g(`搜尋配樂`,`Search music`),(0,q.jsx)(`input`,{type:`search`,"aria-label":g(`搜尋配樂`,`Search music`),value:m,onChange:e=>h(e.target.value),placeholder:g(`輸入曲名`,`Track name`)})]}),(0,q.jsx)(`label`,{htmlFor:`${o}-choice`,className:`sr-only`,children:g(`使用哪首音樂?`,`Which music?`)}),(0,q.jsxs)(`select`,{id:`${o}-choice`,value:n,onChange:e=>r(e.target.value),children:[(0,q.jsx)(`option`,{value:``,children:a}),v.map(({asset:e,label:t})=>(0,q.jsx)(`option`,{value:e.asset_id,children:t},e.asset_id))]}),m.trim()&&!v.some(({asset:e})=>e.name.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase()))&&(0,q.jsx)(`p`,{role:`status`,children:g(`沒有符合的曲目;目前選用的配樂仍保留。`,`No matching tracks; your current choice stays.`)}),(0,q.jsx)(`label`,{htmlFor:`${o}-file`,children:g(`或用自己的音樂檔`,`Or use your own music file`)}),(0,q.jsx)(`input`,{id:`${o}-file`,type:`file`,accept:`.mp3,.wav,.m4a,.aac,.flac,.ogg,.aiff,.aif`,onChange:e=>{y(e.target.files?.[0]),e.target.value=``}}),u&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在匯入音樂…`,`Importing music…`)}),f&&(0,q.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:f})]})}function _t(e){if(!e)return null;try{let t=JSON.parse(e),n=t?.form;return typeof t?.revisionId!=`string`||!n||!Number.isFinite(n.at)||n.at<0||![`change`,`remove`,`keep`,`highlight`,`location`,`audio`,`note`].includes(n.kind)||![`referenceId`,`end`,`target`,`note`,`layer`].every(e=>typeof n[e]==`string`)||n.note.length>2e3||!Number.isFinite(n.gain)||n.gain<-60||n.gain>0||typeof n.fill!=`boolean`?null:t}catch{return null}}var vt=`審片注記(時間是目前這一版影片的位置):`,yt=`Review notes (times are positions in this version of the film):`;function bt(e){return e.split(/(?:^|\n)(?:審片注記(時間是目前這一版影片的位置):|Review notes \(times are positions in this version of the film\):)(?:\r?\n|$)/,1)[0].trim()}function xt(e,t,n){return t.some(t=>t.trim()===e.trim())?n:e}function St(e,t,n=``,r=``){let i=`clipen:prompt-draft:${e}:${t}`,a=`clipen:prompt-draft:v2:${e}:${t}:${r}`,o=(0,l.useRef)(0),[s,c]=(0,l.useState)(()=>{try{return localStorage.getItem(a)??n}catch{return n}});function u(e){o.current+=1,c(e);try{localStorage.setItem(a,e)}catch{}}return(0,l.useEffect)(()=>{let r=!1,s=o.current;try{if(localStorage.getItem(a)!==null)return}catch{}let l=null;try{l=localStorage.getItem(i)}catch{return}if(l===null)return;async function u(){let u=[],d=0;for(;;){let n=await xe(e,d);if(r||s!==o.current)return;if(u.push(...n.prompts.filter(e=>e.kind===t&&e.source===`submitted`).map(e=>e.text)),d+=n.prompts.length,d>=n.total)break;if(!n.prompts.length)return}let f=xt(l,u,n);c(e=>{if(e!==n)return e;try{localStorage.setItem(a,f),localStorage.removeItem(i)}catch{}return f})}return u().catch(()=>{}),()=>{r=!0}},[e,t,a,i,n]),[s,u]}function Ct(e){let t=`clipen:consent:${e||`ai`}`,[n,r]=(0,l.useState)(()=>{try{return localStorage.getItem(t)===`yes`}catch{return!1}});function i(e){r(e);try{e?localStorage.setItem(t,`yes`):localStorage.removeItem(t)}catch{}}return[n,i]}var wt=[[`change`,g(`要修改`,`Change`)],[`remove`,g(`拿掉`,`Remove`)],[`keep`,g(`這樣可以`,`Keep`)],[`highlight`,g(`加強爆點`,`Play up`)],[`location`,g(`地點補充`,`Place`)],[`audio`,g(`聲音`,`Sound`)],[`note`,g(`其他`,`Other`)]],Tt=Object.fromEntries(wt),Et=[`remove`,`keep`],Dt={change:g(`例如:這段字幕改成「第一次吃到」,晚一秒出現。`,`For example: change this caption to “first bite ever” and bring it in a second later.`),remove:g(`可以不填;或補充原因,例如:直式畫面,和前後接不起來。`,`Optional. Or say why, for example: it is vertical and does not cut with the shots around it.`),keep:g(`可以不填;例如:這段文字和時間都很好。`,`Optional. For example: the text and timing here are just right.`),highlight:g(`例如:第一口之後的反應是笑點,請留鋪陳再強調。`,`For example: the reaction after the first bite is the joke; give it a build-up, then land it.`),location:g(`例如:這裡是銀座的某某店,不是淺草。`,`For example: this is a shop in Ginza, not Asakusa.`),audio:g(`例如:風聲太大,壓低原音,讓配樂接上;保留說話內容。`,`For example: the wind is loud. Turn the original sound down and let the music carry; keep what is said.`),note:g(`補充只有你知道的拍攝背景或想法。`,`Anything only you know about the shot or what you had in mind.`)},Ot=[`請依下面的審片注記`,`審片注記`,`Change the current film as the review notes`,`Review notes`],kt=(e,t)=>g(`${e}「${t}」`,`${e} “${t}”`);function Y(e,t=!1){let n=Math.floor(e/60),r=e-n*60;return`${n}:${t?r.toFixed(1).padStart(4,`0`):String(Math.floor(r)).padStart(2,`0`)}`}function At(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.toLocaleTimeString(h,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),i=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),a=Math.round((i(t)-i(n))/864e5);return a===0?g(`今天 ${r}`,`Today ${r}`):a===1?g(`昨天 ${r}`,`Yesterday ${r}`):`${n.getMonth()+1}/${n.getDate()} ${r}`}function jt(e){return m?e>=1e6?`${(e/1e6).toFixed(e>=1e8?0:1)}M`:e>=1e4?`${Math.round(e/1e3)}K`:e.toLocaleString(`en-US`):e>=1e8?`${(e/1e8).toFixed(e>=1e9?0:1)} 億`:e>=1e4?`${(e/1e4).toFixed(e>=1e6?0:1)} 萬`:e.toLocaleString(`en-US`)}function Mt(e){return{short:g(`輸入 ${jt(e.input_tokens)} · 輸出 ${jt(e.output_tokens)} tokens`,`${jt(e.input_tokens)} in · ${jt(e.output_tokens)} out tokens`),detail:g(`輸入 ${jt(e.input_tokens)}(其中 ${jt(e.cached_input_tokens)} 來自快取)· 輸出 ${jt(e.output_tokens)} · 合計 ${jt(e.input_tokens+e.output_tokens)}`,`${jt(e.input_tokens)} in (${jt(e.cached_input_tokens)} from cache) · ${jt(e.output_tokens)} out · ${jt(e.input_tokens+e.output_tokens)} total`)}}function Nt(e){if(e.kind===`restore`)return e.restored_from?g(`回到${At(e.restored_from)} 的樣子`,`Back to ${At(e.restored_from)}`):g(`回到較早的樣子`,`Back to an earlier version`);if(e.kind===`manual`)return e.changes||g(`手動修改`,`Your edit`);let t=e.detail?.split(`
14
+ `).map(e=>e.trim()).filter(Boolean)??[],n=t.find(e=>!Ot.some(t=>e.startsWith(t))&&!/^\d+\.\s/.test(e)),r=t.filter(e=>/^\d+\.\s/.test(e)).length,i=(e.label??`AI`).replace(/完成$| finished$/,``);return n?g(`${i}:「${n.length>36?`${n.slice(0,36)}…`:n}」`,`${i}: “${n.length>48?`${n.slice(0,48)}…`:n}”`):r?g(`${i}:依 ${r} 筆審片注記修改`,`${i}: ${r} review ${v(r,`note`,`notes`)}`):e.label}function Pt(e){let t=e.trim().split(`:`);return!t.length||t.length>2||t.some(e=>!/^\d+(\.\d+)?$/.test(e))?NaN:t.length===2?Number(t[0])*60+Number(t[1]):Number(t[0])}function Ft(e){return e.tracks.filter(e=>e.kind===`video`).flatMap(e=>e.items)}function It(e){return e===`agent-subtitles`?g(`字幕`,`Caption`):e?.startsWith(`program-components`)?g(`元件`,`Graphic`):g(`文字`,`Text`)}function Lt(e,t){let n=Ft(e),r=n.findIndex(e=>e.start_frame<=t&&t<e.start_frame+e.duration_frames),i=r<0?[]:[{id:n[r].item_id,label:g(`鏡頭 ${r+1}(畫面)`,`Shot ${r+1} (picture)`),start:n[r].start_frame,end:n[r].start_frame+n[r].duration_frames}];for(let n of e.tracks)if(n.kind!==`video`&&n.kind!==`audio`)for(let e of n.items){if(!e.text||e.start_frame>t||t>=e.start_frame+e.duration_frames)continue;let r=e.text.replace(/\s+/g,` `);i.push({id:e.item_id,label:kt(It(n.track_id),r.length>24?`${r.slice(0,24)}…`:r),start:e.start_frame,end:e.start_frame+e.duration_frames,text:!0})}return i}function Rt(e,t){let n=t.frame_rate.num/t.frame_rate.den,r=e.current_range,i=Ft(t).findIndex(e=>e.item_id===r?.item_id),a=r?(r.at_frame??r.start_frame)/n:null,o=a===null?g(`位置已變動`,`moved`):e.explicit_range&&r?`${Y(a)}–${Y((r.start_frame+r.duration_frames)/n)}`:Y(a),s=e.element_id&&e.element_text?kt(It(e.element_track),e.element_text.replace(/\s+/g,` `)):i>=0?g(`鏡頭 ${i+1}`,`Shot ${i+1}`):g(`這個畫面`,`This frame`),c=e.kind===`audio`&&e.source_gain_db!==void 0?g(`(原音 ${e.source_gain_db} dB${e.fill_music?`,配樂補滿`:``})`,` (original sound ${e.source_gain_db} dB${e.fill_music?`, music fills in`:``})`):``;return{at:a,time:o,target:s,line:g(`${o} ${Tt[e.kind]}:${s}。${e.note}${c}`,`${o} ${Tt[e.kind]}: ${s}. ${e.note}${c}`)}}function zt(e,t,n){let r=[...t].map(e=>Rt(e,n)).sort((e,t)=>(e.at??1/0)-(t.at??1/0)).map((e,t)=>`${t+1}. ${e.line}`),i=bt(e)||(r.length?g(`請依下面的審片注記修改目前影片,其他部分保留。`,`Change the current film as the review notes below say; keep everything else.`):``);return r.length?`${i}\n\n${g(vt,yt)}\n${r.join(`
15
+ `)}`:i}var Bt={x:[-.95,.95],y:[-.95,.95]},Vt=(e,[t,n])=>Math.round(Math.min(n,Math.max(t,e))*1e3)/1e3,Ht=e=>e.tracks.filter(e=>e.track_id===`program-components`||(e.track_id??``).startsWith(`program-components-`));function Ut(e,t=e.at){return e.shots.find(e=>e.start<=t&&t<e.end)??e.shots[e.shots.length-1]}function Wt(e,t,n){let r=Math.max(6,Math.min(e.total,Math.round(n)));return{at:Math.max(0,Math.min(e.total-r,Math.round(t))),duration:r}}function Gt(e,t,n){let r=t?.components[n],i=e.tracks.flatMap(e=>e.items).find(e=>e.item_id===n);if(!r||!i)return null;let a=(e=[],t={})=>Object.fromEntries(e.map(e=>[e.key,t[e.key]??e.value])),o={words:a(r.fields?.texts,r.edits?.texts),paints:a(r.fields?.colors,r.edits?.colors),x:r.x??0,y:r.y??0,look:r.look_id??``,at:i.start_frame,duration:i.duration_frames,lane:Math.max(0,Ht(e).findIndex(e=>e.items.some(e=>e.item_id===n)))},s=Ft(e).map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames}));return{id:n,...o,saved:o,shots:s,total:e.duration_frames}}function Kt(e){let t=Ut(e),n={item_id:t.id,start_offset_frames:e.at-t.start,duration_frames:e.duration,...e.lane===e.saved.lane?{}:{lane:e.lane}};return{element_id:e.id,texts:e.words,colors:e.paints,x:e.x,y:e.y,...n,...e.look&&e.look!==e.saved.look?{look_id:e.look}:{}}}function qt(e){let{saved:t}=e;return e.x!==t.x||e.y!==t.y||e.at!==t.at||e.duration!==t.duration||e.lane!==t.lane||e.look!==t.look||JSON.stringify(e.words)!==JSON.stringify(t.words)||JSON.stringify(e.paints)!==JSON.stringify(t.paints)}function Jt({label:e,value:t,format:n,parse:r,onCommit:i,disabled:a,suffix:o}){let[s,c]=(0,l.useState)(null),u=()=>{if(s===null)return;let e=r(s);Number.isFinite(e)&&i(e),c(null)};return(0,q.jsxs)(`label`,{children:[e,(0,q.jsxs)(`span`,{className:`rv-field`,children:[(0,q.jsx)(`input`,{value:s??n(t),disabled:a,inputMode:`decimal`,onChange:e=>c(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u()),e.key===`Escape`&&c(null)}}),o&&(0,q.jsx)(`em`,{children:o})]})]})}function Yt({edit:e,settings:t,editing:n,fps:r,busy:i,disabled:a,locked:o,onChange:s,onSave:c,onCancel:l,onRemove:u}){let d=qt(e),f=Object.values(e.words).every(e=>e.trim()),p=t=>s({...e,...t}),m=e=>{e.key===`Enter`&&d&&f&&c()},h=e.x!==e.saved.x||e.y!==e.saved.y,_={words:Object.fromEntries((t.fields?.texts??[]).map(e=>[e.key,e.value])),paints:Object.fromEntries((t.fields?.colors??[]).map(e=>[e.key,e.value]))},v=JSON.stringify(e.words)!==JSON.stringify(_.words)||JSON.stringify(e.paints)!==JSON.stringify(_.paints);return(0,q.jsxs)(`div`,{className:`rv-inspector`,children:[(0,q.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,q.jsx)(`h4`,{children:t.name}),(0,q.jsx)(`span`,{className:`rv-time`,children:Y(e.at/r)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`關閉`,`Close`),onClick:l,children:`×`})]}),o&&(0,q.jsxs)(`p`,{className:`rv-locked`,role:`status`,children:[(0,q.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),o]}),(t.fields?.texts??[]).map(t=>(0,q.jsxs)(`label`,{children:[t.label,(0,q.jsx)(`input`,{value:e.words[t.key]??``,maxLength:120,disabled:a||i,onChange:n=>p({words:{...e.words,[t.key]:n.target.value}}),onKeyDown:m})]},t.key)),(t.fields?.colors.length??0)>0&&(0,q.jsx)(`div`,{className:`rv-colors`,role:`group`,"aria-label":g(`顏色`,`Colours`),children:t.fields?.colors.map(t=>(0,q.jsxs)(`label`,{className:`rv-swatch`,title:t.label,children:[(0,q.jsx)(`input`,{type:`color`,value:e.paints[t.key]??t.value,disabled:a||i,"aria-label":t.label,onChange:n=>p({paints:{...e.paints,[t.key]:n.target.value}})}),(0,q.jsx)(`span`,{style:{background:e.paints[t.key]??t.value}}),t.label]},t.key))}),v&&(0,q.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p(_),children:g(`恢復 AI 的設計`,`Back to the AI's design`)}),(n.looks?.length??0)>0&&(0,q.jsxs)(`label`,{children:[g(`外觀`,`Look`),(0,q.jsxs)(`select`,{value:e.look,disabled:a||i,onChange:e=>p({look:e.target.value}),children:[!e.saved.look&&(0,q.jsx)(`option`,{value:``,children:g(`不使用外觀(頁面自己定字型與顏色)`,`No look (the page sets its own type and colour)`)}),n.looks?.map(e=>(0,q.jsx)(`option`,{value:e.look_id,children:e.name},e.look_id))]})]}),(0,q.jsx)(`p`,{className:`rv-hint`,children:(t.fields?.texts.length??0)+(t.fields?.colors.length??0)>0?g(`這是 AI 自由設計的元件。想改版面或動畫,在下方寫給 AI 修改。`,`The AI designed this graphic freely. To change its layout or animation, tell the AI below.`):g(`這是 AI 自由設計的元件,沒有標出可以直接改的文字或顏色。想改它,在下方寫給 AI 修改。`,`The AI designed this graphic freely and marked no text or colours to edit directly. To change it, tell the AI below.`)}),(0,q.jsxs)(`div`,{className:`rv-pair`,children:[(0,q.jsx)(Jt,{label:g(`出現`,`Starts`),value:e.at/r,format:e=>Y(e,!0),parse:Pt,disabled:a||i,onCommit:t=>p(Wt(e,t*r,e.duration))}),(0,q.jsx)(Jt,{label:g(`長度`,`Length`),suffix:g(`秒`,`s`),value:e.duration/r,format:e=>e.toFixed(1),parse:Number,disabled:a||i,onCommit:t=>p(Wt(e,e.at,Math.min(t*r,e.total-e.at)))})]}),(0,q.jsxs)(`p`,{className:`rv-hint`,children:[g(`在畫面上拖曳元件就能移動,方向鍵可以微調;在下方時間線拖曳可以改出現時間或換軌,拉兩端可以改長度。`,`Drag the graphic on the picture to move it; arrow keys nudge it. On the timeline below, drag to change when it appears or its lane, and pull an end to change its length.`),g(`元件從 ${Y(Ut(e).start/r,!0)} 開始的鏡頭出現,重剪時會跟著這段素材走,長度可以跨過剪接點。`,` It sits on the shot starting at ${Y(Ut(e).start/r,!0)} and follows that footage when the film is recut; it may run past a cut.`),h&&(0,q.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p({x:e.saved.x,y:e.saved.y}),children:g(`回到原位`,`Back to where it was`)}),(e.at!==e.saved.at||e.duration!==e.saved.duration||e.lane!==e.saved.lane)&&(0,q.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p({at:e.saved.at,duration:e.saved.duration,lane:e.saved.lane}),children:g(`恢復原本的時間`,`Back to its original timing`)})]}),(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:a||i||!d||!f,onClick:c,children:i?g(`儲存中…`,`Saving…`):g(`儲存`,`Save`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:l,children:g(`取消`,`Cancel`)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button is-danger`,disabled:a||i,onClick:u,children:g(`刪除元件`,`Delete graphic`)})]})]})}function Xt({projectId:e,csrf:t,runId:n,revisionId:r,timeline:i,frame:a,component:o,slip:s,onMove:c,limits:u=Bt}){let d=i.frame_rate.num/i.frame_rate.den,f=o?JSON.stringify(o):``,p=s?JSON.stringify(s):``,m=`${r}:${a}:${f}:${p}`,[h,_]=(0,l.useState)({key:``,image:``,error:``,box:null,at:null}),v=(0,l.useRef)(null),y=(0,l.useRef)(null);(0,l.useEffect)(()=>{let i=new AbortController,o=window.setTimeout(()=>{let o=f?JSON.parse(f):void 0;Se(t,e,n,r,a,i.signal,o,p?JSON.parse(p):void 0).then(e=>{i.signal.aborted||_({key:m,image:e.image_data_url,error:``,box:e.component_box??null,at:o?{x:o.x??0,y:o.y??0}:null})}).catch(e=>{i.signal.aborted||_(t=>({...t,key:m,error:e instanceof Error?e.message:g(`暫時無法讀取畫面。`,`The picture cannot be read right now.`)}))})},300);return()=>{window.clearTimeout(o),i.abort()}},[t,e,n,r,a,f,p,m]);let{image:b,error:x,box:S,at:C}=h,w=S&&C&&o&&c?{left:S.x+(o.x??C.x)-C.x,top:S.y+(o.y??C.y)-C.y}:null;function T(e){!o||!c||(e.currentTarget.setPointerCapture(e.pointerId),y.current={x:o.x??0,y:o.y??0,clientX:e.clientX,clientY:e.clientY})}function E(e){let t=y.current,n=v.current?.getBoundingClientRect();!t||!n||!c||c(Vt(t.x+(e.clientX-t.clientX)/n.width,u.x),Vt(t.y+(e.clientY-t.clientY)/n.height,u.y))}function D(e){if(!o||!c)return;let t=e.shiftKey?.02:.005,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];n&&(e.preventDefault(),e.stopPropagation(),c(Vt((o.x??0)+n[0],u.x),Vt((o.y??0)+n[1],u.y)))}let O=i.canvas.width/i.canvas.height,k=()=>{y.current=null};return(0,q.jsxs)(`div`,{className:`rv-still${h.key!==m&&b?` is-loading`:``}`,ref:v,style:{aspectRatio:`${i.canvas.width}/${i.canvas.height}`,width:`min(100%, calc(max(300px, 100vh - 350px) * ${O}))`},children:[b?(0,q.jsx)(`img`,{src:b,alt:g(`${Y(a/d)} 的畫面`,`The picture at ${Y(a/d)}`),draggable:!1}):(0,q.jsx)(`span`,{className:`rv-still-wait`,children:g(`正在取得畫面…`,`Getting the picture…`)}),w&&S&&(0,q.jsx)(`div`,{className:`rv-grab`,role:`slider`,tabIndex:0,"aria-label":g(`元件位置,拖曳或用方向鍵移動`,`Graphic position; drag or use the arrow keys`),"aria-valuetext":g(`水平 ${Math.round((o?.x??0)*100)}%,垂直 ${Math.round((o?.y??0)*100)}%`,`${Math.round((o?.x??0)*100)}% across, ${Math.round((o?.y??0)*100)}% down`),style:{left:`${w.left*100}%`,top:`${w.top*100}%`,width:`${S.width*100}%`,height:`${S.height*100}%`},onPointerDown:T,onPointerMove:E,onPointerUp:k,onPointerCancel:k,onKeyDown:D}),x&&(0,q.jsx)(`p`,{className:`rv-still-error`,role:`alert`,children:x})]})}var Zt=72,Qt=7,$t=8,en=[`#8e5a9e`,`#3f7fa8`,`#b0683a`,`#4f8a5b`,`#a64d63`,`#7a6f2e`,`#5a62b0`,`#2e8a86`],tn=(e,t)=>e.start<t.end&&t.start<e.end,nn=[1,2,5,10,15,30,60,120,300];function rn(e,t){let[n,r]=(0,l.useState)({}),i=t.join(`,`);return(0,l.useEffect)(()=>{if(!e||!t.length)return;let n=!1,i=document.createElement(`video`);i.muted=!0,i.preload=`auto`,i.crossOrigin=`anonymous`,i.src=e;let a=document.createElement(`canvas`);a.width=112,a.height=63;let o=a.getContext(`2d`),s=0,c={};function l(){n||s>=t.length||(i.currentTime=Math.min(t[s],Math.max(0,(i.duration||t[s])-.05)))}return i.addEventListener(`loadeddata`,l),i.addEventListener(`seeked`,()=>{if(!(n||!o)){try{o.drawImage(i,0,0,a.width,a.height),c[s]=a.toDataURL(`image/jpeg`,.7)}catch{}s+=1,(s%8==0||s>=t.length)&&r({...c}),l()}}),()=>{n=!0,i.removeAttribute(`src`),i.load()}},[e,i]),n}function an({timeline:e,now:t,notes:n,video:r,onSeek:i,selected:a=null,onSelect:o,draft:s=null,onPlace:c,looks:u={},unreviewed:d=[],liveCaptions:f=[],onSelectCaption:p,onSelectShot:m,hidden:h=[]}){let _=new Set(d),v=e.frame_rate.num/e.frame_rate.den,y=Math.max(1,e.duration_frames),b=y/v,x=(0,l.useRef)(null),[S,C]=(0,l.useState)(800),[w,T]=(0,l.useState)(0),E=(0,l.useRef)(!1),D=(0,l.useRef)(null),[O,k]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=x.current;if(!e)return;let t=new ResizeObserver(()=>C(e.clientWidth-Zt));return t.observe(e),()=>t.disconnect()},[]);let A=Math.max(200,S)/b*2**w,j=b*A,M=e=>e/v*A,N=Ft(e).map((e,t)=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:g(`鏡頭 ${t+1}`,`Shot ${t+1}`),watchable:!!m})),P=e=>(e??``).replace(/\s+/g,` `),F=e=>u[e]?{tone:en[u[e].index%en.length],kind:u[e].name}:{},I=e.tracks.filter(e=>(e.kind===`title`||e.kind===`graphic`)&&e.track_id===`agent-subtitles`).flatMap(e=>e.items.map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:P(e.text),unchecked:_.has(e.item_id),watchable:!!p&&f.includes(e.item_id)}))),L=Ht(e).map(e=>e.items.filter(e=>e.item_id!==s?.id&&!h.includes(e.item_id)).map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:P(e.text),selectable:!!o,unchecked:_.has(e.item_id),...F(e.item_id)})));if(s){let t=Ht(e).flatMap(e=>e.items).find(e=>e.item_id===s.id);for(;L.length<=s.lane;)L.push([]);L[s.lane].push({id:s.id,start:s.start,end:s.end,label:P(t?.text),selectable:!0,...F(s.id)})}O&&L.push([]);let ee=(e,t)=>!(L[e]??[]).some(e=>e.id!==t.id&&tn(e,t)),R=Ft(e).flatMap(e=>(e.effects??[]).filter(e=>e.effect_id===`audio.layers`).flatMap(e=>e.parameters.layers??[]).map((t,n)=>{let r=e.start_frame+Number(t.start_frame??0);return{id:`${e.item_id}-${n}`,start:r,end:r+Number(t.duration_frames??0),label:g(`配樂`,`Music`)}})),te=I.length?3:2,z=[...L.map((e,t)=>({id:`g${t}`,name:`V${te+t}`,label:L.length>1?g(`元件 ${t+1}`,`Graphics ${t+1}`):g(`元件`,`Graphics`),spans:e,kind:`component`,lane:t})).reverse(),...I.length?[{id:`v2`,name:`V2`,label:g(`字幕`,`Captions`),spans:I,kind:`caption`}]:[],{id:`v1`,name:`V1`,label:g(`畫面`,`Picture`),spans:N,kind:`shot`},...R.length?[{id:`a1`,name:`A1`,label:g(`配樂`,`Music`),spans:R,kind:`music`}]:[]],B=[...L.flat(),...I].filter(e=>e.unchecked).sort((e,t)=>e.start-t.start);function V(){let e=B.find(e=>e.start>Math.round(t*v))??B[0];e&&i(e.start/v)}let ne=rn(r,N.map(e=>(e.start+Math.min(v,(e.end-e.start)/2))/v)),re=nn.find(e=>e*A>=64)??600,ie=Array.from({length:Math.floor(b/re)+1},(e,t)=>t*re);(0,l.useEffect)(()=>{let e=x.current;if(!e||E.current)return;let n=t*A;(n<e.scrollLeft||n>e.scrollLeft+e.clientWidth-Zt-40)&&(e.scrollLeft=Math.max(0,n-80))},[t,A]);function H(e){let t=x.current;if(!t)return;let n=t.getBoundingClientRect().left+Zt-t.scrollLeft,r=Math.min(b-1/v,Math.max(0,(e.clientX-n)/A));i(Math.round(r*v)/v)}function ae(e,t){let n=t.dataset.pick??``,r=L.findIndex(e=>e.some(e=>e.id===n)),i=L[r]?.find(e=>e.id===n);if(!i)return;let a=t.getBoundingClientRect(),o=e.clientX-a.left,s=!c||a.width<21?`move`:o<Qt?`left`:o>a.width-Qt?`right`:`move`;D.current={id:n,mode:s,x:e.clientX,y:e.clientY,row:t.closest(`.nle-track`)?.offsetHeight??30,from:{id:n,start:i.start,end:i.end,lane:r},moved:!1},e.currentTarget.setPointerCapture(e.pointerId)}function oe(e){let n=[0,y,Math.round(t*v),...N.flatMap(e=>[e.start,e.end])].reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t,e);return Math.abs(M(n)-M(e))<=$t?n:e}function se(e){let t=D.current;if(!t||!c)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.moved&&Math.abs(n)<4&&Math.abs(r)<4)return;t.moved||(t.moved=!0,k(!0));let i=Math.round(n/A*v),{from:a}=t,o=a.start,s=a.end,l=a.lane;if(t.mode===`left`)o=Math.max(0,Math.min(s-6,oe(a.start+i)));else if(t.mode===`right`)s=Math.min(y,Math.max(o+6,oe(a.end+i)));else{let e=a.end-a.start,n=a.start+i,c=oe(n)-n,u=oe(n+e)-n-e;o=n+(c&&(!u||Math.abs(c)<=Math.abs(u))?c:u),o=Math.max(0,Math.min(y-e,o)),s=o+e;let d=Math.max(0,Math.min(L.length-1,a.lane-Math.round(r/t.row))),f={id:t.id,start:o,end:s,lane:d};l=ee(d,f)?d:[...L.keys()].find(e=>e>=d&&ee(e,f))??L.length}c(t.id,o,s-o,l)}function ce(){let e=D.current;D.current=null,E.current=!1,e&&(e.moved?k(!1):o?.(e.id))}return(0,q.jsxs)(`div`,{className:`nle`,children:[(0,q.jsxs)(`div`,{className:`nle-toolbar`,children:[(0,q.jsx)(`span`,{className:`nle-clock`,children:Y(t,!0)}),(0,q.jsxs)(`span`,{className:`nle-duration`,children:[`/ `,Y(b)]}),B.length>0&&(0,q.jsxs)(`span`,{className:`nle-unseen`,title:g(`AI 這一版只看過部分畫面;虛線框的字幕與元件它沒有看過,建議先檢查。`,`The AI looked at only part of this version; it never saw the dashed captions and graphics. Check them first.`),children:[(0,q.jsx)(`span`,{className:`nle-unseen-key`,"aria-hidden":`true`}),g(`AI 沒看過 ${B.length} 處`,`${B.length} the AI did not see`),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:V,children:g(`跳到下一處`,`Next one`)})]}),(0,q.jsxs)(`label`,{className:`nle-zoom`,children:[g(`縮放`,`Zoom`),(0,q.jsx)(`input`,{type:`range`,min:0,max:6,step:1,value:w,onChange:e=>T(Number(e.target.value)),"aria-label":g(`時間軸縮放`,`Timeline zoom`)})]}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>T(0),disabled:w===0,children:g(`整部片`,`Whole film`)})]}),(0,q.jsx)(`div`,{className:`nle-scroll`,ref:x,children:(0,q.jsxs)(`div`,{className:`nle-canvas`,style:{width:j+Zt},onPointerDown:e=>{if(e.target.closest(`.nle-heads, .nle-marker`))return;let t=e.target.closest(`[data-pick]`);if(t&&o){ae(e,t);return}let n=e.target.closest(`[data-watch]`);if(n?.dataset.shot&&m){m(n.dataset.watch);return}if(n&&p){p(n.dataset.watch);return}E.current=!0,e.currentTarget.setPointerCapture(e.pointerId),H(e)},onPointerMove:e=>{D.current?se(e):E.current&&H(e)},onPointerUp:ce,onPointerCancel:ce,children:[(0,q.jsxs)(`div`,{className:`nle-ruler`,children:[(0,q.jsx)(`div`,{className:`nle-corner`}),(0,q.jsxs)(`div`,{className:`nle-ruler-track`,style:{width:j},children:[ie.map(e=>(0,q.jsx)(`span`,{className:`nle-tick`,style:{left:e*A},children:Y(e)},e)),n.filter(e=>e.at!==null).map(e=>(0,q.jsx)(`button`,{type:`button`,className:`nle-marker is-${e.kind}`,style:{left:(e.at??0)*A},title:`${Y(e.at??0)} ${e.label}`,"aria-label":g(`跳到注記 ${Y(e.at??0)}:${e.label}`,`Go to the note at ${Y(e.at??0)}: ${e.label}`),onClick:()=>i(e.at??0)},e.id))]})]}),z.map(e=>(0,q.jsxs)(`div`,{className:`nle-track is-${e.kind}`,children:[(0,q.jsxs)(`div`,{className:`nle-heads`,children:[(0,q.jsx)(`strong`,{children:e.name}),(0,q.jsx)(`span`,{children:e.label})]}),(0,q.jsx)(`div`,{className:`nle-lane${e.lane!==void 0&&O&&!e.spans.length?` is-new`:``}`,style:{width:j},children:e.spans.map((t,n)=>(0,q.jsx)(`div`,{className:`nle-clip${t.selectable||t.watchable?` is-pickable`:``}${t.selectable&&c?` is-movable`:``}${t.id===a?` is-selected`:``}${t.unchecked?` is-unseen`:``}`,"data-pick":t.selectable?t.id:void 0,"data-watch":t.watchable?t.id:void 0,"data-shot":e.kind===`shot`&&t.watchable?`1`:void 0,style:{left:M(t.start),width:Math.max(2,M(t.end)-M(t.start)),...e.kind===`shot`&&ne[n]?{backgroundImage:`url(${ne[n]})`}:{},...t.tone?{backgroundColor:t.tone}:{}},title:`${Y(t.start/v)}–${Y(t.end/v)} ${t.kind?`[${t.kind}]`:``}${t.label}${t.unchecked?g(`(AI 沒看過)`,` (the AI did not see this)`):``}${t.selectable?c?g(`(點一下編輯,拖曳改時間或換軌,拉兩端改長度)`,` (click to edit, drag to move it or change lanes, pull an end to change its length)`):g(`(點一下編輯)`,` (click to edit)`):t.watchable?g(`(點一下即時預覽)`,` (click to watch it live)`):``}`,children:M(t.end)-M(t.start)>44&&(0,q.jsx)(`span`,{children:t.label})},t.id))})]},e.id)),(0,q.jsx)(`span`,{className:`nle-playhead`,style:{left:Zt+t*A},"aria-hidden":`true`})]})})]})}var on=.5,sn=250;function cn(e){let{x:t,y:n,...r}=e,i=new TextEncoder().encode(JSON.stringify(r));return btoa(String.fromCharCode(...i)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function ln(e){let{projectId:t,runId:n,revisionId:r,timeline:i,component:a,caption:o,at:s,duration:c,onMove:u,limits:d}=e,f=i.frame_rate.num/i.frame_rate.den,{width:p,height:m}=i.canvas,h=`/api/projects/${encodeURIComponent(t)}/production/${encodeURIComponent(n)}/live`,_=`captionDraft`in e&&e.captionDraft?`&draft=${cn(e.captionDraft)}`:``,v=o?`${h}/caption?revision=${encodeURIComponent(r)}&item=${encodeURIComponent(o)}${_}`:`${h}/page?revision=${encodeURIComponent(r)}&draft=${cn(a)}`,[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)({shown:``,next:v}),[C,w]=(0,l.useState)(null),[T,E]=(0,l.useState)(!0),[D,O]=(0,l.useState)(1),k=(0,l.useRef)(null),A=(0,l.useRef)(null),j=(0,l.useRef)({}),M=(0,l.useRef)(!1),N=(0,l.useRef)(null),P=a?.x??0,F=a?.y??0;if((0,l.useEffect)(()=>{if(v===x.next||v===x.shown)return;let e=window.setTimeout(()=>S(e=>({...e,next:v})),sn);return()=>window.clearTimeout(e)},[v,x]),(0,l.useEffect)(()=>{let e=A.current;if(!e)return;let t=new ResizeObserver(()=>O(e.clientWidth/p));return t.observe(e),()=>t.disconnect()},[p]),(0,l.useEffect)(()=>{function e(e){let t=Object.entries(j.current).find(([,t])=>t?.contentWindow===e.source)?.[0],n=e.data;!t||!n||typeof n!=`object`||(n.clipenReady&&t===x.next&&(S({shown:t,next:``}),M.current=!1),typeof n.clipenFrame==`number`&&t===x.shown&&(M.current=!1,(n.box===null||n.box&&[n.box.x,n.box.y,n.box.width,n.box.height].every(Number.isFinite))&&w(n.box??null)))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[x]),(0,l.useEffect)(()=>{let e=0,t=-1,n=Math.max(0,s/f-on),r=Math.min(i.duration_frames,s+c)/f+on;function a(){let i=k.current,o=j.current[x.shown];if(i){(i.currentTime<n-.05||i.currentTime>=r)&&(i.currentTime=n);let e=Math.round(i.currentTime*f)-s,a=e>=0&&e<c;o&&(o.style.visibility=a?`visible`:`hidden`),a&&o?.contentWindow&&!M.current&&e!==t&&(M.current=!0,t=e,o.contentWindow.postMessage({frame:e,fps:f},`*`))}e=requestAnimationFrame(a)}return e=requestAnimationFrame(a),()=>cancelAnimationFrame(e)},[s,c,f,i.duration_frames,x.shown]),(0,l.useEffect)(()=>{let e=k.current;e&&(T?e.play().catch(()=>E(!1)):e.pause())},[T]),y)return(0,q.jsxs)(`div`,{className:`rv-live-fallback`,children:[(0,q.jsx)(Xt,{projectId:t,csrf:e.csrf,runId:n,revisionId:r,timeline:i,frame:e.frame,...a?{component:a,onMove:u,limits:d}:{}}),(0,q.jsx)(`div`,{className:`rv-motion-badge`,role:`status`,children:(0,q.jsx)(`span`,{children:g(`還沒輸出過這一版,先顯示靜態畫面;輸出一次後就能即時看動態`,`Not rendered yet, so this is a still; render once to see it move live`)})})]});function I(e){e.currentTarget.setPointerCapture(e.pointerId),N.current={x:P,y:F,clientX:e.clientX,clientY:e.clientY}}function L(e){let t=N.current,n=A.current?.getBoundingClientRect();!t||!n||!u||!d||u(Vt(t.x+(e.clientX-t.clientX)/n.width,d.x),Vt(t.y+(e.clientY-t.clientY)/n.height,d.y))}function ee(e){if(!u||!d)return;let t=e.shiftKey?.02:.005,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];n&&(e.preventDefault(),e.stopPropagation(),u(Vt(P+n[0],d.x),Vt(F+n[1],d.y)))}let R=p/m;return(0,q.jsxs)(`div`,{className:`rv-live`,ref:A,style:{aspectRatio:`${p}/${m}`,width:`min(100%, calc(max(300px, 100vh - 350px) * ${R}))`},children:[(0,q.jsx)(`video`,{ref:k,src:`${h}/cut?revision=${encodeURIComponent(r)}`,muted:!0,playsInline:!0,autoPlay:!0,preload:`auto`,onLoadedMetadata:e=>{e.currentTarget.currentTime=Math.max(0,s/f-on)},onError:()=>b(!0),"aria-label":g(`元件即時預覽`,`The graphic, live`)}),(0,q.jsx)(`div`,{className:`rv-live-page`,style:{width:p,height:m,transform:`scale(${D})`},children:[x.shown,x.next].filter(Boolean).map(e=>(0,q.jsx)(`iframe`,{ref:t=>{j.current[e]=t},src:e,title:g(`元件設計`,`Graphic design`),sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,tabIndex:-1,style:{width:p,height:m,left:P*p,top:F*m,opacity:+(e===x.shown)}},e))}),C&&u&&(0,q.jsx)(`div`,{className:`rv-grab`,role:`slider`,tabIndex:0,"aria-label":g(`元件位置,拖曳或用方向鍵移動`,`Graphic position; drag or use the arrow keys`),"aria-valuetext":g(`水平 ${Math.round(P*100)}%,垂直 ${Math.round(F*100)}%`,`${Math.round(P*100)}% across, ${Math.round(F*100)}% down`),style:{left:`${(C.x+P)*100}%`,top:`${(C.y+F)*100}%`,width:`${C.width*100}%`,height:`${C.height*100}%`},onPointerDown:I,onPointerMove:L,onPointerUp:()=>{N.current=null},onPointerCancel:()=>{N.current=null},onKeyDown:ee}),(0,q.jsxs)(`div`,{className:`rv-motion-badge`,role:`status`,children:[(0,q.jsx)(`span`,{children:x.next&&!x.shown?g(`正在載入…`,`Loading…`):o?g(`即時預覽 · 只顯示這句字幕,其他字幕與元件暫時隱藏`,`Live · this caption only; others are hidden for now`):g(`即時預覽 · 只顯示這個元件,字幕與其他元件暫時隱藏`,`Live · this graphic only; captions and others are hidden for now`)}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>E(!T),children:T?g(`暫停`,`Pause`):g(`播放`,`Play`)})]})]})}function un({visible:e,projectId:t,csrf:n,runId:r,data:i,video:a,disabled:o,locked:s,onChanged:c,onDirty:u,onSaveComponent:d,onSaveCaption:f,onRemoveComponent:p,onSaveSlip:m,stage:h,unreviewed:_=[],side:v=!0,report:y,composer:b}){let x=i.revision.timeline,S=x.frame_rate.num/x.frame_rate.den,C=i.references??{version:0,items:[]},w=(0,l.useRef)(null),T=`clipen:review-note-draft:${t}:${r}`,[E,D]=(0,l.useState)(()=>{try{return _t(localStorage.getItem(T))}catch{return null}}),O=E?.revisionId===i.revision.revision_id?E.form:null,k=E&&!O?E.form:null,[A,j]=(0,l.useState)(O?.at??0),[M,N]=(0,l.useState)(null),[P,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(null),ee=i.captions??{},[R,te]=(0,l.useState)(null),z=R?Ft(x).find(e=>e.item_id===R.id):void 0,B=R?i.shots?.[R.id]:void 0,V=P?x.tracks.find(e=>e.track_id===`agent-subtitles`)?.items.find(e=>e.item_id===P):void 0,ne=i.component_editing,re=M?ne?.components[M.id]:void 0;function ie(e){let t=e?{revisionId:i.revision.revision_id,form:e}:null;D(t);try{t?localStorage.setItem(T,JSON.stringify(t)):localStorage.removeItem(T)}catch{}}let[H,ae]=(0,l.useState)(!1),oe=!!y,[se,ce]=(0,l.useState)(oe?`report`:`notes`),[le,ue]=(0,l.useState)(oe);le!==oe&&(ue(oe),ce(oe?`report`:`notes`));let[de,fe]=(0,l.useState)(``),pe=Math.max(0,Math.min(x.duration_frames-1,Math.round(A*S))),U=O?Math.round(O.at*S):pe,he=Lt(x,U),ge=he[0],_e=(Ft(x).find(e=>e.item_id===ge?.id)?.effects??[]).filter(e=>e.effect_id===`audio.layers`).flatMap(e=>e.parameters.layers??[]);(0,l.useEffect)(()=>{u(!!(H||E))},[H,E,u]),(0,l.useEffect)(()=>{e||w.current?.pause()},[e]);function ve(e){j(e),w.current&&(w.current.currentTime=e)}function W(){w.current?.pause();let e=w.current?w.current.currentTime:A;N(null),j(e),fe(``),ie({referenceId:``,at:e,end:``,kind:k?.kind??`change`,target:``,note:k?.note??``,gain:k?.gain??-12,fill:k?.fill??!0,layer:``})}function ye(e){if(O)return;let t=x.tracks.find(e=>e.track_id===`agent-subtitles`)?.items.find(t=>t.item_id===e);if(!t)return;w.current?.pause(),fe(``),N(null),te(null),F(e);let n=(i.captions??{})[e];L({text:t.text??``,delivery:n?.delivery??`dialogue`,emphasis:(n?.emphasis??[]).join(`、`)}),ve((t.start_frame+t.duration_frames/2)/S)}function be(e){if(O)return;let t=Ft(x).find(t=>t.item_id===e);!t||!i.shots?.[e]||(w.current?.pause(),fe(``),N(null),F(null),te({id:e,frames:0}),ve(t.start_frame/S))}function G(e){!R||!B||te({...R,frames:Math.max(-B.earlier,Math.min(B.later,R.frames+e))})}function xe(e){if(O)return;let t=Gt(x,ne,e);if(!t){fe(g(`這個元件不能直接編輯,請記一筆注記交給 AI。`,`This graphic cannot be edited directly. Leave a note for the AI instead.`));return}w.current?.pause(),fe(``),F(null),te(null),N(t),ve((t.at+t.duration/2)/S)}function K(e,t,n,r){if(O)return;let i=M?.id===e?M:Gt(x,ne,e);if(!i){fe(g(`這個元件不能直接編輯,請記一筆注記交給 AI。`,`This graphic cannot be edited directly. Leave a note for the AI instead.`));return}M?.id!==e&&(w.current?.pause(),fe(``)),N({...i,...Wt(i,t,n),lane:r})}function Se(e){w.current?.pause();let t=(x.duration_frames-1)/S,n=w.current?w.current.currentTime:A,r=Math.max(0,Math.min(t,Math.round((n+e)*S)/S));ve(r),O&&ie({...O,at:r})}(0,l.useEffect)(()=>{if(!e)return;function t(e){if(e.key===`Escape`&&M){N(null);return}if(e.key===`Escape`&&P){F(null);return}if(e.key===`Escape`&&R){te(null);return}let t=e.target?.closest(`input, textarea, select, [contenteditable="true"]`),n=e.target?.closest(`video`);if(!(t||n&&n!==w.current||o||H||M||e.metaKey||e.ctrlKey||e.altKey)){if(R&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){e.preventDefault(),G((e.key===`ArrowLeft`?-1:1)*(e.shiftKey?Math.round(S):1));return}e.key.toLowerCase()===`m`&&!O?(e.preventDefault(),W()):(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),Se((e.key===`ArrowLeft`?-1:1)*(e.shiftKey?1/S:1)))}}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});function Ce(e){if(E)return;let t=e.current_range;if(!t){fe(g(`這筆注記的畫面已被改動,請刪除後在新的位置重新記一筆。`,`The picture under this note has changed. Delete it and add a new one where it belongs.`));return}let n=(t.at_frame??t.start_frame)/S;N(null),ve(n),fe(``),ie({referenceId:e.reference_id,at:n,end:e.explicit_range?Y((t.start_frame+t.duration_frames)/S,!0):``,kind:e.kind,target:e.element_id??``,note:e.note,gain:e.source_gain_db??-12,fill:e.fill_music??!0,layer:e.audio_layer_id??``})}async function Te(e){if(!(H||o)){ae(!0),fe(``);try{c(await we(n,t,r,i.revision.revision_id,C.version,e)),`reference`in e&&ie(null)}catch(e){fe(e instanceof Error?e.message:g(`無法儲存注記。`,`Could not save the note.`));try{let e=await me(t,r);e.references&&c(e.references)}catch{}}finally{ae(!1)}}}async function J(e,t=!1){if(!M||H)return;let n=M.id;ae(!0),fe(``);try{if(!await e())return;t?De(n):N(null)}finally{ae(!1)}}let[Ee,De]=(0,l.useState)(null),[Oe,ke]=(0,l.useState)(i.revision.revision_id);Oe!==i.revision.revision_id&&(ke(i.revision.revision_id),Ee&&(De(null),N(Gt(x,ne,Ee))));let Ae=O?.end.trim()?Pt(O.end):null,je=he.find(e=>e.id===O?.target),Me=``;O&&(ge?Ae!==null&&!(Ae>O.at)?Me=g(`結束時間要晚於標記的時間,例如 2:55。`,`The end must come after the marked moment, for example 2:55.`):!Et.includes(O.kind)&&!O.note.trim()&&(Me=g(`寫下要怎麼改。`,`Say what to change.`)):Me=g(`這個時間點沒有畫面,請換個位置。`,`There is no picture at this moment; pick another.`));function Ne(){if(!O||!ge||Me)return;let e,t;Ae===null?je?.text?(e=Math.max(ge.start,je.start),t=Math.min(ge.end,je.end)):(e=ge.start,t=ge.end):(e=U,t=Math.min(ge.end,Math.round(Ae*S))),Te({reference:{reference_id:O.referenceId||crypto.randomUUID(),kind:O.kind,item_id:ge.id,start_offset_frames:e-ge.start,duration_frames:Math.max(1,t-e),note:O.note.trim(),at_offset_frames:U-ge.start,explicit_range:Ae!==null,...je?.text?{element_id:je.id}:{},...O.kind===`audio`?{source_gain_db:O.gain,fill_music:O.fill,...O.layer?{audio_layer_id:O.layer}:{}}:{}}})}let Pe=C.items.map(e=>({item:e,...Rt(e,x)})).sort((e,t)=>(e.at??1/0)-(t.at??1/0)),Fe=M&&re?Math.min(x.duration_frames-1,M.at+Math.floor(M.duration/2)):pe,Ie;if(M&&re&&ne)Ie=(0,q.jsx)(Yt,{edit:M,settings:re,editing:ne,fps:S,busy:H,disabled:o||!!s,locked:s,onChange:N,onCancel:()=>N(null),onSave:()=>void J(()=>d(Kt(M)),!0),onRemove:()=>void J(()=>p(M.id))});else if(R&&z&&B){let e=Math.abs(R.frames)/S,t=B.source_start_seconds+R.frames/S;Ie=(0,q.jsxs)(`div`,{className:`rv-inspector`,children:[(0,q.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,q.jsx)(`h4`,{children:g(`微調取用片段`,`Slip the shot`)}),(0,q.jsx)(`span`,{className:`rv-time`,children:Y(z.start_frame/S)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`關閉`,`Close`),onClick:()=>te(null),children:`×`})]}),(0,q.jsx)(`p`,{className:`rv-slip-amount`,"aria-live":`polite`,children:R.frames===0?g(`還沒移動`,`Not moved yet`):R.frames>0?g(`取用往後 ${e.toFixed(2)} 秒`,`${e.toFixed(2)} s later in the footage`):g(`取用往前 ${e.toFixed(2)} 秒`,`${e.toFixed(2)} s earlier in the footage`)}),(0,q.jsx)(`p`,{className:`rv-hint`,children:g(`毛片 ${Y(t,!0)}–${Y(t+z.duration_frames/S,!0)}`,`Footage ${Y(t,!0)}–${Y(t+z.duration_frames/S,!0)}`)}),(0,q.jsxs)(`div`,{className:`rv-row rv-slip-steps`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:H||R.frames<=-B.earlier,onClick:()=>G(-1),children:g(`← 往前一格`,`← A frame earlier`)}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:H||R.frames>=B.later,onClick:()=>G(1),children:g(`往後一格 →`,`A frame later →`)})]}),(0,q.jsx)(`p`,{className:`rv-hint`,children:g(`按 ← → 一次移一格,加 Shift 一次移一秒。這個鏡頭在影片裡的位置和長度不變,只換成毛片裡前後的畫面;這段的原音和字幕會跟著移動,其他鏡頭都不受影響。`,`Press ← → to move a frame, with Shift a second. The shot keeps its place and length in the film and shows an earlier or later stretch of its footage; its sound and captions move with it, and no other shot changes.`)}),(0,q.jsx)(`p`,{className:`rv-hint`,children:g(`最多往前 ${(B.earlier/S).toFixed(1)} 秒、往後 ${(B.later/S).toFixed(1)} 秒。`,`Up to ${(B.earlier/S).toFixed(1)} s earlier and ${(B.later/S).toFixed(1)} s later.`)}),(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:o||H||!!s||R.frames===0,onClick:()=>{ae(!0),m({item_id:R.id,frames:R.frames}).then(e=>{e&&te(null)}).finally(()=>ae(!1))},children:H?g(`儲存中…`,`Saving…`):g(`儲存`,`Save`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>te(null),children:g(`取消`,`Cancel`)})]})]})}else if(V&&ee[V.item_id]&&I){let e=ee[V.item_id],t={element_id:V.item_id,text:I.text.trim(),delivery:I.delivery,emphasis:I.emphasis.split(/[、,,\s]+/).filter(Boolean)},n=t.text!==V.text||t.delivery!==e.delivery||t.emphasis.join(`、`)!==e.emphasis.join(`、`),r=t.text.length>0&&t.text.length<=80;Ie=(0,q.jsxs)(`div`,{className:`rv-inspector`,children:[(0,q.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,q.jsx)(`h4`,{children:g(`字幕`,`Caption`)}),(0,q.jsx)(`span`,{className:`rv-time`,children:Y(V.start_frame/S)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`關閉`,`Close`),onClick:()=>F(null),children:`×`})]}),(0,q.jsxs)(`label`,{children:[g(`文字`,`Words`),(0,q.jsx)(`textarea`,{className:`rv-caption-input`,rows:2,maxLength:80,value:I.text,disabled:o||H,onChange:e=>L({...I,text:e.target.value.replace(/\n/g,``)})})]}),(0,q.jsxs)(`label`,{children:[g(`語氣`,`Delivery`),(0,q.jsxs)(`select`,{value:I.delivery,disabled:o||H,onChange:e=>L({...I,delivery:e.target.value}),children:[(0,q.jsx)(`option`,{value:`dialogue`,children:g(`一般對話`,`Dialogue`)}),(0,q.jsx)(`option`,{value:`punchline`,children:g(`重點句`,`Punchline`)}),(0,q.jsx)(`option`,{value:`quiet`,children:g(`小聲帶過`,`Quiet`)})]})]}),(0,q.jsxs)(`label`,{children:[g(`強調的字`,`Emphasised words`),(0,q.jsx)(`input`,{value:I.emphasis,placeholder:g(`用頓號分開,例如:雷門、最熱門`,`Separate with commas`),disabled:o||H,onChange:e=>L({...I,emphasis:e.target.value})})]}),(0,q.jsx)(`p`,{className:`rv-hint`,children:e.live?g(`改字、語氣或強調,畫面會即時更新;字幕的樣子由 AI 設計,想改樣子就寫給 AI。`,`Change the words, delivery or emphasis and the picture follows at once; to change how captions look, tell the AI.`):g(`這句是較早的字幕樣式,存檔後會在新影片裡看到。`,`This caption uses the earlier style; you will see the change in the new film.`)}),(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:o||H||!n||!r,onClick:()=>{ae(!0),f(t).finally(()=>ae(!1))},children:H?g(`儲存中…`,`Saving…`):g(`儲存`,`Save`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>F(null),children:g(`取消`,`Cancel`)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button`,onClick:()=>{let e=V.start_frame/S;F(null),ve(e),W()},children:g(`記一筆給 AI`,`Note it for the AI`)})]})]})}else Ie=O?(0,q.jsxs)(`fieldset`,{className:`rv-note-form`,disabled:o||H,children:[(0,q.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,q.jsx)(`h4`,{children:O.referenceId?g(`修改注記`,`Edit note`):g(`記一筆`,`New note`)}),(0,q.jsx)(`span`,{className:`rv-time`,children:Y(O.at,!0)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`取消`,`Cancel`),onClick:()=>ie(null),children:`×`})]}),(0,q.jsx)(`div`,{className:`review-chips`,role:`radiogroup`,"aria-label":g(`要怎麼處理`,`What to do`),children:wt.map(([e,t])=>(0,q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":O.kind===e,className:`review-chip is-${e}`,onClick:()=>ie({...O,kind:e}),children:t},e))}),he.length>1&&(0,q.jsx)(`div`,{className:`review-chips`,role:`radiogroup`,"aria-label":g(`指的是`,`About`),children:he.map((e,t)=>(0,q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===0?!je?.text:O.target===e.id,className:`review-chip`,onClick:()=>ie({...O,target:t===0?``:e.id}),children:e.label},e.id))}),(0,q.jsx)(`textarea`,{"aria-label":g(`注記說明`,`Note`),rows:3,maxLength:2e3,value:O.note,placeholder:Dt[O.kind],onChange:e=>ie({...O,note:e.target.value}),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!Me&&Ne()}}),O.kind===`audio`&&(0,q.jsxs)(q.Fragment,{children:[_e.length>0&&(0,q.jsxs)(`label`,{children:[g(`哪個聲音`,`Which sound`),(0,q.jsxs)(`select`,{value:O.layer,onChange:e=>ie({...O,layer:e.target.value}),children:[(0,q.jsx)(`option`,{value:``,children:g(`這段素材的原音`,`This clip's own sound`)}),_e.map(e=>(0,q.jsx)(`option`,{value:String(e.layer_id),children:i.audio_assets.find(t=>t.asset_id===e.asset_id)?.name??g(`配樂/音效`,`Music or effect`)},String(e.layer_id)))]})]}),(0,q.jsxs)(`label`,{children:[g(`降低音量 ${O.gain} dB`,`Lower to ${O.gain} dB`),(0,q.jsx)(`input`,{"aria-label":g(`希望降低音量`,`How much quieter`),type:`range`,min:-60,max:0,step:1,value:O.gain,onChange:e=>ie({...O,gain:Number(e.target.value)})})]}),(0,q.jsxs)(`label`,{className:`consent-check`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:O.fill,onChange:e=>ie({...O,fill:e.target.checked})}),g(`讓配樂補滿這段`,`Let the music fill in`)]})]}),(0,q.jsxs)(`details`,{className:`rv-range`,open:!!O.end,children:[(0,q.jsx)(`summary`,{children:g(`只改其中一段`,`Only part of it`)}),(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`input`,{"aria-label":g(`結束時間`,`End time`),value:O.end,placeholder:g(`到 2:55`,`to 2:55`),onChange:e=>ie({...O,end:e.target.value})}),a&&(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>ie({...O,end:Y(w.current?.currentTime??A,!0)}),children:g(`到目前時間`,`To now`)})]})]}),Me&&O.note&&(0,q.jsx)(`p`,{className:`rv-hint`,children:Me}),(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!!Me,onClick:Ne,children:H?g(`儲存中…`,`Saving…`):g(`記下`,`Save note`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>ie(null),children:g(`取消`,`Cancel`)})]})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,q.jsx)(`h4`,{children:g(`注記`,`Notes`)}),Pe.length>0&&(0,q.jsx)(`span`,{className:`rv-count`,children:Pe.length}),(0,q.jsxs)(`button`,{type:`button`,className:`button secondary rv-mark`,disabled:o||H,onClick:W,children:[g(`記一筆`,`Add note`),(0,q.jsx)(`kbd`,{children:`M`})]})]}),k&&(0,q.jsxs)(`div`,{className:`rv-outdated`,role:`status`,children:[(0,q.jsx)(`p`,{children:g(`上一版有一筆沒記下的注記:「${k.note}」`,`An unsaved note from the previous version: “${k.note}”`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>ie(null),children:g(`不要了`,`Discard`)})]}),Pe.length?(0,q.jsx)(`ol`,{className:`rv-notes`,children:Pe.map(({item:e,at:t,time:n,target:r})=>(0,q.jsxs)(`li`,{className:`is-${e.kind}`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`rv-note-jump`,disabled:t===null,onClick:()=>{t!==null&&ve(t)},"aria-label":g(`跳到 ${n}`,`Go to ${n}`),children:[(0,q.jsx)(`span`,{className:`rv-time`,children:n}),(0,q.jsx)(`span`,{className:`review-kind is-${e.kind}`,children:Tt[e.kind]}),(0,q.jsx)(`span`,{className:`rv-note-target`,children:r}),e.note&&(0,q.jsx)(`span`,{className:`rv-note-text`,children:e.note}),(e.current_range?.element_present===!1||!e.current_range)&&(0,q.jsx)(`small`,{children:g(`畫面已經改過,AI 會依原始素材找回位置。`,`The picture has changed; the AI finds the spot again from the original footage.`)})]}),(0,q.jsxs)(`div`,{className:`rv-note-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:o||H||!!E,onClick:()=>Ce(e),children:g(`修改`,`Edit`)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:o||H,onClick:()=>void Te({delete_id:e.reference_id}),children:g(`刪除`,`Delete`)})]})]},e.reference_id))}):(0,q.jsxs)(`div`,{className:`rv-empty`,children:[(0,q.jsxs)(`p`,{children:[g(`看到要改的地方,按 `,`See something to change? Press `),(0,q.jsx)(`kbd`,{children:`M`}),g(` 記一筆。`,` to add a note.`)]}),(0,q.jsx)(`p`,{children:g(`想改畫面上的字,點時間線上紫色的元件;拖曳它可以改時間或換軌,拉兩端可以改長度。`,`To change on-screen text, click a purple graphic on the timeline; drag it to move it or change lanes, pull an end to change its length.`)})]})]});let Le=v||!!O||!!M||!!V||!!R,Re=!!y&&!O&&!M&&!V&&!R,ze=Re?se:`notes`;return(0,q.jsxs)(`section`,{className:`rv-studio${Le?``:` is-wide`}`,"aria-label":g(`審片`,`Review`),children:[(0,q.jsx)(`div`,{className:`rv-stage`,children:h??(R&&z?(0,q.jsx)(`div`,{className:`rv-slip-stage`,children:[[g(`開頭`,`Start`),z.start_frame],[g(`結尾`,`End`),z.start_frame+z.duration_frames-1]].map(([e,a])=>(0,q.jsxs)(`figure`,{children:[(0,q.jsx)(Xt,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:x,frame:a,slip:R.frames?{item_id:R.id,frames:R.frames}:void 0}),(0,q.jsx)(`figcaption`,{children:e})]},e))}):M?(0,q.jsx)(ln,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:x,frame:Fe,component:Kt(M),at:M.at,duration:M.duration,limits:Bt,onMove:(e,t)=>N({...M,x:e,y:t})}):V&&ee[V.item_id]?.live?(0,q.jsx)(ln,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:x,frame:Fe,caption:V.item_id,at:V.start_frame,duration:V.duration_frames,captionDraft:I?{text:I.text.trim()||(V.text??``),delivery:I.delivery,emphasis:I.emphasis.split(/[、,,\s]+/).filter(Boolean)}:void 0}):V?(0,q.jsx)(Xt,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:x,frame:Math.round(V.start_frame+V.duration_frames/2)}):a?(0,q.jsx)(`video`,{ref:w,controls:!0,preload:`metadata`,src:a.media_url,"aria-label":g(`審片用影片`,`Film under review`),onLoadedMetadata:e=>{e.currentTarget.currentTime=A},onTimeUpdate:e=>j(e.currentTarget.currentTime),onSeeked:e=>j(e.currentTarget.currentTime)}):(0,q.jsx)(Xt,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:x,frame:Fe}))}),Le&&(0,q.jsxs)(`aside`,{className:`rv-panel${Re?` has-tabs`:``}`,children:[Re&&(0,q.jsxs)(`div`,{className:`rv-tabs`,role:`tablist`,children:[(0,q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":ze===`report`,onClick:()=>ce(`report`),children:[g(`AI 說明`,`AI report`),(0,q.jsx)(`i`,{"aria-hidden":`true`})]}),(0,q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":ze===`notes`,onClick:()=>ce(`notes`),children:[g(`注記`,`Notes`),Pe.length>0&&(0,q.jsx)(`span`,{className:`rv-count`,children:Pe.length})]})]}),de&&(0,q.jsx)(`p`,{role:`alert`,className:`rv-error`,children:de}),ze===`report`?y:Ie]}),b,(0,q.jsx)(an,{unreviewed:_,timeline:x,now:A,video:a?.media_url??null,selected:M?.id??P??R?.id??null,onSelect:O?void 0:xe,liveCaptions:Object.keys(ee),onSelectCaption:O?void 0:ye,onSelectShot:O||o||s?void 0:be,hidden:Ht(x).flatMap(e=>e.items).filter(e=>!ne?.components[e.item_id]).map(e=>e.item_id),draft:M?{id:M.id,start:M.at,end:M.at+M.duration,lane:M.lane}:null,onPlace:O||o||s||H?void 0:K,looks:Object.fromEntries(Object.entries(ne?.components??{}).flatMap(([e,t])=>{let n=ne?.looks?.findIndex(n=>n.look_id===(e===M?.id?M.look:t.look_id))??-1;return n>=0?[[e,{name:ne.looks[n].name,index:n}]]:[]})),onSeek:e=>{ve(e),O&&ie({...O,at:e})},notes:Pe.map(({item:e,at:t,target:n})=>({id:e.reference_id,at:t,label:`${Tt[e.kind]} ${n}`,kind:e.kind}))})]})}function dn({looks:e,fonts:t,disabled:n,onSave:r}){let[i,a]=(0,l.useState)({}),[o,s]=(0,l.useState)(``);return e.length?(0,q.jsxs)(`div`,{className:`rv-looks`,children:[(0,q.jsx)(`p`,{className:`rv-looks-intro`,children:g(`同一類元件共用一套字型和配色。改這裡,用這套外觀的元件會一起換;版面和動畫不變。`,`Graphics of one kind share fonts and colours. Change them here and every graphic with this look follows; layout and animation stay.`)}),e.map(e=>{let c=i[e.look_id]??{fonts:{},colors:{}},l=Object.keys(c.fonts).length+Object.keys(c.colors).length>0,u=t=>a(n=>({...n,[e.look_id]:t}));async function d(){s(e.look_id);let t=await r(e.look_id,c);s(``),t&&a(t=>{let{[e.look_id]:n,...r}=t;return r})}return(0,q.jsxs)(`section`,{className:`rv-look`,"aria-label":g(`${e.name}外觀`,`${e.name} look`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`strong`,{children:e.name}),(0,q.jsx)(`span`,{children:e.used_by?g(`${e.used_by} 個元件`,`${e.used_by} ${v(e.used_by,`graphic`,`graphics`)}`):g(`還沒有元件使用`,`Not used yet`)})]}),e.fonts.map(e=>{let r=c.fonts[e.key]??e.family;return(0,q.jsxs)(`label`,{className:`rv-look-font`,children:[e.label,(0,q.jsx)(`select`,{value:r,disabled:n,style:{fontFamily:`"${r}", "PingFang TC", sans-serif`},onChange:t=>{let{[e.key]:n,...r}=c.fonts;u({...c,fonts:t.target.value===e.family?r:{...r,[e.key]:t.target.value}})},children:t.map(e=>(0,q.jsx)(`option`,{value:e.family,children:e.label},e.family))})]},e.key)}),e.colors.length>0&&(0,q.jsx)(`div`,{className:`rv-colors`,role:`group`,"aria-label":g(`${e.name}的顏色`,`${e.name} colours`),children:e.colors.map(e=>{let t=c.colors[e.key]??e.value;return(0,q.jsxs)(`label`,{className:`rv-swatch`,title:e.label,children:[(0,q.jsx)(`input`,{type:`color`,value:t,disabled:n,"aria-label":e.label,onChange:t=>{let{[e.key]:n,...r}=c.colors;u({...c,colors:t.target.value.toLowerCase()===e.value?r:{...r,[e.key]:t.target.value.toLowerCase()}})}}),(0,q.jsx)(`span`,{style:{background:t}}),e.label]},e.key)})}),l&&(0,q.jsxs)(`div`,{className:`rv-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:n||!!o,onClick:()=>void d(),children:o===e.look_id?g(`套用中…`,`Applying…`):g(`套用`,`Apply`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:!!o,onClick:()=>u({fonts:{},colors:{}}),children:g(`取消`,`Cancel`)})]})]},e.look_id)})]}):(0,q.jsx)(`p`,{className:`rv-looks-empty`,children:g(`AI 還沒有替元件定外觀。較早做的元件沒有外觀;請 AI 重新設計後,就能在這裡統一換字型和配色。`,`The AI has not set looks for the graphics yet. Older graphics have none; once the AI redesigns them, you can change their fonts and colours together here.`)})}function fn({report:e,request:t}){let n=!e.changes.length&&!e.notes.length&&!e.not_done.length;return(0,q.jsxs)(`div`,{className:`rv-report-body`,children:[t&&(0,q.jsxs)(`p`,{className:`rv-report-request`,children:[(0,q.jsx)(`span`,{children:g(`你的要求`,`You asked`)}),t]}),e.summary&&(0,q.jsx)(`p`,{className:`rv-report-summary`,children:e.summary}),e.changes.length>0&&(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h5`,{children:g(`改了什麼`,`What changed`)}),(0,q.jsx)(`ol`,{className:`rv-report-changes`,children:e.changes.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`strong`,{children:e.what}),(0,q.jsx)(`span`,{children:e.why})]},t))})]}),e.notes.length>0&&(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h5`,{children:g(`你的注記`,`Your notes`)}),(0,q.jsx)(`ul`,{className:`rv-report-notes`,children:e.notes.map(e=>(0,q.jsxs)(`li`,{className:`is-${e.outcome}`,children:[(0,q.jsx)(`span`,{className:`rv-report-outcome`,children:e.outcome_label}),(0,q.jsxs)(`div`,{children:[e.note&&(0,q.jsx)(`q`,{children:e.note}),(0,q.jsx)(`p`,{children:e.explanation}),e.reason_label&&(0,q.jsx)(`small`,{className:`rv-report-reason`,children:e.reason_label})]})]},e.reference_id))})]}),e.not_done.length>0&&(0,q.jsxs)(`section`,{className:`rv-report-missing`,children:[(0,q.jsx)(`h5`,{children:g(`沒做到的地方`,`Not done`)}),(0,q.jsx)(`ul`,{children:e.not_done.map((e,t)=>(0,q.jsxs)(`li`,{className:e.reason?`is-${e.reason}`:void 0,children:[e.reason_label&&(0,q.jsx)(`span`,{className:`rv-report-reason`,children:e.reason_label}),(0,q.jsx)(`strong`,{children:e.what}),e.detail&&(0,q.jsx)(`span`,{children:e.detail})]},t))}),e.not_done.some(e=>e.reason===`needs_you`)&&(0,q.jsx)(`p`,{className:`rv-hint`,children:g(`回覆「需要你決定或提供」的項目後,下一次修改 AI 會接著做。`,`Answer the items marked “needs you” and the AI picks them up in the next revision.`)})]}),n&&(0,q.jsx)(`p`,{className:`rv-hint`,children:g(`這一版是在 Clipen 要求修改說明之前做的,只有上面這句摘要。`,`This version was made before Clipen asked for change reports, so there is only the summary above.`)})]})}var pn={film:`M4 3h16v18H4zM4 8h16M4 16h16M8 3v5m8-5v5M8 16v5m8-5v5`,play:`m9 5 11 7-11 7V5Z`,edit:`m14 5 5 5M4 20l4-1L20 7a2.1 2.1 0 0 0-3-3L5 16l-1 4Z`,sparkle:`m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Zm7-2v4m-2-2h4`,folder:`M3 7V5h6l2 2h10v13H3V7Z`,plus:`M12 5v14M5 12h14`,arrow:`M5 12h14m-6-6 6 6-6 6`,audio:`M4 9v6m4-10v14m4-16v18m4-16v14m4-10v6`,text:`M4 5h16M12 5v15m-4 0h8`,layers:`m12 3 10 5-10 5L2 8l10-5Zm-9 9 9 5 9-5M3 16l9 5 9-5`,download:`M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5`,check:`m5 12 4 4L19 6`,"arrow-left":`M19 12H5m6-6-6 6 6 6`,sidebar:`M3 4h18v16H3zM15 4v16`,star:`m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3l-5.6 2.9 1.1-6.2L3 9.6l6.2-.9L12 3Z`};function mn({name:e,size:t=18,style:n}){return(0,q.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:n,children:(0,q.jsx)(`path`,{d:pn[e]})})}var hn=`https://github.com/IMGMANISME/clipen`,gn=`clipen:star-asked`;function _n(){let[e,t]=(0,l.useState)(!1);function n(){try{if(localStorage.getItem(gn)===`yes`)return;localStorage.setItem(gn,`yes`)}catch{return}t(!0)}return[e,n,()=>t(!1)]}function vn(){return(0,q.jsxs)(`a`,{className:`star-link`,href:hn,target:`_blank`,rel:`noreferrer`,title:g(`在 GitHub 給 Clipen 一顆星`,`Star Clipen on GitHub`),"aria-label":g(`在 GitHub 給 Clipen 一顆星`,`Star Clipen on GitHub`),children:[(0,q.jsx)(mn,{name:`star`,size:14}),`GitHub`]})}function yn({onClose:e}){return(0,q.jsxs)(`aside`,{className:`star-card`,role:`status`,"aria-label":g(`在 GitHub 給 Clipen 一顆星`,`Star Clipen on GitHub`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`影片做好了 🎉`,`Your film is ready 🎉`)}),(0,q.jsx)(`p`,{children:g(`如果 Clipen 幫上忙,到 GitHub 給它一顆星,讓更多人找到它。`,`If Clipen helped, a star on GitHub helps others find it.`)}),(0,q.jsxs)(`a`,{className:`button primary`,href:hn,target:`_blank`,rel:`noreferrer`,onClick:e,children:[(0,q.jsx)(mn,{name:`star`,size:14}),g(`到 GitHub 給星`,`Star on GitHub`)]})]}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`關閉`,`Close`),onClick:e,children:`×`})]})}var bn=``;function xn(){try{`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission()}catch{}}function Sn(e,t){if(!document.hidden)return;bn||=document.title,document.title=`✓ ${e} · ${bn}`;let n=()=>{document.hidden||(document.title=bn,document.removeEventListener(`visibilitychange`,n))};document.addEventListener(`visibilitychange`,n);try{if(`Notification`in window&&Notification.permission===`granted`){let n=new Notification(e,{body:t,tag:`clipen-done`});n.onclick=()=>{window.focus(),n.close()}}}catch{}}var Cn={film:()=>g(`Clipen:影片做好了`,`Clipen: your film is ready`),stopped:()=>g(`Clipen:AI 停下來了`,`Clipen: the AI stopped`),rendered:()=>g(`Clipen:新影片輸出好了`,`Clipen: the new film is rendered`)},wn=8e3,Tn=!1;function En({visible:e,toolSlot:t,onAddFootage:n,projectId:r,csrf:i,runId:a,revisionId:o,active:s,onChanged:c,musicId:u,onMusicChange:d,previews:f,runProvider:p,aiReview:m=null}){let h=je(),_=!!(p&&h.id&&p!==h.id),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),[C,w]=(0,l.useState)(``),[T,E]=(0,l.useState)(``),[D,O]=St(r,`refinement`,``,a),[k,A]=Ct(h.id),[j,M]=(0,l.useState)(!1),[N,P]=(0,l.useState)(!1),[F,I]=(0,l.useState)(null),[L,ee]=(0,l.useState)(!1),[R,te]=(0,l.useState)(null),[z,B]=(0,l.useState)(null),[V,ne]=(0,l.useState)(null),[re,ie,H]=_n(),[ae,oe]=(0,l.useState)(()=>{try{return localStorage.getItem(`clipen:review-side`)!==`closed`}catch{return!0}});function se(e){oe(e);try{localStorage.setItem(`clipen:review-side`,e?`open`:`closed`)}catch{}}let ce=`clipen:report-read:${r}:${a}`,[le,ue]=(0,l.useState)(()=>{try{return localStorage.getItem(ce)}catch{return null}});function de(e){ue(e);try{localStorage.setItem(ce,e)}catch{}}(0,l.useEffect)(()=>{let e=!1;return me(r,a).then(t=>{e||(b(t),I(null),te(null))}).catch(t=>{e||w(String(t))}),()=>{e=!0}},[r,a,o]),(0,l.useEffect)(()=>{if(!T)return;let e=window.setTimeout(()=>E(``),4e3);return()=>window.clearTimeout(e)},[T]);let fe=y?.revision.revision_id,pe=f.find(e=>e?.state===`succeeded`&&e.revision_id===fe)??null,be=f.find(e=>e&&e.revision_id===fe&&[`queued`,`running`].includes(e.state))??null,G=!!be,xe=(0,l.useRef)(G);(0,l.useEffect)(()=>{xe.current&&!G&&pe&&Sn(Cn.rendered(),g(`回到 Clipen 看新的版本。`,`Come back to watch the new version.`)),xe.current=G},[G,pe]);let K=x||s,Se=y?.references?.items??[],we=y?zt(D,Se,y.revision.timeline):``,Te=y?.history.find(e=>e.revision_id===fe),J=Te&&Te===y?.history[0]&&Te.kind===`ai_complete`&&Te.report&&le!==Te.revision_id?Te:null,Ee=y?y.revision.timeline.duration_frames*y.revision.timeline.frame_rate.den/y.revision.timeline.frame_rate.num:0,De=pe?null:f.find(e=>e?.state===`succeeded`&&e.revision_id!==fe)??null,Oe=y?.history.find(e=>e.revision_id===De?.revision_id),ke=pe??(De&&Oe?.duration_seconds!=null&&Math.abs(Oe.duration_seconds-Ee)<.05?De:null);async function Ae(e,t){if(x||s||!y)return!1;S(!0),w(``),E(``);let n=!1;try{await e(),E(t),n=!0}catch(e){w(e instanceof Error?e.message:g(`這次操作沒有完成。`,`That did not finish.`))}finally{try{b(await me(r,a))}catch{}c(),S(!1)}return n}function Me(){if(!y)return;xn();let e=we.length<=wn?we:g(`${D.trim()||`請依審片注記修改目前影片,其他部分保留。`}\n\n(共 ${Se.length} 筆審片注記,詳見附帶的注記資料。)`,`${D.trim()||`Change the current film as the review notes say; keep everything else.`}\n\n(${Se.length} review notes; see the attached note data.)`).slice(0,wn);M(!1),Ae(async()=>{await ye(i,r,a,y.revision.revision_id,e,u||void 0,y.references?.version??0),O(``)},g(`AI 開始修改了。`,`The AI has started on your changes.`))}async function Pe(e){let t=(await e).revision?.revision_id;t&&await W(i,r,a,t).catch(()=>{})}function Fe(){y&&Ae(()=>W(i,r,a,y.revision.revision_id),g(`開始輸出這一版,好了就能播放。`,`Rendering this version; it plays once it is ready.`))}function Ie(e){y&&(B(null),Ae(()=>U(i,r,a,y.revision.revision_id,e.revision_id),g(`已回到${At(e.created_at)} 的樣子。`,`Back to ${At(e.created_at)}.`)).then(e=>{e&&te(null)}))}let Le=(0,l.useRef)({undone:[],landed:null});(0,l.useEffect)(()=>{if(!e||!y)return;function t(e){if(!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`z`||K||!y)return;let t=e.target;if(t&&t.closest(`input, textarea, select, [contenteditable="true"]`))return;let n=y.revision.revision_id;if(Le.current.landed!==n&&(Le.current={undone:[],landed:null}),e.preventDefault(),e.shiftKey){let e=Le.current.undone.pop(),t=e?y.history.find(t=>t.revision_id===e):void 0;if(!t){E(g(`沒有可以重做的版本。`,`Nothing to redo.`));return}Le.current.landed=t.revision_id,Ae(()=>U(i,r,a,n,t.revision_id),g(`已重做。`,`Redone.`));return}let o=new Set([n,...Le.current.undone]),s=y.history.find(e=>!o.has(e.revision_id));if(!s){E(g(`已經是最早的版本了。`,`This is the earliest version.`));return}Le.current.undone.push(n),Le.current.landed=s.revision_id,Ae(()=>U(i,r,a,n,s.revision_id),g(`已復原到${At(s.created_at)} 的樣子(⇧⌘Z 重做)。`,`Back to ${At(s.created_at)} (⇧⌘Z to redo).`))}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let Re=R?.preview_url?(0,q.jsxs)(`div`,{className:`rv-compare`,children:[(0,q.jsx)(`video`,{controls:!0,autoPlay:!0,preload:`metadata`,src:R.preview_url,"aria-label":g(`${At(R.created_at)} 的影片`,`The film from ${At(R.created_at)}`)},R.preview_url),(0,q.jsxs)(`div`,{className:`rv-compare-bar`,children:[(0,q.jsxs)(`span`,{children:[g(`正在看`,`Watching the film from `),(0,q.jsx)(`strong`,{children:At(R.created_at)}),g(`的影片:${Nt(R)}。現在的影片不受影響。`,`: ${Nt(R)}. The current film is not affected.`)]}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:K,onClick:()=>B(R),children:g(`回到這裡`,`Go back to this`)}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>te(null),children:g(`回到現在`,`Back to now`)})]})]}):void 0;(0,l.useEffect)(()=>(document.documentElement.classList.toggle(`is-reviewing`,e),()=>document.documentElement.classList.remove(`is-reviewing`)),[e]);let ze=(0,q.jsxs)(`header`,{className:`rv-bar`,children:[(0,q.jsxs)(`div`,{className:`rv-title`,children:[(0,q.jsx)(`h3`,{children:g(`審片`,`Review`)}),y&&(0,q.jsxs)(`span`,{children:[Te?g(`已儲存 · ${At(Te.created_at)}`,`Saved · ${At(Te.created_at)}`):g(`目前的影片`,`Current film`),` · `,Y(Ee)]})]}),(0,q.jsxs)(`div`,{className:`rv-tools`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`button secondary rv-side-toggle`,"aria-pressed":ae,onClick:()=>se(!ae),children:[(0,q.jsx)(mn,{name:`sidebar`,size:16}),ae?g(`收起側欄`,`Hide panel`):g(`顯示側欄${Se.length?`(${Se.length})`:``}`,`Show panel${Se.length?` (${Se.length})`:``}`)]}),y&&!pe&&!G&&(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:K,onClick:Fe,children:g(`輸出這一版`,`Render this version`)}),(0,q.jsx)(On,{label:g(`元件外觀`,`Graphic looks`),disabled:!y,children:()=>(0,q.jsx)(dn,{looks:y?.component_editing?.looks??[],fonts:y?.component_editing?.font_choices??[],disabled:K,onSave:(e,t)=>Ae(()=>Pe(_e(i,r,a,y.revision.revision_id,{look_id:e,...t})),g(`外觀換好了,正在輸出新影片。`,`Look changed; rendering the new film.`))})}),(0,q.jsx)(On,{label:g(`修改紀錄`,`History`),disabled:!y,children:e=>(0,q.jsxs)(q.Fragment,{children:[y?.ai_usage&&(0,q.jsxs)(`p`,{className:`rv-usage-total`,title:Mt(y.ai_usage).detail,children:[g(`這部片 AI 總用量 `,`AI usage for this film: `),(0,q.jsx)(`strong`,{children:Mt(y.ai_usage).short}),(0,q.jsx)(`span`,{children:Mt(y.ai_usage).detail})]}),(0,q.jsx)(`ol`,{className:`rv-versions`,"aria-label":g(`修改紀錄,最新的在最上面`,`History, newest first`),children:y?.history.map((t,n)=>{let r=n===0&&t.revision_id===fe,i=!r&&t.revision_id===fe;return(0,q.jsxs)(`li`,{className:r?`is-current`:``,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`rv-version-time`,children:[r&&(0,q.jsx)(`em`,{children:g(`現在`,`Now`)}),At(t.created_at),t.duration_seconds==null?``:` · ${Y(t.duration_seconds)}`]}),(0,q.jsx)(`strong`,{title:Nt(t),children:Nt(t)}),t.kind!==`manual`&&t.kind!==`restore`&&t.changes&&(0,q.jsx)(`small`,{children:t.changes}),t.report&&(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button rv-report-open`,onClick:()=>{e(),ne(t)},children:g(`看 AI 的修改說明`,`Read the AI's report`)}),(0,q.jsx)(`small`,{className:`rv-usage`,title:t.usage?Mt(t.usage).detail:void 0,children:t.kind===`ai_complete`||t.kind===`ai_partial`?t.usage?g(`AI 用量:${Mt(t.usage).short}`,`AI usage: ${Mt(t.usage).short}`):g(`AI 用量沒有記錄`,`AI usage not recorded`):g(`手動,不用 AI 額度`,`By hand; no AI usage`)})]}),!r&&(0,q.jsx)(`div`,{className:`rv-row`,children:i?(0,q.jsx)(`span`,{className:`rv-version-same`,children:g(`和現在一樣`,`Same as now`)}):(0,q.jsxs)(q.Fragment,{children:[t.preview_url&&(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button`,onClick:()=>{te(t),e()},children:g(`看看`,`Watch`)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:K,onClick:()=>{e(),B(t)},children:g(`回到這裡`,`Go back to this`)})]})})]},`${t.revision_id}-${t.created_at}`)})})]})}),(0,q.jsx)(On,{label:L?g(`匯出中…`,`Exporting…`):g(`下載影片`,`Download`),icon:`download`,primary:!0,disabled:!y||L,children:e=>(0,q.jsxs)(`div`,{className:`rv-menu-list`,children:[Tn,pe?(0,q.jsxs)(`a`,{href:pe.media_url,download:!0,onClick:()=>{e(),ie()},children:[(0,q.jsx)(`strong`,{children:g(`下載這一版影片`,`Download this film`)}),(0,q.jsx)(`span`,{children:`MP4`})]}):(0,q.jsxs)(`button`,{type:`button`,disabled:!0,children:[(0,q.jsx)(`strong`,{children:g(`下載這一版影片`,`Download this film`)}),(0,q.jsx)(`span`,{children:G?g(`新影片輸出好就能下載`,`Ready to download once the new film renders`):g(`先按「輸出這一版」,好了就能下載`,`Press “Render this version” first, then download it`)})]})]})})]})]});return(0,q.jsxs)(`section`,{className:`rv`,"aria-label":g(`審片修改`,`Review`),children:[e&&t?(0,Ze.createPortal)(ze,t):ze,be&&(0,q.jsx)(Dn,{job:be,playing:ke?Oe?g(`${At(Oe.created_at)} `,At(Oe.created_at)):g(`上一版`,`the previous version`):null}),y&&!pe&&!G&&ke&&(0,q.jsx)(`p`,{className:`rv-stale`,children:g(`現在播的是${Oe?`${At(Oe.created_at)} `:`上一版`}的影片,還看不到剛改的地方。按「輸出這一版」更新。`,`This plays the film from ${Oe?At(Oe.created_at):`the previous version`}, without your latest change. Press “Render this version” to update it.`)}),C&&(0,q.jsxs)(`p`,{className:`rv-alert`,role:`alert`,children:[C,(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`關閉`,`Close`),onClick:()=>w(``),children:`×`})]}),T&&(0,q.jsx)(`p`,{className:`rv-toast`,role:`status`,children:T}),re&&(0,q.jsx)(yn,{onClose:H}),y&&(0,q.jsx)(un,{side:ae,report:J?.report&&(0,q.jsxs)(`section`,{className:`rv-report`,"aria-label":g(`AI 這次的修改說明`,`The AI's report on this change`),children:[(0,q.jsxs)(`div`,{className:`rv-report-head`,children:[(0,q.jsx)(`strong`,{children:g(`AI 這次的修改說明`,`The AI's report on this change`)}),(0,q.jsx)(`span`,{children:At(J.created_at)}),(0,q.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":g(`知道了`,`Got it`),onClick:()=>de(J.revision_id),children:`×`})]}),(0,q.jsx)(fn,{report:J.report}),(0,q.jsx)(`div`,{className:`rv-row`,children:(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>de(J.revision_id),children:g(`知道了`,`Got it`)})})]}),composer:(0,q.jsx)(`footer`,{className:`rv-composer`,children:s?(0,q.jsxs)(`p`,{className:`rv-working`,children:[(0,q.jsx)(`span`,{className:`rv-pulse`}),g(`AI 正在修改這支片,好了會自動更新。`,`The AI is changing this film; it updates here when done.`)]}):G?(0,q.jsxs)(`p`,{className:`rv-working`,children:[(0,q.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),g(`新影片輸出中,好了就能交給 AI;元件和注記可以繼續改。`,`A new film is rendering; hand it to the AI once it is done. Graphics and notes can still be changed.`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`textarea`,{"aria-label":g(`這一版還要怎麼改?`,`What else should change?`),rows:1,value:D,maxLength:wn,onChange:e=>O(e.target.value),placeholder:Se.length?g(`還有其他想法嗎?(可不填,${Se.length} 筆注記會一起交給 AI)`,`Anything else? (Optional; your ${Se.length} ${v(Se.length,`note goes`,`notes go`)} to the AI too)`):g(`這一版還要怎麼改?例如:節奏再快一點,早餐段落縮短`,`What else should change? For example: faster pace, shorter breakfast part`)}),(0,q.jsx)(On,{label:g(`配樂`,`Music`),disabled:x,up:!0,children:()=>(0,q.jsx)(`div`,{className:`rv-music`,children:(0,q.jsx)(gt,{projectId:r,csrf:i,value:u,onChange:d,disabled:x,defaultLabel:g(`沿用目前配樂`,`Keep the current music`)})})}),n&&(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:x,title:g(`加入新的影片或聲音,交給 AI 時它會看到`,`Add new video or sound; the AI sees it when you hand the film over`),onClick:n,children:g(`+ 素材`,`+ Footage`)}),(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:x||N||!we,title:N?g(`先記下或取消正在寫的注記`,`Save or cancel the note you are writing first`):void 0,onClick:()=>M(!0),children:g(`交給 AI 修改`,`Hand to the AI`)})]})}),unreviewed:m&&m.revision_id===fe?m.unreviewed_item_ids:[],visible:e,projectId:r,csrf:i,runId:a,data:y,video:ke,disabled:x||s,stage:Re,onChanged:e=>b(t=>t&&{...t,references:e}),onDirty:P,onSaveComponent:e=>Ae(()=>Pe(he(i,r,a,y.revision.revision_id,e)),g(`存好了,正在輸出新影片。`,`Saved; rendering the new film.`)),onSaveCaption:e=>Ae(()=>Pe(ge(i,r,a,y.revision.revision_id,e)),g(`字幕改好了,正在輸出新影片。`,`Caption saved; rendering the new film.`)),onSaveSlip:e=>Ae(()=>Pe(Ce(i,r,a,y.revision.revision_id,e)),g(`鏡頭片段調好了,正在輸出新影片。`,`Shot slipped; rendering the new film.`)),onRemoveComponent:e=>Ae(()=>Pe(ve(i,r,a,y.revision.revision_id,e)),g(`元件刪掉了,正在輸出新影片。可以從「版本」還原。`,`Graphic removed; rendering the new film. You can bring it back from History.`))}),(0,q.jsxs)(kn,{open:j,label:g(`交給 AI 修改`,`Hand to the AI`),onClose:()=>M(!1),children:[(0,q.jsx)(`h3`,{children:g(`交給 ${h.name} 修改`,`Hand to ${h.name}`)}),(0,q.jsx)(`p`,{children:g(`${Se.length?`${Se.length} 筆注記${D.trim()?`和你的說明`:``}`:`你的說明`}會交給 ${h.name},從現在的影片繼續改。現在這版會留在修改紀錄裡,隨時可以回來。`,`${Se.length?`Your ${Se.length} ${v(Se.length,`note`,`notes`)}${D.trim()?` and your words`:``}`:`Your words`} go to ${h.name}, who carries on from the current film. This version stays in History; you can come back to it any time.`)}),_&&(0,q.jsx)(`p`,{className:`rv-note`,children:g(`這支片原本由 ${Ne(p)} 製作,這次改由 ${h.name} 接手。`,`${Ne(p)} made this film; ${h.name} takes over this time.`)}),(0,q.jsx)(Xe,{}),(0,q.jsxs)(`label`,{className:`consent-check`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked)}),g(`同意使用 ${h.name} 的額度`,`I agree to use my ${h.name} usage`)]}),(0,q.jsxs)(`div`,{className:`rv-row rv-dialog-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>M(!1),children:g(`取消`,`Cancel`)}),(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!k||x,onClick:Me,children:g(`開始修改`,`Start`)})]})]}),(0,q.jsx)(kn,{open:!!V,label:g(`AI 的修改說明`,`The AI's report`),onClose:()=>ne(null),children:V?.report&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`h4`,{children:[Nt(V),(0,q.jsxs)(`small`,{children:[` · `,At(V.created_at)]})]}),(0,q.jsx)(fn,{report:V.report,request:V.detail}),(0,q.jsx)(`div`,{className:`rv-row`,children:(0,q.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>ne(null),children:g(`關閉`,`Close`)})})]})}),(0,q.jsx)(kn,{open:!!z,label:g(`回到較早的樣子`,`Go back to an earlier version`),onClose:()=>B(null),children:z&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h3`,{children:g(`回到${At(z.created_at)} 的樣子?`,`Go back to ${At(z.created_at)}?`)}),(0,q.jsx)(`p`,{className:`rv-return-what`,children:Nt(z)}),(0,q.jsx)(`p`,{children:g(`影片會變回那時候的樣子。現在這版不會消失,會留在修改紀錄裡,隨時可以再回來。`,`The film goes back to how it was then. This version is not lost; it stays in History and you can return to it any time.`)}),(0,q.jsxs)(`div`,{className:`rv-row rv-dialog-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>B(null),children:g(`取消`,`Cancel`)}),(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:K,onClick:()=>Ie(z),children:g(`回到這裡`,`Go back to this`)})]})]})}),(0,q.jsx)(kn,{open:!!F,label:g(`到 DaVinci Resolve 繼續剪`,`Continue in DaVinci Resolve`),onClose:()=>I(null),children:F&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h3`,{children:g(`到 DaVinci Resolve 繼續剪`,`Continue in DaVinci Resolve`)}),(0,q.jsx)(`p`,{className:`rv-path`,children:F.folder}),(0,q.jsxs)(`ol`,{className:`rv-steps`,children:[(0,q.jsx)(`li`,{children:g(`在 Resolve 選「檔案 › 匯入 › 時間線…」,選資料夾裡的 .fcpxml。`,`In Resolve choose File › Import › Timeline… and pick the .fcpxml in the folder.`)}),(0,q.jsx)(`li`,{children:g(`如果說找不到素材,按「Locate」,選毛片資料夾。`,`If it cannot find the footage, press Locate and choose the footage folder.`)}),F.captions>0&&(0,q.jsx)(`li`,{children:g(`再選「檔案 › 匯入 › 字幕…」,選「字幕.srt」,拖到字幕軌。`,`Then choose File › Import › Subtitle…, pick 字幕.srt and drag it onto the subtitle track.`)})]}),F.notes.length>0&&(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:g(`要留意的地方(${F.notes.length})`,`Things to watch (${F.notes.length})`)}),(0,q.jsx)(`ul`,{children:F.notes.map(e=>(0,q.jsx)(`li`,{children:e},e))})]}),(0,q.jsx)(`div`,{className:`rv-row rv-dialog-actions`,children:(0,q.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>I(null),children:g(`好`,`OK`)})})]})})]})}function Dn({job:e,playing:t}){let[n,r]=(0,l.useState)(()=>Date.now());(0,l.useEffect)(()=>{let e=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let i=e.state===`running`?Math.max(0,Math.min(1,e.progress)):0,a=Date.parse(e.started_at??e.created_at),o=Number.isFinite(a)?Math.max(0,(n-a)/1e3):0,s=i>.08&&o>3?Math.max(1,Math.round(o*(1-i)/i)):null,c=s===null?g(`正在估算時間`,`Estimating time`):s<60?g(`約剩 ${s} 秒`,`about ${s}s left`):g(`約剩 ${Math.ceil(s/60)} 分鐘`,`about ${Math.ceil(s/60)} min left`);return(0,q.jsxs)(`div`,{className:`rv-render`,role:`status`,"aria-live":`polite`,title:g(`${t?`先播${t}的影片,`:``}完成後會自動換成新影片。`,`${t?`Playing the film from ${t} for now; `:``}the new film replaces it when done.`),children:[(0,q.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:e.state===`queued`?g(`準備輸出新影片…`,`Getting ready to render…`):g(`輸出新影片`,`Rendering`)}),(0,q.jsx)(`div`,{className:`rv-render-bar`,"aria-hidden":`true`,children:(0,q.jsx)(`i`,{style:{width:`${Math.max(3,i*100)}%`}})}),e.state===`running`&&(0,q.jsxs)(`span`,{children:[Math.round(i*100),`% · `,c]}),(0,q.jsx)(`span`,{className:`rv-render-note`,children:g(`可以繼續調整`,`You can keep editing`)})]})}function On({label:e,icon:t,primary:n,disabled:r,up:i,children:a}){let[o,s]=(0,l.useState)(!1),c=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!o)return;let e=e=>{c.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[o]),(0,q.jsxs)(`div`,{className:`rv-menu`,ref:c,children:[(0,q.jsxs)(`button`,{type:`button`,className:`button ${n?`primary`:`secondary`}`,"aria-expanded":o,disabled:r,onClick:()=>s(!o),children:[t&&(0,q.jsx)(mn,{name:t,size:16}),e,(0,q.jsx)(`span`,{className:`rv-caret`,"aria-hidden":`true`})]}),o&&(0,q.jsx)(`div`,{className:`rv-menu-panel${i?` is-up`:``}`,children:a(()=>s(!1))})]})}function kn({open:e,label:t,onClose:n,children:r}){let i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let t=i.current;t&&(e&&!t.open&&t.showModal(),!e&&t.open&&t.close())},[e]),(0,q.jsx)(`dialog`,{ref:i,className:`rv-dialog`,"aria-label":t,onClose:n,onClick:e=>{e.target===e.currentTarget&&n()},children:(0,q.jsx)(`div`,{className:`rv-dialog-body`,children:e&&r})})}function An({projectId:e,csrf:t,kind:n,text:r,onUse:i,disabled:a}){let o=(0,l.useId)(),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)([]),[m,_]=(0,l.useState)(0),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(``),[S,C]=(0,l.useState)(``),[w,T]=(0,l.useState)(0);(0,l.useEffect)(()=>{if(!s)return;let t=!1;return xe(u?void 0:e).then(e=>{t||(p(e.prompts),_(e.total),x(``))}).catch(e=>{t||x(String(e))}),()=>{t=!0}},[s,u,e,w,a]);async function E(){y(!0),x(``),C(``);try{await K(t,e,n,r),C(g(`需求已儲存在作品中,可隨時帶入。`,`Saved with this project. Use it again any time.`)),T(e=>e+1)}catch(e){x(e instanceof Error?e.message:g(`無法儲存需求。`,`Could not save the request.`))}finally{y(!1)}}async function D(){y(!0);try{let t=await xe(u?void 0:e,f.length);p(e=>[...e,...t.prompts]),_(t.total)}catch(e){x(String(e))}finally{y(!1)}}return(0,q.jsxs)(`div`,{className:`prompt-history`,children:[(0,q.jsx)(`div`,{className:`workbench-tabs`,children:(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:a||v||!r.trim(),onClick:()=>void E(),children:g(`儲存這段需求`,`Save this request`)})}),S&&(0,q.jsx)(`p`,{role:`status`,children:S}),b&&(0,q.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:b}),(0,q.jsxs)(`details`,{open:s,onToggle:e=>c(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{children:g(`用以前寫過的需求`,`Use an earlier request`)}),(0,q.jsxs)(`label`,{className:`consent-check`,htmlFor:`${o}-scope`,children:[(0,q.jsx)(`input`,{id:`${o}-scope`,type:`checkbox`,disabled:v,checked:u,onChange:e=>d(e.target.checked)}),g(`包含此工作區其他作品`,`Include other projects in this folder`)]}),!f.length&&(0,q.jsx)(`p`,{children:g(`目前沒有已儲存的需求。`,`No saved requests yet.`)}),(0,q.jsx)(`ol`,{children:f.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.kind===`production`?g(`影片製作`,`New film`):g(`AI 修訂`,`AI revision`)}),(0,q.jsxs)(`span`,{children:[e.project_name,` · `,new Date(e.created_at).toLocaleString(h)]})]}),(0,q.jsx)(`p`,{children:e.text}),!!e.references?.items.length&&(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:g(`本次參考註記(${e.references.items.length} 筆)`,`Notes sent with it (${e.references.items.length})`)}),(0,q.jsx)(`ul`,{children:e.references.items.map(e=>(0,q.jsxs)(`li`,{children:[e.note,e.kind===`audio`?` · ${e.source_gain_db} dB${e.fill_music?g(` · 配樂補滿`,` · music fills in`):``}`:``]},e.reference_id))}),(0,q.jsx)(`p`,{children:g(`帶入需求只會複製文字;片段註記請確認目前影片中的範圍。`,`Using a request copies only its text; check where its notes fall in the current film.`)})]}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:a,onClick:()=>{i(e.text),C(g(`已帶入需求,可先修改文字再送出。`,`Request copied in. Edit it before you send it.`))},children:g(`帶入需求`,`Use this`)})]},`${e.project_id}:${e.prompt_id}`))}),f.length<m&&(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:v,onClick:()=>void D(),children:g(`載入更早的需求`,`Load earlier requests`)})]})]})}var jn=``;function Mn({skillId:e,templates:t,selectedId:n,disabled:r,onSelect:i,onStart:a}){let o=(0,l.useId)(),[s,c]=(0,l.useState)(jn),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m]=(0,l.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),h=(0,l.useRef)(null),_=[jn,...new Set(t.map(e=>e.category))],y=n?t.find(e=>e.template_id===n):void 0,b=t.filter(e=>(s===jn||e.category===s)&&[e.name,e.description,e.category,e.editorial_direction,e.design_direction??``,...e.tags].join(` `).toLocaleLowerCase().includes(u.trim().toLocaleLowerCase())),x=t=>`/api/production/skills/${encodeURIComponent(e)}/styles/${encodeURIComponent(t.visual_style_id)}/preview`;(0,l.useEffect)(()=>{f?h.current?.showModal():h.current?.close()},[f]);function S(e){i?.(e),p(null)}function C(e){p(null),a?.(e)}return(0,q.jsxs)(`section`,{className:`template-library`,"aria-labelledby":`${o}-title`,children:[(0,q.jsxs)(`div`,{className:`template-library-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{id:`${o}-title`,children:g(`內建節目樣板`,`Built-in templates`)}),!i&&(0,q.jsx)(`p`,{children:g(`先挑今天要剪的影片類型。每套樣板都是一份給 AI 的剪輯風格,寫好怎麼說故事、節奏快慢、字卡和配樂,AI 會照這個風格剪你的素材。`,`Pick the kind of film you are making today. Each template is an editing style for the AI: how to tell the story, the pace, the captions and the music. The AI cuts your footage in that style.`)})]}),(0,q.jsx)(mn,{name:`layers`,size:25})]}),(0,q.jsxs)(`div`,{className:`template-toolbar`,children:[(0,q.jsx)(`div`,{className:`template-categories`,role:`group`,"aria-label":g(`樣板分類`,`Template categories`),children:_.map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>c(e),children:e===jn?g(`全部`,`All`):e},e))}),(0,q.jsx)(`input`,{type:`search`,"aria-label":g(`搜尋影片樣板`,`Search templates`),placeholder:g(`搜尋旅遊、開箱、美食…`,`Search travel, unboxing, food…`),value:u,onChange:e=>d(e.target.value)})]}),(0,q.jsxs)(`p`,{className:`template-result-count`,role:`status`,children:[g(`顯示 ${b.length} 套`,`${b.length} ${v(b.length,`template`,`templates`)}`),y?g(` · 已選:${y.name}`,` · chosen: ${y.name}`):``]}),(0,q.jsx)(`div`,{className:`template-grid`,children:b.map(e=>(0,q.jsxs)(`article`,{className:`template-card ${n===e.template_id?`is-selected`:``}`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`template-cover`,onClick:()=>p(e),"aria-label":g(`查看${e.name}示例`,`See the ${e.name} sample`),children:[(0,q.jsx)(`img`,{src:x(e),alt:g(`${e.name}原生元件設計預覽`,`${e.name} graphics preview`),loading:`lazy`}),(0,q.jsxs)(`span`,{className:`template-play`,children:[(0,q.jsx)(mn,{name:`play`,size:14}),g(`動態示例`,`Sample`)]}),n===e.template_id&&(0,q.jsxs)(`span`,{className:`template-selected`,children:[(0,q.jsx)(mn,{name:`check`,size:14}),g(`已選用`,`Chosen`)]})]}),(0,q.jsxs)(`div`,{className:`template-card-body`,children:[(0,q.jsx)(`span`,{className:`template-category`,children:e.category}),(0,q.jsx)(`h4`,{children:e.name}),(0,q.jsx)(`p`,{children:e.description}),(0,q.jsx)(`div`,{className:`template-tags`,children:e.tags.map(e=>(0,q.jsx)(`span`,{children:e},e))}),(0,q.jsxs)(`div`,{className:`template-card-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>p(e),children:g(`查看示例`,`See sample`)}),i&&(0,q.jsx)(`button`,{type:`button`,className:`button ${n===e.template_id?`ghost`:`secondary`}`,disabled:r||n===e.template_id,onClick:()=>S(e),children:n===e.template_id?g(`目前樣板`,`Current`):g(`使用這套`,`Use this`)}),a&&(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:()=>C(e),children:g(`用這套開始`,`Start with this`)})]})]})]},e.template_id))}),!b.length&&(0,q.jsxs)(`div`,{className:`template-empty`,children:[(0,q.jsx)(mn,{name:`film`,size:30}),(0,q.jsx)(`p`,{children:g(`沒有符合的樣板,試試其他關鍵字。`,`No templates match. Try other words.`)}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:()=>{d(``),c(jn)},children:g(`查看全部樣板`,`Show all templates`)})]}),!i&&(0,q.jsx)(`p`,{className:`prompt-draft-hint`,children:g(`點封面可以先看示例,喜歡就按「用這套開始」建立作品,AI 會用這個風格剪。示例是無聲動畫,正式影片會用你的素材和配樂。`,`Click a cover to see a sample. If you like it, choose “Start with this” to create a project the AI edits in that style. Samples are silent animations; your film uses your own footage and music.`)}),(0,q.jsx)(`dialog`,{className:`template-dialog`,ref:h,"aria-labelledby":`${o}-sample-title`,onCancel:e=>{e.preventDefault(),p(null)},onClose:()=>p(null),children:f&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`template-dialog-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`studio-section-number`,children:f.category}),(0,q.jsx)(`h3`,{id:`${o}-sample-title`,children:f.name})]}),(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>p(null),"aria-label":g(`關閉樣板示例`,`Close the sample`),children:g(`關閉 ×`,`Close ×`)})]}),(0,q.jsx)(`video`,{controls:!0,autoPlay:!m,muted:!0,loop:!0,playsInline:!0,preload:`metadata`,poster:x(f),src:`/api/production/skills/${encodeURIComponent(e)}/templates/${encodeURIComponent(f.template_id)}/sample`,"aria-label":g(`${f.name}動態元件示例`,`${f.name} animated sample`)},f.template_id),(0,q.jsxs)(`div`,{className:`template-sample-chapters`,"aria-label":g(`示例段落`,`Sample parts`),children:[(0,q.jsx)(`span`,{children:g(`00–02 片頭識別`,`00–02 Opening`)}),(0,q.jsx)(`span`,{children:g(`02–04 章節帶入`,`02–04 Chapter`)}),(0,q.jsx)(`span`,{children:g(`04–06 資訊標註`,`04–06 Info`)}),(0,q.jsx)(`span`,{children:g(`06–08 重點反應`,`06–08 Reaction`)})]}),(0,q.jsxs)(`div`,{className:`template-dialog-copy`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:g(`這套樣板怎麼說故事?`,`How this template tells a story`)}),(0,q.jsx)(`p`,{children:f.editorial_direction}),(0,q.jsxs)(`p`,{children:[g(`配樂方向:`,`Music: `),f.music_direction]}),(0,q.jsx)(`div`,{className:`template-tags`,children:f.tags.map(e=>(0,q.jsx)(`span`,{children:e},e))}),(0,q.jsx)(`p`,{className:`prompt-draft-hint`,children:g(`${f.sample_duration_seconds??3} 秒無聲設計示例,正式影片會依你的內容安排。`,`A ${f.sample_duration_seconds??3}-second silent design sample; your film follows your own footage.`)})]}),i&&(0,q.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:r,onClick:()=>S(f),children:[(0,q.jsx)(mn,{name:`check`}),g(`使用這套樣板`,`Use this template`)]}),a&&(0,q.jsxs)(`button`,{type:`button`,className:`button primary`,onClick:()=>C(f),children:[(0,q.jsx)(mn,{name:`plus`}),g(`用這套樣板建立作品`,`Create a project with this template`)]})]})]})})]})}function Nn({skills:e,skillId:t,templateId:n,disabled:r,onChoose:i}){let a=(0,l.useId)(),o=e.find(e=>e.templates?.length),s=e.find(e=>e.kind===`genre`),c=e.filter(e=>e.source===`custom`),u=n?o?.templates?.find(e=>e.template_id===n):void 0,d=u??e.find(e=>e.skill_id===t),f=d?.name,[p,m]=(0,l.useState)(!f);function h(e){o&&i({skillId:o.skill_id,templateId:e.template_id,visualStyleId:e.visual_style_id,fontStyleId:e.font_style_id,aspectRatio:e.aspect_ratio}),m(!1)}function _(e){i({skillId:e.skill_id,templateId:``,visualStyleId:e.selected_visual_style_id??`variety`,fontStyleId:e.selected_font_style_id??`default`,defaultDurationSeconds:e.default_duration_seconds}),m(!1)}return(0,q.jsxs)(`section`,{className:`skill-picker`,"aria-labelledby":`${a}-title`,children:[(0,q.jsxs)(`div`,{className:`skill-picker-heading`,children:[(0,q.jsx)(`h3`,{id:`${a}-title`,className:`sr-only`,children:g(`選一個剪輯樣板`,`Choose a template`)}),(0,q.jsxs)(`div`,{className:`skill-picker-current`,children:[(0,q.jsxs)(`p`,{children:[g(`目前選用:`,`Using: `),(0,q.jsx)(`strong`,{children:f??g(`尚未選擇`,`None yet`)}),d?.description&&(0,q.jsx)(`span`,{children:d.description})]}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,"aria-expanded":p,disabled:r,onClick:()=>m(!p),children:p?g(`收起樣板`,`Hide templates`):g(`換樣板`,`Change template`)})]})]}),p&&(0,q.jsxs)(q.Fragment,{children:[c.length>0&&(0,q.jsxs)(`div`,{className:`skill-picker-mine`,children:[(0,q.jsx)(`h4`,{children:g(`我的樣板`,`My templates`)}),(0,q.jsx)(`div`,{className:`skill-grid`,children:c.map(e=>{let n=e.skill_id===t&&!u;return(0,q.jsxs)(`article`,{className:`skill-card ${n?`is-selected`:``}`,children:[(0,q.jsx)(`h3`,{children:e.name}),e.description&&(0,q.jsx)(`p`,{children:e.description}),(0,q.jsx)(`div`,{className:`skill-actions`,children:(0,q.jsx)(`button`,{type:`button`,className:`button ${n?`secondary`:`primary`}`,disabled:r||n,onClick:()=>_(e),children:n?g(`目前樣板`,`Current`):g(`使用這套`,`Use this`)})})]},e.skill_id)})})]}),o&&(0,q.jsx)(Mn,{skillId:o.skill_id,templates:o.templates??[],selectedId:u?u.template_id:``,disabled:r,onSelect:h}),s&&(0,q.jsx)(`p`,{className:`skill-picker-basic`,children:s.skill_id===t&&!u?g(`目前不使用樣板,採用基本的旅遊節目設定。`,`No template: using the basic travel show settings.`):(0,q.jsx)(`button`,{type:`button`,className:`link-button`,disabled:r,onClick:()=>_(s),children:g(`不使用樣板,採用基本設定`,`Use no template, just the basics`)})})]})]})}var Pn=e=>`clipen:template-choice:${e}`;function Fn(e,t){try{localStorage.setItem(Pn(e),JSON.stringify(t))}catch{}}function In(e){try{let t=localStorage.getItem(Pn(e));return t?JSON.parse(t):null}catch{return null}}function Ln(e){try{localStorage.removeItem(Pn(e))}catch{}}function Rn({projectId:e,csrf:t,brief:n,sourceReady:r,viewSlot:i,toolSlot:a,onAddFootage:o}){let s=je(),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(``),[p]=(0,l.useState)(()=>In(e)),[m,h]=(0,l.useState)(p?.skillId??`travel-program`),[_,x]=(0,l.useState)(p?.visualStyleId??`tpl-travel-vlog`),[S,C]=(0,l.useState)(p?.templateId??`travel-vlog`),[w,T]=(0,l.useState)(p?.fontStyleId??`variety-tw`),[E,D]=(0,l.useState)(`10`),[O,k]=(0,l.useState)(p?.aspectRatio??`16:9`),A=Math.round(Number(E)*60),j=E.trim()!==``&&Number.isFinite(A)&&A>=30&&A<=1200,[M,N]=St(e,`production`,n||g(`以人物對話與實際體驗串起一段旅遊節目,有清楚故事、節目字幕、配樂、適合的轉場、節目主標、動態大字與有設計感的畫面內動畫。保留人物與現場,不使用獨立字卡代替敘事。`,`A travel show carried by what people say and do, with a clear story, captions, music, fitting transitions, a show title, bold animated text and well-designed on-screen motion. Keep the people and the places; no title cards in place of the story.`)),[P,F]=(0,l.useState)(null),[I,L]=Ct(s.id),[ee,R]=(0,l.useState)(!1),[te,z]=(0,l.useState)(`overview`),[B,V]=(0,l.useState)(!1),ie=(0,l.useRef)(null),[H,ae]=(0,l.useState)(!1),[oe,se]=(0,l.useState)(null),[ce,le]=(0,l.useState)(!0),[ue,de]=(0,l.useState)(!1),[fe,me]=(0,l.useState)(0),U=!!(P?.latest_run&&[`queued`,`running`].includes(P.latest_run.state)),he=(0,l.useRef)(U);(0,l.useEffect)(()=>{if(he.current&&!U&&P?.latest_run){let e=P.latest_run.state===`succeeded`;Sn(e?Cn.film():Cn.stopped(),e?g(`回到 Clipen 看看、記下要改的地方。`,`Come back to watch it and note what to change.`):g(`回到 Clipen 看看發生了什麼。`,`Come back to see what happened.`))}he.current=U},[U,P]),(0,l.useEffect)(()=>{let e=!1;return y().then(t=>{e||u(t)}).catch(t=>{e||se(String(t))}),()=>{e=!0}},[e]),(0,l.useEffect)(()=>{let t=!1,n,r=async()=>{let i=!1;try{let n=await ne(e);if(t)return;F(n),de(!1),f(e=>e||n.production?.intent.music_choice?.asset_id||``),i=!!(n.latest_run&&([`queued`,`running`].includes(n.latest_run.state)||n.latest_run.state===`succeeded`&&n.latest_run.provider_attempt_id===null))||!!n.production?.local_jobs.some(e=>e.state===`running`)||!!(n.production?.preview&&[`queued`,`running`].includes(n.production.preview.state))}catch{if(t)return;de(!0),i=!0}finally{t||(le(!1),i&&(n=window.setTimeout(()=>void r(),3e3)))}};return r(),()=>{t=!0,window.clearTimeout(n)}},[e,fe]);async function ge(){if(!(H||ce||ue||U||!I||!r||!M.trim()||!j)){xn(),ae(!0),se(null);try{await b(t,e,m,M,_,w,A,d||void 0,S||void 0,O),Ln(e),F(await ne(e)),R(!1),z(`overview`)}catch(e){de(!0),se(e instanceof Error?e.message:g(`無法確認是否已啟動,正在重新讀取狀態。`,`Could not confirm it started; reading the status again.`))}finally{ae(!1),me(e=>e+1)}}}async function _e(){if(!(!P?.latest_run||H||U)){ae(!0),se(null);try{await pe(t,e,P.latest_run.run_id),F(await ne(e)),R(!1),z(`overview`)}catch(e){se(e instanceof Error?e.message:g(`無法接續製作。`,`Could not continue the production.`))}finally{ae(!1),me(e=>e+1)}}}async function ve(){if(!(!P?.latest_run||H)){ae(!0),se(null);try{await re(t,e,P.latest_run.run_id),F(await ne(e))}catch(e){se(e instanceof Error?e.message:g(`無法取消製作。`,`Could not stop the production.`))}finally{ae(!1),me(e=>e+1)}}}let W=P?.production,ye=W?P?.latest_run:null,be=W?.preview,G=W?.finished_preview??null,xe=W?.draft_preview??null,K=!!(xe&&(B||!G)),Se=be?.state===`succeeded`?be:W?.last_successful_preview??be,Ce=K?xe:G??Se,we=K?xe?.version:Ce===G?G?.version:null,Te=!K&&Ce?.state===`succeeded`&&Ce.render_id!==be?.render_id&&!xe,J=W?.draft.timeline,Ee=J?.tracks.filter(e=>e.track_id===`program-components`||e.track_id.startsWith(`program-components-`)).reduce((e,t)=>e+t.items.length,0)??0,De=J?.tracks.find(e=>e.track_id===`agent-subtitles`)?.items.length??0,Oe=J?J.duration_frames*J.frame_rate.den/J.frame_rate.num:0;(0,l.useEffect)(()=>{te!==`overview`&&ie.current?.pause()},[te]);function ke(){if(!W)return;let e=W.skill.selected_visual_style_id??`tpl-travel-vlog`,t=c.find(e=>e.skill_id===W.skill.skill_id)??c.find(t=>t.visual_styles?.some(t=>t.visual_style_id===e));if(!t){se(g(`目前影片的樣板已無法用於新製作,請選擇其他樣板。`,`This film's template cannot be used for a new film. Choose another.`));return}h(t.skill_id),x(e),C(t.templates?.find(t=>t.visual_style_id===e)?.template_id??``),T(W.skill.selected_font_style_id??`default`),D(String(Number(((W.intent.target_duration_seconds??60)/60).toFixed(3)))),k(W.intent.aspect_ratio??`16:9`),N(W.intent.brief),f(W.intent.music_choice?.asset_id??``)}let Ae=J?.canvas?{"--film-aspect":`${J.canvas.width} / ${J.canvas.height}`}:void 0;return(0,q.jsxs)(`section`,{className:`production-workspace`,style:Ae,"aria-labelledby":`production-heading`,onPlayCapture:e=>{e.currentTarget.querySelectorAll(`video`).forEach(t=>{t!==e.target&&t.pause()})},children:[(0,q.jsx)(`h2`,{id:`production-heading`,className:`sr-only`,children:g(`AI 節目製作`,`AI production`)}),W&&(()=>{let e=(0,q.jsx)(`nav`,{className:`studio-view-nav`,"aria-label":g(`製作工作區`,`Production`),children:[[`overview`,g(`影片總覽`,`Film`),`play`],[`edit`,g(`審片修改`,`Review`),`edit`],[`new`,g(`新片設定`,`New film`),`plus`]].map(([e,t,n])=>(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":te===e,onClick:()=>{z(e),e===`new`&&R(!0)},children:[(0,q.jsx)(mn,{name:n}),t]},e))});return i?(0,Ze.createPortal)(e,i):e})(),oe&&(0,q.jsx)(`p`,{className:`inline-message error`,role:`alert`,children:oe}),ce&&(0,q.jsx)(`p`,{role:`status`,children:g(`正在讀取製作工作…`,`Loading the production…`)}),ue&&(0,q.jsxs)(`div`,{className:`production-connection-notice`,role:`status`,children:[(0,q.jsx)(`strong`,{children:g(`暫時讀不到最新製作狀態`,`Cannot read the latest status right now`)}),(0,q.jsx)(`p`,{children:g(`以下保留上次讀取的資料;這不代表 AI 已停止。正在自動重新連線。`,`Showing what was last read; this does not mean the AI stopped. Reconnecting automatically.`)}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:()=>me(e=>e+1),children:g(`立即重試連線`,`Reconnect now`)})]}),P?.production&&(te===`overview`||U||[`failed`,`interrupted`].includes(ye?.state??``))&&(0,q.jsx)(mt,{status:P,busy:H,compact:te!==`overview`,onView:()=>z(`overview`),onRefine:J&&J.duration_frames>0?()=>z(`edit`):void 0,onResume:()=>void _e(),onCancel:()=>void ve(),onRefresh:()=>me(e=>e+1),onEdit:()=>{R(!0),z(`new`),window.requestAnimationFrame(()=>document.getElementById(`production-intent`)?.focus())}}),W&&(0,q.jsxs)(`div`,{className:`production-output studio-screen`,id:`production-output`,tabIndex:-1,hidden:te!==`overview`,children:[(0,q.jsx)(`h3`,{className:`sr-only`,children:g(`你的影片`,`Your film`)}),Ce?.state===`succeeded`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`film-version-bar ${K?`is-draft`:``}`,role:`status`,children:[(0,q.jsxs)(`span`,{className:`film-version-now`,children:[g(`正在看:`,`Watching: `),(0,q.jsx)(`strong`,{children:K?g(`未完成的草稿${xe?.version?.kind===`ai_partial`?`(${xe.version.label})`:``}`,`unfinished draft${xe?.version?.kind===`ai_partial`?` (${xe.version.label})`:``}`):G&&Ce===G?g(`完成的版本${G.version?`(${G.version.label})`:``}`,`finished version${G.version?` (${G.version.label})`:``}`):Ce.stale||Te?g(`先前的版本`,`an earlier version`):g(`目前的預覽`,`the current preview`)}),we&&(0,q.jsx)(`small`,{children:At(we.created_at)})]}),(0,q.jsx)(`span`,{className:`film-version-why`,children:K?U?g(`AI 還在製作,畫面可能只改了一部分。`,`The AI is still at work; the picture may be only partly changed.`):g(`AI 沒做完這一輪的檢查,畫面可能只改了一部分。`,`The AI did not finish checking this round; the picture may be only partly changed.`):xe?U?g(`AI 製作中,有一份新的草稿。`,`The AI is at work and there is a newer draft.`):g(`有一份比這版新、但還沒做完的草稿。`,`There is a newer draft that is not finished.`):Te?be&&[`queued`,`running`].includes(be.state)?g(`新的影片正在輸出。`,`A new film is rendering.`):g(`最新一次輸出沒有完成。`,`The latest render did not finish.`):Ce.stale?g(`之後的修改還沒輸出成影片。`,`Later changes have not been rendered yet.`):``}),K&&G&&(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>V(!1),children:g(`回到完成的版本`,`Back to the finished version`)}),!K&&xe&&(0,q.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>V(!0),children:g(`看草稿`,`Watch the draft`)}),(0,q.jsxs)(`span`,{className:`film-version-actions`,children:[(0,q.jsxs)(`span`,{className:`studio-version`,children:[Math.floor(Oe/60),`:`,String(Math.round(Oe%60)).padStart(2,`0`)]}),(0,q.jsxs)(`button`,{type:`button`,className:`button secondary`,onClick:()=>z(`edit`),children:[(0,q.jsx)(mn,{name:`edit`}),g(`審片並交給 AI 修改`,`Review and have the AI change it`)]}),(0,q.jsxs)(`a`,{className:`button primary`,href:Ce.media_url,download:!0,children:[(0,q.jsx)(mn,{name:`download`}),g(`下載影片`,`Download the film`)]})]})]}),(0,q.jsx)(`video`,{ref:ie,controls:!0,preload:`metadata`,src:Ce.media_url,"aria-label":g(`影片預覽`,`Film preview`)},Ce.render_id)]}):(0,q.jsx)(`p`,{children:Ce&&[`queued`,`running`].includes(Ce.state)?g(`正在合成預覽…`,`Rendering a preview…`):Ce?.state===`failed`?g(`這次預覽輸出失敗,草稿仍保留。`,`This preview failed to render; the draft is kept.`):g(`AI 尚未產生可觀看預覽。`,`The AI has not made a preview to watch yet.`)}),(0,q.jsxs)(`details`,{className:`production-film-info`,children:[(0,q.jsx)(`summary`,{children:g(`影片資訊與配樂來源`,`Film details and music credits`)}),(0,q.jsxs)(`p`,{children:[W.skill.name,` · `,W.skill.version]}),(0,q.jsx)(`p`,{children:g(`${Oe.toFixed(1)} 秒 · ${De} 段字幕 · ${Ee} 個畫面元件`,`${Oe.toFixed(1)} s · ${De} ${v(De,`caption`,`captions`)} · ${Ee} ${v(Ee,`graphic`,`graphics`)}`)}),(0,q.jsx)(`p`,{children:W.draft.summary}),W.production_contents?.music.map((e,t)=>(0,q.jsxs)(`div`,{className:`finishing-music-credit`,children:[(0,q.jsxs)(`strong`,{children:[e.role===`music`?g(`配樂`,`Music`):g(`聲音素材`,`Sound`),g(`:`,`: `),e.name]}),(0,q.jsxs)(`p`,{children:[g(`音源使用 `,`Uses `),Y(e.source_offset_seconds??0,!0),`–`,Y((e.source_offset_seconds??0)+e.duration_seconds,!0),e.source_duration_seconds==null?``:g(`/原曲 ${Y(e.source_duration_seconds,!0)}`,` of ${Y(e.source_duration_seconds,!0)}`)]}),(0,q.jsxs)(`p`,{children:[e.provenance.creator?g(`作者:${e.provenance.creator} · `,`By ${e.provenance.creator} · `):``,e.provenance.license===`by`?`CC BY ${e.provenance.license_version??``}`:e.provenance.license===`cc0`?`CC0`:e.provenance.license===`user_supplied`?g(`使用者提供`,`Your own`):e.provenance.license??g(`授權條件尚未取得`,`License not known yet`)]}),e.provenance.attribution&&(0,q.jsxs)(`p`,{children:[g(`署名內容:`,`Credit: `),e.provenance.attribution]}),e.provenance.changes&&(0,q.jsxs)(`p`,{children:[g(`使用方式:`,`Changes: `),e.provenance.changes]}),e.provenance.source_url&&(0,q.jsx)(`a`,{href:e.provenance.source_url,target:`_blank`,rel:`noreferrer`,children:g(`曲目來源`,`Track source`)}),` `,e.provenance.license_url&&(0,q.jsx)(`a`,{href:e.provenance.license_url,target:`_blank`,rel:`noreferrer`,children:g(`授權條件`,`License`)})]},`${e.name}-${t}`)),W.export_url&&(0,q.jsx)(`a`,{className:`button ghost`,href:W.export_url,download:!0,children:g(`下載剪輯資料`,`Download the edit data`)}),ye?.usage&&(0,q.jsx)(`p`,{children:g(`最近一次 AI 執行用量:輸入 ${ye.usage.input_tokens.toLocaleString()}、快取輸入 ${ye.usage.cached_input_tokens.toLocaleString()}、輸出 ${ye.usage.output_tokens.toLocaleString()} Tokens。`,`Latest AI run: ${ye.usage.input_tokens.toLocaleString()} input (${ye.usage.cached_input_tokens.toLocaleString()} cached), ${ye.usage.output_tokens.toLocaleString()} output tokens.`)}),ye&&!ye.usage&&(0,q.jsx)(`p`,{children:g(`實際 AI 用量尚未取得,不代表零用量。`,`The actual AI usage is not known yet; that does not mean zero.`)})]})]}),W&&ye&&J&&J.duration_frames>0&&(0,q.jsx)(`div`,{hidden:te!==`edit`,children:(0,q.jsx)(En,{visible:te===`edit`,toolSlot:a,onAddFootage:o,runProvider:ye.provider,projectId:e,csrf:t,runId:ye.run_id,revisionId:W.draft.revision_id,previews:[be,xe,G,W.last_successful_preview],aiReview:W.ai_review??null,active:U,onChanged:()=>me(e=>e+1),musicId:d,onMusicChange:f},ye.run_id)}),!ce&&(0,q.jsxs)(`details`,{className:`production-editor`,hidden:!!W&&te!==`new`,open:!W||ee,onToggle:e=>R(e.currentTarget.open),children:[(0,q.jsx)(`summary`,{children:W?U?g(`本次製作需求`,`This production`):g(`製作下一支影片`,`Make another film`):g(`設定你的影片`,`Set up your film`)}),(0,q.jsxs)(`div`,{className:`production-brief`,children:[W&&!U&&(0,q.jsx)(`div`,{className:`production-reuse`,children:(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:H,onClick:ke,children:g(`沿用目前影片的設定`,`Use this film's settings`)})}),(0,q.jsxs)(`h3`,{className:`production-step`,children:[(0,q.jsx)(`span`,{children:`1`}),g(`這次想做什麼影片?`,`What film do you want?`)]}),(0,q.jsx)(`textarea`,{id:`production-intent`,"aria-label":g(`這次想做什麼影片?`,`What film do you want?`),value:U?W?.intent.brief??M:M,maxLength:8e3,rows:4,disabled:!!U||H,onChange:e=>N(e.target.value)}),(0,q.jsx)(`p`,{className:`production-hint`,children:g(`想要的畫面感覺也寫在這裡,例如日系雜誌、手寫筆記、霓虹街頭。`,`Describe the look here too, for example: Japanese magazine, handwritten notes, neon streets.`)}),(0,q.jsx)(An,{projectId:e,csrf:t,kind:`production`,text:M,onUse:N,disabled:U||H}),(0,q.jsxs)(`h3`,{className:`production-step`,children:[(0,q.jsx)(`span`,{children:`2`}),g(`選樣板`,`Template`)]}),U&&W?(0,q.jsxs)(`p`,{className:`skill-picker-active`,children:[g(`本次使用的剪輯樣板:`,`Template for this film: `),(0,q.jsx)(`strong`,{children:W.skill.name})]}):c.length>0&&(0,q.jsx)(Nn,{skills:c,skillId:m,templateId:S,disabled:H,onChoose:e=>{h(e.skillId),C(e.templateId),x(e.visualStyleId),T(e.fontStyleId),k(e.aspectRatio??`16:9`),e.defaultDurationSeconds&&e.defaultDurationSeconds%60==0&&D(String(e.defaultDurationSeconds/60))}}),(0,q.jsxs)(`h3`,{className:`production-step`,children:[(0,q.jsx)(`span`,{children:`3`}),g(`畫面比例`,`Shape`)]}),(0,q.jsx)($e,{value:U?W?.intent.aspect_ratio??`16:9`:O,disabled:U||H,onChange:k}),(0,q.jsxs)(`h3`,{className:`production-step`,children:[(0,q.jsx)(`span`,{children:`4`}),g(`片長與配樂`,`Length and music`)]}),(0,q.jsx)(`label`,{htmlFor:`production-duration`,children:g(`片長(分鐘)`,`Length (minutes)`)}),(0,q.jsx)(`input`,{id:`production-duration`,type:`number`,min:.5,max:20,step:`any`,inputMode:`decimal`,value:U?Number(W?.intent.target_duration_seconds??60)/60:E,disabled:U||H,"aria-describedby":`production-duration-hint`,"aria-invalid":!U&&!j,onChange:e=>D(e.target.value)}),(0,q.jsx)(`p`,{id:`production-duration-hint`,className:!U&&!j?`production-hint is-error`:`production-hint`,role:!U&&!j?`alert`:void 0,children:!U&&!j?g(`請輸入 0.5–20 分鐘。`,`Enter 0.5 to 20 minutes.`):g(`0.5–20 分鐘,可以有小數,例如 1.5。`,`0.5 to 20 minutes; decimals are fine, like 1.5.`)}),(0,q.jsx)(gt,{projectId:e,csrf:t,value:d,onChange:f,disabled:U||H}),!r&&(0,q.jsx)(`p`,{className:`inline-message`,role:`status`,children:g(`讀不到毛片資料夾。回到「素材」確認磁碟有接上,再開始製作。`,`The footage folder cannot be read. Check the drive is connected on the Footage page, then start.`)}),!U&&(0,q.jsxs)(`div`,{className:`production-start`,children:[(0,q.jsxs)(`h3`,{className:`production-step`,children:[(0,q.jsx)(`span`,{children:`5`}),g(`開始製作`,`Start`)]}),(0,q.jsxs)(`p`,{children:[W?g(`會另外做一支新影片,目前這支會保留。`,`This makes a separate new film; the current one is kept. `):``,j?g(`片長約 ${Y(A)};越長,需要的時間和 AI 額度越多。`,`About ${Y(A)} long; longer films take more time and AI usage.`):``]}),(0,q.jsx)(Xe,{}),(0,q.jsxs)(`label`,{className:`consent-check`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:I,onChange:e=>L(e.target.checked)}),(0,q.jsx)(`span`,{children:g(`同意使用 ${s.name} 的額度製作,需要時會下載語音模型和有授權的配樂。影片和聲音都留在你的電腦上。`,`I agree to use my ${s.name} usage for this. Clipen downloads a speech model and licensed music when needed; your video and sound stay on your computer.`)})]}),(0,q.jsx)(`button`,{className:`button primary`,disabled:H||ce||ue||!r||!I||!M.trim()||!j||c.length===0,onClick:()=>void ge(),children:H?g(`正在啟動…`,`Starting…`):g(`開始製作`,`Start`)})]})]})]}),P?.result&&P.result.run_id!==P.latest_run?.run_id&&(0,q.jsxs)(`details`,{className:`production-output`,children:[(0,q.jsx)(`summary`,{children:g(`上一次完成的版本`,`The last finished version`)}),(0,q.jsx)(`p`,{children:g(`這版已保留供比較,仍需依實際觀看結果驗收。`,`Kept for comparison; judge it by watching it.`)}),P.result.preview_url&&(0,q.jsx)(`video`,{controls:!0,preload:`metadata`,src:P.result.preview_url,"aria-label":g(`上一次完成版本`,`The last finished version`)}),P.result.export_url&&(0,q.jsx)(`a`,{href:P.result.export_url,download:!0,children:g(`下載這版可編輯時間軸`,`Download its editable timeline`)})]})]})}var zn={body:`M11.52 15.63 A6.27 6.27 0 0 0 21.89 22.63`,stroke:4.44,stick:[`M10.52 9.48 L15.59 7.43 L15.67 11.52 L10.60 13.57Z`,`M17.15 6.80 L22.22 4.75 L22.30 8.84 L17.23 10.89Z`]},Bn={classic:{name:`Classic gold`,tile:[`#e9b44c`],mark:`#1c1404`},black:{name:`Black`,tile:[`#0e0f13`],mark:`#e9b44c`},white:{name:`White`,tile:[`#f5f3ee`],mark:`#1c1404`},sunset:{name:`Sunset`,tile:[`#ff9a3c`,`#e9445a`,`#6b2fbf`],mark:`#ffffff`},neon:{name:`Neon`,tile:[`#24e0c8`,`#0b5cff`,`#13093a`],mark:`#ffffff`},christmas:{name:`Christmas`,tile:[`#c8202f`,`#7d0f1c`],mark:`#fff7e0`}}.classic;function Vn(e){return e.tile.length>1?`linear-gradient(135deg, ${e.tile.join(`, `)})`:e.tile[0]}function Hn(e){let t=e.tile.length>1?`url(#tile)`:e.tile[0];return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${e.tile.length>1?`<defs><linearGradient id="tile" x1="0" y1="0" x2="1" y2="1">${e.tile.map((t,n)=>`<stop offset="${n/(e.tile.length-1)}" stop-color="${t}"/>`).join(``)}</linearGradient></defs>`:``}<rect width="32" height="32" rx="7" fill="${t}"/><path d="${zn.body}" fill="none" stroke="${e.mark}" stroke-width="${zn.stroke}"/>`+zn.stick.map(t=>`<path d="${t}" fill="${e.mark}"/>`).join(``)+`</svg>`}function Un(e=Bn){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=`data:image/svg+xml,${encodeURIComponent(Hn(e))}`)}function Wn({size:e=26,theme:t=Bn}){return(0,q.jsx)(`span`,{className:`brand-mark`,style:{width:e,height:e,background:Vn(t)},"aria-hidden":`true`,children:(0,q.jsxs)(`svg`,{viewBox:`0 0 32 32`,width:e,height:e,children:[(0,q.jsx)(`path`,{d:zn.body,fill:`none`,stroke:t.mark,strokeWidth:zn.stroke}),zn.stick.map(e=>(0,q.jsx)(`path`,{d:e,fill:t.mark},e))]})})}function Gn({csrf:e,projectId:t,disabled:n,onAdded:r}){let i=(0,l.useRef)(null),[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(!1),u=a.some(e=>e.progress<1&&!e.error);async function d(i){if(!i.length||u||n)return;o(i.map(e=>({name:e.name,progress:0})));let a=0;for(let[n,r]of i.entries()){let i=e=>o(t=>t.map((t,r)=>r===n?{...t,...e}:t));try{await w(e,t,r,e=>i({progress:Math.min(e,.99)})),i({progress:1}),a+=1}catch(e){i({error:e instanceof Error?e.message:g(`沒有加入。`,`Not added.`)})}}a&&r()}function f(e){e.preventDefault(),c(!1),d([...e.dataTransfer.files])}return(0,q.jsxs)(`div`,{className:`add-footage${s?` is-over`:``}`,onDragOver:e=>{e.preventDefault(),c(!0)},onDragLeave:()=>c(!1),onDrop:f,children:[(0,q.jsxs)(`div`,{className:`add-footage-body`,children:[(0,q.jsx)(mn,{name:`plus`,size:18}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`加入素材`,`Add footage`)}),(0,q.jsx)(`p`,{children:g(`把影片或聲音檔拖到這裡,或從任何資料夾挑選。檔案會複製一份進這個作品,加入後會自動檢查;交給 AI 修改時,AI 會看到新素材並決定怎麼用。`,`Drop video or sound files here, or pick them from any folder. They are copied into this project and checked; when you hand the film to the AI, it sees the new footage and decides how to use it.`)})]}),(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:n||u,onClick:()=>i.current?.click(),children:g(`選擇檔案`,`Choose files`)}),(0,q.jsx)(`input`,{ref:i,type:`file`,multiple:!0,hidden:!0,accept:`video/*,audio/*,.mov,.mp4,.m4v,.mts,.m2ts,.mkv,.avi,.webm,.mxf,.braw,.r3d,.wav,.mp3,.m4a,.aac,.aif,.aiff,.flac,.ogg,.opus`,onChange:e=>{d([...e.target.files??[]]),e.target.value=``}})]}),a.length>0&&(0,q.jsx)(`ul`,{className:`add-footage-list`,"aria-live":`polite`,children:a.map(e=>(0,q.jsxs)(`li`,{className:e.error?`has-error`:``,children:[(0,q.jsx)(`span`,{children:e.name}),e.error?(0,q.jsx)(`small`,{children:e.error}):e.progress>=1?(0,q.jsx)(`small`,{children:g(`已加入`,`Added`)}):(0,q.jsx)(`progress`,{value:e.progress,max:1,"aria-label":g(`${e.name} 複製進度`,`Copying ${e.name}`)})]},e.name))})]})}function Kn({onStart:e}){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return y().then(t=>{e||n(t.find(e=>e.templates?.length)??null)}).catch(()=>{}),()=>{e=!0}},[]),t?(0,q.jsx)(`div`,{className:`home-templates`,children:(0,q.jsx)(Mn,{skillId:t.skill_id,templates:t.templates??[],selectedId:``,disabled:!0,onStart:n=>e({name:n.name,skillId:t.skill_id,templateId:n.template_id,visualStyleId:n.visual_style_id,fontStyleId:n.font_style_id,aspectRatio:n.aspect_ratio})})}):null}var qn=[{id:`materials`,label:g(`素材`,`Footage`)},{id:`production`,label:g(`AI 節目製作`,`AI production`)}],Jn=[{id:`analysis`,label:g(`逐字稿`,`Transcripts`)}];function Yn(e,t){return{login_required:g(`完成 ${t} 登入後再重啟 Clipen。你仍可先建立作品與整理素材位置。`,`Sign in to ${t}, then restart Clipen. You can already create projects and choose footage.`),unsupported:g(`更新 ${t} CLI 後再重啟 Clipen。本機作品資料不受影響。`,`Update the ${t} CLI, then restart Clipen. Your projects are not affected.`),confinement_failed:g(`安全隔離未通過,因此 Clipen 不會把任何作品資料交給 AI。`,`The safety sandbox check failed, so Clipen will not give the AI any project data.`),unavailable:g(`目前找不到 ${t} CLI。你仍可先建立作品與整理素材位置。`,`The ${t} CLI was not found. You can already create projects and choose footage.`)}[e]}var Xn={available:{label:g(`可使用`,`Available`),help:g(`Clipen 只保存這個位置,不會修改裡面的檔案。`,`Clipen only remembers this folder and never changes the files in it.`)},offline:{label:g(`磁碟未連接`,`Drive not connected`),help:g(`重新連接外接磁碟後,Clipen 會再次確認這個位置。`,`Reconnect the external drive and Clipen checks the folder again.`)},changed:{label:g(`位置已改變`,`Folder changed`),help:g(`這個路徑現在指向不同資料夾,請重新選擇。`,`This path now points to a different folder. Choose it again.`)},permission_required:{label:g(`需要權限`,`Needs permission`),help:g(`請重新選擇資料夾,讓 macOS 確認存取。`,`Choose the folder again so macOS can confirm access.`)}},Zn={controller_restarted:g(`Clipen 上次關閉時檢查尚未完成,請重新檢查。`,`The check was not finished when Clipen last closed. Check again.`),controller_stopped:g(`Clipen 關閉時已安全停止檢查,請重新檢查。`,`Clipen stopped the check safely when it closed. Check again.`),probe_unavailable:g(`找不到 FFprobe。請先安裝 FFmpeg,再重新檢查。`,`FFprobe was not found. Install FFmpeg, then check again.`),probe_unsupported:g(`目前的 FFprobe 版本不支援這次檢查,請更新 FFmpeg。`,`This FFprobe version cannot run the check. Update FFmpeg.`),inventory_input_changed:g(`檢查期間素材位置有變動,請重新檢查。`,`The footage folder changed during the check. Check again.`),root_unavailable:g(`素材磁碟目前無法使用,請確認磁碟已連接。`,`The footage drive is not available. Check it is connected.`),root_changed:g(`素材位置已改變,請重新選擇資料夾。`,`The footage folder changed. Choose it again.`),discovery_timeout:g(`資料夾內容很多,這次檢查已安全停止。請整理後再試一次。`,`The folder holds so much that the check stopped safely. Tidy it up and try again.`),too_many_files:g(`資料夾中的檔案超過安全檢查上限,請縮小素材範圍。`,`The folder has more files than the check allows. Choose a smaller folder.`),tree_too_deep:g(`資料夾層級太深,請整理後再試一次。`,`The folder is nested too deeply. Tidy it up and try again.`)},Qn={entry_unreadable:g(`無法讀取這個項目`,`Cannot read this item`),probe_unsupported:g(`不支援的媒體格式`,`Unsupported format`),probe_unreadable:g(`無法讀取媒體資訊`,`Cannot read media details`),probe_timeout:g(`讀取媒體資訊逾時`,`Reading media details timed out`),probe_changed:g(`檢查時檔案有變動`,`The file changed during the check`),probe_entry_unreadable:g(`無法讀取檔案`,`Cannot read the file`),probe_entry_not_regular:g(`檔案位置已改變`,`The file moved`)},$n={controller_restarted:g(`Clipen 上次關閉時仍在分析。已保存的音訊與逐字稿切塊仍在,可以接續。`,`Clipen closed during the analysis. The saved audio and transcript chunks are still there, so it can continue.`),controller_stopped:g(`Clipen 關閉時已安全停止分析,可以從 checkpoint 接續。`,`Clipen stopped the analysis safely when it closed; it can continue from the checkpoint.`),ffmpeg_unavailable:g(`找不到 FFmpeg,無法準備語音辨識需要的音訊。`,`FFmpeg was not found, so the audio for speech recognition cannot be prepared.`),asr_runtime_unavailable:g(`本機語音辨識執行環境目前無法使用。`,`Local speech recognition is not available right now.`),asr_model_changed:g(`語音辨識模型內容已改變,為避免混用結果,這次分析已停止。`,`The speech model changed, so the analysis stopped rather than mix results.`),scope_changed:g(`素材檢查結果已改變,請重新確認分析範圍。`,`The footage check changed. Confirm the analysis scope again.`),root_changed:g(`外接磁碟上的素材位置已改變,這次沒有執行語音辨識。請重新檢查素材後再試。`,`The footage folder on the external drive changed, so no speech recognition ran. Check the footage again and retry.`),root_unavailable:g(`目前無法讀取素材磁碟,這次沒有執行語音辨識。`,`The footage drive cannot be read, so no speech recognition ran.`),preparation_all_items_failed:g(`所有可分析素材都在語音辨識前失敗,沒有產生可用逐字稿。`,`Every clip failed before speech recognition, so there are no usable transcripts.`)},er={inventory_required:g(`請先完成素材檢查。`,`Check the footage first.`),preparation_empty:g(`目前沒有可進行口語分析的影音素材。`,`There is no footage with speech to analyse.`),root_unavailable:g(`目前無法讀取素材磁碟,請確認外接硬碟已連接。`,`The footage drive cannot be read. Check the external drive is connected.`),root_changed:g(`素材資料夾已改變,請先重新選擇並檢查素材。`,`The footage folder changed. Choose it again and check the footage.`)},tr={asr_runtime_create_failed:g(`無法建立隔離的執行環境,請確認磁碟空間後再試一次。`,`Could not create the isolated environment. Check disk space and try again.`),asr_runtime_install_failed:g(`語音辨識元件下載或安裝失敗,請確認網路後再試一次。`,`Downloading or installing speech recognition failed. Check the network and try again.`),asr_disk_space_insufficient:g(`磁碟空間不足,請至少保留約 3.5 GB 可用空間後再安裝。`,`Not enough disk space. Free about 3.5 GB, then install.`),asr_disk_space_unavailable:g(`目前無法確認安裝磁碟的可用空間。`,`Could not check the free space on the install disk.`),asr_runtime_install_timeout:g(`安裝時間超過安全上限,已停止這次設定。`,`Installing took too long and was stopped.`),asr_download_failed:g(`模型下載失敗,請確認網路後再試一次。`,`The model download failed. Check the network and try again.`),asr_download_verification_failed:g(`下載的模型未通過完整性驗證,Clipen 沒有啟用它。`,`The downloaded model failed its integrity check, so Clipen did not use it.`),asr_model_invalid:g(`模型檔案不完整,Clipen 沒有啟用它。`,`The model files are incomplete, so Clipen did not use them.`),asr_receipt_invalid:g(`安裝紀錄不完整,請清除後重新安裝。`,`The install record is incomplete. Clear it and install again.`),asr_setup_cleanup_failed:g(`未完成的暫存內容無法清除,請重新啟動 Clipen 再試一次。`,`Leftover temporary files could not be cleared. Restart Clipen and try again.`)};function nr(e){if(e===null)return g(`大小未知`,`size unknown`);if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=t[0];for(let e=1;e<t.length&&n>=1024;e+=1)n/=1024,r=t[e];return`${n>=10?n.toFixed(0):n.toFixed(1)} ${r}`}function rr(){return new URLSearchParams(window.location.search).get(`project`)}function ir(e){return e instanceof Error?e.message:g(`Clipen 無法完成這次操作。`,`Clipen could not finish that.`)}function ar(e){let t=new Date(e);return Number.isNaN(t.getTime())?g(`最近更新`,`Recently`):new Intl.DateTimeFormat(h,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function or({status:e}){return e.provider.state===`ready`?null:(0,q.jsxs)(`aside`,{className:`provider-notice`,role:`status`,children:[(0,q.jsx)(`span`,{className:`notice-symbol`,"aria-hidden":`true`,children:`!`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.provider.message}),(0,q.jsx)(`p`,{children:Yn(e.provider.state,e.provider.name)})]})]})}function sr({csrf:e,template:t,onCreated:n,onCancel:r}){let[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null);async function d(t){if(t.preventDefault(),!(!i.trim()||o)){s(!0),u(null);try{n(await N(e,i))}catch(e){u(ir(e))}finally{s(!1)}}}return(0,q.jsxs)(`section`,{className:`create-panel`,"aria-labelledby":`create-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`建立作品`,`New project`)}),(0,q.jsx)(`h2`,{id:`create-title`,children:g(`先替這次剪輯取個名字`,`Name this project first`)}),(0,q.jsx)(`p`,{children:g(`建立後再選擇放毛片的資料夾。`,`Then choose the folder with your footage.`)}),t&&(0,q.jsxs)(`p`,{children:[g(`樣板:`,`Template: `),(0,q.jsx)(`strong`,{children:t})]})]}),(0,q.jsxs)(`form`,{onSubmit:d,children:[(0,q.jsx)(`label`,{htmlFor:`project-name`,children:g(`作品名稱`,`Project name`)}),(0,q.jsx)(`input`,{id:`project-name`,autoFocus:!0,maxLength:120,placeholder:g(`例如:手沖咖啡教學`,`For example: Tokyo trip 2026`),value:i,onChange:e=>a(e.target.value)}),c&&(0,q.jsx)(`p`,{className:`form-error`,role:`alert`,children:c}),(0,q.jsxs)(`div`,{className:`form-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:r,disabled:o,children:g(`取消`,`Cancel`)}),(0,q.jsx)(`button`,{type:`submit`,className:`button primary`,disabled:!i.trim()||o,children:o?g(`正在建立…`,`Creating…`):g(`建立作品`,`New project`)})]})]})]})}function cr({projects:e,csrf:t,onProjects:n,onOpen:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null);function c(e){s(e),a(!0),window.scrollTo({top:0})}function u(t){o&&Fn(t.project_id,o),n([t,...e.filter(e=>e.project_id!==t.project_id)]),r(t)}return(0,q.jsxs)(`main`,{className:`home-main`,children:[(0,q.jsxs)(`section`,{className:`home-heading`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`h1`,{children:g(`你的作品`,`Your projects`)})}),!i&&e.length>0&&(0,q.jsxs)(`button`,{className:`button primary create-button`,onClick:()=>c(null),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),` `,g(`建立作品`,`New project`)]})]}),i&&(0,q.jsx)(sr,{csrf:t,template:o?.name??null,onCreated:u,onCancel:()=>a(!1)}),!i&&e.length===0&&(0,q.jsxs)(`section`,{className:`empty-projects`,"aria-labelledby":`empty-title`,children:[(0,q.jsx)(`div`,{className:`empty-mark`,"aria-hidden":`true`,children:(0,q.jsx)(`span`,{})}),(0,q.jsx)(`h2`,{id:`empty-title`,children:g(`還沒有作品`,`No projects yet`)}),(0,q.jsx)(`p`,{children:g(`選好素材、定下風格,開始你的第一支影片。`,`Pick your footage, choose a style and make your first film.`)}),(0,q.jsx)(`button`,{className:`button primary`,onClick:()=>c(null),children:g(`建立第一個作品`,`Create your first project`)})]}),!i&&e.length>0&&(0,q.jsxs)(`section`,{className:`project-section`,"aria-labelledby":`project-list-title`,children:[(0,q.jsxs)(`div`,{className:`section-title-row`,children:[(0,q.jsx)(`h2`,{id:`project-list-title`,children:g(`最近作品`,`Recent`)}),(0,q.jsx)(`span`,{children:g(`${e.length} 個作品`,`${e.length} ${v(e.length,`project`,`projects`)}`)})]}),(0,q.jsx)(`div`,{className:`project-grid`,children:e.map(e=>{let t=e.directories.find(e=>e.role===`source`);return(0,q.jsxs)(`button`,{className:`project-card`,onClick:()=>r(e),children:[(0,q.jsx)(ur,{projectId:e.project_id,version:e.last_activity_at??e.updated_at}),(0,q.jsx)(`strong`,{children:e.name}),(0,q.jsx)(lr,{project:e,hasSource:!!t}),(0,q.jsxs)(`span`,{className:`project-time`,children:[g(`最近活動:`,`Last active: `),ar(e.last_activity_at??e.updated_at)]})]},e.project_id)})})]}),!i&&(0,q.jsx)(Kn,{onStart:c})]})}function lr({project:e,hasSource:t}){let n=e.standing?.production,[r,i]=t?!n&&!e.standing?.footage_checked?[`next`,g(`下一步:檢查素材`,`Next: check the footage`)]:n?[`queued`,`running`].includes(n.state)?[`active`,g(`AI 製作中`,`AI at work`)]:n.state===`succeeded`?[`done`,g(`影片好了,可以審片`,`Film ready to review`)]:n.state===`cancelled`?[`idle`,g(`已停止製作,草稿還在`,`Stopped; draft kept`)]:n.error_code===`provider_usage_limit`?[`problem`,g(`AI 額度不足,恢復後可繼續`,`Out of AI usage; continue later`)]:[`delivery_blocked`,`provider_stopped_early`].includes(n.error_code??``)?[`problem`,g(`需要你看一下`,`Needs a look`)]:[`problem`,g(`製作沒有完成,草稿還在`,`Not finished; draft kept`)]:[`next`,g(`下一步:開始 AI 製作`,`Next: start the AI`)]:[`next`,g(`下一步:選擇毛片資料夾`,`Next: choose the footage folder`)];return(0,q.jsxs)(`span`,{className:`project-next is-${r}`,children:[(0,q.jsx)(`i`,{"aria-hidden":`true`}),i]})}function ur({projectId:e,version:t}){let[n,r]=(0,l.useState)(null),i=n!==t;return(0,q.jsx)(`span`,{className:`project-cover ${i?`has-still`:``}`,"aria-hidden":`true`,children:i?(0,q.jsx)(`img`,{src:`/api/projects/${e}/cover?v=${encodeURIComponent(t)}`,alt:``,loading:`lazy`,onError:()=>r(t)}):(0,q.jsx)(mn,{name:`film`,size:32})})}function dr({reference:e,busy:t,onChoose:n,onRemove:r}){let i=e?Xn[e.availability]:null;return(0,q.jsxs)(`article`,{className:`directory-card ${e?`has-directory`:``}`,children:[(0,q.jsx)(`div`,{className:`directory-icon`,"aria-hidden":`true`,children:(0,q.jsx)(`span`,{})}),(0,q.jsxs)(`div`,{className:`directory-content`,children:[(0,q.jsxs)(`div`,{className:`directory-title-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{children:g(`毛片資料夾`,`Footage folder`)}),(0,q.jsx)(`p`,{children:g(`剪輯會使用的原始影片與聲音`,`The original video and sound to edit`)})]}),e&&(0,q.jsx)(`span`,{className:`availability ${e.availability}`,children:i?.label})]}),e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`selected-path`,children:[(0,q.jsx)(`strong`,{children:e.display_name}),(0,q.jsx)(`span`,{title:e.display_path,children:e.display_path})]}),e.availability!==`available`&&(0,q.jsx)(`p`,{className:`directory-help`,children:i?.help}),(0,q.jsxs)(`div`,{className:`directory-actions`,children:[(0,q.jsx)(`button`,{className:`text-button`,onClick:n,disabled:t,children:t?g(`等待選擇…`,`Waiting…`):g(`重新選擇`,`Choose again`)}),(0,q.jsx)(`button`,{className:`text-button danger`,onClick:r,disabled:t,children:g(`移除引用`,`Remove`)})]})]}):(0,q.jsx)(`button`,{className:`button secondary choose-button`,onClick:n,disabled:t,children:t?g(`請在 macOS 視窗選擇…`,`Choose in the macOS window…`):g(`選擇毛片資料夾`,`Choose footage folder`)})]})]})}var fr=[g(`選毛片資料夾`,`Choose footage`),g(`檢查素材`,`Check footage`),g(`開始 AI 製作`,`Start the AI`)];function pr({step:e,usable:t,busy:n,checking:r,onChoose:i,onInspect:a,onStart:o}){let[s,c,l,u]=e===1?[g(`選擇放毛片的資料夾`,`Choose the folder with your footage`),g(`例如旅行時手機、相機拍的那一整個資料夾。`,`For example, the whole folder from your phone or camera on a trip.`),g(`選擇毛片資料夾`,`Choose footage folder`),i]:e===2?[r?g(`正在檢查素材…`,`Checking the footage…`):g(`檢查素材`,`Check footage`),r?g(`進度在下方,完成後就能開始製作。`,`Progress is below; you can start once it is done.`):g(`大約幾十秒,看看哪些檔案能用。`,`Takes a few seconds to a minute and shows which files work.`),g(`檢查素材`,`Check footage`),a]:[g(`素材準備好了`,`Footage ready`),t===null?g(`接著讓 AI 剪第一版。`,`Next, let the AI cut a first version.`):g(`${t.toLocaleString()} 段影音可以用,接著讓 AI 剪第一版。`,`${t.toLocaleString()} usable clips. Next, let the AI cut a first version.`),g(`開始 AI 製作`,`Start the AI`),o];return(0,q.jsxs)(`section`,{className:`next-step is-step-${e}`,"aria-label":g(`下一步`,`Next step`),children:[(0,q.jsx)(`ol`,{className:`next-step-track`,children:fr.map((t,n)=>(0,q.jsxs)(`li`,{className:n+1<e?`is-done`:n+1===e?`is-now`:``,"aria-current":n+1===e?`step`:void 0,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:n+1<e?(0,q.jsx)(mn,{name:`check`,size:12}):n+1}),t]},t))}),(0,q.jsxs)(`div`,{className:`next-step-body`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:s}),(0,q.jsx)(`p`,{children:c})]}),!(e===2&&r)&&(0,q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:n,onClick:u,children:l})]})]})}function mr({summary:e,page:t,loading:n,sourceReady:r,actionBusy:i,onStart:a,onCancel:o,onLoadMore:s,loadingMore:c,loadMoreError:l}){let u=e?.latest??null,d=e?.current??null,f=u!==null&&[`queued`,`running`,`cancelling`].includes(u.state),p=u!==null&&[`failed`,`cancelled`,`interrupted`].includes(u.state),m=t?.items.filter(e=>e.status!==`ignored`)??[],h=r&&!i&&!f;return(0,q.jsxs)(`section`,{className:`inventory-section`,"aria-labelledby":`inventory-title`,children:[(0,q.jsxs)(`div`,{className:`inventory-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{id:`inventory-title`,children:g(`檢查素材`,`Check footage`)}),(0,q.jsx)(`p`,{children:g(`讀取每段影片的格式與長度,不用 AI、不改檔案。`,`Reads each clip's format and length; no AI, no changes to your files.`)})]}),!f&&u&&(0,q.jsx)(`button`,{className:`button secondary`,onClick:a,disabled:!h,children:i?g(`正在準備…`,`Getting ready…`):g(`重新檢查素材`,`Check again`)})]}),!r&&(0,q.jsx)(`div`,{className:`inventory-empty muted-state`,children:(0,q.jsx)(`strong`,{children:d?g(`重新確認毛片資料夾`,`Confirm the footage folder again`):g(`先選擇毛片資料夾`,`Choose the footage folder first`)})}),r&&n&&!e&&(0,q.jsxs)(`div`,{className:`inventory-empty`,role:`status`,children:[(0,q.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{children:(0,q.jsx)(`strong`,{children:g(`正在讀取上次檢查狀態`,`Reading the last check`)})})]}),r&&!n&&!u&&(0,q.jsxs)(`div`,{className:`inventory-empty`,children:[(0,q.jsx)(`span`,{className:`inventory-mark`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{children:(0,q.jsx)(`strong`,{children:g(`尚未檢查素材`,`Not checked yet`)})})]}),u&&f&&(0,q.jsxs)(`div`,{className:`inventory-progress`,role:`status`,"aria-live":`polite`,children:[(0,q.jsxs)(`div`,{className:`progress-main`,children:[(0,q.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:u.state===`cancelling`?g(`正在安全停止…`,`Stopping safely…`):g(`正在檢查素材…`,`Checking the footage…`)}),(0,q.jsx)(`p`,{children:g(`已找到 ${u.counts.discovered.toLocaleString()} 個檔案,已讀取 ${u.counts.probed.toLocaleString()} 個媒體資訊。`,`Found ${u.counts.discovered.toLocaleString()} files, read ${u.counts.probed.toLocaleString()} of them.`)})]})]}),(0,q.jsx)(`button`,{className:`button secondary`,onClick:()=>o(u),disabled:i||u.state===`cancelling`,children:u.state===`cancelling`?g(`停止中…`,`Stopping…`):g(`停止檢查`,`Stop`)})]}),u&&p&&(0,q.jsxs)(`div`,{className:`inventory-outcome ${u.state===`failed`?`has-error`:``}`,role:`status`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:u.state===`failed`?`!`:`×`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:u.state===`failed`?g(`這次檢查沒有完成`,`The check did not finish`):u.state===`cancelled`?g(`檢查已取消`,`Check cancelled`):g(`檢查已安全中斷`,`Check stopped safely`)}),(0,q.jsx)(`p`,{children:u.error_code?Zn[u.error_code]??g(`Clipen 無法完成這次素材檢查,請重新試一次。`,`Clipen could not finish the check. Try again.`):g(`素材沒有被修改,你可以隨時重新檢查。`,`Your footage was not changed; check again any time.`)}),d&&d.run_id!==u.run_id&&(0,q.jsx)(`small`,{children:g(`下方仍保留上次成功的檢查結果。`,`The last successful check is still shown below.`)})]})]}),d&&r&&(0,q.jsxs)(`div`,{className:`inventory-results`,children:[d.counts.issues>0&&(0,q.jsx)(`p`,{className:`inventory-attention`,children:g(`部分檔案需要注意,打開下方的媒體清單查看原因。`,`Some files need a look; open the media list below to see why.`)}),(0,q.jsxs)(`div`,{className:`inventory-counts`,"aria-label":g(`素材檢查摘要`,`Footage check summary`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:d.counts.usable.toLocaleString()}),(0,q.jsx)(`span`,{children:g(`可使用媒體`,`Usable`)})]}),(0,q.jsxs)(`div`,{className:d.counts.issues?`attention`:``,children:[(0,q.jsx)(`strong`,{children:d.counts.issues.toLocaleString()}),(0,q.jsx)(`span`,{children:g(`需要注意`,`Need a look`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:d.counts.ignored.toLocaleString()}),(0,q.jsx)(`span`,{children:g(`略過的其他檔案`,`Other files skipped`)})]})]}),t&&t.total>0&&(0,q.jsxs)(`details`,{className:`asset-list`,children:[(0,q.jsxs)(`summary`,{className:`asset-list-heading`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`strong`,{children:g(`查看媒體清單`,`See the media list`)})}),(0,q.jsx)(`span`,{children:g(`顯示 ${m.length.toLocaleString()} 個媒體 · 已讀取 ${t.items.length.toLocaleString()} / ${t.total.toLocaleString()} 筆`,`${m.length.toLocaleString()} media shown · ${t.items.length.toLocaleString()} of ${t.total.toLocaleString()} read`)})]}),(0,q.jsxs)(`div`,{className:`asset-list-content`,children:[m.map(e=>{let t=e.probe?.duration_seconds,n=[...new Set(e.streams.map(e=>e.codec))].join(` · `);return(0,q.jsxs)(`div`,{className:`asset-row ${e.status}`,children:[(0,q.jsx)(`span`,{className:`asset-kind ${e.kind}`,"aria-hidden":`true`,children:e.kind===`video`?`V`:e.kind===`audio`?`A`:`I`}),(0,q.jsxs)(`div`,{className:`asset-name`,children:[(0,q.jsx)(`strong`,{children:e.display_name}),(0,q.jsx)(`span`,{title:e.relative_path,children:e.relative_path})]}),(0,q.jsx)(`div`,{className:`asset-detail`,children:e.status===`needs_attention`?(0,q.jsx)(`strong`,{children:e.issue_code?Qn[e.issue_code]??g(`需要確認`,`Needs checking`):g(`需要確認`,`Needs checking`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:typeof t==`string`&&Number.isFinite(Number(t))?g(`${Number(t).toFixed(1)} 秒`,`${Number(t).toFixed(1)} s`):nr(e.size_bytes)}),n&&(0,q.jsx)(`span`,{children:n})]})})]},e.asset_id)}),t.next_offset!==null&&(0,q.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:c,onClick:s,children:c?g(`正在載入…`,`Loading…`):g(`載入更多素材`,`Load more`)}),l&&(0,q.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:l}),(0,q.jsx)(`p`,{className:`asset-limit`,children:g(`略過的其他檔案不列入媒體清單。`,`Skipped files are not listed.`)})]})]})]})]})}function hr({csrf:e,projectId:t,summary:n,loading:r,actionBusy:i,onStart:a,onCancel:o,onResume:s,onRemoveRuntime:c}){let l=n?.latest??null,u=n?.current??null,d=n?.scope??null,f=l!==null&&[`queued`,`running`,`cancelling`].includes(l.state),p=l?.state===`interrupted`,m=!!(n?.runtime.state===`ready`&&d&&!f&&!p&&!i),h=l&&l.counts.total>0?Math.round((l.counts.transcribed+l.counts.no_audio+l.counts.no_speech+l.counts.issues)/l.counts.total*100):0,_=l?l.counts.transcribed+l.counts.no_audio+l.counts.no_speech+l.counts.issues:0,v=n?.runtime;return(0,q.jsxs)(`section`,{className:`analysis-section`,"aria-labelledby":`analysis-title`,children:[(0,q.jsxs)(`div`,{className:`analysis-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`02 · 分析`,`02 · Analysis`)}),(0,q.jsx)(`h2`,{id:`analysis-title`,children:g(`產生繁體中文逐字稿`,`Make transcripts`)}),(0,q.jsx)(`p`,{children:g(`在本機用原始收音辨識,不確定的段落會標出來讓你核對。`,`Recognised on this Mac from the original sound; unsure parts are marked for you to check.`)})]}),!f&&!p&&(0,q.jsx)(`button`,{className:`button primary`,onClick:a,disabled:!m,children:i?g(`正在準備…`,`Getting ready…`):u?g(`重新分析並取代結果`,`Analyse again and replace`):g(`開始分析`,`Start analysis`)})]}),r&&!n&&(0,q.jsxs)(`div`,{className:`analysis-card`,role:`status`,children:[(0,q.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`正在讀取分析狀態`,`Reading the analysis status`)}),(0,q.jsx)(`p`,{children:g(`尚未開始新的素材處理。`,`Nothing new has started.`)})]})]}),n?.blocked_reason&&(0,q.jsxs)(`div`,{className:`analysis-outcome has-error`,role:`alert`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`!`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`目前不能開始逐字稿分析`,`Transcripts cannot start yet`)}),(0,q.jsx)(`p`,{children:er[n.blocked_reason]??g(`請先確認素材狀態。`,`Check the footage first.`)})]})]}),v?.state===`setup_required`&&v.notice&&(0,q.jsxs)(`div`,{className:`analysis-card setup-required runtime-setup`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`↓`}),(0,q.jsxs)(`div`,{className:`runtime-setup-content`,children:[(0,q.jsx)(`strong`,{children:g(`Clipen 完整設定尚未完成`,`Clipen's setup is not complete`)}),(0,q.jsxs)(`p`,{children:[g(`請關閉 Clipen,回到 Terminal 執行 `,`Close Clipen and run `),(0,q.jsx)(`code`,{children:`clipen install`}),g(`。設定會取得同意後一次完成語音辨識環境與模型下載。`,` in Terminal. With your OK it sets up speech recognition and downloads the model in one go.`)]}),(0,q.jsxs)(`dl`,{className:`runtime-facts`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`下載`,`Download`)}),(0,q.jsxs)(`dd`,{children:[g(`約 `,`about `),nr(v.notice.download_bytes)]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`安裝後`,`Installed`)}),(0,q.jsxs)(`dd`,{children:[g(`約 `,`about `),nr(v.notice.installed_bytes)]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`模型`,`Model`)}),(0,q.jsxs)(`dd`,{children:[v.notice.model.name,` · `,g(`固定版本 `,`pinned `),v.notice.model.revision.slice(0,8)]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:g(`位置`,`Location`)}),(0,q.jsx)(`dd`,{title:v.notice.install_location,children:v.notice.install_location})]})]}),(0,q.jsxs)(`p`,{className:`runtime-license`,children:[g(`MLX Speech 本機程式採用 `,`MLX Speech is under the `),(0,q.jsx)(`a`,{href:v.notice.license.software_url,target:`_blank`,rel:`noreferrer`,children:g(`${v.notice.license.software} 授權`,`${v.notice.license.software} license`)}),g(`;模型採用 `,`; the model under the `),(0,q.jsx)(`a`,{href:v.notice.license.model_url,target:`_blank`,rel:`noreferrer`,children:g(`${v.notice.license.model} 授權`,`${v.notice.license.model} license`)}),g(`。`,`. `),v.notice.license.notice]})]})]}),v?.state===`removing`&&(0,q.jsxs)(`div`,{className:`analysis-card`,role:`status`,children:[(0,q.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:v.message}),(0,q.jsx)(`p`,{children:g(`只會移除 Clipen 管理的模型與執行環境。`,`Removes only the model and runtime Clipen manages.`)})]})]}),v?.state===`failed`&&(0,q.jsxs)(`div`,{className:`analysis-outcome has-error runtime-failed`,role:`alert`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`!`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`本機語音辨識設定沒有完成`,`Local speech recognition setup did not finish`)}),(0,q.jsx)(`p`,{children:v.error_code?tr[v.error_code]??v.message:v.message})]}),(0,q.jsx)(`button`,{className:`button secondary`,onClick:c,disabled:i,children:g(`清除未完成安裝`,`Clear the unfinished install`)})]}),n?.runtime.state===`ready`&&d&&!l&&(0,q.jsxs)(`div`,{className:`analysis-card scope-preview`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`分析範圍已準備好`,`Ready to analyse`)}),(0,q.jsx)(`p`,{children:g(`${d.counts.audio_streams} 條音軌,共約 ${d.duration_seconds} 秒;預計使用 ${nr(d.estimated_audio_bytes)} 暫存空間。`,`${d.counts.audio_streams} audio tracks, about ${d.duration_seconds} seconds; uses about ${nr(d.estimated_audio_bytes)} of temporary space.`)})]}),d.counts.no_audio>0&&(0,q.jsx)(`span`,{children:g(`${d.counts.no_audio} 個素材沒有音軌,會清楚標記並略過`,`${d.counts.no_audio} clips have no audio and are marked and skipped`)})]}),l&&f&&(0,q.jsxs)(`div`,{className:`analysis-progress`,role:`status`,"aria-live":`polite`,children:[(0,q.jsxs)(`div`,{className:`progress-main`,children:[(0,q.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:l.state===`cancelling`?g(`正在保存 checkpoint 並停止…`,`Saving a checkpoint and stopping…`):g(`正在辨識人聲並產生繁體中文逐字稿…`,`Recognising speech and making transcripts…`)}),(0,q.jsx)(`p`,{children:g(`完成 ${h}% · 已處理 ${_.toLocaleString()} / ${l.counts.total.toLocaleString()} 個項目 · ${l.counts.issues} 個需要注意`,`${h}% · ${_.toLocaleString()} of ${l.counts.total.toLocaleString()} done · ${l.counts.issues} need a look`)}),h===0&&l.state!==`cancelling`&&(0,q.jsx)(`small`,{children:g(`第一次辨識會先載入本機模型;弱收音只會有限度重試,避免整批素材雙跑造成過熱。`,`The first run loads the local model; faint sound is retried only a little, so the Mac does not overheat running everything twice.`)}),(0,q.jsx)(`progress`,{value:h,max:100,"aria-label":g(`本機語音辨識進度`,`Speech recognition progress`)})]})]}),(0,q.jsx)(`button`,{className:`button secondary`,onClick:()=>o(l),disabled:i||l.state===`cancelling`,children:l.state===`cancelling`?g(`停止中…`,`Stopping…`):g(`停止分析`,`Stop`)})]}),l&&p&&(0,q.jsxs)(`div`,{className:`analysis-outcome interrupted`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`↻`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:g(`上次分析安全中斷`,`The last analysis stopped safely`)}),(0,q.jsx)(`p`,{children:l.error_code?$n[l.error_code]??g(`已完成的 checkpoint 仍保留。`,`Finished checkpoints are kept.`):g(`已完成的 checkpoint 仍保留。`,`Finished checkpoints are kept.`)})]}),(0,q.jsx)(`button`,{className:`button primary`,onClick:()=>s(l),disabled:i,children:i?g(`正在接續…`,`Continuing…`):g(`接續分析`,`Continue analysis`)})]}),l&&[`failed`,`cancelled`].includes(l.state)&&(0,q.jsxs)(`div`,{className:`analysis-outcome ${l.state===`failed`?`has-error`:``}`,children:[(0,q.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:l.state===`failed`?`!`:`×`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:l.state===`failed`?g(`這次分析沒有完成`,`The analysis did not finish`):g(`分析已取消`,`Analysis cancelled`)}),(0,q.jsx)(`p`,{children:l.error_code?$n[l.error_code]??g(`請確認本機分析環境後再試一次。`,`Check local analysis is set up, then try again.`):g(`毛片沒有被修改,可以重新開始分析。`,`Your footage was not changed; start the analysis again any time.`)})]})]}),l&&_>0&&(f||[`failed`,`cancelled`,`interrupted`].includes(l.state))&&(0,q.jsxs)(`div`,{className:`analysis-live-results`,children:[(0,q.jsx)(`strong`,{children:f?g(`先抽查目前結果`,`Spot-check the results so far`):g(`查看這次已保存的部分結果`,`See the partial results saved`)}),(0,q.jsx)(`p`,{children:f?g(`不必等整批完成;若前幾支逐字稿明顯不對,可以立即停止分析。`,`No need to wait for all of it; if the first transcripts are clearly wrong, stop now.`):g(`即使分析停止,已完成的項目仍可用來判斷設定是否合適。`,`Even stopped, the finished items show whether the settings suit your footage.`)}),(0,q.jsx)(Ye,{csrf:e,projectId:t,run:l,refreshToken:_})]}),u&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`analysis-results`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:u.counts.issues?g(`繁體中文逐字稿已完成,部分素材需要注意`,`Transcripts done; some clips need a look`):g(`繁體中文逐字稿已準備好`,`Transcripts ready`)}),(0,q.jsx)(`p`,{children:[g(`${u.counts.transcribed} 個有逐字稿`,`${u.counts.transcribed} transcribed`),u.counts.no_speech?g(`${u.counts.no_speech} 個沒有人聲`,`${u.counts.no_speech} without speech`):null,u.counts.no_audio?g(`${u.counts.no_audio} 個沒有音軌`,`${u.counts.no_audio} without audio`):null,u.counts.issues?g(`${u.counts.issues} 個需要處理`,`${u.counts.issues} need attention`):null].filter(Boolean).join(` · `)}),(0,q.jsx)(`p`,{className:`analysis-replace-note`,children:g(`重新分析會取代這份逐字稿,毛片不受影響。`,`Analysing again replaces these transcripts; your footage is not affected.`)})]}),(0,q.jsx)(`span`,{className:`result-ready`,children:g(`分析完成`,`Done`)})]}),(0,q.jsx)(Ye,{csrf:e,projectId:t,run:u},u.run_id)]}),v?.state===`ready`&&!f&&(0,q.jsxs)(`details`,{className:`runtime-settings`,children:[(0,q.jsx)(`summary`,{children:g(`本機語音辨識設定`,`Local speech recognition`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`p`,{children:[v.message,g(`。移除只會刪除 Clipen 管理的模型與執行環境,不會碰素材或逐字稿。`,`. Removing it deletes only the model and runtime Clipen manages, never your footage or transcripts.`)]}),(0,q.jsx)(`button`,{className:`text-button danger`,onClick:c,disabled:i,children:g(`移除本機語音辨識`,`Remove local speech recognition`)})]})]})]})}function gr({project:e,csrf:t,onProject:n,onBack:r,onDeleted:i}){let[a,o]=(0,l.useState)(e.name),[s,c]=(0,l.useState)(e.brief),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(null),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[S,C]=(0,l.useState)(null),[w,T]=(0,l.useState)(null),[E,D]=(0,l.useState)(null),[O,k]=(0,l.useState)(null),[A,j]=(0,l.useState)(null),[N,ne]=(0,l.useState)(!1),[re,ie]=(0,l.useState)(null),[H,ae]=(0,l.useState)(!0),[oe,de]=(0,l.useState)(!1),[fe,pe]=(0,l.useState)(null),[me,U]=(0,l.useState)(!1),[he,ge]=(0,l.useState)(null),[_e,ve]=(0,l.useState)(null),[W,ye]=(0,l.useState)(null);function be(e){if(!J(e)){ge(`materials`),D(null),T(G?.availability===`available`?g(`先按下方的「檢查素材」,完成後就能使用這一步。`,`Press “Check footage” below first; this step opens once it is done.`):g(`先選擇毛片資料夾並按「檢查素材」,完成後就能使用這一步。`,`Choose the footage folder and press “Check footage” first; this step opens once it is done.`)),document.getElementById(`inventory-title`)?.scrollIntoView({behavior:`smooth`,block:`center`});return}ge(e),window.scrollTo(0,0)}let G=e.directories.find(e=>e.role===`source`);(0,l.useEffect)(()=>{let t=!0;return R(e.project_id).then(e=>{t&&k(e)}).catch(e=>{t&&D(ir(e))}).finally(()=>{t&&ae(!1)}),()=>{t=!1}},[e.project_id,e.revision]);let xe=O?.latest?.state;(0,l.useEffect)(()=>{if(!xe||![`queued`,`running`,`cancelling`].includes(xe))return;let t=!0,n=window.setInterval(()=>{R(e.project_id).then(e=>{t&&k(e)}).catch(()=>{})},650);return()=>{t=!1,window.clearInterval(n)}},[xe,e.project_id]);let K=G?.availability===`available`?O?.current?.run_id:void 0;(0,l.useEffect)(()=>{if(!K)return;let t=!0;return te(e.project_id,K).then(e=>{t&&(j(e),ie(null))}).catch(e=>{t&&D(ir(e))}),()=>{t=!1}},[K,e.project_id]);let Se=A?.inventory.run_id===K?A:null;async function Ce(){let t=Se?.next_offset;if(!K||t==null||N)return;let n=K;ne(!0),ie(null);try{let r=await te(e.project_id,n,t);j(e=>e?.inventory.run_id===n&&e.next_offset===t?{...r,offset:0,items:[...e.items,...r.items]}:e)}catch(e){ie(ir(e))}finally{ne(!1)}}(0,l.useEffect)(()=>{if(!K)return;let t=!0;return V(e.project_id).then(e=>{t&&pe(e)}).catch(e=>{t&&D(ir(e))}),()=>{t=!1}},[K,e.project_id]);let we=fe&&(fe.scope?.inventory_run_id===K||fe.latest?.inventory_run_id===K||fe.current?.inventory_run_id===K)?fe:null,Te=K?`production`:`materials`;function J(e){return e===`materials`||!!K}let Ee=he&&J(he)?he:Te,De=fe?.latest?.state;(0,l.useEffect)(()=>{if(!De||![`queued`,`running`,`cancelling`].includes(De))return;let t=!0,n=!1,r=()=>{n||(n=!0,V(e.project_id).then(e=>{t&&pe(e)}).catch(()=>{}).finally(()=>{n=!1}))},i=fe?.latest?.run_id,a=i?new EventSource(`/api/projects/${e.project_id}/analyses/${i}/events`):null;a&&(a.onmessage=r);let o=window.setInterval(r,5e3);return()=>{t=!1,a?.close(),window.clearInterval(o)}},[fe?.latest?.run_id,De,e.project_id]);let Oe=fe?.runtime.state;(0,l.useEffect)(()=>{if(Oe!==`removing`)return;let t=!0,n=!1,r=window.setInterval(()=>{n||(n=!0,V(e.project_id).then(e=>{t&&pe(e)}).catch(()=>{}).finally(()=>{n=!1}))},700);return()=>{t=!1,window.clearInterval(r)}},[e.project_id,Oe]);async function ke(t){if(t instanceof x&&t.code===`revision_conflict`)try{let t=await M(e.project_id);n(t),o(t.name),c(t.brief),v(!1)}catch{}D(ir(t))}let Ae=(0,l.useRef)(0);(0,l.useEffect)(()=>{_&&(Ae.current+=1)},[_,a,s]);async function je(){let r=Ae.current;b(!0),D(null);try{let i=await P(t,e,a,s);v(Ae.current!==r),n(i)}catch(e){await ke(e)}finally{b(!1)}}(0,l.useEffect)(()=>{if(!_||!a.trim()||y)return;let e=window.setTimeout(()=>void je(),900);return()=>window.clearTimeout(e)},[_,a,s,y]);async function Me(){if(!(oe||!G||G.availability!==`available`)){de(!0),D(null),T(null);try{let r=e;if(_){if(!a.trim())return;r=await P(t,e,a,s),v(!1),n(r)}let i=await z(t,r);k(e=>({latest:i,current:e?.current??null})),T(g(`素材檢查已開始,你可以留在這裡查看進度`,`The footage check has started; progress shows here`))}catch(e){await ke(e)}finally{de(!1)}}}async function Ne(n){if(!oe){de(!0),D(null),T(null);try{let r=await B(t,e.project_id,n.run_id);k(e=>({latest:r,current:e?.current??null}))}catch(e){D(ir(e))}finally{de(!1)}}}async function Pe(){if(!(me||!we?.scope||we.runtime.state!==`ready`)){U(!0),D(null),T(null);try{let n=await ce(t,e,we.scope.scope_id);pe(e=>e&&{...e,latest:n,current:null}),T(g(`新的本機素材分析已開始,舊分析結果已移除;毛片不會被修改`,`A new analysis has started and the old results were removed; your footage is not changed`))}catch(e){D(ir(e))}finally{U(!1)}}}async function Fe(n){if(!me){U(!0),D(null);try{let r=await le(t,e.project_id,n.run_id);pe(e=>e&&{...e,latest:r})}catch(e){D(ir(e))}finally{U(!1)}}}async function Ie(n){if(!me){U(!0),D(null);try{let r=await ue(t,e.project_id,n.run_id);pe(e=>e&&{...e,latest:r}),T(g(`已從上次保存的 checkpoint 接續分析`,`Continued the analysis from the last checkpoint`))}catch(e){D(ir(e))}finally{U(!1)}}}async function Re(){if(!me&&window.confirm(g(`移除 Clipen 管理的本機語音辨識?毛片與已產生的逐字稿不會被刪除。`,`Remove the local speech recognition Clipen manages? Your footage and transcripts are not deleted.`))){U(!0),D(null),pe(e=>e&&{...e,runtime:{...e.runtime,state:`removing`,phase:`removing`,message:g(`正在停止分析並移除本機語音辨識…`,`Stopping the analysis and removing local speech recognition…`)}});try{let e=await se(t);pe(t=>t&&{...t,runtime:e}),T(g(`本機語音辨識已移除;毛片與分析成果沒有變動,需要時請在 Terminal 執行 clipen install`,`Local speech recognition removed; footage and results are unchanged. Run clipen install in Terminal when you need it again`))}catch(e){D(ir(e))}finally{U(!1)}}}async function ze(){if(!(u||f!==e.name)){d(!0),h(null);try{i(await ee(t,e,f))}catch(e){h(ir(e)),d(!1)}}}async function Be(r){if(!S){C(r),D(null),T(null);try{let i=await F(t,r);if(!i)return;n(await I(t,e,r,i.selection_token)),T(g(`毛片位置已保存`,`Footage folder saved`))}catch(e){await ke(e)}finally{C(null)}}}async function Ve(r){if(!S){C(r),D(null),T(null);try{n(await L(t,e,r)),T(g(`資料夾引用已移除,原始檔案沒有變動`,`Folder removed; the files themselves were not touched`))}catch(e){await ke(e)}finally{C(null)}}}return(0,q.jsxs)(`main`,{className:`workspace-main`,children:[(0,q.jsxs)(`nav`,{className:`workspace-bar`,"aria-label":g(`作品階段`,`Project steps`),children:[(0,q.jsx)(`button`,{type:`button`,className:`workspace-back`,onClick:r,"aria-label":g(`回到所有作品`,`Back to all projects`),children:(0,q.jsx)(mn,{name:`arrow-left`,size:16})}),(0,q.jsx)(`strong`,{className:`workspace-name`,children:e.name}),(0,q.jsxs)(`ol`,{className:`workspace-steps`,children:[qn.map(e=>{let t=J(e.id);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"data-stage":e.id,"aria-disabled":!t,title:t?void 0:g(`先選擇毛片資料夾並檢查素材`,`Choose the footage folder and check it first`),className:Ee===e.id?`is-active`:``,"aria-current":Ee===e.id?`step`:void 0,onClick:()=>be(e.id),children:[e.label,e.id===`materials`&&K&&(0,q.jsx)(mn,{name:`check`,size:14})]})},e.id)}),(0,q.jsx)(`li`,{className:`workspace-views`,ref:ve})]}),(0,q.jsx)(`div`,{className:`workspace-page-tools`,ref:ye}),Jn.map(e=>(0,q.jsx)(`button`,{type:`button`,className:`workspace-tool ${Ee===e.id?`is-active`:``}`,"aria-disabled":!J(e.id),title:J(e.id)?g(`AI 剪片時聽到的每句話:可以查看、更正說錯或聽錯的地方,讓字幕和剪輯更準。`,`Every line the AI heard: check it and correct anything misheard, so captions and cuts come out right.`):g(`先選擇毛片資料夾並檢查素材`,`Choose the footage folder and check it first`),onClick:()=>be(e.id),children:e.label},e.id))]}),(0,q.jsx)(`div`,{className:`workspace-layout`,children:(0,q.jsxs)(`section`,{className:`materials-panel`,"aria-label":g(`作品工作區`,`Project`),children:[Ee===`materials`&&(0,q.jsx)(`div`,{className:`panel-heading`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`h1`,{id:`materials-title`,children:g(`準備這次剪輯`,`Get ready to edit`)})})}),(E||w)&&(0,q.jsx)(`div`,{className:E?`inline-message error`:`inline-message success`,role:E?`alert`:`status`,children:E??w}),Ee===`materials`&&(0,q.jsxs)(`div`,{className:`stage-view`,children:[(0,q.jsx)(pr,{step:!G||G.availability!==`available`?1:K?3:2,usable:O?.current?.counts.usable??null,busy:!!S||oe,checking:!!(O?.latest&&[`queued`,`running`,`cancelling`].includes(O.latest.state)),onChoose:()=>void Be(`source`),onInspect:()=>void Me(),onStart:()=>be(`production`)}),(0,q.jsxs)(`div`,{className:`directory-section`,children:[(0,q.jsx)(`div`,{className:`section-title-row`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`h2`,{children:g(`素材位置`,`Footage`)})})}),(0,q.jsx)(dr,{reference:G,busy:S===`source`,onChoose:()=>void Be(`source`),onRemove:()=>void Ve(`source`)})]}),(0,q.jsx)(mr,{summary:O,page:Se,loading:H,sourceReady:G?.availability===`available`,actionBusy:oe,onStart:()=>void Me(),onCancel:e=>void Ne(e),onLoadMore:()=>void Ce(),loadingMore:N,loadMoreError:re}),G?.availability===`available`&&(0,q.jsx)(Gn,{csrf:t,projectId:e.project_id,disabled:oe||!!(O?.latest&&[`queued`,`running`,`cancelling`].includes(O.latest.state)),onAdded:()=>void Me()}),(0,q.jsxs)(`details`,{className:`project-settings`,children:[(0,q.jsx)(`summary`,{children:g(`作品名稱與刪除`,`Name and delete`)}),(0,q.jsxs)(`form`,{className:`project-form`,"aria-labelledby":`project-details-title`,onSubmit:e=>e.preventDefault(),children:[(0,q.jsx)(`h2`,{id:`project-details-title`,children:g(`作品資料`,`Project details`)}),(0,q.jsx)(`label`,{htmlFor:`workspace-name`,children:g(`作品名稱`,`Project name`)}),(0,q.jsx)(`input`,{id:`workspace-name`,maxLength:120,value:a,onChange:e=>{o(e.target.value),v(!0),T(null)}}),(0,q.jsxs)(`div`,{className:`form-footer`,children:[(0,q.jsx)(`span`,{children:a.trim()?g(`修改會自動保存`,`Changes save automatically`):g(`作品名稱不能空白`,`The name cannot be empty`)}),(0,q.jsxs)(`span`,{className:`save-state ${_?`unsaved`:``}`,"aria-live":`polite`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`}),y?g(`保存中`,`Saving`):_?g(`尚未保存`,`Not saved`):g(`已保存`,`Saved`)]})]})]}),(0,q.jsxs)(`section`,{className:`danger-zone`,"aria-labelledby":`delete-project-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{id:`delete-project-title`,children:g(`刪除作品`,`Delete project`)}),(0,q.jsx)(`p`,{children:g(`只刪 Clipen 的作品資料,毛片不會被刪除。`,`Deletes only Clipen's project data; your footage is not deleted.`)})]}),(0,q.jsx)(`label`,{htmlFor:`delete-project-confirmation`,children:g(`輸入作品名稱「${e.name}」以確認`,`Type the project name “${e.name}” to confirm`)}),m&&(0,q.jsx)(`p`,{className:`form-error`,role:`alert`,children:m}),(0,q.jsxs)(`div`,{className:`danger-actions`,children:[(0,q.jsx)(`input`,{id:`delete-project-confirmation`,value:f,onChange:e=>p(e.target.value),disabled:u}),(0,q.jsx)(`button`,{className:`button danger-button`,type:`button`,disabled:f!==e.name||u,onClick:()=>void ze(),children:u?g(`正在刪除…`,`Deleting…`):g(`永久刪除作品`,`Delete for good`)})]})]})]})]}),Ee===`production`&&K&&(0,q.jsx)(Rn,{projectId:e.project_id,csrf:t,brief:e.brief,sourceReady:G?.availability===`available`,viewSlot:_e,toolSlot:W,onAddFootage:()=>{ge(`materials`),window.setTimeout(()=>document.querySelector(`.add-footage`)?.scrollIntoView({behavior:`smooth`,block:`center`}),60)}},e.project_id),Ee===`analysis`&&K&&(0,q.jsxs)(`div`,{className:`stage-view`,children:[(0,q.jsx)(Le,{projectId:e.project_id,csrf:t,inventoryId:K},`${e.project_id}:${K}`),(0,q.jsx)(hr,{csrf:t,projectId:e.project_id,summary:we,loading:!we,actionBusy:me,onStart:()=>void Pe(),onCancel:e=>void Fe(e),onResume:e=>void Ie(e),onRemoveRuntime:()=>void Re()}),(0,q.jsxs)(`div`,{className:`stage-next`,children:[(0,q.jsx)(`span`,{children:g(`AI 製作時會參考這裡的逐字稿`,`The AI reads these transcripts when it makes the film`)}),(0,q.jsx)(`button`,{className:`button primary`,type:`button`,onClick:()=>be(`production`),children:g(`回到 AI 節目製作`,`Back to AI production`)})]})]})]})})]})}function _r(){return(0,q.jsx)(`div`,{className:`language-switch`,role:`group`,"aria-label":g(`介面語言`,`Language`),children:[[`zh-TW`,`中文`],[`en`,`EN`]].map(([e,t])=>(0,q.jsx)(`button`,{type:`button`,lang:e,"aria-pressed":p===e,onClick:()=>_(e),children:t},e))})}function vr(){let[e,t]=(0,l.useState)({kind:`connecting`}),[n,r]=(0,l.useState)(rr());(0,l.useEffect)(()=>{let e=new AbortController;async function n(){try{await T();let[n,r]=await Promise.all([A(),j()]);e.signal.aborted||t({kind:`ready`,status:n,projects:r})}catch(n){e.signal.aborted||t({kind:`failed`,message:ir(n),serverUnavailable:!(n instanceof x)})}}return n(),()=>e.abort()},[]),(0,l.useEffect)(()=>{let e=()=>r(rr());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(n!==null||e.kind!==`ready`)return;let r=!1;return j().then(e=>{r||t(t=>t.kind===`ready`?{...t,projects:e}:t)}).catch(()=>{}),()=>{r=!0}},[n,e.kind]);let i=(0,l.useMemo)(()=>e.kind===`ready`?e.projects.find(e=>e.project_id===n):void 0,[e,n]);function a(e){let t=e?`/?project=${encodeURIComponent(e.project_id)}`:`/`;window.history.pushState(null,``,t),r(e?.project_id??null)}function o(e){t(t=>{if(t.kind!==`ready`)return t;let n=[e,...t.projects.filter(t=>t.project_id!==e.project_id)];return{...t,projects:n}})}function s(e){t(t=>t.kind===`ready`?{...t,projects:t.projects.filter(t=>t.project_id!==e)}:t),a(null)}let c=e.kind===`ready`,u=c&&e.status.provider.state===`ready`;return(0,q.jsxs)(`div`,{className:`app-shell`,children:[(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsxs)(`button`,{className:`brand`,onClick:()=>a(null),"aria-label":g(`Clipen 作品首頁`,`Clipen home`),children:[(0,q.jsx)(Wn,{}),`clipen`,(0,q.jsx)(`span`,{className:`brand-studio`,children:`STUDIO`})]}),(0,q.jsxs)(`div`,{className:`topbar-end`,children:[(0,q.jsx)(vn,{}),(0,q.jsx)(_r,{}),(0,q.jsx)(ke,{ready:c,providerReady:u,csrf:c?e.status.session.csrf_token:``,providerName:c?e.status.provider.name:``,label:e.kind===`connecting`?g(`正在連接`,`Connecting`):g(`連線中斷`,`Disconnected`)})]})]}),e.kind===`connecting`&&(0,q.jsx)(`main`,{className:`system-main`,children:(0,q.jsxs)(`section`,{className:`system-card`,children:[(0,q.jsx)(`div`,{className:`spinner`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`正在準備`,`Starting`)}),(0,q.jsx)(`h1`,{children:g(`連接本機工作台…`,`Connecting to Clipen…`)}),(0,q.jsx)(`p`,{children:g(`正在載入你的作品與 AI 狀態。`,`Loading your projects and AI status.`)})]})]})}),e.kind===`failed`&&(0,q.jsx)(`main`,{className:`system-main`,children:(0,q.jsxs)(`section`,{className:`system-card warning`,role:`alert`,children:[(0,q.jsx)(`span`,{className:`notice-symbol`,children:`!`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`無法連線`,`Cannot connect`)}),(0,q.jsx)(`h1`,{children:e.serverUnavailable?g(`Clipen 本機服務未啟動`,`Clipen isn't running`):g(`本機工作台拒絕連線`,`Clipen refused the connection`)}),(0,q.jsx)(`p`,{children:e.message}),e.serverUnavailable&&(0,q.jsx)(`code`,{children:g(`clipen codex 或 clipen claude`,`clipen codex or clipen claude`)})]})]})}),c&&(0,q.jsxs)(Ae.Provider,{value:{name:e.status.provider.name,id:e.status.provider.id},children:[(0,q.jsx)(or,{status:e.status}),n&&!i?(0,q.jsx)(`main`,{className:`system-main`,children:(0,q.jsxs)(`section`,{className:`system-card warning`,children:[(0,q.jsx)(`span`,{className:`notice-symbol`,children:`!`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:g(`找不到作品`,`Project not found`)}),(0,q.jsx)(`h1`,{children:g(`這個作品不存在或無法讀取`,`This project does not exist or cannot be read`)}),(0,q.jsx)(`button`,{className:`button primary`,onClick:()=>a(null),children:g(`回到作品首頁`,`Back to home`)})]})]})}):i?(0,q.jsx)(gr,{project:i,csrf:e.status.session.csrf_token,onProject:o,onBack:()=>a(null),onDeleted:s},i.project_id):(0,q.jsx)(cr,{projects:e.projects,csrf:e.status.session.csrf_token,onProjects:n=>t({...e,projects:n}),onOpen:e=>a(e)})]})]})}Un(),(0,u.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(l.StrictMode,{children:(0,q.jsx)(vr,{})}));