@popmelt.com/core 0.37.0 → 0.37.1
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.
- package/README.md +30 -2
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/skills/popmelt-core/SKILL.md +5 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/codex-plugin/skills/popmelt-core/SKILL.md +5 -1
- package/dist/{ExploreAttachment-IO3CNUWH.mjs → ExploreAttachment-6AIMXC2K.mjs} +1 -1
- package/dist/{PagePreviewLayer-KQ2FLIGX.mjs → PagePreviewLayer-SIH7DDBF.mjs} +1 -1
- package/dist/ParticipantRuntime-RTMEFDKF.mjs +1 -0
- package/dist/{PhoneHostGate-2G4BA5FP.mjs → PhoneHostGate-RZRGWS2E.mjs} +1 -1
- package/dist/{PopmeltTasteConnectedPane-H5QWBFD7.mjs → PopmeltTasteConnectedPane-FAJXJEQQ.mjs} +1 -1
- package/dist/{PreviewRuntime-V2PZF462.mjs → PreviewRuntime-MW33PLMV.mjs} +1 -1
- package/dist/{SamplePlacementOverlay-ELSP5AHM.mjs → SamplePlacementOverlay-2VLBRDPZ.mjs} +1 -1
- package/dist/{ThreadPanel-YPL2HDUC.mjs → ThreadPanel-CMC5Q6WM.mjs} +1 -1
- package/dist/adapter-react-three-fiber.d.mts +16 -3
- package/dist/adapter-react-three-fiber.mjs +1 -1
- package/dist/adapter-three.d.mts +20 -3
- package/dist/adapter-three.mjs +4 -4
- package/dist/bridge-entry.mjs +1 -1
- package/dist/{browser-runtime-O3EKN3FI.mjs → browser-runtime-5W2ZKUCZ.mjs} +1 -1
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +1 -1
- package/dist/{checkFixture-SOSI7AT4.mjs → checkFixture-DQPLFEUL.mjs} +1 -1
- package/dist/{chunk-DO46YJCX.mjs → chunk-3PSB5BST.mjs} +1 -1
- package/dist/chunk-3QYA5LGF.mjs +1 -0
- package/dist/{chunk-JCW2WY7X.mjs → chunk-4LVGVKSS.mjs} +1 -1
- package/dist/chunk-5GEBVPTA.mjs +1 -0
- package/dist/{chunk-YVT3J6JB.mjs → chunk-6XEEXK3U.mjs} +1 -1
- package/dist/{chunk-WC4ZNVFM.mjs → chunk-7EISKUU7.mjs} +1 -1
- package/dist/chunk-7JWADHTH.mjs +1 -0
- package/dist/{chunk-LXFKOYLK.mjs → chunk-CCFTIBCJ.mjs} +1 -1
- package/dist/{chunk-MHWIFSXJ.mjs → chunk-CVVD2OMQ.mjs} +1 -1
- package/dist/{chunk-XY7YW7SH.mjs → chunk-EFGQKWSZ.mjs} +1 -1
- package/dist/{chunk-WDSFOF2E.mjs → chunk-F3VZQGPM.mjs} +1 -1
- package/dist/{chunk-JLK3VRBT.mjs → chunk-GAUQZAW6.mjs} +1 -1
- package/dist/{chunk-PILMDBAX.mjs → chunk-HAN6CUNB.mjs} +1 -1
- package/dist/{chunk-BVGHHT3Y.mjs → chunk-HBFSPXIC.mjs} +1 -1
- package/dist/{chunk-DRPRASD6.mjs → chunk-HPU2UMVE.mjs} +1 -1
- package/dist/chunk-JJK4LAN6.mjs +1 -0
- package/dist/{chunk-6O5QLRSA.mjs → chunk-JSNK6NX7.mjs} +1 -1
- package/dist/chunk-KXVXWEN4.mjs +1 -0
- package/dist/{chunk-CIA6WVXQ.mjs → chunk-O2ZQFLNV.mjs} +1 -1
- package/dist/chunk-OIKFQ2FV.mjs +1 -0
- package/dist/{chunk-SNAJBV7T.mjs → chunk-QE5XGXIA.mjs} +2 -2
- package/dist/{chunk-YYFF2X3L.mjs → chunk-QV5G3XRE.mjs} +1 -1
- package/dist/{chunk-B2ISA6V6.mjs → chunk-SBD7GQDN.mjs} +1 -1
- package/dist/{chunk-I7AI52RX.mjs → chunk-SKKHZBOJ.mjs} +1 -1
- package/dist/chunk-UX3DTCHL.mjs +1 -0
- package/dist/chunk-VVNZ5IEG.mjs +24 -0
- package/dist/{chunk-MDPZUECK.mjs → chunk-WF3YGZPI.mjs} +1 -1
- package/dist/{chunk-IGKU4YIV.mjs → chunk-WJHYEACV.mjs} +1 -1
- package/dist/{chunk-I6FJ533W.mjs → chunk-YYODLRV3.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{codex-note-context-UI55CWRI.mjs → codex-note-context-6QGJT2V3.mjs} +1 -1
- package/dist/{codex-project-LIU27RXA.mjs → codex-project-3GJPU63O.mjs} +1 -1
- package/dist/{codex-store-mount-EPETPOBA.mjs → codex-store-mount-F6RBC77X.mjs} +1 -1
- package/dist/dev-server-KWVIMLLL.mjs +1 -0
- package/dist/{focus-inspection-42IEM45O.mjs → focus-inspection-F25RXWZV.mjs} +1 -1
- package/dist/guest-admission.mjs +1 -1
- package/dist/guest-live-canvas.mjs +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/media.d.mts +3 -3
- package/dist/{participantBootstrap-DuosDN9G.d.mts → participantBootstrap-CSLsiQ-C.d.mts} +2 -2
- package/dist/{peer-client-RSC6EGAF.mjs → peer-client-7X52EKMX.mjs} +1 -1
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.d.mts +3 -1
- package/dist/server.mjs +1 -1
- package/dist/{subjects-BhO1x5tz.d.mts → subjects-BQFCkehy.d.mts} +4 -0
- package/dist/{video-adapter-B8J5awc_.d.mts → video-adapter-C0kSwUir.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/ParticipantRuntime-Y2BQVJSL.mjs +0 -1
- package/dist/chunk-4OEHQ6M7.mjs +0 -24
- package/dist/chunk-4YQWU5YB.mjs +0 -1
- package/dist/chunk-AGYBVMHX.mjs +0 -1
- package/dist/chunk-NXTWB3A7.mjs +0 -1
- package/dist/chunk-OFJUTWJU.mjs +0 -1
- package/dist/chunk-PLE6FFKY.mjs +0 -1
- package/dist/chunk-TQ3SP5TE.mjs +0 -1
- package/dist/chunk-YU3ZY76H.mjs +0 -1
- package/dist/dev-server-WYB2CRC5.mjs +0 -1
- /package/dist/{chunk-SQA27YGA.mjs → chunk-TIAPJGX2.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";var e='<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n \x3c!-- fixture-policy --\x3e\n <meta name="viewport" content="width=device-width,initial-scale=1" />\n <title>Steer option styles</title>\n <style>.sp-piece,\n.sp-label-hit {\n position: relative;\n}\n.sp-piece-hit,\n.sp-label-hit {\n cursor: inherit;\n font: inherit;\n margin: 0;\n letter-spacing: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n padding: 0;\n}\n.sp-piece-hit {\n position: absolute;\n /* A keyboard stop for the box, without putting a hit layer over its children. */\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n}\n[data-tagged],\n[data-badge-hover],\n[data-scratch-part]:focus,\n.sp-label-hit:focus-visible,\n.sp-piece:has(> .sp-piece-hit:focus-visible) {\n outline: 1px solid #ed1014;\n outline-offset: 1px;\n}\n\n/* Subject projections track the moving object\'s screen bounds in the sandbox. */\n[data-popmelt-subject-projection][data-scratch-part]:is(\n [data-tagged],\n [data-badge-hover]\n ) {\n opacity: 1 !important;\n z-index: 1 !important;\n}\n\n:root:has(.sp-backdrop) {\n color-scheme: light dark;\n /* The grid is painted by the card or expanded workspace behind this iframe. */\n background-color: transparent;\n}\n.sp-fit {\n color: light-dark(var(--sp-ink-light), var(--sp-ink-dark));\n}\n/* A piece with its own fill has its own backdrop for inherited page text. */\n.sp-fit [data-sp-fill]:not([data-sp-ink], [data-sp-ink] *) {\n color: var(--sp-source-ink, inherit);\n}\n</style>\n <style>\n body {\n margin: 0;\n color: #222;\n font:\n 13px/1.25 \'Popmelt Geist\',\n system-ui,\n sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n body {\n color: #ddd;\n }\n }\n html,\n body,\n #root {\n height: 100%;\n overflow: hidden;\n }\n .sp-backdrop {\n position: absolute;\n inset: 0;\n }\n .sp-fit {\n position: absolute;\n left: 50%;\n top: 50%;\n width: max-content;\n display: flex;\n transform: translate(-50%, -50%) scale(var(--sp-fit, 1));\n }\n html[data-preview-control-hovered] [data-popmelt-sticker-hud] {\n visibility: hidden !important;\n }\n @media (hover: hover) {\n [data-popmelt-sticker-hud] {\n transition: opacity 120ms ease-out;\n }\n html:not(:hover) [data-popmelt-sticker-hud] {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n @starting-style {\n [data-popmelt-sticker-hud] {\n opacity: 0;\n }\n }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-sticker-hud] {\n transition: none;\n }\n }\n </style>\n </head>\n <body>\n <div id="root"></div>\n <script type="module">var e,t,n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},u=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},c=(e,t,s)=>(s=null!=e?n(a(e)):{},((e,t,n,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of o(t))!l.call(e,n)&&void 0!==n&&r(e,n,{get:()=>t[n],enumerable:!(a=i(t,n))||a.enumerable});return e})(!t&&e&&e.__esModule?s:r(s,"default",{value:e,enumerable:!0}),e)),d=u(e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,m={};function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}function y(){}function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||p}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=g.prototype;var x=v.prototype=new y;x.constructor=v,f(x,g.prototype),x.isPureReactComponent=!0;var b=Array.isArray,w={H:null,A:null,T:null,S:null,V:null},S=Object.prototype.hasOwnProperty;function k(e,n,r,i,o,a){return r=a.ref,{$$typeof:t,type:e,key:n,ref:void 0!==r?r:null,props:a}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var M=/\\/+/g;function E(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function T(){}function A(e,r,i,o,a){var l=typeof e;("undefined"===l||"boolean"===l)&&(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case t:case n:s=!0;break;case d:return A((s=e._init)(e._payload),r,i,o,a)}}if(s)return a=a(e),s=""===o?"."+E(e,0):o,b(a)?(i="",null!=s&&(i=s.replace(M,"$&/")+"/"),A(a,r,i,"",function(e){return e})):null!=a&&(C(a)&&(a=function(e,t){return k(e.type,t,void 0,0,0,e.props)}(a,i+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(M,"$&/")+"/")+s)),r.push(a)),1;s=0;var u=""===o?".":o+":";if(b(e))for(var c=0;c<e.length;c++)s+=A(o=e[c],r,i,l=u+E(o,c),a);else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),c=0;!(o=e.next()).done;)s+=A(o=o.value,r,i,l=u+E(o,c++),a);else if("object"===l){if("function"==typeof e.then)return A(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(T,T):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),r,i,o,a);throw r=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return s}function R(e,t,n){if(null==e)return e;var r=[],i=0;return A(e,r,"","",function(e){return t.call(n,e,i++)}),r}function j(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function z(){}e.Children={map:R,forEach:function(e,t,n){R(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return R(e,function(){t++}),t},toArray:function(e){return R(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},e.Component=g,e.Fragment=r,e.Profiler=o,e.PureComponent=v,e.StrictMode=i,e.Suspense=u,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.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=f({},e.props),i=e.key;if(null!=t)for(o in t.ref,void 0!==t.key&&(i=""+t.key),t)!S.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(r[o]=t[o]);var o=arguments.length-2;if(1===o)r.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}return k(e.type,i,void 0,0,0,r)},e.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:a,_context:e},e},e.createElement=function(e,t,n){var r,i={},o=null;if(null!=t)for(r in void 0!==t.key&&(o=""+t.key),t)S.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return k(e,o,void 0,0,0,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:s,render:e}},e.isValidElement=C,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:j}},e.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;null!==i&&i(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(z,I)}catch(e){I(e)}finally{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,n){var r=w.H;if("function"==typeof n)throw Error("useEffect CRUD overload is not enabled in this build of React.");return r.useEffect(e,t)},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.1.0"}),h=u((e,t)=>{t.exports=d()}),p=u(e=>{function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],u=l+1,c=e[u];if(0>i(s,n))u<o&&0>i(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(u<o&&0>i(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(o=performance,e.unstable_now=function(){return o.now()}):(a=Date,l=a.now(),e.unstable_now=function(){return a.now()-l});var o,a,l,s=[],u=[],c=1,d=null,h=3,p=!1,f=!1,m=!1,g=!1,y="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function b(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(s,i)}i=n(u)}}function w(e){if(m=!1,b(e),!f)if(null!==n(s))f=!0,M||(M=!0,S());else{var t=n(u);null!==t&&I(w,t.startTime-e)}}var S,k,C,M=!1,E=-1,T=5,A=-1;function R(){return!(!g&&e.unstable_now()-A<T)}function j(){if(g=!1,M){var t=e.unstable_now();A=t;var i=!0;try{e:{f=!1,m&&(m=!1,v(E),E=-1),p=!0;var o=h;try{t:{for(b(t),d=n(s);null!==d&&!(d.expirationTime>t&&R());){var a=d.callback;if("function"==typeof a){d.callback=null,h=d.priorityLevel;var l=a(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,b(t),i=!0;break t}d===n(s)&&r(s),b(t)}else r(s);d=n(s)}if(null!==d)i=!0;else{var c=n(u);null!==c&&I(w,c.startTime-t),i=!1}}break e}finally{d=null,h=o,p=!1}i=void 0}}finally{i?S():M=!1}}}function I(t,n){E=y(function(){t(e.unstable_now())},n)}"function"==typeof x?S=function(){x(j)}:typeof MessageChannel<"u"?(k=new MessageChannel,C=k.port2,k.port1.onmessage=j,S=function(){C.postMessage(null)}):S=function(){y(j,0)},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"):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=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=h;h=e;try{return t()}finally{h=n}},e.unstable_scheduleCallback=function(r,i,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:c++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(u,r),null===n(s)&&r===n(u)&&(m?(v(E),E=-1):m=!0,I(w,o-a))):(r.sortIndex=l,t(s,r),f||p||(f=!0,M||(M=!0,S()))),r},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}}),f=u((e,t)=>{t.exports=p()}),m=u(e=>{var t=h();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal"),a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(n(299));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:o,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,r)},e.flushSync=function(e){var t=a.T,n=i.p;try{if(a.T=null,i.p=2,e)return e()}finally{a.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,i.d.C(e,t))},e.prefetchDNS=function(e){"string"==typeof e&&i.d.D(e)},e.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var n=t.as,r=l(n,t.crossOrigin),o="string"==typeof t.integrity?t.integrity:void 0,a="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===n?i.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:a}):"script"===n&&i.d.X(e,{crossOrigin:r,integrity:o,fetchPriority:a,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},e.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&i.d.M(e)},e.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},e.preloadModule=function(e,t){if("string"==typeof e)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return a.H.useFormState(e,t,n)},e.useFormStatus=function(){return a.H.useHostTransitionStatus()},e.version="19.1.0"}),g=u((e,t)=>{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=m()}),y=u(e=>{var t=f(),n=h(),r=g();function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function l(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function s(e){if(a(e)!==e)throw Error(i(188))}function u(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=u(e)))return t;e=e.sibling}return null}var c=Object.assign,d=Symbol.for("react.element"),p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),w=Symbol.for("react.consumer"),S=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),j=Symbol.iterator;function I(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=j&&e[j]||e["@@iterator"])?e:null}var z=Symbol.for("react.client.reference");function L(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===z?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case y:return"Fragment";case x:return"Profiler";case v:return"StrictMode";case C:return"Suspense";case M:return"SuspenseList";case A:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case m:return"Portal";case S:return(e.displayName||"Context")+".Provider";case w:return(e._context.displayName||"Context")+".Consumer";case k:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case E:return null!==(t=e.displayName||null)?t:L(e.type)||"Memo";case T:t=e._payload,e=e._init;try{return L(e(t))}catch{}}return null}var P=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D={pending:!1,data:null,method:null,action:null},F=[],O=-1;function $(e){return{current:e}}function H(e){0>O||(e.current=F[O],F[O]=null,O--)}function W(e,t){O++,F[O]=e.current,e.current=t}var B=$(null),V=$(null),q=$(null),U=$(null);function Y(e,t){switch(W(q,t),W(V,e),W(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?od(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=ad(t=od(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(B),W(B,e)}function X(){H(B),H(V),H(q)}function K(e){null!==e.memoizedState&&W(U,e);var t=B.current,n=ad(t,e.type);t!==n&&(W(V,e),W(B,n))}function Q(e){V.current===e&&(H(B),H(V)),U.current===e&&(H(U),Kd._currentValue=D)}var Z=Object.prototype.hasOwnProperty,G=t.unstable_scheduleCallback,J=t.unstable_cancelCallback,ee=t.unstable_shouldYield,te=t.unstable_requestPaint,ne=t.unstable_now,re=t.unstable_getCurrentPriorityLevel,ie=t.unstable_ImmediatePriority,oe=t.unstable_UserBlockingPriority,ae=t.unstable_NormalPriority,le=t.unstable_LowPriority,se=t.unstable_IdlePriority,ue=t.log,ce=t.unstable_setDisableYieldValue,de=null,he=null;function pe(e){if("function"==typeof ue&&ce(e),he&&"function"==typeof he.setStrictMode)try{he.setStrictMode(de,e)}catch{}}var fe=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(me(e)/ge|0)|0},me=Math.log,ge=Math.LN2,ye=256,ve=4194304;function xe(e){var t=42&e;if(0!==t)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:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function be(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!==(r=l&~o)?i=xe(r):0!==(a&=l)?i=xe(a):n||0!==(n=l&~e)&&(i=xe(n)):0!==(l=r&~o)?i=xe(l):0!==a?i=xe(a):n||0!==(n=r&~e)&&(i=xe(n)),0===i?0:0!==t&&t!==i&&0===(t&o)&&((o=i&-i)>=(n=t&-t)||32===o&&4194048&n)?t:i}function we(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Se(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;default:return-1}}function ke(){var e=ye;return!(4194048&(ye<<=1))&&(ye=256),e}function Ce(){var e=ve;return!(62914560&(ve<<=1))&&(ve=4194304),e}function Me(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ee(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Te(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-fe(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194090&n}function Ae(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Re(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 je(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Ie(){var e=_.p;return 0!==e?e:void 0===(e=window.event)?32:ch(e.type)}var ze=Math.random().toString(36).slice(2),Le="__reactFiber$"+ze,Pe="__reactProps$"+ze,Ne="__reactContainer$"+ze,_e="__reactEvents$"+ze,De="__reactListeners$"+ze,Fe="__reactHandles$"+ze,Oe="__reactResources$"+ze,$e="__reactMarker$"+ze;function He(e){delete e[Le],delete e[Pe],delete e[_e],delete e[De],delete e[Fe]}function We(e){var t=e[Le];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ne]||n[Le]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=bd(e);null!==e;){if(n=e[Le])return n;e=bd(e)}return t}n=(e=n).parentNode}return null}function Be(e){if(e=e[Le]||e[Ne]){var t=e.tag;if(5===t||6===t||13===t||26===t||27===t||3===t)return e}return null}function Ve(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(i(33))}function qe(e){var t=e[Oe];return t||(t=e[Oe]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ue(e){e[$e]=!0}var Ye=new Set,Xe={};function Ke(e,t){Qe(e,t),Qe(e+"Capture",t)}function Qe(e,t){for(Xe[e]=t,e=0;e<t.length;e++)Ye.add(t[e])}var Ze,Ge,Je=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]*$"),et={},tt={};function nt(e,t,n){if(function(e){return!!Z.call(tt,e)||!Z.call(et,e)&&(Je.test(e)?tt[e]=!0:(et[e]=!0,!1))}(t))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function rt(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function it(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function ot(e){if(void 0===Ze)try{throw Error()}catch(e){var t=e.stack.trim().match(/\\n( *(at )?)/);Ze=t&&t[1]||"",Ge=-1<e.stack.indexOf("\\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\\n"+Ze+e+Ge}var at=!1;function lt(e,t){if(!e||at)return"";at=!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()}}),"object"==typeof Reflect&&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())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)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 o=r.DetermineComponentFrameRoot(),a=o[0],l=o[1];if(a&&l){var s=a.split("\\n"),u=l.split("\\n");for(i=r=0;r<s.length&&!s[r].includes("DetermineComponentFrameRoot");)r++;for(;i<u.length&&!u[i].includes("DetermineComponentFrameRoot");)i++;if(r===s.length||i===u.length)for(r=s.length-1,i=u.length-1;1<=r&&0<=i&&s[r]!==u[i];)i--;for(;1<=r&&0<=i;r--,i--)if(s[r]!==u[i]){if(1!==r||1!==i)do{if(r--,0>--i||s[r]!==u[i]){var c="\\n"+s[r].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=r&&0<=i);break}}}finally{at=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ot(n):""}function st(e){switch(e.tag){case 26:case 27:case 5:return ot(e.type);case 16:return ot("Lazy");case 13:return ot("Suspense");case 19:return ot("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return ot("Activity");default:return""}}function ut(e){try{var t="";do{t+=st(e),e=e.return}while(e);return t}catch(e){return"\\nError generating stack: "+e.message+"\\n"+e.stack}}function ct(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function dt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ht(e){e._valueTracker||(e._valueTracker=function(e){var t=dt(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function ft(e){if(typeof(e=e||(typeof document<"u"?document:void 0))>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var mt=/[\\n"\\\\]/g;function gt(e){return e.replace(mt,function(e){return"\\\\"+e.charCodeAt(0).toString(16)+" "})}function yt(e,t,n,r,i,o,a,l){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ct(t)):e.value!==""+ct(t)&&(e.value=""+ct(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?xt(e,a,ct(t)):null!=n?xt(e,a,ct(n)):null!=r&&e.removeAttribute("value"),null==i&&null!=o&&(e.defaultChecked=!!o),null!=i&&(e.checked=i&&"function"!=typeof i&&"symbol"!=typeof i),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ct(l):e.removeAttribute("name")}function vt(e,t,n,r,i,o,a,l){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=n){if(("submit"===o||"reset"===o)&&null==t)return;n=null!=n?""+ct(n):"",t=null!=t?""+ct(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=r??i)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a)}function xt(e,t,n){"number"===t&&ft(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function bt(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=""+ct(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function wt(e,t,n){null==t||((t=""+ct(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+ct(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function St(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(i(92));if(P(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=ct(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r)}function kt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var Ct=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 Mt(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||Ct.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Et(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(i(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&n[o]!==r&&Mt(e,o,r)}else for(var a in t)t.hasOwnProperty(a)&&Mt(e,a,t[a])}function Tt(e){if(-1===e.indexOf("-"))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 At=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"]]),Rt=/^[\\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 jt(e){return Rt.test(""+e)?"javascript:throw new Error(\'React has blocked a javascript: URL as a security precaution.\')":e}var It=null;function zt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Lt=null,Pt=null;function Nt(e){var t=Be(e);if(t&&(e=t.stateNode)){var n=e[Pe]||null;e:switch(e=t.stateNode,t.type){case"input":if(yt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(\'input[name="\'+gt(""+t)+\'"][type="radio"]\'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=r[Pe]||null;if(!o)throw Error(i(90));yt(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&pt(r)}break e;case"textarea":wt(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&bt(e,!!n.multiple,t,!1)}}}var _t=!1;function Dt(e,t,n){if(_t)return e(t,n);_t=!0;try{return e(t)}finally{if(_t=!1,(null!==Lt||null!==Pt)&&(Wu(),Lt&&(t=Lt,e=Pt,Pt=Lt=null,Nt(t),e)))for(t=0;t<e.length;t++)Nt(e[t])}}function Ft(e,t){var n=e.stateNode;if(null===n)return null;var r=n[Pe]||null;if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var Ot=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$t=!1;if(Ot)try{Ht={},Object.defineProperty(Ht,"passive",{get:function(){$t=!0}}),window.addEventListener("test",Ht,Ht),window.removeEventListener("test",Ht,Ht)}catch{$t=!1}var Ht,Wt=null,Bt=null,Vt=null;function qt(){if(Vt)return Vt;var e,t,n=Bt,r=n.length,i="value"in Wt?Wt.value:Wt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return Vt=i.slice(e,1<t?1-t:void 0)}function Ut(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Yt(){return!0}function Xt(){return!1}function Kt(e){function t(t,n,r,i,o){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(i):i[a]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?Yt:Xt,this.isPropagationStopped=Xt,this}return c(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Yt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Yt)},persist:function(){},isPersistent:Yt}),t}var Qt,Zt,Gt,Jt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},en=Kt(Jt),tn=c({},Jt,{view:0,detail:0}),nn=Kt(tn),rn=c({},tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Gt&&(Gt&&"mousemove"===e.type?(Qt=e.screenX-Gt.screenX,Zt=e.screenY-Gt.screenY):Zt=Qt=0,Gt=e),Qt)},movementY:function(e){return"movementY"in e?e.movementY:Zt}}),on=Kt(rn),an=Kt(c({},rn,{dataTransfer:0})),ln=Kt(c({},tn,{relatedTarget:0})),sn=Kt(c({},Jt,{animationName:0,elapsedTime:0,pseudoElement:0})),un=Kt(c({},Jt,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),cn=Kt(c({},Jt,{data:0})),dn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},pn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=pn[e])&&!!t[e]}function mn(){return fn}var gn=Kt(c({},tn,{key:function(e){if(e.key){var t=dn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Ut(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?hn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mn,charCode:function(e){return"keypress"===e.type?Ut(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Ut(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),yn=Kt(c({},rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),vn=Kt(c({},tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mn})),xn=Kt(c({},Jt,{propertyName:0,elapsedTime:0,pseudoElement:0})),bn=Kt(c({},rn,{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})),wn=Kt(c({},Jt,{newState:0,oldState:0})),Sn=[9,13,27,32],kn=Ot&&"CompositionEvent"in window,Cn=null;Ot&&"documentMode"in document&&(Cn=document.documentMode);var Mn=Ot&&"TextEvent"in window&&!Cn,En=Ot&&(!kn||Cn&&8<Cn&&11>=Cn),Tn=" ",An=!1;function Rn(e,t){switch(e){case"keyup":return-1!==Sn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var In=!1,zn={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 Ln(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!zn[e.type]:"textarea"===t}function Pn(e,t,n,r){Lt?Pt?Pt.push(r):Pt=[r]:Lt=r,0<(t=qc(t,"onChange")).length&&(n=new en("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Nn=null,_n=null;function Dn(e){Dc(e,0)}function Fn(e){if(pt(Ve(e)))return e}function On(e,t){if("change"===e)return t}var $n,Hn,Wn,Bn=!1;function Vn(){Nn&&(Nn.detachEvent("onpropertychange",qn),_n=Nn=null)}function qn(e){if("value"===e.propertyName&&Fn(_n)){var t=[];Pn(t,_n,e,zt(e)),Dt(Dn,t)}}function Un(e,t,n){"focusin"===e?(Vn(),_n=n,(Nn=t).attachEvent("onpropertychange",qn)):"focusout"===e&&Vn()}function Yn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Fn(_n)}function Xn(e,t){if("click"===e)return Fn(t)}function Kn(e,t){if("input"===e||"change"===e)return Fn(t)}Ot&&(Ot?((Hn="oninput"in document)||((Wn=document.createElement("div")).setAttribute("oninput","return;"),Hn="function"==typeof Wn.oninput),$n=Hn):$n=!1,Bn=$n&&(!document.documentMode||9<document.documentMode));var Qn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Zn(e,t){if(Qn(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===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(!Z.call(t,i)||!Qn(e[i],t[i]))return!1}return!0}function Gn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jn(e,t){var n,r=Gn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Gn(r)}}function er(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?er(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function tr(e){for(var t=ft((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch{n=!1}if(!n)break;t=ft((e=t.contentWindow).document)}return t}function nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var rr=Ot&&"documentMode"in document&&11>=document.documentMode,ir=null,or=null,ar=null,lr=!1;function sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;lr||null==ir||ir!==ft(r)||(r="selectionStart"in(r=ir)&&nr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ar&&Zn(ar,r)||(ar=r,0<(r=qc(or,"onSelect")).length&&(t=new en("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ir)))}function ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var cr={animationend:ur("Animation","AnimationEnd"),animationiteration:ur("Animation","AnimationIteration"),animationstart:ur("Animation","AnimationStart"),transitionrun:ur("Transition","TransitionRun"),transitionstart:ur("Transition","TransitionStart"),transitioncancel:ur("Transition","TransitionCancel"),transitionend:ur("Transition","TransitionEnd")},dr={},hr={};function pr(e){if(dr[e])return dr[e];if(!cr[e])return e;var t,n=cr[e];for(t in n)if(n.hasOwnProperty(t)&&t in hr)return dr[e]=n[t];return e}Ot&&(hr=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);var fr=pr("animationend"),mr=pr("animationiteration"),gr=pr("animationstart"),yr=pr("transitionrun"),vr=pr("transitionstart"),xr=pr("transitioncancel"),br=pr("transitionend"),wr=new Map,Sr="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(" ");function kr(e,t){wr.set(e,t),Ke(t,[e])}Sr.push("scrollEnd");var Cr=new WeakMap;function Mr(e,t){if("object"==typeof e&&null!==e){var n=Cr.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},Cr.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Er=[],Tr=0,Ar=0;function Rr(){for(var e=Tr,t=Ar=Tr=0;t<e;){var n=Er[t];Er[t++]=null;var r=Er[t];Er[t++]=null;var i=Er[t];Er[t++]=null;var o=Er[t];if(Er[t++]=null,null!==r&&null!==i){var a=r.pending;null===a?i.next=i:(i.next=a.next,a.next=i),r.pending=i}0!==o&&Lr(n,i,o)}}function jr(e,t,n,r){Er[Tr++]=e,Er[Tr++]=t,Er[Tr++]=n,Er[Tr++]=r,Ar|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ir(e,t,n,r){return jr(e,t,n,r),Pr(e)}function zr(e,t){return jr(e,null,null,t),Pr(e)}function Lr(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var i=!1,o=e.return;null!==o;)o.childLanes|=n,null!==(r=o.alternate)&&(r.childLanes|=n),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(i=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,i&&null!==t&&(i=31-fe(n),null===(r=(e=o.hiddenUpdates)[i])?e[i]=[t]:r.push(t),t.lane=536870912|n),o):null}function Pr(e){if(50<Lu)throw Lu=0,Pu=null,Error(i(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Nr={};function _r(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 Dr(e,t,n,r){return new _r(e,t,n,r)}function Fr(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Or(e,t){var n=e.alternate;return null===n?((n=Dr(e.tag,t,e.key,e.mode)).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=65011712&e.flags,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=null===t?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 $r(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(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=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Hr(e,t,n,r,o,a){var l=0;if(r=e,"function"==typeof e)Fr(e)&&(l=1);else if("string"==typeof e)l=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,B.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case A:return(e=Dr(31,n,t,o)).elementType=A,e.lanes=a,e;case y:return Wr(n.children,o,a,t);case v:l=8,o|=24;break;case x:return(e=Dr(12,n,t,2|o)).elementType=x,e.lanes=a,e;case C:return(e=Dr(13,n,t,o)).elementType=C,e.lanes=a,e;case M:return(e=Dr(19,n,t,o)).elementType=M,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case b:case S:l=10;break e;case w:l=9;break e;case k:l=11;break e;case E:l=14;break e;case T:l=16,r=null;break e}l=29,n=Error(i(130,null===e?"null":typeof e,"")),r=null}return(t=Dr(l,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Wr(e,t,n,r){return(e=Dr(7,e,r,t)).lanes=n,e}function Br(e,t,n){return(e=Dr(6,e,null,t)).lanes=n,e}function Vr(e,t,n){return(t=Dr(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var qr=[],Ur=0,Yr=null,Xr=0,Kr=[],Qr=0,Zr=null,Gr=1,Jr="";function ei(e,t){qr[Ur++]=Xr,qr[Ur++]=Yr,Yr=e,Xr=t}function ti(e,t,n){Kr[Qr++]=Gr,Kr[Qr++]=Jr,Kr[Qr++]=Zr,Zr=e;var r=Gr;e=Jr;var i=32-fe(r)-1;r&=~(1<<i),n+=1;var o=32-fe(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Gr=1<<32-fe(t)+i|n<<i|r,Jr=o+e}else Gr=1<<o|n<<i|r,Jr=e}function ni(e){null!==e.return&&(ei(e,1),ti(e,1,0))}function ri(e){for(;e===Yr;)Yr=qr[--Ur],qr[Ur]=null,Xr=qr[--Ur],qr[Ur]=null;for(;e===Zr;)Zr=Kr[--Qr],Kr[Qr]=null,Jr=Kr[--Qr],Kr[Qr]=null,Gr=Kr[--Qr],Kr[Qr]=null}var ii=null,oi=null,ai=!1,li=null,si=!1,ui=Error(i(519));function ci(e){throw gi(Mr(Error(i(418,"")),e)),ui}function di(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Le]=e,t[Pe]=r,n){case"dialog":Fc("cancel",t),Fc("close",t);break;case"iframe":case"object":case"embed":Fc("load",t);break;case"video":case"audio":for(n=0;n<Nc.length;n++)Fc(Nc[n],t);break;case"source":Fc("error",t);break;case"img":case"image":case"link":Fc("error",t),Fc("load",t);break;case"details":Fc("toggle",t);break;case"input":Fc("invalid",t),vt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0),ht(t);break;case"select":Fc("invalid",t);break;case"textarea":Fc("invalid",t),St(t,r.value,r.defaultValue,r.children),ht(t)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||Zc(t.textContent,n)?(null!=r.popover&&(Fc("beforetoggle",t),Fc("toggle",t)),null!=r.onScroll&&Fc("scroll",t),null!=r.onScrollEnd&&Fc("scrollend",t),null!=r.onClick&&(t.onclick=Gc),t=!0):t=!1,t||ci(e)}function hi(e){for(ii=e.return;ii;)switch(ii.tag){case 5:case 13:return void(si=!1);case 27:case 3:return void(si=!0);default:ii=ii.return}}function pi(e){if(e!==ii)return!1;if(!ai)return hi(e),ai=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||ld(e.type,e.memoizedProps)),t=!t),t&&oi&&ci(e),hi(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,n=0;e;){if(8===e.nodeType)if("/$"===(t=e.data)){if(0===n){oi=vd(e.nextSibling);break e}n--}else"$"!==t&&"$!"!==t&&"$?"!==t||n++;e=e.nextSibling}oi=null}}else 27===n?(n=oi,fd(e.type)?(e=xd,xd=null,oi=e):oi=n):oi=ii?vd(e.stateNode.nextSibling):null;return!0}function fi(){oi=ii=null,ai=!1}function mi(){var e=li;return null!==e&&(null===bu?bu=e:bu.push.apply(bu,e),li=null),e}function gi(e){null===li?li=[e]:li.push(e)}var yi=$(null),vi=null,xi=null;function bi(e,t,n){W(yi,t._currentValue),t._currentValue=n}function wi(e){e._currentValue=yi.current,H(yi)}function Si(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ki(e,t,n,r){var o=e.child;for(null!==o&&(o.return=e);null!==o;){var a=o.dependencies;if(null!==a){var l=o.child;a=a.firstContext;e:for(;null!==a;){var s=a;a=o;for(var u=0;u<t.length;u++)if(s.context===t[u]){a.lanes|=n,null!==(s=a.alternate)&&(s.lanes|=n),Si(a.return,n,e),r||(l=null);break e}a=s.next}}else if(18===o.tag){if(null===(l=o.return))throw Error(i(341));l.lanes|=n,null!==(a=l.alternate)&&(a.lanes|=n),Si(l,n,e),l=null}else l=o.child;if(null!==l)l.return=o;else for(l=o;null!==l;){if(l===e){l=null;break}if(null!==(o=l.sibling)){o.return=l.return,l=o;break}l=l.return}o=l}}function Ci(e,t,n,r){e=null;for(var o=t,a=!1;null!==o;){if(!a)if(524288&o.flags)a=!0;else if(262144&o.flags)break;if(10===o.tag){var l=o.alternate;if(null===l)throw Error(i(387));if(null!==(l=l.memoizedProps)){var s=o.type;Qn(o.pendingProps.value,l.value)||(null!==e?e.push(s):e=[s])}}else if(o===U.current){if(null===(l=o.alternate))throw Error(i(387));l.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(null!==e?e.push(Kd):e=[Kd])}o=o.return}null!==e&&ki(t,e,n,r),t.flags|=262144}function Mi(e){for(e=e.firstContext;null!==e;){if(!Qn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ei(e){vi=e,xi=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Ti(e){return Ri(vi,e)}function Ai(e,t){return null===vi&&Ei(e),Ri(e,t)}function Ri(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===xi){if(null===e)throw Error(i(308));xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else xi=xi.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()})}},Ii=t.unstable_scheduleCallback,zi=t.unstable_NormalPriority,Li={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pi(){return{controller:new ji,data:new Map,refCount:0}}function Ni(e){e.refCount--,0===e.refCount&&Ii(zi,function(){e.controller.abort()})}var _i=null,Di=0,Fi=0,Oi=null;function $i(){if(0===--Di&&null!==_i){null!==Oi&&(Oi.status="fulfilled");var e=_i;_i=null,Fi=0,Oi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Hi=N.S;N.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===_i){var n=_i=[];Di=0,Fi=zc(),Oi={status:"pending",value:void 0,then:function(e){n.push(e)}}}Di++,t.then($i,$i)}(0,t),null!==Hi&&Hi(e,t)};var Wi=$(null);function Bi(){var e=Wi.current;return null!==e?e:iu.pooledCache}function Vi(e,t){W(Wi,null===t?Wi.current:t.pool)}function qi(){var e=Bi();return null===e?null:{parent:Li._currentValue,pool:e}}var Ui=Error(i(460)),Yi=Error(i(474)),Xi=Error(i(542)),Ki={then:function(){}};function Qi(e){return"fulfilled"===(e=e.status)||"rejected"===e}function Zi(){}function Gi(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Zi,Zi),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw to(e=t.reason),e;default:if("string"==typeof t.status)t.then(Zi,Zi);else{if(null!==(e=iu)&&100<e.shellSuspendCounter)throw Error(i(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw to(e=t.reason),e}throw Ji=t,Ui}}var Ji=null;function eo(){if(null===Ji)throw Error(i(459));var e=Ji;return Ji=null,e}function to(e){if(e===Ui||e===Xi)throw Error(i(483))}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function oo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ao(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&ru){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Pr(e),Lr(e,null,n),t}return jr(e,r,t,n),Pr(e)}function lo(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Ae(e,n)}}function so(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uo=!1;function co(){if(uo&&null!==Oi)throw Oi}function ho(e,t,n,r){uo=!1;var i=e.updateQueue;no=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(null!==l){i.shared.pending=null;var s=l,u=s.next;s.next=null,null===a?o=u:a.next=u,a=s;var d=e.alternate;null!==d&&(l=(d=d.updateQueue).lastBaseUpdate)!==a&&(null===l?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=s)}if(null!==o){var h=i.baseState;for(a=0,d=u=s=null,l=o;;){var p=-536870913&l.lane,f=p!==l.lane;if(f?(au&p)===p:(r&p)===p){0!==p&&p===Fi&&(uo=!0),null!==d&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,g=l;p=t;var y=n;switch(g.tag){case 1:if("function"==typeof(m=g.payload)){h=m.call(y,h,p);break e}h=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(p="function"==typeof(m=g.payload)?m.call(y,h,p):m))break e;h=c({},h,p);break e;case 2:no=!0}}null!==(p=l.callback)&&(e.flags|=64,f&&(e.flags|=8192),null===(f=i.callbacks)?i.callbacks=[p]:f.push(p))}else f={lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===d?(u=d=f,s=h):d=d.next=f,a|=p;if(null===(l=l.next)){if(null===(l=i.shared.pending))break;l=(f=l).next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}null===d&&(s=h),i.baseState=s,i.firstBaseUpdate=u,i.lastBaseUpdate=d,null===o&&(i.shared.lanes=0),fu|=a,e.lanes=a,e.memoizedState=h}}function po(e,t){if("function"!=typeof e)throw Error(i(191,e));e.call(t)}function fo(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)po(n[e],t)}var mo=$(null),go=$(0);function yo(e,t){W(go,e=hu),W(mo,t),hu=e|t.baseLanes}function vo(){W(go,hu),W(mo,mo.current)}function xo(){hu=go.current,H(mo),H(go)}var bo=0,wo=null,So=null,ko=null,Co=!1,Mo=!1,Eo=!1,To=0,Ao=0,Ro=null,jo=0;function Io(){throw Error(i(321))}function zo(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Qn(e[n],t[n]))return!1;return!0}function Lo(e,t,n,r,i,o){return bo=o,wo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=null===e||null===e.memoizedState?Ya:Xa,Eo=!1,o=n(r,i),Eo=!1,Mo&&(o=No(t,n,r,i)),Po(e),o}function Po(e){N.H=Ua;var t=null!==So&&null!==So.next;if(bo=0,ko=So=wo=null,Co=!1,Ao=0,Ro=null,t)throw Error(i(300));null===e||Al||null!==(e=e.dependencies)&&Mi(e)&&(Al=!0)}function No(e,t,n,r){wo=e;var o=0;do{if(Mo&&(Ro=null),Ao=0,Mo=!1,25<=o)throw Error(i(301));if(o+=1,ko=So=null,null!=e.updateQueue){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,null!=a.memoCache&&(a.memoCache.index=0)}N.H=Ka,a=t(n,r)}while(Mo);return a}function _o(){var e=N.H,t=e.useState()[0];return t="function"==typeof t.then?Wo(t):t,e=e.useState()[0],(null!==So?So.memoizedState:null)!==e&&(wo.flags|=1024),t}function Do(){var e=0!==To;return To=0,e}function Fo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Oo(e){if(Co){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Co=!1}bo=0,ko=So=wo=null,Mo=!1,Ao=To=0,Ro=null}function $o(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ko?wo.memoizedState=ko=e:ko=ko.next=e,ko}function Ho(){if(null===So){var e=wo.alternate;e=null!==e?e.memoizedState:null}else e=So.next;var t=null===ko?wo.memoizedState:ko.next;if(null!==t)ko=t,So=e;else{if(null===e)throw null===wo.alternate?Error(i(467)):Error(i(310));e={memoizedState:(So=e).memoizedState,baseState:So.baseState,baseQueue:So.baseQueue,queue:So.queue,next:null},null===ko?wo.memoizedState=ko=e:ko=ko.next=e}return ko}function Wo(e){var t=Ao;return Ao+=1,null===Ro&&(Ro=[]),e=Gi(Ro,e,t),t=wo,null===(null===ko?t.memoizedState:ko.next)&&(t=t.alternate,N.H=null===t||null===t.memoizedState?Ya:Xa),e}function Bo(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return Wo(e);if(e.$$typeof===S)return Ti(e)}throw Error(i(438,String(e)))}function Vo(e){var t=null,n=wo.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=wo.alternate;null!==r&&null!==(r=r.updateQueue)&&null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=R;return t.index++,n}function qo(e,t){return"function"==typeof t?t(e):t}function Uo(e){return Yo(Ho(),So,e)}function Yo(e,t,n){var r=e.queue;if(null===r)throw Error(i(311));r.lastRenderedReducer=n;var o=e.baseQueue,a=r.pending;if(null!==a){if(null!==o){var l=o.next;o.next=a.next,a.next=l}t.baseQueue=o=a,r.pending=null}if(a=e.baseState,null===o)e.memoizedState=a;else{var s=l=null,u=null,c=t=o.next,d=!1;do{var h=-536870913&c.lane;if(h!==c.lane?(au&h)===h:(bo&h)===h){var p=c.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===Fi&&(d=!0);else{if((bo&p)===p){c=c.next,p===Fi&&(d=!0);continue}h={lane:0,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=h,l=a):u=u.next=h,wo.lanes|=p,fu|=p}h=c.action,Eo&&n(a,h),a=c.hasEagerState?c.eagerState:n(a,h)}else p={lane:h,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=p,l=a):u=u.next=p,wo.lanes|=h,fu|=h;c=c.next}while(null!==c&&c!==t);if(null===u?l=a:u.next=s,!Qn(a,e.memoizedState)&&(Al=!0,d&&null!==(n=Oi)))throw n;e.memoizedState=a,e.baseState=l,e.baseQueue=u,r.lastRenderedState=a}return null===o&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Xo(e){var t=Ho(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(null!==o){n.pending=null;var l=o=o.next;do{a=e(a,l.action),l=l.next}while(l!==o);Qn(a,t.memoizedState)||(Al=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Ko(e,t,n){var r=wo,o=Ho(),a=ai;if(a){if(void 0===n)throw Error(i(407));n=n()}else n=t();var l=!Qn((So||o).memoizedState,n);if(l&&(o.memoizedState=n,Al=!0),o=o.queue,va(2048,8,Go.bind(null,r,o,e),[e]),o.getSnapshot!==t||l||null!==ko&&1&ko.memoizedState.tag){if(r.flags|=2048,ma(9,{destroy:void 0,resource:void 0},Zo.bind(null,r,o,n,t),null),null===iu)throw Error(i(349));a||124&bo||Qo(r,t,n)}return n}function Qo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=wo.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Zo(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&ea(e)}function Go(e,t,n){return n(function(){Jo(t)&&ea(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qn(e,n)}catch{return!0}}function ea(e){var t=zr(e,2);null!==t&&Du(t,0,2)}function ta(e){var t=$o();if("function"==typeof e){var n=e;if(e=n(),Eo){pe(!0);try{n()}finally{pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:e},t}function na(e,t,n,r){return e.baseState=n,Yo(e,So,"function"==typeof r?r:qo)}function ra(e,t,n,r,o){if(Ba(e))throw Error(i(485));if(null!==(e=t.action)){var a={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};null!==N.T?n(!0):a.isTransition=!1,r(a),null===(n=t.pending)?(a.next=t.pending=a,ia(t,a)):(a.next=n.next,t.pending=n.next=a)}}function ia(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var o=N.T,a={};N.T=a;try{var l=n(i,r),s=N.S;null!==s&&s(a,l),oa(e,t,l)}catch(n){la(e,t,n)}finally{N.T=o}}else try{oa(e,t,o=n(i,r))}catch(n){la(e,t,n)}}function oa(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){aa(e,t,n)},function(n){return la(e,t,n)}):aa(e,t,n)}function aa(e,t,n){t.status="fulfilled",t.value=n,sa(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,ia(e,n)))}function la(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,sa(t),t=t.next}while(t!==r)}e.action=null}function sa(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ua(e,t){return t}function ca(e,t){if(ai){var n=iu.formState;if(null!==n){e:{var r=wo;if(ai){if(oi){t:{for(var i=oi,o=si;8!==i.nodeType;){if(!o){i=null;break t}if(null===(i=vd(i.nextSibling))){i=null;break t}}i="F!"===(o=i.data)||"F"===o?i:null}if(i){oi=vd(i.nextSibling),r="F!"===i.data;break e}}ci(r)}r=!1}r&&(t=n[0])}}return(n=$o()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:t},n.queue=r,n=$a.bind(null,wo,r),r.dispatch=n,r=ta(!1),o=Wa.bind(null,wo,!1,r.queue),i={state:t,dispatch:null,action:e,pending:null},(r=$o()).queue=i,n=ra.bind(null,wo,i,o,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function da(e){return ha(Ho(),So,e)}function ha(e,t,n){if(t=Yo(e,t,ua)[0],e=Uo(qo)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=Wo(t)}catch(e){throw e===Ui?Xi:e}else r=t;var i=(t=Ho()).queue,o=i.dispatch;return n!==t.memoizedState&&(wo.flags|=2048,ma(9,{destroy:void 0,resource:void 0},pa.bind(null,i,n),null)),[r,o,e]}function pa(e,t){e.action=t}function fa(e){var t=Ho(),n=So;if(null!==n)return ha(t,n,e);Ho(),t=t.memoizedState;var r=(n=Ho()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ma(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=wo.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},wo.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ga(){return Ho().memoizedState}function ya(e,t,n,r){var i=$o();r=void 0===r?null:r,wo.flags|=e,i.memoizedState=ma(1|t,{destroy:void 0,resource:void 0},n,r)}function va(e,t,n,r){var i=Ho();r=void 0===r?null:r;var o=i.memoizedState.inst;null!==So&&null!==r&&zo(r,So.memoizedState.deps)?i.memoizedState=ma(t,o,n,r):(wo.flags|=e,i.memoizedState=ma(1|t,o,n,r))}function xa(e,t){ya(8390656,8,e,t)}function ba(e,t){va(2048,8,e,t)}function wa(e,t){return va(4,2,e,t)}function Sa(e,t){return va(4,4,e,t)}function ka(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Ca(e,t,n){n=null!=n?n.concat([e]):null,va(4,4,ka.bind(null,t,e),n)}function Ma(){}function Ea(e,t){var n=Ho();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&zo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ta(e,t){var n=Ho();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&zo(t,r[1]))return r[0];if(r=e(),Eo){pe(!0);try{e()}finally{pe(!1)}}return n.memoizedState=[r,t],r}function Aa(e,t,n){return void 0===n||1073741824&bo?e.memoizedState=t:(e.memoizedState=n,e=_u(),wo.lanes|=e,fu|=e,n)}function Ra(e,t,n,r){return Qn(n,t)?n:null!==mo.current?(e=Aa(e,n,r),Qn(e,t)||(Al=!0),e):42&bo?(e=_u(),wo.lanes|=e,fu|=e,t):(Al=!0,e.memoizedState=n)}function ja(e,t,n,r,i){var o=_.p;_.p=0!==o&&8>o?o:8;var a=N.T,l={};N.T=l,Wa(e,!1,t,n);try{var s=i(),u=N.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c=function(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}(s,r);Ha(e,t,c,Nu())}else Ha(e,t,r,Nu())}catch(n){Ha(e,t,{then:function(){},status:"rejected",reason:n},Nu())}finally{_.p=o,N.T=a}}function Ia(){}function za(e,t,n,r){if(5!==e.tag)throw Error(i(476));var o=La(e).queue;ja(e,o,t,D,null===n?Ia:function(){return Pa(e),n(r)})}function La(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:D,baseState:D,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:D},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function Pa(e){Ha(e,La(e).next.queue,{},Nu())}function Na(){return Ti(Kd)}function _a(){return Ho().memoizedState}function Da(){return Ho().memoizedState}function Fa(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=Nu(),r=ao(t,e=oo(n),n);return null!==r&&(Du(r,0,n),lo(r,t,n)),t={cache:Pi()},void(e.payload=t)}t=t.return}}function Oa(e,t,n){var r=Nu();n={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Ba(e)?Va(t,n):null!==(n=Ir(e,t,n,r))&&(Du(n,0,r),qa(n,t,r))}function $a(e,t,n){Ha(e,t,n,Nu())}function Ha(e,t,n,r){var i={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ba(e))Va(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,l=o(a,n);if(i.hasEagerState=!0,i.eagerState=l,Qn(l,a))return jr(e,t,i,0),null===iu&&Rr(),!1}catch{}if(null!==(n=Ir(e,t,i,r)))return Du(n,0,r),qa(n,t,r),!0}return!1}function Wa(e,t,n,r){if(r={lane:2,revertLane:zc(),action:r,hasEagerState:!1,eagerState:null,next:null},Ba(e)){if(t)throw Error(i(479))}else null!==(t=Ir(e,n,r,2))&&Du(t,0,2)}function Ba(e){var t=e.alternate;return e===wo||null!==t&&t===wo}function Va(e,t){Mo=Co=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qa(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Ae(e,n)}}var Ua={readContext:Ti,use:Bo,useCallback:Io,useContext:Io,useEffect:Io,useImperativeHandle:Io,useLayoutEffect:Io,useInsertionEffect:Io,useMemo:Io,useReducer:Io,useRef:Io,useState:Io,useDebugValue:Io,useDeferredValue:Io,useTransition:Io,useSyncExternalStore:Io,useId:Io,useHostTransitionStatus:Io,useFormState:Io,useActionState:Io,useOptimistic:Io,useMemoCache:Io,useCacheRefresh:Io},Ya={readContext:Ti,use:Bo,useCallback:function(e,t){return $o().memoizedState=[e,void 0===t?null:t],e},useContext:Ti,useEffect:xa,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ya(4194308,4,ka.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ya(4194308,4,e,t)},useInsertionEffect:function(e,t){ya(4,2,e,t)},useMemo:function(e,t){var n=$o();t=void 0===t?null:t;var r=e();if(Eo){pe(!0);try{e()}finally{pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=$o();if(void 0!==n){var i=n(t);if(Eo){pe(!0);try{n(t)}finally{pe(!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=Oa.bind(null,wo,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},$o().memoizedState=e},useState:function(e){var t=(e=ta(e)).queue,n=$a.bind(null,wo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ma,useDeferredValue:function(e,t){return Aa($o(),e,t)},useTransition:function(){var e=ta(!1);return e=ja.bind(null,wo,e.queue,!0,!1),$o().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=wo,o=$o();if(ai){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===iu)throw Error(i(349));124&au||Qo(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,xa(Go.bind(null,r,a,e),[e]),r.flags|=2048,ma(9,{destroy:void 0,resource:void 0},Zo.bind(null,r,a,n,t),null),n},useId:function(){var e=$o(),t=iu.identifierPrefix;if(ai){var n=Jr;t="«"+t+"R"+(n=(Gr&~(1<<32-fe(Gr)-1)).toString(32)+n),0<(n=To++)&&(t+="H"+n.toString(32)),t+="»"}else t="«"+t+"r"+(n=jo++).toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Na,useFormState:ca,useActionState:ca,useOptimistic:function(e){var t=$o();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Wa.bind(null,wo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return $o().memoizedState=Fa.bind(null,wo)}},Xa={readContext:Ti,use:Bo,useCallback:Ea,useContext:Ti,useEffect:ba,useImperativeHandle:Ca,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Uo,useRef:ga,useState:function(){return Uo(qo)},useDebugValue:Ma,useDeferredValue:function(e,t){return Ra(Ho(),So.memoizedState,e,t)},useTransition:function(){var e=Uo(qo)[0],t=Ho().memoizedState;return["boolean"==typeof e?e:Wo(e),t]},useSyncExternalStore:Ko,useId:_a,useHostTransitionStatus:Na,useFormState:da,useActionState:da,useOptimistic:function(e,t){return na(Ho(),0,e,t)},useMemoCache:Vo,useCacheRefresh:Da},Ka={readContext:Ti,use:Bo,useCallback:Ea,useContext:Ti,useEffect:ba,useImperativeHandle:Ca,useInsertionEffect:wa,useLayoutEffect:Sa,useMemo:Ta,useReducer:Xo,useRef:ga,useState:function(){return Xo(qo)},useDebugValue:Ma,useDeferredValue:function(e,t){var n=Ho();return null===So?Aa(n,e,t):Ra(n,So.memoizedState,e,t)},useTransition:function(){var e=Xo(qo)[0],t=Ho().memoizedState;return["boolean"==typeof e?e:Wo(e),t]},useSyncExternalStore:Ko,useId:_a,useHostTransitionStatus:Na,useFormState:fa,useActionState:fa,useOptimistic:function(e,t){var n=Ho();return null!==So?na(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Vo,useCacheRefresh:Da},Qa=null,Za=0;function Ga(e){var t=Za;return Za+=1,null===Qa&&(Qa=[]),Gi(Qa,e,t)}function Ja(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function el(e,t){throw t.$$typeof===d?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function tl(e){return(0,e._init)(e._payload)}function nl(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(e,t){return(e=Or(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Br(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function u(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===i||"object"==typeof i&&null!==i&&i.$$typeof===T&&tl(i)===t.type)?(Ja(t=o(t,n.props),n),t.return=e,t):(Ja(t=Hr(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Vr(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,i){return null===t||7!==t.tag?((t=Wr(n,e.mode,r,i)).return=e,t):((t=o(t,n)).return=e,t)}function h(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Br(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case p:return Ja(n=Hr(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case m:return(t=Vr(t,e.mode,n)).return=e,t;case T:return h(e,t=(0,t._init)(t._payload),n)}if(P(t)||I(t))return(t=Wr(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return h(e,Ga(t),n);if(t.$$typeof===S)return h(e,Ai(e,t),n);el(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==i?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case p:return n.key===i?u(e,t,n,r):null;case m:return n.key===i?c(e,t,n,r):null;case T:return f(e,t,n=(i=n._init)(n._payload),r)}if(P(n)||I(n))return null!==i?null:d(e,t,n,r,null);if("function"==typeof n.then)return f(e,t,Ga(n),r);if(n.$$typeof===S)return f(e,t,Ai(e,n),r);el(e,n)}return null}function g(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case p:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i);case m:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case T:return g(e,t,n,r=(0,r._init)(r._payload),i)}if(P(r)||I(r))return d(t,e=e.get(n)||null,r,i,null);if("function"==typeof r.then)return g(e,t,n,Ga(r),i);if(r.$$typeof===S)return g(e,t,n,Ai(t,r),i);el(t,r)}return null}function v(s,u,c,d){if("object"==typeof c&&null!==c&&c.type===y&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case p:e:{for(var x=c.key;null!==u;){if(u.key===x){if((x=c.type)===y){if(7===u.tag){n(s,u.sibling),(d=o(u,c.props.children)).return=s,s=d;break e}}else if(u.elementType===x||"object"==typeof x&&null!==x&&x.$$typeof===T&&tl(x)===u.type){n(s,u.sibling),Ja(d=o(u,c.props),c),d.return=s,s=d;break e}n(s,u);break}t(s,u),u=u.sibling}c.type===y?((d=Wr(c.props.children,s.mode,d,c.key)).return=s,s=d):(Ja(d=Hr(c.type,c.key,c.props,null,s.mode,d),c),d.return=s,s=d)}return l(s);case m:e:{for(x=c.key;null!==u;){if(u.key===x){if(4===u.tag&&u.stateNode.containerInfo===c.containerInfo&&u.stateNode.implementation===c.implementation){n(s,u.sibling),(d=o(u,c.children||[])).return=s,s=d;break e}n(s,u);break}t(s,u),u=u.sibling}(d=Vr(c,s.mode,d)).return=s,s=d}return l(s);case T:return v(s,u,c=(x=c._init)(c._payload),d)}if(P(c))return function(i,o,l,s){for(var u=null,c=null,d=o,p=o=0,m=null;null!==d&&p<l.length;p++){d.index>p?(m=d,d=null):m=d.sibling;var y=f(i,d,l[p],s);if(null===y){null===d&&(d=m);break}e&&d&&null===y.alternate&&t(i,d),o=a(y,o,p),null===c?u=y:c.sibling=y,c=y,d=m}if(p===l.length)return n(i,d),ai&&ei(i,p),u;if(null===d){for(;p<l.length;p++)null!==(d=h(i,l[p],s))&&(o=a(d,o,p),null===c?u=d:c.sibling=d,c=d);return ai&&ei(i,p),u}for(d=r(d);p<l.length;p++)null!==(m=g(d,i,p,l[p],s))&&(e&&null!==m.alternate&&d.delete(null===m.key?p:m.key),o=a(m,o,p),null===c?u=m:c.sibling=m,c=m);return e&&d.forEach(function(e){return t(i,e)}),ai&&ei(i,p),u}(s,u,c,d);if(I(c)){if("function"!=typeof(x=I(c)))throw Error(i(150));return function(o,l,s,u){if(null==s)throw Error(i(151));for(var c=null,d=null,p=l,m=l=0,y=null,v=s.next();null!==p&&!v.done;m++,v=s.next()){p.index>m?(y=p,p=null):y=p.sibling;var x=f(o,p,v.value,u);if(null===x){null===p&&(p=y);break}e&&p&&null===x.alternate&&t(o,p),l=a(x,l,m),null===d?c=x:d.sibling=x,d=x,p=y}if(v.done)return n(o,p),ai&&ei(o,m),c;if(null===p){for(;!v.done;m++,v=s.next())null!==(v=h(o,v.value,u))&&(l=a(v,l,m),null===d?c=v:d.sibling=v,d=v);return ai&&ei(o,m),c}for(p=r(p);!v.done;m++,v=s.next())null!==(v=g(p,o,m,v.value,u))&&(e&&null!==v.alternate&&p.delete(null===v.key?m:v.key),l=a(v,l,m),null===d?c=v:d.sibling=v,d=v);return e&&p.forEach(function(e){return t(o,e)}),ai&&ei(o,m),c}(s,u,c=x.call(c),d)}if("function"==typeof c.then)return v(s,u,Ga(c),d);if(c.$$typeof===S)return v(s,u,Ai(s,c),d);el(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==u&&6===u.tag?(n(s,u.sibling),(d=o(u,c)).return=s,s=d):(n(s,u),(d=Br(c,s.mode,d)).return=s,s=d),l(s)):n(s,u)}return function(e,t,n,r){try{Za=0;var i=v(e,t,n,r);return Qa=null,i}catch(t){if(t===Ui||t===Xi)throw t;var o=Dr(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var rl=nl(!0),il=nl(!1),ol=$(null),al=null;function ll(e){var t=e.alternate;W(dl,1&dl.current),W(ol,e),null===al&&(null===t||null!==mo.current||null!==t.memoizedState)&&(al=e)}function sl(e){if(22===e.tag){if(W(dl,dl.current),W(ol,e),null===al){var t=e.alternate;null!==t&&null!==t.memoizedState&&(al=e)}}else ul()}function ul(){W(dl,dl.current),W(ol,ol.current)}function cl(e){H(ol),al===e&&(al=null),H(dl)}var dl=$(0);function hl(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||yd(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function pl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:c({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var fl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Nu(),i=oo(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=ao(e,i,r))&&(Du(t,0,r),lo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Nu(),i=oo(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=ao(e,i,r))&&(Du(t,0,r),lo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nu(),r=oo(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ao(e,r,n))&&(Du(t,0,n),lo(t,e,n))}};function ml(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!(t.prototype&&t.prototype.isPureReactComponent&&Zn(n,r)&&Zn(i,o))}function gl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&fl.enqueueReplaceState(t,t.state,null)}function yl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=c({},n)),e)void 0===n[i]&&(n[i]=e[i]);return n}var vl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)};function xl(e){vl(e)}function bl(e){console.error(e)}function wl(e){vl(e)}function Sl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Cl(e,t,n){return(n=oo(n)).tag=3,n.payload={element:null},n.callback=function(){Sl(e,t)},n}function Ml(e){return(e=oo(e)).tag=3,e}function El(e,t,n,r){var i=n.type.getDerivedStateFromError;if("function"==typeof i){var o=r.value;e.payload=function(){return i(o)},e.callback=function(){kl(t,n,r)}}var a=n.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){kl(t,n,r),"function"!=typeof i&&(null===Mu?Mu=new Set([this]):Mu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Tl=Error(i(461)),Al=!1;function Rl(e,t,n,r){t.child=null===e?il(t,null,n,r):rl(t,e.child,n,r)}function jl(e,t,n,r,i){n=n.render;var o=t.ref;if("ref"in r){var a={};for(var l in r)"ref"!==l&&(a[l]=r[l])}else a=r;return Ei(t),r=Lo(e,t,n,a,o,i),l=Do(),null===e||Al?(ai&&l&&ni(t),t.flags|=1,Rl(e,t,r,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function Il(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Fr(o)||void 0!==o.defaultProps||null!==n.compare?((e=Hr(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,zl(e,t,o,r,i))}if(o=e.child,!Zl(e,i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:Zn)(a,r)&&e.ref===t.ref)return Ql(e,t,i)}return t.flags|=1,(e=Or(o,r)).ref=t.ref,e.return=t,t.child=e}function zl(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(Zn(o,r)&&e.ref===t.ref){if(Al=!1,t.pendingProps=r=o,!Zl(e,i))return t.lanes=e.lanes,Ql(e,t,i);131072&e.flags&&(Al=!0)}}return _l(e,t,n,r,i)}function Ll(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(128&t.flags){if(r=null!==o?o.baseLanes|n:n,null!==e){for(i=t.child=e.child,o=0;null!==i;)o=o|i.lanes|i.childLanes,i=i.sibling;t.childLanes=o&~r}else t.childLanes=0,t.child=null;return Pl(e,t,r,n)}if(!(536870912&n))return t.lanes=t.childLanes=536870912,Pl(e,t,null!==o?o.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Vi(0,null!==o?o.cachePool:null),null!==o?yo(t,o):vo(),sl(t)}else null!==o?(Vi(0,o.cachePool),yo(t,o),ul(),t.memoizedState=null):(null!==e&&Vi(0,null),vo(),ul());return Rl(e,t,i,n),t.child}function Pl(e,t,n,r){var i=Bi();return i=null===i?null:{parent:Li._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},null!==e&&Vi(0,null),vo(),sl(t),null!==e&&Ci(e,t,r,!0),null}function Nl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(i(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function _l(e,t,n,r,i){return Ei(t),n=Lo(e,t,n,r,void 0,i),r=Do(),null===e||Al?(ai&&r&&ni(t),t.flags|=1,Rl(e,t,n,i),t.child):(Fo(e,t,i),Ql(e,t,i))}function Dl(e,t,n,r,i,o){return Ei(t),t.updateQueue=null,n=No(t,r,n,i),Po(e),r=Do(),null===e||Al?(ai&&r&&ni(t),t.flags|=1,Rl(e,t,n,o),t.child):(Fo(e,t,o),Ql(e,t,o))}function Fl(e,t,n,r,i){if(Ei(t),null===t.stateNode){var o=Nr,a=n.contextType;"object"==typeof a&&null!==a&&(o=Ti(a)),o=new n(r,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=fl,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=r,o.state=t.memoizedState,o.refs={},ro(t),a=n.contextType,o.context="object"==typeof a&&null!==a?Ti(a):Nr,o.state=t.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(pl(t,n,a,r),o.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(a=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),a!==o.state&&fl.enqueueReplaceState(o,o.state,null),ho(t,r,o,i),co(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){o=t.stateNode;var l=t.memoizedProps,s=yl(n,l);o.props=s;var u=o.context,c=n.contextType;a=Nr,"object"==typeof c&&null!==c&&(a=Ti(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof o.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(l||u!==a)&&gl(t,o,r,a),no=!1;var h=t.memoizedState;o.state=h,ho(t,r,o,i),co(),u=t.memoizedState,l||h!==u||no?("function"==typeof d&&(pl(t,n,d,r),u=t.memoizedState),(s=no||ml(t,n,s,r,h,u,a))?(c||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=a,r=s):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,io(e,t),c=yl(n,a=t.memoizedProps),o.props=c,d=t.pendingProps,h=o.context,u=n.contextType,s=Nr,"object"==typeof u&&null!==u&&(s=Ti(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==d||h!==s)&&gl(t,o,r,s),no=!1,h=t.memoizedState,o.state=h,ho(t,r,o,i),co();var p=t.memoizedState;a!==d||h!==p||no||null!==e&&null!==e.dependencies&&Mi(e.dependencies)?("function"==typeof l&&(pl(t,n,l,r),p=t.memoizedState),(c=no||ml(t,n,c,r,h,p,s)||null!==e&&null!==e.dependencies&&Mi(e.dependencies))?(u||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,p,s),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),o.props=r,o.state=p,o.context=s,r=c):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Nl(e,t),r=!!(128&t.flags),o||r?(o=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&r?(t.child=rl(t,e.child,null,i),t.child=rl(t,null,n,i)):Rl(e,t,n,i),t.memoizedState=o.state,e=t.child):e=Ql(e,t,i),e}function Ol(e,t,n,r){return fi(),t.flags|=256,Rl(e,t,n,r),t.child}var $l={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hl(e){return{baseLanes:e,cachePool:qi()}}function Wl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=yu),e}function Bl(e,t,n){var r,o=t.pendingProps,a=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&dl.current)),r&&(a=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(ai){if(a?ll(t):ul(),ai){var s,u=oi;if(s=u){e:{for(s=u,u=si;8!==s.nodeType;){if(!u){u=null;break e}if(null===(s=vd(s.nextSibling))){u=null;break e}}u=s}null!==u?(t.memoizedState={dehydrated:u,treeContext:null!==Zr?{id:Gr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},(s=Dr(18,null,null,0)).stateNode=u,s.return=t,t.child=s,ii=t,oi=null,s=!0):s=!1}s||ci(t)}if(null!==(u=t.memoizedState)&&null!==(u=u.dehydrated))return yd(u)?t.lanes=32:t.lanes=536870912,null;cl(t)}return u=o.children,o=o.fallback,a?(ul(),u=ql({mode:"hidden",children:u},a=t.mode),o=Wr(o,a,n,null),u.return=t,o.return=t,u.sibling=o,t.child=u,(a=t.child).memoizedState=Hl(n),a.childLanes=Wl(e,r,n),t.memoizedState=$l,o):(ll(t),Vl(t,u))}if(null!==(s=e.memoizedState)&&null!==(u=s.dehydrated)){if(l)256&t.flags?(ll(t),t.flags&=-257,t=Ul(e,t,n)):null!==t.memoizedState?(ul(),t.child=e.child,t.flags|=128,t=null):(ul(),a=o.fallback,u=t.mode,o=ql({mode:"visible",children:o.children},u),(a=Wr(a,u,n,null)).flags|=2,o.return=t,a.return=t,o.sibling=a,t.child=o,rl(t,e.child,null,n),(o=t.child).memoizedState=Hl(n),o.childLanes=Wl(e,r,n),t.memoizedState=$l,t=a);else if(ll(t),yd(u)){if(r=u.nextSibling&&u.nextSibling.dataset)var c=r.dgst;r=c,(o=Error(i(419))).stack="",o.digest=r,gi({value:o,source:null,stack:null}),t=Ul(e,t,n)}else if(Al||Ci(e,t,n,!1),r=0!==(n&e.childLanes),Al||r){if(null!==(r=iu)&&0!==(o=0!==((o=42&(o=n&-n)?1:Re(o))&(r.suspendedLanes|n))?0:o)&&o!==s.retryLane)throw s.retryLane=o,zr(e,o),Du(r,0,o),Tl;"$?"===u.data||Xu(),t=Ul(e,t,n)}else"$?"===u.data?(t.flags|=192,t.child=e.child,t=null):(e=s.treeContext,oi=vd(u.nextSibling),ii=t,ai=!0,li=null,si=!1,null!==e&&(Kr[Qr++]=Gr,Kr[Qr++]=Jr,Kr[Qr++]=Zr,Gr=e.id,Jr=e.overflow,Zr=t),(t=Vl(t,o.children)).flags|=4096);return t}return a?(ul(),a=o.fallback,u=t.mode,c=(s=e.child).sibling,(o=Or(s,{mode:"hidden",children:o.children})).subtreeFlags=65011712&s.subtreeFlags,null!==c?a=Or(c,a):(a=Wr(a,u,n,null)).flags|=2,a.return=t,o.return=t,o.sibling=a,t.child=o,o=a,a=t.child,null===(u=e.child.memoizedState)?u=Hl(n):(null!==(s=u.cachePool)?(c=Li._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=qi(),u={baseLanes:u.baseLanes|n,cachePool:s}),a.memoizedState=u,a.childLanes=Wl(e,r,n),t.memoizedState=$l,o):(ll(t),e=(n=e.child).sibling,(n=Or(n,{mode:"visible",children:o.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function Vl(e,t){return(t=ql({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ql(e,t){return(e=Dr(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Ul(e,t,n){return rl(t,e.child,null,n),(e=Vl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Yl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Si(e.return,t,n)}function Xl(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Kl(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Rl(e,t,r.children,n),2&(r=dl.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Yl(e,n,t);else if(19===e.tag)Yl(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(W(dl,r),i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===hl(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Xl(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===hl(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Xl(t,!0,n,null,o);break;case"together":Xl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ql(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),fu|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Ci(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Or(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Or(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Zl(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Mi(e))}function Gl(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Al=!0;else{if(!(Zl(e,n)||128&t.flags))return Al=!1,function(e,t,n){switch(t.tag){case 3:Y(t,t.stateNode.containerInfo),bi(0,Li,e.memoizedState.cache),fi();break;case 27:case 5:K(t);break;case 4:Y(t,t.stateNode.containerInfo);break;case 10:bi(0,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(ll(t),t.flags|=128,null):0!==(n&t.child.childLanes)?Bl(e,t,n):(ll(t),null!==(e=Ql(e,t,n))?e.sibling:null);ll(t);break;case 19:var i=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Ci(e,t,n,!1),r=0!==(n&t.childLanes)),i){if(r)return Kl(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),W(dl,dl.current),r)break;return null;case 22:case 23:return t.lanes=0,Ll(e,t,n);case 24:bi(0,Li,e.memoizedState.cache)}return Ql(e,t,n)}(e,t,n);Al=!!(131072&e.flags)}else Al=!1,ai&&1048576&t.flags&&ti(t,Xr,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,o=r._init;if(r=o(r._payload),t.type=r,"function"!=typeof r){if(null!=r){if((o=r.$$typeof)===k){t.tag=11,t=jl(null,t,r,e,n);break e}if(o===E){t.tag=14,t=Il(null,t,r,e,n);break e}}throw t=L(r)||r,Error(i(306,t,""))}Fr(r)?(e=yl(r,e),t.tag=1,t=Fl(null,t,r,e,n)):(t.tag=0,t=_l(null,t,r,e,n))}return t;case 0:return _l(e,t,t.type,t.pendingProps,n);case 1:return Fl(e,t,r=t.type,o=yl(r,t.pendingProps),n);case 3:e:{if(Y(t,t.stateNode.containerInfo),null===e)throw Error(i(387));r=t.pendingProps;var a=t.memoizedState;o=a.element,io(e,t),ho(t,r,null,n);var l=t.memoizedState;if(r=l.cache,bi(0,Li,r),r!==a.cache&&ki(t,[Li],n,!0),co(),r=l.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=Ol(e,t,r,n);break e}if(r!==o){gi(o=Mr(Error(i(424)),t)),t=Ol(e,t,r,n);break e}for(e=9===(e=t.stateNode.containerInfo).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,oi=vd(e.firstChild),ii=t,ai=!0,li=null,si=!0,n=il(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(fi(),r===o){t=Ql(e,t,n);break e}Rl(e,t,r,n)}t=t.child}return t;case 26:return Nl(e,t),null===e?(n=Rd(t.type,null,t.pendingProps,null))?t.memoizedState=n:ai||(n=t.type,e=t.pendingProps,(r=id(q.current).createElement(n))[Le]=t,r[Pe]=e,td(r,n,e),Ue(r),t.stateNode=r):t.memoizedState=Rd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),null===e&&ai&&(r=t.stateNode=wd(t.type,t.pendingProps,q.current),ii=t,si=!0,o=oi,fd(t.type)?(xd=o,oi=vd(r.firstChild)):oi=o),Rl(e,t,t.pendingProps.children,n),Nl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&ai&&((o=r=oi)&&(r=function(e,t,n,r){for(;1===e.nodeType;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[$e])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==i.rel||e.getAttribute("href")!==(null==i.href||""===i.href?null:i.href)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin)||e.getAttribute("title")!==(null==i.title?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==i.src?null:i.src)||e.getAttribute("type")!==(null==i.type?null:i.type)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==i.name?null:""+i.name;if("hidden"===i.type&&e.getAttribute("name")===o)return e}if(null===(e=vd(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,si),null!==r?(t.stateNode=r,ii=t,oi=vd(r.firstChild),si=!1,o=!0):o=!1),o||ci(t)),K(t),o=t.type,a=t.pendingProps,l=null!==e?e.memoizedProps:null,r=a.children,ld(o,a)?r=null:null!==l&&ld(o,l)&&(t.flags|=32),null!==t.memoizedState&&(o=Lo(e,t,_o,null,null,n),Kd._currentValue=o),Nl(e,t),Rl(e,t,r,n),t.child;case 6:return null===e&&ai&&((e=n=oi)&&(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;)if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n||null===(e=vd(e.nextSibling)))return null;return e}(n,t.pendingProps,si),null!==n?(t.stateNode=n,ii=t,oi=null,e=!0):e=!1),e||ci(t)),null;case 13:return Bl(e,t,n);case 4:return Y(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=rl(t,null,r,n):Rl(e,t,r,n),t.child;case 11:return jl(e,t,t.type,t.pendingProps,n);case 7:return Rl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Rl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,bi(0,t.type,r.value),Rl(e,t,r.children,n),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Ei(t),r=r(o=Ti(o)),t.flags|=1,Rl(e,t,r,n),t.child;case 14:return Il(e,t,t.type,t.pendingProps,n);case 15:return zl(e,t,t.type,t.pendingProps,n);case 19:return Kl(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?((n=ql(r,n)).ref=t.ref,t.child=n,n.return=t,t=n):((n=Or(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Ll(e,t,n);case 24:return Ei(t),r=Ti(Li),null===e?(null===(o=Bi())&&(o=iu,a=Pi(),o.pooledCache=a,a.refCount++,null!==a&&(o.pooledCacheLanes|=n),o=a),t.memoizedState={parent:r,cache:o},ro(t),bi(0,Li,o)):(0!==(e.lanes&n)&&(io(e,t),ho(t,null,null,n),co()),o=e.memoizedState,a=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=o),bi(0,Li,r)):(r=a.cache,bi(0,Li,r),r!==o.cache&&ki(t,[Li],n,!0))),Rl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Jl(e){e.flags|=4}function es(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!Wd(t)){if(null!==(t=ol.current)&&((4194048&au)===au?null!==al:(62914560&au)!==au&&!(536870912&au)||t!==al))throw Ji=Ki,Yi;e.flags|=8192}}function ts(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Ce():536870912,e.lanes|=t,vu|=t)}function ns(e,t){if(!ai)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function rs(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=65011712&i.subtreeFlags,r|=65011712&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)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 is(e,t,n){var r=t.pendingProps;switch(ri(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return rs(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),wi(Li),X(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(pi(t)?Jl(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,mi())),rs(t),null;case 26:return n=t.memoizedState,null===e?(Jl(t),null!==n?(rs(t),es(t,n)):(rs(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Jl(t),rs(t),es(t,n)):(rs(t),t.flags&=-16777217):(e.memoizedProps!==r&&Jl(t),rs(t),t.flags&=-16777217),null;case 27:Q(t),n=q.current;var o=t.type;if(null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(i(166));return rs(t),null}e=B.current,pi(t)?di(t):(e=wd(o,r,n),t.stateNode=e,Jl(t))}return rs(t),null;case 5:if(Q(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(i(166));return rs(t),null}if(e=B.current,pi(t))di(t);else{switch(o=id(q.current),e){case 1:e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(e=o.createElement("div")).innerHTML="<script><\\/script>",e=e.removeChild(e.firstChild);break;case"select":e="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?e.multiple=!0:r.size&&(e.size=r.size);break;default:e="string"==typeof r.is?o.createElement(n,{is:r.is}):o.createElement(n)}}e[Le]=t,e[Pe]=r;e:for(o=t.child;null!==o;){if(5===o.tag||6===o.tag)e.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;null===o.sibling;){if(null===o.return||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=e;e:switch(td(e,n,r),n){case"button":case"input":case"select":case"textarea":e=!!r.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Jl(t)}}return rs(t),t.flags&=-16777217,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=q.current,pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(o=ii))switch(o.tag){case 27:case 5:r=o.memoizedProps}e[Le]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||Zc(e.nodeValue,n)))||ci(t)}else(e=id(e).createTextNode(r))[Le]=t,t.stateNode=e}return rs(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(o=pi(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(i(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(i(317));o[Le]=t}else fi(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;rs(t),o=!1}else o=mi(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return 256&t.flags?(cl(t),t):(cl(t),null)}if(cl(t),128&t.flags)return t.lanes=n,t;if(n=null!==r,e=null!==e&&null!==e.memoizedState,n){o=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(o=r.alternate.memoizedState.cachePool.pool);var a=null;null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==o&&(r.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),ts(t,t.updateQueue),rs(t),null;case 4:return X(),null===e&&Hc(t.stateNode.containerInfo),rs(t),null;case 10:return wi(t.type),rs(t),null;case 19:if(H(dl),null===(o=t.memoizedState))return rs(t),null;if(r=!!(128&t.flags),null===(a=o.rendering))if(r)ns(o,!1);else{if(0!==pu||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(a=hl(e))){for(t.flags|=128,ns(o,!1),e=a.updateQueue,t.updateQueue=e,ts(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)$r(n,e),n=n.sibling;return W(dl,1&dl.current|2),t.child}e=e.sibling}null!==o.tail&&ne()>ku&&(t.flags|=128,r=!0,ns(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=hl(a))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,ts(t,e),ns(o,!0),null===o.tail&&"hidden"===o.tailMode&&!a.alternate&&!ai)return rs(t),null}else 2*ne()-o.renderingStartTime>ku&&536870912!==n&&(t.flags|=128,r=!0,ns(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=o.last)?e.sibling=a:t.child=a,o.last=a)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ne(),t.sibling=null,e=dl.current,W(dl,r?1&e|2:1&e),t):(rs(t),null);case 22:case 23:return cl(t),xo(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(rs(t),6&t.subtreeFlags&&(t.flags|=8192)):rs(t),null!==(n=t.updateQueue)&&ts(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&H(Wi),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),wi(Li),rs(t),null;case 25:case 30:return null}throw Error(i(156,t.tag))}function os(e,t){switch(ri(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return wi(Li),X(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Q(t),null;case 13:if(cl(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));fi()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return H(dl),null;case 4:return X(),null;case 10:return wi(t.type),null;case 22:case 23:return cl(t),xo(),null!==e&&H(Wi),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return wi(Li),null;default:return null}}function as(e,t){switch(ri(t),t.tag){case 3:wi(Li),X();break;case 26:case 27:case 5:Q(t);break;case 4:X();break;case 13:cl(t);break;case 19:H(dl);break;case 10:wi(t.type);break;case 22:case 23:cl(t),xo(),null!==e&&H(Wi);break;case 24:wi(Li)}}function ls(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var o=n.create,a=n.inst;r=o(),a.destroy=r}n=n.next}while(n!==i)}}catch(e){dc(t,t.return,e)}}function ss(e,t,n){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var o=i.next;r=o;do{if((r.tag&e)===e){var a=r.inst,l=a.destroy;if(void 0!==l){a.destroy=void 0,i=t;var s=n,u=l;try{u()}catch(e){dc(i,s,e)}}}r=r.next}while(r!==o)}}catch(e){dc(t,t.return,e)}}function us(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{fo(t,n)}catch(t){dc(e,e.return,t)}}}function cs(e,t,n){n.props=yl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){dc(e,t,n)}}function ds(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){dc(e,t,n)}}function hs(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){dc(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){dc(e,t,n)}else n.current=null}function ps(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){dc(e,e.return,t)}}function fs(e,t,n){try{var r=e.stateNode;(function(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 o=null,a=null,l=null,s=null,u=null,c=null,d=null;for(f in n){var h=n[f];if(n.hasOwnProperty(f)&&null!=h)switch(f){case"checked":case"value":break;case"defaultValue":u=h;default:r.hasOwnProperty(f)||Jc(e,t,f,null,r,h)}}for(var p in r){var f=r[p];if(h=n[p],r.hasOwnProperty(p)&&(null!=f||null!=h))switch(p){case"type":a=f;break;case"name":o=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":l=f;break;case"defaultValue":s=f;break;case"children":case"dangerouslySetInnerHTML":if(null!=f)throw Error(i(137,t));break;default:f!==h&&Jc(e,t,p,f,r,h)}}return void yt(e,l,s,u,c,d,a,o);case"select":for(a in f=l=s=p=null,n)if(u=n[a],n.hasOwnProperty(a)&&null!=u)switch(a){case"value":break;case"multiple":f=u;default:r.hasOwnProperty(a)||Jc(e,t,a,null,r,u)}for(o in r)if(a=r[o],u=n[o],r.hasOwnProperty(o)&&(null!=a||null!=u))switch(o){case"value":p=a;break;case"defaultValue":s=a;break;case"multiple":l=a;default:a!==u&&Jc(e,t,o,a,r,u)}return t=s,n=l,r=f,void(null!=p?bt(e,!!n,p,!1):!!r!=!!n&&(null!=t?bt(e,!!n,t,!0):bt(e,!!n,n?[]:"",!1)));case"textarea":for(s in f=p=null,n)if(o=n[s],n.hasOwnProperty(s)&&null!=o&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:Jc(e,t,s,null,r,o)}for(l in r)if(o=r[l],a=n[l],r.hasOwnProperty(l)&&(null!=o||null!=a))switch(l){case"value":p=o;break;case"defaultValue":f=o;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=o)throw Error(i(91));break;default:o!==a&&Jc(e,t,l,o,r,a)}return void wt(e,p,f);case"option":for(var m in n)p=n[m],n.hasOwnProperty(m)&&null!=p&&!r.hasOwnProperty(m)&&("selected"===m?e.selected=!1:Jc(e,t,m,null,r,p));for(u in r)p=r[u],f=n[u],r.hasOwnProperty(u)&&p!==f&&(null!=p||null!=f)&&("selected"===u?e.selected=p&&"function"!=typeof p&&"symbol"!=typeof p:Jc(e,t,u,p,r,f));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)&&null!=p&&!r.hasOwnProperty(g)&&Jc(e,t,g,null,r,p);for(c in r)if(p=r[c],f=n[c],r.hasOwnProperty(c)&&p!==f&&(null!=p||null!=f))switch(c){case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(i(137,t));break;default:Jc(e,t,c,p,r,f)}return;default:if(Tt(t)){for(var y in n)p=n[y],n.hasOwnProperty(y)&&void 0!==p&&!r.hasOwnProperty(y)&&ed(e,t,y,void 0,r,p);for(d in r)p=r[d],f=n[d],!r.hasOwnProperty(d)||p===f||void 0===p&&void 0===f||ed(e,t,d,p,r,f);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&null!=p&&!r.hasOwnProperty(v)&&Jc(e,t,v,null,r,p);for(h in r)p=r[h],f=n[h],!r.hasOwnProperty(h)||p===f||null==p&&null==f||Jc(e,t,h,p,r,f)})(r,e.type,n,t),r[Pe]=t}catch(t){dc(e,e.return,t)}}function ms(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&fd(e.type)||4===e.tag}function gs(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ms(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&fd(e.type)||2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ys(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Gc));else if(4!==r&&(27===r&&fd(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(ys(e,t,n),e=e.sibling;null!==e;)ys(e,t,n),e=e.sibling}function vs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&fd(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(vs(e,t,n),e=e.sibling;null!==e;)vs(e,t,n),e=e.sibling}function xs(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);td(t,r,n),t[Le]=e,t[Pe]=n}catch(t){dc(e,e.return,t)}}var bs=!1,ws=!1,Ss=!1,ks="function"==typeof WeakSet?WeakSet:Set,Cs=null;function Ms(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Fs(e,n),4&r&&ls(5,n);break;case 1:if(Fs(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){dc(n,n.return,e)}else{var i=yl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){dc(n,n.return,e)}}64&r&&us(n),512&r&&ds(n,n.return);break;case 3:if(Fs(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{fo(e,t)}catch(e){dc(n,n.return,e)}}break;case 27:null===t&&4&r&&xs(n);case 26:case 5:Fs(e,n),null===t&&4&r&&ps(n),512&r&&ds(n,n.return);break;case 12:Fs(e,n);break;case 13:Fs(e,n),4&r&&Is(e,n),64&r&&null!==(e=n.memoizedState)&&null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$?"!==e.data||"complete"===n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=mc.bind(null,n));break;case 22:if(!(r=null!==n.memoizedState||bs)){t=null!==t&&null!==t.memoizedState||ws,i=bs;var o=ws;bs=r,(ws=t)&&!o?$s(e,n,!!(8772&n.subtreeFlags)):Fs(e,n),bs=i,ws=o}break;case 30:break;default:Fs(e,n)}}function Es(e){var t=e.alternate;null!==t&&(e.alternate=null,Es(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&He(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 Ts=null,As=!1;function Rs(e,t,n){for(n=n.child;null!==n;)js(e,t,n),n=n.sibling}function js(e,t,n){if(he&&"function"==typeof he.onCommitFiberUnmount)try{he.onCommitFiberUnmount(de,n)}catch{}switch(n.tag){case 26:ws||hs(n,t),Rs(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:ws||hs(n,t);var r=Ts,i=As;fd(n.type)&&(Ts=n.stateNode,As=!1),Rs(e,t,n),Sd(n.stateNode),Ts=r,As=i;break;case 5:ws||hs(n,t);case 6:if(r=Ts,i=As,Ts=null,Rs(e,t,n),As=i,null!==(Ts=r))if(As)try{(9===Ts.nodeType?Ts.body:"HTML"===Ts.nodeName?Ts.ownerDocument.body:Ts).removeChild(n.stateNode)}catch(e){dc(n,t,e)}else try{Ts.removeChild(n.stateNode)}catch(e){dc(n,t,e)}break;case 18:null!==Ts&&(As?(md(9===(e=Ts).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Ah(e)):md(Ts,n.stateNode));break;case 4:r=Ts,i=As,Ts=n.stateNode.containerInfo,As=!0,Rs(e,t,n),Ts=r,As=i;break;case 0:case 11:case 14:case 15:ws||ss(2,n,t),ws||ss(4,n,t),Rs(e,t,n);break;case 1:ws||(hs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&cs(n,t,r)),Rs(e,t,n);break;case 21:Rs(e,t,n);break;case 22:ws=(r=ws)||null!==n.memoizedState,Rs(e,t,n),ws=r;break;default:Rs(e,t,n)}}function Is(e,t){if(null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{Ah(e)}catch(e){dc(t,t.return,e)}}function zs(e,t){var n=function(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new ks),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new ks),t;default:throw Error(i(435,e.tag))}}(e);t.forEach(function(t){var r=gc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}function Ls(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r],a=e,l=t,s=l;e:for(;null!==s;){switch(s.tag){case 27:if(fd(s.type)){Ts=s.stateNode,As=!1;break e}break;case 5:Ts=s.stateNode,As=!1;break e;case 3:case 4:Ts=s.stateNode.containerInfo,As=!0;break e}s=s.return}if(null===Ts)throw Error(i(160));js(a,l,o),Ts=null,As=!1,null!==(a=o.alternate)&&(a.return=null),o.return=null}if(13878&t.subtreeFlags)for(t=t.child;null!==t;)Ns(t,e),t=t.sibling}var Ps=null;function Ns(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ls(t,e),_s(e),4&r&&(ss(3,e,e.return),ls(3,e),ss(5,e,e.return));break;case 1:Ls(t,e),_s(e),512&r&&(ws||null===n||hs(n,n.return)),64&r&&bs&&null!==(e=e.updateQueue)&&null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r));break;case 26:var o=Ps;if(Ls(t,e),_s(e),512&r&&(ws||null===n||hs(n,n.return)),4&r){var a=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":(!(a=o.getElementsByTagName("title")[0])||a[$e]||a[Le]||"http://www.w3.org/2000/svg"===a.namespaceURI||a.hasAttribute("itemprop"))&&(a=o.createElement(r),o.head.insertBefore(a,o.querySelector("head > title"))),td(a,r,n),a[Le]=e,Ue(a),r=a;break e;case"link":var l=$d("link","href",o).get(r+(n.href||""));if(l)for(var s=0;s<l.length;s++)if((a=l[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&a.getAttribute("rel")===(null==n.rel?null:n.rel)&&a.getAttribute("title")===(null==n.title?null:n.title)&&a.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){l.splice(s,1);break t}td(a=o.createElement(r),r,n),o.head.appendChild(a);break;case"meta":if(l=$d("meta","content",o).get(r+(n.content||"")))for(s=0;s<l.length;s++)if((a=l[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&a.getAttribute("name")===(null==n.name?null:n.name)&&a.getAttribute("property")===(null==n.property?null:n.property)&&a.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&a.getAttribute("charset")===(null==n.charSet?null:n.charSet)){l.splice(s,1);break t}td(a=o.createElement(r),r,n),o.head.appendChild(a);break;default:throw Error(i(468,r))}a[Le]=e,Ue(a),r=a}e.stateNode=r}else Hd(o,e.type,e.stateNode);else e.stateNode=Nd(o,r,e.memoizedProps);else a!==r?(null===a?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):a.count--,null===r?Hd(o,e.type,e.stateNode):Nd(o,r,e.memoizedProps)):null===r&&null!==e.stateNode&&fs(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ls(t,e),_s(e),512&r&&(ws||null===n||hs(n,n.return)),null!==n&&4&r&&fs(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ls(t,e),_s(e),512&r&&(ws||null===n||hs(n,n.return)),32&e.flags){o=e.stateNode;try{kt(o,"")}catch(t){dc(e,e.return,t)}}4&r&&null!=e.stateNode&&fs(e,o=e.memoizedProps,null!==n?n.memoizedProps:o),1024&r&&(Ss=!0);break;case 6:if(Ls(t,e),_s(e),4&r){if(null===e.stateNode)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){dc(e,e.return,t)}}break;case 3:if(Od=null,o=Ps,Ps=Md(t.containerInfo),Ls(t,e),Ps=o,_s(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Ah(t.containerInfo)}catch(t){dc(e,e.return,t)}Ss&&(Ss=!1,Ds(e));break;case 4:r=Ps,Ps=Md(e.stateNode.containerInfo),Ls(t,e),_s(e),Ps=r;break;case 12:default:Ls(t,e),_s(e);break;case 13:Ls(t,e),_s(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Su=ne()),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,zs(e,r));break;case 22:o=null!==e.memoizedState;var u=null!==n&&null!==n.memoizedState,c=bs,d=ws;if(bs=c||o,ws=d||u,Ls(t,e),ws=d,bs=c,_s(e),8192&r)e:for(t=e.stateNode,t._visibility=o?-2&t._visibility:1|t._visibility,o&&(null===n||u||bs||ws||Os(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){u=n=t;try{if(a=u.stateNode,o)"function"==typeof(l=a.style).setProperty?l.setProperty("display","none","important"):l.display="none";else{s=u.stateNode;var h=u.memoizedProps.style,p=null!=h&&h.hasOwnProperty("display")?h.display:null;s.style.display=null==p||"boolean"==typeof p?"":(""+p).trim()}}catch(e){dc(u,u.return,e)}}}else if(6===t.tag){if(null===n){u=t;try{u.stateNode.nodeValue=o?"":u.memoizedProps}catch(e){dc(u,u.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&null!==(r=e.updateQueue)&&null!==(n=r.retryQueue)&&(r.retryQueue=null,zs(e,n));break;case 19:Ls(t,e),_s(e),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,zs(e,r));case 30:case 21:}}function _s(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(ms(r)){n=r;break}r=r.return}if(null==n)throw Error(i(160));switch(n.tag){case 27:var o=n.stateNode;vs(e,gs(e),o);break;case 5:var a=n.stateNode;32&n.flags&&(kt(a,""),n.flags&=-33),vs(e,gs(e),a);break;case 3:case 4:var l=n.stateNode.containerInfo;ys(e,gs(e),l);break;default:throw Error(i(161))}}catch(t){dc(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Ds(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Ds(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Fs(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ms(e,t.alternate,t),t=t.sibling}function Os(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ss(4,t,t.return),Os(t);break;case 1:hs(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&cs(t,t.return,n),Os(t);break;case 27:Sd(t.stateNode);case 26:case 5:hs(t,t.return),Os(t);break;case 22:null===t.memoizedState&&Os(t);break;default:Os(t)}e=e.sibling}}function $s(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,i=e,o=t,a=o.flags;switch(o.tag){case 0:case 11:case 15:$s(i,o,n),ls(4,o);break;case 1:if($s(i,o,n),"function"==typeof(i=(r=o).stateNode).componentDidMount)try{i.componentDidMount()}catch(e){dc(r,r.return,e)}if(null!==(i=(r=o).updateQueue)){var l=r.stateNode;try{var s=i.shared.hiddenCallbacks;if(null!==s)for(i.shared.hiddenCallbacks=null,i=0;i<s.length;i++)po(s[i],l)}catch(e){dc(r,r.return,e)}}n&&64&a&&us(o),ds(o,o.return);break;case 27:xs(o);case 26:case 5:$s(i,o,n),n&&null===r&&4&a&&ps(o),ds(o,o.return);break;case 12:$s(i,o,n);break;case 13:$s(i,o,n),n&&4&a&&Is(i,o);break;case 22:null===o.memoizedState&&$s(i,o,n),ds(o,o.return);break;case 30:break;default:$s(i,o,n)}t=t.sibling}}function Hs(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&Ni(n))}function Ws(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ni(e))}function Bs(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)Vs(e,t,n,r),t=t.sibling}function Vs(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Bs(e,t,n,r),2048&i&&ls(9,t);break;case 1:case 13:default:Bs(e,t,n,r);break;case 3:Bs(e,t,n,r),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ni(e)));break;case 12:if(2048&i){Bs(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,a=o.id,l=o.onPostCommit;"function"==typeof l&&l(a,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){dc(t,t.return,e)}}else Bs(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,a=t.alternate,null!==t.memoizedState?2&o._visibility?Bs(e,t,n,r):Us(e,t):2&o._visibility?Bs(e,t,n,r):(o._visibility|=2,qs(e,t,n,r,!!(10256&t.subtreeFlags))),2048&i&&Hs(a,t);break;case 24:Bs(e,t,n,r),2048&i&&Ws(t.alternate,t)}}function qs(e,t,n,r,i){for(i=i&&!!(10256&t.subtreeFlags),t=t.child;null!==t;){var o=e,a=t,l=n,s=r,u=a.flags;switch(a.tag){case 0:case 11:case 15:qs(o,a,l,s,i),ls(8,a);break;case 23:break;case 22:var c=a.stateNode;null!==a.memoizedState?2&c._visibility?qs(o,a,l,s,i):Us(o,a):(c._visibility|=2,qs(o,a,l,s,i)),i&&2048&u&&Hs(a.alternate,a);break;case 24:qs(o,a,l,s,i),i&&2048&u&&Ws(a.alternate,a);break;default:qs(o,a,l,s,i)}t=t.sibling}}function Us(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Us(n,r),2048&i&&Hs(r.alternate,r);break;case 24:Us(n,r),2048&i&&Ws(r.alternate,r);break;default:Us(n,r)}t=t.sibling}}var Ys=8192;function Xs(e){if(e.subtreeFlags&Ys)for(e=e.child;null!==e;)Ks(e),e=e.sibling}function Ks(e){switch(e.tag){case 26:Xs(e),e.flags&Ys&&null!==e.memoizedState&&function(e,t,n){if(null===Bd)throw Error(i(475));var r=Bd;if(!("stylesheet"!==t.type||"string"==typeof n.media&&!1===matchMedia(n.media).matches||4&t.state.loading)){if(null===t.instance){var o=jd(n.href),a=e.querySelector(Id(o));if(a)return null!==(e=a._p)&&"object"==typeof e&&"function"==typeof e.then&&(r.count++,r=qd.bind(r),e.then(r,r)),t.state.loading|=4,t.instance=a,void Ue(a);a=e.ownerDocument||e,n=zd(n),(o=kd.get(o))&&Dd(n,o),Ue(a=a.createElement("link"));var l=a;l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),td(a,"link",n),t.instance=a}null===r.stylesheets&&(r.stylesheets=new Map),r.stylesheets.set(t,e),(e=t.state.preload)&&!(3&t.state.loading)&&(r.count++,t=qd.bind(r),e.addEventListener("load",t),e.addEventListener("error",t))}}(Ps,e.memoizedState,e.memoizedProps);break;case 5:default:Xs(e);break;case 3:case 4:var t=Ps;Ps=Md(e.stateNode.containerInfo),Xs(e),Ps=t;break;case 22:null===e.memoizedState&&(null!==(t=e.alternate)&&null!==t.memoizedState?(t=Ys,Ys=16777216,Xs(e),Ys=t):Xs(e))}}function Qs(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function Zs(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Cs=r,eu(r,e)}Qs(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)Gs(e),e=e.sibling}function Gs(e){switch(e.tag){case 0:case 11:case 15:Zs(e),2048&e.flags&&ss(9,e,e.return);break;case 3:case 12:default:Zs(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,Js(e)):Zs(e)}}function Js(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Cs=r,eu(r,e)}Qs(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:ss(8,t,t.return),Js(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,Js(t));break;default:Js(t)}e=e.sibling}}function eu(e,t){for(;null!==Cs;){var n=Cs;switch(n.tag){case 0:case 11:case 15:ss(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:Ni(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Cs=r;else e:for(n=e;null!==Cs;){var i=(r=Cs).sibling,o=r.return;if(Es(r),r===n){Cs=null;break e}if(null!==i){i.return=o,Cs=i;break e}Cs=o}}}var tu={getCacheForType:function(e){var t=Ti(Li),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},nu="function"==typeof WeakMap?WeakMap:Map,ru=0,iu=null,ou=null,au=0,lu=0,su=null,uu=!1,cu=!1,du=!1,hu=0,pu=0,fu=0,mu=0,gu=0,yu=0,vu=0,xu=null,bu=null,wu=!1,Su=0,ku=1/0,Cu=null,Mu=null,Eu=0,Tu=null,Au=null,Ru=0,ju=0,Iu=null,zu=null,Lu=0,Pu=null;function Nu(){return 2&ru&&0!==au?au&-au:null!==N.T?0!==Fi?Fi:zc():Ie()}function _u(){0===yu&&(yu=536870912&au&&!ai?536870912:ke());var e=ol.current;return null!==e&&(e.flags|=32),yu}function Du(e,t,n){(e===iu&&(2===lu||9===lu)||null!==e.cancelPendingCommit)&&(Vu(e,0),Hu(e,au,yu,!1)),Ee(e,n),(!(2&ru)||e!==iu)&&(e===iu&&(!(2&ru)&&(mu|=n),4===pu&&Hu(e,au,yu,!1)),Mc(e))}function Fu(e,t,n){if(6&ru)throw Error(i(327));for(var r=!n&&!(124&t)&&0===(t&e.expiredLanes)||we(e,t),o=r?function(e,t){var n=ru;ru|=2;var r=Uu(),o=Yu();iu!==e||au!==t?(Cu=null,ku=ne()+500,Vu(e,t)):cu=we(e,t);e:for(;;)try{if(0!==lu&&null!==ou){t=ou;var a=su;t:switch(lu){case 1:lu=0,su=null,ec(e,t,a,1);break;case 2:case 9:if(Qi(a)){lu=0,su=null,Ju(t);break}t=function(){2!==lu&&9!==lu||iu!==e||(lu=7),Mc(e)},a.then(t,t);break e;case 3:lu=7;break e;case 4:lu=5;break e;case 7:Qi(a)?(lu=0,su=null,Ju(t)):(lu=0,su=null,ec(e,t,a,7));break;case 5:var l=null;switch(ou.tag){case 26:l=ou.memoizedState;case 5:case 27:var s=ou;if(!l||Wd(l)){lu=0,su=null;var u=s.sibling;if(null!==u)ou=u;else{var c=s.return;null!==c?(ou=c,tc(c)):ou=null}break t}}lu=0,su=null,ec(e,t,a,5);break;case 6:lu=0,su=null,ec(e,t,a,6);break;case 8:Bu(),pu=6;break e;default:throw Error(i(462))}}Zu();break}catch(t){qu(e,t)}return xi=vi=null,N.H=r,N.A=o,ru=n,null!==ou?0:(iu=null,au=0,Rr(),pu)}(e,t):Ku(e,t,!0),a=r;;){if(0===o){cu&&!r&&Hu(e,t,0,!1);break}if(n=e.current.alternate,!a||$u(n)){if(2===o){if(a=t,e.errorRecoveryDisabledLanes&a)var l=0;else l=0!=(l=-536870913&e.pendingLanes)?l:536870912&l?536870912:0;if(0!==l){t=l;e:{var s=e;o=xu;var u=s.current.memoizedState.isDehydrated;if(u&&(Vu(s,l).flags|=256),2!==(l=Ku(s,l,!1))){if(du&&!u){s.errorRecoveryDisabledLanes|=a,mu|=a,o=4;break e}a=bu,bu=o,null!==a&&(null===bu?bu=a:bu.push.apply(bu,a))}o=l}if(a=!1,2!==o)continue}}if(1===o){Vu(e,0),Hu(e,t,0,!0);break}e:{switch(r=e,a=o){case 0:case 1:throw Error(i(345));case 4:if((4194048&t)!==t)break;case 6:Hu(r,t,yu,!uu);break e;case 2:bu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((62914560&t)===t&&10<(o=Su+300-ne())){if(Hu(r,t,yu,!uu),0!==be(r,0,!0))break e;r.timeoutHandle=ud(Ou.bind(null,r,n,bu,Cu,wu,t,yu,mu,vu,uu,a,2,-0,0),o)}else Ou(r,n,bu,Cu,wu,t,yu,mu,vu,uu,a,0,-0,0)}break}o=Ku(e,t,!1),a=!1}Mc(e)}function Ou(e,t,n,r,o,a,l,s,u,c,d,h,p,f){if(e.timeoutHandle=-1,(8192&(h=t.subtreeFlags)||!(16785408&~h))&&(Bd={stylesheets:null,count:0,unsuspend:Vd},Ks(t),h=function(){if(null===Bd)throw Error(i(475));var e=Bd;return e.stylesheets&&0===e.count&&Yd(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Yd(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}(),null!==h))return e.cancelPendingCommit=h(rc.bind(null,e,t,a,n,r,o,l,s,u,d,1,p,f)),void Hu(e,a,l,!c);rc(e,t,a,n,r,o,l,s,u)}function $u(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&null!==(n=t.updateQueue)&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Qn(o(),i))return!1}catch{return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Hu(e,t,n,r){t&=~gu,t&=~mu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var o=31-fe(i),a=1<<o;r[o]=-1,i&=~a}0!==n&&Te(e,n,t)}function Wu(){return!!(6&ru)||(Ec(0,!1),!1)}function Bu(){if(null!==ou){if(0===lu)var e=ou.return;else xi=vi=null,Oo(e=ou),Qa=null,Za=0,e=ou;for(;null!==e;)as(e.alternate,e),e=e.return;ou=null}}function Vu(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,cd(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),Bu(),iu=e,ou=n=Or(e.current,null),au=t,lu=0,su=null,uu=!1,cu=we(e,t),du=!1,vu=yu=gu=mu=fu=pu=0,bu=xu=null,wu=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var i=31-fe(r),o=1<<i;t|=e[i],r&=~o}return hu=t,Rr(),n}function qu(e,t){wo=null,N.H=Ua,t===Ui||t===Xi?(t=eo(),lu=3):t===Yi?(t=eo(),lu=4):lu=t===Tl?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,su=t,null===ou&&(pu=1,Sl(e,Mr(t,e.current)))}function Uu(){var e=N.H;return N.H=Ua,null===e?Ua:e}function Yu(){var e=N.A;return N.A=tu,e}function Xu(){pu=4,uu||(4194048&au)!==au&&null!==ol.current||(cu=!0),!(134217727&fu)&&!(134217727&mu)||null===iu||Hu(iu,au,yu,!1)}function Ku(e,t,n){var r=ru;ru|=2;var i=Uu(),o=Yu();(iu!==e||au!==t)&&(Cu=null,Vu(e,t)),t=!1;var a=pu;e:for(;;)try{if(0!==lu&&null!==ou){var l=ou,s=su;switch(lu){case 8:Bu(),a=6;break e;case 3:case 2:case 9:case 6:null===ol.current&&(t=!0);var u=lu;if(lu=0,su=null,ec(e,l,s,u),n&&cu){a=0;break e}break;default:u=lu,lu=0,su=null,ec(e,l,s,u)}}Qu(),a=pu;break}catch(t){qu(e,t)}return t&&e.shellSuspendCounter++,xi=vi=null,ru=r,N.H=i,N.A=o,null===ou&&(iu=null,au=0,Rr()),a}function Qu(){for(;null!==ou;)Gu(ou)}function Zu(){for(;null!==ou&&!ee();)Gu(ou)}function Gu(e){var t=Gl(e.alternate,e,hu);e.memoizedProps=e.pendingProps,null===t?tc(e):ou=t}function Ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Dl(n,t,t.pendingProps,t.type,void 0,au);break;case 11:t=Dl(n,t,t.pendingProps,t.type.render,t.ref,au);break;case 5:Oo(t);default:as(n,t),t=Gl(n,t=ou=$r(t,hu),hu)}e.memoizedProps=e.pendingProps,null===t?tc(e):ou=t}function ec(e,t,n,r){xi=vi=null,Oo(t),Qa=null,Za=0;var o=t.return;try{if(function(e,t,n,r,o){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Ci(t,n,o,!0),null!==(n=ol.current)){switch(n.tag){case 13:return null===al?Xu():null===n.alternate&&0===pu&&(pu=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===Ki?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),hc(e,r,o)),!1;case 22:return n.flags|=65536,r===Ki?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),hc(e,r,o)),!1}throw Error(i(435,n.tag))}return hc(e,r,o),Xu(),!1}if(ai)return null!==(t=ol.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==ui&&gi(Mr(e=Error(i(422),{cause:r}),n))):(r!==ui&&gi(Mr(t=Error(i(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,o&=-o,e.lanes|=o,r=Mr(r,n),so(e,o=Cl(e.stateNode,r,o)),4!==pu&&(pu=2)),!1;var a=Error(i(520),{cause:r});if(a=Mr(a,n),null===xu?xu=[a]:xu.push(a),4!==pu&&(pu=2),null===t)return!0;r=Mr(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,so(n,e=Cl(n.stateNode,r,e)),!1;case 1:if(t=n.type,a=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===a||"function"!=typeof a.componentDidCatch||null!==Mu&&Mu.has(a))))return n.flags|=65536,o&=-o,n.lanes|=o,El(o=Ml(o),e,n,r),so(n,o),!1}n=n.return}while(null!==n);return!1}(e,o,t,n,au))return pu=1,Sl(e,Mr(n,e.current)),void(ou=null)}catch(t){if(null!==o)throw ou=o,t;return pu=1,Sl(e,Mr(n,e.current)),void(ou=null)}32768&t.flags?(ai||1===r?e=!0:cu||536870912&au?e=!1:(uu=e=!0,(2===r||9===r||3===r||6===r)&&null!==(r=ol.current)&&13===r.tag&&(r.flags|=16384)),nc(t,e)):tc(t)}function tc(e){var t=e;do{if(32768&t.flags)return void nc(t,uu);e=t.return;var n=is(t.alternate,t,hu);if(null!==n)return void(ou=n);if(null!==(t=t.sibling))return void(ou=t);ou=t=e}while(null!==t);0===pu&&(pu=5)}function nc(e,t){do{var n=os(e.alternate,e);if(null!==n)return n.flags&=32767,void(ou=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(ou=e);ou=e=n}while(null!==e);pu=6,ou=null}function rc(e,t,n,r,o,a,l,s,u){e.cancelPendingCommit=null;do{sc()}while(0!==Eu);if(6&ru)throw Error(i(327));if(null!==t){if(t===e.current)throw Error(i(177));if(a=t.lanes|t.childLanes,function(e,t,n,r,i,o){var a=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 l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0<n;){var c=31-fe(n),d=1<<c;l[c]=0,s[c]=-1;var h=u[c];if(null!==h)for(u[c]=null,c=0;c<h.length;c++){var p=h[c];null!==p&&(p.lane&=-536870913)}n&=~d}0!==r&&Te(e,r,0),0!==o&&0===i&&0!==e.tag&&(e.suspendedLanes|=o&~(a&~t))}(e,n,a|=Ar,l,s,u),e===iu&&(ou=iu=null,au=0),Au=t,Tu=e,Ru=n,ju=a,Iu=o,zu=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,function(e){G(e,function(){return uc(),null})}(ae)):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=N.T,N.T=null,o=_.p,_.p=2,l=ru,ru|=4;try{!function(e,t){if(e=e.containerInfo,nd=rh,nr(e=tr(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var l=0,s=-1,u=-1,c=0,d=0,h=e,p=null;t:for(;;){for(var f;h!==n||0!==o&&3!==h.nodeType||(s=l+o),h!==a||0!==r&&3!==h.nodeType||(u=l+r),3===h.nodeType&&(l+=h.nodeValue.length),null!==(f=h.firstChild);)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++c===o&&(s=l),p===a&&++d===r&&(u=l),null!==(f=h.nextSibling))break;p=(h=p).parentNode}h=f}n=-1===s||-1===u?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(rd={focusedElem:e,selectionRange:n},rh=!1,Cs=t;null!==Cs;)if(e=(t=Cs).child,1024&t.subtreeFlags&&null!==e)e.return=t,Cs=e;else for(;null!==Cs;){switch(a=(t=Cs).alternate,e=t.flags,t.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==a){e=void 0,n=t,o=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var m=yl(n.type,o,(n.elementType,n.type));e=r.getSnapshotBeforeUpdate(m,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){dc(n,n.return,e)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))gd(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gd(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(i(163))}if(null!==(e=t.sibling)){e.return=t.return,Cs=e;break}Cs=t.return}}(e,t)}finally{ru=l,_.p=o,N.T=r}}Eu=1,ic(),oc(),ac()}}function ic(){if(1===Eu){Eu=0;var e=Tu,t=Au,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=N.T,N.T=null;var r=_.p;_.p=2;var i=ru;ru|=4;try{Ns(t,e);var o=rd,a=tr(e.containerInfo),l=o.focusedElem,s=o.selectionRange;if(a!==l&&l&&l.ownerDocument&&er(l.ownerDocument.documentElement,l)){if(null!==s&&nr(l)){var u=s.start,c=s.end;if(void 0===c&&(c=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(c,l.value.length);else{var d=l.ownerDocument||document,h=d&&d.defaultView||window;if(h.getSelection){var p=h.getSelection(),f=l.textContent.length,m=Math.min(s.start,f),g=void 0===s.end?m:Math.min(s.end,f);!p.extend&&m>g&&(a=g,g=m,m=a);var y=Jn(l,m),v=Jn(l,g);if(y&&v&&(1!==p.rangeCount||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=d.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),m>g?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(d=[],p=l;p=p.parentNode;)1===p.nodeType&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof l.focus&&l.focus(),l=0;l<d.length;l++){var b=d[l];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}rh=!!nd,rd=nd=null}finally{ru=i,_.p=r,N.T=n}}e.current=t,Eu=2}}function oc(){if(2===Eu){Eu=0;var e=Tu,t=Au,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=N.T,N.T=null;var r=_.p;_.p=2;var i=ru;ru|=4;try{Ms(e,t.alternate,t)}finally{ru=i,_.p=r,N.T=n}}Eu=3}}function ac(){if(4===Eu||3===Eu){Eu=0,te();var e=Tu,t=Au,n=Ru,r=zu;10256&t.subtreeFlags||10256&t.flags?Eu=5:(Eu=0,Au=Tu=null,lc(e,e.pendingLanes));var i=e.pendingLanes;if(0===i&&(Mu=null),je(n),t=t.stateNode,he&&"function"==typeof he.onCommitFiberRoot)try{he.onCommitFiberRoot(de,t,void 0,!(128&~t.current.flags))}catch{}if(null!==r){t=N.T,i=_.p,_.p=2,N.T=null;try{for(var o=e.onRecoverableError,a=0;a<r.length;a++){var l=r[a];o(l.value,{componentStack:l.stack})}}finally{N.T=t,_.p=i}}!!(3&Ru)&&sc(),Mc(e),i=e.pendingLanes,4194090&n&&42&i?e===Pu?Lu++:(Lu=0,Pu=e):Lu=0,Ec(0,!1)}}function lc(e,t){0===(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,Ni(t))}function sc(e){return ic(),oc(),ac(),uc()}function uc(){if(5!==Eu)return!1;var e=Tu,t=ju;ju=0;var n=je(Ru),r=N.T,o=_.p;try{_.p=32>n?32:n,N.T=null,n=Iu,Iu=null;var a=Tu,l=Ru;if(Eu=0,Au=Tu=null,Ru=0,6&ru)throw Error(i(331));var s=ru;if(ru|=4,Gs(a.current),Vs(a,a.current,l,n),ru=s,Ec(0,!1),he&&"function"==typeof he.onPostCommitFiberRoot)try{he.onPostCommitFiberRoot(de,a)}catch{}return!0}finally{_.p=o,N.T=r,lc(e,t)}}function cc(e,t,n){t=Mr(n,t),null!==(e=ao(e,t=Cl(e.stateNode,t,2),2))&&(Ee(e,2),Mc(e))}function dc(e,t,n){if(3===e.tag)cc(e,e,n);else for(;null!==t;){if(3===t.tag){cc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Mu||!Mu.has(r))){e=Mr(n,e),null!==(r=ao(t,n=Ml(2),2))&&(El(n,r,t,e),Ee(r,2),Mc(r));break}}t=t.return}}function hc(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new nu;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(du=!0,i.add(n),e=pc.bind(null,e,t,n),t.then(e,e))}function pc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,iu===e&&(au&n)===n&&(4===pu||3===pu&&(62914560&au)===au&&300>ne()-Su?!(2&ru)&&Vu(e,0):gu|=n,vu===au&&(vu=0)),Mc(e)}function fc(e,t){0===t&&(t=Ce()),null!==(e=zr(e,t))&&(Ee(e,t),Mc(e))}function mc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),fc(e,n)}function gc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),fc(e,n)}var yc,vc,xc=null,bc=null,wc=!1,Sc=!1,kc=!1,Cc=0;function Mc(e){e!==bc&&null===e.next&&(null===bc?xc=bc=e:bc=bc.next=e),Sc=!0,wc||(wc=!0,hd(function(){6&ru?G(ie,Tc):Ac()}))}function Ec(e,t){if(!kc&&Sc){kc=!0;do{for(var n=!1,r=xc;null!==r;){if(!t)if(0!==e){var i=r.pendingLanes;if(0===i)var o=0;else{var a=r.suspendedLanes,l=r.pingedLanes;o=(1<<31-fe(42|e)+1)-1,o=201326741&(o&=i&~(a&~l))?201326741&o|1:o?2|o:0}0!==o&&(n=!0,Ic(r,o))}else o=au,!(3&(o=be(r,r===iu?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||we(r,o)||(n=!0,Ic(r,o));r=r.next}}while(n);kc=!1}}function Tc(){Ac()}function Ac(){Sc=wc=!1;var e=0;0!==Cc&&(function(){var e=window.event;return e&&"popstate"===e.type?e!==sd&&(sd=e,!0):(sd=null,!1)}()&&(e=Cc),Cc=0);for(var t=ne(),n=null,r=xc;null!==r;){var i=r.next,o=Rc(r,t);0===o?(r.next=null,null===n?xc=i:n.next=i,null===i&&(bc=n)):(n=r,(0!==e||!!(3&o))&&(Sc=!0)),r=i}Ec(e,!1)}function Rc(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var a=31-fe(o),l=1<<a,s=i[a];-1===s?(0===(l&n)||0!==(l&r))&&(i[a]=Se(l,t)):s<=t&&(e.expiredLanes|=l),o&=~l}if(n=au,n=be(e,e===(t=iu)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===lu||9===lu)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&J(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||we(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&J(r),je(n)){case 2:case 8:n=oe;break;case 32:default:n=ae;break;case 268435456:n=se}return r=jc.bind(null,e),n=G(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&J(r),e.callbackPriority=2,e.callbackNode=null,2}function jc(e,t){if(0!==Eu&&5!==Eu)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(sc()&&e.callbackNode!==n)return null;var r=au;return 0===(r=be(e,e===iu?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Fu(e,r,t),Rc(e,ne()),null!=e.callbackNode&&e.callbackNode===n?jc.bind(null,e):null)}function Ic(e,t){if(sc())return null;Fu(e,t,!0)}function zc(){return 0===Cc&&(Cc=ke()),Cc}function Lc(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:jt(""+e)}function Pc(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}for(vc=0;vc<Sr.length;vc++)kr((yc=Sr[vc]).toLowerCase(),"on"+(yc[0].toUpperCase()+yc.slice(1)));kr(fr,"onAnimationEnd"),kr(mr,"onAnimationIteration"),kr(gr,"onAnimationStart"),kr("dblclick","onDoubleClick"),kr("focusin","onFocus"),kr("focusout","onBlur"),kr(yr,"onTransitionRun"),kr(vr,"onTransitionStart"),kr(xr,"onTransitionCancel"),kr(br,"onTransitionEnd"),Qe("onMouseEnter",["mouseout","mouseover"]),Qe("onMouseLeave",["mouseout","mouseover"]),Qe("onPointerEnter",["pointerout","pointerover"]),Qe("onPointerLeave",["pointerout","pointerover"]),Ke("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ke("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ke("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ke("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ke("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ke("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nc="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(" "),_c=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nc));function Dc(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],s=l.instance,u=l.currentTarget;if(l=l.listener,s!==o&&i.isPropagationStopped())break e;o=l,i.currentTarget=u;try{o(i)}catch(e){vl(e)}i.currentTarget=null,o=s}else for(a=0;a<r.length;a++){if(s=(l=r[a]).instance,u=l.currentTarget,l=l.listener,s!==o&&i.isPropagationStopped())break e;o=l,i.currentTarget=u;try{o(i)}catch(e){vl(e)}i.currentTarget=null,o=s}}}}function Fc(e,t){var n=t[_e];void 0===n&&(n=t[_e]=new Set);var r=e+"__bubble";n.has(r)||(Wc(t,e,2,!1),n.add(r))}function Oc(e,t,n){var r=0;t&&(r|=4),Wc(n,e,r,t)}var $c="_reactListening"+Math.random().toString(36).slice(2);function Hc(e){if(!e[$c]){e[$c]=!0,Ye.forEach(function(t){"selectionchange"!==t&&(_c.has(t)||Oc(t,!1,e),Oc(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[$c]||(t[$c]=!0,Oc("selectionchange",!1,t))}}function Wc(e,t,n,r){switch(ch(t)){case 2:var i=ih;break;case 8:i=oh;break;default:i=ah}n=i.bind(null,t,n,e),i=void 0,!$t||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Bc(e,t,n,r,i){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var l=r.tag;if(3===l||4===l){var s=r.stateNode.containerInfo;if(s===i)break;if(4===l)for(l=r.return;null!==l;){var u=l.tag;if((3===u||4===u)&&l.stateNode.containerInfo===i)return;l=l.return}for(;null!==s;){if(null===(l=We(s)))return;if(5===(u=l.tag)||6===u||26===u||27===u){r=o=l;continue e}s=s.parentNode}}r=r.return}Dt(function(){var r=o,i=zt(n),l=[];e:{var s=wr.get(e);if(void 0!==s){var u=en,c=e;switch(e){case"keypress":if(0===Ut(n))break e;case"keydown":case"keyup":u=gn;break;case"focusin":c="focus",u=ln;break;case"focusout":c="blur",u=ln;break;case"beforeblur":case"afterblur":u=ln;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":u=on;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=an;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=vn;break;case fr:case mr:case gr:u=sn;break;case br:u=xn;break;case"scroll":case"scrollend":u=nn;break;case"wheel":u=bn;break;case"copy":case"cut":case"paste":u=un;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=yn;break;case"toggle":case"beforetoggle":u=wn}var d=!!(4&t),h=!d&&("scroll"===e||"scrollend"===e),p=d?null!==s?s+"Capture":null:s;d=[];for(var f,m=r;null!==m;){var g=m;if(f=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===f||null===p||null!=(g=Ft(m,p))&&d.push(Vc(m,g,f)),h)break;m=m.return}0<d.length&&(s=new u(s,c,null,n,i),l.push({event:s,listeners:d}))}}if(!(7&t)){if(u="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===It||!(c=n.relatedTarget||n.fromElement)||!We(c)&&!c[Ne])&&(u||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,u?(u=r,null!==(c=(c=n.relatedTarget||n.toElement)?We(c):null)&&(h=a(c),d=c.tag,c!==h||5!==d&&27!==d&&6!==d)&&(c=null)):(u=null,c=r),u!==c)){if(d=on,g="onMouseLeave",p="onMouseEnter",m="mouse",("pointerout"===e||"pointerover"===e)&&(d=yn,g="onPointerLeave",p="onPointerEnter",m="pointer"),h=null==u?s:Ve(u),f=null==c?s:Ve(c),(s=new d(g,m+"leave",u,n,i)).target=h,s.relatedTarget=f,g=null,We(i)===r&&((d=new d(p,m+"enter",c,n,i)).target=f,d.relatedTarget=h,g=d),h=g,u&&c)e:{for(p=c,m=0,f=d=u;f;f=Uc(f))m++;for(f=0,g=p;g;g=Uc(g))f++;for(;0<m-f;)d=Uc(d),m--;for(;0<f-m;)p=Uc(p),f--;for(;m--;){if(d===p||null!==p&&d===p.alternate)break e;d=Uc(d),p=Uc(p)}d=null}else d=null;null!==u&&Yc(l,s,u,d,!1),null!==c&&null!==h&&Yc(l,h,c,d,!0)}if("select"===(u=(s=r?Ve(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===u&&"file"===s.type)var y=On;else if(Ln(s))if(Bn)y=Kn;else{y=Yn;var v=Un}else!(u=s.nodeName)||"input"!==u.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Tt(r.elementType)&&(y=On):y=Xn;switch(y&&(y=y(e,r))?Pn(l,y,n,i):(v&&v(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&xt(s,"number",s.value)),v=r?Ve(r):window,e){case"focusin":(Ln(v)||"true"===v.contentEditable)&&(ir=v,or=r,ar=null);break;case"focusout":ar=or=ir=null;break;case"mousedown":lr=!0;break;case"contextmenu":case"mouseup":case"dragend":lr=!1,sr(l,n,i);break;case"selectionchange":if(rr)break;case"keydown":case"keyup":sr(l,n,i)}var x;if(kn)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else In?Rn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(En&&"ko"!==n.locale&&(In||"onCompositionStart"!==b?"onCompositionEnd"===b&&In&&(x=qt()):(Bt="value"in(Wt=i)?Wt.value:Wt.textContent,In=!0)),0<(v=qc(r,b)).length&&(b=new cn(b,e,null,n,i),l.push({event:b,listeners:v}),(x||null!==(x=jn(n)))&&(b.data=x))),(x=Mn?function(e,t){switch(e){case"compositionend":return jn(t);case"keypress":return 32!==t.which?null:(An=!0,Tn);case"textInput":return(e=t.data)===Tn&&An?null:e;default:return null}}(e,n):function(e,t){if(In)return"compositionend"===e||!kn&&Rn(e,t)?(e=qt(),Vt=Bt=Wt=null,In=!1,e):null;switch(e){case"paste":default: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 En&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(b=qc(r,"onBeforeInput")).length&&(v=new cn("onBeforeInput","beforeinput",null,n,i),l.push({event:v,listeners:b}),v.data=x),function(e,t,n,r,i){if("submit"===t&&n&&n.stateNode===i){var o=Lc((i[Pe]||null).action),a=r.submitter;a&&null!==(t=(t=a[Pe]||null)?Lc(t.formAction):a.getAttribute("formAction"))&&(o=t,a=null);var l=new en("action","action",null,r,i);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==Cc){var e=a?Pc(i,a):new FormData(i);za(n,{pending:!0,data:e,method:i.method,action:o},null,e)}}else"function"==typeof o&&(l.preventDefault(),e=a?Pc(i,a):new FormData(i),za(n,{pending:!0,data:e,method:i.method,action:o},o,e))},currentTarget:i}]})}}(l,e,r,n,i)}Dc(l,t)})}function Vc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qc(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;if(5!==(i=i.tag)&&26!==i&&27!==i||null===o||(null!=(i=Ft(e,n))&&r.unshift(Vc(e,i,o)),null!=(i=Ft(e,t))&&r.push(Vc(e,i,o))),3===e.tag)return r;e=e.return}return[]}function Uc(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function Yc(e,t,n,r,i){for(var o=t._reactName,a=[];null!==n&&n!==r;){var l=n,s=l.alternate,u=l.stateNode;if(l=l.tag,null!==s&&s===r)break;5!==l&&26!==l&&27!==l||null===u||(s=u,i?null!=(u=Ft(n,o))&&a.unshift(Vc(n,u,s)):i||null!=(u=Ft(n,o))&&a.push(Vc(n,u,s))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var Xc=/\\r\\n?/g,Kc=/\\u0000|\\uFFFD/g;function Qc(e){return("string"==typeof e?e:""+e).replace(Xc,"\\n").replace(Kc,"")}function Zc(e,t){return t=Qc(t),Qc(e)===t}function Gc(){}function Jc(e,t,n,r,o,a){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||kt(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&kt(e,""+r);break;case"className":rt(e,"class",r);break;case"tabIndex":rt(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":rt(e,n,r);break;case"style":Et(e,r,a);break;case"data":if("object"!==t){rt(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=jt(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){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("function"==typeof a&&("formAction"===n?("input"!==t&&Jc(e,t,"name",o.name,o,null),Jc(e,t,"formEncType",o.formEncType,o,null),Jc(e,t,"formMethod",o.formMethod,o,null),Jc(e,t,"formTarget",o.formTarget,o,null)):(Jc(e,t,"encType",o.encType,o,null),Jc(e,t,"method",o.method,o,null),Jc(e,t,"target",o.target,o,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=jt(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=Gc);break;case"onScroll":null!=r&&Fc("scroll",e);break;case"onScrollEnd":null!=r&&Fc("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(i(61));if(null!=(n=r.__html)){if(null!=o.children)throw Error(i(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=jt(""+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":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?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&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Fc("beforetoggle",e),Fc("toggle",e),nt(e,"popover",r);break;case"xlinkActuate":it(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":it(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":it(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":it(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":it(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":it(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":it(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":it(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":it(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":nt(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&nt(e,n=At.get(n)||n,r)}}function ed(e,t,n,r,o,a){switch(n){case"style":Et(e,r,a);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(i(61));if(null!=(n=r.__html)){if(null!=o.children)throw Error(i(60));e.innerHTML=n}}break;case"children":"string"==typeof r?kt(e,r):("number"==typeof r||"bigint"==typeof r)&&kt(e,""+r);break;case"onScroll":null!=r&&Fc("scroll",e);break;case"onScrollEnd":null!=r&&Fc("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Gc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:Xe.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),"function"==typeof(a=null!=(a=e[Pe]||null)?a[n]:null)&&e.removeEventListener(t,a,o),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):nt(e,n,r):("function"!=typeof a&&null!==a&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,o)))}}function td(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fc("error",e),Fc("load",e);var r,o=!1,a=!1;for(r in n)if(n.hasOwnProperty(r)){var l=n[r];if(null!=l)switch(r){case"src":o=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Jc(e,t,r,l,n,null)}}return a&&Jc(e,t,"srcSet",n.srcSet,n,null),void(o&&Jc(e,t,"src",n.src,n,null));case"input":Fc("invalid",e);var s=r=l=a=null,u=null,c=null;for(o in n)if(n.hasOwnProperty(o)){var d=n[o];if(null!=d)switch(o){case"name":a=d;break;case"type":l=d;break;case"checked":u=d;break;case"defaultChecked":c=d;break;case"value":r=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(i(137,t));break;default:Jc(e,t,o,d,n,null)}}return vt(e,r,s,u,c,l,a,!1),void ht(e);case"select":for(a in Fc("invalid",e),o=l=r=null,n)if(n.hasOwnProperty(a)&&null!=(s=n[a]))switch(a){case"value":r=s;break;case"defaultValue":l=s;break;case"multiple":o=s;default:Jc(e,t,a,s,n,null)}return t=r,n=l,e.multiple=!!o,void(null!=t?bt(e,!!o,t,!1):null!=n&&bt(e,!!o,n,!0));case"textarea":for(l in Fc("invalid",e),r=a=o=null,n)if(n.hasOwnProperty(l)&&null!=(s=n[l]))switch(l){case"value":o=s;break;case"defaultValue":a=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(i(91));break;default:Jc(e,t,l,s,n,null)}return St(e,o,a,r),void ht(e);case"option":for(u in n)n.hasOwnProperty(u)&&null!=(o=n[u])&&("selected"===u?e.selected=o&&"function"!=typeof o&&"symbol"!=typeof o:Jc(e,t,u,o,n,null));return;case"dialog":Fc("beforetoggle",e),Fc("toggle",e),Fc("cancel",e),Fc("close",e);break;case"iframe":case"object":Fc("load",e);break;case"video":case"audio":for(o=0;o<Nc.length;o++)Fc(Nc[o],e);break;case"image":Fc("error",e),Fc("load",e);break;case"details":Fc("toggle",e);break;case"embed":case"source":case"link":Fc("error",e),Fc("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&null!=(o=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Jc(e,t,c,o,n,null)}return;default:if(Tt(t)){for(d in n)n.hasOwnProperty(d)&&void 0!==(o=n[d])&&ed(e,t,d,o,n,void 0);return}}for(s in n)n.hasOwnProperty(s)&&null!=(o=n[s])&&Jc(e,t,s,o,n,null)}var nd=null,rd=null;function id(e){return 9===e.nodeType?e:e.ownerDocument}function od(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 ad(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function ld(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var sd=null,ud="function"==typeof setTimeout?setTimeout:void 0,cd="function"==typeof clearTimeout?clearTimeout:void 0,dd="function"==typeof Promise?Promise:void 0,hd="function"==typeof queueMicrotask?queueMicrotask:typeof dd<"u"?function(e){return dd.resolve(null).then(e).catch(pd)}:ud;function pd(e){setTimeout(function(){throw e})}function fd(e){return"head"===e}function md(e,t){var n=t,r=0,i=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0<r&&8>r){n=r;var a=e.ownerDocument;if(1&n&&Sd(a.documentElement),2&n&&Sd(a.body),4&n)for(Sd(n=a.head),a=n.firstChild;a;){var l=a.nextSibling,s=a.nodeName;a[$e]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===a.rel.toLowerCase()||n.removeChild(a),a=l}}if(0===i)return e.removeChild(o),void Ah(t);i--}else"$"===n||"$?"===n||"$!"===n?i++:r=n.charCodeAt(0)-48;else r=0;n=o}while(n);Ah(t)}function gd(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":gd(n),He(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function yd(e){return"$!"===e.data||"$?"===e.data&&"complete"===e.ownerDocument.readyState}function vd(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"F!"===t||"F"===t)break;if("/$"===t)return null}}return e}var xd=null;function bd(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}function wd(e,t,n){switch(t=id(n),e){case"html":if(!(e=t.documentElement))throw Error(i(452));return e;case"head":if(!(e=t.head))throw Error(i(453));return e;case"body":if(!(e=t.body))throw Error(i(454));return e;default:throw Error(i(451))}}function Sd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);He(e)}var kd=new Map,Cd=new Set;function Md(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Ed=_.d;_.d={f:function(){var e=Ed.f(),t=Wu();return e||t},r:function(e){var t=Be(e);null!==t&&5===t.tag&&"form"===t.type?Pa(t):Ed.r(e)},D:function(e){Ed.D(e),Ad("dns-prefetch",e,null)},C:function(e,t){Ed.C(e,t),Ad("preconnect",e,t)},L:function(e,t,n){Ed.L(e,t,n);var r=Td;if(r&&e&&t){var i=\'link[rel="preload"][as="\'+gt(t)+\'"]\';"image"===t&&n&&n.imageSrcSet?(i+=\'[imagesrcset="\'+gt(n.imageSrcSet)+\'"]\',"string"==typeof n.imageSizes&&(i+=\'[imagesizes="\'+gt(n.imageSizes)+\'"]\')):i+=\'[href="\'+gt(e)+\'"]\';var o=i;switch(t){case"style":o=jd(e);break;case"script":o=Ld(e)}kd.has(o)||(e=c({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),kd.set(o,e),null!==r.querySelector(i)||"style"===t&&r.querySelector(Id(o))||"script"===t&&r.querySelector(Pd(o))||(td(t=r.createElement("link"),"link",e),Ue(t),r.head.appendChild(t)))}},m:function(e,t){Ed.m(e,t);var n=Td;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",i=\'link[rel="modulepreload"][as="\'+gt(r)+\'"][href="\'+gt(e)+\'"]\',o=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Ld(e)}if(!kd.has(o)&&(e=c({rel:"modulepreload",href:e},t),kd.set(o,e),null===n.querySelector(i))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Pd(o)))return}td(r=n.createElement("link"),"link",e),Ue(r),n.head.appendChild(r)}}},X:function(e,t){Ed.X(e,t);var n=Td;if(n&&e){var r=qe(n).hoistableScripts,i=Ld(e),o=r.get(i);o||((o=n.querySelector(Pd(i)))||(e=c({src:e,async:!0},t),(t=kd.get(i))&&Fd(e,t),Ue(o=n.createElement("script")),td(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}},S:function(e,t,n){Ed.S(e,t,n);var r=Td;if(r&&e){var i=qe(r).hoistableStyles,o=jd(e);t=t||"default";var a=i.get(o);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(Id(o)))l.loading=5;else{e=c({rel:"stylesheet",href:e,"data-precedence":t},n),(n=kd.get(o))&&Dd(e,n);var s=a=r.createElement("link");Ue(s),td(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){l.loading|=1}),s.addEventListener("error",function(){l.loading|=2}),l.loading|=4,_d(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(o,a)}}},M:function(e,t){Ed.M(e,t);var n=Td;if(n&&e){var r=qe(n).hoistableScripts,i=Ld(e),o=r.get(i);o||((o=n.querySelector(Pd(i)))||(e=c({src:e,async:!0,type:"module"},t),(t=kd.get(i))&&Fd(e,t),Ue(o=n.createElement("script")),td(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}}};var Td=typeof document>"u"?null:document;function Ad(e,t,n){var r=Td;if(r&&"string"==typeof t&&t){var i=gt(t);i=\'link[rel="\'+e+\'"][href="\'+i+\'"]\',"string"==typeof n&&(i+=\'[crossorigin="\'+n+\'"]\'),Cd.has(i)||(Cd.add(i),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(i)&&(td(t=r.createElement("link"),"link",e),Ue(t),r.head.appendChild(t)))}}function Rd(e,t,n,r){var o=(o=q.current)?Md(o):null;if(!o)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=jd(n.href),(r=(n=qe(o).hoistableStyles).get(t))||(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("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=jd(n.href);var a=qe(o).hoistableStyles,l=a.get(e);if(l||(o=o.ownerDocument||o,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,l),(a=o.querySelector(Id(e)))&&!a._p&&(l.instance=a,l.state.loading=5),kd.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},kd.set(e,n),a||function(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}),td(t,"link",n),Ue(t),e.head.appendChild(t))}(o,e,n,l.state))),t&&null===r)throw Error(i(528,""));return l}if(t&&null!==r)throw Error(i(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Ld(n),(r=(n=qe(o).hoistableScripts).get(t))||(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(i(444,e))}}function jd(e){return\'href="\'+gt(e)+\'"\'}function Id(e){return\'link[rel="stylesheet"][\'+e+"]"}function zd(e){return c({},e,{"data-precedence":e.precedence,precedence:null})}function Ld(e){return\'[src="\'+gt(e)+\'"]\'}function Pd(e){return"script[async]"+e}function Nd(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector(\'style[data-href~="\'+gt(n.href)+\'"]\');if(r)return t.instance=r,Ue(r),r;var o=c({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return Ue(r=(e.ownerDocument||e).createElement("style")),td(r,"style",o),_d(r,n.precedence,e),t.instance=r;case"stylesheet":o=jd(n.href);var a=e.querySelector(Id(o));if(a)return t.state.loading|=4,t.instance=a,Ue(a),a;r=zd(n),(o=kd.get(o))&&Dd(r,o),Ue(a=(e.ownerDocument||e).createElement("link"));var l=a;return l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),td(a,"link",r),t.state.loading|=4,_d(a,n.precedence,e),t.instance=a;case"script":return a=Ld(n.src),(o=e.querySelector(Pd(a)))?(t.instance=o,Ue(o),o):(r=n,(o=kd.get(a))&&Fd(r=c({},n),o),Ue(o=(e=e.ownerDocument||e).createElement("script")),td(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(i(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,_d(r,n.precedence,e));return t.instance}function _d(e,t,n){for(var r=n.querySelectorAll(\'link[rel="stylesheet"][data-precedence],style[data-precedence]\'),i=r.length?r[r.length-1]:null,o=i,a=0;a<r.length;a++){var l=r[a];if(l.dataset.precedence===t)o=l;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function Dd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function Fd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var Od=null;function $d(e,t,n){if(null===Od){var r=new Map,i=Od=new Map;i.set(n,r)}else(r=(i=Od).get(n))||(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 o=n[i];if(!(o[$e]||o[Le]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var a=o.getAttribute(t)||"";a=e+a;var l=r.get(a);l?l.push(o):r.set(a,[o])}}return r}function Hd(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function Wd(e){return!("stylesheet"===e.type&&!(3&e.state.loading))}var Bd=null;function Vd(){}function qd(){if(this.count--,0===this.count)if(this.stylesheets)Yd(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var Ud=null;function Yd(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,Ud=new Map,t.forEach(Xd,e),Ud=null,qd.call(e))}function Xd(e,t){if(!(4&t.state.loading)){var n=Ud.get(e);if(n)var r=n.get(null);else{n=new Map,Ud.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var a=i[o];("LINK"===a.nodeName||"not all"!==a.getAttribute("media"))&&(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}a=(i=t.instance).getAttribute("data-precedence"),(o=n.get(a)||r)===r&&n.set(null,i),n.set(a,i),this.count++,r=qd.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),o?o.parentNode.insertBefore(i,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(i,e.firstChild),t.state.loading|=4}}var Kd={$$typeof:S,Provider:null,Consumer:null,_currentValue:D,_currentValue2:D,_threadCount:0};function Qd(e,t,n,r,i,o,a,l){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=Me(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Me(0),this.hiddenUpdates=Me(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function Zd(e,t,n,r,i,o,a,l,s,u,c,d){return e=new Qd(e,t,n,a,l,s,u,d),t=1,!0===o&&(t|=24),o=Dr(3,null,null,t),e.current=o,o.stateNode=e,(t=Pi()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},ro(o),e}function Gd(e){return e?e=Nr:Nr}function Jd(e,t,n,r,i,o){i=Gd(i),null===r.context?r.context=i:r.pendingContext=i,(r=oo(t)).payload={element:n},null!==(o=void 0===o?null:o)&&(r.callback=o),null!==(n=ao(e,r,t))&&(Du(n,0,t),lo(n,e,t))}function eh(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function th(e,t){eh(e,t),(e=e.alternate)&&eh(e,t)}function nh(e){if(13===e.tag){var t=zr(e,67108864);null!==t&&Du(t,0,67108864),th(e,67108864)}}var rh=!0;function ih(e,t,n,r){var i=N.T;N.T=null;var o=_.p;try{_.p=2,ah(e,t,n,r)}finally{_.p=o,N.T=i}}function oh(e,t,n,r){var i=N.T;N.T=null;var o=_.p;try{_.p=8,ah(e,t,n,r)}finally{_.p=o,N.T=i}}function ah(e,t,n,r){if(rh){var i=lh(r);if(null===i)Bc(e,t,r,sh,n),xh(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return hh=bh(hh,e,t,n,r,i),!0;case"dragenter":return ph=bh(ph,e,t,n,r,i),!0;case"mouseover":return fh=bh(fh,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return mh.set(o,bh(mh.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,gh.set(o,bh(gh.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(xh(e,r),4&t&&-1<vh.indexOf(e)){for(;null!==i;){var o=Be(i);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var a=xe(o.pendingLanes);if(0!==a){var l=o;for(l.pendingLanes|=2,l.entangledLanes|=2;a;){var s=1<<31-fe(a);l.entanglements[1]|=s,a&=~s}Mc(o),!(6&ru)&&(ku=ne()+500,Ec(0,!1))}}break;case 13:null!==(l=zr(o,2))&&Du(l,0,2),Wu(),th(o,2)}if(null===(o=lh(r))&&Bc(e,t,r,sh,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Bc(e,t,r,null,n)}}function lh(e){return uh(e=zt(e))}var sh=null;function uh(e){if(sh=null,null!==(e=We(e))){var t=a(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=l(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return sh=e,null}function ch(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"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(re()){case ie:return 2;case oe:return 8;case ae:case le:return 32;case se:return 268435456;default:return 32}default:return 32}}var dh=!1,hh=null,ph=null,fh=null,mh=new Map,gh=new Map,yh=[],vh="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 xh(e,t){switch(e){case"focusin":case"focusout":hh=null;break;case"dragenter":case"dragleave":ph=null;break;case"mouseover":case"mouseout":fh=null;break;case"pointerover":case"pointerout":mh.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gh.delete(t.pointerId)}}function bh(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&null!==(t=Be(t))&&nh(t),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function wh(e){var t=We(e.target);if(null!==t){var n=a(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=l(n)))return e.blockedOn=t,void function(e,t){var n=_.p;try{return _.p=e,t()}finally{_.p=n}}(e.priority,function(){if(13===n.tag){var e=Nu();e=Re(e);var t=zr(n,e);null!==t&&Du(t,0,e),th(n,e)}})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Sh(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=lh(e.nativeEvent);if(null!==n)return null!==(t=Be(n))&&nh(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);It=r,n.target.dispatchEvent(r),It=null,t.shift()}return!0}function kh(e,t,n){Sh(e)&&n.delete(t)}function Ch(){dh=!1,null!==hh&&Sh(hh)&&(hh=null),null!==ph&&Sh(ph)&&(ph=null),null!==fh&&Sh(fh)&&(fh=null),mh.forEach(kh),gh.forEach(kh)}function Mh(e,n){e.blockedOn===n&&(e.blockedOn=null,dh||(dh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ch)))}var Eh=null;function Th(e){Eh!==e&&(Eh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Eh===e&&(Eh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if("function"!=typeof r){if(null===uh(r||n))continue;break}var o=Be(n);null!==o&&(e.splice(t,3),t-=3,za(o,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ah(e){function t(t){return Mh(t,e)}null!==hh&&Mh(hh,e),null!==ph&&Mh(ph,e),null!==fh&&Mh(fh,e),mh.forEach(t),gh.forEach(t);for(var n=0;n<yh.length;n++){var r=yh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<yh.length&&null===(n=yh[0]).blockedOn;)wh(n),null===n.blockedOn&&yh.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var i=n[r],o=n[r+1],a=i[Pe]||null;if("function"==typeof o)a||Th(n);else if(a){var l=null;if(o&&o.hasAttribute("formAction")){if(i=o,a=o[Pe]||null)l=a.formAction;else if(null!==uh(i))continue}else l=a.action;"function"==typeof l?n[r+1]=l:(n.splice(r,3),r-=3),Th(n)}}}function Rh(e){this._internalRoot=e}function jh(e){this._internalRoot=e}jh.prototype.render=Rh.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(i(409));Jd(t.current,Nu(),e,t,null,null)},jh.prototype.unmount=Rh.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Jd(e.current,2,null,e,null,null),Wu(),t[Ne]=null}},jh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ie();e={blockedOn:null,target:e,priority:t};for(var n=0;n<yh.length&&0!==t&&t<yh[n].priority;n++);yh.splice(n,0,e),0===n&&wh(e)}};var Ih=n.version;if("19.1.0"!==Ih)throw Error(i(527,Ih,"19.1.0"));_.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=function(e){var t=e.alternate;if(!t){if(null===(t=a(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var l=o.alternate;if(null===l){if(null!==(r=o.return)){n=r;continue}break}if(o.child===l.child){for(l=o.child;l;){if(l===n)return s(o),e;if(l===r)return s(o),t;l=l.sibling}throw Error(i(188))}if(n.return!==r.return)n=o,r=l;else{for(var u=!1,c=o.child;c;){if(c===n){u=!0,n=o,r=l;break}if(c===r){u=!0,r=o,n=l;break}c=c.sibling}if(!u){for(c=l.child;c;){if(c===n){u=!0,n=l,r=o;break}if(c===r){u=!0,r=l,n=o;break}c=c.sibling}if(!u)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(t),null===(e=null!==e?u(e):null)?null:e.stateNode};var zh,Lh={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&!(zh=__REACT_DEVTOOLS_GLOBAL_HOOK__).isDisabled&&zh.supportsFiber)try{de=zh.inject(Lh),he=zh}catch{}e.createRoot=function(e,t){if(!o(e))throw Error(i(299));var n=!1,r="",a=xl,l=bl,s=wl;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(a=t.onUncaughtError),void 0!==t.onCaughtError&&(l=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError),void 0!==t.unstable_transitionCallbacks&&t.unstable_transitionCallbacks),t=Zd(e,1,!1,null,0,n,r,a,l,s,0,null),e[Ne]=t.current,Hc(e),new Rh(t)},e.hydrateRoot=function(e,t,n){if(!o(e))throw Error(i(299));var r=!1,a="",l=xl,s=bl,u=wl,c=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(a=n.identifierPrefix),void 0!==n.onUncaughtError&&(l=n.onUncaughtError),void 0!==n.onCaughtError&&(s=n.onCaughtError),void 0!==n.onRecoverableError&&(u=n.onRecoverableError),void 0!==n.unstable_transitionCallbacks&&n.unstable_transitionCallbacks,void 0!==n.formState&&(c=n.formState)),(t=Zd(e,1,!0,t,0,r,a,l,s,u,0,c)).context=Gd(null),n=t.current,(a=oo(r=Re(r=Nu()))).callback=null,ao(n,a,r),n=r,t.current.lanes=n,Ee(t,n),Mc(t),e[Ne]=t.current,Hc(e),new jh(t)},e.version="19.1.0"}),v=u((e,t)=>{(function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}})(),t.exports=y()}),x=u(e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(e,n,r){var i=null;if(void 0!==r&&(i=""+r),void 0!==n.key&&(i=""+n.key),"key"in n)for(var o in r={},n)"key"!==o&&(r[o]=n[o]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:void 0!==n?n:null,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r}),b=u((e,t)=>{t.exports=x()}),w=s(()=>{e="/__popmelt/guest"}),S=s(()=>{t="/popmelt/phone"});function k(e){try{let t=new URL(e),n=C.get(t.origin);return n?.pathPrefix?("string"==typeof n.pathPrefix?[n.pathPrefix]:n.pathPrefix).some(e=>e.endsWith("/")?t.pathname.startsWith(e):t.pathname===e)?n:void 0:n}catch{return}}var C,M=s(()=>{S(),w(),C=new Map}),E=c(h()),T=c(v()),A=c(h()),R=c(h()),j=c(b());function I(e,t){return(0,R.forwardRef)(function({size:n=24,width:r=n,height:i=n,color:o="currentColor",className:a,children:l,...s},u){let c=!!l||Object.keys(s).some(e=>e.startsWith("aria-")||"role"===e||"title"===e);return(0,j.jsxs)("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",width:r,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:a?`lucide ${e} ${a}`:`lucide ${e}`,"aria-hidden":!c||void 0,...s,children:[t,l]})})}var z=I("lucide-a-large-small",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),(0,j.jsx)("path",{d:"M15.697 14h5.606"}),(0,j.jsx)("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),(0,j.jsx)("path",{d:"M3.304 13h6.392"})]})),L=I("lucide-text-align-center lucide-align-center",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M21 5H3"}),(0,j.jsx)("path",{d:"M17 12H7"}),(0,j.jsx)("path",{d:"M19 19H5"})]})),P=I("lucide-align-center-vertical",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 2v20"}),(0,j.jsx)("path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4"}),(0,j.jsx)("path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4"}),(0,j.jsx)("path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1"}),(0,j.jsx)("path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1"})]})),N=I("lucide-align-end-vertical",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"16",height:"6",x:"2",y:"4",rx:"2"}),(0,j.jsx)("rect",{width:"9",height:"6",x:"9",y:"14",rx:"2"}),(0,j.jsx)("path",{d:"M22 22V2"})]})),_=I("lucide-align-horizontal-justify-center",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,j.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,j.jsx)("path",{d:"M12 2v20"})]})),D=I("lucide-align-horizontal-justify-end",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),(0,j.jsx)("rect",{width:"6",height:"10",x:"12",y:"7",rx:"2"}),(0,j.jsx)("path",{d:"M22 2v20"})]})),F=I("lucide-align-horizontal-justify-start",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"6",height:"14",x:"6",y:"5",rx:"2"}),(0,j.jsx)("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),(0,j.jsx)("path",{d:"M2 2v20"})]})),O=I("lucide-align-horizontal-space-around",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"6",height:"10",x:"9",y:"7",rx:"2"}),(0,j.jsx)("path",{d:"M4 22V2"}),(0,j.jsx)("path",{d:"M20 22V2"})]})),$=I("lucide-align-horizontal-space-between",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"6",height:"14",x:"3",y:"5",rx:"2"}),(0,j.jsx)("rect",{width:"6",height:"10",x:"15",y:"7",rx:"2"}),(0,j.jsx)("path",{d:"M3 2v20"}),(0,j.jsx)("path",{d:"M21 2v20"})]})),H=I("lucide-text-align-justify lucide-align-justify",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M3 5h18"}),(0,j.jsx)("path",{d:"M3 12h18"}),(0,j.jsx)("path",{d:"M3 19h18"})]})),W=I("lucide-text-align-start lucide-text lucide-align-left",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M21 5H3"}),(0,j.jsx)("path",{d:"M15 12H3"}),(0,j.jsx)("path",{d:"M17 19H3"})]})),B=I("lucide-text-align-end lucide-align-right",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M21 5H3"}),(0,j.jsx)("path",{d:"M21 12H9"}),(0,j.jsx)("path",{d:"M21 19H7"})]})),V=I("lucide-align-start-vertical",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"9",height:"6",x:"6",y:"14",rx:"2"}),(0,j.jsx)("rect",{width:"16",height:"6",x:"6",y:"4",rx:"2"}),(0,j.jsx)("path",{d:"M2 2v20"})]})),q=I("lucide-ban",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,j.jsx)("path",{d:"M4.929 4.929 19.07 19.071"})]})),U=I("lucide-between-horizontal-start lucide-between-horizonal-start",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"13",height:"7",x:"8",y:"3",rx:"1"}),(0,j.jsx)("path",{d:"m2 9 3 3-3 3"}),(0,j.jsx)("rect",{width:"13",height:"7",x:"8",y:"14",rx:"1"})]})),Y=I("lucide-between-vertical-end",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"7",height:"13",x:"3",y:"3",rx:"1"}),(0,j.jsx)("path",{d:"m9 22 3-3 3 3"}),(0,j.jsx)("rect",{width:"7",height:"13",x:"14",y:"3",rx:"1"})]})),X=I("lucide-blend",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("circle",{cx:"15",cy:"9",r:"7"}),(0,j.jsx)("circle",{cx:"9",cy:"15",r:"7"})]})),K=I("lucide-letter-b lucide-bold",(0,j.jsx)("path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8"})),Q=I("lucide-check",(0,j.jsx)("path",{d:"M20 6 9 17l-5-5"})),Z=I("lucide-circle-dashed",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}),(0,j.jsx)("path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}),(0,j.jsx)("path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}),(0,j.jsx)("path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}),(0,j.jsx)("path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}),(0,j.jsx)("path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}),(0,j.jsx)("path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}),(0,j.jsx)("path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"})]})),G=I("lucide-clock",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,j.jsx)("path",{d:"M12 6v6l4 2"})]})),J=I("lucide-command",(0,j.jsx)("path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"})),ee=I("lucide-component",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}),(0,j.jsx)("path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}),(0,j.jsx)("path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}),(0,j.jsx)("path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"})]})),te=I("lucide-corner-down-left",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}),(0,j.jsx)("path",{d:"m9 10-5 5 5 5"})]})),ne=I("lucide-eye",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,j.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})),re=I("lucide-image",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),(0,j.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,j.jsx)("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})),ie=I("lucide-message-circle-question-mark lucide-message-circle-question",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),(0,j.jsx)("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),(0,j.jsx)("path",{d:"M12 17h.01"})]})),oe=I("lucide-minimize-2",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"m14 10 7-7"}),(0,j.jsx)("path",{d:"M20 10h-6V4"}),(0,j.jsx)("path",{d:"m3 21 7-7"}),(0,j.jsx)("path",{d:"M4 14h6v6"})]})),ae=I("lucide-minus",(0,j.jsx)("path",{d:"M5 12h14"})),le=I("lucide-move",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 2v20"}),(0,j.jsx)("path",{d:"m15 19-3 3-3-3"}),(0,j.jsx)("path",{d:"m19 9 3 3-3 3"}),(0,j.jsx)("path",{d:"M2 12h20"}),(0,j.jsx)("path",{d:"m5 9-3 3 3 3"}),(0,j.jsx)("path",{d:"m9 5 3-3 3 3"})]})),se=I("lucide-move-horizontal",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"m18 8 4 4-4 4"}),(0,j.jsx)("path",{d:"M2 12h20"}),(0,j.jsx)("path",{d:"m6 8-4 4 4 4"})]})),ue=I("lucide-move-vertical",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 2v20"}),(0,j.jsx)("path",{d:"m8 18 4 4 4-4"}),(0,j.jsx)("path",{d:"m8 6 4-4 4 4"})]})),ce=I("lucide-octagon-alert lucide-alert-octagon",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 16h.01"}),(0,j.jsx)("path",{d:"M12 8v4"}),(0,j.jsx)("path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"})]})),de=I("lucide-palette",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}),(0,j.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,j.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,j.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,j.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"})]})),he=I("lucide-plus",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M5 12h14"}),(0,j.jsx)("path",{d:"M12 5v14"})]})),pe=I("lucide-reply",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}),(0,j.jsx)("path",{d:"m9 17-5-5 5-5"})]})),fe=I("lucide-rotate-cw",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,j.jsx)("path",{d:"M21 3v5h-5"})]})),me=I("lucide-scaling",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,j.jsx)("path",{d:"M14 15H9v-5"}),(0,j.jsx)("path",{d:"M16 3h5v5"}),(0,j.jsx)("path",{d:"M21 3 9 15"})]})),ge=I("lucide-send-horizontal lucide-send-horizonal",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"}),(0,j.jsx)("path",{d:"M6 12h16"})]})),ye=I("lucide-sliders-horizontal",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M10 5H3"}),(0,j.jsx)("path",{d:"M12 19H3"}),(0,j.jsx)("path",{d:"M14 3v4"}),(0,j.jsx)("path",{d:"M16 17v4"}),(0,j.jsx)("path",{d:"M21 12h-9"}),(0,j.jsx)("path",{d:"M21 19h-5"}),(0,j.jsx)("path",{d:"M21 5h-7"}),(0,j.jsx)("path",{d:"M8 10v4"}),(0,j.jsx)("path",{d:"M8 12H3"})]})),ve=I("lucide-mouse-pointer-2",(0,j.jsx)("path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"})),xe=I("lucide-stretch-horizontal",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("rect",{width:"20",height:"6",x:"2",y:"4",rx:"2"}),(0,j.jsx)("rect",{width:"20",height:"6",x:"2",y:"14",rx:"2"})]})),be=I("lucide-triangle-alert lucide-alert-triangle",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),(0,j.jsx)("path",{d:"M12 9v4"}),(0,j.jsx)("path",{d:"M12 17h.01"})]})),we=I("lucide-x",(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:"M18 6 6 18"}),(0,j.jsx)("path",{d:"m6 6 12 12"})]})),Se=300,ke={key:"z",commandOrControl:!0},Ce=c(h()),Me=c(g()),Ee=c(b()),Te=(0,Ce.forwardRef)(function({style:e,...t},n){return(0,Ee.jsx)("span",{...t,ref:n,role:"tooltip",style:{background:"var(--popmelt-thread-raised, #222)",color:"var(--popmelt-thread-primary, #eee)",borderRadius:16,boxSizing:"border-box",...e}})}),Ae=new WeakMap;function Re(e){return e.closest("[data-popmelt-tooltip-group]")??e.parentElement}function je({hint:e,above:t,anchorRef:n,hoverDelayMs:r,onReveal:i,children:o,...a}){return(0,Ee.jsx)(Ie,{hint:e??a["aria-label"],above:t,anchorRef:n,hoverDelayMs:r,onReveal:i,children:e=>(0,Ee.jsx)("button",{type:"button",...a,"aria-describedby":e,children:o})})}function Ie({hint:e,above:t,anchorRef:n,surfaceStyle:r,hoverDelayMs:i=0,onReveal:o,children:a}){let l=(0,Ce.useId)(),s=(0,Ce.useRef)(null),u=(0,Ce.useRef)(null),c=(0,Ce.useRef)(!1),d=(0,Ce.useRef)(!1),h=(0,Ce.useRef)(!1),p=(0,Ce.useRef)(void 0);(0,Ce.useEffect)(()=>()=>clearTimeout(p.current),[]);let[f,m]=(0,Ce.useState)("closed"),g="entering"===f||"instant"===f,y="closed"!==f?s.current:null,v=y?.closest(\'[data-popmelt-tooltip-boundary], [data-devtools="thread-panel"]\'),x=y?.getRootNode(),b=x&&"host"in x?x:y?.ownerDocument.body;function w(t,n,r){if(!e)return;clearTimeout(p.current);let a=Re(t),l=a&&Ae.get(a),s=l&&l.tip!==u.current?l:null,c=!!(n&&s&&(i?r&&"nodeType"in r&&s.host.contains(r)&&s.openedByPointer():Number(t.ownerDocument.defaultView?.getComputedStyle(s.tip).opacity)>0)),d=()=>{s?.close(),h.current=n,m(c?"instant":"entering"),o?.()};n&&i&&!c?(h.current=!1,p.current=setTimeout(d,i)):d()}return(0,Ce.useLayoutEffect)(()=>{let e=u.current,t=v?.ownerDocument.defaultView;if(!e||!v||!t)return;let n=t.getComputedStyle(v);for(let t of["--popmelt-thread-action","--popmelt-thread-on-action"])e.style.setProperty(t,n.getPropertyValue(t));void 0===r?.fontFamily&&(e.style.fontFamily=n.fontFamily),void 0===r?.letterSpacing&&(e.style.letterSpacing=n.letterSpacing)}),(0,Ce.useLayoutEffect)(()=>{let e=u.current,r=y?.ownerDocument.defaultView;if(!y||!e||!r)return;let i=n?.current??y,o=r.visualViewport,a=()=>{let n=v?.getBoundingClientRect(),a=i.getBoundingClientRect(),l=new r.DOMRect(o?.offsetLeft??0,o?.offsetTop??0,o?.width??r.innerWidth,o?.height??r.innerHeight),s=l.left+8,u=l.right-8,c=l.top+8,d=l.bottom-8;e.style.maxWidth=Math.max(0,Math.min(180,u-s))+"px";let{width:h,height:p}=e.getBoundingClientRect(),f=e=>a.right<=e.left||a.left>=e.right||a.bottom<=e.top||a.top>=e.bottom;if(f(l)||n&&f(n)||h>u-s||p>d-c)return void(e.style.visibility="hidden");let m=(e,t,n)=>Math.max(t,Math.min(e,n)),g=m(a.left+(a.width-h)/2,s,u-h),y=a.top-p-4,x=a.bottom+4,b=m((t?y>=c:x+p>d)?y:x,c,d-p);e.style.left=g+"px",e.style.top=b+"px",e.style.visibility="visible"};a();let l=new r.ResizeObserver(a);l.observe(y),i!==y&&l.observe(i),l.observe(e),v&&l.observe(v);let s=y.getRootNode();return s.addEventListener("scroll",a,!0),r.addEventListener("resize",a),o?.addEventListener("resize",a),o?.addEventListener("scroll",a),()=>{l.disconnect(),s.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),o?.removeEventListener("resize",a),o?.removeEventListener("scroll",a)}},[y,n,v,t,e]),(0,Ce.useLayoutEffect)(()=>{let e=y&&Re(y),t=u.current;if(!e||!t)return;let n={tip:t,host:y,openedByPointer:()=>h.current,close:()=>m("closed")};return Ae.set(e,n),()=>{Ae.get(e)===n&&Ae.delete(e)}},[y]),(0,Ce.useLayoutEffect)(()=>{let e=u.current,t=y?.ownerDocument.defaultView;if(!e||!t)return;let n="instant"!==f&&!t.matchMedia("(prefers-reduced-motion: reduce)").matches;if(e.style.transition=n?"opacity 120ms ease-out":"none","entering"===f&&t.getComputedStyle(e).opacity,e.style.opacity=g?"1":"0",!g){if(!n)return void m("closed");let e=t.setTimeout(()=>m("closed"),120);return()=>t.clearTimeout(e)}},[y,g,f]),(0,Ce.useEffect)(()=>{let e=s.current?.ownerDocument;if(!g||!e)return;let t=e=>{"Escape"===e.key&&(m("closed"),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[g]),(0,Ee.jsxs)("span",{ref:s,style:{position:"relative",display:"inline-flex",minWidth:0},onPointerEnter:e=>{"touch"!==e.pointerType&&(c.current=!0,w(e.currentTarget,!0,e.relatedTarget))},onPointerLeave:()=>{clearTimeout(p.current),c.current=!1,d.current||m(e=>"closed"===e?e:"leaving")},onFocus:e=>{d.current=e.target.matches(":focus-visible"),d.current&&w(e.currentTarget,!1)},onBlur:()=>{d.current=!1,c.current||m(e=>"closed"===e?e:"leaving")},children:[a(g&&e?l:void 0),b&&e&&(0,Me.createPortal)((0,Ee.jsx)(Te,{ref:u,id:l,"aria-hidden":!g||void 0,style:{position:"fixed",opacity:0,visibility:"hidden",background:"var(--popmelt-thread-action, #222)",color:"var(--popmelt-thread-on-action, #eee)",whiteSpace:"normal",overflowWrap:"anywhere",zIndex:v?10006:y?.closest(\'[data-devtools="badge-hit-area"]\')?10003:20,width:"max-content",maxWidth:180,pointerEvents:"none",fontSize:12,fontWeight:500,lineHeight:1.35,padding:"5px 8px",borderRadius:8,...r},children:e}),b)]})}var ze=\'"Popmelt Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif\',Le=\'"Popmelt Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace\',Pe=c(h());async function Ne(e,t){await _e(`${e}/draft-attachments/${encodeURIComponent(t)}`,{method:"DELETE"},5e3)}function _e(n,r={},i=15e3){let o=new AbortController;r.signal&&r.signal.addEventListener("abort",()=>o.abort());let a=setTimeout(()=>o.abort(),i);return function(n,r={}){return function(n,r){let i=function(t,n){let r=k(t);if(!r)return n;let i=new Headers(n.headers);for(let[e,t]of Object.entries(r.headers))i.set(e,t);return{...n,headers:i,redirect:"error",credentials:r.pathPrefix===e+"/"?"same-origin":"omit"}}(n,r);if(k(n)?.phone){let e=new URL(n),r=new Headers(i.headers);return r.set("X-Popmelt-Phone-Route",e.pathname.slice(t.length)+e.search),fetch(e.origin+t,{...i,headers:r,cache:"no-store"})}return fetch(n,i)}(n,function(e={}){let t=typeof window<"u"?window.__POPMELT_PROJECT_ID__??null:null;if(!t)return e;let n=new Headers(e.headers);return n.set("X-Popmelt-Project-Id",t),{...e,headers:n}}(r))}(n,{...r,signal:o.signal}).finally(()=>clearTimeout(a))}async function De(e,t){try{let n=await _e(`${e}/ui-preferences`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:t})},5e3);return n.ok?await n.json():null}catch{return null}}M();var Fe="devtools-toolbar-theme",Oe="popmelt-theme-change",$e="popmelt-theme-project-change",He="(prefers-color-scheme: dark)",We={light:{surface:"#eaeaea",border:"#dddddd",control:"#dddddd",primary:"#222222",threadPrimary:"#222222",secondary:"#777777",muted:"#aaaaaa",mutedStrong:"#888888",hoverSurface:"#dddddd",hoverForeground:"#333333",raisedSurface:"#ffffff",softSurface:"#f5f5f5",actionSurface:"#222222",actionForeground:"#eeeeee",actionHover:"#000000",hairline:"rgba(0,0,0,0.1)",softHairline:"rgba(0,0,0,0.06)",scrollbarIdle:"rgba(34,34,34,0.2)",scrollbarHover:"rgba(34,34,34,0.5)",logoFilter:"none"},dark:{surface:"#111111",border:"#222222",control:"#222222",primary:"#dddddd",threadPrimary:"#aaaaaa",secondary:"#777777",muted:"#555555",mutedStrong:"#777777",hoverSurface:"#222222",hoverForeground:"#dddddd",raisedSurface:"#181818",softSurface:"#181818",actionSurface:"#dddddd",actionForeground:"#222222",actionHover:"#ffffff",hairline:"rgba(255,255,255,0.1)",softHairline:"rgba(255,255,255,0.06)",scrollbarIdle:"rgba(221,221,221,0.2)",scrollbarHover:"rgba(221,221,221,0.5)",logoFilter:"invert(1)"}};function Be(e){return"light"===e||"dark"===e?e:"auto"}function Ve(){if(typeof window>"u")return{exists:!1,preference:"auto"};let e,t=Qe(window.__POPMELT_PROJECT_ID__);try{e=window.localStorage.getItem(t)}catch{let e=document.documentElement.style.colorScheme;return{exists:!1,preference:"dark"===e||"light"===e?e:"auto"}}if(null!==e)return{exists:!0,preference:Be(e)};let n=window.__POPMELT_PROJECT_ID__;if(n){let e=Qe(void 0),r=window.localStorage.getItem(e);if(null!==r){let i=Be(r);window.localStorage.setItem(t,i),window.localStorage.removeItem(e);let o=Ze(void 0);return null!==window.localStorage.getItem(o)&&(window.localStorage.setItem(Ze(n),i),window.localStorage.removeItem(o)),{exists:!0,preference:i}}}let r=window.localStorage.getItem(Fe);if(null!==r){let e=Be(r);return window.__POPMELT_PROJECT_ID__&&(window.localStorage.setItem(t,e),window.localStorage.removeItem(Fe)),{exists:!0,preference:e}}return{exists:!1,preference:"auto"}}function qe(){return Ve().preference}function Ue(e,t,n){if(typeof window>"u")return;window.localStorage.setItem(Qe(t),e);let r=Ze(t);n?window.localStorage.setItem(r,e):window.localStorage.removeItem(r)}function Ye(){return typeof window>"u"?"auto:light":`${qe()}:${window.matchMedia(He).matches?"dark":"light"}`}function Xe(e){if(typeof window>"u")return()=>{};let t=t=>{let n=Qe(window.__POPMELT_PROJECT_ID__);(t.key===n||t.key===Fe)&&e()},n=window.matchMedia(He),r=()=>e();return window.addEventListener("storage",t),window.addEventListener(Oe,e),window.addEventListener($e,e),n.addEventListener("change",r),()=>{window.removeEventListener("storage",t),window.removeEventListener(Oe,e),window.removeEventListener($e,e),n.removeEventListener("change",r)}}function Ke(e){let t=(0,Pe.useSyncExternalStore)(Xe,Ye,()=>"auto:light"),[n,r]=t.split(":"),i=function(e,t){return"auto"===e?t?"dark":"light":e}(n,"dark"===r),o=typeof window<"u"?window.__POPMELT_PROJECT_ID__:void 0;return(0,Pe.useEffect)(()=>{if(!e||!o)return;let t=!1;return(async()=>{let n=Ze(o),r=window.localStorage.getItem(n);if(null!==r){let n=Be(r),i=await De(e,n);return void(!t&&i&&(Ue(i.preferences.theme,o,!1),window.dispatchEvent(new Event(Oe))))}let i=await async function(e="http://localhost:1111"){try{let t=await _e(`${e}/ui-preferences`,{},5e3);return t.ok?await t.json():null}catch{return null}}(e);if(t||!i)return;let a=Ve();if(!i.exists&&a.exists){let n=await De(e,a.preference);return void(!t&&n&&(Ue(n.preferences.theme,o,!1),window.dispatchEvent(new Event(Oe))))}Ue(i.preferences.theme,o,!1),window.dispatchEvent(new Event(Oe))})(),()=>{t=!0}},[e,o]),[i,(0,Pe.useCallback)(t=>{typeof window>"u"||qe()===t||(Ue(t,o,!(!e||!o)),window.dispatchEvent(new Event(Oe)),e&&o&&De(e,t).then(e=>{e&&(Ue(e.preferences.theme,o,!1),window.dispatchEvent(new Event(Oe)))}))},[e,o]),n]}function Qe(e){let t=e?.trim()||"default";return`${Fe}:${t}`}function Ze(e){return`${Qe(e)}:pending-sync`}c(b());var Ge=c(h());function Je(e){let t=()=>typeof window>"u"?void 0:window.matchMedia?.(e);return{matches:()=>!!t()?.matches,subscribe:function(e){let n=t();return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}}}var et=Je("(any-pointer: coarse) and (not (any-pointer: fine))"),tt=Je("(max-width: 480px), (pointer: coarse)"),nt=()=>!1;function rt(e){if(typeof document<"u"&&e===document)return null;try{let t=e.defaultView?.frameElement;return"iframe"===t?.localName?t:null}catch{return null}}function it(e){if("iframe"!==e.localName||e.closest("[data-devtools],[data-popmelt-peer-surface]"))return null;try{let t=e.contentDocument;return t?.documentElement?t:null}catch{return null}}function ot(e){let t=e.getBoundingClientRect(),n=e.offsetWidth?t.width/e.offsetWidth:1,r=e.offsetHeight?t.height/e.offsetHeight:1;return{x:t.left+e.clientLeft*n,y:t.top+e.clientTop*r,sx:n,sy:r}}function at(e,t){let{left:n,top:r,width:i,height:o}=e,a=rt(t);for(;a;){let e=ot(a);n=e.x+n*e.sx,r=e.y+r*e.sy,i*=e.sx,o*=e.sy,a=rt(a.ownerDocument)}return new DOMRect(n,r,i,o)}function lt(e){return at(e.getBoundingClientRect(),e.ownerDocument)}function st(e,t,n){let r=[],i=rt(n);for(;i;)r.unshift(i),i=rt(i.ownerDocument);for(let n of r){let r=ot(n);e=(e-r.x)/r.sx,t=(t-r.y)/r.sy}return{x:e,y:t}}function ut(e){return e.ownerDocument.defaultView??window}function ct(e,t=document){if(e===t)return!0;let n=rt(e);return!(!n?.isConnected||n.contentDocument!==e||!ct(n.ownerDocument,t))}function dt(e,t){if(!ct(t))return new DOMRect(0,0,0,0);let n=e.left,r=e.top,i=e.right,o=e.bottom;for(let e=rt(t);e;e=rt(e.ownerDocument)){let t=at({left:0,top:0,width:e.clientWidth,height:e.clientHeight},e.contentDocument);n=Math.max(n,t.left),r=Math.max(r,t.top),i=Math.min(i,t.right),o=Math.min(o,t.bottom)}return new DOMRect(n,r,Math.max(0,i-n),Math.max(0,o-r))}et.matches;var ht="@frame(";function pt(e){if(!e.startsWith(ht))return null;let t=e.indexOf(") ");if(t<0)return null;try{let n=JSON.parse(decodeURIComponent(e.slice(7,t)));return"string"!=typeof n.selector||"string"!=typeof n.url?null:{...n,rest:e.slice(t+2)}}catch{return null}}var ft=" >>> ";function mt(e){let t=[];for(let n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot);return t}function gt(e=document){let t=[e];for(let e of t)t.push(...mt(e));return t}function yt(e,t=document){if(e.startsWith(ht)){let n=pt(e);if(!n)return null;let r=n.selector.startsWith(ht)||n.selector.includes(ft)?[yt(n.selector,t)].filter(e=>!!e):gt(t).flatMap(e=>Array.from(e.querySelectorAll(n.selector))),i=1===r.length?r[0]:null,o=i&&it(i);return o&&o.URL===n.url?yt(n.rest,o):null}let n=e.split(ft);if(n.length>1){let e=t,r=null;for(let t=0;t<n.length;t+=1){if(r=e.querySelector(n[t]),!r)return null;if(t<n.length-1){if(!r.shadowRoot)return null;e=r.shadowRoot}}return r}let r=[t];for(let t of r){let n=t.querySelector(e);if(n)return n;r.push(...mt(t))}return null}function vt(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return"host"in t?t.host:null}function xt(e,t){return t.startsWith(ht)||t.includes(ft)?yt(t)===e:e.matches(t)}function bt(e,t){let n=e;for(;n;){let e=n.closest(t);if(e)return e;let r=n.getRootNode();n=r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in r?r.host:null}return null}function wt(e,t){let n=t;for(;n;){if(n===e)return!0;n=vt(n)}return!1}function St(e){let t=e.getAttribute("style");return e.style.setProperty("pointer-events","auto","important"),()=>{null===t?e.removeAttribute("style"):e.setAttribute("style",t)}}function kt(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function Ct(e,t,n,r=e=>[e],i,o){let a=[];for(let r of e.querySelectorAll("iframe")){if(!it(r))continue;let e=r.getBoundingClientRect();t<e.left||t>e.right||n<e.top||n>e.bottom||"none"===r.ownerDocument.defaultView?.getComputedStyle(r).pointerEvents&&a.push(St(r))}try{let a=()=>{let r="function"==typeof e.elementsFromPoint?e.elementsFromPoint(t,n):[],i=e.elementFromPoint?.(t,n)??null;return(i&&!r.includes(i)?[i,...r]:r).filter(t=>9===e.nodeType||t.getRootNode()===e)},l=a(),s=l;if(i){let r=function(e,t,n,r){let i=9===e.nodeType?e:e.ownerDocument,o=i.defaultView;if(!o)return;let a=e.querySelector("dialog[open]"),l=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){let i=e;if(r&&i.matches(r)||!a&&i.hasAttribute("inert"))return NodeFilter.FILTER_REJECT;let l=o.getComputedStyle(i);return"none"===l.display||!a&&"svg"===i.localName&&"hidden"===l.overflowX&&"hidden"===l.overflowY&&!kt(i.getBoundingClientRect(),t,n)?NodeFilter.FILTER_REJECT:i.style&&"none"===l.pointerEvents&&function(e,t,n,r,i){let o=e.getBoundingClientRect();if(!o.width&&!o.height||kt(o,t,n)||"http://www.w3.org/1999/xhtml"!==e.namespaceURI||"list-item"===i.display)return!0;for(let t of["::before","::after"]){let n=r.getComputedStyle(e,t).content;if(n&&"none"!==n&&"normal"!==n)return!0}for(let r of e.childNodes){if(r.nodeType!==Node.TEXT_NODE||!r.textContent?.trim())continue;let i=e.ownerDocument.createRange();if(i.selectNodeContents(r),!i.getBoundingClientRect||kt(i.getBoundingClientRect(),t,n))return!0}return!1}(i,t,n,o,l)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),s=[];for(let e=l.nextNode();e;e=l.nextNode())s.push(e);if(!s.length)return;let u=[];try{for(let e of s)u.push(St(e))}catch(e){throw u.forEach(e=>e()),e}return()=>u.forEach(e=>e())}(e,t,n,o);if(r)try{s=a()}finally{r()}s=s.filter(e=>l.includes(e)||i(e))}return s.flatMap(r)}finally{a.forEach(e=>e())}}function Mt(e,t,n=document,r,i){let o=[],a=new Set,l=9===n.nodeType?n:n.ownerDocument,s=st(e,t,l);for(let l of gt(n).reverse())if(!(i&&"host"in l&&bt(l.host,i)))for(let n of Ct(l,s.x,s.y,n=>{let o=it(n);return o?[...Mt(e,t,o,r,i),n]:[n]},r,i))a.has(n)||(a.add(n),o.push(n));return o}function Et(){return ft}function Tt(e){return!(!e||"http://www.w3.org/1999/xhtml"!==e.namespaceURI&&"http://www.w3.org/2000/svg"!==e.namespaceURI)}function At(e,t){let n=({x:e,y:n})=>{let r=at({left:e,top:n,width:0,height:0},t);return{x:r.left,y:r.top}};return{topLeft:n(e.topLeft),topRight:n(e.topRight),bottomRight:n(e.bottomRight),bottomLeft:n(e.bottomLeft)}}var Rt=["transition","transform","translate","rotate","scale"];function jt(e){let[t]=e.getBoxQuads?.({box:"border"})??[];return t?{topLeft:{x:t.p1.x,y:t.p1.y},topRight:{x:t.p2.x,y:t.p2.y},bottomRight:{x:t.p3.x,y:t.p3.y},bottomLeft:{x:t.p4.x,y:t.p4.y}}:It(e.getBoundingClientRect())}function It(e){return{topLeft:{x:e.left,y:e.top},topRight:{x:e.right,y:e.top},bottomRight:{x:e.right,y:e.bottom},bottomLeft:{x:e.left,y:e.bottom}}}var zt={a:1,b:0,c:0,d:1,e:0,f:0};function Lt(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}}function Pt(e,t){return{...zt,e:e,f:t}}function Nt(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return{a:n,b:r,c:-r,d:n,e:0,f:0}}function _t(e,t){return{a:e,b:0,c:0,d:t,e:0,f:0}}function Dt(e,t){if(!e)return 0;let n=Number.parseFloat(e);return Number.isFinite(n)?e.endsWith("%")?n/100*t:n:0}function Ft(e){if(!e)return 1;let t=Number.parseFloat(e);return Number.isFinite(t)?e.endsWith("%")?t/100:t:1}function Ot(e){if(!e||"none"===e)return zt;let t=e.match(/^matrix\\(([^)]+)\\)$/);if(t){let e=t[1].split(",").map(Number);if(6===e.length&&e.every(Number.isFinite)){let[t,n,r,i,o,a]=e;return{a:t,b:n,c:r,d:i,e:o,f:a}}}let n=e.match(/^matrix3d\\(([^)]+)\\)$/);if(n){let e=n[1].split(",").map(Number);if(16===e.length&&e.every(Number.isFinite))return{a:e[0],b:e[1],c:e[4],d:e[5],e:e[12],f:e[13]}}return zt}function $t(e,t){return{x:e.a*t.x+e.c*t.y+e.e,y:e.b*t.x+e.d*t.y+e.f}}function Ht(e){let t=getComputedStyle(e),n=t.rotate.trim().split(/\\s+/).at(-1)??"0",r=Nt(Number.parseFloat(n)||0),[i="1",o=i]=t.scale.trim().split(/\\s+/);return{...Lt(r,Lt(_t(Ft(i),Ft(o)),Ot(t.transform))),e:0,f:0}}function Wt(e){let t=zt,n=e.assignedSlot??vt(e);for(;n;)Tt(n)&&(t=Lt(Ht(n),t)),n=n.assignedSlot??vt(n);return t}function Bt(e,t,n){let r=(r,i)=>({x:e.x+(t.x*r+n.x*i)/2,y:e.y+(t.y*r+n.y*i)/2});return{topLeft:r(-1,-1),topRight:r(1,-1),bottomRight:r(1,1),bottomLeft:r(-1,1)}}function Vt(e){let t=Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0);if(t.length>1)return t.map(t=>{let n=It(t),r=At(n,e.ownerDocument);return rn(r,Zt(Xt(e,n),n,r))}).join(" ");let n=jt(e),r=Tt(e)?Qt(e,n):Kt(n),i=Bt({x:0,y:0},{x:r.width,y:0},{x:0,y:r.height}),o=n;if(!e.getBoxQuads&&Tt(e)){let t=Lt(Wt(e),Ht(e));if(0!==t.b||0!==t.c||t.a<0||t.d<0){let i=e.currentCSSZoom||1;o=Bt(on(n),{x:t.a*r.width*i,y:t.b*r.width*i},{x:t.c*r.height*i,y:t.d*r.height*i})}}let a=At(o,e.ownerDocument);return rn(a,Zt(Xt(e,i),i,a))}function qt(e,t){let[n]=e.getBoxQuads?.({box:"border"})??[];if(n)return jt(e);let r=getComputedStyle(e),{width:i,height:o}=Qt(e,t);if(i<=0||o<=0)return jt(e);let[a="0",l="0"]=r.translate.trim().split(/\\s+/),s=Pt(Dt(a,i),Dt(l,o)),u=r.rotate.trim().split(/\\s+/).at(-1)??"0",c=Nt(Number.parseFloat(u)||0),[d="1",h=d]=r.scale.trim().split(/\\s+/),p=_t(Ft(d),Ft(h)),f=Ot(r.transform),[m="50%",g="50%"]=r.transformOrigin.trim().split(/\\s+/),y={x:Dt(m,i),y:Dt(g,o)},v=Lt(Pt(y.x,y.y),Lt(c,Lt(p,Lt(f,Pt(-y.x,-y.y))))),x=Lt(s,v),b=(t.topRight.x-t.topLeft.x)/i,w=(t.topRight.y-t.topLeft.y)/i,S=(t.bottomLeft.x-t.topLeft.x)/o,k=(t.bottomLeft.y-t.topLeft.y)/o,C=e=>{let n=$t(x,e);return{x:t.topLeft.x+b*n.x+S*n.y,y:t.topLeft.y+w*n.x+k*n.y}};return{topLeft:C({x:0,y:0}),topRight:C({x:i,y:0}),bottomRight:C({x:i,y:o}),bottomLeft:C({x:0,y:o})}}function Ut(e){let t=Rt.map(t=>({property:t,value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}));try{e.style.setProperty("transition","none","important");for(let t of Rt)"transition"!==t&&e.style.setProperty(t,"none","important");let[t]=e.getBoxQuads?.({box:"border"})??[],n=jt(e);return t?n:function(e,t){let{width:n,height:r}=Qt(e,t);if(n<=0||r<=0)return t;let i=Wt(e);if(0===i.b&&0===i.c&&i.a>0&&i.d>0)return t;let o=e.currentCSSZoom||1,a=$t(i,{x:n*o,y:0}),l=$t(i,{x:0,y:r*o});return Bt(on(t),a,l)}(e,n)}finally{for(let{property:n,value:r,priority:i}of t.filter(({property:e})=>"transition"!==e))r?e.style.setProperty(n,r,i):e.style.removeProperty(n);let n=t.find(({property:e})=>"transition"===e);n&&(e.ownerDocument.defaultView?.getComputedStyle(e).transitionProperty,n.value?e.style.setProperty(n.property,n.value,n.priority):e.style.removeProperty(n.property))}}function Yt(e,t,n){let[r="0",i=r]=e.trim().split(/\\s+/),o=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?e.endsWith("%")?n/100*t:n:0};return{x:o(r,t),y:o(i,n)}}function Xt(e,t){let n=getComputedStyle(e),r=(Math.hypot(t.topRight.x-t.topLeft.x,t.topRight.y-t.topLeft.y)+Math.hypot(t.bottomRight.x-t.bottomLeft.x,t.bottomRight.y-t.bottomLeft.y))/2,i=(Math.hypot(t.bottomLeft.x-t.topLeft.x,t.bottomLeft.y-t.topLeft.y)+Math.hypot(t.bottomRight.x-t.topRight.x,t.bottomRight.y-t.topRight.y))/2;return{topLeft:Yt(n.borderTopLeftRadius,r,i),topRight:Yt(n.borderTopRightRadius,r,i),bottomRight:Yt(n.borderBottomRightRadius,r,i),bottomLeft:Yt(n.borderBottomLeftRadius,r,i)}}function Kt(e){return{width:(Math.hypot(e.topRight.x-e.topLeft.x,e.topRight.y-e.topLeft.y)+Math.hypot(e.bottomRight.x-e.bottomLeft.x,e.bottomRight.y-e.bottomLeft.y))/2,height:(Math.hypot(e.bottomLeft.x-e.topLeft.x,e.bottomLeft.y-e.topLeft.y)+Math.hypot(e.bottomRight.x-e.topRight.x,e.bottomRight.y-e.topRight.y))/2}}function Qt(e,t){let n=Kt(t);if("offsetWidth"in e)return{width:e.offsetWidth||n.width,height:e.offsetHeight||n.height};let r=getComputedStyle(e),i=Number.parseFloat(r.width),o=Number.parseFloat(r.height);return{width:Number.isFinite(i)&&i>0?i:n.width,height:Number.isFinite(o)&&o>0?o:n.height}}function Zt(e,t,n){let r=Kt(t),i=Kt(n),o=r.width>0?i.width/r.width:1,a=r.height>0?i.height/r.height:1;return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{x:t.x*o,y:t.y*a}]))}function Gt(e){let t=getComputedStyle(e);return(!t.backgroundImage||"none"===t.backgroundImage)&&function(e){let t=e.trim().toLowerCase();if(!t||"transparent"===t)return 0;if(t.match(/^#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})$/))return 5===t.length?Number.parseInt(t.at(-1).repeat(2),16)/255:9===t.length?Number.parseInt(t.slice(-2),16)/255:1;let n=t.match(/\\/\\s*([\\d.]+%?)\\s*\\)$/);if(n){let e=Number.parseFloat(n[1]);return n[1].endsWith("%")?e/100:e}let r=t.match(/^rgba\\([^,]+,[^,]+,[^,]+,\\s*([\\d.]+%?)\\s*\\)$/);if(r){let e=Number.parseFloat(r[1]);return r[1].endsWith("%")?e/100:e}return 1}(t.backgroundColor)>=.999}function Jt(e,t,n){let r=t.x-e.x,i=t.y-e.y,o=Math.max(1,Math.hypot(r,i));return{x:e.x+r/o*n,y:e.y+i/o*n}}function en(e,t){let n=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),r=[[n(e.topLeft,e.topRight),t.topLeft.x+t.topRight.x],[n(e.topRight,e.bottomRight),t.topRight.y+t.bottomRight.y],[n(e.bottomRight,e.bottomLeft),t.bottomRight.x+t.bottomLeft.x],[n(e.bottomLeft,e.topLeft),t.bottomLeft.y+t.topLeft.y]];return Math.min(1,...r.map(([e,t])=>t>0?e/t:1))}function tn(e){return{topLeft:[e.topLeft.y,e.topLeft.x],topRight:[e.topRight.x,e.topRight.y],bottomRight:[e.bottomRight.y,e.bottomRight.x],bottomLeft:[e.bottomLeft.x,e.bottomLeft.y]}}function nn(e,t){let n=["topLeft","topRight","bottomRight","bottomLeft"],r=tn(t),i=en(e,t),o=1-Math.SQRT1_2;return Object.fromEntries(n.map((t,a)=>{let l=e[t],s=e[n[(a+n.length-1)%n.length]],u=e[n[(a+1)%n.length]],[c,d]=r[t],h=Jt(l,s,c*i*o),p=Jt(l,u,d*i*o);return[t,{x:h.x+p.x-l.x,y:h.y+p.y-l.y}]}))}function rn(e,t){let n=.5522847498,r=["topLeft","topRight","bottomRight","bottomLeft"],i=tn(t),o=en(e,t),a=r.map((t,a)=>{let l=e[t],s=r[(a+r.length-1)%r.length],u=r[(a+1)%r.length],c=e[s],d=e[u],[h,p]=i[t],f=h*o,m=p*o,g=Jt(l,c,f),y=Jt(l,d,m);return{entry:g,exit:y,entryControl:Jt(g,l,f*n),exitControl:Jt(y,l,m*n)}}),l=a[0],s=[`M ${l.exit.x} ${l.exit.y}`];for(let e=1;e<=a.length;e+=1){let t=a[e%a.length];s.push(`L ${t.entry.x} ${t.entry.y}`),s.push(`C ${t.entryControl.x} ${t.entryControl.y} ${t.exitControl.x} ${t.exitControl.y} ${t.exit.x} ${t.exit.y}`)}return s.push("Z"),s.join(" ")}function on(e){return{x:(e.topLeft.x+e.topRight.x+e.bottomRight.x+e.bottomLeft.x)/4,y:(e.topLeft.y+e.topRight.y+e.bottomRight.y+e.bottomLeft.y)/4}}function an(e,t=28,n="top"){let[r,i]="top"===n?[e.topLeft,e.topRight]:"right"===n?[e.topRight,e.bottomRight]:"bottom"===n?[e.bottomRight,e.bottomLeft]:[e.bottomLeft,e.topLeft],o={x:(r.x+i.x)/2,y:(r.y+i.y)/2},a=i.x-r.x,l=i.y-r.y,s=Math.max(1,Math.hypot(a,l));return{edge:o,handle:{x:o.x+l/s*t,y:o.y-a/s*t}}}function ln(e,t){let n=an(e);return n.handle.y>=t/2?{...n,side:"top"}:{...an(e,28,"bottom"),side:"bottom"}}function sn(e,t,n){let r=n.x-t.x,i=n.y-t.y,o=r*r+i*i;if(0===o)return Math.hypot(e.x-t.x,e.y-t.y);let a=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/o));return Math.hypot(e.x-(t.x+a*r),e.y-(t.y+a*i))}var un=["top","right","bottom","left"];function cn(e,t,n,r={}){let i=un.map(n=>({...an(e,28,n),side:n,distance:sn(t,"top"===n?e.topLeft:"right"===n?e.topRight:"bottom"===n?e.bottomRight:e.bottomLeft,"top"===n?e.topRight:"right"===n?e.bottomRight:"bottom"===n?e.bottomLeft:e.topLeft)})),o=r.viewport?i.filter(({handle:e})=>function(e,t,n){let r=t/2;return e.x>=r&&e.x<=n.width-r&&e.y>=r&&e.y<=n.height-r}(e,n,r.viewport)):i,a=o.length>0?o:i,l=a.reduce((e,t)=>t.distance<e.distance?t:e),s=r.currentSide?a.find(({side:e})=>e===r.currentSide):void 0,u=s&&s.distance<=l.distance+(r.hysteresis??8)?s:l;return{edge:u.edge,handle:u.handle,side:u.side}}function dn(e){let t=Math.max(1,Math.hypot(e.x,e.y));return{x:e.x/t,y:e.y/t}}function hn(e){if(!e||"none"===e)return{x:0,y:0};let[t="0",n="0"]=e.trim().split(/\\s+/);return{x:Number.parseFloat(t)||0,y:Number.parseFloat(n)||0}}function pn(e){let t=e.match(/^\\/__popmelt\\/planes\\/app\\/[a-f0-9]{32}(?:\\/|$)/)?.[0];return t?t.replace(/\\/?$/,"/"):"/"}function fn(e){return e.slice(pn(e).length-1)||"/"}var mn=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],gn=e=>e.replace(/\\s+/g," ").trim();function yn(e){return"id"===e||"data-popmelt-media-id"===e||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(e)}function vn(e,t){return!(!(t&&t.length<=200)||"id"===e&&/^(radix-|:|_r_)/.test(t))}function xn(e){let t={},n=new Set([...mn,...e.getAttributeNames().filter(yn)]);for(let r of n){let n=e.getAttribute(r);n&&vn(r,n)&&(t[r]=n)}let r=gn(e.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),i=gn(Array.from(e.childNodes).filter(e=>3===e.nodeType).map(e=>e.textContent).join(" "));return{tag:e.tagName.toLowerCase(),...Object.keys(t).length?{attributes:t}:{},...r&&r.length<=200?{heading:r}:{},...i&&i.length<=200?{text:i}:{}}}function bn(e,t,n=document){let r=gt(n),i=e=>{try{return r.flatMap(t=>Array.from(t.querySelectorAll(e)))}catch{return[]}},o=!(!t||!(t.heading||t.text||Object.keys(t.attributes??{}).length)),a=e=>{if(!t||!o)return!0;let n=xn(e);return n.tag===t.tag&&(!t.heading||n.heading===t.heading)&&(!t.text||n.text===t.text)&&Object.entries(t.attributes??{}).every(([t,n])=>e.getAttribute(t)===n)};for(let r of e){if(r.includes(" >>> ")||r.startsWith("@frame(")){try{let e=yt(r,n),i=pt(r),o=Object.entries(t?.attributes??{}).filter(([e])=>yn(e)),l=i&&e&&(i.rest.startsWith("[data-pm=")||o.length>0&&e.tagName.toLowerCase()===t?.tag&&o.every(([t,n])=>e.getAttribute(t)===n));if(e&&(l||a(e)))return{status:"matched",element:e}}catch{}continue}let e=i(r);if(1===e.length&&(/^\\[data-pm=/.test(r)||!o))return{status:"matched",element:e[0]}}if(!o||e.some(e=>e.includes(" >>> ")||e.startsWith("@frame("))||!/^[a-z][a-z0-9-]*$/.test(t.tag))return{status:"missing"};let l=i(t.tag);if(l.length>500)return{status:"ambiguous"};let s=Object.entries(t.attributes??{}).filter(([e])=>yn(e));if(s.length){let e=l.filter(e=>s.every(([t,n])=>e.getAttribute(t)===n));return 1===e.length?{status:"matched",element:e[0]}:{status:e.length?"ambiguous":"missing"}}let u=l.filter(a);return 1===u.length?{status:"matched",element:u[0]}:{status:u.length?"ambiguous":"missing"}}function wn(e,t,n=document){let r={};if(t)for(let[e,n]of Object.entries({...t.dataAttributes,...t.id?{id:t.id}:{}}))yn(e)&&vn(e,n)&&(r[e]=n);let i=t?.targetFingerprint?.tag??t?.tagName?.toLowerCase(),o=t&&i?{...t.targetFingerprint,tag:i,attributes:{...r,...t.targetFingerprint?.attributes}}:t?.targetFingerprint,a=bn([e,t?.selector].filter(e=>!!e),o,n);return"matched"===a.status?a.element:null}var Sn=["data-popmelt-frame","data-popmelt-media-id","data-testid","data-test","data-cy"];function kn(e){let t=e.getRootNode();if(!("querySelectorAll"in t))return null;let n=new Set([...Sn,...e.getAttributeNames().filter(e=>"id"!==e&&yn(e))]);for(let r of n){let n=e.getAttribute(r);if(!n||n.length>200)continue;let i=`[${r}="${typeof CSS<"u"&&"function"==typeof CSS.escape?CSS.escape(n):Array.from(n,e=>{if(\'"\'===e||"\\\\"===e)return`\\\\${e}`;let t=e.charCodeAt(0);return t<32||127===t?`\\\\${t.toString(16)} `:e}).join("")}"]`;if(1===t.querySelectorAll(i).length)return i}return null}function Cn(e){if(rt(e.ownerDocument))return Mn(e);let t=kn(e);if(t)return t;if(e.id)return`#${e.id}`;let n=e.tagName.toLowerCase(),r=Array.from(e.classList).slice(0,3).join(".");return r?`${n}.${r}`:n}function Mn(e){return En(Tn(e),e.ownerDocument)}function En(e,t){let n=rt(t);if(n){(!n.id||1!==n.ownerDocument.querySelectorAll(`#${CSS.escape(n.id)}`).length)&&!kn(n)&&n.setAttribute("data-popmelt-frame",globalThis.crypto?.randomUUID?.()??`frame-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);let r=n.hasAttribute("data-popmelt-frame")?`[data-popmelt-frame="${n.getAttribute("data-popmelt-frame")}"]`:Tn(n);return function(e,t){return`${ht}${encodeURIComponent(JSON.stringify({selector:e,url:t.URL}))}) `}(rt(n.ownerDocument)?Mn(n):r,t)+e}return e}function Tn(e){if(9===e.getRootNode().nodeType&&e.id&&!e.id.startsWith("radix-")&&!e.id.startsWith(":")&&1===e.ownerDocument.querySelectorAll(`#${CSS.escape(e.id)}`).length)return`#${CSS.escape(e.id)}`;let t=[],n=e;for(;n&&n!==e.ownerDocument.documentElement;){let e=n.tagName.toLowerCase(),r=kn(n);if(r?e=r:n.id&&!n.id.startsWith("radix-")&&!n.id.startsWith(":")&&1===n.getRootNode().querySelectorAll(`#${CSS.escape(n.id)}`).length&&(e=`#${CSS.escape(n.id)}`),!r&&!e.startsWith("#")){let t=Array.from(n.classList).filter(e=>!e.startsWith("_")&&e.length<30).slice(0,2);t.length>0&&(e+="."+t.map(e=>CSS.escape(e)).join("."))}let i=n.parentElement;if(i&&!r&&!e.startsWith("#")){let t=Array.from(i.children).filter(e=>e.tagName===n.tagName);t.length>1&&(e+=`:nth-of-type(${t.indexOf(n)+1})`)}if(t.unshift(e),r||e.startsWith("#")){let e=n.getRootNode();if(9===e.nodeType)break;if("host"in e){t.unshift(Et().trim()),n=e.host;continue}}if(i){n=i;continue}let o=n.getRootNode();if(!("host"in o))break;t.unshift(Et().trim()),n=o.host}return t.join(" > ").replace(/ > >>> > /g,Et())}function An(e){try{return yt(e)}catch{return null}}function Rn(e){if(!e)return null;try{return yt(e)}catch{return null}}function jn(e){return(e??"").replace(/\\s+/g," ").trim()}function In(e){let t=jn(e.getAttribute("aria-label"));if(t)return t.slice(0,80);let n=jn(e.getAttribute("aria-labelledby"));if(n){let e=n.split(/\\s+/).map(e=>jn(document.getElementById(e)?.textContent)).filter(Boolean).join(" ");if(e)return e.slice(0,80)}let r=jn(e.getAttribute("title"));return r?r.slice(0,80):jn(e.textContent).slice(0,80)}function zn(e){if(e instanceof HTMLDetailsElement){let t=Array.from(e.children).find(e=>"summary"===e.tagName.toLowerCase());if(!t)return null;let n=In(t);return n?{triggerSelector:Mn(t),targetSelector:Mn(e),label:n}:null}let t=function(e){return e.id?Array.from(document.querySelectorAll("[aria-controls]")).find(t=>t.getAttribute("aria-controls")===e.id)??null:null}(e);if(!t)return null;let n=In(t);return n?{triggerSelector:Mn(t),targetSelector:Mn(e),label:n}:null}function Ln(e){let t=[],n=new Set,r=vt(e);for(;r&&r!==document.body&&r!==document.documentElement;){let e=zn(r);e&&!n.has(e.triggerSelector)&&(n.add(e.triggerSelector),t.push(e)),r=vt(r)}if(0===t.length)return;let i=t.reverse();return{steps:i,location:i.map(e=>e.label)}}function Pn(e){let t=e?.[0]?.revealRecipe;if(t?.steps.length)return t;let n=Rn(e?.[0]?.selector);return n?Ln(n):void 0}function Nn(e){let t=Pn(e)?.location.filter(Boolean);return t?.length?`Inside: ${t.join(" › ")}`:null}function _n(e){if(!e?.isConnected)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||0===e.getClientRects().length)return!1;let n=e;for(;n;){let e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||Number.parseFloat(e.opacity||"1")<=0)return!1;n=n.parentElement}return!0}function Dn(e,t,n){return"true"===t.getAttribute("aria-expanded")||"open"===t.getAttribute("data-state")||(n instanceof HTMLDetailsElement?n.open:_n(n))}function Fn(e,t=900){return e?new Promise(n=>{let r=performance.now(),i=()=>{let o=Rn(e);_n(o)?n(o):performance.now()-r>=t?n(null):requestAnimationFrame(i)};i()}):Promise.resolve(null)}function On(e){let t={targetFingerprint:xn(e),selector:Cn(e),tagName:e.tagName.toLowerCase()};e.hasAttribute("data-popmelt-subject-projection")&&e.hasAttribute("data-scratch-part")&&(t.subjectLabel=e.getAttribute("data-popmelt-subject-label")||void 0,t.tagName=e.getAttribute("data-popmelt-subject-adapter")||t.tagName);let n=[],r=e.ownerDocument,i=rt(r);for(;i;)n.unshift({url:r.URL,title:r.title,label:i.title||i.getAttribute("aria-label")||i.id||void 0}),r=i.ownerDocument,i=rt(r);n.length&&(t.frameContext=n),e.id&&(t.id=e.id),e.classList.length>0&&(t.className=Array.from(e.classList).join(" "));let o=function(e){let t="";for(let n of e.childNodes)n.nodeType===Node.TEXT_NODE&&(t+=n.textContent||"");return t.trim()}(e)||e.matches(\'button, a, [role="button"], [role="tab"]\')&&(e.getAttribute("aria-label")||e.getAttribute("title")||e.textContent?.trim())||"";o&&o.length>0&&o.length<200&&(t.textContent=o);let a={};for(let t of e.attributes)t.name.startsWith("data-")&&(a[t.name]=t.value);Object.keys(a).length>0&&(t.dataAttributes=a);let l=function(e){let t=Object.keys(e).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));if(!t)return null;let n=e[t],r=[],i=n?._debugSource;for(;n;){let e=n.type,t=e?.displayName||e?.name;t&&"string"==typeof t&&/^[A-Z]/.test(t)&&!t.startsWith("_")&&"Fragment"!==t&&r.unshift(t),n=n.return}return r.length>0?{name:r[r.length-1],path:r,...i?.fileName&&Number.isFinite(i.lineNumber)?{source:i}:{}}:null}(e);l&&(t.reactComponent=l.name,t.reactComponentPath=l.path,l.source&&(t.reactSource=l.source));let s=function(e){let t=vt(e),n=["section","article","nav","aside","header","footer","main"];for(;t&&t!==e.ownerDocument.body;){let e=t.tagName.toLowerCase();if(n.includes(e)&&t.id)return rt(t.ownerDocument)?Cn(t):`${e}#${t.id}`;if(t.id&&!t.id.startsWith("radix-")&&!t.id.startsWith(":"))return rt(t.ownerDocument)?Cn(t):`${e}#${t.id}`;t=vt(t)}return null}(e);s&&(t.context=s);let u=Ln(e);return u&&(t.revealRecipe=u),t}var $n=new WeakMap;function Hn(e,t,n){let r,i=e[0]?.closest("[data-explore-fixture-root]");if(i){for(let o of e)if(i.contains(o)){if("svg"===o.localName){r??=o;continue}if("canvas"===o.localName)return $n.get(o)?.(t,n)??r??o;if(Xn(o,t,n,!1,!0))return r??o}return r??e[0]}}function Wn(e,t,n){let r=Yn(e,t,n),i=Hn(r,e,t);if(i)return i;let o=r.findIndex(e=>"canvas"===e.tagName.toLowerCase());return(o<0?r[0]:r.slice(0,o+1).find(n=>Xn(n,e,t)))??null}function Bn(e,t,n){if("function"!=typeof document.elementsFromPoint)return!0;for(let r of Yn(t,n)){if(r===e||e.contains(r))return Xn(r,t,n);if(Xn(r,t,n))return!1}return!1}var Vn="[data-popmelt-canvas-block]";function qn(e,t){let n=Mt(e,t).find(e=>"devtools-canvas"!==e.id&&"devtools-scrim"!==e.id);return!(!n||!bt(n,Vn))}function Un(e){return"http://www.w3.org/2000/svg"===e.namespaceURI?e.closest("svg")??e:e}function Yn(e,t,n){let r=n?.within;if(!r&&qn(e,t))return[];let i=new Set,o=Mt(e,t,r?.ownerDocument??document,n=>{if(r&&!r.contains(n))return!1;let i=bt(n,"[data-devtools], [data-popmelt-root], [data-popmelt-shadow-host], [data-popmelt-canvas-block]");return(!i||!!r&&i.contains(r))&&Xn(n,e,t,!1)},r?void 0:"[data-devtools], [data-popmelt-canvas-block]"),a=o.map(Un).filter(e=>{if(i.has(e))return!1;if(i.add(e),r){if(e===r||!r.contains(e))return!1;let t=bt(e,"[data-devtools], [data-popmelt-canvas-block]");return!t||t.contains(r)}return!("devtools-canvas"===e.id||"devtools-toolbar"===e.id||"devtools-scrim"===e.id||bt(e,"#devtools-toolbar")||e.hasAttribute("data-devtools")||bt(e,"[data-devtools]"))&&e!==e.ownerDocument.body&&e!==e.ownerDocument.documentElement});return a.length>0?a:!r&&n?.allowBodyFallback&&o.includes(document.body)?[document.body]:[]}function Xn(e,t,n,r=!0,i=!1){let o=e.ownerDocument.defaultView;if(!o)return!1;let a=o.getComputedStyle(e);if("hidden"===a.visibility||"collapse"===a.visibility)return!1;for(let t=e;t;t=vt(t))if("0"===t.ownerDocument.defaultView?.getComputedStyle(t).opacity)return!1;if(function(e,t,n){for(let r of e.childNodes){if(r.nodeType!==Node.TEXT_NODE||!r.textContent?.trim())continue;let i=e.ownerDocument.createRange();i.selectNodeContents(r);let o=i.getClientRects?.();if(o&&Array.from(o).some(r=>{let i=st(t,n,e.ownerDocument);return i.x>=r.left&&i.x<=r.right&&i.y>=r.top&&i.y<=r.bottom}))return!0}return!1}(e,t,n)||"http://www.w3.org/2000/svg"===e.namespaceURI&&(r||"svg"!==e.localName)||["button","canvas","embed","iframe","img","input","object","select","textarea","video"].includes(e.tagName.toLowerCase())&&(!i||"button"!==e.localName)||a.backgroundImage&&"none"!==a.backgroundImage)return!0;let l=a.backgroundColor.trim();if(l&&"transparent"!==l&&!/rgba\\([^)]*,\\s*0(?:\\.0+)?\\s*\\)$/.test(l))return!0;let s=lt(e),u=Number.parseFloat(a.borderTopWidth)||0,c=Number.parseFloat(a.borderRightWidth)||0,d=Number.parseFloat(a.borderBottomWidth)||0,h=Number.parseFloat(a.borderLeftWidth)||0,p=e=>{let t=a[`border${e}Color`];return"none"!==a[`border${e}Style`]&&"transparent"!==t&&!/rgba\\([^)]*,\\s*0(?:\\.0+)?\\s*\\)$/.test(t)};return u>0&&p("Top")&&n<=s.top+u||c>0&&p("Right")&&t>=s.right-c||d>0&&p("Bottom")&&n>=s.bottom-d||h>0&&p("Left")&&t<=s.left+h}function Kn(e){return Array.from(e,e=>{if(\'"\'===e||"\\\\"===e)return`\\\\${e}`;let t=e.codePointAt(0);return t<32||127===t?`\\\\${t.toString(16)} `:e}).join("")}function Qn(e){return`[data-popmelt-subject-adapter="${Kn(e.adapter)}"][data-popmelt-subject-key="${Kn(e.key)}"]`}function Zn(e){let t=e?.getAttribute("data-popmelt-subject-adapter"),n=e?.getAttribute("data-popmelt-subject-key");return t&&n?{adapter:t,key:n}:void 0}function Gn(e,t){let n=!1;e.dataset.popmeltSubjectLabel!==t.label&&(e.dataset.popmeltSubjectLabel=t.label,n=!0);let{left:r,top:i,width:o,height:a}=t.bounds,l=e=>Math.round(2*e)/2+"px",s={left:l(r),top:l(i),width:l(Math.max(0,o)),height:l(Math.max(0,a))};for(let[t,r]of Object.entries(s)){let i=t;e.style[i]!==r&&(e.style[i]=r,n=!0)}let u=t.surfaceBounds,c={popmeltSubjectSurfaceLeft:u?String(u.left):void 0,popmeltSubjectSurfaceTop:u?String(u.top):void 0,popmeltSubjectSurfaceWidth:u?String(u.width):void 0,popmeltSubjectSurfaceHeight:u?String(u.height):void 0};for(let[t,r]of Object.entries(c))void 0===r?t in e.dataset&&(delete e.dataset[t],n=!0):e.dataset[t]!==r&&(e.dataset[t]=r,n=!0);let d=t.outline?.map(e=>`${e.x},${e.y}`).join(" ");return d?e.dataset.popmeltSubjectOutline!==d&&(e.dataset.popmeltSubjectOutline=d,n=!0):void 0!==e.dataset.popmeltSubjectOutline&&(delete e.dataset.popmeltSubjectOutline,n=!0),n}var Jn=class{constructor(e){this.adapters=e,this.appliedCanvases=new Map,this.projections=new Map,this.frameListeners=new Set,this.frame=null,this.lastProjectionFrameTime=0,this.adapterUnsubscribes=e.flatMap(e=>{let t=e.subscribe?.(()=>{for(let e of this.frameListeners)e()});return t?[t]:[]})}async whenReady(){await Promise.all(this.adapters.map(e=>e.whenReady?.()))}hitTest(e){return this.hitTestAll(e)[0]??null}hitTestAll(e){let t=new Map;for(let n=this.adapters.length-1;n>=0;n-=1){let r=this.adapters[n];if(!r)continue;let i=(r.hitTestAll?.(e)??[r.hitTest(e)]).filter(e=>!!e).filter(n=>{let r=n.sourceElement;return!r||(t.has(r)||t.set(r,Bn(r,e.x,e.y)),t.get(r))}).map(e=>this.project(r,e));if(i.length>0)return i}return[]}resolve(e){let t=this.adapters.find(t=>t.id===e.adapter);if(!t)return null;let n=t.resolve(e.key);return n?this.project(t,n):null}restore(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.restoreSubject?.(e.key,t);return n&&r?this.project(n,r):null}async captureFeedback(e){let t=this.resolve(e);if(!t)return null;let{adapter:n,subject:r}=t,i={...t.elementInfo};if(r.sourceElement&&(i.sourceElement={...On(r.sourceElement),selector:Mn(r.sourceElement)}),!n.captureSubject)return{elementInfo:i};try{let t=await n.captureSubject(e.key);return t?{elementInfo:i,crop:t}:{elementInfo:i,warning:"Object crop unavailable; use the page screenshot and image coordinates."}}catch{return{elementInfo:i,warning:"Object crop unavailable (the image may block canvas access via CORS); use the page screenshot and image coordinates."}}}beginCreate(e){for(let t=this.adapters.length-1;t>=0;t-=1){let n=this.adapters[t],r=n?.beginCreate?.(e);if(n&&r)return{adapter:n,session:r}}return null}rename(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.renameSubject?.(e.key,t);return n&&r?this.project(n,r):null}updateBounds(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.updateSubjectBounds?.(e.key,t);return n&&r?this.project(n,r):null}updateTrackingAnchors(e,t){let n=this.adapters.find(t=>t.id===e.adapter),r=n?.updateSubjectTrackingAnchors?.(e.key,t);return n&&r?this.project(n,r):null}promote(e){let t=this.adapters.find(t=>t.id===e.adapter),n=t?.promoteSubject?.(e.key);return t&&n?this.project(t,n):null}remove(e){this.adapters.find(t=>t.id===e.adapter)?.removeSubject?.(e.key)}sampleableObject(e){let t=Zn(e);if(!t)return null;let n=this.resolve(t),r=n?.adapter.sampleCanvas;return n?.element===e&&r?.objects&&n.subject.sourceElement===r.element?{projection:n,surface:r,objects:r.objects}:null}placementSurface(e,t){let n=this.adapters.flatMap(({id:n,sampleCanvas:r})=>r?.element===e&&r.format===t&&r.objects?.placement?[{surface:r,adapter:n}]:[]);return 1===n.length?n[0]:void 0}sampleableCanvases(e,t=!1){return this.adapters.flatMap(({sampleCanvas:n})=>n&&(t||!n.placementOnly)&&wt(e,n.element)?[n]:[])}applyCanvasSamples(e=[]){for(let{id:t,sampleCanvas:n}of this.adapters){if(!n)continue;let r=n.element.ownerDocument,i=e.filter(e=>{if(e.pathname!==r.location?.pathname||e.format!==n.format||n.placementOnly&&!e.subject?.inserted||e.subject&&(e.subject.adapter!==t||Qn(e.subject)!==e.selector))return!1;let i=bn([e.subject?.canvasSelector??e.selector],void 0,r);return"matched"===i.status&&i.element===n.element}),o=this.appliedCanvases.get(n);if(!i.length&&!o)continue;let a=o?.original??n.read(),l=i.find(e=>!e.subject),s=l&&n.accepts(l.value)?l.value:null;for(let e of i){if(!e.subject||!n.objects)continue;let t=s??a,r=e.subject.inserted?n.objects.placement?.insert(t,e.subject.key,e.value):n.objects.replace(t,e.subject.key,e.value);null!=r&&n.accepts(r)&&(s=r)}if(null!==s){if(o?.applied===s)continue;n.write(s),this.appliedCanvases.set(n,{original:a,applied:n.read()})}else o&&(n.read()===o.applied&&n.write(o.original),this.appliedCanvases.delete(n))}}async captureSurfaces(){return(await Promise.all(this.adapters.map(async e=>e.captureSurfaces?.()??[]))).flat()}subscribeFrame(e){return this.frameListeners.add(e),()=>this.frameListeners.delete(e)}destroy(){this.applyCanvasSamples(),null!==this.frame&&cancelAnimationFrame(this.frame),this.frame=null;for(let e of this.projections.values())e.element.remove();this.projections.clear();for(let e of this.adapterUnsubscribes)e();this.frameListeners.clear()}project(e,t){let n={adapter:e.id,key:t.key},r=`${e.id}\\0${t.key}`,i=this.projections.get(r);if(i)return i.subject=t,i.elementInfo=this.elementInfo(e,t,i.selector),Gn(i.element,t),i;let o=Qn(n),a=document.createElement("div");a.dataset.popmeltSubjectAdapter=e.id,a.dataset.popmeltSubjectKey=t.key,a.dataset.popmeltSubjectLabel=t.label,a.dataset.popmeltSubjectProjection="true",a.setAttribute("aria-hidden","true"),Object.assign(a.style,{position:"fixed",pointerEvents:"none",opacity:"0",zIndex:"-1"}),Gn(a,t),document.body.appendChild(a);let l={adapter:e,subject:t,target:n,element:a,selector:o,elementInfo:this.elementInfo(e,t,o)};return this.projections.set(r,l),this.ensureFrame(),l}elementInfo(e,t,n){return{selector:n,tagName:e.id,subjectLabel:t.label,textContent:t.label,context:t.context,...t.imageObject?{imageObject:t.imageObject}:{},...t.videoObject?{videoObject:t.videoObject}:{},dataAttributes:{adapter:e.id,key:t.key,...t.data??{}}}}ensureFrame(){null===this.frame&&0!==this.projections.size&&(this.frame=requestAnimationFrame(e=>{if(this.frame=null,this.lastProjectionFrameTime>0&&e-this.lastProjectionFrameTime<32)return void this.ensureFrame();this.lastProjectionFrameTime=e;let t=!1;for(let[e,n]of this.projections){let r=n.adapter.resolve(n.target.key);r?(n.subject=r,t=Gn(n.element,r)||t):(n.element.remove(),this.projections.delete(e),t=!0)}if(t)for(let e of this.frameListeners)e();this.projections.size>0&&this.ensureFrame()}))}},er=("display color background-color font-family font-size font-style font-weight line-height letter-spacing text-align text-decoration-line white-space flex-direction flex-wrap flex-grow align-items justify-content row-gap column-gap "+["top","right","bottom","left"].flatMap(e=>["padding-"+e,"margin-"+e,"border-"+e+"-style","border-"+e+"-color","border-"+e+"-width"]).join(" ")+" border-top-left-radius border-top-right-radius border-bottom-left-radius border-bottom-right-radius").split(" "),tr={"aspect-ratio":"auto","box-sizing":"content-box",width:"auto",height:"auto","max-width":"none","max-height":"none",transform:"none","transform-origin":"50% 50%",translate:"none",rotate:"none",scale:"none","z-index":"auto",visibility:"visible","min-height":"auto","min-width":"auto","box-shadow":"none","text-shadow":"none","text-transform":"none","word-spacing":"0px","overflow-wrap":"normal","word-break":"normal",direction:"ltr","writing-mode":"horizontal-tb","vertical-align":"baseline",opacity:"1","align-self":"auto","justify-self":"auto","align-content":"normal","justify-items":"normal","flex-shrink":"1","flex-basis":"auto",order:"0","grid-template-columns":"none","grid-template-rows":"none","grid-auto-flow":"row","grid-column-start":"auto","grid-column-end":"auto","grid-row-start":"auto","grid-row-end":"auto","overflow-x":"visible","overflow-y":"visible"},nr=["top","right","bottom","left"],rr=["width","height","max-width","max-height","object-fit","object-position"],ir=["background-size","background-position","background-repeat","background-origin","background-clip"],or=new Set([...[...er,...Object.keys(tr),...nr,...ir,...rr].map(e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),"borderColor","borderRadius","fill","stroke","strokeWidth","strokeDasharray","strokeDashoffset"]),ar=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function lr(e){let t=typeof TextEncoder<"u"?Array.from((new TextEncoder).encode(e)):function(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):t.push(224|r>>12,128|r>>6&63,128|63&r)}return t}(e),n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let e=7;e>=0;e--)t.push(n/Math.pow(2,8*e)&255);let r=1779033703,i=3144134277,o=1013904242,a=2773480762,l=1359893119,s=2600822924,u=528734635,c=1541459225,d=new Array(64);for(let e=0;e<t.length;e+=64){for(let n=0;n<16;n++){let r=e+4*n;d[n]=(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3])>>>0}for(let e=16;e<64;e++){let t=sr(d[e-15],7)^sr(d[e-15],18)^d[e-15]>>>3,n=sr(d[e-2],17)^sr(d[e-2],19)^d[e-2]>>>10;d[e]=d[e-16]+t+d[e-7]+n>>>0}let n=r,h=i,p=o,f=a,m=l,g=s,y=u,v=c;for(let e=0;e<64;e++){let t=v+(sr(m,6)^sr(m,11)^sr(m,25))+(m&g^~m&y)+ar[e]+d[e]>>>0,r=n&h^n&p^h&p;v=y,y=g,g=m,m=f+t>>>0,f=p,p=h,h=n,n=t+((sr(n,2)^sr(n,13)^sr(n,22))+r>>>0)>>>0}r=r+n>>>0,i=i+h>>>0,o=o+p>>>0,a=a+f>>>0,l=l+m>>>0,s=s+g>>>0,u=u+y>>>0,c=c+v>>>0}return[r,i,o,a,l,s,u,c].map(e=>e.toString(16).padStart(8,"0")).join("")}function sr(e,t){return e>>>t|e<<32-t}var ur=/^[a-f0-9]{64}$/,cr=/^[a-zA-Z0-9 _-]{0,64}$/,dr=3145728,hr=new Map,pr=new Map,fr=new Map;function mr(e,t){return new URL(pn(e.location.pathname)+"_popmelt/samples/"+t+".json",e.location.origin).href}function gr(e){let t=e.getAttribute("data-popmelt-sample-version");if(null===t)return;let n={version:t,variant:e.getAttribute("data-popmelt-sample-variant")??"",props:e.getAttribute("data-popmelt-sample-props")??void 0,dark:!!e.closest(".dark")||"dark"===e.ownerDocument.defaultView?.getComputedStyle(e).colorScheme,label:(e.getAttribute("aria-label")??"").slice(0,256)};if(!function(e){return e&&"string"==typeof e.version&&ur.test(e.version)&&"string"==typeof e.variant&&cr.test(e.variant)&&function(e){if(void 0===e)return!0;if("string"!=typeof e||e.length>8192)return!1;try{let t=JSON.parse(e);return null!==t&&"object"==typeof t&&!Array.isArray(t)}catch{return!1}}(e.props)&&(void 0===e.label||"string"==typeof e.label&&e.label.length<=256)&&"boolean"==typeof e.dark}(n))throw Error("This component has no valid sample revision.");if(!hr.has(t)){let n=mr(e.ownerDocument,t);throw(fr.get(n)??0)>Date.now()?Error("The sampled revision is unavailable."):(pr.has(n)||async function(e,t){let n=hr.get(t);if(n)return n;let r=mr(e,t),i=pr.get(r);if(i)return i;let o=(async()=>{let n=new URL("/_popmelt/samples/"+t+".json",e.location.origin).href,i=await(globalThis.caches?.open("popmelt-component-samples-v1").catch(()=>{})),o=await(i?.match(n)),a=o??await fetch(r,{redirect:"error"});if(!a.ok||Number(a.headers.get("content-length"))>dr)throw Error();let l=a.body?.getReader();if(!l)throw Error();let s=0,u="",c=new TextDecoder("utf-8",{fatal:!0});for(;;){let{done:e,value:t}=await l.read();if(e)break;if(s+=t.length,s>dr)throw await l.cancel(),Error();u+=c.decode(t,{stream:!0})}if(u+=c.decode(),(globalThis.crypto?.subtle?Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(u))),e=>e.toString(16).padStart(2,"0")).join(""):lr(u))!==t)throw Error();let d=JSON.parse(u);if("string"!=typeof d.script||"string"!=typeof d.css)throw Error();return o||await(i?.put(n,new Response(u)).catch(()=>{})),hr.size>=8&&hr.delete(hr.keys().next().value),hr.set(t,d),fr.delete(r),d})().finally(()=>pr.delete(r));return pr.set(r,o),o}(e.ownerDocument,t).catch(()=>fr.set(n,Date.now()+5e3)).finally(()=>{e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready"))}),Error("Loading this component for sampling."))}return n}function yr(e){return"string"==typeof e&&e.length<=384&&!/[;{}\\\\]|(?:url|var|attr|env)\\s*\\(/i.test(e)}var vr=new WeakMap;function xr(e){let t=e.currentSrc||e.src;if(!e.complete||!e.naturalWidth||!e.naturalHeight)throw new Error("The image has not loaded.");let n=vr.get(e);if(n?.src===t)return n.pixels;let r=e.ownerDocument.createElement("canvas"),i=Math.min(1,1024/Math.max(e.naturalWidth,e.naturalHeight));for(;;){r.width=Math.max(1,Math.round(e.naturalWidth*i)),r.height=Math.max(1,Math.round(e.naturalHeight*i));let n,o=r.getContext("2d");if(!o)throw new Error("The browser cannot capture this image.");o.drawImage(e,0,0,r.width,r.height);try{n=r.width*r.height<=65536?r.toDataURL("image/png"):"",(!n||n.length>24576)&&(n=r.toDataURL("image/webp",.9))}catch{throw new Error("The image host does not allow its pixels to be copied.")}if(br(n))return vr.set(e,{src:t,pixels:n}),e.addEventListener("load",()=>vr.delete(e),{once:!0}),n;if(1===r.width&&1===r.height)throw new Error("The browser cannot capture this image.");i/=2}}function br(e){return"string"==typeof e&&e.length<=24576&&/^data:image\\/(?:png|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}var wr=new WeakMap,Sr="http://www.w3.org/2000/svg",kr=new Set("svg g path rect circle ellipse line polygon polyline defs linearGradient radialGradient stop clipPath title desc".split(" ")),Cr=new Set("viewBox preserveAspectRatio x y width height cx cy r rx ry x1 x2 y1 y2 d points transform pathLength gradientUnits gradientTransform spreadMethod offset fx fy fr clipPathUnits".split(" ")),Mr=new Set("fill stroke stop-color".split(" ")),Er="fill fill-opacity fill-rule stroke stroke-width stroke-opacity stroke-linecap stroke-linejoin stroke-miterlimit stroke-dasharray stroke-dashoffset clip-rule clip-path vector-effect opacity stop-color stop-opacity display visibility".split(" "),Tr=/^url\\(["\']?#([\\w.:-]+)["\']?\\)$/,Ar=/^[\\w.:-]{1,128}$/;function Rr(e,t){return"id"===e?Ar.test(t):"aria-label"===e?t.length<=512:"aria-hidden"===e?"true"===t||"false"===t:Cr.has(e)?/^[\\w\\s.%+,()-]*$/.test(t):Tr.test(t)?Mr.has(e)||"clip-path"===e:"clip-path"===e?"none"===t:Mr.has(e)?/^(?:[a-z]+|#[a-f\\d]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\\([a-z\\d.\\s,%/+-]+\\))$/i.test(t):Er.includes(e)&&/^[a-z\\d.\\s,%+-]+$/i.test(t)}var jr=class{constructor(){this.ids=new Set,this.references=new Set,this.prefix="pm-svg-"+crypto.randomUUID()+"-"}value(e,t){if("id"===e)return this.ids.has(t)?null:(this.ids.add(t),this.prefix+t);let n=Tr.exec(t)?.[1];return n?(this.references.add(n),"url(#"+this.prefix+n+")"):t}complete(){return[...this.references].every(e=>this.ids.has(e))}},Ir=new Set("article section aside header footer div span h1 h2 h3 h4 h5 h6 p strong em b i small blockquote ul ol li button br picture img figure figcaption code pre".split(" ")),zr={color:"color",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",letterSpacing:"letter-spacing",visibility:"visibility",fill:"fill",stroke:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset"},Lr=new Set(["div","article","section","aside","figure"]),Pr=new Set(["width","height","max-width","max-height","min-width","min-height","transform","transform-origin","grid-template-columns","grid-template-rows",...nr]);function Nr(e,t){let n=e.getBoundingClientRect(),r=(e,r)=>{let i=t.getPropertyValue(e);return i.endsWith("px")?parseFloat(i)+("border-box"===t.boxSizing?0:r.reduce((e,n)=>e+(parseFloat(t.getPropertyValue("padding-"+n))||0)+(parseFloat(t.getPropertyValue("border-"+n+"-width"))||0),0)):n[e]};return{previewWidth:r("width",["left","right"]),previewHeight:r("height",["top","bottom"])}}function _r(e){let t=e.ownerDocument.defaultView,n=0,r=function e(r,i,o,a){if(!t)throw new Error("The source page is no longer available.");if(i>16||++n>256)throw new Error("This subtree is too large to place in one draft.");let l=o?void 0:gr(r),s=o??(l||r.namespaceURI!==Sr||"svg"!==r.localName?void 0:new jr);if(s?r.namespaceURI!==Sr||!kr.has(r.localName):!function(e){return e.hasAttribute("data-popmelt-sample-version")||("http://www.w3.org/1999/xhtml"===e.namespaceURI&&Ir.has(e.localName)||e.namespaceURI===Sr&&"svg"===e.localName)&&!e.shadowRoot}(r))throw new Error(`<${r.localName}> content cannot be placed as an HTML draft.`);let u=t.getComputedStyle(r),c=r.computedStyleMap?.(),d=e=>c?.get(e)?.toString()||u.getPropertyValue(e),h=o?{}:Object.fromEntries(er.map(e=>[e,u.getPropertyValue(e)]).filter(([,e])=>!!e));for(let[e,t]of Object.entries(o?{}:tr)){let n=Pr.has(e)?d(e):u.getPropertyValue(e);n&&n!==t&&(h[e]=n)}let p,f=o?void 0:function(e,t){let n=/^url\\("(data:image\\/[^"]+)"\\)$/.exec(t)?.[1];if(!n)return;if(br(n))return n;let r=wr.get(e);if(r?.src===n){if(r.pixels)return r.pixels;if(r.failed)throw Error("This background image could not be sampled.")}else{let t={src:n};wr.set(e,t);let r=e.ownerDocument.createElement("img");r.src=n,r.decode().then(()=>{t.pixels=xr(r)}).catch(()=>{t.failed=!0}).finally(()=>e.ownerDocument.dispatchEvent(new Event("popmelt-sample-ready")))}throw Error("Loading this image for sampling.")}(r,u.backgroundImage);if(f)for(let e of ir)h[e]=u.getPropertyValue(e);if(s&&(p=function(e,t,n){let r={};for(let t of e.attributes){let{name:e,value:n}=t;if("href"===e||"href"===t.localName)throw new Error("This SVG references other artwork.");(Cr.has(e)||"id"===e||"aria-label"===e||"aria-hidden"===e)&&(r[e]=n)}for(let n of["filter","mask-image","marker-start","marker-mid","marker-end"]){let r=t.getPropertyValue(n)||e.getAttribute(n);if(r&&"none"!==r)throw new Error("This SVG uses an unsupported effect.")}if("rect"===e.localName||"svg"===e.localName)for(let n of["width","height"]){let i=e.computedStyleMap?.().get(n)?.toString()||t.getPropertyValue(n);i&&"auto"!==i&&(r[n]=i)}for(let n of Er){let i=t.getPropertyValue(n)||e.getAttribute(n);i&&(r[n]=i)}for(let[e,t]of Object.entries(r))if(!Rr(e,t)||null===n.value(e,t))throw new Error("This SVG uses an unsupported paint or shape.");return r}(r,u,s)),!l&&"img"===r.localName){let e=r;p={src:xr(e),alt:e.alt}}if(!l&&!o&&("img"===r.localName||s))for(let e of rr){let t=u.getPropertyValue(e);t&&(!Pr.has(e)||"img"===r.localName&&"auto"===d(e))&&(h[e]=t)}if(!o&&("relative"===u.position||i>0&&"absolute"===u.position)){h.position=u.position;for(let e of nr){let t=d(e);t&&"auto"!==t&&(h[e]=t)}"absolute"===h.position&&u.clip&&"auto"!==u.clip&&(h.clip=u.clip)}if(l)return{tag:Lr.has(r.localName)?r.localName:"div",style:h,children:[],component:l,backgroundStill:f,...Nr(r,u)};let m=function(e){let t=[];for(let n of e.getAnimations?.()??[]){if(!("animationName"in n)&&"popmelt-sampled-motion"!==n.id)continue;let r=n.effect;if(r?.target!==e||r.pseudoElement||"finished"===n.playState)continue;let i=r.getTiming(),o=r.getKeyframes().map(e=>{let t={offset:e.computedOffset,easing:e.easing??"linear"};for(let[n,r]of Object.entries(e))or.has(n)&&yr(r)&&(t[n]=r);return t});o.some(e=>Object.keys(e).length>2)&&t.push({frames:o,currentTime:"number"==typeof n.currentTime?n.currentTime:void 0,paused:"paused"===n.playState,timing:{duration:Number(i.duration),delay:i.delay??0,endDelay:i.endDelay??0,iterations:i.iterations===1/0?"infinite":i.iterations??1,direction:i.direction??"normal",fill:i.fill??"none",easing:i.easing??"linear"}})}if(t.length){if(!function(e){return Array.isArray(e)&&e.length<=8&&e.every(e=>{let t=e?.timing;return!!(!(!t||"boolean"!=typeof e.paused||void 0!==e.currentTime&&!Number.isFinite(e.currentTime)||!Array.isArray(e.frames)||!e.frames.length||e.frames.length>64||!Number.isFinite(t.duration)||t.duration<0)&&Number.isFinite(t.delay)&&Number.isFinite(t.endDelay)&&("infinite"===t.iterations||Number.isFinite(t.iterations)&&t.iterations>=0)&&["normal","reverse","alternate","alternate-reverse"].includes(t.direction)&&["auto","none","forwards","backwards","both"].includes(t.fill)&&yr(t.easing))&&e.frames.every((t,n)=>t&&Number.isFinite(t.offset)&&t.offset>=(e.frames[n-1]?.offset??0)&&t.offset<=1&&yr(t.easing)&&Object.entries(t).every(([e,t])=>"offset"===e||"easing"===e||or.has(e)&&yr(t)))})}(t))throw Error("This animation is too complex to sample.");return t}}(r),g=new Set;if(a)for(let e of a.properties){let t=u.getPropertyValue(e),n=r.style.getPropertyValue(e)||(s?r.getAttribute(e):null);t!==a.css.getPropertyValue(e)||n&&"inherit"!==n?t&&Object.hasOwn(tr,e)&&(h[e]=t):(g.add(e),e in h&&(h[e]="inherit"),p&&e in p&&(p[e]="inherit"))}for(let e of m??[])for(let t of e.frames)for(let e of Object.keys(t)){let t=zr[e];t&&g.add(t)}let y=g.size?{css:u,properties:g}:void 0,v=[];for(let t of r.childNodes){if(3===t.nodeType&&t.textContent&&v.push(t.textContent),1!==t.nodeType)continue;let n=t;n.matches("[data-devtools],[data-popmelt-root],[data-popmelt-shadow-host]")||"picture"===r.localName&&"source"===n.localName||v.push(e(n,i+1,s,y))}if(s&&!o&&!s.complete())throw new Error("This SVG references artwork outside the sample.");return o?{tag:r.localName,style:h,children:v,attributes:p,motion:m}:{tag:r.localName,motion:m,backgroundStill:f,attributes:p,style:h,children:v,..."img"===r.localName&&{imageSourceHash:Dr(r)},...0===i?Nr(r,u):{}}}(e,0);if(JSON.stringify(r).length>65536)throw new Error("This subtree is too large to place in one draft.");return r}function Dr(e){let t=e.getAttribute("src")||e.getAttribute("srcset");return t?lr(t):void 0}new Set("main article section aside div ul ol body header footer nav".split(" "));var Fr=c(h()),Or=c(h()),$r=[4,2],Hr=$r.join(" "),Wr=$r[0]+$r[1],Br=c(h()),Vr=c(h()),qr=(0,c(h()).createContext)(null);function Ur(e=22){return{height:e,minHeight:e,maxHeight:e,boxSizing:"border-box",flexShrink:0}}var Yr=c(b());function Xr({threadId:e,color:t,size:n}){let r=(0,Vr.useContext)(qr);if(!e||r?.preview?.threadId!==e)return null;let i=r.preview.enabled;return(0,Yr.jsx)("button",{type:"button","data-devtools":"explore-preview-badge","aria-label":"Preview option on page","aria-pressed":i,title:i?"Turn off page preview":"Preview option on page",onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),r.setPreview(t=>t&&t.threadId===e?{...t,enabled:!t.enabled,revealOnPage:!1}:t)},style:{...Ur(n),appearance:"none",width:28,minWidth:28,padding:0,margin:0,border:0,display:"grid",placeItems:"center",cursor:"pointer",backgroundColor:t,color:"#fff",borderRadius:8,opacity:i?1:.5},children:(0,Yr.jsx)(ne,{size:12,strokeWidth:2.25})})}function Kr(e,t){let n=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","svg"),{x:r,y:i,width:o,height:a}=lt(e);return n.setAttribute("viewBox",[r,i,o,a].join(" ")),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("aria-hidden","true"),n.setAttribute("data-devtools",t),n.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none",n}function Qr(e,t,n,r,i){if(!e.closest("[data-popmelt-hover-painter]"))return;let o=new AbortController,a=new CustomEvent("popmelt:paint-annotation",{bubbles:!0,cancelable:!0,detail:{signal:o.signal,setHitArea:i,createOverlay(e,i){let o=Kr(i,"painted-annotation"),a=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",Vt(e)),a.setAttribute("fill",n?t:"none"),a.setAttribute("fill-opacity",String(n)),a.setAttribute("stroke",t),a.setAttribute("stroke-width",String(1)),a.setAttribute("vector-effect","non-scaling-stroke"),a.setAttribute("stroke-linejoin","round"),"solid"!==r&&a.setAttribute("stroke-dasharray",Hr),"marching"===r&&a.setAttribute("data-popmelt-marching-stroke","true"),o.append(a),o}}});if(!e.dispatchEvent(a))return o;o.abort()}var Zr=c(h()),Gr=new WeakMap,Jr=0,ei="popmelt-scroll-anchor",ti="popmelt-page-paint";function ni(e){if(!(e instanceof HTMLElement&&e.getRootNode()===document&&globalThis.CSS?.supports?.("top","anchor(top)")))return;let t=Gr.get(e);if(!t){let n=getComputedStyle(e).getPropertyValue("anchor-name");if(n&&"none"!==n)return;let r="--popmelt-target-"+ ++Jr;t={name:r,users:0,previous:e.style.getPropertyValue("anchor-name"),priority:e.style.getPropertyPriority("anchor-name")},Gr.set(e,t),e.style.setProperty("anchor-name",r)}let n=t;return n.users++,{name:n.name,element:e,release(){--n.users||(Gr.delete(e),e.style.getPropertyValue("anchor-name")===n.name&&e.style.setProperty("anchor-name",n.previous,n.priority))}}}function ri(e){let[t,n]=(0,Zr.useState)();return(0,Zr.useLayoutEffect)(()=>{let t=ni(e);return n(t),t?.release},[e]),t&&t.element===e?t.name:void 0}function ii(e,t,n,r){return e?{"--popmelt-anchor":e,positionAnchor:e,left:`calc(anchor(left, ${t.left}px) + ${n-t.left}px)`,top:`calc(anchor(top, ${t.top}px) + ${r-t.top}px)`}:{left:n,top:r}}var oi=(0,c(h()).createContext)(!0);function ai(e){return"bottom-left"===e?[2,8,8,8]:"bottom-right"===e?[8,2,8,8]:"top-right"===e?[8,8,2,8]:[8,8,8,2]}function li(e){return ai(e).map(e=>`${e}px`).join(" ")}var si=1.1666666666666667;function ui(e){return e.length>2048?`${e.slice(0,2048)}…`:e}var ci=Le;function di(e){let t=window.innerWidth-e-16;return Math.max(60,Math.min(400,t))}function hi(e,t,n){let r=ui(t);if(r===t&&e.measureText(r).width<=n)return r;let i="…",o=0,a=r.endsWith(i)?r.length-1:r.length;for(;o<a;){let t=Math.ceil((o+a)/2);e.measureText(r.slice(0,t)+i).width<=n?o=t:a=t-1}return o>0?r.slice(0,o)+i:i}function pi(e,t,n,r,i){let o=0,a=typeof window<"u"?window.innerHeight:9999;n&&function(e,t,n){if(void 0===e||void 0===t||void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(r,i,n)&&(o=n.avoidTop??o,a=n.avoidBottom??a);let l=Math.max(o,a-t);return Math.max(o,Math.min(e,l))}function fi(e,t=12,n,r){let i=t*si+8,o=e.y-4,a=pi(o,i,n,e.x-8,r);return a===o?e:{...e,y:a+4}}var mi,gi=new Set;function yi(e){if(gi.add(e),!mi){let e=new Map,t=new Map,n="",r=!0,i=!0,o=!1,a=!0,l=0,s=()=>{let n=new Set,o=new Map,a=t=>{if(n.add(t),!e.has(t)){let n=new MutationObserver(e=>{let t=e.filter(e=>!(1===e.target.nodeType?e.target:e.target.parentElement)?.closest("[data-devtools]"));t.length&&(r=!0),t.some(e=>"childList"===e.type)&&(i=!0)});n.observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});let o=()=>{r=!0};t.addEventListener("scroll",o,!0),t.addEventListener("load",o,!0),e.set(t,()=>{n.disconnect(),t.removeEventListener("scroll",o,!0),t.removeEventListener("load",o,!0)})}for(let e of t.querySelectorAll("*")){if(e.shadowRoot&&!e.closest("[data-devtools]")&&a(e.shadowRoot),"iframe"!==e.localName||e.closest("[data-devtools],[data-popmelt-peer-surface]"))continue;let t=it(e);o.set(e,t),t&&a(t)}};a(document);for(let[t,r]of e)n.has(t)||(r(),e.delete(t));t=o,i=!1,r=!0},u=()=>{if(!a)return;(i||[...t].some(([e,t])=>it(e)!==t))&&s();let e=[];for(let[n,r]of t){let t=n.getBoundingClientRect();e.push(r?.URL,t.x,t.y,t.width,t.height,r?.defaultView?.scrollX,r?.defaultView?.scrollY)}let c=JSON.stringify(e);if((r||c!==n)&&(r=!1,n=c,o))for(let e of gi)e();o=!0,a&&(l=requestAnimationFrame(u))};u(),mi=()=>{a=!1,cancelAnimationFrame(l);for(let t of e.values())t()}}return()=>{gi.delete(e),gi.size||(mi?.(),mi=void 0)}}function vi(e){let t=window.getComputedStyle(e).display;return"flex"===t||"inline-flex"===t||"grid"===t||"inline-grid"===t}function xi(e){let t=window.getComputedStyle(e);return{row:parseFloat(t.rowGap)||0,column:parseFloat(t.columnGap)||0}}function bi(e){let t=Array.from(e.children).filter(e=>{if(!(e instanceof HTMLElement))return!1;let t=window.getComputedStyle(e);return"none"!==t.display&&"absolute"!==t.position&&"fixed"!==t.position});if(t.length<2)return[];let n=[],r=e.getBoundingClientRect(),i=window.getComputedStyle(e).flexDirection,o="column"===i||"column-reverse"===i;for(let e=0;e<t.length-1;e++){let i=t[e].getBoundingClientRect(),a=t[e+1].getBoundingClientRect();if(a.left>i.right+.5&&n.push({axis:"column",x:i.right,y:r.top,w:a.left-i.right,h:r.height}),a.top>i.bottom+.5&&n.push({axis:"row",x:r.left,y:i.bottom,w:r.width,h:a.top-i.bottom}),!(a.left>i.right+.5||a.top>i.bottom+.5))if(o){let e=(i.bottom+a.top)/2;n.push({axis:"row",x:r.left,y:e-3,w:r.width,h:6})}else{let e=(i.right+a.left)/2;n.push({axis:"column",x:e-3,y:r.top,w:6,h:r.height})}}return function(e){let t=[];for(let n of e){let e=t.find(e=>e.axis===n.axis&&("row"===n.axis?Math.abs(e.y-n.y)<2&&Math.abs(e.h-n.h)<2:Math.abs(e.x-n.x)<2&&Math.abs(e.w-n.w)<2));if(e)if("row"===n.axis){let t=Math.min(e.x,n.x),r=Math.max(e.x+e.w,n.x+n.w);e.x=t,e.w=r-t}else{let t=Math.min(e.y,n.y),r=Math.max(e.y+e.h,n.y+n.h);e.y=t,e.h=r-t}else t.push({...n})}return t}(n)}function wi(e,t){let n=window.getComputedStyle(e),r=n.display;if("flex"!==r&&"inline-flex"!==r)return!1;let i=n.justifyContent;if("space-between"!==i&&"space-around"!==i&&"space-evenly"!==i&&"stretch"!==i)return!1;let o=n.flexDirection;return!(t!==("column"===o||"column-reverse"===o?"row":"column")||parseFloat("row"===t?n.rowGap:n.columnGap)>0)}function Si(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.paddingTop)||0,right:parseFloat(t.paddingRight)||0,bottom:parseFloat(t.paddingBottom)||0,left:parseFloat(t.paddingLeft)||0}}function ki(e){let t=window.getComputedStyle(e);return{top:parseFloat(t.marginTop)||0,right:parseFloat(t.marginRight)||0,bottom:parseFloat(t.marginBottom)||0,left:parseFloat(t.marginLeft)||0}}function Ci(e){let t=window.getComputedStyle(e);return{topLeft:t.borderTopLeftRadius,topRight:t.borderTopRightRadius,bottomRight:t.borderBottomRightRadius,bottomLeft:t.borderBottomLeftRadius}}function Mi(e){let t=window.getComputedStyle(e);return{"top-left":parseFloat(t.borderTopLeftRadius)||0,"top-right":parseFloat(t.borderTopRightRadius)||0,"bottom-right":parseFloat(t.borderBottomRightRadius)||0,"bottom-left":parseFloat(t.borderBottomLeftRadius)||0}}function Ei(e){for(let t of e.childNodes)if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim().length>0)return!0;return!1}function Ti(e){let t=document.createRange(),n=!1;for(let r of e.childNodes)r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim().length>0&&(n||(t.setStart(r,0),n=!0),t.setEnd(r,r.textContent?.length??0));if(!n)return null;let r=t.getBoundingClientRect(),i=window.getComputedStyle(e),o=parseFloat(i.fontSize)||16,a=parseFloat(i.lineHeight);isNaN(a)&&(a=1.2*o);let l=Math.max(1,t.getClientRects().length),s=Math.max(r.height,l*a),u=(s-r.height)/2;return new DOMRect(r.x,r.y-u,r.width,s)}function Ai(e){let t=window.getComputedStyle(e),n=parseFloat(t.fontSize)||16,r=parseFloat(t.lineHeight);return isNaN(r)&&(r=1.2*n),{fontSize:n,lineHeight:r}}function Ri(e){return e.left+e.width}function ji(e){return e.top+e.height}function Ii(e,t){if(0===e.length)return t;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top));return{left:n,top:r,width:Math.max(...e.map(Ri))-n,height:Math.max(...e.map(ji))-r}}function zi(e){let t=[...e].sort((e,t)=>e.top-t.top||e.left-t.left),n=[];for(let e of t){let t=e.top+e.height/2,r=n.find(n=>{let r=n.top+n.height/2;return Math.abs(t-r)<=.4*Math.max(n.height,e.height)});if(!r){n.push({...e});continue}let i=Math.min(r.left,e.left),o=Math.min(r.top,e.top),a=Math.max(Ri(r),Ri(e)),l=Math.max(ji(r),ji(e));r.left=i,r.top=o,r.width=a-i,r.height=l-o}return n.sort((e,t)=>e.top-t.top||e.left-t.left)}function Li(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function Pi(e,t,n){let r=e.caretPositionFromPoint?.(t,n);if(r?.offsetNode.nodeType===Node.TEXT_NODE)return{node:r.offsetNode,offset:r.offset};let i=e.caretRangeFromPoint?.(t,n);return i?.startContainer.nodeType===Node.TEXT_NODE?{node:i.startContainer,offset:i.startOffset}:null}function Ni(e,t){let n=Di(e),r=n.find(e=>e.textNode===t)??n[0];if(!r)return null;let i=ut(e).getComputedStyle(e),{textRect:o,...a}=$i(n,e,i);return{...r,targetElement:e,segments:n,originalText:n.map(e=>e.originalText).join(""),styles:i,rect:o,...a,fontSize:parseFloat(i.fontSize)||12,wrapsText:"nowrap"!==i.whiteSpace&&"pre"!==i.whiteSpace}}function _i(e,t){let n=[],r=t;for(;r&&r!==e;){let e=r.parentNode;if(!e)return null;n.unshift(Array.prototype.indexOf.call(e.childNodes,r)),r=e}return r===e?n:null}function Di(e){let t=[],n=r=>{if(r.nodeType===Node.TEXT_NODE){let n=r,i=_i(e,n);return void(i&&t.push({textNode:n,textNodePath:i,originalText:n.nodeValue??""}))}if(r.nodeType!==Node.ELEMENT_NODE&&r!==e)return;let i=r.tagName?.toLowerCase();"script"===i||"style"===i||r.childNodes.forEach(n)};return e.childNodes.forEach(n),t}function Fi(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function Oi(e){let t=e.getBoundingClientRect(),n=ut(e).getComputedStyle(e),r=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.paddingLeft)||0),i=(parseFloat(n.borderRightWidth)||0)+(parseFloat(n.paddingRight)||0),o=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.paddingTop)||0),a=(parseFloat(n.borderBottomWidth)||0)+(parseFloat(n.paddingBottom)||0);return at({left:t.left+r,top:t.top+o,width:Math.max(0,t.width-r-i),height:Math.max(0,t.height-o-a)},e.ownerDocument)}function $i(e,t,n,r=!1){let i=Fi(lt(t)),o=function(e){let t=[];for(let n of e){if(!n.textNode.isConnected||!n.originalText.trim())continue;let e=n.textNode.ownerDocument.createRange();e.selectNodeContents(n.textNode),t.push(...Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>Fi(at(e,n.textNode.ownerDocument)))),e.detach?.()}return zi(t)}(e),a=e[0]?.textNode?function(e,t){let n=e.ownerDocument.createRange();n.selectNodeContents(e);let r=at(n.getBoundingClientRect(),e.ownerDocument);if(n.detach?.(),r.width>0&&r.height>0)return{left:r.left,top:r.top,width:r.width,height:r.height};let i=lt(t);return{left:i.left,top:i.top,width:i.width,height:i.height}}(e[0].textNode,t):i,l=o.length>0?o:[a];return function({display:e,singleTextNode:t=!1,fragmentRects:n,elementRect:r,parentContentRect:i}){let o=zi(n),a=Ii(o,r);if(!("inline"===e&&o.length>1&&i&&i.width>0))return{textRect:a,boundaryRect:t?a:r,boundaryRects:t?o:[r],firstLineIndent:0};let l=o[0],s={left:i.left,top:l.top,width:i.width,height:Math.max(a.height,ji(a)-l.top)},u=Math.max(0,Math.min(s.width,l.left-s.left));return{textRect:a,boundaryRect:Ii(o,r),boundaryRects:o,flowRect:s,firstLineIndent:u}}({display:n.display,singleTextNode:r,fragmentRects:l,elementRect:i,parentContentRect:t.parentElement?Oi(t.parentElement):void 0})}function Hi(e,t,n){if(t===n||0===e.length)return[];let r=0;for(;r<t.length&&r<n.length&&t[r]===n[r];)r+=1;let i=0;for(;i<t.length-r&&i<n.length-r&&t[t.length-1-i]===n[n.length-1-i];)i+=1;let o=r,a=t.length-i,l=n.slice(r,n.length-i),s=0,u=!1;return e.flatMap((t,n)=>{let r=s,i=r+t.originalText.length;s=i;let c=o===a;if(!(c&&(o>=r&&o<i||n===e.length-1&&o===i)||!c&&i>o&&r<a))return[];let d=Math.max(0,Math.min(t.originalText.length,o-r)),h=Math.max(0,Math.min(t.originalText.length,a-r)),p=t.originalText.slice(0,d);return u||(p+=l,u=!0),p+=t.originalText.slice(h),p===t.originalText?[]:[{segment:t,modifiedText:p}]})}function Wi(e,t){return Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}var Bi=new WeakMap;function Vi(e){let t=e.closest("p");return t?Bi.get(t):void 0}function qi(e){let t=Di(e);return{root:e,rows:[e],runs:t.map(e=>[e.textNode]),paths:t.map(e=>e.textNodePath),undo:[]}}function Ui(e){let t=Bi.get(e)??qi(e),n=t.runs.map((e,n)=>({path:t.paths[n],parts:e.map(e=>e.data)}));return{group:t,layout:n}}function Yi(e,t,n){let r=t.splitText(n),i=r,o=t.parentElement;for(;;){let n=o,r=o.cloneNode(!1);for(r.removeAttribute("id"),r.removeAttribute("data-pm");i.nextSibling;)r.appendChild(i.nextSibling);if(r.insertBefore(i,r.firstChild),n.after(r),e.undo.push(e=>{if(!e?.has(n)||n.contains(t))for(;r.firstChild;)n.appendChild(r.firstChild);r.remove()}),"P"===o.tagName){r.dataset.popmeltParagraphContinuation="",e.rows.splice(e.rows.indexOf(n)+1,0,r),Bi.set(r,e);break}i=r,o=n.parentElement}return r}function Xi(e,t){let n=Bi.get(e);if(n&&n.root===e){for(let e of n.rows)e.querySelector("br[data-popmelt-empty-paragraph]")?.remove(),Bi.delete(e);for(let e of n.undo.reverse())e(t)}}function Ki(e,t){if("P"!==e.tagName)return;let n=Bi.get(e);if((!n||n.root===e)&&(n&&!n.runs.every((e,n)=>e.length===t[n]?.parts.length)&&(Xi(e),n=void 0),n??=qi(e),n.paths.length===t.length&&t.every((e,t)=>e.parts.length&&e.path.join(".")===n.paths[t].join(".")))){if(!Bi.has(e)){Bi.set(e,n);for(let e=0;e<t.length;e++){let r=n.runs[e],i=r[0],o=i.data;n.undo.push(e=>{e?.has(i)||(i.data=o);for(let e of r.slice(1))e.remove()});let a=t[e].parts;for(let e=1;e<a.length;e++){let t=r[e-1];r.push(Yi(n,t,t.length))}}}n.runs.forEach((e,n)=>e.forEach((e,r)=>{let i=t[n].parts[r];e.data!==i&&(e.data=i)}));for(let e of n.rows){let t=e.querySelector("br[data-popmelt-empty-paragraph]");if(e.textContent||t||e.querySelector("br,img,svg,input"))e.textContent&&t&&t.remove();else{let t=e.ownerDocument.createElement("br");t.dataset.popmeltEmptyParagraph="",e.appendChild(t)}}return n.lastLayout=t,n}}var Qi=new WeakMap,Zi=new WeakMap;function Gi(e,t){return Tt(e)&&(Qi.get(e)?.has(t)??!1)}function Ji(e){let t=e.sticker;return t?"padding"===t.family||"margin"===t.family?"all"===t.subproperty?10:"x"===t.subproperty||"y"===t.subproperty?20:30:"radius"===t.family||"border"===t.family?"all"===t.subproperty?10:20:10:0}function eo(e){return e.changes.map((e,t)=>({change:e,index:t})).sort((e,t)=>Ji(e.change)-Ji(t.change)||e.index-t.index).map(({change:e})=>e)}function to(e,t,n){if(Tt(e)){let r=Zi.get(e);r||(r=new Map,Zi.set(e,r)),r.has(t)||r.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,n,"important")}}function no(e,t,n,r=!1){if(Tt(e)){let n=r?Zi.get(e)?.get(t):void 0;n?.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t),Zi.get(e)?.delete(t)}}function ro(e){let t=An(e.selector);if(!t&&e.durableSelector&&(t=An(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function io(e){for(let t of e){let e=ro(t);if(e)for(let n of eo(t))Gi(e,n.property)||to(e,n.property,n.modified)}}function oo(e,t=!1){for(let n of e){let e=An(n.selector);if(e)for(let r of n.changes)Gi(e,r.property)||no(e,r.property,r.original,t)}}function ao(e){let t=An(e.selector);if(!t&&e.durableSelector&&(t=An(e.durableSelector),t)){let n=e.selector.match(/\\[data-pm="([^"]+)"\\]/)?.[1];n&&t.setAttribute("data-pm",n)}return t}function lo(e,t){let n=e;for(let e of t)n=n?.childNodes[e]??null;return n?.nodeType===Node.TEXT_NODE?n:null}function so(e){for(let t of[...e].reverse()){if(t.captured)continue;let e=ao(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){Xi(e),t.paragraphs.before.some(e=>e.parts.length>1)&&Ki(e,t.paragraphs.before);continue}let n=lo(e,t.textNodePath);n&&n.nodeValue===t.modified&&n.nodeValue!==t.original&&(n.nodeValue=t.original)}}function uo(e,t){return"text"===e.type&&(e.groupId?t.filter(t=>t.groupId===e.groupId):[e]).every(e=>"pending"===(e.status??"pending")&&!e.threadId)}var co=(0,c(h()).createContext)(0),ho="\\n 0%, 100% { translate: 0 0; }\\n 20% { translate: -4px 0; }\\n 45% { translate: 4px 0; }\\n 70% { translate: -2px 0; }\\n 88% { translate: 1px 0; }\\n";function po(e,t,n){let r=e.points[0];if(typeof window>"u"||"text"!==e.type||!r)return!0;let i=e.region?.points,o=i?.length?function(e){if(0===e.length)return{x:0,y:0,width:0,height:0};let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.min(...t),i=Math.max(...t),o=Math.min(...n);return{x:r,y:o,width:i-r,height:Math.max(...n)-o}}(i):{...r,width:0,height:0};return o.x+o.width>=t&&o.y+o.height>=n&&o.x<t+window.innerWidth&&o.y<n+window.innerHeight}function fo(e){return`\\n<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">\\n <defs>\\n <mask id="cutout">\\n <rect width="100%" height="100%" fill="white" />\\n <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="${e.radius}" fill="black" />\\n </mask>\\n </defs>\\n <rect width="100%" height="100%" fill="white" mask="url(#cutout)" />\\n</svg>`}function mo(e){return`url("data:image/svg+xml,${encodeURIComponent(e)}")`}var go=mo(fo({x:-100,y:-2,width:104,height:26,radius:10})),yo=mo(fo({x:-100,y:-5.929,width:108,height:26,radius:10}));function vo(e,t,n,r=.5){let i=Math.max(0,e-2*r),o=Math.max(0,t-2*r),a=function(e,t,n){let r=Math.max(0,n.topLeft),i=Math.max(0,n.topRight),o=Math.max(0,n.bottomRight),a=Math.max(0,n.bottomLeft),l=Math.min(1,e/Math.max(1,r+i),e/Math.max(1,a+o),t/Math.max(1,r+a),t/Math.max(1,i+o));return{topLeft:r*l,topRight:i*l,bottomRight:o*l,bottomLeft:a*l}}(e,t,n),l=Math.max(0,a.topLeft-r),s=Math.max(0,a.topRight-r),u=Math.max(0,a.bottomRight-r),c=Math.max(0,a.bottomLeft-r),d=r+i,h=r+o;return[`M ${r+l} ${r}`,"H "+(d-s),`A ${s} ${s} 0 0 1 ${d} ${r+s}`,"V "+(h-u),`A ${u} ${u} 0 0 1 ${d-u} ${h}`,`H ${r+c}`,`A ${c} ${c} 0 0 1 ${r} ${h-c}`,`V ${r+l}`,`A ${l} ${l} 0 0 1 ${r+l} ${r}`,"Z"].join(" ")}var xo=c(b()),bo=12;function wo(e){return e>0?16+7.2*String(e).length+16:0}function So({stepCount:e,onClear:t,layered:n=!1,submitted:r=!1,style:i}){let[o]=Ke(),a=We[o];if(e<1)return null;let l=`${e} recorded ${1===e?"action":"actions"}${r?", sent":""}`;return(0,xo.jsxs)("span",{"data-devtools":"interaction-episode-badge","data-popmelt-submitted":r?"true":void 0,"aria-label":l,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t?.()},style:{height:22,display:"inline-flex",alignItems:"center",boxSizing:"border-box",backgroundColor:r?"#8c8c8c":a.surface,border:`1px solid ${r?"#8c8c8c":a.border}`,borderRadius:8,color:r?"#dddddd":a.primary,fontFamily:ci,fontSize:12,fontWeight:600,padding:n?"0 8px 0 7px":"0 8px 0 5.6px",gap:4,pointerEvents:t?"auto":"none",WebkitMaskImage:n?go:void 0,maskImage:n?go:void 0,...i},children:[(0,xo.jsxs)("svg",{"aria-hidden":!0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,xo.jsx)("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),(0,xo.jsx)("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),(0,xo.jsx)("span",{children:e})]})}function ko(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(t,n,e)?e:{}}function Co(e,t,n){return`translate(min(0px, calc(100vw - ${e} - 100%)), min(max(0px, calc(${void 0!==n.avoidTop?`${n.avoidTop}px`:"0px"} - ${t})), calc(${void 0!==n.avoidBottom?`${n.avoidBottom}px`:"100dvh"} - ${t} - 100%)))`}function Mo(e,t,n){if(void 0===n.avoidTop&&void 0===n.avoidBottom)return e;let r=typeof window<"u"?window.innerHeight:9999,i=n.avoidTop??0,o=n.avoidBottom??r,a=Math.max(i,o-t);return Math.max(i,Math.min(e,a))}function Eo({left:e,top:t,scrollX:n,scrollY:r,avoidTop:i,avoidBottom:o,style:a,children:l,...s}){let u=`calc(${e}px - var(--popmelt-scroll-x, ${n}px))`,c=`calc(${t}px - var(--popmelt-scroll-y, ${r}px))`,d=`calc(${e+bo}px - var(--popmelt-scroll-x, ${n}px))`,h=`calc(${t+bo}px - var(--popmelt-scroll-y, ${r}px))`;return(0,xo.jsx)("div",{"data-devtools":"badge-hit-area",...s,style:{position:"fixed",left:0,top:0,padding:bo,...a,transform:`translate3d(${u}, ${c}, 0)`,willChange:"transform"},children:(0,xo.jsx)("div",{style:{transform:Co(d,h,{avoidTop:i,avoidBottom:o})},children:l})})}function To({bundleCount:e,style:t,layered:n=!1,compact:r=!1,description:i,replacementText:o,actionLabel:a,actionIcon:l,shortcut:s,onHoverChange:u,onSend:c}){let[d,h]=(0,Br.useState)(!1),[p]=Ke(),f=We[p],m=(0,Br.useContext)(co),g=(0,Br.useId)(),y=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl",v=Math.max(1,e),x=r&&!d,b=e=>x?(0,xo.jsx)(ge,{size:12,strokeWidth:2,"aria-hidden":!0}):e?(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:v>1?`Send all ${v}`:"Send"}),(0,xo.jsx)(ge,{size:12,strokeWidth:2,"aria-hidden":!0})]}):(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[(0,xo.jsx)("span",{children:y}),(0,xo.jsx)("span",{children:"+"}),(0,xo.jsx)(te,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,xo.jsx)("span",{style:{color:f.secondary,fontWeight:600},children:"to"}),(0,xo.jsx)(ge,{size:12,strokeWidth:2,"aria-hidden":!0}),v>1&&(0,xo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:v})]}),w=e=>a?(0,xo.jsxs)(xo.Fragment,{children:[s&&(0,xo.jsxs)("span",{className:"popmelt-action-shortcut","aria-hidden":!0,style:{alignItems:"center",gap:4,fontWeight:500},children:[(0,xo.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:s}),(0,xo.jsx)("span",{style:{color:f.secondary},children:"to"})]}),l,(0,xo.jsx)("span",{style:{fontWeight:500},children:a})]}):(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:b(e)}),(0,xo.jsxs)("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!x&&(0,xo.jsx)("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),(0,xo.jsx)(ge,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),S=o?(0,xo.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}):null,k={...Ur(),lineHeight:"14px",display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:f.surface,border:`1px solid ${f.border}`,fontFamily:ci,fontSize:12,color:a&&!c?f.secondary:f.primary,userSelect:"none",padding:n?"0 8px 0 10px":"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:8,letterSpacing:"0.24px",WebkitMaskImage:n?go:void 0,maskImage:n?go:void 0},C=v>1?`Send all ${v} pending annotations`:"Send pending annotation";return(0,xo.jsxs)("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":m?m%2?"odd":"even":void 0,onMouseEnter:()=>{h(!0),u?.(!0)},onMouseLeave:()=>{h(!1),u?.(!1)},style:{display:"grid",width:"max-content",...t},children:[(0,xo.jsx)("style",{children:`\\n@keyframes popmelt-send-rejection-odd { ${ho} }\\n@keyframes popmelt-send-rejection-even { ${ho} }\\n[data-popmelt-send-rejection="odd"] { animation: popmelt-send-rejection-odd 220ms ease-out; }\\n[data-popmelt-send-rejection="even"] { animation: popmelt-send-rejection-even 220ms ease-out; }\\n@media (prefers-reduced-motion: reduce) {\\n [data-popmelt-send-rejection] { animation: none; }\\n}\\n.popmelt-send-hint-desktop { display: inline-flex; }\\n.popmelt-action-shortcut { display: inline-flex; }\\n@media (hover: none) and (pointer: coarse) {\\n .popmelt-action-shortcut { display: none; }\\n}\\n.popmelt-send-hint-mobile { display: none; }\\n@media (max-width: 767px) {\\n .popmelt-send-hint-desktop { display: none; }\\n .popmelt-send-hint-mobile { display: inline-flex; }\\n}\\n `}),(0,xo.jsx)("div",{"aria-hidden":!0,style:{...k,gridArea:"1 / 1",visibility:"hidden"},children:w(!1)}),(0,xo.jsxs)("button",{type:"button","data-devtools":"annotation-badge","aria-label":a??C,"aria-describedby":i?g:void 0,disabled:!c,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),c?.()},style:{...k,gridArea:"1 / 1",justifySelf:"start",maxWidth:o?"min(320px, calc(100vw - 16px))":void 0,overflow:o?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:c?"pointer":"default",touchAction:"manipulation"},children:[i&&(0,xo.jsx)("span",{id:g,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:i}),S??w(d)]})]})}function Ao({count:e,color:t,size:n=22,onHoverChange:r}){return(0,xo.jsxs)("div",{"data-devtools":"nested-annotation-count-badge",onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),style:{height:n,display:"flex",alignItems:"center",backgroundColor:t,color:"#8c8c8c"===t?"#dddddd":"#ffffff",fontFamily:ci,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:8,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function Ro({scrollX:e,scrollY:t,projected:n,children:r}){let i=(0,Br.useContext)(oi),o=(0,Br.useRef)(null);(0,Br.useLayoutEffect)(()=>{let e=o.current;if(!i||n||!e)return;let t=()=>{e.style.setProperty("--popmelt-scroll-x",`${window.scrollX}px`),e.style.setProperty("--popmelt-scroll-y",`${window.scrollY}px`)};return t(),window.addEventListener("scroll",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),e.style.removeProperty("--popmelt-scroll-x"),e.style.removeProperty("--popmelt-scroll-y")}},[n,i]);let a={"--popmelt-painted-x":`var(--popmelt-scroll-x, ${e}px)`,"--popmelt-painted-y":`var(--popmelt-scroll-y, ${t}px)`,position:"fixed",inset:0,pointerEvents:"none",zIndex:9999};return(0,xo.jsx)("div",{ref:o,part:n?void 0:ti,"data-devtools":"annotation-badge-layer",style:a,children:r})}function jo({annotations:e,supersededAnnotations:t,inFlightIds:n,orientationLabels:r,activeIds:i,queuePositions:o,scrollX:a,scrollY:l,annotationGroupMap:s,onViewThread:u,onSelectAnnotation:c,onDeleteDraftAnnotation:d,onClearInteractionEpisode:h,onHoverAnnotation:p,canvasRef:f,toolbarRef:m,activeBundleAnnotationIds:g,inactiveBundleOpacity:y=.5,animateBundleOpacity:v=!0,hoverRestoredAnnotationIds:x,nestedAnnotationCountById:b,nestedAnnotationIdsById:w,onHoverNestedAnnotations:S,onHoverSendBundle:k,onSend:C,sendHintAnchorId:M,pendingBundleCount:E=1,parentPinnedAnnotationIds:T,parentPinnedLocationLabels:A,parentPinnedTooltipAnnotationId:R,onActivateAnnotation:j,hiddenAnnotationIds:I,displayAnnotations:z,projected:L=!1}){let P=(0,Br.useContext)(qr),N=(0,Br.useContext)(oi),[_,D]=(0,Br.useState)(0),F=!!(n&&n.size>0&&(void 0===i||i.size>0));(0,Br.useEffect)(()=>{if(!F||!N)return;let e=setInterval(()=>{D(e=>(e+1)%3)},250);return()=>{clearInterval(e)}},[F,N]);let O=[],$=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl";for(let o of e){if("text"!==o.type||!o.text||!o.points[0]||t.has(o)||I?.has(o.id))continue;let u=o.groupId?e.filter(e=>e.groupId===o.groupId):[o],c=o.status??"pending",d=E>0&&o.id===M,h=o.interactionEpisode?.steps.length??0,p=b?.get(o.id)??0,m=w?.get(o.id)??[],y=u.reduce((e,t)=>Math.max(e,t.replyCount??0),0),v="sending"===c||u.some(e=>"sending"===e.status),S="awaiting_review"===c,k=!v&&(!(!n||!n.has(o.id)&&!u.some(e=>n.has(e.id)))||"in_flight"===o.status||u.some(e=>"in_flight"===e.status)),C=u.some(e=>"resolved"===e.status&&(e.replyCount??0)>0||"needs_review"===e.status),A=u.some(e=>e.threadId),R=!g||u.some(e=>g.has(e.id)||x?.has(e.id));if(!(d||v||S||k||"resolved"===c||"failed"===c||"needs_review"===c||C||A||h>0)&&0===p)continue;let j=o.threadId||u.find(e=>e.threadId)?.threadId,L="needs_review"===c||u.some(e=>"needs_review"===e.status),P="waiting_input"===c||u.some(e=>"waiting_input"===e.status),N="failed"===c||u.some(e=>"failed"===e.status),_=d||v||S||k||L||P||N||y>0||"resolved"===c&&A||h>0;if(!_&&0===p)continue;let D=o.points[0],F=o.fontSize||12,$=F*si,H=s.get(o.id),W=((z?.find(e=>e.id===o.id)??o).text??o.text).replace(/\\n/g," "),B=void 0!==H?H+". "+W:W,V=f?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!V)continue;V.font=`${F}px ${ci}`;let q=D.x-a,U=T?.has(o.id)?16:0,Y=hi(V,B,Math.max(60,di(q)-U)),X=V.measureText(Y).width,K=k&&!!i&&!i.has(o.id)&&!u.some(e=>i.has(e.id));O.push({id:o.id,threadId:j,visible:po(o,a,l),x:D.x+X+U+8+2,y:D.y-4,size:$+8,color:d?"#000000":o.color,isSending:v,isAwaitingReview:S,isInFlight:k,orientationLabel:r?.get(o.id)??u.map(e=>r?.get(e.id)).find(Boolean),isQueued:K,queuePosition:void 0,isNeedsReview:L,isQuestion:P,isFailed:N,replyCount:y>0?y:"resolved"===c&&A?1:0,isInActiveBundle:R,isSendHint:d,interactionEpisodeStepCount:h,interactionEpisodeSubmitted:"pending"!==c,nestedCount:p,nestedAnnotationIds:m,nestedColor:"pending"===c?o.color:"#8c8c8c",showActionBadge:_,canDeleteDraft:uo(o,e)})}let H=O.filter(e=>e.isQueued);if(H.length>0&&H.forEach((e,t)=>{e.queuePosition=o?.get(e.id)??`(${t+1}/${H.length})`}),0===O.length)return null;let W=f?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),B=O.map(e=>{W&&(W.font=`12px ${ci}`);let t=e.nestedCount>0?(W?.measureText(`+${e.nestedCount}`).width??7.2*String(e.nestedCount).length+7.2)+16:0,n=wo(e.interactionEpisodeStepCount),r=e.threadId&&P?.preview?.threadId===e.threadId?30:0;if(!e.showActionBadge)return t+n+r;let i,o=R===e.id?A?.get(e.id):void 0;i=o||(e.isSendHint?$:e.isSending?"Sending":e.isAwaitingReview?"Awaiting review":e.isInFlight?e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking":e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision");let a=e.isSendHint||o?0:12,l=7.2*i.length;W&&(l=W.measureText(i).width);let s=e.isSendHint&&W?W.measureText("to").width:e.isSendHint?14.4:0,u=e.isSendHint&&W?W.measureText("+").width:e.isSendHint?7.2:0,c=e.isSendHint&&E>1&&W?W.measureText(String(E)).width:e.isSendHint&&E>1?7.2:0;return n+t+(o?Math.min(l+16,320):e.isSendHint?l+u+s+c+16+12+12+4+4*(E>1?3:2):6+a+4+l+8)+2*(+(n>0)+ +(t>0)+1-1)+r}),V=function(e){let t=e?.current?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(m),q=[];for(let e=0;e<O.length;e++){let t=O[e].y-l,n=O[e].x-a,r=ko(V,n,B[e]),i=Mo(t,O[e].size,r),o=i+O[e].size,s=n;for(let t=0;t<e;t++){if(!O[t].visible||!O[e].visible)continue;let n=O[t].y-l,r=ko(V,q[t],B[t]),a=Mo(n,O[t].size,r);if(!(i<a+O[t].size&&o>a))continue;let u=q[t]+B[t];s<u+2&&(s=u+2)}q.push(s)}return(0,xo.jsxs)(Ro,{scrollX:a,scrollY:l,projected:L,children:[(0,xo.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n@media (prefers-reduced-motion: no-preference) {\\n [data-devtools="annotation-badge-layer"] [data-devtools="badge-hit-area"] {\\n transition: opacity 160ms ease-out;\\n }\\n}\\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"]::selection,\\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"] *::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n\'}}),O.map((e,t)=>{let n=!!e.threadId,r=A?.get(e.id),i=!!r&&R===e.id,o=n||!!r,s=!!e.threadId&&P?.preview?.threadId===e.threadId,f=e.showActionBadge&&e.isSendHint||s,m=o&&!f,g=()=>{j?j(e.id,e.threadId):(c?.(e.id),e.threadId&&u?.(e.threadId))},x=ko(V,q[t],B[t]);return(0,xo.jsx)(Eo,{inert:!e.visible||void 0,"aria-hidden":!e.visible||void 0,left:q[t]+a-bo,top:e.y-bo,scrollX:a,scrollY:l,avoidTop:x.avoidTop,avoidBottom:x.avoidBottom,onMouseDown:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.canDeleteDraft&&d&&d(e.id)},onClick:o?e=>{e.stopPropagation(),g()}:void 0,onMouseEnter:()=>{p?.(e.id)},onMouseLeave:()=>{p?.(null)},onFocus:()=>p?.(e.id),onBlur:()=>p?.(null),onKeyDown:m?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())}:void 0,role:m?"button":void 0,tabIndex:m?0:void 0,"aria-label":m&&r?`${r}. Activate to reveal the annotation source${n?" and open its thread":""}`:void 0,style:{position:"absolute",opacity:e.visible?1:0,pointerEvents:e.visible?"auto":"none",cursor:o?"pointer":void 0,zIndex:9999,minWidth:e.isSendHint?B[t]:void 0},children:(0,xo.jsxs)("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[(0,xo.jsx)(So,{stepCount:e.interactionEpisodeStepCount,submitted:e.interactionEpisodeSubmitted,onClear:e.canDeleteDraft&&h?()=>h(e.id):void 0}),e.nestedCount>0&&(0,xo.jsx)(Ao,{count:e.nestedCount,color:e.nestedColor,size:e.size,onHoverChange:t=>S?.(e.id,t?e.nestedAnnotationIds:null)}),(0,xo.jsx)(Xr,{threadId:e.threadId,color:e.color,size:e.size}),e.showActionBadge&&(e.isSendHint?(0,xo.jsx)(To,{bundleCount:E,description:r?`${r}. Activate the annotation label to reveal its source.`:void 0,replacementText:i?r:void 0,onHoverChange:k,onSend:C}):(0,xo.jsx)("div",{"data-devtools":"annotation-badge",style:{...Ur(e.size),display:"flex",alignItems:"center",backgroundColor:e.color,fontFamily:ci,fontSize:12,color:"#ffffff",userSelect:"none",padding:"0 8px 0 6px",gap:4,whiteSpace:"nowrap",maxWidth:i?"min(320px, calc(100vw - 16px))":void 0,overflow:i?"hidden":void 0,borderRadius:8,opacity:e.isInActiveBundle?1:y,transition:v?"opacity 120ms ease-out":"none"},children:i?(0,xo.jsx)("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:r}):e.isAwaitingReview?(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)(G,{size:12,strokeWidth:2.25}),"Awaiting review"]}):e.isQueued?(0,xo.jsxs)("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[(0,xo.jsx)(G,{size:12,strokeWidth:2.25}),"Queued",e.queuePosition?` ${e.queuePosition}`:""]}):e.isSending||e.isInFlight?(0,xo.jsxs)(xo.Fragment,{children:["Approval needed"===e.orientationLabel?(0,xo.jsx)(ce,{size:12,"aria-label":"Approval needed"}):(0,xo.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:1===_?(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,xo.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,xo.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,xo.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,xo.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,xo.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,xo.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,xo.jsx)("span",{style:{opacity:.6,color:"inherit"},children:e.isSending?"Sending":e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking"})]}):(0,xo.jsxs)(xo.Fragment,{children:[e.isQuestion?(0,xo.jsx)(ie,{size:12,strokeWidth:2.25}):e.isFailed?(0,xo.jsx)(be,{size:12,strokeWidth:2.25}):e.replyCount>0?(0,xo.jsx)(pe,{size:12,strokeWidth:2.25}):(0,xo.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,xo.jsx)("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),(0,xo.jsx)("path",{d:"M10 21h4"})]}),(0,xo.jsx)("span",{style:{color:"inherit"},children:e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision"})]})}))]})},e.id)})]})}function Io({d:e,color:t,animated:n}){let r=(0,Br.useRef)(null);return(0,Br.useLayoutEffect)(()=>{let e=r.current;if(!e||"function"!=typeof e.getTotalLength)return;let t=function(e){if(Number.isFinite(e)&&!(e<=0))return Math.max(1,Math.round(e/Wr))*Wr}(e.getTotalLength());void 0===t?e.removeAttribute("pathLength"):e.setAttribute("pathLength",String(t))},[e]),(0,xo.jsx)("path",{ref:r,d:e,fill:"none",stroke:t,strokeWidth:1,strokeDasharray:n?Hr:void 0,"data-popmelt-marching-stroke":n||void 0,style:n?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function zo(){return(0,xo.jsx)("style",{children:`\\n @keyframes popmelt-march {\\n from { stroke-dashoffset: 0; }\\n to { stroke-dashoffset: -${Wr}; }\\n }\\n @media (prefers-reduced-motion: reduce) {\\n [data-popmelt-marching-stroke="true"] { animation: none !important; }\\n }\\n `})}function Lo({annotations:e,activeIds:t,scrollX:n,scrollY:r,spotlightIds:i,emphasizedIds:o,hoverRestoredIds:a,inactiveOpacity:l=.5}){if(!(0,Br.useContext)(oi))return null;let s=e.filter(e=>e.region&&e.region.points.length>=3&&t?.has(e.id));return s.length?(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)(zo,{}),(0,xo.jsx)("svg",{"data-devtools":"marching-lasso","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9995,overflow:"visible"},children:(0,xo.jsx)("g",{transform:`translate(${-n} ${-r})`,children:s.map(e=>{let t=i?.size?i.has(e.id)?1:.2:!o||o.has(e.id)||a?.has(e.id)?1:l;return(0,xo.jsx)("g",{"data-popmelt-region-id":e.id,opacity:t,children:(0,xo.jsx)(Io,{d:`${e.region.points.map((e,t)=>`${t?"L":"M"}${e.x} ${e.y}`).join(" ")} Z`,color:e.color,animated:!0})},e.id)})})})]}):null}var Po=(0,Br.memo)(function({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:n,selectorElementInfo:r}){let i=(0,Br.useContext)(oi),[o,a]=(0,Br.useState)([]);return(0,Br.useEffect)(()=>{if(!i)return;if(0===e.size)return void a([]);let o=null,l=new Map,s=new Map,u=typeof ResizeObserver>"u"?void 0:new ResizeObserver(p),c=!0,d=!1,h=()=>{let n=new Set;c=!1,d=!1;let i=[];for(let[o,a]of e){let e=wn(o,r?.get(o)),h=l.get(o);if(h?.element===e&&e?.closest("[data-popmelt-hover-painter]"))continue;if(h?.paint.abort(),l.delete(o),!e){d=!0,c=!0;continue}let p=e.hasAttribute("data-popmelt-subject-adapter");p&&(d=!0);let f=Qr(e,a,0,t?"marching":"solid");if(f){l.set(o,{element:e,paint:f});continue}let m=p?void 0:s.get(e);!m&&!p&&(m=ni(e),m&&(s.set(e,m),u?.observe(e,{box:"border-box"}))),m?n.add(e):c=!0;let g=lt(e);i.push({selector:o,anchor:m?.name,top:g.top,left:g.left,width:g.width,height:g.height,color:a,radius:Mi(e),radiusStyle:Ci(e)})}for(let[e,t]of s)n.has(e)||(u?.unobserve(e),t.release(),s.delete(e));a(e=>e.length||i.length?i:e)};function p(){null===o&&(o=requestAnimationFrame(()=>{o=null,h()}))}let f=()=>{c&&p()};h(),window.addEventListener("scroll",f,{capture:!0,passive:!0}),window.addEventListener("resize",p,!0);let m=new MutationObserver(t=>{l.size===e.size&&t.every(e=>"attributes"===e.type&&"style"===e.attributeName&&e.target instanceof Element&&e.target.closest("[data-popmelt-hover-painter]"))||p()});m.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let g=n?.subscribeFrame(()=>{d&&h()}),y=[...e.keys()].some(e=>e.startsWith("@frame("))?yi(h):void 0;return()=>{window.removeEventListener("scroll",f,!0),u?.disconnect();for(let e of s.values())e.release();window.removeEventListener("resize",p,!0),m.disconnect();for(let e of l.values())e.paint.abort();g?.(),y?.(),o&&cancelAnimationFrame(o)}},[t,e,n,r,i]),i&&0!==o.length?(0,xo.jsxs)(xo.Fragment,{children:[t&&(0,xo.jsx)(zo,{}),o.map(e=>(0,xo.jsx)("div",{"data-devtools":"marching-ants",part:e.anchor?ei:void 0,style:{position:"fixed",...ii(e.anchor,e,e.left,e.top),width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,overflow:"visible",borderTopLeftRadius:e.radiusStyle.topLeft,borderTopRightRadius:e.radiusStyle.topRight,borderBottomRightRadius:e.radiusStyle.bottomRight,borderBottomLeftRadius:e.radiusStyle.bottomLeft},children:(0,xo.jsx)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:(0,xo.jsx)(Io,{d:vo(e.width,e.height,{topLeft:e.radius["top-left"],topRight:e.radius["top-right"],bottomRight:e.radius["bottom-right"],bottomLeft:e.radius["bottom-left"]}),color:e.color,animated:t})})},e.selector))]}):null},(e,t)=>{if(e.animated!==t.animated||e.subjectRegistry!==t.subjectRegistry||e.inFlightSelectorColors.size!==t.inFlightSelectorColors.size)return!1;let n=e.inFlightSelectorColors.entries();for(let[r,i]of t.inFlightSelectorColors){let o=n.next().value;if(o?.[0]!==r||o[1]!==i||e.selectorElementInfo?.get(r)!==t.selectorElementInfo?.get(r))return!1}return!0}),No=c(b());function _o({reason:e,layered:t}){return(0,No.jsx)(Ie,{hint:e,children:()=>(0,No.jsx)(To,{bundleCount:1,layered:t,actionIcon:(0,No.jsx)(q,{size:12,"aria-hidden":!0,style:{marginInlineEnd:1}}),actionLabel:"Can\'t sample",description:e})})}var Do={explore:"/explore"};var Fo=c(g()),Oo=c(h()),$o=c(h());function Ho(e){return function(){let e=window.__POPMELT_PATH_PATCH__;if(e)return void(e.subscribers+=1);let t=window.history.pushState,n=window.history.replaceState,r=e=>{window.dispatchEvent(new CustomEvent("popmelt:locationchange",{detail:{prevPath:e}}))},i=function(e,n,i){let o=fn(window.location.pathname);t.call(window.history,e,n,i),r(o)},o=function(e,t,i){let o=fn(window.location.pathname);n.call(window.history,e,t,i),r(o)};window.history.pushState=i,window.history.replaceState=o,window.__POPMELT_PATH_PATCH__={subscribers:1,originalPushState:t,originalReplaceState:n,wrappedPushState:i,wrappedReplaceState:o}}(),window.addEventListener("popstate",e),window.addEventListener("popmelt:locationchange",e),()=>{window.removeEventListener("popstate",e),window.removeEventListener("popmelt:locationchange",e),function(){let e=window.__POPMELT_PATH_PATCH__;e&&(e.subscribers-=1,!(e.subscribers>0)&&(window.history.pushState===e.wrappedPushState&&(window.history.pushState=e.originalPushState),window.history.replaceState===e.wrappedReplaceState&&(window.history.replaceState=e.originalReplaceState),delete window.__POPMELT_PATH_PATCH__))}()}}function Wo(){return fn(window.location.pathname)}function Bo(){return(0,$o.useSyncExternalStore)(Ho,Wo,()=>"/")}var Vo=new WeakMap,qo=new Set;function Uo(e){let t=e?.closest("[data-popmelt-explore-original],[data-popmelt-explore-scene]");return t?Vo.get(t)??null:null}var Yo=c(h());function Xo(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);if(n)return`oklch(${n[1]} / ${t})`;let r=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return r?`rgba(${parseInt(r[1],16)}, ${parseInt(r[2],16)}, ${parseInt(r[3],16)}, ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}var Ko=c(h()),Qo=c(b());function Zo({painterTarget:e,path:t,polygon:n,bounds:r,clip:i,color:o,selected:a,zIndex:l}){let s=(0,Ko.useId)(),u=s+"-contour",c=function(e){let[t,n]=(0,Ko.useState)(null),r=(0,Ko.useRef)(null);return(0,Ko.useLayoutEffect)(()=>{if(n(null),!e)return;let t=Qr(e,"transparent",0,"solid",n);return()=>t?.abort()},[e]),(0,Ko.useLayoutEffect)(()=>{let e=r.current;if(!t||!e)return;let n=()=>{let n=t.matches("path")?[t]:t.querySelectorAll("path"),r=0;for(let t of n){let n=t.getAttribute("d"),i=t.getScreenCTM();if(!n||!i||!t.getClientRects().length)continue;let o=e.children[r++];o||(o=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path"),o.setAttribute("vector-effect","non-scaling-stroke"),e.append(o));let a=rt(t.ownerDocument)?at({left:0,top:0,width:1,height:1},t.ownerDocument):null,l=a?.width??1,s=a?.height??1,u=`matrix(${i.a*l} ${i.b*s} ${i.c*l} ${i.d*s} ${i.e*l+(a?.x??0)} ${i.f*s+(a?.y??0)})`;o.getAttribute("d")!==n&&o.setAttribute("d",n),o.getAttribute("transform")!==u&&o.setAttribute("transform",u);let c=t.getAttribute("fill-rule")||"nonzero";o.getAttribute("fill-rule")!==c&&o.setAttribute("fill-rule",c)}for(;e.children.length>r;)e.lastElementChild.remove()},i=new MutationObserver(n);i.observe(t,{subtree:!0,attributes:!0,childList:!0});let o,a=()=>{n(),o=requestAnimationFrame(a)};return a(),()=>{i.disconnect(),cancelAnimationFrame(o),e.replaceChildren()}},[t]),{active:!!t,group:r}}(e),{left:d,top:h,width:p,height:f}=r;return(0,Qo.jsxs)("svg",{"data-devtools":"sample-spotlight","aria-hidden":"true",width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:l},children:[(0,Qo.jsxs)("defs",{children:[i&&(0,Qo.jsx)("clipPath",{id:s+"-clip",children:(0,Qo.jsx)("rect",{x:i.left,y:i.top,width:i.width,height:i.height})}),(0,Qo.jsx)("g",{id:u,clipPath:i?`url(#${s}-clip)`:void 0,children:c.active?(0,Qo.jsx)("g",{ref:c.group}):n?(0,Qo.jsx)("polygon",{points:n,transform:`translate(${d} ${h}) scale(${p} ${f})`,vectorEffect:"non-scaling-stroke"}):t?(0,Qo.jsx)("path",{d:t}):(0,Qo.jsx)("rect",{x:d,y:h,width:p,height:f})}),(0,Qo.jsxs)("mask",{id:s+"-mask",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:[(0,Qo.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),(0,Qo.jsx)("use",{href:"#"+u,fill:"black"})]})]}),(0,Qo.jsx)("rect",{width:"100%",height:"100%",fill:"black",fillOpacity:.5,mask:`url(#${s}-mask)`}),o&&(0,Qo.jsx)("use",{href:"#"+u,fill:"none",stroke:o,strokeWidth:1,strokeDasharray:a?void 0:Hr})]})}var Go=new WeakMap,Jo="popmelt:preview-viewport-change";function ea(e,t=window){let n=Go.get(t)??function(e){let t={listeners:new Set,rafId:null,schedule:()=>{null===t.rafId&&(t.rafId=e.requestAnimationFrame(()=>{t.rafId=null;for(let e of t.listeners)e()}))}};return Go.set(e,t),e.addEventListener("scroll",t.schedule,{passive:!0,capture:!0}),e.addEventListener("resize",t.schedule),t}(t);return n.listeners.add(e),()=>{n.listeners.delete(e)&&(n.listeners.size>0||(t.removeEventListener("scroll",n.schedule,!0),t.removeEventListener("resize",n.schedule),null!==n.rafId&&t.cancelAnimationFrame(n.rafId),Go.delete(t)))}}function ta(e,t,n){let r=e.ownerDocument.defaultView??window,i=Uo(e)??e,o=()=>t(i),a=null,l=()=>{null===a&&(a=r.requestAnimationFrame(()=>{a=null,o()}))},s="true"===e.getAttribute("data-popmelt-subject-projection")&&n,u=()=>s?s.subscribeFrame(o):function(e,t,n){let r=e.ownerDocument.defaultView,i=new Set,o=new Set,a=null;function l(){a=null,n();for(let e of o)!e.pending&&"running"!==e.playState&&o.delete(e);o.size&&(a=r.requestAnimationFrame(l))}function s(e){for(let t of e.getAnimations?.()??[])(t.pending||"running"===t.playState)&&o.add(t);o.size&&null===a&&(a=r.requestAnimationFrame(l))}function u(e){e.target===e.currentTarget&&s(e.currentTarget)}let c=typeof ResizeObserver>"u"?null:new ResizeObserver(t),d=new MutationObserver(e=>{e.some(e=>Array.from(e.removedNodes).some(e=>i.has(e)))&&p(),e.some(e=>"style"===e.attributeName)?n():t()});function h(){d.disconnect(),c?.disconnect();for(let e of i)e.removeEventListener("animationstart",u),e.removeEventListener("transitionrun",u);i.clear(),o.clear(),null!==a&&r.cancelAnimationFrame(a),a=null}function p(){h();for(let t=e;t;t=t.assignedSlot??vt(t))i.add(t),c?.observe(t),d.observe(t,{attributes:!0,attributeFilter:["style","class","hidden","open","data-popmelt-hover-painter"],childList:!0}),t.addEventListener("animationstart",u),t.addEventListener("transitionrun",u),s(t)}return p(),h}(i,l,o),c=u(),d=function(e){return qo.add(e),()=>{qo.delete(e)}}(()=>{let t=Uo(e)??e;t!==i&&(c(),i=t,c=u(),o())}),h=ea(o,r),p=rt(e.ownerDocument)?yi(o):void 0;return o(),()=>{d(),p?.(),h(),c(),null!==a&&r.cancelAnimationFrame(a)}}function na(e){return"string"==typeof e?e:e.component+e.styles}function ra(e,t){let n="string"==typeof e?0:16;return t(na(e))+n}function ia(e,t=!1){if(e.subjectLabel)return`<${e.subjectLabel}>`;let n=e.dataAttributes?.["data-popmelt-label"]?.trim();if(n)return n;if(t&&e.reactComponent)return{component:e.reactComponent,styles:""};let r=e.id?`#${e.id}`:"";if(t)return e.tagName+r;let i=(e.className?.match(/\\S+/g)??[]).map(e=>e.replace(/^[\\w.-]+[.-]module__[\\w-]+?__([\\w-]+)$/,"$1"));return e.reactComponent?{component:e.reactComponent,styles:i.length?` (${i.join(", ")})`:""}:[e.tagName+r,...i.slice(0,2)].join(".")}function oa(e){return"string"==typeof e?8:4}function aa(e){return{...Ur(),display:"flex",alignItems:"center",gap:4,backgroundColor:e,color:"#fff",fontSize:12,lineHeight:"14px",fontFamily:ci,letterSpacing:"0.24px",padding:"0 8px",borderRadius:8,whiteSpace:"nowrap",maxWidth:400}}var la={overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},sa=c(b());function ua({label:e,prefix:t="",hoverName:n,preview:r="expanded"}){let i="expanded"!==r,o="string"!=typeof e,a=o?e.component:n??e,l=o?e.styles:e.slice(a.length),s=void 0!==n&&!!l;return o||s?(0,sa.jsxs)("span",{"data-popmelt-snap-collapse":s&&"waiting"===r||void 0,"data-popmelt-collapsed":s?i:void 0,style:{display:s?"flex":"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:o?"rgb(255 255 255 / 60%)":void 0},children:[(0,sa.jsxs)("span",{"data-popmelt-component-name":o||void 0,style:{color:"#fff",...s&&{flex:"none",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}},children:[t,o&&(0,sa.jsx)(ee,{"aria-hidden":"true",size:12,fill:"currentColor",stroke:"none",style:{display:"inline-block",verticalAlign:"-0.12em",marginRight:4}}),a]}),s?(0,sa.jsx)("span",{className:"popmelt-collapsible-badge-detail","aria-hidden":i,children:(0,sa.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{paddingLeft:0,whiteSpace:"pre",maxWidth:400},children:l})}):l]}):t+e}var ca=new WeakMap,da=new WeakMap,ha=new WeakMap,pa=new WeakMap;function fa(e,t,n="top-left"){t&&(ca.set(e,t),da.set(t,e),ha.set(t,n)),pa.get(e)?.forEach(e=>e())}function ma(e,t,n){let r="right"===e.horizontalAlignment?e.left-t:e.left;return{left:r,top:e.top,right:r+t,bottom:e.top+n}}function ga(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function ya(e,t,n,r,i=0,o=Number.POSITIVE_INFINITY){let a=e.top>=t+n,l=e.bottom+n+t<=r;if(e.height>=r&&!a&&!l){let n=e.top<0&&e.bottom<=r;return{anchor:n?"bottom-left":"top-left",horizontalAlignment:"left",left:e.left+8,top:n?e.bottom-t-8:e.top+8}}let s=function(e,t,n){let r=Math.max(0,e.left+t-n);return Math.max(0,t-e.right)<r?"right":"left"}(e,i,o);return a?{anchor:"right"===s?"top-right":"top-left",horizontalAlignment:s,left:"right"===s?e.right:e.left,top:e.top-t-n}:{anchor:"right"===s?"bottom-right":"bottom-left",horizontalAlignment:s,left:"right"===s?e.right:e.left,top:e.bottom+n}}var va=c(b()),xa={topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"};function ba(e,t){return e.radii.topLeft===t.radii.topLeft&&e.radii.topRight===t.radii.topRight&&e.radii.bottomRight===t.radii.bottomRight&&e.radii.bottomLeft===t.radii.bottomLeft&&e.outline===t.outline&&e.path===t.path&&!["left","top","width","height"].some(n=>e.frameClip?.[n]!==t.frameClip?.[n]||e.subjectBounds?.[n]!==t.subjectBounds?.[n])&&e.fragments.length===t.fragments.length&&e.fragments.every((e,n)=>{let r=t.fragments[n];return!!r&&e.left===r.left&&e.top===r.top&&e.width===r.width&&e.height===r.height})}function wa(e,t){if(!e.isConnected||!ct(e.ownerDocument))return{fragments:[],radii:xa};let n=lt(e),r=dt(n,e.ownerDocument);if(rt(e.ownerDocument)&&(!r.width||!r.height))return{fragments:[],radii:xa};let i=t&&rt(e.ownerDocument)?dt(new DOMRect(0,0,window.innerWidth,window.innerHeight),e.ownerDocument):void 0;if("true"===e.getAttribute("data-popmelt-subject-projection"))return{fragments:[{left:r.left,top:r.top,width:r.width,height:r.height}],radii:xa,frameClip:i,subjectBounds:t?n:void 0,outline:e.getAttribute("data-popmelt-subject-outline")??void 0};let o=Array.from(e.getClientRects()).map(t=>dt(at(t,e.ownerDocument),e.ownerDocument)).filter(e=>e.width>0&&e.height>0).map(e=>({left:e.left,top:e.top,width:e.width,height:e.height}));return{fragments:zi(o.length>0?o:[{left:r.left,top:r.top,width:r.width,height:r.height}]),radii:Ci(e),path:t?Vt(e):void 0,frameClip:i}}function Sa({element:e,projectedRect:t,isSelected:n=!1,elementInfo:r,color:i="#3b82f6",annotationNumber:o,changeCount:a,hideTooltip:l=!1,hideOutline:s=!1,hideFill:u=!1,tintHoveredSubject:c=!1,spotlight:d=!1,fillOpacity:h=.05,subjectRegistry:p,railGap:f=2,railHeight:m=22,railWidth:g=0,renderRail:y,refreshKey:v,outlineZIndex:x=9996,onActivate:b,onRemove:w}){let S=(0,Yo.useContext)(oi);(0,Yo.useLayoutEffect)(()=>{if(!(S&&c&&e&&p))return;let t=Zn(e);if(!t)return;let n=p.resolve(t);return n?.element===e?n.adapter.highlightHover?.(t.key,i):void 0},[e,i,p,c,S]);let[k,C]=(0,Yo.useState)({fragments:[],radii:xa});(0,Yo.useLayoutEffect)(()=>{if(S)return e?ta(e,e=>{let t=wa(e,d);C(e=>ba(e,t)?e:t)},p):void C({fragments:[],radii:xa})},[S,e,p,d]),(0,Yo.useLayoutEffect)(()=>{if(!S||!e||void 0===v)return;let t=wa(Uo(e)??e,d);C(e=>ba(e,t)?e:t)},[S,e,v,d]);let{fragments:M,radii:E}=t?{fragments:[t],radii:xa}:k,T=e&&(Uo(e)??e),A=T?.closest("[data-popmelt-hover-painter]"),[R,j]=(0,Yo.useState)(null);(0,Yo.useLayoutEffect)(()=>{if(!S||t||s||d||!T||!A)return void j(null);let e=Qr(T,i,u?0:h,n?"solid":"dashed");return j(e?T:null),()=>e?.abort()},[S,t,s,T,A,i,u,d,h,n]);let I=!!T&&R===T,z=ri(!S||t||1!==M.length||k.outline?null:T),L=z?ei:void 0;if(0===M.length||!e&&!t)return null;let P=Ii(M,M[0]),N=ia({tagName:e?.localName??"",id:e?.id,className:e?.getAttribute("class")??void 0,reactComponent:r?.reactComponent,subjectLabel:e?.hasAttribute("data-popmelt-subject-adapter")?e.getAttribute("data-popmelt-subject-label")??void 0:void 0,dataAttributes:{"data-popmelt-label":e?.getAttribute("data-popmelt-label")??""}}),_=ya({left:P.left,right:P.left+P.width,top:P.top,bottom:P.top+P.height,height:P.height},m,f,window.innerHeight,g,window.innerWidth),D={zIndex:9997,display:"flex",alignItems:"center",gap:6,backgroundColor:i,color:"#fff",fontSize:12,fontFamily:Le,lineHeight:"14px",padding:"4px 8px",paddingLeft:void 0===o?oa(N):8,borderRadius:8,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:400,position:"fixed",...ii(z,P,_.left,_.top)},F=!l&&(0,va.jsxs)("div",{ref:t=>{e&&fa(e,t,_.anchor)},part:L,"data-devtools":"tooltip",style:D,children:[void 0!==o&&(0,va.jsxs)("span",{children:[o,"."]}),(0,va.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:(0,va.jsx)(ua,{label:N})}),void 0!==a&&a>0&&(0,va.jsxs)("span",{style:{opacity:.8},children:["(",a," ",1===a?"change":"changes",")"]})]}),O={borderTopLeftRadius:E.topLeft,borderTopRightRadius:E.topRight,borderBottomRightRadius:E.bottomRight,borderBottomLeftRadius:E.bottomLeft};return(0,va.jsxs)(va.Fragment,{children:[d&&(0,va.jsx)(Zo,{painterTarget:S&&!t&&A?T:null,path:t?void 0:k.path,polygon:t?void 0:k.outline,bounds:!t&&k.subjectBounds||P,clip:t?void 0:k.frameClip,color:s?void 0:i,selected:n,zIndex:x-1}),!s&&M.map((e,t)=>(0,va.jsx)("div",{part:L,"data-devtools":"highlight",onContextMenu:w?e=>{e.preventDefault(),e.stopPropagation(),w()}:void 0,role:b?"button":void 0,tabIndex:b?0:void 0,"aria-label":b?"Open annotation thread":void 0,onPointerDown:b?e=>{e.preventDefault(),e.stopPropagation()}:void 0,onClick:b?e=>{e.preventDefault(),e.stopPropagation(),b()}:void 0,onKeyDown:b?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),b())}:void 0,style:{position:"fixed",...ii(z,P,e.left,e.top),width:e.width,height:e.height,pointerEvents:b||w?"auto":"none",cursor:b?"pointer":void 0,zIndex:x,overflow:"visible",opacity:I||d?0:void 0},children:(0,va.jsx)("div",{style:k.outline?{position:"absolute",inset:0,pointerEvents:"none"}:{position:"absolute",inset:0,boxSizing:"border-box",backgroundColor:u||d?"transparent":Xo(i,h),borderColor:i,borderStyle:n?"solid":"dashed",borderWidth:1,...O,pointerEvents:"none"},children:k.outline?(0,va.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",style:{display:"block",overflow:"visible"},"aria-hidden":"true",children:(0,va.jsx)("polygon",{points:k.outline,fill:u||d?"transparent":Xo(i,h),stroke:i,strokeWidth:1,strokeDasharray:n?void 0:"4 3",vectorEffect:"non-scaling-stroke"})}):null})},t)),y?y(_,P,z):F]})}var ka=c(h()),Ca=c(h()),Ma=c(b());function Ea(e,t){if(e.style.display=t?"":"none",!t)return;let n=e.querySelector("line"),r=e.querySelector("circle");n.setAttribute("x1",String(t.annotation.x)),n.setAttribute("y1",String(t.annotation.y)),n.setAttribute("x2",String(t.subject.x)),n.setAttribute("y2",String(t.subject.y)),r.setAttribute("cx",String(t.subject.x)),r.setAttribute("cy",String(t.subject.y))}function Ta({groupRef:e,color:t}){return(0,Ma.jsxs)("g",{ref:e,style:{display:"none"},children:[(0,Ma.jsx)("line",{stroke:t,strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ma.jsx)("circle",{"data-popmelt-subject-draft-point":"",r:"3",fill:t,stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]})}function Aa({element:e,annotationRect:t,subjectAnchor:n,color:r,subjectRegistry:i}){let o=(0,Ca.useRef)(null);return(0,Ca.useEffect)(()=>{let r=o.current;if(!r)return;let a=()=>{let i=function(e,t,n){let r={x:n.left+n.width*t.x,y:n.top+n.height*t.y},i=e.left+e.width,o=e.top+e.height,a=r.x>=e.left&&r.x<=i&&r.y>=e.top&&r.y<=o,l={x:Math.max(e.left,Math.min(i,r.x)),y:Math.max(e.top,Math.min(o,r.y))};return{annotation:l,subject:r,visible:!a&&Math.hypot(r.x-l.x,r.y-l.y)>=2}}(t,n,lt(e));Ea(r,i.visible?i:null)};a();let l=i?.subscribeFrame(a),s=i?null:new MutationObserver(a);return s?.observe(e,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",a),()=>{l?.(),s?.disconnect(),window.removeEventListener("resize",a)}},[t,e,n,i]),(0,Ma.jsx)("svg",{"data-popmelt-subject-draft-connector":"","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100dvw",height:"100dvh",zIndex:10001,pointerEvents:"none",overflow:"visible"},children:(0,Ma.jsx)(Ta,{groupRef:o,color:r})})}var Ra=c(b()),ja=["topLeft","topRight","bottomRight","bottomLeft"],Ia=[["topLeft","topRight"],["topRight","bottomRight"],["bottomRight","bottomLeft"],["bottomLeft","topLeft"]],za="#000000";function La(e){let t=e.match(/^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)(?:\\s*[,/]\\s*([\\d.]+%?))?\\s*\\)$/i);if(!t)return null;let n=t[4],r=n?n.endsWith("%")?Number.parseFloat(n)/100:Number.parseFloat(n):1,i={red:Number.parseFloat(t[1]),green:Number.parseFloat(t[2]),blue:Number.parseFloat(t[3]),alpha:r};return Object.values(i).every(Number.isFinite)?i:null}function Pa(e){let t=e.parentElement;for(;t;){let e=La(getComputedStyle(t).backgroundColor);if(e&&e.alpha>=.95)return(.299*e.red+.587*e.green+.114*e.blue)/255>=.55?za:"#ffffff";t=t.parentElement}return za}function Na(e){return ja.map(t=>`${e[t].x},${e[t].y}`).join(" ")}function _a(e,t,n){return{"data-transform-effective-outline":"","data-transform-effective-scrim":"",fill:e,fillOpacity:t,stroke:e,strokeWidth:1,strokeDasharray:"dashed"===n?Hr:void 0}}function Da({element:e,accentColor:t,activeFacet:n,outlineStyle:r,scrimOpacity:i=.05,refreshKey:o}){let a=(0,ka.useRef)(null),l=(0,ka.useRef)(null),s=(0,ka.useContext)(oi);return(0,ka.useLayoutEffect)(()=>{let t=a.current;if(!t||!s)return;let n,r,i,o=null,u=null,c=!1,d=ta(e,a=>{let s=a.isConnected&&ct(a.ownerDocument),d=s?a.closest("[data-popmelt-hover-painter]"):null;if((o!==d||u!==a)&&(r?.abort(),i?.dispose(),i=void 0,o=d,u=a,r=void 0,c=!1,o)){r=new AbortController;let{signal:n}=r;c=!a.dispatchEvent(new CustomEvent("popmelt:paint-hover",{bubbles:!0,cancelable:!0,detail:{signal:n,setConnectorEdges(t,r){n.aborted||!l.current||(i??=function(e,t){let n=null,r=null,i=null,o=()=>{null!==i||!n||(i=requestAnimationFrame(()=>{i=null;let o=function(e){let t=ca.get(e);return t?.isConnected&&da.get(t)===e&&!t.closest("[inert]")?t.getBoundingClientRect():null}(e),a=o&&n?.isConnected&&n.getScreenCTM();if(!(o&&n&&a&&r))return void Ea(t,null);let l=a;if(rt(n.ownerDocument)){let e=at({left:0,top:0,width:1,height:1},n.ownerDocument);l=new DOMMatrix([a.a*e.width,a.b*e.height,a.c*e.width,a.d*e.height,a.e*e.width+e.left,a.f*e.height+e.top])}Ea(t,function(e,t,n,r){if(!e.width||!e.height)return null;let i=t.startsWith("top"),o={x:e.left+e.width/2,y:i?e.bottom:e.top},{x:a,y:l}=i?n.top:n.bottom,s={x:r.a*a+r.c*l+r.e,y:r.b*a+r.d*l+r.f};return Math.hypot(s.x-o.x,s.y-o.y)<=8||(i?s.y<o.y:s.y>o.y)?null:{annotation:o,subject:s}}(o,function(e){let t=ca.get(e);return(t&&ha.get(t))??"top-left"}(e),r,l))}))},a=function(e,t){let n=pa.get(e)??new Set;return pa.set(e,n),n.add(t),()=>n.delete(t)}(e,o);return{schedule:o,setEdges(e,i){n=e,r=i,n?o():Ea(t,null)},dispose(){a(),null!==i&&cancelAnimationFrame(i),Ea(t,null)}}}(e,l.current),i.setEdges(t,r))},createOverlay(e,n){let r=Kr(n,"painted-hover"),i=t.cloneNode(!1);return i.setAttribute("d",Vt(e)),e===n&&(r.style.borderRadius=getComputedStyle(e).borderRadius,i.setAttribute("stroke-width",String(2))),r.append(i),r}}}))}i?.schedule();let h=s&&!c?Vt(a):"";h!==n&&(n=h,t.setAttribute("d",h))});return()=>{d(),r?.abort(),i?.dispose()}},[e,s,o,t,r,i]),s?(0,Ra.jsxs)("svg",{"data-devtools":"element-boundary","data-popmelt-steer-overlay":!0,"data-transform-facet":n,width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:9996},children:[(0,Ra.jsx)("path",{ref:a,..._a(t,i,r),strokeOpacity:.72}),(0,Ra.jsx)(Ta,{groupRef:l,color:t})]}):null}function Fa(e){return!1===e.showHandles?(0,Ra.jsx)(Da,{...e}):(0,Ra.jsx)(Oa,{...e})}function Oa({element:e,activeFacet:t,accentColor:n,outlineStyle:r="solid",showRotateHandle:i=!0,scrimOpacity:o=.05,cursorViewport:a,draggingKind:l,draggingCorner:s,ghostQuad:u,previewTarget:c,refreshKey:d,onHandlePointerDown:h}){let[p,f]=(0,ka.useState)(null),[m,g]=(0,ka.useState)(null),[y,v]=(0,ka.useState)(null),[x,b]=(0,ka.useState)(null),[w,S]=(0,ka.useState)(!1),[k,C]=(0,ka.useState)(za),M=(0,ka.useRef)("top"),E=(0,ka.useRef)(null),T=`transform-occlusion-${(0,ka.useId)().replace(/:/g,"")}`;if((0,ka.useEffect)(()=>{let t=!1,n=()=>{if(!ct(e.ownerDocument))return void f(null);let n=c&&e.getAnimations?.().some(e=>"transitionProperty"in e&&["transform","translate","scale","rotate"].includes(String(e.transitionProperty))),r=n?c.layoutQuad:Tt(e)?Ut(e):jt(e);t=!!n,c&&(c.layoutQuad=r),E.current=r;let i=At(r,e.ownerDocument);g(i),b(Zt(Xt(e,r),r,i)),S(Gt(e)),C(Pa(e));let o=At(Tt(e)?qt(e,r):jt(e),e.ownerDocument);v(o),f(o)},r=r=>{t&&r.target===e&&n()};e.addEventListener("transitionend",r),e.addEventListener("transitioncancel",r),n(),window.addEventListener(Jo,n),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0});let i=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>n());i?.observe(e);let o="",a=rt(e.ownerDocument)?yi(()=>{let t=lt(e),r=JSON.stringify([ct(e.ownerDocument),t.x,t.y,t.width,t.height]);r!==o&&(o=r,n())}):void 0;return()=>{e.removeEventListener("transitionend",r),e.removeEventListener("transitioncancel",r),a?.(),window.removeEventListener(Jo,n),window.removeEventListener("scroll",n),window.removeEventListener("resize",n),i?.disconnect()}},[e,c]),(0,ka.useLayoutEffect)(()=>{let t=c?.layoutQuad??(l&&E.current?E.current:Tt(e)?Ut(e):jt(e));E.current=t;let n=At(t,e.ownerDocument);g(n),b(Zt(Xt(e,t),t,n)),S(Gt(e)),C(Pa(e));let r=At(Tt(e)?qt(e,t):jt(e),e.ownerDocument);v(r),f(r)},[l,e,c,d]),!p)return null;let A=a?cn(p,a,20,{currentSide:M.current,hysteresis:8,viewport:{width:window.innerWidth,height:window.innerHeight}}):ln(p,20);"rotate"!==l&&(M.current=A.side);let R="rotate"===l?{...an(p,void 0,M.current),side:M.current}:A,j={position:"fixed",inset:0,pointerEvents:"none",zIndex:h?9999:9996},I=l?.95:.72,z=!(!m||!function(e,t,n=1){return["topLeft","topRight","bottomRight","bottomLeft"].some(r=>Math.hypot(e[r].x-t[r].x,e[r].y-t[r].y)>n)}(m,p)),L=m&&y&&x?Zt(x,m,y):x,P=L?nn(p,L):p,N=u&&m&&x?Zt(x,m,u):x,_=u&&N?nn(u,N):u,D=on(p),F=u?on(u):null,O=u?an(u,void 0,R.side):null,$=O&&F?function(e,t,n,r){let i=Math.atan2(n.y-t.y,n.x-t.x),o=Math.atan2(r.y-e.y,r.x-e.x),a=Math.atan2(Math.sin(o-i),Math.cos(o-i));if(Math.abs(a)<.001)return null;let l=Math.hypot(r.x-e.x,r.y-e.y),s=e.x+Math.cos(i)*l,u=e.y+Math.sin(i)*l,c=Math.cos(i),d=Math.sin(i);return{path:`M ${s} ${u} A ${l} ${l} 0 0 ${a>0?1:0} ${r.x} ${r.y}`,startTick:{start:{x:s-4*c,y:u-4*d},end:{x:s+4*c,y:u+4*d}}}}(D,F,O.handle,R.handle):null,H=w&&y&&L?rn(y,L):null,W=H?`url(#${T})`:void 0;return(0,Ra.jsx)("div",{"data-devtools":"transform-handles","data-popmelt-steer-overlay":!0,"data-transform-facet":t,style:j,children:(0,Ra.jsxs)("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[H&&(0,Ra.jsx)("defs",{children:(0,Ra.jsxs)("mask",{id:T,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100%",height:"100%",children:[(0,Ra.jsx)("rect",{width:"100%",height:"100%",fill:"#ffffff"}),(0,Ra.jsx)("path",{"data-transform-occlusion-mask":"",d:H,fill:"#000000"})]})}),z&&m&&x&&(0,Ra.jsx)("path",{"data-transform-layout-plate":"",d:rn(m,x),fill:k,fillOpacity:"0.07",stroke:"none",mask:W}),(0,Ra.jsx)("path",{..._a(n,o,r),d:L?rn(p,L):`M ${Na(p)} Z`,strokeOpacity:I}),"translate"===l&&F&&(0,Ra.jsxs)("g",{"data-transform-origin-trace":"translate",children:[(0,Ra.jsx)("line",{x1:F.x,y1:F.y,x2:D.x,y2:D.y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ra.jsx)("circle",{"data-transform-origin-point":"",cx:F.x,cy:F.y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"scale"===l&&s&&_&&(0,Ra.jsxs)("g",{"data-transform-origin-trace":"scale",children:[(0,Ra.jsx)("line",{x1:_[s].x,y1:_[s].y,x2:P[s].x,y2:P[s].y,stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ra.jsx)("circle",{"data-transform-origin-point":"",cx:_[s].x,cy:_[s].y,r:"3",fill:"#808080",stroke:"#ffffff",strokeWidth:"1",opacity:"0.85"})]}),"rotate"===l&&$&&(0,Ra.jsxs)("g",{"data-transform-origin-trace":"rotate",children:[(0,Ra.jsx)("path",{"data-transform-rotation-arc":"",d:$.path,fill:"none",stroke:"#808080",strokeWidth:"1",strokeDasharray:"2 3",strokeLinecap:"round",opacity:"0.72"}),(0,Ra.jsx)("line",{"data-transform-rotation-arc-start":"",x1:$.startTick.start.x,y1:$.startTick.start.y,x2:$.startTick.end.x,y2:$.startTick.end.y,stroke:"#808080",strokeWidth:"1",strokeLinecap:"round",opacity:"0.85"})]}),h&&Ia.map(([e,t])=>(0,Ra.jsx)("line",{"data-transform-handle":"translate",x1:p[e].x,y1:p[e].y,x2:p[t].x,y2:p[t].y,stroke:"transparent",strokeWidth:12,style:{pointerEvents:"stroke",cursor:"move"},onPointerDown:e=>h("translate",null,e)},`${e}-${t}`)),(0,Ra.jsxs)("g",{"data-transform-affordances":"",children:[ja.map(e=>(0,Ra.jsxs)("g",{children:[(0,Ra.jsx)("rect",{x:P[e].x-3,y:P[e].y-3,width:6,height:6,fill:n,stroke:"#ffffff",strokeWidth:2}),h&&(0,Ra.jsx)("circle",{"data-transform-handle":"scale","data-transform-corner":e,cx:P[e].x,cy:P[e].y,r:10,fill:"transparent",style:{pointerEvents:"all",cursor:"topLeft"===e||"bottomRight"===e?"nwse-resize":"nesw-resize"},onPointerDown:t=>h("scale",e,t)})]},e)),i&&(0,Ra.jsxs)(Ra.Fragment,{children:[(0,Ra.jsx)("line",{x1:R.edge.x,y1:R.edge.y,x2:R.handle.x,y2:R.handle.y,stroke:n,strokeWidth:"1",opacity:I}),(0,Ra.jsx)("circle",{cx:R.handle.x,cy:R.handle.y,r:3,fill:n,stroke:"#ffffff",strokeWidth:2}),h&&(0,Ra.jsx)("line",{"data-transform-handle":"rotate",x1:R.edge.x,y1:R.edge.y,x2:R.handle.x,y2:R.handle.y,stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{pointerEvents:"stroke",cursor:"grab"},onPointerDown:e=>{M.current=R.side,h("rotate",null,e,R.side)}})]})]})]})})}var $a=c(b());function Ha({entry:e,color:t,hasAnnotationLabel:n,subjectRegistry:r}){let i=(0,Oo.useContext)(oi),o=Bo(),[a,l]=(0,Oo.useState)(null);return(0,Oo.useEffect)(()=>{if(!i)return;let t=function(e,t,n){let r=[],i=(e,t)=>{let n=function(e,t){let n=bn(e.filter(e=>!e.includes("data-pm=")),t);return"matched"===n.status?n.element:null}(e,t);!n||r.some(e=>e.element===n)||r.push({element:n,elementInfo:On(n),subject:!1})};for(let o of(e.targets??[]).slice(0,20))if("dom"===o.type){if(o.pathname!==t)continue;i([o.structuralSelector,o.runtimeSelector,...o.legacySelectors??[]].filter(e=>!!e),o.targetFingerprint)}else{let e=n?.resolve({adapter:o.adapter,key:o.key});e&&r.push({element:e.element,elementInfo:e.elementInfo,subject:!0,sourceElement:e.subject.sourceElement})}if(!e.targets?.length)for(let n of(e.elementIdentifiers??[]).slice(0,20))n.startsWith(`${t}:`)&&i([n.slice(t.length+1)]);return r}(e,o,r),n=new Set,a=typeof IntersectionObserver>"u"?null:new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&t.intersectionRect.width&&t.intersectionRect.height?n.delete(t.target):n.add(t.target);s()}),s=()=>{let r=t.filter(e=>!n.has(e.element)&&function(e){let t=e.sourceElement??e.element;if(!t.isConnected)return!1;if(!e.subject||e.sourceElement){let e=getComputedStyle(t);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||"0"===e.opacity||t.checkVisibility&&!t.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}))return!1}let n=lt(e.element);return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}(e));l(t=>t?.entry===e&&t.pathname===o&&t.targets.length===r.length&&t.targets.every((e,t)=>e===r[t])?t:{entry:e,pathname:o,targets:r})};for(let e of t)a?.observe(e.element);s();let u=ea(s),c=function(e){let t=new MutationObserver(t=>{let n=t.filter(e=>document.body.contains(e.target)||e.target===document.documentElement&&[...e.addedNodes,...e.removedNodes].some(e=>e instanceof Element&&"BODY"===e.tagName));n.length&&e(n)});return t.observe(document.documentElement,{childList:!0,subtree:!0}),t}(s);return()=>{a?.disconnect(),u(),c.disconnect()}},[e,o,r,i]),a?.entry!==e||a.pathname!==o?null:(0,$a.jsx)("div",{"data-devtools":"history-target-preview",style:{pointerEvents:"none"},children:a.targets.map((e,i)=>(0,$a.jsxs)(Oo.Fragment,{children:[(0,$a.jsx)(Sa,{element:e.element,elementInfo:e.elementInfo,subjectRegistry:r,tintHoveredSubject:e.subject,hideTooltip:n?.(e.element),hideOutline:!e.subject,color:t}),!e.subject&&(0,$a.jsx)(Fa,{element:e.element,activeFacet:"translate",accentColor:t,showHandles:!1,outlineStyle:"dashed"})]},i))})}var Wa=c(h()),Ba=c(h());function Va(e,t){if(Object.is(e,t))return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;let n=e,r=t,i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>Object.prototype.hasOwnProperty.call(r,e)&&Va(n[e],r[e]))}var qa="devtools-active-text";function Ua(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}var Ya=c(h());function Xa(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ka(e,t){return function(e,t){return e===t||wt(e,t)||wt(t,e)}(e,t)||null!==vt(e)&&vt(e)===vt(t)}function Qa(e,t){return wn(e,t?.[0])}function Za(e){return!(!e.linkedSelector||"body"!==e.elements?.[0]?.tagName.toLowerCase())}function Ga(e){let t=ya(e,22,2,window.innerHeight);return{x:t.left+window.scrollX+8,y:t.top+window.scrollY+4}}function Ja(e,t){if(0===t.size)return null;let n=new Set,r=new Set;for(let i of e)t.has(i.id)&&(i.groupId&&n.add(i.groupId),i.threadId&&r.add(i.threadId));for(let t of e)t.groupId&&n.has(t.groupId)&&t.threadId&&r.add(t.threadId);let i=new Set(t);for(let t of e)(t.groupId&&n.has(t.groupId)||t.threadId&&r.has(t.threadId))&&i.add(t.id);return i}function el(e,t,n=0,r,i,o=90){let a=e.left+window.scrollX+8,l="top-left"===t?e.top+window.scrollY-2-22-22*n+4:e.bottom+window.scrollY+2+4+22*n,s=window.scrollY+4,u=window.scrollY+window.innerHeight-22-4,c=null;if(r&&void 0!==i){let t=r.getBoundingClientRect(),n=e.left;if(n+i+16+o>t.left&&n<t.right)if(t.top<window.innerHeight/2){let e=window.scrollY+t.bottom+4;e>s&&(s=e,c="top")}else{let e=window.scrollY+t.top-22-4;e<u&&(u=e,c="bottom")}}return s>u&&(u=s),l<s?l="top"===c?s:e.top+window.scrollY+4:l>u&&(l="bottom"===c?u:Math.max(e.top+window.scrollY+4,u)),{x:a,y:l}}var tl=c(h());function nl(e,t){return t.selectors??(t.targetBindingId?[]:[e])}function rl(e,t,n,r){let i=[...new Set(e)];return 1!==i.length?n:il(i[0],t,r)?.color??n}function il(e,t,n){for(let[n,r]of t)if(nl(n,r).includes(e))return r;if(!n)return;let r=n(e);if(r)for(let[e,i]of t)if(nl(e,i).some(e=>n(e)===r))return i}function ol(e){let t=new Set(["resolved","needs_review","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&e.status&&t.has(e.status)&&e.threadId)}function al(e){let t=e.status??"pending",n=new Set(["pending","sending","in_flight","resolved","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&n.has(t))}var ll=c(h());function sl(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return[...e];let n=e[e.length-1];return n&&Math.hypot(t.x-n.x,t.y-n.y)<2?[...e]:[...e.length>=256?e.filter((e,t)=>t%2==0):e,{x:t.x,y:t.y}]}function ul(e){return{left:Math.min(...e.map(e=>e.x)),top:Math.min(...e.map(e=>e.y)),right:Math.max(...e.map(e=>e.x)),bottom:Math.max(...e.map(e=>e.y))}}function cl(e,t){let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){let o=t[r],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function dl(e){if(e.length<3)return[];let t=ul(e),n=[];for(let r=0;r<8;r++)for(let i=0;i<8;i++){let o={x:t.left+(i+.5)*(t.right-t.left)/8,y:t.top+(r+.5)*(t.bottom-t.top)/8};cl(o,e)&&n.push(o)}return n}function hl(e){if(e.length<2)return null;let t=e[0],n=e[e.length-1];return t&&n?[t,n]:null}function pl(e,t){let n=Math.min(1,Math.max(0,(t-e.start)/160));return e.to+(e.from-e.to)*(1-n)**2}function fl(e,t,n){return e.map(e=>({x:e.x-t,y:e.y-n}))}function ml(e,t,n,r,i,o){let a=String(r);e.font="600 11px system-ui, -apple-system, sans-serif";let l=e.measureText(a).width+8,s=t-l/2,u=n+o/2+2;e.fillStyle=i,e.fillRect(s,u,l,19),e.fillStyle="#ffffff",e.textBaseline="middle",e.fillText(a,s+4,u+9.5)}function gl(e,t){if(e.points.length<2&&"text"!==e.type)return null;switch(e.type){case"rectangle":case"freehand":{let t,n;if("freehand"===e.type)t=Math.min(...e.points.map(e=>e.x)),n=Math.max(...e.points.map(e=>e.y));else{let r=e.points[0],i=e.points[e.points.length-1];t=Math.min(r.x,i.x),n=Math.max(r.y,i.y)}return{x:t,y:n}}case"circle":{let t=e.points[0],n=e.points[e.points.length-1];return{x:Math.min(t.x,n.x),y:(Math.min(t.y,n.y)+Math.max(t.y,n.y))/2}}case"line":{let t=e.points[0],n=e.points[e.points.length-1],r=t.y>n.y?t:n;return{x:r.x,y:r.y}}default:return null}}var yl=c(h());function vl(e){if(!e.isConnected||!ct(e.ownerDocument))return!1;let t=dt(lt(e),e.ownerDocument);if(t.width<=0||t.height<=0||0===e.getClientRects().length)return!1;let n=e;for(;n;){let e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"collapse"===e.visibility||Number.parseFloat(e.opacity||"1")<=0)return!1;n=vt(n)}return!0}function xl(e,t){if(e?.isConnected){let t=Uo(e);if(t&&vl(t))return{element:t,parentPinned:!e.matches("[data-popmelt-explore-original],[data-popmelt-explore-scene]")};let n=e;for(;n&&n!==document.documentElement;){if(vl(n))return{element:n,parentPinned:n!==e};n=vt(n)}}let n=function(e){if(!e)return null;try{return yt(e)}catch{return null}}(t);return n&&vl(n)?{element:n,parentPinned:!0}:null}function bl(e,t,n){return xl(e,n)?.element===t}function wl(e,t){return`[${e}="${typeof CSS<"u"&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/["\\\\]/g,"\\\\$&")}"]`}var Sl=["id","data-pm","data-popmelt-frame","data-testid","data-test","data-cy","data-popmelt-media-id","data-popmelt-see-id","data-popmelt-subject-key","aria-label","name","href"],kl=["style","class","open","hidden","aria-hidden","data-state"];function Cl(e){let t=new Set(Sl);for(let n of e){/\\.[\\w\\\\-]/.test(n)&&t.add("class");for(let e of n.matchAll(/\\[\\s*([\\w:-]+)/g))t.add(e[1]);if(/:(checked|disabled|enabled|required|optional|read-only|read-write)\\b/.test(n))for(let e of["checked","selected","disabled","required","readonly","contenteditable"])t.add(e)}return{identityAttributes:[...t],attributes:[...new Set([...t,...kl])],changesIdentity:e=>"attributes"!==e.type||t.has(e.attributeName??"")}}function Ml({annotations:e,currentPathname:t,dispatch:n,stateRef:r,styleModifications:i,subjectRegistry:o,toolbarRef:a,onTargetResolutionChange:l}){let s=(0,yl.useContext)(oi),[u,c]=(0,yl.useState)(()=>new Set),d=(0,yl.useMemo)(()=>e.filter(e=>e.linkedSelector&&(!e.pathname||e.pathname===t)).map(e=>[e.id,e.linkedSelector,e.text,e.fontSize,e.timestamp,JSON.stringify([e.elements?.[0]?.selector,e.elements?.[0]?.context,e.elements?.[0]?.targetFingerprint,e.elements?.[0]?.dataAttributes,e.elements?.[0]?.sourceElement?.dataAttributes])].join(":")).join("|"),[e,t]),h=(0,yl.useMemo)(()=>i.filter(e=>!e.pathname||e.pathname===t).map(e=>e.selector).sort().join("|"),[t,i]);return(0,yl.useEffect)(()=>{if(!s)return;if(!d)return void c(e=>0===e.size?e:new Set);let e=null,i=!1,u=document.createElement("canvas").getContext("2d"),h=null,p=new Map,f=new Map,m=new Map,g=Cl(r.current.annotations.flatMap(e=>[e.linkedSelector,e.elements?.[0]?.selector].filter(e=>!!e))),y=()=>{h=null,p.clear()},v=()=>{let e=r.current.styleModifications.filter(e=>!e.pathname||e.pathname===t),i=[],o=(()=>{if(h)return h;let e=r.current.annotations.filter(e=>e.linkedSelector&&(!e.pathname||e.pathname===t)),n=new Map;return h=e.flatMap(e=>{f.has(e.id)||f.set(e.id,function(e){let t=e.elements?.[0],n=t?.sourceElement?.dataAttributes,r=n?.["data-popmelt-media-id"]??n?.["data-popmelt-see-id"]??t?.dataAttributes?.["data-popmelt-media-id"]??t?.dataAttributes?.["data-popmelt-see-id"];if(r&&!e.linkedSelector?.startsWith("@frame(")&&!t?.selector.startsWith("@frame(")){let e=yt(wl("data-popmelt-media-id",r));if(e)return e;let t=yt(wl("data-popmelt-see-id",r));if(t)return t}return wn(e.linkedSelector,t)}(e));let t=f.get(e.id);n.set(e.id,t);let r=xl(t,e.elements?.[0]?.context);return r?[{annotation:e,spatialAnchor:r}]:[]}),(n.size!==m.size||[...n].some(([e,t])=>m.get(e)!==t))&&(m=n,l?.()),h})(),s=new Map(r.current.annotations.map(e=>[e.id,e])),d=new Set(o.filter(({spatialAnchor:e})=>e.parentPinned).map(({annotation:e})=>e.id));c(e=>function(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}(e,d)?e:d);let g=new Map,y=new Map,v=new Map;for(let{annotation:e,spatialAnchor:t}of o){let n=v.get(t.element)??[];n.push(e),v.set(t.element,n)}let x=new Map;for(let e of v.values()){e.sort((e,t)=>e.timestamp-t.timestamp);let t,n=0,r=0;for(let i of e)i.timestamp!==t&&(t=i.timestamp,r=n),x.set(i.id,r),n+=1}for(let{annotation:t,spatialAnchor:n}of o){let r=n.element,o=g.get(r);o||(o=lt(r),g.set(r,o));let l=y.get(r);void 0===l&&(l=e.some(e=>{if(e.captured)return!1;try{return xt(r,e.selector)}catch{return!1}}),y.set(r,l));let c=(l?1:0)+(x.get(t.id)??0),d=p.get(t.id);if(void 0===d&&t.text&&u){let e=t.fontSize||12;u.font=`${e}px ${ci}`,d=Math.max(...t.text.split("\\n").map(e=>u.measureText(e).width))+(n.parentPinned?16:0),p.set(t.id,d)}let h=o.top>=22*(1+c)+2?"top-left":"bottom-left",f=r===document.body&&Za(t)?Ga(o):el(o,h,c,a?.current,d),m=s.get(t.id),v=m?.points[0],b=h!==m?.linkedAnchor;v&&(b||Math.abs(f.x-v.x)>1||Math.abs(f.y-v.y)>1)&&i.push({id:t.id,point:f,linkedAnchor:b?h:void 0})}i.length>0&&n({type:"UPDATE_LINKED_POSITIONS",payload:{updates:i}})};v();let x=()=>{y(),i||null!==e||(e=requestAnimationFrame(()=>{e=null,v()}))},b=ea(v);window.addEventListener("resize",x,!0),window.addEventListener("load",x),document.addEventListener("transitionend",x,!0),document.addEventListener("animationend",x,!0),document.fonts.ready.then(x);let w=o?.subscribeFrame(v),S=new Set,k=()=>{for(let e of gt())!(e instanceof ShadowRoot)||S.has(e)||(S.add(e),C.observe(e,M))},C=new MutationObserver(e=>{let t=e.filter(e=>{let t=e.target,n=t instanceof Element?t:t.parentElement;return!n||!bt(n,\'#devtools-toolbar, #devtools-canvas, #devtools-scrim, [data-popmelt-panel], [data-devtools="panel"], [data-devtools="panel-wrapper"], [data-devtools="annotation-badge-layer"], [data-popmelt-subject-projection]\')});t.some(e=>e.addedNodes.length)&&k(),t.some(g.changesIdentity)&&f.clear(),t.length&&x()}),M={attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:g.attributes};C.observe(document.body,M),k();let E=d.includes("@frame(")?yi(()=>{f.clear(),y(),v()}):void 0;return()=>{i=!0,E?.(),b(),window.removeEventListener("resize",x,!0),window.removeEventListener("load",x),document.removeEventListener("transitionend",x,!0),document.removeEventListener("animationend",x,!0),C.disconnect(),w?.(),e&&cancelAnimationFrame(e)}},[s,t,n,d,h,r,o,a,l]),u}var El=c(h()),Tl=c(h());function Al(e,t,n=new Set){let r=function(e){let t=new Map;for(let n of e)n.groupId&&n.threadId&&t.set(n.groupId,n.threadId);return t}(e);return e.filter(e=>{let i=function(e,t){return e.threadId??(e.groupId?t.get(e.groupId):void 0)}(e,r);return(void 0===t||function(e,t){return"string"==typeof e.pathname&&e.pathname===t}(e,t))&&"dismissed"!==e.status&&(!i||!n.has(i))})}function Rl(e,t,n,r=new Set,i=new Map){let o=new Set;for(let e of Al(t,n,r))e.linkedSelector&&o.add(e.linkedSelector);for(let[e,t]of i)if(!r.has(t.threadId))for(let n of t.selectors??[e])o.add(n);return e.filter(e=>(!e.pathname||e.pathname===n)&&(!e.captured||o.has(e.selector)||!!e.durableSelector&&o.has(e.durableSelector)))}var jl=c(h()),Il=c(h()),zl=c(h()),Ll=Number.MAX_SAFE_INTEGER;function Pl(e){return`${e.pathname??"*"}\\0${e.selector}`}function Nl(e,t){return`element:${e??"*"}\\0${t}`}var _l=c(b());function Dl(e){return`${e} image${e>1?"s":""} attached`}function Fl(e){return e<=0?0:32+7.2*String(e).length}function Ol({imageCount:e,color:t,layered:n=!1}){return e<=0?null:(0,_l.jsxs)("div",{"data-devtools":"active-image-attachment-badge",role:"img","aria-label":Dl(e),title:Dl(e),style:{position:"relative",flex:"0 0 auto",display:"flex",marginRight:-2,zIndex:2},children:[(0,_l.jsx)("span",{"aria-hidden":!0,style:{position:"absolute",left:-4,top:"50%",width:14.142,height:14.142,transform:"translateY(-50%)",display:"grid",placeItems:"center",pointerEvents:"none",maskImage:n?yo:void 0,WebkitMaskImage:n?yo:void 0},children:(0,_l.jsx)("span",{style:{width:10,height:10,background:t,transform:"rotate(-45deg)"}})}),(0,_l.jsxs)("span",{style:{position:"relative",display:"flex",alignItems:"center",gap:4,height:22,padding:n?"0 8px 0 10px":"0 8px",borderRadius:8,backgroundColor:t,color:"#fff",font:`12px/1.2 ${ze}`,whiteSpace:"nowrap",maskImage:n?go:void 0,WebkitMaskImage:n?go:void 0},children:[(0,_l.jsx)(re,{size:12,strokeWidth:2,"aria-hidden":!0}),e]})]})}function $l({point:e,scroll:t,attachments:n,showAttachments:r,onRemoveAttachment:i}){return(0,_l.jsx)(_l.Fragment,{children:r&&n.length>0&&(0,_l.jsx)("div",{"data-devtools":!0,style:{position:"fixed",left:e.x-8-t.x,top:e.y-4-t.y-24,zIndex:10001,display:"flex",gap:4,flexWrap:"wrap",maxWidth:400},children:n.map(e=>(0,_l.jsxs)("button",{type:"button",title:"Remove attachment",onMouseDown:e=>e.preventDefault(),onClick:()=>i(e.id),style:{appearance:"none",border:0,borderRadius:8,background:"rgba(0,0,0,0.72)",color:"#fff",cursor:"pointer",font:"11px/16px system-ui, sans-serif",padding:"2px 7px",whiteSpace:"nowrap"},children:[e.name," · ",Ua(e.size)," ×"]},e.id))})})}var Hl=c(b());function Wl({rawLeft:e,width:t,top:n,scroll:r,collisionId:i,nestedAnnotationCount:o,nestedAnnotationIds:a,nestedBadgeColor:l,interactionEpisodeStepCount:s,imageCount:u=0,color:c="#f50",showSendHint:d,bundleCount:h,onHoverNestedAnnotations:p,onHoverSendHint:f,onClearInteractionEpisode:m,onSend:g}){return 0!==o||0!==s||0!==u||d?(0,Hl.jsx)(Eo,{"data-popmelt-active-annotation-surface":"true",left:e+t+r.x+2-bo,top:n+r.y-bo,scrollX:r.x,scrollY:r.y,onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},style:{pointerEvents:"auto",zIndex:10002},children:(0,Hl.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,Hl.jsx)(So,{stepCount:s,onClear:m}),o>0&&i&&(0,Hl.jsx)(Ao,{count:o,color:l,onHoverChange:e=>p(i,e?a:null)}),(0,Hl.jsxs)("div",{style:{display:"flex",alignItems:"center",isolation:"isolate",marginLeft:u>0?4:0},children:[(0,Hl.jsx)(Ol,{imageCount:u,color:c}),d&&(0,Hl.jsx)(To,{layered:u>0,bundleCount:Math.max(1,h),onHoverChange:f,onSend:g})]})]})}):null}var Bl=c(h()),Vl=c(h());function ql(e,t,n){let r=[],i=0;for(let{textNode:o}of e){let e=Math.max(0,t-i),a=Math.min(o.length,n-i);if(i+=o.length,e>a||t!==n&&e===a||!o.isConnected)continue;let l=o.ownerDocument.createRange();l.setStart(o,e),l.setEnd(o,a);for(let e of l.getClientRects())e.height&&(t===n||e.width)&&r.push(at(e,o.ownerDocument));if(t===n&&t<i&&r.length)break}if(t===n&&!r.length&&!i){let t=e[0]?.textNode.parentElement?.closest("p")?.querySelector("br[data-popmelt-empty-paragraph]");if(t)return[at(t.getBoundingClientRect(),t.ownerDocument)]}return t===n?r.slice(-1):r}function Ul(e,t,n,r,i){let o=e[0]?.textNode.ownerDocument;if(!o)return null;let a=st(t,n,o),l=r.style.pointerEvents,s=i?.style.pointerEvents;r.style.pointerEvents="none",i&&(i.style.pointerEvents="none");try{let t=Pi(o,a.x,a.y);if(!t)return null;let n=0;for(let{textNode:r}of e){if(r===t.node)return n+t.offset;n+=r.length}return null}finally{r.style.pointerEvents=l,i&&(i.style.pointerEvents=s??"")}}var Yl=new WeakMap;var Xl=c(h());var Kl=c(h()),Ql=c(h()),Zl=c(b());function Gl({inputRef:e,value:t,style:n,command:r,onChange:i,onKeyDown:o,...a}){let l=(0,Kl.useRef)(null),{active:s,complete:u,hintId:c,inputProps:d}=function(e,t){let n=(0,Ql.useId)(),[r,i]=(0,Ql.useState)(-1),[o,a]=(0,Ql.useState)(!1),l=t.some(({suffix:e})=>e);(0,Ql.useLayoutEffect)(()=>{let t=e.current;if(!t||!l)return;let n=()=>i(t.matches(":focus")&&t.selectionStart===t.selectionEnd?t.selectionEnd:-1),r=()=>i(-1);return n(),t.addEventListener("selectionchange",n),t.addEventListener("select",n),t.addEventListener("input",n),t.addEventListener("focus",n),t.addEventListener("blur",r),()=>{t.removeEventListener("selectionchange",n),t.removeEventListener("select",n),t.removeEventListener("input",n),t.removeEventListener("focus",n),t.removeEventListener("blur",r)}},[l,e]);let s=o?void 0:t.find(({start:e,token:t,suffix:n})=>n&&e+t.length===r);return{active:s,complete:function(e,t){let n=e.currentTarget;if(!s||"Tab"!==e.key||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||e.nativeEvent.isComposing||n.selectionStart!==r||n.selectionEnd!==r)return!1;e.preventDefault(),e.stopPropagation();let i=/\\s/.test(n.value.charAt(r)),o=s.suffix+(i?"":" ");return n.ownerDocument.execCommand?.("insertText",!1,o)||(n.setRangeText(o,r,r,"end"),t()),i&&n.setSelectionRange(r+o.length+1,r+o.length+1),!0},hintId:n,inputProps:{"aria-autocomplete":s?"inline":void 0,"aria-describedby":s?n:void 0,onCompositionStart:()=>a(!0),onCompositionEnd:()=>a(!1)}}}(e,r?[r]:[]),h=s?.suffix;function p(e){l.current&&(l.current.scrollTop=e.scrollTop,l.current.scrollLeft=e.scrollLeft)}return(0,Kl.useLayoutEffect)(()=>{e.current&&r&&p(e.current)},[r,e,t]),(0,Zl.jsxs)(Zl.Fragment,{children:[r&&(0,Zl.jsxs)("div",{ref:l,"aria-hidden":"true","data-devtools":"annotation-command-display",style:{...n,position:"relative"===n.position?"absolute":n.position,pointerEvents:"none",userSelect:"none",fontWeight:400},children:[r.leading,(0,Zl.jsxs)("strong",{style:{fontWeight:700},children:[r.token,h&&(0,Zl.jsx)("span",{style:{opacity:.55},children:h})]}),r.body]}),(0,Zl.jsx)("textarea",{...a,ref:e,value:t,...d,onChange:e=>{let t=e.currentTarget;i(t.value,t.selectionStart)},onKeyDown:e=>{let t=e.currentTarget;u(e,()=>i(t.value,t.selectionStart))||o?.(e)},onScroll:e=>p(e.currentTarget),style:r?{...n,color:"transparent",caretColor:n.color,backgroundColor:"transparent",fontWeight:400}:n}),r&&h&&(0,Zl.jsxs)("span",{hidden:!0,id:c,children:["Press Tab to complete ",r.token,h,"."]})]})}var Jl=c(b());function es({value:e,command:t,fontSize:n,prefix:r,inputRef:i,inputStyle:o,target:a,singleTextNode:l,segments:s,canvasRef:u,selectionBackground:c,selectionColor:d,annotationBorderRadius:h,activeColor:p,boundaryRects:f,viewportClip:m,wrapsDomText:g,showEditor:y,rawLeft:v,top:x,baselineOffset:b,onChange:w,onKeyDown:S,onPaste:k,onBlur:C}){let M=function(e,t,n){let[r,i]=(0,Xl.useState)(null),o=(0,Xl.useRef)(null),a=(0,Xl.useRef)(null),l=(0,Xl.useCallback)(t=>{if(!e)return;let n=t.selectionStart,r=t.selectionEnd;i(e=>e?.start===n&&e.end===r?e:{start:n,end:r})},[e]);function s(n,r){if(!e||0!==n.button||!r&&!o.current)return;let i=n.currentTarget,s=Ul(e,n.clientX,n.clientY,i,t.current);if(null===s)return;n.preventDefault(),i.focus({preventScroll:!0});let u=function(e,t,n){if(n>=3)return{start:0,end:e.length};if(2===n&&"function"==typeof Intl.Segmenter){let n=new Intl.Segmenter(void 0,{granularity:"word"}).segment(e).containing(Math.min(t,e.length-1));if(n)return{start:n.index,end:n.index+n.segment.length}}return{start:t,end:t}}(i.value,s,r?n.detail:o.current.clicks);if(r){a.current=null;let e="backward"===i.selectionDirection?i.selectionEnd:i.selectionStart;o.current={anchor:n.shiftKey?{start:e,end:e}:u,clicks:n.detail}}let c=o.current.anchor;i.setSelectionRange(Math.min(c.start,u.start),Math.max(c.end,u.end),u.start<c.start?"backward":"forward"),l(i)}return(0,Xl.useLayoutEffect)(()=>{let t=n.current;if(!e||!t)return;let r=()=>l(t),i=()=>{t.matches(":focus")&&r()};return r(),t.ownerDocument.addEventListener("selectionchange",i),t.addEventListener("select",r),t.addEventListener("selectionchange",r),()=>{t.ownerDocument.removeEventListener("selectionchange",i),t.removeEventListener("select",r),t.removeEventListener("selectionchange",r)}},[n,e,l]),{selection:r,rects:e&&r?ql(e,r.start,r.end):[],caret:r?.start===r?.end,events:e?{onKeyDownCapture:function(n){let r=n.currentTarget,i="ArrowUp"===n.key?-1:"ArrowDown"===n.key?1:0,o="Home"===n.key||n.metaKey&&"ArrowLeft"===n.key,s="End"===n.key||n.metaKey&&"ArrowRight"===n.key;if(i||(a.current=null),!e||!i&&!o&&!s||n.altKey||n.ctrlKey||n.metaKey&&"ArrowLeft"!==n.key&&"ArrowRight"!==n.key||n.nativeEvent.isComposing)return;let u="backward"===r.selectionDirection,c=u?r.selectionStart:r.selectionEnd,d=u?r.selectionEnd:r.selectionStart,h=ql(e,c,c)[0];if(!h)return;let p=zi(ql(e,0,r.value.length)),f=h.top+h.height/2,m=p.findIndex(e=>f>=e.top&&f<=e.top+e.height);if(m<0)return;let g,y=p[m+i];if(y){i&&null===a.current&&(a.current=h.left);let n=o?y.left:s?y.left+y.width:a.current??h.left;g=Ul(e,Math.max(y.left+.1,Math.min(y.left+y.width-.1,n)),y.top+y.height/2,r,t.current)}else g=i<0?0:r.value.length;if(null===g)return;n.preventDefault();let v=n.shiftKey?d:g;r.setSelectionRange(Math.min(v,g),Math.max(v,g),g<v?"backward":"forward"),l(r)},onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.currentTarget.setPointerCapture(e.pointerId)},onInput:e=>l(e.currentTarget),onSelect:e=>l(e.currentTarget),onMouseDown:e=>s(e,!0),onMouseMove:e=>{1===e.buttons?s(e,!1):o.current=null},onMouseUp:()=>{o.current=null}}:{}}}(y?s:void 0,u,i),E=function(e,t,n,r,i,o,a){let l=(0,Vl.useRef)({selection:i,color:o,selectionBackground:a}),s=(0,Vl.useRef)(void 0),[u,c]=(0,Vl.useState)(!1);return(0,Vl.useLayoutEffect)(()=>{l.current={selection:i,color:o,selectionBackground:a},s.current?.()},[r,i,o,a]),(0,Vl.useLayoutEffect)(()=>{if(!e?.closest("[data-popmelt-hover-painter]")||!t)return void c(!1);let r=new AbortController,i=new CustomEvent("popmelt:paint-text-edit",{bubbles:!0,cancelable:!0,detail:{signal:r.signal,createOverlay:(e,r)=>function(e,t,n,r,i){let o=Kr(t,"painted-text-edit"),a=n.flatMap(t=>{let n=lo(e,t.textNodePath);return n?[{...t,textNode:n}]:[]});function l(e,t){let n=o.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path"),{left:r,top:a,height:l}=e,s=r+("caret"===t?1:e.width);n.setAttribute("d",`M${r} ${a}H${s}V${a+l}H${r}Z`),n.setAttribute("data-devtools","boundary"===t?"text-edit-active-boundary":`text-edit-${t}`),n.setAttribute("fill","selection"===t?i.selectionBackground:i.color),"boundary"===t&&(n.setAttribute("fill-opacity","0.08"),n.setAttribute("stroke",i.color),n.setAttribute("stroke-width","1"),n.setAttribute("vector-effect","non-scaling-stroke")),o.append(n)}let s=$i(a,e,ut(e).getComputedStyle(e),r);for(let e of s.boundaryRects)l(e,"boundary");if(i.selection){let{start:e,end:t}=i.selection;for(let n of ql(a,e,t))l(n,e===t?"caret":"selection")}return o}(e,r,t,n,l.current),setHitArea:t=>{Yl.set(e,t)},setRefresh:e=>{s.current=e}}});return c(!e.dispatchEvent(i)),()=>{s.current=void 0,r.abort(),Yl.delete(e)}},[e,t,n]),u}(a,s,l,e,y?M.selection:null,p,c),T=E||l||1!==f?.length?void 0:a,A=(0,Bl.useRef)(null);(0,Bl.useLayoutEffect)(()=>{A.current&&T&&A.current.setAttribute("d",Vt(T))},[T,f]);let R=void 0!==f;return(0,Jl.jsxs)("div",{"data-devtools":"text-editor-layer",style:m?{position:"fixed",inset:0,pointerEvents:"none",zIndex:10002,clipPath:`inset(${m.top}px ${Math.max(0,window.innerWidth-m.left-m.width)}px ${Math.max(0,window.innerHeight-m.top-m.height)}px ${m.left}px)`}:{display:"contents"},children:[(0,Jl.jsx)("style",{children:`\\n#devtools-text-input::placeholder { color: rgba(255, 255, 255, 0.5); }\\n#devtools-text-input::selection {\\n background: ${c};\\n color: ${d};\\n}\\n@keyframes popmeltDomCaret { 50% { opacity: 0; } }\\n@media (prefers-reduced-motion: no-preference) {\\n [data-devtools=\'text-edit-caret\'] { animation: popmeltDomCaret 1s step-end infinite; }\\n}\\n@keyframes popmeltAnnotationFieldEnter {\\n from { border-radius: 8px; }\\n to { border-radius: ${h}; }\\n}\\n@media (prefers-reduced-motion: reduce) {\\n #devtools-text-input { animation: none !important; }\\n}\\n`}),T&&(0,Jl.jsx)("svg",{"aria-hidden":"true",width:"100%",height:"100%",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:10002},children:(0,Jl.jsx)("path",{ref:A,"data-devtools":"text-edit-active-boundary",fill:p,fillOpacity:.08,stroke:p,strokeWidth:1,vectorEffect:"non-scaling-stroke"})}),!E&&!T&&f?.map((e,t)=>(0,Jl.jsx)("div",{"data-devtools":"text-edit-active-boundary",style:{position:"fixed",left:e.left,top:e.top,width:e.width,height:e.height,pointerEvents:"none",zIndex:10002,border:`1px solid ${p}`,backgroundColor:Xo(p,.08),boxSizing:"border-box"}},`${e.left}:${e.top}:${t}`)),!E&&y&&M.rects.map((e,t)=>(0,Jl.jsx)("div",{"aria-hidden":!0,"data-devtools":M.caret?"text-edit-caret":"text-edit-selection",style:{position:"fixed",left:e.left,top:e.top,width:M.caret?1:e.width,height:e.height,pointerEvents:"none",zIndex:10002,backgroundColor:M.caret?p:c}},`${e.left}:${e.top}:${t}`)),y&&(0,Jl.jsx)(Gl,{id:"devtools-text-input","data-popmelt-active-annotation-surface":R?void 0:"true",inputRef:i,command:t,value:e,onChange:w,onKeyDown:S,onPaste:k,onBlur:C,placeholder:R?void 0:"Type here...",wrap:R?g?"soft":"off":void 0,spellCheck:!1,...M.events,style:{...o,pointerEvents:"auto",opacity:E||M.rects.length?0:o.opacity}}),y&&!R&&r&&(0,Jl.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"fixed",left:v+8,top:x+4+b,zIndex:10002,pointerEvents:"none",color:"#ffffff",fontFamily:ci,fontSize:n,lineHeight:n*si+"px",whiteSpace:"pre"},children:r})]})}var ts=c(b());function ns({anchor:e,insetTopLeft:t=!1,width:n,height:r,value:i,command:o,fontSize:a,prefix:l,inputRef:s,inputStyle:u,onChange:c,onKeyDown:d,onPaste:h,onBlur:p,onContextMenu:f}){return(0,ts.jsxs)("div",{"data-popmelt-active-annotation-surface":"true",onContextMenu:f,style:{position:"relative",width:n,height:r,flex:`0 0 ${n}px`},children:[(0,ts.jsx)(Gl,{id:"devtools-text-input","data-popmelt-active-annotation-surface":"true",inputRef:s,command:o,value:i,onChange:c,onKeyDown:d,onPaste:h,onBlur:p,onClick:e=>e.stopPropagation(),placeholder:"Type here...",spellCheck:!1,style:{...u,position:"relative",left:0,top:0,zIndex:0,paddingTop:4,paddingBottom:4,borderRadius:li(t?"bottom-left":e),animation:void 0}}),l&&(0,ts.jsx)("span",{"aria-hidden":!0,"data-devtools":"annotation-number",style:{position:"absolute",left:8,top:4,zIndex:1,pointerEvents:"none",color:"#ffffff",fontFamily:ci,fontSize:a,fontWeight:600,lineHeight:a*si+"px",whiteSpace:"pre"},children:l})]})}var rs=c(h()),is=c(b());function os({color:e,cursorRef:t,tool:n,onHandoff:r,onDone:i}){let o=(0,rs.useRef)(null),a=(0,rs.useRef)(r);a.current=r,(0,rs.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let n=(t,n)=>{e.style.left=t-4+"px",e.style.top=n-4+"px"},r=t.current;r&&n(r.x,r.y);let i=e=>n(e.clientX,e.clientY);return window.addEventListener("pointermove",i,{capture:!0}),()=>window.removeEventListener("pointermove",i,{capture:!0})},[t]),(0,rs.useEffect)(()=>{let e=window.setTimeout(()=>a.current(),120);return()=>window.clearTimeout(e)},[]);let l="inspector"===n;return(0,is.jsxs)("div",{ref:o,"data-devtools":"cursor-switch-pulse",onAnimationEnd:i,style:{position:"fixed",left:-100,top:-100,zIndex:2147483647,width:24,height:24,pointerEvents:"none",transformOrigin:"0 0",animation:"popmeltCursorSwitchPulse 160ms ease-in-out both",filter:`drop-shadow(0 .5px .35px rgba(0,0,0,.22)) drop-shadow(0 .75px .65px ${Xo(e,.42)}) drop-shadow(0 1.25px 1.1px ${Xo(e,.24)})`},children:[(0,is.jsx)("svg",{width:"24",height:"24",viewBox:"-3 -3 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:l?(0,is.jsx)("path",{transform:"scale(1.125)",d:"M1 8V2C1 1.44772 1.44772 1 2 1H8C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z",fill:e,stroke:"white",strokeWidth:"1.111"}):(0,is.jsx)("path",{d:"M5.19194 14.2778L0.732307 2.01384C0.442115 1.21582 1.21582 0.442116 2.01384 0.732307L14.2778 5.19194C15.7506 5.72748 15.5191 7.87826 13.9661 8.08812L10.298 8.58381C9.40594 8.70436 8.70436 9.40594 8.58381 10.298L8.08812 13.9661C7.87826 15.5191 5.72748 15.7506 5.19194 14.2778Z",fill:e,stroke:"white",strokeWidth:"1.25"})}),(0,is.jsx)("style",{children:"\\n @keyframes popmeltCursorSwitchPulse {\\n 0%, 100% { transform: scale(1); }\\n 50% { transform: scale(1.5); }\\n 0%, 75% { opacity: 1; }\\n 100% { opacity: 0; }\\n }\\n "})]})}var as=c(h()),ls=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],ss=[50,100,200,300,400,500,600,700,800,900,950],us=500,cs="neutral",ds=950,hs={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}};function ps(e,t){return hs[e][t]}function fs(e,t){let n=ls.indexOf(e);return ls[(n+t+ls.length)%ls.length]}function ms(e){let t=e.trim().toLowerCase(),n=t.match(/^#([0-9a-f]{6})$/i)?.[1];if(n)return[Number.parseInt(n.slice(0,2),16),Number.parseInt(n.slice(2,4),16),Number.parseInt(n.slice(4,6),16)];let r=t.match(/^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function gs(e,t){let n=ms(e),r=ms(t);return null!==n&&null!==r&&n.every((e,t)=>e===r[t])}var ys=["padding","margin","border","radius","stack","grid","text","color","transform","opacity"],vs=[0,1,2,3,4,6,8,10,12,16],xs=[-16,-12,-10,-8,-6,-4,-3,-2,-1,0,1,2,3,4,6,8,10,12,16],bs=["vertical","horizontal"],ws=["stretch","start","center","end","baseline"],Ss=["start","center","end","between","around","evenly"],ks=[1,2,3,4,5,6],Cs=["xs","sm","base","lg","xl","2xl","3xl","4xl"],Ms=[300,400,500,600,700,800],Es=["none","tight","snug","normal","relaxed","loose"],Ts=["tighter","tight","normal","wide","wider","widest"],As=["left","center","right","justify"],Rs=[25,50,75,90,95,100,105,110,125,150],js=[-180,-90,-45,-25,-12,-6,-3,-2,-1,0,1,2,3,6,12,25,45,90,180],Is=[0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],zs=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ls={padding:vs,margin:vs,border:[0,1,2,4,8],radius:vs},Ps={padding:"p",margin:"m",border:"border",radius:"rounded",stack:"flex",grid:"grid",text:"text",color:"text",transform:"transform",opacity:"opacity"},Ns={padding:"P",margin:"M",border:"B",radius:"R",stack:"F",grid:"G",text:"FO",color:"BG",transform:"T",opacity:"O"},_s={padding:"Padding",margin:"Margin",border:"Borders",radius:"Radii",stack:"Flexbox",grid:"Grid",text:"Fonts",color:"Background",transform:"Transform",opacity:"Opacity"},Ds={padding:["all","x","y","top","right","bottom","left"],margin:["all","x","y","top","right","bottom","left"],border:["all","top","right","bottom","left","color"],radius:["all","top-left","top-right","bottom-right","bottom-left"],stack:["direction","gap","align","justify"],grid:["gap","rows","columns"],text:["size","weight","line-height","letter-spacing","text-align","color"],color:ls,transform:["translate","scale","rotate"],opacity:["opacity","mix-blend"]},Fs={all:"",x:"X",y:"Y",top:"T",right:"R",bottom:"B",left:"L","top-left":"TL","top-right":"TR","bottom-right":"BR","bottom-left":"BL",vertical:"V",horizontal:"H",direction:"D",gap:"G",align:"A",justify:"J",rows:"R",columns:"C",size:"S",weight:"W","line-height":"H","letter-spacing":"L","text-align":"A",color:"C",translate:"T",scale:"S",rotate:"R",opacity:"O","mix-blend":"B"};function Os(e){return ls.includes(e)}function $s(e,t){return"color"===e||("text"===e||"border"===e)&&("color"===t||Os(t))}var Hs=e=>encodeURIComponent(e),Ws=e=>`%3Cdefs%3E%3Cfilter id=\'cursor-shadow\' x=\'-35%25\' y=\'-35%25\' width=\'170%25\' height=\'180%25\'%3E%3CfeDropShadow dx=\'0\' dy=\'.5\' stdDeviation=\'.35\' flood-color=\'black\' flood-opacity=\'.22\'/%3E%3CfeDropShadow dx=\'0\' dy=\'.75\' stdDeviation=\'.65\' flood-color=\'${Hs(e)}\' flood-opacity=\'.42\'/%3E%3CfeDropShadow dx=\'0\' dy=\'1.25\' stdDeviation=\'1.1\' flood-color=\'${Hs(e)}\' flood-opacity=\'.24\'/%3E%3C/filter%3E%3C/defs%3E`;function Bs(e="black"){return`url("data:image/svg+xml,%3Csvg width=\'24\' height=\'24\' viewBox=\'-3 -3 24 24\' fill=\'none\' xmlns=\'http://www.w3.org/2000/svg\'%3E${Ws(e)}%3Cpath filter=\'url(%23cursor-shadow)\' d=\'M5.19194 14.2778L0.732307 2.01384C0.442115 1.21582 1.21582 0.442116 2.01384 0.732307L14.2778 5.19194C15.7506 5.72748 15.5191 7.87826 13.9661 8.08812L10.298 8.58381C9.40594 8.70436 8.70436 9.40594 8.58381 10.298L8.08812 13.9661C7.87826 15.5191 5.72748 15.7506 5.19194 14.2778Z\' fill=\'${Hs(e)}\' stroke=\'white\' stroke-width=\'1.25\'/%3E%3C/svg%3E") 4 4, pointer`}function Vs(e="black"){return`url("data:image/svg+xml,%3Csvg width=\'24\' height=\'24\' viewBox=\'-3 -3 24 24\' fill=\'none\' xmlns=\'http://www.w3.org/2000/svg\'%3E${Ws(e)}%3Cpath transform=\'scale(1.125)\' filter=\'url(%23cursor-shadow)\' d=\'M1 8V2C1 1.44772 1.44772 1 2 1H8C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z\' fill=\'${Hs(e)}\' stroke=\'white\' stroke-width=\'1.111\'/%3E%3C/svg%3E") 4 4, pointer`}function qs(e,t="all"){let n=Xs(e,t);return"color"===e||("text"===e||"border"===e)&&$s(e,n)?ss:"stack"===e?"direction"===n?bs:"align"===n?ws:"justify"===n?Ss:vs:"grid"===e?"gap"===n?vs:ks:"text"===e?"weight"===n?Ms:"line-height"===n?Es:"letter-spacing"===n?Ts:"text-align"===n?As:Cs:"transform"===e?"scale"===n?Rs:"rotate"===n?js:xs:"opacity"===e?"mix-blend"===n?zs:Is:Ls[e]}function Us(e,t,n="all"){let r=qs(e,n);if(r.includes(t))return t;if("number"!=typeof t)return r[0];let i=r.filter(e=>"number"==typeof e);return 0===i.length?r[0]:i.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Ys(e){return Ds[e]}function Xs(e,t){if("stack"===e&&("vertical"===t||"horizontal"===t))return"direction";if(("text"===e||"border"===e)&&Os(t))return t;let n=Ys(e);return n.includes(t)?t:n[0]}function Ks(e,t){return"text"===e?"size":"transform"===e?"translate":"opacity"===e?"opacity":Xs(e,t)}function Qs(e,t,n){return"family"===e?"family":"text"!==t&&"border"!==t||"color"!==n?"value":"variant"}function Zs(e,t,n,r="all"){let i=qs(e,r),o=Us(e,t,r),a=i.indexOf(o);return i[(a+n+i.length)%i.length]}function Gs(e){return _s[e]}function Js(e,t){let n=Xs(e,t);return"color"===e||("text"===e||"border"===e)&&Os(n)?n[0].toUpperCase()+n.slice(1):"text"===e?"size"===n?"Size":"weight"===n?"Weight":"line-height"===n?"Leading":"letter-spacing"===n?"Tracking":"text-align"===n?"Align":"Color":"border"===e&&"color"===n?"Color":"transform"===e?"translate"===n?"translate":n:"opacity"===e?"mix-blend"===n?"mix-blend-mode":"opacity":"all"===n?Gs(e):Fs[n]}function eu(e,t){let n=Xs(e,t);if("color"===e)return"background-color";if("stack"===e)return"direction"===n?"flex-direction":"align"===n?"align-items":"justify"===n?"justify-content":"gap";if("grid"===e)return"rows"===n?"grid-template-rows":"columns"===n?"grid-template-columns":"gap";if("text"===e)return"color"===n||Os(n)?"color":"weight"===n?"font-weight":"line-height"===n?"line-height":"letter-spacing"===n?"letter-spacing":"text-align"===n?"text-align":"font-size";if("border"===e&&("color"===n||Os(n)))return"border-color";if("transform"===e)return n;if("opacity"===e)return"mix-blend"===n?"mix-blend-mode":"opacity";if("radius"===e)return"all"===n?"border-radius":`border-${n}-radius`;let r="border"===e?"border":e,i="border"===e?"width":"";return"all"===n?i?`${r}-${i}`:r:"padding"!==e&&"margin"!==e||"x"!==n?"padding"!==e&&"margin"!==e||"y"!==n?i?`${r}-${n}-${i}`:`${r}-${n}`:`${r}-top`:`${r}-left`}function tu(e,t){let n=Xs(e,t);return"color"===e?["background-color"]:"stack"===e||"grid"===e?"gap"===n?["row-gap","column-gap"]:[eu(e,n)]:"text"===e?"color"===n||Os(n)?["color"]:"line-height"===n||"letter-spacing"===n?[eu(e,n),"font-size"]:[eu(e,n)]:"border"!==e||"color"!==n&&!Os(n)?"transform"===e||"opacity"===e?[eu(e,n)]:"padding"!==e&&"margin"!==e||"x"!==n?"padding"!==e&&"margin"!==e||"y"!==n?"all"!==n?[eu(e,n)]:"radius"===e?["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"]:"border"===e?["border-top-width","border-right-width","border-bottom-width","border-left-width"]:[`${e}-top`,`${e}-right`,`${e}-bottom`,`${e}-left`]:[`${e}-top`,`${e}-bottom`]:[`${e}-left`,`${e}-right`]:["border-top-color","border-right-color","border-bottom-color","border-left-color"]}function nu(e,t){let n=e.trim().toLowerCase();if(("stack"===t||"grid"===t)&&"normal"===n)return 0;let r=n.split(/[\\s/]+/).filter(Boolean);if(0===r.length)return null;let i=r.map(e=>{if(/^0(?:\\.0+)?$/.test(e))return 0;let t=e.match(/^(-?\\d+(?:\\.\\d+)?)px$/);return t?Number(t[1]):Number.NaN});return i.some(e=>!Number.isFinite(e))?null:i.every(e=>Math.abs(e-i[0])<.01)?i[0]:null}function ru(e,t,n){let r=n.trim().toLowerCase();if("text"===e){if("size"===t){let t=nu(n,e);return null===t?null:gu(Cs,e=>hu[e],t)}if("weight"===t){if("normal"===r)return 400;if("bold"===r)return 700;let e=Number(r);return Number.isFinite(e)?gu(Ms,e=>e,e):null}if("text-align"===t)return"start"===r?"left":"end"===r?"right":As.includes(r)?r:null}if("transform"===e){if("none"===r)return"scale"===t?100:0;if("translate"===t){let t=nu(n,e);return null===t?null:gu(vs,e=>4*e,t)}if("scale"===t){let e=100*Number.parseFloat(n);return Number.isFinite(e)?gu(Rs,e=>e,e):null}if("rotate"===t){let e=Number.parseFloat(n);return Number.isFinite(e)?gu(js,e=>e,e):null}}if("opacity"===e){if("mix-blend"===t)return zs.includes(r)?r:null;let e=100*Number.parseFloat(n);return Number.isFinite(e)?gu(Is,e=>e,e):null}if("stack"!==e)return null;if("direction"===t){if("column"===r||"column-reverse"===r)return"vertical";if("row"===r||"row-reverse"===r)return"horizontal"}if("align"===t){if("flex-start"===r||"start"===r)return"start";if("center"===r)return"center";if("flex-end"===r||"end"===r)return"end";if("stretch"===r)return"stretch";if("baseline"===r)return"baseline"}if("justify"===t){if("flex-start"===r||"start"===r)return"start";if("center"===r)return"center";if("flex-end"===r||"end"===r)return"end";if("space-between"===r)return"between";if("space-around"===r)return"around";if("space-evenly"===r)return"evenly"}return null}function iu(e,t,n,r){let i=function(e,t,n,r="all"){let i=Xs(e,r);if("color"===e||("text"===e||"border"===e)&&Os(i)){let e=ps(i,t);return n.length>0&&n.every(t=>gs(t,e))}if("text"===e){if("size"===i){let r=nu(n[0]??"",e);return null!==r&&Math.abs(r-hu[t])<.01}if("weight"===i)return ru(e,i,n[0]??"")===t;if("line-height"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=nu(r,e),o=nu(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-fu[t])<.01}if("letter-spacing"===i){let r=(n[0]??"").trim().toLowerCase();if("normal"===r)return"normal"===t;let i=nu(r,e),o=nu(n[1]??"",e);return null!==i&&null!==o&&0!==o&&Math.abs(i/o-mu[t])<.001}return ru(e,i,n[0]??"")===t}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==i)return ru(e,i,n[0]??"")===t;if("grid"===e&&"gap"!==i)return(n[0]?.trim().split(/\\s+/).filter(Boolean).length??0)===t;if("number"!=typeof t)return!1;let o=Number.parseFloat(su(e,t,i)),a=n.map(t=>nu(t,e));return a.length>0&&a.every(e=>null!==e&&Math.abs(e-o)<.01)}(e,t,tu(e,n).map(r),n),o=du(e),a=uu(e,n,t).every(e=>r(e.property).trim()===e.value),l="border"===e&&!$s(e,n)&&"number"==typeof t&&t>0?ou(n):null,s=!l||!["","none"].includes(r(l).trim());return i&&(!o||r("display").trim()===o)&&a&&s}function ou(e){let t=Xs("border",e);return"all"===t?"border-style":`border-${t}-style`}function au(e){return"color"===e?"background-color":"border"===e?"border-top-color":"color"}function lu(e,t,n){let r=Xs(e,n);if("color"===e)return`bg-${r}-${t}`;if("stack"===e)return"direction"===r?"horizontal"===t?"flex-row":"flex-col":"gap"===r?`gap-${t}`:"align"===r?`items-${t}`:`justify-${t}`;if("grid"===e)return"gap"===r?`gap-${t}`:`${"rows"===r?"grid-rows":"grid-cols"}-${t}`;if("text"===e)return Os(r)?`text-${r}-${t}`:"size"===r?`text-${t}`:"weight"===r?pu[t]:"line-height"===r?`leading-${t}`:"letter-spacing"===r?`tracking-${t}`:`text-${t}`;if("border"===e&&Os(r))return`border-${r}-${t}`;if("transform"===e)return`${r}-${t}`;if("opacity"===e)return"mix-blend"===r?`mix-blend-${t}`:`opacity-${t}`;let i=Ps[e];if("all"===r)return`${i}-${t}`;let o="top-left"===r?"tl":"top-right"===r?"tr":"bottom-right"===r?"br":"bottom-left"===r?"bl":r[0];return"padding"===e||"margin"===e?`${i}${o}-${t}`:`${i}-${o}-${t}`}function su(e,t,n="all"){let r=Xs(e,n);if("color"===e||("text"===e||"border"===e)&&Os(r))return ps(r,t);if("stack"===e){if("direction"===r)return"horizontal"===t?"row":"column";if("align"===r)return"start"===t?"flex-start":"end"===t?"flex-end":String(t);if("justify"===r)return"start"===t?"flex-start":"end"===t?"flex-end":"between"===t||"around"===t||"evenly"===t?`space-${t}`:String(t)}return"grid"===e&&"gap"!==r?`repeat(${t}, minmax(0, 1fr))`:"text"===e?"size"===r?`${hu[t]}px`:"weight"===r?String(t):"line-height"===r?String(fu[t]):"letter-spacing"===r?`${mu[t]}em`:String(t):"transform"===e?"scale"===r?String(Number(t)/100):"rotate"===r?`${t}deg`:`${4*Number(t)}px ${4*Number(t)}px`:"opacity"===e?String("mix-blend"===r?t:Number(t)/100):"number"!=typeof t?"0px":`${"border"===e?t:4*t}px`}function uu(e,t,n){let r=Xs(e,t);return"padding"!==e&&"margin"!==e||"x"!==r&&"y"!==r?[]:[{property:"x"===r?`${e}-right`:`${e}-bottom`,value:su(e,n??0,r),token:lu(e,n??0,r)}]}function cu(e,t,n){if("text"===t&&("size"===n||"all"===n))return String(hu[e]);if("text"===t&&"line-height"===n){let t=fu[e];return String(Number(t.toFixed(1)))}if("text"===t&&"letter-spacing"===n){let t=mu[e];return String(Number(t.toFixed(2))).replace(/^(-?)0\\./,"$1.")}return"number"==typeof e?String(e):"vertical"===e?"V":"horizontal"===e?"H":"start"===e?"S":"center"===e?"C":"end"===e?"E":"stretch"===e?"ST":"baseline"===e?"BL":"between"===e?"BT":"around"===e?"AR":"EV"}function du(e){return"stack"===e?"flex":"grid"===e?"grid":null}Bs(),Vs();var hu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},pu={300:"font-light",400:"font-normal",500:"font-medium",600:"font-semibold",700:"font-bold",800:"font-extrabold"},fu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},mu={tighter:-.05,tight:-.025,normal:0,wide:.025,wider:.05,widest:.1};function gu(e,t,n){return e.reduce((e,r)=>Math.abs(t(r)-n)<Math.abs(t(e)-n)?r:e)}var yu=Math.SQRT1_2;function vu(e,t){return qs(e,t).filter(e=>"number"==typeof e)}function xu(e,t,n){return vu(e,t).reduce((r,i)=>Math.abs(Number.parseFloat(su(e,i,t))-n)<Math.abs(Number.parseFloat(su(e,r,t))-n)?i:r)}function bu(e,t){let n=vu("transform",e),r=t=>"translate"===e?Number.parseFloat(su("transform",t,e)):t;return n.reduce((e,n)=>Math.abs(r(n)-t)<Math.abs(r(e)-t)?n:e)}function wu(e,t){return t?e:"left"===e||"right"===e?"x":"y"}function Su(e,t){return t?e:"all"}function ku(e){return{x:("top-left"===e||"bottom-left"===e?1:-1)*yu,y:("top-left"===e||"top-right"===e?1:-1)*yu}}function Cu(e,t){let n=Math.max(1,t);return(e%n+n)%n}var Mu=c(b()),Eu=["top-left","top-right","bottom-right","bottom-left"];function Tu({element:e,radius:t,accentColor:n,hoveredCorner:r,draggingCorner:i,cursorViewport:o,onHandlePointerDown:a}){let[l,s]=(0,as.useState)(null),u=t["top-left"],c=t["top-right"],d=t["bottom-right"],h=t["bottom-left"];if((0,as.useEffect)(()=>{if(!e)return void s(null);let t=()=>{s(e.getBoundingClientRect())};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,as.useLayoutEffect)(()=>{e&&s(e.getBoundingClientRect())},[e,u,c,d,h]),!l)return null;let p=l.width,f=l.height;if(!function(e,t,n){if(e<40||t<40)return!1;let r=["top-left","top-right","bottom-right","bottom-left"].map(r=>{let i=ku(r),o=14+n[r],a=r.endsWith("left")?0:e,l=r.startsWith("top")?0:t;return{x:a+i.x*o,y:l+i.y*o}});return r.every((e,t)=>r.slice(t+1).every(t=>Math.hypot(e.x-t.x,e.y-t.y)>=20))}(p,f,t))return null;let m=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(n),g={"top-left":{x:0,y:0},"top-right":{x:p,y:0},"bottom-right":{x:p,y:f},"bottom-left":{x:0,y:f}},y=Object.fromEntries(Eu.map(e=>{let n=ku(e),r=14+t[e],i=g[e];return[e,{x:i.x+n.x*r,y:i.y+n.y*r}]})),v=i??r,x={position:"fixed",top:l.top,left:l.left,width:p,height:f,pointerEvents:"none",zIndex:a?9999:9996,overflow:"visible"};return(0,Mu.jsxs)("div",{"data-devtools":"border-radius-handles","data-popmelt-steer-overlay":!0,style:x,children:[(0,Mu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${p} ${f}`,children:[(0,Mu.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,p-1),height:Math.max(0,f-1),fill:"none",stroke:m,strokeWidth:"1"}),Eu.map(e=>{let t=y[e];return(0,Mu.jsx)("circle",{cx:t.x,cy:t.y,r:e===v?4:3,fill:n,stroke:"#ffffff",strokeWidth:2},e)}),a&&Eu.map(e=>{let t=y[e],n=g[e],r="top-left"===e||"bottom-right"===e?"nwse-resize":"nesw-resize";return(0,Mu.jsxs)("g",{children:[(0,Mu.jsx)("line",{"data-radius-handle-access":e,x1:n.x,y1:n.y,x2:t.x,y2:t.y,stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{pointerEvents:"stroke",cursor:r},onPointerDown:t=>a(e,t)}),(0,Mu.jsx)("circle",{cx:t.x,cy:t.y,r:10,fill:"transparent",style:{pointerEvents:"all",cursor:r},onPointerDown:t=>a(e,t)})]},`hit-${e}`)})]}),o&&v&&(()=>{let e=Math.round(t[v]);return(0,Mu.jsx)("div",{style:{position:"fixed",left:o.x+8,top:o.y-28,background:n,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:e})})()]})}var Au=c(h()),Ru=c(b());function ju({centerX:e,centerY:t,orientation:n,accentColor:r,...i}){let o="horizontal"===n?10:6,a="horizontal"===n?6:10;return(0,Ru.jsx)("rect",{...i,"data-direct-manipulation-handle":"",x:e-o/2,y:t-a/2,width:o,height:a,fill:r,stroke:"#ffffff",strokeWidth:2})}var Iu=c(b());function zu(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);return n?`oklch(${n[1]} / ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}function Lu({element:e,gap:t,accentColor:n,hoveredAxis:r,draggingAxis:i,cursorViewport:o,isAutoGap:a=!1,refreshKey:l=0,onHandlePointerDown:s}){let[u,c]=(0,Au.useState)(null),[d,h]=(0,Au.useState)([]),[p,f]=(0,Au.useState)(!1);if((0,Au.useEffect)(()=>{let e=e=>{("Meta"===e.key||"Control"===e.key)&&f(!0)},t=e=>{("Meta"===e.key||"Control"===e.key)&&f(!1)},n=()=>f(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",t,!0),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("blur",n)}},[]),(0,Au.useEffect)(()=>{if(!e)return c(null),void h([]);let t=()=>{c(e.getBoundingClientRect()),h(bi(e))};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Au.useLayoutEffect)(()=>{e&&(c(e.getBoundingClientRect()),h(bi(e)))},[e,t.row,t.column,l]),!u||0===d.length)return null;let m=u.width,g=u.height,y="pm-gap-stripe-pattern",v=zu(n,.25),x=zu(n,.1),b=zu(n,.2),w={position:"fixed",top:u.top,left:u.left,width:m,height:g,pointerEvents:"none",zIndex:s?9999:9996,overflow:"visible"},S=i??r;return(0,Iu.jsxs)("div",{"data-devtools":"gap-handles","data-popmelt-steer-overlay":!0,style:w,children:[(0,Iu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${m} ${g}`,children:[(0,Iu.jsx)("defs",{children:(0,Iu.jsx)("pattern",{id:y,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Iu.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:v,strokeWidth:"1.5"})})}),(0,Iu.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,m-1),height:Math.max(0,g-1),fill:"none",stroke:b,strokeWidth:"1"}),d.map((e,n)=>{let r=e.x-u.left,i=e.y-u.top,o=e.w,a=e.h,l=!p||e.axis===S;return 0===("row"===e.axis?t.row:t.column)?null:(0,Iu.jsxs)("g",{opacity:l?1:.6,children:[(0,Iu.jsx)("rect",{x:r,y:i,width:o,height:a,fill:x}),(0,Iu.jsx)("rect",{x:r,y:i,width:o,height:a,fill:`url(#${y})`})]},n)}),d.map((e,t)=>{let r=e.x-u.left+e.w/2,i=e.y-u.top+e.h/2;return a?(0,Iu.jsx)("circle",{"data-gap-handle":e.axis,cx:r,cy:i,r:3,fill:n,stroke:"#ffffff",strokeWidth:2},`gap-handle-${t}`):(0,Iu.jsx)(ju,{"data-gap-handle":e.axis,centerX:r,centerY:i,orientation:"column"===e.axis?"vertical":"horizontal",accentColor:n},`gap-handle-${t}`)}),s&&d.map((e,t)=>{let n=e.x-u.left+e.w/2,r=e.y-u.top+e.h/2,i=Math.max(e.w,20),o=Math.max(e.h,20);return(0,Iu.jsx)("rect",{x:n-i/2,y:r-o/2,width:i,height:o,fill:"transparent",style:{pointerEvents:"all",cursor:"row"===e.axis?"ns-resize":"ew-resize"},onPointerDown:t=>s(e.axis,t)},`gap-hit-${t}`)})]}),o&&S&&(()=>{let e=a?"auto":String(Math.round("row"===S?t.row:t.column));return(0,Iu.jsx)("div",{style:{position:"fixed",left:o.x+8,top:o.y-28,background:n,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:e})})()]})}var Pu=c(h()),Nu=new Set(["CANVAS","EMBED","IFRAME","IMG","INPUT","OBJECT","VIDEO"]),_u=["top","bottom"],Du=["left","right"];var Fu=c(b());function Ou(e,t){let n=e.match(/^oklch\\(([^)]+)\\)$/i);return n?`oklch(${n[1]} / ${t})`:`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}var $u={top:"bottom",bottom:"top",left:"right",right:"left"},Hu="#808080";function Wu({element:e,padding:t,mode:n="padding",accentColor:r,hoveredSide:i,draggingSide:o,activeSides:a,cursorViewport:l,onHandlePointerDown:s}){let[,u]=(0,Pu.useReducer)(e=>e+1,0),[c,d]=(0,Pu.useState)(!1);(0,Pu.useEffect)(()=>{let e=e=>{("Alt"===e.key||"Control"===e.key)&&d(!0)},t=e=>{("Alt"===e.key||"Control"===e.key)&&d(!1)},n=()=>d(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",t,!0),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("blur",n)}},[]),(0,Pu.useEffect)(()=>ea(u),[]);let h=e.getBoundingClientRect(),p=h.width,f=h.height,{top:m,right:g,bottom:y,left:v}=t,x=Math.max(0,m),b=Math.max(0,g),w=Math.max(0,y),S=Math.max(0,v),k="margin"===n,C=k?p+S+b:p,M=k?f+x+w:f,E=k?S:0,T=k?x:0,A=k?"pm-dot-pattern":"pm-stripe-pattern",R=Ou(r,.25),j=Ou(r,.1),I=Ou(r,.2),z=Ou(Hu,.55),L=Ou(Hu,.18),P=Ou(Hu,.9),N=new Set(k?[]:function(e,t=window.getComputedStyle(e)){return function({isHtmlElement:e,tagName:t,display:n,writingMode:r}){return!e||"inline"!==n||Nu.has(t)?[]:r.startsWith("horizontal")?_u:Du}({isHtmlElement:e instanceof HTMLElement,tagName:e.tagName,display:t.display,writingMode:t.writingMode})}(e)),_=N.size>0,D="pm-neutral-stripe-pattern",F={position:"fixed",top:h.top-(k?x:0),left:h.left-(k?S:0),width:C,height:M,pointerEvents:"none",zIndex:s?9999:9996,overflow:"visible"},O=["top","right","bottom","left"],$={top:`0,0 ${C},0 ${C-b},${x} ${S},${x}`,right:`${C},0 ${C},${M} ${C-b},${M-w} ${C-b},${x}`,bottom:`0,${M} ${S},${M-w} ${C-b},${M-w} ${C},${M}`,left:`0,0 ${S},${x} ${S},${M-w} 0,${M}`},H={top:{x:C/2,y:x/2,orientation:"horizontal"},bottom:{x:C/2,y:M-w/2,orientation:"horizontal"},left:{x:S/2,y:M/2,orientation:"vertical"},right:{x:C-b/2,y:M/2,orientation:"vertical"}},W=new Set(a);return o?W.add(o):i&&(W.add(i),c||W.add($u[i])),(0,Fu.jsxs)("div",{"data-devtools":"padding-handles","data-popmelt-steer-overlay":!0,style:F,children:[(0,Fu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${C} ${M}`,children:[(0,Fu.jsxs)("defs",{children:[k?(0,Fu.jsx)("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"4",height:"4",children:(0,Fu.jsx)("circle",{cx:"1",cy:"1",r:"0.65",fill:R})}):(0,Fu.jsx)("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Fu.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:R,strokeWidth:"1.5"})}),_&&(0,Fu.jsx)("pattern",{id:D,patternUnits:"userSpaceOnUse",width:"4",height:"4",patternTransform:"rotate(45)",children:(0,Fu.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:z,strokeWidth:"1.5"})})]}),(0,Fu.jsx)("rect",{x:E+.5,y:T+.5,width:Math.max(0,p-1),height:Math.max(0,f-1),fill:"none",stroke:I,strokeWidth:"1"}),O.map(e=>{if(t[e]<=0)return null;let n=W.has(e),r=N.has(e);return(0,Fu.jsxs)("g",{"data-padding-flow":r?"paint-only":"layout",opacity:n?1:.6,children:[(0,Fu.jsx)("polygon",{points:$[e],fill:r?L:j}),(0,Fu.jsx)("polygon",{points:$[e],fill:`url(#${r?D:A})`})]},e)}),N.has("top")&&x>0&&(0,Fu.jsx)("line",{x1:S,y1:x,x2:C-b,y2:x,stroke:P,strokeWidth:"1"}),N.has("bottom")&&w>0&&(0,Fu.jsx)("line",{x1:S,y1:M-w,x2:C-b,y2:M-w,stroke:P,strokeWidth:"1"}),N.has("left")&&S>0&&(0,Fu.jsx)("line",{x1:S,y1:x,x2:S,y2:M-w,stroke:P,strokeWidth:"1"}),N.has("right")&&b>0&&(0,Fu.jsx)("line",{x1:C-b,y1:x,x2:C-b,y2:M-w,stroke:P,strokeWidth:"1"}),O.map(e=>{let t=H[e];return(0,Fu.jsx)(ju,{centerX:t.x,centerY:t.y,orientation:t.orientation,accentColor:N.has(e)?Hu:r,"data-padding-flow":N.has(e)?"paint-only":"layout"},`handle-${e}`)}),s&&O.map(e=>{let t=H[e];return(0,Fu.jsx)("rect",{x:t.x-10,y:t.y-10,width:20,height:20,fill:"transparent",style:{pointerEvents:"all",cursor:"grab"},onPointerDown:t=>s(e,t)},`hit-${e}`)})]}),l&&(i||o)&&(()=>{let e=o??i,n=Math.round(t[e]),a=N.has(e);return(0,Fu.jsxs)("div",{style:{position:"fixed",left:l.x+8,top:l.y-28,background:a?Hu:r,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:[n,a?" · paint only":""]})})()]})}var Bu=c(h()),Vu=c(b()),qu=["flex-start","center","flex-end"],Uu=["flex-start","center","flex-end"];function Yu(e){let t=Array.from(e.children);if(0===t.length)return null;let n=1/0,r=1/0,i=-1/0,o=-1/0;for(let e of t){let t=e.getBoundingClientRect();0===t.width&&0===t.height||(t.top<n&&(n=t.top),t.left<r&&(r=t.left),t.bottom>i&&(i=t.bottom),t.right>o&&(o=t.right))}return n===1/0?null:new DOMRect(r,n,o-r,i-n)}function Xu({element:e,modifier:t,accentColor:n,refreshKey:r=0}){let[i,o]=(0,Bu.useState)(null);if((0,Bu.useEffect)(()=>{if(!e)return void o(null);let t=()=>o(Yu(e));return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Bu.useLayoutEffect)(()=>{e&&o(Yu(e))},[e,r]),!i)return null;let a=i,l=window.getComputedStyle(e),s=l.display;if("flex"!==s&&"inline-flex"!==s)return null;let u=l.flexDirection,c="column"===u||"column-reverse"===u?"vertical":"horizontal",d="horizontal"===c?"vertical":"horizontal",h=[];if("shift"===t){let e=function(e){return"normal"===e||"flex-start"===e||"start"===e?"flex-start":"flex-end"===e||"end"===e?"flex-end":"center"===e?"center":null}(l.justifyContent);if(e){let t=qu.indexOf(e);"horizontal"===c?(t>0&&h.push("left"),t<qu.length-1&&h.push("right")):(t>0&&h.push("up"),t<qu.length-1&&h.push("down"))}}else{let e=function(e){return"normal"===e||"stretch"===e||"flex-start"===e||"start"===e?"flex-start":"flex-end"===e||"end"===e?"flex-end":"center"===e?"center":null}(l.alignItems);if(e){let t=Uu.indexOf(e);"horizontal"===d?(t>0&&h.push("left"),t<Uu.length-1&&h.push("right")):(t>0&&h.push("up"),t<Uu.length-1&&h.push("down"))}}return 0===h.length?null:(0,Vu.jsx)(Vu.Fragment,{children:h.map(e=>{let t,r;switch(e){case"right":t=a.right+14,r=a.top+a.height/2;break;case"left":t=a.left-14,r=a.top+a.height/2;break;case"down":t=a.left+a.width/2,r=a.bottom+14;break;case"up":t=a.left+a.width/2,r=a.top-14}let i="right"===e?0:"left"===e?180:"down"===e?90:-90,o={position:"fixed",left:t-7,top:r-7,width:14,height:14,pointerEvents:"none",zIndex:9997};return(0,Vu.jsx)("div",{"data-devtools":"swipe-hint",style:o,children:(0,Vu.jsx)("svg",{width:14,height:14,viewBox:"-7 -7 14 14",style:{overflow:"visible"},children:(0,Vu.jsxs)("g",{transform:`rotate(${i})`,children:[(0,Vu.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round"}),(0,Vu.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:"#fff",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Vu.jsx)("line",{x1:"-5",y1:"0",x2:"3",y2:"0",stroke:n,strokeWidth:"1.5",strokeLinecap:"round"}),(0,Vu.jsx)("polyline",{points:"0,-4 5,0 0,4",fill:"none",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})},e)})})}var Ku=c(h()),Qu=c(b());function Zu({element:e,fontSize:t,lineHeight:n,accentColor:r,hoveredProperty:i,draggingProperty:o,cursorViewport:a}){let[l,s]=(0,Ku.useState)(null);if((0,Ku.useEffect)(()=>{if(!e)return void s(null);let t=()=>{s(Ti(e))};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e]),(0,Ku.useLayoutEffect)(()=>{e&&s(Ti(e))},[e,t,n]),!l)return null;let u=l.width,c=l.height,d=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(r),h=o??i,p={position:"fixed",top:l.top,left:l.left,width:u,height:c,pointerEvents:"none",zIndex:9996,overflow:"visible"};return(0,Qu.jsxs)("div",{"data-devtools":"text-handles",style:p,children:[(0,Qu.jsxs)("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:`0 0 ${u} ${c}`,children:[(0,Qu.jsx)("rect",{x:"0.5",y:"0.5",width:Math.max(0,u-1),height:Math.max(0,c-1),fill:"none",stroke:d,strokeWidth:"1"}),("font-size"===h||!h)&&(0,Qu.jsx)("rect",{x:u-1,y:c/2-4,width:2,height:8,fill:r,stroke:"#ffffff",strokeWidth:"font-size"===h?4:2,paintOrder:"stroke"}),("line-height"===h||!h)&&(0,Qu.jsx)("rect",{x:u/2-4,y:c-1,width:8,height:2,fill:r,stroke:"#ffffff",strokeWidth:"line-height"===h?4:2,paintOrder:"stroke"})]}),a&&h&&(()=>{let e="font-size"===h?"Aa":"Lh",i=(e=>"font-size"===e?`${Math.round(t)}`:(t>0?n/t:1.2).toFixed(2).replace(/\\.?0+$/,""))(h);return(0,Qu.jsxs)("div",{style:{position:"fixed",left:a.x+8,top:a.y-28,background:r,color:"#fff",fontSize:11,fontWeight:600,fontFamily:\'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace\',lineHeight:1,padding:"4px 4px",borderRadius:0,whiteSpace:"nowrap",pointerEvents:"none",zIndex:9997},children:[e," ",i]})})()]})}var Gu=c(b());function Ju({active:e,accentColor:t,domDropPreview:n,cursorViewport:r,gapElement:i,gapDragging:o,gapHoveredAxis:a,gapIsAuto:l,gapRefreshKey:s,swipeHint:u,radiusElement:c,radiusDragging:d,radiusHoveredCorner:h,textElement:p,textDragging:f,textHoveredProperty:m,paddingElement:g,paddingDragging:y,paddingHoveredSide:v}){if(!e)return null;let x=p&&!f?Ai(p):null;return(0,Gu.jsxs)(Gu.Fragment,{children:[n&&(0,Gu.jsx)("div",{"data-devtools":"dom-drop-preview",style:{position:"fixed",zIndex:9997,pointerEvents:"none",backgroundColor:t,boxShadow:`0 0 0 1px ${t}`,opacity:"copy"===n.mode?.72:1,...n.rect.height>=n.rect.width?{left:n.rect.left-2,top:"before"===n.placement?n.rect.top-2:n.rect.bottom,width:n.rect.width+4,height:2}:{left:"before"===n.placement?n.rect.left-2:n.rect.right,top:n.rect.top-2,width:2,height:n.rect.height+4}}}),i&&(0,Gu.jsx)(Lu,{element:i,gap:o?{row:o.row,column:o.column}:xi(i),accentColor:t,hoveredAxis:a,draggingAxis:o?.axis??null,cursorViewport:r,isAutoGap:l,refreshKey:s}),u&&(0,Gu.jsx)(Xu,{element:u.target,modifier:u.modifier,accentColor:t,refreshKey:s}),!u&&c&&(0,Gu.jsx)(Tu,{element:c,radius:d?.radius??Mi(c),accentColor:t,hoveredCorner:h,draggingCorner:d?.corner??null,cursorViewport:r}),!u&&p&&(0,Gu.jsx)(Zu,{element:p,fontSize:f?.fontSize??x.fontSize,lineHeight:f?.lineHeight??x.lineHeight,accentColor:t,hoveredProperty:m,draggingProperty:f?.property??null,cursorViewport:r}),!u&&g&&(0,Gu.jsx)(Wu,{element:g,padding:y?.padding??Si(g),accentColor:t,hoveredSide:v,draggingSide:y?.side??null,cursorViewport:r,refreshKey:f?f.fontSize+1e3*f.lineHeight:0})]})}var ec=c(h()),tc=c(h()),nc=c(b());function rc({query:e,border:t,background:n,foreground:r,renderIcon:i}){return(0,nc.jsxs)("span",{"aria-hidden":"true","data-popmelt-sticker-query":!0,style:{position:"absolute",left:"50%",top:44,minWidth:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",gap:4,padding:"0 10px",boxSizing:"border-box",border:`1px solid ${t}`,borderRadius:12,background:n,color:r,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transform:"translateX(-50%)",zIndex:4},children:[e.tokens.map((e,t)=>"icon"===e.kind?(0,nc.jsx)("span",{"aria-label":e.label,"data-popmelt-sticker-query-token":"icon",style:{display:"inline-flex",color:r,flexShrink:0},children:i(e)},`${e.label}-${t}`):(0,nc.jsx)("span",{"data-popmelt-sticker-query-token":"label",style:{color:r,opacity:.72},children:e.label},`${e.label}-${t}`)),e.typed?(0,nc.jsx)("span",{children:e.typed}):(0,nc.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:0,color:r,opacity:.58,fontWeight:500},children:[(0,nc.jsx)("span",{"data-popmelt-sticker-query-caret":!0,style:{width:1,height:11,flexShrink:0,background:r,animation:"popmeltStickerQueryCaret 900ms steps(1, end) infinite"}}),(0,nc.jsx)("span",{children:e.fallback})]}),e.completion&&(0,nc.jsx)("span",{style:{color:r,opacity:.62},children:e.completion}),e.fallback&&e.typed&&(0,nc.jsxs)("span",{style:{color:r,opacity:.68},children:["→ ",e.fallback]})]})}var ic=c(b()),oc=106,ac=32,lc="cubic-bezier(0.16, 1, 0.3, 1)",sc=[0,180,240,300];function uc(e,t,n=42,r=40,i=oc){let o=e.left+i,a=e.top+n,l=Math.min(o,t.right)-Math.max(e.left,t.left),s=Math.min(a,t.bottom)-Math.max(e.top,t.top);if(l<=0||s<=0)return 1;let u=Math.min(l,s);return Math.max(0,1-u/r)}function cc(e,t,n,r=42,i=80,o=8,a=oc){let l=Math.min(Math.max(e.x,n.left),n.right),s=Math.min(Math.max(e.y,n.top),n.bottom),u={x:l-e.x,y:s-e.y},c=Math.hypot(u.x,u.y);if(0===c)return 0;let d=u.x/c,h=u.y/c,p=[{x:t.left,y:t.top},{x:t.left+a,y:t.top},{x:t.left,y:t.top+r},{x:t.left+a,y:t.top+r}],f=Math.max(0,...p.map(t=>(t.x-e.x)*d+(t.y-e.y)*h)),m=Math.max(i,f+o);return Math.min(1,c/m)}var dc={padding:"padding",margin:"margin",border:"border",radius:"radius",stack:"stack-vertical",grid:"grid",text:"text-size",color:"palette",transform:"transform-translate",opacity:"opacity"},hc={top:0,right:90,bottom:180,left:270},pc={"top-right":0,"bottom-right":90,"bottom-left":180,"top-left":270};function fc({name:e}){switch(e){case"padding":return(0,ic.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667ZM7.375 3A0.625 0.625 0 0 1 7.375 4.25H4.625A0.625 0.625 0 0 1 4.625 3H7.375Z",fill:"currentColor"});case"padding-top":return(0,ic.jsx)("path",{d:"M9.333 1.375C10.701 1.375 11.625 2.662 11.625 4V10A0.625 0.625 0 0 1 10.375 10V4C10.375 3.129 9.806 2.625 9.333 2.625H2.667C2.194 2.625 1.625 3.129 1.625 4V10A0.625 0.625 0 0 1 0.375 10V4C0.375 2.662 1.299 1.375 2.667 1.375H9.333ZM7.375 5A0.625 0.625 0 0 1 7.375 6.25H4.625A0.625 0.625 0 0 1 4.625 5H7.375Z",fill:"currentColor"});case"padding-x":return(0,ic.jsx)("path",{d:"M2.75 0.375C3.095 0.375 3.375 0.655 3.375 1S3.095 1.625 2.75 1.625C2.344 1.625 2.073 1.759 1.904 1.929C1.733 2.101 1.625 2.354 1.625 2.667V9.333C1.625 9.646 1.733 9.899 1.904 10.071C2.073 10.241 2.344 10.375 2.75 10.375C3.095 10.375 3.375 10.655 3.375 11S3.095 11.625 2.75 11.625C2.052 11.625 1.448 11.386 1.018 10.952C0.59 10.522 0.375 9.941 0.375 9.333V2.667C0.375 2.059 0.59 1.478 1.018 1.048C1.448 0.614 2.052 0.375 2.75 0.375ZM9.25 0.375C9.948 0.375 10.552 0.614 10.982 1.048C11.41 1.478 11.625 2.059 11.625 2.667V9.333C11.625 9.941 11.41 10.522 10.982 10.952C10.552 11.386 9.948 11.625 9.25 11.625C8.905 11.625 8.625 11.345 8.625 11S8.905 10.375 9.25 10.375C9.656 10.375 9.927 10.241 10.096 10.071C10.267 9.899 10.375 9.646 10.375 9.333V2.667C10.375 2.354 10.267 2.101 10.096 1.929C9.927 1.759 9.656 1.625 9.25 1.625C8.905 1.625 8.625 1.345 8.625 1S8.905 0.375 9.25 0.375ZM8.079 5.25C8.424 5.25 8.704 5.53 8.704 5.875S8.424 6.5 8.079 6.5H3.921C3.576 6.5 3.296 6.22 3.296 5.875S3.576 5.25 3.921 5.25H8.079Z",fill:"currentColor"});case"padding-y":return(0,ic.jsx)("path",{d:"M11.625 2.75C11.625 3.095 11.346 3.375 11 3.375S10.375 3.095 10.375 2.75C10.375 2.344 10.241 2.073 10.072 1.904C9.899 1.733 9.646 1.625 9.333 1.625H2.667C2.355 1.625 2.102 1.733 1.929 1.904C1.759 2.073 1.625 2.344 1.625 2.75C1.625 3.095 1.346 3.375 1 3.375S0.375 3.095 0.375 2.75C0.375 2.052 0.615 1.448 1.048 1.018C1.479 0.59 2.06 0.375 2.667 0.375H9.333C9.941 0.375 10.522 0.59 10.953 1.018C11.386 1.448 11.625 2.052 11.625 2.75ZM11.625 9.25C11.625 9.948 11.386 10.552 10.953 10.982C10.522 11.41 9.941 11.625 9.333 11.625H2.667C2.06 11.625 1.479 11.41 1.048 10.982C0.615 10.552 0.375 9.948 0.375 9.25C0.375 8.905 0.655 8.625 1 8.625S1.625 8.905 1.625 9.25C1.625 9.656 1.759 9.927 1.929 10.096C2.102 10.267 2.355 10.375 2.667 10.375H9.333C9.646 10.375 9.899 10.267 10.072 10.096C10.241 9.927 10.375 9.656 10.375 9.25C10.375 8.905 10.655 8.625 11 8.625S11.625 8.905 11.625 9.25ZM6.75 8.079C6.75 8.424 6.471 8.704 6.125 8.704S5.5 8.424 5.5 8.079V3.921C5.5 3.576 5.78 3.296 6.125 3.296S6.75 3.576 6.75 3.921V8.079Z",fill:"currentColor"});case"margin":return(0,ic.jsx)("path",{d:"M9.333 4.525C10.701 4.525 11.625 5.812 11.625 7.15V8.15C11.625 9.488 10.701 10.775 9.333 10.775H2.667C1.299 10.775 0.375 9.488 0.375 8.15V7.15C0.375 5.812 1.299 4.525 2.667 4.525H9.333ZM2.667 5.775C2.194 5.775 1.625 6.279 1.625 7.15V8.15C1.625 9.021 2.194 9.525 2.667 9.525H9.333C9.806 9.525 10.375 9.021 10.375 8.15V7.15C10.375 6.279 9.806 5.775 9.333 5.775H2.667ZM8.375 1.2A0.625 0.625 0 0 1 8.375 2.45H3.625A0.625 0.625 0 0 1 3.625 1.2H8.375Z",fill:"currentColor"});case"margin-top":return(0,ic.jsx)("path",{d:"M9.333 4.575C10.701 4.575 11.625 5.862 11.625 7.2V10.2A0.625 0.625 0 0 1 10.375 10.2V7.2C10.375 6.329 9.806 5.825 9.333 5.825H2.667C2.194 5.825 1.625 6.329 1.625 7.2V10.2A0.625 0.625 0 0 1 0.375 10.2V7.2C0.375 5.862 1.299 4.575 2.667 4.575H9.333ZM8.375 1.25A0.625 0.625 0 0 1 8.375 2.5H3.625A0.625 0.625 0 0 1 3.625 1.25H8.375Z",fill:"currentColor"});case"margin-x":return(0,ic.jsx)("path",{d:"M11.277 2.902C11.622 2.902 11.902 3.182 11.902 3.527V8.277C11.902 8.622 11.622 8.902 11.277 8.902S10.652 8.622 10.652 8.277V3.527C10.652 3.182 10.931 2.902 11.277 2.902ZM0.724 2.901C1.069 2.901 1.349 3.181 1.349 3.526V8.276C1.349 8.621 1.069 8.901 0.724 8.901S0.099 8.621 0.099 8.276V3.527C0.099 3.182 0.379 2.901 0.724 2.901ZM7.333 3.325C8.643 3.325 9.543 4.506 9.617 5.781C9.62 5.805 9.625 5.829 9.625 5.853L9.622 5.901L9.625 5.95C9.625 5.974 9.62 5.998 9.617 6.021C9.544 7.297 8.643 8.478 7.333 8.478H4.667C3.357 8.478 2.456 7.297 2.382 6.021C2.379 5.998 2.375 5.974 2.375 5.95L2.377 5.901L2.375 5.853C2.375 5.829 2.379 5.805 2.382 5.781C2.456 4.506 3.358 3.325 4.667 3.325H7.333ZM4.667 4.575C4.203 4.575 3.647 5.06 3.626 5.901C3.647 6.742 4.203 7.228 4.667 7.228H7.333C7.798 7.228 8.352 6.742 8.372 5.901C8.351 5.06 7.798 4.575 7.333 4.575H4.667Z",fill:"currentColor"});case"margin-y":return(0,ic.jsx)("path",{d:"M8.375 10.001C8.72 10.001 9 10.281 9 10.626S8.72 11.251 8.375 11.251H3.625C3.28 11.251 3 10.971 3 10.626S3.28 10.001 3.625 10.001H8.375ZM9.333 3.325C10.642 3.325 11.543 4.506 11.617 5.781C11.62 5.805 11.625 5.829 11.625 5.853L11.622 5.901L11.625 5.95C11.625 5.974 11.619 5.998 11.617 6.021C11.543 7.297 10.643 8.478 9.333 8.478H2.667C1.357 8.478 0.455 7.297 0.381 6.021C0.379 5.998 0.375 5.974 0.375 5.95L0.377 5.901L0.375 5.853C0.375 5.829 0.379 5.805 0.381 5.781C0.456 4.506 1.357 3.325 2.667 3.325H9.333ZM2.667 4.575C2.202 4.575 1.648 5.061 1.627 5.901C1.647 6.742 2.202 7.228 2.667 7.228H9.333C9.797 7.228 10.352 6.742 10.373 5.901C10.352 5.06 9.797 4.575 9.333 4.575H2.667ZM8.376 0.751C8.721 0.751 9.001 1.031 9.001 1.376S8.72 2.001 8.376 2.001H3.626C3.28 2.001 3.001 1.72 3.001 1.375S3.281 0.751 3.626 0.751H8.376Z",fill:"currentColor"});case"border":return(0,ic.jsx)(ic.Fragment,{children:(0,ic.jsx)("path",{d:"M4 1.25H8M4 10.75H8M1.25 8V4M10.75 8V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"radius":return(0,ic.jsx)(ic.Fragment,{children:(0,ic.jsx)("path",{d:"M3.25 1.25C2.145 1.25 1.25 2.145 1.25 3.25M10.75 3.25C10.75 2.145 9.855 1.25 8.75 1.25M3.25 10.75C2.145 10.75 1.25 9.855 1.25 8.75M10.75 8.75C10.75 9.855 9.855 10.75 8.75 10.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"gap-x":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M6.625 9.375A0.625 0.625 0 0 1 5.375 9.375V2.625A0.625 0.625 0 0 1 6.625 2.625V9.375Z",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"1.252",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"1.252",cy:"6",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"1.252",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"})]});case"gap-y":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M9.375 5.375A0.625 0.625 0 0 1 9.375 6.625H2.625A0.625 0.625 0 0 1 2.625 5.375H9.375Z",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"1.248",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"1.248",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"6",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"6",cy:"1.252",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.752",cy:"10.748",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.752",cy:"1.252",r:"0.748",fill:"currentColor"})]});case"border-top":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M3.25 0.5A0.75 0.75 0 0 1 3.25 2C2.56 2 2 2.56 2 3.25V8.75C2 9.44 2.56 10 3.25 10A0.75 0.75 0 0 1 3.25 11.5C1.731 11.5 0.5 10.269 0.5 8.75V3.25C0.5 1.731 1.731 0.5 3.25 0.5Z",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"6.625",cy:"10.752",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"6.625",cy:"1.248",r:"0.748",fill:"currentColor"})]});case"radius-top-right":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M8.25 1.25H8.75A2 2 0 0 1 10.75 3.25V3.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,ic.jsx)("circle",{cx:"9.748",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"2.248",cy:"9.748",r:"0.748",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"2.248",cy:"2.248",r:"0.748",fill:"currentColor"})]});case"stack-vertical":case"stack-horizontal":return(0,ic.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM1.625 6.625V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H1.625ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667Z",fill:"currentColor"});case"align":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M1 2H11M2.5 5.25H9.5M4 8.5H8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ic.jsx)("path",{d:"M6 0.75V10.75",stroke:"currentColor",strokeWidth:"0.75",strokeDasharray:"1 2"})]});case"justify":return(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M1 1.5V10.5M11 1.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ic.jsx)("path",{d:"M3 3H9M3 6H9M3 9H9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]});case"grid":return(0,ic.jsx)("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM6.625 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H6.625V10.375ZM1.625 9C1.625 9.871 2.194 10.375 2.667 10.375H5.375V6.625H1.625V9ZM6.625 5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H6.625V5.375ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V1.625H2.667Z",fill:"currentColor"});case"grid-rows":return(0,ic.jsx)("path",{d:"M4.512 0.385C5.781 0.491 6.625 1.721 6.625 3V9C6.625 10.279 5.78 11.508 4.511 11.614C4.477 11.62 4.443 11.625 4.408 11.625H2.666C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H4.409C4.444 0.375 4.478 0.379 4.512 0.385ZM10.748 10.004C11.161 10.004 11.497 10.339 11.497 10.752C11.497 11.165 11.161 11.5 10.748 11.5C10.335 11.5 10 11.165 10 10.752C10 10.339 10.335 10.004 10.748 10.004ZM1.625 9C1.625 9.871 2.193 10.375 2.666 10.375H4.333C4.806 10.375 5.375 9.871 5.375 9V6.625H1.625V9ZM10.748 5.252C11.161 5.252 11.497 5.587 11.497 6C11.497 6.413 11.161 6.748 10.748 6.748C10.335 6.748 10 6.413 10 6C10 5.587 10.335 5.252 10.748 5.252ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V3C5.375 2.129 4.806 1.625 4.333 1.625H2.667ZM10.748 0.5C11.161 0.5 11.497 0.835 11.497 1.248C11.497 1.661 11.161 1.997 10.748 1.997C10.335 1.997 10 1.661 10 1.248C10 0.835 10.335 0.5 10.748 0.5Z",fill:"currentColor"});case"grid-columns":return(0,ic.jsx)("path",{d:"M0.321 7.424C0.427 6.155 1.657 5.311 2.936 5.311H8.936C10.215 5.311 11.444 6.156 11.55 7.425C11.556 7.458 11.561 7.493 11.561 7.528V9.27C11.56 10.637 10.274 11.561 8.936 11.561H2.936C1.598 11.561 0.311 10.636 0.311 9.269V7.527C0.311 7.492 0.315 7.458 0.321 7.424ZM9.94 1.188C9.94 0.775 10.275 0.439 10.688 0.439C11.101 0.439 11.437 0.774 11.437 1.188C11.437 1.601 11.101 1.936 10.688 1.936C10.275 1.936 9.94 1.601 9.94 1.188ZM8.936 10.311C9.806 10.311 10.31 9.743 10.311 9.27V7.603C10.311 7.129 9.807 6.561 8.936 6.561H6.561V10.311H8.936ZM5.188 1.188C5.188 0.775 5.523 0.439 5.936 0.439C6.349 0.439 6.685 0.774 6.685 1.188C6.685 1.601 6.349 1.936 5.936 1.936C5.523 1.936 5.188 1.601 5.188 1.188ZM1.561 9.269C1.561 9.742 2.065 10.311 2.936 10.311H5.311V6.561H2.936C2.065 6.561 1.561 7.129 1.561 7.603V9.269ZM0.436 1.188C0.436 0.774 0.772 0.439 1.185 0.439C1.598 0.439 1.933 0.775 1.933 1.188C1.933 1.601 1.598 1.936 1.185 1.936C0.772 1.936 0.436 1.601 0.436 1.188Z",fill:"currentColor"})}}function mc({family:e,size:t=12,step:n,subproperty:r="all"}){let i=function(e,t="all"){return $s(e,t)?{name:"palette",rotation:0}:"stack"===e?"horizontal"===t?{name:"stack-horizontal",rotation:90}:"align"===t?{name:"align",rotation:0}:"justify"===t?{name:"justify",rotation:0}:{name:"stack-vertical",rotation:0}:"grid"===e?{name:"rows"===t?"grid-rows":"columns"===t?"grid-columns":"grid",rotation:90}:"text"===e?{name:"weight"===t?"text-weight":"line-height"===t?"text-leading":"letter-spacing"===t?"text-tracking":"text-align"===t?"text-align":"text-size",rotation:0}:"transform"===e?{name:"scale"===t?"transform-scale":"rotate"===t?"transform-rotate":"transform-translate",rotation:0}:"opacity"===e?{name:"mix-blend"===t?"mix-blend":"opacity",rotation:0}:"all"===t?{name:dc[e],rotation:0}:"radius"===e?{name:"radius-top-right",rotation:pc[t]??0}:{name:"padding"===e?"x"===t?"padding-x":"y"===t?"padding-y":"padding-top":"margin"===e?"x"===t?"margin-x":"y"===t?"margin-y":"margin-top":"border-top",rotation:("border"===e?90:0)+(hc[t]??0)}}(e,r),o="text-size"===i.name?z:"text-weight"===i.name?K:"text-leading"===i.name?U:"text-tracking"===i.name?Y:"text-align"===i.name?W:"palette"===i.name?de:"transform-translate"===i.name?le:"transform-scale"===i.name?me:"transform-rotate"===i.name?fe:"opacity"===i.name?Z:"mix-blend"===i.name?X:null;return o?(0,ic.jsx)(o,{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,width:t,height:t,strokeWidth:2.5,style:{display:"block",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"}}):(0,ic.jsx)("svg",{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,viewBox:"0 0 12 12",fill:"none",style:{width:t,height:t,display:"block",transform:i.rotation?`rotate(${i.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"},children:(0,ic.jsx)(fc,{name:i.name})})}function gc({offset:e,colors:t,renderItem:n,showControl:r=!0,activeColor:i,snapActiveColor:o=!1}){let a=[e-2,e-1,e,e+1,e+2];return(0,ic.jsxs)("div",{style:{position:"relative",width:96,height:32,overflow:"hidden"},children:[r&&(0,ic.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",left:ac,top:0,width:ac,height:ac,borderRadius:16,background:t.control}}),(0,ic.jsx)("div",{"data-popmelt-sticker-rail":!0,style:{position:"absolute",inset:0,transform:`translateX(${-e*ac}px)`,transition:"transform 250ms ease",willChange:"transform"},children:a.map(r=>{let a=r===e;return(0,ic.jsx)("span",{style:{position:"absolute",left:ac+r*ac,top:0,width:ac,height:ac,display:"flex",alignItems:"center",justifyContent:"center",color:a?i??t.primary:t.mutedStrong,transition:o?"none":`color 400ms ${lc}`},children:n(r,a)},r)})})]})}function yc({family:e,colors:t,showControl:n=!0,activeColor:r,snapActiveColor:i}){let o=(0,tc.useRef)(e),a=(0,tc.useRef)(e),[l,s]=(0,tc.useState)(0);return(0,tc.useLayoutEffect)(()=>{if(a.current===e)return;let t=function(e,t){let n=ys.indexOf(e),r=(ys.indexOf(t)-n+ys.length)%ys.length;return r<=ys.length/2?r:r-ys.length}(a.current,e);a.current=e,s(e=>e+t)},[e]),(0,ic.jsx)(gc,{offset:l,colors:t,showControl:n,activeColor:r,snapActiveColor:i,renderItem:(e,t)=>{let n=function(e,t){let n=(ys.indexOf(e)+t%ys.length+ys.length)%ys.length;return ys[n]}(o.current,e);return(0,ic.jsx)(mc,{family:n,subproperty:"all",size:t?14:12})}})}function vc({color:e,colors:t,showControl:n=!0}){let r=(0,tc.useRef)(e),i=(0,tc.useRef)(e),[o,a]=(0,tc.useState)(0);return(0,tc.useLayoutEffect)(()=>{if(i.current===e)return;let t=function(e,t){let n=ls.indexOf(e),r=(ls.indexOf(t)-n+ls.length)%ls.length;return r<=ls.length/2?r:r-ls.length}(i.current,e);i.current=e,a(e=>e+t)},[e]),(0,ic.jsx)(gc,{offset:o,colors:t,showControl:n,renderItem:(e,t)=>{let n=function(e,t){let n=ls.indexOf(e);return ls[(n+t%ls.length+ls.length)%ls.length]}(r.current,e),i=t?14:12;return(0,ic.jsx)("span",{"aria-label":n,"data-popmelt-sticker-color":n,style:{width:i,height:i,borderRadius:"50%",background:ps(n,us),boxShadow:"inset 0 0 0 1px rgb(0 0 0 / 0.08)",transition:"width 250ms ease, height 250ms ease"}})}})}function xc({name:e,size:t}){let n="align-start"===e?V:"align-center"===e?P:"align-end"===e?N:"align-stretch"===e?xe:"justify-start"===e?F:"justify-center"===e?_:"justify-end"===e?D:"justify-between"===e?$:"justify-around"===e?O:"text-align-left"===e?W:"text-align-center"===e?L:"text-align-right"===e?B:"text-align-justify"===e?H:null;return n?(0,ic.jsx)(n,{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,strokeWidth:2.25,style:{display:"block"}}):(0,ic.jsx)("svg",{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,viewBox:"0 0 14 14",fill:"none",style:{display:"block"},children:"align-baseline"===e?(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M1.5 10.5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ic.jsx)("path",{d:"M3 8V4.75M3 4.75H6.5M6.5 4.75V8M8.5 8V6M8.5 6H11M11 6V8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,ic.jsxs)(ic.Fragment,{children:[(0,ic.jsx)("path",{d:"M1.5 2V12M12.5 2V12",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),(0,ic.jsx)("rect",{x:"3.25",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,ic.jsx)("rect",{x:"8.75",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),(0,ic.jsx)("circle",{cx:"7",cy:"7",r:"0.75",fill:"currentColor"})]})})}function bc({family:e,step:t,subproperty:n,colors:r,showControl:i=!0,unavailable:o=!1,activeColor:a,snapActiveColor:l=!1}){let s=(0,tc.useRef)(t),u=(0,tc.useRef)(t),[c,d]=(0,tc.useState)(0);return(0,tc.useEffect)(()=>{if(u.current===t)return;let r=function(e,t,n,r="all"){let i=qs(e,r),o=i.indexOf(t),a=(i.indexOf(n)-o+i.length)%i.length;return a<=i.length/2?a:a-i.length}(e,u.current,t,n);u.current=t,d(e=>e+r)},[e,t,n]),(0,ic.jsx)(gc,{offset:c,colors:r,showControl:i,activeColor:a??(o?r.muted:r.primary),snapActiveColor:l,renderItem:(t,r)=>{let i=function(e,t,n,r="all"){let i=qs(e,r),o=(i.indexOf(t)+n%i.length+i.length)%i.length;return i[o]}(e,s.current,t,n),a=function(e,t,n){if("stack"===e&&"align"===t){if("start"===n)return"align-start";if("center"===n)return"align-center";if("end"===n)return"align-end";if("stretch"===n)return"align-stretch";if("baseline"===n)return"align-baseline"}if("stack"===e&&"justify"===t){if("start"===n)return"justify-start";if("center"===n)return"justify-center";if("end"===n)return"justify-end";if("between"===n)return"justify-between";if("around"===n)return"justify-around";if("evenly"===n)return"justify-evenly"}if("text"===e&&"text-align"===t){if("left"===n)return"text-align-left";if("center"===n)return"text-align-center";if("right"===n)return"text-align-right";if("justify"===n)return"text-align-justify"}return null}(e,n,i);return(0,ic.jsx)("span",{"data-popmelt-sticker-step-unavailable":r&&o?"true":void 0,style:{alignItems:"center",display:"flex",fontSize:r?14:12,justifyContent:"center",transition:"font-size 250ms ease"},children:a?(0,ic.jsx)(xc,{name:a,size:r?14:12}):cu(i,e,n)})}})}function wc(e){return"family"===e?0:35}function Sc(e){return"family"===e?ac/24:1}function kc(e){return"family"===e?14/(12*Sc(e)):1}function Cc(e,t,n){return`${e}:${t}:${n}`}function Mc(e,t,n){return!!Os(n)&&("color"===e?"family"!==t:("text"===e||"border"===e)&&"value"===t)}function Ec({family:e,step:t,subproperty:n,stage:r,accentColor:i,applyPulse:o=0,snapPulse:a=0,stepUnavailable:l=!1,colors:s}){let u=function(e,t="padding",n="all"){return $s(t,n)?"family"===e?{family:0,variant:-32,value:-64}:"variant"===e?{family:ac,variant:0,value:-32}:{family:64,variant:ac,value:0}:"family"===e?{family:0,variant:-64,value:-32}:{family:ac,variant:-32,value:0}}(r,e,n),c=(0,tc.useRef)(r),d=(0,tc.useRef)(o),h=(0,tc.useRef)(a),[p,f]=(0,tc.useState)(!1),m=h.current!==a;(0,tc.useLayoutEffect)(()=>{h.current=a},[a]),(0,tc.useLayoutEffect)(()=>{let e=c.current!==r&&"family"!==r,t="value"===r&&d.current!==o;if(c.current=r,d.current=o,!e&&!t)return;f(!0);let n=window.requestAnimationFrame(()=>f(!1));return()=>window.cancelAnimationFrame(n)},[o,r]);let g=e=>({position:"absolute",left:0,right:0,top:4,height:ac,transform:`translateY(${e}px)`,transition:m?"none":"transform 250ms ease",willChange:"transform"});return(0,ic.jsxs)("div",{"data-popmelt-sticker-depth-rail":r,style:{position:"relative",width:96,height:40,marginBlock:-4,overflow:"hidden",zIndex:2},children:[(0,ic.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-control":!0,style:{position:"absolute",left:ac,top:4,width:ac,height:ac,borderRadius:16,background:p?i:s.control,transition:p?"none":`background 400ms ${lc}`}}),(0,ic.jsx)("div",{"aria-hidden":"family"!==r,"data-popmelt-sticker-depth-row":"family",style:g(u.family),children:(0,ic.jsx)(yc,{family:e,colors:s,showControl:!1,activeColor:p?s.surface:s.primary,snapActiveColor:p})}),(0,ic.jsx)("div",{"aria-hidden":"variant"!==r,"data-popmelt-sticker-depth-row":"variant",style:g(u.variant),children:$s(e,n)&&Os(n)&&(0,ic.jsx)(vc,{color:n,colors:s,showControl:!1})}),(0,ic.jsx)("div",{"aria-hidden":"value"!==r,"data-popmelt-sticker-depth-row":"value",style:g(u.value),children:(0,ic.jsx)(bc,{family:e,step:t,subproperty:n,colors:s,showControl:!1,unavailable:l,activeColor:p?s.surface:void 0,snapActiveColor:p},Cc(r,e,n))})]})}function Tc(e,t,n=42,r=oc){let i=e.x+10,o=e.y+10;return{left:Math.min(Math.max(8,i),Math.max(8,t.width-r-8)),top:Math.min(Math.max(8,o),Math.max(8,t.height-n-8))}}function Ac(e,t,n){return n?0:Math.min(e,t)}function Rc({cursor:e,family:t,step:n,subproperty:r,stage:i,accentColor:o,applyPulse:a=0,contextLabelPulse:l=0,depthSnapPulse:s=0,rejectPulse:u=0,stepUnavailable:c=!1,query:d=null,toolbarElement:h,controlBounds:p,threadElement:f,annotationRailHovered:m=!1}){let[g]=Ke(),y=We[g],v=`color-mix(in srgb, ${y.actionForeground} 16%, ${y.actionSurface})`,x=function(e,t){let n=Xs(e,t);return"color"===e||("text"===e||"border"===e)&&Os(n)?n:`${function(e){return Ns[e]}(e)}${Fs[n]}`}(t,r),b=(0,tc.useRef)(t),w=(0,tc.useRef)(i),S=(0,tc.useRef)(r),k=(0,tc.useRef)(i),C=(0,tc.useRef)(a),M=(0,tc.useRef)(l),E=(0,tc.useRef)(u),T=(0,tc.useRef)(null),A=(0,tc.useRef)(!1),R=(0,tc.useRef)(!1),j=(0,tc.useRef)(0),I=(0,tc.useRef)(0),z=(0,tc.useRef)(0),L=(0,tc.useRef)(0),[P,N]=(0,tc.useState)(null),[_,D]=(0,tc.useState)(!1),[F,O]=(0,tc.useState)(!1),[$,H]=(0,tc.useState)(!1),[W,B]=(0,tc.useState)(null),[V,q]=(0,tc.useState)(!1),[U,Y]=(0,tc.useState)(0),[X,K]=(0,tc.useState)(!1),[Q,Z]=(0,tc.useState)(!1);(0,tc.useLayoutEffect)(()=>{if(E.current===u)return;E.current=u,Z(!1);let e=window.requestAnimationFrame(()=>Z(!0)),t=window.setTimeout(()=>Z(!1),240);return()=>{window.cancelAnimationFrame(e),window.clearTimeout(t)}},[u]),(0,tc.useLayoutEffect)(()=>{let e=k.current!==i&&"family"!==i,t="value"===i&&C.current!==a;if(k.current=i,C.current=a,!e&&!t)return;K(!0);let n=window.requestAnimationFrame(()=>K(!1));return()=>window.cancelAnimationFrame(n)},[a,i]),(0,tc.useLayoutEffect)(()=>{let e="family"!==w.current&&"family"===i;w.current=i;let n=(e=!1)=>{j.current&&window.cancelAnimationFrame(j.current),e||window.clearTimeout(I.current),window.clearTimeout(z.current),window.clearTimeout(L.current),j.current=0,e||(I.current=0),z.current=0,L.current=0},r=e=>{let t=e?250:200;z.current=window.setTimeout(()=>{O(e),R.current=!1,D(!1)},750),L.current=window.setTimeout(()=>{A.current=!1,N(null)},750+t+34)};if("family"!==i){if(n(),b.current=t,!A.current)return;return O(!0),R.current=!1,D(!1),void(L.current=window.setTimeout(()=>{A.current=!1,N(null)},250))}if(b.current!==t||e){if(b.current=t,A.current=!0,N(t),e)return n(),O(!1),H(!0),R.current=!0,D(!0),I.current=window.setTimeout(()=>{I.current=0,H(!1)},250),void r(!1);I.current||(n(!0),H(!1),O(!1),R.current||(R.current=!0,D(!0)),r(!1))}},[t,i]),(0,tc.useEffect)(()=>()=>{window.cancelAnimationFrame(j.current),window.clearTimeout(I.current),window.clearTimeout(z.current),window.clearTimeout(L.current)},[]),(0,tc.useEffect)(()=>{let e=M.current!==l;if(M.current=l,!function(e,t,n="all"){return"value"===t||$s(e,n)&&"variant"===t}(t,i,r))return B(null),q(!1),void(S.current=r);if(b.current!==t)return S.current=r,B(null),void q(!1);if(S.current===r&&!e)return;S.current=r,q(e),B(e?function(e,t){let n=Gs(e),r=Js(e,t);return r===n?n:`${n} ${r}`}(t,r):Js(t,r));let n=window.setTimeout(()=>{B(null),q(!1)},750);return()=>window.clearTimeout(n)},[l,t,i,r]),(0,tc.useLayoutEffect)(()=>{W&&T.current?Y(T.current.scrollWidth):Y(0)},[W]);let G=function(e,t=7.5){return null===e?24:Math.max(39,18+2*t+Math.ceil(e))}(W?U:null,V?10:7.5),J=V?10:7.5,ee=W?0:140,te=d||"family"!==i||P?68:42,ne=(0,tc.useMemo)(()=>Tc(e,p?.viewport??{width:typeof window>"u"?oc:window.innerWidth,height:typeof window>"u"?42:window.innerHeight},te),[te,e,p?.viewport]),re=h?uc(ne,h.getBoundingClientRect(),te):1,ie=f?cc(e,ne,f.getBoundingClientRect(),te):1,oe=p?.compact?function(e,t,n,r,i){let o,a=8,l=i-r-8,s=1;for(let u of n){let n=Math.max(u.left-e.x,e.x-u.right,0),c=Math.max(u.top-e.y,e.y-u.bottom,0);if(s=Math.min(s,Math.hypot(n,c)/12),t.left+oc<=u.left||t.left>=u.right)continue;let d=(u.top+u.bottom)/2<i/2,h=d?u.bottom+1:u.top-1-r;d?a=Math.max(a,h):l=Math.min(l,h);let p=d?t.top<=h:t.top>=h,f=d?e.y-u.bottom:u.top-e.y;if(!p||f<0)continue;let m=Math.max(n/12,Math.max(0,f-1)/r);m<s&&(s=m,o=d?0:r)}let u=Math.max(a,Math.min(t.top,l));return{top:u,scale:s,originY:o??Math.min(r,Math.max(0,e.y-u))}}(e,ne,p.bounds,te,p.viewport?.height??window.innerHeight):void 0,ae=oe?.scale??p?.bounds.reduce((t,n)=>Math.min(t,cc(e,ne,n,te,40)),1)??1,le=Ac(Math.min(re,ae),ie,m),se=oe?.top??ne.top,ue={position:"fixed",left:ne.left,top:se,width:oc,height:42,display:"flex",alignItems:"center",justifyContent:"center",gap:1,boxSizing:"border-box",padding:4,border:`1px solid ${y.border}`,borderRadius:22,background:y.surface,color:y.primary,fontFamily:ze,fontSize:12,fontWeight:600,lineHeight:1,pointerEvents:"none",overflow:"visible",opacity:le,transform:`scale(${le})`,transformOrigin:`${e.x-ne.left}px ${oe?.originY??e.y-se}px`,visibility:0===le?"hidden":"visible",animation:Q?"popmeltStickerReject 220ms ease-out":void 0,zIndex:2147483647,colorScheme:g},ce=d?function(e){return[...e.tokens.map(e=>e.label),`${e.typed}${e.completion||e.fallback}`].filter(Boolean).join(" ")}(d):"";return(0,ic.jsxs)("div",{role:"status","aria-label":d?`Sticker search: ${ce||"search tokens"}`:`Sticker ${i}: ${"family"===i?t:"variant"===i?x:`${n} ${x}`}`,"data-devtools":"sticker-hud","data-popmelt-sticker-hud":!0,"aria-hidden":m||void 0,style:ue,children:[(0,ic.jsx)("style",{children:`@keyframes popmeltStickerReject {\\n ${ho}\\n }\\n @keyframes popmeltStickerFamilyLabelEnter {\\n from {\\n opacity: 0;\\n transform: translate(-50%, 10px) scale(0.9);\\n }\\n to {\\n opacity: 1;\\n transform: translate(-50%, 0) scale(1);\\n }\\n }\\n @keyframes popmeltStickerQueryCaret {\\n 0%, 45% { opacity: 1; }\\n 55%, 100% { opacity: 0; }\\n }`}),(0,ic.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-wheel-shell":!0,style:{position:"absolute",inset:1,borderRadius:21,background:y.surface,zIndex:1}}),(0,ic.jsx)(Ec,{family:t,step:n,subproperty:r,stage:i,accentColor:o,applyPulse:a,snapPulse:s,stepUnavailable:c,colors:y}),!d&&(0,ic.jsxs)("span",{"aria-hidden":"true","data-popmelt-sticker-token-context":!0,"data-popmelt-sticker-token-context-stage":i,"data-popmelt-sticker-token-context-expanded":W?"true":"false",style:{position:"absolute",left:(oc-G)/2,top:9,width:G,height:24,display:"flex",alignItems:"center",justifyContent:"center",gap:W?4:0,padding:W?`0 ${J}px`:0,boxSizing:"border-box",border:`1px solid ${v}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,transform:`translateY(${wc(i)}px) scale(${Sc(i)})`,transition:`left ${ee}ms ease-out, width ${ee}ms ease-out, gap ${ee}ms ease-out, padding ${ee}ms ease-out, transform 250ms ease`,transformOrigin:"center",willChange:"left, width, transform",overflow:"hidden",zIndex:0},children:[(0,ic.jsx)("span",{style:{display:"block",transform:`scale(${kc(i)})`,transition:"transform 250ms ease",transformOrigin:"center"},children:Mc(t,i,r)?(0,ic.jsx)("span",{"data-popmelt-sticker-color-context":r,style:{display:"block",width:12,height:12,borderRadius:"50%",background:ps(r,"value"===i?n:us),boxShadow:"inset 0 0 0 1px rgb(255 255 255 / 0.16)"}}):(0,ic.jsx)(mc,{family:t,subproperty:"text"===t&&"variant"===i&&Os(r)?"color":r})}),(0,ic.jsx)("span",{ref:T,"data-popmelt-sticker-subproperty-label":!0,style:{flexShrink:0,opacity:W&&U>0?1:0,color:y.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transition:"opacity 120ms ease"},children:W})]}),d&&(0,ic.jsx)(rc,{query:d,border:v,background:y.actionSurface,foreground:y.actionForeground,renderIcon:e=>(0,ic.jsx)(mc,{family:e.family,subproperty:e.subproperty,size:12})}),(0,ic.jsx)("span",{"aria-hidden":"true","data-popmelt-sticker-depth-burst":!0,style:{position:"absolute",left:37,top:5,width:ac,height:ac,overflow:"visible",pointerEvents:"none",zIndex:3},children:sc.map(e=>(0,ic.jsx)("span",{style:{position:"absolute",left:"50%",top:"50%",width:4,height:1.5,borderRadius:1,background:o,opacity:X?1:0,transform:`translate(-50%, -50%) rotate(${e}deg) translateX(${X?17:30}px) scaleX(${X?.7:1})`,transformOrigin:"center",transition:X?"none":"transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease-out",willChange:"transform, opacity"}},e))}),!d&&P&&(0,ic.jsx)("span",{"data-popmelt-sticker-family-label":!0,style:{position:"absolute",left:"50%",top:44,height:24,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 10px",boxSizing:"border-box",opacity:_?1:0,transform:`translate(-50%, ${F?-35:0}px) scale(${F?.9:1})`,transformOrigin:"center",transition:"transform 250ms ease, opacity 200ms ease",animation:_&&$?"popmeltStickerFamilyLabelEnter 250ms ease":void 0,border:`1px solid ${v}`,borderRadius:12,background:y.actionSurface,color:y.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",willChange:"transform, opacity",zIndex:0},children:Gs(P)})]})}function jc(e,t){let n=0===e?"Ready":`${e} action${1===e?"":"s"}`,r=16+7.2*n.length,i=t?0===e?22:45:0===e?96:89;return{label:n,accessibleShortcut:0===e?"Command Escape to exit":"Command Enter to complete",width:Math.ceil(r+4+i)}}function Ic(e,t){let n=e.get(t);return!!n&&(clearTimeout(n),e.delete(t),!0)}function zc(e,t,n){return null!==e&&e.selector===t&&e.expandedIndices.includes(n)}function Lc(e,t){return e?.selector===t?null:e}function Pc({selector:e,label:t,tokens:n}){return JSON.stringify([e,t,n])}function Nc({hasElementChanges:e=!1,hasPendingChanges:t,hasThreadState:n,isHovered:r,hasTimedReveal:i,isRevealedSticker:o}){let a=(e||t||n)&&!r;return{annotationCollapsed:a,stickerCollapsed:a&&!o,sendCompact:a&&!i}}var _c=c(b());function Dc({cursor:e,stepCount:t,accentColor:n,toolbarElement:r,threadElement:i}){let[o]=Ke(),a=We[o],[l,s]=(0,ec.useState)(!1);(0,ec.useEffect)(()=>{s(!1);let e=window.setTimeout(()=>s(!0),1e3);return()=>window.clearTimeout(e)},[t]);let u={width:window.innerWidth,height:window.innerHeight},c=jc(t,!1),d=Tc(e,u,22,c.width),h=r?uc(d,r.getBoundingClientRect(),22,void 0,c.width):1,p=i?cc(e,d,i.getBoundingClientRect(),22,void 0,void 0,c.width):1,f=Math.min(h,p)<1||l,m=jc(t,f),g=Tc(e,u,22,m.width),y=Ac(r?uc(g,r.getBoundingClientRect(),22,void 0,m.width):1,i?cc(e,g,i.getBoundingClientRect(),22,void 0,void 0,m.width):1,!1),v={position:"fixed",left:g.left,top:g.top,width:m.width,height:22,display:"flex",alignItems:"center",gap:4,boxSizing:"border-box",padding:0,color:"#000000",fontSize:12,fontWeight:400,lineHeight:1,pointerEvents:"none",whiteSpace:"nowrap",transition:"width 180ms cubic-bezier(0.2, 0, 0, 1)",opacity:y,transform:`scale(${y})`,transformOrigin:`${e.x-g.left}px ${e.y-g.top}px`,visibility:0===y?"hidden":"visible",zIndex:2147483647,colorScheme:o};return(0,_c.jsxs)("div",{role:"status","aria-label":`${m.label}. ${m.accessibleShortcut}`,"data-devtools":"interaction-episode-hud","data-popmelt-interaction-episode-hud":!0,style:v,children:[(0,_c.jsx)("span",{style:{height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",padding:"4px 8px",borderRadius:"2px 8px 8px 8px",background:n,color:"#dddddd",fontFamily:Le,lineHeight:1.2},children:m.label}),(0,_c.jsx)("span",{"aria-hidden":"true",style:{height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",gap:f?0:6,padding:f?"4px 5px":0===t?"4px 6px 4px 8px":"4px 8px 4px 10px",borderRadius:8,background:a.surface,border:`1px solid ${a.border}`,color:a.primary,fontFamily:ze,lineHeight:1.2,letterSpacing:"0.24px",overflow:"hidden",transition:"width 180ms cubic-bezier(0.2, 0, 0, 1), padding 180ms cubic-bezier(0.2, 0, 0, 1)"},children:f?0===t?(0,_c.jsx)(we,{size:12,strokeWidth:2}):(0,_c.jsxs)("span",{"data-popmelt-interaction-episode-complete-shortcut":!0,style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,_c.jsx)(J,{size:12,strokeWidth:2}),(0,_c.jsx)("span",{children:"+"}),(0,_c.jsx)(te,{size:12,strokeWidth:2})]}):(0,_c.jsxs)(_c.Fragment,{children:[(0,_c.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:[(0,_c.jsx)(J,{size:12,strokeWidth:2}),(0,_c.jsx)("span",{children:"+"}),0===t?(0,_c.jsx)("span",{children:"esc"}):(0,_c.jsx)(te,{size:12,strokeWidth:2})]}),(0,_c.jsx)("span",{style:{color:a.secondary},children:"to"}),0===t?(0,_c.jsx)(we,{size:12,strokeWidth:2,color:"red"}):(0,_c.jsx)(Q,{size:12,strokeWidth:2,color:"#02bd02"})]})})]})}function Fc(e,t){return"string"==typeof t.canvasLabel?t.canvasLabel:[e,t.modified].filter(Boolean).join(" ")}function Oc(e){return function(e,t=96){let n=e.replace(/\\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(0,t-3))}...`:n}(e,512)||"Empty text"}var $c=c(h()),Hc=c(h()),Wc=["reviewing","considering","thinking","zhuzhing","iterating","tweaking","reflecting","noodling","pondering","finessing","polishing","riffing"];function Bc(e){return e.isInFlight?"#888888":e.comment?!1===e.comment.pending?"#888888":e.threadAccentColor:e.isInFlight||e.hasThreadState||e.hasStickers?"#888888":e.accentColor}function Vc(e,t,n){if(t)return e?t.jobId===n?t:void 0:t}function qc(e){if(e.awaitingReview)return{jobId:`suggestion:${e.awaitingReview.submissionId}`,threadId:e.awaitingReview.threadId,status:"awaiting_review",selectors:[e.selector],annotationNumber:e.annotationNumber}}function Uc(e){return e.selection?`${e.selection.family}:${e.selection.subproperty}`:`custom:${e.custom.property}`}function Yc(e,t){return!e||!!t}function Xc(e){return e.sticker?{token:e.sticker.axisSteps?`translate-x-${e.sticker.axisSteps.x}-y-${e.sticker.axisSteps.y}`:lu(e.sticker.family,e.sticker.step,e.sticker.subproperty),selection:e.sticker}:{token:e.modified,custom:{property:e.property,value:e.modified}}}function Kc(e){let t=[];for(let n of e){let e=Xc(n);t.some(t=>Uc(t)===Uc(e))||t.push(e)}return t}var Qc=c(b());function Zc({property:e}){let t,n=/^(padding|margin)(?:-(top|right|bottom|left))?$/.exec(e);n&&(t={family:n[1],subproperty:n[2]??"all"});let r=/^border-(top|right|bottom|left)-width$/.exec(e);r&&(t={family:"border",subproperty:r[1]});let i=/^border-(top-left|top-right|bottom-right|bottom-left)-radius$/.exec(e);i&&(t={family:"radius",subproperty:i[1]});let o={"border-width":["border","all"],"border-radius":["radius","all"],"font-size":["text","size"],"font-weight":["text","weight"],"line-height":["text","line-height"],"letter-spacing":["text","letter-spacing"],"text-align":["text","text-align"],"flex-direction":["stack","direction"],"align-items":["stack","align"],"justify-content":["stack","justify"],gap:["stack","gap"],"grid-template-columns":["grid","columns"],"grid-template-rows":["grid","rows"],translate:["transform","translate"],scale:["transform","scale"],rotate:["transform","rotate"],opacity:["opacity","opacity"],"mix-blend-mode":["opacity","mix-blend"]}[e];if(o&&(t={family:o[0],subproperty:o[1]}),t)return(0,Qc.jsx)(mc,{...t});let a=/(^|-)color$|^(fill|stroke)$/.test(e)?de:/(^|-)(width|inline-size)$/.test(e)?se:/(^|-)(height|block-size)$/.test(e)?ue:ye;return(0,Qc.jsx)(a,{"aria-hidden":"true","data-popmelt-property-icon":e,size:12,strokeWidth:2.5,style:{display:"block"}})}function Gc({chip:e}){return e.selection?(0,Qc.jsx)(mc,{...e.selection}):(0,Qc.jsx)(Zc,{property:e.custom.property})}var Jc=c(b());function ed(e){return e.comment?.threadState??e.threadState}function td(e,t){let n=e.stickers.map(e=>e.token).join(""),r=e.comment?.text??e.label,i=ra(r,n=>7.2*(t&&!e.comment?e.hoverName??n:n).length);return Math.min(720,44+("string"==typeof r?i:Math.min(i,400))+7.2*n.length)}function nd(e,t){return t||!1===e?.pending?0:e?.imageCount??0}function rd(e,t,n,r,i,o){let a=`max(0px, ${e}px)`,l="calc(100vw - 100%)";return`translate3d(${"right"===n?`clamp(0px, calc(${a} - 100% + ${r}px), ${l})`:`min(${a}, ${l})`}, min(max(0px, ${t}px, ${void 0!==i?`${i}px`:"0px"}), calc(${void 0!==o?`${o}px`:"100dvh"} - 100%)), 0)`}function id(e){return e.width>0&&e.height>0&&e.left<window.innerWidth&&e.top<window.innerHeight&&e.left+e.width>0&&e.top+e.height>0}function od({scrollAnchor:e,priority:t,target:n,bounds:r,left:i,top:o,avoidTop:a,avoidBottom:l,anchor:s,horizontalAlignment:u="left",visualRef:c,suppressed:d=!1,style:h,children:p,...f}){let m=Uo(n)??n,[g,y]=(0,$c.useState)(null);(0,$c.useEffect)(()=>{if(!m||typeof IntersectionObserver>"u")return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&y({target:t.target,visible:t.isIntersecting&&t.intersectionRect.width>0&&t.intersectionRect.height>0})},{threshold:[0,1e-5]});return e.observe(m),()=>e.disconnect()},[m]);let v="intent"===t||r.height<window.innerHeight||o+22>0&&o<window.innerHeight,x=!d&&v&&id(r)&&(!m||typeof IntersectionObserver>"u"||(g?.target===m?g.visible:"intent"===t)),b=function(e){let t=e.startsWith("top-");return{top:t?4:12,right:4,bottom:t?12:4,left:4}}(s),w=i-b.left,S=o-b.top;return(0,Jc.jsx)("div",{part:e?ei:void 0,"data-devtools":"badge-hit-area","data-popmelt-rail-priority":t,...f,inert:!x||void 0,"aria-hidden":!x||void 0,style:{position:"fixed",...ii(e,r,0,0),padding:`${b.top}px ${b.right}px ${b.bottom}px ${b.left}px`,transform:rd(w,S,u,b.left+b.right,a,l),...h,opacity:x?1:0,pointerEvents:x?h?.pointerEvents:"none"},children:(0,Jc.jsx)("div",{ref:c,children:p})})}function ad({activeCommentInput:e,children:t,...n}){let r=(0,$c.useRef)(null),[i,o]=(0,$c.useState)(),{left:a,horizontalAlignment:l}=n,{left:s,width:u}=n.bounds,c=(0,$c.useCallback)(()=>{let t=r.current,n=e?.current;if(!n||!t)return void o(void 0);let i=t.getBoundingClientRect(),c=n.closest(\'[data-popmelt-rail-priority="history"]\')?.firstElementChild??n,d=n.closest(\'[data-devtools="annotation-composer"]\')?.querySelector(\'[data-devtools="badge-hit-area"][data-popmelt-active-annotation-surface]\')?.firstElementChild,h=[c,d].flatMap(e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0&&t.top<i.bottom&&t.bottom>i.top?[t]:[]}),p=t.querySelector("[data-popmelt-component-name]"),f=p?.closest(\'[data-devtools="steer-element-identifier"]\');if(!h.length||!p||!f)return void o(h.some(e=>ga(i,e))?null:void 0);let m=i.width-f.getBoundingClientRect().width,g=Math.ceil(p.getBoundingClientRect().width+12),y=p.nextElementSibling,v=y?.firstElementChild?p.scrollWidth+("true"===y.ariaHidden?0:y.firstElementChild.scrollWidth):p.parentElement.scrollWidth,x=Math.min(400,Math.max(g,v+12))+m,b=function(e,t,n,r,i){let o=window.innerWidth-4,a=(e,n,r)=>Math.max(e,Math.min(t,n-r)),l=a(4,o,n);if(!i.some(e=>l<e.right&&l+n>e.left))return;let s=null;function u(i,o){if(e.left>=o||e.left+e.width<=i)return;let l=Math.max(i,e.left),u=o-l>=r,c=Math.min(n,Math.floor(o-(u?l:i)));if(c<r||c<=0)return;let d=u?l:a(i,o,c);(!s||c>s.width||c===s.width&&Math.abs(d-t)<Math.abs(s.left-t))&&(s={left:d,width:c})}let c=4;for(let e of[...i].sort((e,t)=>e.left-t.left))u(c,Math.min(o,e.left-2)),c=Math.max(c,e.right+2);return u(c,o),s}({left:s,width:u},"right"===l?a-x:a,x,Math.min(x,g+m),h),w=b&&{left:b.left,width:b.width-m};o(e=>e&&w&&e.left===w.left&&e.width===w.width?e:w)},[e,s,u,l,a]),d=(0,$c.useRef)(c);(0,$c.useLayoutEffect)(()=>{d.current=c,(e||void 0!==i)&&c()}),(0,$c.useLayoutEffect)(()=>{let t=e?.current;if(t)return ta(t,()=>d.current())},[e]);let h=e&&i,p=h&&h.left>=s?n.anchor.startsWith("top")?"top-left":"bottom-left":n.anchor;return(0,Jc.jsx)(od,{...n,priority:"intent",anchor:p,visualRef:r,left:h?h.left:a,horizontalAlignment:h?"left":l,suppressed:!(!e||null!==i),style:{...n.style,"--popmelt-hover-label-width":h?`${h.width}px`:void 0},children:t(p)})}function ld({historyPreview:e,targetDocument:t,subjectRegistry:n,projectedTargets:r,readOnly:i=!1,focusedSelector:o,threadAccessory:a,styleModifications:l,textModifications:s,sampleTargets:u,stagedComments:c,accentColor:d,annotationNumberBySelector:h,inFlightSelectors:p,inFlightAnnotationIds:f,activeAnnotationIds:m,inFlightSelectorJobIds:g,waitingApprovalJobIds:y,inFlightSelectorColors:v,toolbarRef:x,onHoverSelector:b,sendHintSelector:w,pendingBundleCount:S=1,onHoverSendBundle:k,onSend:C,onSelectSticker:M,onDeleteSticker:E,threadStates:T,onViewThread:A,hoveredElement:R,hoveredElementInfo:j,showHoverIdentifier:I=!1,showHoverStyles:z=!0,activeCommentInput:L,hoverRailAction:P,onEditComment:N,onDeleteComment:_,onDeletePeerComment:D,onDeletePeerStyles:F,onDiscardPlacedSample:O,onDiscardTextChanges:$,onArchiveThread:H,onClearInteractionEpisode:W,onEditSubject:B,onDeleteSubject:V,onHoverSubjectLabel:q,activeCommentEntry:U,refreshKey:Y}){let X=(0,$c.useContext)(oi),K=(0,$c.useContext)(qr),[Q,Z]=(0,$c.useState)([]),[J,ee]=(0,$c.useState)(null),[te,ne]=(0,$c.useState)(null),[re,oe]=(0,$c.useState)(()=>new Map),ae=(0,$c.useRef)(new Map),le=(0,$c.useRef)(new Map),se=(0,$c.useRef)(new Map),ue=(0,$c.useRef)(new Map),de=(0,$c.useRef)(new Map),he=(0,$c.useRef)(new Map),fe=(0,$c.useCallback)(e=>{Ic(de.current,e)},[]),me=(0,$c.useCallback)(e=>{!function(e,t,n,r=1e3){Ic(e,t),e.set(t,setTimeout(()=>{e.delete(t),n()},r))}(de.current,e,()=>{ne(t=>t===e?null:t),ee(t=>t?.selector===e?null:t)})},[]),ge=(0,$c.useCallback)((e,t,n)=>{ee(r=>function(e,t){return e&&e.selector===t.selector?t.index===e.index?e:{...t,expandedIndices:t.index>e.index?[...new Set([...e.expandedIndices,t.index])]:[...new Set([...e.expandedIndices.filter(e=>e<=t.index),t.index])]}:{...t,expandedIndices:[t.index]}}(r,{selector:e,target:t,index:n}))},[]),ye=(0,$c.useCallback)(e=>!!p?.has(e.selector)||!!e.comment&&!!m?.has(e.comment.id),[m,p]),ve=(0,$c.useCallback)((e,t)=>!ye(e)&&(!!e.comment&&!!f?.has(e.comment.id)||"in_flight"===t?.status),[ye,f]),xe=(0,$c.useCallback)(e=>{let t=Vc(e.hasPendingChanges,ed(e),g?.get(e.selector));return function({isInFlight:e,isQueued:t=!1,threadStatus:n}){return e?"working":t||"in_flight"===n?"queued":"waiting_input"===n?"question":"failed"===n?"failed":"resolved"===n?"replied":"draft"}({isInFlight:ye(e),isQueued:ve(e,t),threadStatus:t?.status})},[ye,ve,g]),we=Q.filter(e=>e.hasPendingChanges||!!ed(e)).map(e=>Pc({selector:e.selector,label:na(e.label),tokens:[...e.stickers.map(e=>e.token),..."draft"===xe(e)?[]:[`status:${xe(e)}`]]})).join("|");(0,$c.useLayoutEffect)(()=>{let e=new Set,t=new Map,n=new Set,r=new Set;for(let i of Q){let o=ed(i);if(!i.hasPendingChanges&&!o)continue;e.add(i.selector);let a=xe(i),l=Pc({selector:i.selector,label:na(i.label),tokens:[...i.stickers.map(e=>e.token),..."draft"===a?[]:[`status:${a}`]]});if(ae.current.get(i.selector)===l)continue;ae.current.set(i.selector,l);let s=se.current.get(i.selector);se.current.set(i.selector,a),"working"===a&&"working"!==s&&r.add(i.selector);let u=le.current.get(i.selector),c=new Map,d=null;for(let e of i.stickers){let t=Uc(e);c.set(t,e.token),u?.get(t)!==e.token&&(d=t)}if(le.current.set(i.selector,c),!i.hasPendingChanges&&(void 0===s||"draft"===s&&"queued"!==a&&"working"!==a)){let e=ue.current.get(i.selector);e&&clearTimeout(e),ue.current.delete(i.selector),n.add(i.selector);continue}t.set(i.selector,d);let h=ue.current.get(i.selector);h&&clearTimeout(h),ue.current.set(i.selector,setTimeout(()=>{oe(e=>{if(!e.has(i.selector))return e;let t=new Map(e);return t.delete(i.selector),t}),ue.current.delete(i.selector)},1e3))}for(let[t,n]of ue.current)e.has(t)||(clearTimeout(n),ue.current.delete(t),ae.current.delete(t),le.current.delete(t),se.current.delete(t));r.size>0&&ee(e=>e&&r.has(e.selector)?null:e),oe(r=>{let i=new Map([...r].filter(([t])=>e.has(t)));for(let[e,n]of t)i.set(e,n);for(let e of n)i.delete(e);return i.size===r.size&&[...i].every(([e,t])=>r.get(e)===t)?r:i})},[Q,we,xe]),(0,$c.useEffect)(()=>()=>{for(let e of ue.current.values())clearTimeout(e);ue.current.clear();for(let e of de.current.values())clearTimeout(e);de.current.clear(),ae.current.clear(),le.current.clear(),se.current.clear()},[]);let Se=p&&p.size>0||m&&m.size>0,{charIndex:ke,word:Ce}=function(e){let t=(0,Hc.useContext)(oi),[n,r]=(0,Hc.useState)(0),[i,o]=(0,Hc.useState)(()=>Math.floor(Math.random()*Wc.length));return(0,Hc.useEffect)(()=>{if(!e||!t)return;let n=setInterval(()=>r(e=>(e+1)%3),250),i=setInterval(()=>o(e=>(e+1)%Wc.length),3e3);return()=>{clearInterval(n),clearInterval(i)}},[e,t]),{charIndex:n,word:Wc[i]}}(!!Se);(0,$c.useEffect)(()=>{if(!X)return;let e=null,i=!1,o=t??document,a=Cl([...(u??[]).map(e=>e.subject?.canvasSelector??e.selector),...c.flatMap(e=>[e.selector,e.element.selector]),...l.flatMap(e=>[e.selector,e.element.selector]),...s.flatMap(e=>[e.selector,e.element.selector]),...Array.from(T??[]).flatMap(([e,t])=>t.selectors??[e])]),d=(e,t)=>r?null:wn(e,t,o),p=()=>{let e=[],i=new Map,a=e=>(i.has(e)||i.set(e,r?null:t?(e=>{try{let t=o.querySelectorAll(e);return 1===t.length?t[0]:null}catch{return null}})(e):An(e)),i.get(e)),p=new Map;for(let e of c)p.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1!==e.pending,stickers:[],comment:e});for(let e of l){let t=p.get(e.selector),n=[...t?.stickers??[]];if(Yc(e.captured,g?.get(e.selector)))for(let t of Kc(e.changes)){let e=Uc(t);n.some(t=>Uc(t)===e)||n.push(t)}p.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:(t?.styleChangeCount??0)+e.changes.length,textChangeCount:t?.textChangeCount??0,modifiedText:t?.modifiedText,hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured&&!e.awaitingReview,threadState:qc(e)??t?.threadState,stickers:n,comment:t?.comment})}for(let e of s){let t=p.get(e.selector);p.set(e.selector,{selector:e.selector,element:t?.element??e.element,styleChangeCount:t?.styleChangeCount??0,textChangeCount:1,modifiedText:Fc(t?.modifiedText,e),hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured,stickers:t?.stickers??[],threadState:t?.threadState,comment:t?.comment})}for(let e of u??[]){let t=a(e.subject?.canvasSelector??e.selector);if(!t||t.localName!==(e.elementTag??"canvas").toLowerCase())continue;let r=e.subject&&n?.resolve(e.subject);if(e.subject&&r?.subject.sourceElement!==t)continue;let i=r?.element??t,o=p.get(e.selector);p.set(e.selector,{selector:e.selector,element:r?.elementInfo??On(i),styleChangeCount:0,textChangeCount:0,stickers:[],...o,resolvedElement:i,sampleLabel:e.elementTag?"Placed "+e.elementTag:e.subject?.inserted?"Placed "+r?.subject.label:r?"Sampled "+r.subject.label:"Sampled canvas",hasPendingChanges:!0})}let f=new Set,m=new Set,y=new Set;for(let e of p.values()){let t=e.comment?.threadState;t?.threadId&&m.add(t.threadId),t?.targetBindingId&&y.add(t.targetBindingId)}for(let[e,t]of p){let n=t.resolvedElement??d(e,t.element);n&&(t.resolvedElement=n),n&&f.add(n)}for(let[e,t]of T??[]){if(r||m.has(t.threadId)||t.targetBindingId&&y.has(t.targetBindingId))continue;let n=bn(t.selectors??[e],t.targetFingerprint,o);if("matched"!==n.status)continue;let{element:i}=n,a=t.selectors?.[0]??e;!i||f.has(i)||(f.add(i),p.set(a,{selector:a,element:{...On(i),selector:a},styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1,stickers:[],resolvedElement:i,threadState:t}))}Array.from(p.values()).forEach(t=>{let n=t.transientElement??t.resolvedElement??d(t.selector,t.element),i=r?.get(t.selector);if(!n&&!i)return;let o=function(e){return e.textChangeCount>0&&0===e.styleChangeCount?{label:Oc(e.modifiedText??"")}:{label:e.elementLabel}}({elementLabel:ia(t.element),styleChangeCount:t.styleChangeCount,textChangeCount:t.textChangeCount,modifiedText:t.modifiedText}),l=t.comment?.threadState??t.threadState??(T?il(t.selector,T,a):void 0);e.push({threadState:l,selector:t.selector,label:t.threadState?.title?.trim()||t.sampleLabel||o.label,annotationNumber:t.transientElement?void 0:t.comment?.annotationNumber??l?.annotationNumber??h.get(t.selector),domElement:n,projectedRect:i,hasPendingChanges:t.hasPendingChanges,hasElementChanges:!!t.sampleLabel||t.styleChangeCount>0||t.textChangeCount>0,stickers:t.stickers,transient:!!t.transientElement,comment:t.comment})}),Z(t=>function(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.selector===r.selector&&typeof e.label==typeof r.label&&na(e.label)===na(r.label)&&e.annotationNumber===r.annotationNumber&&e.domElement===r.domElement&&e.projectedRect===r.projectedRect&&e.threadState===r.threadState&&e.comment===r.comment&&e.hasPendingChanges===r.hasPendingChanges&&e.hasElementChanges===r.hasElementChanges&&e.transient===r.transient&&e.stickers.length===r.stickers.length&&e.stickers.every((e,t)=>{let n=r.stickers[t];return e.token===n.token&&e.selection===n.selection&&Uc(e)===Uc(n)})})}(t,e)?t:e)},f=()=>{i||null!==e||(e=requestAnimationFrame(()=>{e=null,p()}))};if(p(),r)return;window.addEventListener("resize",f,!0);let m=new MutationObserver(f);m.observe(o.body,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:a.identityAttributes}),window.addEventListener("load",f),o.fonts?.ready?.then(f);let y=[...l,...s].some(e=>e.selector.startsWith("@frame("))||c.some(e=>e.selector.startsWith("@frame("))?yi(f):void 0;return()=>{i=!0,y?.(),window.removeEventListener("resize",f,!0),window.removeEventListener("load",f),m.disconnect(),e&&cancelAnimationFrame(e)}},[X,h,u,n,c,l,s,T,g,t,r]);let Me=z?P?.spotlight?"compact":"expanded":"waiting",Ee="expanded"!==Me,Te=j&&ia(j),Ae=j?na(ia(j,!0)):void 0,Re=P?.compactIdentifier?Q.filter(e=>e.domElement!==R):void 0!==Ae&&R?Q.map(e=>e.domElement!==R||"string"==typeof e.label&&e.label!==Te?e:{...e,hoverName:Ae}):Q,Ie=I&&(!te||P)&&R&&Te&&j?.selector&&!Re.some(e=>e.domElement===R)?{selector:j.selector,label:Te,hoverName:Ae,annotationNumber:void 0,domElement:R,hasPendingChanges:!1,hasElementChanges:!1,stickers:[],transient:!0}:null,ze=Ie?[...Re,Ie]:Re,Le=e?Q.filter(t=>ye(t)&&(t.comment?.threadId??ed(t)?.threadId)===e.id):[],Pe=e&&(0,Jc.jsx)(Ha,{entry:e,color:e.marker?.color??d,subjectRegistry:n,hasAnnotationLabel:e=>Le.some(t=>t.domElement===e)});if(!ze.length)return Pe??null;let Ne=X?x?.current?.getBoundingClientRect():void 0,_e=!!Ne&&Ne.top<window.innerHeight/2,De=Ne?{avoidTop:_e?Ne.bottom+8:void 0,avoidBottom:_e?void 0:Ne.top-8,avoidLeft:Ne.left-8,avoidRight:Ne.right+8}:{},Fe=e=>R&&e.domElement===R?P:void 0,Oe=e=>i&&j?e.domElement===R:!(!e.domElement||!function(e,t){return!(!t||e!==t&&!e.contains(t))}(e.domElement,R)),$e=e=>a?.threadId&&a.threadId===(e.comment?.threadId??ed(e)?.threadId)?a:void 0,He=e=>K?.preview&&K.preview.threadId===(e.comment?.threadId??ed(e)?.threadId),We=e=>{let t=U?.element===e.domElement,n=Vc(e.hasPendingChanges,ed(e),g?.get(e.selector)),r=ye(e),i=ve(e,n),o=y?.has(g?.get(e.selector)??n?.jobId??""),a=e.comment?.awaitingReview?"Awaiting review":o?"Approval needed":r?Ce||"Thinking":i?"Queued":"in_flight"===n?.status?"Thinking":"waiting_input"===n?.status?"Question":"failed"===n?.status?"Failed":n?.label??"Replied";return(t?U.width+(U.trailingWidth??0)+td(e,Ee):td(e,Ee)+Fl(nd(e.comment,r||!!n))+wo(e.comment?.interactionEpisodeStepCount??0))+($e(e)?.width??(n||e.comment?.awaitingReview?28+7.2*a.length:0))+(Fe(e)?.width??0)+(He(e)?30:0)},Be=ze.find(e=>Fe(e)),Ve=P?.spotlight&&Be?[Be]:ze,qe=Le[0]??Be??ze.find(e=>e.transient)??ze.find(e=>Oe(e)||te===e.selector||J?.selector===e.selector)??(i?ze.find(e=>e.selector===o):void 0),Ue=(()=>{if(!qe)return null;let e=qe.projectedRect,t=e?{...e,right:e.left+e.width,bottom:e.top+e.height}:qe.domElement?lt(qe.domElement):void 0;if(!t||!id(t))return null;let n=We(qe);return ma(ya(t,22,2,window.innerHeight,n,window.innerWidth),n,22)})(),Ye=aa(d),Xe=la;return(0,Jc.jsxs)(Jc.Fragment,{children:[(0,Jc.jsx)("style",{dangerouslySetInnerHTML:{__html:\'\\n[data-devtools="badge-hit-area"]:where(:not([data-popmelt-rail-priority="intent"])) {\\n transition: opacity 160ms ease-out;\\n}\\n[data-devtools="badge"]::selection,\\n[data-devtools="badge"] *::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n.popmelt-staged-sticker-group {\\n display: flex;\\n align-items: center;\\n isolation: isolate;\\n}\\n.popmelt-staged-sticker-layer {\\n position: relative;\\n align-self: stretch;\\n display: flex;\\n align-items: center;\\n margin-right: -2px;\\n}\\n.popmelt-staged-sticker-pointer {\\n position: absolute;\\n left: -4px;\\n top: 50%;\\n width: 14.142px;\\n height: 14.142px;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n transform: translateY(-50%);\\n pointer-events: none;\\n}\\n.popmelt-staged-sticker-pointer::before {\\n content: \\\'\\\';\\n width: 10px;\\n height: 10px;\\n background: var(--popmelt-staged-accent);\\n transform: rotate(-45deg);\\n}\\n.popmelt-collapsible-badge-detail {\\n max-width: 400px;\\n opacity: 1;\\n overflow: hidden;\\n transition: max-width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\\n}\\n.popmelt-collapsible-badge-detail-inner {\\n display: block;\\n min-width: 0;\\n overflow: hidden;\\n padding-left: 4px;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n[data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\\n max-width: 0;\\n opacity: 0;\\n}\\n@supports (interpolate-size: allow-keywords) {\\n .popmelt-collapsible-badge-detail {\\n width: max-content;\\n interpolate-size: allow-keywords;\\n transition: width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\\n }\\n [data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\\n width: 0;\\n max-width: 400px;\\n }\\n}\\n[data-popmelt-snap-collapse="true"] .popmelt-collapsible-badge-detail {\\n transition: none;\\n}\\n@media (prefers-reduced-motion: reduce) {\\n [data-devtools="badge-hit-area"],\\n .popmelt-collapsible-badge-detail {\\n transition: none;\\n }\\n}\\n\'}}),Pe,Ve.map(e=>{let t=$e(e),r=Fe(e),a=U?.element===e.domElement,c=Vc(e.hasPendingChanges,ed(e),g?.get(e.selector)),h=ye(e),p=ve(e,c),f=function(e,t,n,r){return t?r?.get(e)??n:n}(e.selector,h,d,v),m=function(e,t,n){return n?.color?n.color:!1===t?.pending&&(t.threadState||t.awaitingReview)?t.color:e}(f,e.comment,ed(e)),x=h||"in_flight"===c?.status,T=function(e,t){return t?"#888888":e}(m,x),j=y?.has(g?.get(e.selector)??c?.jobId??""),I=e.comment?.awaitingReview||"awaiting_review"===c?.status,z=I?"Awaiting review":j?"Approval needed":h?Ce||"Thinking":p?"Queued":"in_flight"===c?.status?"Thinking":"waiting_input"===c?.status?"Question":"failed"===c?.status?"Failed":c?.label??"Replied",P=Oe(e)||Le.includes(e),X=te===e.selector,K=re.has(e.selector),Q=re.get(e.selector),Z=!!c||!1===e.comment?.pending,oe=Nc({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:h,hasThreadState:Z,isHovered:i&&o===e.selector||P||X||zc(J,e.selector,0),hasTimedReveal:K,isRevealedSticker:!1}),ae=e.stickers.length+1,le=Nc({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:h,hasThreadState:Z,isHovered:zc(J,e.selector,ae),hasTimedReveal:K,isRevealedSticker:!1}),se=Nc({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:x,hasThreadState:Z,isHovered:i&&o===e.selector||P||X||zc(J,e.selector,ae),hasTimedReveal:K,isRevealedSticker:K}),ue=We(e),de=(a?U.imageCount:nd(e.comment,h||!!c))??0,xe=e.stickers.length>0||de>0,we=function({hasCommentEntry:e,stagedChangeCount:t}){return e&&0===t?2:6}({hasCommentEntry:a||!!e.comment,stagedChangeCount:e.stickers.length+ +(de>0)}),Se=h||!!c||!!e.comment?.awaitingReview,Ee=!Se&&e.selector===w,Te=!(!r||!xe||t||Se||He(e)||Ee),Ae=!a&&!r&&oe.annotationCollapsed&&se.stickerCollapsed&&le.sendCompact&&!K&&J?.selector!==e.selector,Re=Ae?function({annotationNumber:e,stickerCount:t,interactionEpisodeStepCount:n,hasStatus:r,hasSend:i,controlGap:o}){let a=16+7.2*Math.max(1,void 0===e?0:String(e).length),l=28*t-2*Math.max(0,t-1),s=n>0?32+7.2*String(n).length:0,u=[t>0&&t>0?l+(s>0?s-2:0)+(i?26:0):0,0===t?s:0,0===t&&i?28:0,r?28:0].filter(e=>e>0);return a+u.reduce((e,t)=>e+t,0)+u.length*o}({annotationNumber:e.annotationNumber,stickerCount:e.stickers.length,interactionEpisodeStepCount:e.comment?.interactionEpisodeStepCount??0,hasStatus:Se,hasSend:Ee,controlGap:we})+Fl(de)+(He(e)?28+we:0):ue;return(0,Jc.jsx)(Sa,{element:e.domElement,projectedRect:e.projectedRect,onRemove:e.comment&&D?()=>D(e.comment.id):F&&l.some(t=>t.selector===e.selector)?()=>F(l.filter(t=>t.selector===e.selector)):void 0,onActivate:e.comment?.threadId||c?.threadId?()=>A?.(e.comment?.threadId??c?.threadId):void 0,hideOutline:!(i&&qe===e),tintHoveredSubject:i&&R===e.domElement&&qe===e,spotlight:r?.spotlight,color:m,fillOpacity:.1,outlineZIndex:10002,subjectRegistry:n,hideTooltip:!0,railGap:2,railWidth:ue,refreshKey:Y,renderRail:(n,o,f)=>{let g=!1;if(Ae&&qe!==e&&Ue){let t=he.current.get(e.selector)?.getBoundingClientRect();g=ga(t?.width?t:ma(n,ue,22),Ue)}if(!a&&qe!==e&&Ue&&ga(ma(n,Re,22),Ue))return null;let y="right"===n.horizontalAlignment?n.left-ue:n.left,v=function(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,o=n.avoidRight??r;return e+t>i&&e<o}(t,n,e)?e:{}}(De,y,ue);if(e.transient){let t=!i&&e.domElement?Zn(e.domElement):null;return(0,Jc.jsx)(ad,{scrollAnchor:f,target:e.domElement,bounds:o,activeCommentInput:L,"data-popmelt-hover-action-rail":!!r||void 0,"data-popmelt-subject-label-action":t?"true":void 0,"data-popmelt-subject-adapter":t?.adapter,"data-popmelt-subject-key":t?.key,left:n.left,top:n.top,avoidTop:v.avoidTop,avoidBottom:v.avoidBottom,anchor:n.anchor,horizontalAlignment:n.horizontalAlignment,style:{zIndex:r?.spotlight?10002:10001,pointerEvents:t||r?"auto":"none",cursor:t?"pointer":void 0},onPointerDown:e=>{t&&e.stopPropagation()},onClick:e=>{t&&(e.preventDefault(),e.stopPropagation(),B?.(t))},onContextMenu:e=>{t&&(e.preventDefault(),e.stopPropagation(),V?.(t))},onMouseEnter:()=>{t&&q?.(t)},onMouseLeave:()=>q?.(null),children:n=>(0,Jc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:2},children:[(0,Jc.jsx)("div",{"data-devtools":"steer-element-identifier",ref:t=>{e.domElement&&fa(e.domElement,t,n)},"data-popmelt-subject-label-action":t?"true":void 0,style:{...Ye,maxWidth:"var(--popmelt-hover-label-width, 400px)",paddingLeft:oa(e.label),borderRadius:e.domElement===document.body?li("bottom-left"):li(n)},children:(0,Jc.jsx)("span",{style:Xe,children:(0,Jc.jsx)(ua,{label:e.label,hoverName:e.hoverName,preview:Me})})}),r?.render(!1)]})})}return(0,Jc.jsx)(od,{scrollAnchor:f,target:e.domElement,bounds:o,priority:"history","data-popmelt-hover-action-rail":!!r||void 0,"data-popmelt-snap-collapse":g||void 0,visualRef:t=>{t?he.current.set(e.selector,t):he.current.delete(e.selector)},left:n.left,top:n.top,avoidTop:v.avoidTop,avoidBottom:v.avoidBottom,anchor:n.anchor,horizontalAlignment:n.horizontalAlignment,onClick:()=>{if(a)return;let t=function(e,t){if(e){if(e.threadId)return{type:"open-thread",threadId:e.threadId};if(!1!==e.pending)return{type:"edit-comment",annotationId:e.id};if(e.threadState?.threadId)return{type:"open-thread",threadId:e.threadState.threadId}}return t?{type:"open-thread",threadId:t}:{type:"none"}}(e.comment,e.comment?.threadId??c?.threadId);"edit-comment"===t.type?N?.(t.annotationId):"open-thread"===t.type&&A?.(t.threadId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation();let n=!i&&O&&u?.find(t=>t.selector===e.selector&&(t.elementTag||t.subject?.inserted));if(n)return b?.(null),void O?.(n);if(e.comment&&D)D(e.comment.id);else{if(F){let t=l.filter(t=>t.selector===e.selector);if(t.length)return void F(t)}e.comment&&!1!==e.comment.pending&&_?(fe(e.selector),ee(t=>Lc(t,e.selector)),ne(t=>t===e.selector?null:t),b?.(null),_(e.comment.id)):s.some(t=>t.selector===e.selector&&!t.captured)?$?.(e.selector):!e.hasPendingChanges&&!h&&"resolved"===c?.status&&H?.(c.threadId)}},onMouseEnter:()=>{fe(e.selector),ne(e.selector),b?.(e.selector)},onMouseLeave:()=>{me(e.selector),b?.(null)},style:{zIndex:a||r?.spotlight?10002:1e4,cursor:a?"text":"pointer",pointerEvents:"auto"},children:(0,Jc.jsxs)("div",{ref:t=>{e.domElement&&fa(e.domElement,t,n.anchor)},style:{display:"flex",alignItems:"center",gap:we},children:[a?U.render(n.anchor):(0,Jc.jsxs)("div",{"data-devtools":"badge","data-popmelt-collapsed":oe.annotationCollapsed,onMouseEnter:()=>ge(e.selector,"annotation",0),style:{...Ye,...t&&{maxWidth:`min(400px, calc(100vw - ${t.width+24}px))`},backgroundColor:Bc({accentColor:d,threadAccentColor:m,comment:e.comment,isInFlight:h,hasThreadState:!!c,hasStickers:e.stickers.length>0}),gap:0,letterSpacing:e.comment?0:Ye.letterSpacing,borderRadius:e.domElement===document.body?li("bottom-left"):li(n.anchor)},children:[(0,Jc.jsx)("span",{style:{fontWeight:600},children:e.annotationNumber}),(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{...Xe,paddingLeft:e.comment?0:void 0},children:e.comment?(0,Jc.jsxs)(Jc.Fragment,{children:[".",(0,Jc.jsx)("span",{style:{marginLeft:2},children:t?t.formatText(e.comment.text):e.comment.text})]}):(0,Jc.jsx)(ua,{label:e.label,prefix:". ",hoverName:e.hoverName,preview:Me})})})]}),!xe&&(0,Jc.jsx)(So,{stepCount:a?0:e.comment?.interactionEpisodeStepCount??0,onClear:!1!==e.comment?.pending&&W?()=>W(e.comment.id):void 0,submitted:!1===e.comment?.pending}),xe&&(0,Jc.jsxs)("div",{className:"popmelt-staged-sticker-group","data-popmelt-tooltip-group":"",children:[e.stickers.map((t,n)=>{let r=Uc(t),o=Nc({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,isInFlight:h,hasThreadState:!!c,isHovered:zc(J,e.selector,n+1),hasTimedReveal:K,isRevealedSticker:K&&r===Q}),a=function(e,t){return{paddingLeft:0===e?8:10,paddingRight:8,zIndex:t-e+1}}(n,e.stickers.length+ +(de>0)),l=0===n?void 0:go;return(0,Jc.jsxs)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:a.zIndex},children:[(0,Jc.jsx)("span",{"aria-hidden":!0,className:"popmelt-staged-sticker-pointer",style:{"--popmelt-staged-accent":T,WebkitMaskImage:0===n?void 0:yo,maskImage:0===n?void 0:yo}}),(0,Jc.jsxs)(je,{type:"button","data-devtools":"staged-sticker","data-popmelt-style-property":t.custom?.property,hoverDelayMs:500,hint:t.custom?`${t.custom.property}: ${t.custom.value}`:void 0,"data-popmelt-collapsed":o.stickerCollapsed,onReveal:()=>ge(e.selector,r,n+1),onBlur:()=>{X||ee(t=>Lc(t,e.selector))},"aria-label":t.custom?`Custom ${t.custom.property}: ${t.custom.value}`:`${i?"Staged":"Edit staged"} ${t.token} sticker`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t.selection&&M?.(e.selector,t.selection)},onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),fe(e.selector),ee(t=>Lc(t,e.selector)),b?.(null),t.selection&&E?.(e.selector,t.selection)},style:{...Ye,position:"relative",height:"100%",minHeight:22,appearance:"none",border:0,margin:0,paddingLeft:a.paddingLeft,paddingRight:a.paddingRight,gap:0,cursor:t.selection&&(M||E)?"pointer":"default",backgroundColor:T,WebkitMaskImage:l,maskImage:l},children:[(0,Jc.jsx)(Gc,{chip:t}),(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:t.token})})]})]},r)}),(0,Jc.jsx)(Ol,{imageCount:de,color:T,layered:e.stickers.length>0}),!a&&(e.comment?.interactionEpisodeStepCount??0)>0&&(0,Jc.jsx)("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:1},children:(0,Jc.jsx)(So,{stepCount:e.comment.interactionEpisodeStepCount,layered:!0,onClear:!1!==e.comment?.pending&&W?()=>W(e.comment.id):void 0,submitted:!1===e.comment?.pending})}),Ee&&(0,Jc.jsx)(To,{bundleCount:S,compact:le.sendCompact,layered:!0,onHoverChange:t=>{t&&ge(e.selector,"send",ae),k?.(t)},onSend:C,style:{position:"relative",zIndex:(e.comment?.interactionEpisodeStepCount??0)>0?0:1}}),Te&&r?.render(!0)]}),t?.controls,(0,Jc.jsx)(Xr,{threadId:e.comment?.threadId??c?.threadId,color:m}),!t&&Se&&(0,Jc.jsx)("button",{type:"button","data-devtools":"annotation-badge","data-popmelt-collapsed":se.stickerCollapsed,onMouseEnter:()=>ge(e.selector,"thread-status",ae),"aria-label":c?`${z}. Open thread`:z,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>{t.preventDefault(),t.stopPropagation();let n=e.comment?.threadId??c?.threadId;n&&A?.(n)},style:{...Ye,appearance:"none",border:0,margin:0,cursor:c&&A?"pointer":"default",backgroundColor:m,gap:0},children:I?(0,Jc.jsxs)(Jc.Fragment,{children:[(0,Jc.jsx)(G,{size:12,strokeWidth:2.25}),(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:z})})]}):h?(0,Jc.jsxs)(Jc.Fragment,{children:[j?(0,Jc.jsx)(ce,{size:12,"aria-label":"Approval needed"}):(0,Jc.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:1===ke?(0,Jc.jsxs)(Jc.Fragment,{children:[(0,Jc.jsx)("circle",{cx:"7",cy:"7",r:"2"}),(0,Jc.jsx)("circle",{cx:"17",cy:"7",r:"2"}),(0,Jc.jsx)("circle",{cx:"7",cy:"17",r:"2"}),(0,Jc.jsx)("circle",{cx:"17",cy:"17",r:"2"})]}):(0,Jc.jsxs)(Jc.Fragment,{children:[(0,Jc.jsx)("circle",{cx:"12",cy:"6",r:"2"}),(0,Jc.jsx)("circle",{cx:"6",cy:"12",r:"2"}),(0,Jc.jsx)("circle",{cx:"18",cy:"12",r:"2"}),(0,Jc.jsx)("circle",{cx:"12",cy:"18",r:"2"})]})}),(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",style:{opacity:.8},children:z})})]}):(0,Jc.jsxs)(Jc.Fragment,{children:[p?(0,Jc.jsx)(G,{"data-devtools":"queued-status-icon",size:12,strokeWidth:2.25,style:{verticalAlign:"middle",opacity:.6}}):"waiting_input"===c?.status?(0,Jc.jsx)(ie,{"data-devtools":"question-status-icon",size:12,strokeWidth:2.25,style:{transform:"translateY(-0.5px)",flexShrink:0}}):"failed"===c?.status?(0,Jc.jsx)(be,{size:12,strokeWidth:2.25}):(0,Jc.jsx)(pe,{size:12,strokeWidth:2.25}),(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail",children:(0,Jc.jsx)("span",{className:"popmelt-collapsible-badge-detail-inner",children:z})})]})}),Ee&&!xe&&(0,Jc.jsx)(To,{bundleCount:S,compact:le.sendCompact,onHoverChange:t=>{t&&ge(e.selector,"send",ae),k?.(t)},onSend:C}),!Te&&r?.render(!1)]})})}},`${e.transient?"intent":"history"}:${e.selector}`)})]})}var sd=c(h()),ud=c(b());function cd({styleModifications:e,textModifications:t=[],accentColor:n}){let[r,i]=(0,sd.useState)([]);if((0,sd.useEffect)(()=>{let n=null,r=()=>{let n=[],r=[...e,...t],o=new Set;for(let e of r){if(o.has(e.selector))continue;let t=An(e.selector);if(!t)continue;o.add(e.selector);let r=lt(t);if(0===r.width&&0===r.height)continue;let i=Mi(t);n.push({selector:e.selector,top:r.top,left:r.left,width:r.width,height:r.height,borderRadius:`${i["top-left"]}px ${i["top-right"]}px ${i["bottom-right"]}px ${i["bottom-left"]}px`})}i(n)},o=()=>{n&&cancelAnimationFrame(n),n=requestAnimationFrame(r)};r(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o,{passive:!0});let a=new MutationObserver(o);return a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]}),()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",o),a.disconnect(),n&&cancelAnimationFrame(n)}},[e,t]),0===r.length)return null;let o=function(e){let t=e.match(/^oklch\\(([^)]+)\\)$/i);return t?`oklch(${t[1]} / 0.2)`:`color-mix(in srgb, ${e} ${Math.round(20)}%, transparent)`}(n);return(0,ud.jsx)(ud.Fragment,{children:r.map(e=>{let t={position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,border:`1px solid ${o}`,borderRadius:e.borderRadius,boxSizing:"border-box"};return(0,ud.jsx)("div",{"data-devtools":"mod-border",style:t},e.selector)})})}var dd=c(h()),hd=c(b()),pd=["top","right","bottom","left"];function fd(e){return"all"===e?pd:"x"===e?["left","right"]:"y"===e?["top","bottom"]:"top"===e||"right"===e||"bottom"===e||"left"===e?[e]:[]}function md(e){return"top-left"===e||"top-right"===e||"bottom-right"===e||"bottom-left"===e?e:null}function gd(e,t,n,r){return e&&"value"===n&&"transform"===t&&("translate"===r||"scale"===r||"rotate"===r)}function yd({active:e,accentColor:t,family:n,stage:r,subproperty:i,hoveredElement:o,previewElement:a,transformPreviewTarget:l,previewRevision:s,frameListenerRef:u,cursorViewport:c,drag:d,onGapPointerDown:h,onRadiusPointerDown:p,onSpacingPointerDown:f,onTransformPointerDown:m}){let g=e&&"value"===r,y=o instanceof HTMLElement&&a===o,v=g&&y&&("stack"===n||"grid"===n)&&"gap"===i,x=v&&(wi(o,"row")||wi(o,"column")),b="transform"===d?.family?d.element:o,w=gd(e,n,r,i)?i:null,S=null!==w&&Tt(b)&&(a===b||l?.element===b||"transform"===d?.family),[k,C]=(0,dd.useState)(0),M=g&&(S||y&&("padding"===n||"margin"===n||"radius"===n||v));(0,dd.useLayoutEffect)(()=>{if(M)return u.current=()=>C(e=>e+1),()=>{u.current=null}},[u,M]);let E=s+k;return(0,hd.jsxs)(hd.Fragment,{children:[g&&("padding"===n||"margin"===n)&&y&&(0,hd.jsx)(Wu,{element:o,padding:"margin"===n?ki(o):Si(o),mode:n,accentColor:t,hoveredSide:d?.family===n?d.side??null:null,draggingSide:d?.family===n?d.side??null:null,activeSides:fd(i),refreshKey:E,cursorViewport:d?.cursor,onHandlePointerDown:(e,t)=>f(n,e,t)}),v&&(0,hd.jsx)(Lu,{element:o,gap:xi(o),accentColor:t,hoveredAxis:d?.gapAxis??null,draggingAxis:d?.gapAxis??null,refreshKey:E,cursorViewport:d?.cursor,isAutoGap:x,onHandlePointerDown:x?void 0:h}),g&&"radius"===n&&y&&(0,hd.jsx)(Tu,{element:o,radius:Mi(o),accentColor:t,hoveredCorner:md(i),draggingCorner:d?.corner??null,cursorViewport:d?.cursor,onHandlePointerDown:p}),S&&(0,hd.jsx)(Fa,{element:b,previewTarget:l?.element===b?l:void 0,activeFacet:w,accentColor:t,draggingKind:"transform"===d?.family?d.transformKind??null:null,draggingCorner:"transform"===d?.family?d.transformCorner??null:null,ghostQuad:"transform"===d?.family?d.ghostQuad??null:null,cursorViewport:d?.cursor??c,refreshKey:E,onHandlePointerDown:m})]})}var vd=c(h()),xd=c(b());function bd(){let e=Math.random()*Math.PI*2,t=5+8*Math.random();return{x:Math.cos(e)*t,y:Math.sin(e)*t}}function wd({onSave:e}){let[t,n]=(0,vd.useState)(!1),[r]=Ke(),i=We[r];return(0,xd.jsxs)("button",{type:"button","data-popmelt-subject-label-save":!0,"data-hovered":t?"true":"false","aria-label":"Save object label",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},style:{appearance:"none",boxSizing:"border-box",height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,margin:0,padding:"0 8px",border:`1px solid ${i.border}`,borderRadius:8,backgroundColor:i.surface,color:i.primary,fontFamily:ci,fontSize:12,fontWeight:600,letterSpacing:"0.24px",lineHeight:1,whiteSpace:"nowrap",cursor:"pointer",pointerEvents:"auto",userSelect:"none",touchAction:"manipulation"},children:[(0,xd.jsxs)("span",{className:"popmelt-subject-save-default",children:[(0,xd.jsx)(te,{size:12,strokeWidth:2,"aria-hidden":!0}),(0,xd.jsx)("span",{style:{color:i.secondary},children:"to"}),(0,xd.jsx)(Q,{size:12,strokeWidth:2,"aria-hidden":!0})]}),(0,xd.jsxs)("span",{className:"popmelt-subject-save-hovered",children:[(0,xd.jsx)("span",{children:"Save"}),(0,xd.jsx)(Q,{size:12,strokeWidth:2,"aria-hidden":!0})]})]})}function Sd({accentColor:e,created:t,registry:n,target:r,onCommit:i,onClose:o,onCancelCreated:a}){let l=n.resolve(r),s=(0,vd.useRef)(l?.subject.label??"object"),[u,c]=(0,vd.useState)(s.current),d=l?.subject.trackingAnchors?.map(e=>({...e}))??[],h=(0,vd.useRef)(d),[p,f]=(0,vd.useState)(d),[m,g]=(0,vd.useState)(0),[y,v]=(0,vd.useState)(0),x=(0,vd.useRef)(null),b=(0,vd.useRef)(null),w=(0,vd.useRef)(null),S=(0,vd.useRef)(!1),k=n.resolve(r),C=(0,vd.useMemo)(()=>{let e=typeof document>"u"?null:document.createElement("canvas").getContext("2d");e&&(e.font=`12px ${ci}`);let t=t=>(e?.measureText(t).width??7.2*t.length)+.24*Math.max(0,t.length-1);return{label:Math.max(8,t(u||" ")),full:t(`<${u||" "}>`)+16}},[u]);if((0,vd.useLayoutEffect)(()=>{w.current?.focus(),w.current?.select()},[]),(0,vd.useLayoutEffect)(()=>{if(m)for(let e of b.current?.querySelectorAll("[data-popmelt-tracking-anchor]")??[]){let t=bd();e.animate?.([{transform:"translate(-50%, -50%)"},{transform:`translate(calc(-50% + ${t.x}px), calc(-50% + ${t.y}px))`},{transform:`translate(calc(-50% - ${.55*t.x}px), calc(-50% - ${.55*t.y}px))`},{transform:"translate(-50%, -50%)"}],{duration:220,easing:"ease-out"})}},[m]),(0,vd.useEffect)(()=>n.subscribeFrame(()=>v(e=>e+1)),[n]),(0,vd.useEffect)(()=>{let e=e=>{let t=x.current;t&&(n.updateBounds(r,function(e,t){let n=t.x-e.start.x,r=t.y-e.start.y;if("translate"===e.kind)return{...e.bounds,left:e.bounds.left+n,top:e.bounds.top+r};let i=e.bounds.left+e.bounds.width,o=e.bounds.top+e.bounds.height;switch(e.corner){case"topLeft":{let t=Math.min(i-8,e.bounds.left+n),a=Math.min(o-8,e.bounds.top+r);return{left:t,top:a,width:i-t,height:o-a}}case"topRight":{let t=Math.max(e.bounds.left+8,i+n),a=Math.min(o-8,e.bounds.top+r);return{left:e.bounds.left,top:a,width:t-e.bounds.left,height:o-a}}case"bottomLeft":{let t=Math.min(i-8,e.bounds.left+n),a=Math.max(e.bounds.top+8,o+r);return{left:t,top:e.bounds.top,width:i-t,height:a-e.bounds.top}}default:{let t=Math.max(e.bounds.left+8,i+n),a=Math.max(e.bounds.top+8,o+r);return{left:e.bounds.left,top:e.bounds.top,width:t-e.bounds.left,height:a-e.bounds.top}}}}(t,{x:e.clientX,y:e.clientY})),v(e=>e+1))},t=()=>{x.current=null,v(e=>e+1)};return window.addEventListener("pointermove",e,!0),window.addEventListener("pointerup",t,!0),window.addEventListener("pointercancel",t,!0),()=>{window.removeEventListener("pointermove",e,!0),window.removeEventListener("pointerup",t,!0),window.removeEventListener("pointercancel",t,!0)}},[n,r]),!k)return null;let M=()=>{if(S.current)return;let e=u.trim();if(!e)return void(t&&a());let l=h.current,s=1===l.length?[]:l,c=k.adapter.updateSubjectTrackingAnchors?n.updateTrackingAnchors(r,s):null,d=n.rename(r,e)??c;d&&i(d),o()},{bounds:E}=k.subject,T=!!k.adapter.updateSubjectTrackingAnchors,A=Math.min(400,C.full),R=A+2+66,j=ya({left:E.left,right:E.left+E.width,top:E.top,bottom:E.top+E.height,height:E.height},22,2,window.innerHeight,R,window.innerWidth),I="right"===j.horizontalAlignment?j.left-R:j.left;return(0,xd.jsxs)(xd.Fragment,{children:[(0,xd.jsx)(Fa,{element:k.element,activeFacet:"translate",accentColor:e,showRotateHandle:!1,refreshKey:y,draggingKind:x.current?.kind??null,draggingCorner:x.current?.corner??null,onHandlePointerDown:(e,t,n)=>{"rotate"!==e&&(n.preventDefault(),n.stopPropagation(),x.current={kind:e,corner:t,start:{x:n.clientX,y:n.clientY},bounds:{...k.subject.bounds}},v(e=>e+1))}}),T&&(0,xd.jsx)("div",{ref:b,"data-popmelt-tracking-anchor-surface":!0,"aria-label":"Add tracking anchor",onPointerDown:e=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();let t=h.current;if(t.length>=3)return void g(e=>e+1);let n=[...t,{x:Math.max(0,Math.min(1,(e.clientX-E.left)/E.width)),y:Math.max(0,Math.min(1,(e.clientY-E.top)/E.height))}];h.current=n,f(n)},style:{position:"fixed",left:E.left,top:E.top,width:E.width,height:E.height,pointerEvents:"auto",cursor:"crosshair",zIndex:9998},children:p.map((t,n)=>(0,xd.jsx)("span",{"data-popmelt-tracking-anchor":!0,"data-popmelt-tracking-anchor-reject":m?"true":void 0,style:{position:"absolute",left:100*t.x+"%",top:100*t.y+"%",width:10,height:10,boxSizing:"border-box",border:"2px solid #ffffff",borderRadius:"50%",background:e,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.35)",pointerEvents:"none",transform:"translate(-50%, -50%)"}},n))}),(0,xd.jsx)("style",{children:\'\\n[data-popmelt-subject-label-editor]::selection {\\n background: #000000;\\n color: #ffffff;\\n}\\n.popmelt-subject-save-default {\\n display: inline-flex;\\n align-items: center;\\n gap: 4px;\\n}\\n.popmelt-subject-save-hovered {\\n display: none;\\n align-items: center;\\n gap: 4px;\\n}\\n[data-popmelt-subject-label-save][data-hovered="true"] .popmelt-subject-save-default {\\n display: none;\\n}\\n[data-popmelt-subject-label-save][data-hovered="true"] .popmelt-subject-save-hovered {\\n display: inline-flex;\\n}\\n@media (max-width: 767px) {\\n .popmelt-subject-save-default { display: none; }\\n .popmelt-subject-save-hovered { display: inline-flex; }\\n}\\n\'}),(0,xd.jsxs)("div",{style:{position:"fixed",left:I,top:j.top,display:"flex",alignItems:"center",gap:2,pointerEvents:"auto",zIndex:1e4},children:[(0,xd.jsxs)("div",{"data-popmelt-subject-label-editor":!0,style:{...aa(e),width:A,gap:0,borderRadius:li(j.anchor)},children:[(0,xd.jsx)("span",{"aria-hidden":!0,children:"<"}),(0,xd.jsx)("input",{ref:w,"data-popmelt-subject-label-input":!0,value:u,"aria-label":"Object label",spellCheck:!1,onChange:e=>c(e.target.value),onBlur:M,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),S.current=!0,t?a():o()):"Enter"===e.key&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),M())},style:{appearance:"none",boxSizing:"content-box",width:Math.min(C.label,368),minWidth:0,height:12*1.2+"px",margin:0,padding:0,border:0,outline:0,background:"transparent",color:"inherit",font:"inherit",letterSpacing:"inherit",lineHeight:"inherit"}}),(0,xd.jsx)("span",{"aria-hidden":!0,children:">"})]}),(0,xd.jsx)(wd,{onSave:M})]})]})}var kd=c(h());function Cd(e,t,n,r,i){let o={...e},a=(o.right-o.left||1)/(o.bottom-o.top||1),l={...e};switch(t){case"topLeft":l.left=n.x,l.top=n.y;break;case"topRight":l.right=n.x,l.top=n.y;break;case"bottomLeft":l.left=n.x,l.bottom=n.y;break;case"bottomRight":l.right=n.x,l.bottom=n.y}if(r)switch(t){case"topLeft":l.right=o.right+(o.left-l.left),l.bottom=o.bottom+(o.top-l.top);break;case"topRight":l.left=o.left-(l.right-o.right),l.bottom=o.bottom+(o.top-l.top);break;case"bottomLeft":l.right=o.right+(o.left-l.left),l.top=o.top-(l.bottom-o.bottom);break;case"bottomRight":l.left=o.left-(l.right-o.right),l.top=o.top-(l.bottom-o.bottom)}if(i){let e=l.right-l.left,n=l.bottom-l.top;if(Math.abs(e/n)>a){let r=Math.abs(n)*a*Math.sign(e);"topLeft"===t||"bottomLeft"===t?l.left=l.right-r:l.right=l.left+r}else{let r=Math.abs(e)/a*Math.sign(n);"topLeft"===t||"topRight"===t?l.top=l.bottom-r:l.bottom=l.top+r}}return l}var Md=c(h());function Ed(e){return Math.random().toString(36).substring(2,e+2)}function Td(e){return at({left:0,top:0,width:1,height:1},e.ownerDocument).height*function(e){let t=Lt(Wt(e),Ht(e));return(e.currentCSSZoom||1)*Math.hypot(t.c,t.d)}(e)}function Ad(e,t,n,r={}){let{textNode:i,targetElement:o,textNodePath:a,segments:l,originalText:s,rect:u,boundaryRect:c,boundaryRects:d,flowRect:h,firstLineIndent:p,styles:f,fontSize:m,wrapsText:g}=e,y=o.getAttribute("data-pm");y||(y=r.createPmId?.()??Ed(6),o.setAttribute("data-pm",y));let v=En(`[data-pm="${y}"]`,o.ownerDocument),x=Td(o),b=e=>e?.endsWith("px")?parseFloat(e)*x+"px":e;return{id:r.createEditId?.()??Ed(7),point:{x:u.left+n.x,y:u.top+n.y},text:s,fontSize:m*x,isNew:!0,clickPoint:t,domEdit:{selector:v,durableSelector:Mn(o),element:{...On(o),selector:v},textNodePath:a,originalText:s,textNode:i,targetElement:o,segments:l,rect:u,boundaryRect:c,boundaryRects:d,flowRect:h,firstLineIndent:p,fontFamily:f.fontFamily,fontWeight:f.fontWeight,fontStyle:f.fontStyle,lineHeight:"normal"===f.lineHeight?Math.round(m*x*1.2*10)/10+"px":b(f.lineHeight),letterSpacing:b(f.letterSpacing),color:f.color,textTransform:f.textTransform,textAlign:f.textAlign,wordSpacing:b(f.wordSpacing),textDecoration:f.textDecoration,textShadow:f.textShadow,whiteSpace:f.whiteSpace,wordBreak:f.wordBreak,overflowWrap:f.overflowWrap,wrapsText:g,singleTextNode:e.singleTextNode}}}function Rd(e){if(!e||e===document.body||e===document.documentElement||Li(e))return!1;let t=e.tagName.toLowerCase();return!["script","style","link","meta","head","html","body","input","textarea","select","option","button"].includes(t)&&!!e.parentElement}function jd(e){let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),`[data-pm="${t}"]`}function Id(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function zd(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function Ld(e,t,n,r,i=Wn){let o=n.parentElement;if(!o)return null;let a=i(e,t);for(;a&&a!==document.body;)if(a===n||n.contains(a))a=a.parentElement;else{if(a.parentElement===o&&Rd(a))break;a=a.parentElement}if(!a||a===document.body||a.parentElement!==o||a===r)return null;let l=a.getBoundingClientRect(),s=l.height>=l.width?t<l.top+l.height/2?"before":"after":e<l.left+l.width/2?"before":"after",u=Id(a);return{parent:o,reference:a,placement:s,index:"before"===s?u:u+1}}function Pd(e,t,n){let r=Array.from(e.children).filter(e=>e!==t),i=Math.max(0,Math.min(n,r.length));e.insertBefore(t,r[i]??null)}function Nd(e){let t=[""];for(let{parts:n}of e)t[t.length-1]=t[t.length-1]+n[0],t.push(...n.slice(1));return t}function _d(e,t,n,r){let i=e.targetElement;if("P"!==i.tagName)return;let o=Vi(i);if(!o&&void 0===r)return;let a=o?.root??i,{group:l,layout:s}=Ui(a),u=l.rows.indexOf(i),c=En(jd(a),a.ownerDocument),d=n.find(e=>e.paragraphs&&!e.captured&&e.selector===c),h=d??(a===i?e:function(){let e=Ni(a);return e&&Ad(e,{x:e.rect.left,y:e.rect.top},{x:window.scrollX,y:window.scrollY})}()?.domEdit);if(!h)return;let p=d?.paragraphs?.before??structuredClone(s),f=e.segments.map(e=>({...e,originalText:e.textNode.data})),m=new Map(Hi(f,f.map(e=>e.originalText).join(""),t).map(({segment:e,modifiedText:t})=>[e.textNode,t])),g=new Map;l.runs.forEach((e,t)=>e.forEach((e,n)=>g.set(e,[t,n])));let y,v=r;for(let[n,{textNode:r,originalText:i}]of e.segments.entries()){let o=g.get(r);if(!o)return;let[a,l]=o,u=t===e.originalText?i:m.get(r)??r.data,c=s[a].parts;c[l]=u,void 0!==v&&(v<u.length||n===e.segments.length-1?(y={parts:c,index:l,offset:Math.min(v,u.length)},v=void 0):v-=u.length)}if(y){let{parts:e,index:t,offset:n}=y,r=e[t];e.splice(t,1,r.slice(0,n),r.slice(n))}let x=Ki(a,s);if(!x)return;let b={selector:h.selector,durableSelector:h.durableSelector,element:h.element,textNodePath:[],original:Nd(p).join("\\n\\n"),modified:Nd(s).join("\\n\\n"),paragraphs:{before:p,after:s}},w=y&&x.rows[u+1],S=w&&Ni(w);if(!S)return{change:b};let k=Ad(S,{x:S.rect.left,y:S.rect.top},{x:window.scrollX,y:window.scrollY});return k.initialCaret=0,{change:b,next:k}}function Dd(e,t,n=!0){let r=new Map(Hi(e.segments,e.originalText,t).map(({segment:e,modifiedText:t})=>[e,t])),i=e.segments.length>1?Oc(t):void 0;return{type:"MODIFY_TEXT_CONTENTS",...n?{}:{saveUndo:!1},payload:e.segments.map(t=>({selector:e.selector,durableSelector:e.durableSelector,element:e.element,textNodePath:t.textNodePath,...void 0!==i?{canvasLabel:i}:{},original:t.originalText,modified:r.get(t)??t.originalText}))}}function Fd({anchorLeftX:e,anchorRightX:t,editorWidth:n,trailingWidth:r,viewportWidth:i}){let o=Math.max(0,i-0),a=Math.max(0,Math.min(t,o)),l=r>0?r+2:0,s=n+l,u=Math.max(0,e-8),c=a-s,d=Math.max(0,0-u)+Math.max(0,u+s-o),h=Math.max(0,0-c)<d?"right":"left",p=Math.max(60,"right"===h?a-0-l:o-u-l),f=Math.min(n,p);return{horizontalAlignment:h,editorLeft:"right"===h?a-l-f:u,maxEditorWidth:p}}function Od({text:e,fontSize:t,effectiveMaxWidth:n,annotationPrefixWidth:r,isModifiedRail:i,fitToContent:o=i,context:a}){let l=a.measureText("Type here...").width,s=o&&e.length>0?a.measureText(" ").width:l,u=ui(e).split("\\n"),c=Math.max(s,...u.map(e=>a.measureText(e||" ").width)),d=Math.max(s,n-r-(i?16:0));if(c>d){let e=function(e,t,n){return t.flatMap(t=>function(e,t,n){let r=ui(t);if(!r||e.measureText(r).width<=n)return[r];let i=r.split(/\\s+/),o=[],a="";for(let t of i){let r=a?`${a} ${t}`:t;a&&e.measureText(r).width>n?(o.push(a),a=t):a=r}return a&&o.push(a),o.length>0?o:[r]}(e,t,n))}(a,u,d);return{width:Math.min(d,Math.max(s,...e.map(e=>a.measureText(e).width))),height:Math.max(1,e.length)*t*si,isWrapped:!0}}return{width:c,height:Math.max(1,u.length)*t*si,isWrapped:!1}}function $d(e,t,n,r=6){return e.moved?e:{...e,moved:Math.hypot(t-e.startX,n-e.startY)>r}}function Hd(e){return!(!e||e.moved)}var Wd=new Set(["text","transform","opacity"]),Bd=new Set(["padding","margin","border","radius","color"]);function Vd(e,t,n){return!!Tt(e)&&(e instanceof HTMLElement||!("text"===t&&!function(e){return"text-align"!==e}(n))&&(Wd.has(t)||function(e){return e instanceof SVGSVGElement&&!(e.parentElement instanceof SVGElement)}(e)&&Bd.has(t)))}var qd={"active-edit":100,"direct-manipulation":90,"in-flight":80,"bundle-preview":70,"nested-preview":65,"annotation-hover":60,"badge-hover":60,"thread-focus":50,selected:45,"pending-change":40,"inspector-hover":30};var Ud=c(h());function Yd(e,t){return e.frames&&0!==t?{...e,frames:e.frames.map(e=>({...e,imageIndex:e.imageIndex+t}))}:e}function Xd(e){let t=e?.replace(/\\s+/g," ").trim();if(t)return t.slice(0,180)}function Kd(e){try{return Mn(e)}catch{return}}function Qd(e){if(e instanceof HTMLVideoElement){let t=Number.isFinite(e.duration)?e.duration:void 0;return{kind:"video",currentTime:e.currentTime,...void 0===t?{}:{duration:t},paused:e.paused}}}function Zd(e){if(!e||Li(e))return;let t=e instanceof HTMLElement?e:null,n=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e:null,r=e.getBoundingClientRect(),i=e.getAttribute("role")??void 0,o=Xd(e.getAttribute("class")),a=Xd(e.getAttribute("aria-label")),l=Xd(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?void 0:e.textContent),s=Qd(e);return{selector:Kd(e),tagName:e.tagName.toLowerCase(),...o?{className:o}:{},...i?{role:i}:{},...a?{ariaLabel:a}:{},...l?{text:l}:{},...!n||n instanceof HTMLInputElement&&"password"===n.type?{}:{value:n.value.slice(0,180)},...e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)?{checked:e.checked}:{},...t&&"disabled"in t&&"boolean"==typeof t.disabled?{disabled:t.disabled}:{},...e.hasAttribute("aria-expanded")?{expanded:"true"===e.getAttribute("aria-expanded")}:{},...e.hasAttribute("aria-pressed")?{pressed:"true"===e.getAttribute("aria-pressed")}:{},...e.hasAttribute("aria-selected")?{selected:"true"===e.getAttribute("aria-selected")}:{},rect:{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)},...s?{media:s}:{}}}function Gd(e){let{subject:t,target:n,adapter:r}=e,{left:i,top:o,width:a,height:l}=t.bounds,s=Qd(t.sourceElement??null);return{tagName:r.id,rect:{x:Math.round(i),y:Math.round(o),width:Math.round(a),height:Math.round(l)},subject:{adapter:n.adapter,key:n.key,label:t.label,...t.context?{context:t.context}:{},...t.data?{data:{...t.data}}:{}},...s?{media:s}:{}}}function Jd(e,t,n){if("scroll"===e)return"Scrolled the page";let r=n??Zd(t),i=r?.subject?.label??r?.ariaLabel??r?.text??r?.tagName??"element";return"click"===e?`Clicked ${i}`:"drag"===e?`Dragged ${i}`:"input"===e?`Entered text in ${i}`:"change"===e?`Changed ${i}`:"submit"===e?`Submitted ${i}`:"play"===e?`Played ${i}`:"pause"===e?`Paused ${i}`:"seek"===e?`Sought in ${i}`:`Pressed a key on ${i}`}function eh(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function th(e){return e instanceof Element?e:e.parentElement}function nh(e){return!(!e||e.domEdit||!e.linkedSelector&&!e.target)}function rh(e){return!(!e||"text"!==e.type||"pending"!==(e.status??"pending")||!e.linkedSelector&&!e.target)}var ih={kind:"root"};function oh(e,t){let n=Gs(e),r=Js(e,t),i="border"===e&&"all"===t?`${n} Width`:r===n?n:`${n} ${r}`,o=("text"===e||"border"===e)&&"color"===t;return{id:`subproperty:${e}:${t}`,label:i,searchPath:i,destination:{family:e,subproperty:t,stage:o?"family":"value"},nextScope:o?{kind:"colors",family:e}:{kind:"values",family:e,subproperty:t}}}function ah(e){return"root"===e.kind?ys.flatMap(e=>{let t=function(e){let t=Gs(e),n=function(e){return"color"===e?"slate":Ys(e)[0]}(e),r="color"===e;return{id:`family:${e}`,label:t,searchPath:t,destination:{family:e,subproperty:n,stage:r?"family":"value"},nextScope:r?{kind:"colors",family:e}:{kind:"values",family:e,subproperty:n}}}(e);return"color"===e?[t]:[t,...Ys(e).filter(e=>!Os(e)).map(t=>oh(e,t))]}):"family"===e.kind?Ys(e.family).filter(e=>!Os(e)).map(t=>oh(e.family,t)):"colors"===e.kind?ls.map(t=>function(e,t){let n=t[0].toUpperCase()+t.slice(1);return{id:`color:${e}:${t}`,label:n,searchPath:n,destination:{family:e,subproperty:t,stage:"variant"},nextScope:{kind:"values",family:e,subproperty:t}}}(e.family,t)):qs(e.family,e.subproperty).map(t=>function(e,t,n){return{id:`value:${e}:${t}:${n}`,label:String(n),searchPath:String(n),destination:{family:e,subproperty:t,step:n,stage:"value"}}}(e.family,e.subproperty,t))}function lh(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function sh(e){return lh(e).replace(/\\s+/g,"")}function uh(e,t){let n=lh(e);if(!n)return 0;let r=lh(t.searchPath),i=lh(t.label),o=sh(e),a=sh(t.searchPath),l=function(e){return lh(e).split(/\\s+/).filter(Boolean).map(e=>e[0]).join("")}(t.searchPath);if(i===n)return 1e3;if(r===n)return 980;if(i.startsWith(n))return 940;if(r.startsWith(n))return 920;if(r.split(" ").some(e=>e.startsWith(n)))return 880;if(l.startsWith(o))return 850;if(a.startsWith(o))return 820;let s=0;for(let e of o){if(s=a.indexOf(e,s),-1===s)return-1;s+=1}let u=t.id.startsWith("family:")?20:0;return 500-Math.max(0,a.length-o.length)+u}function ch(e,t){if(!t.trim())return null;let n=e=>ah(e).map((e,n)=>({candidate:e,index:n,score:uh(t,e)})).filter(e=>e.score>=0).sort((e,t)=>t.score-e.score||e.index-t.index)[0]?.candidate??null,r=n(e);if(r||"root"===e.kind)return r;if("values"===e.kind||"colors"===e.kind){let t=n({kind:"family",family:e.family});if(t)return t}return n(ih)}function dh(e,t){return t.trim().length<2?null:ch(e,t)}function hh(e){return e.id.startsWith("family:")?{kind:"icon",label:e.label,family:e.destination.family,subproperty:"all"}:e.id.startsWith("subproperty:")?{kind:"icon",label:e.label,family:e.destination.family,subproperty:e.destination.subproperty??"all"}:{kind:"label",label:e.label}}function ph(e,t){return e?t?t.label.toLowerCase().startsWith(e.toLowerCase())?{typed:t.label.slice(0,e.length),completion:t.label.slice(e.length),fallback:""}:{typed:e,completion:"",fallback:t.label}:{typed:e,completion:"",fallback:""}:{typed:"",completion:"",fallback:"Steer a property"}}function fh(e,t){Tt(e)&&(t.forEach(t=>e.style.removeProperty(t)),e.style.removeProperty("transition"))}function mh(e,t,n){return{property:e,original:`${t}px`,modified:`${n}px`}}var gh=["space-between","space-around","stretch","normal"],yh={"top-left":"border-top-left-radius","top-right":"border-top-right-radius","bottom-right":"border-bottom-right-radius","bottom-left":"border-bottom-left-radius"};function vh(e,t){return e.selector&&e.elementInfo&&0!==t.length?{selector:e.selector,durableSelector:e.durableSelector??void 0,element:e.elementInfo,changes:t}:null}function xh(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function bh(e){return"string"==typeof e&&ys.includes(e)}function wh(e,t){return"string"==typeof t&&Xs(e,t)===t}function Sh(e){if(!xh(e)||!bh(e.family))return null;let t=e.family;if(!wh(t,e.subproperty))return null;let n=e.subproperty;return function(e){return"family"===e||"variant"===e||"value"===e}(e.stage)&&function(e,t,n){return qs(e,t).includes(n)}(t,n,e.step)?{family:t,subproperty:n,stage:e.stage,step:e.step}:null}function kh(e){if(!xh(e)||"string"!=typeof e.kind)return null;if("root"===e.kind)return{kind:"root"};if("family"===e.kind&&bh(e.family))return{kind:"family",family:e.family};if("colors"===e.kind&&("border"===e.family||"color"===e.family||"text"===e.family))return{kind:"colors",family:e.family};if("values"===e.kind&&bh(e.family)){let t=e.family;return wh(t,e.subproperty)?{kind:"values",family:t,subproperty:e.subproperty}:null}return null}function Ch(e,t){return"sticker"!==e||!t}var Mh=new Set(["display","border-top-style","border-right-style","border-bottom-style","border-left-style"]);function Eh(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function Th(e,t){t.value?e.style.setProperty(t.property,t.value,t.priority):e.style.removeProperty(t.property)}function Ah(e,t){return{property:t,value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}}function Rh(e){if(e){!function(e){Qi.delete(e)}(e.element);for(let t of e.declarations)Th(e.element,t)}}function jh(e,t,n,r){if(!e?.focus||!e.element.isConnected)return n(t.x,t.y);let{element:i,focus:o}=e;if(Math.hypot(t.x-o.point.x,t.y-o.point.y)<=2)return i;let a,l=Eh(o.bounds,t.x,t.y),s=l||i.firstElementChild||i.shadowRoot||Eh(lt(i),t.x,t.y)?n(t.x,t.y):null;if(s===i&&(l||!Eh(lt(i),o.origin.x,o.origin.y)))return o.point=t,i;if(s&&s!==i&&wt(i,s)&&n(o.point.x,o.point.y)!==s)return s;i.style.setProperty("transition","none","important");try{for(let t of e.declarations)"transition"!==t.property&&Th(i,t);let l=n(t.x,t.y);return l===i?o.point=t:a=r,l}finally{if(a)a();else{for(let t of e.activeDeclarations)"transition"!==t.property&&Th(i,t);i.getBoundingClientRect();let t=e.activeDeclarations.find(e=>"transition"===e.property);t&&Th(i,t)}}}var Ih="[data-popmelt-subject-label-action]";function zh(e,t,n){let r=function(e){let t=Number(e.dataset.popmeltSubjectSurfaceLeft),n=Number(e.dataset.popmeltSubjectSurfaceTop),r=Number(e.dataset.popmeltSubjectSurfaceWidth),i=Number(e.dataset.popmeltSubjectSurfaceHeight);return[t,n,r,i].every(Number.isFinite)?{left:t,top:n,right:t+Math.max(0,r),bottom:n+Math.max(0,i)}:null}(e);return!r||t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}function Lh(e,t){let{popmeltSubjectAdapter:n,popmeltSubjectKey:r}=t.dataset;return n&&r?Array.from(e.querySelectorAll("[data-popmelt-subject-adapter][data-popmelt-subject-key]")).find(e=>!e.hasAttribute("data-popmelt-subject-label-action")&&e.dataset.popmeltSubjectAdapter===n&&e.dataset.popmeltSubjectKey===r)??null:null}function Ph(e,t,n){for(let r of e.querySelectorAll(Ih)){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom){let i=Lh(e,r);if(i&&!zh(i,t,n))continue;return r}}return null}var Nh=c(h()),_h=c(h()),Dh={isAnnotating:!1,activeTool:"inspector",activeColor:"oklch(0.628 0.258 29)",strokeWidth:3,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,styleModifications:[],textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]},Fh=(0,_h.createContext)(null),Oh=()=>()=>{},$h=()=>null;function Hh(){return Math.random().toString(36).substring(2,9)}function Wh(e){return"text"===e.type&&"lasso"===e.region?.kind&&(e={...e,fontSize:12,linkedAnchor:e.linkedAnchor??"bottom-left"}),e.status?e:e.captured?{...e,status:"in_flight"}:{...e,status:"pending"}}function Bh(e){return{canvasSamples:e.canvasSamples,annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}}function Vh(e,t){return{...e,undoStack:[...e.undoStack,{...Bh(e),...t&&{textEditSessionId:t}}],redoStack:[]}}function qh(e,t,n=!0){let{selector:r,durableSelector:i,element:o,changes:a}=t,l=typeof window<"u"?fn(window.location.pathname):"/",s=a.filter(e=>e.original!==e.modified);if(0===s.length)return e;let u=n?Vh(e):e,c=u.styleModifications.findIndex(e=>e.selector===r&&(!e.pathname||e.pathname===l));if(c>=0){let e=u.styleModifications[c],t=e.captured?[]:[...e.changes];for(let e of s){let n=t.findIndex(t=>t.property===e.property);n>=0?t=e.modified===t[n].original?t.filter((e,t)=>t!==n):t.map((t,r)=>r===n?{...t,modified:e.modified,token:e.token,sticker:e.sticker}:t):t.push(e)}return 0===t.length?{...u,styleModifications:u.styleModifications.filter((e,t)=>t!==c)}:{...u,styleModifications:u.styleModifications.map((e,n)=>n===c?{...e,changes:t,createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e)}}return{...u,styleModifications:[...u.styleModifications,{selector:r,durableSelector:i,element:o,changes:s,createdAt:Date.now(),pathname:l}]}}function Uh(e,t){let n=new Map,r=[];for(let i of e){let e=i.sampledTree&&i.referenceSelector?n.get(i.referenceSelector):void 0,o=e&&e.pathname===i.pathname?{...i,referenceSelector:e.referenceSelector,placement:e.placement}:i;i.sampledTree&&t.has(i.id)?(n.set(i.selector,o),n.set(`[data-popmelt-placement-item="${i.id}"]`,o)):r.push(o)}return r.length===e.length?e:r}function Yh(e,t,n,r){return e.selector===t&&(!e.pathname||e.pathname===r)&&e.textNodePath.length===n.length&&e.textNodePath.every((e,t)=>e===n[t])}function Xh(e,t,n=!0){let{selector:r,durableSelector:i,element:o,textNodePath:a,original:l,modified:s}=t,u=typeof window<"u"?fn(window.location.pathname):"/",c=e.textModifications.findIndex(e=>Yh(e,r,a,u)),d=t.paragraphs?JSON.stringify(t.paragraphs.before)===JSON.stringify(t.paragraphs.after):l===s;if(d&&c<0)return e;if(c>=0){let r=e.textModifications[c],a=r.captured&&n?Vh(e):e,h=r.captured?l:r.original;return(t.paragraphs?d:s===h)?{...a,textModifications:a.textModifications.filter((e,t)=>t!==c)}:{...a,textModifications:a.textModifications.map((e,n)=>n===c?{...e,durableSelector:i,element:o,...t.paragraphs&&{paragraphs:t.paragraphs},original:h,canvasLabel:t.canvasLabel,modified:s,createdAt:e.createdAt??Date.now(),captured:!1,pathname:u}:e)}}let h=n?Vh(e):e;return{...h,textModifications:[...h.textModifications,{selector:r,durableSelector:i,element:o,textNodePath:a,...t.paragraphs&&{paragraphs:t.paragraphs},...void 0!==t.canvasLabel&&{canvasLabel:t.canvasLabel},original:l,modified:s,createdAt:Date.now(),pathname:u}]}}function Kh(e,t,n=!0,r){return 0===t.length?e:t.reduce((e,t)=>Xh(e,t,!1),n?Vh(e,r):e)}function Qh(e,t){switch(t.type){case"SET_ANNOTATING":return function(e,t){return{...e,isAnnotating:t}}(e,t.payload);case"SET_TOOL":return function(e,t){return{...e,activeTool:t}}(e,t.payload);case"SET_COLOR":return function(e,t){return{...e,activeColor:t}}(e,t.payload);case"SET_STROKE_WIDTH":return function(e,t){return{...e,strokeWidth:t}}(e,t.payload);case"ADD_TEXT":return function(e,t){let n={id:t.id??Hh(),type:"text",points:[t.point],text:t.text,fontSize:t.fontSize||12,color:e.activeColor,strokeWidth:e.strokeWidth,timestamp:Date.now(),status:"pending",pathname:typeof window<"u"?fn(window.location.pathname):"/",groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.region?{region:t.region}:{},...t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?.length?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}};return{...t.groupId?e:Vh(e),annotations:[...e.annotations,n]}}(e,t.payload);case"UPDATE_TEXT":return function(e,t){return{...Vh(e),annotations:e.annotations.map(e=>e.id===t.id?{...e,text:t.text,...null!=t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}}:e)}}(e,t.payload);case"CLEAR_INTERACTION_EPISODE":return function(e,t){return{...Vh(e),annotations:e.annotations.map(e=>{if(e.id!==t.id)return e;let n=e.interactionEpisode?.frames?.length??0,{interactionEpisode:r,...i}=e;if(0===n)return i;let o=Math.max(0,(e.imageCount??0)-n);if(0===o){let{imageCount:e,...t}=i;return t}return{...i,imageCount:o}})}}(e,t.payload);case"DELETE_ANNOTATION":return function(e,t){let n=Vh(e),r=e.annotations.find(e=>e.id===t.id)?.groupId,i=new Set(e.annotations.filter(e=>e.id===t.id||r&&e.groupId===r).map(e=>e.id));return{...n,annotations:e.annotations.filter(e=>e.id!==t.id&&!(r&&e.groupId===r)),selectedAnnotationIds:e.selectedAnnotationIds.filter(e=>!i.has(e)),lastSelectedId:e.lastSelectedId&&i.has(e.lastSelectedId)?null:e.lastSelectedId}}(e,t.payload);case"MOVE_ANNOTATION":return function(e,t){let n=t.saveUndo?Vh(e):e,r=e.annotations.find(e=>e.id===t.id)?.groupId;return{...n,annotations:e.annotations.map(e=>{if(!(e.id===t.id||r&&e.groupId===r))return e;let n=t.delta.x,i=t.delta.y;return{...e,points:e.points.map(e=>({x:e.x+n,y:e.y+i}))}})}}(e,t.payload);case"RESIZE_ANNOTATION":return function(e,t){let n=t.saveUndo?Vh(e):e,r=e.annotations.find(e=>e.id===t.id);if(!r||"text"===r.type||r.points.length<2)return e;let i=0,o=0;if("rectangle"===r.type&&r.groupId){let e=t.points,n=Math.min(e[0].x,e[1].x),a=Math.max(e[0].y,e[1].y),l=r.points[0],s=r.points[r.points.length-1],u=Math.min(l.x,s.x),c=Math.max(l.y,s.y);i=n-u,o=a-c}return{...n,annotations:e.annotations.map(e=>e.id===t.id?{...e,points:t.points}:r.groupId&&e.groupId===r.groupId&&"text"===e.type?{...e,points:e.points.map(e=>({x:e.x+i,y:e.y+o}))}:e)}}(e,t.payload);case"PASTE_ANNOTATIONS":return function(e,t){return{...Vh(e),annotations:[...e.annotations,...t.annotations.map(Wh)]}}(e,t.payload);case"RESTORE_ANNOTATIONS":return function(e,t){let n=new Set,r=[];for(let e of t.annotations)n.has(e.id)||(n.add(e.id),r.push(Wh(e)));return{...e,annotations:r}}(e,t.payload);case"SYNC_ANNOTATIONS":return function(e,t){let n=new Map(e.annotations.map(e=>[e.id,e])),r=t.annotations.map(e=>{let t=Wh(e),r=n.get(t.id);return r&&t.linkedSelector&&r.linkedSelector===t.linkedSelector?{...t,points:r.points,linkedAnchor:r.linkedAnchor}:t});return{...e,annotations:r}}(e,t.payload);case"MERGE_ANNOTATIONS":return function(e,t){let n=new Set(e.annotations.map(e=>e.id)),r=t.annotations.filter(e=>!n.has(e.id)).map(Wh);return r.length>0?{...e,annotations:[...e.annotations,...r]}:e}(e,t.payload);case"UNDO":return function(e){if(0===e.undoStack.length)return e;let t=e.undoStack[e.undoStack.length-1];return{...e,annotations:t?.annotations||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,Bh(e)]}}(e);case"REDO":return function(e){if(0===e.redoStack.length)return e;let t=e.redoStack[e.redoStack.length-1];return{...e,annotations:t?.annotations||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,Bh(e)]}}(e);case"SELECT_ANNOTATION":return function(e,t){let{id:n,addToSelection:r}=t;if(null===n)return{...e,selectedAnnotationIds:[],lastSelectedId:null};if(r){if(e.selectedAnnotationIds.includes(n)){let t=e.selectedAnnotationIds.filter(e=>e!==n);return{...e,selectedAnnotationIds:t,lastSelectedId:t.length>0?t[t.length-1]:null}}return{...e,selectedAnnotationIds:[...e.selectedAnnotationIds,n],lastSelectedId:n}}return{...e,selectedAnnotationIds:[n],lastSelectedId:n}}(e,t.payload);case"UPDATE_ANNOTATION_COLOR":return function(e,t){let n=e.annotations.find(e=>e.id===t.id)?.groupId,r=new Set;for(let t of e.selectedAnnotationIds){let n=e.annotations.find(e=>e.id===t);n?.groupId&&r.add(n.groupId)}return{...e,annotations:e.annotations.map(i=>i.id===t.id||e.selectedAnnotationIds.includes(i.id)||i.groupId&&(i.groupId===n||r.has(i.groupId))?{...i,color:t.color}:i)}}(e,t.payload);case"MARK_CAPTURED":return function(e,t){let n=typeof window<"u"?fn(window.location.pathname):"/",r=t?.annotationIds?new Set(t.annotationIds):void 0,i=t?.textModifications??e.textModifications.filter(e=>!e.pathname||e.pathname===n),o=e=>e.filter(e=>!i.some(t=>e.pathname===t.pathname&&Yh(e,t.selector,t.textNodePath,t.pathname??"")&&e.createdAt===t.createdAt&&e.original===t.original&&e.modified===t.modified&&Va(e.paragraphs,t.paragraphs))),a=(e,t,n=!0)=>t?t.some(t=>Va(t,e)):n,l=t?.domModifications??e.domModifications.filter(e=>!e.pathname||e.pathname===n),s=e=>!e.captured&&l.some(t=>Va(t,e))?{...e,captured:!0}:e,u=e=>({...e,textModifications:o(e.textModifications),domModifications:(e.domModifications??[]).map(e=>e.sampledTree?s(e):e)});return{...e,undoStack:e.undoStack.map(u),redoStack:e.redoStack.map(u),annotations:e.annotations.map(e=>r&&!r.has(e.id)?e:{...e,captured:!0,status:"pending"!==e.status&&"sending"!==e.status&&e.status?e.status:"in_flight"}),styleModifications:e.styleModifications.map(e=>a(e,t?.styleModifications,!e.pathname||e.pathname===n)?{...e,captured:!0}:e),textModifications:o(e.textModifications),domModifications:e.domModifications.map(s),spacingTokenChanges:e.spacingTokenChanges.map(e=>a(e,t?.spacingTokenChanges)?{...e,captured:!0}:e),spacingTokenMods:e.spacingTokenMods.map(e=>a(e,t?.spacingTokenMods)?{...e,captured:!0}:e)}}(e,t.payload);case"CLEAR":return function(e){return{...e,canvasSamples:void 0,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}(e);case"DISCARD_DRAFT":return function(e){return e.canvasSamples?.length||e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured)?{...Vh(e),canvasSamples:void 0,annotations:e.annotations.filter(e=>"pending"!==(e.status??"pending")),styleModifications:e.styleModifications.filter(e=>e.captured),textModifications:e.textModifications.filter(e=>e.captured),domModifications:e.domModifications.filter(e=>e.captured),spacingTokenChanges:e.spacingTokenChanges.filter(e=>e.captured),spacingTokenMods:e.spacingTokenMods.filter(e=>e.captured),selectedAnnotationIds:[],lastSelectedId:null}:e}(e);case"MODIFY_STYLE":return function(e,t){let{selector:n,element:r,property:i,original:o,modified:a}=t,l=typeof window<"u"?fn(window.location.pathname):"/",s=e.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===l));if(o===a&&s<0)return e;if(s>=0){let t=e.styleModifications[s];if(t.captured){let t=Vh(e),n=t.styleModifications.map((e,t)=>t===s?{...e,changes:[{property:i,original:o,modified:a}],createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e);return{...t,styleModifications:n}}let n,r=t.changes.findIndex(e=>e.property===i),u=e;if(r>=0){let e=t.changes[r];n=a===e.original?t.changes.filter((e,t)=>t!==r):t.changes.map((e,t)=>t===r?{...e,modified:a}:e)}else{if(o===a)return e;u=Vh(e),n=[...t.changes,{property:i,original:o,modified:a}]}if(0===n.length)return{...u,styleModifications:u.styleModifications.filter((e,t)=>t!==s)};let c=u.styleModifications.map((e,t)=>t===s?{...e,changes:n,createdAt:e.createdAt??Date.now()}:e);return{...u,styleModifications:c}}{let t=Vh(e),s={selector:n,element:r,changes:[{property:i,original:o,modified:a}],createdAt:Date.now(),pathname:l};return{...t,styleModifications:[...t.styleModifications,s]}}}(e,t.payload);case"DISCARD_PLACED_SAMPLE":{let{selector:n,pathname:r}=t.payload,i=e.domModifications.find(e=>e.selector===n&&e.pathname===r&&e.sampledTree&&!e.captured),o=i?Uh(e.domModifications,new Set([i.id])):e.domModifications,a=e.canvasSamples?.filter(e=>!(e.selector===n&&e.pathname===r&&e.subject?.inserted));return o.length===e.domModifications.length&&a?.length===e.canvasSamples?.length?e:{...Vh(e),domModifications:o,canvasSamples:a}}case"PULL_PEER_EDITS":{let{styles:n,texts:r,canvases:i=[],placedElement:o}=t.payload;if(!(n.length||r.length||i.length||o))return e;let a=Vh(e);o&&(a.domModifications=[...e.domModifications,o]),i.length&&(a.canvasSamples=[...(e.canvasSamples??[]).filter(e=>!e.subject||!i.some(t=>!t.subject&&t.pathname===e.pathname&&t.selector===e.subject?.canvasSelector)),...i]);for(let e of n)a=qh(a,e,!1);return Kh(a,r,!1)}case"MODIFY_STYLES_BATCH":return qh(e,t.payload);case"CLEAR_STYLE":return function(e,t){let{selector:n,property:r}=t,i=typeof window<"u"?fn(window.location.pathname):"/",o=Vh(e),a=o.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i?e:{...e,changes:e.changes.filter(e=>e.property!==r)}).filter(e=>e.changes.length>0);return{...o,styleModifications:a}}(e,t.payload);case"CLEAR_STICKER":return function(e,t){let{selector:n,sticker:r}=t,i=typeof window<"u"?fn(window.location.pathname):"/";if(!e.styleModifications.find(e=>e.selector===n&&(!e.pathname||e.pathname===i)&&!e.captured&&e.changes.some(e=>e.sticker?.family===r.family&&e.sticker.subproperty===r.subproperty)))return e;let o=Vh(e),a=o.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i||e.captured?e:{...e,changes:e.changes.filter(e=>e.sticker?.family!==r.family||e.sticker.subproperty!==r.subproperty)}).filter(e=>e.changes.length>0);return{...o,styleModifications:a}}(e,t.payload);case"CLEAR_ALL_STYLES":return function(e){return 0===e.styleModifications.length?e:{...Vh(e),styleModifications:[]}}(e);case"RECOVER_PLACEMENT_SLOT":{let{id:n,slot:r}=t.payload,i=e.domModifications.find(e=>e.id===n);return i?.captured&&i.sampledTree&&!i.sourceSlot?{...e,domModifications:e.domModifications.map(e=>e===i?{...e,sourceSlot:r}:e)}:e}case"SETTLE_IMPLEMENTED_PLACEMENTS":return function(e,t){let n=new Set(t),r=new Set;for(let t of[e,...e.undoStack,...e.redoStack])for(let e of t.domModifications??[])e.captured&&e.sampledTree&&n.has(e.id)&&r.add(e.id);if(!r.size)return e;let i=e=>({...e,domModifications:Uh(e.domModifications??[],r)});return{...e,domModifications:Uh(e.domModifications,r),undoStack:e.undoStack.map(i),redoStack:e.redoStack.map(i)}}(e,t.payload.ids);case"SETTLE_CAPTURED_STYLES":return function(e,t){let n=new Set(t.selectors);if(0===n.size)return e;let r=e.styleModifications.filter(e=>!(e.captured&&(n.has(e.selector)||e.durableSelector&&n.has(e.durableSelector))));return r.length===e.styleModifications.length?e:{...e,styleModifications:r}}(e,t.payload);case"RESTORE_STYLE_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,styleModifications:t.map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_TEXT_CONTENT":return Xh(e,t.payload);case"MODIFY_TEXT_CONTENTS":return Kh(e,t.payload,t.saveUndo??!0,t.textEditSessionId);case"CANCEL_PARAGRAPH_EDIT":{let{id:n,selector:r,pathname:i,originalDrafts:o}=t.payload,a=e.undoStack.findIndex(e=>e.textEditSessionId===n);if(a<0)return e;let l=e=>[...e.filter(e=>e.selector!==r||e.pathname&&e.pathname!==i),...o],s=e.undoStack.slice(a).filter(e=>e.textEditSessionId!==n);return{...e,textModifications:l(e.textModifications),undoStack:[...e.undoStack.slice(0,a),...s.map(e=>({...e,textModifications:l(e.textModifications)}))]}}case"RESTORE_TEXT_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,textModifications:t.filter(e=>!e.captured).map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_DOM_STRUCTURE":return function(e,t){let n=Vh(e),r=n.domModifications.findIndex(e=>e.id===t.id);return r>=0?{...n,domModifications:n.domModifications.map((e,n)=>n===r?{...t,captured:!1}:e)}:{...n,domModifications:[...n.domModifications,t]}}(e,t.payload);case"RESTORE_DOM_MODIFICATIONS":return function(e,t){return{...e,domModifications:t}}(e,t.payload);case"UPDATE_LINKED_POSITIONS":return function(e,t){let{updates:n}=t,r=new Map(n.map(e=>[e.id,e]));return{...e,annotations:e.annotations.map(e=>{let t=r.get(e.id);return t?{...e,points:[t.point,...e.points.slice(1)],...t.linkedAnchor?{linkedAnchor:t.linkedAnchor}:{}}:e})}}(e,t.payload);case"CLEANUP_ORPHANED":return function(e,t){let{linkedSelectors:n,styleSelectors:r}=t,i=new Set(n),o=new Set(r),a=typeof window<"u"?fn(window.location.pathname):"/",l=new Set,s=new Set;for(let t of e.annotations)t.linkedSelector&&i.has(t.linkedSelector)&&(l.add(t.id),t.groupId&&s.add(t.groupId));for(let t of e.annotations)t.groupId&&s.has(t.groupId)&&l.add(t.id);let u=e.annotations.filter(e=>!l.has(e.id)),c=e.styleModifications.filter(e=>!o.has(e.selector)||e.pathname&&e.pathname!==a),d=e.domModifications.filter(e=>!o.has(e.selector)||e.pathname&&e.pathname!==a);if(u.length===e.annotations.length&&c.length===e.styleModifications.length&&d.length===e.domModifications.length)return e;let h=e.selectedAnnotationIds.filter(e=>!l.has(e));return{...e,annotations:u,styleModifications:c,domModifications:d,selectedAnnotationIds:h,lastSelectedId:h.length>0?h[h.length-1]:null}}(e,t.payload);case"SET_ANNOTATION_STATUS":return function(e,t){let n=new Set(t.ids);return{...e,annotations:e.annotations.map(e=>!n.has(e.id)||t.from&&(e.status??"pending")!==t.from?e:{...e,status:t.status})}}(e,t.payload);case"MARK_ANNOTATIONS_REPLIED":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>{if(!(n.has(e.id)||e.groupId&&r.has(e.groupId)))return e;let i=!!t.jobId&&e.replyJobIds?.includes(t.jobId),o="waiting_input"===e.status;return{...e,status:o?"waiting_input":"resolved",replyCount:(e.replyCount??0)+(i?0:1),replyJobIds:t.jobId&&!i?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,threadId:e.threadId||t.threadId,question:o?e.question:void 0}})}}(e,t.payload);case"MARK_ANNOTATIONS_FAILED":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,status:"failed",threadId:e.threadId||t.threadId,question:void 0}:e)}}(e,t.payload);case"SET_ANNOTATION_THREAD":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,threadId:t.threadId,targetBindingId:t.targetBindingId}:e)}}(e,t.payload);case"SET_ANNOTATION_QUESTION":return function(e,t){let n=new Set(t.ids),r=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&r.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&r.has(e.groupId)?{...e,status:"waiting_input",question:t.question,threadId:t.threadId}:e)}}(e,t.payload);case"APPLY_RESOLUTIONS":return function(e,t){let n=new Map(t.resolutions.map(e=>[e.annotationId,e])),r=new Map;for(let t of e.annotations){let e=n.get(t.id);e&&t.groupId&&r.set(t.groupId,e)}return{...e,annotations:e.annotations.map(e=>{let i=n.get(e.id)||(e.groupId?r.get(e.groupId):void 0);if(!i)return e;let o=!!t.jobId&&e.replyJobIds?.includes(t.jobId);return{...e,status:i.status,resolutionSummary:i.summary,scope:i.finalScope??i.inferredScope??null,replyCount:(e.replyCount??0)+(o?0:1),replyJobIds:t.jobId&&!o?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,question:void 0,threadId:e.threadId||t.threadId}})}}(e,t.payload);case"ADD_SPACING_TOKEN_CHANGE":return function(e,t){let n=e.spacingTokenChanges.findIndex(e=>e.tokenPath===t.tokenPath);return n>=0?{...e,spacingTokenChanges:e.spacingTokenChanges.map((e,r)=>r===n?t:e)}:{...e,spacingTokenChanges:[...e.spacingTokenChanges,t]}}(e,t.payload);case"RESTORE_SPACING_TOKEN_CHANGES":return function(e,t){return{...e,spacingTokenChanges:t}}(e,t.payload);case"MODIFY_SPACING_TOKEN":return function(e,t){let n,r=Vh(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath);if(i>=0){let r=e.spacingTokenMods[i],o={...t,originalValue:r.captured?r.currentValue:r.originalValue,originalPx:r.captured?r.currentPx:r.originalPx,captured:!1};n=e.spacingTokenMods.map((e,t)=>t===i?o:e)}else n=[...e.spacingTokenMods,{...t,captured:!1}];return{...r,spacingTokenMods:n}}(e,t.payload);case"DELETE_SPACING_TOKEN":return function(e,t){let n,r=Vh(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath),o=i>=0?e.spacingTokenMods[i]:null,a=i>=0?o.captured?o.currentValue:o.originalValue:t.originalValue,l=i>=0?o.captured?o.currentPx:o.originalPx:parseFloat(t.originalValue)||0,s={tokenPath:t.tokenPath,originalValue:a,currentValue:"__deleted__",targets:o?.targets??[],originalPx:l,currentPx:0,captured:!1};return n=i>=0?e.spacingTokenMods.map((e,t)=>t===i?s:e):[...e.spacingTokenMods,s],{...r,spacingTokenMods:n}}(e,t.payload);default:return t}}function Zh(e){return e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||!0===e.isContentEditable||"true"===e.getAttribute("contenteditable"))}function Gh(e){return Zh(e.composedPath?.()[0]??e.target)||Zh(function(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}())}function Jh(e,t,n){if(n)return[n];let r=new Set(t),i=new Map;for(let t of e)t.groupId&&t.threadId&&i.set(t.groupId,t.threadId);let o=new Set;for(let t of e){if(!r.has(t.id))continue;let e=t.threadId||(t.groupId?i.get(t.groupId):void 0);e&&o.add(e)}return[...o]}var ep=c(h());function tp(e){let t=jd(e);return{element:e,elementInfo:{...On(e),selector:t},selector:t,durableSelector:Mn(e)}}function np(e){return{x:e.x-window.scrollX,y:e.y-window.scrollY}}function rp(e){to(e,"transition","none")}var ip=c(h());function op(e,t,n,r){let i=n.x-t.x,o=n.y-t.y,a=i*i+o*o;if(0===a)return Math.hypot(e.x-t.x,e.y-t.y)<=r;let l=Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/a)),s=t.x+l*i,u=t.y+l*o;return Math.hypot(e.x-s,e.y-u)<=r}var ap=c(h()),lp=c(h());var sp=c(h()),up=[0,1,2,4,8,12,16,20,24,28,32],cp=[8,10,11,12,13,14,16,18,20,22,24,28,32,36,40,48,56,64,72,80,96];function dp(e){for(let t=0;t<up.length-1;t++){let n=up[t],r=up[t+1];if(e<=(n+r)/2)return n;if(e<r)return r}return 8*Math.round(e/8)}function hp({canvasRef:e,domDragRef:t,gapDragRef:n,gapHoveredAxis:r,gapHoveredElement:i,handCursorRef:o,handDragRef:a,handHoveredElement:l,handHoveredSide:s,modifiersRef:u,radiusDragRef:c,radiusHoveredCorner:d,radiusHoveredElement:h,setDomDropPreview:p,setGapDragging:f,setGapHoveredAxis:m,setGapHoveredElement:g,setGapIsAuto:y,setHandCursorPos:v,setHandDragging:x,setHandHoveredElement:b,setHandHoveredSide:w,setRadiusDragging:S,setRadiusHoveredCorner:k,setRadiusHoveredElement:C,setTextDragging:M,setTextHoveredElement:E,setTextHoveredProperty:T,textDragRef:A,textHoveredElement:R,textHoveredProperty:j}){return(0,sp.useCallback)(({x:I,y:z})=>{o.current={x:I,y:z},v({x:I,y:z});let L=u.current.cmd,P=u.current.shift;if(t.current.isDragging){let n=t.current,r=n.element;if(!r)return;if(!n.hasMoved){let e=Math.abs(I-n.startX),t=Math.abs(z-n.startY);if(e<=3&&t<=3)return;n.hasMoved=!0}let i=Ld(I,z,r,e.current);return i?void p({rect:i.reference.getBoundingClientRect(),placement:i.placement,mode:n.mode}):void p(null)}if(n.current.isDragging){let e=n.current,t=e.element;if(!t)return;let r=function(e,t,n){let r=e.axis;if(!r)return null;let i=!e.hasMoved;if(i){let n=Math.abs(t.x-e.startX),r=Math.abs(t.y-e.startY);if(n<=2&&r<=2)return null}let o=e.originalRow,a=e.originalColumn;if("column"===r){let r=t.x-e.startX;a+=r,n.isolate||(o+=r)}else{let r=t.y-e.startY;o+=r,n.isolate||(a+=r)}return o=Math.max(0,o),a=Math.max(0,a),n.snap&&(o=dp(o),a=dp(a)),{axis:r,gap:{row:Math.round(o),column:Math.round(a)},started:i,convertedAuto:i&&e.isAuto}}(e,{x:I,y:z},{isolate:L,snap:P});if(!r)return;return r.started&&(e.hasMoved=!0),r.convertedAuto&&(to(t,"justify-content","normal"),to(t,"row-gap",`${e.visualGap}px`),to(t,"column-gap",`${e.visualGap}px`),y(!1)),to(t,"row-gap",`${r.gap.row}px`),to(t,"column-gap",`${r.gap.column}px`),void f({axis:r.axis,...r.gap})}if(c.current.isDragging){let e=c.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.corner;if(!r)return null;let i=e.original[r]+t.y-e.startY;return i=Math.max(0,Math.min(e.maxRadius,i)),n.snap&&(i=dp(i)),i=Math.round(i),{corner:r,radius:n.isolate?{...e.original,[r]:i}:{"top-left":i,"top-right":i,"bottom-right":i,"bottom-left":i}}}(e,{x:I,y:z},{isolate:L,snap:P});if(!n)return;return to(t,"border-top-left-radius",`${n.radius["top-left"]}px`),to(t,"border-top-right-radius",`${n.radius["top-right"]}px`),to(t,"border-bottom-right-radius",`${n.radius["bottom-right"]}px`),to(t,"border-bottom-left-radius",`${n.radius["bottom-left"]}px`),void S(n)}if(A.current.isDragging){let e=A.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.property;if(!r)return null;let i=e.originalFontSize,o=e.originalLineHeight;if("font-size"===r)i=Math.max(1,e.originalFontSize+t.x-e.startX),n&&(i=function(e){return cp.reduce((t,n)=>Math.abs(e-n)<Math.abs(e-t)?n:t)}(i));else if(o=Math.max(i,e.originalLineHeight+t.y-e.startY),n){let e=i>0?o/i:1.2;o=i*Math.max(1,Math.round(2*e)/2)}return{property:r,text:{fontSize:Math.round(i),lineHeight:Math.round(10*o)/10}}}(e,{x:I,y:z},P);if(!n)return;return to(t,"font-size",`${n.text.fontSize}px`),to(t,"line-height",""+(n.text.fontSize>0?Math.round(n.text.lineHeight/n.text.fontSize*1e3)/1e3:1.2)),void M({property:n.property,...n.text})}if(a.current.isDragging){let e=a.current,t=e.element;if(!t)return;let n=function(e,t,n){let r=e.side;if(!r)return null;let i={...e.original};if("top"===r){let r=e.startY-t.y;i.top+=r,n.isolate||(i.bottom+=r)}else if("bottom"===r){let r=t.y-e.startY;i.bottom+=r,n.isolate||(i.top+=r)}else if("left"===r){let r=e.startX-t.x;i.left+=r,n.isolate||(i.right+=r)}else{let r=t.x-e.startX;i.right+=r,n.isolate||(i.left+=r)}return Object.keys(i).forEach(e=>{let t=Math.max(0,i[e]);n.snap&&(t=dp(t)),i[e]=Math.round(t)}),{side:r,padding:i}}(e,{x:I,y:z},{isolate:L,snap:P});if(!n)return;return to(t,"padding",`${n.padding.top}px ${n.padding.right}px ${n.padding.bottom}px ${n.padding.left}px`),void x(n)}let N=Wn(I,z);for(;N&&"A"===N.tagName;)N=N.parentElement;let _=function({element:e,stickyElement:t,point:n,hitRadius:r=16}){let i=[];e&&i.push(e),t&&t!==e&&i.push(t);let o=null,a=r,l=null;for(let e of i){let t=e.getBoundingClientRect(),r=Mi(e),i=[["top-left",t.left,t.top+r["top-left"]],["top-right",t.right,t.top+r["top-right"]],["bottom-right",t.right,t.bottom-r["bottom-right"]],["bottom-left",t.left,t.bottom-r["bottom-left"]]];for(let[t,r,s]of i){let i=Math.hypot(n.x-r,n.y-s);i<a&&(a=i,o=t,l=e)}}return o&&l?{element:l,corner:o}:null}({element:N,stickyElement:h,point:{x:I,y:z}});if(_)return C(_.element),k(_.corner),l&&b(null),s&&w(null),i&&g(null),r&&m(null),y(!1),R&&E(null),void(j&&T(null));h&&C(null),d&&k(null);let D=function({element:e,point:t,maxCandidates:n=3}){let r=[];e&&vi(e)&&r.push(e);let i=e?.parentElement??null;for(;i&&i!==document.body&&r.length<n;)vi(i)&&r.push(i),i=i.parentElement;for(let e of r){let n=bi(e).find(e=>t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h);if(n)return{element:e,axis:n.axis,isAuto:wi(e,n.axis)}}return null}({element:N,point:{x:I,y:z}});if(D)return g(D.element),m(D.axis),y(D.isAuto),l&&b(null),s&&w(null),R&&E(null),void(j&&T(null));i&&g(null),r&&m(null),y(!1);let F=function({element:e,stickyElement:t,point:n,hitRadius:r=12}){let i=[];e&&i.push(e),t&&t!==e&&i.push(t);let o=null,a=1/0,l=null;for(let e of i){if(!Ei(e))continue;let t=Ti(e);if(!t)continue;let i=n.x>=t.left&&n.x<=t.right&&n.y>=t.top&&n.y<=t.bottom,s=[["font-size",t.right,t.top+t.height/2],["line-height",t.left+t.width/2,t.bottom]];for(let[t,u,c]of s){let s=Math.hypot(n.x-u,n.y-c);(i||s<r)&&s<a&&(a=s,o=t,l=e)}}return o&&l?{element:l,property:o}:null}({element:N,stickyElement:R,point:{x:I,y:z}});if(F?(E(F.element),T(F.property)):(R&&E(null),j&&T(null)),N!==l&&b(N),N){let e=Si(N);w(function(e,t,n){let r=t.top+Math.max(n.top,4),i=t.bottom-Math.max(n.bottom,4),o=t.left+Math.max(n.left,4),a=t.right-Math.max(n.right,4);if(e.x<t.left||e.x>t.right||e.y<t.top||e.y>t.bottom)return null;let l=e.y<r,s=e.y>i,u=e.x<o,c=e.x>a;return l&&u?n.top>=n.left?"top":"left":l&&c?n.top>=n.right?"top":"right":s&&u?n.bottom>=n.left?"bottom":"left":s&&c?n.bottom>=n.right?"bottom":"right":l?"top":s?"bottom":u?"left":c?"right":null}({x:I,y:z},N.getBoundingClientRect(),e))}else w(null)},[e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m,g,y,v,x,b,w,S,k,C,M,E,T,A,R,j])}var pp=c(h()),fp=c(h());function mp({rawElement:e,point:t,dragHandoff:n,previewTarget:r,handleHitSize:i}){let o=!(!n?.element.isConnected||e!==n.element&&!function(e,t,n=8){return Math.hypot(t.x-e.x,t.y-e.y)<=n}(n.releasePoint,t)),a=!(!n||o),l=!(a||!r?.element.isConnected||!function(e,t,n,r,i,o,a){return!!(o&&a&&function(e,t,n,r){let i={x:t,y:n},o=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],a=r/2;if(o.some(e=>Math.hypot(t-e.x,n-e.y)<=a)||[[e.topLeft,e.topRight],[e.topRight,e.bottomRight],[e.bottomRight,e.bottomLeft],[e.bottomLeft,e.topLeft]].some(([e,t])=>sn(i,e,t)<=6))return!0;let l=cn(e,i,r);return sn(i,l.edge,l.handle)<=r/2}(o,r,i,a)||t===e)||(t&&t!==e&&e.contains(t)?Eh(n,r,i):!!(t&&t.contains(e)&&o&&a&&function(e,t,n,r){let i={x:t,y:n},o=cn(e,i,r);return sn(i,o.edge,o.handle)<=1.5*r}(o,r,i,a))||Eh(n,r,i)||!(!o||!function(e,t,n){let r=t,i=n,o=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],a=!1,l=!1;for(let e=0;e<o.length;e+=1){let t=o[e],n=o[(e+1)%o.length],s=(n.x-t.x)*(i-t.y)-(n.y-t.y)*(r-t.x);if(s>.001&&(a=!0),s<-.001&&(l=!0),a&&l)return!1}return!0}(o,r,i)))}(r.element,e,r.bounds,t.x,t.y,r.renderedQuad,i));return{candidate:o?n.element:l?r.element:e,clearDragHandoff:a,clearPreviewTarget:!(!r||l)}}function gp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}){return t&&!n&&("inspector"===e||"sticker"===e)}function yp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n,retainSampleRailHover:r,hoveredElement:i,hoveredElementInfo:o,subjectRegistry:a,stickerFamily:l,stickerStage:s,stickerSubproperty:u,steerDragRef:c,stickerPreviewRef:d,transformDragHandoffRef:h,transformPreviewSuppressionRef:p,transformPreviewTargetRef:f,clearStickerPreview:m,isElementInFlight:g,setHoveredElement:y,setHoveredElementInfo:v,setStickerCursor:x,setStickerStep:b}){return(0,fp.useCallback)(({viewportPoint:w,passThrough:S,stopPropagation:k})=>{if(!gp({activeTool:e,isAnnotating:t,suspendTargetDiscovery:n}))return!!n;if("sticker"===e&&(k(),x(e=>e?.x===w.x&&e.y===w.y?e:w)),c.current||r&&i&&function(e,t){let n=ca.get(e);if(!n?.isConnected||da.get(n)!==e)return!1;let r=n.closest("[data-popmelt-hover-action-rail]")?.getBoundingClientRect();return!!(r&&t.x>=r.left&&t.x<r.right&&t.y>=r.top&&t.y<r.bottom)}(i,w))return!0;if(qn(w.x,w.y))return"sticker"===e&&m(),i&&y(null),o&&v(null),x(null),!0;let C={allowBodyFallback:"inspector"===e},M=S?function(e,t,n){let r=Yn(e,t,n);return Hn(r,e,t)??r.find(n=>Xn(n,e,t))??r.at(-1)??null}(w.x,w.y,C):"sticker"===e&&d.current?.focus&&"transform"!==l?jh(d.current,w,Wn,h.current?void 0:m):Wn(w.x,w.y,C),E="inspector"===e?a?.hitTest(w):null,T=function(e,t,n,r=16){if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement)||t)return!1;let i=lt(e);return!(n.x<i.left||n.x>i.right||n.y<i.top||n.y>i.bottom)&&Math.min(n.x-i.left,i.right-n.x,n.y-i.top,i.bottom-n.y)<=r}(M,!!E,w),A=Zn(i),R=function(e,t){return!(!e||!t||e.adapter===t.adapter&&e.key===t.key)}(A,E?.target),j=!E&&A?a?.resolve(A)?.subject.sourceElement:void 0,I=j&&!Bn(j,w.x,w.y);if(!T&&!R&&!I&&"inspector"===e&&function(e,t,n,r){if(!(t instanceof HTMLElement))return!1;let{popmeltSubjectAdapter:i,popmeltSubjectKey:o}=t.dataset;if(!i||!o)return!1;let a=Array.from(e.querySelectorAll(`${Ih}[data-popmelt-subject-adapter][data-popmelt-subject-key]`)).find(e=>e.dataset.popmeltSubjectAdapter===i&&e.dataset.popmeltSubjectKey===o);return!(!a||!zh(t,n,r))&&function(e,t,n,r){let i=lt(e),o=t.getBoundingClientRect();return n>=Math.min(i.left,o.left)&&n<=Math.max(i.right,o.right)&&r>=Math.min(i.top,o.top)&&r<=Math.max(i.bottom,o.bottom)}(t,a,n,r)}(document,i,w.x,w.y))return!0;let z=E?.element??M,L="sticker"===e&&"value"===s&&"transform"===l?f.current:null,P=S?{candidate:z,clearDragHandoff:!!h.current,clearPreviewTarget:!!L}:mp({rawElement:z,point:w,dragHandoff:h.current,previewTarget:L,handleHitSize:20});P.clearDragHandoff&&(h.current=null),P.clearPreviewTarget&&(f.current=null);let N=P.candidate,_=function(e,t,n){return t?"sticker"!==e&&n(t)?null:t:null}(e,N,g);if(_===i)return E?.element===_&&function(e,t){return e?.subjectLabel!==t.subjectLabel||e?.textContent!==t.textContent||e?.context!==t.context}(o,E.elementInfo)&&v(E.elementInfo),!0;if("sticker"===e&&m(),"sticker"!==e||!Tt(_)||"transform"!==l||"translate"!==u&&"scale"!==u&&"rotate"!==u)"transform"===l&&(p.current=null);else{let e=function(e,t){return function(e,t){if("translate"===t)return bu(t,hn(e).x);if("scale"===t){let n=Number.parseFloat(e);return bu(t,Number.isFinite(n)?100*n:100)}let n=Number.parseFloat(e);return bu(t,Number.isFinite(n)?n:0)}(window.getComputedStyle(e).getPropertyValue(t).trim(),t)}(_,u);p.current={element:_,subproperty:u,step:e},b(e)}return y(_),v(E?.element===_?E.elementInfo:_?On(_):null),!0},[e,m,i,o,t,g,r,y,v,x,b,c,d,l,s,u,a,n,h,p,f])}function vp(e){let t=hp(e),n=function({annotations:e,dragState:t,resizeState:n,dispatch:r,setDragState:i,setResizeState:o}){return(0,lp.useCallback)(({point:a,centerOrigin:l,lockAspect:s})=>{if(n){let t=e.find(e=>e.id===n.annotationId);if(!t)return!0;let i=function({annotation:e,session:t,point:n,centerOrigin:r,lockAspect:i}){let{handle:o,originalPoints:a}=t;if("line"===e.type){let e=a[0],t=a[a.length-1];return"start"===o?[n,t]:[e,n]}if("freehand"===e.type){let e={left:Math.min(...a.map(e=>e.x)),right:Math.max(...a.map(e=>e.x)),top:Math.min(...a.map(e=>e.y)),bottom:Math.max(...a.map(e=>e.y))},t=e.right-e.left||1,l=e.bottom-e.top||1,s=Cd(e,o,n,r,i),u=s.right-s.left||1,c=s.bottom-s.top||1;return a.map(n=>({x:s.left+(n.x-e.left)/t*u,y:s.top+(n.y-e.top)/l*c}))}let l=a[0],s=a[a.length-1],u={left:Math.min(l.x,s.x),right:Math.max(l.x,s.x),top:Math.min(l.y,s.y),bottom:Math.max(l.y,s.y)};if("circle"===e.type){let e=(u.left+u.right)/2,t=(u.top+u.bottom)/2,a=u.right-u.left,l=u.bottom-u.top,s={...u};switch(o){case"top":if(s.top=n.y,r&&(s.bottom=t+(t-n.y)),i){let t=(s.bottom-s.top)*(a/l)/2;s.left=e-t,s.right=e+t}break;case"bottom":if(s.bottom=n.y,r&&(s.top=t-(n.y-t)),i){let t=(s.bottom-s.top)*(a/l)/2;s.left=e-t,s.right=e+t}break;case"left":if(s.left=n.x,r&&(s.right=e+(e-n.x)),i){let e=(s.right-s.left)*(l/a)/2;s.top=t-e,s.bottom=t+e}break;case"right":if(s.right=n.x,r&&(s.left=e-(n.x-e)),i){let e=(s.right-s.left)*(l/a)/2;s.top=t-e,s.bottom=t+e}}return[{x:s.left,y:s.top},{x:s.right,y:s.bottom}]}let c=Cd(u,o,n,r,i);return[{x:c.left,y:c.top},{x:c.right,y:c.bottom}]}({annotation:t,session:n,point:a,centerOrigin:l,lockAspect:s});return r({type:"RESIZE_ANNOTATION",payload:{id:n.annotationId,points:i,saveUndo:!n.hasMoved}}),n.hasMoved||o({...n,hasMoved:!0}),!0}if(t&&"pending"===(t.annotation.status??"pending")){let e=function(e,t){if("pending"!==(e.annotation.status??"pending"))return null;let n={x:t.x-e.startPoint.x,y:t.y-e.startPoint.y};return e.hasMoved?{session:{...e,startPoint:t},move:{delta:n,saveUndo:!1}}:Math.abs(n.x)>2||Math.abs(n.y)>2?{session:{...e,hasMoved:!0,startPoint:t},move:{delta:n,saveUndo:!0}}:null}(t,a);return e&&(i(e.session),r({type:"MOVE_ANNOTATION",payload:{id:t.annotation.id,delta:e.move.delta,...e.move.saveUndo?{saveUndo:!0}:{}}})),!0}return!1},[e,r,t,n,i,o])}(e),r=yp(e),i=(0,ap.useRef)(r),o=(0,ap.useRef)(e.clearPageElementHover),a=(0,ap.useRef)(!1),l=gp({activeTool:e.activeTool,isAnnotating:e.isAnnotating,suspendTargetDiscovery:e.suspendTargetDiscovery});(0,ap.useLayoutEffect)(()=>{i.current=r,o.current=e.clearPageElementHover},[r,e.clearPageElementHover]),(0,ap.useEffect)(()=>{if(l)return function({onSuspend:e,observeResize:t,onRestore:n,suspendedRef:r}){let i,o=()=>{r.current||(r.current=!0,e()),clearTimeout(i),i=setTimeout(()=>{r.current=!1,n()},96)};return window.addEventListener("scroll",o,{capture:!0,passive:!0}),t&&window.addEventListener("resize",o),()=>{t&&window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),clearTimeout(i),r.current=!1}}({observeResize:"sticker"===e.activeTool,onSuspend:()=>o.current(),onRestore:()=>{let t=e.lastCanvasCursorRef.current;t&&i.current({viewportPoint:t,passThrough:!1,stopPropagation:()=>{}})},suspendedRef:a})},[e.activeTool,e.lastCanvasCursorRef,l]);let s=(0,ap.useCallback)(e=>!!a.current||i.current(e),[]);(0,ap.useEffect)(()=>{let t=t=>{t.repeat||"Meta"!==t.key&&"Control"!==t.key||!e.lastCanvasCursorRef.current||s({viewportPoint:e.lastCanvasCursorRef.current,passThrough:!0,stopPropagation:()=>{}})};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[s,e.lastCanvasCursorRef]),(0,ap.useEffect)(()=>{let t=t=>{let n=e.canvasRef.current;if(n&&t.composedPath().includes(n))return;let r={x:t.clientX,y:t.clientY};e.lastCanvasCursorRef.current=r,s({viewportPoint:r,passThrough:t.metaKey||t.ctrlKey,stopPropagation:()=>{}})};return window.addEventListener("mousemove",t,!0),()=>window.removeEventListener("mousemove",t,!0)},[s,e.canvasRef,e.lastCanvasCursorRef]),(0,ap.useEffect)(()=>{if(e.subjectRegistry)return e.subjectRegistry.subscribeFrame(()=>{let t=e.lastCanvasCursorRef.current;t&&s({viewportPoint:t,passThrough:!1,stopPropagation:()=>{}})})},[s,e.lastCanvasCursorRef,e.subjectRegistry]);let u=(0,ap.useCallback)(()=>!!e.dragState||!!e.resizeState||e.domDragRef.current.isDragging||e.handDragRef.current.isDragging||e.gapDragRef.current.isDragging||e.radiusDragRef.current.isDragging||e.textDragRef.current.isDragging,[e.domDragRef,e.dragState,e.gapDragRef,e.handDragRef,e.radiusDragRef,e.resizeState,e.textDragRef]);return(0,ap.useEffect)(()=>{if(!l)return;let t=t=>{let n=e.lastCanvasCursorRef.current,r=t.target;!n||u()||!(r instanceof HTMLElement)||!r.contains(e.canvasRef.current)||!r.matches(":hover")||s({viewportPoint:n,passThrough:!1,stopPropagation:()=>{}})};return window.addEventListener(Jo,t),()=>window.removeEventListener(Jo,t)},[s,u,e.canvasRef,e.lastCanvasCursorRef,l]),function({activeTool:e,isAnnotating:t,lastCanvasCursorRef:n,getPoint:r,isManipulating:i,findTextAtPoint:o,clearPageElementHover:a,handleShakePointerMove:l,handleTargetPointerMove:s,handleHandPointerMove:u,handleAnnotationPointerMove:c}){return(0,pp.useCallback)(d=>{let h=r(d),p={x:h.x-window.scrollX,y:h.y-window.scrollY},f="metaKey"in d&&(!("pointerType"in d)||"mouse"===d.pointerType);n.current=p;let m=i();if(!l({isManipulating:m,isTouchEvent:"touches"in d||"pointerType"in d&&"mouse"!==d.pointerType,viewportPoint:p})){if(!m&&o(h))return void a();if(!s({viewportPoint:p,passThrough:f&&(d.metaKey||d.ctrlKey),stopPropagation:()=>d.stopPropagation()})){if("hand"===e&&t)return void u(p);c({point:h,centerOrigin:f&&(d.metaKey||d.ctrlKey),lockAspect:f&&d.shiftKey})}}},[e,a,o,r,c,u,l,s,t,i,n])}({...e,isManipulating:u,handleAnnotationPointerMove:n,handleHandPointerMove:t,handleTargetPointerMove:s})}var xp=c(h());function bp({annotationGroupMap:e,canvasRef:t,currentPathname:n,cursorPosRef:r,dispatch:i,domDragRef:o,dragState:a,gapDragRef:l,gapDragging:s,getPoint:u,handDragRef:c,handDragging:d,lastPositionedTextId:h,radiusDragRef:p,radiusDragging:f,resizeState:m,setActiveText:g,setDomDropPreview:y,setDragState:v,setGapDragging:x,setHandDragging:b,setRadiusDragging:w,setResizeState:S,setSendHintAnchorId:k,setTextDragging:C,textDragRef:M,textDragging:E}){return(0,xp.useCallback)(T=>{if(o.current.isDragging){let e=o.current,r=u(T),a=function({drag:e,clientX:t,clientY:n,pathname:r,createId:i,rootElement:o,elementAtPoint:a}){let l=e.element;if(!(l&&e.selector&&e.durableSelector&&e.elementInfo))return null;let s=Ld(t,n,l,o,a);if(!s)return null;let u=e.originalParent===s.parent&&s.index>e.originalIndex?s.index-1:s.index;if("move"===e.mode&&e.originalParent===s.parent&&(u===e.originalIndex||u===e.originalIndex+1))return null;let c=Mn(s.parent),d=jd(s.parent),h=Mn(s.reference),p=jd(s.reference),f=e.selector,m=e.durableSelector,g=e.elementInfo;if("copy"===e.mode){let e=l.cloneNode(!0);if(!(e instanceof Element))return null;zd(e),Pd(s.parent,e,u),f=jd(e),m=Mn(e),g={...On(e),selector:f}}else Pd(s.parent,l,u);let y=e.originalParent;return{id:i(),operation:e.mode,selector:f,durableSelector:m,element:g,sourceSelector:"copy"===e.mode?e.selector:void 0,sourceDurableSelector:"copy"===e.mode?e.durableSelector:void 0,sourceElement:"copy"===e.mode?e.elementInfo:void 0,originalParentSelector:y?jd(y):void 0,originalParentDurableSelector:y?Mn(y):void 0,originalIndex:e.originalIndex,targetParentSelector:d,targetParentDurableSelector:c,targetIndex:u,referenceSelector:p,referenceDurableSelector:h,placement:s.placement,pathname:r}}({drag:e,clientX:r.x-window.scrollX,clientY:r.y-window.scrollY,pathname:n,createId:Hh,rootElement:t.current});return a&&i({type:"MODIFY_DOM_STRUCTURE",payload:a}),o.current={isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null},void y(null)}if(M.current.isDragging){let e=function(e,t){return e.element&&t?vh(e,function(e,t,n){fh(e,["font-size","line-height"]);let r=[];if(t.fontSize!==n.fontSize&&(to(e,"font-size",`${n.fontSize}px`),r.push(mh("font-size",t.fontSize,n.fontSize))),t.lineHeight!==n.lineHeight){let i=t.fontSize>0?Math.round(t.lineHeight/t.fontSize*1e3)/1e3:1.2,o=n.fontSize>0?Math.round(n.lineHeight/n.fontSize*1e3)/1e3:1.2;to(e,"line-height",`${o}`),r.push({property:"line-height",original:`${i}`,modified:`${o}`})}return r}(e.element,{fontSize:e.originalFontSize,lineHeight:e.originalLineHeight},t)):null}(M.current,E);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),M.current={isDragging:!1,property:null,startX:0,startY:0,originalFontSize:0,originalLineHeight:0,originalRatio:1.2,element:null,elementInfo:null,selector:null,durableSelector:null},void C(null)}if(l.current.isDragging){let e="button"in T&&2===T.button,t=function(e,t,n){return e.element?vh(e,function(e,t,n,r){if(!t.hasMoved){if(r)return[];fh(e,[]);let n=t.justifyContent||"normal",i=gh.indexOf(n),o=gh[(i+1)%gh.length],a=[];return"normal"===o?(to(e,"justify-content","normal"),a.push({property:"justify-content",original:t.justifyContent,modified:"normal"})):"stretch"===o?(to(e,"justify-content",o),to(e,"row-gap","8px"),to(e,"column-gap","8px"),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),8!==t.row&&a.push(mh("row-gap",t.row,8)),8!==t.column&&a.push(mh("column-gap",t.column,8))):(fh(e,["row-gap","column-gap"]),to(e,"justify-content",o),a.push({property:"justify-content",original:t.justifyContent||"normal",modified:o}),t.row>0&&a.push(mh("row-gap",t.row,0)),t.column>0&&a.push(mh("column-gap",t.column,0))),a}if(!n)return[];fh(e,["row-gap","column-gap"]);let i=[];return t.isAuto?(fh(e,["justify-content"]),to(e,"justify-content","normal"),to(e,"row-gap",`${n.row}px`),to(e,"column-gap",`${n.column}px`),i.push({property:"justify-content",original:t.justifyContent,modified:"normal"}),i.push(mh("row-gap",0,n.row)),i.push(mh("column-gap",0,n.column)),i):(t.row!==n.row&&(to(e,"row-gap",`${n.row}px`),i.push(mh("row-gap",t.row,n.row))),t.column!==n.column&&(to(e,"column-gap",`${n.column}px`),i.push(mh("column-gap",t.column,n.column))),i)}(e.element,{hasMoved:e.hasMoved,isAuto:e.isAuto,row:e.originalRow,column:e.originalColumn,justifyContent:e.originalJustifyContent},t,n)):null}(l.current,s,e);return t&&i({type:"MODIFY_STYLES_BATCH",payload:t}),l.current={isDragging:!1,hasMoved:!1,axis:null,startX:0,startY:0,originalRow:0,originalColumn:0,element:null,elementInfo:null,selector:null,durableSelector:null,isAuto:!1,originalJustifyContent:"",visualGap:0},void x(null)}if(p.current.isDragging){let e=function(e,t){return e.element&&t?vh(e,function(e,t,n){let r=Object.values(yh);fh(e,r);let i=[];return Object.keys(yh).forEach(r=>{if(t[r]===n[r])return;let o=yh[r];to(e,o,`${n[r]}px`),i.push(mh(o,t[r],n[r]))}),i}(e.element,e.original,t.radius)):null}(p.current,f);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),p.current={isDragging:!1,corner:null,startY:0,original:{"top-left":0,"top-right":0,"bottom-right":0,"bottom-left":0},maxRadius:0,element:null,elementInfo:null,selector:null,durableSelector:null},void w(null)}if(c.current.isDragging){let e=function(e,t){return e.element&&t?vh(e,function(e,t,n){fh(e,["padding"]);let r=[];return Object.keys(t).forEach(i=>{if(t[i]===n[i])return;let o=`padding-${i}`;to(e,o,`${n[i]}px`),r.push(mh(o,t[i],n[i]))}),r}(e.element,e.original,t.padding)):null}(c.current,d);return e&&i({type:"MODIFY_STYLES_BATCH",payload:e}),c.current={isDragging:!1,side:null,startX:0,startY:0,original:{top:0,right:0,bottom:0,left:0},element:null,elementInfo:null,selector:null,durableSelector:null},void b(null)}if(m)return void S(null);if(!a)return;let A=e.get(a.annotation.id),R=t.current?.getContext("2d"),j=0;void 0!==A&&R&&(R.font=`${a.annotation.fontSize||12}px ${ci}`,j=R.measureText(`${A}. `).width);let I=function({session:e,clickPoint:t,groupLabelWidth:n=0}){let{annotation:r}=e;return e.hasMoved||"text"!==r.type||"pending"!==(r.status??"pending")?null:{activeText:{id:r.id,point:r.points[0],text:r.text||"",fontSize:r.fontSize||12,isNew:!1,clickPoint:{x:t.x-n,y:t.y},groupId:r.groupId,linkedSelector:r.linkedSelector,linkedAnchor:r.linkedAnchor,elements:r.elements,...r.region?{region:r.region}:{},attachments:r.attachments,interactionEpisode:r.interactionEpisode},color:r.color}}({session:a,clickPoint:u(T),groupLabelWidth:j});I&&(h.current=null,r.current=null,k(a.annotation.id),I.color&&i({type:"SET_COLOR",payload:I.color}),g(I.activeText)),v(null)},[e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m,g,y,v,x,b,w,S,k,C,M,E])}var wp=c(h()),Sp=class{constructor(){this.anchor=null,this.axis=null,this.direction=0,this.reversals=0,this.sequenceStartedAt=0,this.lastTriggerAt=Number.NEGATIVE_INFINITY}push(e){if(e.time-this.lastTriggerAt<700)return this.anchor=e,!1;if(!this.anchor||this.sequenceStartedAt&&e.time-this.sequenceStartedAt>520)return this.reset(e),!1;let t=e.x-this.anchor.x,n=e.y-this.anchor.y,r=Math.hypot(t,n);if(!this.axis)return r<16||(this.axis={x:t/r,y:n/r},this.direction=1,this.sequenceStartedAt=e.time,this.anchor=e),!1;let i=t*this.axis.x+n*this.axis.y,o=t*-this.axis.y+n*this.axis.x;if(Math.abs(i)<16)return!1;if(Math.abs(o)>.7*Math.abs(i))return this.reset(e),!1;let a=Math.sign(i);return a===this.direction?(this.anchor=e,!1):(this.direction=a,this.reversals+=1,this.anchor=e,!(this.reversals<3||(this.lastTriggerAt=e.time,this.reset(e,!0),0)))}reset(e=null,t=!1){this.anchor=e,this.axis=null,this.direction=0,this.reversals=0,this.sequenceStartedAt=0,t||(this.lastTriggerAt=Number.NEGATIVE_INFINITY)}},kp=c(h());function Cp({activeText:e,activeTextRef:t,canvasRef:n,clearPageElementHover:r,clearSelection:i,clearSignal:o,commentTextEditCandidateRef:a,cursorPosRef:l,dispatch:s,findTextAtPoint:u,lastPositionedTextId:c,onAttachImages:d,onCloseThread:h,onSend:p,pendingLinkedText:f,releaseActiveTextAttachments:m,setActiveText:g,setDragState:y,setHoveredTextId:v,setPendingLinkedText:x,setSendHintAnchorId:b,state:w,stateRef:S}){(0,kp.useLayoutEffect)(()=>{f&&(g({id:Math.random().toString(36).substring(2,9),point:f.point,subjectAnchor:f.subjectAnchor,text:"",fontSize:12,isNew:!0,linkedSelector:f.linkedSelector,target:f.target,linkedAnchor:f.linkedAnchor,elements:f.elements}),x(null))},[f,g,x]),(0,kp.useEffect)(()=>{let t=t=>{if(e)return;let n=u({x:t.clientX+window.scrollX,y:t.clientY+window.scrollY});v(n?.id??null)};return window.addEventListener("mousemove",t),()=>window.removeEventListener("mousemove",t)},[e,u,v]);let k=(0,kp.useCallback)(()=>{if(!e||t.current?.id!==e.id)return;if(t.current=null,e.domEdit)return void g(null);let n=function(e){if(e.domEdit){let t=e.domEdit;return e.text===t.originalText?{action:null,sendHintAnchorId:null,attachedImages:null}:{action:Dd(t,e.text),sendHintAnchorId:null,attachedImages:null}}let t=e.images??[],n=t.length,r=e.attachments??[];if(!(e.text.trim()||n>0||r.length>0||e.interactionEpisode?.steps.length))return{action:e.isNew?null:{type:"DELETE_ANNOTATION",payload:{id:e.id}},sendHintAnchorId:null,attachedImages:null};let i=function(e,t,n){return e||(t>0?`[${t} image${t>1?"s":""}]`:n[0]?.name??"")}(e.text,n,r)||`[Interaction episode: ${e.interactionEpisode?.steps.length??0} steps]`;return{action:e.isNew?{type:"ADD_TEXT",payload:{point:e.point,text:i,fontSize:e.fontSize,id:e.id,groupId:e.groupId,linkedSelector:e.linkedSelector,target:e.target,linkedAnchor:e.linkedAnchor,elements:e.elements,...e.region?{region:e.region}:{},...n>0?{imageCount:n}:{},...r.length>0?{attachments:r}:{},...e.interactionEpisode?{interactionEpisode:e.interactionEpisode}:{}}}:{type:"UPDATE_TEXT",payload:{id:e.id,text:i,...n>0?{imageCount:n}:{},attachments:r,interactionEpisode:e.interactionEpisode}},sendHintAnchorId:e.id,attachedImages:n>0?{annotationId:e.id,images:t}:null}}(e);n.sendHintAnchorId&&b(n.sendHintAnchorId),n.action&&s(n.action),n.attachedImages&&d&&d(n.attachedImages.annotationId,n.attachedImages.images),g(null)},[e,t,s,d,g,b]),C=(0,kp.useCallback)(()=>{let e=t.current;if(e){if(!e.isNew||e.domEdit)return void k();t.current=null,m(e.attachments),g(null),b(null)}},[t,k,m,g,b]),M=(0,kp.useCallback)(e=>{let n=S.current.annotations.find(t=>t.id===e);if(!n||"text"!==n.type||!n.points[0]||"pending"!==(n.status??"pending"))return;let o=t.current;o&&o.id!==n.id&&C(),i(),r(),c.current=null,l.current=n.text?.length??0,b(n.id),n.color&&s({type:"SET_COLOR",payload:n.color}),g({id:n.id,point:n.points[0],text:n.text||"",fontSize:n.fontSize||12,isNew:!1,groupId:n.groupId,linkedSelector:n.linkedSelector,target:n.target,linkedAnchor:n.linkedAnchor,elements:n.elements,...n.region?{region:n.region}:{},attachments:n.attachments,interactionEpisode:n.interactionEpisode})},[t,r,i,C,l,s,c,g,b,S]),E=(0,kp.useRef)(!1),T=(0,kp.useCallback)(()=>{if(!p)return;let e=t.current;if(function(e){return!!e&&(void 0!==e.originalText?e.text!==e.originalText:e.text.trim().length>0||!!e.hasInteractionEpisode)}(e?{text:e.text,originalText:e.domEdit?.originalText,hasInteractionEpisode:!!e.interactionEpisode?.steps.length}:null))return E.current=!0,void k();p()},[t,k,p]);(0,kp.useEffect)(()=>{e||!E.current||(E.current=!1,p?.())},[e,p,w.annotations,w.textModifications]);let A=(0,kp.useRef)(o);(0,kp.useEffect)(()=>{if(o===A.current)return;A.current=o;let e=t.current;e?.domEdit&&e.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText});let n=e?.isNew?e.attachments??[]:[];m(n),E.current=!1,g(null),x(null),b(null),y(null),l.current=null,c.current=null,localStorage.removeItem(qa)},[t,o,l,c,m,g,y,x,b]);let R=(0,kp.useCallback)((e,t,r,i=!1)=>function(e){let t=function(e,t,n,r=!1){return function(e,t){if(!e)return t();let n=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=n}}(n,()=>{let n=Wn(e,t);if(!n||Li(n))return null;let i=n?.ownerDocument??document,o=st(e,t,i),a=Pi(i,o.x,o.y)?.node??null;if(a&&!n.contains(a)&&(a=null),!a){let e=n;e&&!Li(e)&&(a=function(e,t,n){let r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=r.nextNode();for(;i;){let o=i,a=e.ownerDocument.createRange();a.selectNodeContents(o);let l=Array.from(a.getClientRects());if(a.detach?.(),l.some(e=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom))return o;i=r.nextNode()}return null}(e,o.x,o.y))}if(!a&&n?.closest("p")?.querySelector("[data-popmelt-empty-paragraph]"))return Ni(n.closest("p"));if(!a||!function(e){return!(!e||"http://www.w3.org/1999/xhtml"!==e.namespaceURI)}(a.parentElement))return null;let l=a.parentElement;if(Li(l))return null;for(;!r&&l.parentElement&&l!==i.body;){let e=ut(l).getComputedStyle(l).display,t="inline-block"===e&&1===l.childNodes.length&&l.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==e&&"contents"!==e&&!t)break;let n=l.parentElement;if(Li(n))break;if(Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){l=n;continue}let r=ut(n).getComputedStyle(n).display,i="inline-block"===r&&1===n.childNodes.length&&n.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==r&&"contents"!==r&&!i)break;l=n}let s=a.parentElement?.closest("p"),u=a.parentElement?.closest(\'button, input, textarea, select, [role="button"]\');if(s&&(!u||!s.contains(u)))return Ni(s,a);let c=l.tagName.toLowerCase();if("script"===c||"style"===c||"textarea"===c||"input"===c)return null;let d=Di(l).filter(e=>!r||e.textNode===a),h=d.map(e=>e.originalText).join("");if(!h.trim())return null;let p=_i(l,a);if(!p)return null;let f=ut(l).getComputedStyle(l),m=$i(d,l,f,r),{textRect:g,boundaryRect:y,boundaryRects:v,flowRect:x,firstLineIndent:b}=m;if(g.width<=0||g.height<=0)return null;let w=parseFloat(f.fontSize)||12,S="nowrap"!==f.whiteSpace&&"pre"!==f.whiteSpace&&(r?v.length>1:function(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let n=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).length;return t.detach?.(),n>1}(a)||"inline"!==f.display);return{textNode:a,targetElement:l,textNodePath:p,segments:d,originalText:h,rect:g,boundaryRect:y,boundaryRects:v,flowRect:x,firstLineIndent:b,styles:f,fontSize:w,wrapsText:S,singleTextNode:r}})}(e.clientX,e.clientY,e.canvas,e.singleTextNode);return t?Ad(t,e.clickPoint,e.scroll):null}({singleTextNode:i,clientX:e,clientY:t,clickPoint:r,canvas:n.current,scroll:{x:window.scrollX,y:window.scrollY}}),[n]),j=(0,kp.useCallback)(e=>{h?.(),x(null),y(null),b(null),i(),r(),c.current=null;let t=e.domEdit?.targetElement;if("P"===t?.tagName){let n=Vi(t)?.root??t,r=En(jd(n),n.ownerDocument),i=window.location.pathname;e.paragraphSession={id:e.id,selector:r,pathname:i,originalDrafts:S.current.textModifications.filter(e=>e.selector===r&&(!e.pathname||e.pathname===i))}}g(e)},[r,i,c,S,h,g,y,x,b]);return(0,kp.useEffect)(()=>{let e=e=>{if(0!==e.button)return;let t=S.current,n=a.current;if(!t.isAnnotating||"inspector"!==t.activeTool||!n)return;let r=Date.now()>n.expiresAt,i=Math.hypot(e.clientX-n.clientX,e.clientY-n.clientY)>12,o=n.edit.domEdit;!r&&!i&&o?.textNode.isConnected&&o.targetElement.isConnected?(e.preventDefault(),e.stopPropagation(),a.current=null,j(n.edit)):a.current=null},t=t=>{2===t.detail&&e(t)},n=t=>{e(t)};return window.addEventListener("mousedown",t,!0),window.addEventListener("dblclick",n,!0),()=>{window.removeEventListener("mousedown",t,!0),window.removeEventListener("dblclick",n,!0)}},[a,j,S]),{commitActiveText:k,finishActiveTextForTargetChange:C,createInlineTextEdit:R,enterDomTextEdit:j,editPendingLinkedComment:M,handleSendPendingBundle:T}}var Mp=c(h());var Ep=c(h());var Tp=c(h()),Ap=new Set(["resolved","needs_review","waiting_input","failed"]);function Rp(e){return e.linkedSelector??(e.target?Qn(e.target):void 0)}function jp(e,t){let n=e.groupId?t.filter(t=>t.groupId===e.groupId):[e],r=n.find(e=>void 0!==e.status&&Ap.has(e.status)),i=n.find(e=>e.threadId),o=n.find(e=>Rp(e)),a=o?Rp(o):void 0;if(!r?.status||!i?.threadId||!a)return;let l=n.find(e=>e.targetBindingId),s=n.find(e=>e.replyJobIds?.length);return{status:r.status,threadId:i.threadId,targetBindingId:l?.targetBindingId,replyJobIds:s?.replyJobIds,linkedSelector:a,elements:o?.elements}}var Ip=c(h()),zp=["flex-start","center","flex-end"],Lp=["flex-start","center","flex-end"];var Pp=c(h());function Np(e){return"colors"===e.kind?"variant":"values"===e.kind?"value":void 0}function _p(e){return"variant"!==e.stage||!$s(e.family,e.subproperty)||"border"!==e.family&&"color"!==e.family&&"text"!==e.family?"value"===e.stage?{kind:"values",family:e.family,subproperty:e.subproperty}:ih:{kind:"colors",family:e.family}}function Dp({active:e,family:t,step:n,subproperty:r,stage:i,query:o,setFamily:a,setStep:l,setSubproperty:s,setStage:u,setQuery:c,setCursor:d,setContextLabelPulse:h,setDepthSnapPulse:p,setRejectPulse:f,lastCursorRef:m,toolbarRef:g,previewRef:y,applyStickerRef:v,readColor:x,readStep:b}){(0,Pp.useEffect)(()=>{if(!e)return;m.current&&d(m.current);let w=e=>{let d=e.composedPath?.()[0]??e.target;if("INPUT"===d?.tagName||"TEXTAREA"===d?.tagName||d?.isContentEditable||d&&g?.current?.contains(d)||e.metaKey||e.ctrlKey||e.altKey)return;let m={family:t,step:n,subproperty:r,stage:i},w=e=>{a(e.family),l(e.step),s(e.subproperty),u(e.stage)},S=function(e,t,n,r=!1){if(!e)return" "!==n?{handled:!1,session:e}:r?{handled:!0,session:e}:{handled:!0,session:{query:"",segments:[],scope:_p(t),origin:t,history:[]}};if("Escape"===n)return{handled:!0,session:null};if("Backspace"===n){if(e.query){let t=e.query.slice(0,-1),n=dh(e.scope,t);return{handled:!0,session:{...e,query:t},restore:n?void 0:e.segmentOrigin,destination:n?{mode:"preview",scope:e.scope,value:n.destination}:void 0}}let t=e.history.at(-1);return t?{handled:!0,restore:t.snapshot,session:{...e,query:"",segmentOrigin:void 0,segments:e.segments.slice(0,-1),scope:t.scope,history:e.history.slice(0,-1)}}:{handled:!0,session:null,restore:e.origin}}if(" "===n){if(!e.query.trim())return{handled:!0,session:e};let n=ch(e.scope,e.query);return n?.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Np(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:e,command:"reject"}}if("Enter"===n){if("values"===e.scope.kind){let n=e.query.trim()?ch(e.scope,e.query):null;return e.query.trim()&&!n?{handled:!0,session:e,command:"reject"}:n?.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Np(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:e,destination:n?{mode:"navigate",scope:e.scope,value:n.destination}:void 0,command:"apply"}}let n=ch(e.scope,e.query);return n?n.nextScope?{handled:!0,destination:{mode:"navigate",scope:e.scope,value:n.destination},stage:Np(n.nextScope),session:{...e,query:"",segmentOrigin:void 0,segments:[...e.segments,e.query.trim()],scope:n.nextScope,history:[...e.history,{scope:e.scope,snapshot:t}]}}:{handled:!0,session:null,destination:{mode:"navigate",scope:e.scope,value:n.destination}}:{handled:!0,session:e,command:"reject"}}let i=n.toLowerCase();if(!r&&("w"===i||"a"===i||"s"===i||"d"===i)&&e.query.at(-1)===i)return{handled:!1,session:null,replayAsSteering:!0,restore:e.segmentOrigin??e.origin};if(1===n.length){let r=`${e.query}${n.toLowerCase()}`,i=dh(e.scope,r);return{handled:!0,session:{...e,query:r,segmentOrigin:e.query?e.segmentOrigin:t},destination:i?{mode:"preview",scope:e.scope,value:i.destination}:void 0}}return{handled:!1,session:e}}(o,m,e.key,e.repeat);if(S.replayAsSteering&&(c(null),p(e=>e+1)),S.handled){e.preventDefault(),e.stopPropagation(),S.restore&&w(S.restore);let t=S.destination?(e=>{let t=function(e,t,n){let{destination:r,mode:i,scope:o}=t;if("preview"===i&&"values"!==o.kind){let t=r.family,n=r.subproperty??Ks(t,e.subproperty);return{next:{family:t,subproperty:n,step:Us(t,e.step,n),stage:"colors"===o.kind?"variant":"family"},pulseContextLabel:!1}}let a=r.family,l=void 0!==r.step,s=au(a),u=!l&&$s(a,r.subproperty??"all")?n.readColor(s):null,c=r.subproperty??Ks(a,e.subproperty);"color"===a&&"family"===r.stage&&(c=u?.name??cs),("border"===a||"text"===a)&&"color"===r.subproperty&&(c=u?.name??cs);let d=l?null:u?u.name===c?u.step:us:n.readStep(a,c);return{next:{family:a,subproperty:c,step:r.step??d??Us(a,e.step,c),stage:r.stage},pulseContextLabel:"family"!==r.stage}}(m,e,{readColor:x,readStep:b});return w(t.next),t.pulseContextLabel&&h(e=>e+1),t.next})({mode:S.destination.mode,scope:S.destination.scope,destination:S.destination.value}):void 0;if(S.stage&&u(S.stage),"reject"===S.command&&f(e=>e+1),"apply"===S.command){let e=y.current?.element,n=t?{family:t.family,step:t.step,subproperty:t.subproperty}:void 0;return void(e&&v.current(e,n)?c(null):(c(S.session),e||f(e=>e+1)))}return void c(S.session)}let k=function(e,t,n){let r=t.toLowerCase(),i=()=>({handled:!0,next:e});if("a"===r||"d"===r||"ArrowLeft"===t||"ArrowRight"===t){let n="a"===r||"ArrowLeft"===t?-1:1;if("family"===e.stage){let t=function(e,t){let n=ys.indexOf(e);return ys[(n+t+ys.length)%ys.length]}(e.family,n),r="color"===t?cs:Ks(t,e.subproperty);return{handled:!0,next:{family:t,subproperty:r,step:"color"===t?ds:Us(t,e.step,r),stage:e.stage}}}return"variant"===e.stage&&$s(e.family,e.subproperty)?{handled:!0,next:{...e,subproperty:fs(e.subproperty,n),step:us}}:{handled:!0,next:{...e,step:Zs(e.family,e.step,n,e.subproperty)}}}if("q"===r||"e"===r){if("color"===e.family)return i();let t="q"===r?-1:1,o=function(e,t,n){let r=Ys(e),i="text"!==e&&"border"!==e||!Os(t)?Xs(e,t):"color",o=r.indexOf(i);return r[(o+n+r.length)%r.length]}(e.family,e.subproperty,t);if(("text"===e.family||"border"===e.family)&&"color"===o){if("family"===e.stage)return{handled:!0,next:{...e,subproperty:"color",step:us}};let t=n.readColor(au(e.family));return{handled:!0,next:{...e,subproperty:t?.name??cs,step:t?.step??ds,stage:Qs(e.stage,e.family,o)}}}return{handled:!0,next:{...e,subproperty:o,step:n.readStep(e.family,o)??Us(e.family,e.step,o),stage:Qs(e.stage,e.family,o)}}}if("w"===r||"Enter"===t){if("family"===e.stage){if("color"===e.family){let t=n.readColor("background-color");return{handled:!0,next:{...e,subproperty:t?.name??cs,step:t?.step??ds,stage:"variant"}}}if(("text"===e.family||"border"===e.family)&&"color"===e.subproperty){let t=n.readColor(au(e.family));return{handled:!0,next:{...e,subproperty:t?.name??cs,step:t?.step??ds,stage:"variant"}}}return{handled:!0,next:{...e,step:n.readStep(e.family,e.subproperty)??e.step,stage:"value"}}}return"variant"===e.stage?{handled:!0,next:{...e,step:Us(e.family,e.step,e.subproperty),stage:"value"}}:{handled:!0,next:e,command:"apply"}}return"s"===r?"value"===e.stage?{handled:!0,next:{...e,stage:$s(e.family,e.subproperty)?"variant":"family"}}:"variant"===e.stage?{handled:!0,next:{...e,subproperty:"text"===e.family?"color":e.subproperty,stage:"family"}}:i():"Escape"===t&&"family"!==e.stage?{handled:!0,stopPropagation:!0,next:{...e,subproperty:"variant"===e.stage&&"text"===e.family?"color":e.subproperty,stage:"value"===e.stage&&$s(e.family,e.subproperty)?"variant":"family"}}:{handled:!1,next:e}}(S.replayAsSteering&&S.restore?S.restore:m,e.key,{readColor:x,readStep:b});if(k.handled&&(e.preventDefault(),k.stopPropagation&&e.stopPropagation(),a(k.next.family),l(k.next.step),s(k.next.subproperty),u(k.next.stage),"apply"===k.command)){let e=y.current?.element;e?v.current(e):f(e=>e+1)}};return window.addEventListener("keydown",w,!0),()=>window.removeEventListener("keydown",w,!0)},[e,v,t,m,y,o,x,b,h,d,p,a,c,f,u,l,s,i,n,r,g])}var Fp=c(h()),Op=c(h());function $p(e,t){let n=(0,Op.useRef)(t);n.current=t;let{dragRef:r,pointerLockElementRef:i,replaceDrag:o,clearDrag:a,releasePointerLock:l}=e;(0,Op.useEffect)(()=>{let e=(e,t)=>{let a=r.current;if(!a)return;let l=i.current,s=null!==l&&document.pointerLockElement===l?function(e,t,n){return{cursor:{x:Cu(e.cursor.x+t.x,n.width),y:Cu(e.cursor.y+t.y,n.height)},deltaX:e.deltaX+t.x,deltaY:e.deltaY+t.y}}(a,{x:e.movementX,y:e.movementY},{width:window.innerWidth,height:window.innerHeight}):{cursor:{x:e.clientX,y:e.clientY},deltaX:e.clientX-a.startX,deltaY:e.clientY-a.startY},u=function(e,t,n,r){let{deltaX:i,deltaY:o}=t;if("translate"===e.transformKind&&e.startTranslate){let n=function(e,t){if(!t||0===e.x&&0===e.y)return e;let n=Math.PI/4,r=Math.atan2(e.y,e.x),i=Math.round(r/n)*n,o=Math.hypot(e.x,e.y);return{x:Math.cos(i)*o,y:Math.sin(i)*o}}({x:i,y:o},r),a=bu("translate",e.startTranslate.x+n.x),l=bu("translate",e.startTranslate.y+n.y),s=Math.abs(n.x)>=Math.abs(n.y)?a:l;return{subproperty:"translate",step:s,drag:{...e,subproperty:"translate",step:s,translateSteps:{x:a,y:l},translateValue:`${4*Number(a)}px ${4*Number(l)}px`,hasMoved:e.hasMoved||Math.abs(i)>2||Math.abs(o)>2,cursor:t.cursor,deltaX:i,deltaY:o}}}let a=e.vector?function(e,t,n){return e*n.x+t*n.y}(i,o,e.vector):"x"===e.axis?i:o,l=e.startPixels+a*(e.direction??1),s="rotate"===e.transformKind?l:Math.max(0,l),u=e.side?wu(e.side,n):e.corner?Su(e.corner,n):e.subproperty,c=e.transformKind?bu(e.transformKind,s):xu(e.family,u,s);return{subproperty:u,step:c,drag:{...e,subproperty:u,step:c,hasMoved:e.hasMoved||Math.abs(i)>2||Math.abs(o)>2,cursor:t.cursor,deltaX:i,deltaY:o}}}(a,s,t,e.shiftKey);n.current.onSelectionChange(u.subproperty,u.step),o(u.drag),n.current.onCursorChange(s.cursor)},t=()=>{n.current.onCancel(),a(),l()},s=t=>{r.current&&(t.preventDefault(),e(t,t.altKey||t.ctrlKey))},u=e=>{r.current&&(e.preventDefault(),((e,t)=>{let i=r.current;if(!i)return;let o=i.side?wu(i.side,e):i.corner?Su(i.corner,e):i.subproperty;i.hasMoved&&n.current.onCommit(i,o,t),a(),l()})(e.altKey||e.ctrlKey,{x:e.clientX,y:e.clientY}))},c=e=>{"Escape"!==e.key||!r.current||(e.preventDefault(),e.stopPropagation(),t())},d=()=>{let e=i.current;e&&document.pointerLockElement!==e&&r.current&&t()};return window.addEventListener("pointermove",s,{passive:!1}),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",t),window.addEventListener("keydown",c,!0),document.addEventListener("pointerlockchange",d),()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",t),window.removeEventListener("keydown",c,!0),document.removeEventListener("pointerlockchange",d),l()}},[a,r,i,l,o])}var Hp=c(h()),Wp=c(b());function Bp(e){return 0===e.button&&e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey}function Vp(e){return e instanceof Element&&null!==e.closest("[data-popmelt-subject-label-action]")}var qp="__active_text_send_hint__";function Up({historyPreview:e,onPlaceSample:t,bridgeUrl:n,steeringContextStorageKey:r,state:i,dispatch:o,onScreenshot:a,inFlightAnnotationIds:l,inFlightOrientationLabels:s,waitingApprovalJobIds:u,activeAnnotationIds:c,queuePositionMap:d,inFlightStyleSelectors:h,inFlightStyleSelectorJobIds:p,inFlightSelectorColors:f,modifiedElementThreadStates:m,dismissedThreadIds:g,onAttachImages:y,onRemoveImages:v,onCaptureInteractionFrame:x,onSend:b,onViewThread:w,onCloseThread:S,onArchiveThread:k,onDeleteSubmittedAnnotation:C,highlightedAnnotationIds:M,cycleFocusedAnnotationIds:E,onCanvasInteraction:T,focusedThreadAnnotationId:A,openThreadId:R,hasOpenThread:j=!1,externalCanvasRef:I,toolbarRef:z,threadPanelElement:L,clearSignal:P=0,subjectRegistry:N,subjectRegistryReady:_=!0,onFocusTargetChange:D,onFocusActivity:F,commitCommentRef:O,onUnsentCommentChange:$,showSteerChangeBadges:H=!0,onSteerPreviewChange:W,onSteerTargetClick:B,nativeFixtureInput:V=!1,steerControlBounds:q,canEditSteerText:U}){let Y=(0,Wa.useContext)(oi),{canvasRef:X,redrawAll:K,resizeCanvas:Q}=function(){let e=(0,ll.useRef)(null),t=(0,ll.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getContext("2d");n&&n.clearRect(0,0,t.width,t.height)},[]),n=(0,ll.useCallback)((t,n,r,i=1,o=!1,a=!1)=>{let l=e.current;if(!l)return;let s=l.getContext("2d");s&&function(e,t,n,r,i=1,o=!1,a=!1){let l=t.status??(t.captured?"in_flight":"pending"),s="pending"===l?t.color:"#8c8c8c";switch(e.save(),e.globalAlpha=i,t.region&&function(e,t,n,r=!0){t.length<3||(e.save(),e.beginPath(),t.forEach((t,n)=>0===n?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)),e.closePath(),e.fillStyle=n,e.globalAlpha*=.07,e.fill("evenodd"),e.restore(),r&&(e.save(),e.strokeStyle=n,e.lineWidth=1,e.setLineDash([...$r]),e.stroke(),e.restore()))}(e,t.region.points,s,!a),t.type){case"freehand":((e,t,n,r)=>{let i=hl(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.moveTo(o.x,o.y);for(let n=1;n<t.length-1;n++){let r=t[n],i=t[n+1];!r||!i||e.quadraticCurveTo(r.x,r.y,(r.x+i.x)/2,(r.y+i.y)/2)}e.lineTo(a.x,a.y),e.stroke()})(e,t.points,s,t.strokeWidth);break;case"line":((e,t,n,r)=>{let i=hl(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.moveTo(o.x,o.y),e.lineTo(a.x,a.y),e.stroke()})(e,t.points,s,t.strokeWidth);break;case"rectangle":((e,t,n,r)=>{let i=hl(t);if(!i)return;let[o,a]=i;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.strokeRect(Math.min(o.x,a.x),Math.min(o.y,a.y),Math.abs(a.x-o.x),Math.abs(a.y-o.y))})(e,t.points,s,t.strokeWidth);break;case"circle":((e,t,n,r)=>{let i=hl(t);if(!i)return;let[o,a]=i,l=(o.x+a.x)/2,s=(o.y+a.y)/2,u=Math.abs(a.x-o.x)/2,c=Math.abs(a.y-o.y)/2;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.ellipse(l,s,u,c,0,0,2*Math.PI),e.stroke()})(e,t.points,s,t.strokeWidth);break;case"text":if(t.text&&t.points[0]){let i="pending"===l?"#ffffff":"#dddddd";!function(e,t,n,r,i=12,o,a,l,s="#dddddd",u,c=!1){if(!n)return;let d=i*si,h=n.replace(/\\n/g," "),p=void 0!==o?o+". "+h:h;e.font=`${i}px ${ci}`,e.textBaseline="middle";let f=void 0!==a?Math.min(400,Math.max(60,window.innerWidth-a-16)):400,m=c?16:0,g=hi(e,p,Math.max(60,f-m)),y=m+e.measureText(g).width,v=fi(t,i,l,y+16);e.fillStyle=r;let x=v.x-8,b=v.y-4,w=y+16,S=d+8;e.beginPath(),e.roundRect(x,b,w,S,ai(u)),e.fill();let k=v.y+d/2;if(c){let t=v.x,n=k-6;e.strokeStyle=s,e.lineWidth=1.5,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(t+7.5,n+4),e.lineTo(t+10.5,n+6.5),e.lineTo(t+7.5,n+9),e.moveTo(t+1.5,n+1.5),e.lineTo(t+1.5,n+4.5),e.quadraticCurveTo(t+1.5,n+6.5,t+3.5,n+6.5),e.lineTo(t+10.5,n+6.5),e.stroke()}e.fillStyle=s,e.fillText(g,v.x+m,k)}(e,t.points[0],t.text,s,t.fontSize,n,t.points[0].x,r,i,Za(t)?"bottom-left":t.linkedAnchor,o)}}e.restore()}(s,t,n,r,i,o,a)},[]),r=(0,ll.useCallback)((t,n)=>{let r=e.current;if(!r||t.points.length<2)return;let i=r.getContext("2d");if(i){if(i.fillStyle="#ffffff",i.strokeStyle=t.color,i.lineWidth=1.5,"line"===t.type)return void[t.points[0],t.points[t.points.length-1]].forEach(e=>{i.beginPath(),i.arc(e.x,e.y,n/2,0,2*Math.PI),i.fill(),i.stroke()});if("circle"===t.type){let e=t.points[0],r=t.points[t.points.length-1],o=Math.min(e.x,r.x),a=Math.max(e.x,r.x),l=Math.min(e.y,r.y),s=Math.max(e.y,r.y),u=(o+a)/2,c=(l+s)/2;return void[{x:u,y:l},{x:u,y:s},{x:o,y:c},{x:a,y:c}].forEach(e=>{i.beginPath(),i.rect(e.x-n/2,e.y-n/2,n,n),i.fill(),i.stroke()})}if("rectangle"===t.type||"freehand"===t.type){let e,r,o,a;if("freehand"===t.type)e=Math.min(...t.points.map(e=>e.x)),r=Math.max(...t.points.map(e=>e.x)),o=Math.min(...t.points.map(e=>e.y)),a=Math.max(...t.points.map(e=>e.y));else{let n=t.points[0],i=t.points[t.points.length-1];e=Math.min(n.x,i.x),r=Math.max(n.x,i.x),o=Math.min(n.y,i.y),a=Math.max(n.y,i.y)}[{x:e,y:o},{x:r,y:o},{x:e,y:a},{x:r,y:a}].forEach(e=>{i.beginPath(),i.rect(e.x-n/2,e.y-n/2,n,n),i.fill(),i.stroke()})}}},[]),i=(0,ll.useRef)(null),o=(0,ll.useRef)(new Map);(0,ll.useEffect)(()=>()=>{null!==i.current&&cancelAnimationFrame(i.current)},[]);let a=(0,ll.useCallback)((a,l,s,u=0,c=0,d,h,p,f,m,g=.5,y,v)=>{null!==i.current&&cancelAnimationFrame(i.current),i.current=null;let x=performance.now(),b=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,w=new Map,S=x;for(let e of a){if("text"!==e.type)continue;let t=Number(po(e,u,c)),n=o.current.get(e.id),r=n?.to!==t||b?{from:n&&!b?pl(n,x):t,to:t,start:x}:n;w.set(e.id,r),r.from!==t&&(S=Math.max(S,r.start+160))}o.current=w;let k=o=>{let x=e=>{let t=w.get(e);return t?pl(t,o):1};if(t(),a.forEach(e=>{let t=x(e.id);if(0===t)return;let r={...e,points:fl(e.points,u,c),...e.region?{region:{...e.region,points:fl(e.region.points,u,c)}}:{}},i=d?.get(e.id),o=m?.has(e.id)??!1,a=!!h?.size,l=h?.has(e.id)??!1,s=a?l?1:.2:!f||f.has(e.id)||o?1:g;n(r,i,p,s*t,y?.has(e.id),v?.has(e.id))}),l&&l.length>0&&s){let t=e.current?.getContext("2d");for(let e of l){let n=a.find(t=>t.id===e);if(n&&x(n.id)>0){let e=m?.has(n.id)??!1,i=!!h?.size,o=h?.has(n.id)??!1,l=i?o?1:.2:!f||f.has(n.id)||e?1:g,p={...n,points:fl(n.points,u,c)};if(t?.save(),t&&(t.globalAlpha=l*x(n.id)),r(p,s),t&&"text"!==n.type&&d&&(!n.groupId||!a.some(e=>e.groupId===n.groupId&&"text"===e.type))){let e=d.get(n.id);if(void 0!==e){let r=gl(p);if(r){let i="pending"===(n.status??(n.captured?"in_flight":"pending"))?n.color:"#999999";ml(t,r.x,r.y,e,i,s)}}}t?.restore()}}}i.current=o<S?requestAnimationFrame(k):null};k(x)},[t,n,r]),l=(0,ll.useCallback)(()=>{let t=e.current;if(!t)return;let n=window.devicePixelRatio||1,r=window.visualViewport?.width??window.innerWidth,i=window.visualViewport?.height??window.innerHeight;t.width=r*n,t.height=i*n;let o=t.getContext("2d");o&&o.scale(n,n)},[]);return{canvasRef:e,clearCanvas:t,drawAnnotation:n,redrawAll:a,resizeCanvas:l}}(),Z=(0,Wa.useRef)(null),[G,J]=(0,Wa.useState)(null),[ee,te]=(0,Wa.useState)(0),[ne,re]=(0,Wa.useState)(0),ie=(0,Wa.useCallback)(()=>re(e=>e+1),[]),oe=Bo(),ae=(0,Wa.useCallback)(e=>{X.current=e,I&&(I.current=e),J(t=>t===e?t:e)},[I,X]);(0,Wa.useLayoutEffect)(()=>{if(!N||!_)return;let e=!1;for(let t of i.annotations)t.target&&(e=!0,!N.resolve(t.target)&&t.elements?.[0]&&N.restore(t.target,t.elements[0]));e&&te(e=>e+1)},[i.annotations,N,_]);let le=(0,Wa.useRef)(null),se=(0,Wa.useRef)(0),[ue,ce]=(0,Wa.useState)(null),de=(0,Wa.useCallback)(()=>{let e=le.current;le.current=null,ce(null),e&&(e.session.cancel(),e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId))},[]),he=(0,Wa.useRef)(!1),[pe,fe]=(0,Wa.useState)(!1),me=(0,Wa.useRef)(null),ge=(0,Wa.useRef)(null),[ye,xe]=(0,Wa.useState)(!1),be=(0,Wa.useRef)(Promise.resolve()),[we,Se]=(0,Wa.useState)(0),[ke,Ce]=(0,Wa.useState)(null),Me=(0,Wa.useCallback)(()=>{if(!x)return Promise.resolve(null);let e=be.current.then(async()=>(await new Promise(e=>window.requestAnimationFrame(()=>e())),x()));return be.current=e.catch(()=>null),e},[x]),Ee=(0,Wa.useRef)(i.activeTool),Te=(0,Wa.useRef)(void 0);(0,Wa.useEffect)(()=>()=>clearTimeout(Te.current),[]);let Ae=(0,Wa.useRef)(null),Re=(0,Wa.useRef)(null),je=(0,Wa.useRef)(null),Ie=(0,Wa.useRef)(null),ze=(0,Wa.useCallback)(()=>{me.current?.cancel(),me.current=null,ge.current=null,he.current=!1,je.current=null,Ie.current=null,fe(!1),xe(!1),Se(0),Ce(null)},[]),Le=(0,Wa.useCallback)(()=>{de(),he.current=!0,Ee.current=i.activeTool,fe(!0)},[de,i.activeTool]);(0,Wa.useEffect)(()=>{he.current&&i.activeTool!==Ee.current&&ze()},[ze,i.activeTool]),(0,Wa.useEffect)(()=>{(!i.isAnnotating||"inspector"!==i.activeTool)&&de()},[de,i.activeTool,i.isAnnotating]),(0,Wa.useEffect)(()=>()=>{let e=le.current;le.current=null,e?.session.cancel()},[]);let{activeText:Pe,setActiveText:De,handleTextPaste:Fe,removeActiveTextAttachment:Oe,releaseActiveTextAttachments:$e}=function({bridgeUrl:e,annotations:t,persist:n=!0}){let[r,i]=(0,Ba.useState)(()=>n?function(){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(qa),t=e?JSON.parse(e):null;return"lasso"!==t?.region?.kind||t.domEdit?t:{...t,fontSize:12,linkedAnchor:t.linkedAnchor??"bottom-left"}}catch{return null}}():null);(0,Ba.useEffect)(()=>{if(!r||r.domEdit)return;let e=t.find(e=>e.id===r.id&&"pending"!==(e.status??(e.captured?"in_flight":"pending")));!e||e.text!==r.text||r.images?.length||JSON.stringify(e.attachments??[])!==JSON.stringify(r.attachments??[])||JSON.stringify(e.interactionEpisode??null)!==JSON.stringify(r.interactionEpisode??null)||i(e=>e===r?null:e)},[r,t]),(0,Ba.useEffect)(()=>{n&&(r&&!r.domEdit?window.localStorage.setItem(qa,JSON.stringify(r)):window.localStorage.removeItem(qa))},[r,n]),(0,Ba.useEffect)(()=>{let t=r?.attachments?.map(e=>e.id)??[];!e||0===t.length||async function(e,t){0!==t.length&&await _e(`${e}/draft-attachments/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})},5e3)}(e,t).catch(()=>{})},[r?.attachments,e]);let o=(0,Ba.useCallback)(t=>{!e||!t?.length||Promise.all(t.map(t=>Ne(e,t.id).catch(()=>{})))},[e]),a=(0,Ba.useCallback)(async n=>{if(!r||r.domEdit)return;let o=function(e){return function(e){let t=e.replace(/^\\uFEFF/,"").trim().replace(/^<\\?xml[\\s\\S]*?\\?>\\s*/i,"").replace(/^(?:\x3c!--[\\s\\S]*?--\x3e\\s*)+/i,"").replace(/^<!doctype\\s+svg[\\s\\S]*?>\\s*/i,"");return/^<svg(?:\\s|>)[\\s\\S]*<\\/svg>\\s*$/i.test(t)}(e)?{blob:new Blob([e],{type:"image/svg+xml"}),kind:"svg",name:"figma-selection.svg"}:e.length>=8192?{blob:new Blob([e],{type:"text/plain"}),kind:"text",name:"pasted-context.txt"}:null}(n.clipboardData.getData("text/plain"));if(o){if(n.preventDefault(),!e)return;if(o.blob.size>2097152)return void console.warn("[Popmelt] Pasted attachment exceeds the 2 MB draft limit.");try{let n=r.groupId?t.find(e=>e.groupId===r.groupId&&"text"!==e.type)?.id??r.id:r.id,a=await async function(e,t,n){let r=new URLSearchParams({annotationId:t,kind:n.kind,name:n.name}),i=await _e(`${e}/draft-attachments?${r}`,{method:"POST",headers:{"Content-Type":n.blob.type},body:n.blob},15e3);if(!i.ok)throw new Error((await i.json().catch(()=>null))?.error||`Bridge returned ${i.status}`);return(await i.json()).attachment}(e,n,o);i(e=>e?.id===r.id?{...e,attachments:[...e.attachments??[],a]}:e)}catch(e){console.error("[Popmelt] Failed to stage pasted attachment:",e)}return}let a=n.clipboardData.items,l=[];for(let e=0;e<a.length;e+=1){let t=a[e];if(!t.type.startsWith("image/"))continue;let n=t.getAsFile();n&&l.push(n)}0!==l.length&&(n.preventDefault(),i(e=>e?{...e,images:[...e.images??[],...l]}:null))},[r,t,e]),l=(0,Ba.useCallback)(t=>{i(e=>e&&{...e,attachments:e.attachments?.filter(e=>e.id!==t)}),e&&Ne(e,t).catch(()=>{})},[e]);return{activeText:r,setActiveText:i,handleTextPaste:a,removeActiveTextAttachment:l,releaseActiveTextAttachments:o}}({persist:!V,bridgeUrl:n,annotations:i.annotations}),[He,We]=(0,Wa.useState)(null),[Be,Ve]=(0,Wa.useState)(null),[qe,Ue]=(0,Wa.useState)(null),[Ye,Xe]=(0,Wa.useState)(0),Ke=(0,Wa.useRef)(null),Qe=(0,Wa.useRef)(null),Ze=(0,Wa.useRef)(null),[Ge,Je]=(0,Wa.useState)(null),[et,tt]=(0,Wa.useState)(null),nt=(0,Wa.useRef)(void 0);void 0===nt.current&&(nt.current=r&&typeof window<"u"?function(e,t){try{let n=e.getItem(t);if(!n)return null;let r=JSON.parse(n);return xh(r)&&1===r.version?function(e){let t=Sh(e);if(!t||!xh(e))return null;if(null===e.query)return{...t,query:null};let n=function(e){if(!xh(e)||"string"!=typeof e.query||!Array.isArray(e.segments)||!e.segments.every(e=>"string"==typeof e))return null;let t=kh(e.scope),n=Sh(e.origin);if(!t||!n||!Array.isArray(e.history))return null;let r,i=[];for(let t of e.history){if(!xh(t))return null;let e=kh(t.scope),n=Sh(t.snapshot);if(!e||!n)return null;i.push({scope:e,snapshot:n})}if(void 0!==e.segmentOrigin){let t=Sh(e.segmentOrigin);if(!t)return null;r=t}return{query:e.query,segments:e.segments,scope:t,origin:n,...r?{segmentOrigin:r}:{},history:i}}(e.query);return n?{...t,query:n}:null}(r.context):null}catch{return null}}(window.localStorage,r):null);let it=nt.current,[ot,at]=(0,Wa.useState)(()=>it?.family??"padding"),[st,ht]=(0,Wa.useState)(()=>it?.step??4),[pt,ft]=(0,Wa.useState)(()=>it?.subproperty??"all"),[mt,gt]=(0,Wa.useState)(()=>it?.stage??"family"),[yt,bt]=(0,Wa.useState)(null);!function(e,t){(0,Hp.useEffect)(()=>{let n=n=>{if("touch"===n.pointerType)return;let r={x:n.clientX,y:n.clientY};e.current=r,t?.(r)};return window.addEventListener("pointermove",n,{capture:!0,passive:!0}),()=>window.removeEventListener("pointermove",n,{capture:!0})},[e,t])}(Qe,ye?Ce:i.isAnnotating&&"sticker"===i.activeTool?bt:void 0);let[wt,St]=(0,Wa.useState)(null),kt=(0,Wa.useCallback)(e=>{St({id:performance.now(),nativeReady:!1,tool:e})},[]),[Ct,Mt]=(0,Wa.useState)(0),[Et,At]=(0,Wa.useState)(0),[Rt,jt]=(0,Wa.useState)(0),[It,zt]=(0,Wa.useState)(0),[Lt,Pt]=(0,Wa.useState)(!1),[Nt,_t]=(0,Wa.useState)(0),[Dt,Ft]=(0,Wa.useState)(()=>it?.query??null);(0,Wa.useEffect)(()=>{!r||typeof window>"u"||function(e,t,n){try{e.setItem(t,JSON.stringify({version:1,context:n}))}catch{}}(window.localStorage,r,{family:ot,step:st,subproperty:pt,stage:mt,query:Dt})},[r,ot,Dt,mt,st,pt]);let Ot=(0,Wa.useRef)(i.activeTool),$t=(0,Wa.useRef)(!1),Ht=(0,Wa.useRef)(()=>!1),Wt=(0,Wa.useRef)(null),Bt=(0,Wa.useRef)(null);(0,Wa.useLayoutEffect)(()=>{let e=Wt.current;W&&Bt.current!==e&&(Bt.current=e,W(e))},[Nt,W]);let Vt=(0,Wa.useRef)(null),Yt=(0,Wa.useRef)(i.styleModifications),Xt=(0,Wa.useRef)(null),Kt=(0,Wa.useRef)(null),Qt=(0,Wa.useRef)(null),Zt=(0,Wa.useRef)(null),Gt=(0,Wa.useRef)(null),Jt=(0,Wa.useCallback)(()=>{null!==Gt.current&&(cancelAnimationFrame(Gt.current),Gt.current=null)},[]),en=(0,Wa.useCallback)(()=>{if(Jt(),!Y)return;let e,t=n=>{e??=n,function(e){if(e)for(let t of e.activeDeclarations){let n=e.element.style;n.getPropertyValue(t.property)===t.value&&n.getPropertyPriority(t.property)===t.priority||Th(e.element,t)}}(Wt.current);let r=Xt.current;r&&Wt.current?.element===r.element&&(r.renderedQuad=qt(r.element,r.layoutQuad)),Zt.current?.(),Gt.current=n-e<100?requestAnimationFrame(t):null};Gt.current=requestAnimationFrame(t)},[Jt,Y]);(0,Wa.useEffect)(()=>(Y?Wt.current&&en():Jt(),Jt),[Y,en,Jt]);let tn=(0,Wa.useCallback)(()=>{Jt();let e=Wt.current;e&&(Rh(e),Wt.current=null,Vt.current=null,_t(e=>e+1))},[Jt]),{handleShakePointerMove:nn,pendingShakeToolTransitionRef:rn}=function({activeTool:e,isAnnotating:t,clearStickerPreview:n,dispatch:r,setStickerCursor:i,startCursorSwitchPulse:o}){let a=(0,wp.useRef)(new Sp),l=(0,wp.useRef)(null);return{handleShakePointerMove:(0,wp.useCallback)(({isManipulating:s,isTouchEvent:u,viewportPoint:c})=>{if(u||s||!t||"inspector"!==e&&"sticker"!==e||!a.current.push({...c,time:performance.now()}))return!1;let d="sticker"===e?"inspector":"sticker";return l.current={from:e,to:d},o(d),"sticker"===d?i(c):n(),r({type:"SET_TOOL",payload:d}),!0},[e,n,r,t,i,o]),pendingShakeToolTransitionRef:l}}({activeTool:i.activeTool,isAnnotating:i.isAnnotating,clearStickerPreview:tn,dispatch:o,setStickerCursor:bt,startCursorSwitchPulse:kt});(0,Wa.useLayoutEffect)(()=>{let e=Yt.current,t=i.styleModifications;Yt.current=t,e!==t&&Wt.current&&(Jt(),function(e,t,n){e&&(Rh(e),oo(t),io(n))}(Wt.current,e,t),Wt.current=null,Vt.current=null,Xt.current=null,_t(e=>e+1))},[i.styleModifications,Jt]),(0,Wa.useLayoutEffect)(()=>{Ch(i.activeTool,i.isAnnotating)&&(tn(),Kt.current=null,Qt.current=null)},[tn,i.activeTool,i.isAnnotating]);let sn=(0,Wa.useCallback)(()=>{gt("family"),bt(null),Ft(null)},[]);(0,Wa.useLayoutEffect)(()=>{let e=Ot.current,t=i.activeTool,n=rn.current,r=n?.from===e&&n.to===t;rn.current=null,Ot.current=t;let o=function(e,t,n,r){return e===t?{preservedAway:r,shouldReset:!1}:n&&("sticker"===e&&"inspector"===t||"inspector"===e&&"sticker"===t)?{preservedAway:"inspector"===t,shouldReset:!1}:{preservedAway:!1,shouldReset:r||"sticker"===e||"sticker"===t}}(e,t,r,$t.current);$t.current=o.preservedAway,o.shouldReset&&sn()},[rn,sn,i.activeTool]),(0,Wa.useLayoutEffect)(()=>{i.isAnnotating||($t.current=!1,sn())},[sn,i.isAnnotating]);let un=(0,Wa.useCallback)((e,t)=>{if(tn(),!Ge)return null;let n=window.getComputedStyle(Ge);return function(e,t,n="all"){let r=Xs(e,n);if("color"===e||("text"===e||"border"===e)&&Os(r)){let e=function(e,t){let n=ms(t);return n?ss.reduce((t,r)=>{let i=ms(hs[e][t]),o=ms(hs[e][r]),a=i.reduce((e,t,r)=>e+(t-n[r])**2,0);return o.reduce((e,t,r)=>e+(t-n[r])**2,0)<a?r:t}):null}(r,t[0]??"");if(null===e)return null;let n=ps(r,e);return t.every(e=>gs(e,n))?e:null}if("text"===e){if("line-height"===r&&"normal"===(t[0]??"").trim().toLowerCase())return"normal";if("line-height"===r){let n=nu(t[0]??"",e),r=nu(t[1]??"",e);return null===n||null===r||0===r?null:gu(Es,e=>fu[e],n/r)}if("letter-spacing"===r){let n=(t[0]??"").trim().toLowerCase();if("normal"===n)return"normal";let r=nu(n,e),i=nu(t[1]??"",e);return null===r||null===i||0===i?null:gu(Ts,e=>mu[e],r/i)}return ru(e,r,t[0]??"")}if("transform"===e||"opacity"===e||"stack"===e&&"gap"!==r)return ru(e,r,t[0]??"");if("grid"===e&&"gap"!==r){let e=t[0]?.trim().split(/\\s+/).filter(Boolean).length??0;return qs("grid",r).includes(e)?e:null}let i=t.map(t=>nu(t,e));if(0===i.length||i.some(e=>null===e))return null;let o=i[0];if(!i.every(e=>Math.abs(e-o)<.01))return null;let a=qs(e,r).filter(e=>"number"==typeof e);return 0===a.length?null:a.reduce((t,n)=>Math.abs(Number.parseFloat(su(e,n,r))-o)<Math.abs(Number.parseFloat(su(e,t,r))-o)?n:t)}(e,tu(e,t).map(e=>n.getPropertyValue(e)),t)},[tn,Ge]),cn=(0,Wa.useCallback)(e=>(tn(),Ge?function(e){let t=ms(e);if(!t)return null;let n=null;for(let e of ls)for(let r of ss){let i=ms(hs[e][r]).reduce((e,n,r)=>e+(n-t[r])**2,0);(!n||i<n.distance)&&(n={name:e,step:r,distance:i})}return n&&{name:n.name,step:n.step}}(window.getComputedStyle(Ge).getPropertyValue(e)):null),[tn,Ge]);Dp({active:"sticker"===i.activeTool&&i.isAnnotating,family:ot,step:st,subproperty:pt,stage:mt,query:Dt,setFamily:at,setStep:ht,setSubproperty:ft,setStage:gt,setQuery:Ft,setCursor:bt,setContextLabelPulse:At,setDepthSnapPulse:jt,setRejectPulse:zt,lastCursorRef:Qe,toolbarRef:z,previewRef:Wt,applyStickerRef:Ht,readColor:cn,readStep:un});let[pn,mn]=(0,Wa.useState)(null),[gn,yn]=(0,Wa.useState)(null),[vn,xn]=(0,Wa.useState)(null),[Sn,kn]=(0,Wa.useState)(!1),Cn=(0,Wa.useRef)({isDragging:!1,side:null,startX:0,startY:0,original:{top:0,right:0,bottom:0,left:0},element:null,elementInfo:null,selector:null,durableSelector:null}),jn=(0,Wa.useRef)({isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}),[In,zn]=(0,Wa.useState)(null),[$n,Hn]=(0,Wa.useState)(null),[Bn,Vn]=(0,Wa.useState)(null),[qn,Un]=(0,Wa.useState)(null),Yn=(0,Wa.useRef)({x:0,y:0}),[Xn,Kn]=(0,Wa.useState)({x:0,y:0}),Gn=(0,Wa.useRef)({isDragging:!1,hasMoved:!1,axis:null,startX:0,startY:0,originalRow:0,originalColumn:0,element:null,elementInfo:null,selector:null,durableSelector:null,isAuto:!1,originalJustifyContent:"",visualGap:0}),[Jn,er]=(0,Wa.useState)(null),[tr,nr]=(0,Wa.useState)(null),[rr,ir]=(0,Wa.useState)(null),[or,ar]=(0,Wa.useState)(!1),[lr,sr]=(0,Wa.useState)(0),{swipeHint:ur,clearSwipeHint:cr}=function({enabled:e,dispatch:t,handCursorRef:n,setGapRefreshKey:r}){let[i,o]=(0,Ip.useState)(null),a=(0,Ip.useCallback)(()=>o(null),[]);return(0,Ip.useEffect)(()=>{let i=null,a=!1,l=null,s=null,u=null,c=null,d=0,h=(e,t)=>{let n=Wn(e,t);for(;n&&n!==document.documentElement;){let e=window.getComputedStyle(n).display;if("flex"===e||"inline-flex"===e)return n;n=n.parentElement}return null},p=e=>{let t=window.getComputedStyle(e).flexDirection;return"column"===t||"column-reverse"===t?"vertical":"horizontal"},f=e=>{let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),{selector:`[data-pm="${t}"]`,durableSelector:Mn(e)}},m=(e,t,n)=>{let r=h(t,n);o(r?{modifier:e,target:r}:null)},g=()=>{u=null,c=null,d=0,l=null,s=null,o(null)},y=t=>{if(!e)return;let r=n.current;"Shift"!==t.key||t.altKey?"Alt"===t.key&&!t.shiftKey&&m("alt",r.x,r.y):m("shift",r.x,r.y)},v=n=>{if(!e)return;let o=n.shiftKey&&!n.altKey,y=n.altKey&&!n.shiftKey;if(!o&&!y||0!==n.buttons)return void g();if(null===l&&(l=n.clientX,s=n.clientY,m(o?"shift":"alt",n.clientX,n.clientY)),a)return;null===u&&(u=n.clientX,c=n.clientY,d=0);let v=n.clientX-u,x=n.clientY-c,b=Math.abs(v)>=Math.abs(x)?v:x;if(Math.abs(b)>3){let e=b>0?1:-1;if(0!==d&&e!==d)return u=n.clientX,c=n.clientY,void(d=0);d=e}if(Math.abs(v)<20&&Math.abs(x)<20)return;let w=h(l,s);if(!w)return;let S=Math.abs(v)>=Math.abs(x)?"horizontal":"vertical",k=("horizontal"===S?v:x)>0?1:-1;u=null,c=null,d=0,o?((e,n,i)=>{let o=p(e);if(n===o){let n=window.getComputedStyle(e).justifyContent,r="normal"===n||"flex-start"===n||"start"===n?"flex-start":"flex-end"===n||"end"===n?"flex-end":"center"===n?"center":null;if(!r)return;let o=zp.indexOf(r)+i;if(o<0||o>=zp.length)return;let a=zp[o],{selector:l,durableSelector:s}=f(e);to(e,"justify-content",a),t({type:"MODIFY_STYLES_BATCH",payload:{selector:l,durableSelector:s,element:On(e),changes:[{property:"justify-content",original:n,modified:a}]}})}else{let n=window.getComputedStyle(e).flexDirection,r="horizontal"===o?"column":"row",{selector:i,durableSelector:a}=f(e);to(e,"flex-direction",r),t({type:"MODIFY_STYLES_BATCH",payload:{selector:i,durableSelector:a,element:On(e),changes:[{property:"flex-direction",original:n,modified:r}]}})}r(e=>e+1)})(w,S,k):((e,n,i)=>{if(n!==("horizontal"===p(e)?"vertical":"horizontal"))return;let o=window.getComputedStyle(e).alignItems,a="normal"===o||"stretch"===o||"flex-start"===o||"start"===o?"flex-start":"flex-end"===o||"end"===o?"flex-end":"center"===o?"center":null;if(!a)return;let l=Lp.indexOf(a)+i;if(l<0||l>=Lp.length)return;let s=Lp[l],{selector:u,durableSelector:c}=f(e);to(e,"align-items",s),t({type:"MODIFY_STYLES_BATCH",payload:{selector:u,durableSelector:c,element:On(e),changes:[{property:"align-items",original:o,modified:s}]}}),r(e=>e+1)})(w,S,k),a=!0,i&&clearTimeout(i),i=setTimeout(()=>{a=!1,i=null},300)},x=e=>{("Shift"===e.key||"Alt"===e.key)&&g()};return window.addEventListener("keydown",y),window.addEventListener("mousemove",v),window.addEventListener("mousedown",g),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",y),window.removeEventListener("mousemove",v),window.removeEventListener("mousedown",g),window.removeEventListener("keyup",x),i&&clearTimeout(i)}},[t,e,n,r]),{swipeHint:i,clearSwipeHint:a}}({enabled:"hand"===i.activeTool&&i.isAnnotating,dispatch:o,handCursorRef:Yn,setGapRefreshKey:sr}),dr=(0,Wa.useRef)({isDragging:!1,corner:null,startY:0,original:{"top-left":0,"top-right":0,"bottom-right":0,"bottom-left":0},maxRadius:0,element:null,elementInfo:null,selector:null,durableSelector:null}),[hr,pr]=(0,Wa.useState)(null),[fr,mr]=(0,Wa.useState)(null),[gr,yr]=(0,Wa.useState)(null),vr=(0,Wa.useRef)({isDragging:!1,property:null,startX:0,startY:0,originalFontSize:0,originalLineHeight:0,originalRatio:1.2,element:null,elementInfo:null,selector:null,durableSelector:null}),[xr,br]=(0,Wa.useState)(null),[wr,Sr]=(0,Wa.useState)(null),[kr,Cr]=(0,Wa.useState)(null),{modifiersRef:Mr,shiftOnly:Er}=function(){let e=(0,El.useRef)({shift:!1,cmd:!1}),[t,n]=(0,El.useState)(!1);return(0,El.useEffect)(()=>{let t=t=>{let r=t.metaKey||t.ctrlKey;e.current={shift:t.shiftKey,cmd:r},n(t.shiftKey&&!r&&!t.altKey)},r=()=>{e.current={shift:!1,cmd:!1},n(!1)};return window.addEventListener("keydown",t,!0),window.addEventListener("keyup",t,!0),window.addEventListener("pointerover",t,!0),window.addEventListener("blur",r),()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("pointerover",t,!0),window.removeEventListener("blur",r)}},[]),{modifiersRef:e,shiftOnly:t}}(),Tr=(0,Wa.useRef)(f);Tr.current=f;let Ar=(0,Wa.useCallback)(e=>{let t=Tr.current;if(!t||0===t.size)return!1;for(let n of t.keys())try{if(xt(e,n))return!0}catch{}return!1},[]),{applySticker:Rr,beginSteerGapDrag:jr,beginSteerRadiusDrag:Ir,beginSteerSpacingDrag:zr,beginSteerTransformDrag:Lr,steerDrag:Pr,steerDragRef:Nr}=function({applyStickerRef:e,clearStickerPreview:t,dispatch:n,hoveredElement:r,lastCanvasCursorRef:i,setHoveredElement:o,setHoveredElementInfo:a,setStickerApplyPulse:l,setStickerCursor:s,setStickerRejectPulse:u,setStickerStep:c,setStickerSubproperty:d,stickerFamily:h,stickerStep:p,stickerSubproperty:f,transformDragHandoffRef:m,transformPreviewSuppressionRef:g,transformPreviewTargetRef:y}){let v=function(){let[e,t]=(0,Op.useState)(null),n=(0,Op.useRef)(e);n.current=e;let r=(0,Op.useRef)(null),i=(0,Op.useCallback)(e=>{let t=e.requestPointerLock;if("function"==typeof t){r.current=e;try{let n=t.call(e);n&&n.catch(()=>{r.current===e&&(r.current=null)})}catch{r.current=null}}},[]),o=(0,Op.useCallback)((e,r)=>{n.current=e,t(e),i(r)},[i]),a=(0,Op.useCallback)(e=>{n.current=e,t(e)},[]),l=(0,Op.useCallback)(()=>{n.current=null,t(null)},[]),s=(0,Op.useCallback)(()=>{let e=r.current;r.current=null,e&&document.pointerLockElement===e&&document.exitPointerLock()},[]);return{drag:e,dragRef:n,pointerLockElementRef:r,startDrag:o,replaceDrag:a,clearDrag:l,releasePointerLock:s}}(),{drag:x,dragRef:b,startDrag:w}=v,S=(0,Fp.useCallback)((e,r)=>{if(!e.isConnected||Li(e))return u(e=>e+1),!1;t();let i=r?.family??h,o=r?.step??p,a=r?.subproperty??f;if(!Vd(e,i,a))return u(e=>e+1),!1;let s="transform"===i&&"translate"===a&&r?.axisSteps?function(e,t,n){let r=e.ownerDocument.defaultView.getComputedStyle(e),i="translate",o=`${4*Number(t)}px ${4*Number(n)}px`,a={family:"transform",subproperty:"translate",step:t,axisSteps:{x:t,y:n}};return{alreadyApplied:r.getPropertyValue(i).trim()===o,changes:[{property:i,original:r.getPropertyValue(i).trim()||"none",modified:o,token:`translate-x-${t}-y-${n}`,sticker:a}]}}(e,r.axisSteps.x,r.axisSteps.y):function(e,t,n,r){let i=e.ownerDocument.defaultView.getComputedStyle(e),o=eu(t,r),a=su(t,n,r),l=du(t),s=uu(t,r,n),u="border"===t&&!$s(t,r)&&"number"==typeof n&&n>0?ou(r):null,c={family:t,subproperty:Xs(t,r),step:n},d=[{property:o,original:i.getPropertyValue(o).trim()||"0px",modified:a,token:lu(t,n,r),sticker:c}];l&&d.unshift({property:"display",original:i.getPropertyValue("display").trim()||"block",modified:l,token:l,sticker:c});for(let e of s)d.push({property:e.property,original:i.getPropertyValue(e.property).trim(),modified:e.value,token:e.token,sticker:c});if(u){let e=i.getPropertyValue(u).trim();(!e||"none"===e)&&d.push({property:u,original:e||"none",modified:"solid",token:lu(t,n,r),sticker:c})}return{alreadyApplied:iu(t,n,r,e=>i.getPropertyValue(e)),changes:d}}(e,i,o,a);if(s.alreadyApplied)return u(e=>e+1),!1;let c=jd(e),d=Mn(e);return function(e,t){for(let n of t.changes)to(e,n.property,n.modified)}(e,s),n({type:"MODIFY_STYLES_BATCH",payload:{selector:c,durableSelector:d,element:{...On(e),selector:d},changes:s.changes}}),l(e=>e+1),!0},[t,n,l,u,h,p,f]);e.current=S;let k=(0,Fp.useCallback)((e,n,i)=>{if(!(r instanceof HTMLElement))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId),t();let o="margin"===e?ki(r):Si(r),a="left"===n||"right"===n?"x":"y",l=wu(n,i.altKey||i.ctrlKey),s="margin"===e,u="top"===n||"left"===n?s?-1:1:s?1:-1,h=xu(e,l,o[n]);d(l),c(h),w({element:r,family:e,subproperty:l,startX:i.clientX,startY:i.clientY,startPixels:o[n],deltaX:0,deltaY:0,direction:u,axis:a,step:h,hasMoved:!1,side:n,cursor:{x:i.clientX,y:i.clientY}},i.currentTarget)},[t,r,c,d,w]),C=(0,Fp.useCallback)((e,n)=>{if(!(r instanceof HTMLElement)||"stack"!==h&&"grid"!==h)return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=xi(r),o="row"===e?i.row:i.column,a=xu(h,"gap",o);d("gap"),c(a),w({element:r,family:h,subproperty:"gap",startX:n.clientX,startY:n.clientY,startPixels:o,deltaX:0,deltaY:0,direction:1,axis:"row"===e?"y":"x",step:a,hasMoved:!1,gapAxis:e,cursor:{x:n.clientX,y:n.clientY}},n.currentTarget)},[t,r,c,d,w,h]),M=(0,Fp.useCallback)((e,n)=>{if(!(r instanceof HTMLElement))return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),t();let i=Su(e,n.altKey||n.ctrlKey),o=Mi(r)[e],a=xu("radius",i,o);d(i),c(a),w({element:r,family:"radius",subproperty:i,startX:n.clientX,startY:n.clientY,startPixels:o,deltaX:0,deltaY:0,vector:ku(e),step:a,hasMoved:!1,corner:e,cursor:{x:n.clientX,y:n.clientY}},n.currentTarget)},[t,r,c,d,w]),E=(0,Fp.useCallback)((e,n,i,o)=>{if(!Tt(r))return;i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);let a=window.getComputedStyle(r).getPropertyValue(e).trim(),l="translate"===e?hn(a):void 0,s="scale"===e?100*(Number.parseFloat(a)||1):"translate"===e?l.x:Number.parseFloat(a)||0,u=bu(e,s),h=Ut(r),p=qt(r,h),f="scale"===e&&n?function(e,t){let n=on(e);return dn({x:e[t].x-n.x,y:e[t].y-n.y})}(p,n):"rotate"===e?function(e,t){let n=on(e),{handle:r}=an(e,28,t),i=dn({x:r.x-n.x,y:r.y-n.y});return{x:-i.y,y:i.x}}(p,o??ln(p,20).side):void 0,y=l?{x:bu("translate",l.x),y:bu("translate",l.y)}:void 0;g.current=null,m.current=null,t(),d(e),c(u),w({element:r,family:"transform",subproperty:e,startX:i.clientX,startY:i.clientY,startPixels:s,deltaX:0,deltaY:0,direction:1,vector:f,step:u,hasMoved:!1,transformKind:e,transformCorner:n??void 0,startTranslate:l,translateSteps:y,translateValue:l?`${l.x}px ${l.y}px`:void 0,ghostQuad:p,cursor:{x:i.clientX,y:i.clientY}},i.currentTarget)},[t,r,c,d,w,m,g]);return $p(v,{onSelectionChange:(0,Fp.useCallback)((e,t)=>{d(e),c(t)},[c,d]),onCursorChange:(0,Fp.useCallback)(e=>{i.current=e,s(e)},[i,s]),onCommit:(0,Fp.useCallback)((t,n,r)=>{e.current(t.element,{family:t.family,step:t.step,subproperty:n,axisSteps:t.translateSteps}),"transform"===t.family&&(g.current={element:t.element,subproperty:t.subproperty,step:t.step},m.current={element:t.element,releasePoint:r},y.current=null,o(t.element),a(On(t.element)))},[e,o,a,m,g,y]),onCancel:(0,Fp.useCallback)(()=>{t(),g.current=null,m.current=null},[t,m,g])}),{applySticker:S,beginSteerGapDrag:C,beginSteerRadiusDrag:M,beginSteerSpacingDrag:k,beginSteerTransformDrag:E,steerDrag:x,steerDragRef:b}}({applyStickerRef:Ht,clearStickerPreview:tn,dispatch:o,hoveredElement:Ge,lastCanvasCursorRef:Qe,setHoveredElement:Je,setHoveredElementInfo:tt,setStickerApplyPulse:Mt,setStickerCursor:bt,setStickerRejectPulse:zt,setStickerStep:ht,setStickerSubproperty:ft,stickerFamily:ot,stickerStep:st,stickerSubproperty:pt,transformDragHandoffRef:Qt,transformPreviewSuppressionRef:Kt,transformPreviewTargetRef:Xt});(0,Wa.useEffect)(()=>{Pt(!1);let e="transform"===Pr?.family?Pr.element:Ge;if(Ch(i.activeTool,i.isAnnotating)||"value"!==mt||!Vd(e,ot,pt)||Li(e))return Xt.current=null,void tn();let t={element:e,family:ot,step:st,subproperty:pt,valueOverride:"translate"===Pr?.transformKind?Pr.translateValue:void 0},n=Kt.current,r="transform"===ot&&n?.element===e&&n.subproperty===pt&&n.step===st;if(n&&!r&&(Kt.current=null),r){if(tn(),Xt.current?.element!==e){let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=Ut(e);Xt.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:qt(e,o)},_t(e=>e+1)}return}if(Wt.current&&function(e,t){return e?.element===t.element&&e.family===t.family&&e.step===t.step&&e.subproperty===t.subproperty&&e.valueOverride===t.valueOverride}(Vt.current,t))return;if("transform"===ot){if(Xt.current?.element!==e){Rh(Wt.current),Wt.current=null,Vt.current=null;let{top:t,right:n,bottom:r,left:i}=e.getBoundingClientRect(),o=Ut(e);Xt.current={element:e,bounds:{top:t,right:n,bottom:r,left:i},layoutQuad:o,renderedQuad:qt(e,o)}}}else Xt.current=null;let o=function(e,t,n,r,i=null,o,a){i&&i.element!==e&&(Rh(i),i=null);let l=a&&"transform"!==t?{bounds:i?.focus?.bounds??lt(e),origin:i?.focus?.origin??a,point:a}:null,s=window.getComputedStyle(e),u=eu(t,r),c=o?s.getPropertyValue(u).trim()===o:iu(t,n,r,e=>s.getPropertyValue(e)),d=du(t),h=uu(t,r,n),p="border"===t&&!$s(t,r)&&"number"==typeof n&&n>0?ou(r):null,f=[u,...d?["display"]:[],...h.map(e=>e.property),...p?[p]:[]],m=[...new Set(f)],g=new Set([...m,"transition"]),y=new Map(i?.declarations.map(e=>[e.property,e])??[]);for(let t of y.values())g.has(t.property)||Th(e,t);let v=[...g].map(t=>y.get(t)??Ah(e,t)),x=m.filter(e=>!Mh.has(e));(function(e,t){Qi.set(e,new Set(t))})(e,function(e){let t=new Set(e);for(let n of e){if("padding"===n||n.startsWith("padding-")){t.add("padding");for(let e of["top","right","bottom","left"])t.add(`padding-${e}`)}if("margin"===n||n.startsWith("margin-")){t.add("margin");for(let e of["top","right","bottom","left"])t.add(`margin-${e}`)}if("border-radius"===n||/border-.+-radius/.test(n)){t.add("border-radius");for(let e of["top-left","top-right","bottom-right","bottom-left"])t.add(`border-${e}-radius`)}if("border-width"===n||/border-.+-width/.test(n)){t.add("border-width");for(let e of["top","right","bottom","left"])t.add(`border-${e}-width`)}if("border-color"===n||/border-.+-color/.test(n)){t.add("border-color");for(let e of["top","right","bottom","left"])t.add(`border-${e}-color`)}("gap"===n||"row-gap"===n||"column-gap"===n)&&(t.add("gap"),t.add("row-gap"),t.add("column-gap"))}return t}(m)),x.length>0&&to(e,"transition",x.map(e=>`${e} 100ms ease-out`).join(", ")),d&&to(e,"display",d);for(let t of h)to(e,t.property,t.value);if(to(e,u,o??su(t,n,r)),p){let t=window.getComputedStyle(e).getPropertyValue(p).trim();(!t||"none"===t)&&to(e,p,"solid")}return{preview:{element:e,focus:l,declarations:v,activeDeclarations:[...g].map(t=>Ah(e,t))},stepUnavailable:c}}(e,ot,st,pt,Wt.current,t.valueOverride,Qe.current);Wt.current=o.preview,Vt.current=t,Pt(o.stepUnavailable),_t(e=>e+1),en()},[tn,Ge,i.activeTool,i.isAnnotating,Pr?.element,Pr?.family,Pr?.transformKind,Pr?.translateValue,ot,mt,st,pt,en]),(0,Wa.useEffect)(()=>()=>{Jt(),Rh(Wt.current),Wt.current=null,Vt.current=null,Xt.current=null,Kt.current=null,Qt.current=null},[Jt]);let Dr=(0,Wa.useCallback)(()=>{tn(),Xt.current=null,Kt.current=null,Qt.current=null,Je(null),tt(null),zn(null),Hn(null),Vn(null),er(null),nr(null),ar(!1),pr(null),mr(null),br(null),Sr(null),cr()},[tn,cr]),Wr=(0,Wa.useMemo)(()=>function(e,t){let n=t?.domEdit?null:t,r=new Set;for(let t of e)(t.status?"pending"===t.status:!t.captured)&&!t.threadId&&!t.replyCount||(r.add(t.id),t.groupId&&r.add(t.groupId));let i=({id:e,groupId:t})=>!(r.has(e)||t&&r.has(t));return!(!n?.text.trim()||!i(n))||e.some(e=>"text"===e.type&&e.id!==n?.id&&!!e.text?.trim()&&i(e))}(i.annotations,Pe),[i.annotations,Pe]),Br=!!b&&Wr;(0,Wa.useEffect)(()=>{$?.(O?Wr:Br)},[$,Br,O,Wr]);let Vr=!(!Pe||Pe.domEdit),qr=Vr?Pe?.id:null,Ur=qe?`${qe.target.adapter}:${qe.target.key}`:null,Yr=qr??Ur;(0,Wa.useEffect)(()=>{Yr&&Dr()},[Yr,Dr]);let Xr=(0,Wa.useCallback)(e=>{mn(e),e&&Dr()},[Dr]),Kr=(0,Wa.useCallback)(e=>{yn(e),e&&Dr()},[Dr]),Qr=(0,Wa.useCallback)((e,t)=>{xn(t?.length?{ownerId:e,annotationIds:t}:null),t?.length&&Dr()},[Dr]),Zr=(0,Wa.useCallback)(e=>{kn(e),e&&Dr()},[Dr]),Gr=(0,Wa.useCallback)((e,t)=>{tn();let n=An(e);Vd(n,t.family,t.subproperty)&&(o({type:"SELECT_ANNOTATION",payload:{id:null}}),o({type:"SET_TOOL",payload:"sticker"}),at(t.family),ft(t.subproperty),ht(t.step),gt("value"),Je(n),tt(On(n)),Qe.current&&bt(Qe.current))},[tn,o]),Jr=(0,Wa.useCallback)((e,t)=>{tn(),Dr(),yn(null),o({type:"CLEAR_STICKER",payload:{selector:e,sticker:t}})},[Dr,tn,o]),ni=(0,Wa.useCallback)(e=>{if(!w)return;w(e);let t=0,n=()=>{let e=z?.current?.getRootNode()?.querySelector("[data-popmelt-reply]");if(e)return e.focus(),void e.setSelectionRange(e.value.length,e.value.length);t+=1,t<6&&requestAnimationFrame(n)};requestAnimationFrame(n)},[w,z]),ui=(0,Wa.useRef)(i);ui.current=i;let mi=Ml({annotations:i.annotations,currentPathname:oe,dispatch:o,stateRef:ui,styleModifications:i.styleModifications,subjectRegistry:N,toolbarRef:z,onTargetResolutionChange:ie}),gi=(0,Wa.useRef)(Pe);gi.current=Pe;let yi=(0,Wa.useRef)(Pe);(0,Wa.useEffect)(()=>{let e=!1,t=t=>{if(e=2===t.button&&t.composedPath().some(e=>e instanceof Element&&e.hasAttribute("data-popmelt-shadow-host")),yi.current=null,2!==t.button||e)return;let n=gi.current;yi.current=nh(n)?n:null},n=t=>{e&&2===t.button&&t.composedPath()[0]===Z.current&&(t.preventDefault(),t.stopPropagation()),e=!1};return window.addEventListener("pointerdown",t,!0),window.addEventListener("contextmenu",n,!0),()=>{window.removeEventListener("pointerdown",t,!0),window.removeEventListener("contextmenu",n,!0)}},[Z]);let{cursorPosRef:vi,inputRef:wi,lastPositionedTextId:Ci}=function({activeText:e,activeTextRef:t,canvasRef:n,visible:r}){let i=(0,Ep.useContext)(oi),o=(0,Ep.useRef)(null),a=(0,Ep.useRef)(null),l=(0,Ep.useRef)(null),s=e?.id??null,u=e?.initialCaret??(e?.isNew&&""===e.text?0:void 0);return(0,Ep.useLayoutEffect)(()=>{if(!r||!i||void 0===u||!s||a.current===s)return;let e=o.current;e&&(e.focus({preventScroll:!0}),e.setSelectionRange(u,u),a.current=s)},[s,u,r,i]),(0,Ep.useEffect)(()=>{if(!i)return;if(!s)return a.current=null,void(l.current=null);if(!r||!o.current)return void(a.current=null);let e=requestAnimationFrame(()=>{let e=o.current;if(!e||(e.focus(),a.current===s))return;a.current=s;let r=t.current;if(r){if(r.domEdit)return void e.setSelectionRange(r.initialCaret??0,r.initialCaret??e.value.length);if(null!==l.current){let t=Math.min(l.current,e.value.length);return void e.setSelectionRange(t,t)}if(!r.isNew&&r.clickPoint){let t=n.current?.getContext("2d");if(!t)return;t.font=`${r.fontSize}px ${ci}`;let i=function({text:e,fontSize:t,point:n,clickPoint:r,context:i}){let o=e.split("\\n"),a=t*si,l=Math.max(0,Math.min(o.length-1,Math.floor((r.y-n.y)/a))),s=o[l]??"",u=r.x-n.x,c=s.length;for(let e=0;e<=s.length;e+=1){let t=i.measureText(s.slice(0,e)).width;if(t<=u)continue;let n=e>0?i.measureText(s.slice(0,e-1)).width:0;c=Math.max(0,u-n<t-u?e-1:e);break}let d=c;for(let e=0;e<l;e+=1)d+=(o[e]?.length??0)+1;return d}({text:r.text,fontSize:r.fontSize,point:r.point,clickPoint:r.clickPoint,context:t});e.setSelectionRange(i,i)}}});return()=>cancelAnimationFrame(e)},[s,t,n,r,i]),{cursorPosRef:l,inputRef:o,lastPositionedTextId:a}}({activeText:Pe,activeTextRef:gi,canvasRef:Z,visible:i.isAnnotating});!function(e,t,n){let r=(0,Mp.useContext)(oi),i=e?.domEdit?.textNode,o=e?.domEdit?.targetElement;(0,Mp.useEffect)(()=>{if(!r||!i)return;let e=null,a=()=>{n.current&&o?.isConnected&&i.isConnected&&ct(o.ownerDocument)&&function(e,t){let n=Yl.get(e);if(!n?.isConnected)return!1;let{left:r,top:i,width:o,height:a}=lt(n);return t.style.left=r+"px",t.style.top=i+"px",t.style.width=o+"px",t.style.height=a+"px",!0}(o,n.current)||t(e=>{if(!e?.domEdit)return e;let{textNode:t,targetElement:n,segments:r,singleTextNode:i,rect:o,boundaryRect:a,boundaryRects:l,flowRect:s,firstLineIndent:u}=e.domEdit;if(!t.isConnected||!n.isConnected||!ct(n.ownerDocument))return null;let c=ut(n).getComputedStyle(n),d=$i(r,n,c,i),{textRect:h,boundaryRect:p,boundaryRects:f,flowRect:m,firstLineIndent:g}=d;if(Wi(o,h)&&Wi(a,p)&&function(e,t){return e.length===t.length&&e.every((e,n)=>Wi(e,t[n]))}(l,f)&&function(e,t){return e&&t?Wi(e,t):e===t}(s,m)&&Math.abs(u-g)<.5)return e;let y=Td(n),v=(parseFloat(c.fontSize)||12)*y,x=e=>e?.endsWith("px")?parseFloat(e)*y+"px":e;return{...e,fontSize:v,point:{x:h.left+window.scrollX,y:h.top+window.scrollY},domEdit:{...e.domEdit,wrapsText:i?f.length>1:e.domEdit.wrapsText,rect:h,boundaryRect:p,boundaryRects:f,flowRect:m,firstLineIndent:g,lineHeight:"normal"===c.lineHeight?1.2*v+"px":x(c.lineHeight),letterSpacing:x(c.letterSpacing),wordSpacing:x(c.wordSpacing)}}}),e=window.requestAnimationFrame(a)};return e=window.requestAnimationFrame(a),()=>{null!==e&&window.cancelAnimationFrame(e)}},[r,i,t,n,o])}(Pe,De,wi);let Ei=(0,Wa.useCallback)(()=>{window.requestAnimationFrame(()=>{wi.current?.focus();let e=wi.current?.value.length??0;wi.current?.setSelectionRange(e,e)})},[wi]),Ti=(0,Wa.useCallback)((e,t=yi.current)=>{let n=gi.current,r=N?.hitTest(e)??null,i=r?.element??Wn(e.x,e.y,{allowBodyFallback:!0}),o=r?.target,a=[...ui.current.annotations].reverse().find(e=>"text"===e.type&&"pending"===(e.status??"pending")&&(o&&e.target?e.target.adapter===o.adapter&&e.target.key===o.key:!(!e.linkedSelector||!i||!Qa(e.linkedSelector,e.elements)?.contains(i)))),l=function(e){let t=e.activationDraft??e.activeDraft;if(nh(t))return{kind:"draft",value:t};let n=function(e,t,n){let r=[...n?[n]:[],...[...t].reverse()],i=new Set,o=[];for(let t of r){if(i.has(t))continue;i.add(t);let n=e.find(e=>e.id===t);n&&(o.push(n),n.groupId&&o.push(...e.filter(e=>e.id!==n.id&&e.groupId===n.groupId)))}return o}(e.annotations,e.selectedAnnotationIds,e.lastSelectedId).find(rh);return n?{kind:"annotation",value:n}:rh(e.annotationAtCursor)?{kind:"annotation",value:e.annotationAtCursor}:null}({activationDraft:t,activeDraft:n,annotations:ui.current.annotations,selectedAnnotationIds:ui.current.selectedAnnotationIds,lastSelectedId:ui.current.lastSelectedId,annotationAtCursor:a});if(yi.current=null,!l||"inspector"!==ui.current.activeTool)return!1;let s=l.value;me.current?.cancel();let u=s.target&&N?N.resolve(s.target):null,c=u?.subject.sourceElement??(s.linkedSelector?An(s.linkedSelector):null);return ge.current={id:s.id,draft:"draft"===l.kind},me.current=function(e){let t=e.now??(()=>Date.now()),n=t(),r=[],i=null,o=0,a=!1,l=e.captureFrame?.().catch(()=>null)??Promise.resolve(null),s=[],u=null,c=()=>{if(window.clearTimeout(o),o=0,!i)return;let n=t(),a=i.captureResult?.()??Zd(i.targetElement),u="input"===i.kind||"change"===i.kind||"submit"===i.kind||"scroll"===i.kind||"play"===i.kind||"pause"===i.kind||"seek"===i.kind,c={id:i.id,action:{kind:i.kind,label:i.label,...i.key?{key:i.key}:{},...i.target?{target:i.target}:{}},startedAt:i.startedAt,completedAt:n,outcome:u||i.changes.length>0||eh(i.target,a)?"changed":"no-observable-change",changes:i.changes,...a?{result:a}:{}};if(i=null,r.length<50&&(r.push(c),e.onStep?.(c),e.captureFrame)){let t=l,n=e.captureFrame().catch(()=>null);l=n,s.push(Promise.all([t,n]).then(([e,t])=>({step:c,before:e,after:t})))}},d=()=>{window.clearTimeout(o),o=window.setTimeout(c,180)},h=(o,a,l)=>{let{element:s,state:u}=a,h="input"===i?.kind&&"input"===o&&i.targetElement===s,p="click"===i?.kind&&("input"===o||"change"===o||"play"===o||"pause"===o||"seek"===o)&&i.targetElement===s;h||p||(c(),i={id:`episode-step-${n}-${r.length+1}`,kind:o,label:Jd(o,s,u),...l?{key:l}:{},targetElement:s,target:u,captureResult:a.captureResult,startedAt:t(),changes:[]},e.onActionCountChange?.(r.length+1)),d()},p=new MutationObserver(e=>{if(i&&!a){for(let t of e){if(i.changes.length>=16)break;let e=(e,t)=>{if(!i||i.changes.length>=16)return;let n=Zd(th(t));!n||i.changes.some(t=>t.kind===e&&t.element.selector===n.selector&&t.element.tagName===n.tagName&&t.element.text===n.text)||i.changes.push({kind:e,element:n})};t.addedNodes.forEach(t=>e("added",t)),t.removedNodes.forEach(t=>e("removed",t)),("attributes"===t.type||"characterData"===t.type)&&e("updated",t.target)}d()}});return p.observe(document.documentElement,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["aria-expanded","aria-pressed","aria-selected","checked","class","disabled","hidden","open","poster","src","value"]}),{recordEvent(t){if(a)return;if("pointerdown"===t.type||"pointerup"===t.type){let n=t;if("pointerdown"===t.type&&0===n.button){let r=e.resolveEventTarget?.(t),i=r?.element??(t.target instanceof Element&&!Li(t.target)?t.target:null),o=r?.state??Zd(i);if(!o)return;return void(u={x:n.clientX,y:n.clientY,targetElement:i,target:o,captureResult:r?.captureResult})}if("pointerup"===t.type){let e=u;return u=null,void(e?.targetElement&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>4&&h("drag",{element:e.targetElement,state:e.target,captureResult:e.captureResult}))}}let n=function(e){return"click"===e.type?"click":"input"===e.type?"input":"change"===e.type?"change":"submit"===e.type?"submit":"keydown"===e.type?"keydown":"play"===e.type?"play":"pause"===e.type?"pause":"seeked"===e.type?"seek":null}(t);if(!n||t instanceof KeyboardEvent&&!function(e){return!(e.metaKey||e.ctrlKey||e.altKey)&&["Enter"," ","Escape","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)}(t))return;let r=e.resolveEventTarget?.(t),i=r?.element??(t.target instanceof Element&&!Li(t.target)?t.target:null);if(!i)return;let o=r?.state??Zd(i);o&&h(n,{element:i,state:o,captureResult:r?.captureResult},t instanceof KeyboardEvent?t.key:void 0)},recordScroll(){if(!a){if("scroll"===i?.kind)return void d();h("scroll",{element:null,state:{tagName:"document",text:"page"}})}},hasActions:()=>null!==i||r.length>0,async finish(){a||c(),a=!0,p.disconnect(),window.clearTimeout(o);let i={version:1,startedAt:n,completedAt:t(),subject:e.subjectState??Zd(e.subjectElement),steps:[...r]};if(0===r.length||0===s.length)return{episode:i,frames:[]};let l=await Promise.all(s),u=[],d=new Map,h=[],f=async e=>{if(!e)return;let t=await async function(e){let t=new Uint8Array(await e.arrayBuffer()),n=2166136261;for(let e of t)n^=e,n=Math.imul(n,16777619);return`${e.size.toString(36)}-${(n>>>0).toString(36)}`}(e),r=d.get(t);if(r)return r;let i=`episode-frame-${n}-${u.length+1}`;return d.set(t,i),h.push({id:i,imageIndex:u.length,fingerprint:t}),u.push(e),i};for(let e of l){let t=await f(e.before),n=await f(e.after);(t||n)&&(e.step.visuals={...t?{beforeFrameId:t}:{},...n?{afterFrameId:n}:{}})}return h.length>0&&(i.frames=h),{episode:i,frames:u}},cancel(){a=!0,i=null,u=null,p.disconnect(),window.clearTimeout(o)}}}({subjectElement:c,...u?{subjectState:Gd(u)}:{},resolveEventTarget:e=>{if(!(e instanceof MouseEvent&&N))return;let t=N.hitTest({x:e.clientX,y:e.clientY});if(!t)return;let n=t.target;return{element:t.subject.sourceElement??null,state:Gd(t),captureResult:()=>{let e=N.resolve(n);return e?Gd(e):void 0}}},onActionCountChange:Se,captureFrame:x?Me:void 0}),Dr(),We(null),mn(null),yn(null),Se(0),Ce(e),xe(!0),Le(),!0},[Dr,Me,Le,x,N]),Ri=(0,Wa.useCallback)(async()=>{let e=me.current,t=ge.current;if(!e||!t||!e.hasActions())return;let{episode:n,frames:r}=await e.finish();if(me.current=null,t.draft)De(e=>{if(e?.id!==t.id)return e;let i=e.images?.length??0;return{...e,images:[...e.images??[],...r],interactionEpisode:Yd(n,i)}});else{let e=ui.current.annotations.find(e=>e.id===t.id);if(e){let t=e.imageCount??0,i=Yd(n,t);r.length>0&&y?.(e.id,r),o({type:"UPDATE_TEXT",payload:{id:e.id,text:e.text??"",imageCount:t+r.length,interactionEpisode:i}})}}ze(),t.draft&&Ei()},[o,ze,Ei,y,De]),ji=(0,Wa.useCallback)(e=>{let t=gi.current;if(t?.id===e&&(De(t=>{if(t?.id!==e)return t;let n=new Set(t.interactionEpisode?.frames?.map(e=>e.imageIndex)??[]),r={...t};return delete r.interactionEpisode,n.size>0&&t.images&&(r.images=t.images.filter((e,t)=>!n.has(t))),r}),t.isNew))return;let n=ui.current.annotations.find(t=>t.id===e)?.interactionEpisode?.frames?.map(e=>e.imageIndex)??[];n.length>0&&v?.(e,n),o({type:"CLEAR_INTERACTION_EPISODE",payload:{id:e}})},[o,v,De]),Ii=(0,Wa.useCallback)(()=>{let e=ge.current?.draft;ze(),e&&Ei()},[ze,Ei]);(0,Wa.useEffect)(()=>{let e=e=>{if(!he.current)return;let t=e.metaKey||e.ctrlKey;if("Escape"===e.key&&t)return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),void(me.current?Ii():ze());"Enter"===e.key&&t&&me.current&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),Ri())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[Ii,ze,Ri]),(0,Wa.useEffect)(()=>{if(!ye)return;let e=e=>me.current?.recordEvent(e),t=()=>me.current?.recordScroll();return window.addEventListener("click",e,!0),window.addEventListener("pointerdown",e,!0),window.addEventListener("pointerup",e,!0),window.addEventListener("input",e,!0),window.addEventListener("change",e,!0),window.addEventListener("submit",e,!0),window.addEventListener("keydown",e,!0),window.addEventListener("play",e,!0),window.addEventListener("pause",e,!0),window.addEventListener("seeked",e,!0),window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("click",e,!0),window.removeEventListener("pointerdown",e,!0),window.removeEventListener("pointerup",e,!0),window.removeEventListener("input",e,!0),window.removeEventListener("change",e,!0),window.removeEventListener("submit",e,!0),window.removeEventListener("keydown",e,!0),window.removeEventListener("play",e,!0),window.removeEventListener("pause",e,!0),window.removeEventListener("seeked",e,!0),window.removeEventListener("scroll",t,!0)}},[ye]);let zi=(0,Wa.useRef)([]);(0,Wa.useRef)(a).current=a;let{dragState:Pi,resizeState:Ni,setDragState:_i,setResizeState:Di}=function(){let[e,t]=(0,kd.useState)(null),[n,r]=(0,kd.useState)(null);return{dragState:e,resizeState:n,setDragState:t,setResizeState:r}}(),Fi=i.selectedAnnotationIds;zi.current=Fi;let Oi=(0,Wa.useCallback)((e,t=!1)=>{o({type:"SELECT_ANNOTATION",payload:{id:e,addToSelection:t}})},[o]),Hi=(0,Wa.useCallback)(()=>{o({type:"SELECT_ANNOTATION",payload:{id:null}})},[o]),Bi=(0,Wa.useCallback)(e=>{let t=ui.current.annotations.find(t=>t.id===e);!t||!uo(t,ui.current.annotations)||(o({type:"DELETE_ANNOTATION",payload:{id:e}}),gi.current?.id===e&&($e(gi.current.attachments),De(null)),Dr(),mn(null),yn(null),xn(null),kn(!1),Hi())},[Dr,Hi,o,$e,De]),qi=(0,Wa.useCallback)(e=>{let t=function(e,t,n){let r=e.filter(e=>!(e.captured||e.selector!==t||e.pathname&&e.pathname!==n));return r.length?{type:"MODIFY_TEXT_CONTENTS",payload:r.map(e=>({...e,modified:e.original}))}:null}(ui.current.textModifications,e,oe);t&&(o(t),Dr(),yn(null),xn(null),kn(!1))},[oe,o,Dr]),Ui=(0,Wa.useRef)({x:window.scrollX,y:window.scrollY}),Yi=(0,Wa.useRef)(null),[Xi,Ki]=(0,Wa.useState)(Ui.current);(0,Wa.useLayoutEffect)(()=>{if(Y)return Q(),window.addEventListener("resize",Q),window.visualViewport?.addEventListener("resize",Q),()=>{window.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("resize",Q)}},[Q,Y]),function({state:e,stateRef:t,activeTextRef:n,selectedIdsRef:r,dispatch:i,clearSelection:o,selectAnnotation:a,handHoveredElement:l,onArchiveThread:s,openThreadId:u,currentPathname:c,hasOpenThread:d}){let h=(0,Nh.useRef)([]),p=(0,Nh.useRef)(0),f=(0,Nh.useRef)(null);(0,Nh.useEffect)(()=>{let m=m=>{if("Escape"===m.key){if(m.defaultPrevented||m.repeat||n.current||d||Gh(m))return;if(r.current.length>0)return m.preventDefault(),void o();let e=t.current;if(e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured))return m.preventDefault(),void i({type:"DISCARD_DRAFT"})}if((m.metaKey||m.ctrlKey)&&"c"===m.key.toLowerCase()&&"hand"===e.activeTool&&l&&!n.current){if(Rd(l)){m.preventDefault();let e=jd(l);f.current={source:l,sourceSelector:e,sourceDurableSelector:Mn(l),sourceElement:{...On(l),selector:e}}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key.toLowerCase()&&"hand"===e.activeTool&&f.current&&!n.current){let e=f.current,t=l&&Rd(l)?l:e.source,n=t.parentElement;if(n){m.preventDefault();let r=Mn(n),o=jd(n),a=Mn(t),l=jd(t),s=Id(t)+1,u=e.source.cloneNode(!0);if(u instanceof Element){zd(u),Pd(n,u,s);let t=jd(u),d=Mn(u),h={...On(u),selector:t};i({type:"MODIFY_DOM_STRUCTURE",payload:{id:Hh(),operation:"copy",selector:t,durableSelector:d,element:h,sourceSelector:e.sourceSelector,sourceDurableSelector:e.sourceDurableSelector,sourceElement:e.sourceElement,targetParentSelector:o,targetParentDurableSelector:r,targetIndex:s,referenceSelector:l,referenceDurableSelector:a,placement:"after",pathname:c}})}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key&&h.current.length>0&&!n.current){m.preventDefault(),p.current+=1;let e=20*p.current,t=h.current[0]?.groupId?Math.random().toString(36).substring(2,9):void 0,n=h.current.map(n=>({...n,id:Math.random().toString(36).substring(2,9),groupId:n.groupId?t:void 0,timestamp:Date.now(),points:n.points.map(t=>({x:t.x+e,y:t.y+e}))}));i({type:"PASTE_ANNOTATIONS",payload:{annotations:n}});let r=n.find(e=>"text"!==e.type)??n[0];return void(r&&a(r.id))}let g=r.current;if(!(n.current||Gh(m)||"Delete"!==m.key&&"Backspace"!==m.key||m.metaKey||m.ctrlKey||m.altKey)){if(0===g.length&&!u)return;let e=Jh(t.current.annotations,g,u);if(!s||0===e.length)return;m.preventDefault();for(let t of e)s(t);o()}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,o,c,i,l,d,s,u,a,r,e.activeTool,t])}({state:i,stateRef:ui,activeTextRef:gi,selectedIdsRef:zi,dispatch:o,clearSelection:Hi,selectAnnotation:Oi,handHoveredElement:In,onArchiveThread:k,openThreadId:R,currentPathname:oe,hasOpenThread:j});let{pageAnnotations:Zi,pageStyleModifications:Gi,pageTextModifications:Ji,pendingBundleCount:eo,pendingTextAnnotations:no}=function({state:e,activeText:t,currentPathname:n,dismissedThreadIds:r,modifiedElementThreadStates:i}){let o=(0,Tl.useMemo)(()=>Al(e.annotations,n,r),[e.annotations,n,r]),a=(0,Tl.useMemo)(()=>Rl(e.styleModifications,e.annotations,n,r,i),[e.annotations,e.styleModifications,n,r,i]),l=(0,Tl.useMemo)(()=>Rl(e.textModifications,e.annotations,n,r,i),[e.annotations,e.textModifications,n,r,i]),s=(0,Tl.useMemo)(()=>{let t=new Set,r=e=>!(e.captured||e.pathname&&e.pathname!==n);for(let n of e.styleModifications)r(n)&&!n.awaitingReview&&t.add(`element:${n.selector}`);for(let n of e.textModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.domModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.spacingTokenChanges)n.captured||t.add(`spacing:${n.tokenPath}`);for(let n of e.spacingTokenMods)n.captured||t.add(`spacing:${n.tokenPath}`);return t},[n,e.domModifications,e.spacingTokenChanges,e.spacingTokenMods,e.styleModifications,e.textModifications]),u=(0,Tl.useMemo)(()=>function(e,t,n=[]){let r=new Set(e.filter(e=>"pending"===(e.status??"pending")).map(e=>`annotation:${e.groupId||e.id}`));t?.isNew&&!t.domEdit&&(t.text.trim()||t.interactionEpisode?.steps.length)&&r.add(`annotation:${t.groupId||t.id}`);for(let e of n)r.add(`edit:${e}`);return r.size}(e.annotations,t,s),[e.annotations,t,s]);return{pageAnnotations:o,pageStyleModifications:a,pageTextModifications:l,pendingBundleCount:u,pendingTextAnnotations:(0,Tl.useMemo)(()=>e.annotations.filter(e=>"text"===e.type&&e.text&&"pending"===(e.status??"pending")).sort((e,t)=>t.timestamp-e.timestamp),[e.annotations])}}({state:i,activeText:Pe,currentPathname:oe,dismissedThreadIds:g,modifiedElementThreadStates:m}),{sendHintAnchorId:ro,setSendHintAnchorId:ao}=function({activeText:e,activeTextAnchorId:t,hoveredElement:n,hoveredTextId:r,pendingTextAnnotations:i}){let[o,a]=(0,Il.useState)(null);return(0,Il.useEffect)(()=>{e&&!e.domEdit&&e.text.trim()?a(t):a(e=>e&&i.some(t=>t.id===e)?e:i[0]?.id??null)},[e,t,i]),(0,Il.useEffect)(()=>{if(!r)return;let e=i.find(e=>e.id===r);e&&a(e.id)},[r,i]),(0,Il.useEffect)(()=>{if(!n)return;let e=i.find(e=>{if(!e.linkedSelector)return!1;try{return xt(n,e.linkedSelector)}catch{return!1}});e&&a(e.id)},[n,i]),{sendHintAnchorId:o,setSendHintAnchorId:a}}({activeText:Pe,activeTextAnchorId:qp,hoveredElement:Ge,hoveredTextId:He,pendingTextAnnotations:no}),{locationLabels:lo,tooltipAnnotationId:so,revealAnnotation:co}=function({annotations:e,annotationIds:t,badgeHoveredAnnotationId:n,hoveredTextId:r}){let i=(0,jl.useMemo)(()=>{let n=new Map;for(let r of e){if(!t.has(r.id))continue;let e=Nn(r.elements);e&&n.set(r.id,e)}return n},[e,t]),o=[n,r].find(e=>e&&i.has(e))??null,[a,l]=(0,jl.useState)(null);(0,jl.useEffect)(()=>{if(l(null),!o)return;let e=window.setTimeout(()=>{l(o)},500);return()=>window.clearTimeout(e)},[o]);let s=(0,jl.useCallback)(async e=>{let t=await async function(e,t){let n=function(e,t){return Rn(e)??Rn(t?.[0]?.selector)}(e,t);if(_n(n))return n;let r=Pn(t)??(n?Ln(n):void 0);if(!r)return null;for(let e of r.steps){let t=Rn(e.triggerSelector);if(!(t instanceof HTMLElement))return null;if(!Dn(0,t,Rn(e.targetSelector))&&(t.click(),!await Fn(e.targetSelector)))return null}return Fn(e&&Rn(e)?e:t?.[0]?.selector)}(e.linkedSelector,e.elements);if(!t)return;let n=lt(t);(n.bottom<0||n.top>window.innerHeight)&&t.scrollIntoView({behavior:"smooth",block:"center"})},[]);return{locationLabels:i,tooltipAnnotationId:a,revealAnnotation:s}}({annotations:Zi,annotationIds:mi,badgeHoveredAnnotationId:pn,hoveredTextId:He}),ho=(0,Wa.useCallback)((e,t)=>{let n=ui.current.annotations.find(t=>t.id===e);n&&(Oi(e),t&&ni(t),mi.has(e)&&co(n))},[ni,mi,co,Oi]),{cycleSpotlightAnnotationIds:fo,emphasizedAnnotationIds:mo,hoverRestoredAnnotationIds:go,inactiveEmphasisOpacity:yo,statusSpotlightAnnotationIds:vo}=function({annotations:e,isCreatingAnnotation:t,hoveredTextId:n,badgeHoveredAnnotationId:r,highlightedAnnotationIds:i,cycleFocusedAnnotationIds:o,hoveredElement:a}){let l=(0,Ya.useMemo)(()=>{let n=e.filter(e=>"pending"===(e.status??"pending"));if(0===n.length&&!t)return null;let r=new Set(n.map(e=>e.id)),i=new Set(n.flatMap(e=>e.groupId?[e.groupId]:[])),o=new Set(n.flatMap(e=>e.threadId?[e.threadId]:[]));for(let t of e)(t.groupId&&i.has(t.groupId)||t.threadId&&o.has(t.threadId))&&r.add(t.id);return r},[e,t]),s=(0,Ya.useMemo)(()=>{let t=new Set;if(n&&t.add(n),r&&t.add(r),i?.forEach(e=>t.add(e)),a)for(let n of e)if(n.linkedSelector)try{xt(a,n.linkedSelector)&&t.add(n.id)}catch{}return Ja(e,t)},[e,n,r,i,a]),u=(0,Ya.useMemo)(()=>i?Ja(e,i):null,[e,i]),c=(0,Ya.useMemo)(()=>o?Ja(e,o):null,[e,o]);return{cycleSpotlightAnnotationIds:c,emphasizedAnnotationIds:u??c??l,hoverRestoredAnnotationIds:s,inactiveEmphasisOpacity:u||c?.2:.5,statusSpotlightAnnotationIds:u}}({annotations:Zi,isCreatingAnnotation:!(!Pe?.isNew||Pe.domEdit),hoveredTextId:He,badgeHoveredAnnotationId:pn,highlightedAnnotationIds:M,cycleFocusedAnnotationIds:E,hoveredElement:Ge}),xo=function(e){let t=e?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(Y?z?.current:null),bo=xo.avoidTop,ko=xo.avoidBottom,Co=xo.avoidLeft,Mo=xo.avoidRight,Eo=(0,Wa.useMemo)(()=>({avoidTop:bo,avoidBottom:ko,avoidLeft:Co,avoidRight:Mo}),[bo,ko,Co,Mo]),Ao=function(e,t){return(0,zl.useMemo)(()=>[...(e.canvasSamples??[]).filter(e=>e.pathname===t),...e.domModifications.flatMap(e=>e.sampledTree&&!e.captured&&e.pathname&&e.pathname===t?[{selector:e.selector,pathname:e.pathname,elementTag:e.element.tagName}]:[])],[e.canvasSamples,e.domModifications,t])}(i,oe),{supersededAnnotations:Ro,stagedArtifactOrder:Io,annotationGroupMap:zo,pageModificationNumberBySelector:No}=function({state:e,pageSampleTargets:t,pageAnnotations:n,pageStyleModifications:r,pageTextModifications:i}){let o=(0,zl.useMemo)(()=>function(e){let t=new Set,n=new Map;for(let t of e){if(!t.linkedSelector)continue;let e=n.get(t.linkedSelector)||[];e.push(t),n.set(t.linkedSelector,e)}let r=new Set,i=new Set;for(let e of n.values()){if(e.length<=1){e[0]?.groupId&&i.add(e[0].groupId);continue}e.sort((e,t)=>t.timestamp-e.timestamp);let n=e[0];n.groupId&&i.add(n.groupId);for(let n=1;n<e.length;n++){let i=e[n];t.add(i),i.groupId&&r.add(i.groupId)}}for(let n of e)n.groupId&&r.has(n.groupId)&&!i.has(n.groupId)&&t.add(n);return t}(e.annotations),[e.annotations]),a=(0,zl.useMemo)(()=>function({annotations:e,sampleTargets:t,styleModifications:n,textModifications:r}){let i=new Map,o=0,a=new Map;for(let t of e)t.groupId&&t.linkedSelector&&a.set(t.groupId,{selector:t.linkedSelector,pathname:t.pathname});for(let t of e){let e=t.groupId?a.get(t.groupId):t.linkedSelector?{selector:t.linkedSelector,pathname:t.pathname}:void 0,n=e?Nl(e.pathname,e.selector):`annotation:${t.groupId??t.id}`,r=i.get(n);r?(r.createdAt=Math.min(r.createdAt,t.timestamp),r.annotationIds.push(t.id)):i.set(n,{key:n,createdAt:t.timestamp,stableIndex:o++,annotationIds:[t.id]})}let l=e=>{let t=Pl(e),n=`element:${t}`,r=e.createdAt??Ll,a=i.get(n);if(a)return a.createdAt=Math.min(a.createdAt,r),void(a.modificationKey=t);i.set(n,{key:n,createdAt:r,stableIndex:o++,annotationIds:[],modificationKey:t})};n.forEach(l),r.forEach(l),t?.forEach(l);let s=new Map,u=new Map,c=[...i.values()].sort((e,t)=>e.createdAt-t.createdAt||e.stableIndex-t.stableIndex);return c.forEach((e,t)=>{let n=t+1;e.annotationIds.forEach(e=>s.set(e,n)),e.modificationKey&&u.set(e.modificationKey,n)}),{annotationNumberById:s,modificationNumberByKey:u,count:c.length}}({annotations:n.filter(e=>!o.has(e)),sampleTargets:t,styleModifications:r,textModifications:i}),[n,t,r,i,o]),l=(0,zl.useMemo)(()=>{let e=new Map,n=t=>{let n=a.modificationNumberByKey.get(Pl(t));if(void 0===n)return;let r=e.get(t.selector);(void 0===r||n<r)&&e.set(t.selector,n)};return r.forEach(n),i.forEach(n),t?.forEach(n),e},[t,r,i,a.modificationNumberByKey]);return{supersededAnnotations:o,stagedArtifactOrder:a,annotationGroupMap:a.annotationNumberById,pageModificationNumberBySelector:l}}({state:i,pageSampleTargets:Ao,pageAnnotations:Zi,pageStyleModifications:Gi,pageTextModifications:Ji}),Oo=Zn(Ge),$o=!(!qe||Oo?.adapter!==qe.target.adapter||Oo.key!==qe.target.key),Ho=Pe?.linkedSelector&&!Pe.domEdit?Pe:Be,Wo=Ho?.linkedSelector?Qa(Ho.linkedSelector,Ho.elements):null,Vo=!!(Ge&&Ho&&bl(Wo,Ge,Ho.elements?.[0]?.context)),qo=!(!t||!Y||e||Pe||"inspector"!==i.activeTool&&"sticker"!==i.activeTool),Uo=qo&&Er&&!$o?Ge:null,Yo=(0,Wa.useCallback)(e=>function(e,t,n,r){try{let i=function(e,t,n,r){let i=fn(t.location.pathname);if(!e.isConnected||fn(e.ownerDocument.location.pathname)!==i)throw new Error("The preview changed. Select the element again.");let o=n?.sampleableObject(e);if(o){let{projection:e,surface:n,objects:i}=o,a=i.read(n.read(),e.target.key);if(null===a)throw new Error("This object cannot be sampled by its renderer.");if(a.length>65536)throw new Error("This object is too large to place.");if(!r?.sampleableCanvases(t.documentElement,!0).some(e=>e.format===n.format&&e.objects?.placement&&(e.objects.placement.canPlace?.(a)??!0)))throw new Error("This object needs a matching scene object on your plane.");return{kind:"object",label:e.subject.label,format:n.format,value:a}}if(Zn(e))throw new Error("This scene object needs a unique identity before it can be sampled.");return{kind:"element",label:e.localName,tree:_r(e)}}(e,t,n,r),o={pathname:fn(t.location.pathname),id:crypto.randomUUID()};return{sample:"object"===i.kind?{...i,...o}:{...i,...o,sourceSelector:Tn(e)},reason:null}}catch(e){return{sample:null,reason:e instanceof Error?e.message:"This element cannot be sampled."}}}(e,document,N,N),[N]),Ko=(0,Wa.useCallback)(e=>Yo(e).reason,[Yo]),{reason:Qo,recheck:Zo}=function(e,t){let[n,r]=(0,Or.useState)(null),i=(0,Or.useCallback)(()=>{r(e?t(e):null)},[e,t]);return(0,Or.useLayoutEffect)(()=>{if(i(),!e)return;let t=new MutationObserver(i);return t.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["src","srcset","sizes"]}),e.ownerDocument.addEventListener("popmelt-sample-ready",i),e.addEventListener("load",i,!0),e.addEventListener("error",i,!0),()=>{t.disconnect(),e.ownerDocument.removeEventListener("popmelt-sample-ready",i),e.removeEventListener("load",i,!0),e.removeEventListener("error",i,!0)}},[e,i]),{reason:n,recheck:i}}(Uo,Ko),Go=Qo?125:100,Jo=function(e){let[t,n]=(0,Fr.useState)(null);return(0,Fr.useEffect)(()=>{if(n(null),!e)return;let t=window.setTimeout(()=>n(e),1e3);return()=>window.clearTimeout(t)},[e]),!(!e||e!==t)}(Y&&!e?Ge:null),ea=!Jo||!!Uo,ta=!(!Ge||!et||$o||!Uo&&(He||pn||Vo)),{hiddenCollidingAnnotationIds:na,nestedCollidingAnnotationCountById:aa,nestedCollidingAnnotationIdsById:la,visibleCollisionRepresentativeByAnnotationId:sa}=function({activeText:e,activeTextSendHintId:t,annotationNumberById:n,badgeHoveredAnnotationId:r,canvasRef:i,focusedThreadAnnotationId:o,hoveredElement:a,hoveredElementInfo:l,sampleActionWidth:s=0,compactHoverIdentifier:u=!1,hoveredTextId:c,showHoverElementIdentifier:d,layoutReady:h,layoutRevision:p,pageAnnotations:f,parentPinnedAnnotationIds:m,pendingLinkedText:g,scroll:y,supersededAnnotations:v,textSafeBounds:x}){let b=(0,tl.useRef)(new Map);return(0,tl.useMemo)(()=>{let p=new Set,w=new Map,S=new Map,k=new Map,C=()=>({hiddenCollidingAnnotationIds:p,nestedCollidingAnnotationCountById:w,nestedCollidingAnnotationIdsById:S,visibleCollisionRepresentativeByAnnotationId:k});if(!h)return C();let M=i.current?.getContext("2d");if(!M)return C();let E=(e,t,n,r,i)=>{M.font=`${r}px ${ci}`;let o=(n||"Type here...").replace(/\\n/g," "),a=void 0!==i?`${i}. ${o}`:o,l={x:t.x-y.x,y:t.y-y.y},s=m.has(e)?16:0,u=Math.max(60,di(l.x)-s),c=hi(M,a,u),d=M.measureText(c).width,h=fi(l,r,x,s+d+16);return{left:h.x-8,top:h.y-4,right:h.x+s+d+8,bottom:h.y+r*si+4}},T=new Set,A=f.flatMap(e=>{if("text"!==e.type||!e.text||!e.points[0]||!e.linkedSelector||v.has(e))return[];let t=e.elements?.[0]?.selector,r=b.current.get(e.id),i=r?.selector===e.linkedSelector&&r.fallbackSelector===t&&r.element.isConnected,o=i?r.element:Qa(e.linkedSelector,e.elements);if(!o)return[];let a=i?r.depth:function(e){let t=0,n=vt(e);for(;n;)t+=1,n=vt(n);return t}(o);return b.current.set(e.id,{selector:e.linkedSelector,fallbackSelector:t,element:o,depth:a}),T.add(e.id),[{id:e.id,annotation:e,element:o,bounds:E(e.id,e.points[0],e.text,e.fontSize||12,n.get(e.id)),depth:a}]});for(let e of b.current.keys())T.has(e)||b.current.delete(e);if(0===A.length)return C();let R=A.map((e,t)=>t),j=e=>{let t=e;for(;R[t]!==t;)t=R[t];for(;R[e]!==e;){let n=R[e];R[e]=t,e=n}return t},I=(e,t)=>{let n=j(e),r=j(t);n!==r&&(R[r]=n)};for(let e=0;e<A.length;e+=1)for(let t=e+1;t<A.length;t+=1){let n=A[e],r=A[t];Ka(n.element,r.element)&&Xa(n.bounds,r.bounds)&&I(e,t)}let z=new Map;A.forEach((e,t)=>{let n=j(t),r=z.get(n)??[];r.push(e),z.set(n,r)});for(let e of z.values())for(let t of e){let n=new Set,r=e.flatMap(e=>e.id===t.id||e.element===t.element||!t.element.contains(e.element)||n.has(e.element)?[]:(n.add(e.element),[e.id]));r.length>0&&(w.set(t.id,r.length),S.set(t.id,r))}let L=e?.linkedSelector?{id:e.id,element:Qa(e.linkedSelector,e.elements),bounds:E(e.id,e.point,e.text,e.fontSize,n.get(e.id))}:g?.linkedSelector?{id:t,element:Qa(g.linkedSelector,g.elements),bounds:E(t,g.point,"",12)}:null,P=null;if(a&&d){let e=lt(a),t=22,n=e.height>=window.innerHeight,r=n?e.top+8:e.top>=t+2?e.top-t-2:e.bottom+2,i=n?e.left+8:e.left,o=l?ia(l,u):a.tagName.toLowerCase();M.font=`12px ${ci}`;let c=Math.min(400,ra(o,e=>M.measureText(e).width)+oa(o)+8);P={left:i,top:r,right:i+c+s,bottom:r+t}}let N=(e,t)=>{e.forEach(e=>{e.id!==t&&p.add(e.id),t&&k.set(e.id,t)})};for(let e of z.values()){if(L?.element&&e.some(e=>Ka(L.element,e.element)&&Xa(L.bounds,e.bounds))){let t=new Set,n=e.flatMap(e=>e.element===L.element||!L.element.contains(e.element)||t.has(e.element)?[]:(t.add(e.element),[e.id]));n.length>0&&(w.set(L.id,n.length),S.set(L.id,n)),N(e,e.find(e=>e.id===L.id)?.id);continue}let t=[c,r].find(t=>t&&e.some(e=>e.id===t)),n=e.find(e=>e.id===t);if(n){N(e,n.id);continue}if(a){let t=e.find(e=>e.element===a);if(t){N(e,t.id);continue}if(P&&e.some(e=>!al(e.annotation)&&!ol(e.annotation)&&"awaiting_review"!==e.annotation.status&&Ka(a,e.element)&&Xa(P,e.bounds))){N(e);continue}}let i=[o].find(t=>t&&e.some(e=>e.id===t));if(i)N(e,i);else if(e.length>1){let t=e.reduce((e,t)=>t.depth<e.depth||t.depth===e.depth&&(t.bounds.top<e.bounds.top||t.bounds.top===e.bounds.top&&t.annotation.timestamp<e.annotation.timestamp)?t:e);N(e,t.id)}}return C()},[e,t,n,r,i,o,a,l,s,u,c,d,h,f,m,g,y.x,y.y,v,x,p])}({activeText:Pe,activeTextSendHintId:qp,annotationNumberById:zo,badgeHoveredAnnotationId:pn,canvasRef:Z,focusedThreadAnnotationId:A,hoveredElement:Ge,hoveredElementInfo:et,hoveredTextId:He,layoutReady:Y&&null!==G,showHoverElementIdentifier:ta,compactHoverIdentifier:ea,sampleActionWidth:Uo?Go:0,layoutRevision:ee+ne,pageAnnotations:Zi,parentPinnedAnnotationIds:mi,pendingLinkedText:Be,scroll:Xi,supersededAnnotations:Ro,textSafeBounds:Eo}),{activeTextAnnotation:ua,activeTextCollisionId:ca,activeTextModifiedRail:da,activeTextNestedAnnotationCount:ha,activeTextNestedAnnotationIds:pa,activeTextNestedBadgeColor:fa,elementRailColorBySelector:ma,elementRailComments:ga,hiddenAnnotationBadgeIds:va,modifiedElementSendHintSelector:xa,stagedElementComments:ba,visibleCanvasAnnotations:wa,visibleSendHintAnchorId:ka}=function({resolveElement:e,projectedSelectors:t,activeText:n,activeColor:r,annotations:i,annotationNumberById:o,focusedThreadAnnotationId:a,hiddenCollidingAnnotationIds:l,modifiedElementThreadStates:s,nestedCollidingAnnotationCountById:u,nestedCollidingAnnotationIdsById:c,pageAnnotations:d,pageStyleModifications:h,pageTextModifications:p,sendHintAnchorId:f,supersededAnnotations:m,visibleCollisionRepresentativeByAnnotationId:g,activeTextSendHintId:y,targetResolutionRevision:v}){let x=(0,Tp.useCallback)((n,r)=>t?null:e?e(n,r):Qa(n,r),[v,e,t]),b=(0,Tp.useMemo)(()=>{let e=[],n=new Set,r=[...d].sort((e,t)=>t.timestamp-e.timestamp);for(let i of r){if("text"!==i.type||!i.text||!i.linkedSelector||m.has(i)||l.has(i.id))continue;let r=i.status??(i.captured?"in_flight":"pending");if(!["pending","sending","in_flight","awaiting_review"].includes(r))continue;let a=o.get(i.id);if(void 0===a||n.has(i.linkedSelector))continue;let s=x(i.linkedSelector,i.elements),u=i.elements?.[0];!s&&(!t?.has(i.linkedSelector)||!u)||(n.add(i.linkedSelector),e.push({id:i.id,selector:i.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:a,color:i.color,element:u??On(s),pending:"pending"===r,awaitingReview:"awaiting_review"===r,threadId:i.threadId,imageCount:i.imageCount??0,interactionEpisodeStepCount:i.interactionEpisode?.steps.length}))}return e},[o,l,d,m,x,t]),w=(0,Tp.useMemo)(()=>new Set(b.map(e=>e.id)),[b]),S=(0,Tp.useMemo)(()=>{let e=new Map;for(let t of d){if("text"!==t.type)continue;let n=jp(t,d);n&&e.set(t.id,n)}return e},[d]),k=(0,Tp.useMemo)(()=>{let e=[],n=new Set,r=[...d].sort((e,t)=>+(t.id===a)-+(e.id===a)||t.timestamp-e.timestamp);for(let i of r){let r=S.get(i.id);if(!r||!ol({...i,status:r.status,threadId:r.threadId,linkedSelector:r.linkedSelector})||!i.text||m.has(i)||l.has(i.id)||n.has(r.linkedSelector))continue;let a=o.get(i.id);if(void 0===a)continue;let s=x(r.linkedSelector,r.elements),u=r.elements?.[0];!s&&(!t?.has(r.linkedSelector)||!u)||(n.add(r.linkedSelector),e.push({id:i.id,selector:r.linkedSelector,text:i.text.replace(/\\n/g," "),annotationNumber:a,color:i.color,element:u??On(s),pending:!1,imageCount:i.imageCount??0,interactionEpisodeStepCount:i.interactionEpisode?.steps.length,threadState:{jobId:r.replyJobIds?.[r.replyJobIds.length-1]??r.threadId,threadId:r.threadId,targetBindingId:r.targetBindingId,annotationNumber:a,status:"waiting_input"===r.status?"waiting_input":"failed"===r.status?"failed":"resolved",label:"waiting_input"===r.status?"Question":"failed"===r.status?"Failed":"Replied"}}))}return e},[o,a,l,d,S,m,x,t]),C=(0,Tp.useMemo)(()=>[...b,...k],[k,b]),M=(0,Tp.useMemo)(()=>{let e=new Set,t=new Set,n=new Set,r=new Set;for(let[e,i]of s??[])if("matched"===bn(i.selectors??[e],i.targetFingerprint).status){t.add(i.threadId),i.targetBindingId&&n.add(i.targetBindingId);for(let e of i.selectors??[])r.add(e);!i.targetBindingId&&!i.selectors?.length&&r.add(e)}for(let i of d){let o=S.get(i.id),a=i.groupId?d.filter(e=>e.groupId===i.groupId):[i],s=a.map(Rp).find(e=>!!e),u=a.find(e=>e.threadId)?.threadId,c=a.find(e=>e.targetBindingId)?.targetBindingId;"text"===i.type&&i.text&&s&&!m.has(i)&&!l.has(i.id)&&(u&&t.has(u)||c&&n.has(c)||r.has(s)||o&&ol({...i,status:o.status,threadId:o.threadId,linkedSelector:o.linkedSelector})&&x(o.linkedSelector,o.elements))&&e.add(i.id)}return e},[l,s,d,S,m,x]),E=(0,Tp.useMemo)(()=>{let e=new Set;for(let t of d)al(t)&&t.linkedSelector&&!m.has(t)&&!l.has(t.id)&&x(t.linkedSelector,t.elements)&&e.add(t.id);return e},[l,d,m,x]),T=(0,Tp.useMemo)(()=>{let e=new Set(E);for(let t of w)e.add(t);for(let t of M)e.add(t);return e},[E,M,w]),A=(0,Tp.useMemo)(()=>new Map(C.map(e=>[e.selector,e.color])),[C]),R=(0,Tp.useMemo)(()=>new Set([...l,...T]),[T,l]),j=(0,Tp.useMemo)(()=>{if(!n?.linkedSelector||n.domEdit)return null;let e=x(n.linkedSelector,n.elements);if(!e)return null;let t=[...h,...p].find(t=>!t.captured&&Qa(t.selector,[t.element])===e),r=d.find(e=>e.id===n.id),i=!(n.isNew||!r||!al(r));return t||i?{element:e,selector:t?.selector??n.linkedSelector}:null},[n,d,h,p,x]),I=f===y?f:f?g.get(f)??f:null,z=(0,Tp.useMemo)(()=>{if(I===y)return n?.text.trim()?j?.selector??null:null;if(I&&I!==y)return b.find(e=>e.id===I)?.selector??null;for(let e=p.length-1;e>=0;e-=1){let t=p[e];if(t&&!t.captured)return t.selector}for(let e=h.length-1;e>=0;e-=1){let t=h[e];if(t&&!t.captured&&!t.awaitingReview)return t.selector}return null},[n,j,y,h,p,b,I]),L=n?n.isNew?y:n.id:null,P=L?u.get(L)??0:0,N=L?c.get(L)??[]:[],_=n?.isNew?void 0:i.find(e=>e.id===n?.id),D="pending"===(_?.status??(_?.captured?"in_flight":"pending"))?_?.color??r:"#8c8c8c",F=(0,Tp.useMemo)(()=>d.filter(e=>!(m.has(e)||l.has(e.id)||T.has(e.id)||n&&!n.isNew&&e.id===n.id)),[n,T,l,d,m]);return{activeTextAnnotation:_,activeTextCollisionId:L,activeTextModifiedRail:j,activeTextNestedAnnotationCount:P,activeTextNestedAnnotationIds:N,activeTextNestedBadgeColor:D,elementRailColorBySelector:A,elementRailCommentIds:T,elementRailComments:C,hiddenAnnotationBadgeIds:R,modifiedElementSendHintSelector:z,stagedElementComments:b,visibleCanvasAnnotations:F,visibleSendHintAnchorId:I}}({activeText:Pe,activeColor:i.activeColor,annotations:i.annotations,annotationNumberById:zo,focusedThreadAnnotationId:A,hiddenCollidingAnnotationIds:na,modifiedElementThreadStates:m,nestedCollidingAnnotationCountById:aa,nestedCollidingAnnotationIdsById:la,pageAnnotations:Zi,pageStyleModifications:Gi,pageTextModifications:Ji,sendHintAnchorId:ro,supersededAnnotations:Ro,visibleCollisionRepresentativeByAnnotationId:sa,activeTextSendHintId:qp,targetResolutionRevision:ee+ne}),Ca=(0,Wa.useMemo)(()=>{if(0===Fi.length)return null;let e=new Map;for(let t of Fi){let n=i.annotations.find(e=>e.id===t);if(!n)continue;let r=n.groupId?i.annotations.filter(e=>e.groupId===n.groupId):[n];for(let t of r)if(t.linkedSelector&&!f?.has(t.linkedSelector)){let n=t.color||i.activeColor;e.set(t.linkedSelector,n)}}return e.size>0?e:null},[Fi,i.annotations,i.activeColor,f]),Ma=(0,Wa.useCallback)((e=Ui.current)=>{let t=X.current;t&&(t.style.setProperty("--popmelt-painted-x",`${e.x}px`),t.style.setProperty("--popmelt-painted-y",`${e.y}px`)),K(wa,Fi,8,e.x,e.y,zo,vo,Eo,mo,go,yo,mi,c)},[c,wa,Fi,X,K,zo,vo,Eo,mo,go,yo,mi]),Ea=(0,Wa.useRef)(Ma);(0,Wa.useLayoutEffect)(()=>{Ea.current=Ma,Y&&Ma(Ui.current)},[Ma,Y]),(0,Wa.useLayoutEffect)(()=>{if(!Y)return;let e=()=>{let e={x:window.scrollX,y:window.scrollY};e.x===Ui.current.x&&e.y===Ui.current.y||(Ui.current=e,Ea.current(e),null===Yi.current&&(Yi.current=window.requestAnimationFrame(()=>{Yi.current=null;let e=Ui.current;Ki(t=>t.x===e.x&&t.y===e.y?t:e)})))};return e(),Ki(Ui.current),window.addEventListener("scroll",e,{passive:!0}),()=>{window.removeEventListener("scroll",e),null!==Yi.current&&(window.cancelAnimationFrame(Yi.current),Yi.current=null)}},[Y]);let{findAnnotationAtPoint:Ta,findHandleAtPoint:Ra,findTextAtPoint:ja,getPoint:Ia}=function({annotationGroupMap:e,annotations:t,canvasRef:n,handleSize:r,hiddenCollidingAnnotationIds:i,pageAnnotations:o,parentPinnedAnnotationIds:a,scroll:l,selectedAnnotationIds:s,supersededAnnotations:u,textSafeBounds:c}){let d=(0,ip.useCallback)(e=>function(e,t,n){if(!e)return{x:0,y:0};let r=t.touches?.[0],i=r?.clientX??t.clientX,o=r?.clientY??t.clientY;if(void 0===i||void 0===o)return{x:0,y:0};let a=e.getBoundingClientRect();return{x:i-a.left+n.x,y:o-a.top+n.y}}(n.current,e,{x:window.scrollX,y:window.scrollY}),[n]),h=(0,ip.useCallback)(t=>function({point:e,annotations:t,isHidden:n=()=>!1,textContainsPoint:r=()=>!1}){for(let i=t.length-1;i>=0;i-=1){let o=t[i];if(!o||n(o))continue;if("text"===o.type){if(r(o,e))return o;continue}if(o.points.length<2)continue;let a=o.points[0],l=o.points[o.points.length-1],s=(o.strokeWidth||3)+4;if("line"===o.type){if(op(e,a,l,s))return o;continue}if("freehand"===o.type){for(let t=0;t<o.points.length-1;t+=1)if(op(e,o.points[t],o.points[t+1],s))return o;continue}let u=Math.min(a.x,l.x),c=Math.max(a.x,l.x),d=Math.min(a.y,l.y),h=Math.max(a.y,l.y);if("rectangle"!==o.type){if("circle"===o.type){let t=(c-u)/2,n=(h-d)/2;if(0===t||0===n)continue;let r=Math.hypot((e.x-(u+c)/2)/t,(e.y-(d+h)/2)/n);if(Math.abs(r-1)*Math.max(t,n)<=s)return o}}else if(op(e,{x:u,y:d},{x:c,y:d},s)||op(e,{x:u,y:h},{x:c,y:h},s)||op(e,{x:u,y:d},{x:u,y:h},s)||op(e,{x:c,y:d},{x:c,y:h},s))return o}return null}({point:t,annotations:o,isHidden:e=>u.has(e)||i.has(e.id),textContainsPoint:(t,r)=>function({annotation:e,point:t,context:n,groupNumber:r,scroll:i,textSafeBounds:o,parentPinned:a}){let l=e.points[0];if(!(l&&e.text&&n&&po(e,i.x,i.y)))return!1;let s=e.fontSize||12;n.font=`${s}px ${ci}`;let u=e.text.replace(/\\n/g," "),c=void 0!==r?`${r}. ${u}`:u,d=l.x-i.x,h=a?16:0,p=hi(n,c,Math.max(60,di(d)-h)),f=n.measureText(p).width,m=s*si,g=fi({x:l.x-i.x,y:l.y-i.y},s,o,h+f+16),y=g.x+i.x,v=g.y+i.y;return t.x>=y-8-4&&t.x<=y+h+f+8+4&&t.y>=v-4-4&&t.y<=v+m+4+4}({annotation:t,point:r,context:n.current?.getContext("2d")??null,groupNumber:e.get(t.id),scroll:l,textSafeBounds:c,parentPinned:a.has(t.id)})}),[e,n,i,o,a,l,u,c]),p=(0,ip.useCallback)(e=>{let t=h(e);return"text"===t?.type?t:null},[h]),f=(0,ip.useCallback)(e=>function(e,t,n,r){if(0===t.length)return null;let i=r/2+4;for(let r of t){let t=n.find(e=>e.id===r);if(!t||t.points.length<2)continue;let o,a,l,s,u=t.points[0],c=t.points[t.points.length-1];if("line"===t.type){if(Math.hypot(e.x-u.x,e.y-u.y)<=i)return{handle:"start",annotationId:r};if(Math.hypot(e.x-c.x,e.y-c.y)<=i)return{handle:"end",annotationId:r};continue}"freehand"===t.type?(o=Math.min(...t.points.map(e=>e.x)),a=Math.max(...t.points.map(e=>e.x)),l=Math.min(...t.points.map(e=>e.y)),s=Math.max(...t.points.map(e=>e.y))):(o=Math.min(u.x,c.x),a=Math.max(u.x,c.x),l=Math.min(u.y,c.y),s=Math.max(u.y,c.y));let d="circle"===t.type?[{handle:"top",x:(o+a)/2,y:l},{handle:"bottom",x:(o+a)/2,y:s},{handle:"left",x:o,y:(l+s)/2},{handle:"right",x:a,y:(l+s)/2}]:"rectangle"===t.type||"freehand"===t.type?[{handle:"topLeft",x:o,y:l},{handle:"topRight",x:a,y:l},{handle:"bottomLeft",x:o,y:s},{handle:"bottomRight",x:a,y:s}]:[];for(let t of d)if(Math.hypot(e.x-t.x,e.y-t.y)<=i)return{handle:t.handle,annotationId:r}}return null}(e,s,t,r),[t,r,s]);return{findAnnotationAtPoint:h,findHandleAtPoint:f,findTextAtPoint:p,getPoint:d}}({annotationGroupMap:zo,annotations:i.annotations,canvasRef:Z,handleSize:8,hiddenCollidingAnnotationIds:na,pageAnnotations:Zi,parentPinnedAnnotationIds:mi,scroll:Xi,selectedAnnotationIds:Fi,supersededAnnotations:Ro,textSafeBounds:Eo}),{commitActiveText:za,createInlineTextEdit:La,enterDomTextEdit:Pa,editPendingLinkedComment:Na,finishActiveTextForTargetChange:_a,handleSendPendingBundle:Da}=Cp({activeText:Pe,activeTextRef:gi,canvasRef:Z,clearPageElementHover:Dr,clearSelection:Hi,clearSignal:P,commentTextEditCandidateRef:Ze,cursorPosRef:vi,dispatch:o,findTextAtPoint:ja,lastPositionedTextId:Ci,onAttachImages:y,onCloseThread:S,onSend:b,pendingLinkedText:Be,releaseActiveTextAttachments:$e,setActiveText:De,setDragState:_i,setHoveredTextId:We,setPendingLinkedText:Ve,setSendHintAnchorId:ao,state:i,stateRef:ui});(0,Wa.useLayoutEffect)(()=>{if(O)return O.current=za,()=>{O.current=null}},[O,za]);let Oa=(0,Wa.useCallback)(()=>{let e=yi.current;(function(e,t){return!(!t||e?.id!==t.id)})(gi.current,e)||za()},[za]),$a=(0,Wa.useCallback)((e,t)=>{let n=Wt.current;if(n?.focus)return jh(n,{x:e,y:t},Wn);let r=Qe.current,i=Xt.current?.element;return i?.isConnected&&r&&Math.hypot(e-r.x,t-r.y)<=2?i:Wn(e,t)},[]),Va=function({activeText:e,applySticker:t,steerTargetAt:n,canvasRef:r,clearSelection:i,commentTextEditCandidateRef:o,commitActiveText:a,createInlineTextEdit:l,dispatch:s,domDragRef:u,editPendingLinkedComment:c,finishActiveTextForTargetChange:d,findAnnotationAtPoint:h,findHandleAtPoint:p,findTextAtPoint:f,gapDragRef:m,gapHoveredAxis:g,gapHoveredElement:y,gapIsAuto:v,getPoint:x,handleAnnotationActivation:b,handDragRef:w,handHoveredElement:S,handHoveredSide:k,hoveredElement:C,hoveredElementInfo:M,isElementInFlight:E,onCanvasInteraction:T,openThreadAndFocusReply:A,pageAnnotations:R,modifiedElementThreadStates:j,pageStyleModifications:I,parentPinnedAnnotationIds:z,pointerTargetOverrideRef:L,radiusDragRef:P,radiusHoveredCorner:N,radiusHoveredElement:_,selectAnnotation:D,setDragState:F,setGapDragging:O,setHandDragging:$,setPendingLinkedText:H,setRadiusDragging:W,setResizeState:B,setStickerRejectPulse:V,setTextDragging:q,state:U,stickerStage:Y,textDragRef:X,textHoveredElement:K,textHoveredProperty:Q,toolbarRef:Z}){return(0,ep.useCallback)(G=>{if(!U.isAnnotating||!function(e){return!("button"in e)||0===e.button}(G))return;T?.();let J=L?.current??null;L&&(L.current=null);let ee=J?.element??C,te=J?.elementInfo??M,ne=x(G),re="shiftKey"in G&&G.shiftKey,ie="clientX"in G?{x:G.clientX,y:G.clientY}:"touches"in G&&G.touches[0]?{x:G.touches[0].clientX,y:G.touches[0].clientY}:null;if("sticker"===U.activeTool){if("button"in G&&0!==G.button||"value"!==Y)return;if(!ie)return void V(e=>e+1);let e=J?.element??n(ie.x,ie.y);return e instanceof HTMLElement||e instanceof SVGElement?(G.preventDefault(),G.stopPropagation(),void t(e)):void V(e=>e+1)}if("inspector"!==U.activeTool||!ie||"button"in G&&0!==G.button)o.current=null;else{let e=l(ie.x,ie.y,ne);o.current=e?{edit:e,clientX:ie.x,clientY:ie.y,expiresAt:Date.now()+1e3}:null}let oe=f(ne);if(oe?.points[0]){"inspector"===U.activeTool?d():e&&a(),re||i();let t=oe.threadId||(oe.groupId?U.annotations.find(e=>e.groupId===oe.groupId&&e.threadId)?.threadId:void 0);return z.has(oe.id)?(o.current=null,void b(oe.id,t)):(t&&A(t),void F({annotation:oe,startPoint:ne,hasMoved:!1}))}if("inspector"===U.activeTool){if("button"in G&&2===G.button)return;if(ee&&!E(ee)){if(e?.linkedSelector&&!e.domEdit&&wn(e.linkedSelector,e.elements?.[0])===ee)return void G.preventDefault();d();let t=R.filter(e=>"text"===e.type&&e.linkedSelector).filter(e=>wn(e.linkedSelector,e.elements?.[0])===ee).sort((e,t)=>t.timestamp-e.timestamp)[0];if(t?.points[0]){if("pending"!==(t.status??"pending")||t.threadId){let e=t.threadId||(t.groupId?U.annotations.find(e=>e.groupId===t.groupId&&e.threadId)?.threadId:void 0);e&&A(e)}else c(t.id);return}let n=Zn(ee),i=new Set;for(let[e,t]of j??[]){let n=bn(t.selectors??[e],t.targetFingerprint);"matched"===n.status&&n.element===ee&&i.add(t.threadId)}if(1===i.size)return void A([...i][0]);let o=te??On(ee),a=n?Qn(n):Mn(ee),l=lt(ee),s=a;if(!n){let e=ee.getAttribute("data-pm");e||(e=Math.random().toString(36).substring(2,8),ee.setAttribute("data-pm",e)),s=En(`[data-pm="${e}"]`,ee.ownerDocument)}let u,h=(I.some(e=>{if(e.captured)return!1;try{return xt(ee,e.selector)}catch{return!1}})?1:0)+U.annotations.filter(e=>{if(!e.linkedSelector)return!1;try{return xt(ee,e.linkedSelector)}catch{return!1}}).length,p=l.top>=22*(1+h)+2?"top-left":"bottom-left",f=r.current?.getContext("2d")??document.createElement("canvas").getContext("2d");f&&(f.font=`12px ${ci}`,u=f.measureText("Type here...").width);let m=ee===document.body?Ga(l):el(l,p,h,Z?.current,u,0);H({point:m,subjectAnchor:n?{x:.5,y:.5}:void 0,linkedSelector:s,target:n,linkedAnchor:p,elements:[{...o,selector:a}]})}return}if("hand"===U.activeTool&&S&&Rd(S)&&!y&&!_&&!K&&!k){let e=S,t=jd(e),n=Mn(e),r=On(e),i="altKey"in G&&G.altKey;return u.current={isDragging:!0,hasMoved:!1,mode:i?"copy":"move",startX:ne.x-window.scrollX,startY:ne.y-window.scrollY,element:e,originalParent:e.parentElement,originalIndex:Id(e),selector:t,durableSelector:n,elementInfo:{...r,selector:t}},void G.preventDefault()}if("hand"===U.activeTool&&y&&g){let e=function(e,t,n,r){let i=tp(e),o=np(n),a=xi(e),l=window.getComputedStyle(e).justifyContent,s=0;if(r){let n=bi(e).find(e=>e.axis===t);s=n?"column"===t?n.w:n.h:0}let u=r?{row:s,column:s}:a;return rp(e),{session:{...i,isDragging:!0,hasMoved:!1,axis:t,startX:o.x,startY:o.y,originalRow:u.row,originalColumn:u.column,isAuto:r,originalJustifyContent:l,visualGap:s},dragging:{axis:t,...u}}}(y,g,ne,v);return m.current=e.session,void O(e.dragging)}if("hand"===U.activeTool&&K&&Q){let e=function(e,t,n){let r=tp(e),i=np(n),o=Ai(e);return rp(e),{session:{...r,isDragging:!0,property:t,startX:i.x,startY:i.y,originalFontSize:o.fontSize,originalLineHeight:o.lineHeight,originalRatio:o.fontSize>0?o.lineHeight/o.fontSize:1.2},dragging:{property:t,...o}}}(K,Q,ne);return X.current=e.session,void q(e.dragging)}if("hand"===U.activeTool&&_&&N){let e=function(e,t,n){let r=tp(e),i=Mi(e);return rp(e),{session:{...r,isDragging:!0,corner:t,startY:np(n).y,original:i,maxRadius:Math.floor(e.getBoundingClientRect().height/2)},dragging:{corner:t,radius:{...i}}}}(_,N,ne);return P.current=e.session,void W(e.dragging)}if("hand"===U.activeTool&&S&&k){let e=function(e,t,n){let r=tp(e),i=np(n),o=Si(e);return rp(e),{session:{...r,isDragging:!0,side:t,startX:i.x,startY:i.y,original:o},dragging:{side:t,padding:{...o}}}}(S,k,ne);return w.current=e.session,void $(e.dragging)}let ae=p(ne);if(ae){let e=U.annotations.find(e=>e.id===ae.annotationId);if(e&&"text"!==e.type&&"pending"===(e.status??"pending"))return void B({annotationId:ae.annotationId,handle:ae.handle,startPoint:ne,originalPoints:[...e.points],hasMoved:!1})}let le=h(ne);if(le?.points[0]){e&&a(),"text"!==le.type?(D(le.id,re),le.color&&"pending"===(le.status??"pending")&&s({type:"SET_COLOR",payload:le.color})):re||i();let t=le.threadId||(le.groupId?U.annotations.find(e=>e.groupId===le.groupId&&e.threadId)?.threadId:void 0);return t&&"pending"!==(le.status??"pending")&&A(t),void F({annotation:le,startPoint:ne,hasMoved:!1})}re||i()},[e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m,g,y,v,x,b,w,S,k,C,M,E,T,A,R,j,I,z,L,P,N,_,D,F,O,$,H,W,B,V,q,U.activeTool,U.annotations,U.isAnnotating,Y,X,K,Q,Z])}({steerTargetAt:$a,activeText:Pe,applySticker:Rr,canvasRef:Z,clearSelection:Hi,commentTextEditCandidateRef:Ze,commitActiveText:za,createInlineTextEdit:La,dispatch:o,domDragRef:jn,editPendingLinkedComment:Na,finishActiveTextForTargetChange:_a,findAnnotationAtPoint:Ta,findHandleAtPoint:Ra,findTextAtPoint:ja,gapDragRef:Gn,gapHoveredAxis:tr,gapHoveredElement:Jn,gapIsAuto:or,getPoint:Ia,handleAnnotationActivation:ho,handDragRef:Cn,handHoveredElement:In,handHoveredSide:$n,hoveredElement:Ge,hoveredElementInfo:et,isElementInFlight:Ar,onCanvasInteraction:T,openThreadAndFocusReply:ni,pageAnnotations:Zi,modifiedElementThreadStates:m,pageStyleModifications:Gi,parentPinnedAnnotationIds:mi,pointerTargetOverrideRef:Ie,radiusDragRef:dr,radiusHoveredCorner:fr,radiusHoveredElement:hr,selectAnnotation:Oi,setDragState:_i,setGapDragging:ir,setHandDragging:Un,setPendingLinkedText:Ve,setRadiusDragging:yr,setResizeState:Di,setStickerRejectPulse:zt,setTextDragging:Cr,state:i,stickerStage:mt,textDragRef:vr,textHoveredElement:xr,textHoveredProperty:wr,toolbarRef:z}),Ua=(0,Wa.useCallback)((e,t)=>N?.hitTest({x:e,y:t})?.element??Wn(e,t),[N]),nl=(0,Wa.useCallback)((e,n)=>{if(!t||e===Uo&&Qo)return;let r=Yo(e);r.sample?t(r.sample,n):Zo()},[t,Uo,Qo,Yo,Zo]);(0,Wa.useEffect)(()=>{if(!pe)return;let e=e=>{if(0===e.button){if(e.target instanceof Element&&Li(e.target))return void(je.current=null);F?.(),je.current={startX:e.clientX,startY:e.clientY,moved:!1}}},t=e=>{(!(e.target instanceof Element)||!Li(e.target))&&F?.();let t=je.current;t&&(je.current=$d(t,e.clientX,e.clientY))},n=()=>{je.current=null},r=e=>{let t=je.current;if(je.current=null,!Hd(t)||0!==e.button||e.target instanceof Element&&Li(e.target)||me.current||"inspector"!==i.activeTool&&"sticker"!==i.activeTool)return;if(qo&&Bp(e)){let t=Ua(e.clientX,e.clientY);if(t)return e.preventDefault(),e.stopImmediatePropagation(),void nl(t,{x:e.clientX,y:e.clientY})}let n="inspector"===i.activeTool?N?.hitTest({x:e.clientX,y:e.clientY}):null;n&&N?.promote(n.target);let r=n?.element??("sticker"===i.activeTool?$a(e.clientX,e.clientY):Wn(e.clientX,e.clientY,{allowBodyFallback:!0}));!r||Li(r)||r!==document.documentElement&&("inspector"===i.activeTool&&Ar(r)||"sticker"===i.activeTool&&!(r instanceof HTMLElement)&&!(r instanceof SVGElement)||(Ie.current={element:r,elementInfo:n?.elementInfo??On(r)},e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),Va(e)))};return window.addEventListener("pointerdown",e,!0),window.addEventListener("pointermove",t,!0),window.addEventListener("pointercancel",n,!0),window.addEventListener("click",r,!0),()=>{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("pointermove",t,!0),window.removeEventListener("pointercancel",n,!0),window.removeEventListener("click",r,!0)}},[Va,$a,pe,qo,nl,Ua,Ar,i.activeTool,N,F]),(0,Wa.useEffect)(()=>{!i.isAnnotating&&he.current&&ze()},[ze,i.isAnnotating]);let il=vp({retainSampleRailHover:!!Uo,activeTool:i.activeTool,annotations:i.annotations,canvasRef:Z,clearPageElementHover:Dr,clearStickerPreview:tn,dispatch:o,domDragRef:jn,dragState:Pi,findTextAtPoint:ja,gapDragRef:Gn,gapHoveredAxis:tr,gapHoveredElement:Jn,getPoint:Ia,handCursorRef:Yn,handDragRef:Cn,handHoveredElement:In,handHoveredSide:$n,handleShakePointerMove:nn,hoveredElement:Ge,hoveredElementInfo:et,isAnnotating:i.isAnnotating,isElementInFlight:Ar,lastCanvasCursorRef:Qe,modifiersRef:Mr,radiusDragRef:dr,radiusHoveredCorner:fr,radiusHoveredElement:hr,resizeState:Ni,setDomDropPreview:Vn,setDragState:_i,setGapDragging:ir,setGapHoveredAxis:nr,setGapHoveredElement:er,setGapIsAuto:ar,setHandCursorPos:Kn,setHandDragging:Un,setHandHoveredElement:zn,setHandHoveredSide:Hn,setHoveredElement:Je,setHoveredElementInfo:tt,setRadiusDragging:yr,setRadiusHoveredCorner:mr,setRadiusHoveredElement:pr,setResizeState:Di,setStickerCursor:bt,setStickerStep:ht,setTextDragging:Cr,setTextHoveredElement:br,setTextHoveredProperty:Sr,steerDragRef:Nr,stickerPreviewRef:Wt,stickerFamily:ot,stickerStage:mt,stickerSubproperty:pt,subjectRegistry:N,suspendTargetDiscovery:!!qe||Vr&&"inspector"!==i.activeTool||ye,textDragRef:vr,textHoveredElement:xr,textHoveredProperty:wr,transformDragHandoffRef:Qt,transformPreviewSuppressionRef:Kt,transformPreviewTargetRef:Xt}),cl=bp({annotationGroupMap:zo,canvasRef:Z,currentPathname:oe,cursorPosRef:vi,dispatch:o,domDragRef:jn,dragState:Pi,gapDragRef:Gn,gapDragging:rr,getPoint:Ia,handDragRef:Cn,handDragging:qn,lastPositionedTextId:Ci,radiusDragRef:dr,radiusDragging:gr,resizeState:Ni,setActiveText:De,setDomDropPreview:Vn,setDragState:_i,setGapDragging:ir,setHandDragging:Un,setRadiusDragging:yr,setResizeState:Di,setSendHintAnchorId:ao,setTextDragging:Cr,textDragRef:vr,textDragging:kr}),yl=function({enabled:e,onRegion:t,onClick:n,onStart:r}){let i=(0,Md.useRef)(null),o=(0,Md.useRef)(null),[a,l]=(0,Md.useState)(null),s=(0,Md.useCallback)(()=>{let e=i.current;i.current=null,o.current=null,l(null),e?.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)},[]);return(0,Md.useEffect)(()=>{e||s()},[e,s]),(0,Md.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i.current&&(e.preventDefault(),e.stopImmediatePropagation(),s())};return window.addEventListener("keydown",e,!0),window.addEventListener("blur",s),window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("blur",s),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s),s()}},[s]),{activateTouchTap:t=>{let r=o.current,a=i.current;if(a?.touchPress){let e=t.changedTouches[0],n=a.touchPress;!a.moved&&e&&Math.hypot(e.clientX-n.clientX,e.clientY-n.clientY)<6&&(r=n),s()}o.current=null,e&&r&&!t.touches.length&&(t.preventDefault(),n(r))},begin:t=>(o.current=null,"touch"!==t.pointerType||t.isPrimary?!(!e||0!==t.button||!["mouse","pen","touch"].includes(t.pointerType)||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||i.current||(i.current={pointerId:t.pointerId,target:t.currentTarget,points:[{x:t.clientX,y:t.clientY}],moved:!1,touchPress:"touch"===t.pointerType?t.nativeEvent:null,scroll:{x:window.scrollX,y:window.scrollY},viewport:{width:window.innerWidth,height:window.innerHeight}},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),0)):(s(),!0)),move:e=>{let t=i.current;if(!t||e.pointerId!==t.pointerId)return!1;let n={x:e.clientX,y:e.clientY};return!t.moved&&Math.hypot(n.x-t.points[0].x,n.y-t.points[0].y)>=6&&(t.moved=!0,t.touchPress||r()),t.touchPress||(t.points=sl(t.points,n),t.moved&&l(t.points),e.preventDefault()),!0},end:e=>{let r=i.current;if(!r||e.pointerId!==r.pointerId)return!1;let a=sl(r.points,{x:e.clientX,y:e.clientY});if(s(),!r.moved&&Math.hypot(e.clientX-r.points[0].x,e.clientY-r.points[0].y)<6)r.touchPress?o.current=e.nativeEvent:n(e.nativeEvent);else if(!r.touchPress){let e=function(e,t,n,r=Date.now()){if(e.length<3)return null;let i=ul(e);return i.right-i.left<8||i.bottom-i.top<8||0===dl(e).length?null:{kind:"lasso",coordinateSpace:"document",points:e.map(e=>({x:e.x+t.x,y:e.y+t.y})),viewport:n,scroll:{...t},capturedAt:r}}(a,r.scroll,r.viewport);e&&t(e,a)}return r.touchPress||e.preventDefault(),!0},cancel:s,preview:a,active:()=>null!==i.current}}({enabled:i.isAnnotating&&"inspector"===i.activeTool&&!qe&&!pe&&!ye,onStart:()=>{za(),Hi(),Dr(),Ze.current=null},onClick:e=>{let t=N?.hitTest({x:e.clientX,y:e.clientY});t&&N?.promote(t.target);let n=t?.element??Wn(e.clientX,e.clientY,{allowBodyFallback:!0});!n||Li(n)||(Ie.current={element:n,elementInfo:t?.elementInfo??(n===Ge?et:null)??On(n)},"touch"===e.pointerType?((0,Fo.flushSync)(()=>Va(e)),wi.current?.focus({preventScroll:!0})):Va(e),cl(e))},onRegion:(e,t)=>{let n=new Map;for(let e of dl(t)){if(n.size>=16)break;let t=N?.hitTest(e),r=t?null:Wn(e.x,e.y),i=t?.elementInfo??(r?On(r):null);i&&n.set(i.selector,i)}let r=ul(e.points);Ci.current=null,vi.current=0,De({id:Math.random().toString(36).substring(2,9),point:{x:r.left,y:r.bottom+12},text:"",fontSize:12,isNew:!0,region:{...e,elements:[...n.values()]},linkedAnchor:"bottom-left",elements:[]}),ao(qp)}}),vl=yl.cancel;(0,Wa.useEffect)(()=>{vl()},[P,vl]);let xl=(0,Wa.useCallback)(e=>{if(ja(Ia(e))||Ta(Ia(e))||!yl.begin(e)){if(i.isAnnotating&&"inspector"===i.activeTool&&0===e.button&&"mouse"===e.pointerType&&N&&!qe){let t=N.beginCreate({x:e.clientX,y:e.clientY});if(t)return le.current={...t,start:{x:e.clientX,y:e.clientY},moved:!1,pointerId:e.pointerId,captureTarget:e.currentTarget},e.currentTarget.setPointerCapture(e.pointerId),void e.preventDefault()}Va(e)}},[Va,ja,Ta,Ia,yl,i.activeTool,i.isAnnotating,qe,N]),wl=(0,Wa.useCallback)(e=>{if(yl.move(e))return;let t=le.current;if(!t||t.pointerId!==e.pointerId)return void il(e);let n=Math.hypot(e.clientX-t.start.x,e.clientY-t.start.y);!t.moved&&n>=4&&(t.moved=!0),t.moved?(t.session.update({x:e.clientX,y:e.clientY}),ce({adapter:t.adapter.id,key:t.session.key}),Xe(e=>e+1),e.preventDefault()):il(e)},[il,yl]),Sl=(0,Wa.useCallback)(e=>{if(yl.end(e))return;let t=le.current;if(t&&t.pointerId!==e.pointerId)return;if(le.current=null,ce(null),!t)return void cl(e);if(t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),!t.moved){t.session.cancel();let n=N?.hitTest({x:e.clientX,y:e.clientY});return n&&N?.promote(n.target),Va(e),void cl(e)}t.session.update({x:e.clientX,y:e.clientY});let n=t.session.commit();n&&(se.current=window.performance.now()+500,Ue({target:{adapter:t.adapter.id,key:n.key},created:!0})),e.preventDefault()},[Va,cl,N,yl]),kl=(0,Wa.useCallback)(e=>{if(!i.isAnnotating||"inspector"!==i.activeTool||!N)return!1;let t=N.resolve(e);if(!t?.adapter.renameSubject)return!1;let n=gi.current;return n?.isNew&&n.target?.adapter===t.target.adapter&&n.target.key===t.target.key&&($e(n.attachments),De(null),Ve(null)),Ue({target:t.target,created:!1}),!0},[gi,$e,De,i.activeTool,i.isAnnotating,N]),Cl=(0,Wa.useCallback)(e=>{if(window.performance.now()<=se.current)return se.current=0,e.preventDefault(),void e.stopPropagation();if(se.current=0,U&&i.isAnnotating&&"sticker"===i.activeTool&&0===e.button){let t=La(e.clientX,e.clientY,Ia(e),!!V);if(t?.domEdit&&U(t.domEdit.targetElement))return clearTimeout(Te.current),tn(),sn(),Pa(t),e.preventDefault(),void e.stopPropagation()}if(!N)return;let t=N.hitTest({x:e.clientX,y:e.clientY});!t||!kl(t.target)||(e.preventDefault(),e.stopPropagation())},[U,V,tn,La,Pa,Ia,kl,sn,i.activeTool,i.isAnnotating,N]),[_l,Dl]=(0,Wa.useState)(!1),Ol=V&&"sticker"===i.activeTool&&"family"===mt;(0,Wa.useEffect)(()=>{if(!Ol)return;let e=!1,t=t=>{t.altKey!==e&&(e=t.altKey,Dl(e))},n=()=>{e=!1,Dl(!1)};window.addEventListener("keydown",t,!0),window.addEventListener("keyup",t,!0),window.addEventListener("pointermove",t,!0),window.addEventListener("blur",n);let r=t=>{e||t.defaultPrevented||t.composedPath()[0]===Z.current||!(t.target instanceof Element)||!Wn(t.clientX,t.clientY)?.closest("[data-scratch-text]")||Cl(t)};return document.addEventListener("dblclick",r),()=>{document.removeEventListener("dblclick",r),window.removeEventListener("keydown",t,!0),window.removeEventListener("keyup",t,!0),window.removeEventListener("pointermove",t,!0),window.removeEventListener("blur",n),n()}},[Cl,Ol,Z]);let Hl=(0,Wa.useCallback)((e,t)=>{vi.current=t;let n=gi.current;if(n?.domEdit){let t=n.domEdit,r=_d(t,e,ui.current.textModifications),i=r?{type:"MODIFY_TEXT_CONTENTS",payload:[r.change],saveUndo:n.text===t.originalText}:Dd(t,e,n.text===t.originalText);r||i.payload.forEach(({modified:e},n)=>{let r=t.segments[n].textNode;r.data!==e&&(r.data=e)}),o({...i,textEditSessionId:n.paragraphSession?.id})}De(t=>t&&{...t,text:e})},[gi,vi,o,De,ui]),Bl=(0,Wa.useCallback)(e=>{if(e.nativeEvent.isComposing||229===e.nativeEvent.keyCode)return;let t=gi.current,n=t?.domEdit;if(n&&Vi(n.targetElement)&&(e.metaKey||e.ctrlKey)&&"z"===e.key.toLowerCase())return e.preventDefault(),e.stopPropagation(),De(null),void o({type:e.shiftKey?"REDO":"UNDO"});if("Escape"===e.key)t?.paragraphSession?(e.preventDefault(),e.stopPropagation(),o({type:"CANCEL_PARAGRAPH_EDIT",payload:t.paragraphSession})):gi.current?.domEdit&&(o(Dd(gi.current.domEdit,gi.current.domEdit.originalText,!1)),gi.current.domEdit.segments.forEach(e=>{e.textNode.nodeValue=e.originalText})),$e(gi.current?.attachments),De(null);else if(function(e){return!("Enter"!==e.key||!e.metaKey&&!e.ctrlKey||(e.preventDefault(),e.stopPropagation(),0))}(e))Da();else if("Enter"===e.key&&!e.shiftKey){if(e.preventDefault(),t&&"P"===n?.targetElement.tagName&&wi.current){let{value:e,selectionStart:r,selectionEnd:i}=wi.current,a=_d(n,e.slice(0,r)+e.slice(i),ui.current.textModifications,r);if(a?.next)return o({type:"MODIFY_TEXT_CONTENTS",payload:[a.change],textEditSessionId:t.paragraphSession?.id}),void De({...a.next,paragraphSession:t.paragraphSession})}za()}},[za,o,Da,wi,ui,gi,$e,De]),Vl=(0,Wa.useCallback)(e=>{if(!i.isAnnotating)return;let t=yi.current;yi.current=null;let n=ja(Ia(e));if(n&&C&&!uo(n,ui.current.annotations))return e.preventDefault(),e.stopPropagation(),void C(n.id);if(n&&uo(n,ui.current.annotations))return e.preventDefault(),e.stopPropagation(),void Bi(n.id);if("resolved"===n?.status){let t=Jh(ui.current.annotations,[n.id]);if(t.length>0)return e.preventDefault(),e.stopPropagation(),void t.forEach(e=>k?.(e))}e.preventDefault();let r=!!gi.current,o=Ti({x:e.clientX,y:e.clientY},t);!r&&!o&&Le()},[Le,ja,Ia,Bi,k,C,Ti,i.isAnnotating]),ql=(0,Wa.useMemo)(()=>{if(!Ge)return i.activeColor;let e=null;for(let t of Zi)!t.linkedSelector||Ro.has(t)||Qa(t.linkedSelector,t.elements)!==Ge||(!e||t.timestamp>e.timestamp)&&(e=t);let t=e?.color??i.activeColor,n=et?.selector??e?.linkedSelector;return n?rl([n],m??new Map,t,An):t},[Ge,et?.selector,m,Zi,i.activeColor,Ro]),Ul=function(e,t){return e&&"model"!==t}(i.isAnnotating,i.activeTool),Xl={position:"fixed",top:0,left:0,width:"100dvw",height:"100dvh",zIndex:9998,pointerEvents:pe||Ol&&_l||!Ul?"none":"auto",visibility:Ul?"visible":"hidden",cursor:wt&&!wt.nativeReady?"none":(()=>{if(!i.isAnnotating)return"default";if(Ni){let{handle:e}=Ni;return"start"===e||"end"===e?"move":"top"===e||"bottom"===e?"ns-resize":"left"===e||"right"===e?"ew-resize":"topLeft"===e||"bottomRight"===e?"nwse-resize":"nesw-resize"}if(function(e){return"hand"===e}(i.activeTool)){let e=rr?.axis??tr;if("row"===e)return"ns-resize";if("column"===e)return"ew-resize";if(gr||fr)return"ns-resize";let t=kr?.property??wr;if("font-size"===t)return"ew-resize";if("line-height"===t)return"ns-resize";let n=qn?.side??$n;return"top"===n||"bottom"===n?"ns-resize":"left"===n||"right"===n?"ew-resize":"default"}return"inspector"===i.activeTool?Vs(ql):"sticker"===i.activeTool?Bs(ql):"crosshair"})(),touchAction:"inspector"===i.activeTool?"pan-x pan-y pinch-zoom":"none"},Kl=(0,Wa.useMemo)(()=>{if(!Pe||Pe.domEdit)return;if(Pe.linkedSelector){let e=ba.find(e=>e.selector===Pe.linkedSelector)?.annotationNumber??No.get(da?.selector??Pe.linkedSelector);if(void 0!==e)return e}let e=zo.get(Pe.id);if(void 0!==e)return e;if(Pe.groupId){let e=i.annotations.find(e=>e.groupId===Pe.groupId),t=e?zo.get(e.id):void 0;if(void 0!==t)return t}return Io.count+1},[Pe,da,zo,No,ba,Io.count,i.annotations]),Ql=void 0!==Kl?`${Kl}.`:"",Zl=(0,Wa.useMemo)(()=>{if(!Pe||!Ql||Pe.domEdit)return 0;let e=Z.current?.getContext("2d");return e&&(e.font=`${Pe.fontSize}px ${ci}`),function({prefix:e,fontSize:t,railGap:n,context:r}){if(!e)return 0;let i=.6*t;return(r?.measureText(e).width??e.length*i)+(n??(r?.measureText(" ").width??i)/2)}({prefix:Ql,fontSize:Pe.fontSize,railGap:da?2:void 0,context:e})},[Pe,Ql,da,Z]),Gl=Pe?.images?.length??i.annotations.find(e=>e.id===Pe?.id)?.imageCount??0,Jl=!Pe||Pe.domEdit||da?0:function({nestedAnnotationCount:e,interactionEpisodeStepCount:t,reserveSendHint:n,imageCount:r=0}){let i=+(r>0)+ +(t>0)+ +(e>0)+Number(n);return 0===i?0:Fl(r)+(r>0?4:0)+(e>0?36:0)+wo(t)+(n?86:0)+2*Math.max(0,i-1)}({nestedAnnotationCount:ha,imageCount:Gl,interactionEpisodeStepCount:Pe.interactionEpisode?.steps.length??0,reserveSendHint:!!b&&ro===qp&&!!Pe.text.trim()}),ts=!i.isAnnotating||!Pe?.linkedSelector||Pe.target||Pe.domEdit||da?null:Qa(Pe.linkedSelector,Pe.elements),rs=!(!Pe||!Za(Pe)),is=function(e){let[t,n]=(0,Ud.useState)();return(0,Ud.useLayoutEffect)(()=>{if(!e)return;let t,r=function(e){if(e.ownerDocument!==document)return!1;for(let t=e;t&&t!==document.documentElement;t=vt(t)){let n=getComputedStyle(t);if("fixed"===n.position||"sticky"===n.position||t!==e&&t!==document.scrollingElement&&/(auto|scroll|hidden)/.test(n.overflowX+n.overflowY)&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth))return!1}return!0}(e),i=()=>{if(!e.isConnected)return;let o=lt(e),a=r?{x:window.scrollX,y:window.scrollY}:void 0;n(t=>t?.element===e&&t.rect.x===o.x&&t.rect.y===o.y&&t.rect.width===o.width&&t.rect.height===o.height&&t.pageScroll?.x===a?.x&&t.pageScroll?.y===a?.y?t:{element:e,rect:o,pageScroll:a}),t=requestAnimationFrame(i)};return i(),()=>cancelAnimationFrame(t)},[e]),t?.element===e?t:void 0}(ts),as=is?.rect,us=Z.current?.getRootNode(),cs=us&&"host"in us&&us.host.hasAttribute("data-popmelt-top-layer-host")?is?.pageScroll:void 0,ds=ri(cs?null:ts),fs=rs&&as?ya(as,22,2,window.innerHeight):null,ys=Pe?fs?fs.left+8:as?as.left+8:Pe.point.x-Xi.x:0,vs=Pe?as?.right??Pe.point.x-Xi.x:0,xs=(0,Wa.useMemo)(()=>Pe&&!Pe.domEdit?function(e){let t=function(e){let t=[];for(let n of e.matchAll(/(?<!\\S)\\/\\S*/g)){let e=n[0],r=e.toLowerCase(),i=Object.values(Do).filter(e=>e.startsWith(r));if(!i.length)continue;let o=e.length>1&&1===i.length?i[0].slice(e.length):"";t.push({start:n.index,token:e,suffix:o})}return t}(e)[0];if(!t)return;let n=e.slice(0,t.start);if(n.trim())return;let r=e.slice(t.start+t.token.length);return!r||Object.values(Do).some(e=>e===t.token.toLowerCase())?{...t,leading:n,body:r}:void 0}(Pe.text):void 0,[Pe]),bs=(0,Wa.useCallback)(()=>{let e=Z.current;if(!e||!Pe)return{width:100,height:14,isWrapped:!1};if(Pe.domEdit){let e=Pe.domEdit.flowRect??Pe.domEdit.rect;return{width:Math.max(1,Math.min(e.width,window.innerWidth-e.left)),height:Math.max(1,e.height),isWrapped:Pe.domEdit.wrapsText}}let t=e.getContext("2d");if(!t)return{width:100,height:Pe.fontSize*si,isWrapped:!1};t.font=`${Pe.fontSize}px ${ci}`;let n=Pe.text+(xs?.suffix??""),r=Pe.point.x-Xi.x;if(!da){let e=!!(Pe.linkedSelector||Pe.target||Pe.region),r=Od({text:n,fontSize:Pe.fontSize,effectiveMaxWidth:384,annotationPrefixWidth:Zl,isModifiedRail:!1,fitToContent:e,context:t}).width+Zl+16,i=Fd({anchorLeftX:ys,anchorRightX:vs,editorWidth:r,trailingWidth:Jl,viewportWidth:window.innerWidth});return Od({text:n,fontSize:Pe.fontSize,effectiveMaxWidth:Math.max(1,i.maxEditorWidth-16),annotationPrefixWidth:Zl,isModifiedRail:!1,fitToContent:e,context:t})}return Od({text:n,fontSize:Pe.fontSize,effectiveMaxWidth:di(r),annotationPrefixWidth:Zl,isModifiedRail:!!da,context:t})},[Pe,xs,Z,Xi.x,Zl,da,Jl,ys,vs])(),ws=!!Pe?.domEdit,Ss=Pe?Math.max(1,Pe.text.split("\\n").length)*Pe.fontSize*si+8:0,ks=ws?bs.height:bs.height+8,Cs=fs??(as?ya(as,ks,2,window.innerHeight):void 0),Ms=li(rs?"bottom-left":Cs?.anchor??Pe?.linkedAnchor),As=bs.isWrapped?ks-Ss:0,Rs=Pe?ws?(Pe.domEdit.flowRect??Pe.domEdit.rect).top:Cs?.top??Pe.point.y-4-Xi.y-As:0,js=Pe?ws?(Pe.domEdit.flowRect??Pe.domEdit.rect).left:Pe.point.x-8-Xi.x:0,Is=ws?bs.width:bs.width+Zl+16,zs=!Pe||ws||da?js:Fd({anchorLeftX:ys,anchorRightX:vs,editorWidth:Is,trailingWidth:Jl,viewportWidth:window.innerWidth}).editorLeft,Ls=Pe?ws?Rs:pi(Rs,ks,Eo,zs,Is):0,Ps=Pe?.domEdit?{image:Pe.domEdit.boundaryRects.map(()=>"linear-gradient(#000 0 0)").join(", "),position:Pe.domEdit.boundaryRects.map(e=>`${e.left-zs}px ${e.top-Ls}px`).join(", "),size:Pe.domEdit.boundaryRects.map(e=>`${e.width}px ${e.height}px`).join(", ")}:void 0,Ns=!!(cs||ds&&as),_s=Ns?0:zs,Ds=Ns?0:Ls,Fs=Pe?Pe.domEdit?{position:"fixed",left:_s,top:Ds,zIndex:10002,width:Is,height:ks,minHeight:0,padding:0,margin:0,boxSizing:"border-box",appearance:"none",fontSize:Pe.fontSize,fontFamily:Pe.domEdit.fontFamily,fontWeight:Pe.domEdit.fontWeight,fontStyle:Pe.domEdit.fontStyle,color:"transparent",caretColor:i.activeColor,WebkitTextFillColor:"transparent",backgroundColor:"transparent",border:"none",borderRadius:0,outline:"none",boxShadow:"none",lineHeight:Pe.domEdit.lineHeight,textIndent:Pe.domEdit.firstLineIndent,letterSpacing:Pe.domEdit.letterSpacing,textTransform:Pe.domEdit.textTransform,textAlign:Pe.domEdit.textAlign,wordSpacing:Pe.domEdit.wordSpacing,textDecoration:Pe.domEdit.textDecoration,textShadow:Pe.domEdit.textShadow,resize:"none",overflow:"hidden",whiteSpace:Pe.domEdit.wrapsText?Pe.domEdit.whiteSpace:"pre",wordBreak:Pe.domEdit.wordBreak,overflowWrap:Pe.domEdit.overflowWrap,maskImage:Ps?.image,maskPosition:Ps?.position,maskSize:Ps?.size,maskRepeat:"no-repeat",WebkitMaskImage:Ps?.image,WebkitMaskPosition:Ps?.position,WebkitMaskSize:Ps?.size,WebkitMaskRepeat:"no-repeat"}:{position:"fixed",left:_s,top:Ds,zIndex:10002,width:Is,height:ks,padding:"3.5px 8px 4.5px",paddingLeft:8+Zl,boxSizing:"border-box",fontSize:Pe.fontSize,fontFamily:ci,color:"#ffffff",backgroundColor:i.activeColor,border:"none",borderRadius:Ms,animation:Pe.isNew?"popmeltAnnotationFieldEnter 150ms ease-out both":void 0,outline:"none",boxShadow:"none",lineHeight:si,resize:"none",overflow:"hidden",whiteSpace:bs.isWrapped?"pre-wrap":"pre",wordBreak:bs.isWrapped?"break-word":void 0}:{},Hs=Pe?.target&&Pe.linkedSelector?Qa(Pe.linkedSelector,Pe.elements):null,{nestedBadgeOwnerSelector:Ws,hoveredLinkedAnnotationId:Us,hasSelectedHighlightForElement:Ys,ownedInFlightSelectorColors:Ks,ownedFocusedSelectorColors:Qs,selectorElementInfo:Zs,claimElementOverlay:Gs}=function({activeText:e,pendingLinkedText:t,activeTextSendHintId:n,activeTool:r,isAnnotating:i,annotations:o,pageAnnotations:a,pageStyleModifications:l,pageTextModifications:s,supersededAnnotations:u,nestedBadgeHover:c,isSendBundleHovered:d,badgeHoveredAnnotationId:h,hoveredTextId:p,badgeHoveredSelector:f,focusedThreadAnnotationId:m,inFlightSelectorColors:g,focusedSelectorColors:y,hoveredElement:v}){let x=new Map;for(let e of o)e.linkedSelector&&e.elements?.[0]&&x.set(e.linkedSelector,e.elements[0]);for(let e of[...l,...s])x.set(e.selector,e.element);for(let n of[e,t])n?.linkedSelector&&n.elements?.[0]&&x.set(n.linkedSelector,n.elements[0]);let b=(e,t)=>Qa(e,t??(x.has(e)?[x.get(e)]:void 0)),w=e=>e?o.find(t=>t.id===e)?.linkedSelector??null:null,S=c?c.ownerId===n?e?.linkedSelector??null:w(c.ownerId):null,k=[e?.linkedSelector,t?.linkedSelector,w(m),w(c||d?null:h),w(c||d?null:p),f].filter(Boolean),C=c||d?null:h||p,M=[],E=(e,t)=>{e&&M.push({target:e,owner:t})},T=(e,t,n)=>{e&&E(b(e,n),t)};if(i){if("hand"===r)for(let e of l)e.captured||T(e.selector,"pending-change");for(let e of s)e.captured||T(e.selector,"pending-change");for(let e of g?.keys()??[])T(e,"in-flight");for(let e of y?.keys()??[])T(e,"selected");if(T(e?.domEdit?e.linkedSelector:null,"active-edit",e?.elements),!c&&!d&&T(e?.linkedSelector||t?.linkedSelector,"direct-manipulation",e?.elements||t?.elements),!d&&m){let e=o.find(e=>e.id===m);e?.linkedSelector&&S!==e.linkedSelector&&T(e.linkedSelector,"thread-focus",e.elements)}if(C){let e=o.find(e=>e.id===C);T(e?.linkedSelector,"annotation-hover",e?.elements)}if(c&&!d)for(let e of c.annotationIds){let t=o.find(t=>t.id===e);T(t?.linkedSelector,"nested-preview",t?.elements)}if(d){for(let e of a)"pending"===(e.status??"pending")&&T(e.linkedSelector,"bundle-preview",e.elements);e&&!e.domEdit&&e.text?.trim()&&T(e.linkedSelector,"bundle-preview",e.elements);for(let e of[...l,...s])e.captured||T(e.selector,"bundle-preview",[e.element])}T(f,"badge-hover"),("inspector"===r||"sticker"===r)&&v&&!C&&!f&&E(v,"inspector-hover")}let A=function(e){let t=new Map;for(let n of e){let e=t.get(n.target);(!e||qd[n.owner]>qd[e])&&t.set(n.target,n.owner)}return t}(M),R=(e,t)=>A.get(e)===t,j=(e,t)=>{if(!e)return null;let n=new Map,r=new Set;for(let[i,o]of e){let e=b(i);e&&R(e,t)&&!r.has(e)&&(r.add(e),n.set(i,o))}return n.size>0?n:null},I=new Set;return{selectorElementInfo:x,nestedBadgeOwnerSelector:S,hoveredLinkedAnnotationId:C,hasSelectedHighlightForElement:e=>k.some(t=>((e,t)=>!!t&&b(t)===e)(e,t)),getExistingAnnotationForElement:e=>{let t=null;for(let n of a)!n.linkedSelector||u.has(n)||Qa(n.linkedSelector,n.elements)!==e||(!t||n.timestamp>t.timestamp)&&(t=n);return t},ownedInFlightSelectorColors:j(g,"in-flight"),ownedFocusedSelectorColors:j(y,"selected"),claimElementOverlay:(e,t)=>!(!R(e,t)||I.has(e)||(I.add(e),0))}}({activeText:Pe,pendingLinkedText:Be,activeTextSendHintId:qp,activeTool:i.activeTool,isAnnotating:i.isAnnotating,annotations:i.annotations,pageAnnotations:Zi,pageStyleModifications:Gi,pageTextModifications:Ji,supersededAnnotations:Ro,nestedBadgeHover:vn,isSendBundleHovered:Sn,badgeHoveredAnnotationId:pn,hoveredTextId:He,badgeHoveredSelector:gn,focusedThreadAnnotationId:A,inFlightSelectorColors:f,focusedSelectorColors:Ca,hoveredElement:Ge}),Js=ql,au=Pe?.domEdit?Xo(i.activeColor,.28):"#000000",cu=Pe?.domEdit?"transparent":"#ffffff",hu=Wo??Ge,pu=Wo?"selected":"hover",yu=Wo?Ho?.target??Zn(Wo):Oo,vu=yu?.adapter,Cu=yu?.key;(0,Wa.useEffect)(()=>(D?.(i.isAnnotating&&hu?{element:hu,selection:pu,subject:vu&&Cu?{adapter:vu,key:Cu}:void 0}:null),()=>D?.(null)),[D,i.isAnnotating,hu,pu,vu,Cu]);let Mu=e=>{Ke.current=null,N?.remove(e),Je(null),tt(null),Ue(t=>t?.target.adapter===e.adapter&&t.target.key===e.key?null:t)};if(ye){let e=ge.current,t=e?.draft?i.activeColor:i.annotations.find(t=>t.id===e?.id)?.color??i.activeColor;return ke?(0,Wp.jsx)(Dc,{cursor:ke,stepCount:we,accentColor:t,toolbarElement:z?.current,threadElement:L}):null}let Eu=!i.isAnnotating||Pe||Be||qe?null:e,Tu=i.isAnnotating&&"hand"!==i.activeTool&&(H&&(Gi.length>0||Ji.length>0||!!Ao?.length)||ga.length>0||(m?.size??0)>0||ta);return(0,Wp.jsxs)(Wp.Fragment,{children:[(yl.preview||Pe?.region)&&(0,Wp.jsx)("svg",{"data-popmelt-lasso":"","aria-hidden":"true",style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9999},children:(0,Wp.jsx)("polygon",{points:(yl.preview??Pe.region.points.map(e=>({x:e.x-Xi.x,y:e.y-Xi.y}))).map(e=>`${e.x},${e.y}`).join(" "),fill:i.activeColor,fillOpacity:.07,fillRule:"evenodd",stroke:i.activeColor,strokeWidth:1,strokeDasharray:Hr})}),(0,Wp.jsx)("canvas",{ref:ae,part:ti,"data-devtools":"annotation-paint","aria-hidden":"true",style:{...Xl,pointerEvents:"none"}}),(0,Wp.jsx)("canvas",{ref:Z,width:1,height:1,id:"devtools-canvas",style:Xl,onPointerDown:e=>{if(F?.(),Ae.current=null,e.isPrimary&&qo&&Bp(e)&&Ua(e.clientX,e.clientY))return Ae.current={startX:e.clientX,startY:e.clientY,moved:!1},void e.preventDefault();if("touch"===e.pointerType&&"sticker"===i.activeTool)return;let t="sticker"===i.activeTool&&e.isPrimary&&0===e.button,n=t&&U?$a(e.clientX,e.clientY):null;if(V&&"family"!==mt&&n?.hasAttribute("data-popmelt-subject-key"))return void B?.(n);let r=n&&U?.(n);Re.current=t&&(r||B&&"family"===mt)?{startX:e.clientX,startY:e.clientY,moved:!1}:null,(!r||(clearTimeout(Te.current),"value"!==mt))&&xl(e)},onPointerMove:e=>{Ae.current?Ae.current=$d(Ae.current,e.clientX,e.clientY):(Re.current&&(Re.current=$d(Re.current,e.clientX,e.clientY)),F?.(),(yl.active()||le.current||!Oo||!Ph(e.currentTarget.ownerDocument,e.clientX,e.clientY))&&wl(e))},onTouchEnd:yl.activateTouchTap,onClick:e=>{let t=Ae.current;if(Ae.current=null,t){if(Hd(t)&&qo&&Bp(e)){let t=Ua(e.clientX,e.clientY);t&&nl(t,{x:e.clientX,y:e.clientY})}return}let n=Re.current;if(Re.current=null,!Hd(n))return;let r=$a(e.clientX,e.clientY);r&&(clearTimeout(Te.current),U?.(r)?1===e.detail&&(Te.current=setTimeout(()=>{r.isConnected&&("value"===mt&&r instanceof HTMLElement?Rr(r):"family"===mt&&B?.(r))},350)):"family"===mt&&B?.(r))},onPointerUp:e=>{Ae.current||Sl(e)},onPointerCancel:e=>{Ae.current=null,Re.current=null,yl.active()?yl.cancel():le.current?de():cl(e)},onLostPointerCapture:e=>{yl.active()&&yl.cancel(),le.current?.pointerId===e.pointerId&&de()},onDoubleClick:Cl,onPointerLeave:e=>{if(Re.current=null,le.current||yl.active()||Uo&&e.relatedTarget instanceof Element&&e.relatedTarget.closest("[data-popmelt-hover-action-rail]")||function(e){return e instanceof Element&&null!==e.closest("[data-popmelt-steer-overlay]")}(e.relatedTarget)||Vp(e.relatedTarget))return;Sl(e),tn(),Kt.current=null,Qt.current=null;let t=()=>{Je(null),tt(null)};if(Zn(Ge)){let{clientX:n,clientY:r}=e,i=e.currentTarget.getRootNode();return void window.setTimeout(()=>{Vp(i.elementFromPoint(n,r))||null!==Ke.current||t()},100)}t()},onContextMenu:e=>{if(Oo&&Ph(e.currentTarget.ownerDocument,e.clientX,e.clientY))return e.preventDefault(),e.stopPropagation(),void Mu(Oo);Vl(e)}}),ue&&N&&(()=>{let e=N.resolve(ue);return e?(0,Wp.jsx)(Fa,{element:e.element,activeFacet:"translate",accentColor:i.activeColor,showHandles:!1,showRotateHandle:!1,refreshKey:Ye}):null})(),qe&&N&&(0,Wp.jsx)(Sd,{accentColor:i.activeColor,created:qe.created,registry:N,target:qe.target,onCommit:e=>{Je(e.element),tt(e.elementInfo),Xe(e=>e+1)},onClose:()=>Ue(null),onCancelCreated:()=>{N.remove(qe.target),Ue(null)}},`${qe.target.adapter}:${qe.target.key}`),wt&&(0,Wp.jsx)(os,{color:ql,cursorRef:Qe,tool:wt.tool,onHandoff:()=>St(e=>e?.id===wt.id?{...e,nativeReady:!0}:e),onDone:()=>St(null)},wt.id),i.isAnnotating&&Pe&&(0,Wp.jsxs)("div",{"data-devtools":"annotation-composer",part:ds?ei:void 0,style:Ns&&as?{position:cs?"absolute":"fixed",...cs?{left:zs+cs.x,top:Ls+cs.y}:ii(ds,as,zs,Ls),width:Is,height:ks,transform:"translateZ(0)",pointerEvents:"none",zIndex:10002}:{display:"contents"},children:[Hs&&Pe.subjectAnchor&&(0,Wp.jsx)(Aa,{element:Hs,annotationRect:{left:zs,top:Ls,width:Is,height:ks},subjectAnchor:Pe.subjectAnchor,color:i.activeColor,subjectRegistry:N}),(0,Wp.jsx)(es,{target:Pe.domEdit?.targetElement,singleTextNode:Pe.domEdit?.singleTextNode,segments:Pe.domEdit?.segments,canvasRef:Z,value:Pe.text,command:xs,fontSize:Pe.fontSize,prefix:Ql,inputRef:wi,inputStyle:Fs,selectionBackground:au,selectionColor:cu,annotationBorderRadius:Ms,activeColor:i.activeColor,boundaryRects:Pe.domEdit?.boundaryRects,viewportClip:Pe.domEdit&&rt(Pe.domEdit.targetElement.ownerDocument)?dt(new DOMRect(0,0,window.innerWidth,window.innerHeight),Pe.domEdit.targetElement.ownerDocument):void 0,wrapsDomText:Pe.domEdit?.wrapsText,showEditor:!da,rawLeft:_s,top:Ds,baselineOffset:-.5,onChange:Hl,onKeyDown:Bl,onPaste:Fe,onBlur:Oa},Pe.paragraphSession?.id??Pe.id),!da&&!Pe.domEdit&&(0,Wp.jsx)(Wl,{rawLeft:_s,width:Is,top:Ds,scroll:Xi,collisionId:ca,nestedAnnotationCount:ha,nestedAnnotationIds:pa,nestedBadgeColor:fa,imageCount:Gl,color:i.activeColor,interactionEpisodeStepCount:Pe.interactionEpisode?.steps.length??0,showSendHint:ro===qp&&!!Pe.text.trim(),bundleCount:eo,onHoverNestedAnnotations:Qr,onHoverSendHint:Zr,onClearInteractionEpisode:()=>ji(Pe.id),onSend:b?Da:void 0}),(0,Wp.jsx)($l,{point:Ns?{x:8,y:4}:Pe.point,scroll:Ns?{x:0,y:0}:Xi,attachments:Pe.attachments??[],showAttachments:!Pe.domEdit,onRemoveAttachment:Oe})]}),Tu&&(0,Wp.jsx)(ld,{historyPreview:Eu,subjectRegistry:N,sampleTargets:H?Ao:void 0,styleModifications:H?Gi:[],textModifications:H?Ji:[],stagedComments:ga,accentColor:i.activeColor,annotationNumberBySelector:No,inFlightSelectors:h,inFlightAnnotationIds:l,activeAnnotationIds:c,inFlightSelectorJobIds:p,waitingApprovalJobIds:u,inFlightSelectorColors:f,toolbarRef:z,onHoverSelector:Kr,sendHintSelector:xa,pendingBundleCount:eo,onHoverSendBundle:Zr,onSend:b?Da:void 0,onSelectSticker:Gr,onDeleteSticker:Jr,threadStates:m,onViewThread:w,hoveredElement:e?null:Ge,hoveredElementInfo:et,showHoverStyles:Jo,showHoverIdentifier:ta,hoverRailAction:Uo&&t?{compactIdentifier:!0,spotlight:!0,width:Go,render:e=>Qo?(0,Wp.jsx)(_o,{reason:Qo,layered:e}):(0,Wp.jsx)(To,{bundleCount:1,layered:e,actionLabel:"Sample",shortcut:(0,Wp.jsx)(ve,{size:12,fill:"currentColor","aria-hidden":!0}),description:"Sample a copy to place on your plane.",onSend:()=>nl(Uo,Qe.current??void 0)})}:void 0,activeCommentInput:Vr?wi:void 0,onEditComment:Na,onDeleteComment:Bi,onDeletePeerComment:C?e=>{let t=ui.current.annotations.find(t=>t.id===e);t&&uo(t,ui.current.annotations)?Bi(e):C(e)}:void 0,onDiscardPlacedSample:({selector:e,pathname:t})=>{o({type:"DISCARD_PLACED_SAMPLE",payload:{selector:e,pathname:t}}),Dr(),yn(null),xn(null),kn(!1)},onDiscardTextChanges:qi,onArchiveThread:k,onClearInteractionEpisode:ji,onEditSubject:kl,onDeleteSubject:Mu,onHoverSubjectLabel:e=>{Ke.current=e},refreshKey:Nt,activeCommentEntry:da?{element:da.element,width:Is,imageCount:Gl,trailingWidth:Fl(Gl)+wo(Pe?.interactionEpisode?.steps.length??0),render:e=>Pe&&da?(0,Wp.jsxs)(Wp.Fragment,{children:[(0,Wp.jsx)(ns,{anchor:e,insetTopLeft:rs,width:Is,height:ks,value:Pe.text,command:xs,fontSize:Pe.fontSize,prefix:Ql,inputRef:wi,inputStyle:Fs,onChange:Hl,onKeyDown:Bl,onPaste:Fe,onBlur:Oa,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),Bi(Pe.id)}}),(0,Wp.jsx)(So,{stepCount:Pe.interactionEpisode?.steps.length??0,onClear:()=>ji(Pe.id)})]}):null}:void 0}),"hand"===i.activeTool&&i.isAnnotating&&(Gi.length>0||Ji.length>0)&&(0,Wp.jsx)(cd,{styleModifications:Gi.filter(e=>{let t=An(e.selector);return!!t&&Gs(t,"pending-change")}),textModifications:Ji.filter(e=>{let t=An(e.selector);return!!t&&Gs(t,"pending-change")}),accentColor:i.activeColor}),H&&i.isAnnotating&&!Pe?.domEdit&&(()=>{let e=new Set;return Ji.flatMap(t=>{if(t.captured||e.has(t.selector))return[];let n=An(t.selector);return n&&Gs(n,"pending-change")?(e.add(t.selector),[(0,Wp.jsx)(Sa,{element:n,isSelected:!1,color:i.activeColor,hideTooltip:!0},`pending-text-change-${t.selector}`)]):[]})})(),i.isAnnotating&&!Uo&&(0,Wp.jsx)(jo,{annotations:Zi,displayAnnotations:wa,supersededAnnotations:Ro,inFlightIds:l,orientationLabels:s,activeIds:c,queuePositions:d,scrollX:Xi.x,scrollY:Xi.y,annotationGroupMap:zo,onViewThread:w,onSelectAnnotation:Oi,onDeleteDraftAnnotation:Bi,onClearInteractionEpisode:ji,onHoverAnnotation:Xr,canvasRef:Z,toolbarRef:z,activeBundleAnnotationIds:mo,inactiveBundleOpacity:yo,animateBundleOpacity:!vo&&!fo,hoverRestoredAnnotationIds:go,nestedAnnotationCountById:aa,nestedAnnotationIdsById:la,onHoverNestedAnnotations:Qr,onHoverSendBundle:Zr,onSend:b?Da:void 0,sendHintAnchorId:ka===qp?null:ka,pendingBundleCount:eo,parentPinnedAnnotationIds:mi,parentPinnedLocationLabels:lo,parentPinnedTooltipAnnotationId:so,onActivateAnnotation:ho,hiddenAnnotationIds:va}),i.isAnnotating&&(0,Wp.jsx)(Lo,{annotations:wa,activeIds:c,scrollX:Xi.x,scrollY:Xi.y,spotlightIds:vo,emphasizedIds:mo,hoverRestoredIds:go,inactiveOpacity:yo}),i.isAnnotating&&Ks&&(0,Wp.jsx)(Po,{inFlightSelectorColors:Ks,selectorElementInfo:Zs,subjectRegistry:N}),i.isAnnotating&&Qs&&(0,Wp.jsx)(Po,{inFlightSelectorColors:Qs,selectorElementInfo:Zs,animated:!1,subjectRegistry:N}),(0,Wp.jsx)(Ju,{active:"hand"===i.activeTool&&i.isAnnotating,accentColor:i.activeColor,domDropPreview:Bn,cursorViewport:Xn,gapElement:rr?Gn.current.element:Jn,gapDragging:rr,gapHoveredAxis:tr,gapIsAuto:or,gapRefreshKey:lr,swipeHint:ur,radiusElement:gr?dr.current.element:hr,radiusDragging:gr,radiusHoveredCorner:fr,textElement:kr?vr.current.element:xr,textDragging:kr,textHoveredProperty:wr,paddingElement:qn?Cn.current.element:In,paddingDragging:qn,paddingHoveredSide:$n}),!Tu&&Eu&&(0,Wp.jsx)(Ha,{entry:Eu,color:Eu.marker?.color??i.activeColor,subjectRegistry:N}),("inspector"===i.activeTool||"sticker"===i.activeTool)&&i.isAnnotating&&(0,Wp.jsx)(Wp.Fragment,{children:!e&&Ge&&(()=>{let e="sticker"===i.activeTool&&"value"===mt&&("padding"===ot||"margin"===ot)&&Wt.current?.element===Ge,t=gd("sticker"===i.activeTool,ot,mt,pt);if(Ys(Ge)||!Gs(Ge,"inspector-hover"))return null;let n=Vo||Zi.some(e=>!(!e.linkedSelector||Ro.has(e))&&bl(Qa(e.linkedSelector,e.elements),Ge,e.elements?.[0]?.context)),r=!!He||!!pn;return(0,Wp.jsxs)(Wp.Fragment,{children:[!e&&(0,Wp.jsx)(Sa,{element:Ge,isSelected:!1,elementInfo:et,color:Js,hideOutline:!Oo,hideFill:!Oo,tintHoveredSubject:!!Oo,subjectRegistry:N,refreshKey:"sticker"===i.activeTool?Nt:void 0,hideTooltip:$o||ta||n||r}),!t&&!Oo&&(0,Wp.jsx)(Fa,{element:Ge,activeFacet:"translate",accentColor:Js,showHandles:!1,outlineStyle:"dashed",refreshKey:"sticker"===i.activeTool?Nt:void 0})]})})()}),(0,Wp.jsx)(yd,{active:"sticker"===i.activeTool&&i.isAnnotating,accentColor:Js,family:ot,stage:mt,subproperty:pt,hoveredElement:Ge,previewElement:Wt.current?.element??null,transformPreviewTarget:Xt.current,previewRevision:Nt,frameListenerRef:Zt,cursorViewport:yt,drag:Pr,onGapPointerDown:jr,onRadiusPointerDown:Ir,onSpacingPointerDown:zr,onTransformPointerDown:Lr}),"sticker"===i.activeTool&&i.isAnnotating&&yt&&(0,Wp.jsx)(Rc,{cursor:yt,family:ot,step:st,subproperty:pt,stage:mt,accentColor:i.activeColor,applyPulse:Ct,contextLabelPulse:Et,depthSnapPulse:Rt,rejectPulse:It,stepUnavailable:Lt,query:Dt?{tokens:Dt.segments.flatMap((e,t)=>{let n=ch(Dt.history[t]?.scope??ih,e);return n?[hh(n)]:[]}),...ph(Dt.query,dh(Dt.scope,Dt.query))}:null,controlBounds:q,toolbarElement:z?.current,threadElement:L,annotationRailHovered:null!==gn||null!==pn||null!==vn||Sn}),!vn&&!Sn&&(Pe?.linkedSelector||Be?.linkedSelector)&&(()=>{let e=Pe?.linkedSelector||Be?.linkedSelector;if(!e)return null;let t=Qa(e,Pe?.elements??Be?.elements);return t&&Gs(t,"direct-manipulation")?(0,Wp.jsx)(Sa,{element:t,isSelected:!0,color:ua?.color??i.activeColor,hideTooltip:!0}):null})(),A&&(()=>{if(Sn)return null;let e=i.annotations.find(e=>e.id===A);if(!e?.linkedSelector||Ws===e.linkedSelector)return null;let t=Qa(e.linkedSelector,e.elements);if(!t||!Gs(t,"thread-focus"))return null;let n=!(!l||!l.has(e.id));return(0,Wp.jsx)(Sa,{element:t,isSelected:!n,color:e.color,onActivate:e.threadId?()=>ni(e.threadId):void 0,hideTooltip:!0})})(),Us&&(()=>{let e=i.annotations.find(e=>e.id===Us);if(!e?.linkedSelector)return null;let t=Qa(e.linkedSelector,e.elements);return t&&Gs(t,"annotation-hover")?(0,Wp.jsx)(Sa,{element:t,isSelected:!1,color:e.color,onActivate:e.threadId?()=>ni(e.threadId):void 0,hideTooltip:!0}):null})(),vn&&!Sn&&(()=>{let e=new Set;return vn.annotationIds.flatMap(t=>{let n=i.annotations.find(e=>e.id===t);if(!n?.linkedSelector||e.has(n.linkedSelector))return[];let r=Qa(n.linkedSelector,n.elements);return r&&Gs(r,"nested-preview")?(e.add(n.linkedSelector),[(0,Wp.jsx)(Sa,{element:r,isSelected:!1,color:n.color,hideTooltip:!0},`nested-annotation-${t}`)]):[]})})(),Sn&&(()=>{let e=[],t=new Set,n=(n,r,i,o)=>{if(!r||t.has(r))return;let a=Qa(r,i);a&&Gs(a,"bundle-preview")&&(t.add(r),e.push({id:n,element:a,color:o}))};for(let e of Zi)"pending"===(e.status??"pending")&&n(e.id,e.linkedSelector,e.elements,e.color);Pe&&!Pe.domEdit&&Pe.text.trim()&&n(qp,Pe.linkedSelector,Pe.elements,i.activeColor);for(let e of Gi)e.captured||n(`style-${e.selector}`,e.selector,[e.element],i.activeColor);for(let e of Ji)e.captured||n(`text-${e.selector}`,e.selector,[e.element],i.activeColor);return e.map(e=>(0,Wp.jsx)(Sa,{element:e.element,isSelected:!1,color:e.color,hideTooltip:!0},`send-bundle-${e.id}`))})(),gn&&(()=>{let e=An(gn);if(!e||!Gs(e,"badge-hover"))return null;let t=rl([gn],m??new Map,ma.get(gn)??i.activeColor,An);return(0,Wp.jsx)(Wp.Fragment,{children:(0,Wp.jsx)(Sa,{element:e,isSelected:!1,color:t,fillOpacity:.1,hideTooltip:!0,subjectRegistry:N})})})()]})}var Yp=c(h()),Xp=c(b()),Kp=[1,1.5,2.25,3.375,4];function Qp(e=1){let t=e,n=null,r=0,i=0,o=()=>null===n?1:n/(t??1),a=e=>Math.max(Math.min(1,o()),Math.min(4/(t??1),e)),l=new Set,s=(e,t)=>t<=1?(1-t)/2:Math.max(1-t,Math.min(0,e));function u(e,o,a){let s=1===e?null:e*(t??1);if(n!==s||r!==o||i!==a){n=s,r=o,i=a;for(let e of l)e()}}return{clampScale:a,snapshot:()=>({pageScale:n,focusX:r,focusY:i}),restore(e){if(e.pageScale!==n||e.focusX!==r||e.focusY!==i){({pageScale:n,focusX:r,focusY:i}=e);for(let e of l)e()}},getFitScale:()=>t,setFitScale(e){if(t!==e){t=e;for(let e of l)e()}},getScale:o,setScale(e){let t=a(e);u(t,1===t?0:r,1===t?0:i)},getView(e,a){let l=o(),u=(1-l)/2,c=n??t??1;return{scale:l,x:s(e>0?u-r*c/e:u,l),y:s(a>0?u-i*c/a:u,l)}},setView(e,n,r,i,o){if(!i||!o)return;let l=a(e),c=(1-l)/2,d=l*(t??1);u(l,(c-s(n,l))*i/d,(c-s(r,l))*o/d)},subscribe:e=>(l.add(e),()=>{l.delete(e)})}}function Zp({framing:e}){let t=(0,Yp.useSyncExternalStore)(e.subscribe,e.getScale,e.getScale),n=(0,Yp.useSyncExternalStore)(e.subscribe,e.getFitScale,e.getFitScale),r=null===n?[]:Kp.map(e=>e/n),i=r.find(e=>e>t)??t,o=r.filter(e=>e<t).pop()??Math.min(1,t);function a(e,r){if(null===n)return`Zoom ${e}`;let i=Math.round(n*r*100)+"%";return r===t?"out"===e?`Fit (${i})`:`Maximum zoom (${i})`:`Zoom ${e} to ${i}`}return(0,Xp.jsxs)("div",{"data-preview-zoom-controls":"",role:"group","aria-label":"Preview framing","data-popmelt-canvas-block":"",children:[(0,Xp.jsx)(je,{type:"button","aria-label":"Zoom out",hint:a("out",o),disabled:o===t,onClick:()=>e.setScale(o),children:(0,Xp.jsx)(ae,{size:14})}),(0,Xp.jsx)(je,{type:"button","aria-label":"Zoom in",hint:a("in",i),disabled:i===t,onClick:()=>e.setScale(i),children:(0,Xp.jsx)(he,{size:14})})]})}function Gp({children:e,overlay:t,interactive:n=!1,framing:r,parentGestureSurface:i}){let o=We.dark,[a]=(0,Yp.useState)(Qp),l=r??a,s=(0,Yp.useRef)(null),[u,c]=(0,Yp.useState)(),[d,h]=(0,Yp.useState)({scale:1,x:0,y:0}),p=(0,Yp.useRef)(d);return(0,Yp.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=l.getView(t.width,t.height);p.current=n,h(n)},r=()=>{c({width:e.clientWidth,height:e.clientHeight}),t()},o=l.subscribe(t);r();let a=typeof ResizeObserver<"u"?new ResizeObserver(r):void 0;a?.observe(e);let u=()=>window.matchMedia("(any-hover: hover) and (any-pointer: fine)").matches,d=t=>(i&&t.currentTarget===i?e.ownerDocument.defaultView?.frameElement:e)?.getBoundingClientRect()??e.getBoundingClientRect(),f=(t,n,r,i=e.getBoundingClientRect())=>{if(!i.width||!i.height)return;let o=p.current,a=l.clampScale(t),s=Math.max(0,Math.min(1,(n-i.left)/i.width)),u=Math.max(0,Math.min(1,(r-i.top)/i.height));l.setView(a,s-(s-o.x)*a/o.scale,u-(u-o.y)*a/o.scale,i.width,i.height)},m=null,g=t=>{if(!n&&!u()||!t.ctrlKey&&1===p.current.scale)return;t.preventDefault(),t.stopPropagation();let r=d(t),i=1===t.deltaMode?16:2===t.deltaMode?e.clientHeight:1;t.ctrlKey?null===m&&f(p.current.scale*Math.exp(-t.deltaY*i*.01),t.clientX,t.clientY,r):r.width&&r.height&&l.setView(p.current.scale,p.current.x-t.deltaX*i/r.width,p.current.y-t.deltaY*i/r.height,r.width,r.height)},y=e=>{if(!n&&!u())return;e.preventDefault(),e.stopPropagation();let t=e;if("gesturestart"===e.type)m=p.current.scale;else if("gestureend"===e.type)m=null;else if(null!==m&&Number.isFinite(t.scale)){let n=d(e);f(m*t.scale,Number.isFinite(t.clientX)?t.clientX:n.left+n.width/2,Number.isFinite(t.clientY)?t.clientY:n.top+n.height/2,n)}},v=null,x=e=>{if(2!==e.touches.length)return void(v=null);let[t,n]=[e.touches[0],e.touches[1]],r=(t.clientX+n.clientX)/2,i=(t.clientY+n.clientY)/2,o=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY);if(e.preventDefault(),"touchmove"===e.type&&null===m&&v&&v.distance>0){let t=d(e);f(p.current.scale*o/v.distance,v.x,v.y,t);let n=p.current;t.width&&t.height&&l.setView(n.scale,n.x+(r-v.x)/t.width,n.y+(i-v.y)/t.height,t.width,t.height)}v={x:r,y:i,distance:o}},b=t=>{if(p.current.scale<=1||!(t.target instanceof Element)||!t.target.closest("[data-preview-zoom-content]"))return;let n=t.target.getBoundingClientRect(),r=e.getBoundingClientRect();(n.left<r.left||n.top<r.top||n.right>r.right||n.bottom>r.bottom)&&l.setScale(1)},w=["touchstart","touchmove","touchend","touchcancel"],S=i?[e,i]:[e],k=["gesturestart","gesturechange","gestureend"];for(let e of S){if(n)for(let t of w)e.addEventListener(t,x,{passive:!1,capture:!0});e.addEventListener("wheel",g,{passive:!1,capture:n});for(let t of k)e.addEventListener(t,y,{passive:!1,capture:n})}return n&&e.addEventListener("focusin",b),()=>{for(let e of S){if(n)for(let t of w)e.removeEventListener(t,x,!0);e.removeEventListener("wheel",g,n);for(let t of k)e.removeEventListener(t,y,n)}e.removeEventListener("focusin",b),o(),a?.disconnect()}},[n,l,i]),(0,Yp.useLayoutEffect)(()=>{n&&s.current&&function(e){let t=e.ownerDocument.defaultView;t&&Go.get(t)?.schedule(),e.dispatchEvent(new Event(Jo,{bubbles:!0}))}(s.current)},[n,d,u]),(0,Xp.jsxs)("div",{ref:s,"data-preview-zoom":!0,style:{position:"relative",width:"100%",aspectRatio:n?void 0:"16 / 9",height:n?"100%":void 0,touchAction:n?"none":void 0,overflow:"hidden",borderRadius:8},children:[(0,Xp.jsx)("div",{"data-preview-zoom-content":!0,style:{width:u?.width||"100%",height:u?.height||"100%",zoom:d.scale,transformOrigin:"0 0",transform:`translate(${100*d.x/d.scale}%, ${100*d.y/d.scale}%)`},children:e}),t,n&&!r&&(0,Xp.jsx)(Zp,{framing:l}),!n&&d.scale>1&&(0,Xp.jsxs)(Xp.Fragment,{children:[(0,Xp.jsx)("style",{children:`\\n [data-preview-zoom-reset] span { color: ${o.primary}; }\\n [data-preview-zoom-reset] svg { color: ${o.secondary}; }\\n [data-preview-zoom-reset]:hover span, [data-preview-zoom-reset]:focus-visible span { color: ${o.secondary}; }\\n [data-preview-zoom-reset]:hover svg, [data-preview-zoom-reset]:focus-visible svg { color: ${o.primary}; }\\n [data-preview-zoom-reset] span, [data-preview-zoom-reset] svg { transition: color 120ms ease; }\\n `}),(0,Xp.jsxs)("button",{"data-popmelt-canvas-block":"","data-preview-zoom-reset":!0,type:"button","aria-label":"Reset preview zoom",onClick:()=>l.setScale(1),style:{position:"absolute",right:8,bottom:8,display:"inline-flex",alignItems:"center",gap:6,border:0,borderRadius:8,padding:"4px 6px 4px 10px",background:o.control,color:o.primary,fontSize:12,cursor:"pointer"},children:[(0,Xp.jsxs)("span",{children:[Math.round(100*d.scale),"%"]}),(0,Xp.jsx)(oe,{size:14,"aria-hidden":"true"})]})]})]})}var Jp=/^(?:@[a-zA-Z][\\w-]{0,63}|~?(?:0|[1-9]\\d{0,3})(?:\\.(?:0|[1-9]\\d{0,3})){0,31}|)$/;function ef(e){if(e.matches(\'svg, img, [role="img"]\'))return!0;if(e.childElementCount||"http://www.w3.org/1999/xhtml"!==e.namespaceURI)return!1;let t=e.ownerDocument.defaultView?.getComputedStyle(e).maskImage;return!!t&&"none"!==t}function tf(e){let t=e.getAttribute("data-popmelt-subject-label")||e.getAttribute("data-explore-part");if(t)return t.slice(0,80);let n=e.closest(\'button, a[href], [role="button"], [role="link"]\');if(n===e)return e.matches(\'a[href], [role="link"]\')?"link":"button";let r=e.getAttribute("aria-label");if(ef(e)){let t=r||e.getAttribute("alt")||e.querySelector(":scope > title")?.textContent;if(t)return t.slice(0,80);if(n){let t=Array.from(n.querySelectorAll("*")).filter(ef);if(t.length>1)return"icon "+(t.indexOf(e)+1)}return"icon"}let i=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join(" ").trim();return n&&i?"label":(r||i||e.localName).slice(0,80)}var nf="[modern-screenshot]",rf=typeof window<"u",of=rf&&"Worker"in window,af=(rf&&window,rf&&window,rf?window.navigator?.userAgent:""),lf=af.includes("Chrome"),sf=af.includes("AppleWebKit")&&!lf,uf=af.includes("Firefox"),cf=e=>"CSSLayerBlockRule"===e.constructor.name,df=e=>1===e.nodeType,hf=e=>"object"==typeof e.className,pf=e=>"image"===e.tagName,ff=e=>df(e)&&typeof e.style<"u"&&!hf(e),mf=e=>8===e.nodeType,gf=e=>"IMG"===e.tagName,yf=e=>"VIDEO"===e.tagName,vf=e=>"SLOT"===e.tagName;function xf(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var bf=e=>e.startsWith("data:");function wf(e,t){if(e.match(/^[a-z]+:\\/\\//i))return e;if(rf&&e.match(/^\\/\\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!rf)return e;let n=Sf().implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function Sf(e){return(e&&df(e)?e?.ownerDocument:e)??window.document}var kf="http://www.w3.org/2000/svg",Cf=e=>function(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(e)})}(e,"dataUrl");function Mf(e,t){let n=Sf(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function Ef(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},l="string"==typeof e?Mf(e,Sf(i)):e,s=null,u=null;function c(){n(l),s&&clearTimeout(s),u?.()}if(r&&(s=setTimeout(c,r)),yf(l)){let e=l.currentSrc||l.src;if(!e)return l.poster?Ef(l.poster,t).then(n):c();if(l.readyState>=2)return c();let r=c,i=t=>{a?.("Failed video load",e,t),o?.(t),c()};u=()=>{l.removeEventListener("loadeddata",r),l.removeEventListener("error",i)},l.addEventListener("loadeddata",r,{once:!0}),l.addEventListener("error",i,{once:!0})}else{let e=pf(l)?l.href.baseVal:l.currentSrc||l.src;if(!e)return c();let t=async()=>{if(gf(l)&&"decode"in l)try{await l.decode()}catch(t){a?.("Failed to decode image, trying to render anyway",l.dataset.originalSrc||e,t)}c()},n=t=>{a?.("Failed image load",l.dataset.originalSrc||e,t),c()};if(gf(l)&&l.complete)return t();u=()=>{l.removeEventListener("load",t),l.removeEventListener("error",n)},l.addEventListener("load",t,{once:!0}),l.addEventListener("error",n,{once:!0})}})}var Tf=function(){let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)}();function Af(e){return e?.split(",").map(e=>e.trim().replace(/"|\'/g,"").toLowerCase()).filter(Boolean)}var Rf=0;function jf(e){let t=`${nf}[#${Rf}]`;return Rf++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&((...e)=>console.warn(nf,...e))(...t)}}function If(e){return{cache:e?"no-cache":"force-cache"}}async function zf(e,t){return(e=>e&&"__CONTEXT__"in e)(e)?e:Lf(e,{...t,autoDestruct:!0})}async function Lf(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??!0,l=e.ownerDocument??(rf?window.document:void 0),s=e.ownerDocument?.defaultView??(rf?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:If(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:jf(o),node:e,ownerDocument:l,ownerWindow:s,dpi:1===n?null:96*n,svgStyleElement:Pf(l),svgDefsElement:l?.createElementNS(kf,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:of&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?u.get(t)?.resolve?.(n):u.get(t)?.reject?.(new Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;u.get(t)?.reject?.(new Error(`Error receiving message from worker: ${t}`))},e}catch(e){return c.log.warn("Failed to new Worker",e),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[xf(l)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:e=>"restoreScrollPosition"===e?"boolean"!=typeof a&&(a[e]??!1):"boolean"==typeof a?a:a[e]??!0,shadowRoots:[]};c.log.time("wait until load"),await async function(e,t){ff(e)&&(gf(e)||yf(e)?await Ef(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Ef(e,t)))))}(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:d,height:h}=function(e,t){let{width:n,height:r}=t;if(df(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute("width"))||0,r=r||t.height||Number(e.getAttribute("height"))||0}return{width:n,height:r}}(e,c);return c.width=d,c.height=h,c}function Pf(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode("\\n.______background-clip--text {\\n background-clip: text;\\n -webkit-background-clip: text;\\n}\\n");return t.appendChild(n),t}function Nf(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if("data:,"!==t)return Mf(t,e.ownerDocument)}catch(e){t.log.warn("Failed to clone canvas",e)}let n=e.cloneNode(!1),r=e.getContext("2d"),i=n.getContext("2d");try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn("Failed to clone canvas",e)}return n}var _f=["width","height","-webkit-text-fill-color"],Df=["stroke","fill"];function Ff(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=hf(e)&&"svg"!==i,a=o?Df.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>null!==e):[],l=[o&&"svg",i,a.map((e,t)=>`${e}=${t}`).join(","),t].filter(Boolean).join(":");if(r.has(l))return r.get(l);let s=function(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${Tf()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc=\'<!DOCTYPE html><meta charset="UTF-8"><title></title><body>\',e.sandbox=t)}catch(t){e.log.warn("Failed to getSandBox",t)}}return t}(n)?.contentWindow;if(!s)return new Map;let u,c,d=s?.document;o?(u=d.createElementNS(kf,"svg"),c=u.ownerDocument.createElementNS(u.namespaceURI,i),a.forEach(([e,t])=>{c.setAttributeNS(null,e,t)}),u.appendChild(c)):u=c=d.createElement(i),c.textContent=" ",d.body.appendChild(u);let h=s.getComputedStyle(c,t),p=new Map;for(let e=h.length,t=0;t<e;t++){let e=h.item(t);_f.includes(e)||p.set(e,h.getPropertyValue(e))}return d.body.removeChild(u),r.set(l,p),p}function Of(e,t,n){let r=new Map,i=[],o=new Map;if(n)for(let e of n)a(e);else for(let t=e.length,n=0;n<t;n++)a(e.item(n));for(let e=i.length,t=0;t<e;t++)o.get(i[t])?.forEach((e,t)=>r.set(t,e));function a(n){let a=e.getPropertyValue(n),l=e.getPropertyPriority(n),s=n.lastIndexOf("-"),u=s>-1?n.substring(0,s):void 0;if(u){let e=o.get(u);e||(e=new Map,o.set(u,e)),e.set(n,[a,l])}t.get(n)===a&&!l||(u?i.push(u):r.set(n,[a,l]))}return r}var $f=["::before","::after"],Hf=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"],Wf=new Set(["symbol"]);async function Bf(e,t,n,r,i){if(df(n)&&((e=>"STYLE"===e.tagName)(n)||(e=>"SCRIPT"===e.tagName)(n))||r.filter&&!r.filter(n))return;Wf.has(t.nodeName)||Wf.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await Uf(n,r,!1,i);r.isEnable("restoreScrollPosition")&&function(e,t){if(!ff(e)||!ff(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,o=new DOMMatrix(i),{a:a,b:l,c:s,d:u}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-r,-n),o.a=a,o.b=l,o.c=s,o.d=u,t.style.transform=o.toString()}(e,o),t.appendChild(o)}async function Vf(e,t,n,r){let i=e.firstChild;df(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!mf(o))if(df(o)&&vf(o)&&"function"==typeof o.assignedNodes){let i=o.assignedNodes();for(let o=0;o<i.length;o++)await Bf(e,t,i[o],n,r)}else await Bf(e,t,o,n,r)}var qf=/^[\\w-:]+$/;async function Uf(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:o,fontFamilies:a,onCloneEachNode:l}=t;if(i&&(e=>3===e.nodeType)(e))return r&&/\\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&o&&df(e)&&(ff(e)||hf(e))){let r=await function(e,t){return(e=>"CANVAS"===e.tagName)(e)?Nf(e,t):(e=>"IFRAME"===e.tagName)(e)?function(e,t){try{if(e?.contentDocument?.documentElement)return Uf(e.contentDocument.documentElement,t)}catch(e){t.log.warn("Failed to clone iframe",e)}return e.cloneNode(!1)}(e,t):gf(e)?function(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager"),t}(e):yf(e)?async function(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Mf(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await Ef(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Mf(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener("seeked",e,{once:!0})});let o=r.createElement("canvas");o.width=e.offsetWidth,o.height=e.offsetHeight;try{let e=o.getContext("2d");e&&e.drawImage(n,0,0,o.width,o.height)}catch(r){return t.log.warn("Failed to clone video",r),e.poster?Mf(e.poster,e.ownerDocument):n}return Nf(o,t)}return n}(e,t):e.cloneNode(!1)}(e,t);if(t.isEnable("removeAbnormalAttributes")){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];qf.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=function(e,t,n,r){let{ownerWindow:i,includeStyleProperties:o,currentParentNodeStyle:a}=r,l=t.style,s=i.getComputedStyle(e),u=Ff(e,null,r);a?.forEach((e,t)=>{u.delete(t)});let c=Of(s,u,o);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("position"),c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),"text"===c.get("background-clip")?.[0]&&t.classList.add("______background-clip--text"),lf&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),("hidden"===c.get("overflow-x")?.[0]||"hidden"===c.get("overflow-y")?.[0])&&"ellipsis"===c.get("text-overflow")?.[0]&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let e=l.length,t=0;t<e;t++)l.removeProperty(l.item(t));return c.forEach(([e,t],n)=>{l.setProperty(n,e,t)}),c}(e,r,n,t);n&&function(e,t){let{backgroundColor:n,width:r,height:i,style:o}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),o)for(let e in o)a[e]=o[e]}(r,t);let o=!1;if(t.isEnable("copyScrollbar")){let t=[i.get("overflow-x")?.[0],i.get("overflow-y")?.[0]];o=t.includes("scroll")||(t.includes("auto")||t.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let s=i.get("text-transform")?.[0],u=Af(i.get("font-family")?.[0]),c=u?e=>{"uppercase"===s?e=e.toUpperCase():"lowercase"===s?e=e.toLowerCase():"capitalize"===s&&(e=e[0].toUpperCase()+e.substring(1)),u.forEach(t=>{let n=a.get(t);n||a.set(t,n=new Set),e.split("").forEach(e=>n.add(e))})}:void 0;return function(e,t,n,r,i){let{ownerWindow:o,svgStyleElement:a,svgStyles:l,currentNodeStyle:s}=r;function u(n){let a=o.getComputedStyle(e,n),u=a.getPropertyValue("content");if(!u||"none"===u)return;i?.(u),u=u.replace(/(\')|(")|(counter\\(.+\\))/g,"");let c=[Tf()],d=Ff(e,n,r);s?.forEach((e,t)=>{d.delete(t)});let h=Of(a,d,r.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),"text"===h.get("background-clip")?.[0]&&t.classList.add("______background-clip--text");let p=[`content: \'${u}\';`];if(h.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?" !important":""};`)}),1===p.length)return;try{t.className=[t.className,...c].join(" ")}catch(e){return void r.log.warn("Failed to copyPseudoClass",e)}let f=p.join("\\n "),m=l.get(f);m||(m=[],l.set(f,m)),m.push(`.${c[0]}${n}`)}a&&o&&($f.forEach(u),n&&Hf.forEach(u))}(e,r,o,t,c),function(e,t){((e=>"TEXTAREA"===e.tagName)(e)||(e=>"INPUT"===e.tagName)(e)||(e=>"SELECT"===e.tagName)(e))&&t.setAttribute("value",e.value)}(e,r),yf(e)||await Vf(e,r,t,c),await(l?.(r)),r}let s=e.cloneNode(!1);return await Vf(e,s,t),await(l?.(s)),s}function Yf(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn("Failed to destroyContext",t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function Xf(e,t){let{url:n,requestType:r="text",responseType:i="text",imageDom:o}=t,a=n,{timeout:l,acceptOfImage:s,requests:u,fetchFn:c,fetch:{requestInit:d,bypassingCache:h,placeholderImage:p},font:f,workers:m,fontFamilies:g}=e;"image"===r&&(sf||uf)&&e.drawImageCount++;let y=u.get(n);if(!y){h&&h instanceof RegExp&&h.test(a)&&(a+=(/\\?/.test(a)?"&":"?")+(new Date).getTime());let t=r.startsWith("font")&&f&&f.minify,v=new Set;t&&r.split(";")[1].split(",").forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let x=t&&v.size,b={url:a,timeout:l,responseType:x?"arrayBuffer":i,headers:"image"===r?{accept:s}:void 0,...d};y={type:r,resolve:void 0,reject:void 0,response:null},y.response=(async()=>{if(c&&"image"===r){let e=await c(n);if(e)return e}return!sf&&n.startsWith("http")&&m.length?new Promise((e,t)=>{m[u.size&m.length-1].postMessage({rawUrl:n,...b}),y.resolve=e,y.reject=t}):function(e){let{url:t,timeout:n,responseType:r,...i}=e,o=new AbortController,a=n?setTimeout(()=>o.abort(),n):void 0;return fetch(t,{signal:o.signal,...i}).then(e=>{if(!e.ok)throw new Error("Failed fetch, not 2xx response",{cause:e});switch(r){case"arrayBuffer":return e.arrayBuffer();case"dataUrl":return e.blob().then(Cf);default:return e.text()}}).finally(()=>clearTimeout(a))}(b)})().catch(t=>{if(u.delete(n),"image"===r&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),"string"==typeof p?p:p(o);throw t}),u.set(n,y)}return y.response}async function Kf(e,t,n,r){if(!Qf(e))return e;for(let[i,o]of function(e,t){let n=[];return e.replace(Zf,(e,r,i)=>(n.push([i,wf(i,t)]),e)),n.filter(([e])=>!bf(e))}(e,t))try{let t=await Xf(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(Gf(i),`$1${t}$3`)}catch(e){n.log.warn("Failed to fetch css data url",i,e)}return e}function Qf(e){return/url\\(([\'"]?)([^\'"]+?)\\1\\)/.test(e)}var Zf=/url\\(([\'"]?)([^\'"]+?)\\1\\)/g;function Gf(e){let t=e.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g,"\\\\$1");return new RegExp(`(url\\\\([\'"]?)(${t})([\'"]?\\\\))`,"g")}var Jf=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function em(e,t){let{tasks:n}=t;df(e)&&((gf(e)||pf(e))&&n.push(...function(e,t){if(gf(e)){let n=e.currentSrc||e.src;if(!bf(n))return[Xf(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(t=>{t&&(e.srcset="",e.dataset.originalSrc=n,e.src=t||"")})];(sf||uf)&&t.drawImageCount++}else if(hf(e)&&!bf(e.href.baseVal)){let n=e.href.baseVal;return[Xf(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||"")})]}return[]}(e,t)),(e=>"use"===e.tagName)(e)&&n.push(...function(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute("href")??e.getAttribute("xlink:href");if(!i)return[];let[o,a]=i.split("#");if(a){let i=`#${a}`,l=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(o&&e.setAttribute("href",i),r?.querySelector(i))return[];if(l)return r?.appendChild(l.cloneNode(!0)),[];if(o)return[Xf(t,{url:o,responseType:"text"}).then(e=>{r?.insertAdjacentHTML("beforeend",e)})]}return[]}(e,t))),ff(e)&&n.push(...function(e,t){return Jf.map(n=>{let r=e.getPropertyValue(n);return r&&"none"!==r?((sf||uf)&&t.drawImageCount++,Kf(r,null,t,!0).then(t=>{!t||r===t||e.setProperty(n,t,e.getPropertyPriority(n))})):null}).filter(Boolean)}(e.style,t)),e.childNodes.forEach(e=>{em(e,t)})}async function tm(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:o,tasks:a,font:l}=t;if(n&&r&&i.size)if(l&&l.cssText){let e=am(l.cssText,t);r.appendChild(n.createTextNode(`${e}\\n`))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return"cssRules"in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),l=n.implementation.createHTMLDocument(""),s=l.createElement("style");l.head.appendChild(s);let u=s.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if((e=>"CSSImportRule"===e.constructor.name)(e)){let n=e.href,r="";try{r=await Xf(t,{url:n,requestType:"text",responseType:"text"})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(Zf,(e,t,r)=>e.replace(r,wf(r,n)));for(let e of function(e){if(null==e)return[];let t=[],n=e.replace(nm,"");for(;;){let e=rm.exec(n);if(!e)break;t.push(e[0])}n=n.replace(rm,"");let r=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,i=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else{if(e=i.exec(n),!e)break;r.lastIndex=i.lastIndex}t.push(e[0])}return t}(i))try{u.insertRule(e,u.cssRules.length)}catch(n){t.log.warn("Error inserting rule from remote css import",{rule:e,error:n})}}}))),u.cssRules.length&&e.push(u);let c=[];e.forEach(e=>{lm(e.cssRules,c)}),c.filter(e=>(e=>"CSSFontFaceRule"===e.constructor.name)(e)&&Qf(e.style.getPropertyValue("src"))&&Af(e.style.getPropertyValue("font-family"))?.some(e=>i.has(e))).forEach(e=>{let i=e,l=o.get(i.cssText);l?r.appendChild(n.createTextNode(`${l}\\n`)):a.push(Kf(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=am(e,t),o.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}\\n`))}))})}}var nm=/(\\/\\*[\\s\\S]*?\\*\\/)/g,rm=/((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})/gi,im=/url\\([^)]+\\)\\s*format\\((["\']?)([^"\']+)\\1\\)/g,om=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function am(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(om,e=>{for(;;){let[t,,n]=im.exec(e)||[];if(!n)return"";if(n===r)return`src: ${t};`}}):e}function lm(e,t=[]){for(let n of Array.from(e))cf(n)?t.push(...lm(n.cssRules)):"cssRules"in n?lm(n.cssRules,t):t.push(n);return t}var sm=/\\bx?link:?href\\s*=\\s*["\'](?!data:)[^"\']+["\']/i;async function um(e,t){let n=await zf(e,t);if(df(n.node)&&hf(n.node)&&!function(e){return sm.test(e.innerHTML)}(n.node))return n.node;let{ownerDocument:r,log:i,tasks:o,svgStyleElement:a,svgDefsElement:l,svgStyles:s,font:u,progress:c,autoDestruct:d,onCloneNode:h,onEmbedNode:p,onCreateForeignObjectSvg:f}=n;i.time("clone node");let m=await Uf(n.node,n,!0);if(a&&r){let e="";s.forEach((t,n)=>{e+=`${t.join(",\\n")} {\\n ${n}\\n}\\n`}),a.appendChild(r.createTextNode(e))}i.timeEnd("clone node"),await(h?.(m)),!1!==u&&df(m)&&(i.time("embed web font"),await tm(0,n),i.timeEnd("embed web font")),i.time("embed node"),em(m,n);let g=o.length,y=0;c?.(y,g),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){let e=o.pop();if(!e)break;try{await e}catch(e){n.log.warn("Failed to run task",e)}c?.(++y,g)}})),i.timeEnd("embed node"),await(p?.(m));let v=function(e,t){let{width:n,height:r}=t,i=function(e,t,n){let r=Sf(n).createElementNS(kf,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}(n,r,e.ownerDocument),o=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(e),i.appendChild(o),i}(m,n);return l&&v.insertBefore(l,v.children[0]),a&&v.insertBefore(a,v.children[0]),d&&Yf(n),await(f?.(v)),v}async function cm(e,t){let n=await zf(e,t),r=await um(n),i=function(e,t){let n=(new XMLSerializer).serializeToString(e);return t&&(n=n.replace(/[\\u0000-\\u0008\\v\\f\\u000E-\\u001F\\uD800-\\uDFFF\\uFFFE\\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=Pf(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(kf,"defs"),n.svgStyles.clear());let o=Mf(i,r.ownerDocument);return await async function(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:o}=t;n.time("image to canvas");let a=await Ef(e,{timeout:r,onWarn:t.log.warn}),{canvas:l,context2d:s}=function(e,t){let{width:n,height:r,scale:i,backgroundColor:o,maximumCanvasSize:a}=t,l=e.createElement("canvas");l.width=Math.floor(n*i),l.height=Math.floor(r*i),l.style.width=`${n}px`,l.style.height=`${r}px`,a&&(l.width>a||l.height>a)&&(l.width>a&&l.height>a?l.width>l.height?(l.height*=a/l.width,l.width=a):(l.width*=a/l.height,l.height=a):l.width>a?(l.height*=a/l.width,l.width=a):(l.width*=a/l.height,l.height=a));let s=l.getContext("2d");return s&&o&&(s.fillStyle=o,s.fillRect(0,0,l.width,l.height)),{canvas:l,context2d:s}}(e.ownerDocument,t),u=()=>{try{s?.drawImage(a,0,0,l.width,l.height)}catch(e){t.log.warn("Failed to drawImage",e)}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{s?.clearRect(0,0,l.width,l.height),u(),t()},e+o)});return t.drawImageCount=0,n.timeEnd("image to canvas"),l}(o,n)}var dm=c(h()),hm=1001,pm=1006,fm="srgb",mm="srgb-linear",gm="linear",ym="srgb",vm=7680,xm=2e3,bm=2001;function wm(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var Sm={};function km(e){let t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){let t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]=\'Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.\'}return e}function Cm(...e){let t="THREE."+(e=km(e)).shift();{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function Mm(...e){let t=e.join(" ");t in Sm||(Sm[t]=!0,Cm(...e))}var Em=class{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let r=n[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Tm=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function Am(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Tm[255&e]+Tm[e>>8&255]+Tm[e>>16&255]+Tm[e>>24&255]+"-"+Tm[255&t]+Tm[t>>8&255]+"-"+Tm[t>>16&15|64]+Tm[t>>24&255]+"-"+Tm[63&n|128]+Tm[n>>8&255]+"-"+Tm[n>>16&255]+Tm[n>>24&255]+Tm[255&r]+Tm[r>>8&255]+Tm[r>>16&255]+Tm[r>>24&255]).toLowerCase()}function Rm(e,t,n){return Math.max(t,Math.min(n,e))}function jm(e,t,n){return(1-n)*e+n*t}Math.PI,Math.PI;var Im=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Rm(this.x,e.x,t.x),this.y=Rm(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Rm(this.x,e,t),this.y=Rm(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Rm(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Rm(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},zm=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,o,a){let l=n[r+0],s=n[r+1],u=n[r+2],c=n[r+3],d=i[o+0],h=i[o+1],p=i[o+2],f=i[o+3];if(c!==f||l!==d||s!==h||u!==p){let e=l*d+s*h+u*p+c*f;e<0&&(d=-d,h=-h,p=-p,f=-f,e=-e);let t=1-a;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,l=l*t+d*(a=Math.sin(a*n)/r),s=s*t+h*a,u=u*t+p*a,c=c*t+f*a}else{l=l*t+d*a,s=s*t+h*a,u=u*t+p*a,c=c*t+f*a;let e=1/Math.sqrt(l*l+s*s+u*u+c*c);l*=e,s*=e,u*=e,c*=e}}e[t]=l,e[t+1]=s,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,o){let a=n[r],l=n[r+1],s=n[r+2],u=n[r+3],c=i[o],d=i[o+1],h=i[o+2],p=i[o+3];return e[t]=a*p+u*c+l*h-s*d,e[t+1]=l*p+u*d+s*c-a*h,e[t+2]=s*p+u*h+a*d-l*c,e[t+3]=u*p-a*c-l*d-s*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,o=e._order,a=Math.cos,l=Math.sin,s=a(n/2),u=a(r/2),c=a(i/2),d=l(n/2),h=l(r/2),p=l(i/2);switch(o){case"XYZ":this._x=d*u*c+s*h*p,this._y=s*h*c-d*u*p,this._z=s*u*p+d*h*c,this._w=s*u*c-d*h*p;break;case"YXZ":this._x=d*u*c+s*h*p,this._y=s*h*c-d*u*p,this._z=s*u*p-d*h*c,this._w=s*u*c+d*h*p;break;case"ZXY":this._x=d*u*c-s*h*p,this._y=s*h*c+d*u*p,this._z=s*u*p+d*h*c,this._w=s*u*c-d*h*p;break;case"ZYX":this._x=d*u*c-s*h*p,this._y=s*h*c+d*u*p,this._z=s*u*p-d*h*c,this._w=s*u*c+d*h*p;break;case"YZX":this._x=d*u*c+s*h*p,this._y=s*h*c+d*u*p,this._z=s*u*p-d*h*c,this._w=s*u*c-d*h*p;break;case"XZY":this._x=d*u*c-s*h*p,this._y=s*h*c-d*u*p,this._z=s*u*p+d*h*c,this._w=s*u*c+d*h*p;break;default:Cm("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],a=t[5],l=t[9],s=t[2],u=t[6],c=t[10],d=n+a+c;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(u-l)*e,this._y=(i-s)*e,this._z=(o-r)*e}else if(n>a&&n>c){let e=2*Math.sqrt(1+n-a-c);this._w=(u-l)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+s)/e}else if(a>c){let e=2*Math.sqrt(1+a-n-c);this._w=(i-s)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(l+u)/e}else{let e=2*Math.sqrt(1+c-n-a);this._w=(o-r)/e,this._x=(i+s)/e,this._y=(l+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Rm(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,l=t._y,s=t._z,u=t._w;return this._x=n*u+o*a+r*s-i*l,this._y=r*u+o*l+i*a-n*s,this._z=i*u+o*s+n*l-r*a,this._w=o*u-n*a-r*l-i*s,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,i=-i,o=-o,a=-a);let l=1-t;if(a<.9995){let e=Math.acos(a),s=Math.sin(e);l=Math.sin(l*e)/s,t=Math.sin(t*e)/s,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+i*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+i*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Lm=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Nm.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nm.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,l=e.w,s=2*(o*r-a*n),u=2*(a*t-i*r),c=2*(i*n-o*t);return this.x=t+l*s+o*c-a*u,this.y=n+l*u+a*s-i*c,this.z=r+l*c+i*u-o*s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Rm(this.x,e.x,t.x),this.y=Rm(this.y,e.y,t.y),this.z=Rm(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Rm(this.x,e,t),this.y=Rm(this.y,e,t),this.z=Rm(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Rm(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-i*a,this.y=i*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Pm.copy(this).projectOnVector(e),this.sub(Pm)}reflect(e){return this.sub(Pm.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Rm(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Pm=new Lm,Nm=new zm,_m=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,o,a,l,s){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,o,a,l,s)}set(e,t,n,r,i,o,a,l,s){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=i,u[5]=l,u[6]=n,u[7]=o,u[8]=s,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[3],l=n[6],s=n[1],u=n[4],c=n[7],d=n[2],h=n[5],p=n[8],f=r[0],m=r[3],g=r[6],y=r[1],v=r[4],x=r[7],b=r[2],w=r[5],S=r[8];return i[0]=o*f+a*y+l*b,i[3]=o*m+a*v+l*w,i[6]=o*g+a*x+l*S,i[1]=s*f+u*y+c*b,i[4]=s*m+u*v+c*w,i[7]=s*g+u*x+c*S,i[2]=d*f+h*y+p*b,i[5]=d*m+h*v+p*w,i[8]=d*g+h*x+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],l=e[6],s=e[7],u=e[8];return t*o*u-t*a*s-n*i*u+n*a*l+r*i*s-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],l=e[6],s=e[7],u=e[8],c=u*o-a*s,d=a*l-u*i,h=s*i-o*l,p=t*c+n*d+r*h;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*s-u*n)*f,e[2]=(a*n-r*o)*f,e[3]=d*f,e[4]=(u*t-r*l)*f,e[5]=(r*i-a*t)*f,e[6]=h*f,e[7]=(n*l-s*t)*f,e[8]=(o*t-n*i)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,o,a){let l=Math.cos(i),s=Math.sin(i);return this.set(n*l,n*s,-n*(l*o+s*a)+o+e,-r*s,r*l,-r*(-s*o+l*a)+a+t,0,0,1),this}scale(e,t){return Mm("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Dm.makeScale(e,t)),this}rotate(e){return Mm("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Dm.makeRotation(-e)),this}translate(e,t){return Mm("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Dm.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}},Dm=new _m,Fm=(new _m).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Om=(new _m).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),$m=function(){let e={enabled:!0,workingColorSpace:mm,spaces:{},convert:function(e,t,n){return!1===this.enabled||t===n||!t||!n||(this.spaces[t].transfer===ym&&(e.r=Hm(e.r),e.g=Hm(e.g),e.b=Hm(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===ym&&(e.r=Wm(e.r),e.g=Wm(e.g),e.b=Wm(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?gm:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Mm("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Mm("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[mm]:{primaries:t,whitePoint:r,transfer:gm,toXYZ:Fm,fromXYZ:Om,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:fm},outputColorSpaceConfig:{drawingBufferColorSpace:fm}},[fm]:{primaries:t,whitePoint:r,transfer:ym,toXYZ:Fm,fromXYZ:Om,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:fm}}}),e}();function Hm(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Wm(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Bm,Vm=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{void 0===Bm&&(Bm=wm("canvas")),Bm.width=e.width,Bm.height=e.height;let t=Bm.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Bm}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=wm("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=255*Hm(i[e]/255);return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*Hm(t[e]/255)):t[e]=Hm(t[e]);return{data:t,width:e.width,height:e.height}}return Cm("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},qm=0,Um=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qm++}),this.uuid=Am(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Ym(r[t].image)):e.push(Ym(r[t]))}else e=Ym(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function Ym(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Vm.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(Cm("Texture: Unable to serialize Texture."),{})}var Xm=0,Km=new Lm,Qm=class e extends Em{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=hm,i=hm,o=pm,a=1008,l=1023,s=1009,u=e.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Xm++}),this.uuid=Am(),this.name="",this.source=new Um(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=o,this.minFilter=a,this.anisotropy=u,this.format=l,this.internalFormat=null,this.type=s,this.offset=new Im(0,0),this.repeat=new Im(1,1),this.center=new Im(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _m,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Km).x}get height(){return this.source.getSize(Km).y}get depth(){return this.source.getSize(Km).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){Cm(`Texture.setValues(): parameter \'${t}\' has value of undefined.`);continue}let r=this[t];void 0!==r?r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n:Cm(`Texture.setValues(): property \'${t}\' does not exist.`)}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case hm:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case hm:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}};Qm.DEFAULT_IMAGE=null,Qm.DEFAULT_MAPPING=300,Qm.DEFAULT_ANISOTROPY=1;var Zm=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,o=e.elements,a=o[0],l=o[4],s=o[8],u=o[1],c=o[5],d=o[9],h=o[2],p=o[6],f=o[10];if(Math.abs(l-u)<.01&&Math.abs(s-h)<.01&&Math.abs(d-p)<.01){if(Math.abs(l+u)<.1&&Math.abs(s+h)<.1&&Math.abs(d+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let e=(a+1)/2,o=(c+1)/2,m=(f+1)/2,g=(l+u)/4,y=(s+h)/4,v=(d+p)/4;return e>o&&e>m?e<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=g/n,i=y/n):o>m?o<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(o),n=g/r,i=v/r):m<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(m),n=y/i,r=v/i),this.set(n,r,i,t),this}let m=Math.sqrt((p-d)*(p-d)+(s-h)*(s-h)+(u-l)*(u-l));return Math.abs(m)<.001&&(m=1),this.x=(p-d)/m,this.y=(s-h)/m,this.z=(u-l)/m,this.w=Math.acos((a+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Rm(this.x,e.x,t.x),this.y=Rm(this.y,e.y,t.y),this.z=Rm(this.z,e.z,t.z),this.w=Rm(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Rm(this.x,e,t),this.y=Rm(this.y,e,t),this.z=Rm(this.z,e,t),this.w=Rm(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Rm(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Gm=class extends Em{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pm,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Zm(0,0,e,t),this.scissorTest=!1,this.viewport=new Zm(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},i=new Qm(r),o=n.count;for(let e=0;e<o;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:pm,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,!0!==this.textures[r].isData3DTexture&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new Um(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Jm=class extends Gm{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},eg=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m)}set(e,t,n,r,i,o,a,l,s,u,c,d,h,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=l,g[2]=s,g[6]=u,g[10]=c,g[14]=d,g[3]=h,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new e).fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinantAffine()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinantAffine())return this.identity();let t=this.elements,n=e.elements,r=1/tg.setFromMatrixColumn(e,0).length(),i=1/tg.setFromMatrixColumn(e,1).length(),o=1/tg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),s=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=o*u,n=o*c,r=a*u,i=a*c;t[0]=l*u,t[4]=-l*c,t[8]=s,t[1]=n+r*s,t[5]=e-i*s,t[9]=-a*l,t[2]=i-e*s,t[6]=r+n*s,t[10]=o*l}else if("YXZ"===e.order){let e=l*u,n=l*c,r=s*u,i=s*c;t[0]=e+i*a,t[4]=r*a-n,t[8]=o*s,t[1]=o*c,t[5]=o*u,t[9]=-a,t[2]=n*a-r,t[6]=i+e*a,t[10]=o*l}else if("ZXY"===e.order){let e=l*u,n=l*c,r=s*u,i=s*c;t[0]=e-i*a,t[4]=-o*c,t[8]=r+n*a,t[1]=n+r*a,t[5]=o*u,t[9]=i-e*a,t[2]=-o*s,t[6]=a,t[10]=o*l}else if("ZYX"===e.order){let e=o*u,n=o*c,r=a*u,i=a*c;t[0]=l*u,t[4]=r*s-n,t[8]=e*s+i,t[1]=l*c,t[5]=i*s+e,t[9]=n*s-r,t[2]=-s,t[6]=a*l,t[10]=o*l}else if("YZX"===e.order){let e=o*l,n=o*s,r=a*l,i=a*s;t[0]=l*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=o*u,t[9]=-a*u,t[2]=-s*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=o*l,n=o*s,r=a*l,i=a*s;t[0]=l*u,t[4]=-c,t[8]=s*u,t[1]=e*c+i,t[5]=o*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=a*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rg,e,ig)}lookAt(e,t,n){let r=this.elements;return lg.subVectors(e,t),0===lg.lengthSq()&&(lg.z=1),lg.normalize(),og.crossVectors(n,lg),0===og.lengthSq()&&(1===Math.abs(n.z)?lg.x+=1e-4:lg.z+=1e-4,lg.normalize(),og.crossVectors(n,lg)),og.normalize(),ag.crossVectors(lg,og),r[0]=og.x,r[4]=ag.x,r[8]=lg.x,r[1]=og.y,r[5]=ag.y,r[9]=lg.y,r[2]=og.z,r[6]=ag.z,r[10]=lg.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],l=n[8],s=n[12],u=n[1],c=n[5],d=n[9],h=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],v=n[7],x=n[11],b=n[15],w=r[0],S=r[4],k=r[8],C=r[12],M=r[1],E=r[5],T=r[9],A=r[13],R=r[2],j=r[6],I=r[10],z=r[14],L=r[3],P=r[7],N=r[11],_=r[15];return i[0]=o*w+a*M+l*R+s*L,i[4]=o*S+a*E+l*j+s*P,i[8]=o*k+a*T+l*I+s*N,i[12]=o*C+a*A+l*z+s*_,i[1]=u*w+c*M+d*R+h*L,i[5]=u*S+c*E+d*j+h*P,i[9]=u*k+c*T+d*I+h*N,i[13]=u*C+c*A+d*z+h*_,i[2]=p*w+f*M+m*R+g*L,i[6]=p*S+f*E+m*j+g*P,i[10]=p*k+f*T+m*I+g*N,i[14]=p*C+f*A+m*z+g*_,i[3]=y*w+v*M+x*R+b*L,i[7]=y*S+v*E+x*j+b*P,i[11]=y*k+v*T+x*I+b*N,i[15]=y*C+v*A+x*z+b*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],a=e[5],l=e[9],s=e[13],u=e[2],c=e[6],d=e[10],h=e[14],p=e[3],f=e[7],m=e[11],g=e[15],y=l*h-s*d,v=a*h-s*c,x=a*d-l*c,b=o*h-s*u,w=o*d-l*u,S=o*c-a*u;return t*(f*y-m*v+g*x)-n*(p*y-m*b+g*w)+r*(p*v-f*b+g*S)-i*(p*x-f*w+m*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],o=e[5],a=e[9],l=e[2],s=e[6],u=e[10];return t*(o*u-a*s)-n*(i*u-a*l)+r*(i*s-o*l)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],l=e[6],s=e[7],u=e[8],c=e[9],d=e[10],h=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=t*a-n*o,v=t*l-r*o,x=t*s-i*o,b=n*l-r*a,w=n*s-i*a,S=r*s-i*l,k=u*f-c*p,C=u*m-d*p,M=u*g-h*p,E=c*m-d*f,T=c*g-h*f,A=d*g-h*m,R=y*A-v*T+x*E+b*M-w*C+S*k;if(0===R)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/R;return e[0]=(a*A-l*T+s*E)*j,e[1]=(r*T-n*A-i*E)*j,e[2]=(f*S-m*w+g*b)*j,e[3]=(d*w-c*S-h*b)*j,e[4]=(l*M-o*A-s*C)*j,e[5]=(t*A-r*M+i*C)*j,e[6]=(m*x-p*S-g*v)*j,e[7]=(u*S-d*x+h*v)*j,e[8]=(o*T-a*M+s*k)*j,e[9]=(n*M-t*T-i*k)*j,e[10]=(p*w-f*x+g*y)*j,e[11]=(c*x-u*w-h*y)*j,e[12]=(a*C-o*E-l*k)*j,e[13]=(t*E-n*C+r*k)*j,e[14]=(f*v-p*b-m*y)*j,e[15]=(u*b-c*v+d*y)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,a=e.y,l=e.z,s=i*o,u=i*a;return this.set(s*o+n,s*a-r*l,s*l+r*a,0,s*a+r*l,u*a+n,u*l-r*o,0,s*l-r*a,u*l+r*o,i*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,o){return this.set(1,n,i,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,o=t._y,a=t._z,l=t._w,s=i+i,u=o+o,c=a+a,d=i*s,h=i*u,p=i*c,f=o*u,m=o*c,g=a*c,y=l*s,v=l*u,x=l*c,b=n.x,w=n.y,S=n.z;return r[0]=(1-(f+g))*b,r[1]=(h+x)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(h-x)*w,r[5]=(1-(d+g))*w,r[6]=(m+y)*w,r[7]=0,r[8]=(p+v)*S,r[9]=(m-y)*S,r[10]=(1-(d+f))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(0===i)return n.set(1,1,1),t.identity(),this;let o=tg.set(r[0],r[1],r[2]).length(),a=tg.set(r[4],r[5],r[6]).length(),l=tg.set(r[8],r[9],r[10]).length();i<0&&(o=-o),ng.copy(this);let s=1/o,u=1/a,c=1/l;return ng.elements[0]*=s,ng.elements[1]*=s,ng.elements[2]*=s,ng.elements[4]*=u,ng.elements[5]*=u,ng.elements[6]*=u,ng.elements[8]*=c,ng.elements[9]*=c,ng.elements[10]*=c,t.setFromRotationMatrix(ng),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,i,o,a=xm,l=!1){let s,u,c=this.elements,d=2*i/(t-e),h=2*i/(n-r),p=(t+e)/(t-e),f=(n+r)/(n-r);if(l)s=i/(o-i),u=o*i/(o-i);else if(a===xm)s=-(o+i)/(o-i),u=-2*o*i/(o-i);else{if(a!==bm)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);s=-o/(o-i),u=-o*i/(o-i)}return c[0]=d,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=h,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=s,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,o,a=xm,l=!1){let s,u,c=this.elements,d=2/(t-e),h=2/(n-r),p=-(t+e)/(t-e),f=-(n+r)/(n-r);if(l)s=1/(o-i),u=o/(o-i);else if(a===xm)s=-2/(o-i),u=-(o+i)/(o-i);else{if(a!==bm)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);s=-1/(o-i),u=-i/(o-i)}return c[0]=d,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=h,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=s,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},tg=new Lm,ng=new eg,rg=new Lm(0,0,0),ig=new Lm(1,1,1),og=new Lm,ag=new Lm,lg=new Lm,sg=new eg,ug=new zm,cg=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],o=r[4],a=r[8],l=r[1],s=r[5],u=r[9],c=r[2],d=r[6],h=r[10];switch(t){case"XYZ":this._y=Math.asin(Rm(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(d,s),this._z=0);break;case"YXZ":this._x=Math.asin(-Rm(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,s)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Rm(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,h),this._z=Math.atan2(-o,s)):(this._y=0,this._z=Math.atan2(l,i));break;case"ZYX":this._y=Math.asin(-Rm(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(l,i)):(this._x=0,this._z=Math.atan2(-o,s));break;case"YZX":this._z=Math.asin(Rm(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,s),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-Rm(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,s),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-u,h),this._y=0);break;default:Cm("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return sg.makeRotationFromQuaternion(e),this.setFromRotationMatrix(sg,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ug.setFromEuler(this),this.setFromQuaternion(ug,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};cg.DEFAULT_ORDER="XYZ";var dg=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}},hg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pg={h:0,s:0,l:0},fg={h:0,s:0,l:0};function mg(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var gg=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){let t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=fm){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,$m.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=$m.workingColorSpace){return this.r=e,this.g=t,this.b=n,$m.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=$m.workingColorSpace){if(e=(e%1+1)%1,t=Rm(t,0,1),n=Rm(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=mg(i,r,e+1/3),this.g=mg(i,r,e),this.b=mg(i,r,e-1/3)}return $m.colorSpaceToWorking(this,r),this}setStyle(e,t=fm){function n(t){void 0!==t&&parseFloat(t)<1&&Cm("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let i,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(i=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:Cm("Color: Unknown color model "+e)}}else if(r=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let n=r[1],i=n.length;if(3===i)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===i)return this.setHex(parseInt(n,16),t);Cm("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=fm){let n=hg[e.toLowerCase()];return void 0!==n?this.setHex(n,t):Cm("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Hm(e.r),this.g=Hm(e.g),this.b=Hm(e.b),this}copyLinearToSRGB(e){return this.r=Wm(e.r),this.g=Wm(e.g),this.b=Wm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=fm){return $m.workingToColorSpace(yg.copy(this),e),65536*Math.round(Rm(255*yg.r,0,255))+256*Math.round(Rm(255*yg.g,0,255))+Math.round(Rm(255*yg.b,0,255))}getHexString(e=fm){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$m.workingColorSpace){$m.workingToColorSpace(yg.copy(this),t);let n,r,i=yg.r,o=yg.g,a=yg.b,l=Math.max(i,o,a),s=Math.min(i,o,a),u=(s+l)/2;if(s===l)n=0,r=0;else{let e=l-s;switch(r=u<=.5?e/(l+s):e/(2-l-s),l){case i:n=(o-a)/e+(o<a?6:0);break;case o:n=(a-i)/e+2;break;case a:n=(i-o)/e+4}n/=6}return e.h=n,e.s=r,e.l=u,e}getRGB(e,t=$m.workingColorSpace){return $m.workingToColorSpace(yg.copy(this),t),e.r=yg.r,e.g=yg.g,e.b=yg.b,e}getStyle(e=fm){$m.workingToColorSpace(yg.copy(this),e);let t=yg.r,n=yg.g,r=yg.b;return e!==fm?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*r)})`}offsetHSL(e,t,n){return this.getHSL(pg),this.setHSL(pg.h+e,pg.s+t,pg.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(pg),e.getHSL(fg);let n=jm(pg.h,fg.h,t),r=jm(pg.s,fg.s,t),i=jm(pg.l,fg.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},yg=new gg;gg.NAMES=hg;var vg=class{constructor(e=new Lm(1/0,1/0,1/0),t=new Lm(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(bg.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(bg.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=bg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,bg):bg.fromBufferAttribute(r,t),bg.applyMatrix4(e.matrixWorld),this.expandByPoint(bg);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),wg.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),wg.copy(n.boundingBox)),wg.applyMatrix4(e.matrixWorld),this.union(wg)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,bg),bg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ag),Rg.subVectors(this.max,Ag),Sg.subVectors(e.a,Ag),kg.subVectors(e.b,Ag),Cg.subVectors(e.c,Ag),Mg.subVectors(kg,Sg),Eg.subVectors(Cg,kg),Tg.subVectors(Sg,Cg);let t=[0,-Mg.z,Mg.y,0,-Eg.z,Eg.y,0,-Tg.z,Tg.y,Mg.z,0,-Mg.x,Eg.z,0,-Eg.x,Tg.z,0,-Tg.x,-Mg.y,Mg.x,0,-Eg.y,Eg.x,0,-Tg.y,Tg.x,0];return!(!zg(t,Sg,kg,Cg,Rg)||(t=[1,0,0,0,1,0,0,0,1],!zg(t,Sg,kg,Cg,Rg)))&&(jg.crossVectors(Mg,Eg),t=[jg.x,jg.y,jg.z],zg(t,Sg,kg,Cg,Rg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,bg).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(bg).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(xg[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xg[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xg[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xg[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xg[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xg[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xg[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xg[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xg)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},xg=[new Lm,new Lm,new Lm,new Lm,new Lm,new Lm,new Lm,new Lm],bg=new Lm,wg=new vg,Sg=new Lm,kg=new Lm,Cg=new Lm,Mg=new Lm,Eg=new Lm,Tg=new Lm,Ag=new Lm,Rg=new Lm,jg=new Lm,Ig=new Lm;function zg(e,t,n,r,i){for(let o=0,a=e.length-3;o<=a;o+=3){Ig.fromArray(e,o);let a=i.x*Math.abs(Ig.x)+i.y*Math.abs(Ig.y)+i.z*Math.abs(Ig.z),l=t.dot(Ig),s=n.dot(Ig),u=r.dot(Ig);if(Math.max(-Math.max(l,s,u),Math.min(l,s,u))>a)return!1}return!0}var Lg=new vg,Pg=new Lm,Ng=new Lm,_g=0,Dg=class extends Em{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_g++}),this.uuid=Am(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new gg(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vm,this.stencilZFail=vm,this.stencilZPass=vm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){Cm(`Material: parameter \'${t}\' has value of undefined.`);continue}let r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:Cm(`Material: \'${t}\' is not a property of THREE.${this.type}.`)}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),100!==this.blendEquation&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vm&&(n.stencilFail=this.stencilFail),this.stencilZFail!==vm&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vm&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(void 0!==e.uuid&&(this.uuid=e.uuid),void 0!==e.name&&(this.name=e.name),void 0!==e.color&&void 0!==this.color&&this.color.setHex(e.color),void 0!==e.roughness&&(this.roughness=e.roughness),void 0!==e.metalness&&(this.metalness=e.metalness),void 0!==e.sheen&&(this.sheen=e.sheen),void 0!==e.sheenColor&&(this.sheenColor=(new gg).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(this.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==this.emissive&&this.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==this.specular&&this.specular.setHex(e.specular),void 0!==e.specularIntensity&&(this.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==this.specularColor&&this.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(this.shininess=e.shininess),void 0!==e.clearcoat&&(this.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(this.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(this.dispersion=e.dispersion),void 0!==e.iridescence&&(this.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(this.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(this.transmission=e.transmission),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.attenuationDistance&&(this.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==this.attenuationColor&&this.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(this.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(this.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.flatShading&&(this.flatShading=e.flatShading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.side&&(this.side=e.side),void 0!==e.shadowSide&&(this.shadowSide=e.shadowSide),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.transparent&&(this.transparent=e.transparent),void 0!==e.alphaTest&&(this.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(this.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(this.depthFunc=e.depthFunc),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.depthWrite&&(this.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(this.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(this.blendSrc=e.blendSrc),void 0!==e.blendDst&&(this.blendDst=e.blendDst),void 0!==e.blendEquation&&(this.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(this.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(this.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(this.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==this.blendColor&&this.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(this.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(this.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(this.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(this.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(this.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(this.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(this.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(this.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(this.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(this.rotation=e.rotation),void 0!==e.linewidth&&(this.linewidth=e.linewidth),void 0!==e.dashSize&&(this.dashSize=e.dashSize),void 0!==e.gapSize&&(this.gapSize=e.gapSize),void 0!==e.scale&&(this.scale=e.scale),void 0!==e.polygonOffset&&(this.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(this.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(this.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(this.dithering=e.dithering),void 0!==e.alphaToCoverage&&(this.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(this.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(this.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(this.allowOverride=e.allowOverride),void 0!==e.visible&&(this.visible=e.visible),void 0!==e.toneMapped&&(this.toneMapped=e.toneMapped),void 0!==e.userData&&(this.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),void 0!==e.size&&(this.size=e.size),void 0!==e.sizeAttenuation&&(this.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(this.map=t[e.map]||null),void 0!==e.matcap&&(this.matcap=t[e.matcap]||null),void 0!==e.alphaMap&&(this.alphaMap=t[e.alphaMap]||null),void 0!==e.bumpMap&&(this.bumpMap=t[e.bumpMap]||null),void 0!==e.bumpScale&&(this.bumpScale=e.bumpScale),void 0!==e.normalMap&&(this.normalMap=t[e.normalMap]||null),void 0!==e.normalMapType&&(this.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),this.normalScale=(new Im).fromArray(t)}return void 0!==e.displacementMap&&(this.displacementMap=t[e.displacementMap]||null),void 0!==e.displacementScale&&(this.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(this.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(this.roughnessMap=t[e.roughnessMap]||null),void 0!==e.metalnessMap&&(this.metalnessMap=t[e.metalnessMap]||null),void 0!==e.emissiveMap&&(this.emissiveMap=t[e.emissiveMap]||null),void 0!==e.emissiveIntensity&&(this.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(this.specularMap=t[e.specularMap]||null),void 0!==e.specularIntensityMap&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),void 0!==e.specularColorMap&&(this.specularColorMap=t[e.specularColorMap]||null),void 0!==e.envMap&&(this.envMap=t[e.envMap]||null),void 0!==e.envMapRotation&&this.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(this.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(this.lightMap=t[e.lightMap]||null),void 0!==e.lightMapIntensity&&(this.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(this.aoMap=t[e.aoMap]||null),void 0!==e.aoMapIntensity&&(this.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(this.gradientMap=t[e.gradientMap]||null),void 0!==e.clearcoatMap&&(this.clearcoatMap=t[e.clearcoatMap]||null),void 0!==e.clearcoatRoughnessMap&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),void 0!==e.clearcoatNormalMap&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),void 0!==e.clearcoatNormalScale&&(this.clearcoatNormalScale=(new Im).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(this.iridescenceMap=t[e.iridescenceMap]||null),void 0!==e.iridescenceThicknessMap&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),void 0!==e.transmissionMap&&(this.transmissionMap=t[e.transmissionMap]||null),void 0!==e.thicknessMap&&(this.thicknessMap=t[e.thicknessMap]||null),void 0!==e.anisotropyMap&&(this.anisotropyMap=t[e.anisotropyMap]||null),void 0!==e.sheenColorMap&&(this.sheenColorMap=t[e.sheenColorMap]||null),void 0!==e.sheenRoughnessMap&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}},Fg=new Lm,Og=new Lm,$g=new Lm,Hg=new Lm,Wg=new Lm,Bg=new Lm,Vg=new Lm,qg=class{constructor(e=new Lm,t=new Lm(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Fg)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Fg.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Fg.copy(this.origin).addScaledVector(this.direction,t),Fg.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Og.copy(e).add(t).multiplyScalar(.5),$g.copy(t).sub(e).normalize(),Hg.copy(this.origin).sub(Og);let i,o,a,l,s=.5*e.distanceTo(t),u=-this.direction.dot($g),c=Hg.dot(this.direction),d=-Hg.dot($g),h=Hg.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(i=u*d-c,o=u*c-d,l=s*p,i>=0)if(o>=-l)if(o<=l){let e=1/p;i*=e,o*=e,a=i*(i+u*o+2*c)+o*(u*i+o+2*d)+h}else o=s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+h;else o=-s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+h;else o<=-l?(i=Math.max(0,-(-u*s+c)),o=i>0?-s:Math.min(Math.max(-s,-d),s),a=-i*i+o*(o+2*d)+h):o<=l?(i=0,o=Math.min(Math.max(-s,-d),s),a=o*(o+2*d)+h):(i=Math.max(0,-(u*s+c)),o=i>0?s:Math.min(Math.max(-s,-d),s),a=-i*i+o*(o+2*d)+h);else o=u>0?-s:s,i=Math.max(0,-(u*o+c)),a=-i*i+o*(o+2*d)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(Og).addScaledVector($g,o),a}intersectSphere(e,t){Fg.subVectors(e.center,this.origin);let n=Fg.dot(this.direction),r=Fg.dot(Fg)-n*n,i=e.radius*e.radius;if(r>i)return null;let o=Math.sqrt(i-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,a,l,s=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,d=this.origin;return s>=0?(n=(e.min.x-d.x)*s,r=(e.max.x-d.x)*s):(n=(e.max.x-d.x)*s,r=(e.min.x-d.x)*s),u>=0?(i=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(i=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||i>r||((i>n||isNaN(n))&&(n=i),(o<r||isNaN(r))&&(r=o),c>=0?(a=(e.min.z-d.z)*c,l=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,l=(e.min.z-d.z)*c),n>l||a>r)||((a>n||n!=n)&&(n=a),(l<r||r!=r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,Fg)}intersectTriangle(e,t,n,r,i){Wg.subVectors(t,e),Bg.subVectors(n,e),Vg.crossVectors(Wg,Bg);let o,a=this.direction.dot(Vg);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Hg.subVectors(this.origin,e);let l=o*this.direction.dot(Bg.crossVectors(Hg,Bg));if(l<0)return null;let s=o*this.direction.dot(Wg.cross(Hg));if(s<0||l+s>a)return null;let u=-o*Hg.dot(Vg);return u<0?null:this.at(u/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}},Ug=class extends Dg{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gg(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cg,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Yg=new Lm,Xg=new Lm,Kg=new _m,Qg=class{constructor(e=new Lm(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Yg.subVectors(n,t).cross(Xg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Yg),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/i;return!0===n&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Kg.getNormalMatrix(e),r=this.coplanarPoint(Yg).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}},Zg=new class{constructor(e=new Lm,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):Lg.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Pg.subVectors(e,this.center);let t=Pg.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Pg,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Ng.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pg.copy(e.center).add(Ng)),this.expandByPoint(Pg.copy(e.center).sub(Ng))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Gg=new Im(.5,.5),Jg=new Lm,ey=class{constructor(e=new Qg,t=new Qg,n=new Qg,r=new Qg,i=new Qg,o=new Qg){this.planes=[e,t,n,r,i,o]}set(e,t,n,r,i,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=xm,n=!1){let r=this.planes,i=e.elements,o=i[0],a=i[1],l=i[2],s=i[3],u=i[4],c=i[5],d=i[6],h=i[7],p=i[8],f=i[9],m=i[10],g=i[11],y=i[12],v=i[13],x=i[14],b=i[15];if(r[0].setComponents(s-o,h-u,g-p,b-y).normalize(),r[1].setComponents(s+o,h+u,g+p,b+y).normalize(),r[2].setComponents(s+a,h+c,g+f,b+v).normalize(),r[3].setComponents(s-a,h-c,g-f,b-v).normalize(),n)r[4].setComponents(l,d,m,x).normalize(),r[5].setComponents(s-l,h-d,g-m,b-x).normalize();else if(r[4].setComponents(s-l,h-d,g-m,b-x).normalize(),t===xm)r[5].setComponents(s+l,h+d,g+m,b+x).normalize();else{if(t!==bm)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);r[5].setComponents(l,d,m,x).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Zg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Zg.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Zg)}intersectsSprite(e){Zg.center.set(0,0,0);let t=Gg.distanceTo(e.center);return Zg.radius=.7071067811865476+t,Zg.applyMatrix4(e.matrixWorld),this.intersectsSphere(Zg)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Jg.x=r.normal.x>0?e.max.x:e.min.x,Jg.y=r.normal.y>0?e.max.y:e.min.y,Jg.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Jg)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}},ty=new eg,ny=class{constructor(e,t,n=0,r=1/0){this.ray=new qg(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new dg,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):function(...e){let t="THREE."+(e=km(e)).shift();{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ty.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ty),this}intersectObject(e,t=!0,n=[]){return iy(e,this,n,t),n.sort(ry),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)iy(e[r],this,n,t);return n.sort(ry),n}};function ry(e,t){return e.distance-t.distance}function iy(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(i=!1),!0===i&&!0===r){let r=e.children;for(let e=0,i=r.length;e<i;e++)iy(r[e],t,n,!0)}}function oy(e){let t=new Map,n=new Map,r=e.clone();return ay(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),o=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=o.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function ay(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)ay(e.children[r],t.children[r],n)}function ly(e){try{return JSON.parse(e)}catch{return null}}function sy(e,t){return Array.isArray(e)&&e.length===t&&e.every(Number.isFinite)}function uy(e){let t=e;return!!t&&"string"==typeof t.source&&!!t.source&&t.source.length<=2048&&sy(t.position,3)&&sy(t.scale,3)&&sy(t.quaternion,4)}function cy(e){let t=ly(e);if(!Array.isArray(t))return null;let n=new Set;for(let e of t){if(!e||"string"!=typeof e.key||!/^placed-[\\w-]{1,128}$/.test(e.key)||n.has(e.key)||!uy(e.sample))return null;n.add(e.key)}return t}function dy(e,t){let n=oy(e),r=new Map;function i(e){let t=r.get(e);return t||(t=e.clone(),t.transparent=!0,t.opacity*=.5,t.depthWrite=!1,r.set(e,t)),t}return n.traverse(e=>{if(t){e.raycast=()=>{},e.castShadow=!1,"isLight"in e&&(e.visible=!1);let t=e;t.material&&(t.material=Array.isArray(t.material)?t.material.map(i):i(t.material))}}),{object:n,dispose(){for(let e of r.values())e.dispose();n.traverse(e=>{"isSkinnedMesh"in e&&e.skeleton.dispose(),"isInstancedMesh"in e&&e.dispose(),"shadow"in e&&e.shadow?.dispose()})}}}function hy(e,t){e.position.fromArray(t.position),e.quaternion.fromArray(t.quaternion),e.scale.fromArray(t.scale),e.updateMatrix(),e.updateWorldMatrix(!0,!0)}function py(e,t,n,r){let i=t;if(!t.startsWith("#")){let e=n.canvas.ownerDocument.createElement("canvas");e.width=e.height=1;let r=e.getContext("2d");if(r){r.fillStyle=t,r.fillRect(0,0,1,1);let e=r.getImageData(0,0,1,1).data;i=e[0]<<16|e[1]<<8|e[2]}}let o=function(e,t,n){let r,i=t.ownerDocument.defaultView,o=i?.matchMedia?.("(prefers-reduced-motion: reduce)"),a=performance.now(),l=0,s={value:0},u=new Im,c=new vg,d=new eg,h=new Zm;n&&o?.addEventListener("change",n);let p,f=new Jm(1,1,{depthBuffer:!1}),m=new Zm,g=new Im,y=new Im,v=new gg,x=-1,b=null;return{update:function(t,w,S,k){let C=t.getRenderTarget();if(x===t.info.render.frame&&p===S&&b===C)return;x=t.info.render.frame,p=S,b=C,t.getCurrentViewport(m),C?g.set(C.width,C.height):t.getDrawingBufferSize(g);let M=t.domElement.getBoundingClientRect();f.setSize(Math.max(1,m.z),Math.max(1,m.w)),y.set(1*(k??g.x/Math.max(1,M.width))/f.width,1*(k??g.y/Math.max(1,M.height))/f.height);let E=performance.now();if(o?.matches)s.value=-1;else{d.multiplyMatrices(S.projectionMatrix,S.matrixWorldInverse),c.setFromObject(e).applyMatrix4(d);let t=Math.max(1e-4,c.max.x-c.min.x),o=Math.max(1e-4,c.max.y-c.min.y),p=1/(2*y.x),f=1/(2*y.y);h.set((c.min.x+c.max.x)/2,(c.min.y+c.max.y)/2,p,f),u.set(Math.max(.5,(t*p-1)/2),Math.max(.5,(o*f-1)/2));let m=4*(u.x+u.y);s.value>=0&&Number.isFinite(m)&&m>0&&(l=(l+72*(E-a)/(1e3*m))%1),s.value=Number.isFinite(m)?l*m:-1,n&&i&&void 0===r&&(r=i.requestAnimationFrame(()=>{r=void 0,n()}))}a=E;let T=t.getActiveCubeFace(),A=t.getActiveMipmapLevel(),R=t.getClearAlpha();t.getClearColor(v);try{t.setRenderTarget(f),t.setClearColor(0,0),t.state.buffers.color.setMask(!0),t.clear(!0,!1,!1),e.traverseVisible(e=>{let n=e;if(!n.isMesh||!n.layers.test(S.layers))return;n.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,n.matrixWorld),n.normalMatrix.getNormalMatrix(n.modelViewMatrix);let{geometry:r,material:i}=n;if(Array.isArray(i))for(let e of r.groups){let o=i[e.materialIndex??0];o?.visible&&o.colorWrite&&t.renderBufferDirect(S,w,r,o,n,e)}else i.visible&&i.colorWrite&&t.renderBufferDirect(S,w,r,i,n,null)})}finally{t.setClearColor(v,R),t.setRenderTarget(C,T,A),t.state.viewport(m)}},applyTo:function(e){e.onBeforeCompile=e=>{e.uniforms.hoverMask={value:f.texture},e.uniforms.hoverViewport={value:m},e.uniforms.traceHeadPx=s,e.uniforms.traceHalfSizePx={value:u},e.uniforms.traceBounds={value:h},e.uniforms.hoverStep={value:y},e.fragmentShader=`\\n uniform sampler2D hoverMask;\\n uniform vec4 hoverViewport;\\n uniform vec2 hoverStep;\\n uniform float traceHeadPx;\\n uniform vec2 traceHalfSizePx;\\n uniform vec4 traceBounds;\\n float traceStrength(vec2 uv) {\\n if (traceHeadPx < 0.0) return 0.0;\\n // Map a ray from the subject center to clockwise CSS-pixel distance\\n // on the projected bounds. Crossings of holes keep the same sweep.\\n vec2 ray = (2.0 * uv - 1.0 - traceBounds.xy) * traceBounds.zw / traceHalfSizePx;\\n float radius = max(abs(ray.x), abs(ray.y));\\n if (radius < 1e-7) return 0.0;\\n vec2 edge = ray / radius;\\n float w = traceHalfSizePx.x, h = traceHalfSizePx.y;\\n float distancePx;\\n if (ray.y >= abs(ray.x)) distancePx = edge.x * w;\\n else if (ray.x >= abs(ray.y)) distancePx = w + (1.0 - edge.y) * h;\\n else if (-ray.y >= abs(ray.x)) distancePx = (2.0 - edge.x) * w + 2.0 * h;\\n else distancePx = 3.0 * w + (3.0 + edge.y) * h;\\n float perimeter = 4.0 * (w + h);\\n float behind = mod(traceHeadPx - distancePx, perimeter);\\n float segment = min(${24..toFixed(1)}, perimeter * 0.19);\\n return clamp(2.0 - behind / max(segment, 0.0001), 0.0, 1.0);\\n }\\n float coverage(vec2 uv, float center) {\\n return clamp(texture2D(hoverMask, uv).a / center, 0.0, 1.0);\\n }\\n `+e.fragmentShader.replace("#include <tonemapping_fragment>","\\n vec2 uv = (gl_FragCoord.xy - hoverViewport.xy) / hoverViewport.zw;\\n float center = max(texture2D(hoverMask, uv).a, 0.001);\\n float tracer = traceStrength(uv);\\n // The moving head fattens to two CSS pixels over the one-pixel resting line.\\n vec2 span = hoverStep * (1.0 + tracer);\\n vec2 dx = vec2(span.x, 0.0);\\n vec2 dy = vec2(0.0, span.y);\\n vec2 diag = 0.70710678 * span;\\n float inside = min(min(coverage(uv + dx, center), coverage(uv - dx, center)), min(coverage(uv + dy, center), coverage(uv - dy, center)));\\n inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));\\n diag.y = -diag.y;\\n inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));\\n gl_FragColor.a *= mix(0.38, 1.0, (1.0 - inside) * mix(0.3, 1.0, tracer));\\n #include <tonemapping_fragment>\\n ")}},dispose:function(){void 0!==r&&i?.cancelAnimationFrame(r),n&&o?.removeEventListener("change",n),f.dispose()}}}(e,n.canvas,n.invalidate),a=new Map,l=[],s=new Set,u=function(e,t,n,r,i,o){let a=e.ownerDocument,l=a.defaultView,s=a.createElement("span");s.dataset.devtools="three-hover-layer",s.setAttribute("aria-hidden","true"),s.style.cssText="all:initial!important;position:absolute!important;display:block!important;overflow:hidden!important;pointer-events:none!important;box-sizing:border-box!important;";let u=a.createElement("canvas");u.style.cssText="position:absolute;pointer-events:none;",s.attachShadow({mode:"open"}).append(u);let c,d,h,p,f=new Im,m=new Zm,g=new vg,y=new eg,v=new ey,x=new Jm(1,1),b=new gg,w=null,S=new Uint8Array(0),k=-1,C=!1,M=!1,E=!1,T=0,A=!1;function R(){T++,s.remove()}return{paint:function(a,j,I,z){if(E||!l||!e.isConnected||a.getRenderTarget())return!1;let L=e.getBoundingClientRect(),P=l.devicePixelRatio||1;if(a.getDrawingBufferSize(f),f.x+1>=L.width*P&&f.y+1>=L.height*P||!L.width||!L.height||a.getScissorTest())return(s.isConnected||C)&&R(),!1;if(a.getCurrentViewport(m),m.x||m.y||m.z!==f.x||m.w!==f.y||(w??=u.getContext("2d"),!w))return!1;if(function(t){if(p)return;let n=t.onAfterRender,r=Object.hasOwn(t,"onAfterRender"),i=function(...t){n.apply(this,t);let r=t[0];r.domElement===e&&!r.getRenderTarget()&&k!==r.info.render.frame&&!o()&&R()};t.onAfterRender=i,p=()=>{t.onAfterRender===i&&(r?t.onAfterRender=n:Reflect.deleteProperty(t,"onAfterRender"))}}(j),k===a.info.render.frame)return!0;if(k=a.info.render.frame,C)return M=!0,!0;y.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),g.setFromObject(t).applyMatrix4(y);let N=Math.max(0,8*Math.floor(((g.min.x+1)*L.width/2-3)/8)/L.width),_=Math.min(1,8*Math.ceil(((g.max.x+1)*L.width/2+3)/8)/L.width),D=Math.max(0,8*Math.floor(((1-g.max.y)*L.height/2-3)/8)/L.height),F=Math.min(1,8*Math.ceil(((1-g.min.y)*L.height/2+3)/8)/L.height),O=_-N,$=F-D;if(!(O>0&&$>0))return R(),!0;let H=L.width*O,W=L.height*$,B=Math.min(Math.max(2,P),Math.sqrt(2097152/(H*W)),a.capabilities.maxTextureSize/Math.max(H,W)),V=Math.max(1,Math.ceil(H*B)),q=Math.max(1,Math.ceil(W*B));x.setSize(V,q),c!==I&&(c=I,d=Object.create(I),d.projectionMatrix=new eg,d.projectionMatrixInverse=new eg),y.set(1/O,0,0,(1-N-_)/O,0,1/$,0,(D+F-1)/$,0,0,1,0,0,0,0,1),d.projectionMatrix.multiplyMatrices(y,I.projectionMatrix),d.projectionMatrixInverse.copy(d.projectionMatrix).invert(),y.multiplyMatrices(d.projectionMatrix,d.matrixWorldInverse),v.setFromProjectionMatrix(y);let U=d,Y=a.renderLists.get(j,0),X=[Y.opaque,Y.transmissive,Y.transparent],K=a.getClearAlpha();a.getClearColor(b);let Q,Z=T;try{a.setRenderTarget(x),a.setClearColor(0,0),a.state.buffers.color.setMask(!0),a.state.buffers.depth.setMask(!0),a.clear();for(let e of X)for(let{object:t,geometry:n,material:r,group:i}of e){if(!n||!r.depthWrite||!t.layers.test(I.layers)||t.frustumCulled&&!v.intersectsObject(t))continue;t.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix);let e=r.colorWrite;try{r.colorWrite=!1,a.renderBufferDirect(U,j,n,r,t,i)}finally{r.colorWrite=e}}for(let e of X)for(let{object:t,geometry:r,material:i,group:o}of e)!r||!n.has(t)||!i.colorWrite||!t.layers.test(I.layers)||z(U,t,r,i,o,B);S.length!==V*q*4&&(S=new Uint8Array(V*q*4)),a.readRenderTargetPixelsAsync?Q=a.readRenderTargetPixelsAsync(x,0,0,V,q,S):a.readRenderTargetPixels(x,0,0,V,q,S)}finally{a.setClearColor(b,K),a.setRenderTarget(null),a.state.viewport(m)}function G(){if(T!==Z||!e.isConnected||!w||!l)return;if(!h||h.width!==V||h.height!==q){u.width=V,u.height=q,h=w.createImageData(V,q);for(let e=0;e<h.data.length;e+=4)h.data[e]=r>>16&255,h.data[e+1]=r>>8&255,h.data[e+2]=255&r}for(let e=0;e<q;e++){let t=e*V*4+3,n=(q-e-1)*V*4+3;for(let e=0;e<V;e++,t+=4,n+=4)h.data[t]=S[n]}w.putImageData(h,0,0);let t=l.getComputedStyle(e),n=(e,t)=>s.style.setProperty(e,t,"important");n("position","fixed"===t.position?"fixed":"absolute"),n("left",e.offsetLeft+"px"),n("top",e.offsetTop+"px"),n("width",e.offsetWidth+"px"),n("height",e.offsetHeight+"px"),n("border-radius",t.borderRadius),n("transform",t.transform),n("transform-origin",t.transformOrigin),n("z-index",t.zIndex);let i=parseFloat(t.paddingLeft)||0,o=parseFloat(t.paddingTop)||0,a=e.clientWidth-i-(parseFloat(t.paddingRight)||0),c=e.clientHeight-o-(parseFloat(t.paddingBottom)||0);u.style.left=e.clientLeft+i+N*a+"px",u.style.top=e.clientTop+o+D*c+"px",u.style.width=O*a+"px",u.style.height=$*c+"px",s.parentNode!==e.parentNode&&e.after(s)}return Q?(C=!0,Q.then(G,()=>{Z===T&&(E=!0,R())}).finally(()=>{C=!1,!A&&(M||E)&&i?.(),M=!1})):G(),!0},dispose:function(){A=!0,R(),p?.(),x.dispose()}}}(n.canvas,e,s,new gg(i).getHex(),n.invalidate,r);function c(e,t,n,r,l,s,u,c){o.update(e,t,n,c);let d=a.get(s);d||(d=new Ug({color:i,transparent:!0,depthWrite:!1,toneMapped:!1,fog:!1}),o.applyTo(d),a.set(s,d)),d.opacity=s.transparent?s.opacity:1,d.side=s.side,d.depthTest=s.depthTest,d.depthFunc=s.depthWrite?4:s.depthFunc,d.clippingPlanes=s.clippingPlanes,d.clipIntersection=s.clipIntersection;let h=s;d.wireframe=!0===h.wireframe,s.depthWrite||(d.map=h.map??null,d.alphaMap=h.alphaMap??null,d.alphaTest=s.alphaTest),e.renderBufferDirect(n,t,l,d,r,u)}return e.traverse(e=>{if(!e.isMesh)return;s.add(e);let t=e.onAfterRender,i=!Object.hasOwn(e,"onAfterRender"),o=function(...e){t.apply(this,e);let[i,o,a,l,s,d]=e;i.domElement!==n.canvas||"function"!=typeof i.renderBufferDirect||o.overrideMaterial||!s.colorWrite||r()||u.paint(i,o,a,(e,t,n,r,a,l)=>c(i,o,e,t,n,r,a,l))||c(i,o,a,this,l,s,d)};e.onAfterRender=o,l.push(()=>{e.onAfterRender===o&&(i?Reflect.deleteProperty(e,"onAfterRender"):e.onAfterRender=t)})}),n.invalidate?.(),()=>{for(let e of l)e();for(let e of a.values())e.dispose();u.dispose(),o.dispose(),n.invalidate?.()}}function fy(e){return[e.x,e.y,e.z].map(e=>Number(e.toFixed(4))).join(", ")}function my(e){let t=e.material;return t&&(Array.isArray(t)?t:[t]).map(e=>e.name?.trim()||e.type).filter(Boolean).join(", ")||void 0}function gy(e){let t=(e.parent?.children??[]).filter(t=>t.type===e.type&&t.name===e.name),n=Math.max(0,t.indexOf(e)),r=e.name.trim()||e.type;return`${encodeURIComponent(r)}[${n}]`}function yy(e){let t=[],n=e;for(;n?.parent;)t.push(gy(n)),n=n.parent;return t.reverse().join("/")}function vy(e){let t=e.userData.popmeltLabel;return"string"==typeof t&&t.trim()?t.trim():e.name.trim()||e.type}function xy(e){let t=e;for(;t.parent;){let e=t.name.trim(),n=e.match(/^(.*)_(?:alpha|normal|material)(?:_\\d+)+$/i),r=t.parent;for(;r.parent&&!r.name.trim();)r=r.parent;let i=r.name.trim();if(!i||!e.startsWith(`${i}_`)&&!n)break;t=r}return t}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}})),typeof window<"u"&&(window.__THREE__?Cm("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");var by=c(b());function wy({input:e,port:t,framing:n}){let r=(0,dm.useRef)(null);return(0,dm.useLayoutEffect)(()=>{let i=r.current,o=document.createElement("style");o.textContent=e.bundle.css;let a=document.createElement("style");document.head.append(a,o);let l=e.reference.width,s=e.reference.slot,u=e.reference.surface,c=e.reference.intrinsic;function d(t,n){if(l=t.width,s=t.slot,u=t.surface,c=t.intrinsic,u){let e=document.getElementById("root");e.style.width=u.width+"px",e.style.height=u.height+"px",i.style.width=c?"max-content":l+"px",i.style.maxWidth=l+"px"}s&&(i.style.width=c?"max-content":s.width+"px",i.style.maxWidth=s.width+"px",e.fillScene&&(i.style.height=s.height+"px")),function(t){document.documentElement.style.colorScheme=e.mirror?"light dark":t??"light dark"}(n);for(let[e,n]of Object.entries(t.style))i.style.setProperty(e,n);i.style.color=e.mirror?t.style.color??"":"light-dark("+t.lightInk+","+t.darkInk+")",a.textContent!==t.fonts&&(a.textContent=t.fonts)}d(e.reference,e.theme);let h=new ResizeObserver(m),p=null,f="";function m(){let r=i.firstElementChild;if(!r)return;if(p!==r&&(p&&h.unobserve(p),p=r,h.observe(r)),s){if(e.fillScene)return;i.style.width="max-content";let n=i.getBoundingClientRect().width;i.style.width=c?"max-content":s.width+"px";let r=Math.max(1,i.offsetHeight,i.scrollHeight),o=c?n:s.width,a=o+"x"+r;return void(a!==f&&(t.postMessage({type:"size",width:o,height:r}),f=a))}if(!u)return void(i.style.width=getComputedStyle(r).display.startsWith("inline")?"max-content":document.documentElement.clientWidth+"px");let o=getComputedStyle(r).display.startsWith("inline");i.style.width=c||o?"max-content":l+"px";let a=i.getBoundingClientRect(),d=a.width/parseFloat(getComputedStyle(i).width);if(!(d>0&&u.width&&u.height))return;let m=Array.from(i.children,e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);m.length||m.push(a);let g=Math.min(...m.map(e=>e.left)),y=Math.max(...m.map(e=>e.right)),v=Math.min(...m.map(e=>e.top)),x=Math.max(...m.map(e=>e.bottom)),b=Math.max(.01,Math.min(1,(u.width-36)/Math.max(1,(y-g)/d),(u.height-36)/Math.max(1,(x-v)/d))),w=(a.left+a.right-g-y)/(2*d),S=(a.top+a.bottom-v-x)/(2*d);i.style.setProperty("--sp-fit",String(b)),i.style.transform=`translate(-50%, -50%) scale(var(--sp-fit)) translate(${w}px, ${S}px)`,n.setFitScale(b)}let g,y=new Map(e.initial.map(e=>[e.part+"|"+e.property,e])),v=e.parts??{},x=new WeakMap,b=new WeakMap,w=new WeakMap,S=new WeakMap,k=new WeakMap,C=e=>Array.from(e.children).filter(e=>!e.hasAttribute("data-popmelt-paragraph-continuation")&&!e.hasAttribute("data-popmelt-empty-paragraph"));function M(t,n){let r=t.getAttribute("data-explore-part"),i=r&&Jp.test("@"+r)?"@"+r:n;if(t instanceof HTMLElement||t instanceof SVGElement){if(x.get(t)!==i){t.getAttribute("style")?.includes("data:image/svg+xml,")&&function(e){for(let t of Array.from(e)){if(!t.startsWith("--"))continue;let n=e.getPropertyValue(t).trim(),r=/^url\\((["\'])(data:image\\/svg\\+xml,[\\s\\S]*)\\1\\)$/i.exec(n);if(!r||CSS.supports("background-image",n))continue;let i=r[2].replace(/["\']/g,e=>\'"\'===e?"%22":"%27");e.setProperty(t,\'url("\'+i+\'")\',e.getPropertyPriority(t))}}(t.style),x.set(t,i),t.dataset.scratchPart=i;for(let e of y.values())e.part===i&&"text"!==e.property&&"paragraphs"!==e.property&&t.style.setProperty(e.property,e.to)}if(t instanceof HTMLElement&&(function(t,n){let r=0===t.childElementCount&&t.childNodes.length>1,i=!0;t.childNodes.forEach((o,a)=>{if(!(o instanceof Text))return;let l=e=>r&&void 0!==e?i?e:"":void 0,s=1===t.childNodes.length?n:n+"/text/"+a;if(w.get(o)!==s){w.set(o,s);let e=y.get(s+"|text")?.to??l(y.get(n+"|text")?.to);void 0!==e&&(o.data=e)}let u=v[s]?.text??l(v[n]?.text);i=!1,e.mirror&&(void 0!==u?(S.has(o)||S.set(o,o.data),o.data!==u&&(o.data=u)):S.has(o)&&(o.data=S.get(o),S.delete(o)))})}(t,i),t.toggleAttribute("data-scratch-text","P"===t.tagName||Array.from(t.childNodes).some(e=>e instanceof Text&&!!e.data.trim()))),e.mirror&&function(e,t){let n=b.get(e);n||(n=new Map,b.set(e,n));for(let[r,i]of n)void 0===v[t]?.[r]&&(i?e.style.setProperty(r,i):e.style.removeProperty(r),n.delete(r));for(let[r,i]of Object.entries(v[t]??{}))"text"===r||"paragraphs"===r||(n.has(r)||n.set(r,e.style.getPropertyValue(r)),e.style.setProperty(r,i))}(t,i),C(t).forEach((e,t)=>M(e,n?n+"."+t:String(t))),"P"===t.tagName&&t instanceof HTMLElement){let n=y.get(i+"|paragraphs")?.to,r=e.mirror?v[i]?.paragraphs??n:n;k.get(t)!==r&&(r?Ki(t,function(e){if(e.length>256e3)throw Error("Paragraph draft is too large.");let t=JSON.parse(e);if(!Array.isArray(t)||!t.length||t.length>4096||t.some(e=>!(e&&Array.isArray(e.path)&&e.path.length&&!(e.path.length>128)&&e.path.every(e=>"number"==typeof e&&Number.isSafeInteger(e)&&e>=0)&&Array.isArray(e.parts)&&e.parts.length&&e.parts.every(e=>"string"==typeof e)))||t.reduce((e,t)=>e+t.parts.length-1,0)>512)throw Error("Invalid paragraph draft.");return t}(r))&&k.set(t,r):(Xi(t),k.delete(t)))}}}function E(){if(!e.mirror&&i.firstElementChild){let e=!!i.querySelector("canvas");e!==g&&(g=e,t.postMessage({type:"canvas",present:e}))}C(i).forEach((e,t)=>M(e,t?"~"+t:"")),m()}let T,A,R=e.mirror||e.check||e.readOnly?void 0:function(e){let t=window,n=t.__THREE_DEVTOOLS__,r=t.__THREE_DEVTOOLS__??=new EventTarget,i=[];function o(t){let n=t.detail;if(!n?.isWebGLRenderer)return;let r,o,a,l=n.domElement,s=n.render,u=function(t,i){let u=s.call(n,t,i);if(!e.contains(l)||n.getRenderTarget()||!t.isScene||r===t&&o===i)return u;a?.destroy(),r=t,o=i;let c=function(e){let t,n=e.raycaster??new ny,r=new Im,i=0,o=t=>e.key?.(t)??function(e){let t=e.userData.popmeltId;return"string"==typeof t&&t.trim()?t.trim():yy(e)}(t),a=(t,n)=>{let r=s?.owner(t)??o(t);if(!r)return null;let i=function(e,t,n){let r=(new vg).setFromObject(e,!0);if(r.isEmpty())return null;let i=n.getBoundingClientRect(),o=[];for(let e of[r.min.x,r.max.x])for(let n of[r.min.y,r.max.y])for(let i of[r.min.z,r.max.z])o.push(new Lm(e,n,i).project(t));let a=o.map(e=>i.left+(e.x+1)/2*i.width),l=o.map(e=>i.top+(1-e.y)/2*i.height),s=Math.max(i.left,Math.min(...a)),u=Math.min(i.right,Math.max(...a)),c=Math.max(i.top,Math.min(...l)),d=Math.min(i.bottom,Math.max(...l));return u<=s||d<=c?null:{left:s,top:c,width:u-s,height:d-c}}(t,e.camera,e.canvas);return i?{key:r,label:e.label?.(t)??vy(t),sourceElement:e.canvas,bounds:i,context:yy(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:yy(t),...n&&n!==t?{renderObjectName:n.name.trim()||n.type,renderObjectType:n.type,renderScenePath:yy(n)}:{},position:fy(t.position),rotation:fy(t.rotation),scale:fy(t.scale),visible:String(t.visible),...my(t)?{material:my(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(e=>"string"==typeof e[1]&&e[1].length>0))}}:null},l=t=>{let n=null,r=!1,i=t.endsWith("]");return e.scene.traverse(a=>{!e.key&&!i&&("string"!=typeof a.userData.popmeltId||a.userData.popmeltId.trim()!==t)||void 0!==s?.owner(a)||o(a)!==t||(n?r=!0:n=a)}),r?null:n},s=void 0===e.sampleCanvas?function(e,t){let n,r,i=new Map,o=new WeakMap,a=new ny,l="[]";function s(e){e.object.removeFromParent(),o.delete(e.object),e.dispose?.()}function u(e){return t(e.source)}function c(){r=void 0,n&&(s(n),n=void 0,e.invalidate?.())}return{codec:{format:"popmelt-three-instance/v1",placementOnly:!0,read:()=>l,accepts:e=>null!==cy(e),write(t){let n=cy(t);if(!n)return;let r=new Map;try{for(let{key:t,sample:o}of n){if(i.get(t)?.sample.source===o.source)continue;let n=u(o);if(!n?.parent)throw Error("The sampled Three.js object is unavailable.");let a=e.sampling?.duplicate?.(n)??dy(n,!1);if(a.object.parent||a.object===e.scene)throw Error("A sampled object must be a fresh, detached instance.");r.set(t,a)}}catch(e){for(let e of r.values())s(e);return void console.warn("[Popmelt] Could not create the sampled Three.js object.",e)}let a=new Set(n.map(e=>e.key));for(let[e,t]of i)a.has(e)&&!r.has(e)||(s(t),i.delete(e));for(let{key:e,sample:t}of n){let n=r.get(e);n&&(n.object.traverse(t=>{t!==n.object&&"string"==typeof t.userData.popmeltId&&(t.userData.popmeltId=e+"/"+t.userData.popmeltId)}),n.object.userData.popmeltId=e,o.set(n.object,e),u(t).parent.add(n.object),i.set(e,{...n,sample:t}));let a=i.get(e);a.sample=t,hy(a.object,t)}l=t,e.invalidate?.()},objects:{read(n,r){let i=cy(n)?.find(e=>e.key===r);if(i)return JSON.stringify(i.sample);let o=t(r);return o?.parent&&o!==e.scene?JSON.stringify({source:r,position:o.position.toArray(),quaternion:o.quaternion.toArray(),scale:o.scale.toArray()}):null},replace:()=>null,placement:{canPlace(e){let t=ly(e);return uy(t)&&!!u(t)?.parent},at(t,r){let i=ly(t);if(!uy(i))return null;let o=u(i);if(!o?.parent)return null;let l=e.canvas.getBoundingClientRect();if(!l.width||!l.height)return null;e.scene.updateWorldMatrix(!0,!0),e.camera.updateWorldMatrix(!0,!1),a.layers.mask=e.camera.layers.mask,a.setFromCamera(new Im((r.x-l.left)/l.width*2-1,1-(r.y-l.top)/l.height*2),e.camera);let s=a.intersectObject(e.scene,!0).find(({object:e})=>{for(let t=e;t;t=t.parent)if(!t.visible||t===o||t===n?.object)return!1;return!0}),c=e.sampling?.position?.(o,s,a.ray);if(null===c)return null;if(!c){let t=(new vg).setFromObject(o);if(t.isEmpty())return null;let n=t.getCenter(new Lm),r=o.getWorldPosition(new Lm);if(s){let e=s.face?.normal.clone().applyNormalMatrix((new _m).getNormalMatrix(s.object.matrixWorld))??a.ray.direction.clone().negate();e.dot(a.ray.direction)>0&&e.negate();let n=t.getSize(new Lm),r=(Math.abs(e.x)*n.x+Math.abs(e.y)*n.y+Math.abs(e.z)*n.z)/2;c=s.point.clone().addScaledVector(e,r)}else{let t=(new Qg).setFromNormalAndCoplanarPoint(e.camera.getWorldDirection(new Lm),n);if(c=a.ray.intersectPlane(t,new Lm),!c)return null}c.add(r.sub(n))}return i.position=o.parent.worldToLocal(c.clone()).toArray(),JSON.stringify(i)},preview(t){let i=t&&ly(t),a=uy(i)&&u(i);if(!a||!uy(i)||!a.parent)return c();if(r!==a){if(n?.source!==a){c();try{n={...dy(a,!0),source:a}}catch{return void(r=a)}o.set(n.object,""),a.parent.add(n.object)}hy(n.object,i),e.invalidate?.()}},insert(e,n,r){let i=cy(e),o=ly(r);return i&&/^placed-[\\w-]{1,128}$/.test(n)&&uy(o)&&u(o)?.parent&&!t(n)?JSON.stringify([...i.filter(e=>e.key!==n),{key:n,sample:o}]):null}}}},owner:function(e){if(n||i.size)for(;e;){let t=o.get(e);if(void 0!==t)return t;e=e.parent}},placed:i}}(e,l):void 0,u=e.sampleCanvas??s?.codec,c=e=>s?.placed.get(e)?.object??l(e);return{id:e.id?.trim()||"three",...u&&{sampleCanvas:{...u,element:e.canvas}},hitTest({x:t,y:i}){let o=e.canvas.getBoundingClientRect();if(t<o.left||t>o.right||i<o.top||i>o.bottom)return null;r.set((t-o.left)/o.width*2-1,-(i-o.top)/o.height*2+1),n.setFromCamera(r,e.camera);for(let t of n.intersectObject(e.scene,!0)){let n=s?.owner(t.object),r=void 0!==n?s?.placed.get(n)?.object:e.select?e.select(t.object):xy(t.object);if(!r||!r.visible)continue;let i=a(r,t.object);if(i)return i}return null},highlightHover(n,r){let o=c(n);if(!o)return;t?.();let a=py(o,r,e,()=>i>0);return t=a,()=>{t===a&&(t=void 0,a())}},resolve(e){let t=c(e);return t?a(t):null},...e.captureFrame?{async captureSurfaces(){i++;try{let t=await(e.captureFrame?.());return t?[{element:e.canvas,dataUrl:t}]:[]}finally{i--,t&&e.invalidate?.()}}}:{}}}({canvas:l,scene:t,camera:i,select(e){for(let n=e;n&&n!==t;n=n.parent)if(n.userData.popmeltId||n.name)return n;return e}}),d=new Jn([c]);return a=d,$n.set(l,(e,t)=>{let n=c.hitTest({x:e,y:t});if(!n)return null;let r=d.resolve({adapter:c.id,key:n.key});if(!r)return null;let i=r.element,o=JSON.stringify([l.dataset.scratchPart,n.key]),a=2166136261;for(let e=0;e<o.length;e++)a=Math.imul(a^o.charCodeAt(e),16777619);return i.dataset.scratchPart="@three-"+(n.label.replace(/[^\\w-]/g,"-").slice(0,40)||"object")+"-"+(a>>>0).toString(36),i}),u};n.render=u,i.push(()=>{n.render===u&&(n.render=s),$n.delete(l),a?.destroy()})}return r.addEventListener("observe",o),()=>{r.removeEventListener("observe",o);for(let e of i)e();!n&&t.__THREE_DEVTOOLS__===r&&delete t.__THREE_DEVTOOLS__}}(i),j=URL.createObjectURL(new Blob([e.bundle.script],{type:"text/javascript"})),I=!1;function z(){if(I)return;let e=document.createRange();e.selectNodeContents(i),T=[...e.getClientRects()].some(e=>e.width>0&&e.height>0)?setTimeout(()=>t.postMessage({type:"painted"}),400):setTimeout(z,50)}import(j).then(async n=>{if(I)return;if("function"!=typeof n.default)throw Error("The fixture must export a mount function.");let r=await n.default(i);if("function"==typeof r&&(I?r():A=r),!I){E(),e.check&&z();let n=async()=>{if(!I){if(e.mirror&&!i.firstElementChild)return void(T=setTimeout(()=>{n()},16));e.mirror&&await document.fonts.ready,!I&&(E(),t.postMessage({type:"ready"}))}};e.mirror?n():requestAnimationFrame(()=>{I||t.postMessage({type:"ready"})})}}).catch(e=>{I||t.postMessage({type:"error",message:e instanceof Error?e.message:"Fixture failed to mount."})});let L=new MutationObserver(E);L.observe(i,{childList:!0,subtree:!0}),h.observe(i),h.observe(document.documentElement);let P=n=>{let r=n.data;"capture"===r.type&&!e.mirror&&async function(e,t){let n=e.ownerDocument;await n.fonts.ready;let r=e.getBoundingClientRect(),i=e.offsetWidth,o=e.offsetHeight;if(!i||!o||!r.width)throw Error("The option is not ready to capture.");let a=r.width/i,l=Array.from(e.children,e=>e.getBoundingClientRect()).filter(e=>e.width&&e.height);l.length||l.push(r);let s,u=Math.max(0,(Math.min(r.right,...l.map(e=>e.left))-r.left)/a-12),c=Math.max(0,(Math.min(r.bottom,...l.map(e=>e.top))-r.top)/a-12),d=Math.min(i,(Math.max(r.left,...l.map(e=>e.right))-r.left)/a+12),h=Math.min(o,(Math.max(r.top,...l.map(e=>e.bottom))-r.top)/a+12),p=await Lf(e,{width:i,height:o,scale:Math.min(2,1600/Math.max(i,o)),backgroundColor:t,timeout:2500,style:{transform:"none",position:"static",margin:"0"},onCloneEachNode:e=>{if(1!==e.nodeType)return;let t=e;(t.hasAttribute("data-tagged")||t.hasAttribute("data-badge-hover")||t.hasAttribute("data-scratch-part"))&&(t.style.outline="none"),t.removeAttribute("data-tagged"),t.removeAttribute("data-badge-hover")}});p.sandbox=n.createElement("iframe");try{s=await cm(p)}finally{Yf(p)}let f=n.createElement("canvas"),m=s.width/i;return f.width=Math.max(1,Math.ceil((d-u)*m)),f.height=Math.max(1,Math.ceil((h-c)*m)),f.getContext("2d").drawImage(s,-u*m,-c*m),new Promise((e,t)=>f.toBlob(n=>n?e(n):t(Error("Could not capture the reviewed option.")),"image/png"))}(i,r.background).then(e=>{I||t.postMessage({type:"capture",id:r.id,image:e})},()=>{I||t.postMessage({type:"capture",id:r.id,error:!0})}),"reference"===r.type&&(d(r.reference,r.theme),m()),"styles"===r.type&&(v=r.parts,E())};return t.addEventListener("message",P),()=>{I=!0,R?.(),clearTimeout(T),URL.revokeObjectURL(j),L.disconnect(),h.disconnect(),t.removeEventListener("message",P),"function"==typeof A&&A(),a.remove(),o.remove()}},[e,t,n]),(0,by.jsx)("div",{ref:r,inert:e.readOnly||void 0,"data-explore-fixture-root":"",className:e.mirror?void 0:"sp-fit",style:{display:"flow-root",height:e.fillScene?"100%":void 0}})}function Sy(e){let t=e.map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return.2126*t[0]+.7152*t[1]+.0722*t[2]}function ky(e,t){let n=Sy(e),r=Sy(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var Cy=c(h());function My(e,t){return e.computedStyleMap?.().get(t)?.toString()??("max-width"===t?getComputedStyle(e).maxWidth:function(e,t){if(Tt(e)){let n=e.style.getPropertyValue(t);if(n)return n}let n=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());try{for(let r of document.styleSheets)try{let i=r.cssRules||r.rules;for(let r of i)if(r instanceof CSSStyleRule&&e.matches(r.selectorText)){let e=r.style.getPropertyValue(t);if(e)return e;let i=r.style[n];if(i)return i}}catch{}}catch{}return null}(e,t))}function Ey(e,t){if(e){if(/^[\\d.]+px$/.test(e))return parseFloat(e);if(/^[\\d.]+%$/.test(e))return t*parseFloat(e)/100}}var Ty=["font-family","font-size","font-weight","font-style","font-stretch","font-variation-settings","font-feature-settings","line-height","letter-spacing","white-space","overflow-wrap","word-break","flex-wrap","color"];function Ay(e){return e.trim().replace(/^([\'"])(.*)\\1$/,"$2").toLowerCase()}function Ry(e,t,n){let r=e.ownerDocument,i=function(e,t){let n=new Set([t]);for(let[t]of function*(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;let t=e;return t.matches("script,style,noscript,template,[hidden],[data-devtools],[data-popmelt-root]")?NodeFilter.FILTER_REJECT:t.matches("input,textarea,select")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),n=new Set;for(let e=t.nextNode();e;e=t.nextNode()){let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;!t||n.has(t)||(n.add(t),yield[t,e.nodeType===Node.TEXT_NODE?e.textContent.trim():""])}}(e))t!==e&&n.add(getComputedStyle(t).fontFamily);let r=new Set;for(let e of n)for(let t of e.matchAll(/\\s*("[^"]*"|\'[^\']*\'|[^,]+)\\s*(?:,|$)/g))r.add(Ay(t[1]));return r}(e,n),o=[],a=new Set;for(let e of r.fonts){let n=Ay(e.family);if(i.has(n)&&!t.fonts.has(e))try{t.fonts.add(e),o.push(e)}catch{a.add(n)}}let l=()=>{for(let e of o)t.fonts.delete(e)};if(!a.size)return l;let s=function(e,t){let n=e.ownerDocument,r=[];function i(e){if(!e||e.disabled)return;let t;try{t=e.cssRules}catch{return}o(t,e.href??n.baseURI)}function o(e,n){for(let a of e)if(a.type===CSSRule.FONT_FACE_RULE){let{style:e}=a;if(!t.has(Ay(e.getPropertyValue("font-family"))))continue;let i=a.cssText.replace(/url\\("([^"]*)"\\)|url\\(\'([^\']*)\'\\)|url\\(([^)]*)\\)/gi,(e,t,r,i)=>{try{return"url("+JSON.stringify(new URL(t??r??i.trim(),n).href)+")"}catch{return e}});r.push(i)}else a.type===CSSRule.IMPORT_RULE?i(a.styleSheet):"cssRules"in a&&o(a.cssRules,n)}let a=[n];for(let t=e.getRootNode();"host"in t;t=t.host.getRootNode())a.push(t);for(let e of a)for(let t of[...e.styleSheets,...e.adoptedStyleSheets??[]])i(t);return r}(e,a);if(!s.length)return l;let u=t.createElement("style");return u.textContent=s.join("\\n"),t.head.append(u),()=>{u.remove(),l()}}var jy=c(b());function Iy({target:e,children:t,onFitScale:n}){let r=(0,Cy.useRef)(null);return(0,Cy.useLayoutEffect)(()=>{let t=r.current,i=window.frameElement?.ownerDocument,o=i?.location.pathname===e.pathname?wn(e.selector,e.element,i):null,a=o&&function(e){let t=[];for(let n=e;n;n=vt(n))t.unshift(n);return{boxes:t,measure:function(n=!1){let r=e.ownerDocument.documentElement.clientWidth;for(let i of t){let t=getComputedStyle(i);if("inline"===t.display||"contents"===t.display)continue;let o=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0)+(parseFloat(t.borderLeftWidth)||0)+(parseFloat(t.borderRightWidth)||0),a="border-box"===t.boxSizing,l=Ey(My(i,"width"),r),s=Ey(My(i,"max-width"),r),u=void 0===l?r-o:l-(a?o:0);r=Math.max(0,Math.min(u,void 0===s?1/0:s-(a?o:0))),n&&i===e&&(r+=o)}return r}}}(o),l=o&&getComputedStyle(o),s=o&&l?Ry(o,t.ownerDocument,l.fontFamily):void 0,u=t.ownerDocument.documentElement.style,c=l&&function(){if(typeof CanvasRenderingContext2D>"u")return;let e=document.createElement("canvas");e.width=e.height=1;let t=e.getContext("2d",{willReadFrequently:!0});return t?(e,n)=>{t.fillStyle=n,t.fillRect(0,0,1,1),t.fillStyle=e,t.fillRect(0,0,1,1);let r=t.getImageData(0,0,1,1).data;return[r[0],r[1],r[2]]}:void 0}();l&&t.style.setProperty("--sp-source-ink",l.color);for(let e of["light","dark"]){let t=We[e],n=t.raisedSurface,r=l&&c&&ky(c(l.color,n),c(n,n))>=4.5;u.setProperty("--sp-ink-"+e,r?l.color:t.primary)}if(l)for(let e of Ty)"color"!==e&&t.style.setProperty(e,l.getPropertyValue(e));let d=()=>{let e=document.documentElement.clientWidth,r=document.documentElement.clientHeight;if(!e||!r)return;a&&(t.style.maxWidth=a.measure()+"px");let{width:i,height:o}=getComputedStyle(t),l=Math.min(1,(e-36)/Math.max(1,parseFloat(i)),(r-36)/Math.max(1,parseFloat(o))),s=Math.max(.01,l);t.style.setProperty("--sp-fit",String(s)),n(s)},h=new ResizeObserver(d);h.observe(t),h.observe(document.documentElement);for(let e of a?.boxes??[])h.observe(e);return d(),()=>{h.disconnect(),s?.()}},[e,n]),(0,jy.jsx)("div",{ref:r,className:"sp-fit",children:t})}function zy(e,t){let n=e.label?.trim().replace(/\\s*[→↓]$/,"").slice(0,52),r=n?n[0].toUpperCase()+n.slice(1)+" "+e.kind:e.kind[0].toUpperCase()+e.kind.slice(1),i=e.name||r;return"label"===t?i+" label":i}new RegExp(`^${Do.explore}(?=\\\\s|$)`,"i");var Ly=c(b());function Py(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),t]))}function Ny({node:e,picker:t,path:n=[],live:r}){let i="row"===e.kind||"column"===e.kind,o=n.join("."),a={display:"inline-flex",flexDirection:"column"===e.kind?"column":"row",alignItems:i&&"column"===e.kind?"flex-start":"center",gap:e.space??0,flexWrap:i&&"row"===e.kind?"inherit":void 0,maxWidth:"100%",boxSizing:"border-box",color:e.ink,background:e.fill,border:e.stroke?"1px solid "+e.stroke:void 0,borderRadius:e.radius,padding:e.px||e.py?String(e.py??0)+"px "+String(e.px??0)+"px":void 0,fontSize:e.size?e.size+"px":void 0,fontWeight:e.weight,...Py(e.style),...Py(r?.[o])},l=o+"/label",s=!i&&"text"!==e.kind;return(0,Ly.jsxs)("span",{style:a,className:[t&&"sp-piece"].filter(Boolean).join(" ")||void 0,"data-sp-fill":t&&(e.fill||a.backgroundColor)?"":void 0,"data-sp-ink":t&&a.color?"":void 0,"data-scratch-text":"text"===e.kind||void 0,"data-popmelt-label":zy(e),"data-scratch-part":o,tabIndex:t?-1:void 0,"data-badge-hover":t?.hovered===o||void 0,"data-tagged":t?.selected===o||void 0,children:[t&&(0,Ly.jsx)("button",{type:"button",className:"sp-piece-hit",onClick:()=>t.tag(o),"aria-label":`Tag ${e.kind}${e.label?": "+e.label:""}`,"aria-pressed":t.selected===o}),i?e.children?.map((e,i)=>(0,Ly.jsx)(Ny,{live:r,node:e,path:[...n,i],picker:t},i)):t&&s?(0,Ly.jsx)("button",{type:"button",className:"sp-label-hit","data-popmelt-label":zy(e,"label"),"data-sp-fill":e.labelStyle?.["background-color"]?"":void 0,"data-sp-ink":e.labelStyle?.color?"":void 0,"data-scratch-text":"",style:Py(e.labelStyle),"data-scratch-part":l,"data-badge-hover":t.hovered===l||void 0,"data-tagged":t.selected===l||void 0,onClick:()=>t.tag(l),"aria-label":"Tag text: "+e.label,"aria-pressed":t.selected===l,children:r?.[l]?.text??e.label}):s?(0,Ly.jsx)("span",{"data-popmelt-label":zy(e,"label"),"data-scratch-part":l,style:{display:"inline-block",...Py(e.labelStyle),...Py(r?.[l])},children:r?.[l]?.text??e.label}):r?.[o]?.text??e.label]})}var _y=c(h()),Dy=c(b());function Fy({tag:e,framing:t}){let n=(0,_y.useRef)(null);return(0,Dy.jsx)("div",{"data-devtools":"preview-feedback-picker",style:{position:"absolute",inset:0,cursor:e?"crosshair":"default",userSelect:"none"},onPointerDown:e=>{n.current=e.isPrimary&&0===e.button?{id:e.pointerId,x:e.clientX,y:e.clientY,dragged:!1}:null},onPointerMove:e=>{let r=n.current;if(r?.id!==e.pointerId)return;let i=e.clientX-r.x,o=e.clientY-r.y;if(!r.dragged&&Math.hypot(i,o)<=8||(r.dragged=!0,r.x=e.clientX,r.y=e.clientY,"touch"!==e.pointerType||t.getScale()<=1))return;let{width:a,height:l}=e.currentTarget.getBoundingClientRect();if(!a||!l)return;let s=t.getView(a,l);t.setView(s.scale,s.x+i/a,s.y+o/l,a,l)},onPointerLeave:()=>{n.current=null},onPointerCancel:()=>{n.current=null},onPointerUp:t=>{let r=n.current;if(n.current=null,r?.id!==t.pointerId||r.dragged||Math.hypot(t.clientX-r.x,t.clientY-r.y)>8||!e)return;let i=t.currentTarget.parentElement?.querySelector(".sp-fit");if(!i)return;let o=Wn(t.clientX,t.clientY,{within:i})?.closest("[data-scratch-part]");o&&e(o.getAttribute("data-scratch-part"),tf(o))}})}var Oy=c(b());function $y({node:e,fixture:t,readOnly:n,target:r,color:i,framing:o,update:a,tag:l,selectedPart:s,hoveredPart:u,feedbackOnly:c,controlBounds:d,focusRequest:h,preview:p,toggleWorkspace:f}){!function(e){let t=(0,A.useRef)(e);t.current=e,(0,A.useEffect)(()=>{let e=0,n=0,r=r=>{if("Meta"!==r.key&&"Control"!==r.key)return void(n=0);let i=Date.now();n=i-e<Se?n+1:1,n>=2&&(t.current(),n=0),e=i},i=e=>{"Meta"!==e.key&&"Control"!==e.key&&(n=0)};return window.addEventListener("keydown",r),window.addEventListener("keyup",i),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",i)}},[])}(f);let m=!!t,g=(0,Ge.useSyncExternalStore)(tt.subscribe,tt.matches,nt),y=c??g,[v,x]=function(e,t){let n=(0,_h.useContext)(Fh),[r,i]=(0,_h.useReducer)(Qh,Dh),o=(0,_h.useSyncExternalStore)(n?.subscribe??Oh,n?.getSnapshot??$h,n?.getSnapshot??$h)??r,a=n?.dispatch??i;(0,_h.useEffect)(()=>{if(!o.isAnnotating)return;let t=t=>{t.defaultPrevented||t.isComposing||t.altKey||t.composedPath().some(e=>e instanceof Element&&(e.matches(\'input, textarea, select, [role="textbox"]\')||e instanceof HTMLElement&&e.isContentEditable||e.hasAttribute("contenteditable")&&"false"!==e.getAttribute("contenteditable")))||(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===ke.key&&(t.preventDefault(),t.shiftKey?a({type:"REDO"}):(e?.current?.(),a({type:"UNDO"})))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,o.isAnnotating,e,t]);let l=n?.getUndoHead?n.getUndoHead():o.undoStack.at(-1);return[o,a,l]}();(0,E.useLayoutEffect)(()=>{if(!h)return;let e=document.querySelector(\'[data-scratch-part="\'+CSS.escape(h.part)+\'"]\');e&&(window.frameElement?.scrollIntoView({block:"nearest",inline:"nearest"}),e.focus({preventScroll:!0}))},[h]),(0,E.useLayoutEffect)(()=>{if(y||n)return;let e=()=>{document.documentElement.removeAttribute("data-preview-control-hovered"),document.hasFocus()||window.focus()},t=e=>{if("Enter"!==e.key&&" "!==e.key)return;let t=e.target;!(t instanceof HTMLButtonElement)||!t.matches(".sp-label-hit, .sp-piece-hit")||(e.preventDefault(),e.stopImmediatePropagation(),t.click())};return window.addEventListener("pointermove",e,!0),window.addEventListener("keydown",t,!0),()=>{window.removeEventListener("pointermove",e,!0),window.removeEventListener("keydown",t,!0)}},[y,n]),(0,E.useLayoutEffect)(()=>{x({type:"SET_COLOR",payload:i}),x({type:"SET_TOOL",payload:"sticker"}),x({type:"SET_ANNOTATING",payload:!0})},[i,x]);let b=(0,E.useRef)([]);return(0,E.useLayoutEffect)(()=>()=>so(b.current),[]),(0,E.useLayoutEffect)(()=>{let e=v.styleModifications;io(e);let t=[];for(let n of e){let e=ro(n)?.getAttribute("data-scratch-part");if(null!=e)for(let r of eo(n))t.push({part:e,property:r.property,from:r.original,to:r.modified,sticker:r.sticker})}(function(e,t){let n=new Set(t);so(e.filter(e=>!(n.has(e)||e.paragraphs&&t.some(t=>t.paragraphs&&t.selector===e.selector&&!t.captured)))),function(e){for(let t of e){if(t.captured)continue;let e=ao(t);if(!e)continue;if(t.paragraphs&&"P"===e.tagName){let n=e;if(!Vi(n)&&JSON.stringify(Ui(n).layout)!==JSON.stringify(t.paragraphs.before))continue;Ki(n,t.paragraphs.after);continue}let n=lo(e,t.textNodePath);n&&n.nodeValue===t.original&&n.nodeValue!==t.modified&&(n.nodeValue=t.modified)}}(t)})(b.current,v.textModifications),b.current=v.textModifications;for(let e of v.textModifications){let n=ao(e),r=n?.getAttribute("data-scratch-part");if(e.paragraphs&&null!=r)t.push({part:r,property:"paragraphs",from:JSON.stringify(e.paragraphs.before),to:JSON.stringify(e.paragraphs.after)});else if(n&&null!=r){let i=r;if(m){let t=n;for(let n of e.textNodePath.slice(0,-1))t=t?.childNodes[n];if(!(t instanceof Element))continue;i=t.getAttribute("data-scratch-part")??r,t.childNodes.length>1&&(i+="/text/"+e.textNodePath.at(-1))}t.push({part:i,property:"text",from:e.original,to:e.modified})}}return a(t),()=>{oo(e,!0)}},[v.styleModifications,v.textModifications,a,m]),(0,Oy.jsxs)(Gp,{interactive:!0,framing:o,parentGestureSurface:window.frameElement?.closest(".sp-workspace"),overlay:n||y?(0,Oy.jsx)(Fy,{framing:o,tag:n?void 0:l}):(0,Oy.jsx)(Up,{state:v,dispatch:x,nativeFixtureInput:!!t,steerControlBounds:d,showSteerChangeBadges:!1,canEditSteerText:e=>e.hasAttribute("data-scratch-text")||"P"===e.tagName&&!!e.querySelector("[data-scratch-text]"),onSteerPreviewChange:e=>{let t=e?.element.getAttribute("data-scratch-part");p(e&&null!=t?{[t]:Object.fromEntries(e.activeDeclarations.filter(e=>"transition"!==e.property).map(e=>[e.property,e.value]))}:null)},onSteerTargetClick:e=>{let n=e.closest("[data-scratch-part]")?.getAttribute("data-scratch-part");null!=n&&l(n,t?tf(e):void 0)},onScreenshot:async()=>!1}),children:[(0,Oy.jsx)("div",{className:"sp-backdrop","aria-hidden":"true","data-popmelt-canvas-block":""}),t,r&&e&&(0,Oy.jsx)(Iy,{target:r,onFitScale:o.setFitScale,children:(0,Oy.jsx)(Ny,{node:e,picker:{tag:l,selected:s,hovered:u}})})]})}var Hy=(0,T.createRoot)(document.getElementById("root"));window.addEventListener("pagehide",e=>{e.persisted||Hy.unmount()});var Wy=0;window.startScratchSteer=(e,t,n,r,i,o,a,l)=>{let s=++Wy;return u=>Hy.render((0,Oy.jsx)($y,{node:e,target:t,color:n,framing:r,update:i,preview:a,toggleWorkspace:l,tag:o,...u},s))},window.parent!==window&&!window.frameElement&&function(e){let t=n=>{if(n.source!==window.parent||!n.ports[0]||!n.data?.bundle)return;window.removeEventListener("message",t);let r=n.ports[0],i=n.data;for(let e of["localStorage","sessionStorage"]){let t=new Map;Object.defineProperty(window,e,{configurable:!0,value:{get length(){return t.size},key:e=>[...t.keys()][e]??null,getItem:e=>t.get(String(e))??null,setItem(e,n){t.set(String(e),String(n))},removeItem(e){t.delete(String(e))},clear(){t.clear()}}})}let o=Qp(null);o.restore(i.framing);let a="",l=o.subscribe(()=>{let e=o.snapshot(),t=JSON.stringify([e,o.getFitScale()]);t!==a&&(a=t,r.postMessage({type:"framing",fit:o.getFitScale(),view:e}))}),s={readOnly:i.readOnly,feedbackOnly:i.feedbackOnly,framing:o,color:i.accent,update:e=>r.postMessage({type:"edits",edits:e}),tag:(e,t)=>r.postMessage({type:"tag",part:e,label:t}),preview:e=>r.postMessage({type:"preview",parts:e}),toggleWorkspace:()=>r.postMessage({type:"toggle"})};window.addEventListener("error",e=>r.postMessage({type:"error",message:e.error?.message||e.message})),window.addEventListener("unhandledrejection",e=>r.postMessage({type:"error",message:String(e.reason)}));let u=(0,by.jsx)(wy,{input:i,port:r,framing:o});r.onmessage=t=>{let n=t.data;if("controlEnter"===n.type&&document.documentElement.setAttribute("data-preview-control-hovered",""),"controls"===n.type&&!i.mirror&&(s.controlBounds=n.bounds,e(s,u)),"framing"===n.type&&o.restore(n.view),"framingGesture"===n.type){let e=document.querySelector("[data-preview-zoom]"),t="wheel"===n.event?new WheelEvent("wheel",n):Object.assign(new Event(n.event),{clientX:n.clientX,clientY:n.clientY,scale:n.scale});e?.dispatchEvent(t)}if("interaction"===n.type&&!i.mirror){"boolean"==typeof n.feedbackOnly&&(s.feedbackOnly=i.feedbackOnly=n.feedbackOnly),s.focusRequest=void 0===n.focus?void 0:{part:n.focus};for(let[e,t]of[["data-tagged",n.selected],["data-badge-hover",n.hovered]])document.querySelectorAll("[data-scratch-part]").forEach(n=>n.toggleAttribute(e,n.getAttribute("data-scratch-part")===t));e(s,u)}},window.addEventListener("keydown",e=>{"Escape"===e.key&&!e.target?.closest?.("input,textarea,[contenteditable=true]")&&r.postMessage({type:"escape"})},!0),window.addEventListener("pagehide",()=>{l(),r.close()},{once:!0}),e(i.mirror?null:s,u)};window.addEventListener("message",t)}((e,t)=>Hy.render(e?(0,Oy.jsx)($y,{...e,fixture:t}):t));\n/*! Bundled license information:\n\nreact/cjs/react.production.js:\n (**\n * @license React\n * react.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nscheduler/cjs/scheduler.production.js:\n (**\n * @license React\n * scheduler.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom.production.js:\n (**\n * @license React\n * react-dom.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom-client.production.js:\n (**\n * @license React\n * react-dom-client.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact/cjs/react-jsx-runtime.production.js:\n (**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n*/<\/script>\n </body>\n</html>\n',t=e.replace("\x3c!-- fixture-policy --\x3e","<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' blob:; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data: blob:; worker-src blob:; connect-src data: blob:; frame-src 'none'; base-uri 'none'; form-action 'none'\">");export{e as a,t as b};
|