stillmade-sdk 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.stillmade/sdk-baseline.json +1 -1
  2. package/AGENTS.md +8 -2
  3. package/DESKTOP_CAPABILITIES.md +1 -1
  4. package/INTERFACE_DESIGN.md +167 -83
  5. package/MODULES.md +1 -1
  6. package/NATIVE_MCP.md +1 -1
  7. package/PASTE_TO_LLM.md +151 -12
  8. package/README.md +5 -2
  9. package/SDK.md +510 -115
  10. package/UI_AESTHETIC.md +64 -0
  11. package/blocks/native/sm.export-video/versions/2.1.0/package.js +580 -0
  12. package/blocks/native/sm.panel-strip/versions/2.4.0/package.js +1176 -0
  13. package/blocks/native/sm.panel-strip/versions/2.4.1/package.js +1316 -0
  14. package/blocks/native/sm.shot-plan/versions/2.2.0/package.js +800 -0
  15. package/blocks/native/sm.shot-plan/versions/2.2.1/package.js +920 -0
  16. package/examples/README.md +10 -0
  17. package/examples/custom-interface.stillmade.json +3 -3
  18. package/package.json +7 -1
  19. package/packages/block-cli/dev-host/assets/host.js +214 -28
  20. package/packages/block-cli/dev-host/assets/index.css +1 -1
  21. package/packages/block-cli/format.js +1 -1
  22. package/packages/block-cli/templates.js +53 -22
  23. package/packages/block-platform/block-readiness.js +5 -0
  24. package/packages/block-platform/brief-ports.js +29 -0
  25. package/packages/block-platform/catalog.js +32 -9
  26. package/packages/block-platform/current-semantic-source.js +7 -3
  27. package/packages/block-platform/flow-inspection.js +14 -4
  28. package/packages/block-platform/plain-descriptions.js +1 -1
  29. package/packages/block-platform/project-context.js +7 -0
  30. package/packages/block-platform/project-input-samples.js +3 -1
  31. package/packages/block-platform/project-inputs.js +11 -2
  32. package/packages/block-platform/project-start-input.js +46 -0
  33. package/packages/block-platform/step-groups.js +2 -0
  34. package/packages/block-platform/steps.js +55 -4
  35. package/packages/block-platform/type-preview.js +19 -3
  36. package/packages/block-platform/workspace-input-readset.js +6 -1
  37. package/packages/block-sdk/builder-contract.js +11 -5
  38. package/packages/block-sdk/collaboration-admission.js +4 -2
  39. package/packages/block-sdk/connection-adapters.js +35 -2
  40. package/packages/block-sdk/contracts.js +5 -2
  41. package/packages/block-sdk/examples.js +3 -3
  42. package/packages/block-sdk/first-party-identities.js +190 -0
  43. package/packages/block-sdk/first-party-packages.js +6 -1
  44. package/packages/block-sdk/index.d.ts +2 -0
  45. package/packages/block-sdk/index.js +1 -1
  46. package/packages/block-sdk/javascript.js +5 -1
  47. package/packages/block-sdk/platform-checks.js +13 -2
  48. package/packages/block-sdk/shared-agent-controls.js +5 -4
  49. package/packages/block-sdk/shared-controls.js +13 -9
  50. package/packages/block-sdk/view-design.js +104 -27
  51. package/packages/block-sdk/view.js +4 -2
  52. package/packages/design-system/block-kit.css +183 -0
  53. package/packages/design-system/block-kit.html +187 -0
@@ -1,20 +1,20 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=s((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function w(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!ee.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function T(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function E(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function A(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+k(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(O,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(E(o)&&(o=T(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+k(s,l);c+=A(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+k(s,l++),c+=A(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var M={current:null},N={transition:null},ne={ReactCurrentDispatcher:M,ReactCurrentBatchConfig:N,ReactCurrentOwner:C};function re(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!E(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,e.act=re,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!ee.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=w,e.createFactory=function(e){var t=w.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=E,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},e.unstable_act=re,e.useCallback=function(e,t){return M.current.useCallback(e,t)},e.useContext=function(e){return M.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return M.current.useDeferredValue(e)},e.useEffect=function(e,t){return M.current.useEffect(e,t)},e.useId=function(){return M.current.useId()},e.useImperativeHandle=function(e,t,n){return M.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return M.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return M.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return M.current.useMemo(e,t)},e.useReducer=function(e,t,n){return M.current.useReducer(e,t,n)},e.useRef=function(e){return M.current.useRef(e)},e.useState=function(e){return M.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return M.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return M.current.useTransition()},e.version=`18.3.1`})),f=s(((e,t)=>{t.exports=d()})),p=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,j(x);else{var t=n(l);t!==null&&te(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(ee),ee=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&te(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,ee=-1,w=5,T=-1;function E(){return!(e.unstable_now()-T<w)}function D(){if(C!==null){var t=e.unstable_now();T=t;var n=!0;try{n=C(!0,t)}finally{n?O():(S=!1,C=null)}}else S=!1}var O;if(typeof v==`function`)O=function(){v(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){g(D,0)};function j(e){C=e,S||(S=!0,O())}function te(t,n){ee=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,j(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(ee),ee=-1):h=!0,te(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,j(x))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=s(((e,t)=>{t.exports=p()})),h=s((e=>{var t=f(),n=m();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},p={};function h(e){return l.call(p,e)?!0:l.call(d,e)?!1:u.test(e)?p[e]=!0:(d[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ee=Symbol.for(`react.element`),w=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),D=Symbol.for(`react.profiler`),O=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),ne=Symbol.for(`react.offscreen`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var P=Object.assign,ae;function oe(e){if(ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||``}return`
2
- `+ae+e}var se=!1;function ce(e,t){if(!e||se)return``;se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=s((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N={current:null},P={transition:null},te={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:P,ReactCurrentOwner:C};function ne(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,e.act=ne,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ee}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=P.transition;P.transition={};try{e()}finally{P.transition=t}},e.unstable_act=ne,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.current.useTransition()},e.version=`18.3.1`})),f=s(((e,t)=>{t.exports=d()})),p=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&ee(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&ee(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function ee(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},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 f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,ee(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=s(((e,t)=>{t.exports=p()})),h=s((e=>{var t=f(),n=m();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},p={};function h(e){return l.call(p,e)?!0:l.call(d,e)?!1:u.test(e)?p[e]=!0:(d[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),te=Symbol.for(`react.offscreen`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Object.assign,ie;function ae(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``}return`
2
+ `+ie+e}var oe=!1;function se(e,t){if(!e||oe)return``;oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
3
3
  `),a=r.stack.split(`
4
4
  `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
5
- `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{se=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?oe(e):``}function le(e){switch(e.tag){case 5:return oe(e.type);case 16:return oe(`Lazy`);case 13:return oe(`Suspense`);case 19:return oe(`SuspenseList`);case 0:case 2:case 15:return e=ce(e.type,!1),e;case 11:return e=ce(e.type.render,!1),e;case 1:return e=ce(e.type,!0),e;default:return``}}function ue(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case T:return`Fragment`;case w:return`Portal`;case D:return`Profiler`;case E:return`StrictMode`;case j:return`Suspense`;case te:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case k:return(e.displayName||`Context`)+`.Consumer`;case O:return(e._context.displayName||`Context`)+`.Provider`;case A:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}function de(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ue(t);case 8:return t===E?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function fe(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function pe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function me(e){var t=pe(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.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]}}}}function he(e){e._valueTracker||=me(e)}function ge(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=pe(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function _e(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function ve(e,t){var n=t.checked;return P({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ye(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=fe(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function be(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function xe(e,t){be(e,t);var n=fe(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Ce(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Ce(e,t.type,fe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Se(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Ce(e,t,n){(t!==`number`||_e(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var we=Array.isArray;function Te(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=``+fe(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ee(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function De(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(we(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:fe(n)}}function Oe(e,t){var n=fe(t.value),r=fe(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function ke(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Ae(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function je(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Ae(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Me,Ne=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Me||=document.createElement(`div`),Me.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Me.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ie=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Fe).forEach(function(e){Ie.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fe[t]=Fe[e]})});function Le(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Fe.hasOwnProperty(e)&&Fe[e]?(``+t).trim():t+`px`}function Re(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Le(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var ze=P({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Be(e,t){if(t){if(ze[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ve(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 F=null;function He(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var I=null,Ue=null,We=null;function Ge(e){if(e=Ii(e)){if(typeof I!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),I(e.stateNode,e.type,t))}}function Ke(e){Ue?We?We.push(e):We=[e]:Ue=e}function qe(){if(Ue){var e=Ue,t=We;if(We=Ue=null,Ge(e),t)for(e=0;e<t.length;e++)Ge(t[e])}}function Je(e,t){return e(t)}function Ye(){}var Xe=!1;function Ze(e,t,n){if(Xe)return e(t,n);Xe=!0;try{return Je(e,t,n)}finally{Xe=!1,(Ue!==null||We!==null)&&(Ye(),qe())}}function Qe(e,t){var n=e.stateNode;if(n===null)return null;var i=Ri(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var $e=!1;if(c)try{var et={};Object.defineProperty(et,"passive",{get:function(){$e=!0}}),window.addEventListener(`test`,et,et),window.removeEventListener(`test`,et,et)}catch{$e=!1}function tt(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var nt=!1,rt=null,it=!1,L=null,R={onError:function(e){nt=!0,rt=e}};function at(e,t,n,r,i,a,o,s,c){nt=!1,rt=null,tt.apply(R,arguments)}function ot(e,t,n,i,a,o,s,c,l){if(at.apply(this,arguments),nt){if(nt){var u=rt;nt=!1,rt=null}else throw Error(r(198));it||(it=!0,L=u)}}function st(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ct(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function lt(e){if(st(e)!==e)throw Error(r(188))}function ut(e){var t=e.alternate;if(!t){if(t=st(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return lt(a),e;if(o===i)return lt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function dt(e){return e=ut(e),e===null?null:ft(e)}function ft(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ft(e);if(t!==null)return t;e=e.sibling}return null}var pt=n.unstable_scheduleCallback,mt=n.unstable_cancelCallback,ht=n.unstable_shouldYield,gt=n.unstable_requestPaint,_t=n.unstable_now,vt=n.unstable_getCurrentPriorityLevel,yt=n.unstable_ImmediatePriority,bt=n.unstable_UserBlockingPriority,xt=n.unstable_NormalPriority,St=n.unstable_LowPriority,Ct=n.unstable_IdlePriority,wt=null,Tt=null;function Et(e){if(Tt&&typeof Tt.onCommitFiberRoot==`function`)try{Tt.onCommitFiberRoot(wt,e,void 0,(e.current.flags&128)==128)}catch{}}var Dt=Math.clz32?Math.clz32:At,Ot=Math.log,kt=Math.LN2;function At(e){return e>>>=0,e===0?32:31-(Ot(e)/kt|0)|0}var jt=64,Mt=4194304;function Nt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Nt(a))):r=Nt(s)}else o=n&~i,o===0?a!==0&&(r=Nt(a)):r=Nt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Dt(t),i=1<<n,r|=e[n],t&=~i;return r}function Ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function It(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Dt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ft(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Lt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Rt(){var e=jt;return jt<<=1,!(jt&4194240)&&(jt=64),e}function zt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Bt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Dt(t),e[t]=n}function Vt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Dt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Ht(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Dt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var z=0;function Ut(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Wt,Gt,Kt,qt,Jt,Yt=!1,Xt=[],Zt=null,Qt=null,$t=null,en=new Map,tn=new Map,nn=[],B=`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 submit`.split(` `);function rn(e,t){switch(e){case`focusin`:case`focusout`:Zt=null;break;case`dragenter`:case`dragleave`:Qt=null;break;case`mouseover`:case`mouseout`:$t=null;break;case`pointerover`:case`pointerout`:en.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:tn.delete(t.pointerId)}}function an(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ii(t),t!==null&&Gt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function on(e,t,n,r,i){switch(t){case`focusin`:return Zt=an(Zt,e,t,n,r,i),!0;case`dragenter`:return Qt=an(Qt,e,t,n,r,i),!0;case`mouseover`:return $t=an($t,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return en.set(a,an(en.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,tn.set(a,an(tn.get(a)||null,e,t,n,r,i)),!0}return!1}function sn(e){var t=Fi(e.target);if(t!==null){var n=st(t);if(n!==null){if(t=n.tag,t===13){if(t=ct(n),t!==null){e.blockedOn=t,Jt(e.priority,function(){Kt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function V(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_n(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);F=r,n.target.dispatchEvent(r),F=null}else return t=Ii(n),t!==null&&Gt(t),e.blockedOn=n,!1;t.shift()}return!0}function H(e,t,n){V(e)&&n.delete(t)}function cn(){Yt=!1,Zt!==null&&V(Zt)&&(Zt=null),Qt!==null&&V(Qt)&&(Qt=null),$t!==null&&V($t)&&($t=null),en.forEach(H),tn.forEach(H)}function ln(e,t){e.blockedOn===t&&(e.blockedOn=null,Yt||(Yt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cn)))}function un(e){function t(t){return ln(t,e)}if(0<Xt.length){ln(Xt[0],e);for(var n=1;n<Xt.length;n++){var r=Xt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Zt!==null&&ln(Zt,e),Qt!==null&&ln(Qt,e),$t!==null&&ln($t,e),en.forEach(t),tn.forEach(t),n=0;n<nn.length;n++)r=nn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<nn.length&&(n=nn[0],n.blockedOn===null);)sn(n),n.blockedOn===null&&nn.shift()}var dn=C.ReactCurrentBatchConfig,fn=!0;function pn(e,t,n,r){var i=z,a=dn.transition;dn.transition=null;try{z=1,hn(e,t,n,r)}finally{z=i,dn.transition=a}}function mn(e,t,n,r){var i=z,a=dn.transition;dn.transition=null;try{z=4,hn(e,t,n,r)}finally{z=i,dn.transition=a}}function hn(e,t,n,r){if(fn){var i=_n(e,t,n,r);if(i===null)ci(e,t,r,gn,n),rn(e,r);else if(on(i,e,t,n,r))r.stopPropagation();else if(rn(e,r),t&4&&-1<B.indexOf(e)){for(;i!==null;){var a=Ii(i);if(a!==null&&Wt(a),a=_n(e,t,n,r),a===null&&ci(e,t,r,gn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ci(e,t,r,null,n)}}var gn=null;function _n(e,t,n,r){if(gn=null,e=He(r),e=Fi(e),e!==null){if(t=st(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ct(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return gn=e,null}function vn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(vt()){case yt:return 1;case bt:return 4;case xt:case St:return 16;case Ct:return 536870912;default:return 16}default:return 16}}var yn=null,bn=null,xn=null;function Sn(){if(xn)return xn;var e,t=bn,n=t.length,r,i=`value`in yn?yn.value:yn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return xn=i.slice(e,1<r?1-r:void 0)}function Cn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function wn(){return!0}function Tn(){return!1}function En(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?wn:Tn,this.isPropagationStopped=Tn,this}return P(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=wn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=wn)},persist:function(){},isPersistent:wn}),t}var Dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},On=En(Dn),kn=P({},Dn,{view:0,detail:0}),An=En(kn),jn,Mn,Nn,Pn=P({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Nn&&(Nn&&e.type===`mousemove`?(jn=e.screenX-Nn.screenX,Mn=e.screenY-Nn.screenY):Mn=jn=0,Nn=e),jn)},movementY:function(e){return`movementY`in e?e.movementY:Mn}}),Fn=En(Pn),In=En(P({},Pn,{dataTransfer:0})),Ln=En(P({},kn,{relatedTarget:0})),Rn=En(P({},Dn,{animationName:0,elapsedTime:0,pseudoElement:0})),zn=En(P({},Dn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Bn=En(P({},Dn,{data:0})),Vn={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`},Un={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Wn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Un[e])?!!t[e]:!1}function Gn(){return Wn}var Kn=En(P({},kn,{key:function(e){if(e.key){var t=Vn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Hn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gn,charCode:function(e){return e.type===`keypress`?Cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),qn=En(P({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Jn=En(P({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gn})),Yn=En(P({},Dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Xn=En(P({},Pn,{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})),Zn=[9,13,27,32],Qn=c&&`CompositionEvent`in window,$n=null;c&&`documentMode`in document&&($n=document.documentMode);var U=c&&`TextEvent`in window&&!$n,er=c&&(!Qn||$n&&8<$n&&11>=$n),tr=` `,nr=!1;function rr(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ir(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ar=!1;function or(e,t){switch(e){case`compositionend`:return ir(t);case`keypress`:return t.which===32?(nr=!0,tr):null;case`textInput`:return e=t.data,e===tr&&nr?null:e;default:return null}}function sr(e,t){if(ar)return e===`compositionend`||!Qn&&rr(e,t)?(e=Sn(),xn=bn=yn=null,ar=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return er&&t.locale!==`ko`?null:t.data;default:return null}}var cr={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 lr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!cr[e.type]:t===`textarea`}function ur(e,t,n,r){Ke(r),t=K(t,`onChange`),0<t.length&&(n=new On(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var dr=null,W=null;function fr(e){ni(e,0)}function pr(e){if(ge(Li(e)))return e}function mr(e,t){if(e===`change`)return t}var hr=!1;if(c){var gr;if(c){var _r=`oninput`in document;if(!_r){var vr=document.createElement(`div`);vr.setAttribute(`oninput`,`return;`),_r=typeof vr.oninput==`function`}gr=_r}else gr=!1;hr=gr&&(!document.documentMode||9<document.documentMode)}function yr(){dr&&(dr.detachEvent(`onpropertychange`,br),W=dr=null)}function br(e){if(e.propertyName===`value`&&pr(W)){var t=[];ur(t,W,e,He(e)),Ze(fr,t)}}function xr(e,t,n){e===`focusin`?(yr(),dr=t,W=n,dr.attachEvent(`onpropertychange`,br)):e===`focusout`&&yr()}function Sr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return pr(W)}function Cr(e,t){if(e===`click`)return pr(t)}function wr(e,t){if(e===`input`||e===`change`)return pr(t)}function Tr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Er=typeof Object.is==`function`?Object.is:Tr;function Dr(e,t){if(Er(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Er(e[i],t[i]))return!1}return!0}function Or(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kr(e,t){var n=Or(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(){for(var e=window,t=_e();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=_e(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Nr(e){var t=jr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ar(n.ownerDocument.documentElement,n)){if(r!==null&&Mr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=kr(n,a);var o=kr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Pr=c&&`documentMode`in document&&11>=document.documentMode,Fr=null,Ir=null,Lr=null,Rr=!1;function zr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rr||Fr==null||Fr!==_e(r)||(r=Fr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Lr&&Dr(Lr,r)||(Lr=r,r=K(Ir,`onSelect`),0<r.length&&(t=new On(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Fr)))}function Br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var G={animationend:Br(`Animation`,`AnimationEnd`),animationiteration:Br(`Animation`,`AnimationIteration`),animationstart:Br(`Animation`,`AnimationStart`),transitionend:Br(`Transition`,`TransitionEnd`)},Vr={},Hr={};c&&(Hr=document.createElement(`div`).style,`AnimationEvent`in window||(delete G.animationend.animation,delete G.animationiteration.animation,delete G.animationstart.animation),`TransitionEvent`in window||delete G.transitionend.transition);function Ur(e){if(Vr[e])return Vr[e];if(!G[e])return e;var t=G[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Hr)return Vr[e]=t[n];return e}var Wr=Ur(`animationend`),Gr=Ur(`animationiteration`),Kr=Ur(`animationstart`),qr=Ur(`transitionend`),Jr=new Map,Yr=`abort auxClick 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 Xr(e,t){Jr.set(e,t),o(t,[e])}for(var Zr=0;Zr<Yr.length;Zr++){var Qr=Yr[Zr];Xr(Qr.toLowerCase(),`on`+(Qr[0].toUpperCase()+Qr.slice(1)))}Xr(Wr,`onAnimationEnd`),Xr(Gr,`onAnimationIteration`),Xr(Kr,`onAnimationStart`),Xr(`dblclick`,`onDoubleClick`),Xr(`focusin`,`onFocus`),Xr(`focusout`,`onBlur`),Xr(qr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var $r=`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(` `),ei=new Set(`cancel close invalid load scroll toggle`.split(` `).concat($r));function ti(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ot(r,t,void 0,e),e.currentTarget=null}function ni(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ti(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ti(i,s,l),a=c}}}if(it)throw e=L,it=!1,L=null,e}function ri(e,t){var n=t[Mi];n===void 0&&(n=t[Mi]=new Set);var r=e+`__bubble`;n.has(r)||(si(t,e,2,!1),n.add(r))}function ii(e,t,n){var r=0;t&&(r|=4),si(n,e,r,t)}var ai=`_reactListening`+Math.random().toString(36).slice(2);function oi(e){if(!e[ai]){e[ai]=!0,i.forEach(function(t){t!==`selectionchange`&&(ei.has(t)||ii(t,!1,e),ii(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ai]||(t[ai]=!0,ii(`selectionchange`,!1,t))}}function si(e,t,n,r){switch(vn(t)){case 1:var i=pn;break;case 4:i=mn;break;default:i=hn}n=i.bind(null,t,n,e),i=void 0,!$e||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ci(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Fi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ze(function(){var r=a,i=He(n),o=[];a:{var s=Jr.get(e);if(s!==void 0){var c=On,l=e;switch(e){case`keypress`:if(Cn(n)===0)break a;case`keydown`:case`keyup`:c=Kn;break;case`focusin`:l=`focus`,c=Ln;break;case`focusout`:l=`blur`,c=Ln;break;case`beforeblur`:case`afterblur`:c=Ln;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Fn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=In;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Jn;break;case Wr:case Gr:case Kr:c=Rn;break;case qr:c=Yn;break;case`scroll`:c=An;break;case`wheel`:c=Xn;break;case`copy`:case`cut`:case`paste`:c=zn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=qn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Qe(p,f),h!=null&&u.push(li(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==F&&(l=n.relatedTarget||n.fromElement)&&(Fi(l)||l[ji]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Fi(l):null,l!==null&&(d=st(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Fn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=qn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Li(c),m=l==null?s:Li(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Fi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ui(m))p++;for(m=0,h=f;h;h=ui(h))m++;for(;0<p-m;)u=ui(u),p--;for(;0<m-p;)f=ui(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ui(u),f=ui(f)}u=null}else u=null;c!==null&&di(o,s,c,u,!1),l!==null&&d!==null&&di(o,d,l,u,!0)}}a:{if(s=r?Li(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=mr;else if(lr(s)){if(hr)g=wr;else{g=Sr;var _=xr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Cr);if(g&&=g(e,r)){ur(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Ce(s,`number`,s.value)}switch(_=r?Li(r):window,e){case`focusin`:(lr(_)||_.contentEditable===`true`)&&(Fr=_,Ir=r,Lr=null);break;case`focusout`:Lr=Ir=Fr=null;break;case`mousedown`:Rr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Rr=!1,zr(o,n,i);break;case`selectionchange`:if(Pr)break;case`keydown`:case`keyup`:zr(o,n,i)}var v;if(Qn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else ar?rr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(er&&n.locale!==`ko`&&(ar||y!==`onCompositionStart`?y===`onCompositionEnd`&&ar&&(v=Sn()):(yn=i,bn=`value`in yn?yn.value:yn.textContent,ar=!0)),_=K(r,y),0<_.length&&(y=new Bn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ir(n),v!==null&&(y.data=v)))),(v=U?or(e,n):sr(e,n))&&(r=K(r,`onBeforeInput`),0<r.length&&(i=new Bn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ni(o,t)})}function li(e,t,n){return{instance:e,listener:t,currentTarget:n}}function K(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Qe(e,n),a!=null&&r.unshift(li(e,a,i)),a=Qe(e,t),a!=null&&r.push(li(e,a,i))),e=e.return}return r}function ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function di(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Qe(n,a),c!=null&&o.unshift(li(n,c,s))):i||(c=Qe(n,a),c!=null&&o.push(li(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var fi=/\r\n?/g,pi=/\u0000|\uFFFD/g;function mi(e){return(typeof e==`string`?e:``+e).replace(fi,`
6
- `).replace(pi,``)}function hi(e,t,n){if(t=mi(t),mi(e)!==t&&n)throw Error(r(425))}function gi(){}var _i=null,vi=null;function yi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bi=typeof setTimeout==`function`?setTimeout:void 0,xi=typeof clearTimeout==`function`?clearTimeout:void 0,Si=typeof Promise==`function`?Promise:void 0,Ci=typeof queueMicrotask==`function`?queueMicrotask:Si===void 0?bi:function(e){return Si.resolve(null).then(e).catch(wi)};function wi(e){setTimeout(function(){throw e})}function Ti(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),un(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);un(t)}function Ei(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Di(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Oi=Math.random().toString(36).slice(2),ki=`__reactFiber$`+Oi,Ai=`__reactProps$`+Oi,ji=`__reactContainer$`+Oi,Mi=`__reactEvents$`+Oi,Ni=`__reactListeners$`+Oi,Pi=`__reactHandles$`+Oi;function Fi(e){var t=e[ki];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ji]||n[ki]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Di(e);e!==null;){if(n=e[ki])return n;e=Di(e)}return t}e=n,n=e.parentNode}return null}function Ii(e){return e=e[ki]||e[ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Li(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ri(e){return e[Ai]||null}var zi=[],Bi=-1;function Vi(e){return{current:e}}function q(e){0>Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function J(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Hi={},Ui=Vi(Hi),Wi=Vi(!1),Gi=Hi;function Ki(e,t){var n=e.type.contextTypes;if(!n)return Hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qi(e){return e=e.childContextTypes,e!=null}function Ji(){q(Wi),q(Ui)}function Yi(e,t,n){if(Ui.current!==Hi)throw Error(r(168));J(Ui,t),J(Wi,n)}function Xi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,de(e)||`Unknown`,a));return P({},n,i)}function Zi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Hi,Gi=Ui.current,J(Ui,e),J(Wi,Wi.current),!0}function Qi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Xi(e,t,Gi),i.__reactInternalMemoizedMergedChildContext=e,q(Wi),q(Ui),J(Ui,e)):q(Wi),J(Wi,n)}var $i=null,ea=!1,ta=!1;function na(e){$i===null?$i=[e]:$i.push(e)}function ra(e){ea=!0,na(e)}function ia(){if(!ta&&$i!==null){ta=!0;var e=0,t=z;try{var n=$i;for(z=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$i=null,ea=!1}catch(t){throw $i!==null&&($i=$i.slice(e+1)),pt(yt,ia),t}finally{z=t,ta=!1}}return null}var aa=[],Y=0,oa=null,sa=0,ca=[],la=0,ua=null,da=1,fa=``;function pa(e,t){aa[Y++]=sa,aa[Y++]=oa,oa=e,sa=t}function ma(e,t,n){ca[la++]=da,ca[la++]=fa,ca[la++]=ua,ua=e;var r=da;e=fa;var i=32-Dt(r)-1;r&=~(1<<i),n+=1;var a=32-Dt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,da=1<<32-Dt(t)+i|n<<i|r,fa=a+e}else da=1<<a|n<<i|r,fa=e}function ha(e){e.return!==null&&(pa(e,1),ma(e,1,0))}function ga(e){for(;e===oa;)oa=aa[--Y],aa[Y]=null,sa=aa[--Y],aa[Y]=null;for(;e===ua;)ua=ca[--la],ca[la]=null,fa=ca[--la],ca[la]=null,da=ca[--la],ca[la]=null}var _a=null,X=null,Z=!1,va=null;function ya(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ba(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,_a=e,X=Ei(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,_a=e,X=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ua===null?null:{id:da,overflow:fa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,_a=e,X=null,!0);default:return!1}}function xa(e){return!!(e.mode&1)&&!(e.flags&128)}function Sa(e){if(Z){var t=X;if(t){var n=t;if(!ba(e,t)){if(xa(e))throw Error(r(418));t=Ei(n.nextSibling);var i=_a;t&&ba(e,t)?ya(i,n):(e.flags=e.flags&-4097|2,Z=!1,_a=e)}}else{if(xa(e))throw Error(r(418));e.flags=e.flags&-4097|2,Z=!1,_a=e}}}function Ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;_a=e}function wa(e){if(e!==_a)return!1;if(!Z)return Ca(e),Z=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!yi(e.type,e.memoizedProps)),t&&=X){if(xa(e))throw Ta(),Error(r(418));for(;t;)ya(e,t),t=Ei(t.nextSibling)}if(Ca(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){X=Ei(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}X=null}}else X=_a?Ei(e.stateNode.nextSibling):null;return!0}function Ta(){for(var e=X;e;)e=Ei(e.nextSibling)}function Ea(){X=_a=null,Z=!1}function Da(e){va===null?va=[e]:va.push(e)}var Oa=C.ReactCurrentBatchConfig;function ka(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Aa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function ja(e){var t=e._init;return t(e._payload)}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===T?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===N&&ja(i)===t.type)?(r=a(t,n.props),r.ref=ka(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=ka(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case ee:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=ka(e,null,t),n.return=e,n;case w:return t=eu(t,e.mode,n),t.return=e,t;case N:var r=t._init;return f(e,r(t._payload),n)}if(we(t)||ie(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case ee:return n.key===i?l(e,t,n,r):null;case w:return n.key===i?u(e,t,n,r):null;case N:return i=n._init,p(e,t,i(n._payload),r)}if(we(n)||ie(n))return i===null?d(e,t,n,r,null):null;Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case ee:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case w:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(we(r)||ie(r))return e=e.get(n)||null,d(t,e,r,i,null);Aa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Z&&pa(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Z&&pa(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Z&&pa(r,h),l}function g(a,s,c,l){var u=ie(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Z&&pa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Z&&pa(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Z&&pa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===T&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ee:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===T){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===N&&ja(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ka(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===T?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=ka(e,r,i),o.return=e,e=o)}return s(e);case w:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case N:return l=i._init,_(e,r,l(i._payload),o)}if(we(i))return h(e,r,i,o);if(ie(i))return g(e,r,i,o);Aa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Na=Ma(!0),Pa=Ma(!1),Fa=Vi(null),Ia=null,La=null,Ra=null;function za(){Ra=La=Ia=null}function Ba(e){var t=Fa.current;q(Fa),e._currentValue=t}function Va(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ha(e,t){Ia=e,Ra=La=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ms=!0),e.firstContext=null)}function Ua(e){var t=e._currentValue;if(Ra!==e){if(e={context:e,memoizedValue:t,next:null},La===null){if(Ia===null)throw Error(r(308));La=e,Ia.dependencies={lanes:0,firstContext:e}}else La=La.next=e}return t}var Wa=null;function Ga(e){Wa===null?Wa=[e]:Wa.push(e)}function Ka(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ga(t)):(n.next=i.next,i.next=n),t.interleaved=n,qa(e,r)}function qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ja=!1;function Ya(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Za(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ga(r)):(t.next=i.next,i.next=t),r.interleaved=t,qa(e,n)}function $a(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ht(e,n)}}function eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function to(e,t,n,r){var i=e.updateQueue;Ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=P({},d,f);break a;case 2:Ja=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function no(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var ro={},io=Vi(ro),ao=Vi(ro),oo=Vi(ro);function so(e){if(e===ro)throw Error(r(174));return e}function co(e,t){switch(J(oo,t),J(ao,e),J(io,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:je(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=je(t,e)}q(io),J(io,t)}function lo(){q(io),q(ao),q(oo)}function uo(e){so(oo.current);var t=so(io.current),n=je(t,e.type);t!==n&&(J(ao,e),J(io,n))}function fo(e){ao.current===e&&(q(io),q(ao))}var po=Vi(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=[];function go(){for(var e=0;e<ho.length;e++)ho[e]._workInProgressVersionPrimary=null;ho.length=0}var _o=C.ReactCurrentDispatcher,vo=C.ReactCurrentBatchConfig,yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=0,Eo=0;function Do(){throw Error(r(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Er(e[n],t[n]))return!1;return!0}function ko(e,t,n,i,a,o){if(yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_o.current=e===null||e.memoizedState===null?fs:ps,e=n(i,a),wo){o=0;do{if(wo=!1,To=0,25<=o)throw Error(r(301));o+=1,So=xo=null,t.updateQueue=null,_o.current=ms,e=n(i,a)}while(wo)}if(_o.current=ds,t=xo!==null&&xo.next!==null,yo=0,So=xo=bo=null,Co=!1,t)throw Error(r(300));return e}function Ao(){var e=To!==0;return To=0,e}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Mo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw Error(r(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=xo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((yo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,bo.lanes|=d,Jc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Er(i,t.memoizedState)||(Ms=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,bo.lanes|=o,Jc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Er(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(e,t){var n=bo,i=Mo(),a=t(),o=!Er(i.memoizedState,a);if(o&&(i.memoizedState=a,Ms=!0),i=i.queue,Yo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Wo(9,zo.bind(null,n,i,a,t),void 0,null),Vc===null)throw Error(r(349));yo&30||Ro(n,t,a)}return a}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Er(e,n)}catch{return!0}}function Ho(e){var t=qa(e,1);t!==null&&ml(t,e,1,-1)}function Uo(e){var t=jo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t.queue=e,e=e.dispatch=ss.bind(null,bo,e),[t.memoizedState,e]}function Wo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Go(){return Mo().memoizedState}function Ko(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Wo(1|t,n,void 0,r===void 0?null:r)}function qo(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=void 0;if(xo!==null){var o=xo.memoizedState;if(a=o.destroy,r!==null&&Oo(r,o.deps)){i.memoizedState=Wo(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Wo(1|t,n,a,r)}function Jo(e,t){return Ko(8390656,8,e,t)}function Yo(e,t){return qo(2048,8,e,t)}function Xo(e,t){return qo(4,2,e,t)}function Zo(e,t){return qo(4,4,e,t)}function Qo(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $o(e,t,n){return n=n==null?null:n.concat([e]),qo(4,4,Qo.bind(null,t,e),n)}function es(){}function ts(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ns(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rs(e,t,n){return yo&21?(Er(n,t)||(n=Rt(),bo.lanes|=n,Jc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ms=!0),e.memoizedState=n)}function is(e,t){var n=z;z=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{z=n,vo.transition=r}}function as(){return Mo().memoizedState}function os(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cs(e))ls(t,n);else if(n=Ka(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),us(n,t,r)}}function ss(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cs(e))ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o)){var c=t.interleaved;c===null?(i.next=i,Ga(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ka(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),us(n,t,r))}}function cs(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function ls(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function us(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ht(e,n)}}var ds={readContext:Ua,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useInsertionEffect:Do,useLayoutEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useMutableSource:Do,useSyncExternalStore:Do,useId:Do,unstable_isNewReconciler:!1},fs={readContext:Ua,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:Ua,useEffect:Jo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Ko(4194308,4,Qo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=os.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:es,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=is.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=bo,a=jo();if(Z){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));yo&30||Ro(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Jo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Wo(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Vc.identifierPrefix;if(Z){var n=fa,r=da;n=(r&~(1<<32-Dt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Eo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ps={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Po,useRef:Go,useState:function(){return Po(No)},useDebugValue:es,useDeferredValue:function(e){return rs(Mo(),xo.memoizedState,e)},useTransition:function(){return[Po(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1},ms={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Fo,useRef:Go,useState:function(){return Fo(No)},useDebugValue:es,useDeferredValue:function(e){var t=Mo();return xo===null?t.memoizedState=e:rs(t,xo.memoizedState,e)},useTransition:function(){return[Fo(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1};function hs(e,t){if(e&&e.defaultProps){for(var n in t=P({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:P({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var _s={isMounted:function(e){return(e=e._reactInternals)?st(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fl(),r=pl(e),i=Za(n,r);i.tag=2,t!=null&&(i.callback=t),t=Qa(e,i,r),t!==null&&(ml(t,e,r,n),$a(t,e,r))}};function vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Dr(n,r)||!Dr(i,a):!0}function ys(e,t,n){var r=!1,i=Hi,a=t.contextType;return typeof a==`object`&&a?a=Ua(a):(i=qi(t)?Gi:Ui.current,r=t.contextTypes,a=(r=r!=null)?Ki(e,i):Hi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_s,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&_s.enqueueReplaceState(t,t.state,null)}function xs(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ya(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ua(a):(a=qi(t)?Gi:Ui.current,i.context=Ki(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(gs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&_s.enqueueReplaceState(i,i.state,null),to(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ss(e,t){try{var n=``,r=t;do n+=le(r),r=r.return;while(r);var i=n}catch(e){i=`
5
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ae(e):``}function ce(e){switch(e.tag){case 5:return ae(e.type);case 16:return ae(`Lazy`);case 13:return ae(`Suspense`);case 19:return ae(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function le(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case ee:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function ue(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return le(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function de(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function pe(e){var t=fe(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.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]}}}}function me(e){e._valueTracker||=pe(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=fe(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ge(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function _e(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ve(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=de(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ye(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function be(e,t){ye(e,t);var n=de(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Se(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Se(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Se(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ce=Array.isArray;function we(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=``+de(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Te(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Ee(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(Ce(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:de(n)}}function De(e,t){var n=de(t.value),r=de(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Oe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function ke(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Ae(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?ke(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var je,Me=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(je||=document.createElement(`div`),je.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ne(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var I={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Pe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(I).forEach(function(e){Pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),I[t]=I[e]})});function Fe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||I.hasOwnProperty(e)&&I[e]?(``+t).trim():t+`px`}function Ie(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Fe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Le=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Re(e,t){if(t){if(Le[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function ze(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 L=null;function Be(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var R=null,Ve=null,He=null;function Ue(e){if(e=Ni(e)){if(typeof R!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Fi(t),R(e.stateNode,e.type,t))}}function We(e){Ve?He?He.push(e):He=[e]:Ve=e}function Ge(){if(Ve){var e=Ve,t=He;if(He=Ve=null,Ue(e),t)for(e=0;e<t.length;e++)Ue(t[e])}}function Ke(e,t){return e(t)}function qe(){}var Je=!1;function Ye(e,t,n){if(Je)return e(t,n);Je=!0;try{return Ke(e,t,n)}finally{Je=!1,(Ve!==null||He!==null)&&(qe(),Ge())}}function Xe(e,t){var n=e.stateNode;if(n===null)return null;var i=Fi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ze=!1;if(c)try{var Qe={};Object.defineProperty(Qe,"passive",{get:function(){Ze=!0}}),window.addEventListener(`test`,Qe,Qe),window.removeEventListener(`test`,Qe,Qe)}catch{Ze=!1}function $e(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var et=!1,tt=null,nt=!1,rt=null,it={onError:function(e){et=!0,tt=e}};function at(e,t,n,r,i,a,o,s,c){et=!1,tt=null,$e.apply(it,arguments)}function ot(e,t,n,i,a,o,s,c,l){if(at.apply(this,arguments),et){if(et){var u=tt;et=!1,tt=null}else throw Error(r(198));nt||(nt=!0,rt=u)}}function st(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ct(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function lt(e){if(st(e)!==e)throw Error(r(188))}function ut(e){var t=e.alternate;if(!t){if(t=st(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return lt(a),e;if(o===i)return lt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function dt(e){return e=ut(e),e===null?null:z(e)}function z(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=z(e);if(t!==null)return t;e=e.sibling}return null}var B=n.unstable_scheduleCallback,ft=n.unstable_cancelCallback,pt=n.unstable_shouldYield,mt=n.unstable_requestPaint,ht=n.unstable_now,gt=n.unstable_getCurrentPriorityLevel,_t=n.unstable_ImmediatePriority,vt=n.unstable_UserBlockingPriority,yt=n.unstable_NormalPriority,bt=n.unstable_LowPriority,xt=n.unstable_IdlePriority,St=null,Ct=null;function wt(e){if(Ct&&typeof Ct.onCommitFiberRoot==`function`)try{Ct.onCommitFiberRoot(St,e,void 0,(e.current.flags&128)==128)}catch{}}var Tt=Math.clz32?Math.clz32:Ot,Et=Math.log,Dt=Math.LN2;function Ot(e){return e>>>=0,e===0?32:31-(Et(e)/Dt|0)|0}var kt=64,At=4194304;function jt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Mt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=jt(a))):r=jt(s)}else o=n&~i,o===0?a!==0&&(r=jt(a)):r=jt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Tt(t),i=1<<n,r|=e[n],t&=~i;return r}function Nt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Tt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Nt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Ft(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function It(){var e=kt;return kt<<=1,!(kt&4194240)&&(kt=64),e}function Lt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Rt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function zt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Tt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var V=0;function Vt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ht,Ut,Wt,Gt,Kt,qt=!1,Jt=[],Yt=null,Xt=null,Zt=null,Qt=new Map,$t=new Map,en=[],tn=`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 submit`.split(` `);function nn(e,t){switch(e){case`focusin`:case`focusout`:Yt=null;break;case`dragenter`:case`dragleave`:Xt=null;break;case`mouseover`:case`mouseout`:Zt=null;break;case`pointerover`:case`pointerout`:Qt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:$t.delete(t.pointerId)}}function rn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ni(t),t!==null&&Ut(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function an(e,t,n,r,i){switch(t){case`focusin`:return Yt=rn(Yt,e,t,n,r,i),!0;case`dragenter`:return Xt=rn(Xt,e,t,n,r,i),!0;case`mouseover`:return Zt=rn(Zt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Qt.set(a,rn(Qt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,$t.set(a,rn($t.get(a)||null,e,t,n,r,i)),!0}return!1}function on(e){var t=Mi(e.target);if(t!==null){var n=st(t);if(n!==null){if(t=n.tag,t===13){if(t=ct(n),t!==null){e.blockedOn=t,Kt(e.priority,function(){Wt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function H(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);L=r,n.target.dispatchEvent(r),L=null}else return t=Ni(n),t!==null&&Ut(t),e.blockedOn=n,!1;t.shift()}return!0}function sn(e,t,n){H(e)&&n.delete(t)}function cn(){qt=!1,Yt!==null&&H(Yt)&&(Yt=null),Xt!==null&&H(Xt)&&(Xt=null),Zt!==null&&H(Zt)&&(Zt=null),Qt.forEach(sn),$t.forEach(sn)}function ln(e,t){e.blockedOn===t&&(e.blockedOn=null,qt||(qt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cn)))}function un(e){function t(t){return ln(t,e)}if(0<Jt.length){ln(Jt[0],e);for(var n=1;n<Jt.length;n++){var r=Jt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yt!==null&&ln(Yt,e),Xt!==null&&ln(Xt,e),Zt!==null&&ln(Zt,e),Qt.forEach(t),$t.forEach(t),n=0;n<en.length;n++)r=en[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<en.length&&(n=en[0],n.blockedOn===null);)on(n),n.blockedOn===null&&en.shift()}var U=C.ReactCurrentBatchConfig,W=!0;function dn(e,t,n,r){var i=V,a=U.transition;U.transition=null;try{V=1,pn(e,t,n,r)}finally{V=i,U.transition=a}}function fn(e,t,n,r){var i=V,a=U.transition;U.transition=null;try{V=4,pn(e,t,n,r)}finally{V=i,U.transition=a}}function pn(e,t,n,r){if(W){var i=hn(e,t,n,r);if(i===null)ai(e,t,r,mn,n),nn(e,r);else if(an(i,e,t,n,r))r.stopPropagation();else if(nn(e,r),t&4&&-1<tn.indexOf(e)){for(;i!==null;){var a=Ni(i);if(a!==null&&Ht(a),a=hn(e,t,n,r),a===null&&ai(e,t,r,mn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ai(e,t,r,null,n)}}var mn=null;function hn(e,t,n,r){if(mn=null,e=Be(r),e=Mi(e),e!==null){if(t=st(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ct(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return mn=e,null}function gn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(gt()){case _t:return 1;case vt:return 4;case yt:case bt:return 16;case xt:return 536870912;default:return 16}default:return 16}}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return yn=i.slice(e,1<r?1-r:void 0)}function xn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Sn(){return!0}function Cn(){return!1}function wn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Sn:Cn,this.isPropagationStopped=Cn,this}return F(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Sn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Sn)},persist:function(){},isPersistent:Sn}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=F({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=F({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Un,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(F({},Mn,{dataTransfer:0})),Fn=wn(F({},Dn,{relatedTarget:0})),In=wn(F({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(F({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(F({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={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`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Un(){return Hn}var Wn=wn(F({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=xn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Un,charCode:function(e){return e.type===`keypress`?xn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?xn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Gn=wn(F({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=wn(F({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Un})),qn=wn(F({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Jn=wn(F({},Mn,{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})),Yn=[9,13,27,32],Xn=c&&`CompositionEvent`in window,Zn=null;c&&`documentMode`in document&&(Zn=document.documentMode);var Qn=c&&`TextEvent`in window&&!Zn,$n=c&&(!Xn||Zn&&8<Zn&&11>=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function G(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return G(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Xn&&nr(e,t)?(e=bn(),yn=vn=_n=null,rr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return $n&&t.locale!==`ko`?null:t.data;default:return null}}var or={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 sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!or[e.type]:t===`textarea`}function cr(e,t,n,r){We(r),t=si(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var lr=null,ur=null;function dr(e){ei(e,0)}function fr(e){if(he(Pi(e)))return e}function pr(e,t){if(e===`change`)return t}var mr=!1;if(c){var K;if(c){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}K=hr}else K=!1;mr=K&&(!document.documentMode||9<document.documentMode)}function _r(){lr&&(lr.detachEvent(`onpropertychange`,vr),ur=lr=null)}function vr(e){if(e.propertyName===`value`&&fr(ur)){var t=[];cr(t,ur,e,Be(e)),Ye(dr,t)}}function yr(e,t,n){e===`focusin`?(_r(),lr=t,ur=n,lr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return fr(ur)}function xr(e,t){if(e===`click`)return fr(t)}function Sr(e,t){if(e===`input`||e===`change`)return fr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function jr(e){var t=kr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Or(n.ownerDocument.documentElement,n)){if(r!==null&&Ar(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Dr(n,a);var o=Dr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Mr=c&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==ge(r)||(r=Nr,`selectionStart`in r&&Ar(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fr&&Tr(Fr,r)||(Fr=r,r=si(Pr,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Nr)))}function Rr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var zr={animationend:Rr(`Animation`,`AnimationEnd`),animationiteration:Rr(`Animation`,`AnimationIteration`),animationstart:Rr(`Animation`,`AnimationStart`),transitionend:Rr(`Transition`,`TransitionEnd`)},Br={},Vr={};c&&(Vr=document.createElement(`div`).style,`AnimationEvent`in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),`TransitionEvent`in window||delete zr.transitionend.transition);function Hr(e){if(Br[e])return Br[e];if(!zr[e])return e;var t=zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vr)return Br[e]=t[n];return e}var Ur=Hr(`animationend`),q=Hr(`animationiteration`),Wr=Hr(`animationstart`),Gr=Hr(`transitionend`),Kr=new Map,qr=`abort auxClick 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 Jr(e,t){Kr.set(e,t),o(t,[e])}for(var Yr=0;Yr<qr.length;Yr++){var Xr=qr[Yr];Jr(Xr.toLowerCase(),`on`+(Xr[0].toUpperCase()+Xr.slice(1)))}Jr(Ur,`onAnimationEnd`),Jr(q,`onAnimationIteration`),Jr(Wr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Gr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Zr=`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(` `),Qr=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Zr));function $r(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ot(r,t,void 0,e),e.currentTarget=null}function ei(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;$r(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;$r(i,s,l),a=c}}}if(nt)throw e=rt,nt=!1,rt=null,e}function J(e,t){var n=t[ki];n===void 0&&(n=t[ki]=new Set);var r=e+`__bubble`;n.has(r)||(ii(t,e,2,!1),n.add(r))}function ti(e,t,n){var r=0;t&&(r|=4),ii(n,e,r,t)}var ni=`_reactListening`+Math.random().toString(36).slice(2);function ri(e){if(!e[ni]){e[ni]=!0,i.forEach(function(t){t!==`selectionchange`&&(Qr.has(t)||ti(t,!1,e),ti(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ni]||(t[ni]=!0,ti(`selectionchange`,!1,t))}}function ii(e,t,n,r){switch(gn(t)){case 1:var i=dn;break;case 4:i=fn;break;default:i=pn}n=i.bind(null,t,n,e),i=void 0,!Ze||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ai(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Mi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ye(function(){var r=a,i=Be(n),o=[];a:{var s=Kr.get(e);if(s!==void 0){var c=En,l=e;switch(e){case`keypress`:if(xn(n)===0)break a;case`keydown`:case`keyup`:c=Wn;break;case`focusin`:l=`focus`,c=Fn;break;case`focusout`:l=`blur`,c=Fn;break;case`beforeblur`:case`afterblur`:c=Fn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Kn;break;case Ur:case q:case Wr:c=In;break;case Gr:c=qn;break;case`scroll`:c=On;break;case`wheel`:c=Jn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Gn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Xe(p,f),h!=null&&u.push(oi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==L&&(l=n.relatedTarget||n.fromElement)&&(Mi(l)||l[Oi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Mi(l):null,l!==null&&(d=st(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Nn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Gn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Pi(c),m=l==null?s:Pi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Mi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ci(m))p++;for(m=0,h=f;h;h=ci(h))m++;for(;0<p-m;)u=ci(u),p--;for(;0<m-p;)f=ci(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ci(u),f=ci(f)}u=null}else u=null;c!==null&&li(o,s,c,u,!1),l!==null&&d!==null&&li(o,d,l,u,!0)}}a:{if(s=r?Pi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=pr;else if(sr(s)){if(mr)g=Sr;else{g=br;var _=yr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=xr);if(g&&=g(e,r)){cr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Se(s,`number`,s.value)}switch(_=r?Pi(r):window,e){case`focusin`:(sr(_)||_.contentEditable===`true`)&&(Nr=_,Pr=r,Fr=null);break;case`focusout`:Fr=Pr=Nr=null;break;case`mousedown`:Ir=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ir=!1,Lr(o,n,i);break;case`selectionchange`:if(Mr)break;case`keydown`:case`keyup`:Lr(o,n,i)}var v;if(Xn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else rr?nr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&($n&&n.locale!==`ko`&&(rr||y!==`onCompositionStart`?y===`onCompositionEnd`&&rr&&(v=bn()):(_n=i,vn=`value`in _n?_n.value:_n.textContent,rr=!0)),_=si(r,y),0<_.length&&(y=new Rn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=G(n),v!==null&&(y.data=v)))),(v=Qn?ir(e,n):ar(e,n))&&(r=si(r,`onBeforeInput`),0<r.length&&(i=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ei(o,t)})}function oi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function si(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Xe(e,n),a!=null&&r.unshift(oi(e,a,i)),a=Xe(e,t),a!=null&&r.push(oi(e,a,i))),e=e.return}return r}function ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function li(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Xe(n,a),c!=null&&o.unshift(oi(n,c,s))):i||(c=Xe(n,a),c!=null&&o.push(oi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ui=/\r\n?/g,di=/\u0000|\uFFFD/g;function Y(e){return(typeof e==`string`?e:``+e).replace(ui,`
6
+ `).replace(di,``)}function fi(e,t,n){if(t=Y(t),Y(e)!==t&&n)throw Error(r(425))}function pi(){}var mi=null,hi=null;function gi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _i=typeof setTimeout==`function`?setTimeout:void 0,vi=typeof clearTimeout==`function`?clearTimeout:void 0,yi=typeof Promise==`function`?Promise:void 0,bi=typeof queueMicrotask==`function`?queueMicrotask:yi===void 0?_i:function(e){return yi.resolve(null).then(e).catch(xi)};function xi(e){setTimeout(function(){throw e})}function Si(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),un(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);un(t)}function Ci(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function wi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ti=Math.random().toString(36).slice(2),Ei=`__reactFiber$`+Ti,Di=`__reactProps$`+Ti,Oi=`__reactContainer$`+Ti,ki=`__reactEvents$`+Ti,Ai=`__reactListeners$`+Ti,ji=`__reactHandles$`+Ti;function Mi(e){var t=e[Ei];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Oi]||n[Ei]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wi(e);e!==null;){if(n=e[Ei])return n;e=wi(e)}return t}e=n,n=e.parentNode}return null}function Ni(e){return e=e[Ei]||e[Oi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Pi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Fi(e){return e[Di]||null}var Ii=[],Li=-1;function Ri(e){return{current:e}}function zi(e){0>Li||(e.current=Ii[Li],Ii[Li]=null,Li--)}function X(e,t){Li++,Ii[Li]=e.current,e.current=t}var Bi={},Vi=Ri(Bi),Hi=Ri(!1),Ui=Bi;function Wi(e,t){var n=e.type.contextTypes;if(!n)return Bi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Gi(e){return e=e.childContextTypes,e!=null}function Ki(){zi(Hi),zi(Vi)}function qi(e,t,n){if(Vi.current!==Bi)throw Error(r(168));X(Vi,t),X(Hi,n)}function Ji(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ue(e)||`Unknown`,a));return F({},n,i)}function Yi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bi,Ui=Vi.current,X(Vi,e),X(Hi,Hi.current),!0}function Xi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Ji(e,t,Ui),i.__reactInternalMemoizedMergedChildContext=e,zi(Hi),zi(Vi),X(Vi,e)):zi(Hi),X(Hi,n)}var Zi=null,Qi=!1,$i=!1;function ea(e){Zi===null?Zi=[e]:Zi.push(e)}function ta(e){Qi=!0,ea(e)}function na(){if(!$i&&Zi!==null){$i=!0;var e=0,t=V;try{var n=Zi;for(V=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Zi=null,Qi=!1}catch(t){throw Zi!==null&&(Zi=Zi.slice(e+1)),B(_t,na),t}finally{V=t,$i=!1}}return null}var ra=[],ia=0,aa=null,oa=0,sa=[],ca=0,la=null,Z=1,ua=``;function da(e,t){ra[ia++]=oa,ra[ia++]=aa,aa=e,oa=t}function fa(e,t,n){sa[ca++]=Z,sa[ca++]=ua,sa[ca++]=la,la=e;var r=Z;e=ua;var i=32-Tt(r)-1;r&=~(1<<i),n+=1;var a=32-Tt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Z=1<<32-Tt(t)+i|n<<i|r,ua=a+e}else Z=1<<a|n<<i|r,ua=e}function pa(e){e.return!==null&&(da(e,1),fa(e,1,0))}function ma(e){for(;e===aa;)aa=ra[--ia],ra[ia]=null,oa=ra[--ia],ra[ia]=null;for(;e===la;)la=sa[--ca],sa[ca]=null,ua=sa[--ca],sa[ca]=null,Z=sa[--ca],sa[ca]=null}var ha=null,ga=null,_a=!1,va=null;function ya(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ba(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,ha=e,ga=Ci(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ha=e,ga=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=la===null?null:{id:Z,overflow:ua},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ha=e,ga=null,!0);default:return!1}}function xa(e){return!!(e.mode&1)&&!(e.flags&128)}function Sa(e){if(_a){var t=ga;if(t){var n=t;if(!ba(e,t)){if(xa(e))throw Error(r(418));t=Ci(n.nextSibling);var i=ha;t&&ba(e,t)?ya(i,n):(e.flags=e.flags&-4097|2,_a=!1,ha=e)}}else{if(xa(e))throw Error(r(418));e.flags=e.flags&-4097|2,_a=!1,ha=e}}}function Ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ha=e}function wa(e){if(e!==ha)return!1;if(!_a)return Ca(e),_a=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!gi(e.type,e.memoizedProps)),t&&=ga){if(xa(e))throw Ta(),Error(r(418));for(;t;)ya(e,t),t=Ci(t.nextSibling)}if(Ca(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){ga=Ci(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ga=null}}else ga=ha?Ci(e.stateNode.nextSibling):null;return!0}function Ta(){for(var e=ga;e;)e=Ci(e.nextSibling)}function Ea(){ga=ha=null,_a=!1}function Da(e){va===null?va=[e]:va.push(e)}var Oa=C.ReactCurrentBatchConfig;function ka(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Aa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function ja(e){var t=e._init;return t(e._payload)}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===P&&ja(i)===t.type)?(r=a(t,n.props),r.ref=ka(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=ka(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=ka(e,null,t),n.return=e,n;case T:return t=eu(t,e.mode,n),t.return=e,t;case P:var r=t._init;return f(e,r(t._payload),n)}if(Ce(t)||re(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case P:return i=n._init,p(e,t,i(n._payload),r)}if(Ce(n)||re(n))return i===null?d(e,t,n,r,null):null;Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case P:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Ce(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);Aa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),_a&&da(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return _a&&da(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),_a&&da(r,h),l}function g(a,s,c,l){var u=re(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),_a&&da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return _a&&da(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),_a&&da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===P&&ja(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ka(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=ka(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case P:return l=i._init,_(e,r,l(i._payload),o)}if(Ce(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Aa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Na=Ma(!0),Pa=Ma(!1),Fa=Ri(null),Ia=null,La=null,Ra=null;function za(){Ra=La=Ia=null}function Ba(e){var t=Fa.current;zi(Fa),e._currentValue=t}function Va(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ha(e,t){Ia=e,Ra=La=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ms=!0),e.firstContext=null)}function Ua(e){var t=e._currentValue;if(Ra!==e){if(e={context:e,memoizedValue:t,next:null},La===null){if(Ia===null)throw Error(r(308));La=e,Ia.dependencies={lanes:0,firstContext:e}}else La=La.next=e}return t}var Wa=null;function Ga(e){Wa===null?Wa=[e]:Wa.push(e)}function Ka(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ga(t)):(n.next=i.next,i.next=n),t.interleaved=n,qa(e,r)}function qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ja=!1;function Ya(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Za(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ga(r)):(t.next=i.next,i.next=t),r.interleaved=t,qa(e,n)}function $a(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}function eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function to(e,t,n,r){var i=e.updateQueue;Ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:Ja=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function no(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var ro={},io=Ri(ro),ao=Ri(ro),oo=Ri(ro);function so(e){if(e===ro)throw Error(r(174));return e}function co(e,t){switch(X(oo,t),X(ao,e),X(io,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ae(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ae(t,e)}zi(io),X(io,t)}function lo(){zi(io),zi(ao),zi(oo)}function uo(e){so(oo.current);var t=so(io.current),n=Ae(t,e.type);t!==n&&(X(ao,e),X(io,n))}function fo(e){ao.current===e&&(zi(io),zi(ao))}var po=Ri(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=[];function go(){for(var e=0;e<ho.length;e++)ho[e]._workInProgressVersionPrimary=null;ho.length=0}var _o=C.ReactCurrentDispatcher,vo=C.ReactCurrentBatchConfig,yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=0,Eo=0;function Do(){throw Error(r(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function ko(e,t,n,i,a,o){if(yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_o.current=e===null||e.memoizedState===null?fs:ps,e=n(i,a),wo){o=0;do{if(wo=!1,To=0,25<=o)throw Error(r(301));o+=1,So=xo=null,t.updateQueue=null,_o.current=ms,e=n(i,a)}while(wo)}if(_o.current=ds,t=xo!==null&&xo.next!==null,yo=0,So=xo=bo=null,Co=!1,t)throw Error(r(300));return e}function Ao(){var e=To!==0;return To=0,e}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Mo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw Error(r(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=xo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((yo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,bo.lanes|=d,Jc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,wr(i,t.memoizedState)||(Ms=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,bo.lanes|=o,Jc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);wr(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(e,t){var n=bo,i=Mo(),a=t(),o=!wr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ms=!0),i=i.queue,Yo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Wo(9,zo.bind(null,n,i,a,t),void 0,null),Vc===null)throw Error(r(349));yo&30||Ro(n,t,a)}return a}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Ho(e){var t=qa(e,1);t!==null&&ml(t,e,1,-1)}function Uo(e){var t=jo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t.queue=e,e=e.dispatch=ss.bind(null,bo,e),[t.memoizedState,e]}function Wo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Go(){return Mo().memoizedState}function Ko(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Wo(1|t,n,void 0,r===void 0?null:r)}function qo(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=void 0;if(xo!==null){var o=xo.memoizedState;if(a=o.destroy,r!==null&&Oo(r,o.deps)){i.memoizedState=Wo(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Wo(1|t,n,a,r)}function Jo(e,t){return Ko(8390656,8,e,t)}function Yo(e,t){return qo(2048,8,e,t)}function Xo(e,t){return qo(4,2,e,t)}function Zo(e,t){return qo(4,4,e,t)}function Qo(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $o(e,t,n){return n=n==null?null:n.concat([e]),qo(4,4,Qo.bind(null,t,e),n)}function es(){}function ts(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ns(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rs(e,t,n){return yo&21?(wr(n,t)||(n=It(),bo.lanes|=n,Jc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ms=!0),e.memoizedState=n)}function is(e,t){var n=V;V=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{V=n,vo.transition=r}}function as(){return Mo().memoizedState}function os(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cs(e))ls(t,n);else if(n=Ka(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),us(n,t,r)}}function ss(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cs(e))ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,wr(s,o)){var c=t.interleaved;c===null?(i.next=i,Ga(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ka(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),us(n,t,r))}}function cs(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function ls(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function us(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var ds={readContext:Ua,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useInsertionEffect:Do,useLayoutEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useMutableSource:Do,useSyncExternalStore:Do,useId:Do,unstable_isNewReconciler:!1},fs={readContext:Ua,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:Ua,useEffect:Jo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Ko(4194308,4,Qo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=os.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:es,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=is.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=bo,a=jo();if(_a){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));yo&30||Ro(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Jo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Wo(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Vc.identifierPrefix;if(_a){var n=ua,r=Z;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Eo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ps={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Po,useRef:Go,useState:function(){return Po(No)},useDebugValue:es,useDeferredValue:function(e){return rs(Mo(),xo.memoizedState,e)},useTransition:function(){return[Po(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1},ms={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Fo,useRef:Go,useState:function(){return Fo(No)},useDebugValue:es,useDeferredValue:function(e){var t=Mo();return xo===null?t.memoizedState=e:rs(t,xo.memoizedState,e)},useTransition:function(){return[Fo(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1};function hs(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:F({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var _s={isMounted:function(e){return(e=e._reactInternals)?st(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fl(),r=pl(e),i=Za(n,r);i.tag=2,t!=null&&(i.callback=t),t=Qa(e,i,r),t!==null&&(ml(t,e,r,n),$a(t,e,r))}};function vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Tr(n,r)||!Tr(i,a):!0}function ys(e,t,n){var r=!1,i=Bi,a=t.contextType;return typeof a==`object`&&a?a=Ua(a):(i=Gi(t)?Ui:Vi.current,r=t.contextTypes,a=(r=r!=null)?Wi(e,i):Bi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_s,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&_s.enqueueReplaceState(t,t.state,null)}function xs(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ya(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ua(a):(a=Gi(t)?Ui:Vi.current,i.context=Wi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(gs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&_s.enqueueReplaceState(i,i.state,null),to(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ss(e,t){try{var n=``,r=t;do n+=ce(r),r=r.return;while(r);var i=n}catch(e){i=`
7
7
  Error generating stack: `+e.message+`
8
- `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Cs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ws(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ts=typeof WeakMap==`function`?WeakMap:Map;function Es(e,t,n){n=Za(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){nl||(nl=!0,rl=r),ws(e,t)},n}function Ds(e,t,n){n=Za(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ws(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ws(e,t),typeof r!=`function`&&(il===null?il=new Set([this]):il.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Os(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ts;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function ks(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function As(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Za(-1,1),t.tag=2,Qa(n,t,1))),n.lanes|=1),e)}var js=C.ReactCurrentOwner,Ms=!1;function Ns(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function Ps(e,t,n,r,i){n=n.render;var a=t.ref;return Ha(t,i),r=ko(e,t,n,r,a,i),n=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(Z&&n&&ha(t),t.flags|=1,Ns(e,t,r,i),t.child)}function Fs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Is(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Dr:n,n(o,r)&&e.ref===t.ref)return ec(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Is(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Dr(a,r)&&e.ref===t.ref){if(Ms=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ms=!0);else return t.lanes=e.lanes,ec(e,t,i)}}return zs(e,t,n,r,i)}function Ls(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},J(Gc,Wc),Wc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,J(Gc,Wc),Wc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,J(Gc,Wc),Wc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),J(Gc,Wc),Wc|=r;return Ns(e,t,i,n),t.child}function Rs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zs(e,t,n,r,i){var a=qi(n)?Gi:Ui.current;return a=Ki(t,a),Ha(t,i),n=ko(e,t,n,r,a,i),r=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(Z&&r&&ha(t),t.flags|=1,Ns(e,t,n,i),t.child)}function Bs(e,t,n,r,i){if(qi(n)){var a=!0;Zi(t)}else a=!1;if(Ha(t,i),t.stateNode===null)$s(e,t),ys(t,n,r),xs(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ua(l):(l=qi(n)?Gi:Ui.current,l=Ki(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&bs(t,o,r,l),Ja=!1;var f=t.memoizedState;o.state=f,to(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Wi.current||Ja?(typeof u==`function`&&(gs(t,n,u,r),c=t.memoizedState),(s=Ja||vs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Xa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:hs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ua(c):(c=qi(n)?Gi:Ui.current,c=Ki(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&bs(t,o,r,c),Ja=!1,f=t.memoizedState,o.state=f,to(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Wi.current||Ja?(typeof p==`function`&&(gs(t,n,p,r),m=t.memoizedState),(l=Ja||vs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Vs(e,t,n,r,a,i)}function Vs(e,t,n,r,i,a){Rs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Qi(t,n,!1),ec(e,t,a);r=t.stateNode,js.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Na(t,e.child,null,a),t.child=Na(t,null,s,a)):Ns(e,t,s,a),t.memoizedState=r.state,i&&Qi(t,n,!0),t.child}function Hs(e){var t=e.stateNode;t.pendingContext?Yi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yi(e,t.context,!1),co(e,t.containerInfo)}function Us(e,t,n,r,i){return Ea(),Da(i),t.flags|=256,Ns(e,t,n,r),t.child}var Ws={dehydrated:null,treeContext:null,retryLane:0};function Gs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ks(e,t,n){var r=t.pendingProps,i=po.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),J(po,i&1),e===null)return Sa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Gs(n),t.memoizedState=Ws,e):qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Ys(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Gs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ws,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function qs(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Js(e,t,n,r){return r!==null&&Da(r),Na(t,e.child,null,n),e=qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ys(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Cs(Error(r(422))),Js(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Na(t,e.child,null,s),t.child.memoizedState=Gs(s),t.memoizedState=Ws,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Js(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Cs(o,i,void 0),Js(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ms||c){if(i=Vc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,qa(e,a),ml(i,e,a,-1))}return Ol(),i=Cs(Error(r(421))),Js(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,X=Ei(a.nextSibling),_a=t,Z=!0,va=null,e!==null&&(ca[la++]=da,ca[la++]=fa,ca[la++]=ua,da=e.id,fa=e.overflow,ua=t),t=qs(t,i.children),t.flags|=4096,t)}function Xs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function Zs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function Qs(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ns(e,t,r.children,n),r=po.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xs(e,n,t);else if(e.tag===19)Xs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(J(po,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Zs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Zs(t,!0,n,null,a);break;case`together`:Zs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $s(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tc(e,t,n){switch(t.tag){case 3:Hs(t),Ea();break;case 5:uo(t);break;case 1:qi(t.type)&&Zi(t);break;case 4:co(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;J(Fa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(J(po,po.current&1),e=ec(e,t,n),e===null?null:e.sibling):Ks(e,t,n):(J(po,po.current&1),t.flags|=128,null);J(po,po.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Qs(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),J(po,po.current),r)break;return null;case 22:case 23:return t.lanes=0,Ls(e,t,n)}return ec(e,t,n)}var nc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},rc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,so(io.current);var o=null;switch(n){case`input`:i=ve(e,i),r=ve(e,r),o=[];break;case`select`:i=P({},i,{value:void 0}),r=P({},r,{value:void 0}),o=[];break;case`textarea`:i=Ee(e,i),r=Ee(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}Be(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ri(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ic=function(e,t,n,r){n!==r&&(t.flags|=4)};function ac(e,t){if(!Z)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function sc(e,t,n){var i=t.pendingProps;switch(ga(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oc(t),null;case 1:return qi(t.type)&&Ji(),oc(t),null;case 3:return i=t.stateNode,lo(),q(Wi),q(Ui),go(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,va!==null&&(vl(va),va=null))),oc(t),null;case 5:fo(t);var o=so(oo.current);if(n=t.type,e!==null&&t.stateNode!=null)rc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return oc(t),null}if(e=so(io.current),wa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=!!(t.mode&1),n){case`dialog`:ri(`cancel`,i),ri(`close`,i);break;case`iframe`:case`object`:case`embed`:ri(`load`,i);break;case`video`:case`audio`:for(o=0;o<$r.length;o++)ri($r[o],i);break;case`source`:ri(`error`,i);break;case`img`:case`image`:case`link`:ri(`error`,i),ri(`load`,i);break;case`details`:ri(`toggle`,i);break;case`input`:ye(i,s),ri(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ri(`invalid`,i);break;case`textarea`:De(i,s),ri(`invalid`,i)}for(var c in Be(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ri(`scroll`,i)}switch(n){case`input`:he(i),Se(i,s,!0);break;case`textarea`:he(i),ke(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Ae(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,nc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ve(n,i),n){case`dialog`:ri(`cancel`,e),ri(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ri(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<$r.length;o++)ri($r[o],e);o=i;break;case`source`:ri(`error`,e),o=i;break;case`img`:case`image`:case`link`:ri(`error`,e),ri(`load`,e),o=i;break;case`details`:ri(`toggle`,e),o=i;break;case`input`:ye(e,i),o=ve(e,i),ri(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=P({},i,{value:void 0}),ri(`invalid`,e);break;case`textarea`:De(e,i),o=Ee(e,i),ri(`invalid`,e);break;default:o=i}for(s in Be(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Re(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ne(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Pe(e,u):typeof u==`number`&&Pe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ri(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:he(e),Se(e,i,!1);break;case`textarea`:he(e),ke(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+fe(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Te(e,!!i.multiple,i.defaultValue,!0):Te(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return oc(t),null;case 6:if(e&&t.stateNode!=null)ic(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=so(oo.current),so(io.current),wa(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=_a,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return oc(t),null;case 13:if(q(po),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Z&&X!==null&&t.mode&1&&!(t.flags&128))Ta(),Ea(),t.flags|=98560,s=!1;else if(s=wa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else Ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;oc(t),s=!1}else va!==null&&(vl(va),va=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||po.current&1?Kc===0&&(Kc=3):Ol())),t.updateQueue!==null&&(t.flags|=4),oc(t),null);case 4:return lo(),e===null&&oi(t.stateNode.containerInfo),oc(t),null;case 10:return Ba(t.type._context),oc(t),null;case 17:return qi(t.type)&&Ji(),oc(t),null;case 19:if(q(po),s=t.memoizedState,s===null)return oc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)ac(s,!1);else{if(Kc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=mo(e),c!==null){for(t.flags|=128,ac(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return J(po,po.current&1|2),t.child}e=e.sibling}s.tail!==null&&_t()>el&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}}else{if(!i){if(e=mo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ac(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Z)return oc(t),null}else 2*_t()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(oc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=_t(),t.sibling=null,n=po.current,J(po,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(oc(t),t.subtreeFlags&6&&(t.flags|=8192)):oc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function cc(e,t){switch(ga(t),t.tag){case 1:return qi(t.type)&&Ji(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),q(Wi),q(Ui),go(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fo(t),null;case 13:if(q(po),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(po),null;case 4:return lo(),null;case 10:return Ba(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var lc=!1,uc=!1,dc=typeof WeakSet==`function`?WeakSet:Set,Q=null;function fc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}}function pc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var mc=!1;function hc(e,t){if(_i=fn,e=jr(),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},fn=!1,Q=t;Q!==null;)if(t=Q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:hs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return h=mc,mc=!1,h}function gc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&pc(t,n,a)}i=i.next}while(i!==r)}}function _c(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function yc(e){var t=e.alternate;t!==null&&(e.alternate=null,yc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bc(e){return e.tag===5||e.tag===3||e.tag===4}function xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||bc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Sc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Sc(e,t,n),e=e.sibling;e!==null;)Sc(e,t,n),e=e.sibling}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}var wc=null,Tc=!1;function Ec(e,t,n){for(n=n.child;n!==null;)Dc(e,t,n),n=n.sibling}function Dc(e,t,n){if(Tt&&typeof Tt.onCommitFiberUnmount==`function`)try{Tt.onCommitFiberUnmount(wt,n)}catch{}switch(n.tag){case 5:uc||fc(n,t);case 6:var r=wc,i=Tc;wc=null,Ec(e,t,n),wc=r,Tc=i,wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wc.removeChild(n.stateNode));break;case 18:wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),un(e)):Ti(wc,n.stateNode));break;case 4:r=wc,i=Tc,wc=n.stateNode.containerInfo,Tc=!0,Ec(e,t,n),wc=r,Tc=i;break;case 0:case 11:case 14:case 15:if(!uc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&pc(n,t,o),i=i.next}while(i!==r)}Ec(e,t,n);break;case 1:if(!uc&&(fc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Ec(e,t,n);break;case 21:Ec(e,t,n);break;case 22:n.mode&1?(uc=(r=uc)||n.memoizedState!==null,Ec(e,t,n),uc=r):Ec(e,t,n);break;default:Ec(e,t,n)}}function Oc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function kc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:wc=c.stateNode,Tc=!1;break a;case 3:wc=c.stateNode.containerInfo,Tc=!0;break a;case 4:wc=c.stateNode.containerInfo,Tc=!0;break a}c=c.return}if(wc===null)throw Error(r(160));Dc(o,s,a),wc=null,Tc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Rl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ac(t,e),t=t.sibling}function Ac(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(kc(t,e),jc(e),i&4){try{gc(3,e,e.return),_c(3,e)}catch(t){Rl(e,e.return,t)}try{gc(5,e,e.return)}catch(t){Rl(e,e.return,t)}}break;case 1:kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return);break;case 5:if(kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return),e.flags&32){var a=e.stateNode;try{Pe(a,``)}catch(t){Rl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&be(a,o),Ve(c,s);var u=Ve(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Re(a,f):d===`dangerouslySetInnerHTML`?Ne(a,f):d===`children`?Pe(a,f):S(a,d,f,u)}switch(c){case`input`:xe(a,o);break;case`textarea`:Oe(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Te(a,!!o.multiple,o.multiple?[]:``,!1):Te(a,!!o.multiple,o.defaultValue,!0)):Te(a,!!o.multiple,m,!1)}a[Ai]=o}catch(t){Rl(e,e.return,t)}}break;case 6:if(kc(t,e),jc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Rl(e,e.return,t)}}break;case 3:if(kc(t,e),jc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{un(t.containerInfo)}catch(t){Rl(e,e.return,t)}break;case 4:kc(t,e),jc(e);break;case 13:kc(t,e),jc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||($c=_t())),i&4&&Oc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(uc=(u=uc)||d,kc(t,e),uc=u):kc(t,e),jc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Q=e,d=e.child;d!==null;){for(f=Q=d;Q!==null;){switch(p=Q,m=p.child,p.tag){case 0:case 11:case 14:case 15:gc(4,p,p.return);break;case 1:fc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Rl(i,n,e)}}break;case 5:fc(p,p.return);break;case 22:if(p.memoizedState!==null){Fc(f);continue}}m===null?Fc(f):(m.return=p,Q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Le(`display`,s))}catch(t){Rl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Rl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:kc(t,e),jc(e),i&4&&Oc(e);break;case 21:break;default:kc(t,e),jc(e)}}function jc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(bc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Pe(a,``),i.flags&=-33),Cc(e,xc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Sc(e,xc(e),o);break;default:throw Error(r(161))}}catch(t){Rl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mc(e,t,n){Q=e,Nc(e,t,n)}function Nc(e,t,n){for(var r=!!(e.mode&1);Q!==null;){var i=Q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||lc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||uc;s=lc;var l=uc;if(lc=o,(uc=c)&&!l)for(Q=i;Q!==null;)o=Q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Ic(i):(c.return=o,Q=c);for(;a!==null;)Q=a,Nc(a,t,n),a=a.sibling;Q=i,lc=s,uc=l}Pc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Q=a):Pc(e,t,n)}}function Pc(e){for(;Q!==null;){var t=Q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:uc||_c(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!uc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:hs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&no(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}no(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&un(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}uc||t.flags&512&&vc(t)}catch(e){Rl(t,t.return,e)}}if(t===e){Q=null;break}if(n=t.sibling,n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Fc(e){for(;Q!==null;){var t=Q;if(t===e){Q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Ic(e){for(;Q!==null;){var t=Q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{_c(4,t)}catch(e){Rl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Rl(t,i,e)}}var a=t.return;try{vc(t)}catch(e){Rl(t,a,e)}break;case 5:var o=t.return;try{vc(t)}catch(e){Rl(t,o,e)}}}catch(e){Rl(t,t.return,e)}if(t===e){Q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Q=s;break}Q=t.return}}var Lc=Math.ceil,Rc=C.ReactCurrentDispatcher,zc=C.ReactCurrentOwner,Bc=C.ReactCurrentBatchConfig,$=0,Vc=null,Hc=null,Uc=0,Wc=0,Gc=Vi(0),Kc=0,qc=null,Jc=0,Yc=0,Xc=0,Zc=null,Qc=null,$c=0,el=1/0,tl=null,nl=!1,rl=null,il=null,al=!1,ol=null,sl=0,cl=0,ll=null,ul=-1,dl=0;function fl(){return $&6?_t():ul===-1?ul=_t():ul}function pl(e){return e.mode&1?$&2&&Uc!==0?Uc&-Uc:Oa.transition===null?(e=z,e===0?(e=window.event,e=e===void 0?16:vn(e.type),e):e):(dl===0&&(dl=Rt()),dl):1}function ml(e,t,n,i){if(50<cl)throw cl=0,ll=null,Error(r(185));Bt(e,n,i),(!($&2)||e!==Vc)&&(e===Vc&&(!($&2)&&(Yc|=n),Kc===4&&bl(e,Uc)),hl(e,i),n===1&&$===0&&!(t.mode&1)&&(el=_t()+500,ea&&ia()))}function hl(e,t){var n=e.callbackNode;It(e,t);var r=Pt(e,e===Vc?Uc:0);if(r===0)n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&mt(n),t===1)e.tag===0?ra(xl.bind(null,e)):na(xl.bind(null,e)),Ci(function(){!($&6)&&ia()}),n=null;else{switch(Ut(r)){case 1:n=yt;break;case 4:n=bt;break;case 16:n=xt;break;case 536870912:n=Ct;break;default:n=xt}n=Wl(n,gl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function gl(e,t){if(ul=-1,dl=0,$&6)throw Error(r(327));var n=e.callbackNode;if(Il()&&e.callbackNode!==n)return null;var i=Pt(e,e===Vc?Uc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=kl(e,i);else{t=i;var a=$;$|=2;var o=Dl();(Vc!==e||Uc!==t)&&(tl=null,el=_t()+500,Tl(e,t));do try{jl();break}catch(t){El(e,t)}while(1);za(),Rc.current=o,$=a,Hc===null?(Vc=null,Uc=0,t=Kc):t=0}if(t!==0){if(t===2&&(a=Lt(e),a!==0&&(i=a,t=_l(e,a))),t===1)throw n=qc,Tl(e,0),bl(e,i),hl(e,_t()),n;if(t===6)bl(e,i);else{if(a=e.current.alternate,!(i&30)&&!yl(a)&&(t=kl(e,i),t===2&&(o=Lt(e),o!==0&&(i=o,t=_l(e,o))),t===1))throw n=qc,Tl(e,0),bl(e,i),hl(e,_t()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Pl(e,Qc,tl);break;case 3:if(bl(e,i),(i&130023424)===i&&(t=$c+500-_t(),10<t)){if(Pt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){fl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(Pl.bind(null,e,Qc,tl),t);break}Pl(e,Qc,tl);break;case 4:if(bl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Dt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=_t()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Lc(i/1960))-i,10<i){e.timeoutHandle=bi(Pl.bind(null,e,Qc,tl),i);break}Pl(e,Qc,tl);break;case 5:Pl(e,Qc,tl);break;default:throw Error(r(329))}}}return hl(e,_t()),e.callbackNode===n?gl.bind(null,e):null}function _l(e,t){var n=Zc;return e.current.memoizedState.isDehydrated&&(Tl(e,t).flags|=256),e=kl(e,t),e!==2&&(t=Qc,Qc=n,t!==null&&vl(t)),e}function vl(e){Qc===null?Qc=e:Qc.push.apply(Qc,e)}function yl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Er(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bl(e,t){for(t&=~Xc,t&=~Yc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Dt(t),r=1<<n;e[n]=-1,t&=~r}}function xl(e){if($&6)throw Error(r(327));Il();var t=Pt(e,0);if(!(t&1))return hl(e,_t()),null;var n=kl(e,t);if(e.tag!==0&&n===2){var i=Lt(e);i!==0&&(t=i,n=_l(e,i))}if(n===1)throw n=qc,Tl(e,0),bl(e,t),hl(e,_t()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Pl(e,Qc,tl),hl(e,_t()),null}function Sl(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(el=_t()+500,ea&&ia())}}function Cl(e){ol!==null&&ol.tag===0&&!($&6)&&Il();var t=$;$|=1;var n=Bc.transition,r=z;try{if(Bc.transition=null,z=1,e)return e()}finally{z=r,Bc.transition=n,$=t,!($&6)&&ia()}}function wl(){Wc=Gc.current,q(Gc)}function Tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Hc!==null)for(n=Hc.return;n!==null;){var r=n;switch(ga(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ji();break;case 3:lo(),q(Wi),q(Ui),go();break;case 5:fo(r);break;case 4:lo();break;case 13:q(po);break;case 19:q(po);break;case 10:Ba(r.type._context);break;case 22:case 23:wl()}n=n.return}if(Vc=e,Hc=e=Yl(e.current,null),Uc=Wc=t,Kc=0,qc=null,Xc=Yc=Jc=0,Qc=Zc=null,Wa!==null){for(t=0;t<Wa.length;t++)if(n=Wa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Wa=null}return e}function El(e,t){do{var n=Hc;try{if(za(),_o.current=ds,Co){for(var i=bo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Co=!1}if(yo=0,So=xo=bo=null,wo=!1,To=0,zc.current=null,n===null||n.return===null){Kc=1,qc=t,Hc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Uc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=ks(s);if(m!==null){m.flags&=-257,As(m,s,c,o,t),m.mode&1&&Os(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Os(o,u,t),Ol();break a}l=Error(r(426))}else if(Z&&c.mode&1){var _=ks(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),As(_,s,c,o,t),Da(Ss(l,c));break a}}o=l=Ss(l,c),Kc!==4&&(Kc=2),Zc===null?Zc=[o]:Zc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Es(o,l,t);eo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(il===null||!il.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ds(o,c,t);eo(o,x);break a}}o=o.return}while(o!==null)}Nl(n)}catch(e){t=e,Hc===n&&n!==null&&(Hc=n=n.return);continue}break}while(1)}function Dl(){var e=Rc.current;return Rc.current=ds,e===null?ds:e}function Ol(){(Kc===0||Kc===3||Kc===2)&&(Kc=4),Vc===null||!(Jc&268435455)&&!(Yc&268435455)||bl(Vc,Uc)}function kl(e,t){var n=$;$|=2;var i=Dl();(Vc!==e||Uc!==t)&&(tl=null,Tl(e,t));do try{Al();break}catch(t){El(e,t)}while(1);if(za(),$=n,Rc.current=i,Hc!==null)throw Error(r(261));return Vc=null,Uc=0,Kc}function Al(){for(;Hc!==null;)Ml(Hc)}function jl(){for(;Hc!==null&&!ht();)Ml(Hc)}function Ml(e){var t=Ul(e.alternate,e,Wc);e.memoizedProps=e.pendingProps,t===null?Nl(e):Hc=t,zc.current=null}function Nl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=cc(n,t),n!==null){n.flags&=32767,Hc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Kc=6,Hc=null;return}}else if(n=sc(n,t,Wc),n!==null){Hc=n;return}if(t=t.sibling,t!==null){Hc=t;return}Hc=t=e}while(t!==null);Kc===0&&(Kc=5)}function Pl(e,t,n){var r=z,i=Bc.transition;try{Bc.transition=null,z=1,Fl(e,t,n,r)}finally{Bc.transition=i,z=r}return null}function Fl(e,t,n,i){do Il();while(ol!==null);if($&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Vt(e,o),e===Vc&&(Hc=Vc=null,Uc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||al||(al=!0,Wl(xt,function(){return Il(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Bc.transition,Bc.transition=null;var s=z;z=1;var c=$;$|=4,zc.current=null,hc(e,n),Ac(n,e),Nr(vi),fn=!!_i,vi=_i=null,e.current=n,Mc(n,e,a),gt(),$=c,z=s,Bc.transition=o}else e.current=n;if(al&&(al=!1,ol=e,sl=a),o=e.pendingLanes,o===0&&(il=null),Et(n.stateNode,i),hl(e,_t()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(nl)throw nl=!1,e=rl,rl=null,e;return sl&1&&e.tag!==0&&Il(),o=e.pendingLanes,o&1?e===ll?cl++:(cl=0,ll=e):cl=0,ia(),null}function Il(){if(ol!==null){var e=Ut(sl),t=Bc.transition,n=z;try{if(Bc.transition=null,z=16>e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,$&6)throw Error(r(331));var a=$;for($|=4,Q=e.current;Q!==null;){var o=Q,s=o.child;if(Q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Q=u;Q!==null;){var d=Q;switch(d.tag){case 0:case 11:case 15:gc(8,d,o)}var f=d.child;if(f!==null)f.return=d,Q=f;else for(;Q!==null;){d=Q;var p=d.sibling,m=d.return;if(yc(d),d===u){Q=null;break}if(p!==null){p.return=m,Q=p;break}Q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Q=s;else b:for(;Q!==null;){if(o=Q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Q=v;break b}Q=o.return}}var y=e.current;for(Q=y;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else b:for(s=y;Q!==null;){if(c=Q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:_c(9,c)}}catch(e){Rl(c,c.return,e)}if(c===s){Q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Q=x;break b}Q=c.return}}if($=a,ia(),Tt&&typeof Tt.onPostCommitFiberRoot==`function`)try{Tt.onPostCommitFiberRoot(wt,e)}catch{}i=!0}return i}finally{z=n,Bc.transition=t}}return!1}function Ll(e,t,n){t=Ss(n,t),t=Es(e,t,1),e=Qa(e,t,1),t=fl(),e!==null&&(Bt(e,1,t),hl(e,t))}function Rl(e,t,n){if(e.tag===3)Ll(e,e,n);else for(;t!==null;){if(t.tag===3){Ll(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(il===null||!il.has(r))){e=Ss(n,e),e=Ds(t,e,1),t=Qa(t,e,1),e=fl(),t!==null&&(Bt(t,1,e),hl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=fl(),e.pingedLanes|=e.suspendedLanes&n,Vc===e&&(Uc&n)===n&&(Kc===4||Kc===3&&(Uc&130023424)===Uc&&500>_t()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Mt,Mt<<=1,!(Mt&130023424)&&(Mt=4194304)):t=1);var n=fl();e=qa(e,t),e!==null&&(Bt(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Wi.current)Ms=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ms=!1,tc(e,t,n);Ms=!!(e.flags&131072)}}else Ms=!1,Z&&t.flags&1048576&&ma(t,sa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;$s(e,t),e=t.pendingProps;var a=Ki(t,Ui.current);Ha(t,n),a=ko(null,t,i,e,a,n);var o=Ao();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qi(i)?(o=!0,Zi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ya(t),a.updater=_s,t.stateNode=a,a._reactInternals=t,xs(t,i,e,n),t=Vs(null,t,i,!0,o,n)):(t.tag=0,Z&&o&&ha(t),Ns(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch($s(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=hs(i,e),a){case 0:t=zs(null,t,i,e,n);break a;case 1:t=Bs(null,t,i,e,n);break a;case 11:t=Ps(null,t,i,e,n);break a;case 14:t=Fs(null,t,i,hs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),zs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Bs(e,t,i,a,n);case 3:a:{if(Hs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Xa(e,t),to(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ss(Error(r(423)),t),t=Us(e,t,i,n,a);break a}if(i!==a){a=Ss(Error(r(424)),t),t=Us(e,t,i,n,a);break a}for(X=Ei(t.stateNode.containerInfo.firstChild),_a=t,Z=!0,va=null,n=Pa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ea(),i===a){t=ec(e,t,n);break a}Ns(e,t,i,n)}t=t.child}return t;case 5:return uo(t),e===null&&Sa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Rs(e,t),Ns(e,t,s,n),t.child;case 6:return e===null&&Sa(t),null;case 13:return Ks(e,t,n);case 4:return co(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Na(t,null,i,n):Ns(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Ps(e,t,i,a,n);case 7:return Ns(e,t,t.pendingProps,n),t.child;case 8:return Ns(e,t,t.pendingProps.children,n),t.child;case 12:return Ns(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,J(Fa,i._currentValue),i._currentValue=s,o!==null){if(Er(o.value,s)){if(o.children===a.children&&!Wi.current){t=ec(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Za(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Va(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Va(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ns(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ha(t,n),a=Ua(a),i=i(a),t.flags|=1,Ns(e,t,i,n),t.child;case 14:return i=t.type,a=hs(i,t.pendingProps),a=hs(i.type,a),Fs(e,t,i,a,n);case 15:return Is(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),$s(e,t),t.tag=1,qi(i)?(e=!0,Zi(t)):e=!1,Ha(t,n),ys(t,i,a),xs(t,i,a,n),Vs(null,t,i,!0,e,n);case 19:return Qs(e,t,n);case 22:return Ls(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return pt(e,t)}function Gl(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.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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===M)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case T:return Zl(n.children,a,o,t);case E:s=8,a|=8;break;case D:return e=Kl(12,n,t,a|2),e.elementType=D,e.lanes=o,e;case j:return e=Kl(13,n,t,a),e.elementType=j,e.lanes=o,e;case te:return e=Kl(19,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case O:s=10;break a;case k:s=9;break a;case A:s=11;break a;case M:s=14;break a;case N:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zt(0),this.expirationTimes=zt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ya(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:w,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Hi;e=e._reactInternals;a:{if(st(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(qi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(qi(n))return Xi(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=fl(),i=pl(n),a=Za(r,i),a.callback=t??null,Qa(n,a,i),e.current.lanes=i,Bt(e,i,r),hl(e,r),e}function ou(e,t,n,r){var i=t.current,a=fl(),o=pl(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=Za(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Qa(i,t,o),e!==null&&(ml(e,i,o,a),$a(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cl(function(){ou(null,e,null,null)}),t[ji]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=qt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<nn.length&&t!==0&&t<nn[n].priority;n++);nn.splice(n,0,e),n===0&&sn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[ji]=o.current,oi(e.nodeType===8?e.parentNode:e),Cl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[ji]=c.current,oi(e.nodeType===8?e.parentNode:e),Cl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Wt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Nt(t.pendingLanes);n!==0&&(Ht(t,n|1),hl(t,_t()),!($&6)&&(el=_t()+500,ia()))}break;case 13:Cl(function(){var t=qa(e,1);t!==null&&ml(t,e,1,fl())}),lu(e,1)}},Gt=function(e){if(e.tag===13){var t=qa(e,134217728);t!==null&&ml(t,e,134217728,fl()),lu(e,134217728)}},Kt=function(e){if(e.tag===13){var t=pl(e),n=qa(e,t);n!==null&&ml(n,e,t,fl()),lu(e,t)}},qt=function(){return z},Jt=function(e,t){var n=z;try{return z=e,t()}finally{z=n}},I=function(e,t,n){switch(t){case`input`:if(xe(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ri(i);if(!a)throw Error(r(90));ge(i),xe(i,a)}}}break;case`textarea`:Oe(e,n);break;case`select`:t=n.value,t!=null&&Te(e,!!n.multiple,t,!1)}},Je=Sl,Ye=Cl;var yu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,Ke,qe,Sl]},bu={findFiberByHostInstance:Fi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{wt=Su.inject(xu),Tt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[ji]=t.current,oi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=dt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Cl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[ji]=t.current,oi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(Cl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[ji]=null})}),!0):!1},e.unstable_batchedUpdates=Sl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),g=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=s((e=>{var t=g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),v=u(f(),1),y=_();function b(e=void 0){if(!e)return``;let t;try{t=new URL(e)}catch{return``}return t.protocol!==`https:`||t.username||t.password||t.pathname!==`/`||t.search||t.hash?``:t.origin}var x=(e,t)=>`${b(t)}${e}`;async function S(){throw Error(`App views run inside StillMade.`)}function C(e,t={}){return L(w.includes(e),`SHARED_WORK_OPERATION`,`Choose a declared shared-work operation.`),at(t),L(R(t)&&JSON.stringify(t).length<=131072,`SHARED_WORK_INPUT`,`Shared-work requests require bounded JSON arguments.`),{operation:e,args:structuredClone(t)}}function ee(e,t,n,r){let i=0,a=new Map,o=new Set,s=new Set,c=()=>{for(let e of s)URL.revokeObjectURL(e);s.clear()};return addEventListener(`message`,n=>{let r=n.data;if(n.source!==parent||!r||r.channel!==e||r.session!==t||![`shared-work-result`,`shared-work-refresh`].includes(r.op))return;if(r.op===`shared-work-refresh`){c();for(let e of o)try{e()}catch{}return}let i=a.get(r.id);if(i){if(a.delete(r.id),r.error){i.reject(Error(r.error));return}if(i.media){if(!(r.media instanceof Blob)||!r.media.size||r.media.size>67108864||![`image`,`video`,`audio`].includes(r.kind)||!r.media.type.startsWith(r.kind+`/`)||s.size>=2){i.reject(Error(`The shared creative preview is invalid or its limit was reached.`));return}let e=URL.createObjectURL(r.media);s.add(e),i.resolve({url:e,kind:r.kind})}else i.resolve(r.result)}}),addEventListener(`message`,n=>{n.source===parent&&n.data?.channel===e&&n.data?.session===t&&n.data?.op===`dispose`&&c()}),{releaseSharedWorkMedia(e){s.delete(e)&&URL.revokeObjectURL(e)},previewSharedWorkMedia(o){if(!n||typeof o!=`string`||!/^[0-9a-f-]{36}$/i.test(o))return Promise.reject(Error(`Choose a permitted saved creative.`));if(a.size>=4||s.size>=2)return Promise.reject(Error(`Close a previous preview before opening another.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i,media:!0}),r({channel:e,session:t,op:`shared-work-media-request`,id:c,contributionId:o},`*`)})},onSharedWorkRefresh(e){if(typeof e!=`function`)throw Error(`Expected a callback.`);return o.add(e),()=>o.delete(e)},sharedWork(o,s={}){if(!n)return Promise.reject(Error(`This Block has no shared-work permission.`));if(![`list`,`accounts`,`grants`,`create`,`bind`,`read`,`update`,`creatives`,`contribute`,`grant`,`revoke`,`unlink`].includes(o)||!s||Array.isArray(s)||typeof s!=`object`||JSON.stringify(s).length>131072)return Promise.reject(Error(`Invalid shared-work request.`));if(a.size>=4)return Promise.reject(Error(`Wait for the current shared-work request.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i}),r({channel:e,session:t,op:`shared-work-request`,id:c,operation:o,args:s},`*`)})}}}var w,T=o((()=>{gt(),w=Object.freeze([`list`,`accounts`,`grants`,`create`,`bind`,`read`,`update`,`creatives`,`contribute`,`grant`,`revoke`,`unlink`])}));function E(e){if(typeof e!=`string`||e.length>4194304)return!1;if(/^\/api\/media\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-][A-Za-z0-9._-]*$/.test(e)||/^data:image\/(png|jpeg|webp|gif);base64,[a-z0-9+/=]+$/i.test(e))return!0;try{let t=new URL(e);return[`https:`,`blob:`,`sm-media:`].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}}var D=o((()=>{}));function O(e){if(!j(e,[`schemaVersion`,`format`,`name`,`files`])||e.schemaVersion!==1||![`file`,`zip`].includes(e.format)||!te(e.name)||e.name.includes(`/`)||!Array.isArray(e.files)||!e.files.length||e.files.length>k.files||(e.format===`file`?e.files.length!==1||!M(e.name):!e.name.endsWith(`.zip`)))return!1;let t=new Set,n=0;return e.files.every(r=>{if(!A(r)||!te(r.path)||t.has(r.path.toLowerCase()))return!1;let i=r.path.toLowerCase();if([...t].some(e=>i.startsWith(e+`/`)||e.startsWith(i+`/`))||(t.add(i),e.format===`file`&&r.path!==e.name))return!1;if(j(r,[`path`,`text`])&&typeof r.text==`string`&&M(r.path))return n+=new TextEncoder().encode(r.text).length,n<=k.textBytes;if(e.format!==`zip`||!j(r,[`path`,`source`])||!N(r.path))return!1;let a=r.source;return A(a)&&E(a.url)&&[`image`,`video`,`audio`].includes(a.kind)&&[`assetId`,`versionId`,`url`].every(e=>typeof a[e]==`string`&&a[e].length>0&&a[e].length<=(e===`url`?8192:200))&&(a.role===void 0||typeof a.role==`string`&&a.role.length<=100)})}var k,A,j,te,M,N,ne=o((()=>{D(),k=Object.freeze({files:256,textBytes:3e6,pathLength:180}),A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=(e,t)=>A(e)&&Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t)),te=e=>typeof e==`string`&&e.length<=k.pathLength&&/^[A-Za-z0-9_-][A-Za-z0-9_./-]*$/.test(e)&&e.split(`/`).every(e=>e&&![`.`,`..`,`__proto__`,`constructor`,`prototype`].includes(e)&&!e.endsWith(`.`)&&!/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(e)),M=e=>/\.(?:txt|md|json|csv|xml|fcpxml|srt|vtt)$/i.test(e),N=e=>/\.(?:png|jpe?g|webp|gif|mp4|webm|mov|mp3|wav|ogg|m4a|flac|bin)$/i.test(e)}));function re(){let e=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),t=/^(string|text|number|integer|boolean|object|json)(\[\])?\??$/,n=new Set([`__proto__`,`prototype`,`constructor`]);function r(i,a=0){return a>40?!1:typeof i==`string`?t.test(i):Array.isArray(i)?i.length===1&&r(i[0],a+1):e(i)&&Object.entries(i).every(([e,t])=>!n.has(e)&&r(t,a+1))}function i(t,r,o=0){return o>40?!1:r==null?!0:Array.isArray(r)?r.length===1&&Array.isArray(t)&&t.every(e=>i(e,r[0],o+1)):typeof r==`string`?r.endsWith(`?`)?t===void 0||i(t,r.slice(0,-1),o+1):r.endsWith(`[]`)?Array.isArray(t)&&t.every(e=>i(e,r.slice(0,-2),o+1)):r===`string`||r===`text`?typeof t==`string`:r===`object`?e(t):r===`json`?a(t,o+1):r===`integer`?Number.isSafeInteger(t):r===`number`?typeof t==`number`&&Number.isFinite(t):r===`boolean`&&typeof t==`boolean`:e(r)&&e(t)&&Object.entries(r).every(([e,r])=>!n.has(e)&&i(Object.hasOwn(t,e)?t[e]:void 0,r,o+1))}function a(t,r){return r>40?!1:t===null||typeof t==`string`||typeof t==`boolean`?!0:typeof t==`number`?Number.isFinite(t):(e(t)||Array.isArray(t))&&Object.entries(t).every(([e,t])=>!n.has(e)&&a(t,r+1))}return{semanticSchemaValid:r,schemaMatches:i,validate:(e,t)=>{try{return r(t)&&a(e,0)&&i(e,t)}catch{return!1}}}}var ie,P,ae,oe=o((()=>{({semanticSchemaValid:ie,schemaMatches:P}=re()),Object.freeze([`upstream`,`project`,`adapter`,`chat`,`default`,`user`,`external`]),ae=Object.freeze([`key`,`semantic`,`accepts`,`schema`,`sources`,`sensitivity`,`freshnessPolicy`,`cardinality`,`batchable`])})),se,ce=o((()=>{se=Object.freeze([Object.freeze({name:`narration_script`,parents:Object.freeze([`script`])}),Object.freeze({name:`sales_script`,parents:Object.freeze([`script`])}),Object.freeze({name:`timed_transcript`,parents:Object.freeze([`transcript`])}),Object.freeze({name:`product_image`,parents:Object.freeze([`image`])}),Object.freeze({name:`reference_image`,parents:Object.freeze([`image`])}),Object.freeze({name:`generated_image`,parents:Object.freeze([`image`,`source_image`])}),Object.freeze({name:`processed_image`,parents:Object.freeze([`image`,`source_image`])})]),new Map(se.map(e=>[e.name,e.parents]))})),le=o((()=>{oe()}));function ue(e){return me(e,[`schemaVersion`,`startMs`,`endMs`])&&e.schemaVersion===2&&typeof e.startMs==`number`&&Number.isFinite(e.startMs)&&e.startMs>=0&&typeof e.endMs==`number`&&Number.isFinite(e.endMs)&&e.endMs>=e.startMs&&e.endMs<=fe}function de(e){return me(e,[`schemaVersion`,`decision`])&&e.schemaVersion===2&&[`accepted`,`rejected`,`deferred`].includes(e.decision)}var fe,pe,me,he=o((()=>{fe=2**53-1,pe=e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),me=(e,t)=>pe(e)&&Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))})),ge=o((()=>{gt()})),_e=o((()=>{gt(),ge(),Object.freeze({routes:16,operations:64,keyLength:80,declarationBytes:65536})})),ve,ye=o((()=>{ve=`(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})`,RegExp(`^`+ve+`$`),RegExp(`^(>=|<=|>|<|=)?`+ve+`$`)}));function be(e){return xe(e)&&Object.keys(e).length===5&&e.schemaVersion===1&&typeof e.title==`string`&&e.title.trim().length>0&&e.title.length<=200&&Se.includes(e.field)&&xe(e.before)&&e.before.schemaVersion===1&&xe(e.after)&&e.after.schemaVersion===1}var xe,Se,Ce=o((()=>{xe=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Se=Object.freeze([`blueprint`,`shotPlan`,`panels`,`board`,`canvas`,`animation`,`editor`])}));function we(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length!==4||!Object.keys(e).every(e=>[`type`,`duration`,`soundOn`,`soundId`].includes(e)))return!1;let t=Te.find(t=>t.type===e.type);return!!t&&Number.isFinite(e.duration)&&e.duration>=.1&&e.duration<=3&&typeof e.soundOn==`boolean`&&(t.sounds.length?t.sounds.includes(e.soundId):e.soundId===``)}var Te,Ee=o((()=>{Te=Object.freeze([{type:`Cut`,sounds:[]},{type:`Fade`,sounds:[]},{type:`Cross dissolve`,sounds:[]},{type:`Shape wipe`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Iris`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Ink splat`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Swirl`,sounds:[`whoosh`,`swirl_wind`]},{type:`Whip left`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip right`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip up`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip down`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip pan`,sounds:[`whip_crack`,`whip_zip`]},{type:`Slash`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Shred`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Morph`,sounds:[`morph_warp`,`morph_bloom`]},{type:`Dip to black`,sounds:[]},{type:`Dip to white`,sounds:[]},{type:`Push left`,sounds:[`push_slide`,`push_thump`]},{type:`Push right`,sounds:[`push_slide`,`push_thump`]},{type:`Push up`,sounds:[`push_slide`,`push_thump`]},{type:`Push down`,sounds:[`push_slide`,`push_thump`]},{type:`Zoom left`,sounds:[]},{type:`Zoom right`,sounds:[]},{type:`Zoom up`,sounds:[]},{type:`Zoom down`,sounds:[]}].map(e=>Object.freeze({...e,sounds:Object.freeze(e.sounds)})))}));function De(e){if(!Oe(e)||e.schemaVersion!==1||!ke(e.title)||!ke(e.timelineId)||!Array.isArray(e.commands)||!e.commands.length||e.commands.length>100||Object.keys(e).some(e=>![`schemaVersion`,`title`,`timelineId`,`commands`].includes(e)))return!1;let t=new Set;return e.commands.every(e=>{if(!Oe(e)||![`clips`,`audioItems`,`captions`].includes(e.collection)||!Oe(e.values)||!Me(e,[`collection`,`operation`,`before`,`values`]))return!1;let n=e.values,r=e.operation===`caption.add`,i=r?n.id:e.before?.id,a=`${e.collection}:${i}`;return!ke(i)||t.has(a)?!1:(t.add(a),e.collection===`captions`?r?e.before===null&&Re(n)&&ke(n.trackId)&&Fe(n):!Oe(e.before)||!Fe(e.before)?!1:e.operation===`caption.update`?Me(n,[`text`,`start`,`end`])&&Fe(n):e.operation===`remove`&&Me(n,[]):!Object.hasOwn(je,e.operation)||!Oe(e.before)||!Ae(e.before.start,0,86400)||!Ae(e.before.duration,.001,86400)||!Me(n,je[e.operation])?!1:e.operation===`transition`?e.collection===`clips`&&we(n):e.operation===`grade`?e.collection===`clips`&&Pe(n):e.operation===`split`?Ae(n.at,0,86400)&&ke(n.newId)&&n.newId!==e.before.id:e.operation===`move`?Ae(n.start,0,86400):e.operation===`trim`?Ae(n.trimStart,0,86400)&&Ae(n.duration,.001,86400):e.operation===`volume`?Ae(n.volume,0,200):e.operation!==`mute`||typeof n.muted==`boolean`)})}var Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze=o((()=>{Ee(),Oe=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ke=e=>typeof e==`string`&&e.length>0&&e.length<=200,Ae=(e,t,n)=>Number.isFinite(e)&&e>=t&&e<=n,je={move:[`start`],trim:[`trimStart`,`duration`],volume:[`volume`],mute:[`muted`],remove:[],split:[`at`,`newId`],grade:[`lut`,`color`],transition:[`type`,`duration`,`soundOn`,`soundId`]},Me=(e,t)=>Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t)),Ne={brightness:[-100,100],contrast:[-100,100],saturation:[-100,100],temperature:[-100,100],sharpness:[-50,50],vignette:[0,100]},Pe=e=>[`None`,`Cold`,`Warm`,`Desaturated`,`High Contrast`,`Filmic`,`Teal and Orange`].includes(e.lut)&&Oe(e.color)&&Me(e.color,Object.keys(Ne))&&Object.entries(Ne).every(([t,[n,r]])=>Ae(e.color[t],n,r)),Fe=e=>typeof e.text==`string`&&e.text.trim().length>0&&e.text.length<=5e3&&Ae(e.start,0,86400)&&Ae(e.end,0,86400)&&e.end-e.start>=.001,Ie=[`id`,`trackId`,`text`,`start`,`end`],Le={font:e=>e===`Hanken Grotesk`,size:e=>Ae(e,8,200),color:e=>typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),highlightColor:e=>typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),background:e=>e===`none`||typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),backgroundOpacity:e=>Ae(e,0,100),backgroundPadding:e=>Ae(e,0,100),backgroundRadius:e=>Ae(e,0,100),position:e=>[`top left`,`top center`,`top right`,`middle left`,`middle center`,`middle right`,`bottom left`,`bottom center`,`bottom right`].includes(e),animation:e=>[`none`,`fade`].includes(e)},Re=e=>!Ie.every(t=>Object.hasOwn(e,t))||Object.keys(e).some(e=>!Ie.includes(e)&&e!==`words`&&!Object.hasOwn(Le,e))||!Object.entries(Le).every(([t,n])=>!Object.hasOwn(e,t)||n(e[t]))?!1:!Object.hasOwn(e,`words`)||Array.isArray(e.words)&&e.words.length<=1e3&&e.words.every((t,n)=>Oe(t)&&Me(t,[`text`,`start`,`end`])&&typeof t.text==`string`&&t.text.trim().length>0&&t.text.length<=5e3&&Ae(t.start,e.start,e.end)&&Ae(t.end,t.start,e.end)&&(n===0||t.start>=e.words[n-1].start))})),Be,Ve=o((()=>{Be=Object.freeze([`screen.capture`,`cursor.track`,`camera.capture`,`microphone.capture`,`clipboard.read`,`clipboard.write`,`media.pick`,`notifications.show`,`power.keep-awake`,`native.tools`])})),F=o((()=>{Object.freeze({"org.stillmade.PythonAdapter":Object.freeze({id:`org.stillmade.PythonAdapter`,adapterVersion:1,label:`Python connection`,actions:Object.freeze([`adapter.import`,`adapter.inspect`,`adapter.execute`,`adapter.describe`,`adapter.call`]),projectExtensions:Object.freeze([`py`])}),"org.natron.Natron":Object.freeze({id:`org.natron.Natron`,adapterVersion:1,label:`Natron`,actions:Object.freeze([`launch`,`project.import`,`project.open`,`project.render`]),projectExtensions:Object.freeze([`ntp`])})})}));function He(e){return qe(e)&&e.kind===`file`&&Ye(e.assetId,512)&&Ye(e.versionId,512)&&Qe.includes(e.mimeType)&&(e.url===void 0||Ye(e.url,32768))&&(e.name===void 0||Ye(e.name,Xe.fileName))&&(e.bytes===void 0||Number.isSafeInteger(e.bytes)&&e.bytes>=0)}function I(e){return qe(e)&&Object.keys(e).every(e=>[`schemaVersion`,`format`,`text`,`title`].includes(e))&&e.schemaVersion===1&&$e.includes(e.format)&&typeof e.text==`string`&&e.text.length<=Xe.documentText&&(e.title===void 0||typeof e.title==`string`&&e.title.length<=Xe.documentTitle)}function Ue(e){if(!qe(e)||!Object.keys(e).every(e=>[`schemaVersion`,`columns`,`rows`].includes(e))||e.schemaVersion!==void 0&&e.schemaVersion!==1)return!1;let{columns:t,rows:n}=e;if(!Array.isArray(t)||!t.length||t.length>Xe.tableColumns||!Array.isArray(n)||n.length>Xe.tableRows||!t.every(e=>typeof e==`string`&&e.trim().length>0&&e.length<=Xe.columnName&&!Je.has(e))||new Set(t).size!==t.length)return!1;let r=new Set(t),i=0;for(let e of n){if(!qe(e))return!1;for(let[t,n]of Object.entries(e))if(!r.has(t)||!et(n)||++i>Xe.tableCells)return!1}return!0}function We(e){if(typeof e!=`string`||!e.length||e.length>Xe.url||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t;try{t=new URL(e)}catch{return!1}return[`http:`,`https:`].includes(t.protocol)&&t.hostname.length>0&&!t.username&&!t.password}function Ge(e){let t=typeof e==`string`?tt.exec(e):null;if(!t)return!1;let[n,r,i,a=0,o=0,s=0,c=0,l=0]=t.slice(1).map(e=>e===void 0?void 0:Number(e)),u=[31,n%4==0&&(n%100!=0||n%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][r-1];return r>=1&&r<=12&&i>=1&&i<=u&&a<=23&&o<=59&&s<=59&&c<=14&&l<=59}function Ke(e){return typeof e==`string`&&/^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(e)}var qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt=o((()=>{qe=e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),Je=new Set([`__proto__`,`prototype`,`constructor`]),Ye=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,Xe=Object.freeze({fileName:255,documentText:1e6,documentTitle:300,tableColumns:500,tableRows:1e5,tableCells:5e5,columnName:160,cellText:1e5,url:8192}),Ze=Object.freeze({pdf:`application/pdf`,txt:`text/plain`,csv:`text/csv`,md:`text/markdown`,json:`application/json`,zip:`application/zip`}),Qe=Object.freeze([...new Set(Object.values(Ze))]),$e=Object.freeze([`markdown`,`plain`]),et=e=>e===null||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)||typeof e==`string`&&e.length<=Xe.cellText,tt=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(?:Z|[+-](\d{2}):(\d{2}))?)?$/})),rt=o((()=>{Object.freeze({origins:8,requestBytes:4194304,responseBytes:8388608,timeoutMs:3e4,redirects:3,headers:32,headerBytes:16384,urlLength:8192,requestsPerMinute:120,originRequestsPerMinute:3e3,keyLength:4096}),Object.freeze([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`]),Object.freeze([`bearer`,`header`,`query`,`oauth2`])})),it=o((()=>{Object.freeze([`media.saved`,`schedule`,`webhook`,`project.completed`,`provider`]),Object.freeze({triggers:4,labelLength:120,minEverySeconds:60,maxEverySeconds:31536e3}),Object.freeze([`recipe`,`javascript`,`capability`])}));function L(e,t,n){if(!e)throw new ht(t,n)}function R(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e))}function at(e,t=0,n={nodes:0}){if(L(t<=40&&++n.nodes<=5e5,`LIMIT`,`Document exceeds complexity limit`),!(e===null||[`string`,`boolean`].includes(typeof e))){if(typeof e==`number`){L(Number.isFinite(e),`SCHEMA`,`Numbers must be finite`);return}L(Array.isArray(e)||R(e),`SCHEMA`,`Only JSON data is accepted`);for(let[r,i]of Object.entries(e))L(!mt.has(r),`SCHEMA`,`Forbidden field: ${r}`),at(i,t+1,n)}}function ot(e){at(e);let t=e=>Array.isArray(e)?e.map(t):R(e)?Object.fromEntries(Object.keys(e).sort().map(n=>[n,t(e[n])])):e;return JSON.stringify(t(e))}async function st(e){let t=new TextEncoder().encode(ot(e)),n=await globalThis.crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n),e=>e.toString(16).padStart(2,`0`)).join(``)}function ct(e,t){if(typeof t==`object`&&t&&t.schema!=null&&!P(e,t.schema))return!1;let n=typeof t==`string`?t:t.type;if(n===`object`)try{return at(e),R(e)}catch{return!1}if(n?.endsWith(`[]`))return Array.isArray(e)&&e.every(e=>ct(e,n.slice(0,-2)));if(n===`text`)return typeof e==`string`&&e.length<=1e6;if(n===`boolean`)return typeof e==`boolean`;if(n===`url`)return We(e);if(n===`date`)return Ge(e);if(n===`color`)return Ke(e);if(n===`file`)return He(e);if(n===`document`)return I(e);if(n===`table`)try{return at(e),Ue(e)}catch{return!1}if(n===`number`||n===`integer`)return typeof e==`number`&&Number.isFinite(e)&&(n!==`integer`||Number.isInteger(e))&&(t.min==null||e>=t.min)&&(t.max==null||e<=t.max);if(n===`file-bundle`)try{return at(e),O(e)}catch{return!1}if(n===`workspace-edit`)try{return at(e),be(e)}catch{return!1}if(n===`timeline-edit`)try{return at(e),De(e)}catch{return!1}if(n===`timeline-range`||n===`approval`)return R(e)&&e.schemaVersion===1?!0:n===`timeline-range`?ue(e):de(e);if(n===`json`)try{return at(e),!0}catch{return!1}return n===`image`&&R(e)&&Array.isArray(e.data)?Number.isInteger(e.width)&&Number.isInteger(e.height)&&e.width>0&&e.height>0&&e.width*e.height<=1048576&&e.data.length===e.width*e.height*4&&e.data.every(e=>Number.isInteger(e)&&e>=0&&e<=255):[`image`,`video`,`audio`,`asset`].includes(n)?R(e)&&typeof e.assetId==`string`&&typeof e.versionId==`string`&&(n===`asset`||e.kind===n):lt.includes(n)&&R(e)&&e.schemaVersion===1}var lt,ut,dt,ft,pt,mt,ht,gt=o((()=>{T(),ne(),oe(),ce(),le(),he(),_e(),ye(),Ce(),ze(),Ve(),F(),nt(),rt(),it(),Object.freeze([`type`,`required`,`default`,`min`,`max`,`description`,`role`,`primary`,`context`,`imageMode`,...ae]),lt=Object.freeze(`text.number.integer.boolean.json.object.image.video.audio.asset.script.transcript.brief.bible.shot-plan.panel-document.board-document.scene-document.timeline.timeline-edit.file-bundle.workspace-edit.timeline-range.research.character.location.style.pipeline.approval.scene.shot.mask.depth.pose.metadata.project-context.file.document.table.url.date.color`.split(`.`)),Object.freeze([`final.render`,`stock.search`,`presenter.generate`,`quality.analyze`,`image.generate`,`image.generate.batch`,`media.generate`,`youtube.upload`]),Object.freeze([`text`,`number`,`slider`,`checkbox`,`asset`,`select`,`multiselect`,`file`,`date`,`color`,`url`,`richtext`,`list`,`grid`]),Object.freeze([`gallery`,`before-after`,`table`,`document`,`chart`,`code`,`player`,`download`]),Object.freeze({file:[`file`,`file[]`],date:[`date`],color:[`color`],url:[`url`],richtext:[`document`,`text`],list:[`text[]`,`number[]`,`integer[]`,`url[]`,`date[]`,`color[]`],grid:[`table`]}),Object.freeze({gallery:[`image[]`],"before-after":[`image`],table:[`table`],document:[`document`,`text`],chart:[`table`,`number[]`,`integer[]`],code:[`text`,`json`,`object`],player:[`audio`,`video`,`audio[]`,`video[]`],download:[`file`,`file[]`,`file-bundle`]}),ut=Object.freeze({script:`script`,transcript:`transcript`,shots:`shot[]`,shotPlan:`shot-plan`,scenes:`scene[]`,characters:`character[]`,locations:`location[]`,styles:`style[]`,assets:`asset[]`,files:`file[]`,generations:`metadata[]`,versions:`metadata[]`,timeline:`timeline`,editor:`timeline`,canvas:`pipeline`,blueprint:`bible`,panels:`panel-document`,board:`board-document`,animation:`scene-document`,metadata:`metadata`}),dt=(e,t,n,r)=>Object.freeze({executor:e,mode:t,byok:n,summary:r}),ft=Object.freeze({"text.generate":dt(`capability-run`,`sync`,!0,`Exact model, account BYOK or credits, and explicit run review`),"audio.speech":dt(`capability-run`,`sync`,!0,`One short text/script input to measured audio in any StillMade catalog voice (Deepgram, ElevenLabs, OpenAI, Kokoro) with credits, or OpenAI with your key; playback review; accepted project recordings can be explicitly added to Editor audio`),"audio.transcribe":dt(`capability-run`,`sync`,!0,`One owner-scoped stored audio asset to reviewed text and ordered word timings with StillMade transcription on credits, or OpenAI Whisper with your key`),"audio.music":dt(`capability-run`,`sync`,!1,`One prompt to generated music (5–240 seconds) with StillMade credits and playback review`),"audio.sfx":dt(`capability-run`,`sync`,!1,`One prompt to a generated sound effect (0.5–22 seconds) with StillMade credits and playback review`),"image.generate":dt(`capability-run`,`sync`,!0,`One prompt and optional reference images to a stored PNG with any catalog image model and its settings; StillMade credits or account key, and actual image review`),"video.generate":dt(`capability-run`,`async`,!0,`One prompt and optional first/last frames to a measured stored video clip with any catalog video model and its settings; StillMade credits and actual video review`),"image.describe":dt(`capability-run`,`sync`,!0,`One to four owned images to bounded production notes; host-selected model/payment and actual description review`),"media.analyze":dt(`capability-run`,`sync`,!1,`One owned video (optionally one time range), image or up to four images to structured visual evidence: summary, timeline, observations, on-screen text and issues, with StillMade credits`),"web.fetch":dt(`capability-run`,`sync`,!1,`One public web page read by the host and answered against the Block's instruction, with StillMade credits; no cookies, keys or private addresses`),"web.research":dt(`capability-run`,`sync`,!1,`One topic searched on the web and summarized with cited sources, with StillMade credits`),"timeline.propose":dt(`capability-run`,`sync`,!0,`Bounded typed context to strict timeline-edit JSON; host-selected model/payment, stale-before checks, preview and Apply`),"workspace.propose":dt(`capability-run`,`sync`,!0,`Bounded typed context to a strict workspace-edit proposal for one permitted workspace; preview and explicit Apply`),"connection.execute":dt(`connection`,`sync`,!1,`One reviewed action on a connected third-party app account through the host connection service; the Block never receives account credentials`)}),pt=e=>Object.freeze(Object.entries(ft).filter(([,t])=>e(t)).map(([e])=>e)),pt(()=>!0),pt(e=>e.executor===`capability-run`),pt(e=>e.executor===`capability-run`&&e.mode===`sync`),pt(e=>e.byok),[...Object.keys(ut).map(e=>`context.${e}.read`)],mt=new Set([`__proto__`,`prototype`,`constructor`]),ht=class extends Error{constructor(e,t,n=[]){super(t),this.name=`BlockError`,this.code=e,this.details=n}}}));gt();var _t=Object.freeze([`tasks`,`preview-task`,`apply-task`]);function vt(e,t={}){return L(_t.includes(e),`CONNECTION_TASK`,`Choose a declared task operation.`),at(t),L(R(t)&&JSON.stringify(t).length<=32768,`CONNECTION_TASK`,`Use bounded task selection arguments.`),{operation:e,args:structuredClone(t)}}function yt(e,t,n,r){let i=0,a=new Map;return addEventListener(`message`,n=>{let r=n.data;if(n.source!==parent||!r||r.channel!==e||r.session!==t||r.op!==`connected-app-result`)return;let i=a.get(r.id);i&&(a.delete(r.id),r.error?i.reject(Error(r.error)):i.resolve(r.result))}),{connectedApp(o,s={}){if(!n)return Promise.reject(Error(`This Block has no connected-app task contract.`));if(![`tasks`,`preview-task`,`apply-task`].includes(o)||!s||typeof s!=`object`||Array.isArray(s)||JSON.stringify(s).length>32768)return Promise.reject(Error(`Invalid task choice.`));if(a.size>=2)return Promise.reject(Error(`Wait for the current task choice.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i}),r({channel:e,session:t,op:`connected-app-request`,id:c,operation:o,args:s},`*`)})}}}function bt(e){let t=0,n=null,r=[],i=0,a=()=>{if(n||!r.length)return;let o=r.shift();n=o,Promise.resolve().then(()=>{if(o.generation!==t)throw Error(`Preview input changed`);return e(o.kind,o.value)}).then(o.resolve,o.reject).finally(()=>{n===o&&(n=null,i-=o.bytes,a())})};return{request(e,o){let s,c;try{if(![`image`,`media`].includes(e)||!o||Array.isArray(o)||typeof o!=`object`||(s=JSON.stringify(o),c=new TextEncoder().encode(s).length,c>4194304))throw Error(`Expected a bounded preview value`)}catch(e){return Promise.reject(e)}let l=e===`image`&&[n,...r].find(t=>t?.kind===e&&t.serialized===s);if(l)return l.promise;if(r.length+ +!!n>=4||i+c>8388608)return Promise.reject(Error(`Too many queued previews. Wait for a preview to finish.`));let u={kind:e,value:JSON.parse(s),serialized:s,bytes:c,generation:t};return u.promise=new Promise((e,t)=>{u.resolve=e,u.reject=t}),i+=c,r.push(u),a(),u.promise},reset(e=`Preview input changed`){t+=1;for(let t of[n,...r])t&&t.reject(Error(e));n=null,r=[],i=0}}}function xt(){return null}var St=Object.freeze({bytes:25165824,timeoutMs:15e3}),Ct=Object.freeze({video:[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],audio:[`audio/mpeg`,`audio/mp3`,`audio/mp4`,`audio/aac`,`audio/ogg`,`audio/wav`,`audio/x-wav`,`audio/webm`,`audio/flac`]});function wt(e){if(!e||!Ct[e.kind]?.includes(e.blob?.type)||!(e.blob instanceof Blob)||!e.blob.size||e.blob.size>St.bytes)throw Error(`The host returned an unsupported or oversized media preview.`);return{kind:e.kind,blob:e.blob}}async function Tt(e,{signal:t,check:n=()=>{}}={}){n();let r=await fetch(e.url,{signal:t,credentials:`omit`,redirect:`error`,referrerPolicy:`no-referrer`});if(n(),!r.ok)throw Error(`This media could not be loaded. Upload a local copy to preview it.`);let i=(r.headers.get(`content-type`)||``).split(`;`)[0].trim().toLowerCase();if(!Ct[e.kind]?.includes(i))throw Error(`Choose a supported audio or video file.`);if(Number(r.headers.get(`content-length`))>St.bytes)throw Error(`Preview media must be under 24 MB.`);if(!r.body?.getReader)throw Error(`Streaming media previews are unavailable in this browser.`);let a=r.body.getReader(),o=[],s=0;try{for(;;){if(n(),t?.aborted)throw new DOMException(`Media preview cancelled`,`AbortError`);let{done:e,value:r}=await a.read();if(n(),e)break;if(s+=r.byteLength,s>St.bytes)throw Error(`Preview media must be under 24 MB.`);o.push(r)}return wt({kind:e.kind,blob:new Blob(o,{type:i})})}finally{await a.cancel().catch(()=>{}),a.releaseLock()}}var Et=new Set;function Dt(e){return Et.add(e),()=>Et.delete(e)}function Ot(e,t,n,r=null,i=[]){let a=new Map,o=new Set(i),s=new Map,c=new Set,l=new Map,u=!1,d=(e,t)=>{if(clearTimeout(t.timer),s.delete(e),u)return;let r;return r=Promise.resolve().then(()=>{if(!u)return t.callback()}).catch(t=>{l.set(e,t),n(t.message)}).finally(()=>c.delete(r)),c.add(r),r},f=(e,t)=>{if(u||typeof e!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)||typeof t!=`function`)throw Error(`Use a named shared edit callback`);if(!s.has(e)&&s.size+c.size>=32||!l.has(e)&&l.size>=32)throw Error(`Too many scheduled shared edits`);l.delete(e);let n=s.get(e),r={callback:t,started:n?.started??Date.now(),timer:null};n&&clearTimeout(n.timer),r.timer=setTimeout(()=>d(e,r),Math.max(0,Math.min(150,500-(Date.now()-r.started)))),s.set(e,r)},p=(i,s)=>{if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(i)||a.has(i))throw Error(`Use one control per named shared field`);let c=e.getElementById(s);if(!c||![`INPUT`,`TEXTAREA`,`SELECT`].includes(c.tagName)||c.tagName===`INPUT`&&![`text`,`number`,`range`,`checkbox`,`color`].includes(c.type))throw Error(`Bind an existing text, number, checkbox or select control`);if(o.has(i)){let e=c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`,t=c.disabled,n=c.readOnly,r=c.getAttribute(`title`),o=c.getAttribute(`aria-readonly`),s=c.getAttribute(`aria-disabled`);e?(c.readOnly=!0,c.setAttribute(`aria-readonly`,`true`)):(c.disabled=!0,c.setAttribute(`aria-disabled`,`true`)),c.setAttribute(`title`,`Connected input. Change its source in Flow.`);let l={flush:async()=>{},status:()=>({dirty:!1,saving:!1,problem:null,canEdit:!1,composing:!1,interrupted:!1}),setDefault(){},dispose(){c.disabled=t,c.readOnly=n,r===null?c.removeAttribute(`title`):c.setAttribute(`title`,r),o===null?c.removeAttribute(`aria-readonly`):c.setAttribute(`aria-readonly`,o),s===null?c.removeAttribute(`aria-disabled`):c.setAttribute(`aria-disabled`,s),a.delete(i)}};return a.set(i,l),l.dispose}if(r&&(c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`)){let e=r.bind(i,c),t=e.dispose;return e.dispose=()=>{t(),a.delete(i)},a.set(i,e),e.dispose}let l=c.disabled,u={exists:!1},d,f=!1,p=!1,m=null,h=!1,g=!1,_=null,v=null,y=null,b=!1,x=!1,S,C=c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`,ee=e=>{v=e,c.setCustomValidity(e.message),n(e.message)},w=e=>{c.type===`checkbox`?c.checked=!!e:c.value!==String(e??``)&&(c.value=String(e??``))},T=()=>c.type===`checkbox`?c.checked:[`number`,`range`].includes(c.type)?c.valueAsNumber:c.value,E=T(),D=()=>{if(clearTimeout(m),m=null,p)return _;if(h||b||!f||!g||v)return;let e=d;f=!1,y=null,p=!0;let n=!1;return _=Promise.resolve().then(()=>t.updateShared({[i]:e},{[i]:u})).then(()=>{u={exists:!0,value:e},c.setCustomValidity(``),!v&&f&&Object.is(d,e)&&(f=!1,y=null)},e=>{n=!0,f=!0,ee(e)}).finally(()=>{p=!1,_=null,!h&&!n&&f&&d!==e&&O(),!h&&!f&&j(t.getShared())}),_},O=()=>{clearTimeout(m),m=setTimeout(D,Math.max(0,Math.min(150,500-(Date.now()-(y??Date.now())))))},k=()=>{!h&&C&&g&&!l&&(b=!0,clearTimeout(m),m=null)},A=e=>{if(h||!g||l)return;if(C&&e?.isComposing){k();return}if(b)return;let t=T();if(typeof t==`number`&&!Number.isFinite(t)){ee(Error(`Enter a finite number`));return}S!==void 0&&Object.is(t,S)||(S=void 0,(v||!Object.is(t,f||p?d:u.exists?u.value:E))&&((v||y===null)&&(y=Date.now()),d=t,v=null,f=!0,O()))},j=e=>{h||(g=e.canEdit,c.disabled=l||!g,!g&&b&&(x=!0),!g&&(f||b)&&ee(Error(`Editing access changed. Your unsaved draft has been preserved.`)),!(b||f||p||v)&&(u=Object.hasOwn(e.state,i)?{exists:!0,value:e.state[i]}:{exists:!1},w(u.exists?u.value:E)))},te=t.onShared(j),M=()=>{if(!h&&b){if(b=!1,!g||x){x=!1,d=T(),S=d,f=!0,ee(Error(`Editing access changed. Your unsaved draft has been preserved.`));return}A(),f&&!p&&!v?(y=Date.now(),O()):!f&&!p&&!v&&j(t.getShared())}};c.disabled=l||!t.getShared().canEdit,c.addEventListener(`input`,A),c.addEventListener(`change`,A),c.addEventListener(`blur`,D),c.addEventListener(`compositionstart`,k),c.addEventListener(`compositionend`,M);let N=()=>{h=!0,b=!1,clearTimeout(m),te(),c.removeEventListener(`input`,A),c.removeEventListener(`change`,A),c.removeEventListener(`blur`,D),c.removeEventListener(`compositionstart`,k),c.removeEventListener(`compositionend`,M),c.disabled=l,a.delete(i)};return a.set(i,{dispose:N,flush:D,status(){return{dirty:f,saving:p,problem:v,canEdit:g,composing:b,interrupted:S!==void 0}},setDefault(e){E=e,j(t.getShared())}}),N},m=()=>{let t=[...e.querySelectorAll(`[data-stillmade-share]`)];if(t.length>100)throw Error(`Use at most 100 shared controls`);for(let n of t){let t=n.getAttribute(`data-stillmade-share`),r=n.id;if(typeof t!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(t)||typeof r!=`string`||!r||r.length>200||e.getElementById(r)!==n)throw Error(`Each data-stillmade-share control needs a unique ID and valid shared field name`);p(t,r)}return t.length},h=()=>{if(u)throw Error(`Block closed before edits could be flushed`);if([...a.values()].some(e=>e.status().composing))throw Error(`Finish composing text before leaving this Block or running an action.`);let e=[...a.values()].find(e=>e.status().interrupted);if(e)throw e.status().problem};return{bindShared:p,bindAnnotated:m,scheduleSharedEdit:f,flushAll:async()=>{if(u)throw Error(`Block closed before edits could be flushed`);for(let e=0;e<32;e++){if(u)throw Error(`Block closed before edits could be flushed`);h();let e=[...c];for(let[t,n]of[...s])e.push(d(t,n));for(let t of a.values())e.push(t.flush());if(await Promise.all(e),u)throw Error(`Block closed before edits could be flushed`);if(l.size)throw l.values().next().value;let t=!1;for(let e of a.values()){let n=e.status();if(n.problem)throw n.problem;if(n.composing)throw Error(`Finish composing text before leaving this Block or running an action.`);if(n.dirty&&!n.canEdit)throw Error(`Editing access changed. Your draft is not saved.`);t||=n.dirty||n.saving}if(!t&&!s.size&&!c.size)return{queued:!0}}throw Error(`Edits are still arriving. Finish editing before leaving this Block.`)},assertNoComposition:h,getBindingStatus:e=>a.get(e)?.status(),setSharedDefaults(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length>100||JSON.stringify(e).length>65536)throw Error(`Use bounded shared control defaults`);for(let[t,n]of Object.entries(e))a.get(t)?.setDefault(n)},dispose(){u=!0;for(let e of s.values())clearTimeout(e.timer);s.clear();for(let e of[...a.values()])e.dispose()}}}var kt="var StillMadeTextFrame=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=()=>new Map,n=e=>{let n=t();return e.forEach((e,t)=>{n.set(t,e)}),n},r=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},i=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},a=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},o=()=>new Set,s=e=>e[e.length-1],c=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},l=Array.from,u=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},d=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},f=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},p=Array.isArray;var m=class{constructor(){this._observers=t()}on(e,t){return r(this._observers,e,o).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,n){return l((this._observers.get(e)||t()).values()).forEach(e=>e(...n))}destroy(){this._observers=t()}};let h=Math.floor,g=Math.abs,_=(e,t)=>e<t?e:t,v=(e,t)=>e>t?e:t;Number.isNaN;let y=e=>e===0?1/e<0:e<0,b=2**53-1,x=-(2**53-1),S=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&h(e)===e);Number.isNaN,Number.parseInt;let C=String.fromCharCode;String.fromCodePoint,C(65535);let w=e=>e.toLowerCase(),ee=/^\\s*/g,T=e=>e.replace(ee,``),E=/([A-Z])/g,te=(e,t)=>T(e.replace(E,e=>`${t}${w(e)}`)),D=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},O=typeof TextEncoder<`u`?new TextEncoder:null,k=O?e=>O.encode(e):D,A=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});A&&A.decode(new Uint8Array).length===1&&(A=null);let j=(e,t)=>f(t,()=>e).join(``);var M=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};let ne=()=>new M,N=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},re=e=>{let t=new Uint8Array(N(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},ie=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(v(n,t)*2),e.cpos=0)},P=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ae=P,F=(e,t)=>{for(;t>127;)P(e,128|127&t),t=h(t/128);P(e,127&t)},oe=(e,t)=>{let n=y(t);for(n&&(t=-t),P(e,(t>63?128:0)|(n?64:0)|63&t),t=h(t/64);t>0;)P(e,(t>127?128:0)|127&t),t=h(t/128)},se=new Uint8Array(3e4),ce=se.length/3,le=O&&O.encodeInto?(e,t)=>{if(t.length<ce){let n=O.encodeInto(t,se).written||0;F(e,n);for(let t=0;t<n;t++)P(e,se[t])}else I(e,k(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;F(e,r);for(let t=0;t<r;t++)P(e,n.codePointAt(t))},ue=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=_(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(v(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},I=(e,t)=>{F(e,t.byteLength),ue(e,t)},de=(e,t)=>{ie(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},fe=(e,t)=>de(e,4).setFloat32(0,t,!1),pe=(e,t)=>de(e,8).setFloat64(0,t,!1),me=(e,t)=>de(e,8).setBigInt64(0,t,!1),he=new DataView(new ArrayBuffer(4)),ge=e=>(he.setFloat32(0,e),he.getFloat32(0)===e),_e=(e,t)=>{switch(typeof t){case`string`:P(e,119),le(e,t);break;case`number`:S(t)&&g(t)<=2147483647?(P(e,125),oe(e,t)):ge(t)?(P(e,124),fe(e,t)):(P(e,123),pe(e,t));break;case`bigint`:P(e,122),me(e,t);break;case`object`:if(t===null)P(e,126);else if(p(t)){P(e,117),F(e,t.length);for(let n=0;n<t.length;n++)_e(e,t[n])}else if(t instanceof Uint8Array)P(e,116),I(e,t);else{P(e,118);let n=Object.keys(t);F(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];le(e,i),_e(e,t[i])}}break;case`boolean`:P(e,t?120:121);break;default:P(e,127)}};var ve=class extends M{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&F(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}};let ye=e=>{e.count>0&&(oe(e.encoder,e.count===1?e.s:-e.s),e.count>1&&F(e.encoder,e.count-2))};var be=class{constructor(){this.encoder=new M,this.s=0,this.count=0}write(e){this.s===e?this.count++:(ye(this),this.count=1,this.s=e)}toUint8Array(){return ye(this),re(this.encoder)}};let xe=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);oe(e.encoder,t),e.count>1&&F(e.encoder,e.count-2)}};var Se=class{constructor(){this.encoder=new M,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(xe(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return xe(this),re(this.encoder)}},Ce=class{constructor(){this.sarr=[],this.s=``,this.lensE=new be}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new M;return this.sarr.push(this.s),this.s=``,le(e,this.sarr.join(``)),ue(e,this.lensE.toUint8Array()),re(e)}};let we=e=>Error(e),Te=()=>{throw we(`Method unimplemented`)},L=()=>{throw we(`Unexpected case`)},Ee=we(`Unexpected end of array`),De=we(`Integer out of Range`),Oe=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw Ee;return new Uint8Array(e.buffer,e.byteOffset+t,n)},ke=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw Ee;return new DataView(e.buffer,e.byteOffset+t,n)};var Ae=class{constructor(e){this.arr=e,this.pos=0}};let je=e=>new Ae(e),Me=e=>e.pos!==e.arr.length,Ne=(e,t)=>{let n=Oe(e.arr,e.pos,t);return e.pos+=t,n},R=e=>Ne(e,z(e)),Pe=e=>e.arr[e.pos++],z=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>b)throw De}throw Ee},Fe=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>b)throw De}throw Ee},Ie=A?e=>A.decode(R(e)):e=>{let t=z(e);if(t===0)return``;{let n=String.fromCodePoint(Pe(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Pe(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Le=(e,t)=>{let n=ke(e.arr,e.pos,t);return e.pos+=t,n},Re=[e=>void 0,e=>null,Fe,e=>Le(e,4).getFloat32(0,!1),e=>Le(e,8).getFloat64(0,!1),e=>Le(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Ie,e=>{let t=z(e),n={};for(let r=0;r<t;r++){let t=Ie(e);n[t]=ze(e)}return n},e=>{let t=z(e),n=[];for(let r=0;r<t;r++)n.push(ze(e));return n},R],ze=e=>Re[127-Pe(e)](e);var Be=class extends Ae{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),this.count=Me(this)?z(this)+1:-1),this.count--,this.s}},Ve=class extends Ae{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Fe(this);let e=y(this.s);this.count=1,e&&(this.s=-this.s,this.count=z(this)+2)}return this.count--,this.s}},He=class extends Ae{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Fe(this),t=e&1;this.diff=h(e/2),this.count=1,t&&(this.count=z(this)+2)}return this.s+=this.diff,this.count--,this.s}},Ue=class{constructor(e){this.decoder=new Ve(e),this.str=Ie(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;let We=crypto.getRandomValues.bind(crypto),Ge=()=>We(new Uint32Array(1))[0],Ke=()=>`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^Ge()&15>>e/4).toString(16)),qe=Date.now,Je=e=>new Promise(e);Promise.all.bind(Promise);let Ye=e=>e===void 0?null:e,Xe=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(Xe=localStorage)}catch{}let Ze=Xe,Qe=Symbol(`Equality`),$e=(e,t)=>e===t||!!e?.[Qe]?.(t)||!1,et=e=>typeof e==`object`,tt=Object.assign,nt=Object.keys,rt=(e,t)=>{for(let n in e)t(e[n],n)},it=e=>nt(e).length,at=e=>{for(let t in e)return!1;return!0},ot=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},st=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ct=(e,t)=>e===t||it(e)===it(t)&&ot(e,(e,n)=>(e!==void 0||st(t,n))&&$e(t[n],e)),lt=Object.freeze,ut=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&ut(e[t])}return lt(e)},dt=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&dt(e,t,n+1)}},ft=e=>e,pt=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Qe]!=null)return e[Qe](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!pt(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(it(e)!==it(t))return!1;for(let n in e)if(!st(e,n)||!pt(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!pt(e[n],t[n]))return!1;break;default:return!1}return!0},mt=(e,t)=>t.includes(e),ht=typeof process<`u`&&process.release&&/node|io\\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`;typeof navigator<`u`&&/Mac/.test(navigator.platform);let gt,_t=[],vt=()=>{if(gt===void 0){if(ht){gt=t();let e=process.argv,n=null;for(let t=0;t<e.length;t++){let r=e[t];r[0]===`-`?(n!==null&&gt.set(n,``),n=r):n===null?_t.push(r):(gt.set(n,r),n=null)}n!==null&&gt.set(n,``)}else typeof location==`object`?(gt=t(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);gt.set(`--${te(t,`-`)}`,n),gt.set(`-${te(t,`-`)}`,n)}})):gt=t()}return gt},yt=e=>vt().has(e),bt=e=>Ye(ht?process.env[e.toUpperCase().replaceAll(`-`,`_`)]:Ze.getItem(e)),xt=e=>yt(`--`+e)||bt(e)!==null,St=xt(`production`),Ct=ht&&mt(process.env.FORCE_COLOR,[`true`,`1`,`2`])||!yt(`--no-colors`)&&!xt(`no-color`)&&(!ht||process.stdout.isTTY)&&(!ht||yt(`--color`)||bt(`COLORTERM`)!==null||(bt(`TERM`)||``).includes(`color`)),wt=e=>new Uint8Array(e),Tt=e=>{let t=wt(e.byteLength);return t.set(e),t};var Et=class{constructor(e,t){this.left=e,this.right=t}};let Dt=(e,t)=>new Et(e,t),Ot=e=>e.next()>=.5,kt=(e,t,n)=>h(e.next()*(n+1-t)+t),At=(e,t,n)=>h(e.next()*(n+1-t)+t),jt=(e,t,n)=>At(e,t,n),Mt=e=>C(jt(e,97,122)),Nt=(e,t=0,n=20)=>{let r=jt(e,t,n),i=``;for(let t=0;t<r;t++)i+=Mt(e);return i},Pt=(e,t)=>t[jt(e,0,t.length-1)],Ft=Symbol(`0schema`);var It=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(j(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`\n`)}};let Lt=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Qe]?$e(e,t):p(e)?u(e,e=>d(t,t=>Lt(e,t))):et(e)?ot(e,(e,n)=>Lt(e,t[n])):!1;var B=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Lt(t,n)}equals(e){return this.constructor===e.constructor&&pt(this.shape,e.shape)}[Ft](){return!0}[Qe](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Te()}get nullable(){return hn(this,An)}get optional(){return new Kt(this)}cast(e){return Pn(e,this),e}expect(e){return Pn(e,this),e}},Rt=class extends B{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}};let V=(e,t=null)=>new Rt(e,t);V(Rt);var zt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}};let H=e=>new zt(e);V(zt);var Bt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}};let Vt=(...e)=>new Bt(e),Ht=V(Bt),Ut=RegExp.escape||(e=>e.replace(/[().|&,$^[\\]]/g,e=>`\\\\`+e)),Wt=e=>{if(Tn.check(e))return[Ut(e)];if(Ht.check(e))return e.shape.map(e=>e+``);if(wn.check(e))return[`[+-]?\\\\d+.?\\\\d*`];if(En.check(e))return[`.*`];if(gn.check(e))return e.shape.map(Wt).flat(1);L()};V(class extends B{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(Wt).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});let Gt=Symbol(`optional`);var Kt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[Gt](){return!0}};let qt=V(Kt);var Jt=class extends B{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new Jt,V(Jt);var Yt=class e extends B{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):ot(this.shape,(n,r)=>{let i=this._isPartial&&!st(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}};let Xt=e=>new Yt(e),Zt=V(Yt),Qt=H(e=>e!=null&&(e.constructor===Object||e.constructor==null));var $t=class extends B{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&ot(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}};let en=(e,t)=>new $t(e,t),tn=V($t);var nn=class extends B{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&ot(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}};let rn=(...e)=>new nn(e);V(nn);var an=class extends B{constructor(e){super(),this.shape=e.length===1?e[0]:new mn(e)}check(e,t){let n=p(e)&&u(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}};let on=(...e)=>new an(e),sn=V(an),cn=H(e=>p(e));var ln=class extends B{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}};let un=(e,t=null)=>new ln(e,t);V(ln);let dn=un(B),fn=V(class extends B{constructor(e){super(),this.len=e.length-1,this.args=rn(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),pn=H(e=>typeof e==`function`);V(class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=u(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var mn=class extends B{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=d(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}};let hn=(...e)=>e.findIndex(e=>gn.check(e))>=0?hn(...e.map(e=>Nn(e)).map(e=>gn.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new mn(e),gn=V(mn),_n=()=>!0,vn=H(_n),yn=V(zt,e=>e.shape===_n),bn=H(e=>typeof e==`bigint`),xn=H(e=>e===bn),Sn=H(e=>typeof e==`symbol`);H(e=>e===Sn);let Cn=H(e=>typeof e==`number`),wn=H(e=>e===Cn),Tn=H(e=>typeof e==`string`),En=H(e=>e===Tn),Dn=H(e=>typeof e==`boolean`),On=H(e=>e===Dn),kn=Vt(void 0);V(Bt,e=>e.shape.length===1&&e.shape[0]===void 0),Vt(void 0);let An=Vt(null),jn=V(Bt,e=>e.shape.length===1&&e.shape[0]===null);V(Uint8Array),V(Rt,e=>e.shape===Uint8Array);let Mn=hn(Cn,Tn,An,kn,bn,Dn,Sn);(()=>{let e=on(vn),t=en(Tn,vn),n=hn(Cn,Tn,An,Dn,e,t);return e.shape=n,t.shape.values=n,n})();let Nn=e=>{if(dn.check(e))return e;if(Qt.check(e)){let t={};for(let n in e)t[n]=Nn(e[n]);return Xt(t)}if(cn.check(e))return hn(...e.map(Nn));if(Mn.check(e))return Vt(e);if(pn.check(e))return V(e);L()},Pn=St?()=>{}:(e,t)=>{let n=new It;if(!t.check(e,n))throw we(`Expected value to be of type ${t.constructor.name}.\\n${n.toString()}`)};var Fn=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Nn(e),h:t}),this}else(e){return this.if(vn,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw we(`Unhandled pattern`)}}};let In=(e=>new Fn(e))(vn).if(wn,(e,t)=>kt(t,x,b)).if(En,(e,t)=>Nt(t)).if(On,(e,t)=>Ot(t)).if(xn,(e,t)=>BigInt(kt(t,x,b))).if(gn,(e,t)=>Ln(t,Pt(t,e.shape))).if(Zt,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(qt.check(i)){if(Ot(t))continue;i=i.shape}n[r]=In(i,t)}return n}).if(sn,(e,t)=>{let n=[],r=At(t,0,42);for(let i=0;i<r;i++)n.push(Ln(t,e.shape));return n}).if(Ht,(e,t)=>Pt(t,e.shape)).if(jn,(e,t)=>null).if(fn,(e,t)=>{let n=Ln(t,e.res);return()=>n}).if(yn,(e,t)=>Ln(t,Pt(t,[Cn,Tn,An,kn,bn,Dn,on(Cn),en(hn(`a`,`b`,`c`),Cn)]))).if(tn,(e,t)=>{let n={},r=kt(t,0,3);for(let i=0;i<r;i++){let r=Ln(t,e.shape.keys);n[r]=Ln(t,e.shape.values)}return n}).done(),Ln=(e,t)=>In(Nn(t),e),Rn=typeof document<`u`?document:{};H(e=>e.nodeType===Un),typeof DOMParser<`u`&&new DOMParser,H(e=>e.nodeType===Bn),H(e=>e.nodeType===Vn);let zn=e=>i(e,(e,t)=>`${t}:${e};`).join(``),Bn=Rn.ELEMENT_NODE,Vn=Rn.TEXT_NODE;Rn.CDATA_SECTION_NODE,Rn.COMMENT_NODE;let Hn=Rn.DOCUMENT_NODE;Rn.DOCUMENT_TYPE_NODE;let Un=Rn.DOCUMENT_FRAGMENT_NODE;H(e=>e.nodeType===Hn);let Wn=Symbol,Gn=Wn(),Kn=Wn(),qn=Wn(),Jn=Wn(),Yn=Wn(),Xn=Wn(),Zn=Wn(),Qn=Wn(),$n=Wn(),er=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};qe();let tr={[Gn]:Dt(`font-weight`,`bold`),[Kn]:Dt(`font-weight`,`normal`),[qn]:Dt(`color`,`blue`),[Yn]:Dt(`color`,`green`),[Jn]:Dt(`color`,`grey`),[Xn]:Dt(`color`,`red`),[Zn]:Dt(`color`,`purple`),[Qn]:Dt(`color`,`orange`),[$n]:Dt(`color`,`black`)},nr=Ct?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let n=[],r=[],i=t(),a=[],o=0;for(;o<e.length;o++){let t=e[o],a=tr[t];if(a!==void 0)i.set(a.left,a.right);else{if(t===void 0)break;if(t.constructor===String||t.constructor===Number){let e=zn(i);o>0||e.length>0?(n.push(`%c`+t),r.push(e)):n.push(t)}else break}}for(o>0&&(a=r,a.unshift(n.join(``)));o<e.length;o++){let t=e[o];t instanceof Symbol||a.push(t)}return a}:er,rr=(...e)=>{console.log(...nr(e)),ar.forEach(t=>t.print(e))},ir=(...e)=>{console.warn(...nr(e)),e.unshift(Qn),ar.forEach(t=>t.print(e))},ar=o(),or=e=>({[Symbol.iterator](){return this},next:e}),sr=(e,t)=>or(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),cr=(e,t)=>or(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});var lr=class{constructor(e,t){this.clock=e,this.len=t}},ur=class{constructor(){this.clients=new Map}};let dr=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])Si(e,i,o.clock,o.len,n)}}),fr=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=h((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},pr=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&fr(n,t.clock)!==null},mr=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new lr(r.clock,v(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},hr=e=>{let t=new ur;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)c(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return mr(t),t},gr=(e,t,n,i)=>{r(e.clients,t,()=>[]).push(new lr(n,i))},_r=()=>new ur,vr=e=>{let t=_r();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new lr(i,a))}}r.length>0&&t.clients.set(n,r)}),t},yr=(e,t)=>{F(e.restEncoder,t.clients.size),l(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),F(e.restEncoder,t);let r=n.length;F(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},br=e=>{let t=new ur,n=z(e.restDecoder);for(let i=0;i<n;i++){e.resetDsCurVal();let n=z(e.restDecoder),i=z(e.restDecoder);if(i>0){let a=r(t.clients,n,()=>[]);for(let t=0;t<i;t++)a.push(new lr(e.readDsClock(),e.readDsLen()))}}return t},xr=(e,t,n)=>{let r=new ur,i=z(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=z(e.restDecoder),a=z(e.restDecoder),o=n.clients.get(i)||[],s=W(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&gr(r,i,s,a-s);let e=_i(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,Po(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,Po(t,c,a-c.id.clock)),c.delete(t))}else gr(r,i,n,a-n)}}if(r.clients.size>0){let e=new jr;return F(e.restEncoder,0),yr(e,r),e.toUint8Array()}return null},Sr=Ge;var Cr=class e extends m{constructor({guid:e=Ke(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Sr(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new mi,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Je(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>Je(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&K(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(l(this.subdocs).map(e=>e.guid))}transact(e,t=null){return K(this,e,t)}get(e,t=J){let n=r(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),i=n.constructor;if(t!==J&&i!==t){if(i===J){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}throw Error(`Type with the name ${e} has already been defined with a different constructor`)}return n}getArray(e=``){return this.get(e,wa)}getText(e=``){return this.get(e,Ga)}getMap(e=``){return this.get(e,Da)}getXmlElement(e=``){return this.get(e,Xa)}getXmlFragment(e=``){return this.get(e,Ja)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,l(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,K(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},wr=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return z(this.restDecoder)}readDsLen(){return z(this.restDecoder)}},Tr=class extends wr{readLeftID(){return U(z(this.restDecoder),z(this.restDecoder))}readRightID(){return U(z(this.restDecoder),z(this.restDecoder))}readClient(){return z(this.restDecoder)}readInfo(){return Pe(this.restDecoder)}readString(){return Ie(this.restDecoder)}readParentInfo(){return z(this.restDecoder)===1}readTypeRef(){return z(this.restDecoder)}readLen(){return z(this.restDecoder)}readAny(){return ze(this.restDecoder)}readBuf(){return Tt(R(this.restDecoder))}readJSON(){return JSON.parse(Ie(this.restDecoder))}readKey(){return Ie(this.restDecoder)}},Er=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=z(this.restDecoder),this.dsCurrVal}readDsLen(){let e=z(this.restDecoder)+1;return this.dsCurrVal+=e,e}},Dr=class extends Er{constructor(e){super(e),this.keys=[],z(e),this.keyClockDecoder=new He(R(e)),this.clientDecoder=new Ve(R(e)),this.leftClockDecoder=new He(R(e)),this.rightClockDecoder=new He(R(e)),this.infoDecoder=new Be(R(e),Pe),this.stringDecoder=new Ue(R(e)),this.parentInfoDecoder=new Be(R(e),Pe),this.typeRefDecoder=new Ve(R(e)),this.lenDecoder=new Ve(R(e))}readLeftID(){return new ei(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ei(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ze(this.restDecoder)}readBuf(){return R(this.restDecoder)}readJSON(){return ze(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},Or=class{constructor(){this.restEncoder=ne()}toUint8Array(){return re(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){F(this.restEncoder,e)}writeDsLen(e){F(this.restEncoder,e)}},kr=class extends Or{writeLeftID(e){F(this.restEncoder,e.client),F(this.restEncoder,e.clock)}writeRightID(e){F(this.restEncoder,e.client),F(this.restEncoder,e.clock)}writeClient(e){F(this.restEncoder,e)}writeInfo(e){ae(this.restEncoder,e)}writeString(e){le(this.restEncoder,e)}writeParentInfo(e){F(this.restEncoder,+!!e)}writeTypeRef(e){F(this.restEncoder,e)}writeLen(e){F(this.restEncoder,e)}writeAny(e){_e(this.restEncoder,e)}writeBuf(e){I(this.restEncoder,e)}writeJSON(e){le(this.restEncoder,JSON.stringify(e))}writeKey(e){le(this.restEncoder,e)}},Ar=class{constructor(){this.restEncoder=ne(),this.dsCurrVal=0}toUint8Array(){return re(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,F(this.restEncoder,t)}writeDsLen(e){e===0&&L(),F(this.restEncoder,e-1),this.dsCurrVal+=e}},jr=class extends Ar{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Se,this.clientEncoder=new be,this.leftClockEncoder=new Se,this.rightClockEncoder=new Se,this.infoEncoder=new ve(ae),this.stringEncoder=new Ce,this.parentInfoEncoder=new ve(ae),this.typeRefEncoder=new be,this.lenEncoder=new be}toUint8Array(){let e=ne();return F(e,0),I(e,this.keyClockEncoder.toUint8Array()),I(e,this.clientEncoder.toUint8Array()),I(e,this.leftClockEncoder.toUint8Array()),I(e,this.rightClockEncoder.toUint8Array()),I(e,re(this.infoEncoder)),I(e,this.stringEncoder.toUint8Array()),I(e,re(this.parentInfoEncoder)),I(e,this.typeRefEncoder.toUint8Array()),I(e,this.lenEncoder.toUint8Array()),ue(e,re(this.restEncoder)),re(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){_e(this.restEncoder,e)}writeBuf(e){I(this.restEncoder,e)}writeJSON(e){_e(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}};let Mr=(e,t,n,r)=>{r=v(r,t[0].id.clock);let i=_i(t,r);F(e.restEncoder,t.length-i),e.writeClient(n),F(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},Nr=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{W(t,n)>e&&r.set(n,e)}),hi(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),F(e.restEncoder,r.size),l(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{Mr(e,t.clients.get(n),n,r)})},Pr=(e,n)=>{let r=t(),i=z(e.restDecoder);for(let t=0;t<i;t++){let t=z(e.restDecoder),i=Array(t),a=e.readClient(),o=z(e.restDecoder);r.set(a,{i:0,refs:i});for(let r=0;r<t;r++){let t=e.readInfo();switch(31&t){case 0:{let t=e.readLen();i[r]=new Y(U(a,o),t),o+=t;break}case 10:{let t=z(e.restDecoder);i[r]=new zo(U(a,o),t),o+=t;break}default:{let s=!(t&192),c=new Z(U(a,o),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,s?e.readParentInfo()?n.get(e.readString()):e.readLeftID():null,s&&(t&32)==32?e.readString():null,Lo(e,t));i[r]=c,o+=c.length}}}}return r},Fr=(e,t,n)=>{let i=[],a=l(n.keys()).sort((e,t)=>e-t);if(a.length===0)return null;let o=()=>{if(a.length===0)return null;let e=n.get(a[a.length-1]);for(;e.refs.length===e.i;)if(a.pop(),a.length>0)e=n.get(a[a.length-1]);else return null;return e},s=o();if(s===null)return null;let c=new mi,u=new Map,d=(e,t)=>{let n=u.get(e);(n==null||n>t)&&u.set(e,t)},f=s.refs[s.i++],p=new Map,m=()=>{for(let e of i){let t=e.id.client,r=n.get(t);r?(r.i--,c.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):c.clients.set(t,[e]),a=a.filter(e=>e!==t)}i.length=0};for(;;){if(f.constructor!==zo){let a=r(p,f.id.client,()=>W(t,f.id.client))-f.id.clock;if(a<0)i.push(f),d(f.id.client,f.id.clock-1),m();else{let r=f.getMissing(e,t);if(r!==null){i.push(f);let e=n.get(r)||{refs:[],i:0};if(e.refs.length===e.i)d(r,W(t,r)),m();else{f=e.refs[e.i++];continue}}else(a===0||a<f.length)&&(f.integrate(e,a),p.set(f.id.client,f.id.clock+f.length))}}if(i.length>0)f=i.pop();else if(s!==null&&s.i<s.refs.length)f=s.refs[s.i++];else{if(s=o(),s===null)break;f=s.refs[s.i++]}}if(c.clients.size>0){let e=new jr;return Nr(e,c,new Map),F(e.restEncoder,0),{missing:u,update:e.toUint8Array()}}return null},Ir=(e,t)=>Nr(e,t.doc.store,t.beforeState),Lr=(e,t,n,r=new Dr(e))=>K(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=Pr(r,n),o=Fr(e,i,a),s=i.pendingStructs;if(s){for(let[e,n]of s.missing)if(n<W(i,e)){t=!0;break}if(o){for(let[e,t]of o.missing){let n=s.missing.get(e);(n==null||n>t)&&s.missing.set(e,t)}s.update=Vi([s.update,o.update])}}else i.pendingStructs=o;let c=xr(r,e,i);if(i.pendingDs){let t=new Dr(je(i.pendingDs));z(t.restDecoder);let n=xr(t,e,i);i.pendingDs=c&&n?Vi([c,n]):c||n}else i.pendingDs=c;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,Rr(e.doc,t)}},n,!1),Rr=(e,t,n,r=Dr)=>{let i=je(t);Lr(i,e,n,new r(i))},zr=(e,t,n)=>Rr(e,t,n,Tr),Br=(e,t,n=new Map)=>{Nr(e,t.store,n),yr(e,vr(t.store))},Vr=(e,t=new Uint8Array([0]),n=new jr)=>{let r=Wr(t);Br(n,e,r);let i=[n.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(Hi(e.store.pendingStructs.update,t)),i.length>1){if(n.constructor===kr)return zi(i.map((e,t)=>t===0?e:qi(e)));if(n.constructor===jr)return Vi(i)}return i[0]},Hr=(e,t)=>Vr(e,t,new kr),Ur=e=>{let t=new Map,n=z(e.restDecoder);for(let r=0;r<n;r++){let n=z(e.restDecoder),r=z(e.restDecoder);t.set(n,r)}return t},Wr=e=>Ur(new wr(je(e))),Gr=(e,t)=>(F(e.restEncoder,t.size),l(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{F(e.restEncoder,t),F(e.restEncoder,n)}),e),Kr=(e,t)=>Gr(e,hi(t.store)),qr=(e,t=new Ar)=>(e instanceof Map?Gr(t,e):Kr(t,e),t.toUint8Array()),Jr=e=>qr(e,new Or);var Yr=class{constructor(){this.l=[]}};let Xr=()=>new Yr,Zr=(e,t)=>e.l.push(t),Qr=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},$r=(e,t,n)=>dt(e.l,[t,n]);var ei=class{constructor(e,t){this.client=e,this.clock=t}};let ti=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,U=(e,t)=>new ei(e,t),ni=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw L()},ri=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};var ii=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},ai=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}};let oi=(e,t,n=0)=>new ai(e,t,n),si=(e,t,n)=>{let r=null,i=null;return e._item===null?i=ni(e):r=U(e._item.id.client,e._item.id.clock),new ii(r,i,t,n)},ci=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return si(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return si(e,U(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return si(e,r.lastId,n);r=r.right}return si(e,null,n)},li=(e,t)=>{let n=vi(e,t);return{item:n,diff:t.clock-n.id.clock}},ui=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(W(r,i.client)<=i.clock)return null;let e=n?Mo(r,i):li(r,i),t=e.item;if(!(t instanceof Z))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(W(r,a.client)<=a.clock)return null;let{item:e}=n?Mo(r,a):{item:vi(r,a)};if(e instanceof Z&&e.content instanceof Ao)c=e.content.type;else return null}else throw L();l=s>=0?c._length:0}return oi(c,l,e.assoc)};var di=class{constructor(e,t){this.ds=e,this.sv=t}};((e,t)=>new di(e,t))(_r(),new Map);let fi=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!pr(t.ds,e.id),pi=(e,t)=>{let n=r(e.meta,pi,o),i=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<W(i,n)&&G(e,U(n,t))}),dr(e,t.ds,e=>{}),n.add(t))};var mi=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}};let hi=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},W=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},gi=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw L()}n.push(t)},_i=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=h(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=h((n+r)/2)}throw L()},vi=(e,t)=>{let n=e.clients.get(t.client);return n[_i(n,t.clock)]},yi=(e,t,n)=>{let r=_i(t,n),i=t[r];return i.id.clock<n&&i instanceof Z?(t.splice(r+1,0,Po(e,i,n-i.id.clock)),r+1):r},G=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[yi(e,n,t.clock)]},bi=(e,t,n)=>{let r=t.clients.get(n.client),i=_i(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==Y&&r.splice(i+1,0,Po(e,a,n.clock-a.id.clock+1)),a},xi=(e,t,n)=>{let r=e.clients.get(t.id.client);r[_i(r,t.id.clock)]=n},Si=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=yi(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&yi(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)};var Ci=class{constructor(e,t,n){this.doc=e,this.deleteSet=new ur,this.beforeState=hi(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}};let wi=(e,t)=>t.deleteSet.clients.size===0&&!a(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(mr(t.deleteSet),Ir(e,t),yr(e,t.deleteSet),!0),Ti=(e,t,n)=>{let i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&r(e.changed,t,o).add(n)},Ei=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Z&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},Di=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=_i(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof Z&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},Oi=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=_(r.length-1,1+_i(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+Ei(r,e)}})},ki=(e,t,n)=>{Di(e,t,n),Oi(e,t)},Ai=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{mr(a),n.afterState=hi(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{$r(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&Ha(n)})}),dt(e,[])}finally{r.gc&&Di(a,i,r.gcFilter),Oi(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=v(_i(e,r),1);for(let t=e.length-1;t>=n;)t-=1+Ei(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=_i(r,n);a+1<r.length&&Ei(r,a+1)>1||a>0&&Ei(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(rr(Qn,Gn,`[yjs] `,Kn,Xn,`Changed the client-id because another client seems to be using it.`),r.clientID=Sr()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new kr;wi(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new jr;wi(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):Ai(e,t+1)}}},K=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new Ci(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&Ai(i,0)}}return o};var ji=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}};let Mi=(e,t,n)=>{dr(e,n.deletions,n=>{n instanceof Z&&t.scope.some(t=>t===e.doc||ri(t,n))&&No(n,!1)})},Ni=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;K(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;dr(n,o.insertions,e=>{if(e instanceof Z){if(e.redone!==null){let{item:t,diff:i}=Mo(r,e.id);i>0&&(t=G(n,U(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||ri(t,e))&&c.push(e)}}),dr(n,o.deletions,e=>{e instanceof Z&&a.some(t=>t===n.doc||ri(t,e))&&!pr(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=Io(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o};var Pi=class extends m{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=p(e)?e[0].doc:e instanceof Cr?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new ur;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&gr(i,n,r,a)});let a=qe(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=hr([t.deletions,e.deleteSet]),t.insertions=hr([t.insertions,i])}else r.push(new ji(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),dr(e,e.deleteSet,t=>{t instanceof Z&&this.scope.some(n=>n===e.doc||ri(n,t))&&No(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.destroy=this.destroy.bind(this),this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,this.destroy)}addToScope(e){let t=new Set(this.scope);e=p(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof J?e.doc!==this.doc:e!==this.doc)&&ir(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>Mi(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>Mi(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Ni(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Ni(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),this.doc.off(`destroy`,this.destroy),super.destroy()}};function*Fi(e){let t=z(e.restDecoder);for(let n=0;n<t;n++){let t=z(e.restDecoder),n=e.readClient(),r=z(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=z(e.restDecoder);yield new zo(U(n,r),t),r+=t}else if(31&t){let i=!(t&192),a=new Z(U(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,Lo(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new Y(U(n,r),t),r+=t}}}}var Ii=class{constructor(e,t){this.gen=Fi(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===zo);return this.curr}};let Li=(e,t=Dr)=>{let n=[],r=new t(je(e)),i=new Ii(r,!1);for(let e=i.curr;e!==null;e=i.next())n.push(e);return{structs:n,ds:br(r)}};var Ri=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}};let zi=e=>Vi(e,Tr,kr),Bi=(e,t)=>{if(e.constructor===Y){let{client:n,clock:r}=e.id;return new Y(U(n,r+t),e.length-t)}if(e.constructor===zo){let{client:n,clock:r}=e.id;return new zo(U(n,r+t),e.length-t)}{let n=e,{client:r,clock:i}=n.id;return new Z(U(r,i+t),null,U(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},Vi=(e,t=Dr,n=jr)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(je(e))),i=r.map(e=>new Ii(e,!0)),a=null,o=new n,s=new Ri(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===zo?1:-1:n}return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)Wi(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock){if(a.struct.constructor===zo)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{Wi(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new zo(U(t,a.struct.id.clock+a.struct.length),e),offset:0}}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===zo?a.struct.length-=t:n=Bi(n,t)),a.struct.mergeWith(n)||(Wi(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==zo;n=e.next())Wi(s,a.struct,a.offset),a={struct:n,offset:0}}a!==null&&(Wi(s,a.struct,a.offset),a=null),Gi(s);let c=r.map(e=>br(e)),l=hr(c);return yr(o,l),o.toUint8Array()},Hi=(e,t,n=Dr,r=jr)=>{let i=Wr(t),a=new r,o=new Ri(a),s=new n(je(e)),c=new Ii(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===zo){c.next();continue}if(e.id.clock+e.length>n)for(Wi(o,e,v(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)Wi(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}Gi(o);let l=br(s);return yr(a,l),a.toUint8Array()},Ui=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:re(e.encoder.restEncoder)}),e.encoder.restEncoder=ne(),e.written=0)},Wi=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Ui(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),F(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},Gi=e=>{Ui(e);let t=e.encoder.restEncoder;F(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];F(t,r.written),ue(t,r.restEncoder)}},Ki=(e,t,n,r)=>{let i=new n(je(e)),a=new Ii(i,!1),o=new r,s=new Ri(o);for(let e=a.curr;e!==null;e=a.next())Wi(s,t(e),0);Gi(s);let c=br(i);return yr(o,c),o.toUint8Array()},qi=e=>Ki(e,ft,Dr,kr),Ji=`You must not compute changes after the event-handler fired.`;var Yi=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=Xi(this.currentTarget,this.target)}deletes(e){return pr(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw we(Ji);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r)){if(e!==null&&this.deletes(e))i=`delete`,a=s(e.content.getContent());else return}else e!==null&&this.deletes(e)?(i=`update`,a=s(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=s(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw we(Ji);let t=this.target,n=o(),r=o(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}};let Xi=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},q=()=>{ir(`Invalid access: Add Yjs type to a document before reading data.`)},Zi=0;var Qi=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Zi++}};let $i=e=>{e.timestamp=Zi++},ea=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Zi++},ta=(e,t,n)=>{if(e.length>=80){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return ea(r,t,n),r}{let r=new Qi(t,n);return e.push(r),r}},na=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>g(t-e.index)<g(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,$i(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&g(n.index-i)<r.parent.length/80?(ea(n,r,i),n):ta(e._searchMarker,r,i)},ra=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=v(t,i.index+n))}},ia=(e,t,n)=>{let i=e,a=t.changedParentTypes;for(;r(a,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;$r(i._eH,n,t)};var J=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Xr(),this._dEH=Xr(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Te()}clone(){throw Te()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Zr(this._eH,e)}observeDeep(e){Zr(this._dEH,e)}unobserve(e){Qr(this._eH,e)}unobserveDeep(e){Qr(this._dEH,e)}toJSON(){}};let aa=(e,t,n)=>{e.doc??q(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},oa=e=>{e.doc??q();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},sa=(e,t)=>{let n=0,r=e._start;for(e.doc??q();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},ca=(e,t)=>{let n=[];return sa(e,(r,i)=>{n.push(t(r,i,e))}),n},la=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},ua=(e,t)=>{e.doc??q();let n=na(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},da=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new vo(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new io(new Uint8Array(n))),i.integrate(e,0);break;case Cr:i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new lo(n)),i.integrate(e,0);break;default:if(n instanceof J)i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ao(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},fa=()=>we(`Length exceeded!`),pa=(e,t,n,r)=>{if(n>t._length)throw fa();if(n===0)return t._searchMarker&&ra(t._searchMarker,n,r.length),da(e,t,null,r);let i=n,a=na(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&G(e,U(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&ra(t._searchMarker,i,r.length),da(e,t,o,r)},ma=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return da(e,t,r,n)},ha=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=na(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&G(e,U(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&G(e,U(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw fa();t._searchMarker&&ra(t._searchMarker,i,-a+r)},ga=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},_a=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new vo([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new vo([r]);break;case Uint8Array:s=new io(r);break;case Cr:s=new lo(r);break;default:if(r instanceof J)s=new Ao(r);else throw Error(`Unexpected content type`)}new Z(U(o,W(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},va=(e,t)=>{e.doc??q();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},ya=e=>{let t={};return e.doc??q(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},ba=(e,t)=>{e.doc??q();let n=e._map.get(t);return n!==void 0&&!n.deleted},xa=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&fi(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Sa=e=>(e.doc??q(),sr(e._map.entries(),e=>!e[1].deleted));var Ca=class extends Yi{},wa=class e extends J{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}get length(){return this.doc??q(),this._length}_callObserver(e,t){super._callObserver(e,t),ia(this,e,new Ca(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):K(this.doc,n=>{pa(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):K(this.doc,t=>{ma(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):K(this.doc,n=>{ha(n,this,e,t)})}get(e){return ua(this,e)}toArray(){return oa(this)}slice(e=0,t=this.length){return aa(this,e,t)}toJSON(){return this.map(e=>e instanceof J?e.toJSON():e)}map(e){return ca(this,e)}forEach(e){sa(this,e)}[Symbol.iterator](){return la(this)}_write(e){e.writeTypeRef(Co)}};let Ta=e=>new wa;var Ea=class extends Yi{constructor(e,t,n){super(e,t),this.keysChanged=n}},Da=class e extends J{constructor(e){super(),this._prelimContent=null,this._prelimContent=e===void 0?new Map:new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof J?e.clone():e)}),t}_callObserver(e,t){ia(this,e,new Ea(this,e,t))}toJSON(){this.doc??q();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof J?r.toJSON():r}}),e}get size(){return[...Sa(this)].length}keys(){return cr(Sa(this),e=>e[0])}values(){return cr(Sa(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return cr(Sa(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??q(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):K(this.doc,t=>{ga(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):K(this.doc,n=>{_a(n,this,e,t)}),t}get(e){return va(this,e)}has(e){return ba(this,e)}clear(){this.doc===null?this._prelimContent.clear():K(this.doc,e=>{this.forEach(function(t,n,r){ga(e,r,n)})})}_write(e){e.writeTypeRef(wo)}};let Oa=e=>new Da,ka=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&ct(e,t);var Aa=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&L(),this.right.content.constructor){case X:this.right.deleted||Pa(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length)}this.left=this.right,this.right=this.right.right}};let ja=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case X:t.right.deleted||Pa(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&G(e,U(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length)}t.left=t.right,t.right=t.right.right}return t},Ma=(e,t,n,r)=>{let i=new Map,a=r?na(t,n):null;if(a){let t=new Aa(a.p.left,a.p,a.index,i);return ja(e,t,n-a.index)}{let r=new Aa(null,t._start,0,i);return ja(e,r,n)}},Na=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===X&&ka(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new Z(U(a,W(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new X(o,r));l.integrate(e,0),n.right=l,n.forward()})},Pa=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},Fa=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===X&&ka(t[e.right.content.key]??null,e.right.content.value));)e.forward()},Ia=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!ka(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new Z(U(a,W(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new X(s,c)),n.right.integrate(e,0),n.forward()}}return o},La=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;Fa(n,i);let s=Ia(e,t,n,i),c=r.constructor===String?new bo(r):r instanceof J?new Ao(r):new fo(r),{left:l,right:u,index:d}=n;t._searchMarker&&ra(t._searchMarker,n.index,c.getLength()),u=new Z(U(o,W(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),Na(e,t,n,s)},Ra=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;Fa(n,i);let s=Ia(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===X));){if(!n.right.deleted)switch(n.right.content.constructor){case X:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(ka(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&G(e,U(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`\n`;n.right=new Z(U(o,W(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new bo(i)),n.right.integrate(e,0),n.forward()}Na(e,t,n,s)},za=(e,n,r,i,a)=>{let o=n,s=t();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===X){let e=o.content;s.set(e.key,e)}o=o.right}let c=0,l=!1;for(;n!==o;){if(r===n&&(l=!0),!n.deleted){let t=n.content;switch(t.constructor){case X:{let{key:r,value:o}=t,u=i.get(r)??null;(s.get(r)!==t||u===o)&&(n.delete(e),c++,!l&&(a.get(r)??null)===o&&u!==o&&(u===null?a.delete(r):a.set(r,u))),!l&&!n.deleted&&Pa(a,t);break}}}n=n.right}return c},Ba=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===X){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},Va=e=>{let r=0;return K(e.doc,i=>{let a=e._start,o=e._start,s=t(),c=n(s);for(;o;){if(o.deleted===!1)switch(o.content.constructor){case X:Pa(c,o.content);break;default:r+=za(i,a,o,s,c),s=n(c),a=o}o=o.right}}),r},Ha=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&Si(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===X&&e.constructor!==Y&&t.add(e.parent)})}K(n,n=>{dr(e,e.deleteSet,e=>{if(e instanceof Y||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===X?t.add(r):Ba(n,e)});for(let e of t)Va(e)})},Ua=(e,t,r)=>{let i=r,a=n(t.currentAttributes),o=t.right;for(;r>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Ao:case fo:case bo:r<t.right.length&&G(e,U(t.right.id.client,t.right.id.clock+r)),r-=t.right.length,t.right.delete(e)}t.forward()}o&&za(e,o,t.right,a,t.currentAttributes);let s=(t.left||t.right).parent;return s._searchMarker&&ra(s._searchMarker,t.index,-i+r),t};var Wa=class extends Yi{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];K(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},at(o)||(e.attributes=tt({},o))),c=0}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case Ao:case fo:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case bo:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case X:{let{key:t,value:s}=i.content;if(this.adds(i)){if(!this.deletes(i)){let c=n.get(t)??null;ka(c,s)?s!==null&&i.delete(e):(a===`retain`&&u(),ka(s,r.get(t)??null)?delete o[t]:o[t]=s)}}else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;ka(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(ka(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),Pa(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},Ga=class e extends J{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??q(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new Wa(this,e,t);ia(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??q();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===bo&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):K(this.doc,n=>{let r=new Aa(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`\n`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&La(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&Ua(n,r,a.delete):Ra(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??q();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(fi(s,e)||t!==void 0&&fi(s,t))switch(s.content.constructor){case bo:{let r=i.get(`ychange`);e!==void 0&&!fi(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!fi(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case Ao:case fo:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case X:fi(s,e)&&(c(),Pa(i,s.content))}s=s.right}c()};return e||t?K(a,n=>{e&&pi(n,e),t&&pi(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):K(r,r=>{let i=Ma(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),La(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):K(r,r=>{let i=Ma(r,this,e,!n);La(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):K(n,n=>{Ua(n,Ma(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):K(r,r=>{let i=Ma(r,this,e,!1);i.right!==null&&Ra(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):K(this.doc,t=>{ga(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):K(this.doc,n=>{_a(n,this,e,t)})}getAttribute(e){return va(this,e)}getAttributes(){return ya(this)}_write(e){e.writeTypeRef(To)}};let Ka=e=>new Ga;var qa=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??q()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===Xa||t.constructor===Ja)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},Ja=class e extends J{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}get length(){return this.doc??q(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new qa(this,e)}querySelector(e){e=e.toUpperCase();let t=new qa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),l(new qa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){ia(this,e,new Qa(this,t,e))}toString(){return ca(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),sa(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):K(this.doc,n=>{pa(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)K(this.doc,n=>{let r=e&&e instanceof J?e._item:e;da(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw we(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):K(this.doc,n=>{ha(n,this,e,t)})}toArray(){return oa(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return ua(this,e)}slice(e=0,t=this.length){return aa(this,e,t)}forEach(e){sa(this,e)}_write(e){e.writeTypeRef(Do)}};let Ya=e=>new Ja;var Xa=class e extends Ja{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),n=this.getAttributes();return rt(n,(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`=\"`+e[r]+`\"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):K(this.doc,t=>{ga(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):K(this.doc,n=>{_a(n,this,e,t)})}getAttribute(e){return va(this,e)}hasAttribute(e){return ba(this,e)}getAttributes(e){return e?xa(this,e):ya(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return sa(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Eo),e.writeKey(this.nodeName)}};let Za=e=>new Xa(e.readKey());var Qa=class extends Yi{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},$a=class e extends Da{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(Oo),e.writeKey(this.hookName)}};let eo=e=>new $a(e.readKey());var to=class e extends Ga{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}=\"${t.value}\"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ko)}};let no=e=>new to;var ro=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Te()}mergeWith(e){return!1}write(e,t,n){throw Te()}integrate(e,t){throw Te()}},Y=class extends ro{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),gi(e.doc.store,this)}write(e,t){e.writeInfo(0),e.writeLen(this.length-t)}getMissing(e,t){return null}},io=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw Te()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}};let ao=e=>new io(e.readBuf());var oo=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){gr(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}};let so=e=>new oo(e.readLen()),co=(e,t)=>new Cr({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});var lo=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(co(this.doc.guid,this.opts))}splice(e){throw Te()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}};let uo=e=>new lo(co(e.readString(),e.readAny()));var fo=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw Te()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}};let po=e=>new fo(e.readJSON());var X=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw Te()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}};let mo=e=>new X(e.readKey(),e.readJSON());var ho=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}};let go=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new ho(n)},_o=bt(`node_env`)===`development`;var vo=class e{constructor(e){this.arr=e,_o&&ut(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}};let yo=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new vo(n)};var bo=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}};let xo=e=>new bo(e.readString()),So=[Ta,Oa,Ka,Za,Ya,eo,no],Co=0,wo=1,To=2,Eo=3,Do=4,Oo=5,ko=6;var Ao=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw Te()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}};let jo=e=>new Ao(So[e.readTypeRef()](e)),Mo=(e,t)=>{let n=t,r=0,i;do r>0&&(n=U(n.client,n.clock+r)),i=vi(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Z);return{item:i,diff:r}},No=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},Po=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new Z(U(r,i+n),t,U(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=U(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},Fo=(e,t)=>d(e,e=>pr(e.deletions,t)),Io=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return G(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||Io(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=G(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:G(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:G(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||pr(r,d.right.id)||Fo(a.undoStack,d.right.id)||Fo(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=G(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=p._map.get(t.parentSub)||null)}let m=W(s,c),h=U(c,m),g=new Z(h,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=h,No(g,!0),g.integrate(e,0),g};var Z=class e extends ro{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=W(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=W(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ei&&this.id.client!==this.parent.client&&this.parent.clock>=W(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=bi(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=G(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===Y||this.right&&this.right.constructor===Y)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ei){let e=vi(n,this.parent);this.parent=e.constructor===Y?null:e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=bi(e,e.doc.store,U(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),ti(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(ti(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(vi(e.doc.store,n.origin)))r.has(vi(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),gi(e.doc.store,this),this.content.integrate(e,this),Ti(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Y(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:U(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ti(e.origin,this.lastId)&&this.right===e&&ti(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),gr(e.deleteSet,this.id.client,this.id.clock,this.length),Ti(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw L();this.content.gc(e),t?xi(e,this,new Y(this.id,this.length)):this.content=new oo(this.length)}write(e,t){let n=t>0?U(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=ni(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===ei?(e.writeParentInfo(!1),e.writeLeftID(t)):L();i!==null&&e.writeString(i)}this.content.write(e,t)}};let Lo=(e,t)=>Ro[t&31](e),Ro=[()=>{L()},so,go,ao,xo,po,mo,jo,yo,uo,()=>{L()}];var zo=class extends ro{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){L()}write(e,t){e.writeInfo(10),F(e.restEncoder,this.length-t)}getMissing(e,t){return null}};let Bo=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},Vo=`__ $YJS$ __`;Bo[Vo]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),Bo[Vo]=!0;let Q=Object.freeze({stateBytes:262144,updateBytes:32768,textLength:32768,clients:128,structs:16384,historyUnits:1048576,undoEntries:100,undoUnits:32768}),Ho=new TextEncoder,Uo=(e,t)=>{throw Object.assign(Error(t),{code:e})},$=(e,t,n)=>{e||Uo(t,n)},Wo=e=>Number.isSafeInteger(e)&&e>=0,Go=e=>{$(typeof e==`string`,`SHARED_TEXT_INPUT`,`Shared text must be a string`),$(e.length<=Q.textLength,`SHARED_TEXT_LIMIT`,`Shared text exceeds its character limit`);for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(++t);$(n>=56320&&n<=57343,`SHARED_TEXT_INPUT`,`Shared text contains an incomplete Unicode character`)}else $(n<56320||n>57343,`SHARED_TEXT_INPUT`,`Shared text contains an incomplete Unicode character`)}return e};function Ko(e){$(e instanceof Uint8Array,`SHARED_TEXT_INPUT`,`Expected shared text bytes`);let t=``;for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}function qo(e,t=Q.updateBytes){$(typeof e==`string`&&e.length>0&&e.length<=4*Math.ceil(t/3),`SHARED_TEXT_LIMIT`,`Shared text data exceeds its byte limit`),$(e.length%4==0&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e),`SHARED_TEXT_INPUT`,`Expected canonical base64 shared text data`);let n=atob(e);$(n.length<=t,`SHARED_TEXT_LIMIT`,`Shared text data exceeds its byte limit`);let r=Uint8Array.from(n,e=>e.charCodeAt(0));return $(Ko(r)===e,`SHARED_TEXT_INPUT`,`Expected canonical base64 shared text data`),r}function Jo(e){let t;class n extends Tr{constructor(e){super(e),t=e}}let r=Li(e,n);$(t.pos===e.length,`SHARED_TEXT_STATE`,`Shared text data contains trailing bytes`),$(r.structs.length<=Q.structs&&r.ds.clients.size<=Q.clients,`SHARED_TEXT_LIMIT`,`Shared text history exceeds its limit`);let i=0,a=0,o=new Map;for(let e of r.structs)$(Wo(e.id.client)&&Wo(e.id.clock)&&Wo(e.length)&&e.length>0,`SHARED_TEXT_STATE`,`Invalid shared text history`),$(!o.has(e.id.client)||e.id.clock>=o.get(e.id.client),`SHARED_TEXT_STATE`,`Shared text history overlaps itself`),o.set(e.id.client,e.id.clock+e.length),i+=e.length,$(e.id.clock+e.length<=Q.historyUnits&&i<=Q.historyUnits,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),e instanceof Z?($(e.parentSub===null&&(e.parent===null||typeof e.parent!=`string`||e.parent===`text`),`SHARED_TEXT_STATE`,`Shared text accepts only its plaintext field`),$(e.content instanceof bo||e.content instanceof oo,`SHARED_TEXT_STATE`,`Shared text cannot contain formatting, embedded values or other shared types`),e.content instanceof bo&&Go(e.content.str)):$(e instanceof Y,`SHARED_TEXT_STATE`,`Unsupported shared text history`);for(let[e,t]of r.ds.clients){$(Wo(e),`SHARED_TEXT_STATE`,`Invalid shared text deletion`),a+=t.length,$(a<=Q.structs,`SHARED_TEXT_LIMIT`,`Shared text deletion history exceeds its limit`);for(let e of t)$(Wo(e.clock)&&Wo(e.len)&&e.len>0&&e.clock+e.len<=Q.historyUnits,`SHARED_TEXT_STATE`,`Invalid shared text deletion`)}return r}function Yo(e,t){let n=new Map;for(let e of t.structs){let t=n.get(e.id.client)||[];t.push(e),n.set(e.id.client,t)}let r=(t,r)=>{let i=e=>{if(!e)return;let t=0,n=e.length;for(;t<n;){let i=t+n>>>1;e[i].id.clock<=r?t=i+1:n=i}let i=e[t-1];return i&&r<i.id.clock+i.length?i:void 0};return i(e.store.clients.get(t))||i(n.get(t))},i=(e,t)=>{let n=r(e,t);if(n instanceof Z&&n.content instanceof bo){let e=t-n.id.clock,r=n.content.str;$(ts(r,e),`SHARED_TEXT_STATE`,`Shared text update splits a Unicode character`)}};for(let e of t.structs)e instanceof Z&&(e.origin&&i(e.origin.client,e.origin.clock+1),e.rightOrigin&&i(e.rightOrigin.client,e.rightOrigin.clock));for(let[e,n]of t.ds.clients)for(let t of n)i(e,t.clock),i(e,t.clock+t.len)}function Xo(e){let t=e.getText(`text`);$(e.share.size===1&&e.share.get(`text`)===t&&t._map.size===0&&e.getSubdocs().size===0,`SHARED_TEXT_STATE`,`Shared text accepts only its plaintext field`),$(e.store.pendingStructs===null&&e.store.pendingDs===null,`SHARED_TEXT_STATE`,`Shared text update is missing earlier history`),$(e.store.clients.size<=Q.clients,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`);let n=0,r=0;for(let i of e.store.clients.values())for(let e of i)n++,r+=e.length,$(n<=Q.structs&&r<=Q.historyUnits,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),e instanceof Z?$(e.parent===t&&e.parentSub===null&&(e.content instanceof bo||e.content instanceof oo),`SHARED_TEXT_STATE`,`Shared text contains unsupported history`):$(e instanceof Y,`SHARED_TEXT_STATE`,`Unsupported shared text history`);for(let e of t.toDelta())$(typeof e.insert==`string`&&e.attributes===void 0,`SHARED_TEXT_STATE`,`Shared text cannot contain formatting or embedded values`);return Go(t.toString())}function Zo(e,t,n){let r=qo(t,n);Yo(e,Jo(r)),zr(e,r),Xo(e)}function Qo(e){let t=new Cr;t.getText(`text`);try{return Zo(t,e,Q.stateBytes),t}catch(e){throw t.destroy(),e}}function $o(e){let t=Xo(e),n=Hr(e);return $(n.length<=Q.stateBytes,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),{state:Ko(n),value:t}}function es(e){try{return e()}catch(e){if(typeof e?.code==`string`&&e.code.startsWith(`SHARED_TEXT_`))throw e;Uo(`SHARED_TEXT_STATE`,`Invalid shared text data`)}}let ts=(e,t)=>Wo(t)&&t<=e.length&&!(t>0&&t<e.length&&e.charCodeAt(t-1)>=55296&&e.charCodeAt(t-1)<=56319&&e.charCodeAt(t)>=56320&&e.charCodeAt(t)<=57343),ns=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function rs({protocol:e,epoch:t,state:n}){$(e===1&&typeof t==`string`&&ns.test(t),`SHARED_TEXT_INPUT`,`Expected a versioned shared text epoch`);let r=es(()=>Qo(n)),i=r.getText(`text`),a={},o={},s=new WeakMap,c=new Pi(i,{trackedOrigins:new Set([a]),captureTimeout:0}),l=!1,u=null,d=()=>{if($(!l,`SHARED_TEXT_CLOSED`,`Shared text session is closed`),u)throw u},f=e=>{throw u=e,e},p=(e=[])=>{let t=e=>[...e.deletions.clients.values()].reduce((e,t)=>e+t.reduce((e,t)=>e+t.len,0),0),n=[...c.undoStack,...c.redoStack].reduce((e,n)=>e+t(n),0);for(;c.undoStack.length+c.redoStack.length>Q.undoEntries||n>Q.undoUnits;){let r=(c.undoStack.length?c.undoStack:c.redoStack).shift();n-=t(r),e.push(r.deletions)}if(!e.length)return;let i=hr(e);r.transact(e=>{dr(e,i,e=>{e instanceof Z&&(e.keep=!1)});for(let t of[...c.undoStack,...c.redoStack])dr(e,t.deletions,e=>{e instanceof Z&&(e.keep=!0)});ki(i,r.store,()=>!0)},o)},m=e=>{d();let t=c.redoStack.map(e=>e.deletions);try{return r.transact(e,a),p(t),i.toString()}catch(e){return f(e)}},h=e=>{d();let t=c[e](),n;try{n=Go(i.toString())}catch(n){throw t&&c[e===`undo`?`redo`:`undo`](),n}try{return p(),n}catch(e){return f(e)}};return Object.freeze({getValue(){return $(!l,`SHARED_TEXT_CLOSED`,`Shared text session is closed`),i.toString()},splice(e,t,n=``){d();let r=i.toString();return Go(n),$(Wo(t)&&ts(r,e)&&ts(r,e+t),`SHARED_TEXT_INPUT`,`Choose complete characters within the shared text`),$(r.length-t+n.length<=Q.textLength&&Ho.encode(n).length+1024<=Q.updateBytes,`SHARED_TEXT_LIMIT`,`Shared text edit exceeds its limit`),!t&&!n?r:m(()=>{t&&i.delete(e,t),n&&i.insert(e,n)})},captureSelection(e,t=e,n=`none`){d();let r=i.toString();$(ts(r,e)&&ts(r,t)&&e<=t&&[`none`,`forward`,`backward`].includes(n),`SHARED_TEXT_INPUT`,`Invalid shared text selection`);let a=Object.freeze({});return s.set(a,{start:ci(i,e),end:ci(i,t),direction:n}),a},resolveSelection(e){d(),$(e&&s.has(e),`SHARED_TEXT_INPUT`,`Selection belongs to another shared text session`);let t=s.get(e),n=ui(t.start,r),a=ui(t.end,r);return $(n?.type===i&&a?.type===i,`SHARED_TEXT_STATE`,`Shared text selection is unavailable`),{start:Math.min(n.index,a.index),end:Math.max(n.index,a.index),direction:t.direction}},receive(n){return d(),$(n?.protocol===e&&n.epoch===t,`SHARED_TEXT_STATE`,`Shared text epoch changed; retain the local draft and reopen explicitly`),es(()=>{let e=Qo(Ko(Hr(r)));try{Zo(e,n.state,Q.stateBytes),$o(e)}finally{e.destroy()}return zr(r,qo(n.state,Q.stateBytes),o),i.toString()})},getUpdateSince(n){return d(),$(n?.protocol===e&&n.epoch===t,`SHARED_TEXT_STATE`,`Shared text epoch changed; retain the local draft and reopen explicitly`),es(()=>{let i=Qo(n.state);try{$o(r);let n=Hr(r,Jr(i));return $(n.length<=Q.updateBytes,`SHARED_TEXT_LIMIT`,`Shared text batch exceeds its limit`),{protocol:e,epoch:t,update:Ko(n)}}finally{i.destroy()}})},undo(){return h(`undo`)},redo(){return h(`redo`)},canUndo(){return!l&&c.undoStack.length>0},canRedo(){return!l&&c.redoStack.length>0},checkpoint(){return d(),es(()=>({protocol:e,epoch:t,...$o(r)}))},dispose(){l||(l=!0,c.destroy(),r.destroy())}})}function is(e,t,n,r=null,i=[]){let a=new Map,o=new Set(i),s=new Map,c=new Set,l=new Map,u=!1,d=(e,t)=>{if(clearTimeout(t.timer),s.delete(e),u)return;let r;return r=Promise.resolve().then(()=>{if(!u)return t.callback()}).catch(t=>{l.set(e,t),n(t.message)}).finally(()=>c.delete(r)),c.add(r),r},f=(e,t)=>{if(u||typeof e!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)||typeof t!=`function`)throw Error(`Use a named shared edit callback`);if(!s.has(e)&&s.size+c.size>=32||!l.has(e)&&l.size>=32)throw Error(`Too many scheduled shared edits`);l.delete(e);let n=s.get(e),r={callback:t,started:n?.started??Date.now(),timer:null};n&&clearTimeout(n.timer),r.timer=setTimeout(()=>d(e,r),Math.max(0,Math.min(150,500-(Date.now()-r.started)))),s.set(e,r)},p=(i,s)=>{if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(i)||a.has(i))throw Error(`Use one control per named shared field`);let c=e.getElementById(s);if(!c||![`INPUT`,`TEXTAREA`,`SELECT`].includes(c.tagName)||c.tagName===`INPUT`&&![`text`,`number`,`range`,`checkbox`,`color`].includes(c.type))throw Error(`Bind an existing text, number, checkbox or select control`);if(o.has(i)){let e=c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`,t=c.disabled,n=c.readOnly,r=c.getAttribute(`title`),o=c.getAttribute(`aria-readonly`),s=c.getAttribute(`aria-disabled`);e?(c.readOnly=!0,c.setAttribute(`aria-readonly`,`true`)):(c.disabled=!0,c.setAttribute(`aria-disabled`,`true`)),c.setAttribute(`title`,`Connected input. Change its source in Flow.`);let l={flush:async()=>{},status:()=>({dirty:!1,saving:!1,problem:null,canEdit:!1,composing:!1,interrupted:!1}),setDefault(){},dispose(){c.disabled=t,c.readOnly=n,r===null?c.removeAttribute(`title`):c.setAttribute(`title`,r),o===null?c.removeAttribute(`aria-readonly`):c.setAttribute(`aria-readonly`,o),s===null?c.removeAttribute(`aria-disabled`):c.setAttribute(`aria-disabled`,s),a.delete(i)}};return a.set(i,l),l.dispose}if(r&&(c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`)){let e=r.bind(i,c),t=e.dispose;return e.dispose=()=>{t(),a.delete(i)},a.set(i,e),e.dispose}let l=c.disabled,u={exists:!1},d,f=!1,p=!1,m=null,h=!1,g=!1,_=null,v=null,y=null,b=!1,x=!1,S,C=c.tagName===`TEXTAREA`||c.tagName===`INPUT`&&c.type===`text`,w=e=>{v=e,c.setCustomValidity(e.message),n(e.message)},ee=e=>{c.type===`checkbox`?c.checked=!!e:c.value!==String(e??``)&&(c.value=String(e??``))},T=()=>c.type===`checkbox`?c.checked:[`number`,`range`].includes(c.type)?c.valueAsNumber:c.value,E=T(),te=()=>{if(clearTimeout(m),m=null,p)return _;if(h||b||!f||!g||v)return;let e=d;f=!1,y=null,p=!0;let n=!1;return _=Promise.resolve().then(()=>t.updateShared({[i]:e},{[i]:u})).then(()=>{u={exists:!0,value:e},c.setCustomValidity(``),!v&&f&&Object.is(d,e)&&(f=!1,y=null)},e=>{n=!0,f=!0,w(e)}).finally(()=>{p=!1,_=null,!h&&!n&&f&&d!==e&&D(),!h&&!f&&A(t.getShared())}),_},D=()=>{clearTimeout(m),m=setTimeout(te,Math.max(0,Math.min(150,500-(Date.now()-(y??Date.now())))))},O=()=>{!h&&C&&g&&!l&&(b=!0,clearTimeout(m),m=null)},k=e=>{if(h||!g||l)return;if(C&&e?.isComposing){O();return}if(b)return;let t=T();if(typeof t==`number`&&!Number.isFinite(t)){w(Error(`Enter a finite number`));return}S!==void 0&&Object.is(t,S)||(S=void 0,(v||!Object.is(t,f||p?d:u.exists?u.value:E))&&((v||y===null)&&(y=Date.now()),d=t,v=null,f=!0,D()))},A=e=>{h||(g=e.canEdit,c.disabled=l||!g,!g&&b&&(x=!0),!g&&(f||b)&&w(Error(`Editing access changed. Your unsaved draft has been preserved.`)),!(b||f||p||v)&&(u=Object.hasOwn(e.state,i)?{exists:!0,value:e.state[i]}:{exists:!1},ee(u.exists?u.value:E)))},j=t.onShared(A),M=()=>{if(!h&&b){if(b=!1,!g||x){x=!1,d=T(),S=d,f=!0,w(Error(`Editing access changed. Your unsaved draft has been preserved.`));return}k(),f&&!p&&!v?(y=Date.now(),D()):!f&&!p&&!v&&A(t.getShared())}};c.disabled=l||!t.getShared().canEdit,c.addEventListener(`input`,k),c.addEventListener(`change`,k),c.addEventListener(`blur`,te),c.addEventListener(`compositionstart`,O),c.addEventListener(`compositionend`,M);let ne=()=>{h=!0,b=!1,clearTimeout(m),j(),c.removeEventListener(`input`,k),c.removeEventListener(`change`,k),c.removeEventListener(`blur`,te),c.removeEventListener(`compositionstart`,O),c.removeEventListener(`compositionend`,M),c.disabled=l,a.delete(i)};return a.set(i,{dispose:ne,flush:te,status(){return{dirty:f,saving:p,problem:v,canEdit:g,composing:b,interrupted:S!==void 0}},setDefault(e){E=e,A(t.getShared())}}),ne},m=()=>{let t=[...e.querySelectorAll(`[data-stillmade-share]`)];if(t.length>100)throw Error(`Use at most 100 shared controls`);for(let n of t){let t=n.getAttribute(`data-stillmade-share`),r=n.id;if(typeof t!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(t)||typeof r!=`string`||!r||r.length>200||e.getElementById(r)!==n)throw Error(`Each data-stillmade-share control needs a unique ID and valid shared field name`);p(t,r)}return t.length},h=()=>{if(u)throw Error(`Block closed before edits could be flushed`);if([...a.values()].some(e=>e.status().composing))throw Error(`Finish composing text before leaving this Block or running an action.`);let e=[...a.values()].find(e=>e.status().interrupted);if(e)throw e.status().problem};return{bindShared:p,bindAnnotated:m,scheduleSharedEdit:f,flushAll:async()=>{if(u)throw Error(`Block closed before edits could be flushed`);for(let e=0;e<32;e++){if(u)throw Error(`Block closed before edits could be flushed`);h();let e=[...c];for(let[t,n]of[...s])e.push(d(t,n));for(let t of a.values())e.push(t.flush());if(await Promise.all(e),u)throw Error(`Block closed before edits could be flushed`);if(l.size)throw l.values().next().value;let t=!1;for(let e of a.values()){let n=e.status();if(n.problem)throw n.problem;if(n.composing)throw Error(`Finish composing text before leaving this Block or running an action.`);if(n.dirty&&!n.canEdit)throw Error(`Editing access changed. Your draft is not saved.`);t||=n.dirty||n.saving}if(!t&&!s.size&&!c.size)return{queued:!0}}throw Error(`Edits are still arriving. Finish editing before leaving this Block.`)},assertNoComposition:h,getBindingStatus:e=>a.get(e)?.status(),setSharedDefaults(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length>100||JSON.stringify(e).length>65536)throw Error(`Use bounded shared control defaults`);for(let[t,n]of Object.entries(e))a.get(t)?.setDefault(n)},dispose(){u=!0;for(let e of s.values())clearTimeout(e.timer);s.clear();for(let e of[...a.values()])e.dispose()}}}function as(e,t,n,r,i,a=null){let o=new Map,s=new Map,c=[],l=0,u=!1,d=``,f=()=>{if(u)return;let e=[...o.values()].map(e=>e.status()),t={count:e.length,dirty:e.filter(e=>e.dirty||e.composing||e.interrupted).length,pending:e.filter(e=>e.saving).length,readonly:e.filter(e=>!e.canEdit).length,error:e.find(e=>e.problem)?.problem.message?.slice(0,1e3)||null,retryable:e.some(e=>e.retryable)},n=JSON.stringify(t);n!==d&&(d=n,parent.postMessage({channel:r,session:i,op:`text-recovery-status`,status:t},`*`),a&&a.send({channel:r,session:i,op:`named-text-controls`,token:a.token,snapshot:[...o.values()].map(e=>e.nativeState?.()).filter(Boolean).slice(0,50)},`*`))},p=e=>Object.assign(Error(e?.message||String(e)),e?.code?{code:e.code}:{}),m=()=>{for(;!u&&s.size<4&&c.length;){let e=c.findIndex(e=>e.action!==`read`),t=c.splice(e<0?0:e,1)[0],n=String(++l);t.id=n,s.set(n,t),(a?.send||parent.postMessage.bind(parent))({channel:r,session:i,op:`text-request`,id:n,action:t.action,key:t.key,body:t.body,...t.nativeProof&&a?{nativeText:{token:a.token,callId:t.nativeProof.callId}}:{}},`*`)}},h=(e,t,n={},r=null)=>new Promise((i,a)=>{if(u||s.size+c.length>=128){a(Error(`Shared text is unavailable or busy. Your draft is retained.`));return}let o={action:e,key:t,body:n,nativeProof:r,resolve:i,reject:a,timer:null,id:null};o.timer=setTimeout(()=>{if(o.id)s.delete(o.id);else{let e=c.indexOf(o);e>=0&&c.splice(e,1)}a(Error(`Shared text acknowledgement timed out. Your draft is retained.`)),m()},3e4),c.push(o),m()}),g=e=>{let t=e.data;if(!(e.source!==parent||t?.channel!==r||t.session!==i||u)){if(t.op===`text-result`){let e=s.get(t.id);if(!e)return;s.delete(t.id),clearTimeout(e.timer),t.error?e.reject(p(t.error)):e.resolve(t.result),m()}else if(t.op===`text-refresh`)for(let e of o.values())e.refresh();else if(t.op===`text-retry`)for(let e of o.values())e.retry().catch(()=>{})}};addEventListener(`message`,g);let _=(r,i)=>{if(o.has(r)||o.size>=100)throw Error(`Use at most 100 distinct shared text controls.`);let s=new WeakMap,c=null,l=i.disabled,u=i.readOnly,d=i.value,m=`loading`,g=!1,_=null,v=null,y=null,b=null,x=!1,S=0,C=null,w=null,ee=null,T=!1,E=!1,te=!1,D=!1,O=null,k=null,A=null,j=t.getShared().canEdit===!0,M=i.value,ne=()=>!!b&&!D&&!E&&j&&!/^(READ_ONLY|SHARED_TEXT_(SOURCE|EPOCH|CONFLICT|INPUT|LIMIT|STATE|UPDATE|PROTOCOL))$/.test(b.code||``),N=e=>{T||(b=p(e),E&&(D=!0),i.readOnly=!0,(x||D)&&(i.disabled=l),i.setCustomValidity(b.message),n(b.message),f())},re=()=>({start:i.selectionStart??0,end:i.selectionEnd??0,direction:i.selectionDirection||`none`}),ie=t=>{if(M=v.getValue(),i.value!==M&&(i.value=M),t&&e.activeElement===i){let e=v.resolveSelection(t);i.setSelectionRange(e.start,e.end,e.direction)}},P=()=>{let e=re();return v.captureSelection(e.start,e.end,e.direction)},ae=e=>{if(!T&&e){if(b||D){(!k||e.textRevision>=k.textRevision)&&(k=e);return}if(E){(!k||e.textRevision>=k.textRevision)&&(k=e);return}if(v&&i.value!==M)throw D=!0,x=!0,Error(`This control has an uncommitted draft. Copy it before reopening the Block.`);if(y&&e.epoch!==y.epoch)throw Object.assign(Error(`This shared text was reset. Copy your draft before reloading the Block.`),{code:`SHARED_TEXT_EPOCH`});if(!(y&&e.textRevision<y.textRevision)){if(y&&e.protocol===y.protocol&&e.sourceIdentity===y.sourceIdentity&&e.textRevision===y.textRevision&&e.state===y.state&&e.value===y.value){y=e;return}if(!v)v=rs(e),y=e,ie();else{let t=P();v.receive(e),y=e,ie(t)}m=`text`,i.disabled=l||!j,i.readOnly=u,i.setCustomValidity(``),f()}}},F=()=>{m=`legacy`,i.disabled=l,i.readOnly=u,i.value=d,_=is(e,t,n),_.bindShared(r,i.id),_.setSharedDefaults({[r]:d})},oe=async(e=!1)=>T||!g||m===`legacy`||O||b?O:(O=(async()=>{let t=await h(`read`,r);if(T)return;if(t.unsupported){if(e)F();else throw Error(`Shared text is no longer available. Your draft is retained.`);return}if(t.enabled){ae(t.snapshot);return}if(!j){m=`waiting`,M=t.value,i.value=t.value,i.disabled=!0;return}A={action:`initialize`,body:{protocol:1,requestId:crypto.randomUUID(),sourceIdentity:t.sourceIdentity}};let n=await h(A.action,r,A.body);A=null,T||ae(n.snapshot)})().catch(N).finally(()=>{O=null,f()}),f(),O),se=()=>{T||b||E||(ee===null&&(ee=Date.now()),clearTimeout(w),w=setTimeout(()=>{w=null,ce().catch(()=>{})},Math.max(0,Math.min(200,600-(Date.now()-ee)))))},ce=async()=>{if(clearTimeout(w),w=null,_)return _.flushAll();if(O&&await O,b)throw b;if(T)throw Error(`Block closed before text was saved.`);if(!g||m===`loading`)throw Error(`Shared text is still loading. Wait before leaving this Block or running an action.`);if(E)throw Error(`Finish composing text before leaving this Block or running an action.`);if(v&&i.value!==M)throw D=!0,x=!0,N(Error(`This control has an uncommitted draft. Copy it before reopening the Block.`)),b;if(C){await C;return}if(!x)return;if(!j)throw Error(`Editing access changed. Your draft is retained.`);try{A={action:`update`,version:S,nativeProof:c?.version===S?{callId:c.callId}:null,body:{...v.getUpdateSince(y),requestId:crypto.randomUUID()}}}catch(e){throw N(e),e}x=!1,ee=null;let e=A;C=h(e.action,r,e.body,e.nativeProof).then(t=>{T||(ae(t.snapshot),!b&&!D&&(x=S!==e.version)),A=null}).catch(e=>{throw x=!0,N(e),e}).finally(()=>{C=null,x&&!b&&se(),f()}),f(),await C},le=e=>{if(m!==`text`||T||l||u||!j||D)return;if(e?.isComposing){ue();return}if(E)return;if(b){i.value!==M&&(D=!0,x=!0,f());return}let t=i.value;if(t!==M)try{let n=0,r=M.length,i=t.length;for(;n<r&&n<i&&M[n]===t[n];)n++;for(n>0&&n<r&&/[\\uDC00-\\uDFFF]/.test(M[n])&&n--;r>n&&i>n&&M[r-1]===t[i-1];)r--,i--;r<M.length&&/[\\uDC00-\\uDFFF]/.test(M[r])&&(r++,i++),v.splice(n,r-n,t.slice(n,i)),M=v.getValue(),S++,c=s.has(e)?{version:S,callId:s.get(e)}:null,x=!0,se(),f()}catch(e){D=!0,x=!0,N(e)}},ue=()=>{m!==`text`||T||!j||l||u||b||(E=!0,clearTimeout(w),w=null,f())},I=()=>{if(E){if(E=!1,b||!j||te){D=!0,x=!0,b||N(Error(`Editing access changed. Your composed draft is retained.`));return}if(le(),k){let e=k;k=null;try{ae(e)}catch(e){N(e)}}x&&se(),f()}},de=e=>{if(!(m!==`text`||E||b||!j||l||u||!(e.metaKey||e.ctrlKey)||e.altKey||![`z`,`y`].includes(e.key.toLowerCase()))){e.preventDefault();try{e.key.toLowerCase()===`y`||e.shiftKey?v.redo():v.undo(),ie(),S++,x=!0,se(),f()}catch(e){N(e)}}},fe=()=>{m===`text`&&ce().catch(()=>{})},pe=t.onShared(e=>{g=!0,j=e.canEdit===!0,m!==`legacy`&&(i.disabled=l||m!==`text`||!j,!j&&(x||E)&&(te||=E,D=!0,N(Error(`Editing access changed. Your unsaved draft is retained.`))),o.has(r)&&m===`loading`&&oe(!0),f())});i.disabled=!0,i.addEventListener(`input`,le),i.addEventListener(`change`,le),i.addEventListener(`blur`,fe),i.addEventListener(`keydown`,de),i.addEventListener(`compositionstart`,ue),i.addEventListener(`compositionend`,I);let me=()=>{let e=String(i.value),t=i.hidden||i.closest(`[hidden]`)!==null;return{field:r,nodeId:i.id,type:i.tagName.toLowerCase()===`textarea`?`textarea`:i.type,value:e.slice(0,1e4),partial:e.length>1e4,disabled:i.disabled||l||u||t,ready:m===`text`&&!T&&!b&&!D&&!E&&!C&&!O&&!x&&!A&&j,identity:JSON.stringify([r,i.id,i.type,y?.protocol??null,y?.epoch??null,y?.sourceIdentity??null,y?.textRevision??null])}},he={nativeState:me,async nativeEdit(e,t){let n=me();if(!a||typeof t!=`string`||!/^\\d{1,9}$/.test(t)||!e||Object.keys(e).sort().join(`,`)!==`field,identity,previous,value`||e.field!==r||e.identity!==n.identity||n.partial||!n.ready||n.disabled||typeof e.previous!=`string`||e.previous!==n.value||typeof e.value!=`string`||e.value.length>1e4||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(r)||/password|credential|authorization|cookie|secret|token|api.?key/i.test(r)||!i.id||![`text`,`textarea`].includes(n.type))throw Error(`The original named text control changed or is unavailable.`);let o=new Event(`input`,{bubbles:!0});if(s.set(o,t),i.value=e.value,i.dispatchEvent(o),s.delete(o),i.value!==e.value||!x||E||D||b)throw Error(`The original text handler changed or refused this edit.`);let c=S;if(await ce(),S!==c||i.value!==e.value||x||A||C||b)throw Error(`Original text changed while its acknowledgement was pending. Do not repeat the edit.`);return{value:i.value,identity:me().identity}},flush:ce,getValue:()=>i.value,status:()=>_?_.getBindingStatus(r):{dirty:x||!!A,saving:!!C||!!O,problem:b,canEdit:j,composing:E,interrupted:D,retryable:ne()},setDefault(e){d=String(e??``),_&&_.setSharedDefaults({[r]:e})},refresh(){!b&&!T&&oe()},async retry(){if(!(T||C||O||!ne())){if(b=null,i.setCustomValidity(``),A){let e=A;C=h(e.action,r,e.body,e.nativeProof).then(t=>{ae(t.snapshot),e.action===`update`&&!b&&!D&&(x=S!==e.version),A=null}).catch(e=>{throw N(e),e}).finally(()=>{C=null,f()}),f(),await C}else await oe(m===`loading`);if(b)throw b;if(i.readOnly=u,k){let e=k;k=null;try{ae(e)}catch(e){throw N(e),e}}x&&await ce(),f()}},dispose(){T=!0,clearTimeout(w),pe(),_?.dispose(),v?.dispose(),o.delete(r),i.removeEventListener(`input`,le),i.removeEventListener(`change`,le),i.removeEventListener(`blur`,fe),i.removeEventListener(`keydown`,de),i.removeEventListener(`compositionstart`,ue),i.removeEventListener(`compositionend`,I),i.disabled=l,i.readOnly=u,f()}};return o.set(r,he),g&&oe(!0),he},v=setInterval(()=>{for(let e of o.values())e.refresh()},15e3);return{bind:_,inspectNative(){return[...o.values()].map(e=>e.nativeState()).filter(e=>e.nodeId&&[`text`,`textarea`].includes(e.type)&&!/password|credential|authorization|cookie|secret|token|api.?key/i.test(e.field)).slice(0,50)},async dispatchNative(e,t){if(!e||typeof e.field!=`string`||!o.has(e.field))throw Error(`Inspect an existing original named text field.`);return o.get(e.field).nativeEdit(e,t)},getValues:()=>Object.fromEntries([...o].map(([e,t])=>[e,t.getValue()])),dispose(){u=!0,clearInterval(v),removeEventListener(`message`,g);for(let e of[...o.values()])e.dispose();for(let e of[...s.values(),...c])clearTimeout(e.timer),e.reject(Error(`Block closed before text was acknowledged.`));s.clear(),c.length=0}}}return e.installTextFrame=as,e})({});",At=`(sharedAPI,onStatus)=>{const documentTools=(()=>{const BlockError=(class extends Error {
8
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Cs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ws(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ts=typeof WeakMap==`function`?WeakMap:Map;function Es(e,t,n){n=Za(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){nl||(nl=!0,rl=r),ws(e,t)},n}function Ds(e,t,n){n=Za(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ws(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ws(e,t),typeof r!=`function`&&(il===null?il=new Set([this]):il.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Os(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ts;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function ks(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function As(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Za(-1,1),t.tag=2,Qa(n,t,1))),n.lanes|=1),e)}var js=C.ReactCurrentOwner,Ms=!1;function Ns(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function Ps(e,t,n,r,i){n=n.render;var a=t.ref;return Ha(t,i),r=ko(e,t,n,r,a,i),n=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(_a&&n&&pa(t),t.flags|=1,Ns(e,t,r,i),t.child)}function Fs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Is(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return ec(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Is(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref){if(Ms=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ms=!0);else return t.lanes=e.lanes,ec(e,t,i)}}return zs(e,t,n,r,i)}function Ls(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},X(Gc,Wc),Wc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,X(Gc,Wc),Wc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,X(Gc,Wc),Wc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),X(Gc,Wc),Wc|=r;return Ns(e,t,i,n),t.child}function Rs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zs(e,t,n,r,i){var a=Gi(n)?Ui:Vi.current;return a=Wi(t,a),Ha(t,i),n=ko(e,t,n,r,a,i),r=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(_a&&r&&pa(t),t.flags|=1,Ns(e,t,n,i),t.child)}function Bs(e,t,n,r,i){if(Gi(n)){var a=!0;Yi(t)}else a=!1;if(Ha(t,i),t.stateNode===null)$s(e,t),ys(t,n,r),xs(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ua(l):(l=Gi(n)?Ui:Vi.current,l=Wi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&bs(t,o,r,l),Ja=!1;var f=t.memoizedState;o.state=f,to(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Hi.current||Ja?(typeof u==`function`&&(gs(t,n,u,r),c=t.memoizedState),(s=Ja||vs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Xa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:hs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ua(c):(c=Gi(n)?Ui:Vi.current,c=Wi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&bs(t,o,r,c),Ja=!1,f=t.memoizedState,o.state=f,to(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Hi.current||Ja?(typeof p==`function`&&(gs(t,n,p,r),m=t.memoizedState),(l=Ja||vs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Vs(e,t,n,r,a,i)}function Vs(e,t,n,r,i,a){Rs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Xi(t,n,!1),ec(e,t,a);r=t.stateNode,js.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Na(t,e.child,null,a),t.child=Na(t,null,s,a)):Ns(e,t,s,a),t.memoizedState=r.state,i&&Xi(t,n,!0),t.child}function Hs(e){var t=e.stateNode;t.pendingContext?qi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&qi(e,t.context,!1),co(e,t.containerInfo)}function Us(e,t,n,r,i){return Ea(),Da(i),t.flags|=256,Ns(e,t,n,r),t.child}var Ws={dehydrated:null,treeContext:null,retryLane:0};function Gs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ks(e,t,n){var r=t.pendingProps,i=po.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),X(po,i&1),e===null)return Sa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Gs(n),t.memoizedState=Ws,e):qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Ys(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Gs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ws,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function qs(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Js(e,t,n,r){return r!==null&&Da(r),Na(t,e.child,null,n),e=qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ys(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Cs(Error(r(422))),Js(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Na(t,e.child,null,s),t.child.memoizedState=Gs(s),t.memoizedState=Ws,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Js(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Cs(o,i,void 0),Js(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ms||c){if(i=Vc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,qa(e,a),ml(i,e,a,-1))}return Ol(),i=Cs(Error(r(421))),Js(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ga=Ci(a.nextSibling),ha=t,_a=!0,va=null,e!==null&&(sa[ca++]=Z,sa[ca++]=ua,sa[ca++]=la,Z=e.id,ua=e.overflow,la=t),t=qs(t,i.children),t.flags|=4096,t)}function Xs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function Zs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function Qs(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ns(e,t,r.children,n),r=po.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xs(e,n,t);else if(e.tag===19)Xs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(X(po,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Zs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Zs(t,!0,n,null,a);break;case`together`:Zs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $s(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tc(e,t,n){switch(t.tag){case 3:Hs(t),Ea();break;case 5:uo(t);break;case 1:Gi(t.type)&&Yi(t);break;case 4:co(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;X(Fa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(X(po,po.current&1),e=ec(e,t,n),e===null?null:e.sibling):Ks(e,t,n):(X(po,po.current&1),t.flags|=128,null);X(po,po.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Qs(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),X(po,po.current),r)break;return null;case 22:case 23:return t.lanes=0,Ls(e,t,n)}return ec(e,t,n)}var nc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},rc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,so(io.current);var o=null;switch(n){case`input`:i=_e(e,i),r=_e(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=Te(e,i),r=Te(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=pi)}Re(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&J(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ic=function(e,t,n,r){n!==r&&(t.flags|=4)};function ac(e,t){if(!_a)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function sc(e,t,n){var i=t.pendingProps;switch(ma(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oc(t),null;case 1:return Gi(t.type)&&Ki(),oc(t),null;case 3:return i=t.stateNode,lo(),zi(Hi),zi(Vi),go(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,va!==null&&(vl(va),va=null))),oc(t),null;case 5:fo(t);var o=so(oo.current);if(n=t.type,e!==null&&t.stateNode!=null)rc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return oc(t),null}if(e=so(io.current),wa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ei]=t,i[Di]=s,e=!!(t.mode&1),n){case`dialog`:J(`cancel`,i),J(`close`,i);break;case`iframe`:case`object`:case`embed`:J(`load`,i);break;case`video`:case`audio`:for(o=0;o<Zr.length;o++)J(Zr[o],i);break;case`source`:J(`error`,i);break;case`img`:case`image`:case`link`:J(`error`,i),J(`load`,i);break;case`details`:J(`toggle`,i);break;case`input`:ve(i,s),J(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},J(`invalid`,i);break;case`textarea`:Ee(i,s),J(`invalid`,i)}for(var c in Re(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&J(`scroll`,i)}switch(n){case`input`:me(i),xe(i,s,!0);break;case`textarea`:me(i),Oe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=pi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=ke(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ei]=t,e[Di]=i,nc(e,t,!1,!1),t.stateNode=e;a:{switch(c=ze(n,i),n){case`dialog`:J(`cancel`,e),J(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:J(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Zr.length;o++)J(Zr[o],e);o=i;break;case`source`:J(`error`,e),o=i;break;case`img`:case`image`:case`link`:J(`error`,e),J(`load`,e),o=i;break;case`details`:J(`toggle`,e),o=i;break;case`input`:ve(e,i),o=_e(e,i),J(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),J(`invalid`,e);break;case`textarea`:Ee(e,i),o=Te(e,i),J(`invalid`,e);break;default:o=i}for(s in Re(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ie(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Me(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Ne(e,u):typeof u==`number`&&Ne(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&J(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:me(e),xe(e,i,!1);break;case`textarea`:me(e),Oe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+de(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&we(e,!!i.multiple,i.defaultValue,!0):we(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=pi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return oc(t),null;case 6:if(e&&t.stateNode!=null)ic(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=so(oo.current),so(io.current),wa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ei]=t,(s=i.nodeValue!==n)&&(e=ha,e!==null))switch(e.tag){case 3:fi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&fi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ei]=t,t.stateNode=i}return oc(t),null;case 13:if(zi(po),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(_a&&ga!==null&&t.mode&1&&!(t.flags&128))Ta(),Ea(),t.flags|=98560,s=!1;else if(s=wa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ei]=t}else Ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;oc(t),s=!1}else va!==null&&(vl(va),va=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||po.current&1?Kc===0&&(Kc=3):Ol())),t.updateQueue!==null&&(t.flags|=4),oc(t),null);case 4:return lo(),e===null&&ri(t.stateNode.containerInfo),oc(t),null;case 10:return Ba(t.type._context),oc(t),null;case 17:return Gi(t.type)&&Ki(),oc(t),null;case 19:if(zi(po),s=t.memoizedState,s===null)return oc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)ac(s,!1);else{if(Kc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=mo(e),c!==null){for(t.flags|=128,ac(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return X(po,po.current&1|2),t.child}e=e.sibling}s.tail!==null&&ht()>el&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}}else{if(!i){if(e=mo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ac(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!_a)return oc(t),null}else 2*ht()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(oc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ht(),t.sibling=null,n=po.current,X(po,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(oc(t),t.subtreeFlags&6&&(t.flags|=8192)):oc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function cc(e,t){switch(ma(t),t.tag){case 1:return Gi(t.type)&&Ki(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),zi(Hi),zi(Vi),go(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fo(t),null;case 13:if(zi(po),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zi(po),null;case 4:return lo(),null;case 10:return Ba(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var lc=!1,uc=!1,dc=typeof WeakSet==`function`?WeakSet:Set,Q=null;function fc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}}function pc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var mc=!1;function hc(e,t){if(mi=W,e=kr(),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(hi={focusedElem:e,selectionRange:n},W=!1,Q=t;Q!==null;)if(t=Q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:hs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return h=mc,mc=!1,h}function gc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&pc(t,n,a)}i=i.next}while(i!==r)}}function _c(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function yc(e){var t=e.alternate;t!==null&&(e.alternate=null,yc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ei],delete t[Di],delete t[ki],delete t[Ai],delete t[ji])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bc(e){return e.tag===5||e.tag===3||e.tag===4}function xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||bc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Sc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pi));else if(r!==4&&(e=e.child,e!==null))for(Sc(e,t,n),e=e.sibling;e!==null;)Sc(e,t,n),e=e.sibling}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}var wc=null,Tc=!1;function Ec(e,t,n){for(n=n.child;n!==null;)Dc(e,t,n),n=n.sibling}function Dc(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount==`function`)try{Ct.onCommitFiberUnmount(St,n)}catch{}switch(n.tag){case 5:uc||fc(n,t);case 6:var r=wc,i=Tc;wc=null,Ec(e,t,n),wc=r,Tc=i,wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wc.removeChild(n.stateNode));break;case 18:wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?Si(e.parentNode,n):e.nodeType===1&&Si(e,n),un(e)):Si(wc,n.stateNode));break;case 4:r=wc,i=Tc,wc=n.stateNode.containerInfo,Tc=!0,Ec(e,t,n),wc=r,Tc=i;break;case 0:case 11:case 14:case 15:if(!uc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&pc(n,t,o),i=i.next}while(i!==r)}Ec(e,t,n);break;case 1:if(!uc&&(fc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Ec(e,t,n);break;case 21:Ec(e,t,n);break;case 22:n.mode&1?(uc=(r=uc)||n.memoizedState!==null,Ec(e,t,n),uc=r):Ec(e,t,n);break;default:Ec(e,t,n)}}function Oc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function kc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:wc=c.stateNode,Tc=!1;break a;case 3:wc=c.stateNode.containerInfo,Tc=!0;break a;case 4:wc=c.stateNode.containerInfo,Tc=!0;break a}c=c.return}if(wc===null)throw Error(r(160));Dc(o,s,a),wc=null,Tc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Rl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ac(t,e),t=t.sibling}function Ac(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(kc(t,e),jc(e),i&4){try{gc(3,e,e.return),_c(3,e)}catch(t){Rl(e,e.return,t)}try{gc(5,e,e.return)}catch(t){Rl(e,e.return,t)}}break;case 1:kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return);break;case 5:if(kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return),e.flags&32){var a=e.stateNode;try{Ne(a,``)}catch(t){Rl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ye(a,o),ze(c,s);var u=ze(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ie(a,f):d===`dangerouslySetInnerHTML`?Me(a,f):d===`children`?Ne(a,f):S(a,d,f,u)}switch(c){case`input`:be(a,o);break;case`textarea`:De(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?we(a,!!o.multiple,o.multiple?[]:``,!1):we(a,!!o.multiple,o.defaultValue,!0)):we(a,!!o.multiple,m,!1)}a[Di]=o}catch(t){Rl(e,e.return,t)}}break;case 6:if(kc(t,e),jc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Rl(e,e.return,t)}}break;case 3:if(kc(t,e),jc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{un(t.containerInfo)}catch(t){Rl(e,e.return,t)}break;case 4:kc(t,e),jc(e);break;case 13:kc(t,e),jc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||($c=ht())),i&4&&Oc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(uc=(u=uc)||d,kc(t,e),uc=u):kc(t,e),jc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Q=e,d=e.child;d!==null;){for(f=Q=d;Q!==null;){switch(p=Q,m=p.child,p.tag){case 0:case 11:case 14:case 15:gc(4,p,p.return);break;case 1:fc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Rl(i,n,e)}}break;case 5:fc(p,p.return);break;case 22:if(p.memoizedState!==null){Fc(f);continue}}m===null?Fc(f):(m.return=p,Q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Fe(`display`,s))}catch(t){Rl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Rl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:kc(t,e),jc(e),i&4&&Oc(e);break;case 21:break;default:kc(t,e),jc(e)}}function jc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(bc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Ne(a,``),i.flags&=-33),Cc(e,xc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Sc(e,xc(e),o);break;default:throw Error(r(161))}}catch(t){Rl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mc(e,t,n){Q=e,Nc(e,t,n)}function Nc(e,t,n){for(var r=!!(e.mode&1);Q!==null;){var i=Q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||lc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||uc;s=lc;var l=uc;if(lc=o,(uc=c)&&!l)for(Q=i;Q!==null;)o=Q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Ic(i):(c.return=o,Q=c);for(;a!==null;)Q=a,Nc(a,t,n),a=a.sibling;Q=i,lc=s,uc=l}Pc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Q=a):Pc(e,t,n)}}function Pc(e){for(;Q!==null;){var t=Q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:uc||_c(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!uc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:hs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&no(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}no(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&un(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}uc||t.flags&512&&vc(t)}catch(e){Rl(t,t.return,e)}}if(t===e){Q=null;break}if(n=t.sibling,n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Fc(e){for(;Q!==null;){var t=Q;if(t===e){Q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Ic(e){for(;Q!==null;){var t=Q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{_c(4,t)}catch(e){Rl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Rl(t,i,e)}}var a=t.return;try{vc(t)}catch(e){Rl(t,a,e)}break;case 5:var o=t.return;try{vc(t)}catch(e){Rl(t,o,e)}}}catch(e){Rl(t,t.return,e)}if(t===e){Q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Q=s;break}Q=t.return}}var Lc=Math.ceil,Rc=C.ReactCurrentDispatcher,zc=C.ReactCurrentOwner,Bc=C.ReactCurrentBatchConfig,$=0,Vc=null,Hc=null,Uc=0,Wc=0,Gc=Ri(0),Kc=0,qc=null,Jc=0,Yc=0,Xc=0,Zc=null,Qc=null,$c=0,el=1/0,tl=null,nl=!1,rl=null,il=null,al=!1,ol=null,sl=0,cl=0,ll=null,ul=-1,dl=0;function fl(){return $&6?ht():ul===-1?ul=ht():ul}function pl(e){return e.mode&1?$&2&&Uc!==0?Uc&-Uc:Oa.transition===null?(e=V,e===0?(e=window.event,e=e===void 0?16:gn(e.type),e):e):(dl===0&&(dl=It()),dl):1}function ml(e,t,n,i){if(50<cl)throw cl=0,ll=null,Error(r(185));Rt(e,n,i),(!($&2)||e!==Vc)&&(e===Vc&&(!($&2)&&(Yc|=n),Kc===4&&bl(e,Uc)),hl(e,i),n===1&&$===0&&!(t.mode&1)&&(el=ht()+500,Qi&&na()))}function hl(e,t){var n=e.callbackNode;Pt(e,t);var r=Mt(e,e===Vc?Uc:0);if(r===0)n!==null&&ft(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ft(n),t===1)e.tag===0?ta(xl.bind(null,e)):ea(xl.bind(null,e)),bi(function(){!($&6)&&na()}),n=null;else{switch(Vt(r)){case 1:n=_t;break;case 4:n=vt;break;case 16:n=yt;break;case 536870912:n=xt;break;default:n=yt}n=Wl(n,gl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function gl(e,t){if(ul=-1,dl=0,$&6)throw Error(r(327));var n=e.callbackNode;if(Il()&&e.callbackNode!==n)return null;var i=Mt(e,e===Vc?Uc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=kl(e,i);else{t=i;var a=$;$|=2;var o=Dl();(Vc!==e||Uc!==t)&&(tl=null,el=ht()+500,Tl(e,t));do try{jl();break}catch(t){El(e,t)}while(1);za(),Rc.current=o,$=a,Hc===null?(Vc=null,Uc=0,t=Kc):t=0}if(t!==0){if(t===2&&(a=Ft(e),a!==0&&(i=a,t=_l(e,a))),t===1)throw n=qc,Tl(e,0),bl(e,i),hl(e,ht()),n;if(t===6)bl(e,i);else{if(a=e.current.alternate,!(i&30)&&!yl(a)&&(t=kl(e,i),t===2&&(o=Ft(e),o!==0&&(i=o,t=_l(e,o))),t===1))throw n=qc,Tl(e,0),bl(e,i),hl(e,ht()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Pl(e,Qc,tl);break;case 3:if(bl(e,i),(i&130023424)===i&&(t=$c+500-ht(),10<t)){if(Mt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){fl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=_i(Pl.bind(null,e,Qc,tl),t);break}Pl(e,Qc,tl);break;case 4:if(bl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Tt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ht()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Lc(i/1960))-i,10<i){e.timeoutHandle=_i(Pl.bind(null,e,Qc,tl),i);break}Pl(e,Qc,tl);break;case 5:Pl(e,Qc,tl);break;default:throw Error(r(329))}}}return hl(e,ht()),e.callbackNode===n?gl.bind(null,e):null}function _l(e,t){var n=Zc;return e.current.memoizedState.isDehydrated&&(Tl(e,t).flags|=256),e=kl(e,t),e!==2&&(t=Qc,Qc=n,t!==null&&vl(t)),e}function vl(e){Qc===null?Qc=e:Qc.push.apply(Qc,e)}function yl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!wr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bl(e,t){for(t&=~Xc,t&=~Yc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tt(t),r=1<<n;e[n]=-1,t&=~r}}function xl(e){if($&6)throw Error(r(327));Il();var t=Mt(e,0);if(!(t&1))return hl(e,ht()),null;var n=kl(e,t);if(e.tag!==0&&n===2){var i=Ft(e);i!==0&&(t=i,n=_l(e,i))}if(n===1)throw n=qc,Tl(e,0),bl(e,t),hl(e,ht()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Pl(e,Qc,tl),hl(e,ht()),null}function Sl(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(el=ht()+500,Qi&&na())}}function Cl(e){ol!==null&&ol.tag===0&&!($&6)&&Il();var t=$;$|=1;var n=Bc.transition,r=V;try{if(Bc.transition=null,V=1,e)return e()}finally{V=r,Bc.transition=n,$=t,!($&6)&&na()}}function wl(){Wc=Gc.current,zi(Gc)}function Tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,vi(n)),Hc!==null)for(n=Hc.return;n!==null;){var r=n;switch(ma(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ki();break;case 3:lo(),zi(Hi),zi(Vi),go();break;case 5:fo(r);break;case 4:lo();break;case 13:zi(po);break;case 19:zi(po);break;case 10:Ba(r.type._context);break;case 22:case 23:wl()}n=n.return}if(Vc=e,Hc=e=Yl(e.current,null),Uc=Wc=t,Kc=0,qc=null,Xc=Yc=Jc=0,Qc=Zc=null,Wa!==null){for(t=0;t<Wa.length;t++)if(n=Wa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Wa=null}return e}function El(e,t){do{var n=Hc;try{if(za(),_o.current=ds,Co){for(var i=bo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Co=!1}if(yo=0,So=xo=bo=null,wo=!1,To=0,zc.current=null,n===null||n.return===null){Kc=1,qc=t,Hc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Uc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=ks(s);if(m!==null){m.flags&=-257,As(m,s,c,o,t),m.mode&1&&Os(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Os(o,u,t),Ol();break a}l=Error(r(426))}else if(_a&&c.mode&1){var _=ks(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),As(_,s,c,o,t),Da(Ss(l,c));break a}}o=l=Ss(l,c),Kc!==4&&(Kc=2),Zc===null?Zc=[o]:Zc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Es(o,l,t);eo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(il===null||!il.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ds(o,c,t);eo(o,x);break a}}o=o.return}while(o!==null)}Nl(n)}catch(e){t=e,Hc===n&&n!==null&&(Hc=n=n.return);continue}break}while(1)}function Dl(){var e=Rc.current;return Rc.current=ds,e===null?ds:e}function Ol(){(Kc===0||Kc===3||Kc===2)&&(Kc=4),Vc===null||!(Jc&268435455)&&!(Yc&268435455)||bl(Vc,Uc)}function kl(e,t){var n=$;$|=2;var i=Dl();(Vc!==e||Uc!==t)&&(tl=null,Tl(e,t));do try{Al();break}catch(t){El(e,t)}while(1);if(za(),$=n,Rc.current=i,Hc!==null)throw Error(r(261));return Vc=null,Uc=0,Kc}function Al(){for(;Hc!==null;)Ml(Hc)}function jl(){for(;Hc!==null&&!pt();)Ml(Hc)}function Ml(e){var t=Ul(e.alternate,e,Wc);e.memoizedProps=e.pendingProps,t===null?Nl(e):Hc=t,zc.current=null}function Nl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=cc(n,t),n!==null){n.flags&=32767,Hc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Kc=6,Hc=null;return}}else if(n=sc(n,t,Wc),n!==null){Hc=n;return}if(t=t.sibling,t!==null){Hc=t;return}Hc=t=e}while(t!==null);Kc===0&&(Kc=5)}function Pl(e,t,n){var r=V,i=Bc.transition;try{Bc.transition=null,V=1,Fl(e,t,n,r)}finally{Bc.transition=i,V=r}return null}function Fl(e,t,n,i){do Il();while(ol!==null);if($&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(zt(e,o),e===Vc&&(Hc=Vc=null,Uc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||al||(al=!0,Wl(yt,function(){return Il(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Bc.transition,Bc.transition=null;var s=V;V=1;var c=$;$|=4,zc.current=null,hc(e,n),Ac(n,e),jr(hi),W=!!mi,hi=mi=null,e.current=n,Mc(n,e,a),mt(),$=c,V=s,Bc.transition=o}else e.current=n;if(al&&(al=!1,ol=e,sl=a),o=e.pendingLanes,o===0&&(il=null),wt(n.stateNode,i),hl(e,ht()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(nl)throw nl=!1,e=rl,rl=null,e;return sl&1&&e.tag!==0&&Il(),o=e.pendingLanes,o&1?e===ll?cl++:(cl=0,ll=e):cl=0,na(),null}function Il(){if(ol!==null){var e=Vt(sl),t=Bc.transition,n=V;try{if(Bc.transition=null,V=16>e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,$&6)throw Error(r(331));var a=$;for($|=4,Q=e.current;Q!==null;){var o=Q,s=o.child;if(Q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Q=u;Q!==null;){var d=Q;switch(d.tag){case 0:case 11:case 15:gc(8,d,o)}var f=d.child;if(f!==null)f.return=d,Q=f;else for(;Q!==null;){d=Q;var p=d.sibling,m=d.return;if(yc(d),d===u){Q=null;break}if(p!==null){p.return=m,Q=p;break}Q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Q=s;else b:for(;Q!==null;){if(o=Q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Q=v;break b}Q=o.return}}var y=e.current;for(Q=y;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else b:for(s=y;Q!==null;){if(c=Q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:_c(9,c)}}catch(e){Rl(c,c.return,e)}if(c===s){Q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Q=x;break b}Q=c.return}}if($=a,na(),Ct&&typeof Ct.onPostCommitFiberRoot==`function`)try{Ct.onPostCommitFiberRoot(St,e)}catch{}i=!0}return i}finally{V=n,Bc.transition=t}}return!1}function Ll(e,t,n){t=Ss(n,t),t=Es(e,t,1),e=Qa(e,t,1),t=fl(),e!==null&&(Rt(e,1,t),hl(e,t))}function Rl(e,t,n){if(e.tag===3)Ll(e,e,n);else for(;t!==null;){if(t.tag===3){Ll(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(il===null||!il.has(r))){e=Ss(n,e),e=Ds(t,e,1),t=Qa(t,e,1),e=fl(),t!==null&&(Rt(t,1,e),hl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=fl(),e.pingedLanes|=e.suspendedLanes&n,Vc===e&&(Uc&n)===n&&(Kc===4||Kc===3&&(Uc&130023424)===Uc&&500>ht()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=At,At<<=1,!(At&130023424)&&(At=4194304)):t=1);var n=fl();e=qa(e,t),e!==null&&(Rt(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Hi.current)Ms=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ms=!1,tc(e,t,n);Ms=!!(e.flags&131072)}}else Ms=!1,_a&&t.flags&1048576&&fa(t,oa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;$s(e,t),e=t.pendingProps;var a=Wi(t,Vi.current);Ha(t,n),a=ko(null,t,i,e,a,n);var o=Ao();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Gi(i)?(o=!0,Yi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ya(t),a.updater=_s,t.stateNode=a,a._reactInternals=t,xs(t,i,e,n),t=Vs(null,t,i,!0,o,n)):(t.tag=0,_a&&o&&pa(t),Ns(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch($s(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=hs(i,e),a){case 0:t=zs(null,t,i,e,n);break a;case 1:t=Bs(null,t,i,e,n);break a;case 11:t=Ps(null,t,i,e,n);break a;case 14:t=Fs(null,t,i,hs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),zs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Bs(e,t,i,a,n);case 3:a:{if(Hs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Xa(e,t),to(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ss(Error(r(423)),t),t=Us(e,t,i,n,a);break a}if(i!==a){a=Ss(Error(r(424)),t),t=Us(e,t,i,n,a);break a}for(ga=Ci(t.stateNode.containerInfo.firstChild),ha=t,_a=!0,va=null,n=Pa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ea(),i===a){t=ec(e,t,n);break a}Ns(e,t,i,n)}t=t.child}return t;case 5:return uo(t),e===null&&Sa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,gi(i,a)?s=null:o!==null&&gi(i,o)&&(t.flags|=32),Rs(e,t),Ns(e,t,s,n),t.child;case 6:return e===null&&Sa(t),null;case 13:return Ks(e,t,n);case 4:return co(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Na(t,null,i,n):Ns(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Ps(e,t,i,a,n);case 7:return Ns(e,t,t.pendingProps,n),t.child;case 8:return Ns(e,t,t.pendingProps.children,n),t.child;case 12:return Ns(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,X(Fa,i._currentValue),i._currentValue=s,o!==null){if(wr(o.value,s)){if(o.children===a.children&&!Hi.current){t=ec(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Za(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Va(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Va(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ns(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ha(t,n),a=Ua(a),i=i(a),t.flags|=1,Ns(e,t,i,n),t.child;case 14:return i=t.type,a=hs(i,t.pendingProps),a=hs(i.type,a),Fs(e,t,i,a,n);case 15:return Is(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),$s(e,t),t.tag=1,Gi(i)?(e=!0,Yi(t)):e=!1,Ha(t,n),ys(t,i,a),xs(t,i,a,n),Vs(null,t,i,!0,e,n);case 19:return Qs(e,t,n);case 22:return Ls(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return B(e,t)}function Gl(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.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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===N)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case ee:return e=Kl(19,n,t,a),e.elementType=ee,e.lanes=o,e;case te:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case N:s=14;break a;case P:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=te,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Lt(0),this.expirationTimes=Lt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ya(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Bi;e=e._reactInternals;a:{if(st(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Gi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Gi(n))return Ji(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=fl(),i=pl(n),a=Za(r,i),a.callback=t??null,Qa(n,a,i),e.current.lanes=i,Rt(e,i,r),hl(e,r),e}function ou(e,t,n,r){var i=t.current,a=fl(),o=pl(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=Za(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Qa(i,t,o),e!==null&&(ml(e,i,o,a),$a(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cl(function(){ou(null,e,null,null)}),t[Oi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<en.length&&t!==0&&t<en[n].priority;n++);en.splice(n,0,e),n===0&&on(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[Oi]=o.current,ri(e.nodeType===8?e.parentNode:e),Cl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[Oi]=c.current,ri(e.nodeType===8?e.parentNode:e),Cl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Ht=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=jt(t.pendingLanes);n!==0&&(Bt(t,n|1),hl(t,ht()),!($&6)&&(el=ht()+500,na()))}break;case 13:Cl(function(){var t=qa(e,1);t!==null&&ml(t,e,1,fl())}),lu(e,1)}},Ut=function(e){if(e.tag===13){var t=qa(e,134217728);t!==null&&ml(t,e,134217728,fl()),lu(e,134217728)}},Wt=function(e){if(e.tag===13){var t=pl(e),n=qa(e,t);n!==null&&ml(n,e,t,fl()),lu(e,t)}},Gt=function(){return V},Kt=function(e,t){var n=V;try{return V=e,t()}finally{V=n}},R=function(e,t,n){switch(t){case`input`:if(be(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Fi(i);if(!a)throw Error(r(90));he(i),be(i,a)}}}break;case`textarea`:De(e,n);break;case`select`:t=n.value,t!=null&&we(e,!!n.multiple,t,!1)}},Ke=Sl,qe=Cl;var yu={usingClientEntryPoint:!1,Events:[Ni,Pi,Fi,We,Ge,Sl]},bu={findFiberByHostInstance:Mi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{St=Su.inject(xu),Ct=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[Oi]=t.current,ri(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=dt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Cl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[Oi]=t.current,ri(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(Cl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[Oi]=null})}),!0):!1},e.unstable_batchedUpdates=Sl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),g=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=s((e=>{var t=g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),v=u(f(),1),y=_();function b(e=void 0){if(!e)return``;let t;try{t=new URL(e)}catch{return``}return t.protocol!==`https:`||t.username||t.password||t.pathname!==`/`||t.search||t.hash?``:t.origin}var x=(e,t)=>`${b(t)}${e}`;async function S(){throw Error(`App views run inside StillMade.`)}function C(e,t={}){return z(T.includes(e),`SHARED_WORK_OPERATION`,`Choose a declared shared-work operation.`),ct(t),z(B(t)&&JSON.stringify(t).length<=131072,`SHARED_WORK_INPUT`,`Shared-work requests require bounded JSON arguments.`),{operation:e,args:structuredClone(t)}}function w(e,t,n,r){let i=0,a=new Map,o=new Set,s=new Set,c=()=>{for(let e of s)URL.revokeObjectURL(e);s.clear()};return addEventListener(`message`,n=>{let r=n.data;if(n.source!==parent||!r||r.channel!==e||r.session!==t||![`shared-work-result`,`shared-work-refresh`].includes(r.op))return;if(r.op===`shared-work-refresh`){c();for(let e of o)try{e()}catch{}return}let i=a.get(r.id);if(i){if(a.delete(r.id),r.error){i.reject(Error(r.error));return}if(i.media){if(!(r.media instanceof Blob)||!r.media.size||r.media.size>67108864||![`image`,`video`,`audio`].includes(r.kind)||!r.media.type.startsWith(r.kind+`/`)||s.size>=2){i.reject(Error(`The shared creative preview is invalid or its limit was reached.`));return}let e=URL.createObjectURL(r.media);s.add(e),i.resolve({url:e,kind:r.kind})}else i.resolve(r.result)}}),addEventListener(`message`,n=>{n.source===parent&&n.data?.channel===e&&n.data?.session===t&&n.data?.op===`dispose`&&c()}),{releaseSharedWorkMedia(e){s.delete(e)&&URL.revokeObjectURL(e)},previewSharedWorkMedia(o){if(!n||typeof o!=`string`||!/^[0-9a-f-]{36}$/i.test(o))return Promise.reject(Error(`Choose a permitted saved creative.`));if(a.size>=4||s.size>=2)return Promise.reject(Error(`Close a previous preview before opening another.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i,media:!0}),r({channel:e,session:t,op:`shared-work-media-request`,id:c,contributionId:o},`*`)})},onSharedWorkRefresh(e){if(typeof e!=`function`)throw Error(`Expected a callback.`);return o.add(e),()=>o.delete(e)},sharedWork(o,s={}){if(!n)return Promise.reject(Error(`This Block has no shared-work permission.`));if(![`list`,`accounts`,`grants`,`create`,`bind`,`read`,`update`,`creatives`,`contribute`,`grant`,`revoke`,`unlink`].includes(o)||!s||Array.isArray(s)||typeof s!=`object`||JSON.stringify(s).length>131072)return Promise.reject(Error(`Invalid shared-work request.`));if(a.size>=4)return Promise.reject(Error(`Wait for the current shared-work request.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i}),r({channel:e,session:t,op:`shared-work-request`,id:c,operation:o,args:s},`*`)})}}}var T,E=o((()=>{vt(),T=Object.freeze([`list`,`accounts`,`grants`,`create`,`bind`,`read`,`update`,`creatives`,`contribute`,`grant`,`revoke`,`unlink`])}));function D(e){if(typeof e!=`string`||e.length>4194304)return!1;if(/^\/api\/media\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-][A-Za-z0-9._-]*$/.test(e)||/^data:image\/(png|jpeg|webp|gif);base64,[a-z0-9+/=]+$/i.test(e))return!0;try{let t=new URL(e);return[`https:`,`blob:`,`sm-media:`].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}}var O=o((()=>{}));function k(e){if(!M(e,[`schemaVersion`,`format`,`name`,`files`])||e.schemaVersion!==1||![`file`,`zip`].includes(e.format)||!ee(e.name)||e.name.includes(`/`)||!Array.isArray(e.files)||!e.files.length||e.files.length>A.files||(e.format===`file`?e.files.length!==1||!N(e.name):!e.name.endsWith(`.zip`)))return!1;let t=new Set,n=0;return e.files.every(r=>{if(!j(r)||!ee(r.path)||t.has(r.path.toLowerCase()))return!1;let i=r.path.toLowerCase();if([...t].some(e=>i.startsWith(e+`/`)||e.startsWith(i+`/`))||(t.add(i),e.format===`file`&&r.path!==e.name))return!1;if(M(r,[`path`,`text`])&&typeof r.text==`string`&&(N(r.path)||e.format===`zip`&&P(r.path)))return n+=new TextEncoder().encode(r.text).length,n<=A.textBytes;if(e.format!==`zip`||!M(r,[`path`,`source`])||!te(r.path))return!1;let a=r.source;return j(a)&&D(a.url)&&[`image`,`video`,`audio`].includes(a.kind)&&[`assetId`,`versionId`,`url`].every(e=>typeof a[e]==`string`&&a[e].length>0&&a[e].length<=(e===`url`?8192:200))&&(a.role===void 0||typeof a.role==`string`&&a.role.length<=100)})}var A,j,M,ee,N,P,te,ne=o((()=>{O(),A=Object.freeze({files:256,textBytes:3e6,pathLength:180}),j=e=>typeof e==`object`&&!!e&&!Array.isArray(e),M=(e,t)=>j(e)&&Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t)),ee=e=>typeof e==`string`&&e.length<=A.pathLength&&/^[A-Za-z0-9_-][A-Za-z0-9_./-]*$/.test(e)&&e.split(`/`).every(e=>e&&![`.`,`..`,`__proto__`,`constructor`,`prototype`].includes(e)&&!e.endsWith(`.`)&&!/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(e)),N=e=>/\.(?:txt|md|json|csv|xml|fcpxml|srt|vtt)$/i.test(e),P=e=>/\.(?:html?|css|[cm]?js|jsx|tsx?|vue|svelte|svg|map|ya?ml|toml|ini|py|[ch]|cc|cpp|hpp|rs|go|java|kt|swift|rb|sh|sql)$/i.test(e),te=e=>/\.(?:png|jpe?g|webp|gif|mp4|webm|mov|mp3|wav|ogg|m4a|flac|bin)$/i.test(e)}));function re(e,t,n){if(!e)throw new ie(t,n)}function F(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e))}var ie,ae=o((()=>{ie=class extends Error{constructor(e,t,n=[]){super(t),this.name=`BlockError`,this.code=e,this.details=n}}}));function oe(){let e=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),t=/^(string|text|number|integer|boolean|object|json)(\[\])?\??$/,n=new Set([`__proto__`,`prototype`,`constructor`]);function r(i,a=0){return a>40?!1:typeof i==`string`?t.test(i):Array.isArray(i)?i.length===1&&r(i[0],a+1):e(i)&&Object.entries(i).every(([e,t])=>!n.has(e)&&r(t,a+1))}function i(t,r,o=0){return o>40?!1:r==null?!0:Array.isArray(r)?r.length===1&&Array.isArray(t)&&t.every(e=>i(e,r[0],o+1)):typeof r==`string`?r.endsWith(`?`)?t===void 0||i(t,r.slice(0,-1),o+1):r.endsWith(`[]`)?Array.isArray(t)&&t.every(e=>i(e,r.slice(0,-2),o+1)):r===`string`||r===`text`?typeof t==`string`:r===`object`?e(t):r===`json`?a(t,o+1):r===`integer`?Number.isSafeInteger(t):r===`number`?typeof t==`number`&&Number.isFinite(t):r===`boolean`&&typeof t==`boolean`:e(r)&&e(t)&&Object.entries(r).every(([e,r])=>!n.has(e)&&i(Object.hasOwn(t,e)?t[e]:void 0,r,o+1))}function a(t,r){return r>40?!1:t===null||typeof t==`string`||typeof t==`boolean`?!0:typeof t==`number`?Number.isFinite(t):(e(t)||Array.isArray(t))&&Object.entries(t).every(([e,t])=>!n.has(e)&&a(t,r+1))}return{semanticSchemaValid:r,schemaMatches:i,validate:(e,t)=>{try{return r(t)&&a(e,0)&&i(e,t)}catch{return!1}}}}var se,ce,le,ue=o((()=>{({semanticSchemaValid:se,schemaMatches:ce}=oe()),Object.freeze([`upstream`,`project`,`adapter`,`chat`,`default`,`user`,`external`]),le=Object.freeze([`key`,`semantic`,`accepts`,`schema`,`sources`,`sensitivity`,`freshnessPolicy`,`cardinality`,`batchable`])})),de,fe=o((()=>{de=Object.freeze([Object.freeze({name:`narration_script`,parents:Object.freeze([`script`])}),Object.freeze({name:`sales_script`,parents:Object.freeze([`script`])}),Object.freeze({name:`timed_transcript`,parents:Object.freeze([`transcript`])}),Object.freeze({name:`product_image`,parents:Object.freeze([`image`])}),Object.freeze({name:`reference_image`,parents:Object.freeze([`image`])}),Object.freeze({name:`generated_image`,parents:Object.freeze([`image`,`source_image`])}),Object.freeze({name:`processed_image`,parents:Object.freeze([`image`,`source_image`])}),Object.freeze({name:`visual_description`,parents:Object.freeze([`plain_text`])}),Object.freeze({name:`transcript_text`,parents:Object.freeze([`plain_text`])}),Object.freeze({name:`editor_timeline`,parents:Object.freeze([`timeline`])}),Object.freeze({name:`legacy.timeline.updatededitor`,parents:Object.freeze([`timeline`])}),Object.freeze({name:`narration_audio`,parents:Object.freeze([`source_audio`])})]),new Map(de.map(e=>[e.name,e.parents]))})),pe=o((()=>{ue()}));function me(e){return ve(e,[`schemaVersion`,`startMs`,`endMs`])&&e.schemaVersion===2&&typeof e.startMs==`number`&&Number.isFinite(e.startMs)&&e.startMs>=0&&typeof e.endMs==`number`&&Number.isFinite(e.endMs)&&e.endMs>=e.startMs&&e.endMs<=ge}function he(e){return ve(e,[`schemaVersion`,`decision`])&&e.schemaVersion===2&&[`accepted`,`rejected`,`deferred`].includes(e.decision)}var ge,_e,ve,ye=o((()=>{ge=2**53-1,_e=e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),ve=(e,t)=>_e(e)&&Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))})),be=o((()=>{vt()})),xe=o((()=>{vt(),be(),Object.freeze({routes:16,operations:64,keyLength:80,declarationBytes:65536})})),Se,Ce=o((()=>{Se=`(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})`,RegExp(`^`+Se+`$`),RegExp(`^(>=|<=|>|<|=)?`+Se+`$`)}));function we(e){return Te(e)&&Object.keys(e).length===5&&e.schemaVersion===1&&typeof e.title==`string`&&e.title.trim().length>0&&e.title.length<=200&&Ee.includes(e.field)&&Te(e.before)&&e.before.schemaVersion===1&&Te(e.after)&&e.after.schemaVersion===1}var Te,Ee,De=o((()=>{Te=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ee=Object.freeze([`blueprint`,`shotPlan`,`panels`,`board`,`canvas`,`animation`,`editor`])}));function Oe(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length!==4||!Object.keys(e).every(e=>[`type`,`duration`,`soundOn`,`soundId`].includes(e)))return!1;let t=ke.find(t=>t.type===e.type);return!!t&&Number.isFinite(e.duration)&&e.duration>=.1&&e.duration<=3&&typeof e.soundOn==`boolean`&&(t.sounds.length?t.sounds.includes(e.soundId):e.soundId===``)}var ke,Ae=o((()=>{ke=Object.freeze([{type:`Cut`,sounds:[]},{type:`Fade`,sounds:[]},{type:`Cross dissolve`,sounds:[]},{type:`Shape wipe`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Iris`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Ink splat`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Swirl`,sounds:[`whoosh`,`swirl_wind`]},{type:`Whip left`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip right`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip up`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip down`,sounds:[`whip_crack`,`whip_zip`]},{type:`Whip pan`,sounds:[`whip_crack`,`whip_zip`]},{type:`Slash`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Shred`,sounds:[`shape_sweep`,`shape_pop`]},{type:`Morph`,sounds:[`morph_warp`,`morph_bloom`]},{type:`Dip to black`,sounds:[]},{type:`Dip to white`,sounds:[]},{type:`Push left`,sounds:[`push_slide`,`push_thump`]},{type:`Push right`,sounds:[`push_slide`,`push_thump`]},{type:`Push up`,sounds:[`push_slide`,`push_thump`]},{type:`Push down`,sounds:[`push_slide`,`push_thump`]},{type:`Zoom left`,sounds:[]},{type:`Zoom right`,sounds:[]},{type:`Zoom up`,sounds:[]},{type:`Zoom down`,sounds:[]}].map(e=>Object.freeze({...e,sounds:Object.freeze(e.sounds)})))}));function je(e){if(!Me(e)||e.schemaVersion!==1||!Ne(e.title)||!Ne(e.timelineId)||!Array.isArray(e.commands)||!e.commands.length||e.commands.length>100||Object.keys(e).some(e=>![`schemaVersion`,`title`,`timelineId`,`commands`].includes(e)))return!1;let t=new Set;return e.commands.every(e=>{if(!Me(e)||![`clips`,`audioItems`,`captions`].includes(e.collection)||!Me(e.values)||!Fe(e,[`collection`,`operation`,`before`,`values`]))return!1;let n=e.values,r=e.operation===`caption.add`,i=r?n.id:e.before?.id,a=`${e.collection}:${i}`;return!Ne(i)||t.has(a)?!1:(t.add(a),e.collection===`captions`?r?e.before===null&&Be(n)&&Ne(n.trackId)&&Re(n):!Me(e.before)||!Re(e.before)?!1:e.operation===`caption.update`?Fe(n,[`text`,`start`,`end`])&&Re(n):e.operation===`remove`&&Fe(n,[]):!Object.hasOwn(Pe,e.operation)||!Me(e.before)||!I(e.before.start,0,86400)||!I(e.before.duration,.001,86400)||!Fe(n,Pe[e.operation])?!1:e.operation===`transition`?e.collection===`clips`&&Oe(n):e.operation===`grade`?e.collection===`clips`&&Le(n):e.operation===`split`?I(n.at,0,86400)&&Ne(n.newId)&&n.newId!==e.before.id:e.operation===`move`?I(n.start,0,86400):e.operation===`trim`?I(n.trimStart,0,86400)&&I(n.duration,.001,86400):e.operation===`volume`?I(n.volume,0,200):e.operation!==`mute`||typeof n.muted==`boolean`)})}var Me,Ne,I,Pe,Fe,Ie,Le,Re,ze,L,Be,R=o((()=>{Ae(),Me=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ne=e=>typeof e==`string`&&e.length>0&&e.length<=200,I=(e,t,n)=>Number.isFinite(e)&&e>=t&&e<=n,Pe={move:[`start`],trim:[`trimStart`,`duration`],volume:[`volume`],mute:[`muted`],remove:[],split:[`at`,`newId`],grade:[`lut`,`color`],transition:[`type`,`duration`,`soundOn`,`soundId`]},Fe=(e,t)=>Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t)),Ie={brightness:[-100,100],contrast:[-100,100],saturation:[-100,100],temperature:[-100,100],sharpness:[-50,50],vignette:[0,100]},Le=e=>[`None`,`Cold`,`Warm`,`Desaturated`,`High Contrast`,`Filmic`,`Teal and Orange`].includes(e.lut)&&Me(e.color)&&Fe(e.color,Object.keys(Ie))&&Object.entries(Ie).every(([t,[n,r]])=>I(e.color[t],n,r)),Re=e=>typeof e.text==`string`&&e.text.trim().length>0&&e.text.length<=5e3&&I(e.start,0,86400)&&I(e.end,0,86400)&&e.end-e.start>=.001,ze=[`id`,`trackId`,`text`,`start`,`end`],L={font:e=>e===`Hanken Grotesk`,size:e=>I(e,8,200),color:e=>typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),highlightColor:e=>typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),background:e=>e===`none`||typeof e==`string`&&/^#[a-f0-9]{3}(?:[a-f0-9]{3})?$/i.test(e),backgroundOpacity:e=>I(e,0,100),backgroundPadding:e=>I(e,0,100),backgroundRadius:e=>I(e,0,100),position:e=>[`top left`,`top center`,`top right`,`middle left`,`middle center`,`middle right`,`bottom left`,`bottom center`,`bottom right`].includes(e),animation:e=>[`none`,`fade`].includes(e)},Be=e=>!ze.every(t=>Object.hasOwn(e,t))||Object.keys(e).some(e=>!ze.includes(e)&&e!==`words`&&!Object.hasOwn(L,e))||!Object.entries(L).every(([t,n])=>!Object.hasOwn(e,t)||n(e[t]))?!1:!Object.hasOwn(e,`words`)||Array.isArray(e.words)&&e.words.length<=1e3&&e.words.every((t,n)=>Me(t)&&Fe(t,[`text`,`start`,`end`])&&typeof t.text==`string`&&t.text.trim().length>0&&t.text.length<=5e3&&I(t.start,e.start,e.end)&&I(t.end,t.start,e.end)&&(n===0||t.start>=e.words[n-1].start))})),Ve,He=o((()=>{Ve=Object.freeze([`screen.capture`,`cursor.track`,`camera.capture`,`microphone.capture`,`clipboard.read`,`clipboard.write`,`media.pick`,`notifications.show`,`power.keep-awake`,`native.tools`])})),Ue=o((()=>{Object.freeze({"org.stillmade.PythonAdapter":Object.freeze({id:`org.stillmade.PythonAdapter`,adapterVersion:1,label:`Python connection`,actions:Object.freeze([`adapter.import`,`adapter.inspect`,`adapter.execute`,`adapter.describe`,`adapter.call`]),projectExtensions:Object.freeze([`py`])}),"org.natron.Natron":Object.freeze({id:`org.natron.Natron`,adapterVersion:1,label:`Natron`,actions:Object.freeze([`launch`,`project.import`,`project.open`,`project.render`]),projectExtensions:Object.freeze([`ntp`])})})}));function We(e){return Xe(e)&&e.kind===`file`&&Qe(e.assetId,512)&&Qe(e.versionId,512)&&tt.includes(e.mimeType)&&(e.url===void 0||Qe(e.url,32768))&&(e.name===void 0||Qe(e.name,$e.fileName))&&(e.bytes===void 0||Number.isSafeInteger(e.bytes)&&e.bytes>=0)}function Ge(e){return Xe(e)&&Object.keys(e).every(e=>[`schemaVersion`,`format`,`text`,`title`].includes(e))&&e.schemaVersion===1&&nt.includes(e.format)&&typeof e.text==`string`&&e.text.length<=$e.documentText&&(e.title===void 0||typeof e.title==`string`&&e.title.length<=$e.documentTitle)}function Ke(e){if(!Xe(e)||!Object.keys(e).every(e=>[`schemaVersion`,`columns`,`rows`].includes(e))||e.schemaVersion!==void 0&&e.schemaVersion!==1)return!1;let{columns:t,rows:n}=e;if(!Array.isArray(t)||!t.length||t.length>$e.tableColumns||!Array.isArray(n)||n.length>$e.tableRows||!t.every(e=>typeof e==`string`&&e.trim().length>0&&e.length<=$e.columnName&&!Ze.has(e))||new Set(t).size!==t.length)return!1;let r=new Set(t),i=0;for(let e of n){if(!Xe(e))return!1;for(let[t,n]of Object.entries(e))if(!r.has(t)||!rt(n)||++i>$e.tableCells)return!1}return!0}function qe(e){if(typeof e!=`string`||!e.length||e.length>$e.url||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t;try{t=new URL(e)}catch{return!1}return[`http:`,`https:`].includes(t.protocol)&&t.hostname.length>0&&!t.username&&!t.password}function Je(e){let t=typeof e==`string`?it.exec(e):null;if(!t)return!1;let[n,r,i,a=0,o=0,s=0,c=0,l=0]=t.slice(1).map(e=>e===void 0?void 0:Number(e)),u=[31,n%4==0&&(n%100!=0||n%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][r-1];return r>=1&&r<=12&&i>=1&&i<=u&&a<=23&&o<=59&&s<=59&&c<=14&&l<=59}function Ye(e){return typeof e==`string`&&/^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(e)}var Xe,Ze,Qe,$e,et,tt,nt,rt,it,at=o((()=>{Xe=e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&[Object.prototype,null].includes(Object.getPrototypeOf(e)),Ze=new Set([`__proto__`,`prototype`,`constructor`]),Qe=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,$e=Object.freeze({fileName:255,documentText:1e6,documentTitle:300,tableColumns:500,tableRows:1e5,tableCells:5e5,columnName:160,cellText:1e5,url:8192}),et=Object.freeze({pdf:`application/pdf`,txt:`text/plain`,csv:`text/csv`,md:`text/markdown`,json:`application/json`,zip:`application/zip`}),tt=Object.freeze([...new Set(Object.values(et))]),nt=Object.freeze([`markdown`,`plain`]),rt=e=>e===null||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)||typeof e==`string`&&e.length<=$e.cellText,it=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(?:Z|[+-](\d{2}):(\d{2}))?)?$/})),ot=o((()=>{Object.freeze({origins:8,requestBytes:4194304,responseBytes:8388608,timeoutMs:3e4,redirects:3,headers:32,headerBytes:16384,urlLength:8192,requestsPerMinute:120,originRequestsPerMinute:3e3,keyLength:4096}),Object.freeze([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`]),Object.freeze([`bearer`,`header`,`query`,`oauth2`])})),st=o((()=>{Object.freeze([`media.saved`,`schedule`,`webhook`,`project.completed`,`provider`]),Object.freeze({triggers:4,labelLength:120,minEverySeconds:60,maxEverySeconds:31536e3}),Object.freeze([`recipe`,`javascript`,`capability`])}));function ct(e,t=0,n={nodes:0}){if(z(t<=40&&++n.nodes<=5e5,`LIMIT`,`Document exceeds complexity limit`),!(e===null||[`string`,`boolean`].includes(typeof e))){if(typeof e==`number`){z(Number.isFinite(e),`SCHEMA`,`Numbers must be finite`);return}z(Array.isArray(e)||B(e),`SCHEMA`,`Only JSON data is accepted`);for(let[r,i]of Object.entries(e))z(!_t.has(r),`SCHEMA`,`Forbidden field: ${r}`),ct(i,t+1,n)}}function lt(e){ct(e);let t=e=>Array.isArray(e)?e.map(t):B(e)?Object.fromEntries(Object.keys(e).sort().map(n=>[n,t(e[n])])):e;return JSON.stringify(t(e))}async function ut(e){let t=new TextEncoder().encode(lt(e)),n=await globalThis.crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n),e=>e.toString(16).padStart(2,`0`)).join(``)}function dt(e,t){if(typeof t==`object`&&t&&t.schema!=null&&!ce(e,t.schema))return!1;let n=typeof t==`string`?t:t.type;if(n===`object`)try{return ct(e),B(e)}catch{return!1}if(n?.endsWith(`[]`))return Array.isArray(e)&&e.every(e=>dt(e,n.slice(0,-2)));if(n===`text`)return typeof e==`string`&&e.length<=1e6;if(n===`boolean`)return typeof e==`boolean`;if(n===`url`)return qe(e);if(n===`date`)return Je(e);if(n===`color`)return Ye(e);if(n===`file`)return We(e);if(n===`document`)return Ge(e);if(n===`table`)try{return ct(e),Ke(e)}catch{return!1}if(n===`number`||n===`integer`)return typeof e==`number`&&Number.isFinite(e)&&(n!==`integer`||Number.isInteger(e))&&(t.min==null||e>=t.min)&&(t.max==null||e<=t.max);if(n===`file-bundle`)try{return ct(e),k(e)}catch{return!1}if(n===`workspace-edit`)try{return ct(e),we(e)}catch{return!1}if(n===`timeline-edit`)try{return ct(e),je(e)}catch{return!1}if(n===`timeline-range`||n===`approval`)return B(e)&&e.schemaVersion===1?!0:n===`timeline-range`?me(e):he(e);if(n===`json`)try{return ct(e),!0}catch{return!1}return n===`image`&&B(e)&&Array.isArray(e.data)?Number.isInteger(e.width)&&Number.isInteger(e.height)&&e.width>0&&e.height>0&&e.width*e.height<=1048576&&e.data.length===e.width*e.height*4&&e.data.every(e=>Number.isInteger(e)&&e>=0&&e<=255):[`image`,`video`,`audio`,`asset`].includes(n)?B(e)&&typeof e.assetId==`string`&&typeof e.versionId==`string`&&(n===`asset`||e.kind===n):ft.includes(n)&&B(e)&&e.schemaVersion===1}var z,B,ft,pt,mt,ht,gt,_t,vt=o((()=>{E(),ne(),ae(),ue(),fe(),pe(),ye(),xe(),Ce(),De(),R(),He(),Ue(),at(),ot(),st(),z=re,B=F,Object.freeze([`type`,`required`,`default`,`min`,`max`,`description`,`role`,`primary`,`context`,`imageMode`,...le]),ft=Object.freeze(`text.number.integer.boolean.json.object.image.video.audio.asset.script.transcript.brief.bible.shot-plan.panel-document.board-document.scene-document.timeline.timeline-edit.file-bundle.workspace-edit.timeline-range.research.character.location.style.pipeline.approval.scene.shot.mask.depth.pose.metadata.project-context.file.document.table.url.date.color`.split(`.`)),Object.freeze([`final.render`,`stock.search`,`presenter.generate`,`quality.analyze`,`image.generate`,`image.generate.batch`,`media.generate`,`youtube.upload`]),Object.freeze([`text`,`number`,`slider`,`checkbox`,`asset`,`select`,`multiselect`,`file`,`date`,`color`,`url`,`richtext`,`list`,`grid`]),Object.freeze([`gallery`,`before-after`,`table`,`document`,`chart`,`code`,`player`,`download`]),Object.freeze({file:[`file`,`file[]`],date:[`date`],color:[`color`],url:[`url`],richtext:[`document`,`text`],list:[`text[]`,`number[]`,`integer[]`,`url[]`,`date[]`,`color[]`],grid:[`table`]}),Object.freeze({gallery:[`image[]`],"before-after":[`image`],table:[`table`],document:[`document`,`text`],chart:[`table`,`number[]`,`integer[]`],code:[`text`,`json`,`object`],player:[`audio`,`video`,`audio[]`,`video[]`],download:[`file`,`file[]`,`file-bundle`]}),pt=Object.freeze({script:`script`,transcript:`transcript`,shots:`shot[]`,shotPlan:`shot-plan`,scenes:`scene[]`,characters:`character[]`,locations:`location[]`,styles:`style[]`,assets:`asset[]`,files:`file[]`,generations:`metadata[]`,versions:`metadata[]`,timeline:`timeline`,editor:`timeline`,canvas:`pipeline`,blueprint:`bible`,panels:`panel-document`,board:`board-document`,animation:`scene-document`,metadata:`metadata`}),mt=(e,t,n,r)=>Object.freeze({executor:e,mode:t,byok:n,summary:r}),ht=Object.freeze({"text.generate":mt(`capability-run`,`sync`,!0,`Exact model, account BYOK or credits, and explicit run review`),"audio.speech":mt(`capability-run`,`sync`,!0,`One short text/script input to measured audio in any StillMade catalog voice (Deepgram, ElevenLabs, OpenAI, Kokoro) with credits, or OpenAI with your key; playback review; accepted project recordings can be explicitly added to Editor audio`),"audio.transcribe":mt(`capability-run`,`sync`,!0,`One owner-scoped stored audio asset to reviewed text and ordered word timings with StillMade transcription on credits, or OpenAI Whisper with your key`),"audio.music":mt(`capability-run`,`sync`,!1,`One prompt to generated music (5–240 seconds) with StillMade credits and playback review`),"audio.sfx":mt(`capability-run`,`sync`,!1,`One prompt to a generated sound effect (0.5–22 seconds) with StillMade credits and playback review`),"image.generate":mt(`capability-run`,`sync`,!0,`One prompt and optional reference images to a stored PNG with any catalog image model and its settings; StillMade credits or account key, and actual image review`),"video.generate":mt(`capability-run`,`async`,!0,`One prompt and optional first/last frames to a measured stored video clip with any catalog video model and its settings; StillMade credits and actual video review`),"image.describe":mt(`capability-run`,`sync`,!0,`One to four owned images to bounded production notes; host-selected model/payment and actual description review`),"media.analyze":mt(`capability-run`,`sync`,!1,`One owned video (optionally one time range), image or up to four images to structured visual evidence: summary, timeline, observations, on-screen text and issues, with StillMade credits`),"web.fetch":mt(`capability-run`,`sync`,!1,`One public web page read by the host and answered against the Block's instruction, with StillMade credits; no cookies, keys or private addresses`),"web.research":mt(`capability-run`,`sync`,!1,`One topic searched on the web and summarized with cited sources, with StillMade credits`),"timeline.propose":mt(`capability-run`,`sync`,!0,`Bounded typed context to strict timeline-edit JSON; host-selected model/payment, stale-before checks, preview and Apply`),"workspace.propose":mt(`capability-run`,`sync`,!0,`Bounded typed context to a strict workspace-edit proposal for one permitted workspace; preview and explicit Apply`),"connection.execute":mt(`connection`,`sync`,!1,`One reviewed action on a connected third-party app account through the host connection service; the Block never receives account credentials`)}),gt=e=>Object.freeze(Object.entries(ht).filter(([,t])=>e(t)).map(([e])=>e)),gt(()=>!0),gt(e=>e.executor===`capability-run`),gt(e=>e.executor===`capability-run`&&e.mode===`sync`),gt(e=>e.byok),[...Object.keys(pt).map(e=>`context.${e}.read`)],_t=new Set([`__proto__`,`prototype`,`constructor`])}));vt();var yt=Object.freeze([`tasks`,`preview-task`,`apply-task`]);function bt(e,t={}){return z(yt.includes(e),`CONNECTION_TASK`,`Choose a declared task operation.`),ct(t),z(B(t)&&JSON.stringify(t).length<=32768,`CONNECTION_TASK`,`Use bounded task selection arguments.`),{operation:e,args:structuredClone(t)}}function xt(e,t,n,r){let i=0,a=new Map;return addEventListener(`message`,n=>{let r=n.data;if(n.source!==parent||!r||r.channel!==e||r.session!==t||r.op!==`connected-app-result`)return;let i=a.get(r.id);i&&(a.delete(r.id),r.error?i.reject(Error(r.error)):i.resolve(r.result))}),{connectedApp(o,s={}){if(!n)return Promise.reject(Error(`This Block has no connected-app task contract.`));if(![`tasks`,`preview-task`,`apply-task`].includes(o)||!s||typeof s!=`object`||Array.isArray(s)||JSON.stringify(s).length>32768)return Promise.reject(Error(`Invalid task choice.`));if(a.size>=2)return Promise.reject(Error(`Wait for the current task choice.`));let c=String(++i);return new Promise((n,i)=>{a.set(c,{resolve:n,reject:i}),r({channel:e,session:t,op:`connected-app-request`,id:c,operation:o,args:s},`*`)})}}}function St(e){let t=0,n=null,r=[],i=0,a=()=>{if(n||!r.length)return;let o=r.shift();n=o,Promise.resolve().then(()=>{if(o.generation!==t)throw Error(`Preview input changed`);return e(o.kind,o.value)}).then(o.resolve,o.reject).finally(()=>{n===o&&(n=null,i-=o.bytes,a())})};return{request(e,o){let s,c;try{if(![`image`,`media`].includes(e)||!o||Array.isArray(o)||typeof o!=`object`||(s=JSON.stringify(o),c=new TextEncoder().encode(s).length,c>4194304))throw Error(`Expected a bounded preview value`)}catch(e){return Promise.reject(e)}let l=e===`image`&&[n,...r].find(t=>t?.kind===e&&t.serialized===s);if(l)return l.promise;if(r.length+ +!!n>=4||i+c>8388608)return Promise.reject(Error(`Too many queued previews. Wait for a preview to finish.`));let u={kind:e,value:JSON.parse(s),serialized:s,bytes:c,generation:t};return u.promise=new Promise((e,t)=>{u.resolve=e,u.reject=t}),i+=c,r.push(u),a(),u.promise},reset(e=`Preview input changed`){t+=1;for(let t of[n,...r])t&&t.reject(Error(e));n=null,r=[],i=0}}}function Ct(){return null}var wt=Object.freeze({bytes:25165824,timeoutMs:15e3}),Tt=Object.freeze({video:[`video/mp4`,`video/webm`,`video/ogg`,`video/quicktime`],audio:[`audio/mpeg`,`audio/mp3`,`audio/mp4`,`audio/aac`,`audio/ogg`,`audio/wav`,`audio/x-wav`,`audio/webm`,`audio/flac`]});function Et(e){if(!e||!Tt[e.kind]?.includes(e.blob?.type)||!(e.blob instanceof Blob)||!e.blob.size||e.blob.size>wt.bytes)throw Error(`The host returned an unsupported or oversized media preview.`);return{kind:e.kind,blob:e.blob}}var Dt=/^\/api\/media\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-][A-Za-z0-9._-]*$/;async function Ot(e,{signal:t,check:n=()=>{}}={}){n();let r=await fetch(e.url,{signal:t,credentials:`omit`,redirect:Dt.test(e.url)?`follow`:`error`,referrerPolicy:`no-referrer`});if(n(),!r.ok)throw Error(`This media could not be loaded. Upload a local copy to preview it.`);let i=(r.headers.get(`content-type`)||``).split(`;`)[0].trim().toLowerCase();if(!Tt[e.kind]?.includes(i))throw Error(`Choose a supported audio or video file.`);if(Number(r.headers.get(`content-length`))>wt.bytes)throw Error(`Preview media must be under 24 MB.`);if(!r.body?.getReader)throw Error(`Streaming media previews are unavailable in this browser.`);let a=r.body.getReader(),o=[],s=0;try{for(;;){if(n(),t?.aborted)throw new DOMException(`Media preview cancelled`,`AbortError`);let{done:e,value:r}=await a.read();if(n(),e)break;if(s+=r.byteLength,s>wt.bytes)throw Error(`Preview media must be under 24 MB.`);o.push(r)}return Et({kind:e.kind,blob:new Blob(o,{type:i})})}finally{await a.cancel().catch(()=>{}),a.releaseLock()}}var kt=new Set;function At(e){return kt.add(e),()=>kt.delete(e)}function jt(e,t,n,r=null,i=[]){let a=new Map,o=[`text`,`search`,`email`,`tel`,`url`],s=new Set(i),c=new Map,l=new Set,u=new Map,d=!1,f=(e,t)=>{if(clearTimeout(t.timer),c.delete(e),d)return;let r;return r=Promise.resolve().then(()=>{if(!d)return t.callback()}).catch(t=>{u.set(e,t),n(t.message)}).finally(()=>l.delete(r)),l.add(r),r},p=(e,t)=>{if(d||typeof e!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)||typeof t!=`function`)throw Error(`Use a named shared edit callback`);if(!c.has(e)&&c.size+l.size>=32||!u.has(e)&&u.size>=32)throw Error(`Too many scheduled shared edits`);u.delete(e);let n=c.get(e),r={callback:t,started:n?.started??Date.now(),timer:null};n&&clearTimeout(n.timer),r.timer=setTimeout(()=>f(e,r),Math.max(0,Math.min(150,500-(Date.now()-r.started)))),c.set(e,r)},m=(i,c)=>{if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(i)||a.has(i))throw Error(`Use one control per named shared field`);let l=e.getElementById(c),u=l?.tagName===`FIELDSET`?[...l.querySelectorAll(`input[type="radio"]`)]:null;if(!l||![`INPUT`,`TEXTAREA`,`SELECT`,`FIELDSET`].includes(l.tagName)||u&&!u.length||l.tagName===`INPUT`&&![`text`,`search`,`email`,`tel`,`url`,`number`,`range`,`checkbox`,`color`].includes(l.type))throw Error(`Bind an existing text, number, checkbox or select control, or a fieldset of radio buttons`);if(s.has(i)){let e=l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type),t=l.disabled,n=l.readOnly,r=l.getAttribute(`title`),s=l.getAttribute(`aria-readonly`),c=l.getAttribute(`aria-disabled`);e?(l.readOnly=!0,l.setAttribute(`aria-readonly`,`true`)):(l.disabled=!0,l.setAttribute(`aria-disabled`,`true`)),l.setAttribute(`title`,`Connected input. Change its source in Flow.`);let u={flush:async()=>{},status:()=>({dirty:!1,saving:!1,problem:null,canEdit:!1,composing:!1,interrupted:!1}),setDefault(){},dispose(){l.disabled=t,l.readOnly=n,r===null?l.removeAttribute(`title`):l.setAttribute(`title`,r),s===null?l.removeAttribute(`aria-readonly`):l.setAttribute(`aria-readonly`,s),c===null?l.removeAttribute(`aria-disabled`):l.setAttribute(`aria-disabled`,c),a.delete(i)}};return a.set(i,u),u.dispose}if(r&&(l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type))){let e=r.bind(i,l),t=e.dispose;return e.dispose=()=>{t(),a.delete(i)},a.set(i,e),e.dispose}let d=l.disabled,f={exists:!1},p,m=!1,h=!1,g=null,_=!1,v=!1,y=null,b=null,x=null,S=!1,C=!1,w,T=l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type),E=e=>{b=e,l.setCustomValidity(e.message),n(e.message)},D=()=>u.find(e=>e.checked)?.value??``,O=e=>{let n=u?D():l.type===`checkbox`?l.checked:l.value;if(u)for(let t of u)t.checked=t.value===String(e??``);else l.type===`checkbox`?l.checked=!!e:l.value!==String(e??``)&&(l.value=String(e??``));(u?D():l.type===`checkbox`?l.checked:l.value)!==n&&queueMicrotask(()=>{_||t.announce?.()})},k=()=>u?D():l.type===`checkbox`?l.checked:[`number`,`range`].includes(l.type)?l.valueAsNumber:l.value,A=k(),j=()=>{if(clearTimeout(g),g=null,h)return y;if(_||S||!m||!v||b)return;let e=p;m=!1,x=null,h=!0;let n=!1;return y=Promise.resolve().then(()=>t.updateShared({[i]:e},{[i]:f})).then(()=>{f={exists:!0,value:e},l.setCustomValidity(``),!b&&m&&Object.is(p,e)&&(m=!1,x=null)},e=>{n=!0,m=!0,E(e)}).finally(()=>{h=!1,y=null,!_&&!n&&m&&p!==e&&M(),!_&&!m&&P(t.getShared())}),y},M=()=>{clearTimeout(g),g=setTimeout(j,Math.max(0,Math.min(150,500-(Date.now()-(x??Date.now())))))},ee=()=>{!_&&T&&v&&!d&&(S=!0,clearTimeout(g),g=null)},N=e=>{if(_||!v||d)return;if(T&&e?.isComposing){ee();return}if(S)return;let t=k();if(typeof t==`number`&&!Number.isFinite(t)){E(Error(`Enter a finite number`));return}w!==void 0&&Object.is(t,w)||(w=void 0,(b||!Object.is(t,m||h?p:f.exists?f.value:A))&&((b||x===null)&&(x=Date.now()),p=t,b=null,m=!0,M()))},P=e=>{_||(v=e.canEdit,l.disabled=d||!v,!v&&S&&(C=!0),!v&&(m||S)&&E(Error(`Editing access changed. Your unsaved draft has been preserved.`)),!(S||m||h||b)&&(f=Object.hasOwn(e.state,i)?{exists:!0,value:e.state[i]}:{exists:!1},O(f.exists?f.value:A)))},te=t.onShared(P),ne=()=>{if(!_&&S){if(S=!1,!v||C){C=!1,p=k(),w=p,m=!0,E(Error(`Editing access changed. Your unsaved draft has been preserved.`));return}N(),m&&!h&&!b?(x=Date.now(),M()):!m&&!h&&!b&&P(t.getShared())}};l.disabled=d||!t.getShared().canEdit;let re=u?`focusout`:`blur`;l.addEventListener(`input`,N),l.addEventListener(`change`,N),l.addEventListener(re,j),l.addEventListener(`compositionstart`,ee),l.addEventListener(`compositionend`,ne);let F=()=>{_=!0,S=!1,clearTimeout(g),te(),l.removeEventListener(`input`,N),l.removeEventListener(`change`,N),l.removeEventListener(re,j),l.removeEventListener(`compositionstart`,ee),l.removeEventListener(`compositionend`,ne),l.disabled=d,a.delete(i)};return a.set(i,{dispose:F,flush:j,status(){return{dirty:m,saving:h,problem:b,canEdit:v,composing:S,interrupted:w!==void 0}},setDefault(e){A=e,P(t.getShared())}}),F},h=()=>{let t=[...e.querySelectorAll(`[data-stillmade-share]`)];if(t.length>100)throw Error(`Use at most 100 shared controls`);for(let n of t){let t=n.getAttribute(`data-stillmade-share`),r=n.id;if(typeof t!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(t)||typeof r!=`string`||!r||r.length>200||e.getElementById(r)!==n)throw Error(`Each data-stillmade-share control needs a unique ID and valid shared field name`);m(t,r)}return t.length},g=()=>{if(d)throw Error(`Block closed before edits could be flushed`);if([...a.values()].some(e=>e.status().composing))throw Error(`Finish composing text before leaving this Block or running an action.`);let e=[...a.values()].find(e=>e.status().interrupted);if(e)throw e.status().problem};return{bindShared:m,bindAnnotated:h,scheduleSharedEdit:p,flushAll:async()=>{if(d)throw Error(`Block closed before edits could be flushed`);for(let e=0;e<32;e++){if(d)throw Error(`Block closed before edits could be flushed`);g();let e=[...l];for(let[t,n]of[...c])e.push(f(t,n));for(let t of a.values())e.push(t.flush());if(await Promise.all(e),d)throw Error(`Block closed before edits could be flushed`);if(u.size)throw u.values().next().value;let t=!1;for(let e of a.values()){let n=e.status();if(n.problem)throw n.problem;if(n.composing)throw Error(`Finish composing text before leaving this Block or running an action.`);if(n.dirty&&!n.canEdit)throw Error(`Editing access changed. Your draft is not saved.`);t||=n.dirty||n.saving}if(!t&&!c.size&&!l.size)return{queued:!0}}throw Error(`Edits are still arriving. Finish editing before leaving this Block.`)},assertNoComposition:g,getBindingStatus:e=>a.get(e)?.status(),setSharedDefaults(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length>100||JSON.stringify(e).length>65536)throw Error(`Use bounded shared control defaults`);for(let[t,n]of Object.entries(e))a.get(t)?.setDefault(n)},dispose(){d=!0;for(let e of c.values())clearTimeout(e.timer);c.clear();for(let e of[...a.values()])e.dispose()}}}var Mt='var StillMadeTextFrame=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=()=>new Map,n=e=>{let n=t();return e.forEach((e,t)=>{n.set(t,e)}),n},r=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},i=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},a=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},o=()=>new Set,s=e=>e[e.length-1],c=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},l=Array.from,u=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},d=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},f=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},p=Array.isArray;var m=class{constructor(){this._observers=t()}on(e,t){return r(this._observers,e,o).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,n){return l((this._observers.get(e)||t()).values()).forEach(e=>e(...n))}destroy(){this._observers=t()}};let h=Math.floor,g=Math.abs,_=(e,t)=>e<t?e:t,v=(e,t)=>e>t?e:t;Number.isNaN;let y=e=>e===0?1/e<0:e<0,b=2**53-1,x=-(2**53-1),S=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&h(e)===e);Number.isNaN,Number.parseInt;let C=String.fromCharCode;String.fromCodePoint,C(65535);let w=e=>e.toLowerCase(),ee=/^\\s*/g,T=e=>e.replace(ee,``),E=/([A-Z])/g,te=(e,t)=>T(e.replace(E,e=>`${t}${w(e)}`)),D=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},O=typeof TextEncoder<`u`?new TextEncoder:null,k=O?e=>O.encode(e):D,A=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});A&&A.decode(new Uint8Array).length===1&&(A=null);let j=(e,t)=>f(t,()=>e).join(``);var M=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};let ne=()=>new M,N=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},P=e=>{let t=new Uint8Array(N(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},re=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(v(n,t)*2),e.cpos=0)},F=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ie=F,I=(e,t)=>{for(;t>127;)F(e,128|127&t),t=h(t/128);F(e,127&t)},ae=(e,t)=>{let n=y(t);for(n&&(t=-t),F(e,(t>63?128:0)|(n?64:0)|63&t),t=h(t/64);t>0;)F(e,(t>127?128:0)|127&t),t=h(t/128)},oe=new Uint8Array(3e4),se=oe.length/3,ce=O&&O.encodeInto?(e,t)=>{if(t.length<se){let n=O.encodeInto(t,oe).written||0;I(e,n);for(let t=0;t<n;t++)F(e,oe[t])}else L(e,k(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;I(e,r);for(let t=0;t<r;t++)F(e,n.codePointAt(t))},le=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=_(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(v(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},L=(e,t)=>{I(e,t.byteLength),le(e,t)},ue=(e,t)=>{re(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},de=(e,t)=>ue(e,4).setFloat32(0,t,!1),fe=(e,t)=>ue(e,8).setFloat64(0,t,!1),pe=(e,t)=>ue(e,8).setBigInt64(0,t,!1),me=new DataView(new ArrayBuffer(4)),he=e=>(me.setFloat32(0,e),me.getFloat32(0)===e),ge=(e,t)=>{switch(typeof t){case`string`:F(e,119),ce(e,t);break;case`number`:S(t)&&g(t)<=2147483647?(F(e,125),ae(e,t)):he(t)?(F(e,124),de(e,t)):(F(e,123),fe(e,t));break;case`bigint`:F(e,122),pe(e,t);break;case`object`:if(t===null)F(e,126);else if(p(t)){F(e,117),I(e,t.length);for(let n=0;n<t.length;n++)ge(e,t[n])}else if(t instanceof Uint8Array)F(e,116),L(e,t);else{F(e,118);let n=Object.keys(t);I(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];ce(e,i),ge(e,t[i])}}break;case`boolean`:F(e,t?120:121);break;default:F(e,127)}};var _e=class extends M{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&I(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}};let ve=e=>{e.count>0&&(ae(e.encoder,e.count===1?e.s:-e.s),e.count>1&&I(e.encoder,e.count-2))};var ye=class{constructor(){this.encoder=new M,this.s=0,this.count=0}write(e){this.s===e?this.count++:(ve(this),this.count=1,this.s=e)}toUint8Array(){return ve(this),P(this.encoder)}};let be=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);ae(e.encoder,t),e.count>1&&I(e.encoder,e.count-2)}};var xe=class{constructor(){this.encoder=new M,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(be(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return be(this),P(this.encoder)}},Se=class{constructor(){this.sarr=[],this.s=``,this.lensE=new ye}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new M;return this.sarr.push(this.s),this.s=``,ce(e,this.sarr.join(``)),le(e,this.lensE.toUint8Array()),P(e)}};let Ce=e=>Error(e),we=()=>{throw Ce(`Method unimplemented`)},Te=()=>{throw Ce(`Unexpected case`)},Ee=Ce(`Unexpected end of array`),De=Ce(`Integer out of Range`),Oe=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw Ee;return new Uint8Array(e.buffer,e.byteOffset+t,n)},ke=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw Ee;return new DataView(e.buffer,e.byteOffset+t,n)};var Ae=class{constructor(e){this.arr=e,this.pos=0}};let je=e=>new Ae(e),Me=e=>e.pos!==e.arr.length,Ne=(e,t)=>{let n=Oe(e.arr,e.pos,t);return e.pos+=t,n},R=e=>Ne(e,z(e)),Pe=e=>e.arr[e.pos++],z=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>b)throw De}throw Ee},Fe=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>b)throw De}throw Ee},Ie=A?e=>A.decode(R(e)):e=>{let t=z(e);if(t===0)return``;{let n=String.fromCodePoint(Pe(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Pe(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Le=(e,t)=>{let n=ke(e.arr,e.pos,t);return e.pos+=t,n},Re=[e=>void 0,e=>null,Fe,e=>Le(e,4).getFloat32(0,!1),e=>Le(e,8).getFloat64(0,!1),e=>Le(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Ie,e=>{let t=z(e),n={};for(let r=0;r<t;r++){let t=Ie(e);n[t]=ze(e)}return n},e=>{let t=z(e),n=[];for(let r=0;r<t;r++)n.push(ze(e));return n},R],ze=e=>Re[127-Pe(e)](e);var Be=class extends Ae{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),this.count=Me(this)?z(this)+1:-1),this.count--,this.s}},Ve=class extends Ae{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Fe(this);let e=y(this.s);this.count=1,e&&(this.s=-this.s,this.count=z(this)+2)}return this.count--,this.s}},He=class extends Ae{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Fe(this),t=e&1;this.diff=h(e/2),this.count=1,t&&(this.count=z(this)+2)}return this.s+=this.diff,this.count--,this.s}},Ue=class{constructor(e){this.decoder=new Ve(e),this.str=Ie(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;let We=crypto.getRandomValues.bind(crypto),Ge=()=>We(new Uint32Array(1))[0],Ke=()=>`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^Ge()&15>>e/4).toString(16)),qe=Date.now,Je=e=>new Promise(e);Promise.all.bind(Promise);let Ye=e=>e===void 0?null:e,Xe=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(Xe=localStorage)}catch{}let Ze=Xe,Qe=Symbol(`Equality`),$e=(e,t)=>e===t||!!e?.[Qe]?.(t)||!1,et=e=>typeof e==`object`,tt=Object.assign,nt=Object.keys,rt=(e,t)=>{for(let n in e)t(e[n],n)},it=e=>nt(e).length,at=e=>{for(let t in e)return!1;return!0},ot=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},st=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ct=(e,t)=>e===t||it(e)===it(t)&&ot(e,(e,n)=>(e!==void 0||st(t,n))&&$e(t[n],e)),lt=Object.freeze,ut=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&ut(e[t])}return lt(e)},dt=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&dt(e,t,n+1)}},ft=e=>e,pt=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Qe]!=null)return e[Qe](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!pt(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(it(e)!==it(t))return!1;for(let n in e)if(!st(e,n)||!pt(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!pt(e[n],t[n]))return!1;break;default:return!1}return!0},mt=(e,t)=>t.includes(e),ht=typeof process<`u`&&process.release&&/node|io\\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`;typeof navigator<`u`&&/Mac/.test(navigator.platform);let gt,_t=[],vt=()=>{if(gt===void 0){if(ht){gt=t();let e=process.argv,n=null;for(let t=0;t<e.length;t++){let r=e[t];r[0]===`-`?(n!==null&&gt.set(n,``),n=r):n===null?_t.push(r):(gt.set(n,r),n=null)}n!==null&&gt.set(n,``)}else typeof location==`object`?(gt=t(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);gt.set(`--${te(t,`-`)}`,n),gt.set(`-${te(t,`-`)}`,n)}})):gt=t()}return gt},yt=e=>vt().has(e),bt=e=>Ye(ht?process.env[e.toUpperCase().replaceAll(`-`,`_`)]:Ze.getItem(e)),xt=e=>yt(`--`+e)||bt(e)!==null,St=xt(`production`),Ct=ht&&mt(process.env.FORCE_COLOR,[`true`,`1`,`2`])||!yt(`--no-colors`)&&!xt(`no-color`)&&(!ht||process.stdout.isTTY)&&(!ht||yt(`--color`)||bt(`COLORTERM`)!==null||(bt(`TERM`)||``).includes(`color`)),wt=e=>new Uint8Array(e),Tt=e=>{let t=wt(e.byteLength);return t.set(e),t};var Et=class{constructor(e,t){this.left=e,this.right=t}};let Dt=(e,t)=>new Et(e,t),Ot=e=>e.next()>=.5,kt=(e,t,n)=>h(e.next()*(n+1-t)+t),At=(e,t,n)=>h(e.next()*(n+1-t)+t),jt=(e,t,n)=>At(e,t,n),Mt=e=>C(jt(e,97,122)),Nt=(e,t=0,n=20)=>{let r=jt(e,t,n),i=``;for(let t=0;t<r;t++)i+=Mt(e);return i},Pt=(e,t)=>t[jt(e,0,t.length-1)],Ft=Symbol(`0schema`);var It=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(j(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn\'t match ${n.expected}. ${n.message}`)}return e.join(`\n`)}};let Lt=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Qe]?$e(e,t):p(e)?u(e,e=>d(t,t=>Lt(e,t))):et(e)?ot(e,(e,n)=>Lt(e,t[n])):!1;var B=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Lt(t,n)}equals(e){return this.constructor===e.constructor&&pt(this.shape,e.shape)}[Ft](){return!0}[Qe](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){we()}get nullable(){return hn(this,An)}get optional(){return new Kt(this)}cast(e){return Pn(e,this),e}expect(e){return Pn(e,this),e}},Rt=class extends B{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}};let V=(e,t=null)=>new Rt(e,t);V(Rt);var zt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}};let H=e=>new zt(e);V(zt);var Bt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}};let Vt=(...e)=>new Bt(e),Ht=V(Bt),Ut=RegExp.escape||(e=>e.replace(/[().|&,$^[\\]]/g,e=>`\\\\`+e)),Wt=e=>{if(Tn.check(e))return[Ut(e)];if(Ht.check(e))return e.shape.map(e=>e+``);if(wn.check(e))return[`[+-]?\\\\d+.?\\\\d*`];if(En.check(e))return[`.*`];if(gn.check(e))return e.shape.map(Wt).flat(1);Te()};V(class extends B{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(Wt).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn\'t match string template.`),n}});let Gt=Symbol(`optional`);var Kt=class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[Gt](){return!0}};let qt=V(Kt);var Jt=class extends B{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new Jt,V(Jt);var Yt=class e extends B{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):ot(this.shape,(n,r)=>{let i=this._isPartial&&!st(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}};let Xt=e=>new Yt(e),Zt=V(Yt),Qt=H(e=>e!=null&&(e.constructor===Object||e.constructor==null));var $t=class extends B{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&ot(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn\'t match schema`:`Value doesn\'t match value`),i&&this.shape.values.check(n,t)})}};let en=(e,t)=>new $t(e,t),tn=V($t);var nn=class extends B{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&ot(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}};let rn=(...e)=>new nn(e);V(nn);var an=class extends B{constructor(e){super(),this.shape=e.length===1?e[0]:new mn(e)}check(e,t){let n=p(e)&&u(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}};let on=(...e)=>new an(e),sn=V(an),cn=H(e=>p(e));var ln=class extends B{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}};let un=(e,t=null)=>new ln(e,t);V(ln);let dn=un(B),fn=V(class extends B{constructor(e){super(),this.len=e.length-1,this.args=rn(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),pn=H(e=>typeof e==`function`);V(class extends B{constructor(e){super(),this.shape=e}check(e,t){let n=u(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var mn=class extends B{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=d(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}};let hn=(...e)=>e.findIndex(e=>gn.check(e))>=0?hn(...e.map(e=>Nn(e)).map(e=>gn.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new mn(e),gn=V(mn),_n=()=>!0,vn=H(_n),yn=V(zt,e=>e.shape===_n),bn=H(e=>typeof e==`bigint`),xn=H(e=>e===bn),Sn=H(e=>typeof e==`symbol`);H(e=>e===Sn);let Cn=H(e=>typeof e==`number`),wn=H(e=>e===Cn),Tn=H(e=>typeof e==`string`),En=H(e=>e===Tn),Dn=H(e=>typeof e==`boolean`),On=H(e=>e===Dn),kn=Vt(void 0);V(Bt,e=>e.shape.length===1&&e.shape[0]===void 0),Vt(void 0);let An=Vt(null),jn=V(Bt,e=>e.shape.length===1&&e.shape[0]===null);V(Uint8Array),V(Rt,e=>e.shape===Uint8Array);let Mn=hn(Cn,Tn,An,kn,bn,Dn,Sn);(()=>{let e=on(vn),t=en(Tn,vn),n=hn(Cn,Tn,An,Dn,e,t);return e.shape=n,t.shape.values=n,n})();let Nn=e=>{if(dn.check(e))return e;if(Qt.check(e)){let t={};for(let n in e)t[n]=Nn(e[n]);return Xt(t)}if(cn.check(e))return hn(...e.map(Nn));if(Mn.check(e))return Vt(e);if(pn.check(e))return V(e);Te()},Pn=St?()=>{}:(e,t)=>{let n=new It;if(!t.check(e,n))throw Ce(`Expected value to be of type ${t.constructor.name}.\\n${n.toString()}`)};var Fn=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Nn(e),h:t}),this}else(e){return this.if(vn,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw Ce(`Unhandled pattern`)}}};let In=(e=>new Fn(e))(vn).if(wn,(e,t)=>kt(t,x,b)).if(En,(e,t)=>Nt(t)).if(On,(e,t)=>Ot(t)).if(xn,(e,t)=>BigInt(kt(t,x,b))).if(gn,(e,t)=>Ln(t,Pt(t,e.shape))).if(Zt,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(qt.check(i)){if(Ot(t))continue;i=i.shape}n[r]=In(i,t)}return n}).if(sn,(e,t)=>{let n=[],r=At(t,0,42);for(let i=0;i<r;i++)n.push(Ln(t,e.shape));return n}).if(Ht,(e,t)=>Pt(t,e.shape)).if(jn,(e,t)=>null).if(fn,(e,t)=>{let n=Ln(t,e.res);return()=>n}).if(yn,(e,t)=>Ln(t,Pt(t,[Cn,Tn,An,kn,bn,Dn,on(Cn),en(hn(`a`,`b`,`c`),Cn)]))).if(tn,(e,t)=>{let n={},r=kt(t,0,3);for(let i=0;i<r;i++){let r=Ln(t,e.shape.keys);n[r]=Ln(t,e.shape.values)}return n}).done(),Ln=(e,t)=>In(Nn(t),e),Rn=typeof document<`u`?document:{};H(e=>e.nodeType===Un),typeof DOMParser<`u`&&new DOMParser,H(e=>e.nodeType===Bn),H(e=>e.nodeType===Vn);let zn=e=>i(e,(e,t)=>`${t}:${e};`).join(``),Bn=Rn.ELEMENT_NODE,Vn=Rn.TEXT_NODE;Rn.CDATA_SECTION_NODE,Rn.COMMENT_NODE;let Hn=Rn.DOCUMENT_NODE;Rn.DOCUMENT_TYPE_NODE;let Un=Rn.DOCUMENT_FRAGMENT_NODE;H(e=>e.nodeType===Hn);let Wn=Symbol,Gn=Wn(),Kn=Wn(),qn=Wn(),Jn=Wn(),Yn=Wn(),Xn=Wn(),Zn=Wn(),Qn=Wn(),$n=Wn(),er=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};qe();let tr={[Gn]:Dt(`font-weight`,`bold`),[Kn]:Dt(`font-weight`,`normal`),[qn]:Dt(`color`,`blue`),[Yn]:Dt(`color`,`green`),[Jn]:Dt(`color`,`grey`),[Xn]:Dt(`color`,`red`),[Zn]:Dt(`color`,`purple`),[Qn]:Dt(`color`,`orange`),[$n]:Dt(`color`,`black`)},nr=Ct?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let n=[],r=[],i=t(),a=[],o=0;for(;o<e.length;o++){let t=e[o],a=tr[t];if(a!==void 0)i.set(a.left,a.right);else{if(t===void 0)break;if(t.constructor===String||t.constructor===Number){let e=zn(i);o>0||e.length>0?(n.push(`%c`+t),r.push(e)):n.push(t)}else break}}for(o>0&&(a=r,a.unshift(n.join(``)));o<e.length;o++){let t=e[o];t instanceof Symbol||a.push(t)}return a}:er,rr=(...e)=>{console.log(...nr(e)),ar.forEach(t=>t.print(e))},ir=(...e)=>{console.warn(...nr(e)),e.unshift(Qn),ar.forEach(t=>t.print(e))},ar=o(),or=e=>({[Symbol.iterator](){return this},next:e}),sr=(e,t)=>or(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),cr=(e,t)=>or(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});var lr=class{constructor(e,t){this.clock=e,this.len=t}},ur=class{constructor(){this.clients=new Map}};let dr=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])Si(e,i,o.clock,o.len,n)}}),fr=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=h((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},pr=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&fr(n,t.clock)!==null},mr=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new lr(r.clock,v(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},hr=e=>{let t=new ur;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)c(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return mr(t),t},gr=(e,t,n,i)=>{r(e.clients,t,()=>[]).push(new lr(n,i))},_r=()=>new ur,vr=e=>{let t=_r();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new lr(i,a))}}r.length>0&&t.clients.set(n,r)}),t},yr=(e,t)=>{I(e.restEncoder,t.clients.size),l(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),I(e.restEncoder,t);let r=n.length;I(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},br=e=>{let t=new ur,n=z(e.restDecoder);for(let i=0;i<n;i++){e.resetDsCurVal();let n=z(e.restDecoder),i=z(e.restDecoder);if(i>0){let a=r(t.clients,n,()=>[]);for(let t=0;t<i;t++)a.push(new lr(e.readDsClock(),e.readDsLen()))}}return t},xr=(e,t,n)=>{let r=new ur,i=z(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=z(e.restDecoder),a=z(e.restDecoder),o=n.clients.get(i)||[],s=W(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&gr(r,i,s,a-s);let e=_i(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,Po(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,Po(t,c,a-c.id.clock)),c.delete(t))}else gr(r,i,n,a-n)}}if(r.clients.size>0){let e=new jr;return I(e.restEncoder,0),yr(e,r),e.toUint8Array()}return null},Sr=Ge;var Cr=class e extends m{constructor({guid:e=Ke(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Sr(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new mi,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Je(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>Je(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&K(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(l(this.subdocs).map(e=>e.guid))}transact(e,t=null){return K(this,e,t)}get(e,t=J){let n=r(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),i=n.constructor;if(t!==J&&i!==t){if(i===J){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}throw Error(`Type with the name ${e} has already been defined with a different constructor`)}return n}getArray(e=``){return this.get(e,wa)}getText(e=``){return this.get(e,Ga)}getMap(e=``){return this.get(e,Da)}getXmlElement(e=``){return this.get(e,Xa)}getXmlFragment(e=``){return this.get(e,Ja)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,l(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,K(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},wr=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return z(this.restDecoder)}readDsLen(){return z(this.restDecoder)}},Tr=class extends wr{readLeftID(){return U(z(this.restDecoder),z(this.restDecoder))}readRightID(){return U(z(this.restDecoder),z(this.restDecoder))}readClient(){return z(this.restDecoder)}readInfo(){return Pe(this.restDecoder)}readString(){return Ie(this.restDecoder)}readParentInfo(){return z(this.restDecoder)===1}readTypeRef(){return z(this.restDecoder)}readLen(){return z(this.restDecoder)}readAny(){return ze(this.restDecoder)}readBuf(){return Tt(R(this.restDecoder))}readJSON(){return JSON.parse(Ie(this.restDecoder))}readKey(){return Ie(this.restDecoder)}},Er=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=z(this.restDecoder),this.dsCurrVal}readDsLen(){let e=z(this.restDecoder)+1;return this.dsCurrVal+=e,e}},Dr=class extends Er{constructor(e){super(e),this.keys=[],z(e),this.keyClockDecoder=new He(R(e)),this.clientDecoder=new Ve(R(e)),this.leftClockDecoder=new He(R(e)),this.rightClockDecoder=new He(R(e)),this.infoDecoder=new Be(R(e),Pe),this.stringDecoder=new Ue(R(e)),this.parentInfoDecoder=new Be(R(e),Pe),this.typeRefDecoder=new Ve(R(e)),this.lenDecoder=new Ve(R(e))}readLeftID(){return new ei(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ei(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ze(this.restDecoder)}readBuf(){return R(this.restDecoder)}readJSON(){return ze(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},Or=class{constructor(){this.restEncoder=ne()}toUint8Array(){return P(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){I(this.restEncoder,e)}writeDsLen(e){I(this.restEncoder,e)}},kr=class extends Or{writeLeftID(e){I(this.restEncoder,e.client),I(this.restEncoder,e.clock)}writeRightID(e){I(this.restEncoder,e.client),I(this.restEncoder,e.clock)}writeClient(e){I(this.restEncoder,e)}writeInfo(e){ie(this.restEncoder,e)}writeString(e){ce(this.restEncoder,e)}writeParentInfo(e){I(this.restEncoder,+!!e)}writeTypeRef(e){I(this.restEncoder,e)}writeLen(e){I(this.restEncoder,e)}writeAny(e){ge(this.restEncoder,e)}writeBuf(e){L(this.restEncoder,e)}writeJSON(e){ce(this.restEncoder,JSON.stringify(e))}writeKey(e){ce(this.restEncoder,e)}},Ar=class{constructor(){this.restEncoder=ne(),this.dsCurrVal=0}toUint8Array(){return P(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,I(this.restEncoder,t)}writeDsLen(e){e===0&&Te(),I(this.restEncoder,e-1),this.dsCurrVal+=e}},jr=class extends Ar{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new xe,this.clientEncoder=new ye,this.leftClockEncoder=new xe,this.rightClockEncoder=new xe,this.infoEncoder=new _e(ie),this.stringEncoder=new Se,this.parentInfoEncoder=new _e(ie),this.typeRefEncoder=new ye,this.lenEncoder=new ye}toUint8Array(){let e=ne();return I(e,0),L(e,this.keyClockEncoder.toUint8Array()),L(e,this.clientEncoder.toUint8Array()),L(e,this.leftClockEncoder.toUint8Array()),L(e,this.rightClockEncoder.toUint8Array()),L(e,P(this.infoEncoder)),L(e,this.stringEncoder.toUint8Array()),L(e,P(this.parentInfoEncoder)),L(e,this.typeRefEncoder.toUint8Array()),L(e,this.lenEncoder.toUint8Array()),le(e,P(this.restEncoder)),P(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){ge(this.restEncoder,e)}writeBuf(e){L(this.restEncoder,e)}writeJSON(e){ge(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}};let Mr=(e,t,n,r)=>{r=v(r,t[0].id.clock);let i=_i(t,r);I(e.restEncoder,t.length-i),e.writeClient(n),I(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},Nr=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{W(t,n)>e&&r.set(n,e)}),hi(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),I(e.restEncoder,r.size),l(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{Mr(e,t.clients.get(n),n,r)})},Pr=(e,n)=>{let r=t(),i=z(e.restDecoder);for(let t=0;t<i;t++){let t=z(e.restDecoder),i=Array(t),a=e.readClient(),o=z(e.restDecoder);r.set(a,{i:0,refs:i});for(let r=0;r<t;r++){let t=e.readInfo();switch(31&t){case 0:{let t=e.readLen();i[r]=new Y(U(a,o),t),o+=t;break}case 10:{let t=z(e.restDecoder);i[r]=new zo(U(a,o),t),o+=t;break}default:{let s=!(t&192),c=new Z(U(a,o),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,s?e.readParentInfo()?n.get(e.readString()):e.readLeftID():null,s&&(t&32)==32?e.readString():null,Lo(e,t));i[r]=c,o+=c.length}}}}return r},Fr=(e,t,n)=>{let i=[],a=l(n.keys()).sort((e,t)=>e-t);if(a.length===0)return null;let o=()=>{if(a.length===0)return null;let e=n.get(a[a.length-1]);for(;e.refs.length===e.i;)if(a.pop(),a.length>0)e=n.get(a[a.length-1]);else return null;return e},s=o();if(s===null)return null;let c=new mi,u=new Map,d=(e,t)=>{let n=u.get(e);(n==null||n>t)&&u.set(e,t)},f=s.refs[s.i++],p=new Map,m=()=>{for(let e of i){let t=e.id.client,r=n.get(t);r?(r.i--,c.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):c.clients.set(t,[e]),a=a.filter(e=>e!==t)}i.length=0};for(;;){if(f.constructor!==zo){let a=r(p,f.id.client,()=>W(t,f.id.client))-f.id.clock;if(a<0)i.push(f),d(f.id.client,f.id.clock-1),m();else{let r=f.getMissing(e,t);if(r!==null){i.push(f);let e=n.get(r)||{refs:[],i:0};if(e.refs.length===e.i)d(r,W(t,r)),m();else{f=e.refs[e.i++];continue}}else(a===0||a<f.length)&&(f.integrate(e,a),p.set(f.id.client,f.id.clock+f.length))}}if(i.length>0)f=i.pop();else if(s!==null&&s.i<s.refs.length)f=s.refs[s.i++];else{if(s=o(),s===null)break;f=s.refs[s.i++]}}if(c.clients.size>0){let e=new jr;return Nr(e,c,new Map),I(e.restEncoder,0),{missing:u,update:e.toUint8Array()}}return null},Ir=(e,t)=>Nr(e,t.doc.store,t.beforeState),Lr=(e,t,n,r=new Dr(e))=>K(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=Pr(r,n),o=Fr(e,i,a),s=i.pendingStructs;if(s){for(let[e,n]of s.missing)if(n<W(i,e)){t=!0;break}if(o){for(let[e,t]of o.missing){let n=s.missing.get(e);(n==null||n>t)&&s.missing.set(e,t)}s.update=Vi([s.update,o.update])}}else i.pendingStructs=o;let c=xr(r,e,i);if(i.pendingDs){let t=new Dr(je(i.pendingDs));z(t.restDecoder);let n=xr(t,e,i);i.pendingDs=c&&n?Vi([c,n]):c||n}else i.pendingDs=c;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,Rr(e.doc,t)}},n,!1),Rr=(e,t,n,r=Dr)=>{let i=je(t);Lr(i,e,n,new r(i))},zr=(e,t,n)=>Rr(e,t,n,Tr),Br=(e,t,n=new Map)=>{Nr(e,t.store,n),yr(e,vr(t.store))},Vr=(e,t=new Uint8Array([0]),n=new jr)=>{let r=Wr(t);Br(n,e,r);let i=[n.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(Hi(e.store.pendingStructs.update,t)),i.length>1){if(n.constructor===kr)return zi(i.map((e,t)=>t===0?e:qi(e)));if(n.constructor===jr)return Vi(i)}return i[0]},Hr=(e,t)=>Vr(e,t,new kr),Ur=e=>{let t=new Map,n=z(e.restDecoder);for(let r=0;r<n;r++){let n=z(e.restDecoder),r=z(e.restDecoder);t.set(n,r)}return t},Wr=e=>Ur(new wr(je(e))),Gr=(e,t)=>(I(e.restEncoder,t.size),l(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{I(e.restEncoder,t),I(e.restEncoder,n)}),e),Kr=(e,t)=>Gr(e,hi(t.store)),qr=(e,t=new Ar)=>(e instanceof Map?Gr(t,e):Kr(t,e),t.toUint8Array()),Jr=e=>qr(e,new Or);var Yr=class{constructor(){this.l=[]}};let Xr=()=>new Yr,Zr=(e,t)=>e.l.push(t),Qr=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn\'t exist.`)},$r=(e,t,n)=>dt(e.l,[t,n]);var ei=class{constructor(e,t){this.client=e,this.clock=t}};let ti=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,U=(e,t)=>new ei(e,t),ni=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw Te()},ri=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};var ii=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},ai=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}};let oi=(e,t,n=0)=>new ai(e,t,n),si=(e,t,n)=>{let r=null,i=null;return e._item===null?i=ni(e):r=U(e._item.id.client,e._item.id.clock),new ii(r,i,t,n)},ci=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return si(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return si(e,U(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return si(e,r.lastId,n);r=r.right}return si(e,null,n)},li=(e,t)=>{let n=vi(e,t);return{item:n,diff:t.clock-n.id.clock}},ui=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(W(r,i.client)<=i.clock)return null;let e=n?Mo(r,i):li(r,i),t=e.item;if(!(t instanceof Z))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(W(r,a.client)<=a.clock)return null;let{item:e}=n?Mo(r,a):{item:vi(r,a)};if(e instanceof Z&&e.content instanceof Ao)c=e.content.type;else return null}else throw Te();l=s>=0?c._length:0}return oi(c,l,e.assoc)};var di=class{constructor(e,t){this.ds=e,this.sv=t}};((e,t)=>new di(e,t))(_r(),new Map);let fi=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!pr(t.ds,e.id),pi=(e,t)=>{let n=r(e.meta,pi,o),i=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<W(i,n)&&G(e,U(n,t))}),dr(e,t.ds,e=>{}),n.add(t))};var mi=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}};let hi=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},W=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},gi=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw Te()}n.push(t)},_i=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=h(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=h((n+r)/2)}throw Te()},vi=(e,t)=>{let n=e.clients.get(t.client);return n[_i(n,t.clock)]},yi=(e,t,n)=>{let r=_i(t,n),i=t[r];return i.id.clock<n&&i instanceof Z?(t.splice(r+1,0,Po(e,i,n-i.id.clock)),r+1):r},G=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[yi(e,n,t.clock)]},bi=(e,t,n)=>{let r=t.clients.get(n.client),i=_i(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==Y&&r.splice(i+1,0,Po(e,a,n.clock-a.id.clock+1)),a},xi=(e,t,n)=>{let r=e.clients.get(t.id.client);r[_i(r,t.id.clock)]=n},Si=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=yi(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&yi(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)};var Ci=class{constructor(e,t,n){this.doc=e,this.deleteSet=new ur,this.beforeState=hi(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}};let wi=(e,t)=>t.deleteSet.clients.size===0&&!a(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(mr(t.deleteSet),Ir(e,t),yr(e,t.deleteSet),!0),Ti=(e,t,n)=>{let i=t._item;(i===null||i.id.clock<(e.beforeState.get(i.id.client)||0)&&!i.deleted)&&r(e.changed,t,o).add(n)},Ei=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Z&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},Di=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=_i(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof Z&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},Oi=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=_(r.length-1,1+_i(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+Ei(r,e)}})},ki=(e,t,n)=>{Di(e,t,n),Oi(e,t)},Ai=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{mr(a),n.afterState=hi(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{$r(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&Ha(n)})}),dt(e,[])}finally{r.gc&&Di(a,i,r.gcFilter),Oi(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=v(_i(e,r),1);for(let t=e.length-1;t>=n;)t-=1+Ei(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=_i(r,n);a+1<r.length&&Ei(r,a+1)>1||a>0&&Ei(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(rr(Qn,Gn,`[yjs] `,Kn,Xn,`Changed the client-id because another client seems to be using it.`),r.clientID=Sr()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new kr;wi(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new jr;wi(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):Ai(e,t+1)}}},K=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new Ci(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&Ai(i,0)}}return o};var ji=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}};let Mi=(e,t,n)=>{dr(e,n.deletions,n=>{n instanceof Z&&t.scope.some(t=>t===e.doc||ri(t,n))&&No(n,!1)})},Ni=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;K(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;dr(n,o.insertions,e=>{if(e instanceof Z){if(e.redone!==null){let{item:t,diff:i}=Mo(r,e.id);i>0&&(t=G(n,U(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||ri(t,e))&&c.push(e)}}),dr(n,o.deletions,e=>{e instanceof Z&&a.some(t=>t===n.doc||ri(t,e))&&!pr(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=Io(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o};var Pi=class extends m{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=p(e)?e[0].doc:e instanceof Cr?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new ur;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&gr(i,n,r,a)});let a=qe(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=hr([t.deletions,e.deleteSet]),t.insertions=hr([t.insertions,i])}else r.push(new ji(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),dr(e,e.deleteSet,t=>{t instanceof Z&&this.scope.some(n=>n===e.doc||ri(n,t))&&No(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.destroy=this.destroy.bind(this),this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,this.destroy)}addToScope(e){let t=new Set(this.scope);e=p(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof J?e.doc!==this.doc:e!==this.doc)&&ir(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>Mi(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>Mi(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Ni(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Ni(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),this.doc.off(`destroy`,this.destroy),super.destroy()}};function*Fi(e){let t=z(e.restDecoder);for(let n=0;n<t;n++){let t=z(e.restDecoder),n=e.readClient(),r=z(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=z(e.restDecoder);yield new zo(U(n,r),t),r+=t}else if(31&t){let i=!(t&192),a=new Z(U(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,Lo(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new Y(U(n,r),t),r+=t}}}}var Ii=class{constructor(e,t){this.gen=Fi(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===zo);return this.curr}};let Li=(e,t=Dr)=>{let n=[],r=new t(je(e)),i=new Ii(r,!1);for(let e=i.curr;e!==null;e=i.next())n.push(e);return{structs:n,ds:br(r)}};var Ri=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}};let zi=e=>Vi(e,Tr,kr),Bi=(e,t)=>{if(e.constructor===Y){let{client:n,clock:r}=e.id;return new Y(U(n,r+t),e.length-t)}if(e.constructor===zo){let{client:n,clock:r}=e.id;return new zo(U(n,r+t),e.length-t)}{let n=e,{client:r,clock:i}=n.id;return new Z(U(r,i+t),null,U(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},Vi=(e,t=Dr,n=jr)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(je(e))),i=r.map(e=>new Ii(e,!0)),a=null,o=new n,s=new Ri(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===zo?1:-1:n}return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)Wi(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock){if(a.struct.constructor===zo)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{Wi(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new zo(U(t,a.struct.id.clock+a.struct.length),e),offset:0}}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===zo?a.struct.length-=t:n=Bi(n,t)),a.struct.mergeWith(n)||(Wi(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==zo;n=e.next())Wi(s,a.struct,a.offset),a={struct:n,offset:0}}a!==null&&(Wi(s,a.struct,a.offset),a=null),Gi(s);let c=r.map(e=>br(e)),l=hr(c);return yr(o,l),o.toUint8Array()},Hi=(e,t,n=Dr,r=jr)=>{let i=Wr(t),a=new r,o=new Ri(a),s=new n(je(e)),c=new Ii(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===zo){c.next();continue}if(e.id.clock+e.length>n)for(Wi(o,e,v(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)Wi(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}Gi(o);let l=br(s);return yr(a,l),a.toUint8Array()},Ui=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:P(e.encoder.restEncoder)}),e.encoder.restEncoder=ne(),e.written=0)},Wi=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Ui(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),I(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},Gi=e=>{Ui(e);let t=e.encoder.restEncoder;I(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];I(t,r.written),le(t,r.restEncoder)}},Ki=(e,t,n,r)=>{let i=new n(je(e)),a=new Ii(i,!1),o=new r,s=new Ri(o);for(let e=a.curr;e!==null;e=a.next())Wi(s,t(e),0);Gi(s);let c=br(i);return yr(o,c),o.toUint8Array()},qi=e=>Ki(e,ft,Dr,kr),Ji=`You must not compute changes after the event-handler fired.`;var Yi=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=Xi(this.currentTarget,this.target)}deletes(e){return pr(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ce(Ji);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r)){if(e!==null&&this.deletes(e))i=`delete`,a=s(e.content.getContent());else return}else e!==null&&this.deletes(e)?(i=`update`,a=s(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=s(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ce(Ji);let t=this.target,n=o(),r=o(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}};let Xi=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},q=()=>{ir(`Invalid access: Add Yjs type to a document before reading data.`)},Zi=0;var Qi=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Zi++}};let $i=e=>{e.timestamp=Zi++},ea=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Zi++},ta=(e,t,n)=>{if(e.length>=80){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return ea(r,t,n),r}{let r=new Qi(t,n);return e.push(r),r}},na=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>g(t-e.index)<g(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,$i(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&g(n.index-i)<r.parent.length/80?(ea(n,r,i),n):ta(e._searchMarker,r,i)},ra=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=v(t,i.index+n))}},ia=(e,t,n)=>{let i=e,a=t.changedParentTypes;for(;r(a,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;$r(i._eH,n,t)};var J=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Xr(),this._dEH=Xr(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw we()}clone(){throw we()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Zr(this._eH,e)}observeDeep(e){Zr(this._dEH,e)}unobserve(e){Qr(this._eH,e)}unobserveDeep(e){Qr(this._dEH,e)}toJSON(){}};let aa=(e,t,n)=>{e.doc??q(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},oa=e=>{e.doc??q();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},sa=(e,t)=>{let n=0,r=e._start;for(e.doc??q();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},ca=(e,t)=>{let n=[];return sa(e,(r,i)=>{n.push(t(r,i,e))}),n},la=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},ua=(e,t)=>{e.doc??q();let n=na(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},da=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new vo(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new io(new Uint8Array(n))),i.integrate(e,0);break;case Cr:i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new lo(n)),i.integrate(e,0);break;default:if(n instanceof J)i=new Z(U(o,W(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ao(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},fa=()=>Ce(`Length exceeded!`),pa=(e,t,n,r)=>{if(n>t._length)throw fa();if(n===0)return t._searchMarker&&ra(t._searchMarker,n,r.length),da(e,t,null,r);let i=n,a=na(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&G(e,U(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&ra(t._searchMarker,i,r.length),da(e,t,o,r)},ma=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return da(e,t,r,n)},ha=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=na(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&G(e,U(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&G(e,U(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw fa();t._searchMarker&&ra(t._searchMarker,i,-a+r)},ga=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},_a=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new vo([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new vo([r]);break;case Uint8Array:s=new io(r);break;case Cr:s=new lo(r);break;default:if(r instanceof J)s=new Ao(r);else throw Error(`Unexpected content type`)}new Z(U(o,W(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},va=(e,t)=>{e.doc??q();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},ya=e=>{let t={};return e.doc??q(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},ba=(e,t)=>{e.doc??q();let n=e._map.get(t);return n!==void 0&&!n.deleted},xa=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&fi(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Sa=e=>(e.doc??q(),sr(e._map.entries(),e=>!e[1].deleted));var Ca=class extends Yi{},wa=class e extends J{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}get length(){return this.doc??q(),this._length}_callObserver(e,t){super._callObserver(e,t),ia(this,e,new Ca(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):K(this.doc,n=>{pa(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):K(this.doc,t=>{ma(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):K(this.doc,n=>{ha(n,this,e,t)})}get(e){return ua(this,e)}toArray(){return oa(this)}slice(e=0,t=this.length){return aa(this,e,t)}toJSON(){return this.map(e=>e instanceof J?e.toJSON():e)}map(e){return ca(this,e)}forEach(e){sa(this,e)}[Symbol.iterator](){return la(this)}_write(e){e.writeTypeRef(Co)}};let Ta=e=>new wa;var Ea=class extends Yi{constructor(e,t,n){super(e,t),this.keysChanged=n}},Da=class e extends J{constructor(e){super(),this._prelimContent=null,this._prelimContent=e===void 0?new Map:new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof J?e.clone():e)}),t}_callObserver(e,t){ia(this,e,new Ea(this,e,t))}toJSON(){this.doc??q();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof J?r.toJSON():r}}),e}get size(){return[...Sa(this)].length}keys(){return cr(Sa(this),e=>e[0])}values(){return cr(Sa(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return cr(Sa(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??q(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):K(this.doc,t=>{ga(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):K(this.doc,n=>{_a(n,this,e,t)}),t}get(e){return va(this,e)}has(e){return ba(this,e)}clear(){this.doc===null?this._prelimContent.clear():K(this.doc,e=>{this.forEach(function(t,n,r){ga(e,r,n)})})}_write(e){e.writeTypeRef(wo)}};let Oa=e=>new Da,ka=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&ct(e,t);var Aa=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&Te(),this.right.content.constructor){case X:this.right.deleted||Pa(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length)}this.left=this.right,this.right=this.right.right}};let ja=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case X:t.right.deleted||Pa(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&G(e,U(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length)}t.left=t.right,t.right=t.right.right}return t},Ma=(e,t,n,r)=>{let i=new Map,a=r?na(t,n):null;if(a){let t=new Aa(a.p.left,a.p,a.index,i);return ja(e,t,n-a.index)}{let r=new Aa(null,t._start,0,i);return ja(e,r,n)}},Na=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===X&&ka(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new Z(U(a,W(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new X(o,r));l.integrate(e,0),n.right=l,n.forward()})},Pa=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},Fa=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===X&&ka(t[e.right.content.key]??null,e.right.content.value));)e.forward()},Ia=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!ka(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new Z(U(a,W(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new X(s,c)),n.right.integrate(e,0),n.forward()}}return o},La=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;Fa(n,i);let s=Ia(e,t,n,i),c=r.constructor===String?new bo(r):r instanceof J?new Ao(r):new fo(r),{left:l,right:u,index:d}=n;t._searchMarker&&ra(t._searchMarker,n.index,c.getLength()),u=new Z(U(o,W(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),Na(e,t,n,s)},Ra=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;Fa(n,i);let s=Ia(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===X));){if(!n.right.deleted)switch(n.right.content.constructor){case X:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(ka(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&G(e,U(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`\n`;n.right=new Z(U(o,W(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new bo(i)),n.right.integrate(e,0),n.forward()}Na(e,t,n,s)},za=(e,n,r,i,a)=>{let o=n,s=t();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===X){let e=o.content;s.set(e.key,e)}o=o.right}let c=0,l=!1;for(;n!==o;){if(r===n&&(l=!0),!n.deleted){let t=n.content;switch(t.constructor){case X:{let{key:r,value:o}=t,u=i.get(r)??null;(s.get(r)!==t||u===o)&&(n.delete(e),c++,!l&&(a.get(r)??null)===o&&u!==o&&(u===null?a.delete(r):a.set(r,u))),!l&&!n.deleted&&Pa(a,t);break}}}n=n.right}return c},Ba=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===X){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},Va=e=>{let r=0;return K(e.doc,i=>{let a=e._start,o=e._start,s=t(),c=n(s);for(;o;){if(o.deleted===!1)switch(o.content.constructor){case X:Pa(c,o.content);break;default:r+=za(i,a,o,s,c),s=n(c),a=o}o=o.right}}),r},Ha=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&Si(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===X&&e.constructor!==Y&&t.add(e.parent)})}K(n,n=>{dr(e,e.deleteSet,e=>{if(e instanceof Y||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===X?t.add(r):Ba(n,e)});for(let e of t)Va(e)})},Ua=(e,t,r)=>{let i=r,a=n(t.currentAttributes),o=t.right;for(;r>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Ao:case fo:case bo:r<t.right.length&&G(e,U(t.right.id.client,t.right.id.clock+r)),r-=t.right.length,t.right.delete(e)}t.forward()}o&&za(e,o,t.right,a,t.currentAttributes);let s=(t.left||t.right).parent;return s._searchMarker&&ra(s._searchMarker,t.index,-i+r),t};var Wa=class extends Yi{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];K(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},at(o)||(e.attributes=tt({},o))),c=0}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case Ao:case fo:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case bo:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case X:{let{key:t,value:s}=i.content;if(this.adds(i)){if(!this.deletes(i)){let c=n.get(t)??null;ka(c,s)?s!==null&&i.delete(e):(a===`retain`&&u(),ka(s,r.get(t)??null)?delete o[t]:o[t]=s)}}else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;ka(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(ka(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),Pa(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},Ga=class e extends J{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??q(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new Wa(this,e,t);ia(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??q();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===bo&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):K(this.doc,n=>{let r=new Aa(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`\n`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&La(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&Ua(n,r,a.delete):Ra(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??q();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(fi(s,e)||t!==void 0&&fi(s,t))switch(s.content.constructor){case bo:{let r=i.get(`ychange`);e!==void 0&&!fi(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!fi(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case Ao:case fo:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case X:fi(s,e)&&(c(),Pa(i,s.content))}s=s.right}c()};return e||t?K(a,n=>{e&&pi(n,e),t&&pi(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):K(r,r=>{let i=Ma(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),La(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):K(r,r=>{let i=Ma(r,this,e,!n);La(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):K(n,n=>{Ua(n,Ma(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):K(r,r=>{let i=Ma(r,this,e,!1);i.right!==null&&Ra(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):K(this.doc,t=>{ga(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):K(this.doc,n=>{_a(n,this,e,t)})}getAttribute(e){return va(this,e)}getAttributes(){return ya(this)}_write(e){e.writeTypeRef(To)}};let Ka=e=>new Ga;var qa=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??q()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===Xa||t.constructor===Ja)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},Ja=class e extends J{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}get length(){return this.doc??q(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new qa(this,e)}querySelector(e){e=e.toUpperCase();let t=new qa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),l(new qa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){ia(this,e,new Qa(this,t,e))}toString(){return ca(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),sa(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):K(this.doc,n=>{pa(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)K(this.doc,n=>{let r=e&&e instanceof J?e._item:e;da(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw Ce(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):K(this.doc,n=>{ha(n,this,e,t)})}toArray(){return oa(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return ua(this,e)}slice(e=0,t=this.length){return aa(this,e,t)}forEach(e){sa(this,e)}_write(e){e.writeTypeRef(Do)}};let Ya=e=>new Ja;var Xa=class e extends Ja{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),n=this.getAttributes();return rt(n,(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof J?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):K(this.doc,t=>{ga(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):K(this.doc,n=>{_a(n,this,e,t)})}getAttribute(e){return va(this,e)}hasAttribute(e){return ba(this,e)}getAttributes(e){return e?xa(this,e):ya(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return sa(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Eo),e.writeKey(this.nodeName)}};let Za=e=>new Xa(e.readKey());var Qa=class extends Yi{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},$a=class e extends Da{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(Oo),e.writeKey(this.hookName)}};let eo=e=>new $a(e.readKey());var to=class e extends Ga{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ko)}};let no=e=>new to;var ro=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw we()}mergeWith(e){return!1}write(e,t,n){throw we()}integrate(e,t){throw we()}},Y=class extends ro{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),gi(e.doc.store,this)}write(e,t){e.writeInfo(0),e.writeLen(this.length-t)}getMissing(e,t){return null}},io=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw we()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}};let ao=e=>new io(e.readBuf());var oo=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){gr(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}};let so=e=>new oo(e.readLen()),co=(e,t)=>new Cr({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});var lo=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(co(this.doc.guid,this.opts))}splice(e){throw we()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}};let uo=e=>new lo(co(e.readString(),e.readAny()));var fo=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw we()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}};let po=e=>new fo(e.readJSON());var X=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw we()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}};let mo=e=>new X(e.readKey(),e.readJSON());var ho=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}};let go=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new ho(n)},_o=bt(`node_env`)===`development`;var vo=class e{constructor(e){this.arr=e,_o&&ut(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}};let yo=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new vo(n)};var bo=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}};let xo=e=>new bo(e.readString()),So=[Ta,Oa,Ka,Za,Ya,eo,no],Co=0,wo=1,To=2,Eo=3,Do=4,Oo=5,ko=6;var Ao=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw we()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}};let jo=e=>new Ao(So[e.readTypeRef()](e)),Mo=(e,t)=>{let n=t,r=0,i;do r>0&&(n=U(n.client,n.clock+r)),i=vi(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Z);return{item:i,diff:r}},No=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},Po=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new Z(U(r,i+n),t,U(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=U(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},Fo=(e,t)=>d(e,e=>pr(e.deletions,t)),Io=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return G(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||Io(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=G(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:G(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:G(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||pr(r,d.right.id)||Fo(a.undoStack,d.right.id)||Fo(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=G(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=p._map.get(t.parentSub)||null)}let m=W(s,c),h=U(c,m),g=new Z(h,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=h,No(g,!0),g.integrate(e,0),g};var Z=class e extends ro{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=W(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=W(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ei&&this.id.client!==this.parent.client&&this.parent.clock>=W(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=bi(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=G(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===Y||this.right&&this.right.constructor===Y)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ei){let e=vi(n,this.parent);this.parent=e.constructor===Y?null:e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=bi(e,e.doc.store,U(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),ti(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(ti(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(vi(e.doc.store,n.origin)))r.has(vi(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),gi(e.doc.store,this),this.content.integrate(e,this),Ti(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Y(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:U(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ti(e.origin,this.lastId)&&this.right===e&&ti(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),gr(e.deleteSet,this.id.client,this.id.clock,this.length),Ti(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw Te();this.content.gc(e),t?xi(e,this,new Y(this.id,this.length)):this.content=new oo(this.length)}write(e,t){let n=t>0?U(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=ni(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===ei?(e.writeParentInfo(!1),e.writeLeftID(t)):Te();i!==null&&e.writeString(i)}this.content.write(e,t)}};let Lo=(e,t)=>Ro[t&31](e),Ro=[()=>{Te()},so,go,ao,xo,po,mo,jo,yo,uo,()=>{Te()}];var zo=class extends ro{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){Te()}write(e,t){e.writeInfo(10),I(e.restEncoder,this.length-t)}getMissing(e,t){return null}};let Bo=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},Vo=`__ $YJS$ __`;Bo[Vo]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),Bo[Vo]=!0;let Q=Object.freeze({stateBytes:262144,updateBytes:32768,textLength:32768,clients:128,structs:16384,historyUnits:1048576,undoEntries:100,undoUnits:32768}),Ho=new TextEncoder,Uo=(e,t)=>{throw Object.assign(Error(t),{code:e})},$=(e,t,n)=>{e||Uo(t,n)},Wo=e=>Number.isSafeInteger(e)&&e>=0,Go=e=>{$(typeof e==`string`,`SHARED_TEXT_INPUT`,`Shared text must be a string`),$(e.length<=Q.textLength,`SHARED_TEXT_LIMIT`,`Shared text exceeds its character limit`);for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(++t);$(n>=56320&&n<=57343,`SHARED_TEXT_INPUT`,`Shared text contains an incomplete Unicode character`)}else $(n<56320||n>57343,`SHARED_TEXT_INPUT`,`Shared text contains an incomplete Unicode character`)}return e};function Ko(e){$(e instanceof Uint8Array,`SHARED_TEXT_INPUT`,`Expected shared text bytes`);let t=``;for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)}function qo(e,t=Q.updateBytes){$(typeof e==`string`&&e.length>0&&e.length<=4*Math.ceil(t/3),`SHARED_TEXT_LIMIT`,`Shared text data exceeds its byte limit`),$(e.length%4==0&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e),`SHARED_TEXT_INPUT`,`Expected canonical base64 shared text data`);let n=atob(e);$(n.length<=t,`SHARED_TEXT_LIMIT`,`Shared text data exceeds its byte limit`);let r=Uint8Array.from(n,e=>e.charCodeAt(0));return $(Ko(r)===e,`SHARED_TEXT_INPUT`,`Expected canonical base64 shared text data`),r}function Jo(e){let t;class n extends Tr{constructor(e){super(e),t=e}}let r=Li(e,n);$(t.pos===e.length,`SHARED_TEXT_STATE`,`Shared text data contains trailing bytes`),$(r.structs.length<=Q.structs&&r.ds.clients.size<=Q.clients,`SHARED_TEXT_LIMIT`,`Shared text history exceeds its limit`);let i=0,a=0,o=new Map;for(let e of r.structs)$(Wo(e.id.client)&&Wo(e.id.clock)&&Wo(e.length)&&e.length>0,`SHARED_TEXT_STATE`,`Invalid shared text history`),$(!o.has(e.id.client)||e.id.clock>=o.get(e.id.client),`SHARED_TEXT_STATE`,`Shared text history overlaps itself`),o.set(e.id.client,e.id.clock+e.length),i+=e.length,$(e.id.clock+e.length<=Q.historyUnits&&i<=Q.historyUnits,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),e instanceof Z?($(e.parentSub===null&&(e.parent===null||typeof e.parent!=`string`||e.parent===`text`),`SHARED_TEXT_STATE`,`Shared text accepts only its plaintext field`),$(e.content instanceof bo||e.content instanceof oo,`SHARED_TEXT_STATE`,`Shared text cannot contain formatting, embedded values or other shared types`),e.content instanceof bo&&Go(e.content.str)):$(e instanceof Y,`SHARED_TEXT_STATE`,`Unsupported shared text history`);for(let[e,t]of r.ds.clients){$(Wo(e),`SHARED_TEXT_STATE`,`Invalid shared text deletion`),a+=t.length,$(a<=Q.structs,`SHARED_TEXT_LIMIT`,`Shared text deletion history exceeds its limit`);for(let e of t)$(Wo(e.clock)&&Wo(e.len)&&e.len>0&&e.clock+e.len<=Q.historyUnits,`SHARED_TEXT_STATE`,`Invalid shared text deletion`)}return r}function Yo(e,t){let n=new Map;for(let e of t.structs){let t=n.get(e.id.client)||[];t.push(e),n.set(e.id.client,t)}let r=(t,r)=>{let i=e=>{if(!e)return;let t=0,n=e.length;for(;t<n;){let i=t+n>>>1;e[i].id.clock<=r?t=i+1:n=i}let i=e[t-1];return i&&r<i.id.clock+i.length?i:void 0};return i(e.store.clients.get(t))||i(n.get(t))},i=(e,t)=>{let n=r(e,t);if(n instanceof Z&&n.content instanceof bo){let e=t-n.id.clock,r=n.content.str;$(ts(r,e),`SHARED_TEXT_STATE`,`Shared text update splits a Unicode character`)}};for(let e of t.structs)e instanceof Z&&(e.origin&&i(e.origin.client,e.origin.clock+1),e.rightOrigin&&i(e.rightOrigin.client,e.rightOrigin.clock));for(let[e,n]of t.ds.clients)for(let t of n)i(e,t.clock),i(e,t.clock+t.len)}function Xo(e){let t=e.getText(`text`);$(e.share.size===1&&e.share.get(`text`)===t&&t._map.size===0&&e.getSubdocs().size===0,`SHARED_TEXT_STATE`,`Shared text accepts only its plaintext field`),$(e.store.pendingStructs===null&&e.store.pendingDs===null,`SHARED_TEXT_STATE`,`Shared text update is missing earlier history`),$(e.store.clients.size<=Q.clients,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`);let n=0,r=0;for(let i of e.store.clients.values())for(let e of i)n++,r+=e.length,$(n<=Q.structs&&r<=Q.historyUnits,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),e instanceof Z?$(e.parent===t&&e.parentSub===null&&(e.content instanceof bo||e.content instanceof oo),`SHARED_TEXT_STATE`,`Shared text contains unsupported history`):$(e instanceof Y,`SHARED_TEXT_STATE`,`Unsupported shared text history`);for(let e of t.toDelta())$(typeof e.insert==`string`&&e.attributes===void 0,`SHARED_TEXT_STATE`,`Shared text cannot contain formatting or embedded values`);return Go(t.toString())}function Zo(e,t,n){let r=qo(t,n);Yo(e,Jo(r)),zr(e,r),Xo(e)}function Qo(e){let t=new Cr;t.getText(`text`);try{return Zo(t,e,Q.stateBytes),t}catch(e){throw t.destroy(),e}}function $o(e){let t=Xo(e),n=Hr(e);return $(n.length<=Q.stateBytes,`SHARED_TEXT_LIMIT`,`Shared text history needs a new epoch`),{state:Ko(n),value:t}}function es(e){try{return e()}catch(e){if(typeof e?.code==`string`&&e.code.startsWith(`SHARED_TEXT_`))throw e;Uo(`SHARED_TEXT_STATE`,`Invalid shared text data`)}}let ts=(e,t)=>Wo(t)&&t<=e.length&&!(t>0&&t<e.length&&e.charCodeAt(t-1)>=55296&&e.charCodeAt(t-1)<=56319&&e.charCodeAt(t)>=56320&&e.charCodeAt(t)<=57343),ns=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function rs({protocol:e,epoch:t,state:n}){$(e===1&&typeof t==`string`&&ns.test(t),`SHARED_TEXT_INPUT`,`Expected a versioned shared text epoch`);let r=es(()=>Qo(n)),i=r.getText(`text`),a={},o={},s=new WeakMap,c=new Pi(i,{trackedOrigins:new Set([a]),captureTimeout:0}),l=!1,u=null,d=()=>{if($(!l,`SHARED_TEXT_CLOSED`,`Shared text session is closed`),u)throw u},f=e=>{throw u=e,e},p=(e=[])=>{let t=e=>[...e.deletions.clients.values()].reduce((e,t)=>e+t.reduce((e,t)=>e+t.len,0),0),n=[...c.undoStack,...c.redoStack].reduce((e,n)=>e+t(n),0);for(;c.undoStack.length+c.redoStack.length>Q.undoEntries||n>Q.undoUnits;){let r=(c.undoStack.length?c.undoStack:c.redoStack).shift();n-=t(r),e.push(r.deletions)}if(!e.length)return;let i=hr(e);r.transact(e=>{dr(e,i,e=>{e instanceof Z&&(e.keep=!1)});for(let t of[...c.undoStack,...c.redoStack])dr(e,t.deletions,e=>{e instanceof Z&&(e.keep=!0)});ki(i,r.store,()=>!0)},o)},m=e=>{d();let t=c.redoStack.map(e=>e.deletions);try{return r.transact(e,a),p(t),i.toString()}catch(e){return f(e)}},h=e=>{d();let t=c[e](),n;try{n=Go(i.toString())}catch(n){throw t&&c[e===`undo`?`redo`:`undo`](),n}try{return p(),n}catch(e){return f(e)}};return Object.freeze({getValue(){return $(!l,`SHARED_TEXT_CLOSED`,`Shared text session is closed`),i.toString()},splice(e,t,n=``){d();let r=i.toString();return Go(n),$(Wo(t)&&ts(r,e)&&ts(r,e+t),`SHARED_TEXT_INPUT`,`Choose complete characters within the shared text`),$(r.length-t+n.length<=Q.textLength&&Ho.encode(n).length+1024<=Q.updateBytes,`SHARED_TEXT_LIMIT`,`Shared text edit exceeds its limit`),!t&&!n?r:m(()=>{t&&i.delete(e,t),n&&i.insert(e,n)})},captureSelection(e,t=e,n=`none`){d();let r=i.toString();$(ts(r,e)&&ts(r,t)&&e<=t&&[`none`,`forward`,`backward`].includes(n),`SHARED_TEXT_INPUT`,`Invalid shared text selection`);let a=Object.freeze({});return s.set(a,{start:ci(i,e),end:ci(i,t),direction:n}),a},resolveSelection(e){d(),$(e&&s.has(e),`SHARED_TEXT_INPUT`,`Selection belongs to another shared text session`);let t=s.get(e),n=ui(t.start,r),a=ui(t.end,r);return $(n?.type===i&&a?.type===i,`SHARED_TEXT_STATE`,`Shared text selection is unavailable`),{start:Math.min(n.index,a.index),end:Math.max(n.index,a.index),direction:t.direction}},receive(n){return d(),$(n?.protocol===e&&n.epoch===t,`SHARED_TEXT_STATE`,`Shared text epoch changed; retain the local draft and reopen explicitly`),es(()=>{let e=Qo(Ko(Hr(r)));try{Zo(e,n.state,Q.stateBytes),$o(e)}finally{e.destroy()}return zr(r,qo(n.state,Q.stateBytes),o),i.toString()})},getUpdateSince(n){return d(),$(n?.protocol===e&&n.epoch===t,`SHARED_TEXT_STATE`,`Shared text epoch changed; retain the local draft and reopen explicitly`),es(()=>{let i=Qo(n.state);try{$o(r);let n=Hr(r,Jr(i));return $(n.length<=Q.updateBytes,`SHARED_TEXT_LIMIT`,`Shared text batch exceeds its limit`),{protocol:e,epoch:t,update:Ko(n)}}finally{i.destroy()}})},undo(){return h(`undo`)},redo(){return h(`redo`)},canUndo(){return!l&&c.undoStack.length>0},canRedo(){return!l&&c.redoStack.length>0},checkpoint(){return d(),es(()=>({protocol:e,epoch:t,...$o(r)}))},dispose(){l||(l=!0,c.destroy(),r.destroy())}})}function is(e,t,n,r=null,i=[]){let a=new Map,o=[`text`,`search`,`email`,`tel`,`url`],s=new Set(i),c=new Map,l=new Set,u=new Map,d=!1,f=(e,t)=>{if(clearTimeout(t.timer),c.delete(e),d)return;let r;return r=Promise.resolve().then(()=>{if(!d)return t.callback()}).catch(t=>{u.set(e,t),n(t.message)}).finally(()=>l.delete(r)),l.add(r),r},p=(e,t)=>{if(d||typeof e!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)||typeof t!=`function`)throw Error(`Use a named shared edit callback`);if(!c.has(e)&&c.size+l.size>=32||!u.has(e)&&u.size>=32)throw Error(`Too many scheduled shared edits`);u.delete(e);let n=c.get(e),r={callback:t,started:n?.started??Date.now(),timer:null};n&&clearTimeout(n.timer),r.timer=setTimeout(()=>f(e,r),Math.max(0,Math.min(150,500-(Date.now()-r.started)))),c.set(e,r)},m=(i,c)=>{if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(i)||a.has(i))throw Error(`Use one control per named shared field`);let l=e.getElementById(c),u=l?.tagName===`FIELDSET`?[...l.querySelectorAll(`input[type="radio"]`)]:null;if(!l||![`INPUT`,`TEXTAREA`,`SELECT`,`FIELDSET`].includes(l.tagName)||u&&!u.length||l.tagName===`INPUT`&&![`text`,`search`,`email`,`tel`,`url`,`number`,`range`,`checkbox`,`color`].includes(l.type))throw Error(`Bind an existing text, number, checkbox or select control, or a fieldset of radio buttons`);if(s.has(i)){let e=l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type),t=l.disabled,n=l.readOnly,r=l.getAttribute(`title`),s=l.getAttribute(`aria-readonly`),c=l.getAttribute(`aria-disabled`);e?(l.readOnly=!0,l.setAttribute(`aria-readonly`,`true`)):(l.disabled=!0,l.setAttribute(`aria-disabled`,`true`)),l.setAttribute(`title`,`Connected input. Change its source in Flow.`);let u={flush:async()=>{},status:()=>({dirty:!1,saving:!1,problem:null,canEdit:!1,composing:!1,interrupted:!1}),setDefault(){},dispose(){l.disabled=t,l.readOnly=n,r===null?l.removeAttribute(`title`):l.setAttribute(`title`,r),s===null?l.removeAttribute(`aria-readonly`):l.setAttribute(`aria-readonly`,s),c===null?l.removeAttribute(`aria-disabled`):l.setAttribute(`aria-disabled`,c),a.delete(i)}};return a.set(i,u),u.dispose}if(r&&(l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type))){let e=r.bind(i,l),t=e.dispose;return e.dispose=()=>{t(),a.delete(i)},a.set(i,e),e.dispose}let d=l.disabled,f={exists:!1},p,m=!1,h=!1,g=null,_=!1,v=!1,y=null,b=null,x=null,S=!1,C=!1,w,ee=l.tagName===`TEXTAREA`||l.tagName===`INPUT`&&o.includes(l.type),T=e=>{b=e,l.setCustomValidity(e.message),n(e.message)},E=()=>u.find(e=>e.checked)?.value??``,te=e=>{let n=u?E():l.type===`checkbox`?l.checked:l.value;if(u)for(let t of u)t.checked=t.value===String(e??``);else l.type===`checkbox`?l.checked=!!e:l.value!==String(e??``)&&(l.value=String(e??``));(u?E():l.type===`checkbox`?l.checked:l.value)!==n&&queueMicrotask(()=>{_||t.announce?.()})},D=()=>u?E():l.type===`checkbox`?l.checked:[`number`,`range`].includes(l.type)?l.valueAsNumber:l.value,O=D(),k=()=>{if(clearTimeout(g),g=null,h)return y;if(_||S||!m||!v||b)return;let e=p;m=!1,x=null,h=!0;let n=!1;return y=Promise.resolve().then(()=>t.updateShared({[i]:e},{[i]:f})).then(()=>{f={exists:!0,value:e},l.setCustomValidity(``),!b&&m&&Object.is(p,e)&&(m=!1,x=null)},e=>{n=!0,m=!0,T(e)}).finally(()=>{h=!1,y=null,!_&&!n&&m&&p!==e&&A(),!_&&!m&&ne(t.getShared())}),y},A=()=>{clearTimeout(g),g=setTimeout(k,Math.max(0,Math.min(150,500-(Date.now()-(x??Date.now())))))},j=()=>{!_&&ee&&v&&!d&&(S=!0,clearTimeout(g),g=null)},M=e=>{if(_||!v||d)return;if(ee&&e?.isComposing){j();return}if(S)return;let t=D();if(typeof t==`number`&&!Number.isFinite(t)){T(Error(`Enter a finite number`));return}w!==void 0&&Object.is(t,w)||(w=void 0,(b||!Object.is(t,m||h?p:f.exists?f.value:O))&&((b||x===null)&&(x=Date.now()),p=t,b=null,m=!0,A()))},ne=e=>{_||(v=e.canEdit,l.disabled=d||!v,!v&&S&&(C=!0),!v&&(m||S)&&T(Error(`Editing access changed. Your unsaved draft has been preserved.`)),!(S||m||h||b)&&(f=Object.hasOwn(e.state,i)?{exists:!0,value:e.state[i]}:{exists:!1},te(f.exists?f.value:O)))},N=t.onShared(ne),P=()=>{if(!_&&S){if(S=!1,!v||C){C=!1,p=D(),w=p,m=!0,T(Error(`Editing access changed. Your unsaved draft has been preserved.`));return}M(),m&&!h&&!b?(x=Date.now(),A()):!m&&!h&&!b&&ne(t.getShared())}};l.disabled=d||!t.getShared().canEdit;let re=u?`focusout`:`blur`;l.addEventListener(`input`,M),l.addEventListener(`change`,M),l.addEventListener(re,k),l.addEventListener(`compositionstart`,j),l.addEventListener(`compositionend`,P);let F=()=>{_=!0,S=!1,clearTimeout(g),N(),l.removeEventListener(`input`,M),l.removeEventListener(`change`,M),l.removeEventListener(re,k),l.removeEventListener(`compositionstart`,j),l.removeEventListener(`compositionend`,P),l.disabled=d,a.delete(i)};return a.set(i,{dispose:F,flush:k,status(){return{dirty:m,saving:h,problem:b,canEdit:v,composing:S,interrupted:w!==void 0}},setDefault(e){O=e,ne(t.getShared())}}),F},h=()=>{let t=[...e.querySelectorAll(`[data-stillmade-share]`)];if(t.length>100)throw Error(`Use at most 100 shared controls`);for(let n of t){let t=n.getAttribute(`data-stillmade-share`),r=n.id;if(typeof t!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(t)||typeof r!=`string`||!r||r.length>200||e.getElementById(r)!==n)throw Error(`Each data-stillmade-share control needs a unique ID and valid shared field name`);m(t,r)}return t.length},g=()=>{if(d)throw Error(`Block closed before edits could be flushed`);if([...a.values()].some(e=>e.status().composing))throw Error(`Finish composing text before leaving this Block or running an action.`);let e=[...a.values()].find(e=>e.status().interrupted);if(e)throw e.status().problem};return{bindShared:m,bindAnnotated:h,scheduleSharedEdit:p,flushAll:async()=>{if(d)throw Error(`Block closed before edits could be flushed`);for(let e=0;e<32;e++){if(d)throw Error(`Block closed before edits could be flushed`);g();let e=[...l];for(let[t,n]of[...c])e.push(f(t,n));for(let t of a.values())e.push(t.flush());if(await Promise.all(e),d)throw Error(`Block closed before edits could be flushed`);if(u.size)throw u.values().next().value;let t=!1;for(let e of a.values()){let n=e.status();if(n.problem)throw n.problem;if(n.composing)throw Error(`Finish composing text before leaving this Block or running an action.`);if(n.dirty&&!n.canEdit)throw Error(`Editing access changed. Your draft is not saved.`);t||=n.dirty||n.saving}if(!t&&!c.size&&!l.size)return{queued:!0}}throw Error(`Edits are still arriving. Finish editing before leaving this Block.`)},assertNoComposition:g,getBindingStatus:e=>a.get(e)?.status(),setSharedDefaults(e){if(!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length>100||JSON.stringify(e).length>65536)throw Error(`Use bounded shared control defaults`);for(let[t,n]of Object.entries(e))a.get(t)?.setDefault(n)},dispose(){d=!0;for(let e of c.values())clearTimeout(e.timer);c.clear();for(let e of[...a.values()])e.dispose()}}}function as(e,t,n,r,i,a=null){let o=new Map,s=new Map,c=[],l=0,u=!1,d=``,f=()=>{if(u)return;let e=[...o.values()].map(e=>e.status()),t={count:e.length,dirty:e.filter(e=>e.dirty||e.composing||e.interrupted).length,pending:e.filter(e=>e.saving).length,readonly:e.filter(e=>!e.canEdit).length,error:e.find(e=>e.problem)?.problem.message?.slice(0,1e3)||null,retryable:e.some(e=>e.retryable)},n=JSON.stringify(t);n!==d&&(d=n,parent.postMessage({channel:r,session:i,op:`text-recovery-status`,status:t},`*`),a&&a.send({channel:r,session:i,op:`named-text-controls`,token:a.token,snapshot:[...o.values()].map(e=>e.nativeState?.()).filter(Boolean).slice(0,50)},`*`))},p=e=>Object.assign(Error(e?.message||String(e)),e?.code?{code:e.code}:{}),m=()=>{for(;!u&&s.size<4&&c.length;){let e=c.findIndex(e=>e.action!==`read`),t=c.splice(e<0?0:e,1)[0],n=String(++l);t.id=n,s.set(n,t),(a?.send||parent.postMessage.bind(parent))({channel:r,session:i,op:`text-request`,id:n,action:t.action,key:t.key,body:t.body,...t.nativeProof&&a?{nativeText:{token:a.token,callId:t.nativeProof.callId}}:{}},`*`)}},h=(e,t,n={},r=null)=>new Promise((i,a)=>{if(u||s.size+c.length>=128){a(Error(`Shared text is unavailable or busy. Your draft is retained.`));return}let o={action:e,key:t,body:n,nativeProof:r,resolve:i,reject:a,timer:null,id:null};o.timer=setTimeout(()=>{if(o.id)s.delete(o.id);else{let e=c.indexOf(o);e>=0&&c.splice(e,1)}a(Error(`Shared text acknowledgement timed out. Your draft is retained.`)),m()},3e4),c.push(o),m()}),g=e=>{let t=e.data;if(!(e.source!==parent||t?.channel!==r||t.session!==i||u)){if(t.op===`text-result`){let e=s.get(t.id);if(!e)return;s.delete(t.id),clearTimeout(e.timer),t.error?e.reject(p(t.error)):e.resolve(t.result),m()}else if(t.op===`text-refresh`)for(let e of o.values())e.refresh();else if(t.op===`text-retry`)for(let e of o.values())e.retry().catch(()=>{})}};addEventListener(`message`,g);let _=(r,i)=>{if(o.has(r)||o.size>=100)throw Error(`Use at most 100 distinct shared text controls.`);let s=new WeakMap,c=null,l=i.disabled,u=i.readOnly,d=i.value,m=`loading`,g=!1,_=null,v=null,y=null,b=null,x=!1,S=0,C=null,w=null,ee=null,T=!1,E=!1,te=!1,D=!1,O=null,k=null,A=null,j=t.getShared().canEdit===!0,M=i.value,ne=()=>!!b&&!D&&!E&&j&&!/^(READ_ONLY|SHARED_TEXT_(SOURCE|EPOCH|CONFLICT|INPUT|LIMIT|STATE|UPDATE|PROTOCOL))$/.test(b.code||``),N=e=>{T||(b=p(e),E&&(D=!0),i.readOnly=!0,(x||D)&&(i.disabled=l),i.setCustomValidity(b.message),n(b.message),f())},P=()=>({start:i.selectionStart??0,end:i.selectionEnd??0,direction:i.selectionDirection||`none`}),re=e=>{i.value!==e&&(i.value=e,queueMicrotask(()=>{T||t.announce?.()}))},F=t=>{if(M=v.getValue(),re(M),t&&e.activeElement===i){let e=v.resolveSelection(t);i.setSelectionRange(e.start,e.end,e.direction)}},ie=()=>{let e=P();return v.captureSelection(e.start,e.end,e.direction)},I=e=>{if(!T&&e){if(b||D){(!k||e.textRevision>=k.textRevision)&&(k=e);return}if(E){(!k||e.textRevision>=k.textRevision)&&(k=e);return}if(v&&i.value!==M)throw D=!0,x=!0,Error(`This control has an uncommitted draft. Copy it before reopening the Block.`);if(y&&e.epoch!==y.epoch)throw Object.assign(Error(`This shared text was reset. Copy your draft before reloading the Block.`),{code:`SHARED_TEXT_EPOCH`});if(!(y&&e.textRevision<y.textRevision)){if(y&&e.protocol===y.protocol&&e.sourceIdentity===y.sourceIdentity&&e.textRevision===y.textRevision&&e.state===y.state&&e.value===y.value){y=e;return}if(!v)v=rs(e),y=e,F();else{let t=ie();v.receive(e),y=e,F(t)}m=`text`,i.disabled=l||!j,i.readOnly=u,i.setCustomValidity(``),f()}}},ae=()=>{m=`legacy`,i.disabled=l,i.readOnly=u,i.value=d,_=is(e,t,n),_.bindShared(r,i.id),_.setSharedDefaults({[r]:d}),queueMicrotask(()=>{T||t.announce?.()})},oe=async(e=!1)=>T||!g||m===`legacy`||O||b?O:(O=(async()=>{let t=await h(`read`,r);if(T)return;if(t.unsupported){if(e)ae();else throw Error(`Shared text is no longer available. Your draft is retained.`);return}if(t.enabled){I(t.snapshot);return}if(!j){m=`waiting`,M=t.value,re(t.value),i.disabled=!0;return}A={action:`initialize`,body:{protocol:1,requestId:crypto.randomUUID(),sourceIdentity:t.sourceIdentity}};let n=await h(A.action,r,A.body);A=null,T||I(n.snapshot)})().catch(N).finally(()=>{O=null,f()}),f(),O),se=()=>{T||b||E||(ee===null&&(ee=Date.now()),clearTimeout(w),w=setTimeout(()=>{w=null,ce().catch(()=>{})},Math.max(0,Math.min(200,600-(Date.now()-ee)))))},ce=async()=>{if(clearTimeout(w),w=null,_)return _.flushAll();if(O&&await O,b)throw b;if(T)throw Error(`Block closed before text was saved.`);if(!g||m===`loading`)throw Error(`Shared text is still loading. Wait before leaving this Block or running an action.`);if(E)throw Error(`Finish composing text before leaving this Block or running an action.`);if(v&&i.value!==M)throw D=!0,x=!0,N(Error(`This control has an uncommitted draft. Copy it before reopening the Block.`)),b;if(C){await C;return}if(!x)return;if(!j)throw Error(`Editing access changed. Your draft is retained.`);try{A={action:`update`,version:S,nativeProof:c?.version===S?{callId:c.callId}:null,body:{...v.getUpdateSince(y),requestId:crypto.randomUUID()}}}catch(e){throw N(e),e}x=!1,ee=null;let e=A;C=h(e.action,r,e.body,e.nativeProof).then(t=>{T||(I(t.snapshot),!b&&!D&&(x=S!==e.version)),A=null}).catch(e=>{throw x=!0,N(e),e}).finally(()=>{C=null,x&&!b&&se(),f()}),f(),await C},le=e=>{if(m!==`text`||T||l||u||!j||D)return;if(e?.isComposing){L();return}if(E)return;if(b){i.value!==M&&(D=!0,x=!0,f());return}let t=i.value;if(t!==M)try{let n=0,r=M.length,i=t.length;for(;n<r&&n<i&&M[n]===t[n];)n++;for(n>0&&n<r&&/[\\uDC00-\\uDFFF]/.test(M[n])&&n--;r>n&&i>n&&M[r-1]===t[i-1];)r--,i--;r<M.length&&/[\\uDC00-\\uDFFF]/.test(M[r])&&(r++,i++),v.splice(n,r-n,t.slice(n,i)),M=v.getValue(),S++,c=s.has(e)?{version:S,callId:s.get(e)}:null,x=!0,se(),f()}catch(e){D=!0,x=!0,N(e)}},L=()=>{m!==`text`||T||!j||l||u||b||(E=!0,clearTimeout(w),w=null,f())},ue=()=>{if(E){if(E=!1,b||!j||te){D=!0,x=!0,b||N(Error(`Editing access changed. Your composed draft is retained.`));return}if(le(),k){let e=k;k=null;try{I(e)}catch(e){N(e)}}x&&se(),f()}},de=e=>{if(!(m!==`text`||E||b||!j||l||u||!(e.metaKey||e.ctrlKey)||e.altKey||![`z`,`y`].includes(e.key.toLowerCase()))){e.preventDefault();try{e.key.toLowerCase()===`y`||e.shiftKey?v.redo():v.undo(),F(),S++,x=!0,se(),f()}catch(e){N(e)}}},fe=()=>{m===`text`&&ce().catch(()=>{})},pe=t.onShared(e=>{g=!0,j=e.canEdit===!0,m!==`legacy`&&(i.disabled=l||m!==`text`||!j,!j&&(x||E)&&(te||=E,D=!0,N(Error(`Editing access changed. Your unsaved draft is retained.`))),o.has(r)&&m===`loading`&&oe(!0),f())});i.disabled=!0,i.addEventListener(`input`,le),i.addEventListener(`change`,le),i.addEventListener(`blur`,fe),i.addEventListener(`keydown`,de),i.addEventListener(`compositionstart`,L),i.addEventListener(`compositionend`,ue);let me=()=>{let e=String(i.value),t=i.hidden||i.closest(`[hidden]`)!==null;return{field:r,nodeId:i.id,type:i.tagName.toLowerCase()===`textarea`?`textarea`:i.type,value:e.slice(0,1e4),partial:e.length>1e4,disabled:i.disabled||l||u||t,ready:m===`text`&&!T&&!b&&!D&&!E&&!C&&!O&&!x&&!A&&j,identity:JSON.stringify([r,i.id,i.type,y?.protocol??null,y?.epoch??null,y?.sourceIdentity??null,y?.textRevision??null])}},he={nativeState:me,async nativeEdit(e,t){let n=me();if(!a||typeof t!=`string`||!/^\\d{1,9}$/.test(t)||!e||Object.keys(e).sort().join(`,`)!==`field,identity,previous,value`||e.field!==r||e.identity!==n.identity||n.partial||!n.ready||n.disabled||typeof e.previous!=`string`||e.previous!==n.value||typeof e.value!=`string`||e.value.length>1e4||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(r)||/password|credential|authorization|cookie|secret|token|api.?key/i.test(r)||!i.id||![`text`,`textarea`].includes(n.type))throw Error(`The original named text control changed or is unavailable.`);let o=new Event(`input`,{bubbles:!0});if(s.set(o,t),i.value=e.value,i.dispatchEvent(o),s.delete(o),i.value!==e.value||!x||E||D||b)throw Error(`The original text handler changed or refused this edit.`);let c=S;if(await ce(),S!==c||i.value!==e.value||x||A||C||b)throw Error(`Original text changed while its acknowledgement was pending. Do not repeat the edit.`);return{value:i.value,identity:me().identity}},flush:ce,getValue:()=>i.value,status:()=>_?_.getBindingStatus(r):{dirty:x||!!A,saving:!!C||!!O,problem:b,canEdit:j,composing:E,interrupted:D,retryable:ne()},setDefault(e){d=String(e??``),_&&_.setSharedDefaults({[r]:e})},refresh(){!b&&!T&&oe()},async retry(){if(!(T||C||O||!ne())){if(b=null,i.setCustomValidity(``),A){let e=A;C=h(e.action,r,e.body,e.nativeProof).then(t=>{I(t.snapshot),e.action===`update`&&!b&&!D&&(x=S!==e.version),A=null}).catch(e=>{throw N(e),e}).finally(()=>{C=null,f()}),f(),await C}else await oe(m===`loading`);if(b)throw b;if(i.readOnly=u,k){let e=k;k=null;try{I(e)}catch(e){throw N(e),e}}x&&await ce(),f()}},dispose(){T=!0,clearTimeout(w),pe(),_?.dispose(),v?.dispose(),o.delete(r),i.removeEventListener(`input`,le),i.removeEventListener(`change`,le),i.removeEventListener(`blur`,fe),i.removeEventListener(`keydown`,de),i.removeEventListener(`compositionstart`,L),i.removeEventListener(`compositionend`,ue),i.disabled=l,i.readOnly=u,f()}};return o.set(r,he),g&&oe(!0),he},v=setInterval(()=>{for(let e of o.values())e.refresh()},15e3);return{bind:_,inspectNative(){return[...o.values()].map(e=>e.nativeState()).filter(e=>e.nodeId&&[`text`,`textarea`].includes(e.type)&&!/password|credential|authorization|cookie|secret|token|api.?key/i.test(e.field)).slice(0,50)},async dispatchNative(e,t){if(!e||typeof e.field!=`string`||!o.has(e.field))throw Error(`Inspect an existing original named text field.`);return o.get(e.field).nativeEdit(e,t)},getValues:()=>Object.fromEntries([...o].map(([e,t])=>[e,t.getValue()])),dispose(){u=!0,clearInterval(v),removeEventListener(`message`,g);for(let e of[...o.values()])e.dispose();for(let e of[...s.values(),...c])clearTimeout(e.timer),e.reject(Error(`Block closed before text was acknowledged.`));s.clear(),c.length=0}}}return e.installTextFrame=as,e})({});',Nt=`(sharedAPI,onStatus)=>{const documentTools=(()=>{const BlockError=(class extends Error {
9
9
  constructor(code, message, details = []) {
10
10
  super(message);
11
11
  this.name = "BlockError";
12
12
  this.code = code;
13
13
  this.details = details;
14
14
  }
15
- }),forbiddenKeys=new Set(["__proto__","prototype","constructor"]);const assert=(function assert(condition, code, message) {
16
- if (!condition) throw new BlockError(code, message);
17
- }),plain=(function plain(value) {
15
+ }),BlockError$1=BlockError,forbiddenKeys=new Set(["__proto__","prototype","constructor"]);const assert=(function assert$2(condition, code, message) {
16
+ if (!condition) throw new BlockError$1(code, message);
17
+ }),plain=(function plain$5(value) {
18
18
  return !!value && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
19
19
  }),safeDocument=(function safeDocument(value, depth = 0, budget = { nodes: 0 }) {
20
20
  assert(depth <= 40 && ++budget.nodes <= 5e5, "LIMIT", "Document exceeds complexity limit");
@@ -32,7 +32,7 @@ Error generating stack: `+e.message+`
32
32
  safeDocument(value);
33
33
  const visit = (v) => Array.isArray(v) ? v.map(visit) : plain(v) ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, visit(v[k])])) : v;
34
34
  return JSON.stringify(visit(value));
35
- });const operations=(function createDocumentOperations({ assert, plain, safeDocument, stableStringify }) {
35
+ }),assert$2=assert,plain$5=plain;const operations=(function createDocumentOperations({ assert, plain, safeDocument, stableStringify }) {
36
36
  const sameValue = (a, b) => {
37
37
  if (a === b) return true;
38
38
  if (a === null || b === null || typeof a !== "object" || typeof b !== "object") return false;
@@ -226,9 +226,9 @@ Error generating stack: `+e.message+`
226
226
  this.code = code;
227
227
  this.details = details;
228
228
  }
229
- }),forbiddenKeys=new Set(["__proto__","prototype","constructor"]),assert=(function assert(condition, code, message) {
230
- if (!condition) throw new BlockError(code, message);
231
- }),plain=(function plain(value) {
229
+ }),forbiddenKeys=new Set(["__proto__","prototype","constructor"]),assert=(function assert$2(condition, code, message) {
230
+ if (!condition) throw new BlockError$1(code, message);
231
+ }),plain=(function plain$5(value) {
232
232
  return !!value && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
233
233
  }),safeDocument=(function safeDocument(value, depth = 0, budget = { nodes: 0 }) {
234
234
  assert(depth <= 40 && ++budget.nodes <= 5e5, "LIMIT", "Document exceeds complexity limit");
@@ -242,7 +242,7 @@ Error generating stack: `+e.message+`
242
242
  assert(!forbiddenKeys.has(key), "SCHEMA", \`Forbidden field: \${key}\`);
243
243
  safeDocument(child, depth + 1, budget);
244
244
  }
245
- });const createIdentityCodec=collections=>(function createDocumentIdentityTools({ assert, plain, safeDocument }) {
245
+ }),BlockError$1=BlockError,assert$2=assert,plain$5=plain;const createIdentityCodec=collections=>(function createDocumentIdentityTools({ assert, plain, safeDocument }) {
246
246
  const limits = Object.freeze({
247
247
  declarations: 64,
248
248
  pathSegments: 16,
@@ -1083,20 +1083,18 @@ Error generating stack: `+e.message+`
1083
1083
  entries.clear();
1084
1084
  }
1085
1085
  });
1086
- })(createStore,sharedAPI,onStatus);})(documentTools,sharedAPI,onStatus);return {documentTools,sharedDocuments}}`;function jt(){return()=>{}}function Mt(){return{}}gt();function Nt({assert:e,plain:t,safeDocument:n,stableStringify:r}){let i=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>i(e,t[n]));let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&i(e[n],t[n]))},a=(e,t)=>e.exists===t.exists&&(!e.exists||i(e.value,t.value)),o=(e,t)=>Object.hasOwn(e,t)?{exists:!0,value:e[t]}:{exists:!1},s=e=>Array.isArray(e)&&e.every(e=>t(e)&&typeof e.id==`string`)&&new Set(e.map(e=>e.id)).size===e.length;function c(e,n,r){let i=[];if(t(e)&&t(n))for(let l of new Set([...Object.keys(e),...Object.keys(n)])){let u=o(e,l),d=o(n,l);a(u,d)||(!(r.length===0&&[`projectType`,`semanticContext`].includes(l))&&u.exists&&d.exists&&(t(u.value)&&t(d.value)||s(u.value)&&s(d.value))?i.push(...c(u.value,d.value,[...r,l])):i.push({path:[...r,l],before:u,after:d}))}else if(s(e)&&s(n)){let t=new Map(e.map(e=>[e.id,e])),a=new Map(n.map(e=>[e.id,e]));for(let e of new Set([...t.keys(),...a.keys()]))t.has(e)&&a.has(e)?i.push(...c(t.get(e),a.get(e),[...r,{id:e}])):i.push({path:[...r,{id:e}],before:t.has(e)?{exists:!0,value:t.get(e)}:{exists:!1},after:a.has(e)?{exists:!0,value:a.get(e)}:{exists:!1}});let o=[...e.filter(e=>a.has(e.id)).map(e=>e.id),...n.filter(e=>!t.has(e.id)).map(e=>e.id)];JSON.stringify(o)!==JSON.stringify(n.map(e=>e.id))&&i.push({path:r,before:{exists:!0,value:n.map(e=>t.get(e.id)||e)},after:{exists:!0,value:n},order:n.map(e=>e.id),expectedOrder:e.map(e=>e.id)})}return i}function l(e,t,r=[]){return n(e),n(t),c(e,t,r)}function u(n,r){let i=n;for(let n of r.slice(0,-1))t(n)?(e(Array.isArray(i),`CONFLICT`,`Collection removed`),i=i.find(e=>e?.id===n.id)):(e(i&&Object.hasOwn(i,n),`CONFLICT`,`Parent removed`),i=i[n]),e(i&&typeof i==`object`,`CONFLICT`,`Parent removed`);let a=r.at(-1);if(t(a)){e(Array.isArray(i),`CONFLICT`,`Collection removed`);let t=i.findIndex(e=>e?.id===a.id);return{parent:i,key:t,state:t<0?{exists:!1}:{exists:!0,value:i[t]},collection:!0,id:a.id}}return e(t(i),`CONFLICT`,`Parent removed`),{parent:i,key:a,state:o(i,a),collection:!1}}function d(r,i){n(r),n(i),e(Array.isArray(i)&&i.length<=2e3,`LIMIT`,`Too many operations`);let o=structuredClone(r);for(let n of i){e(Array.isArray(n.path)&&n.path.length>0&&n.path.length<=30&&n.path.every(e=>typeof e==`string`&&e.length>0&&![`__proto__`,`constructor`,`prototype`].includes(e)||t(e)&&typeof e.id==`string`&&Object.keys(e).length===1),`PATCH`,`Invalid operation path`),e(t(n.before)&&t(n.after)&&typeof n.before.exists==`boolean`&&typeof n.after.exists==`boolean`,`PATCH`,`Expected before/after preconditions`),e(!(n.path.at(-1)===`id`&&t(n.path.at(-2))),`PATCH`,`Collection identity is immutable`);let r=u(o,n.path);if(n.order){e(Array.isArray(r.state.value)&&Array.isArray(n.order)&&Array.isArray(n.expectedOrder),`PATCH`,`Invalid order operation`);let t=r.state.value,i=new Set(n.expectedOrder);e(new Set(n.order).size===n.order.length&&n.order.every(e=>typeof e==`string`&&t.some(t=>t.id===e)),`PATCH`,`Invalid order IDs`);let a=new Set(n.order);if(JSON.stringify(t.filter(e=>a.has(e.id)).map(e=>e.id))===JSON.stringify(n.order))continue;e(t.filter(e=>i.has(e.id)).map(e=>e.id).join(`\0`)===n.expectedOrder.filter(e=>t.some(t=>t.id===e)).join(`\0`),`CONFLICT`,`Collection order changed`),r.parent[r.key]=[...n.order.map(e=>t.find(t=>t.id===e)),...t.filter(e=>!a.has(e.id))];continue}e(a(r.state,n.before)||a(r.state,n.after),`CONFLICT`,`Concurrent change at ${n.path.map(e=>typeof e==`string`?e:e.id).join(`.`)}`),!a(r.state,n.after)&&(r.collection?n.after.exists?(e(n.after.value?.id===r.id,`PATCH`,`Collection ID mismatch`),r.key<0?r.parent.push(structuredClone(n.after.value)):r.parent[r.key]=structuredClone(n.after.value)):r.parent.splice(r.key,1):n.after.exists?r.parent[r.key]=structuredClone(n.after.value):delete r.parent[r.key])}return o}return Object.freeze({isKeyed:s,diffDocument:l,applyOperations:d})}var{isKeyed:Pt,diffDocument:Ft,applyOperations:It}=Nt({assert:L,plain:R,safeDocument:at,stableStringify:ot});gt();var Lt=Object.freeze({stateBytes:393216,requestBytes:8e5,pendingBytes:2097152});function Rt(e={},t){at(t),L(new TextEncoder().encode(JSON.stringify(t)).length<=Lt.requestBytes,`VIEW_STATE`,`Shared edit exceeds 800,000 bytes`),L(R(e)&&R(t)&&R(t.values)&&R(t.before),`VIEW_STATE`,`Expected a shared view patch`);let n=Object.keys(t.values);L(t.merge===void 0||typeof t.merge==`boolean`,`VIEW_STATE`,`Invalid structured merge option`);let r={...e};L(n.length>0&&n.length<=100&&n.every(e=>/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)),`VIEW_STATE`,`Use bounded named view fields`);for(let i of n){let n=t.before[i];L(R(n)&&typeof n.exists==`boolean`,`VIEW_STATE`,`Missing field precondition`);let a=Object.hasOwn(e,i);if(t.merge&&n.exists&&a&&R(n.value)&&R(t.values[i])&&R(e[i])){let a=Ft({value:n.value},{value:t.values[i]});r[i]=It({value:e[i]},a).value;continue}L(a===n.exists&&(!a||ot(e[i])===ot(n.value))||a&&ot(e[i])===ot(t.values[i]),`CONFLICT`,`This field changed. Read the shared state before applying your edit.`),r[i]=structuredClone(t.values[i])}return L(new TextEncoder().encode(JSON.stringify(r)).length<=Lt.stateBytes,`VIEW_STATE`,`Shared view state exceeds 384 KiB`),r}function zt(e,t,n=Lt,r={}){let i={state:{},outputs:{},memory:null,canEdit:!1},a=!1,o=0,s=null,c=!1,l=[],u=0,d=0,f=new Set,p=new Map,m=null,h=null,g=null,_=(e,t)=>{t=Error(String(t?.message||`Shared edit failed`).slice(0,1e3));let n=e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[];if(!n.length){m=t;return}for(let e of n){if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)){m=t;continue}if(p.size>=100&&!p.has(e)){m=Error(`Too many unresolved shared fields. Reopen the Block to recover.`);break}p.set(e,t)}},v=()=>{h&&g===null&&(g=setTimeout(()=>{if(g=null,!h||s||l.length)return;let e=h;h=null;let t=c?Error(`Block closed`):m||p.values().next().value;t?e.reject(t):e.resolve({queued:!0})},0))};r.captureControlState=()=>({attempts:u,snapshotVersion:d,closed:c,ready:a,pending:!!s,queued:l.length,failed:!!m||p.size>0}),r.flushSharedWrites=()=>{if(h)return h.promise;let e,t,n=new Promise((n,r)=>{e=n,t=r});return h={promise:n,resolve:e,reject:t},v(),n};let y=()=>{for(let e of f)try{e(structuredClone(i))}catch{}},b=e=>{let t=Error(e);s&&=(clearTimeout(s.timer),_(s.values,t),s.reject(t),null);for(let e of l.splice(0))_(e.values,t),e.reject(t);v()},x=()=>{if(s||!l.length||c)return;if(!a||!i.canEdit){b(`Shared editing is unavailable or read only`);return}s=l.shift();let n=s;n.timer=setTimeout(()=>{c=!0,a=!1,i={...i,canEdit:!1},b(`Shared edit acknowledgement timed out. Reopen the Block to recover.`),y()},15e3),parent.postMessage({channel:e,session:t,op:`shared-view-update`,id:n.id,request:{values:n.values,before:n.before,...n.merge?{merge:!0}:{}}},`*`)};return addEventListener(`message`,n=>{let r=n.data;if(!c&&n.source===parent&&r&&r.channel===e&&r.session===t){if(r.op===`shared-view`)d++,i=r.value,a=!0,i.canEdit||b(`Shared editing is unavailable or read only`),y(),x();else if(r.op===`shared-view-result`&&s?.id===r.id){let e=s;if(clearTimeout(e.timer),s=null,r.error){let t=Error(r.error);_(e.values,t),e.reject(t),b(`A previous edit failed. Read the shared state before trying again.`)}else{let t={...i.state};for(let n of Object.keys(e.values)){let r=e.before[n];Object.hasOwn(t,n)===r.exists&&(!r.exists||JSON.stringify(t[n])===JSON.stringify(r.value))&&(t[n]=e.values[n])}i={...i,state:t};for(let t of Object.keys(e.values))p.delete(t);e.resolve({queued:!0}),y()}x(),v()}else r.op===`dispose`&&(c=!0,a=!1,f.clear(),b(`Block closed`))}}),{getShared(){return structuredClone(i)},onShared(e){if(typeof e!=`function`)throw Error(`Expected a function`);return f.add(e),a&&e(structuredClone(i)),()=>f.delete(e)},updateShared(e,t,r){u++;let d=t=>(_(e,t),v(),Promise.reject(t));if(c||!a||!i.canEdit)return d(Error(`Shared editing is unavailable or read only`));if(l.length>=32)return d(Error(`Too many pending shared edits. Wait for synchronization.`));let f={},p=!1,m=0;try{if(r!==void 0){if(!r||typeof r!=`object`||Array.isArray(r)||Object.keys(r).some(e=>e!==`merge`)||typeof r.merge!=`boolean`)throw Error(`Expected a structured merge option`);if(p=r.merge,p&&t===void 0)throw Error(`Structured edits require the exact base preconditions`)}if(!e||Array.isArray(e)||typeof e!=`object`||new TextEncoder().encode(JSON.stringify(e)).length>n.stateBytes)throw Error(`Expected bounded view fields`);e=structuredClone(e);let a=Object.keys(e);if(!a.length||a.length>100||a.some(e=>!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)))throw Error(`Use bounded named view fields`);let o={...i.state,...s?.values};for(let e of l)Object.assign(o,e.values);for(let e of a)f[e]=Object.hasOwn(o,e)?{exists:!0,value:structuredClone(o[e])}:{exists:!1};if(t!==void 0){if(!t||Array.isArray(t)||typeof t!=`object`)throw Error(`Expected field preconditions`);f=structuredClone(t);for(let e of a)if(!f[e]||typeof f[e].exists!=`boolean`)throw Error(`Missing field precondition`)}if(m=new TextEncoder().encode(JSON.stringify({values:e,before:f,...p?{merge:!0}:{}})).length,m>n.requestBytes)throw Error(`Shared edit exceeds 800,000 bytes`);if(m+(s?.bytes||0)+l.reduce((e,t)=>e+t.bytes,0)>n.pendingBytes)throw Error(`Pending shared edits exceed 2 MiB. Wait for synchronization.`)}catch(e){return d(e)}return new Promise((t,n)=>{l.push({id:String(++o),resolve:t,reject:n,values:e,before:f,merge:p,bytes:m}),x()})}}}function Bt(e,t=()=>{},n=()=>{}){let r=new Set(`div.section.article.header.footer.p.span.strong.em.i.small.h1.h2.h3.h4.label.button.input.textarea.select.option.ul.ol.li.table.thead.tbody.tr.th.td.details.summary.output.progress.img`.split(`.`)),i=new Set([`DIV`,`SPAN`,`SECTION`,`ARTICLE`,`MAIN`,`ASIDE`,`UL`,`OL`,`TBODY`]),a=new Set([`tag`,`text`,`children`,`id`,`className`,`action`,`value`,`type`,`checked`,`disabled`,`placeholder`,`min`,`max`,`step`,`label`]),o=new Set,s=new WeakMap,c=new WeakMap,l=new Map,u=new Map,d=!1,f=0,p=0,m=!1,h=new Set,g=()=>{try{n()}catch{}},_=(e,t)=>{if(!e)throw Error(t)},v=(e,t=1e4)=>(_(typeof e==`string`&&e.length<=t,`Dynamic control text exceeds its limit`),e),y=e=>e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type===`text`,b=(e,t,n)=>{let r=s.get(e);if(m||d||!r?.action||r.event!==n||!t.contains(e)||e.disabled)return;let i={action:r.action,value:e.value,checked:e.checked===!0,event:n};for(let e of o)try{Promise.resolve(e({...i})).then(g,()=>{})}catch{}},x=(e,t,n=e.value)=>{if(d||!t.contains(e)||e.disabled||!y(e))return;let r=c.get(e),i=s.get(e),a={composing:!0,cancelled:!1,action:i?.action,event:i?.event,type:e.type,declared:i?.declared,initialValue:n,conflict:r?.conflict===!0,problem:r?.problem,suppress:null};c.set(e,a),l.set(e,t)},S=(e,n,r,i)=>{if(!r.conflict){r.conflict=!0,r.problem=i,u.set(e,n);try{t(i)}catch{}}},C=e=>{for(let t of l.keys())(t===e||e.contains?.(t))&&(c.get(t).cancelled=!0,l.delete(t));for(let t of u.keys())(t===e||e.contains?.(t))&&u.delete(t)},ee=(t,n)=>{v(t,120);let o=e.getElementById(t);_(o&&i.has(o.tagName),`Choose an existing container for dynamic controls`),_(Array.isArray(n)&&JSON.stringify(n).length<=262144,`Dynamic controls exceed 256 KiB`);let u=0,d=new Set,ee=(n,i)=>{_(++u<=1e3&&i<=12,`Dynamic controls exceed 1000 elements or 12 levels`),_(n&&typeof n==`object`&&!Array.isArray(n)&&Object.keys(n).every(e=>a.has(e)),`Unsupported dynamic control field`),_(r.has(n.tag),`Unsupported dynamic control tag`);let f=e.createElement(n.tag);if(n.id!==void 0){let r=v(n.id,120),i=e.getElementById(r);_(r&&r!==t&&!d.has(r)&&(!i||o.contains(i)),`Dynamic control IDs must be unique`),d.add(r),f.id=r}n.className!==void 0&&(f.className=v(n.className,240)),n.text!==void 0&&(f.textContent=v(n.text)),n.label!==void 0&&f.setAttribute(`aria-label`,v(n.label,240)),n.type!==void 0&&(_(n.tag===`input`&&[`text`,`number`,`range`,`checkbox`,`radio`,`color`].includes(n.type),`Unsupported dynamic input type`),f.type=n.type);for(let e of[`checked`,`disabled`])n[e]!==void 0&&(_(typeof n[e]==`boolean`,`Control flags must be boolean`),f[e]=n[e]);for(let e of[`min`,`max`,`step`])n[e]!==void 0&&(_(typeof n[e]==`string`||typeof n[e]==`number`&&Number.isFinite(n[e]),`Control values must be text or finite numbers`),f[e]=v(String(n[e]),1e4));if(n.placeholder!==void 0&&(f.placeholder=v(n.placeholder,240)),n.tag===`button`&&(f.type=`button`),n.children!==void 0){_(Array.isArray(n.children)&&n.text===void 0,`Use children or text for a control`);for(let e of n.children)f.appendChild(ee(e,i+1))}if(n.value!==void 0&&(_(typeof n.value==`string`||typeof n.value==`number`&&Number.isFinite(n.value),`Control values must be text or finite numbers`),f.value=v(String(n.value),1e4)),n.action!==void 0){let e=v(n.action,120);_(e&&[`button`,`input`,`textarea`,`select`].includes(n.tag),`Actions belong to interactive controls`)}if([`button`,`input`,`textarea`,`select`].includes(n.tag)){let e=n.tag===`button`?`click`:[`checkbox`,`radio`].includes(n.type)||n.tag===`select`?`change`:`input`;s.set(f,{action:n.action,event:e,declared:f.value,declaredDisabled:f.disabled,root:o,handle:`view-control-`+String(++p)});for(let e of[`click`,`input`,`change`])f.addEventListener(e,t=>{let n=c.get(f);if(e===`input`&&t.isComposing){n?.composing||x(f,o,s.get(f)?.declared??f.value);return}if(!(n?.composing||n?.conflict)){if(e===`input`&&n?.suppress!==null&&n?.suppress!==void 0){let e=f.value===n.suppress;if(n.suppress=null,e)return}b(f,o,e)}});(n.tag===`input`||n.tag===`textarea`)&&(f.addEventListener(`compositionstart`,()=>x(f,o)),f.addEventListener(`compositionend`,()=>{let e=c.get(f);if(!e?.composing)return;e.composing=!1,e.suppress=f.value,l.delete(f);let t=s.get(f);!e.cancelled&&!e.conflict&&f.value!==e.initialValue&&y(f)&&e.type===f.type&&e.action===t?.action&&e.event===t?.event&&b(f,o,`input`),e.suppress=f.value}))}return f},w=e.createDocumentFragment();for(let e of n)w.appendChild(ee(e,0));_(e.querySelectorAll(`*`).length-o.querySelectorAll(`*`).length+u<=5e3,`This interface exceeds 5000 elements`);let T=e.activeElement,E=T&&o.contains(T)&&typeof T.selectionStart==`number`?{start:T.selectionStart,end:T.selectionEnd,direction:T.selectionDirection}:null,D=(e,t)=>{let n=Array.from(e.childNodes),r=new Set,i=new Map(n.filter(e=>e.nodeType===1&&e.id).map(e=>[e.id,e]));Array.from(t.childNodes).forEach((t,a)=>{let l=t.nodeType===1?t.id:``,u=l?i.get(l):n[a];if(!u||r.has(u)||u.nodeType!==t.nodeType||u.nodeName!==t.nodeName||u.nodeType===1&&u.id!==l)u=t;else if(u.nodeType===3)u.nodeValue!==t.nodeValue&&(u.nodeValue=t.nodeValue);else{let e=`value`in t?t.value:void 0,n=c.get(u),r=s.get(t);n?.composing&&(t.disabled&&S(u,o,n,`Editing access changed while you were composing. Your local draft is retained here. Review it before reopening this Block.`),t.disabled||n.action!==r?.action||n.event!==r?.event||n.type!==t.type?n.cancelled=!0:!n.cancelled&&e!==n.declared&&S(u,o,n,`Text changed elsewhere while you were composing. Your local draft is retained here. Copy it before reopening this Block to review the shared version.`));for(let e of[`id`,`class`,`aria-label`,`type`,`min`,`max`,`step`,`placeholder`]){let n=t.getAttribute(e);n===null?u.removeAttribute(e):u.getAttribute(e)!==n&&u.setAttribute(e,n)}D(u,t),`disabled`in t&&(u.disabled=t.disabled),`checked`in t&&(u.checked=t.checked),e!==void 0&&u.value!==e&&!n?.composing&&!n?.conflict&&(u.value=e),s.has(t)&&s.set(u,s.get(t))}r.add(u);let d=e.childNodes[a];d!==u&&e.insertBefore(u,d||null)});for(let t of n)!r.has(t)&&t.parentNode===e&&(C(t),t.remove())};D(o,w),h.add(o),f++,m&&A(!0),g(),T&&o.contains(T)&&!T.disabled&&!c.get(T)?.composing&&(e.activeElement!==T&&T.focus({preventScroll:!0}),E&&typeof T.selectionStart==`number`&&typeof T.setSelectionRange==`function`&&T.setSelectionRange(E.start,E.end,E.direction))},w=()=>{_(!d,`Dynamic controls are closed`);let e=[...u].find(([e,t])=>t.contains(e)&&e.isConnected);if(e)throw Error(c.get(e[0]).problem);_(![...l].some(([e,t])=>t.contains(e)&&e.isConnected&&!e.disabled),`Finish composing text before continuing.`)},T=()=>{let e=new Set,t=[];for(let n of h)if(n.isConnected)for(let r of n.querySelectorAll(`button,input,textarea,select`)){let i=s.get(r);i?.action&&i.root===n&&!e.has(r)&&(e.add(r),t.push(r))}return t},E=t=>{for(let n=t;n;n=n.parentElement){if(n.hidden)return!0;let t=e.defaultView?.getComputedStyle(n);if(t?.display===`none`||[`hidden`,`collapse`].includes(t?.visibility)||t?.opacity===`0`)return!0}return!1},D=e=>String(e.getAttribute(`aria-label`)||e.textContent||e.placeholder||`Control`).slice(0,240),O=e=>e.tagName===`SELECT`?Array.from(e.options).map(e=>({value:e.value,label:e.textContent})):null,k=e=>{let t=s.get(e);return JSON.stringify({action:t.action,event:t.event,root:t.root.id,tag:e.tagName,type:e.type,value:e.value,checked:e.checked,disabled:e.disabled,hidden:E(e),label:D(e),choices:O(e)})},A=e=>{for(let t of T())t.disabled=e||s.get(t).declaredDisabled};return Object.freeze({render:ee,inspectControls:({offset:e=0,limit:t=20}={})=>{_(!d,`Dynamic controls are closed`),_(Number.isSafeInteger(e)&&e>=0&&Number.isSafeInteger(t)&&t>=1&&t<=20,`Choose a bounded control page`);let n=T();return _(e<=n.length,`Choose a current control page`),{revision:f,total:n.length,offset:e,nextOffset:e+t<n.length?e+t:null,controls:n.slice(e,e+t).map(e=>{let t=s.get(e),n=String(e.value??``);return{id:t.handle,action:t.action,label:D(e),tag:e.tagName.toLowerCase(),type:e.type,event:t.event,disabled:e.disabled,hidden:E(e),value:n.slice(0,240),valuePartial:n.length>240,...typeof e.checked==`boolean`?{checked:e.checked}:{},...e.tagName===`select`?{choices:O(e).slice(0,40),choicesPartial:e.options.length>40}:{},identity:k(e)}})}},dispatchControl:async(e,t=async()=>{})=>{_(!m,`A declared control is already running`),w(),_(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).every(e=>[`id`,`revision`,`identity`,`value`,`checked`].includes(e))&&typeof e.id==`string`&&e.revision===f&&typeof e.identity==`string`,`The declared control changed`);let n=T().find(t=>s.get(t).handle===e.id),r=n&&s.get(n);_(n&&k(n)===e.identity,`The declared control changed`),_(!n.disabled&&!E(n),`This declared control is unavailable`),_(o.size>0,`This declared control has no native handler`),n.tagName===`BUTTON`?_(!Object.hasOwn(e,`value`)&&!Object.hasOwn(e,`checked`),`Buttons take no input value`):[`checkbox`,`radio`].includes(n.type)?(_(typeof e.checked==`boolean`&&!Object.hasOwn(e,`value`),`Choose a checkbox value`),n.checked=e.checked):(_((typeof e.value==`string`&&e.value.length<=1e4||typeof e.value==`number`&&Number.isFinite(e.value))&&!Object.hasOwn(e,`checked`),`Choose a bounded control value`),n.tagName===`SELECT`&&_(Array.from(n.options).some(t=>t.value===String(e.value)),`Choose a declared option`),n.value=String(e.value));let i={action:r.action,value:n.value,checked:n.checked,event:r.event};m=!0,A(!0);try{let e=[];for(let t of o)try{e.push(Promise.resolve(t({...i})))}catch(t){e.push(Promise.reject(t))}let n=await Promise.allSettled(e);_(!d,`Dynamic controls are closed`),await t(),_(!d,`Dynamic controls are closed`);let r=n.find(e=>e.status===`rejected`);if(r)throw r.reason;return{settled:!0}}finally{m=!1,A(!1),g()}},onAction(e){return _(typeof e==`function`&&o.size<16,`Register at most 16 action listeners`),o.add(e),()=>o.delete(e)},assertCommitted:w,async flushAll(){return w(),{queued:!0}},dispose(){d=!0,h.clear();for(let e of l.keys())c.get(e).cancelled=!0;l.clear(),u.clear(),o.clear()}})}function Vt(e=[]){let t=new Set([`__proto__`,`prototype`,`constructor`]),n=new Set(e);function r(e,n=0,i={nodes:0}){if(n>32||++i.nodes>5e4)throw Error(`Field data exceeds its complexity limit.`);if(!(e===null||[`string`,`boolean`].includes(typeof e))&&!(typeof e==`number`&&Number.isFinite(e))){if(!e||typeof e!=`object`||!Array.isArray(e)&&![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw Error(`Fields accept plain JSON only.`);if(Object.getOwnPropertySymbols(e).length)throw Error(`Fields accept JSON keys only.`);for(let a of Object.getOwnPropertyNames(e)){if(Array.isArray(e)&&a===`length`)continue;let o=Object.getOwnPropertyDescriptor(e,a);if(t.has(a)||!o||!o.enumerable||!Object.hasOwn(o,`value`))throw Error(`Unsafe field data.`);r(o.value,n+1,i)}}}let i=e=>{r(e);let t=JSON.stringify(e);if(t.length>2097152)throw Error(`Field data exceeds 2 MiB.`);return JSON.parse(t)},a=e=>{if(!Array.isArray(e)||e.length<1||e.length>12||e.some(e=>typeof e!=`string`&&!Number.isSafeInteger(e)||typeof e==`string`&&(t.has(e)||e.length>240)||typeof e==`number`&&(e<0||e>1e4)))throw Error(`Choose a safe field path.`)};function o(e,t){a(t),r(e);let n=e;for(let e of t){if(!n||typeof n!=`object`||!Object.hasOwn(n,e))return;n=n[e]}return n===void 0?void 0:i(n)}function s(e,t,n){a(t);let o=i(e);r(n);let s=o;for(let e=0;e<t.length-1;e++){let n=t[e];(!Object.hasOwn(s,n)||s[n]===null||typeof s[n]!=`object`)&&(s[n]=typeof t[e+1]==`number`?[]:{}),s=s[n]}return s[t.at(-1)]=i(n),o}function c(e){return Object.hasOwn(e,`default`)?i(e.default):Array.isArray(e.enum)&&e.enum.length?i(e.enum[0]):e.type===`object`?{}:e.type===`array`?[]:e.type===`boolean`?!1:[`integer`,`number`].includes(e.type)?Math.max(e.minimum||0,0):``}function l(e,t,i,{canEdit:a=!0,busy:o=!1}={}){r(e),r(t),r(i);let s=0,c=[],l=[],u=(e,t,n)=>{let r=`field-${l.length}`;return l.push({id:r,kind:e,path:t,s:n}),r};function d(e,t,r,i,c,f){if(++s>150||f>5)return[{tag:`p`,text:`This task needs a custom interface for its remaining fields.`}];let p=[{tag:`label`,text:String(i).slice(0,240)+(c?` *`:` (optional)`)}],m=o||!a||n.has(t[0]);if(e.description&&p.push({tag:`small`,text:String(e.description).slice(0,1e3)}),e.type===`object`&&e.properties)for(let n of Object.keys(e.properties))p.push({tag:`section`,children:d(e.properties[n],t.concat(n),r?.[n],e.properties[n].title||n,(e.required||[]).includes(n),f+1)});else if(e.type===`array`){let n=Array.isArray(r)?r:[];n.slice(0,20).forEach((n,r)=>p.push({tag:`section`,className:`connection-array`,children:d(e.items||{},t.concat(r),n,`Item `+(r+1),!0,f+1).concat([{tag:`button`,text:`Remove item`,action:u(`remove`,t.concat(r),e),disabled:m}])})),n.length>20&&p.push({tag:`p`,text:`Showing 20 items. All selected items remain in this input.`}),p.push({tag:`button`,text:`Add item`,action:u(`add`,t,e),disabled:m||n.length>=20})}else Array.isArray(e.enum)&&e.enum.length&&e.enum.every(e=>typeof e==`string`)?p.push({tag:`select`,id:`control-${l.length}`,value:r===void 0?``:String(r),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240),children:[{tag:`option`,value:``,text:`Choose…`},...e.enum.slice(0,100).map(e=>({tag:`option`,value:e,text:e}))]}):e.type===`boolean`?p.push({tag:`input`,id:`control-${l.length}`,type:`checkbox`,checked:r===!0,action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240)}):[`integer`,`number`].includes(e.type)?p.push({tag:`input`,id:`control-${l.length}`,type:`number`,value:r===void 0?``:String(r),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240),...e.minimum===void 0?{}:{min:e.minimum},...e.maximum===void 0?{}:{max:e.maximum},step:e.type===`integer`?1:`any`}):e.type===`string`||!e.type?p.push({tag:`textarea`,id:`control-${l.length}`,value:r===void 0?``:String(r).slice(0,1e4),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240)}):p.push({tag:`p`,text:`Select a compatible upstream value for this field.`});return p}for(let[n,r]of Object.entries(t)){let t=e.properties?.[r];if(!t)throw Error(`Choose a schema-declared input.`);c.push({tag:`section`,children:d(t,[n],i[n],t.title||r,(e.required||[]).includes(r),0)})}return{tree:c,actions:l}}function u(e,t,i){r(t),r(i);let a=t.find(e=>e.id===i.action);if(!a)throw Error(`The field changed. Read its current controls.`);if(n.has(a.path[0]))throw Error(`This input is connected. Change its source in Flow.`);if(a.kind===`add`){let t=o(e,a.path)||[];if(!Array.isArray(t)||t.length>=20)throw Error(`Use at most 20 locally edited items.`);return s(e,a.path,[...t,c(a.s.items||{})])}if(a.kind===`remove`){let t=a.path.slice(0,-1),n=o(e,t);if(!Array.isArray(n))throw Error(`The list changed.`);return s(e,t,n.filter((e,t)=>t!==a.path.at(-1)))}let l=a.s.type===`boolean`?i.checked:[`integer`,`number`].includes(a.s.type)?i.value===``?NaN:Number(i.value):i.value;if(typeof l==`number`&&(!Number.isFinite(l)||a.s.type===`integer`&&!Number.isSafeInteger(l)))throw Error(`Enter a valid number.`);return s(e,a.path,l)}function d(e,t,a){let o=i(e);r(t),r(a);for(let e of Object.keys(a))!n.has(e)&&Object.hasOwn(t,e)&&(o[e]=i(t[e]));return o}function f(e,t,a){r(e),r(t),r(a);let o={},s={};for(let r of Object.keys(a))!n.has(r)&&Object.hasOwn(e,r)&&JSON.stringify(e[r])!==JSON.stringify(t[r])&&(o[r]=i(e[r]),s[r]=Object.hasOwn(t,r)?{exists:!0,value:i(t[r])}:{exists:!1});if(JSON.stringify(o).length>393216)throw Error(`Saved task fields exceed 384 KiB. Use an upstream source for larger data.`);return{patch:o,before:s,changed:Object.keys(o).length>0}}function p(e,{maximumFields:t=20}={}){if(e=i(e),!Number.isSafeInteger(t)||t<1||t>100)throw Error(`Use a bounded result preview.`);let n=[],r=!1,a=(e,i,o)=>{if(n.length>=t||o>8){r=!0;return}if(typeof e!=`object`||!e){let t=i.map(e=>typeof e==`number`?`Item `+(e+1):String(e).replaceAll(`_`,` `)).join(` / `)||`Result`,r=e===null?`No value`:typeof e==`boolean`?e?`Yes`:`No`:String(e);n.push({tag:`li`,children:[{tag:`strong`,text:t.slice(0,240)},{tag:`p`,text:r.slice(0,1500)+(r.length>1500?`…`:``)}]});return}if(Array.isArray(e))e.slice(0,50).forEach((e,t)=>a(e,i.concat(t),o+1)),e.length>50&&(r=!0);else for(let[t,n]of Object.entries(e))a(n,i.concat(t),o+1)};return a(e,[],0),[{tag:`h3`,text:`Result`},{tag:`ul`,children:n},...r?[{tag:`small`,text:`Preview is bounded. The saved result retains its complete permitted data.`}]:[]]}function m(e){if(typeof e!=`string`||!/^[A-Z]{3}$/.test(e))throw Error(`Choose a three-letter currency code.`);return new Intl.NumberFormat(`en`,{style:`currency`,currency:e}).resolvedOptions().maximumFractionDigits}function h(e,t){let n=m(t),r=String(e).split(`.`);if(r.length>2||!/^\d+$/.test(r[0])||r[1]!==void 0&&(!/^\d+$/.test(r[1])||r[1].length>n))throw Error(`Enter a budget using this currency’s supported decimal places.`);let i=Number(r[0])*10**n+Number((r[1]||``).padEnd(n,`0`));if(!Number.isSafeInteger(i)||i<=0)throw Error(`Enter a positive supported budget.`);return i}function g(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`Use an exact saved budget.`);return new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e/10**m(t))}return Object.freeze({read:o,set:s,controls:l,change:u,fromState:d,edits:f,preview:p,currencyDigits:m,minorUnits:h,formatMoney:g})}var Ht=`ai-video-workflow-auth`;function z(){try{return typeof localStorage>`u`?null:JSON.parse(localStorage.getItem(Ht)||`null`)?.user?.id||null}catch{return null}}gt(),Ve();function Ut(e,{bridge:t=globalThis.stillmadeDesktop?.blockDesktop,onStatus:n=()=>{},storageScope:r=`preview`}={}){let i=null,a=null,o=!1,s=null,c=!1,l=null,u=null,d=new Set,f=e=>e&&[`audio`,`video`,`image`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?JSON.stringify([e.kind,e.assetId,e.versionId,e.url]):``,p=e?.manifest?.permissions?.desktop||[],m=new Map((e?.manifest?.desktopTools||[]).map(e=>[e.id,new Set(e.actions||[])])),h={"tool.launch":`launch`,"tool.project.import":`project.import`,"tool.project.open":`project.open`,"tool.project.render":`project.render`,"tool.adapter.import":`adapter.import`,"tool.adapter.inspect":`adapter.inspect`,"tool.adapter.execute":`adapter.execute`,"tool.adapter.describe":`adapter.describe`,"tool.adapter.call":`adapter.call`},g=e=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`);if(o)throw Error(`Block desktop access was closed. Reopen the Block.`);if(!p.includes(e))throw Error(`Declare permissions.desktop: ${e}`)},_=async()=>(a||=(async()=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`);let n=e.manifest,a=await t.open({id:n.id,version:n.version,digest:await st(e),permissions:p,tools:n.desktopTools||[],name:n.name,storageScope:`${z()||`anonymous`}:${r}`});if(o)throw await t.close(a),Error(`Block was closed`);return i=a,l=setTimeout(()=>x(),36e5),a})(),a),v=async(e,n={})=>{g(e);let r=await _();if(o)throw Error(`Block was closed`);return t.invoke(r,e,n)},y=async e=>{let r=s;if(!r)throw Error(`No recording is active`);return r.finishing||=(async()=>{if(clearTimeout(r.timer),clearInterval(r.cursorTimer),r.recorder.state!==`inactive`&&r.recorder.stop(),await r.stopped,r.stream.getTracks().forEach(e=>e.stop()),s=null,n({active:!1}),!e)return{cancelled:!0};if(r.error)throw Error(r.error);let a=new Blob(r.chunks,{type:r.recorder.mimeType}),o=await t.save(i,r.kind,new Uint8Array(await a.arrayBuffer())),c=f(o);return c&&d.add(c),{asset:o,cursor:r.cursor,displays:r.displays||[],coordinates:`Global screen coordinates in device-independent pixels; timestamps in milliseconds relative to recording start.`}})(),r.finishing},b=async(e,r={})=>{if(e===`record.stop`)return y(!0);if(e===`record.cancel`)return y(!1);if(e===`session.close`)return await x(),{closed:!0};if(c)throw Error(`A desktop request is already in progress`);c=!0;try{if(e!==`record.start`){if(e.startsWith(`tool.`)){g(`native.tools`);let n=m.get(r.tool),i=h[e];if(!n||e!==`tool.status`&&!n.has(i))throw Error(`Declare the exact desktop tool action`);let a=await t.invoke(await _(),e,r);if(o)throw Error(`Block desktop access closed before the native operation completed.`);let s=f(a?.asset);return s&&d.add(s),a}if(e.startsWith(`storage.`)){if(![`storage.info`,`storage.list`,`storage.read`,`storage.write`,`storage.remove`].includes(e))throw Error(`Unknown storage operation`);if(!t)throw Error(`Device storage requires the StillMade desktop app.`);if(o)throw Error(`Block desktop access was closed. Reopen the Block.`);return t.invoke(await _(),e,r)}if(!Be.includes(e))throw Error(`Unknown desktop operation`);if([`screen.capture`,`camera.capture`,`microphone.capture`].includes(e))throw Error(`Use record.start with kind screen, camera, or microphone.`);let n=await v(e,r);if(e===`media.pick`)for(let e of n?.assets||[]){let t=f(e);t&&d.add(t)}return n}if(s)throw Error(`A recording is already active`);let i=r.kind||`screen`,a={screen:`screen.capture`,camera:`camera.capture`,microphone:`microphone.capture`}[i];if(!a)throw Error(`Choose screen, camera, or microphone`);if(g(a),r.cursor&&(g(`cursor.track`),await v(`cursor.track`)),i!==`screen`&&await v(a),i===`screen`){if(g(a),await t.authorize(await _(),a),await new Promise((e,t)=>{u={reject:t},n({awaitingStart:!0,kind:i,start:()=>{u=null,e()}})}),o)throw Error(`Block was closed`);await v(a,{systemAudio:r.systemAudio===!0})}let c=i===`screen`?await navigator.mediaDevices.getDisplayMedia({video:{frameRate:30},audio:r.systemAudio===!0}):await navigator.mediaDevices.getUserMedia({video:i===`camera`,audio:i===`microphone`});if(o)throw c.getTracks().forEach(e=>e.stop()),Error(`Block was closed`);let l;try{l=new MediaRecorder(c,{mimeType:i===`microphone`?`audio/webm`:`video/webm`})}catch(e){throw c.getTracks().forEach(e=>e.stop()),e}let p={kind:i,stream:c,recorder:l,chunks:[],bytes:0,cursor:[],started:Date.now(),error:null};s=p,p.stopped=new Promise(e=>l.addEventListener(`stop`,e,{once:!0})),l.addEventListener(`dataavailable`,e=>{e.data.size&&(p.bytes+=e.data.size,p.bytes>134217728?(p.error=`Recording reached the 128 MiB limit`,y(!1).catch(()=>{})):p.chunks.push(e.data))}),l.addEventListener(`error`,()=>{p.error=`Recording failed`,y(!1).catch(()=>{})});for(let e of c.getTracks())e.addEventListener(`ended`,()=>{s===p&&l.state===`recording`&&(l.stop(),clearInterval(p.cursorTimer),n({active:!0,ended:!0}))});try{l.start(1e3)}catch(e){throw c.getTracks().forEach(e=>e.stop()),s=null,e}if(r.cursor){let e=!1;p.cursorTimer=setInterval(async()=>{if(!(e||s!==p||p.cursor.length>=18e3)){e=!0;try{let e=await v(`cursor.track`);s===p&&(p.displays=e.displays,p.cursor.push({x:e.x,y:e.y,time:e.time-p.started}))}catch(e){p.error=e.message,y(!1).catch(()=>{})}finally{e=!1}}},100)}return p.timer=setTimeout(()=>{p.error=`Recording reached the 30 minute limit`,y(!1).catch(()=>{})},18e5),n({active:!0,kind:i}),{recording:!0,kind:i,cursor:!!r.cursor}}catch(e){throw s||n({active:!1,error:e.message}),e}finally{c=!1}},x=async()=>{o||(o=!0,S?.(),u?.reject(Error(`Recording cancelled`)),u=null,clearTimeout(l),s&&s.stream.getTracks().forEach(e=>e.stop()),s&&await y(!1).catch(()=>{}),i&&await t.close(i).catch(()=>{}),n({active:!1,closed:!0}))},S=t?.onRevoked?.(e=>{i===e&&x().catch(()=>{})});return{call:b,close:x,authorizesMedia:e=>d.has(f(e))}}var Wt=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Gt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Kt=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,qt=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Jt={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Yt=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,Xt={5:Yt,"5module":Yt+` export import`,6:Yt+` const class extends export import super`},Zt=/^in(stanceof)?$/,Qt=RegExp(`[`+qt+`]`),$t=RegExp(`[`+qt+Kt+`]`);function en(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function tn(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Qt.test(String.fromCharCode(e)):t!==!1&&en(e,Gt)}function nn(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&$t.test(String.fromCharCode(e)):t===!1?!1:en(e,Gt)||en(e,Wt)}var B=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function rn(e,t){return new B(e,{beforeExpr:!0,binop:t})}var an={beforeExpr:!0},on={startsExpr:!0},sn={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,sn[e]=new B(e,t)}var H={num:new B(`num`,on),regexp:new B(`regexp`,on),string:new B(`string`,on),name:new B(`name`,on),privateId:new B(`privateId`,on),eof:new B(`eof`),bracketL:new B(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new B(`]`),braceL:new B(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new B(`}`),parenL:new B(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new B(`)`),comma:new B(`,`,an),semi:new B(`;`,an),colon:new B(`:`,an),dot:new B(`.`),question:new B(`?`,an),questionDot:new B(`?.`),arrow:new B(`=>`,an),template:new B(`template`),invalidTemplate:new B(`invalidTemplate`),ellipsis:new B(`...`,an),backQuote:new B("`",on),dollarBraceL:new B("${",{beforeExpr:!0,startsExpr:!0}),eq:new B(`=`,{beforeExpr:!0,isAssign:!0}),assign:new B(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new B(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new B(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:rn(`||`,1),logicalAND:rn(`&&`,2),bitwiseOR:rn(`|`,3),bitwiseXOR:rn(`^`,4),bitwiseAND:rn(`&`,5),equality:rn(`==/!=/===/!==`,6),relational:rn(`</>/<=/>=`,7),bitShift:rn(`<</>>/>>>`,8),plusMin:new B(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:rn(`%`,10),star:rn(`*`,10),slash:rn(`/`,10),starstar:new B(`**`,{beforeExpr:!0}),coalesce:rn(`??`,1),_break:V(`break`),_case:V(`case`,an),_catch:V(`catch`),_continue:V(`continue`),_debugger:V(`debugger`),_default:V(`default`,an),_do:V(`do`,{isLoop:!0,beforeExpr:!0}),_else:V(`else`,an),_finally:V(`finally`),_for:V(`for`,{isLoop:!0}),_function:V(`function`,on),_if:V(`if`),_return:V(`return`,an),_switch:V(`switch`),_throw:V(`throw`,an),_try:V(`try`),_var:V(`var`),_const:V(`const`),_while:V(`while`,{isLoop:!0}),_with:V(`with`),_new:V(`new`,{beforeExpr:!0,startsExpr:!0}),_this:V(`this`,on),_super:V(`super`,on),_class:V(`class`,on),_extends:V(`extends`,an),_export:V(`export`),_import:V(`import`,on),_null:V(`null`,on),_true:V(`true`,on),_false:V(`false`,on),_in:V(`in`,{beforeExpr:!0,binop:7}),_instanceof:V(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:V(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},cn=/\r\n?|\n|\u2028|\u2029/,ln=new RegExp(cn.source,`g`);function un(e){return e===10||e===13||e===8232||e===8233}function dn(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(un(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var fn=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,pn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,mn=Object.prototype,hn=mn.hasOwnProperty,gn=mn.toString,_n=Object.hasOwn||(function(e,t){return hn.call(e,t)}),vn=Array.isArray||(function(e){return gn.call(e)===`[object Array]`}),yn=Object.create(null);function bn(e){return yn[e]||(yn[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function xn(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Sn=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Cn=function(e,t){this.line=e,this.column=t};Cn.prototype.offset=function(e){return new Cn(this.line,this.column+e)};var wn=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Tn(e,t){for(var n=1,r=0;;){var i=dn(e,r,t);if(i<0)return new Cn(n,t-r);++n,r=i}}var En={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Dn=!1;function On(e){var t={};for(var n in En)t[n]=e&&_n(e,n)?e[n]:En[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Dn&&typeof console==`object`&&console.warn&&(Dn=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1087
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),vn(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(vn(t.onComment)&&(t.onComment=kn(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function kn(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new wn(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var An=1,jn=2,Mn=4,Nn=8,Pn=16,Fn=32,In=64,Ln=128,Rn=256,zn=512,Bn=1024,Vn=An|jn|Rn;function Hn(e,t){return jn|(e?Mn:0)|(t?Nn:0)}var Un=0,Wn=1,Gn=2,Kn=3,qn=4,Jn=5,Yn=function(e,t,n){this.options=e=On(e),this.sourceFile=e.sourceFile,this.keywords=bn(Xt[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Jt[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=bn(r);var i=(r?r+` `:``)+Jt.strict;this.reservedWordsStrict=bn(i),this.reservedWordsStrictBind=bn(i+` `+Jt.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
1088
- `,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(cn).length)):this.lineStart=0,this.type=H.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?jn:An),this.regexpState=null,this.privateNameStack=[]},Xn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Yn.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},Xn.inFunction.get=function(){return(this.currentVarScope().flags&jn)>0},Xn.inGenerator.get=function(){return(this.currentVarScope().flags&Nn)>0},Xn.inAsync.get=function(){return(this.currentVarScope().flags&Mn)>0},Xn.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Rn|zn))return!1;if(t&jn)return(t&Mn)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Xn.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&An)},Xn.allowSuper.get=function(){return(this.currentThisScope().flags&In)>0||this.options.allowSuperOutsideMethod},Xn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ln)>0},Xn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Xn.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Rn|zn)||t&jn&&!(t&Pn))return!0}return!1},Xn.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Bn||!this.inModule&&e&An)},Xn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Rn)>0},Yn.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},Yn.parse=function(e,t){return new this(t,e).parse()},Yn.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},Yn.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Yn.prototype,Xn);var Zn=Yn.prototype,Qn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Zn.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){pn.lastIndex=e,e+=pn.exec(this.input)[0].length;var t=Qn.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){pn.lastIndex=e+t[0].length;var n=pn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||cn.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,pn.lastIndex=e,e+=pn.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Zn.eat=function(e){return this.type===e&&(this.next(),!0)},Zn.isContextual=function(e){return this.type===H.name&&this.value===e&&!this.containsEsc},Zn.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Zn.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},Zn.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Zn.canInsertSemicolon=function(){return this.type===H.eof||this.type===H.braceR||cn.test(this.input.slice(this.lastTokEnd,this.start))},Zn.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Zn.semicolon=function(){!this.eat(H.semi)&&!this.insertSemicolon()&&this.unexpected()},Zn.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Zn.expect=function(e){this.eat(e)||this.unexpected()},Zn.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var $n=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Zn.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Zn.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Zn.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Zn.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var U=Yn.prototype;U.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==H.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var er={kind:`loop`},tr={kind:`switch`};U.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;pn.lastIndex=this.pos;var t=pn.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(tn(r)){var i=n;do n+=r<=65535?1:2;while(nn(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!Zt.test(a))return!0}return!1},U.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;pn.lastIndex=this.pos;var e=pn.exec(this.input),t=this.pos+e[0].length,n;return!cn.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(nn(n=this.fullCharCodeAt(t+8))||n===92))},U.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;pn.lastIndex=this.pos;var n=pn.exec(this.input),r=this.pos+n[0].length;if(cn.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||nn(a=this.fullCharCodeAt(i))||a===92)return!1;pn.lastIndex=i;var o=pn.exec(this.input);if(r=i+o[0].length,o&&cn.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!tn(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(nn(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(Zt.test(l))return!1;if(t&&!e&&l===`of`){pn.lastIndex=r;var u=pn.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},U.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},U.isUsing=function(e){return this.isUsingKeyword(!1,e)},U.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=H._var,a=`let`),r){case H._break:case H._continue:return this.parseBreakContinueStatement(i,r.keyword);case H._debugger:return this.parseDebuggerStatement(i);case H._do:return this.parseDoStatement(i);case H._for:return this.parseForStatement(i);case H._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case H._class:return e&&this.unexpected(),this.parseClass(i,!0);case H._if:return this.parseIfStatement(i);case H._return:return this.parseReturnStatement(i);case H._switch:return this.parseSwitchStatement(i);case H._throw:return this.parseThrowStatement(i);case H._try:return this.parseTryStatement(i);case H._const:case H._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case H._while:return this.parseWhileStatement(i);case H._with:return this.parseWithStatement(i);case H.braceL:return this.parseBlock(!0,i);case H.semi:return this.parseEmptyStatement(i);case H._export:case H._import:if(this.options.ecmaVersion>10&&r===H._import){pn.lastIndex=this.pos;var o=pn.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===H._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===H.name&&d.type===`Identifier`&&this.eat(H.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},U.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(H.semi)||this.insertSemicolon()?e.label=null:this.type===H.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},U.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},U.parseDoStatement=function(e){return this.next(),this.labels.push(er),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(H._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(H.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},U.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(er),this.enterScope(0),this.expect(H.parenL),this.type===H.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===H._var||this.type===H._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new $n,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===H._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===H._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},U.parseForAfterInit=function(e,t,n){return(this.type===H._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===H._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},U.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,rr|(n?0:ir),!1,t)},U.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(H._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},U.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(H.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},U.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(H.braceL),this.labels.push(tr),this.enterScope(Bn);for(var t,n=!1;this.type!==H.braceR;)if(this.type===H._case||this.type===H._default){var r=this.type===H._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(H.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},U.parseThrowStatement=function(e){return this.next(),cn.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var nr=[];U.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Fn:0),this.checkLValPattern(e,t?qn:Gn),this.expect(H.parenR),e},U.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===H._catch){var t=this.startNode();this.next(),this.eat(H.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(H._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},U.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},U.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(er),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},U.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},U.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},U.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===H._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},U.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},U.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(H.braceL),e&&this.enterScope(0);this.type!==H.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},U.parseFor=function(e,t){return e.init=t,this.expect(H.semi),e.test=this.type===H.semi?null:this.parseExpression(),this.expect(H.semi),e.update=this.type===H.parenR?null:this.parseExpression(),this.expect(H.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},U.parseForIn=function(e,t){var n=this.type===H._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(H.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},U.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(H.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===H._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==H._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==H._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(H.comma))break}return e},U.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Wn:Gn,!1)};var rr=1,ir=2,ar=4;U.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===H.star&&t&ir&&this.unexpected(),e.generator=this.eat(H.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&rr&&(e.id=t&ar&&this.type!==H.name?null:this.parseIdent(),e.id&&!(t&ir)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Wn:Gn:Kn));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Hn(e.async,e.generator)),t&rr||(e.id=this.type===H.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&rr?`FunctionDeclaration`:`FunctionExpression`)},U.parseFunctionParams=function(e){this.expect(H.parenL),e.params=this.parseBindingList(H.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},U.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(H.braceL);this.type!==H.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&or(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},U.parseClassElement=function(e){if(this.eat(H.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(H.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===H.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===H.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(H.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===H.parenL||o!==`method`||i||a){var l=!n.static&&sr(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},U.isClassElementNameStart=function(){return this.type===H.name||this.type===H.privateId||this.type===H.num||this.type===H.string||this.type===H.bracketL||this.type.keyword},U.parseClassElementName=function(e){this.type===H.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},U.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&sr(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},U.parseClassField=function(e){return sr(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&sr(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(H.eq)?(this.enterScope(zn|In),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},U.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Rn|In);this.type!==H.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},U.parseClassId=function(e,t){this.type===H.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Gn,!1)):(t===!0&&this.unexpected(),e.id=null)},U.parseClassSuper=function(e){e.superClass=this.eat(H._extends)?this.parseExprSubscripts(null,!1):null},U.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},U.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];_n(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function or(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function sr(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}U.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==H.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},U.parseExport=function(e,t){if(this.next(),this.eat(H.star))return this.parseExportAllDeclaration(e,t);if(this.eat(H._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==H.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},U.parseExportDeclaration=function(e){return this.parseStatement(null)},U.parseExportDefaultDeclaration=function(){var e;if(this.type===H._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,rr|ar,!1,e)}if(this.type===H._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},U.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),_n(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},U.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},U.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},U.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},U.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},U.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(H.braceL);!this.eat(H.braceR);){if(n)n=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.braceR))break;t.push(this.parseExportSpecifier(e))}return t},U.parseImport=function(e){return this.next(),this.type===H.string?(e.specifiers=nr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===H.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},U.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Gn),this.finishNode(e,`ImportSpecifier`)},U.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Gn),this.finishNode(e,`ImportDefaultSpecifier`)},U.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Gn),this.finishNode(e,`ImportNamespaceSpecifier`)},U.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===H.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(H.comma)))return e;if(this.type===H.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(H.braceL);!this.eat(H.braceR);){if(t)t=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.braceR))break;e.push(this.parseImportSpecifier())}return e},U.parseWithClause=function(){var e=[];if(!this.eat(H._with))return e;this.expect(H.braceL);for(var t={},n=!0;!this.eat(H.braceR);){if(n)n=!1;else if(this.expect(H.comma),this.afterTrailingComma(H.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;_n(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},U.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===H.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(H.colon),this.type!==H.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},U.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===H.string){var e=this.parseLiteral(this.value);return Sn.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},U.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},U.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var cr=Yn.prototype;cr.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},cr.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},cr.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},cr.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==H.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},cr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case H.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(H.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case H.braceL:return this.parseObj(!0)}return this.parseIdent()},cr.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(H.comma),t&&this.type===H.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===H.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===H.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},cr.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},cr.parseBindingListItem=function(e){return e},cr.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(H.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},cr.checkLValSimple=function(e,t,n){t===void 0&&(t=Un);var r=t!==Un;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Gn&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(_n(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Jn&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},cr.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Un),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},cr.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Un),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var lr=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},ur={b_stat:new lr(`{`,!1),b_expr:new lr(`{`,!0),b_tmpl:new lr("${",!1),p_stat:new lr(`(`,!1),p_expr:new lr(`(`,!0),q_tmpl:new lr("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new lr(`function`,!1),f_expr:new lr(`function`,!0),f_expr_gen:new lr(`function`,!0,!1,null,!0),f_gen:new lr(`function`,!1,!1,null,!0)},dr=Yn.prototype;dr.initialContext=function(){return[ur.b_stat]},dr.curContext=function(){return this.context[this.context.length-1]},dr.braceIsBlock=function(e){var t=this.curContext();return t===ur.f_expr||t===ur.f_stat?!0:e===H.colon&&(t===ur.b_stat||t===ur.b_expr)?!t.isExpr:e===H._return||e===H.name&&this.exprAllowed?cn.test(this.input.slice(this.lastTokEnd,this.start)):e===H._else||e===H.semi||e===H.eof||e===H.parenR||e===H.arrow?!0:e===H.braceL?t===ur.b_stat:e===H._var||e===H._const||e===H.name?!1:!this.exprAllowed},dr.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},dr.updateContext=function(e){var t,n=this.type;n.keyword&&e===H.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},dr.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},H.parenR.updateContext=H.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===ur.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},H.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?ur.b_stat:ur.b_expr),this.exprAllowed=!0},H.dollarBraceL.updateContext=function(){this.context.push(ur.b_tmpl),this.exprAllowed=!0},H.parenL.updateContext=function(e){var t=e===H._if||e===H._for||e===H._with||e===H._while;this.context.push(t?ur.p_stat:ur.p_expr),this.exprAllowed=!0},H.incDec.updateContext=function(){},H._function.updateContext=H._class.updateContext=function(e){e.beforeExpr&&e!==H._else&&(e!==H.semi||this.curContext()===ur.p_stat)&&!(e===H._return&&cn.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==H.colon&&e!==H.braceL||this.curContext()!==ur.b_stat)?this.context.push(ur.f_expr):this.context.push(ur.f_stat),this.exprAllowed=!1},H.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},H.backQuote.updateContext=function(){this.curContext()===ur.q_tmpl?this.context.pop():this.context.push(ur.q_tmpl),this.exprAllowed=!1},H.star.updateContext=function(e){if(e===H._function){var t=this.context.length-1;this.context[t]===ur.f_expr?this.context[t]=ur.f_expr_gen:this.context[t]=ur.f_gen}this.exprAllowed=!0},H.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==H.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var W=Yn.prototype;W.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},W.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===H.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(H.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},W.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new $n,r=!0);var s=this.start,c=this.startLoc;(this.type===H.parenL||this.type===H.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===H.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===H.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},W.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(H.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(H.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},W.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},W.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==H._in)&&a>r){var o=this.type===H.logicalOR||this.type===H.logicalAND,s=this.type===H.coalesce;s&&(a=H.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===H.coalesce||s&&(this.type===H.logicalOR||this.type===H.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},W.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},W.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===H.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&fr(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&pr(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===H.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==H._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(H.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function fr(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&fr(e.expression)}function pr(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&pr(e.expression)||e.type===`ParenthesizedExpression`&&pr(e.expression)}W.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},W.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},W.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(H.arrow)},W.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},W.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(H.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(H.bracketL);if(l||c&&this.type!==H.parenL&&this.type!==H.backQuote||this.eat(H.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(H.bracketR)):u.property=this.type===H.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(H.parenL)){var d=new $n,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(H.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===H.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},W.parseExprAtom=function(e,t,n){this.type===H.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case H._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===H.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==H.dot&&this.type!==H.bracketL&&this.type!==H.parenL&&this.unexpected(),this.finishNode(r,`Super`);case H._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case H.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(H._function))return this.overrideContext(ur.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(H.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===H.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(H.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case H.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case H.num:case H.string:return this.parseLiteral(this.value);case H._null:case H._true:case H._false:return r=this.startNode(),r.value=this.type===H._null?null:this.type===H._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case H.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case H.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(H.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case H.braceL:return this.overrideContext(ur.b_expr),this.parseObj(!1,e);case H._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case H._class:return this.parseClass(this.startNode(),!1);case H._new:return this.parseNew();case H.backQuote:return this.parseTemplate();case H._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},W.parseExprAtomDefault=function(){this.unexpected()},W.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===H.parenL&&!e)return this.parseDynamicImport(t);if(this.type===H.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},W.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(H.parenR)?e.options=null:(this.expect(H.comma),this.afterTrailingComma(H.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(H.parenR)||(this.expect(H.comma),this.afterTrailingComma(H.parenR)||this.unexpected())));else if(!this.eat(H.parenR)){var t=this.start;this.eat(H.comma)&&this.eat(H.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},W.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},W.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},W.parseParenExpression=function(){this.expect(H.parenL);var e=this.parseExpression();return this.expect(H.parenR),e},W.shouldParseArrow=function(e){return!this.canInsertSemicolon()},W.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new $n,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==H.parenR;){if(l?l=!1:this.expect(H.comma),a&&this.afterTrailingComma(H.parenR,!0)){u=!0;break}if(this.type===H.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===H.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(H.parenR),e&&this.shouldParseArrow(c)&&this.eat(H.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},W.parseParenItem=function(e){return e},W.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var mr=[];W.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===H.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(H.parenL)?this.parseExprList(H.parenR,this.options.ecmaVersion>=8,!1):mr,this.finishNode(e,`NewExpression`)},W.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===H.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
1086
+ })(createStore,sharedAPI,onStatus);})(documentTools,sharedAPI,onStatus);return {documentTools,sharedDocuments}}`;function Pt(){return()=>{}}function Ft(){return{}}vt();function It({assert:e,plain:t,safeDocument:n,stableStringify:r}){let i=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>i(e,t[n]));let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&i(e[n],t[n]))},a=(e,t)=>e.exists===t.exists&&(!e.exists||i(e.value,t.value)),o=(e,t)=>Object.hasOwn(e,t)?{exists:!0,value:e[t]}:{exists:!1},s=e=>Array.isArray(e)&&e.every(e=>t(e)&&typeof e.id==`string`)&&new Set(e.map(e=>e.id)).size===e.length;function c(e,n,r){let i=[];if(t(e)&&t(n))for(let l of new Set([...Object.keys(e),...Object.keys(n)])){let u=o(e,l),d=o(n,l);a(u,d)||(!(r.length===0&&[`projectType`,`semanticContext`].includes(l))&&u.exists&&d.exists&&(t(u.value)&&t(d.value)||s(u.value)&&s(d.value))?i.push(...c(u.value,d.value,[...r,l])):i.push({path:[...r,l],before:u,after:d}))}else if(s(e)&&s(n)){let t=new Map(e.map(e=>[e.id,e])),a=new Map(n.map(e=>[e.id,e]));for(let e of new Set([...t.keys(),...a.keys()]))t.has(e)&&a.has(e)?i.push(...c(t.get(e),a.get(e),[...r,{id:e}])):i.push({path:[...r,{id:e}],before:t.has(e)?{exists:!0,value:t.get(e)}:{exists:!1},after:a.has(e)?{exists:!0,value:a.get(e)}:{exists:!1}});let o=[...e.filter(e=>a.has(e.id)).map(e=>e.id),...n.filter(e=>!t.has(e.id)).map(e=>e.id)];JSON.stringify(o)!==JSON.stringify(n.map(e=>e.id))&&i.push({path:r,before:{exists:!0,value:n.map(e=>t.get(e.id)||e)},after:{exists:!0,value:n},order:n.map(e=>e.id),expectedOrder:e.map(e=>e.id)})}return i}function l(e,t,r=[]){return n(e),n(t),c(e,t,r)}function u(n,r){let i=n;for(let n of r.slice(0,-1))t(n)?(e(Array.isArray(i),`CONFLICT`,`Collection removed`),i=i.find(e=>e?.id===n.id)):(e(i&&Object.hasOwn(i,n),`CONFLICT`,`Parent removed`),i=i[n]),e(i&&typeof i==`object`,`CONFLICT`,`Parent removed`);let a=r.at(-1);if(t(a)){e(Array.isArray(i),`CONFLICT`,`Collection removed`);let t=i.findIndex(e=>e?.id===a.id);return{parent:i,key:t,state:t<0?{exists:!1}:{exists:!0,value:i[t]},collection:!0,id:a.id}}return e(t(i),`CONFLICT`,`Parent removed`),{parent:i,key:a,state:o(i,a),collection:!1}}function d(r,i){n(r),n(i),e(Array.isArray(i)&&i.length<=2e3,`LIMIT`,`Too many operations`);let o=structuredClone(r);for(let n of i){e(Array.isArray(n.path)&&n.path.length>0&&n.path.length<=30&&n.path.every(e=>typeof e==`string`&&e.length>0&&![`__proto__`,`constructor`,`prototype`].includes(e)||t(e)&&typeof e.id==`string`&&Object.keys(e).length===1),`PATCH`,`Invalid operation path`),e(t(n.before)&&t(n.after)&&typeof n.before.exists==`boolean`&&typeof n.after.exists==`boolean`,`PATCH`,`Expected before/after preconditions`),e(!(n.path.at(-1)===`id`&&t(n.path.at(-2))),`PATCH`,`Collection identity is immutable`);let r=u(o,n.path);if(n.order){e(Array.isArray(r.state.value)&&Array.isArray(n.order)&&Array.isArray(n.expectedOrder),`PATCH`,`Invalid order operation`);let t=r.state.value,i=new Set(n.expectedOrder);e(new Set(n.order).size===n.order.length&&n.order.every(e=>typeof e==`string`&&t.some(t=>t.id===e)),`PATCH`,`Invalid order IDs`);let a=new Set(n.order);if(JSON.stringify(t.filter(e=>a.has(e.id)).map(e=>e.id))===JSON.stringify(n.order))continue;e(t.filter(e=>i.has(e.id)).map(e=>e.id).join(`\0`)===n.expectedOrder.filter(e=>t.some(t=>t.id===e)).join(`\0`),`CONFLICT`,`Collection order changed`),r.parent[r.key]=[...n.order.map(e=>t.find(t=>t.id===e)),...t.filter(e=>!a.has(e.id))];continue}e(a(r.state,n.before)||a(r.state,n.after),`CONFLICT`,`Concurrent change at ${n.path.map(e=>typeof e==`string`?e:e.id).join(`.`)}`),!a(r.state,n.after)&&(r.collection?n.after.exists?(e(n.after.value?.id===r.id,`PATCH`,`Collection ID mismatch`),r.key<0?r.parent.push(structuredClone(n.after.value)):r.parent[r.key]=structuredClone(n.after.value)):r.parent.splice(r.key,1):n.after.exists?r.parent[r.key]=structuredClone(n.after.value):delete r.parent[r.key])}return o}return Object.freeze({isKeyed:s,diffDocument:l,applyOperations:d})}var{isKeyed:Lt,diffDocument:Rt,applyOperations:zt}=It({assert:z,plain:B,safeDocument:ct,stableStringify:lt});vt();var Bt=Object.freeze({stateBytes:393216,requestBytes:8e5,pendingBytes:2097152});function V(e={},t){ct(t),z(new TextEncoder().encode(JSON.stringify(t)).length<=Bt.requestBytes,`VIEW_STATE`,`Shared edit exceeds 800,000 bytes`),z(B(e)&&B(t)&&B(t.values)&&B(t.before),`VIEW_STATE`,`Expected a shared view patch`);let n=Object.keys(t.values);z(t.merge===void 0||typeof t.merge==`boolean`,`VIEW_STATE`,`Invalid structured merge option`);let r={...e};z(n.length>0&&n.length<=100&&n.every(e=>/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)),`VIEW_STATE`,`Use bounded named view fields`);for(let i of n){let n=t.before[i];z(B(n)&&typeof n.exists==`boolean`,`VIEW_STATE`,`Missing field precondition`);let a=Object.hasOwn(e,i);if(t.merge&&n.exists&&a&&B(n.value)&&B(t.values[i])&&B(e[i])){let a=Rt({value:n.value},{value:t.values[i]});r[i]=zt({value:e[i]},a).value;continue}z(a===n.exists&&(!a||lt(e[i])===lt(n.value))||a&&lt(e[i])===lt(t.values[i]),`CONFLICT`,`This field changed. Read the shared state before applying your edit.`),r[i]=structuredClone(t.values[i])}return z(new TextEncoder().encode(JSON.stringify(r)).length<=Bt.stateBytes,`VIEW_STATE`,`Shared view state exceeds 384 KiB`),r}function Vt(e,t,n=Bt,r={}){let i={state:{},outputs:{},memory:null,canEdit:!1},a=!1,o=0,s=null,c=!1,l=[],u=0,d=0,f=new Set,p=new Map,m=null,h=null,g=null,_=(e,t)=>{t=Error(String(t?.message||`Shared edit failed`).slice(0,1e3));let n=e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[];if(!n.length){m=t;return}for(let e of n){if(!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)){m=t;continue}if(p.size>=100&&!p.has(e)){m=Error(`Too many unresolved shared fields. Reopen the Block to recover.`);break}p.set(e,t)}},v=()=>{h&&g===null&&(g=setTimeout(()=>{if(g=null,!h||s||l.length)return;let e=h;h=null;let t=c?Error(`Block closed`):m||p.values().next().value;t?e.reject(t):e.resolve({queued:!0})},0))};r.captureControlState=()=>({attempts:u,snapshotVersion:d,closed:c,ready:a,pending:!!s,queued:l.length,failed:!!m||p.size>0}),r.flushSharedWrites=()=>{if(h)return h.promise;let e,t,n=new Promise((n,r)=>{e=n,t=r});return h={promise:n,resolve:e,reject:t},v(),n};let y=()=>{for(let e of f)try{e(structuredClone(i))}catch{}},b=e=>{let t=Error(e);s&&=(clearTimeout(s.timer),_(s.values,t),s.reject(t),null);for(let e of l.splice(0))_(e.values,t),e.reject(t);v()},x=()=>{if(s||!l.length||c)return;if(!a||!i.canEdit){b(`Shared editing is unavailable or read only`);return}s=l.shift();let n=s;n.timer=setTimeout(()=>{c=!0,a=!1,i={...i,canEdit:!1},b(`Shared edit acknowledgement timed out. Reopen the Block to recover.`),y()},15e3),parent.postMessage({channel:e,session:t,op:`shared-view-update`,id:n.id,request:{values:n.values,before:n.before,...n.merge?{merge:!0}:{}}},`*`)};addEventListener(`message`,n=>{let r=n.data;if(!c&&n.source===parent&&r&&r.channel===e&&r.session===t){if(r.op===`shared-view`)d++,i=r.value,a=!0,i.canEdit||b(`Shared editing is unavailable or read only`),y(),x();else if(r.op===`shared-view-result`&&s?.id===r.id){let e=s;if(clearTimeout(e.timer),s=null,r.error){let t=Error(r.error);_(e.values,t),e.reject(t),b(`A previous edit failed. Read the shared state before trying again.`)}else{let t={...i.state};for(let n of Object.keys(e.values)){let r=e.before[n];Object.hasOwn(t,n)===r.exists&&(!r.exists||JSON.stringify(t[n])===JSON.stringify(r.value))&&(t[n]=e.values[n])}i={...i,state:t};for(let t of Object.keys(e.values))p.delete(t);e.resolve({queued:!0}),y()}x(),v()}else r.op===`dispose`&&(c=!0,a=!1,f.clear(),b(`Block closed`))}});let S={getShared(){return structuredClone(i)},onShared(e){if(typeof e!=`function`)throw Error(`Expected a function`);return f.add(e),a&&e(structuredClone(i)),()=>f.delete(e)},updateShared(e,t,r){u++;let d=t=>(_(e,t),v(),Promise.reject(t));if(c||!a||!i.canEdit)return d(Error(`Shared editing is unavailable or read only`));if(l.length>=32)return d(Error(`Too many pending shared edits. Wait for synchronization.`));let f={},p=!1,m=0;try{if(r!==void 0){if(!r||typeof r!=`object`||Array.isArray(r)||Object.keys(r).some(e=>e!==`merge`)||typeof r.merge!=`boolean`)throw Error(`Expected a structured merge option`);if(p=r.merge,p&&t===void 0)throw Error(`Structured edits require the exact base preconditions`)}if(!e||Array.isArray(e)||typeof e!=`object`||new TextEncoder().encode(JSON.stringify(e)).length>n.stateBytes)throw Error(`Expected bounded view fields`);e=structuredClone(e);let a=Object.keys(e);if(!a.length||a.length>100||a.some(e=>!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(e)))throw Error(`Use bounded named view fields`);let o={...i.state,...s?.values};for(let e of l)Object.assign(o,e.values);for(let e of a)f[e]=Object.hasOwn(o,e)?{exists:!0,value:structuredClone(o[e])}:{exists:!1};if(t!==void 0){if(!t||Array.isArray(t)||typeof t!=`object`)throw Error(`Expected field preconditions`);f=structuredClone(t);for(let e of a)if(!f[e]||typeof f[e].exists!=`boolean`)throw Error(`Missing field precondition`)}if(m=new TextEncoder().encode(JSON.stringify({values:e,before:f,...p?{merge:!0}:{}})).length,m>n.requestBytes)throw Error(`Shared edit exceeds 800,000 bytes`);if(m+(s?.bytes||0)+l.reduce((e,t)=>e+t.bytes,0)>n.pendingBytes)throw Error(`Pending shared edits exceed 2 MiB. Wait for synchronization.`)}catch(e){return d(e)}return new Promise((t,n)=>{l.push({id:String(++o),resolve:t,reject:n,values:e,before:f,merge:p,bytes:m}),x()})}};return Object.defineProperty(S,"announce",{value:()=>{a&&!c&&y()}}),S}function Ht(e,t=()=>{},n=()=>{}){let r=new Set(`div.section.article.header.footer.p.span.strong.em.i.small.h1.h2.h3.h4.label.button.input.textarea.select.option.ul.ol.li.table.thead.tbody.tr.th.td.details.summary.output.progress.img`.split(`.`)),i=new Set([`DIV`,`SPAN`,`SECTION`,`ARTICLE`,`MAIN`,`ASIDE`,`UL`,`OL`,`TBODY`]),a=new Set([`tag`,`text`,`children`,`id`,`className`,`action`,`value`,`type`,`checked`,`disabled`,`placeholder`,`min`,`max`,`step`,`label`]),o=new Set,s=new WeakMap,c=new WeakMap,l=new Map,u=new Map,d=!1,f=0,p=0,m=!1,h=new Set,g=()=>{try{n()}catch{}},_=(e,t)=>{if(!e)throw Error(t)},v=(e,t=1e4)=>(_(typeof e==`string`&&e.length<=t,`Dynamic control text exceeds its limit`),e),y=e=>e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type===`text`,b=(e,t,n)=>{let r=s.get(e);if(m||d||!r?.action||r.event!==n||!t.contains(e)||e.disabled)return;let i={action:r.action,value:e.value,checked:e.checked===!0,event:n};for(let e of o)try{Promise.resolve(e({...i})).then(g,()=>{})}catch{}},x=(e,t,n=e.value)=>{if(d||!t.contains(e)||e.disabled||!y(e))return;let r=c.get(e),i=s.get(e),a={composing:!0,cancelled:!1,action:i?.action,event:i?.event,type:e.type,declared:i?.declared,initialValue:n,conflict:r?.conflict===!0,problem:r?.problem,suppress:null};c.set(e,a),l.set(e,t)},S=(e,n,r,i)=>{if(!r.conflict){r.conflict=!0,r.problem=i,u.set(e,n);try{t(i)}catch{}}},C=e=>{for(let t of l.keys())(t===e||e.contains?.(t))&&(c.get(t).cancelled=!0,l.delete(t));for(let t of u.keys())(t===e||e.contains?.(t))&&u.delete(t)},w=(t,n)=>{v(t,120);let o=e.getElementById(t);_(o&&i.has(o.tagName),`Choose an existing container for dynamic controls`),_(Array.isArray(n)&&JSON.stringify(n).length<=262144,`Dynamic controls exceed 256 KiB`);let u=0,d=new Set,w=(n,i)=>{_(++u<=1e3&&i<=12,`Dynamic controls exceed 1000 elements or 12 levels`),_(n&&typeof n==`object`&&!Array.isArray(n)&&Object.keys(n).every(e=>a.has(e)),`Unsupported dynamic control field`),_(r.has(n.tag),`Unsupported dynamic control tag`);let f=e.createElement(n.tag);if(n.id!==void 0){let r=v(n.id,120),i=e.getElementById(r);_(r&&r!==t&&!d.has(r)&&(!i||o.contains(i)),`Dynamic control IDs must be unique`),d.add(r),f.id=r}n.className!==void 0&&(f.className=v(n.className,240)),n.text!==void 0&&(f.textContent=v(n.text)),n.label!==void 0&&f.setAttribute(`aria-label`,v(n.label,240)),n.type!==void 0&&(_(n.tag===`input`&&[`text`,`number`,`range`,`checkbox`,`radio`,`color`].includes(n.type),`Unsupported dynamic input type`),f.type=n.type);for(let e of[`checked`,`disabled`])n[e]!==void 0&&(_(typeof n[e]==`boolean`,`Control flags must be boolean`),f[e]=n[e]);for(let e of[`min`,`max`,`step`])n[e]!==void 0&&(_(typeof n[e]==`string`||typeof n[e]==`number`&&Number.isFinite(n[e]),`Control values must be text or finite numbers`),f[e]=v(String(n[e]),1e4));if(n.placeholder!==void 0&&(f.placeholder=v(n.placeholder,240)),n.tag===`button`&&(f.type=`button`),n.children!==void 0){_(Array.isArray(n.children)&&n.text===void 0,`Use children or text for a control`);for(let e of n.children)f.appendChild(w(e,i+1))}if(n.value!==void 0&&(_(typeof n.value==`string`||typeof n.value==`number`&&Number.isFinite(n.value),`Control values must be text or finite numbers`),f.value=v(String(n.value),1e4)),n.action!==void 0){let e=v(n.action,120);_(e&&[`button`,`input`,`textarea`,`select`].includes(n.tag),`Actions belong to interactive controls`)}if([`button`,`input`,`textarea`,`select`].includes(n.tag)){let e=n.tag===`button`?`click`:[`checkbox`,`radio`].includes(n.type)||n.tag===`select`?`change`:`input`;s.set(f,{action:n.action,event:e,declared:f.value,declaredDisabled:f.disabled,root:o,handle:`view-control-`+String(++p)});for(let e of[`click`,`input`,`change`])f.addEventListener(e,t=>{let n=c.get(f);if(e===`input`&&t.isComposing){n?.composing||x(f,o,s.get(f)?.declared??f.value);return}if(!(n?.composing||n?.conflict)){if(e===`input`&&n?.suppress!==null&&n?.suppress!==void 0){let e=f.value===n.suppress;if(n.suppress=null,e)return}b(f,o,e)}});(n.tag===`input`||n.tag===`textarea`)&&(f.addEventListener(`compositionstart`,()=>x(f,o)),f.addEventListener(`compositionend`,()=>{let e=c.get(f);if(!e?.composing)return;e.composing=!1,e.suppress=f.value,l.delete(f);let t=s.get(f);!e.cancelled&&!e.conflict&&f.value!==e.initialValue&&y(f)&&e.type===f.type&&e.action===t?.action&&e.event===t?.event&&b(f,o,`input`),e.suppress=f.value}))}return f},T=e.createDocumentFragment();for(let e of n)T.appendChild(w(e,0));_(e.querySelectorAll(`*`).length-o.querySelectorAll(`*`).length+u<=5e3,`This interface exceeds 5000 elements`);let E=e.activeElement,D=E&&o.contains(E)&&typeof E.selectionStart==`number`?{start:E.selectionStart,end:E.selectionEnd,direction:E.selectionDirection}:null,O=(e,t)=>{let n=Array.from(e.childNodes),r=new Set,i=new Map(n.filter(e=>e.nodeType===1&&e.id).map(e=>[e.id,e]));Array.from(t.childNodes).forEach((t,a)=>{let l=t.nodeType===1?t.id:``,u=l?i.get(l):n[a];if(!u||r.has(u)||u.nodeType!==t.nodeType||u.nodeName!==t.nodeName||u.nodeType===1&&u.id!==l)u=t;else if(u.nodeType===3)u.nodeValue!==t.nodeValue&&(u.nodeValue=t.nodeValue);else{let e=`value`in t?t.value:void 0,n=c.get(u),r=s.get(t);n?.composing&&(t.disabled&&S(u,o,n,`Editing access changed while you were composing. Your local draft is retained here. Review it before reopening this Block.`),t.disabled||n.action!==r?.action||n.event!==r?.event||n.type!==t.type?n.cancelled=!0:!n.cancelled&&e!==n.declared&&S(u,o,n,`Text changed elsewhere while you were composing. Your local draft is retained here. Copy it before reopening this Block to review the shared version.`));for(let e of[`id`,`class`,`aria-label`,`type`,`min`,`max`,`step`,`placeholder`]){let n=t.getAttribute(e);n===null?u.removeAttribute(e):u.getAttribute(e)!==n&&u.setAttribute(e,n)}O(u,t),`disabled`in t&&(u.disabled=t.disabled),`checked`in t&&(u.checked=t.checked),e!==void 0&&u.value!==e&&!n?.composing&&!n?.conflict&&(u.value=e),s.has(t)&&s.set(u,s.get(t))}r.add(u);let d=e.childNodes[a];d!==u&&e.insertBefore(u,d||null)});for(let t of n)!r.has(t)&&t.parentNode===e&&(C(t),t.remove())};O(o,T),h.add(o),f++,m&&j(!0),g(),E&&o.contains(E)&&!E.disabled&&!c.get(E)?.composing&&(e.activeElement!==E&&E.focus({preventScroll:!0}),D&&typeof E.selectionStart==`number`&&typeof E.setSelectionRange==`function`&&E.setSelectionRange(D.start,D.end,D.direction))},T=()=>{_(!d,`Dynamic controls are closed`);let e=[...u].find(([e,t])=>t.contains(e)&&e.isConnected);if(e)throw Error(c.get(e[0]).problem);_(![...l].some(([e,t])=>t.contains(e)&&e.isConnected&&!e.disabled),`Finish composing text before continuing.`)},E=()=>{let e=new Set,t=[];for(let n of h)if(n.isConnected)for(let r of n.querySelectorAll(`button,input,textarea,select`)){let i=s.get(r);i?.action&&i.root===n&&!e.has(r)&&(e.add(r),t.push(r))}return t},D=t=>{for(let n=t;n;n=n.parentElement){if(n.hidden)return!0;let t=e.defaultView?.getComputedStyle(n);if(t?.display===`none`||[`hidden`,`collapse`].includes(t?.visibility)||t?.opacity===`0`)return!0}return!1},O=e=>String(e.getAttribute(`aria-label`)||e.textContent||e.placeholder||`Control`).slice(0,240),k=e=>e.tagName===`SELECT`?Array.from(e.options).map(e=>({value:e.value,label:e.textContent})):null,A=e=>{let t=s.get(e);return JSON.stringify({action:t.action,event:t.event,root:t.root.id,tag:e.tagName,type:e.type,value:e.value,checked:e.checked,disabled:e.disabled,hidden:D(e),label:O(e),choices:k(e)})},j=e=>{for(let t of E())t.disabled=e||s.get(t).declaredDisabled};return Object.freeze({render:w,inspectControls:({offset:e=0,limit:t=20}={})=>{_(!d,`Dynamic controls are closed`),_(Number.isSafeInteger(e)&&e>=0&&Number.isSafeInteger(t)&&t>=1&&t<=20,`Choose a bounded control page`);let n=E();return _(e<=n.length,`Choose a current control page`),{revision:f,total:n.length,offset:e,nextOffset:e+t<n.length?e+t:null,controls:n.slice(e,e+t).map(e=>{let t=s.get(e),n=String(e.value??``);return{id:t.handle,action:t.action,label:O(e),tag:e.tagName.toLowerCase(),type:e.type,event:t.event,disabled:e.disabled,hidden:D(e),value:n.slice(0,240),valuePartial:n.length>240,...typeof e.checked==`boolean`?{checked:e.checked}:{},...e.tagName===`select`?{choices:k(e).slice(0,40),choicesPartial:e.options.length>40}:{},identity:A(e)}})}},dispatchControl:async(e,t=async()=>{})=>{_(!m,`A declared control is already running`),T(),_(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).every(e=>[`id`,`revision`,`identity`,`value`,`checked`].includes(e))&&typeof e.id==`string`&&e.revision===f&&typeof e.identity==`string`,`The declared control changed`);let n=E().find(t=>s.get(t).handle===e.id),r=n&&s.get(n);_(n&&A(n)===e.identity,`The declared control changed`),_(!n.disabled&&!D(n),`This declared control is unavailable`),_(o.size>0,`This declared control has no native handler`),n.tagName===`BUTTON`?_(!Object.hasOwn(e,`value`)&&!Object.hasOwn(e,`checked`),`Buttons take no input value`):[`checkbox`,`radio`].includes(n.type)?(_(typeof e.checked==`boolean`&&!Object.hasOwn(e,`value`),`Choose a checkbox value`),n.checked=e.checked):(_((typeof e.value==`string`&&e.value.length<=1e4||typeof e.value==`number`&&Number.isFinite(e.value))&&!Object.hasOwn(e,`checked`),`Choose a bounded control value`),n.tagName===`SELECT`&&_(Array.from(n.options).some(t=>t.value===String(e.value)),`Choose a declared option`),n.value=String(e.value));let i={action:r.action,value:n.value,checked:n.checked,event:r.event};m=!0,j(!0);try{let e=[];for(let t of o)try{e.push(Promise.resolve(t({...i})))}catch(t){e.push(Promise.reject(t))}let n=await Promise.allSettled(e);_(!d,`Dynamic controls are closed`),await t(),_(!d,`Dynamic controls are closed`);let r=n.find(e=>e.status===`rejected`);if(r)throw r.reason;return{settled:!0}}finally{m=!1,j(!1),g()}},onAction(e){return _(typeof e==`function`&&o.size<16,`Register at most 16 action listeners`),o.add(e),()=>o.delete(e)},assertCommitted:T,async flushAll(){return T(),{queued:!0}},dispose(){d=!0,h.clear();for(let e of l.keys())c.get(e).cancelled=!0;l.clear(),u.clear(),o.clear()}})}function Ut(e=[]){let t=new Set([`__proto__`,`prototype`,`constructor`]),n=new Set(e);function r(e,n=0,i={nodes:0}){if(n>32||++i.nodes>5e4)throw Error(`Field data exceeds its complexity limit.`);if(!(e===null||[`string`,`boolean`].includes(typeof e))&&!(typeof e==`number`&&Number.isFinite(e))){if(!e||typeof e!=`object`||!Array.isArray(e)&&![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw Error(`Fields accept plain JSON only.`);if(Object.getOwnPropertySymbols(e).length)throw Error(`Fields accept JSON keys only.`);for(let a of Object.getOwnPropertyNames(e)){if(Array.isArray(e)&&a===`length`)continue;let o=Object.getOwnPropertyDescriptor(e,a);if(t.has(a)||!o||!o.enumerable||!Object.hasOwn(o,`value`))throw Error(`Unsafe field data.`);r(o.value,n+1,i)}}}let i=e=>{r(e);let t=JSON.stringify(e);if(t.length>2097152)throw Error(`Field data exceeds 2 MiB.`);return JSON.parse(t)},a=e=>{if(!Array.isArray(e)||e.length<1||e.length>12||e.some(e=>typeof e!=`string`&&!Number.isSafeInteger(e)||typeof e==`string`&&(t.has(e)||e.length>240)||typeof e==`number`&&(e<0||e>1e4)))throw Error(`Choose a safe field path.`)};function o(e,t){a(t),r(e);let n=e;for(let e of t){if(!n||typeof n!=`object`||!Object.hasOwn(n,e))return;n=n[e]}return n===void 0?void 0:i(n)}function s(e,t,n){a(t);let o=i(e);r(n);let s=o;for(let e=0;e<t.length-1;e++){let n=t[e];(!Object.hasOwn(s,n)||s[n]===null||typeof s[n]!=`object`)&&(s[n]=typeof t[e+1]==`number`?[]:{}),s=s[n]}return s[t.at(-1)]=i(n),o}function c(e){return Object.hasOwn(e,`default`)?i(e.default):Array.isArray(e.enum)&&e.enum.length?i(e.enum[0]):e.type===`object`?{}:e.type===`array`?[]:e.type===`boolean`?!1:[`integer`,`number`].includes(e.type)?Math.max(e.minimum||0,0):``}function l(e,t,i,{canEdit:a=!0,busy:o=!1}={}){r(e),r(t),r(i);let s=0,c=[],l=[],u=(e,t,n)=>{let r=`field-${l.length}`;return l.push({id:r,kind:e,path:t,s:n}),r};function d(e,t,r,i,c,f){if(++s>150||f>5)return[{tag:`p`,text:`This task needs a custom interface for its remaining fields.`}];let p=[{tag:`label`,text:String(i).slice(0,240)+(c?` *`:` (optional)`)}],m=o||!a||n.has(t[0]);if(e.description&&p.push({tag:`small`,text:String(e.description).slice(0,1e3)}),e.type===`object`&&e.properties)for(let n of Object.keys(e.properties))p.push({tag:`section`,children:d(e.properties[n],t.concat(n),r?.[n],e.properties[n].title||n,(e.required||[]).includes(n),f+1)});else if(e.type===`array`){let n=Array.isArray(r)?r:[];n.slice(0,20).forEach((n,r)=>p.push({tag:`section`,className:`connection-array`,children:d(e.items||{},t.concat(r),n,`Item `+(r+1),!0,f+1).concat([{tag:`button`,text:`Remove item`,action:u(`remove`,t.concat(r),e),disabled:m}])})),n.length>20&&p.push({tag:`p`,text:`Showing 20 items. All selected items remain in this input.`}),p.push({tag:`button`,text:`Add item`,action:u(`add`,t,e),disabled:m||n.length>=20})}else Array.isArray(e.enum)&&e.enum.length&&e.enum.every(e=>typeof e==`string`)?p.push({tag:`select`,id:`control-${l.length}`,value:r===void 0?``:String(r),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240),children:[{tag:`option`,value:``,text:`Choose…`},...e.enum.slice(0,100).map(e=>({tag:`option`,value:e,text:e}))]}):e.type===`boolean`?p.push({tag:`input`,id:`control-${l.length}`,type:`checkbox`,checked:r===!0,action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240)}):[`integer`,`number`].includes(e.type)?p.push({tag:`input`,id:`control-${l.length}`,type:`number`,value:r===void 0?``:String(r),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240),...e.minimum===void 0?{}:{min:e.minimum},...e.maximum===void 0?{}:{max:e.maximum},step:e.type===`integer`?1:`any`}):e.type===`string`||!e.type?p.push({tag:`textarea`,id:`control-${l.length}`,value:r===void 0?``:String(r).slice(0,1e4),action:u(`edit`,t,e),disabled:m,label:String(i).slice(0,240)}):p.push({tag:`p`,text:`Select a compatible upstream value for this field.`});return p}for(let[n,r]of Object.entries(t)){let t=e.properties?.[r];if(!t)throw Error(`Choose a schema-declared input.`);c.push({tag:`section`,children:d(t,[n],i[n],t.title||r,(e.required||[]).includes(r),0)})}return{tree:c,actions:l}}function u(e,t,i){r(t),r(i);let a=t.find(e=>e.id===i.action);if(!a)throw Error(`The field changed. Read its current controls.`);if(n.has(a.path[0]))throw Error(`This input is connected. Change its source in Flow.`);if(a.kind===`add`){let t=o(e,a.path)||[];if(!Array.isArray(t)||t.length>=20)throw Error(`Use at most 20 locally edited items.`);return s(e,a.path,[...t,c(a.s.items||{})])}if(a.kind===`remove`){let t=a.path.slice(0,-1),n=o(e,t);if(!Array.isArray(n))throw Error(`The list changed.`);return s(e,t,n.filter((e,t)=>t!==a.path.at(-1)))}let l=a.s.type===`boolean`?i.checked:[`integer`,`number`].includes(a.s.type)?i.value===``?NaN:Number(i.value):i.value;if(typeof l==`number`&&(!Number.isFinite(l)||a.s.type===`integer`&&!Number.isSafeInteger(l)))throw Error(`Enter a valid number.`);return s(e,a.path,l)}function d(e,t,a){let o=i(e);r(t),r(a);for(let e of Object.keys(a))!n.has(e)&&Object.hasOwn(t,e)&&(o[e]=i(t[e]));return o}function f(e,t,a){r(e),r(t),r(a);let o={},s={};for(let r of Object.keys(a))!n.has(r)&&Object.hasOwn(e,r)&&JSON.stringify(e[r])!==JSON.stringify(t[r])&&(o[r]=i(e[r]),s[r]=Object.hasOwn(t,r)?{exists:!0,value:i(t[r])}:{exists:!1});if(JSON.stringify(o).length>393216)throw Error(`Saved task fields exceed 384 KiB. Use an upstream source for larger data.`);return{patch:o,before:s,changed:Object.keys(o).length>0}}function p(e,{maximumFields:t=20}={}){if(e=i(e),!Number.isSafeInteger(t)||t<1||t>100)throw Error(`Use a bounded result preview.`);let n=6e3,r=!1,a=e=>{let t=String(e).replaceAll(`_`,` `).slice(0,120);return t.charAt(0).toUpperCase()+t.slice(1)},o=e=>{let t=e==null?`—`:typeof e==`boolean`?e?`Yes`:`No`:String(e);return t.length>500?t.slice(0,500)+`…`:t},s=e=>typeof e==`object`&&!!e&&!Array.isArray(e),c=(e,t)=>(n--,{tag:e,...t}),l=e=>`${e.length} ${e.length===1?`item`:`items`}${e.length>50?`, showing the first 50`:``}`,u=(e,t)=>{if(n<=0||t>5)return r=!0,c(`p`,{text:`…`});if(typeof e!=`object`||!e)return c(`p`,{text:o(e)});if(Array.isArray(e)){if(!e.length)return c(`p`,{text:`No items`});let n=e.slice(0,50);if(e.length>50&&(r=!0),n.every(s)){let t=[...new Set(n.flatMap(e=>Object.keys(e)))],i=t.slice(0,12);t.length>12&&(r=!0);let s=e=>typeof e==`object`&&e?Array.isArray(e)?e.map(s).join(`, `):Object.values(e).map(s).join(`: `):o(e),u=e=>{let t=s(e);return t.length>200?t.slice(0,200)+`…`:t};return c(`div`,{className:`connection-table`,children:[c(`small`,{text:l(e)}),c(`table`,{children:[c(`thead`,{children:[c(`tr`,{children:i.map(e=>c(`th`,{text:a(e)}))})]}),c(`tbody`,{children:n.map(e=>c(`tr`,{children:i.map(t=>c(`td`,{text:u(e[t])}))}))})]})]})}return c(`div`,{children:[c(`small`,{text:l(e)}),c(`ul`,{children:n.map(e=>c(`li`,{children:[u(e,t+1)]}))})]})}let i=Object.entries(e),d=i.filter(([,e])=>typeof e!=`object`||!e),f=i.filter(([,e])=>typeof e==`object`&&!!e),p=[];d.length&&p.push(c(`table`,{className:`connection-fields`,children:[c(`tbody`,{children:d.map(([e,t])=>c(`tr`,{children:[c(`th`,{text:a(e)}),c(`td`,{text:o(t)})]}))})]}));for(let[e,n]of f)p.push(t===0?c(`section`,{children:[c(`h4`,{text:a(e)}),u(n,t+1)]}):c(`details`,{children:[c(`summary`,{text:a(e)}),u(n,t+1)]}));return p.length||p.push(c(`p`,{text:`No fields`})),c(`div`,{children:p})};return[{tag:`h3`,text:`Result`},u(e,0),...r?[{tag:`small`,text:`Preview is bounded. The saved result retains its complete permitted data.`}]:[]]}function m(e){if(typeof e!=`string`||!/^[A-Z]{3}$/.test(e))throw Error(`Choose a three-letter currency code.`);return new Intl.NumberFormat(`en`,{style:`currency`,currency:e}).resolvedOptions().maximumFractionDigits}function h(e,t){let n=m(t),r=String(e).split(`.`);if(r.length>2||!/^\d+$/.test(r[0])||r[1]!==void 0&&(!/^\d+$/.test(r[1])||r[1].length>n))throw Error(`Enter a budget using this currency’s supported decimal places.`);let i=Number(r[0])*10**n+Number((r[1]||``).padEnd(n,`0`));if(!Number.isSafeInteger(i)||i<=0)throw Error(`Enter a positive supported budget.`);return i}function g(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`Use an exact saved budget.`);return new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e/10**m(t))}return Object.freeze({read:o,set:s,controls:l,change:u,fromState:d,edits:f,preview:p,currencyDigits:m,minorUnits:h,formatMoney:g})}var Wt=`ai-video-workflow-auth`;function Gt(){try{return typeof localStorage>`u`?null:JSON.parse(localStorage.getItem(Wt)||`null`)?.user?.id||null}catch{return null}}vt(),He();function Kt(e,{bridge:t=globalThis.stillmadeDesktop?.blockDesktop,onStatus:n=()=>{},storageScope:r=`preview`}={}){let i=null,a=null,o=!1,s=null,c=!1,l=null,u=null,d=new Set,f=e=>e&&[`audio`,`video`,`image`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?JSON.stringify([e.kind,e.assetId,e.versionId,e.url]):``,p=e?.manifest?.permissions?.desktop||[],m=new Map((e?.manifest?.desktopTools||[]).map(e=>[e.id,new Set(e.actions||[])])),h={"tool.launch":`launch`,"tool.project.import":`project.import`,"tool.project.open":`project.open`,"tool.project.render":`project.render`,"tool.adapter.import":`adapter.import`,"tool.adapter.inspect":`adapter.inspect`,"tool.adapter.execute":`adapter.execute`,"tool.adapter.describe":`adapter.describe`,"tool.adapter.call":`adapter.call`},g=e=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`);if(o)throw Error(`Block desktop access was closed. Reopen the Block.`);if(!p.includes(e))throw Error(`Declare permissions.desktop: ${e}`)},_=async()=>(a||=(async()=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`);let n=e.manifest,a=await t.open({id:n.id,version:n.version,digest:await ut(e),permissions:p,tools:n.desktopTools||[],name:n.name,storageScope:`${Gt()||`anonymous`}:${r}`});if(o)throw await t.close(a),Error(`Block was closed`);return i=a,l=setTimeout(()=>x(),36e5),a})(),a),v=async(e,n={})=>{g(e);let r=await _();if(o)throw Error(`Block was closed`);return t.invoke(r,e,n)},y=async e=>{let r=s;if(!r)throw Error(`No recording is active`);return r.finishing||=(async()=>{if(clearTimeout(r.timer),clearInterval(r.cursorTimer),r.recorder.state!==`inactive`&&r.recorder.stop(),await r.stopped,r.stream.getTracks().forEach(e=>e.stop()),s=null,n({active:!1}),!e)return{cancelled:!0};if(r.error)throw Error(r.error);let a=new Blob(r.chunks,{type:r.recorder.mimeType}),o=await t.save(i,r.kind,new Uint8Array(await a.arrayBuffer())),c=f(o);return c&&d.add(c),{asset:o,cursor:r.cursor,displays:r.displays||[],coordinates:`Global screen coordinates in device-independent pixels; timestamps in milliseconds relative to recording start.`}})(),r.finishing},b=async(e,r={})=>{if(e===`record.stop`)return y(!0);if(e===`record.cancel`)return y(!1);if(e===`session.close`)return await x(),{closed:!0};if(c)throw Error(`A desktop request is already in progress`);c=!0;try{if(e!==`record.start`){if(e.startsWith(`tool.`)){g(`native.tools`);let n=m.get(r.tool),i=h[e];if(!n||e!==`tool.status`&&!n.has(i))throw Error(`Declare the exact desktop tool action`);let a=await t.invoke(await _(),e,r);if(o)throw Error(`Block desktop access closed before the native operation completed.`);let s=f(a?.asset);return s&&d.add(s),a}if(e.startsWith(`storage.`)){if(![`storage.info`,`storage.list`,`storage.read`,`storage.write`,`storage.remove`].includes(e))throw Error(`Unknown storage operation`);if(!t)throw Error(`Device storage requires the StillMade desktop app.`);if(o)throw Error(`Block desktop access was closed. Reopen the Block.`);return t.invoke(await _(),e,r)}if(!Ve.includes(e))throw Error(`Unknown desktop operation`);if([`screen.capture`,`camera.capture`,`microphone.capture`].includes(e))throw Error(`Use record.start with kind screen, camera, or microphone.`);let n=await v(e,r);if(e===`media.pick`)for(let e of n?.assets||[]){let t=f(e);t&&d.add(t)}return n}if(s)throw Error(`A recording is already active`);let i=r.kind||`screen`,a={screen:`screen.capture`,camera:`camera.capture`,microphone:`microphone.capture`}[i];if(!a)throw Error(`Choose screen, camera, or microphone`);if(g(a),r.cursor&&(g(`cursor.track`),await v(`cursor.track`)),i!==`screen`&&await v(a),i===`screen`){if(g(a),await t.authorize(await _(),a),await new Promise((e,t)=>{u={reject:t},n({awaitingStart:!0,kind:i,start:()=>{u=null,e()}})}),o)throw Error(`Block was closed`);await v(a,{systemAudio:r.systemAudio===!0})}let c=i===`screen`?await navigator.mediaDevices.getDisplayMedia({video:{frameRate:30},audio:r.systemAudio===!0}):await navigator.mediaDevices.getUserMedia({video:i===`camera`,audio:i===`microphone`});if(o)throw c.getTracks().forEach(e=>e.stop()),Error(`Block was closed`);let l;try{l=new MediaRecorder(c,{mimeType:i===`microphone`?`audio/webm`:`video/webm`})}catch(e){throw c.getTracks().forEach(e=>e.stop()),e}let p={kind:i,stream:c,recorder:l,chunks:[],bytes:0,cursor:[],started:Date.now(),error:null};s=p,p.stopped=new Promise(e=>l.addEventListener(`stop`,e,{once:!0})),l.addEventListener(`dataavailable`,e=>{e.data.size&&(p.bytes+=e.data.size,p.bytes>134217728?(p.error=`Recording reached the 128 MiB limit`,y(!1).catch(()=>{})):p.chunks.push(e.data))}),l.addEventListener(`error`,()=>{p.error=`Recording failed`,y(!1).catch(()=>{})});for(let e of c.getTracks())e.addEventListener(`ended`,()=>{s===p&&l.state===`recording`&&(l.stop(),clearInterval(p.cursorTimer),n({active:!0,ended:!0}))});try{l.start(1e3)}catch(e){throw c.getTracks().forEach(e=>e.stop()),s=null,e}if(r.cursor){let e=!1;p.cursorTimer=setInterval(async()=>{if(!(e||s!==p||p.cursor.length>=18e3)){e=!0;try{let e=await v(`cursor.track`);s===p&&(p.displays=e.displays,p.cursor.push({x:e.x,y:e.y,time:e.time-p.started}))}catch(e){p.error=e.message,y(!1).catch(()=>{})}finally{e=!1}}},100)}return p.timer=setTimeout(()=>{p.error=`Recording reached the 30 minute limit`,y(!1).catch(()=>{})},18e5),n({active:!0,kind:i}),{recording:!0,kind:i,cursor:!!r.cursor}}catch(e){throw s||n({active:!1,error:e.message}),e}finally{c=!1}},x=async()=>{o||(o=!0,S?.(),u?.reject(Error(`Recording cancelled`)),u=null,clearTimeout(l),s&&s.stream.getTracks().forEach(e=>e.stop()),s&&await y(!1).catch(()=>{}),i&&await t.close(i).catch(()=>{}),n({active:!1,closed:!0}))},S=t?.onRevoked?.(e=>{i===e&&x().catch(()=>{})});return{call:b,close:x,authorizesMedia:e=>d.has(f(e))}}var qt=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Jt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Yt=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Xt=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Zt={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Qt=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,$t={5:Qt,"5module":Qt+` export import`,6:Qt+` const class extends export import super`},en=/^in(stanceof)?$/,tn=RegExp(`[`+Xt+`]`),nn=RegExp(`[`+Xt+Yt+`]`);function rn(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function an(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&tn.test(String.fromCharCode(e)):t!==!1&&rn(e,Jt)}function on(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&nn.test(String.fromCharCode(e)):t===!1?!1:rn(e,Jt)||rn(e,qt)}var H=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function sn(e,t){return new H(e,{beforeExpr:!0,binop:t})}var cn={beforeExpr:!0},ln={startsExpr:!0},un={};function U(e,t){return t===void 0&&(t={}),t.keyword=e,un[e]=new H(e,t)}var W={num:new H(`num`,ln),regexp:new H(`regexp`,ln),string:new H(`string`,ln),name:new H(`name`,ln),privateId:new H(`privateId`,ln),eof:new H(`eof`),bracketL:new H(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new H(`]`),braceL:new H(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new H(`}`),parenL:new H(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new H(`)`),comma:new H(`,`,cn),semi:new H(`;`,cn),colon:new H(`:`,cn),dot:new H(`.`),question:new H(`?`,cn),questionDot:new H(`?.`),arrow:new H(`=>`,cn),template:new H(`template`),invalidTemplate:new H(`invalidTemplate`),ellipsis:new H(`...`,cn),backQuote:new H("`",ln),dollarBraceL:new H("${",{beforeExpr:!0,startsExpr:!0}),eq:new H(`=`,{beforeExpr:!0,isAssign:!0}),assign:new H(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new H(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new H(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:sn(`||`,1),logicalAND:sn(`&&`,2),bitwiseOR:sn(`|`,3),bitwiseXOR:sn(`^`,4),bitwiseAND:sn(`&`,5),equality:sn(`==/!=/===/!==`,6),relational:sn(`</>/<=/>=`,7),bitShift:sn(`<</>>/>>>`,8),plusMin:new H(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:sn(`%`,10),star:sn(`*`,10),slash:sn(`/`,10),starstar:new H(`**`,{beforeExpr:!0}),coalesce:sn(`??`,1),_break:U(`break`),_case:U(`case`,cn),_catch:U(`catch`),_continue:U(`continue`),_debugger:U(`debugger`),_default:U(`default`,cn),_do:U(`do`,{isLoop:!0,beforeExpr:!0}),_else:U(`else`,cn),_finally:U(`finally`),_for:U(`for`,{isLoop:!0}),_function:U(`function`,ln),_if:U(`if`),_return:U(`return`,cn),_switch:U(`switch`),_throw:U(`throw`,cn),_try:U(`try`),_var:U(`var`),_const:U(`const`),_while:U(`while`,{isLoop:!0}),_with:U(`with`),_new:U(`new`,{beforeExpr:!0,startsExpr:!0}),_this:U(`this`,ln),_super:U(`super`,ln),_class:U(`class`,ln),_extends:U(`extends`,cn),_export:U(`export`),_import:U(`import`,ln),_null:U(`null`,ln),_true:U(`true`,ln),_false:U(`false`,ln),_in:U(`in`,{beforeExpr:!0,binop:7}),_instanceof:U(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:U(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:U(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:U(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},dn=/\r\n?|\n|\u2028|\u2029/,fn=new RegExp(dn.source,`g`);function pn(e){return e===10||e===13||e===8232||e===8233}function mn(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(pn(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var hn=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,gn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,_n=Object.prototype,vn=_n.hasOwnProperty,yn=_n.toString,bn=Object.hasOwn||(function(e,t){return vn.call(e,t)}),xn=Array.isArray||(function(e){return yn.call(e)===`[object Array]`}),Sn=Object.create(null);function Cn(e){return Sn[e]||(Sn[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function wn(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Tn=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,En=function(e,t){this.line=e,this.column=t};En.prototype.offset=function(e){return new En(this.line,this.column+e)};var Dn=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function On(e,t){for(var n=1,r=0;;){var i=mn(e,r,t);if(i<0)return new En(n,t-r);++n,r=i}}var kn={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},An=!1;function jn(e){var t={};for(var n in kn)t[n]=e&&bn(e,n)?e[n]:kn[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!An&&typeof console==`object`&&console.warn&&(An=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1087
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),xn(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(xn(t.onComment)&&(t.onComment=Mn(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function Mn(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new Dn(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Nn=1,Pn=2,Fn=4,In=8,Ln=16,Rn=32,zn=64,Bn=128,Vn=256,Hn=512,Un=1024,Wn=Nn|Pn|Vn;function Gn(e,t){return Pn|(e?Fn:0)|(t?In:0)}var Kn=0,qn=1,Jn=2,Yn=3,Xn=4,Zn=5,Qn=function(e,t,n){this.options=e=jn(e),this.sourceFile=e.sourceFile,this.keywords=Cn($t[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Zt[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=Cn(r);var i=(r?r+` `:``)+Zt.strict;this.reservedWordsStrict=Cn(i),this.reservedWordsStrictBind=Cn(i+` `+Zt.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
1088
+ `,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(dn).length)):this.lineStart=0,this.type=W.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?Pn:Nn),this.regexpState=null,this.privateNameStack=[]},$n={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Qn.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},$n.inFunction.get=function(){return(this.currentVarScope().flags&Pn)>0},$n.inGenerator.get=function(){return(this.currentVarScope().flags&In)>0},$n.inAsync.get=function(){return(this.currentVarScope().flags&Fn)>0},$n.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Vn|Hn))return!1;if(t&Pn)return(t&Fn)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},$n.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Nn)},$n.allowSuper.get=function(){return(this.currentThisScope().flags&zn)>0||this.options.allowSuperOutsideMethod},$n.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Bn)>0},$n.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},$n.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Vn|Hn)||t&Pn&&!(t&Ln))return!0}return!1},$n.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Un||!this.inModule&&e&Nn)},$n.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Vn)>0},Qn.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},Qn.parse=function(e,t){return new this(t,e).parse()},Qn.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},Qn.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Qn.prototype,$n);var er=Qn.prototype,tr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;er.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){gn.lastIndex=e,e+=gn.exec(this.input)[0].length;var t=tr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){gn.lastIndex=e+t[0].length;var n=gn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||dn.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,gn.lastIndex=e,e+=gn.exec(this.input)[0].length,this.input[e]===`;`&&e++}},er.eat=function(e){return this.type===e&&(this.next(),!0)},er.isContextual=function(e){return this.type===W.name&&this.value===e&&!this.containsEsc},er.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},er.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},er.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},er.canInsertSemicolon=function(){return this.type===W.eof||this.type===W.braceR||dn.test(this.input.slice(this.lastTokEnd,this.start))},er.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},er.semicolon=function(){!this.eat(W.semi)&&!this.insertSemicolon()&&this.unexpected()},er.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},er.expect=function(e){this.eat(e)||this.unexpected()},er.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var nr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};er.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},er.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},er.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},er.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var G=Qn.prototype;G.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==W.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var rr={kind:`loop`},ir={kind:`switch`};G.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;gn.lastIndex=this.pos;var t=gn.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(an(r)){var i=n;do n+=r<=65535?1:2;while(on(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!en.test(a))return!0}return!1},G.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;gn.lastIndex=this.pos;var e=gn.exec(this.input),t=this.pos+e[0].length,n;return!dn.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(on(n=this.fullCharCodeAt(t+8))||n===92))},G.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;gn.lastIndex=this.pos;var n=gn.exec(this.input),r=this.pos+n[0].length;if(dn.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||on(a=this.fullCharCodeAt(i))||a===92)return!1;gn.lastIndex=i;var o=gn.exec(this.input);if(r=i+o[0].length,o&&dn.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!an(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(on(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(en.test(l))return!1;if(t&&!e&&l===`of`){gn.lastIndex=r;var u=gn.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},G.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},G.isUsing=function(e){return this.isUsingKeyword(!1,e)},G.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=W._var,a=`let`),r){case W._break:case W._continue:return this.parseBreakContinueStatement(i,r.keyword);case W._debugger:return this.parseDebuggerStatement(i);case W._do:return this.parseDoStatement(i);case W._for:return this.parseForStatement(i);case W._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case W._class:return e&&this.unexpected(),this.parseClass(i,!0);case W._if:return this.parseIfStatement(i);case W._return:return this.parseReturnStatement(i);case W._switch:return this.parseSwitchStatement(i);case W._throw:return this.parseThrowStatement(i);case W._try:return this.parseTryStatement(i);case W._const:case W._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case W._while:return this.parseWhileStatement(i);case W._with:return this.parseWithStatement(i);case W.braceL:return this.parseBlock(!0,i);case W.semi:return this.parseEmptyStatement(i);case W._export:case W._import:if(this.options.ecmaVersion>10&&r===W._import){gn.lastIndex=this.pos;var o=gn.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===W._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===W.name&&d.type===`Identifier`&&this.eat(W.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},G.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(W.semi)||this.insertSemicolon()?e.label=null:this.type===W.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},G.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},G.parseDoStatement=function(e){return this.next(),this.labels.push(rr),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(W._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(W.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},G.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(rr),this.enterScope(0),this.expect(W.parenL),this.type===W.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===W._var||this.type===W._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new nr,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===W._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===W._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},G.parseForAfterInit=function(e,t,n){return(this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===W._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},G.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,or|(n?0:sr),!1,t)},G.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(W._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},G.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(W.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},G.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(W.braceL),this.labels.push(ir),this.enterScope(Un);for(var t,n=!1;this.type!==W.braceR;)if(this.type===W._case||this.type===W._default){var r=this.type===W._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(W.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},G.parseThrowStatement=function(e){return this.next(),dn.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var ar=[];G.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Rn:0),this.checkLValPattern(e,t?Xn:Jn),this.expect(W.parenR),e},G.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===W._catch){var t=this.startNode();this.next(),this.eat(W.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(W._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},G.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},G.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(rr),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},G.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},G.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},G.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===W._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},G.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},G.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(W.braceL),e&&this.enterScope(0);this.type!==W.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},G.parseFor=function(e,t){return e.init=t,this.expect(W.semi),e.test=this.type===W.semi?null:this.parseExpression(),this.expect(W.semi),e.update=this.type===W.parenR?null:this.parseExpression(),this.expect(W.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},G.parseForIn=function(e,t){var n=this.type===W._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(W.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},G.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(W.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==W._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==W._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(W.comma))break}return e},G.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?qn:Jn,!1)};var or=1,sr=2,cr=4;G.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===W.star&&t&sr&&this.unexpected(),e.generator=this.eat(W.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&or&&(e.id=t&cr&&this.type!==W.name?null:this.parseIdent(),e.id&&!(t&sr)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?qn:Jn:Yn));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Gn(e.async,e.generator)),t&or||(e.id=this.type===W.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&or?`FunctionDeclaration`:`FunctionExpression`)},G.parseFunctionParams=function(e){this.expect(W.parenL),e.params=this.parseBindingList(W.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},G.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(W.braceL);this.type!==W.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&lr(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},G.parseClassElement=function(e){if(this.eat(W.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(W.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===W.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===W.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(W.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===W.parenL||o!==`method`||i||a){var l=!n.static&&ur(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},G.isClassElementNameStart=function(){return this.type===W.name||this.type===W.privateId||this.type===W.num||this.type===W.string||this.type===W.bracketL||this.type.keyword},G.parseClassElementName=function(e){this.type===W.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},G.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&ur(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},G.parseClassField=function(e){return ur(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&ur(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(W.eq)?(this.enterScope(Hn|zn),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},G.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Vn|zn);this.type!==W.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},G.parseClassId=function(e,t){this.type===W.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Jn,!1)):(t===!0&&this.unexpected(),e.id=null)},G.parseClassSuper=function(e){e.superClass=this.eat(W._extends)?this.parseExprSubscripts(null,!1):null},G.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},G.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];bn(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function lr(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function ur(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}G.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==W.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},G.parseExport=function(e,t){if(this.next(),this.eat(W.star))return this.parseExportAllDeclaration(e,t);if(this.eat(W._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==W.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},G.parseExportDeclaration=function(e){return this.parseStatement(null)},G.parseExportDefaultDeclaration=function(){var e;if(this.type===W._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,or|cr,!1,e)}if(this.type===W._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},G.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),bn(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},G.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},G.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},G.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},G.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},G.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(W.braceL);!this.eat(W.braceR);){if(n)n=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;t.push(this.parseExportSpecifier(e))}return t},G.parseImport=function(e){return this.next(),this.type===W.string?(e.specifiers=ar,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===W.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},G.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Jn),this.finishNode(e,`ImportSpecifier`)},G.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Jn),this.finishNode(e,`ImportDefaultSpecifier`)},G.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Jn),this.finishNode(e,`ImportNamespaceSpecifier`)},G.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===W.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(W.comma)))return e;if(this.type===W.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(W.braceL);!this.eat(W.braceR);){if(t)t=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;e.push(this.parseImportSpecifier())}return e},G.parseWithClause=function(){var e=[];if(!this.eat(W._with))return e;this.expect(W.braceL);for(var t={},n=!0;!this.eat(W.braceR);){if(n)n=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;bn(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},G.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===W.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(W.colon),this.type!==W.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},G.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===W.string){var e=this.parseLiteral(this.value);return Tn.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},G.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},G.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var dr=Qn.prototype;dr.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},dr.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},dr.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},dr.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==W.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},dr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case W.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(W.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case W.braceL:return this.parseObj(!0)}return this.parseIdent()},dr.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(W.comma),t&&this.type===W.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===W.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===W.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},dr.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},dr.parseBindingListItem=function(e){return e},dr.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(W.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},dr.checkLValSimple=function(e,t,n){t===void 0&&(t=Kn);var r=t!==Kn;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Jn&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(bn(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Zn&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},dr.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Kn),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},dr.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Kn),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var fr=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},pr={b_stat:new fr(`{`,!1),b_expr:new fr(`{`,!0),b_tmpl:new fr("${",!1),p_stat:new fr(`(`,!1),p_expr:new fr(`(`,!0),q_tmpl:new fr("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new fr(`function`,!1),f_expr:new fr(`function`,!0),f_expr_gen:new fr(`function`,!0,!1,null,!0),f_gen:new fr(`function`,!1,!1,null,!0)},mr=Qn.prototype;mr.initialContext=function(){return[pr.b_stat]},mr.curContext=function(){return this.context[this.context.length-1]},mr.braceIsBlock=function(e){var t=this.curContext();return t===pr.f_expr||t===pr.f_stat?!0:e===W.colon&&(t===pr.b_stat||t===pr.b_expr)?!t.isExpr:e===W._return||e===W.name&&this.exprAllowed?dn.test(this.input.slice(this.lastTokEnd,this.start)):e===W._else||e===W.semi||e===W.eof||e===W.parenR||e===W.arrow?!0:e===W.braceL?t===pr.b_stat:e===W._var||e===W._const||e===W.name?!1:!this.exprAllowed},mr.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},mr.updateContext=function(e){var t,n=this.type;n.keyword&&e===W.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},mr.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},W.parenR.updateContext=W.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===pr.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},W.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?pr.b_stat:pr.b_expr),this.exprAllowed=!0},W.dollarBraceL.updateContext=function(){this.context.push(pr.b_tmpl),this.exprAllowed=!0},W.parenL.updateContext=function(e){var t=e===W._if||e===W._for||e===W._with||e===W._while;this.context.push(t?pr.p_stat:pr.p_expr),this.exprAllowed=!0},W.incDec.updateContext=function(){},W._function.updateContext=W._class.updateContext=function(e){e.beforeExpr&&e!==W._else&&(e!==W.semi||this.curContext()===pr.p_stat)&&!(e===W._return&&dn.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==W.colon&&e!==W.braceL||this.curContext()!==pr.b_stat)?this.context.push(pr.f_expr):this.context.push(pr.f_stat),this.exprAllowed=!1},W.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},W.backQuote.updateContext=function(){this.curContext()===pr.q_tmpl?this.context.pop():this.context.push(pr.q_tmpl),this.exprAllowed=!1},W.star.updateContext=function(e){if(e===W._function){var t=this.context.length-1;this.context[t]===pr.f_expr?this.context[t]=pr.f_expr_gen:this.context[t]=pr.f_gen}this.exprAllowed=!0},W.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==W.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var K=Qn.prototype;K.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},K.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===W.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(W.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},K.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new nr,r=!0);var s=this.start,c=this.startLoc;(this.type===W.parenL||this.type===W.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===W.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===W.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},K.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(W.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(W.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},K.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},K.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==W._in)&&a>r){var o=this.type===W.logicalOR||this.type===W.logicalAND,s=this.type===W.coalesce;s&&(a=W.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===W.coalesce||s&&(this.type===W.logicalOR||this.type===W.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},K.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},K.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===W.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&hr(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&gr(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===W.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==W._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(W.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function hr(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&hr(e.expression)}function gr(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&gr(e.expression)||e.type===`ParenthesizedExpression`&&gr(e.expression)}K.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},K.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},K.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(W.arrow)},K.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},K.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(W.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(W.bracketL);if(l||c&&this.type!==W.parenL&&this.type!==W.backQuote||this.eat(W.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(W.bracketR)):u.property=this.type===W.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(W.parenL)){var d=new nr,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(W.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===W.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},K.parseExprAtom=function(e,t,n){this.type===W.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case W._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===W.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==W.dot&&this.type!==W.bracketL&&this.type!==W.parenL&&this.unexpected(),this.finishNode(r,`Super`);case W._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case W.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(W._function))return this.overrideContext(pr.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(W.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===W.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(W.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case W.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case W.num:case W.string:return this.parseLiteral(this.value);case W._null:case W._true:case W._false:return r=this.startNode(),r.value=this.type===W._null?null:this.type===W._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case W.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case W.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(W.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case W.braceL:return this.overrideContext(pr.b_expr),this.parseObj(!1,e);case W._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case W._class:return this.parseClass(this.startNode(),!1);case W._new:return this.parseNew();case W.backQuote:return this.parseTemplate();case W._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},K.parseExprAtomDefault=function(){this.unexpected()},K.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===W.parenL&&!e)return this.parseDynamicImport(t);if(this.type===W.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},K.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(W.parenR)?e.options=null:(this.expect(W.comma),this.afterTrailingComma(W.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(W.parenR)||(this.expect(W.comma),this.afterTrailingComma(W.parenR)||this.unexpected())));else if(!this.eat(W.parenR)){var t=this.start;this.eat(W.comma)&&this.eat(W.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},K.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},K.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},K.parseParenExpression=function(){this.expect(W.parenL);var e=this.parseExpression();return this.expect(W.parenR),e},K.shouldParseArrow=function(e){return!this.canInsertSemicolon()},K.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new nr,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==W.parenR;){if(l?l=!1:this.expect(W.comma),a&&this.afterTrailingComma(W.parenR,!0)){u=!0;break}if(this.type===W.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===W.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(W.parenR),e&&this.shouldParseArrow(c)&&this.eat(W.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},K.parseParenItem=function(e){return e},K.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var _r=[];K.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===W.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(W.parenL)?this.parseExprList(W.parenR,this.options.ecmaVersion>=8,!1):_r,this.finishNode(e,`NewExpression`)},K.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===W.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
1089
1089
  `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
1090
- `),cooked:this.value},this.next(),n.tail=this.type===H.backQuote,this.finishNode(n,`TemplateElement`)},W.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===H.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(H.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(H.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},W.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===H.name||this.type===H.num||this.type===H.string||this.type===H.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===H.star)&&!cn.test(this.input.slice(this.lastTokEnd,this.start))},W.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(H.braceR);){if(r)r=!1;else if(this.expect(H.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(H.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},W.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(H.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===H.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===H.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(H.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(H.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},W.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},W.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===H.colon&&this.unexpected(),this.eat(H.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===H.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==H.comma&&this.type!==H.braceR&&this.type!==H.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===H.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},W.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(H.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(H.bracketR),e.key;e.computed=!1}return e.key=this.type===H.num||this.type===H.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},W.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},W.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Hn(t,r.generator)|In|(n?Ln:0)),this.expect(H.parenL),r.params=this.parseBindingList(H.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},W.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Hn(n,!1)|Pn),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},W.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==H.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Jn),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},W.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},W.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Wn,t?null:n)}},W.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(H.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===H.comma?o=null:this.type===H.ellipsis?(o=this.parseSpread(r),r&&this.type===H.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},W.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Vn)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},W.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},W.parseIdentNode=function(){var e=this.startNode();return this.type===H.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=H.name):this.unexpected(),e},W.parsePrivateIdent=function(){var e=this.startNode();return this.type===H.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},W.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===H.semi||this.canInsertSemicolon()||this.type!==H.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(H.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},W.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var hr=Yn.prototype;hr.raise=function(e,t){var n=Tn(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},hr.raiseRecoverable=hr.raise,hr.curPosition=function(){if(this.options.locations)return new Cn(this.curLine,this.pos-this.lineStart)};var gr=Yn.prototype,_r=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};gr.enterScope=function(e){this.scopeStack.push(new _r(e))},gr.exitScope=function(){this.scopeStack.pop()},gr.treatFunctionsAsVarInScope=function(e){return e.flags&jn||!this.inModule&&e.flags&An},gr.declareName=function(e,t,n){var r=!1;if(t===Gn){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&An&&delete this.undefinedExports[e]}else if(t===qn)this.currentScope().lexical.push(e);else if(t===Kn){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Fn&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&An&&delete this.undefinedExports[e],s.flags&Vn)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},gr.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},gr.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},gr.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Vn|zn|Rn))return t}},gr.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Vn|zn|Rn)&&!(t.flags&Pn))return t}};var vr=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new wn(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},yr=Yn.prototype;yr.startNode=function(){return new vr(this,this.start,this.startLoc)},yr.startNodeAt=function(e,t){return new vr(this,e,t)};function br(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}yr.finishNode=function(e,t){return br.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},yr.finishNodeAt=function(e,t,n,r){return br.call(this,e,t,n,r)},yr.copyNode=function(e){var t=new vr(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var xr=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,Sr=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Cr=Sr+` Extended_Pictographic`,wr=Cr,Tr=wr+` EBase EComp EMod EPres ExtPict`,Er=Tr,Dr={9:Sr,10:Cr,11:wr,12:Tr,13:Er,14:Er},Or={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},kr=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Ar=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,jr=Ar+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Mr=jr+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Nr=Mr+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Pr=Nr+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Fr={9:Ar,10:jr,11:Mr,12:Nr,13:Pr,14:Pr+` `+xr},Ir={};function Lr(e){var t=Ir[e]={binary:bn(Dr[e]+` `+kr),binaryOfStrings:bn(Or[e]),nonBinary:{General_Category:bn(kr),Script:bn(Fr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Rr=0,zr=[9,10,11,12,13,14];Rr<zr.length;Rr+=1){var Br=zr[Rr];Lr(Br)}var G=Yn.prototype,Vr=function(e,t){this.parent=e,this.base=t||this};Vr.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Vr.prototype.sibling=function(){return new Vr(this.parent,this.base)};var Hr=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=Ir[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Hr.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Hr.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Hr.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Hr.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Hr.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Hr.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Hr.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Hr.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Hr.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},G.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function Ur(e){for(var t in e)return!0;return!1}G.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Ur(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},G.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},G.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Vr(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},G.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},G.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},G.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},G.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},G.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},G.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},G.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},G.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},G.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},G.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},G.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&Wr(n);)t+=xn(n),e.advance();return t};function Wr(e){return e===105||e===109||e===115}G.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},G.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},G.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Gr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Gr(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}G.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Gr(n);)e.advance();return e.pos!==t},G.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},G.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},G.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},G.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=xn(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=xn(e.lastIntValue);return!0}return!1},G.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Kr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Kr(e){return tn(e,!0)||e===36||e===95}G.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),qr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function qr(e){return nn(e,!0)||e===36||e===95||e===8204||e===8205}G.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},G.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},G.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},G.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},G.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},G.regexp_eatZero=function(e){return e.current()===48&&!ai(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},G.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},G.regexp_eatControlLetter=function(e){var t=e.current();return Jr(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Jr(e){return e>=65&&e<=90||e>=97&&e<=122}G.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Yr(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Yr(e){return e>=0&&e<=1114111}G.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},G.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Xr=0,Zr=1,Qr=2;G.regexp_eatCharacterClassEscape=function(e){var t=e.current();if($r(t))return e.lastIntValue=-1,e.advance(),Zr;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Qr&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Xr};function $r(e){return e===100||e===68||e===115||e===83||e===119||e===87}G.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Zr}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Xr},G.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){_n(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},G.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Zr;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Qr;e.raise(`Invalid property name`)},G.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;ei(t=e.current());)e.lastStringValue+=xn(t),e.advance();return e.lastStringValue!==``};function ei(e){return Jr(e)||e===95}G.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;ti(t=e.current());)e.lastStringValue+=xn(t),e.advance();return e.lastStringValue!==``};function ti(e){return ei(e)||ai(e)}G.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},G.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Qr&&e.raise(`Negated character class may contain strings`),!0}return!1},G.regexp_classContents=function(e){return e.current()===93?Zr:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Zr)},G.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},G.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||ci(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},G.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},G.regexp_classSetExpression=function(e){var t=Zr,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Qr&&(t=Qr);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Qr&&(t=Zr);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Qr&&(t=Qr)}},G.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},G.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Zr:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},G.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Qr&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},G.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},G.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Qr&&(t=Qr);return t},G.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Zr:Qr},G.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&ni(n)||ri(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function ni(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function ri(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}G.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ii(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ii(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}G.regexp_eatClassControlLetter=function(e){var t=e.current();return ai(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},G.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},G.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;ai(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function ai(e){return e>=48&&e<=57}G.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;oi(n=e.current());)e.lastIntValue=16*e.lastIntValue+si(n),e.advance();return e.pos!==t};function oi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function si(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}G.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},G.regexp_eatOctalDigit=function(e){var t=e.current();return ci(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function ci(e){return e>=48&&e<=55}G.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!oi(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+si(i),e.advance()}return!0};var li=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new wn(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},K=Yn.prototype;K.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new li(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},K.getToken=function(){return this.next(),new li(this)},typeof Symbol<`u`&&(K[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===H.eof,value:t}}}}),K.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(H.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},K.readToken=function(e){return tn(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},K.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},K.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},K.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=dn(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},K.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!un(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},K.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&fn.test(String.fromCharCode(e)))++this.pos;else break loop}}},K.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},K.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(H.ellipsis)):(++this.pos,this.finishToken(H.dot))},K.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(H.assign,2):this.finishOp(H.slash,1)},K.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?H.star:H.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=H.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(H.assign,n+1):this.finishOp(r,n)},K.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(H.assign,3):this.finishOp(e===124?H.logicalOR:H.logicalAND,2):t===61?this.finishOp(H.assign,2):this.finishOp(e===124?H.bitwiseOR:H.bitwiseAND,1)},K.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(H.assign,2):this.finishOp(H.bitwiseXOR,1)},K.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||cn.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(H.incDec,2):t===61?this.finishOp(H.assign,2):this.finishOp(H.plusMin,1)},K.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(H.assign,n+1):this.finishOp(H.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(H.relational,n))},K.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(H.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(H.arrow)):this.finishOp(e===61?H.eq:H.prefix,1)},K.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(H.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(H.assign,3):this.finishOp(H.coalesce,2)}return this.finishOp(H.question,1)},K.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),tn(t,!0)||t===92))return this.finishToken(H.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+xn(t)+`'`)},K.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(H.parenL);case 41:return++this.pos,this.finishToken(H.parenR);case 59:return++this.pos,this.finishToken(H.semi);case 44:return++this.pos,this.finishToken(H.comma);case 91:return++this.pos,this.finishToken(H.bracketL);case 93:return++this.pos,this.finishToken(H.bracketR);case 123:return++this.pos,this.finishToken(H.braceL);case 125:return++this.pos,this.finishToken(H.braceR);case 58:return++this.pos,this.finishToken(H.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(H.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(H.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+xn(e)+`'`)},K.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},K.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(cn.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Hr(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(H.regexp,{pattern:i,flags:o,value:c})},K.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function ui(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function di(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}K.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=di(this.input.slice(t,this.pos)),++this.pos):tn(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(H.num,n)},K.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=di(this.input.slice(t,this.pos));return++this.pos,tn(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(H.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),tn(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=ui(this.input.slice(t,this.pos),n);return this.finishToken(H.num,a)},K.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},K.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(un(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(H.string,t)};var fi={};K.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===fi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},K.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw fi;this.raise(e,t)},K.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===H.template||this.type===H.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(H.dollarBraceL)):(++this.pos,this.finishToken(H.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(H.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(un(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
1091
- `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},K.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(H.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
1090
+ `),cooked:this.value},this.next(),n.tail=this.type===W.backQuote,this.finishNode(n,`TemplateElement`)},K.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===W.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(W.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(W.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},K.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===W.name||this.type===W.num||this.type===W.string||this.type===W.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===W.star)&&!dn.test(this.input.slice(this.lastTokEnd,this.start))},K.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(W.braceR);){if(r)r=!1;else if(this.expect(W.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(W.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},K.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(W.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===W.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===W.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(W.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(W.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},K.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},K.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===W.colon&&this.unexpected(),this.eat(W.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===W.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==W.comma&&this.type!==W.braceR&&this.type!==W.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===W.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},K.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(W.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(W.bracketR),e.key;e.computed=!1}return e.key=this.type===W.num||this.type===W.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},K.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},K.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Gn(t,r.generator)|zn|(n?Bn:0)),this.expect(W.parenL),r.params=this.parseBindingList(W.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},K.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Gn(n,!1)|Ln),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},K.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==W.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Zn),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},K.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},K.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,qn,t?null:n)}},K.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(W.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===W.comma?o=null:this.type===W.ellipsis?(o=this.parseSpread(r),r&&this.type===W.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},K.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Wn)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},K.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},K.parseIdentNode=function(){var e=this.startNode();return this.type===W.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=W.name):this.unexpected(),e},K.parsePrivateIdent=function(){var e=this.startNode();return this.type===W.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},K.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===W.semi||this.canInsertSemicolon()||this.type!==W.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(W.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},K.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var vr=Qn.prototype;vr.raise=function(e,t){var n=On(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},vr.raiseRecoverable=vr.raise,vr.curPosition=function(){if(this.options.locations)return new En(this.curLine,this.pos-this.lineStart)};var yr=Qn.prototype,br=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};yr.enterScope=function(e){this.scopeStack.push(new br(e))},yr.exitScope=function(){this.scopeStack.pop()},yr.treatFunctionsAsVarInScope=function(e){return e.flags&Pn||!this.inModule&&e.flags&Nn},yr.declareName=function(e,t,n){var r=!1;if(t===Jn){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Nn&&delete this.undefinedExports[e]}else if(t===Xn)this.currentScope().lexical.push(e);else if(t===Yn){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Rn&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&Nn&&delete this.undefinedExports[e],s.flags&Wn)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},yr.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},yr.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},yr.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Wn|Hn|Vn))return t}},yr.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Wn|Hn|Vn)&&!(t.flags&Ln))return t}};var xr=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new Dn(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Sr=Qn.prototype;Sr.startNode=function(){return new xr(this,this.start,this.startLoc)},Sr.startNodeAt=function(e,t){return new xr(this,e,t)};function Cr(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}Sr.finishNode=function(e,t){return Cr.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Sr.finishNodeAt=function(e,t,n,r){return Cr.call(this,e,t,n,r)},Sr.copyNode=function(e){var t=new xr(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var wr=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,Tr=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Er=Tr+` Extended_Pictographic`,Dr=Er,Or=Dr+` EBase EComp EMod EPres ExtPict`,kr=Or,Ar={9:Tr,10:Er,11:Dr,12:Or,13:kr,14:kr},jr={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},Mr=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Nr=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,Pr=Nr+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Fr=Pr+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Ir=Fr+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Lr=Ir+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Rr={9:Nr,10:Pr,11:Fr,12:Ir,13:Lr,14:Lr+` `+wr},zr={};function Br(e){var t=zr[e]={binary:Cn(Ar[e]+` `+Mr),binaryOfStrings:Cn(jr[e]),nonBinary:{General_Category:Cn(Mr),Script:Cn(Rr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Vr=0,Hr=[9,10,11,12,13,14];Vr<Hr.length;Vr+=1){var Ur=Hr[Vr];Br(Ur)}var q=Qn.prototype,Wr=function(e,t){this.parent=e,this.base=t||this};Wr.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Wr.prototype.sibling=function(){return new Wr(this.parent,this.base)};var Gr=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=zr[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Gr.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Gr.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Gr.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Gr.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Gr.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Gr.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Gr.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Gr.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Gr.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},q.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function Kr(e){for(var t in e)return!0;return!1}q.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Kr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},q.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},q.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Wr(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},q.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},q.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},q.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},q.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},q.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},q.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},q.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},q.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},q.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},q.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},q.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&qr(n);)t+=wn(n),e.advance();return t};function qr(e){return e===105||e===109||e===115}q.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},q.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},q.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Jr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Jr(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}q.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Jr(n);)e.advance();return e.pos!==t},q.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},q.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},q.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},q.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=wn(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=wn(e.lastIntValue);return!0}return!1},q.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Yr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Yr(e){return an(e,!0)||e===36||e===95}q.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Xr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Xr(e){return on(e,!0)||e===36||e===95||e===8204||e===8205}q.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},q.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},q.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},q.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},q.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},q.regexp_eatZero=function(e){return e.current()===48&&!si(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},q.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},q.regexp_eatControlLetter=function(e){var t=e.current();return Zr(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Zr(e){return e>=65&&e<=90||e>=97&&e<=122}q.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qr(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Qr(e){return e>=0&&e<=1114111}q.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},q.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var $r=0,ei=1,J=2;q.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(ti(t))return e.lastIntValue=-1,e.advance(),ei;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===J&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return $r};function ti(e){return e===100||e===68||e===115||e===83||e===119||e===87}q.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),ei}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return $r},q.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){bn(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},q.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return ei;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return J;e.raise(`Invalid property name`)},q.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;ni(t=e.current());)e.lastStringValue+=wn(t),e.advance();return e.lastStringValue!==``};function ni(e){return Zr(e)||e===95}q.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;ri(t=e.current());)e.lastStringValue+=wn(t),e.advance();return e.lastStringValue!==``};function ri(e){return ni(e)||si(e)}q.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},q.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===J&&e.raise(`Negated character class may contain strings`),!0}return!1},q.regexp_classContents=function(e){return e.current()===93?ei:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),ei)},q.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},q.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||ui(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},q.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},q.regexp_classSetExpression=function(e){var t=ei,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===J&&(t=J);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==J&&(t=ei);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===J&&(t=J)}},q.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},q.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?ei:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},q.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===J&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},q.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},q.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===J&&(t=J);return t},q.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?ei:J},q.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&ii(n)||ai(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function ii(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function ai(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}q.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return oi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function oi(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}q.regexp_eatClassControlLetter=function(e){var t=e.current();return si(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},q.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},q.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;si(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function si(e){return e>=48&&e<=57}q.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;ci(n=e.current());)e.lastIntValue=16*e.lastIntValue+li(n),e.advance();return e.pos!==t};function ci(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function li(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}q.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},q.regexp_eatOctalDigit=function(e){var t=e.current();return ui(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function ui(e){return e>=48&&e<=55}q.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!ci(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+li(i),e.advance()}return!0};var di=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Dn(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Y=Qn.prototype;Y.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new di(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Y.getToken=function(){return this.next(),new di(this)},typeof Symbol<`u`&&(Y[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===W.eof,value:t}}}}),Y.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(W.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Y.readToken=function(e){return an(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Y.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},Y.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},Y.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=mn(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Y.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!pn(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Y.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&hn.test(String.fromCharCode(e)))++this.pos;else break loop}}},Y.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Y.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(W.ellipsis)):(++this.pos,this.finishToken(W.dot))},Y.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(W.assign,2):this.finishOp(W.slash,1)},Y.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?W.star:W.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=W.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(W.assign,n+1):this.finishOp(r,n)},Y.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(W.assign,3):this.finishOp(e===124?W.logicalOR:W.logicalAND,2):t===61?this.finishOp(W.assign,2):this.finishOp(e===124?W.bitwiseOR:W.bitwiseAND,1)},Y.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(W.assign,2):this.finishOp(W.bitwiseXOR,1)},Y.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||dn.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(W.incDec,2):t===61?this.finishOp(W.assign,2):this.finishOp(W.plusMin,1)},Y.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(W.assign,n+1):this.finishOp(W.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(W.relational,n))},Y.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(W.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(W.arrow)):this.finishOp(e===61?W.eq:W.prefix,1)},Y.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(W.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(W.assign,3):this.finishOp(W.coalesce,2)}return this.finishOp(W.question,1)},Y.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),an(t,!0)||t===92))return this.finishToken(W.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+wn(t)+`'`)},Y.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(W.parenL);case 41:return++this.pos,this.finishToken(W.parenR);case 59:return++this.pos,this.finishToken(W.semi);case 44:return++this.pos,this.finishToken(W.comma);case 91:return++this.pos,this.finishToken(W.bracketL);case 93:return++this.pos,this.finishToken(W.bracketR);case 123:return++this.pos,this.finishToken(W.braceL);case 125:return++this.pos,this.finishToken(W.braceR);case 58:return++this.pos,this.finishToken(W.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(W.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(W.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+wn(e)+`'`)},Y.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Y.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(dn.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Gr(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(W.regexp,{pattern:i,flags:o,value:c})},Y.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function fi(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function pi(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Y.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=pi(this.input.slice(t,this.pos)),++this.pos):an(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(W.num,n)},Y.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=pi(this.input.slice(t,this.pos));return++this.pos,an(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(W.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),an(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=fi(this.input.slice(t,this.pos),n);return this.finishToken(W.num,a)},Y.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},Y.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(pn(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(W.string,t)};var mi={};Y.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===mi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Y.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw mi;this.raise(e,t)},Y.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===W.template||this.type===W.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(W.dollarBraceL)):(++this.pos,this.finishToken(W.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(W.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(pn(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
1091
+ `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Y.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(W.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
1092
1092
  `&&++this.pos;case`
1093
- `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},K.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
1094
- `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return xn(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return un(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},K.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},K.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(nn(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?tn:nn)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=xn(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},K.readWord=function(){var e=this.readWord1(),t=H.name;return this.keywords.test(e)&&(t=sn[e]),this.finishToken(t,e)},Yn.acorn={Parser:Yn,version:`8.18.0`,defaultOptions:En,Position:Cn,SourceLocation:wn,getLineInfo:Tn,Node:vr,TokenType:B,tokTypes:H,keywordTypes:sn,TokContext:lr,tokContexts:ur,isIdentifierChar:nn,isIdentifierStart:tn,Token:li,isNewLine:un,lineBreak:cn,lineBreakG:ln,nonASCIIwhitespace:fn};function pi(e,t){return Yn.parse(e,t)}async function mi(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=await globalThis.crypto.subtle.digest(`SHA-256`,t);return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function hi(e,t,n){let r=e.files[t];L(r,`MODULE_FILE`,`${t} is not part of this module`);let i=n instanceof Uint8Array?n:new Uint8Array(n);return L(i.byteLength===r.bytes&&await mi(i)===r.sha256,`MODULE_FILE`,`${t} does not match its recorded digest`),i}var gi=o((()=>{gt(),Object.freeze({files:64,fileBytes:67108864,totalBytes:134217728,path:160,wallClockMs:12e4,maxWallClockMs:18e5,progressGraceMs:6e4,messageBytes:16777216,logEntries:500}),Object.freeze([`text/javascript`,`application/wasm`,`application/json`,`text/plain`,`image/png`,`image/jpeg`,`image/webp`,`font/woff2`,`application/octet-stream`]),Object.freeze([`input`,`signal`,`progress`,`log`,`asset`,`files.read`,`files.write`,`media.transform`,`actions.run`,`hosted.run`,`connections.call`,`net.fetch`,`storage.info`,`storage.list`,`storage.get`,`storage.set`,`storage.remove`,`storage.putFile`,`storage.getFile`,`project.read`,`assets.create`,`assets.appendVersion`])}));gt(),gi();var _i=Object.freeze({htmlBytes:65536,cssBytes:32768,javascriptBytes:65536,messageBytes:4194304,runsPerMinute:30,imagePreviewsPerMinute:60,imagePreviewMs:15e3,imagePreviewEdge:512}),vi=e=>new TextEncoder().encode(e).length,yi=new Set(`eval.Function.AsyncFunction.GeneratorFunction.require.importScripts.process.globalThis.window.self.top.parent.opener.frames.location.navigation.history.navigator.localStorage.sessionStorage.indexedDB.caches.cookieStore.fetch.XMLHttpRequest.WebSocket.EventSource.Worker.SharedWorker.ServiceWorker.WebAssembly.Deno.Bun.Reflect.Proxy.DOMParser.MutationObserver.postMessage.open.close.print.alert.confirm.prompt.setInterval.setTimeout.queueMicrotask.arguments.constructor.__proto__.prototype.__lookupGetter__.__lookupSetter__.__defineGetter__.__defineSetter__.getPrototypeOf.setPrototypeOf.getOwnPropertyDescriptor.getOwnPropertyDescriptors.getOwnPropertyNames.getOwnPropertySymbols.defineProperty.defineProperties.defaultView.ownerGlobal.contentWindow.contentDocument.cookie.domain.documentURI.URL.baseURI.referrer.write.writeln.innerHTML.outerHTML.insertAdjacentHTML.createElement.createElementNS.createContextualFragment.createRange.setAttribute.setAttributeNS.attributes.attributeStyleMap.adoptNode.importNode.execCommand.replaceChildren.setHTML.setHTMLUnsafe.parseHTML.parseHTMLUnsafe`.split(`.`));for(let e of[`showSaveFilePicker`,`showDirectoryPicker`,`saveAs`,`FileSystemWritableFileStream`,`createWritable`,`msSaveBlob`,`msSaveOrOpenBlob`,`download`])yi.add(e);var bi=new Set([...yi,`assign`,`values`,`entries`,`fromEntries`]);Object.freeze([...yi]),Object.freeze([`assign`,`values`,`entries`,`fromEntries`]);var xi=new Set(`div.section.article.header.footer.main.aside.nav.h1.h2.h3.h4.p.span.strong.em.i.small.br.hr.label.input.textarea.button.select.option.optgroup.fieldset.legend.output.progress.meter.ul.ol.li.dl.dt.dd.figure.figcaption.img.video.audio.source.canvas.table.thead.tbody.tfoot.tr.th.td.pre.code.details.summary`.split(`.`));Object.freeze([...xi]);var Si=e=>(e.property||e.key)?.name??(e.property||e.key)?.value;function Ci(e){return e?e.type===`Identifier`?[e.name]:e.type===`RestElement`?Ci(e.argument):e.type===`AssignmentPattern`?Ci(e.left):e.type===`ArrayPattern`?e.elements.flatMap(Ci):e.type===`ObjectPattern`?e.properties.flatMap(e=>Ci(e.type===`RestElement`?e.argument:e.value)):[]:[]}function wi(e){return e?.type===`MemberExpression`?wi(e.object):Ci(e)}function Ti(e){let t=[],n=new Map,r=new Map,i=new Set,a=new Map,o=[e];for(;o.length;){let e=o.pop();L(t.length<25e3,`VIEW`,`View JavaScript exceeds review complexity`),t.push(e);let s=e.type===`VariableDeclarator`?[e.id]:[`FunctionExpression`,`ArrowFunctionExpression`,`FunctionDeclaration`].includes(e.type)?[e.id,...e.params]:[`ClassDeclaration`,`ClassExpression`].includes(e.type)?[e.id]:e.type===`CatchClause`?[e.param]:[];for(let e of s)for(let t of Ci(e))r.set(t,(r.get(t)||0)+1);if(e.type===`AssignmentExpression`)for(let t of wi(e.left))i.add(t);if(e.type===`UpdateExpression`||e.type===`UnaryExpression`&&e.operator===`delete`)for(let t of wi(e.argument))i.add(t);if(e.type===`CallExpression`&&e.callee?.type===`MemberExpression`&&!e.callee.computed&&e.callee.object?.type===`Identifier`&&e.callee.object.name===`StillMade`&&e.callee.property.name===`onInput`&&e.arguments.length===1){let t=e.arguments[0];[`ArrowFunctionExpression`,`FunctionExpression`].includes(t.type)&&t.params.length===1&&t.params[0].type===`Identifier`&&a.set(t,t.params[0].name)}for(let t of Object.values(e))for(let r of Array.isArray(t)?t:[t])r&&typeof r==`object`&&(n.set(r,e),o.push(r))}let s=new Set;for(let e of t){if(e.computed||Si(e)!==`prompt`)continue;if(e.type===`Property`&&n.get(e)?.type===`ObjectExpression`&&!e.shorthand&&!e.method&&e.kind===`init`){s.add(e);continue}if(e.type!==`MemberExpression`||e.object?.type!==`Identifier`||r.has(`StillMade`)||i.has(`StillMade`))continue;let t=e.object.name;if(r.get(t)!==1||i.has(t))continue;let o=n.get(e);for(;o?.type===`ChainExpression`;)o=n.get(o);if((![`CallExpression`,`NewExpression`,`TaggedTemplateExpression`].includes(o?.type)||o.callee!==e&&o.tag!==e&&o.callee?.type!==`ChainExpression`)&&!(o?.type===`MemberExpression`&&o.object===e&&[`call`,`apply`,`bind`].includes(Si(o)))){for(let r=n.get(e);r;r=n.get(r))if(a.get(r)===t){s.add(e);break}}}return{nodes:t,parents:n,allowed:s}}function Ei(e){if(Ni(e))return Fi(e);L(R(e)&&Object.keys(e).every(e=>[`html`,`css`,`javascript`,`themedCss`,`appearance`].includes(e)),`VIEW`,`View must contain only html, css, javascript, optional themedCss, and appearance`),L(e.appearance===void 0||[`host`,`original`].includes(e.appearance),`VIEW`,`View appearance must be host or original`);for(let t of[`html`,`css`,`javascript`,`themedCss`])(t===`html`||e[t]!==void 0)&&L(typeof e[t]==`string`&&vi(e[t])<=_i[`${t===`themedCss`?`css`:t}Bytes`]&&(t!==`html`||e[t].trim().length>0),`VIEW`,`View ${t} exceeds its size limit or is empty`);let t=e.html,n=/<\/?([a-z][a-z0-9-]*)(?:\s+[a-z_:][a-z0-9_:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'`=<>]+))?)*\s*\/?>/gi;L(!t.replace(n,``).includes(`<`),`VIEW`,`Use complete HTML control tags; declarations, comments, and malformed markup are unsupported`);for(let e of t.matchAll(n)){L(xi.has(e[1].toLowerCase()),`VIEW`,`Unsupported view element: ${e[1]}`);let t=e[0].slice(e[0].indexOf(e[1])+e[1].length).replace(/\/?>$/,``);for(let e of t.matchAll(/\s+([a-z_:][a-z0-9_:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'`=<>]+)))?/gi)){let t=e[1].toLowerCase(),n=e[2]??e[3]??e[4]??``;L(!t.startsWith(`on`)&&![`href`,`srcdoc`,`action`,`formaction`,`form`,`target`,`download`,`ping`,`autofocus`,`nonce`,`is`].includes(t)&&!t.includes(`:`),`VIEW`,`View markup contains an unsupported executable or navigation attribute`),[`src`,`poster`].includes(t)&&L(/^(?:data:|blob:)/i.test(n),`VIEW`,`View media must use data or blob URLs`)}}let r=[...t.matchAll(/\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi)].map(e=>e[1]??e[2]??e[3]);if(L(!/@import|@font-face|url\s*\(|expression\s*\(|-moz-binding|<\/style/i.test([e.css||``,e.themedCss||``,...r].join(`
1095
- `)),`VIEW`,`View CSS cannot load resources or contain markup`),e.javascript){let t;try{t=pi(`"use strict";\n${e.javascript}`,{ecmaVersion:2022,sourceType:`script`})}catch(e){throw Object.assign(Error(`View JavaScript syntax: ${e.message}`),{code:`VIEW`})}let{nodes:n,parents:r,allowed:i}=Ti(t),a=new Map;for(let e of n){L(![`ImportExpression`,`ImportDeclaration`,`WithStatement`,`ThisExpression`,`MetaProperty`,`WhileStatement`,`DoWhileStatement`,`ForStatement`,`ForInStatement`,`ForOfStatement`,`FunctionDeclaration`].includes(e.type),`VIEW`,`Unsupported view syntax: ${e.type}`),e.type===`FunctionExpression`&&L(!e.id,`VIEW`,`Named recursive functions are unsupported in view code`),e.type===`VariableDeclarator`&&e.id?.type===`Identifier`&&[`FunctionExpression`,`ArrowFunctionExpression`].includes(e.init?.type)&&a.set(e.id.name,e.init),e.type===`CallExpression`&&e.callee?.type===`Identifier`&&L(![`addEventListener`,`removeEventListener`,`dispatchEvent`].includes(e.callee.name),`VIEW`,`Attach events to declared controls, not the global frame`);let t=r.get(e),n=i.has(t)&&(t.property||t.key)===e;if(e.type===`Identifier`&&L(n||!yi.has(e.name),`VIEW`,`Unsupported view API: ${e.name}`),[`MemberExpression`,`Property`,`MethodDefinition`].includes(e.type)&&!e.computed&&L(i.has(e)||!bi.has(Si(e)),`VIEW`,`Unsupported view property`),[`MemberExpression`,`Property`,`MethodDefinition`].includes(e.type)&&e.computed){let t=e.property||e.key;L(t?.type===`Literal`&&(typeof t.value==`string`||Number.isInteger(t.value))&&!bi.has(t.value),`VIEW`,`View property access must use a safe literal key`)}}L(a.size<=128,`VIEW`,`View contains too many helper functions`);let o=0,s=e=>{let t=new Set,n=[e];for(;n.length;){let e=n.pop();L(++o<=1e5,`VIEW`,`View helpers exceed review complexity`);let i=r.get(e),a=i?.type===`MemberExpression`&&!i.computed&&i.property===e||i?.type===`Property`&&!i.computed&&!i.shorthand&&i.key===e;e.type===`Identifier`&&!a&&t.add(e.name);for(let t of Object.values(e))Array.isArray(t)?n.push(...t.filter(e=>e&&typeof e==`object`)):t&&typeof t==`object`&&n.push(t)}return t},c=new Map([...a].map(([e,t])=>[e,[...s(t.body)].filter(e=>a.has(e))])),l=new Set,u=(e,t=new Set)=>{if(l.has(e))return;L(!t.has(e),`VIEW`,`Recursive UI functions are unsupported; move computation into the Block runtime`);let n=new Set([...t,e]);for(let t of c.get(e)||[])u(t,n);l.add(e)};for(let e of c.keys())u(e)}return!0}function Di(e,t){L(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t),`VIEW`,`Invalid interface guard`);let n=[pi(`"use strict";
1096
- `+e,{ecmaVersion:2022})],r=[];for(;n.length;){let e=n.pop();[`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1-14,text:`${t}();`}):(r.push({position:e.body.start-14,text:`(${t}(),`}),r.push({position:e.body.end-14,text:`)`})));for(let t of Object.values(e))Array.isArray(t)?n.push(...t.filter(e=>e&&typeof e==`object`)):t&&typeof t==`object`&&n.push(t)}for(let t of r.sort((e,t)=>t.position-e.position))e=e.slice(0,t.position)+t.text+e.slice(t.position);return e}var Oi=Object.freeze({htmlBytes:262144,cssBytes:262144,javascriptBytes:4194304,assetFiles:32,assetBytes:8388608,taskMs:250,longTaskMs:1e3}),ki=Object.freeze([`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/svg+xml`,`font/woff2`,`application/json`,`text/plain`,`audio/mpeg`,`audio/wav`,`video/mp4`,`application/octet-stream`]),Ai=[`runtime`,`html`,`css`,`themedCss`,`javascript`,`appearance`,`files`],ji=/<\s*(script|iframe|frame|frameset|object|embed|applet|base|meta|link|portal|noscript)\b/i,Mi=/^(?!\/)(?!.*\.\.)(?!.*\/\/)[A-Za-z0-9._\/-]{1,160}$/,Ni=e=>R(e)&&e.runtime===`frame`;function Pi(e){try{return{ast:pi(e,{ecmaVersion:`latest`,sourceType:`script`})}}catch(t){let n=!1;try{pi(e,{ecmaVersion:`latest`,sourceType:`module`}),n=!0}catch{}throw Object.assign(Error(n?`Frame view JavaScript must be one classic script: bundle it as an IIFE (for example esbuild --format=iife).`:`View JavaScript syntax: ${t.message}`),{code:`VIEW`})}}function Fi(e){L(Object.keys(e).every(e=>Ai.includes(e)),`VIEW`,`A frame view contains runtime "frame", html and optional css, themedCss, javascript, appearance and files`),L(e.appearance===void 0||[`host`,`original`].includes(e.appearance),`VIEW`,`View appearance must be host or original`);for(let t of[`html`,`css`,`javascript`,`themedCss`]){if(t!==`html`&&e[t]===void 0)continue;let n=Oi[`${t===`themedCss`?`css`:t}Bytes`];L(typeof e[t]==`string`&&vi(e[t])<=n&&(t!==`html`||e[t].trim().length>0),`VIEW`,`Frame view ${t} exceeds ${Math.round(n/1024)} KiB or is empty`)}L(!ji.test(e.html),`VIEW`,`Frame view markup cannot contain script, frame, object, embed, base, meta or link elements; put code in view.javascript and assets in view.files`);for(let t of[e.css,e.themedCss])t&&L(!/@import|url\s*\(\s*["']?\s*(?:https?:|\/\/)|<\/style/i.test(t),`VIEW`,`Frame view CSS cannot load remote resources; ship them in view.files`);if(e.javascript){let{ast:t}=Pi(e.javascript),n=[t],r=0;for(;n.length;){let e=n.pop();L(++r<=4e6,`VIEW`,`Frame view JavaScript is too complex to compile`),L(e.type!==`ImportExpression`,`VIEW`,`Bundle every dependency into view.javascript; frame views cannot import code`);for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&n.push(e);else t&&typeof t==`object`&&typeof t.type==`string`&&n.push(t)}}if(e.files!==void 0){L(R(e.files)&&e.files.schemaVersion===1&&R(e.files.files)&&Object.keys(e.files).every(e=>[`schemaVersion`,`files`].includes(e)),`VIEW`,`view.files is {schemaVersion: 1, files: {path: {sha256, bytes, mediaType}}}`);let t=Object.entries(e.files.files),n=0;L(t.length<=Oi.assetFiles,`VIEW`,`A frame view ships at most ${Oi.assetFiles} asset files`);for(let[e,r]of t)L(Mi.test(e)&&R(r)&&Object.keys(r).every(e=>[`sha256`,`bytes`,`mediaType`].includes(e))&&/^[a-f0-9]{64}$/.test(r.sha256||``)&&Number.isSafeInteger(r.bytes)&&r.bytes>0&&ki.includes(r.mediaType),`VIEW`,`View asset ${e} needs a safe path, its SHA-256, size and a supported media type`),n+=r.bytes;L(n<=Oi.assetBytes,`VIEW`,`Frame view assets exceed 8 MiB in total`)}return!0}function Ii(e,t){L(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t),`VIEW`,`Invalid interface guard`);let{ast:n}=Pi(e),r=[],i=[[n,0]],a=`${t}();`;for(;i.length;){let[e,n]=i.pop();[`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1,text:a,depth:n,open:!0}):(r.push({position:e.body.start,text:`(${t}(),`,depth:n,open:!0}),r.push({position:e.body.end,text:`)`,depth:n,open:!1}))),[`WhileStatement`,`DoWhileStatement`,`ForStatement`,`ForInStatement`,`ForOfStatement`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1,text:a,depth:n,open:!0}):(r.push({position:e.body.start,text:`{${a}`,depth:n,open:!0}),r.push({position:e.body.end,text:`}`,depth:n,open:!1})));for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&i.push([e,n+1]);else t&&typeof t==`object`&&typeof t.type==`string`&&i.push([t,n+1])}r.sort((e,t)=>t.position-e.position||(e.open===t.open?e.open?t.depth-e.depth:e.depth-t.depth:e.open?-1:1));for(let t of r)e=e.slice(0,t.position)+t.text+e.slice(t.position);return e}function Li(e,t,n,{guardName:r,taskMs:i,assets:a}){let o=parent,s=performance.now.bind(performance),c=setTimeout.bind(globalThis),l=Error,u=`This interface ran too long without pausing and was stopped. Move long work into a Worker or the Block runtime.`,d=!1,f=0,p=0,m=0,h=!1,g=s(),_=0,v=!1,y=()=>{d&&(_+=Math.max(0,p-f)),d=!1,m=0,h=!1;let r=s();r-g>=5e3&&(!v&&_/(r-g)>.7&&(v=!0,n({channel:e,session:t,op:`unresponsive`},`*`)),g=r,_=0)};Object.defineProperty(globalThis,r,{value:()=>{if(h)throw new l(u);if(!d){d=!0,f=p=s(),c(y,0);return}if(!(++m&255)&&(p=s(),p-f>i))throw h=!0,new l(u)},writable:!1,configurable:!1,enumerable:!1});try{globalThis.navigation?.addEventListener(`navigate`,e=>{e.cancelable&&e.preventDefault()})}catch{}addEventListener(`pagehide`,()=>n({channel:e,session:t,op:`navigated`},`*`)),addEventListener(`message`,r=>{let i=r.data;r.source===o&&i&&i.channel===e&&i.session===t&&i.op===`ping`&&typeof i.id==`string`&&n({channel:e,session:t,op:`pong`,id:i.id},`*`)});let b=new Map,x=new Map,S=e=>{let t=Object.hasOwn(a,e)?a[e]:null;if(!t)throw new l(`${String(e).slice(0,160)} is not one of this view's files`);if(!b.has(e)){let n=atob(t.base64),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);b.set(e,r)}return b.get(e)};return Object.freeze({asset(e){return x.has(e)||x.set(e,URL.createObjectURL(new Blob([S(e)],{type:a[e].mediaType}))),x.get(e)},assetBytes(e){return S(e).slice().buffer}})}gt();var Ri=Object.freeze([`style`,`cssText`,`setProperty`,`removeProperty`,`insertRule`,`deleteRule`,`styleSheets`,`adoptedStyleSheets`,`animate`]),zi=Object.freeze(`--bg.--bg-elev-1.--bg-elev-2.--bg-inset.--fg.--fg-muted.--fg-subtle.--fg-on-accent.--border-tok.--border-strong.--divider.--hover-wash.--press-wash.--selection-bg.--selection-fg.--signal.--signal-dim.--signal-glow.--accent.--accent-hover.--accent-dim.--accent-glow.--accent-contrast.--bg-primary.--bg-secondary.--bg-tertiary.--bg-elevated.--bg-hover.--border.--border-light.--text-primary.--text-secondary.--text-muted.--success.--warning.--danger.--shadow.--shadow-lg.--shadow-1.--shadow-2.--editor-standout-bg.--editor-standout-fg`.split(`.`)),Bi=new Set(zi),Vi=/^(?:color|background(?:-color|-image)?|(?:border|outline)(?:-(?:top|right|bottom|left|inline|block|inline-start|inline-end|block-start|block-end))?(?:-color)?|(?:box|text)-shadow|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|column-rule(?:-color)?|-webkit-text-fill-color)$/;function q(e,{original:t=!1}={}){let n=e.replace(/\/\*[\s\S]*?\*\//g,``);L(!/[\\&]|@(?:property|supports|layer|keyframes)|(?:^|[;{])\s*(?:all|filter|backdrop-filter|mix-blend-mode)\s*:/i.test(n),`APPEARANCE`,`Use plain theme rules; CSS escapes, nesting, filters and color blending need adaptation.`);for(let e of n.matchAll(/(?:^|[;{])\s*([\w-]+)\s*:\s*([^;{}]+)/g)){let n=e[1].toLowerCase(),r=e[2].trim();if(t||(L(!Bi.has(n),`APPEARANCE`,`Do not redefine StillMade appearance tokens.`),!Vi.test(n)&&!n.endsWith(`-color`)&&![`border-image`,`border-image-source`,`-webkit-text-stroke`].includes(n)&&!n.startsWith(`--`)))continue;let i=r.replace(/var\(\s*(--[\w-]+)\s*\)/g,(e,t)=>(L(Bi.has(t),`APPEARANCE`,`Use a StillMade semantic color token instead of ${t}.`),` token `)).replace(/!important/gi,``);if(n.startsWith(`--`)&&!/#|\b(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\s*\(/i.test(i))continue;let a=i.replace(/-?\d*\.?\d+(?:px|rem|em|vh|vw|%|deg|turn)?/g,``).replace(/[(),\s/.-]/g,` `).trim().split(/\s+/).filter(Boolean),o=new Set(`token.transparent.currentColor.currentcolor.inherit.initial.unset.none.auto.solid.dashed.dotted.double.inset.outset.thin.medium.thick.linear.radial.conic.repeating.gradient.to.top.right.bottom.left.circle.ellipse.at.center`.split(`.`));L(a.every(e=>o.has(e))&&!/#|\b(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color|var)\s*\(/i.test(i),`APPEARANCE`,`Use semantic theme tokens for ${n}; keep original colors in view.css and provide view.themedCss.`)}}function J(e,{appearance:t=e?.appearance??`host`}={}){if(!e)return!0;L([`host`,`original`].includes(t),`APPEARANCE`,`View appearance must be host or original.`);let n=t===`original`;L(!/\s(?:bgcolor|bordercolor|color|text|link|vlink|alink)\s*=/i.test(e.html),`APPEARANCE`,`Move presentational HTML colors into the original and themed stylesheets.`),q(n?e.css??``:e.themedCss??e.css??``,{original:n}),n&&e.themedCss!==void 0&&q(e.themedCss);for(let t of e.html.matchAll(/\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi))q(t[1]??t[2]??t[3],{original:n});return L(!RegExp(`\\b(?:${Ri.join(`|`)})\\b`).test(e.javascript||``),`APPEARANCE`,`Use CSS classes for interface changes; put themed colors in the stylesheet instead of setting styles in JavaScript.`),!0}var Hi=`@font-face{font-family:"Hanken Grotesk";font-style:normal;font-weight:100 900;font-display:swap;src:url("/fonts/HankenGrotesk-Variable.ttf") format("truetype")}
1093
+ `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},Y.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
1094
+ `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return wn(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return pn(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},Y.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Y.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(on(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?an:on)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=wn(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Y.readWord=function(){var e=this.readWord1(),t=W.name;return this.keywords.test(e)&&(t=un[e]),this.finishToken(t,e)},Qn.acorn={Parser:Qn,version:`8.18.0`,defaultOptions:kn,Position:En,SourceLocation:Dn,getLineInfo:On,Node:xr,TokenType:H,tokTypes:W,keywordTypes:un,TokContext:fr,tokContexts:pr,isIdentifierChar:on,isIdentifierStart:an,Token:di,isNewLine:pn,lineBreak:dn,lineBreakG:fn,nonASCIIwhitespace:hn};function hi(e,t){return Qn.parse(e,t)}async function gi(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=await globalThis.crypto.subtle.digest(`SHA-256`,t);return[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function _i(e,t,n){let r=e.files[t];z(r,`MODULE_FILE`,`${t} is not part of this module`);let i=n instanceof Uint8Array?n:new Uint8Array(n);return z(i.byteLength===r.bytes&&await gi(i)===r.sha256,`MODULE_FILE`,`${t} does not match its recorded digest`),i}var vi=o((()=>{vt(),Object.freeze({files:64,fileBytes:67108864,totalBytes:134217728,path:160,wallClockMs:12e4,maxWallClockMs:18e5,progressGraceMs:6e4,messageBytes:16777216,logEntries:500}),Object.freeze([`text/javascript`,`application/wasm`,`application/json`,`text/plain`,`image/png`,`image/jpeg`,`image/webp`,`font/woff2`,`application/octet-stream`]),Object.freeze([`input`,`signal`,`progress`,`log`,`asset`,`files.read`,`files.write`,`media.transform`,`actions.run`,`hosted.run`,`connections.call`,`net.fetch`,`storage.info`,`storage.list`,`storage.get`,`storage.set`,`storage.remove`,`storage.putFile`,`storage.getFile`,`project.read`,`assets.create`,`assets.appendVersion`])}));vt(),vi();var yi=Object.freeze({htmlBytes:65536,cssBytes:32768,javascriptBytes:65536,messageBytes:4194304,runsPerMinute:30,imagePreviewsPerMinute:60,imagePreviewMs:15e3,imagePreviewEdge:512}),bi=e=>new TextEncoder().encode(e).length,xi=new Set(`eval.Function.AsyncFunction.GeneratorFunction.require.importScripts.process.globalThis.window.self.top.parent.opener.frames.location.navigation.history.navigator.localStorage.sessionStorage.indexedDB.caches.cookieStore.fetch.XMLHttpRequest.WebSocket.EventSource.Worker.SharedWorker.ServiceWorker.WebAssembly.Deno.Bun.Reflect.Proxy.DOMParser.MutationObserver.postMessage.open.close.print.alert.confirm.prompt.setInterval.setTimeout.queueMicrotask.arguments.constructor.__proto__.prototype.__lookupGetter__.__lookupSetter__.__defineGetter__.__defineSetter__.getPrototypeOf.setPrototypeOf.getOwnPropertyDescriptor.getOwnPropertyDescriptors.getOwnPropertyNames.getOwnPropertySymbols.defineProperty.defineProperties.defaultView.ownerGlobal.contentWindow.contentDocument.cookie.domain.documentURI.URL.baseURI.referrer.write.writeln.innerHTML.outerHTML.insertAdjacentHTML.createElement.createElementNS.createContextualFragment.createRange.setAttribute.setAttributeNS.attributes.attributeStyleMap.adoptNode.importNode.execCommand.replaceChildren.setHTML.setHTMLUnsafe.parseHTML.parseHTMLUnsafe`.split(`.`));for(let e of[`showSaveFilePicker`,`showDirectoryPicker`,`saveAs`,`FileSystemWritableFileStream`,`createWritable`,`msSaveBlob`,`msSaveOrOpenBlob`,`download`])xi.add(e);var Si=new Set([...xi,`assign`,`values`,`entries`,`fromEntries`]);Object.freeze([...xi]),Object.freeze([`assign`,`values`,`entries`,`fromEntries`]);var Ci=new Set(`div.section.article.header.footer.main.aside.nav.h1.h2.h3.h4.p.span.strong.em.i.small.br.hr.label.input.textarea.button.select.option.optgroup.fieldset.legend.output.progress.meter.ul.ol.li.dl.dt.dd.figure.figcaption.img.video.audio.source.canvas.table.thead.tbody.tfoot.tr.th.td.pre.code.details.summary`.split(`.`));Object.freeze([...Ci]);var wi=e=>(e.property||e.key)?.name??(e.property||e.key)?.value;function Ti(e){return e?e.type===`Identifier`?[e.name]:e.type===`RestElement`?Ti(e.argument):e.type===`AssignmentPattern`?Ti(e.left):e.type===`ArrayPattern`?e.elements.flatMap(Ti):e.type===`ObjectPattern`?e.properties.flatMap(e=>Ti(e.type===`RestElement`?e.argument:e.value)):[]:[]}function Ei(e){return e?.type===`MemberExpression`?Ei(e.object):Ti(e)}function Di(e){let t=[],n=new Map,r=new Map,i=new Set,a=new Map,o=[e];for(;o.length;){let e=o.pop();z(t.length<25e3,`VIEW`,`View JavaScript exceeds review complexity`),t.push(e);let s=e.type===`VariableDeclarator`?[e.id]:[`FunctionExpression`,`ArrowFunctionExpression`,`FunctionDeclaration`].includes(e.type)?[e.id,...e.params]:[`ClassDeclaration`,`ClassExpression`].includes(e.type)?[e.id]:e.type===`CatchClause`?[e.param]:[];for(let e of s)for(let t of Ti(e))r.set(t,(r.get(t)||0)+1);if(e.type===`AssignmentExpression`)for(let t of Ei(e.left))i.add(t);if(e.type===`UpdateExpression`||e.type===`UnaryExpression`&&e.operator===`delete`)for(let t of Ei(e.argument))i.add(t);if(e.type===`CallExpression`&&e.callee?.type===`MemberExpression`&&!e.callee.computed&&e.callee.object?.type===`Identifier`&&e.callee.object.name===`StillMade`&&e.callee.property.name===`onInput`&&e.arguments.length===1){let t=e.arguments[0];[`ArrowFunctionExpression`,`FunctionExpression`].includes(t.type)&&t.params.length===1&&t.params[0].type===`Identifier`&&a.set(t,t.params[0].name)}for(let t of Object.values(e))for(let r of Array.isArray(t)?t:[t])r&&typeof r==`object`&&(n.set(r,e),o.push(r))}let s=new Set;for(let e of t){if(e.computed||wi(e)!==`prompt`)continue;if(e.type===`Property`&&n.get(e)?.type===`ObjectExpression`&&!e.shorthand&&!e.method&&e.kind===`init`){s.add(e);continue}if(e.type!==`MemberExpression`||e.object?.type!==`Identifier`||r.has(`StillMade`)||i.has(`StillMade`))continue;let t=e.object.name;if(r.get(t)!==1||i.has(t))continue;let o=n.get(e);for(;o?.type===`ChainExpression`;)o=n.get(o);if((![`CallExpression`,`NewExpression`,`TaggedTemplateExpression`].includes(o?.type)||o.callee!==e&&o.tag!==e&&o.callee?.type!==`ChainExpression`)&&!(o?.type===`MemberExpression`&&o.object===e&&[`call`,`apply`,`bind`].includes(wi(o)))){for(let r=n.get(e);r;r=n.get(r))if(a.get(r)===t){s.add(e);break}}}return{nodes:t,parents:n,allowed:s}}function Oi(e){if(Fi(e))return Li(e);z(B(e)&&Object.keys(e).every(e=>[`html`,`css`,`javascript`,`themedCss`,`appearance`].includes(e)),`VIEW`,`View must contain only html, css, javascript, optional themedCss, and appearance`),z(e.appearance===void 0||[`host`,`original`].includes(e.appearance),`VIEW`,`View appearance must be host or original`);for(let t of[`html`,`css`,`javascript`,`themedCss`])(t===`html`||e[t]!==void 0)&&z(typeof e[t]==`string`&&bi(e[t])<=yi[`${t===`themedCss`?`css`:t}Bytes`]&&(t!==`html`||e[t].trim().length>0),`VIEW`,`View ${t} exceeds its size limit or is empty`);let t=e.html,n=/<\/?([a-z][a-z0-9-]*)(?:\s+[a-z_:][a-z0-9_:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'`=<>]+))?)*\s*\/?>/gi;z(!t.replace(n,``).includes(`<`),`VIEW`,`Use complete HTML control tags; declarations, comments, and malformed markup are unsupported`);for(let e of t.matchAll(n)){z(Ci.has(e[1].toLowerCase()),`VIEW`,`Unsupported view element: ${e[1]}`);let t=e[0].slice(e[0].indexOf(e[1])+e[1].length).replace(/\/?>$/,``);for(let e of t.matchAll(/\s+([a-z_:][a-z0-9_:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'`=<>]+)))?/gi)){let t=e[1].toLowerCase(),n=e[2]??e[3]??e[4]??``;z(!t.startsWith(`on`)&&![`href`,`srcdoc`,`action`,`formaction`,`form`,`target`,`download`,`ping`,`autofocus`,`nonce`,`is`].includes(t)&&!t.includes(`:`),`VIEW`,`View markup contains an unsupported executable or navigation attribute`),[`src`,`poster`].includes(t)&&z(/^(?:data:|blob:)/i.test(n),`VIEW`,`View media must use data or blob URLs`)}}let r=[...t.matchAll(/\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi)].map(e=>e[1]??e[2]??e[3]);if(z(!/@import|@font-face|url\s*\(|expression\s*\(|-moz-binding|<\/style/i.test([e.css||``,e.themedCss||``,...r].join(`
1095
+ `)),`VIEW`,`View CSS cannot load resources or contain markup`),e.javascript){let t;try{t=hi(`"use strict";\n${e.javascript}`,{ecmaVersion:2022,sourceType:`script`})}catch(e){throw Object.assign(Error(`View JavaScript syntax: ${e.message}`),{code:`VIEW`})}let{nodes:n,parents:r,allowed:i}=Di(t),a=new Map;for(let e of n){z(![`ImportExpression`,`ImportDeclaration`,`WithStatement`,`ThisExpression`,`MetaProperty`,`WhileStatement`,`DoWhileStatement`,`ForStatement`,`ForInStatement`,`ForOfStatement`,`FunctionDeclaration`].includes(e.type),`VIEW`,`Unsupported view syntax: ${e.type}`),e.type===`FunctionExpression`&&z(!e.id,`VIEW`,`Named recursive functions are unsupported in view code`),e.type===`VariableDeclarator`&&e.id?.type===`Identifier`&&[`FunctionExpression`,`ArrowFunctionExpression`].includes(e.init?.type)&&a.set(e.id.name,e.init),e.type===`CallExpression`&&e.callee?.type===`Identifier`&&z(![`addEventListener`,`removeEventListener`,`dispatchEvent`].includes(e.callee.name),`VIEW`,`Attach events to declared controls, not the global frame`);let t=r.get(e),n=i.has(t)&&(t.property||t.key)===e;if(e.type===`Identifier`&&z(n||!xi.has(e.name),`VIEW`,`Unsupported view API: ${e.name}. View code cannot use this name, even for its own variable; rename it.`),[`MemberExpression`,`Property`,`MethodDefinition`].includes(e.type)&&!e.computed&&z(i.has(e)||!Si.has(wi(e)),`VIEW`,`Unsupported view property`),[`MemberExpression`,`Property`,`MethodDefinition`].includes(e.type)&&e.computed){let t=e.property||e.key;z(t?.type===`Literal`&&(typeof t.value==`string`||Number.isInteger(t.value))&&!Si.has(t.value),`VIEW`,`View property access must use a safe literal key`)}}z(a.size<=128,`VIEW`,`View contains too many helper functions`);let o=0,s=e=>{let t=new Set,n=[e];for(;n.length;){let e=n.pop();z(++o<=1e5,`VIEW`,`View helpers exceed review complexity`);let i=r.get(e),a=i?.type===`MemberExpression`&&!i.computed&&i.property===e||i?.type===`Property`&&!i.computed&&!i.shorthand&&i.key===e;e.type===`Identifier`&&!a&&t.add(e.name);for(let t of Object.values(e))Array.isArray(t)?n.push(...t.filter(e=>e&&typeof e==`object`)):t&&typeof t==`object`&&n.push(t)}return t},c=new Map([...a].map(([e,t])=>[e,[...s(t.body)].filter(e=>a.has(e))])),l=new Set,u=(e,t=new Set)=>{if(l.has(e))return;z(!t.has(e),`VIEW`,`Recursive UI functions are unsupported; move computation into the Block runtime`);let n=new Set([...t,e]);for(let t of c.get(e)||[])u(t,n);l.add(e)};for(let e of c.keys())u(e)}return!0}function ki(e,t){z(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t),`VIEW`,`Invalid interface guard`);let n=[hi(`"use strict";
1096
+ `+e,{ecmaVersion:2022})],r=[];for(;n.length;){let e=n.pop();[`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1-14,text:`${t}();`}):(r.push({position:e.body.start-14,text:`(${t}(),`}),r.push({position:e.body.end-14,text:`)`})));for(let t of Object.values(e))Array.isArray(t)?n.push(...t.filter(e=>e&&typeof e==`object`)):t&&typeof t==`object`&&n.push(t)}for(let t of r.sort((e,t)=>t.position-e.position))e=e.slice(0,t.position)+t.text+e.slice(t.position);return e}var Ai=Object.freeze({htmlBytes:262144,cssBytes:262144,javascriptBytes:4194304,assetFiles:32,assetBytes:8388608,taskMs:250,longTaskMs:1e3}),ji=Object.freeze([`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/svg+xml`,`font/woff2`,`application/json`,`text/plain`,`audio/mpeg`,`audio/wav`,`video/mp4`,`application/octet-stream`]),Mi=[`runtime`,`html`,`css`,`themedCss`,`javascript`,`appearance`,`files`],Ni=/<\s*(script|iframe|frame|frameset|object|embed|applet|base|meta|link|portal|noscript)\b/i,Pi=/^(?!\/)(?!.*\.\.)(?!.*\/\/)[A-Za-z0-9._\/-]{1,160}$/,Fi=e=>B(e)&&e.runtime===`frame`;function Ii(e){try{return{ast:hi(e,{ecmaVersion:`latest`,sourceType:`script`})}}catch(t){let n=!1;try{hi(e,{ecmaVersion:`latest`,sourceType:`module`}),n=!0}catch{}throw Object.assign(Error(n?`Frame view JavaScript must be one classic script: bundle it as an IIFE (for example esbuild --format=iife).`:`View JavaScript syntax: ${t.message}`),{code:`VIEW`})}}function Li(e){z(Object.keys(e).every(e=>Mi.includes(e)),`VIEW`,`A frame view contains runtime "frame", html and optional css, themedCss, javascript, appearance and files`),z(e.appearance===void 0||[`host`,`original`].includes(e.appearance),`VIEW`,`View appearance must be host or original`);for(let t of[`html`,`css`,`javascript`,`themedCss`]){if(t!==`html`&&e[t]===void 0)continue;let n=Ai[`${t===`themedCss`?`css`:t}Bytes`];z(typeof e[t]==`string`&&bi(e[t])<=n&&(t!==`html`||e[t].trim().length>0),`VIEW`,`Frame view ${t} exceeds ${Math.round(n/1024)} KiB or is empty`)}z(!Ni.test(e.html),`VIEW`,`Frame view markup cannot contain script, frame, object, embed, base, meta or link elements; put code in view.javascript and assets in view.files`);for(let t of[e.css,e.themedCss])t&&z(!/@import|url\s*\(\s*["']?\s*(?:https?:|\/\/)|<\/style/i.test(t),`VIEW`,`Frame view CSS cannot load remote resources; ship them in view.files`);if(e.javascript){let{ast:t}=Ii(e.javascript),n=[t],r=0;for(;n.length;){let e=n.pop();z(++r<=4e6,`VIEW`,`Frame view JavaScript is too complex to compile`),z(e.type!==`ImportExpression`,`VIEW`,`Bundle every dependency into view.javascript; frame views cannot import code`);for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&n.push(e);else t&&typeof t==`object`&&typeof t.type==`string`&&n.push(t)}}if(e.files!==void 0){z(B(e.files)&&e.files.schemaVersion===1&&B(e.files.files)&&Object.keys(e.files).every(e=>[`schemaVersion`,`files`].includes(e)),`VIEW`,`view.files is {schemaVersion: 1, files: {path: {sha256, bytes, mediaType}}}`);let t=Object.entries(e.files.files),n=0;z(t.length<=Ai.assetFiles,`VIEW`,`A frame view ships at most ${Ai.assetFiles} asset files`);for(let[e,r]of t)z(Pi.test(e)&&B(r)&&Object.keys(r).every(e=>[`sha256`,`bytes`,`mediaType`].includes(e))&&/^[a-f0-9]{64}$/.test(r.sha256||``)&&Number.isSafeInteger(r.bytes)&&r.bytes>0&&ji.includes(r.mediaType),`VIEW`,`View asset ${e} needs a safe path, its SHA-256, size and a supported media type`),n+=r.bytes;z(n<=Ai.assetBytes,`VIEW`,`Frame view assets exceed 8 MiB in total`)}return!0}function Ri(e,t){z(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t),`VIEW`,`Invalid interface guard`);let{ast:n}=Ii(e),r=[],i=[[n,0]],a=`${t}();`;for(;i.length;){let[e,n]=i.pop();[`ArrowFunctionExpression`,`FunctionExpression`,`FunctionDeclaration`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1,text:a,depth:n,open:!0}):(r.push({position:e.body.start,text:`(${t}(),`,depth:n,open:!0}),r.push({position:e.body.end,text:`)`,depth:n,open:!1}))),[`WhileStatement`,`DoWhileStatement`,`ForStatement`,`ForInStatement`,`ForOfStatement`].includes(e.type)&&(e.body.type===`BlockStatement`?r.push({position:e.body.start+1,text:a,depth:n,open:!0}):(r.push({position:e.body.start,text:`{${a}`,depth:n,open:!0}),r.push({position:e.body.end,text:`}`,depth:n,open:!1})));for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&i.push([e,n+1]);else t&&typeof t==`object`&&typeof t.type==`string`&&i.push([t,n+1])}r.sort((e,t)=>t.position-e.position||(e.open===t.open?e.open?t.depth-e.depth:e.depth-t.depth:e.open?-1:1));for(let t of r)e=e.slice(0,t.position)+t.text+e.slice(t.position);return e}function zi(e,t,n,{guardName:r,taskMs:i,assets:a}){let o=parent,s=performance.now.bind(performance),c=setTimeout.bind(globalThis),l=Error,u=`This interface ran too long without pausing and was stopped. Move long work into a Worker or the Block runtime.`,d=!1,f=0,p=0,m=0,h=!1,g=s(),_=0,v=!1,y=()=>{d&&(_+=Math.max(0,p-f)),d=!1,m=0,h=!1;let r=s();r-g>=5e3&&(!v&&_/(r-g)>.7&&(v=!0,n({channel:e,session:t,op:`unresponsive`},`*`)),g=r,_=0)};Object.defineProperty(globalThis,r,{value:()=>{if(h)throw new l(u);if(!d){d=!0,f=p=s(),c(y,0);return}if(!(++m&255)&&(p=s(),p-f>i))throw h=!0,new l(u)},writable:!1,configurable:!1,enumerable:!1});try{globalThis.navigation?.addEventListener(`navigate`,e=>{e.cancelable&&e.preventDefault()})}catch{}addEventListener(`pagehide`,()=>n({channel:e,session:t,op:`navigated`},`*`)),addEventListener(`message`,r=>{let i=r.data;r.source===o&&i&&i.channel===e&&i.session===t&&i.op===`ping`&&typeof i.id==`string`&&n({channel:e,session:t,op:`pong`,id:i.id},`*`)});let b=new Map,x=new Map,S=e=>{let t=Object.hasOwn(a,e)?a[e]:null;if(!t)throw new l(`${String(e).slice(0,160)} is not one of this view's files`);if(!b.has(e)){let n=atob(t.base64),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);b.set(e,r)}return b.get(e)};return Object.freeze({asset(e){return x.has(e)||x.set(e,URL.createObjectURL(new Blob([S(e)],{type:a[e].mediaType}))),x.get(e)},assetBytes(e){return S(e).slice().buffer}})}vt();var X=Object.freeze([`style`,`cssText`,`setProperty`,`removeProperty`,`insertRule`,`deleteRule`,`styleSheets`,`adoptedStyleSheets`,`animate`]),Bi=Object.freeze(`--bg.--bg-elev-1.--bg-elev-2.--bg-inset.--fg.--fg-muted.--fg-subtle.--fg-on-accent.--border-tok.--border-strong.--divider.--hover-wash.--press-wash.--selection-bg.--selection-fg.--signal.--signal-dim.--signal-glow.--accent.--accent-hover.--accent-dim.--accent-glow.--accent-contrast.--bg-primary.--bg-secondary.--bg-tertiary.--bg-elevated.--bg-hover.--border.--border-light.--text-primary.--text-secondary.--text-muted.--success.--warning.--danger.--shadow.--shadow-lg.--shadow-1.--shadow-2.--editor-standout-bg.--editor-standout-fg`.split(`.`)),Vi=new Set(Bi),Hi=/^(?:color|background(?:-color|-image)?|(?:border|outline)(?:-(?:top|right|bottom|left|inline|block|inline-start|inline-end|block-start|block-end))?(?:-color)?|(?:box|text)-shadow|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|column-rule(?:-color)?|-webkit-text-fill-color)$/;function Ui(e,{original:t=!1}={}){let n=e.replace(/\/\*[\s\S]*?\*\//g,``);z(!/[\\&]|@(?:property|supports|layer|keyframes)|(?:^|[;{])\s*(?:all|filter|backdrop-filter|mix-blend-mode)\s*:/i.test(n),`APPEARANCE`,`Use plain theme rules; CSS escapes, nesting, filters and color blending need adaptation.`);for(let e of n.matchAll(/(?:^|[;{])\s*([\w-]+)\s*:\s*([^;{}]+)/g)){let n=e[1].toLowerCase(),r=e[2].trim();if(t||(z(!Vi.has(n),`APPEARANCE`,`Do not redefine StillMade appearance tokens.`),!Hi.test(n)&&!n.endsWith(`-color`)&&![`border-image`,`border-image-source`,`-webkit-text-stroke`].includes(n)&&!n.startsWith(`--`)))continue;let i=r.replace(/var\(\s*(--[\w-]+)\s*\)/g,(e,t)=>(z(Vi.has(t),`APPEARANCE`,`Use a StillMade semantic color token instead of ${t}.`),` token `)).replace(/!important/gi,``);if(n.startsWith(`--`)&&!/#|\b(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\s*\(/i.test(i))continue;let a=i.replace(/-?\d*\.?\d+(?:px|rem|em|vh|vw|%|deg|turn)?/g,``).replace(/[(),\s/.-]/g,` `).trim().split(/\s+/).filter(Boolean),o=new Set(`token.transparent.currentColor.currentcolor.inherit.initial.unset.none.auto.solid.dashed.dotted.double.inset.outset.thin.medium.thick.linear.radial.conic.repeating.gradient.to.top.right.bottom.left.circle.ellipse.at.center`.split(`.`));z(a.every(e=>o.has(e))&&!/#|\b(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color|var)\s*\(/i.test(i),`APPEARANCE`,`Use semantic theme tokens for ${n}; keep original colors in view.css and provide view.themedCss.`)}}function Wi(e,{appearance:t=e?.appearance??`host`}={}){if(!e)return!0;z([`host`,`original`].includes(t),`APPEARANCE`,`View appearance must be host or original.`);let n=t===`original`;z(!/\s(?:bgcolor|bordercolor|color|text|link|vlink|alink)\s*=/i.test(e.html),`APPEARANCE`,`Move presentational HTML colors into the original and themed stylesheets.`),Ui(n?e.css??``:e.themedCss??e.css??``,{original:n}),n&&e.themedCss!==void 0&&Ui(e.themedCss);for(let t of e.html.matchAll(/\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi))Ui(t[1]??t[2]??t[3],{original:n});return z(!RegExp(`\\b(?:${X.join(`|`)})\\b`).test(e.javascript||``),`APPEARANCE`,`Use CSS classes for interface changes; put themed colors in the stylesheet instead of setting styles in JavaScript.`),!0}var Gi=`@font-face{font-family:"Hanken Grotesk";font-style:normal;font-weight:100 900;font-display:swap;src:url("/fonts/HankenGrotesk-Variable.ttf") format("truetype")}
1097
1097
  @font-face{font-family:"Hanken Grotesk";font-style:italic;font-weight:100 900;font-display:swap;src:url("/fonts/HankenGrotesk-Italic-Variable.ttf") format("truetype")}
1098
- @font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:100 900;font-display:swap;src:url("/fonts/JetBrainsMono-Variable.ttf") format("truetype")}
1099
- @font-face{font-family:"JetBrains Mono";font-style:italic;font-weight:100 900;font-display:swap;src:url("/fonts/JetBrainsMono-Italic-Variable.ttf") format("truetype")}
1100
1098
  /* Shared StillMade foundations. App and public listing pages use this file. */
1101
1099
  :root {
1102
1100
  /* ---------- Raw palette: two anchors + tonal steps ---------- */
@@ -1121,7 +1119,8 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
1121
1119
  /* ---------- Type families ---------- */
1122
1120
  --font-display: "Balgin", "Hanken Grotesk", ui-sans-serif, sans-serif;
1123
1121
  --font-body: "Hanken Grotesk", ui-sans-serif, sans-serif;
1124
- --font-mono: "JetBrains Mono", ui-monospace, monospace;
1122
+ /* Code only (source, code blocks). Interface text never uses it. */
1123
+ --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
1125
1124
  --font: var(--font-body);
1126
1125
 
1127
1126
  /* ---------- Type scale ---------- */
@@ -1248,6 +1247,11 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
1248
1247
  --success: var(--fg);
1249
1248
  --warning: var(--signal);
1250
1249
  --danger: var(--signal);
1250
+ /* Block attention (placement-attention.js): yellow = needs an answer or rerun, red = needs a fix. Green = live or ready, blue = working. */
1251
+ --attention-warning: #E0B24F;
1252
+ --attention-error: #E26A5F;
1253
+ --attention-ok: #6BC38E;
1254
+ --attention-info: #7DA7E8;
1251
1255
  --shadow: var(--shadow-1);
1252
1256
  --shadow-lg: var(--shadow-2);
1253
1257
  }
@@ -1311,6 +1315,10 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
1311
1315
  --success: var(--fg);
1312
1316
  --warning: var(--signal);
1313
1317
  --danger: var(--signal);
1318
+ --attention-warning: #B98200;
1319
+ --attention-error: #C2453D;
1320
+ --attention-ok: #2E7D4F;
1321
+ --attention-info: #2F67B8;
1314
1322
  --shadow: var(--shadow-1);
1315
1323
  --shadow-lg: var(--shadow-2);
1316
1324
  }
@@ -1336,6 +1344,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
1336
1344
  --editor-standout-bg: #24211D; --editor-standout-fg: #FFFFFF;
1337
1345
  --text-primary: var(--fg); --text-secondary: var(--fg-muted); --text-muted: var(--fg-subtle);
1338
1346
  --success: var(--fg); --warning: var(--signal); --danger: var(--signal);
1347
+ --attention-warning: #B98200; --attention-error: #C2453D; --attention-ok: #2E7D4F; --attention-info: #2F67B8;
1339
1348
  --shadow: var(--shadow-1); --shadow-lg: var(--shadow-2);
1340
1349
  }
1341
1350
 
@@ -1352,7 +1361,7 @@ button[data-icon-action="true"]:focus-visible {outline:2px solid var(--signal) !
1352
1361
  button[data-icon-action="true"]:disabled {opacity:.4 !important;cursor:not-allowed;}
1353
1362
  button[data-icon-action="true"][aria-pressed="true"] {color:var(--text-primary, var(--fg)) !important;text-decoration:underline;text-underline-offset:5px;}
1354
1363
  @media (pointer:coarse) {button[data-icon-action="true"] {min-width:44px !important;min-height:44px !important;}}
1355
- `,Ui=`/* Shared containment for creator-authored form rows, including installed pins.
1364
+ `,Ki=`/* Shared containment for creator-authored form rows, including installed pins.
1356
1365
  This is host presentation only; it does not alter a Block's source or inputs. */
1357
1366
  :where(section, div, fieldset, form):has(> label + label) {
1358
1367
  flex-wrap: wrap;
@@ -1383,5 +1392,182 @@ label:has(> textarea) {
1383
1392
  min-block-size: 44px !important;
1384
1393
  block-size: 44px !important;
1385
1394
  }
1386
- `;function Wi(e){let t=e=>Number.isFinite(e)&&e>=0&&e<=1;return!e||typeof e!=`object`||Array.isArray(e)||!t(e.x)||!t(e.y)||e.id!==void 0&&(typeof e.id!=`string`||!e.id.length||e.id.length>160)?null:{x:e.x,y:e.y,...e.id===void 0?{}:{id:e.id}}}function Gi(e,t,n){if(t=Wi(t),!t)return null;let r,i;if(t.id!==void 0){let n=e.getElementById(t.id);if(!n)return null;let a=n.getBoundingClientRect();if(a.width<=0||a.height<=0)return null;r=a.left+a.width*t.x,i=a.top+a.height*t.y;let o=e.elementFromPoint?.(r,i);if(o&&!n.contains(o))return null}else r=t.x*e.documentElement.scrollWidth-n.scrollX,i=t.y*e.documentElement.scrollHeight-n.scrollY;return Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0&&r<=n.width&&i<=n.height?{x:r,y:i}:null}function Ki(e,t,n){let r=null,i=null,a=null,o=!1,s=e=>Math.max(0,Math.min(1,e)),c=[],l=null,u=null,d=null,f=new Map,p=()=>{if(u=null,o||!n)return;!l&&c.length&&(l=document.createElement(`div`),l.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483647;overflow:hidden`,l.setAttribute(`aria-hidden`,`true`),document.body.append(l));let e=new Set(c.map(e=>e.id));for(let[t,n]of f)e.has(t)||(n.remove(),f.delete(t));for(let e of c){let t=f.get(e.id);t||(t=document.createElement(`div`),t.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;color:var(--fg);white-space:nowrap;font:12px var(--font-body,sans-serif)`,typeof matchMedia==`function`&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches&&(t.style.transition=`transform 100ms linear`),l.append(t),f.set(e.id,t)),t.textContent=`↖ `+e.label;let r=n(document,e.anchor,{width:innerWidth,height:innerHeight,scrollX,scrollY});t.hidden=!r,r&&(t.style.transform=`translate(`+r.x+`px,`+r.y+`px)`)}},m=()=>{u===null&&(u=setTimeout(p,50))},h=()=>{if(i=null,!o&&r){if(r.visible&&a){let e=(document.elementFromPoint?.(a.x,a.y)||a.target)?.closest?.(`[id]`),t=e?.id,n=t&&t.length<=160?e.getBoundingClientRect():null;if(n?.width>0&&n?.height>0)r.anchor={id:t,x:s((a.x-n.left)/n.width),y:s((a.y-n.top)/n.height)};else{let e=document.documentElement;r.anchor={x:s((a.x+scrollX)/Math.max(1,e.scrollWidth)),y:s((a.y+scrollY)/Math.max(1,e.scrollHeight))}}}parent.postMessage({channel:e,session:t,op:`cursor`,cursor:r},`*`),r=null}},g=e=>{a={x:e.clientX,y:e.clientY,target:e.target},r={x:s(e.clientX/Math.max(1,innerWidth)),y:s(e.clientY/Math.max(1,innerHeight)),visible:!0},i===null&&(i=setTimeout(h,50))},_=()=>{a=null,r={x:0,y:0,visible:!1},i===null&&(i=setTimeout(h,0))},v=()=>{a&&g({clientX:a.x,clientY:a.y,target:a.target}),m()},y=n=>{let s=n.data;if(!(o||n.source!==parent||s?.channel!==e||s.session!==t)){if(s.op===`peer-cursors`){c=(Array.isArray(s.peers)?s.peers:[]).slice(0,50).filter(e=>e&&typeof e.id==`string`&&e.id.length<=200&&typeof e.label==`string`&&e.label.length<=120).map(e=>({id:e.id,label:e.label,anchor:e.anchor})),m();return}s.op===`dispose`&&(o=!0,clearTimeout(i),clearTimeout(u),d?.disconnect(),r=null,a=null,c=[],f.clear(),l?.remove(),removeEventListener(`pointermove`,g),removeEventListener(`scroll`,v,!0),removeEventListener(`resize`,v),removeEventListener(`blur`,_),removeEventListener(`message`,y),document.documentElement.removeEventListener(`pointerleave`,_))}};addEventListener(`pointermove`,g,{passive:!0}),addEventListener(`scroll`,v,{passive:!0,capture:!0}),addEventListener(`resize`,v,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,_),addEventListener(`blur`,_),addEventListener(`message`,y),typeof MutationObserver==`function`&&(d=new MutationObserver(e=>{c.length&&e.some(e=>!l?.contains(e.target))&&m()}),d.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}function qi(e,t){let n=r=>{let i=r.data;r.source===parent&&i&&i.channel===e&&i.session===t&&(i.op===`theme`&&[`light`,`dark`,`white`].includes(i.mode)&&(document.documentElement.dataset.mode=i.mode),i.op===`dispose`&&removeEventListener(`message`,n))};addEventListener(`message`,n)}function Ji(e,t){let n=parent,r=null,i=0,a=!1,o=()=>{if(r=null,a)return;let o=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height));o!==i&&(i=o,n.postMessage({channel:e,session:t,op:`content-size`,height:o},`*`))},s=()=>{!a&&r===null&&(r=setTimeout(o,100))},c=new ResizeObserver(s);c.observe(document.body);let l=i=>{i.source===n&&i.data?.channel===e&&i.data?.session===t&&i.data?.op===`dispose`&&(a=!0,clearTimeout(r),c.disconnect(),removeEventListener(`message`,l))};addEventListener(`message`,l),s()}gt();function Yi(e){return L(Array.isArray(e)&&e.length>0&&e.length<=128&&e.every(e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e)),`SCHEMA`,`Provide 1–128 exact source digests`),[...new Set(e)]}async function Xi(e){at(e);let t=e?.stages&&e.packages||[];return L(Array.isArray(t)&&t.length<128,`LIMIT`,`Too many packaged Blocks for execution review`),Yi(await Promise.all([e,...t].map(e=>st(e))))}async function Zi(e){let t=await Xi(e),n=new Set(t),r=e?.stages?e.packages||[]:[e],i=e=>{L(e&&typeof e.digest==`string`&&/^[a-f0-9]{64}$/.test(e.digest),`SCHEMA`,`Block lineage needs exact source digests`),n.add(e.digest),L(n.size<=128,`LIMIT`,`Block source and ancestry exceed the security review limit`)};for(let e of r){let t=e.manifest?.provenance;t?.remixedFrom!==void 0&&i(t.remixedFrom);let n=t?.remixAncestors??[];L(Array.isArray(n)&&n.length<=64,`SCHEMA`,`Block ancestry must contain at most 64 exact source references`),n.forEach(i);let r=e.portable?.lineage?.parents??[];L(Array.isArray(r)&&r.length<=16,`SCHEMA`,`Portable lineage must contain at most 16 exact source references`),r.forEach(i)}return Yi([...n])}var Qi=`stillmade.block-security.v1`,$i=new Map;function ea(e,t){let n=e?.revision||0,r=t.revision||0;return{revision:Math.max(n,r),published:t.published||e?.published===!0,revoked:n>r?e.revoked:n===r?t.revoked||e?.revoked===!0:t.revoked}}function ta(){try{let e=JSON.parse(globalThis.localStorage?.getItem(Qi)||`{}`);for(let[t,n]of Object.entries(e))/^[a-f0-9]{64}$/.test(t)&&n&&typeof n.revoked==`boolean`&&typeof n.published==`boolean`&&Number.isInteger(n.revision)&&n.revision>=0&&$i.set(t,ea($i.get(t),n))}catch{}return $i}function na(e){let t=ta();for(let n of e){let e=t.get(n.digest);(n.revoked||n.published||e)&&t.set(n.digest,ea(e,n))}try{globalThis.localStorage?.setItem(Qi,JSON.stringify(Object.fromEntries(t)))}catch{}}var ra=()=>Object.assign(Error(`This exact Block version has been quarantined by StillMade. Use a reviewed replacement.`),{code:`BLOCK_REVOKED`});async function ia(e,{signal:t}={}){let n=await Zi(e),r=ta();if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});let i=new AbortController,a=()=>i.abort();t?.addEventListener(`abort`,a,{once:!0});let o=setTimeout(a,3e3),s;try{let e=await fetch(`/api/blocks/runtime-policy`,{method:`POST`,credentials:`omit`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({digests:n}),signal:i.signal});if(!e.ok)throw Error(`Block security check unavailable`);if(s=await e.json(),!Array.isArray(s.digests)||s.digests.length!==n.length||new Set(s.digests.map(e=>e.digest)).size!==n.length||s.digests.some(e=>!n.includes(e.digest)||typeof e.revoked!=`boolean`||typeof e.published!=`boolean`||!Number.isInteger(e.revision)||e.revision<0))throw Error(`Invalid security response`);na(s.digests)}catch{if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});if(n.some(e=>r.get(e)?.revoked))throw ra();if(n.some(e=>r.get(e)?.published))throw Object.assign(Error(`Reconnect to check the safety of this published Block before running it.`),{code:`REVOCATION_UNAVAILABLE`});return{checked:!1}}finally{clearTimeout(o),t?.removeEventListener(`abort`,a)}if(n.some(e=>ta().get(e)?.revoked))throw ra();return{checked:!0}}var aa=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Y=s(((e,t)=>{t.exports=aa()}))(),oa=`modulepreload`,sa=function(e){return`/`+e},ca={},la=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sa(t,n),t=s(t),t in ca)return;ca[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:oa,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ua=c({loadViewAssets:()=>da});async function da(e,{signal:t}={}){let n={};for(let[r,i]of Object.entries(e?.files||{})){let a=await fetch(`/__dev/files/`+i.sha256,{signal:t});if(!a.ok)throw Error(r+` is missing from the Block folder.`);let o=await hi(e,r,new Uint8Array(await a.arrayBuffer()));n[r]={mediaType:i.mediaType,base64:fa(o)}}return n}var fa,pa=o((()=>{gi(),fa=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}));T(),gt();var ma=`stillmade.block.view.v1`,ha=()=>globalThis.crypto.randomUUID(),ga=`*{box-sizing:border-box}html{container:stillmade-view/inline-size;overflow-wrap:anywhere}body{min-width:0;margin:0;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}h1,h2{font:200 italic clamp(26px,8cqi,32px)/1.1 var(--font-display);letter-spacing:var(--tr-display)}button,input,textarea,select,summary{font:inherit;color:inherit;max-width:100%}button,input,textarea,select{min-height:44px;border:1px solid var(--border-tok);border-radius:var(--r-3);padding:10px 14px;background:transparent}summary{display:flex;align-items:center;min-height:44px;cursor:pointer}button{min-width:44px;cursor:pointer;border-radius:var(--r-pill);background:var(--fg);color:var(--bg)}button:disabled{opacity:.5;cursor:default}textarea{display:block;width:100%;min-height:120px}img,video,canvas{max-width:100%}:focus-visible{outline:2px solid var(--signal);outline-offset:3px}@container stillmade-view (max-width:360px){body{padding:12px}button,input,textarea,select{font-size:16px}}`,_a=`*{box-sizing:border-box}html{overflow-wrap:anywhere}body{min-width:0;margin:0;padding:16px;overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}`,X=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`);function Z(e){if(at(e),new TextEncoder().encode(JSON.stringify(e)).length>_i.messageBytes)throw Error(`Preview data exceeds 4 MiB`);return structuredClone(e)}var va=e=>R(e)&&[`image`,`video`,`audio`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?ot([e.kind,e.assetId,e.versionId,e.url]):``;function ya(e){let t=(0,v.useRef)({has:!1,original:null,signature:null,value:null});if(t.current.has&&Object.is(t.current.original,e))return t.current.value;let n=e===void 0?`undefined`:ot(e);return t.current.signature===n?t.current.original=e:t.current={has:!0,original:e,signature:n,value:e},t.current.value}function ba(e,t=[]){return Array.isArray(e)?(e.forEach(e=>ba(e,t)),t):R(e)?va(e)?(t.push(e),t):(Object.values(e).forEach(e=>ba(e,t)),t):t}var xa=e=>Array.isArray(e)?e.length>0&&e.every(xa):!!va(e);function Sa(e,t,n){if(!R(e)||!Object.values(e).length||!Object.values(e).every(xa))throw Error(`Only complete saved media references can be chosen as outputs.`);let r=new Set(ba(t).map(va));for(let t of ba(e))if(!r.has(va(t))&&!n?.authorizesMedia(t))throw Error(`Choose media supplied by this workspace or recorded in this session.`);return Z(e)}function Ca(e){let t=Z(e);if(!R(t)||!ct(t,`image`))throw Error(`Choose a valid image supplied by this workspace.`);if(t.role!==void 0&&(typeof t.role!=`string`||!/^[a-z][a-z0-9_]{0,79}$/.test(t.role)))throw Error(`This image has an invalid semantic role.`);if(!Array.isArray(t.data)&&!([`assetId`,`versionId`,`url`].every(e=>typeof t[e]==`string`&&t[e].length>0)&&t.assetId.length<=512&&t.versionId.length<=512&&t.url.length<=32768))throw Error(`Keep the complete image reference supplied by this workspace.`);return t}function wa(e){let t=Z(e);if(!(R(t)&&Object.keys(t).length===3&&[`url`,`width`,`height`].every(e=>Object.hasOwn(t,e))&&[`width`,`height`].every(e=>Number.isInteger(t[e])&&t[e]>0&&t[e]<=_i.imagePreviewEdge))||typeof t.url!=`string`||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(t.url))throw Error(`The host returned an invalid image preview.`);let n=t.url.slice(22);if(n.length%4!=0)throw Error(`The host returned an invalid image preview.`);let r=atob(n.slice(0,44)),i=e=>r.charCodeAt(e),a=e=>i(e)*16777216+i(e+1)*65536+i(e+2)*256+i(e+3);if(r.length<33||![137,80,78,71,13,10,26,10].every((e,t)=>i(t)===e)||a(8)!==13||r.slice(12,16)!==`IHDR`||a(16)!==t.width||a(20)!==t.height)throw Error(`The host returned an invalid image preview.`);return t}function Ta(e,t,n=`light`,r=`package`,i=!1,a=[],o=null,s=!1,c=!1,{assets:l={}}={}){Ei(e);let u=Ni(e),d=r===`package`?e.appearance??`host`:r;d!==`original`&&!u&&J(e,{appearance:`host`});let f=(d===`original`?e.css??``:e.themedCss??e.css??``)+`
1387
- `+(u?``:Ui),p=globalThis.crypto.randomUUID().replaceAll(`-`,``),m=`__sm_view_${p}`,h=`__sm_guard_${globalThis.crypto.randomUUID().replaceAll(`-`,``)}`,g=`(()=>{"use strict";document.currentScript.remove();const session=${X(t)},channel=${X(ma)},send=parent.postMessage.bind(parent);let input={},ready=false,inputRevision=0,editRevision=0,sequence=0,pending=null,pendingAdopt=null,adoptSequence=0,pendingImage=null,imageSequence=0,pendingDesktop=null,desktopSequence=0;const mediaURLs=new Set();const clearMedia=()=>{for(const url of mediaURLs)URL.revokeObjectURL(url);mediaURLs.clear()};const listeners=new Set();let calls=0,started=0;const now=performance.now.bind(performance),resetTask=setTimeout.bind(globalThis);${u?`for(const meta of document.querySelectorAll("meta[http-equiv]"))meta.remove();const frameRuntime=(${Li.toString()})(channel,session,send,${X({guardName:h,taskMs:Oi.taskMs,assets:l})});`:`Object.defineProperty(globalThis,${X(m)},{configurable:true,value:()=>{if(calls===0){started=now();resetTask(()=>{calls=0},0)}if(++calls>10000||now()-started>50)throw Error("Interface is doing too much work. Move processing into the Block runtime.")}});addEventListener("message",event=>{if(event.isTrusted&&event.source===parent)calls=0},true);`}let controlEffects=0;let assisted=false,trackedCalls=new Set(),trackedFailure=null,controlOffset=0;const track=promise=>{if(assisted){trackedCalls.add(promise);promise.then(()=>trackedCalls.delete(promise),error=>{trackedFailure=error;trackedCalls.delete(promise)})}return promise};const controlSnapshot=(offset=controlOffset,automatic=true)=>{try{let snapshot;try{snapshot=dynamicUI.inspectControls({offset})}catch(error){if(!automatic||error.message!=="Choose a current control page"||!Number.isSafeInteger(offset)||offset<0)throw error;snapshot=dynamicUI.inspectControls({offset:0});}controlOffset=snapshot.offset;send({channel,session,op:"view-controls",snapshot},"*")}catch(error){send({channel,session,op:"view-controls-error",error:String(error.message).slice(0,1000)},"*")}};const dynamicUI=(${Bt.toString()})(document,error=>send({channel,session,op:"interface-error",error},"*"),()=>Promise.resolve().then(controlSnapshot));const sharedLifecycle={};const sharedAPI=(${zt.toString()})(channel,session,${X(Lt)},sharedLifecycle);const textControls=${i?`(()=>{${kt};return StillMadeTextFrame.installTextFrame(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),channel,session,{token:${X(o)},send});})()`:`null`};const sharedControls=(${Ot.toString()})(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),textControls,${X(a)});const {documentTools,sharedDocuments}=(${At})(sharedAPI,status=>send({channel,session,op:"document-store-status",status},"*"));const previews=(${bt.toString()})((kind,value)=>{if(kind==="media"){if(mediaURLs.size>=2)throw Error("Release a previous media preview before opening another");if(!["video","audio"].includes(value.kind))throw Error("Choose an audio or video reference");}return new Promise((resolve,reject)=>{const id=String(++imageSequence);pendingImage={id,resolve,reject,media:kind==="media"};send({channel,session,op:kind==="media"?"preview-media":"preview-image",id,value},"*")})});const connectionAPI=(${yt.toString()})(${X(ma)},${X(t)},${c},send),workAPI=(${ee.toString()})(${X(ma)},${X(t)},${s},send);const api=Object.freeze({...connectionAPI,...workAPI,${u?`asset:frameRuntime.asset,assetBytes:frameRuntime.assetBytes,`:``}connectedApp(...args){controlEffects++;return track(connectionAPI.connectedApp(...args))},sharedWork(...args){controlEffects++;return track(workAPI.sharedWork(...args))},previewSharedWorkMedia(...args){controlEffects++;return track(workAPI.previewSharedWorkMedia(...args))},schemaFields:(${Vt.toString()})(${JSON.stringify(a)}),...sharedAPI,...documentTools,connectDocument:sharedDocuments.connectDocument,bindShared:sharedControls.bindShared,setSharedDefaults:sharedControls.setSharedDefaults,scheduleSharedEdit:sharedControls.scheduleSharedEdit,render:dynamicUI.render,onAction:dynamicUI.onAction,releaseMedia(url){if(mediaURLs.delete(url))URL.revokeObjectURL(url)},previewMedia(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("media",value))},desktop(operation,args={}){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingDesktop)return Promise.reject(Error("A desktop request is already pending"));if(typeof operation!=="string"||JSON.stringify(args).length>131072)return Promise.reject(Error("Invalid desktop request"));return track(new Promise((resolve,reject)=>{const id=String(++desktopSequence);pendingDesktop={id,resolve,reject};send({channel,session,op:"desktop",id,operation,args},"*")}))},get input(){return structuredClone(input)},onInput(fn){if(typeof fn!=="function")throw Error("Expected a function");listeners.add(fn);if(ready)fn(structuredClone(input));return()=>listeners.delete(fn)},useOutput(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingAdopt)return Promise.reject(Error("An output choice is already pending"));let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded output values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++adoptSequence);pendingAdopt={id,resolve,reject};send({channel,session,op:"use-output",id,outputs:values},"*")}))},previewImage(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("image",value))},run(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pending)return Promise.reject(Error("A run is already in progress"));try{dynamicUI.assertCommitted();sharedControls.assertNoComposition();}catch(error){return Promise.reject(error);}let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded input values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++sequence),requested=JSON.parse(serialized),sourceRevision=inputRevision,localRevision=editRevision,call={id,resolve,reject,sent:false};pending=call;Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>{dynamicUI.assertCommitted();sharedControls.assertNoComposition();if(pending!==call||!ready)throw Error("Preview was closed before its edits were saved.");if(inputRevision!==sourceRevision||editRevision!==localRevision)throw Error("The input changed while edits were saving. Review it before running again.");const savedText=textControls?.getValues?.()||{};for(const [key,value] of Object.entries(savedText)){const captured=typeof requested[key]==="string"?requested[key]:typeof requested[key]?.text==="string"?requested[key].text:null;if(captured!==null&&captured!==value)throw Error("The input changed while shared text was saving. Review it before running again.");}if(!sharedAPI.getShared().canEdit)throw Error("Shared editing is unavailable or read only.");call.sent=true;send({channel,session,op:"run",id,input:requested},"*");}).catch(error=>{if(pending===call){pending=null;call.reject(error);}});}))}});Object.defineProperty(globalThis,"StillMade",{value:api,writable:false,configurable:false});addEventListener("message",event=>{if(event.source!==parent||!event.data||event.data.channel!==channel||event.data.session!==session)return;const data=event.data;if(data.op==="inspect-view-controls"){controlSnapshot(data.offset,false);return;}if(data.op==="dispatch-named-text"&&typeof data.id==="string"){Promise.resolve().then(()=>textControls.dispatchNative(data.control,data.id)).then(()=>send({channel,session,op:"named-text-result",token:${X(o)},id:data.id},"*"),error=>send({channel,session,op:"named-text-result",token:${X(o)},id:data.id,error:String(error.message).slice(0,1000)},"*")).finally(()=>send({channel,session,op:"named-text-controls",token:${X(o)},snapshot:textControls.inspectNative()},"*"));return;}if(data.op==="inspect-named-text"){if(textControls)send({channel,session,op:"named-text-controls",token:${X(o)},snapshot:textControls.inspectNative()},"*");return;}if(data.op==="dispatch-view-control"&&typeof data.id==="string"){if(assisted){send({channel,session,op:"view-control-result",id:data.id,error:"A declared control is already running"},"*");return;}assisted=true;trackedFailure=null;const controlDocumentSeal=sharedDocuments.captureControlSettlement(),controlSharedSeal=sharedLifecycle.captureControlState(),controlInputRevision=inputRevision,controlEffectRevision=controlEffects;const personalControlUnchanged=()=>controlDocumentSeal&&inputRevision===controlInputRevision&&controlEffects===controlEffectRevision&&JSON.stringify(sharedLifecycle.captureControlState())===JSON.stringify(controlSharedSeal)&&!controlSharedSeal.closed&&controlSharedSeal.ready&&!controlSharedSeal.pending&&!controlSharedSeal.queued&&!controlSharedSeal.failed&&sharedDocuments.unchangedControlSettlement(controlDocumentSeal);dynamicUI.dispatchControl(data.control,async()=>{for(let round=0;round<16;round++){await Promise.allSettled(Array.from(trackedCalls));await dynamicUI.flushAll();await sharedControls.flushAll();if(personalControlUnchanged())await sharedDocuments.settleControl(controlDocumentSeal);else await sharedDocuments.flushAll();await sharedLifecycle.flushSharedWrites();await new Promise(resolve=>setTimeout(resolve,0));if(trackedFailure)throw trackedFailure;if(!trackedCalls.size){if(controlDocumentSeal&&!personalControlUnchanged())await sharedDocuments.flushAll();dynamicUI.assertCommitted();sharedControls.assertNoComposition();return;}}throw Error("Declared action did not settle");}).then(()=>send({channel,session,op:"view-control-result",id:data.id},"*"),error=>send({channel,session,op:"view-control-result",id:data.id,error:String(error?.message||"Declared action failed").slice(0,1000)},"*")).finally(()=>{assisted=false;controlSnapshot()});return;}if(data.op==="flush-shared"&&typeof data.id==="string"){Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>dynamicUI.flushAll()).then(()=>sharedControls.assertNoComposition()).then(()=>send({channel,session,op:"flush-shared-result",id:data.id},"*"),error=>send({channel,session,op:"flush-shared-result",id:data.id,error:String(error?.message||"Pending edits could not be confirmed").slice(0,1000)},"*"));return;}if(data.op==="desktop-result"&&pendingDesktop&&data.id===pendingDesktop.id){const call=pendingDesktop;pendingDesktop=null;data.error?call.reject(Error(data.error)):call.resolve(data.result)}else if(data.op==="use-output-result"&&pendingAdopt&&data.id===pendingAdopt.id){const call=pendingAdopt;pendingAdopt=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="input"){inputRevision+=1;if(pending&&!pending.sent){pending.reject(Error("Preview input changed before its edits were saved."));pending=null;}clearMedia();previews.reset();if(pendingImage)pendingImage.reject(Error("Preview input changed"));pendingImage=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview input changed"));pendingAdopt=null;input=data.input;ready=true;for(const fn of listeners)try{fn(structuredClone(input))}catch(error){send({channel,session,op:"interface-error",error:String(error?.message||"The Block interface could not display its input").slice(0,1000)},"*")}}else if(data.op==="result"&&pending?.sent&&data.id===pending.id){const call=pending;pending=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="preview-media-result"&&pendingImage?.media&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;if(data.error)call.reject(Error(data.error));else{try{const url=URL.createObjectURL(data.preview.blob);mediaURLs.add(url);call.resolve({kind:data.preview.kind,url,mimeType:data.preview.blob.type,bytes:data.preview.blob.size})}catch(error){call.reject(error)}}}else if(data.op==="preview-image-result"&&pendingImage&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;data.error?call.reject(Error(data.error)):call.resolve(data.preview)}else if(data.op==="dispose"){clearMedia();previews.reset("Preview was reset");dynamicUI.dispose();sharedControls.dispose();textControls?.dispose();sharedDocuments.dispose();if(pendingDesktop)pendingDesktop.reject(Error("Block was closed"));pendingDesktop=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview was reset"));pendingAdopt=null;if(pendingImage)pendingImage.reject(Error("Preview was reset"));pendingImage=null;if(pending)pending.reject(Error("Preview was reset"));pending=null;listeners.clear();ready=false}});addEventListener("input",()=>{editRevision+=1;},true);addEventListener("change",()=>{editRevision+=1;},true);addEventListener("compositionstart",()=>{editRevision+=1;},true);addEventListener("keydown",event=>{if(event.key==="Escape")send({channel,session,op:"escape"},"*")},true);addEventListener("click",event=>{if(event.target.closest?.("a,area"))event.preventDefault()},true);send({channel,session,op:"ready"},"*");})();`,_=u?`document.currentScript.remove();for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${Ii(e.javascript||``,h)}`.replace(/<\/script/gi,`<\\/script`):`document.currentScript.remove();((${m})=>{"use strict";delete globalThis[${X(m)}];for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${Di(e.javascript||``,m)}\n})(globalThis[${X(m)}]);`.replace(/<\/script/gi,`<\\/script`);return`<!doctype html><html data-mode="${[`dark`,`white`].includes(n)?n:`light`}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${p}'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:;${u?` font-src data: blob:;`:``} connect-src 'none'; frame-src 'none'; worker-src ${u?`blob:`:`'none'`}; object-src 'none'; base-uri 'none'; form-action 'none';"><meta name="referrer" content="no-referrer"><style>${Hi.replace(/@font-face\s*\{[^}]*\}/g,``)}${u?_a:ga}${(f||``).replace(/<\/style/gi,`<\\/style`)}@media(pointer:coarse){input,textarea,select{font-size:16px!important}}</style></head><body>${e.html}<script nonce="${p}">${g.replace(/<\/script/gi,`<\\/script`)}<\/script><script nonce="${p}">document.currentScript.remove();(${qi.toString()})(${X(ma)},${X(t)});(${Ji.toString()})(${X(ma)},${X(t)});(${Ki.toString()})(${X(ma)},${X(t)},((validateCursorAnchor)=>(${Gi.toString()}))(${Wi.toString()}));<\/script><script nonce="${p}">${_}<\/script></body></html>`}function Ea({view:e,input:t={},sharedView:n=null,presenceKey:r=null,peers:i=[],actorId:a=null,onSharedChange:o,sharedText:s=null,sharedWork:c=null,connectedApp:l=null,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m,policyContent:h,policyParent:g,currentAppViewPolicy:_=null,title:y=`Block preview`,height:b=480,fitContent:ee=!1,resetKey:w=0,theme:T,appearance:E=`package`,lockedInputKeys:D=[],agentContext:O=null}){let k=ya(e),A=ya(h),j=ya(g),te=[`comfyui`,`capability`].includes(A?.manifest?.runtime)||!!A?.manifest?.desktopTools?.length,M=A?.capability?.operation===`image.generate`?9e5:36e4,N=(0,v.useRef)(null),ne=(0,v.useRef)({onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m}),re=(0,v.useRef)(t),[ie,P]=(0,v.useState)(``),[ae,oe]=(0,v.useState)(0),se=(0,v.useRef)(null),ce=(0,v.useRef)(null),[le,ue]=(0,v.useState)(null),[de,fe]=(0,v.useState)(null),[pe,me]=(0,v.useState)(null),[he,ge]=(0,v.useState)(null),[_e,ve]=(0,v.useState)(()=>globalThis.document?.documentElement?.dataset.mode||`light`),ye=(0,v.useRef)(`light`);ye.current=[`dark`,`white`].includes(T||_e)?T||_e:`light`;let be=(0,v.useRef)(l);be.current=l;let xe=(0,v.useRef)(c);xe.current=c;let Se=(0,v.useRef)(s);Se.current=s;let Ce=(0,v.useRef)(!1),[we,Te]=(0,v.useState)(()=>({enabled:!!s,projectId:s?.projectId??null,placementId:s?.placementId??null})),Ee=()=>{let e={enabled:!!Se.current,projectId:Se.current?.projectId??null,placementId:Se.current?.placementId??null};Te(t=>t.enabled===e.enabled&&t.projectId===e.projectId&&t.placementId===e.placementId?t:e)};(0,v.useEffect)(()=>{Ce.current||Ee()},[!!s,s?.projectId,s?.placementId]);let De=we.enabled,Oe=we.projectId,ke=we.placementId,Ae=!!he?.count&&!!(he.dirty||he.pending||he.error);(0,v.useEffect)(()=>{let e=globalThis.document.documentElement,t=new MutationObserver(()=>ve(e.dataset.mode||`light`));return t.observe(e,{attributes:!0,attributeFilter:[`data-mode`]}),()=>t.disconnect()},[]);let je=(0,v.useMemo)(()=>{try{let e=Z(t);return{value:e,signature:ot(e)}}catch(e){return{error:e.message}}},[t]);ne.current={onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m},re.current=je;let[Me,Ne]=(0,v.useState)(null),Pe=_?Me?.handle===_&&Me.allowed:!A||Me?.content===A&&Me.parent===j&&Me.allowed;(0,v.useEffect)(()=>{if(!A&&!_)return;let e=!0,t=new AbortController;return Ne(null),(_?S(_,{signal:t.signal}):Promise.all([A,...j?[j]:[]].map(e=>ia(e,{signal:t.signal})))).then(()=>{e&&Ne({handle:_,content:A,parent:j,allowed:!0})},t=>{e&&(Ne({handle:_,content:A,parent:j,allowed:!1,error:t.message}),ne.current.onError?.(t))}),()=>{e=!1,t.abort()}},[A,j,_,ae]);let Fe=Ni(k)&&k.files?k.files:null,[Ie,Le]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!Fe||!Pe){Le(null);return}let e=!0,t=new AbortController;return Le(null),Promise.resolve().then(()=>(Ei(k),la(()=>Promise.resolve().then(()=>(pa(),ua)),void 0))).then(({loadViewAssets:e})=>e(Fe,{signal:t.signal})).then(t=>{e&&Le({files:Fe,assets:t})},t=>{e&&Le({files:Fe,error:String(t?.message||`The interface files could not be loaded.`)})}),()=>{e=!1,t.abort()}},[k,Fe,Pe]);let Re=Fe?Ie?.files===Fe?Ie:{loading:!0}:null,ze=JSON.stringify([...new Set(D.filter(e=>typeof e==`string`))].sort()),Be=[k,Re,w,E,ae,a,r,te,M,ee,De,Oe,ke,ze,!!A?.manifest?.sharedWork,A?.capability?.operation],Ve=(0,v.useRef)(null);if(!Ve.current||Be.some((e,t)=>!Object.is(e,Ve.current.inputs[t]))){let e;try{if(Re?.loading)throw Object.assign(Error(`Loading the interface files.`),{loading:!0});if(Re?.error)throw Error(Re.error);let t=ha(),n=ha();e={session:t,nativeTextToken:n,html:Ta(k,t,ye.current,E,De,JSON.parse(ze),n,!!A?.manifest?.sharedWork,A?.capability?.operation===`connection.execute`,{assets:Re?.assets||{}})}}catch(t){e=t.loading?{loading:!0}:{error:t.message}}Ve.current={inputs:Be,document:e}}let F=Ve.current.document,He=(0,v.useMemo)(()=>({state:{},outputs:{},memory:null,canEdit:!0,localOnly:!0}),[F.session]),I=(0,v.useRef)(n);I.current=n??He;let Ue=(0,v.useRef)(n==null);Ue.current=n==null;let We=(0,v.useRef)({session:null,count:0}),Ge=(0,v.useRef)(null),Ke=(0,v.useRef)(null),qe=(0,v.useRef)(null),Je=(0,v.useRef)(null),Ye=(0,v.useRef)(null);Je.current={key:r,peers:i,actorId:a};let Xe=(0,v.useRef)(null),Ze=(0,v.useRef)(null);Ze.current={input:je.signature,error:je.error,view:k,policyContent:A,policyParent:j,resetKey:w,appearance:E,policyReady:Pe};let Qe=(0,v.useRef)(null);Qe.current=ot([O?.projectId,O?.placementId,O?.sourceDigest,a].map(e=>e??null));let[$e,et]=(0,v.useState)(null),tt=ot([xt(),a,Qe.current,F.session??null,je.signature,Pe]);(0,v.useEffect)(()=>{let e=!0;if(et(null),!O?.projectId||!O?.placementId||!O?.sourceDigest||je.error||!Pe||a!==xt())return()=>{e=!1};let t=tt;return st(je.value).then(n=>{e&&et({basis:t,value:{version:1,actorId:a,projectId:O.projectId,placementId:O.placementId,sourceDigest:O.sourceDigest,inputDigest:n}})},()=>{e&&et(null)}),()=>{e=!1}},[tt]),$e?.basis===tt&&$e.value;let[nt,rt]=(0,v.useState)(null),it=(0,v.useRef)(null),L=(0,v.useRef)(null),[at,ct]=(0,v.useState)(null),[lt,ut]=(0,v.useState)(!1),[dt,ft]=(0,v.useState)(!1),[pt,mt]=(0,v.useState)(null);return pt&&pt.actor===a&&pt.runtimeActor===xt()&&pt.identity===Qe.current&&pt.session===F.session&&Object.keys(pt.authority).every(e=>pt.authority[e]===Ze.current[e])&&pt.evidence,{...O},A?.manifest?.id,A?.manifest?.version,F.session,je.signature,I.current?.canEdit,{...O},F.session,je.signature,I.current?.canEdit,(0,v.useEffect)(()=>{if(rt(null),ct(null),ft(!1),ut(!1),mt(null),P(``),fe(null),me(null),ge(null),F.error||F.loading||!Pe)return;let e=!0,t=!1,n=!1,i=null,o=null,s=null,c=0,l=0,u=[],d=[],f=0,p=0,m,h=0,g=null,_=[],v=0,y=null,b=0,x=0,S=null,w=Ni(k),T=()=>{let t;return t=Ut(A,{onStatus:n=>{e&&m===t&&ue(n)},storageScope:`${a||`anonymous`}:${r||`preview`}`}),t};m=T(),se.current=m,ue(null);let E=()=>{if(!e||!I.current?.canEdit)return;let t=m;m=T(),se.current=m,g=null,ue(null),Promise.resolve(t.close()).catch(()=>{})};ce.current=E;let D=t=>{e&&N.current?.contentWindow?.postMessage({channel:ma,session:F.session,...t},`*`)},O=null,j=null,ie=0,ae=!1,oe=a,le=Ze.current,de=Qe.current,pe=(t,n)=>{if(!e||ae||t?.signal?.aborted||xt()!==oe||Qe.current!==de||j&&re.current.signature!==j.inputIdentity||O&&re.current.signature!==O.inputIdentity&&re.current.signature!==n||Object.keys(le).filter(e=>e!==`input`).some(e=>le[e]!==Ze.current[e]))throw ae=!0,ft(!1),Error(`The declared interface source, account or task changed. Reload the preview before further assisted edits.`)},he=e=>{if(!O)return;let t=O;O=null,clearTimeout(t.timer),t.context?.signal?.removeEventListener(`abort`,t.abort),ut(!1),t.reject(e)};L.current={request:(e,n,r={})=>new Promise((a,o)=>{try{if(pe(r),!t||O)throw Error(`The declared interface is loading or busy.`);if(e===`dispatch-view-control`&&!r.taskFence)throw Error(`The declared interface requires its active project task.`);let s=String(++ie),c=()=>{ae=!0,ft(!1),i?.abort(),he(Error(`Declared action stopped; reload the preview before more assisted edits.`))},l=setTimeout(c,M);O={id:s,op:e,inputIdentity:re.current.signature,offset:n.offset,context:r,resolve:a,reject:o,timer:l,abort:c},r.signal?.addEventListener(`abort`,c,{once:!0}),e===`dispatch-view-control`&&ut(!0),D({op:e,id:s,...n})}catch(e){o(e)}})},it.current={request:(e,n)=>new Promise((r,i)=>{try{if(pe(n),!t||O||j||!n.taskFence||n.signal?.aborted)throw Error(`The original text requires its idle current task.`);let a=String(++ie),o=()=>{ae=!0,ft(!1),j?.id===a&&(j=null,ut(!1),i(Error(`Original text stopped; retain its pending request.`)))},s=setTimeout(o,M);j={id:a,field:e.field,inputIdentity:re.current.signature,context:n,resolve:r,reject:i,timer:s,abort:o},n.signal?.addEventListener(`abort`,o,{once:!0}),ut(!0),D({op:`dispatch-named-text`,id:a,control:e})}catch(e){i(e)}})};let _e=()=>{if(ae)throw Error(`This previous assisted interface is no longer writable. Reload it to recover.`);return O?.op===`dispatch-view-control`?(pe(O.context),O.context):null},ve=!1,we=0,Te=[],Ae=0,je=!1,Me=0,Ne=[],Fe=0,Ie=0,Le=[],Re=null,ze=!1,Be={projectId:Oe,placementId:ke,actorId:a},Ve=()=>e&&Se.current?.projectId===Be.projectId&&Se.current?.placementId===Be.placementId,He=e=>({message:String(e?.message||`Shared text failed.`).slice(0,1e3),...typeof e?.code==`string`&&/^[A-Z][A-Z0-9_]{0,79}$/.test(e.code)?{code:e.code}:{}}),We=Se.current?.projectId&&a?jt({projectId:Se.current.projectId,actorId:a,headers:Mt,onChange:e=>{if(Ve()){if(e.kind===`revoked`){ze=!0,D({op:`shared-view`,value:{...I.current,canEdit:!1}});return}[`text`,`document`,`resync`].includes(e.kind)&&(e.scope&&e.scope!==`canvas`||Re===null&&(Re=setTimeout(()=>{Re=null,t&&Ve()&&!ze&&D({op:`text-refresh`})},100)))}}}):null,$e=xe.current?.projectId&&a?jt({projectId:xe.current.projectId,actorId:a,headers:Mt,onChange:e=>{t&&[`document`,`resync`,`revoked`,`connection-access`].includes(e.kind)&&(Ae++,D({op:`shared-work-refresh`}))}}):null,et=()=>{t&&D({op:`theme`,mode:ye.current})};Ye.current=et;let tt=`[]`,nt=()=>{if(!t)return;let{key:e,peers:n,actorId:r}=Je.current,i=!Ue.current&&e&&localStorage.getItem(`stillmade:show-shared-cursors`)!==`false`?n.filter(t=>t.user_id!==r&&t.selection?.cursor?.visible&&t.selection.cursor.surface===e).slice(0,50).flatMap(e=>{let t=Wi(e.selection.cursor.anchor);return t?[{id:String(e.session_id).slice(0,200),label:String(e.label||`Teammate`).slice(0,120),anchor:t}]:[]}):[],a=JSON.stringify(i);a!==tt&&(tt=a,D({op:`peer-cursors`,peers:i}))};qe.current=nt,window.addEventListener(`stillmade:cursor-preferences`,nt),window.addEventListener(`storage`,nt);let at=e=>{P(e),ne.current.onError?.(Error(e))},st=()=>{e&&(clearInterval(y),S?.disconnect(),at(`This interface stopped responding and was closed. Reload it to try again.`),e=!1,i?.abort(),N.current&&(N.current.src=`about:blank`))};Ge.current=w?()=>{e&&(clearInterval(y),at(`This interface tried to leave its frame and was closed. Reload it to try again.`),e=!1,i?.abort(),N.current&&(N.current.src=`about:blank`))}:null;let lt=()=>{if(typeof PerformanceObserver!=`function`||!PerformanceObserver.supportedEntryTypes?.includes(`longtask`))return;let e=[],t=e=>Array.from(e.attribution||[]).some(e=>e.containerType===`iframe`&&typeof e.containerSrc==`string`&&e.containerSrc.endsWith(`#${F.session}`));S=new PerformanceObserver(n=>{for(let r of n.getEntries()){if(!t(r))continue;let n=r.startTime+r.duration;if(e=e.filter(e=>e.end>n-5e3),e.push({end:n,duration:r.duration}),r.duration>=Oi.longTaskMs||e.reduce((e,t)=>e+t.duration,0)>=3500)return st()}});try{S.observe({type:`longtask`})}catch{S=null}},dt=()=>{b=Date.now(),y=setInterval(()=>{if(!e)return clearInterval(y);if(globalThis.document.visibilityState!==`hidden`&&Date.now()-b>8e3)return st();D({op:`ping`,id:String(++x)})},2e3)},pt=setTimeout(()=>{e&&!t&&(at(`The preview could not start. Reload it to try again.`),e=!1,i?.abort(),N.current&&(N.current.src=`about:blank`))},15e3),ht=e=>{let t=o;t&&(mt(null),o=null,t.controller.abort(),e&&D({op:t.media?`preview-media-result`:`preview-image-result`,id:t.id,error:e}))},gt=()=>{if(!t)return;let e=re.current;if(e.error){ht(`Preview input is unavailable.`),at(e.error);return}s!==e.signature&&(ht(`Preview input changed. Use its current image.`),s=e.signature,D({op:`input`,input:e.value}))};Xe.current=gt;let _t=null,yt=!1,bt=0,St=[],Ct=null,Tt=0,Et=null,Ot=Dt(()=>{if(Ue.current||!t)return Promise.resolve();if(!e)return Promise.reject(Error(`The Block interface is unavailable. Its latest edits could not be checked.`));if(Ct)return Ct.promise;let n=String(++Tt),r,i,a=new Promise((e,t)=>{r=e,i=t}),o=setTimeout(()=>{Ct?.id===n&&(Ct=null,i(Error(`The Block did not confirm its pending edits. Stay here to recover the draft.`)))},17e3);return Ct={id:n,promise:a,resolve:r,reject:i,timer:o},D({op:`flush-shared`,id:n}),a}),kt=()=>{if(t&&I.current)try{let e=Z(I.current),t=ot(e);if(t===_t)return;_t=t,D({op:`shared-view`,value:e})}catch(e){at(e.message)}};Ke.current=kt;let At=t=>{e&&Ue.current&&(I.current.outputs=t,kt())},Nt=r=>{let s=r.data;if(w&&e&&R(s)&&s.op===`navigated`&&s.channel===ma&&s.session===F.session&&(r.source===null||r.source===N.current?.contentWindow)){Ge.current?.();return}if(!e||r.source!==N.current?.contentWindow||!R(s)||s.channel!==ma||s.session!==F.session)return;if(s.op===`document-ready`){n||(n=!0,D({op:`document`,html:F.html}));return}if(s.op===`ready`){t||(t=!0,clearTimeout(pt),w&&(dt(),lt()),et(),gt(),kt(),nt(),D({op:`inspect-view-controls`,offset:0}),D({op:`inspect-named-text`}));return}if(s.op===`flush-shared-result`){if(!Ct||s.id!==Ct.id)return;let e=Ct;Ct=null,clearTimeout(e.timer);let t=s.error||Et;t?e.reject(Error(String(t).slice(0,1e3))):e.resolve({queued:!0});return}if(s.op===`escape`){let e=Date.now();globalThis.document.activeElement===N.current&&e-v>=300&&(v=e,window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0})));return}if(s.op===`pong`){w&&typeof s.id==`string`&&(b=Date.now());return}if(s.op===`unresponsive`){w&&st();return}if(s.op===`interface-error`){at(String(s.error||`The Block interface could not display its input`).slice(0,1e3));return}if(s.op===`document-store-status`){let e=s.status;R(e)&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=8)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&me(e);return}if(s.op===`text-recovery-status`){let e=s.status;De&&R(e)&&Object.keys(e).every(e=>[`count`,`dirty`,`pending`,`readonly`,`error`,`retryable`].includes(e))&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=100)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&typeof e.retryable==`boolean`&&ge(e);return}if(!t)return;if(s.op===`named-text-controls`){if(s.token===F.nativeTextToken&&Array.isArray(s.snapshot)&&s.snapshot.length<=50){let e=Z(s.snapshot);e.every(e=>R(e)&&typeof e.field==`string`&&typeof e.identity==`string`&&typeof e.value==`string`&&e.value.length<=1e4&&typeof e.partial==`boolean`&&typeof e.ready==`boolean`&&typeof e.disabled==`boolean`)&&rt(e)}return}if(s.op===`named-text-result`){let e=j;if(!e||s.id!==e.id||s.token!==F.nativeTextToken)return;try{if(pe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));e.resolve()}catch(t){e.reject(t)}finally{j=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ut(!1)}return}if(s.op===`view-controls`){try{let e=Z(s.snapshot);if(!R(e)||!Number.isSafeInteger(e.revision)||!Number.isSafeInteger(e.total)||e.total<0||e.total>1e4||!Number.isSafeInteger(e.offset)||!Array.isArray(e.controls)||e.controls.length>20||e.controls.some(e=>!R(e)||typeof e.id!=`string`||typeof e.identity!=`string`||typeof e.action!=`string`||typeof e.disabled!=`boolean`||typeof e.hidden!=`boolean`))throw Error(`Invalid declared interface controls.`);if(ct(e),ft(!ae),O?.op===`inspect-view-controls`&&e.offset===O.offset){let e=O;pe(e.context),O=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),e.resolve()}}catch(e){he(e)}return}if(s.op===`view-controls-error`){he(Error(String(s.error||`Declared controls are unavailable.`).slice(0,1e3)));return}if(s.op===`view-control-result`){if(O?.op!==`dispatch-view-control`||s.id!==O.id)return;let e=O;try{if(pe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));O=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ut(!1),e.resolve()}catch(e){he(e)}return}if(s.op===`connected-app-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=we)return;we=Number(s.id);let t=e=>D({op:`connected-app-result`,id:s.id,...e}),n=be.current,r=Ze.current;Te=Te.filter(e=>Date.now()-e<6e4);try{if(A?.capability?.operation!==`connection.execute`||!n?.request)throw Error(`Open the saved connected Block to choose its task.`);let i=vt(s.operation,Z(s.args));if(i.operation!==`tasks`&&!I.current?.canEdit)throw Error(`This workspace is read only.`);if(ve||Te.length>=30)throw Error(`Wait for the current task request.`);ve=!0,Te.push(Date.now()),Promise.resolve().then(()=>n.request(i.operation,i.args)).then(i=>{if(!e||n.projectId!==be.current?.projectId||n.placementId!==be.current?.placementId||Object.keys(r).some(e=>r[e]!==Ze.current[e]))throw Error(`The installed app changed. Open its current workspace.`);t({result:Z(i)})},e=>t({error:String(e.message||`Task selection failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{ve=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-media-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Me)return;Me=Number(s.id);let t=xe.current,n=Ze.current,r=Ae,i=e=>D({op:`shared-work-result`,id:s.id,...e});try{if(!A?.manifest?.sharedWork||!A.manifest.permissions?.project?.includes(`work.shared`)||!t?.previewMedia||typeof s.contributionId!=`string`||!/^[0-9a-f-]{36}$/i.test(s.contributionId))throw Error(`Choose a permitted saved creative in this workspace.`);if(Ne=Ne.filter(e=>Date.now()-e<6e4),je||Ne.length>=60)throw Error(`Wait for the current media preview.`);je=!0,Ne.push(Date.now()),Promise.resolve().then(()=>t.previewMedia(s.contributionId,{signal:AbortSignal.timeout(3e4)})).then(t=>{if(!e||r!==Ae||Object.keys(n).some(e=>n[e]!==Ze.current[e]))throw Error(`This workspace changed before the creative preview.`);if(!(t.media instanceof Blob)||!t.media.size||t.media.size>67108864||![`image`,`video`,`audio`].includes(t.kind)||!t.media.type.startsWith(t.kind+`/`))throw Error(`This preview exceeds the media limit.`);i(t)},e=>i({error:String(e.message||`Media preview failed.`).slice(0,1e3)})).catch(e=>i({error:String(e.message).slice(0,1e3)})).finally(()=>{je=!1})}catch(e){i({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Me)return;Me=Number(s.id);let t=e=>D({op:`shared-work-result`,id:s.id,...e}),n=xe.current,r=Ze.current,i=Ae;Ne=Ne.filter(e=>Date.now()-e<6e4);try{if(!A?.manifest?.permissions?.project?.includes(`work.shared`)||!A.manifest.sharedWork||!n?.request)throw Error(`Shared work is unavailable in this preview. Open the saved Block in its project.`);let a=C(s.operation,Z(s.args));if(![`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation)&&!I.current?.canEdit)throw Error(`This workspace is read only.`);if(je||Ne.length>=60)throw Error(`Wait for the current shared-work request.`);je=!0,Ne.push(Date.now()),Promise.resolve().then(()=>n.request(a.operation,a.args)).then(o=>{if(!e||n.projectId!==xe.current?.projectId||n.placementId!==xe.current?.placementId||Object.keys(r).some(e=>r[e]!==Ze.current[e]))throw Error(`This Block changed before the shared-work response. Reopen its current version.`);if(i!==Ae){if([`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation))throw Error(`Saved-work access changed. Read its current version.`);t({result:{saved:!0,refreshRequired:!0}});return}t({result:Z(o)})},e=>t({error:String(e.message||`Shared work failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{je=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`text-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Ie)return;Ie=Number(s.id);let e=e=>D({op:`text-result`,id:s.id,...e}),t=Se.current,n=re.current.signature,r=Ze.current;if(Le=Le.filter(e=>Date.now()-e<6e4),!De||!Ve()||!t||typeof t.request!=`function`||![`read`,`initialize`,`update`,`reset`].includes(s.action)||typeof s.key!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(s.key)||[`constructor`,`prototype`,`__proto__`].includes(s.key)){e({error:{message:`Shared text is unavailable for this field.`}});return}if(Fe>=16||Le.length>=1200){e({error:{message:`Shared text requests are arriving too quickly. Your draft is retained.`}});return}let i=()=>{if(!Ve()||re.current.error||re.current.signature!==n||Object.keys(r).some(e=>r[e]!==Ze.current[e]))throw Error(`Shared text input or workspace changed. Your draft is retained.`);if(ze||s.action!==`read`&&!I.current?.canEdit)throw Object.assign(Error(`Shared text is read only.`),{code:`READ_ONLY`})},a;try{if(i(),a=Z(s.body),!R(a)||new TextEncoder().encode(JSON.stringify(a)).length>5e4||Object.keys(a).some(e=>![`protocol`,`requestId`,`sourceIdentity`,`epoch`,`textRevision`,`value`,`update`].includes(e)))throw Error(`Invalid shared text request.`)}catch(t){e({error:He(t)});return}Fe++,Le.push(Date.now()),Promise.resolve().then(async()=>{if(i(),_e()&&s.action!==`read`)throw Error(`Assisted shared-text writes require a task-safe native commit interface; this control is unavailable.`);try{let e=j,n;if(e&&s.action!==`read`){if(pe(e.context),s.action!==`update`||s.key!==e.field||s.nativeText?.token!==F.nativeTextToken||s.nativeText?.callId!==e.id)throw Error(`Unrelated text events cannot use this native task.`);n=e.context}else if(s.nativeText)throw Error(`The original text invocation is no longer current; do not replay.`);return await t.request(s.action,{...a,placementId:t.placementId,fieldKey:s.key},n)}catch(e){if(s.action===`read`&&e.code===`SHARED_TEXT_FIELD_UNSUPPORTED`&&typeof I.current?.state?.[s.key]!=`string`)return{unsupported:!0};throw e}}).then(t=>{i(),e({result:Z(t)})}).catch(t=>e({error:He(t)})).finally(()=>{Fe--});return}if(s.op===`cursor`){let e=s.cursor;if(R(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1){let t=N.current?.getBoundingClientRect(),n=Wi(e.anchor),r=Je.current.key;t&&window.dispatchEvent(new CustomEvent(`stillmade:sandbox-cursor`,{detail:{x:(t.left+e.x*t.width)/Math.max(1,window.innerWidth),y:(t.top+e.y*t.height)/Math.max(1,window.innerHeight),visible:e.visible!==!1,...n&&typeof r==`string`&&r.length>0&&r.length<=200&&!Ue.current?{anchor:n,surface:r}:{}}}))}return}if(s.op===`shared-view-update`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=bt)return;bt=Number(s.id);let t=e=>{Et=e.error?String(e.error):null,D({op:`shared-view-result`,id:s.id,...e})};if(St=St.filter(e=>Date.now()-e<6e4),yt||St.length>=240){t({error:`Shared edits are arriving too quickly. Wait and retry.`});return}if(!I.current?.canEdit||!Ue.current&&typeof ne.current.onSharedChange!=`function`){t({error:`Shared editing is unavailable or read only.`});return}let n;try{if(n=Z(s.request),new TextEncoder().encode(JSON.stringify(n)).length>Lt.requestBytes)throw Error(`Shared edit exceeds the limit`)}catch(e){t({error:e.message});return}yt=!0,St.push(Date.now()),Promise.resolve().then(()=>{if(!e||!I.current?.canEdit)throw Error(`Shared editing is unavailable or read only.`);if(_e(),Ue.current){I.current.state=Rt(I.current.state,n),kt();return}let t=_e();return ne.current.onSharedChange(n,t||void 0)}).then(()=>t({queued:!0}),e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{yt=!1});return}if(s.op===`content-size`){ee&&Number.isInteger(s.height)&&s.height>0&&s.height<=1e5&&fe(Math.max(280,Math.min(3e4,s.height)));return}if(s.op===`desktop`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=h)return;h=Number(s.id);let t=e=>D({op:`desktop-result`,id:s.id,...e});if(_=_.filter(e=>Date.now()-e<6e4),g||_.length>=120){t({error:`Too many desktop requests. Wait before trying again.`});return}let n;try{if(n=Z(s.args||{}),JSON.stringify(n).length>131072||!R(n))throw Error(`Desktop arguments exceed the limit`)}catch(e){t({error:e.message});return}let r=![`tool.status`,`storage.info`,`storage.list`,`storage.read`,`record.cancel`,`session.close`].includes(s.operation);if(r&&!I.current?.canEdit){t({error:`Desktop changes are unavailable while this workspace is read only.`});return}let i={native:m};_.push(Date.now()),g=i,Promise.resolve().then(()=>{if(!e||i.native!==m||r&&!I.current?.canEdit)throw Error(`Desktop access or edit permission changed before this request.`);if(_e()&&r)throw Error(`Assisted desktop mutations require a task-safe native interface; this control is unavailable.`);return i.native.call(s.operation,n)}).then(n=>{if(!e||i.native!==m||r&&!I.current?.canEdit)throw Error(`Desktop access or edit permission changed before this result could be used.`);t({result:Z(n)})},e=>t({error:String(e.message).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{g===i&&(g=null)});return}if(s.op===`use-output`){if(typeof s.id!=`string`||!/^[0-9]{1,9}$/.test(s.id))return;let e=e=>D({op:`use-output-result`,id:s.id,...e});try{if(_e())throw Error(`Assisted media adoption requires a task-safe native commit interface; this control is unavailable.`);if(w&&!I.current?.canEdit)throw Error(`This workspace is read only.`);let t=Z(s.outputs),n=ne.current.onUseOutput;if(typeof n!=`function`)throw Error(`Choosing an existing media output is unavailable in this workspace.`);Sa(t,re.current.value,m),Promise.resolve(n(t)).then(t=>{let n=Z(t);At(n),e({outputs:n})},t=>e({error:String(t?.message||`The media output could not be saved`).slice(0,1e3)}))}catch(t){e({error:String(t.message).slice(0,1e3)})}return}if(s.op===`preview-image`||s.op===`preview-media`){let t=s.op===`preview-media`;if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=l)return;mt(null),l=Number(s.id);let n=e=>D({op:t?`preview-media-result`:`preview-image-result`,id:s.id,...e}),r=Date.now();if(d=d.filter(e=>r-e<6e4),o||d.length>=_i.imagePreviewsPerMinute){++p<=3&&n({error:o?`An image preview is already loading`:`Image preview limit reached. Wait a minute before trying again.`}),p===4&&(at(`Preview paused after too many image requests. Reset it to continue.`),e=!1,ht(),i?.abort(),N.current&&(N.current.src=`about:blank`));return}d.push(r);let c;try{if(c=t?Z(s.value):Ca(s.value),t&&(!R(c)||![`video`,`audio`].includes(c.kind)||![`assetId`,`versionId`,`url`].every(e=>typeof c[e]==`string`&&c[e].length>0&&c[e].length<=32768)))throw Error(`Keep the complete audio or video reference supplied by this workspace.`)}catch(e){n({error:e.message});return}let u=t?ne.current.onPreviewMedia:ne.current.onPreviewImage;if(typeof u!=`function`){n({error:t?`Audio/video preview is unavailable in this workspace.`:`Image preview is unavailable in this workspace. Choose an image with the host controls.`});return}let f=new AbortController,m=Ze.current,h={controller:f,id:s.id,media:t};o=h;let g=Qe.current,_=a,v=xt(),y=()=>{if(f.signal.aborted||v!==xt()||g!==Qe.current||Object.keys(m).some(e=>m[e]!==Ze.current[e]))throw Error(`Image preview input or workspace changed.`)},b=setTimeout(()=>{e&&o===h&&ht(`Image preview timed out. Try a smaller image.`)},_i.imagePreviewMs);f.signal.addEventListener(`abort`,()=>clearTimeout(b),{once:!0}),Promise.resolve().then(()=>(y(),u(c,{signal:f.signal}))).then(r=>{if(e&&!f.signal.aborted&&o===h){if(y(),t&&r?.kind!==c.kind)throw Error(`The host returned a different media kind.`);let e=t?wt(r):wa(r);y(),typeof c.assetId==`string`&&c.assetId.length<=512&&typeof c.versionId==`string`&&c.versionId.length<=512&&mt({actor:_,runtimeActor:v,identity:g,session:F.session,authority:m,evidence:{assetId:c.assetId,versionId:c.versionId,kind:t?e.kind:`image`,mime:t?e.blob.type:`image/png`,...t?{byteLength:e.blob.size}:{width:e.width,height:e.height},status:`broker-loaded`}}),n({preview:e})}},t=>{e&&!f.signal.aborted&&o===h&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).catch(t=>{e&&!f.signal.aborted&&o===h&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).finally(()=>{clearTimeout(b),o===h&&(o=null)});return}if(s.op!==`run`||typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=c)return;c=Number(s.id);let y=e=>D({op:`result`,id:s.id,...e});if(w&&!I.current?.canEdit){y({error:`Shared editing is unavailable or read only.`});return}let x=Date.now();if(u=u.filter(e=>x-e<6e4),i||u.length>=_i.runsPerMinute){++f<=3&&y({error:i?`A run is already in progress`:`Preview run limit reached. Wait a minute before trying again.`}),f===4&&(at(`Preview paused after too many requests. Reset it to continue.`),e=!1,ht(),i?.abort(),N.current&&(N.current.src=`about:blank`));return}let S;try{if(!R(s.input))throw Error(`Expected input values`);S=Z(s.input)}catch(e){y({error:e.message});return}u.push(x),P(``);let T=new AbortController;i=T,Ce.current=!0,O?.context.signal?.addEventListener(`abort`,()=>T.abort(),{once:!0});let E=setTimeout(()=>{e&&i===T&&(T.abort(),i=null,y({error:te?`Preview confirmation or execution timed out. Cancellation was requested; the backend may still be finishing.`:`Preview execution timed out. Try a smaller input.`}))},te?M:15e3);T.signal.addEventListener(`abort`,()=>clearTimeout(E),{once:!0});let k=O?.op===`dispatch-view-control`?O:null,ie=k?async e=>{if(O!==k||i!==T||T.signal.aborted||!R(e)||e.receipt?.status!==`completed`||e.receipt.saved!==!0||ot(e.taskFence)!==ot(k.context.taskFence)||ot([e.projectId,e.placementId,e.sourceDigest,e.actorId])!==de||ot(Z(e.beforeInput))!==k.inputIdentity)throw Error(`The native input commit does not match this active declared action.`);let t=ot(Z(e.input));for(let e=0;e<25&&re.current.signature!==t;e++)if(pe(k.context,t),await new Promise(e=>setTimeout(e,10)),O!==k||i!==T||T.signal.aborted)throw Error(`The native input commit was stopped before its render.`);if(pe(k.context,t),re.current.signature!==t)throw Error(`The native input commit does not match the current rendered inputs.`);k.inputIdentity=t}:void 0;Promise.resolve().then(()=>ne.current.onRun(S,{..._e(),signal:T.signal,...ie?{onInputCommitted:ie}:{},...A?.manifest?.desktopTools?.length?{nativeDesktopSession:m}:{}})).then(t=>{if(e&&!T.signal.aborted){if(!R(t))throw Error(`Block execution must return named outputs`);let e=Z(t);At(e),y({outputs:e})}},t=>{e&&!T.signal.aborted&&y({error:String(t?.message||`The Block could not run`).slice(0,1e3)})}).catch(t=>{e&&!T.signal.aborted&&y({error:String(t.message).slice(0,1e3)})}).finally(()=>{clearTimeout(E),i===T&&(i=null),Ce.current=!1,setTimeout(()=>{e&&!Ce.current&&Ee()},250)})};return window.addEventListener(`message`,Nt),()=>{j&&=(clearTimeout(j.timer),j.context.signal?.removeEventListener(`abort`,j.abort),j.reject(Error(`Original text closed; retain its pending request.`)),null),it.current=null,he(Error(`The declared interface was closed.`)),L.current=null,We?.(),$e?.(),clearTimeout(Re),Ot(),Ct&&=(clearTimeout(Ct.timer),Ct.reject(Error(`Block closed before pending edits were confirmed.`)),null),clearTimeout(pt),clearInterval(y),S?.disconnect(),D({op:`dispose`}),e=!1,m.close(),se.current===m&&(se.current=null),ce.current===E&&(ce.current=null),ht(),i?.abort(),Ce.current=!1,window.removeEventListener(`message`,Nt),window.removeEventListener(`stillmade:cursor-preferences`,nt),window.removeEventListener(`storage`,nt),qe.current=null,Xe.current=null,Ke.current=null}},[F,Pe,te,M,ee,r,a,Oe,ke]),(0,v.useEffect)(()=>{Xe.current?.()},[t]),(0,v.useEffect)(()=>{Ke.current?.(),n?.canEdit===!1&&Promise.resolve(se.current?.close()).catch(()=>{})},[n,Pe]),(0,v.useEffect)(()=>{qe.current?.()},[i,r,a,n]),(0,v.useEffect)(()=>{Ye.current?.()},[T,_e]),(0,Y.jsxs)(`div`,{className:`bs-sandbox-ui`,children:[le?.awaitingStart&&(0,Y.jsxs)(`div`,{className:`bs-notice`,role:`status`,children:[(0,Y.jsx)(`p`,{children:`Ready to record. Choose your screen or window after pressing Start.`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:le.start,children:`Start screen recording`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>se.current?.close(),children:`Cancel`})]}),le?.active&&(0,Y.jsxs)(`div`,{role:`status`,className:`bs-notice`,children:[(0,Y.jsxs)(`strong`,{children:[`Recording `,le.kind||`media`]}),(0,Y.jsx)(`span`,{children:` · This Block has temporary desktop access.`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>se.current?.close(),children:`Cancel recording and revoke access`})]}),le?.closed&&A?.manifest?.permissions?.desktop?.length>0&&(0,Y.jsx)(`button`,{type:`button`,className:`btn`,disabled:!Pe||!I.current?.canEdit,onClick:()=>ce.current?.(),children:`Reopen desktop access`}),!le?.closed&&!le?.active&&A?.manifest?.permissions?.desktop?.length>0&&(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>se.current?.close(),children:`Revoke this Block’s desktop access`}),F.loading?(0,Y.jsx)(`p`,{role:`status`,children:`Loading the interface…`}):F.error?(0,Y.jsxs)(`p`,{role:`alert`,children:[`This interface cannot be previewed: `,F.error]}):Pe?(0,Y.jsx)(`iframe`,{ref:N,onLoad:()=>{We.current.session!==F.session&&(We.current={session:F.session,count:0}),++We.current.count>2&&Ge.current?.()},title:y,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,src:`${x(`/block-ui-sandbox.html`)}#${F.session}`,style:{width:`100%`,height:ee&&de||b,minHeight:280,border:`1px solid var(--border-tok)`,borderRadius:`var(--r-3)`,background:`var(--bg)`}},F.session):(0,Y.jsx)(`p`,{role:Me?.error?`alert`:`status`,children:Me?.error||`Checking Block safety…`}),pe?.count>0&&(pe.error?(0,Y.jsx)(`p`,{role:`alert`,className:`bs-notice`,children:pe.error}):pe.dirty||pe.pending?(0,Y.jsx)(`p`,{role:`status`,className:`bs-notice`,children:`Sharing changes…`}):null),he?.count>0&&(he.error||he.dirty||he.pending)?(0,Y.jsxs)(`div`,{className:`bs-notice`,role:he.error?`alert`:`status`,children:[(0,Y.jsx)(`p`,{children:he.error||`Saving shared text…`}),he.error&&(0,Y.jsx)(`p`,{children:`Your text is retained here. Copy it before leaving; reloading cannot safely recover an unacknowledged draft.`}),he.retryable&&(0,Y.jsx)(`button`,{type:`button`,className:`btn`,disabled:he.pending>0||!I.current?.canEdit,onClick:()=>N.current?.contentWindow?.postMessage({channel:ma,session:F.session,op:`text-retry`},`*`),children:`Retry save`})]}):null,(ie||Me?.error)&&(0,Y.jsxs)(Y.Fragment,{children:[ie&&(0,Y.jsx)(`p`,{role:`alert`,children:ie}),(0,Y.jsx)(`button`,{type:`button`,className:`btn`,disabled:Ae,onClick:()=>{Ae||oe(e=>e+1)},children:`Reload preview`})]})]})}var Da=[[`light`,`Light`],[`dark`,`Dark`],[`white`,`White`]],Oa=[[`full`,`Full width`,null],[`tablet`,`Tablet`,768],[`phone`,`Phone`,390]],ka=e=>{let t=JSON.stringify(e);return t.length>160?`${t.slice(0,157)}...`:t},Aa=(e,t)=>{try{return localStorage.getItem(e)||t}catch{return t}},ja=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};async function Ma(e){return(await fetch(`/__dev/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({input:e})})).json()}async function Na(e,{signal:t}={}){if(typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`))throw Error(`The local preview shows stand-in media and files mapped in tests/mocks.json.`);let n=await fetch(e.url,{signal:t});if(!n.ok)throw Error(`This image is not available in the local preview. Map it to a file under files in tests/mocks.json.`);let r=await createImageBitmap(await n.blob()),i=Math.min(1,512/Math.max(r.width,r.height)),a=document.createElement(`canvas`);return a.width=Math.max(1,Math.round(r.width*i)),a.height=Math.max(1,Math.round(r.height*i)),a.getContext(`2d`).drawImage(r,0,0,a.width,a.height),r.close?.(),{url:a.toDataURL(`image/png`),width:a.width,height:a.height}}function Pa(e,{signal:t}={}){return typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`)?Promise.reject(Error(`The local preview plays stand-in media and files mapped in tests/mocks.json.`)):Tt(e,{signal:t})}function Fa({value:e,onCommit:t,disabled:n}){let r=(0,v.useMemo)(()=>JSON.stringify(e,null,2),[e]),[i,a]=(0,v.useState)(r),[o,s]=(0,v.useState)(``);return(0,v.useEffect)(()=>{a(r),s(``)},[r]),(0,Y.jsxs)(`div`,{className:`dh-input`,children:[(0,Y.jsx)(`textarea`,{"aria-label":`Input JSON`,spellCheck:!1,rows:8,value:i,disabled:n,onChange:e=>a(e.target.value),onBlur:()=>{if(i!==r)try{let e=JSON.parse(i||`{}`);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`The input is one JSON object, keyed by input port.`);s(``),t(e)}catch(e){s(e.message)}}}),o&&(0,Y.jsx)(`p`,{role:`alert`,children:o})]})}var Ia=(0,v.memo)(function({entries:e,onClear:t}){let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,Y.jsxs)(`section`,{className:`dh-console`,"aria-label":`Console`,children:[(0,Y.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Y.jsx)(`h2`,{children:`Console`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,disabled:!e.length,children:`Clear`})]}),(0,Y.jsx)(`ol`,{ref:n,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`dh-entry dh-${e.kind}`,children:[(0,Y.jsx)(`time`,{children:e.time}),(0,Y.jsx)(`span`,{className:`dh-kind`,children:e.label}),(0,Y.jsx)(`pre`,{children:e.text})]},e.id))}),!e.length&&(0,Y.jsx)(`p`,{className:`dh-muted`,children:`Runs, logs, stand-ins, reloads and errors appear here.`})]})}),La={run:`Run`,log:`Log`,"stand-in":`Stand-in`,reload:`Reload`,build:`Build`,error:`Error`,view:`View`};function Ra(){let[e,t]=(0,v.useState)({revision:0,content:null,problem:null,folder:``}),[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)(()=>Aa(`stillmade.dev.theme`,`light`)),[o,s]=(0,v.useState)(()=>Aa(`stillmade.dev.width`,`full`)),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)([]),[y,b]=(0,v.useState)({}),x=(0,v.useRef)({}),S=(0,v.useRef)(0),C=(0,v.useCallback)((e,t)=>_(n=>[...n.slice(-299),{id:++S.current,kind:e,label:La[e]||e,time:new Date().toLocaleTimeString(),text:String(t)}]),[]),ee=(0,v.useCallback)(async()=>{let e=await(await fetch(`/__dev/package`,{cache:`no-store`})).json();return t(e),e},[]);(0,v.useEffect)(()=>{let e=!0;ee().then(t=>{e&&(d(e=>e??(t.content?.tests?.[0]?.input||{})),C(`reload`,`Previewing ${t.folder}`),t.problem&&C(`error`,t.problem))}).catch(e=>C(`error`,e.message));let t=new EventSource(`/__dev/events`);return t.addEventListener(`package`,async t=>{let n=JSON.parse(t.data);try{if(await ee(),!e)return;r(e=>e+1),C(n.problem?`error`:`reload`,n.problem?`Reloaded with a problem: ${n.problem}`:`Reloaded after a change`)}catch(e){C(`error`,e.message)}}),t.addEventListener(`build`,e=>{let t=JSON.parse(e.data);t.state===`running`?C(`build`,`Building: ${t.command}`):t.state===`done`?C(`build`,`Build finished`):C(`error`,`Build failed${t.output?`\n${t.output}`:``}`)}),()=>{e=!1,t.close()}},[]),(0,v.useEffect)(()=>{document.documentElement.dataset.mode=i,ja(`stillmade.dev.theme`,i)},[i]),(0,v.useEffect)(()=>{ja(`stillmade.dev.width`,o)},[o]);let w=e.content,T=w?.manifest,E=w?.tests||[],D=e=>{l(e),d(E[e]?.input||{})},O=(0,v.useCallback)(async(e,{signal:t}={})=>{C(`run`,`Run with ${ka(e)}`),h(!0);try{let n=await Ma(e);if(t?.aborted)throw Object.assign(Error(`Run cancelled`),{code:`CANCELLED`});for(let e of n.logs||[])C(`log`,e);for(let e of n.standIns||[])C(`stand-in`,`${e.api} ${e.name} (${e.source===`mocks`?`tests/mocks.json`:`recorded stand-in`})`);if(n.error)throw C(`error`,`${n.error}${n.code?` (${n.code})`:``}`),Object.assign(Error(n.error),{code:n.code});return p(n.outputs),C(`run`,`Finished in ${n.ms} ms`),n.outputs}finally{h(!1)}},[C]),k=(0,v.useCallback)(async e=>{let t=Rt(x.current,e);x.current=t,b(t)},[]),A=()=>{x.current={},b({}),r(e=>e+1),C(`view`,`Shared state cleared`)},j=(0,v.useMemo)(()=>({state:y,outputs:{},memory:null,canEdit:!0}),[y]),te=(0,v.useCallback)(async e=>{p(e),C(`view`,`The view chose outputs ${ka(e)}`)},[C]),M=(0,v.useCallback)(e=>C(`error`,String(e?.message||e)),[C]),N=u||{},ne=Oa.find(([e])=>e===o)?.[2];return(0,Y.jsxs)(`div`,{className:`dh-page`,children:[(0,Y.jsxs)(`header`,{className:`dh-header`,children:[(0,Y.jsxs)(`div`,{className:`dh-title`,children:[(0,Y.jsx)(`span`,{className:`dh-wordmark`,children:`StillMade AI`}),(0,Y.jsx)(`h1`,{children:T?.name||`Block preview`}),T&&(0,Y.jsxs)(`span`,{className:`dh-meta`,children:[T.id,` · `,T.version,` · `,T.runtime,w.view?.runtime===`frame`?` · frame view`:w.view?` · view`:``]})]}),(0,Y.jsxs)(`div`,{className:`dh-controls`,children:[(0,Y.jsxs)(`label`,{children:[`Appearance`,(0,Y.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:Da.map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{children:[`Width`,(0,Y.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:Oa.map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))})]}),E.length>1&&(0,Y.jsxs)(`label`,{children:[`Fixture`,(0,Y.jsx)(`select`,{value:c,onChange:e=>D(Number(e.target.value)),children:E.map((e,t)=>(0,Y.jsx)(`option`,{value:t,children:e.name},t))})]}),(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>r(e=>e+1),children:`Reload view`})]})]}),e.problem&&(0,Y.jsx)(`p`,{className:`dh-problem`,role:`alert`,children:e.problem}),(0,Y.jsxs)(`main`,{className:`dh-main`,children:[(0,Y.jsx)(`section`,{className:`dh-stage`,"aria-label":`Preview`,children:(0,Y.jsx)(`div`,{className:`dh-frame`,style:ne?{maxWidth:ne}:void 0,children:w?w.view?(0,Y.jsx)(Ea,{view:w.view,policyContent:w,input:N,sharedView:j,onSharedChange:k,onRun:O,onUseOutput:te,onPreviewImage:Na,onPreviewMedia:Pa,onError:M,actorId:`dev-preview`,title:`${T.name} preview`,height:560},n):(0,Y.jsxs)(`div`,{className:`dh-noview`,children:[(0,Y.jsx)(`p`,{children:`This Block has no interface. StillMade shows controls for its inputs; run it here with the input on the right.`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:m,onClick:()=>O(N).catch(()=>{}),children:m?`Running`:`Run`})]}):(0,Y.jsx)(`p`,{className:`dh-muted`,role:`status`,children:`Loading the Block`})})}),(0,Y.jsxs)(`aside`,{className:`dh-panel`,children:[(0,Y.jsxs)(`section`,{"aria-label":`Input`,children:[(0,Y.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Y.jsx)(`h2`,{children:`Input`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m||!w,onClick:()=>O(N).catch(()=>{}),children:`Run with this input`})]}),u&&(0,Y.jsx)(Fa,{value:u,onCommit:d,disabled:!w})]}),(0,Y.jsxs)(`section`,{"aria-label":`Outputs`,children:[(0,Y.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Y.jsx)(`h2`,{children:`Last outputs`}),w?.view&&(0,Y.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:A,children:`Clear shared state`})]}),f?(0,Y.jsx)(`pre`,{className:`dh-json`,children:JSON.stringify(f,null,2)}):(0,Y.jsx)(`p`,{className:`dh-muted`,children:`Nothing has run yet.`})]}),(0,Y.jsx)(Ia,{entries:g,onClear:()=>_([])})]})]})]})}(0,y.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(Ra,{}));
1395
+ `,qi=`/* StillMade Block kit: the default build-out for every Block interface.
1396
+ The host injects this file into every Block view (standard and frame), after
1397
+ the theme and before the Block's own CSS, so any Block can use these classes
1398
+ without shipping styles. Every rule sits inside :where() so a Block's own
1399
+ stylesheet always wins when a person explicitly asks for a different look.
1400
+
1401
+ The shape of a Block page, top to bottom:
1402
+ .sm-block one workspace, no cards inside cards
1403
+ .sm-stage the thing being made (preview, media, result); biggest area
1404
+ .sm-choices picks shown as pictures or icons, not word lists
1405
+ .sm-shape a frame shape at its real ratio (style="--r:9/16")
1406
+ .sm-field the few inputs a person actually needs
1407
+ .sm-actions one .sm-primary, optional .sm-quiet / .sm-icon
1408
+ .sm-status short live state beside the action
1409
+ .sm-more everything secondary, collapsed
1410
+ .sm-hint an info toggle for words that might help, collapsed
1411
+ .sm-empty what an empty stage shows: a glyph, a few words, one action
1412
+ .sm-glyph icons drawn in CSS with currentColor (no SVG or url needed)
1413
+
1414
+ The reference page is packages/design-system/block-kit.html. Keep this file
1415
+ free of url(), @import and @font-face: Block views refuse to load resources. */
1416
+
1417
+ /* ---------- Layout ---------- */
1418
+ :where(html:has(.sm-block)){container-type:inline-size}
1419
+ :where(.sm-block){display:grid;gap:var(--s-5,24px);min-width:0}
1420
+ :where(.sm-block,.sm-block *){box-sizing:border-box}
1421
+ :where(.sm-block) > :where(*){min-width:0}
1422
+ /* Unnamed container queries read the view page (the host makes it a container). */
1423
+ @container (min-width:720px){
1424
+ :where(.sm-block[data-layout="split"]){grid-template-columns:minmax(0,1.6fr) minmax(260px,1fr);align-items:start}
1425
+ :where(.sm-block[data-layout="split"]) > :where(.sm-stage){grid-row:span 6}
1426
+ }
1427
+ :where(.sm-row){display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2,8px)}
1428
+
1429
+ /* ---------- The stage: the object being made gets the main surface ---------- */
1430
+ :where(.sm-stage){position:relative;display:grid;place-items:center;min-height:220px;padding:var(--s-3,12px);border-radius:var(--r-3,8px);background:var(--bg-inset);overflow:hidden}
1431
+ :where(.sm-stage[data-ratio="16:9"]){aspect-ratio:16/9;min-height:0}
1432
+ :where(.sm-stage[data-ratio="9:16"]){aspect-ratio:9/16;min-height:0;max-height:70vh;justify-self:center;width:auto;height:min(70vh,640px)}
1433
+ :where(.sm-stage[data-ratio="1:1"]){aspect-ratio:1;min-height:0}
1434
+ :where(.sm-stage) > :where(img,video,canvas){display:block;max-width:100%;max-height:100%;object-fit:contain;border-radius:var(--r-2,4px)}
1435
+ :where(.sm-stage[data-fill]) > :where(img,video,canvas){width:100%;height:100%;object-fit:cover}
1436
+
1437
+ /* ---------- Empty state: a picture and a few words, never a paragraph ---------- */
1438
+ :where(.sm-empty){display:grid;justify-items:center;gap:var(--s-3,12px);padding:var(--s-5,24px) var(--s-4,16px);text-align:center;color:var(--fg-muted)}
1439
+ :where(.sm-empty) > :where(.sm-glyph){--sm-glyph-size:40px;color:var(--fg-subtle)}
1440
+ :where(.sm-empty) > :where(p){margin:0;max-width:24ch;font-size:var(--fs-body,1rem)}
1441
+ :where(.sm-drop){outline:1px dashed var(--border-tok);outline-offset:-8px}
1442
+ :where(.sm-drop[data-over]){outline-color:var(--fg);background:var(--hover-wash)}
1443
+
1444
+ /* ---------- Actions ---------- */
1445
+ :where(.sm-actions){display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2,8px)}
1446
+ :where(.sm-actions) > :where(.sm-status){margin-inline-start:var(--s-2,8px)}
1447
+ :where(.sm-primary,.sm-quiet){display:inline-flex;align-items:center;justify-content:center;gap:var(--s-2,8px);min-height:var(--touch-target,44px);padding:10px 20px;border-radius:var(--r-pill,999px);font:inherit;font-weight:500;cursor:pointer;max-width:100%;text-align:center;overflow-wrap:anywhere}
1448
+ :where(.sm-primary){border:1px solid var(--fg);background:var(--fg);color:var(--bg)}
1449
+ :where(.sm-quiet){border:1px solid var(--border-tok);background:transparent;color:var(--fg)}
1450
+ :where(.sm-quiet):hover{background:var(--hover-wash)}
1451
+ :where(.sm-icon){display:inline-grid;place-items:center;min-width:var(--touch-target,44px);min-height:var(--touch-target,44px);padding:0;border:0;border-radius:var(--r-2,4px);background:transparent;color:var(--fg-muted);cursor:pointer}
1452
+ :where(.sm-icon):hover{color:var(--fg);background:var(--hover-wash)}
1453
+ :where(.sm-icon[aria-pressed="true"]){color:var(--fg);background:var(--press-wash)}
1454
+ :where(.sm-primary,.sm-quiet,.sm-icon):disabled{opacity:.45;cursor:default}
1455
+ :where(.sm-primary,.sm-quiet,.sm-icon):focus-visible{outline:2px solid var(--signal);outline-offset:3px}
1456
+ @container (max-width:420px){
1457
+ :where(.sm-actions) > :where(.sm-primary){flex:1 1 100%}
1458
+ }
1459
+
1460
+ /* ---------- Fields: a short label above one control ---------- */
1461
+ :where(.sm-field){display:grid;gap:6px;min-width:0}
1462
+ :where(.sm-field) > :where(label,.sm-label){display:flex;align-items:center;gap:var(--s-1,4px);font-size:var(--fs-body-s,.875rem);color:var(--fg-muted);min-height:24px}
1463
+ :where(.sm-field) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea){width:100%;min-height:var(--touch-target,44px);padding:10px 12px;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-1);color:var(--fg);font:inherit}
1464
+ :where(.sm-field) :where(textarea){min-height:96px;resize:vertical}
1465
+ :where(.sm-fields){display:grid;gap:var(--s-4,16px);grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr))}
1466
+
1467
+ /* ---------- Choices as pictures: replaces word dropdowns and radio lists ---------- */
1468
+ :where(.sm-choices){display:grid;gap:var(--s-2,8px);grid-template-columns:repeat(auto-fill,minmax(var(--sm-tile,96px),1fr));margin:0;padding:0;border:0;min-width:0}
1469
+ :where(.sm-choices[data-size="wide"]){--sm-tile:160px}
1470
+ :where(.sm-choices) > :where(legend){padding:0;margin-bottom:6px;font-size:var(--fs-body-s,.875rem);color:var(--fg-muted)}
1471
+ :where(.sm-choices) > :where(label){position:relative;display:grid;justify-items:center;align-content:start;gap:6px;padding:var(--s-2,8px);border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-1);color:var(--fg-muted);font-size:var(--fs-caption,.8125rem);text-align:center;cursor:pointer}
1472
+ :where(.sm-choices) > :where(label):hover{border-color:var(--border-strong);color:var(--fg)}
1473
+ :where(.sm-choices) :where(input[type="radio"],input[type="checkbox"]){position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
1474
+ :where(.sm-choices) > :where(label:has(input:checked)){border-color:var(--fg);color:var(--fg);box-shadow:inset 0 0 0 1px var(--fg)}
1475
+ :where(.sm-choices) > :where(label:has(input:focus-visible)){outline:2px solid var(--signal);outline-offset:2px}
1476
+ :where(.sm-choices) :where(img,video,canvas,.sm-swatch){display:block;width:100%;aspect-ratio:var(--sm-tile-ratio,1);object-fit:cover;border-radius:var(--r-2,4px);background:var(--bg-inset)}
1477
+ :where(.sm-choices) :where(.sm-glyph){--sm-glyph-size:28px;margin:10px 0 4px}
1478
+ :where(.sm-choices[data-ratio="16:9"]){--sm-tile-ratio:16/9}
1479
+ :where(.sm-choices[data-ratio="9:16"]){--sm-tile-ratio:9/16}
1480
+ :where(.sm-choices[data-compact]) > :where(label){grid-auto-flow:column;justify-content:center;align-content:center;align-items:center;min-height:var(--touch-target,44px);padding:6px 12px}
1481
+ :where(.sm-choices[data-compact]) :where(.sm-glyph){--sm-glyph-size:18px;margin:0}
1482
+ :where(.sm-choices) :where(audio){width:100%;height:32px;position:relative;z-index:1}
1483
+ /* A frame shape drawn at its real proportion: <span class="sm-shape" style="--r:9/16"></span>. */
1484
+ :where(.sm-shape){display:block;box-sizing:border-box;width:calc(var(--sm-shape-size,32px) * min(1,var(--r,1)));aspect-ratio:var(--r,1);max-width:100%;margin:4px auto;border:2px solid currentColor;border-radius:3px}
1485
+ :where(.sm-choices) > :where(label:has(.sm-shape)){grid-template-rows:1fr auto;align-content:stretch}
1486
+ :where(.sm-choices) :where(.sm-shape){--sm-shape-size:36px;align-self:center;margin:6px auto 2px}
1487
+ :where(.sm-choices[data-compact]) :where(.sm-shape){--sm-shape-size:20px;margin:0}
1488
+
1489
+ /* ---------- Media gallery ---------- */
1490
+ :where(.sm-gallery){display:grid;gap:var(--s-2,8px);grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--sm-tile,140px)),1fr));margin:0;padding:0;list-style:none}
1491
+ :where(.sm-gallery) > :where(*){position:relative;margin:0;border-radius:var(--r-3,8px);overflow:hidden;background:var(--bg-inset)}
1492
+ :where(.sm-gallery) :where(img,video,canvas){display:block;width:100%;aspect-ratio:var(--sm-tile-ratio,1);object-fit:cover}
1493
+ :where(.sm-gallery) :where(figcaption){padding:6px 8px;font-size:var(--fs-caption,.8125rem);color:var(--fg-muted)}
1494
+ :where(.sm-gallery) :where([aria-selected="true"],.is-selected){box-shadow:inset 0 0 0 2px var(--fg)}
1495
+
1496
+ /* ---------- Status: a glyph and a few words, next to the action ---------- */
1497
+ :where(.sm-status){display:inline-flex;align-items:center;gap:var(--s-2,8px);min-height:24px;font-size:var(--fs-body-s,.875rem);color:var(--fg-muted)}
1498
+ :where(.sm-status):empty{display:none}
1499
+ :where(.sm-status[data-state])::before{content:"";flex:none;width:14px;height:14px;border-radius:50%;background:currentColor}
1500
+ :where(.sm-status[data-state="loading"])::before{background:transparent;border:2px solid currentColor;border-right-color:transparent;animation:sm-spin .8s linear infinite}
1501
+ :where(.sm-status[data-state="success"]){color:var(--attention-ok,var(--fg))}
1502
+ :where(.sm-status[data-state="success"])::before{border-radius:0;background:transparent;width:6px;height:11px;margin:0 4px 3px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}
1503
+ :where(.sm-status[data-state="waiting"]){color:var(--attention-warning,var(--signal))}
1504
+ :where(.sm-status[data-state="waiting"])::before{width:8px;height:8px;margin:0 3px}
1505
+ :where(.sm-status[data-state="error"]){color:var(--attention-error,var(--signal))}
1506
+ :where(.sm-status[data-state="error"])::before{border-radius:0;clip-path:polygon(50% 0,100% 100%,0 100%)}
1507
+ :where(.sm-progress){width:100%;height:4px;border:0;border-radius:var(--r-pill,999px);overflow:hidden;background:var(--bg-elev-2);accent-color:var(--fg);appearance:none}
1508
+ :where(.sm-progress)::-webkit-progress-bar{background:var(--bg-elev-2)}
1509
+ :where(.sm-progress)::-webkit-progress-value{background:var(--fg)}
1510
+ :where(.sm-progress)::-moz-progress-bar{background:var(--fg)}
1511
+
1512
+ /* ---------- Collapsed words: More (secondary settings) and hints ---------- */
1513
+ :where(.sm-more){border-top:1px solid var(--divider)}
1514
+ :where(.sm-more) > :where(summary){display:flex;align-items:center;gap:var(--s-2,8px);min-height:var(--touch-target,44px);padding:0;list-style:none;color:var(--fg-muted);font-size:var(--fs-body-s,.875rem);cursor:pointer}
1515
+ :where(.sm-more) > :where(summary)::-webkit-details-marker{display:none}
1516
+ :where(.sm-more) > :where(summary)::after{content:"";width:7px;height:7px;margin-inline-start:2px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:translateY(-2px) rotate(45deg);transition:transform var(--dur-fast,160ms) var(--ease-out,ease)}
1517
+ :where(.sm-more[open]) > :where(summary)::after{transform:translateY(2px) rotate(-135deg)}
1518
+ :where(.sm-more) > :where(summary):hover{color:var(--fg)}
1519
+ :where(.sm-more) > :where(:not(summary)){margin-top:var(--s-2,8px)}
1520
+ :where(.sm-more[open]){padding-bottom:var(--s-3,12px)}
1521
+ /* The popup spans its label row (.sm-label), so it never runs off a narrow screen. */
1522
+ :where(.sm-label){position:relative}
1523
+ :where(.sm-hint){display:inline-block;vertical-align:middle}
1524
+ :where(:not(.sm-label)) > :where(.sm-hint){position:relative}
1525
+ /* 44px to tap, with negative margins so the label row stays compact. */
1526
+ :where(.sm-hint) > :where(summary){display:inline-grid;place-items:center;width:var(--touch-target,44px);height:var(--touch-target,44px);margin:-8px;min-height:0;padding:0;border:0;list-style:none;color:var(--fg-subtle);cursor:pointer}
1527
+ :where(.sm-hint) > :where(summary)::-webkit-details-marker{display:none}
1528
+ :where(.sm-hint) > :where(summary)::before{content:"i";display:grid;place-items:center;width:15px;height:15px;border:1.5px solid currentColor;border-radius:50%;font:600 10px/1 var(--font-body);font-style:normal}
1529
+ :where(.sm-hint) > :where(summary):hover,:where(.sm-hint[open]) > :where(summary){color:var(--fg)}
1530
+ :where(.sm-hint) > :where(:not(summary)){position:absolute;z-index:5;inset-inline-start:0;top:100%;width:max-content;max-width:min(280px,100%);margin:4px 0 0;padding:10px 12px;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-2);color:var(--fg);font-size:var(--fs-body-s,.875rem);line-height:1.45;box-shadow:var(--shadow-1)}
1531
+ /* Outside a label row there is no safe anchor, so the explanation opens in the flow instead. */
1532
+ :where(:not(.sm-label)) > :where(.sm-hint[open]){display:block}
1533
+ :where(:not(.sm-label)) > :where(.sm-hint) > :where(:not(summary)){position:static;width:auto;max-width:60ch}
1534
+
1535
+ /* ---------- Glyphs: small icons drawn with currentColor ----------
1536
+ <span class="sm-glyph" data-glyph="upload" aria-hidden="true"></span>
1537
+ Pair with a visible word or the control's aria-label. */
1538
+ :where(.sm-glyph){--g:var(--sm-glyph-size,20px);position:relative;display:inline-block;flex:none;width:var(--g);height:var(--g);color:inherit;vertical-align:middle}
1539
+ :where(.sm-glyph)::before,:where(.sm-glyph)::after{content:"";position:absolute;box-sizing:border-box}
1540
+ :where(.sm-glyph[data-glyph="play"])::before{inset:15% 15% 15% 25%;background:currentColor;clip-path:polygon(0 0,100% 50%,0 100%)}
1541
+ :where(.sm-glyph[data-glyph="pause"])::before{inset:18% 25%;border:solid currentColor;border-width:0 calc(var(--g)*.14)}
1542
+ :where(.sm-glyph[data-glyph="plus"])::before,:where(.sm-glyph[data-glyph="close"])::before{inset:15%;background:linear-gradient(currentColor,currentColor) center/100% 2px no-repeat,linear-gradient(currentColor,currentColor) center/2px 100% no-repeat}
1543
+ :where(.sm-glyph[data-glyph="close"])::before{transform:rotate(45deg)}
1544
+ :where(.sm-glyph[data-glyph="check"])::before{left:36%;top:12%;width:30%;height:58%;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}
1545
+ :where(.sm-glyph[data-glyph="chevron"])::before{left:30%;top:22%;width:40%;height:40%;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}
1546
+ :where(.sm-glyph[data-glyph="upload"])::before{left:10%;right:10%;bottom:10%;height:35%;border:2px solid currentColor;border-top:0;border-radius:0 0 3px 3px}
1547
+ :where(.sm-glyph[data-glyph="upload"])::after{left:25%;right:25%;top:4%;height:62%;background:currentColor;clip-path:polygon(50% 0,100% 45%,60% 45%,60% 100%,40% 100%,40% 45%,0 45%)}
1548
+ :where(.sm-glyph[data-glyph="image"])::before{inset:12%;border:2px solid currentColor;border-radius:3px}
1549
+ :where(.sm-glyph[data-glyph="image"])::after{left:22%;right:22%;bottom:24%;height:34%;background:currentColor;clip-path:polygon(0 100%,35% 20%,60% 65%,75% 45%,100% 100%)}
1550
+ :where(.sm-glyph[data-glyph="video"])::before{left:8%;right:28%;top:22%;bottom:22%;border:2px solid currentColor;border-radius:3px}
1551
+ :where(.sm-glyph[data-glyph="video"])::after{right:8%;top:30%;bottom:30%;width:20%;background:currentColor;clip-path:polygon(0 35%,100% 0,100% 100%,0 65%)}
1552
+ :where(.sm-glyph[data-glyph="audio"])::before{inset:15% 12%;background:linear-gradient(currentColor,currentColor) 0 60%/2px 40% no-repeat,linear-gradient(currentColor,currentColor) 33% 50%/2px 80% no-repeat,linear-gradient(currentColor,currentColor) 66% 50%/2px 100% no-repeat,linear-gradient(currentColor,currentColor) 100% 60%/2px 50% no-repeat}
1553
+ :where(.sm-glyph[data-glyph="text"])::before{inset:20% 12%;background:linear-gradient(currentColor,currentColor) 0 0/100% 2px no-repeat,linear-gradient(currentColor,currentColor) 0 50%/100% 2px no-repeat,linear-gradient(currentColor,currentColor) 0 100%/60% 2px no-repeat}
1554
+ :where(.sm-glyph[data-glyph="spark"])::before{inset:8%;background:currentColor;clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%)}
1555
+ :where(.sm-glyph[data-glyph="info"])::before{inset:10%;border:2px solid currentColor;border-radius:50%}
1556
+ :where(.sm-glyph[data-glyph="info"])::after{left:50%;top:28%;width:2px;height:46%;margin-left:-1px;background:linear-gradient(currentColor,currentColor) 0 0/2px 2px no-repeat,linear-gradient(currentColor,currentColor) 0 100%/2px 60% no-repeat}
1557
+ :where(.sm-glyph[data-glyph="warning"])::before{inset:8% 4% 10%;background:currentColor;clip-path:polygon(50% 0,100% 100%,0 100%)}
1558
+ :where(.sm-glyph[data-glyph="warning"])::after{left:50%;top:38%;width:2px;height:38%;margin-left:-1px;background:linear-gradient(var(--bg),var(--bg)) 0 0/2px 60% no-repeat,linear-gradient(var(--bg),var(--bg)) 0 100%/2px 2px no-repeat}
1559
+ :where(.sm-glyph[data-glyph="spinner"])::before{inset:12%;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:sm-spin .8s linear infinite}
1560
+
1561
+ /* The hidden attribute always wins over kit display rules. */
1562
+ :where([class*="sm-"][hidden]){display:none!important}
1563
+
1564
+ /* Visually hidden but read aloud, for icon-only controls that need more than aria-label. */
1565
+ :where(.sm-sr){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
1566
+
1567
+ @keyframes sm-spin{to{transform:rotate(360deg)}}
1568
+ @media (prefers-reduced-motion:reduce){
1569
+ :where(.sm-status[data-state="loading"])::before,:where(.sm-glyph[data-glyph="spinner"])::before{animation:none;border-right-color:currentColor;opacity:.6}
1570
+ :where(.sm-more) > :where(summary)::after{transition:none}
1571
+ }
1572
+ `;function Ji(e){let t=e=>Number.isFinite(e)&&e>=0&&e<=1;return!e||typeof e!=`object`||Array.isArray(e)||!t(e.x)||!t(e.y)||e.id!==void 0&&(typeof e.id!=`string`||!e.id.length||e.id.length>160)?null:{x:e.x,y:e.y,...e.id===void 0?{}:{id:e.id}}}function Yi(e,t,n){if(t=Ji(t),!t)return null;let r,i;if(t.id!==void 0){let n=e.getElementById(t.id);if(!n)return null;let a=n.getBoundingClientRect();if(a.width<=0||a.height<=0)return null;r=a.left+a.width*t.x,i=a.top+a.height*t.y;let o=e.elementFromPoint?.(r,i);if(o&&!n.contains(o))return null}else r=t.x*e.documentElement.scrollWidth-n.scrollX,i=t.y*e.documentElement.scrollHeight-n.scrollY;return Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0&&r<=n.width&&i<=n.height?{x:r,y:i}:null}function Xi(e,t,n){let r=null,i=null,a=null,o=!1,s=e=>Math.max(0,Math.min(1,e)),c=[],l=null,u=null,d=null,f=new Map,p=()=>{if(u=null,o||!n)return;!l&&c.length&&(l=document.createElement(`div`),l.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483647;overflow:hidden`,l.setAttribute(`aria-hidden`,`true`),document.body.append(l));let e=new Set(c.map(e=>e.id));for(let[t,n]of f)e.has(t)||(n.remove(),f.delete(t));for(let e of c){let t=f.get(e.id);t||(t=document.createElement(`div`),t.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;color:var(--fg);white-space:nowrap;font:12px var(--font-body,sans-serif)`,typeof matchMedia==`function`&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches&&(t.style.transition=`transform 100ms linear`),l.append(t),f.set(e.id,t)),t.textContent=`↖ `+e.label;let r=n(document,e.anchor,{width:innerWidth,height:innerHeight,scrollX,scrollY});t.hidden=!r,r&&(t.style.transform=`translate(`+r.x+`px,`+r.y+`px)`)}},m=()=>{u===null&&(u=setTimeout(p,50))},h=()=>{if(i=null,!o&&r){if(r.visible&&a){let e=(document.elementFromPoint?.(a.x,a.y)||a.target)?.closest?.(`[id]`),t=e?.id,n=t&&t.length<=160?e.getBoundingClientRect():null;if(n?.width>0&&n?.height>0)r.anchor={id:t,x:s((a.x-n.left)/n.width),y:s((a.y-n.top)/n.height)};else{let e=document.documentElement;r.anchor={x:s((a.x+scrollX)/Math.max(1,e.scrollWidth)),y:s((a.y+scrollY)/Math.max(1,e.scrollHeight))}}}parent.postMessage({channel:e,session:t,op:`cursor`,cursor:r},`*`),r=null}},g=e=>{a={x:e.clientX,y:e.clientY,target:e.target},r={x:s(e.clientX/Math.max(1,innerWidth)),y:s(e.clientY/Math.max(1,innerHeight)),visible:!0},i===null&&(i=setTimeout(h,50))},_=()=>{a=null,r={x:0,y:0,visible:!1},i===null&&(i=setTimeout(h,0))},v=()=>{a&&g({clientX:a.x,clientY:a.y,target:a.target}),m()},y=n=>{let s=n.data;if(!(o||n.source!==parent||s?.channel!==e||s.session!==t)){if(s.op===`peer-cursors`){c=(Array.isArray(s.peers)?s.peers:[]).slice(0,50).filter(e=>e&&typeof e.id==`string`&&e.id.length<=200&&typeof e.label==`string`&&e.label.length<=120).map(e=>({id:e.id,label:e.label,anchor:e.anchor})),m();return}s.op===`dispose`&&(o=!0,clearTimeout(i),clearTimeout(u),d?.disconnect(),r=null,a=null,c=[],f.clear(),l?.remove(),removeEventListener(`pointermove`,g),removeEventListener(`scroll`,v,!0),removeEventListener(`resize`,v),removeEventListener(`blur`,_),removeEventListener(`message`,y),document.documentElement.removeEventListener(`pointerleave`,_))}};addEventListener(`pointermove`,g,{passive:!0}),addEventListener(`scroll`,v,{passive:!0,capture:!0}),addEventListener(`resize`,v,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,_),addEventListener(`blur`,_),addEventListener(`message`,y),typeof MutationObserver==`function`&&(d=new MutationObserver(e=>{c.length&&e.some(e=>!l?.contains(e.target))&&m()}),d.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}function Zi(e,t){let n=r=>{let i=r.data;r.source===parent&&i&&i.channel===e&&i.session===t&&(i.op===`theme`&&[`light`,`dark`,`white`].includes(i.mode)&&(document.documentElement.dataset.mode=i.mode),i.op===`dispose`&&removeEventListener(`message`,n))};addEventListener(`message`,n)}function Qi(e,t){let n=parent,r=null,i=0,a=!1,o=()=>{if(r=null,a)return;let o=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height));o!==i&&(i=o,n.postMessage({channel:e,session:t,op:`content-size`,height:o},`*`))},s=()=>{!a&&r===null&&(r=setTimeout(o,100))},c=new ResizeObserver(s);c.observe(document.body);let l=i=>{i.source===n&&i.data?.channel===e&&i.data?.session===t&&i.data?.op===`dispose`&&(a=!0,clearTimeout(r),c.disconnect(),removeEventListener(`message`,l))};addEventListener(`message`,l),s()}vt();function $i(e){return z(Array.isArray(e)&&e.length>0&&e.length<=128&&e.every(e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e)),`SCHEMA`,`Provide 1–128 exact source digests`),[...new Set(e)]}async function ea(e){ct(e);let t=e?.stages&&e.packages||[];return z(Array.isArray(t)&&t.length<128,`LIMIT`,`Too many packaged Blocks for execution review`),$i(await Promise.all([e,...t].map(e=>ut(e))))}async function ta(e){let t=await ea(e),n=new Set(t),r=e?.stages?e.packages||[]:[e],i=e=>{z(e&&typeof e.digest==`string`&&/^[a-f0-9]{64}$/.test(e.digest),`SCHEMA`,`Block lineage needs exact source digests`),n.add(e.digest),z(n.size<=128,`LIMIT`,`Block source and ancestry exceed the security review limit`)};for(let e of r){let t=e.manifest?.provenance;t?.remixedFrom!==void 0&&i(t.remixedFrom);let n=t?.remixAncestors??[];z(Array.isArray(n)&&n.length<=64,`SCHEMA`,`Block ancestry must contain at most 64 exact source references`),n.forEach(i);let r=e.portable?.lineage?.parents??[];z(Array.isArray(r)&&r.length<=16,`SCHEMA`,`Portable lineage must contain at most 16 exact source references`),r.forEach(i)}return $i([...n])}var na=`stillmade.block-security.v1`,ra=new Map;function ia(e,t){let n=e?.revision||0,r=t.revision||0;return{revision:Math.max(n,r),published:t.published||e?.published===!0,revoked:n>r?e.revoked:n===r?t.revoked||e?.revoked===!0:t.revoked}}function aa(){try{let e=JSON.parse(globalThis.localStorage?.getItem(na)||`{}`);for(let[t,n]of Object.entries(e))/^[a-f0-9]{64}$/.test(t)&&n&&typeof n.revoked==`boolean`&&typeof n.published==`boolean`&&Number.isInteger(n.revision)&&n.revision>=0&&ra.set(t,ia(ra.get(t),n))}catch{}return ra}function oa(e){let t=aa();for(let n of e){let e=t.get(n.digest);(n.revoked||n.published||e)&&t.set(n.digest,ia(e,n))}try{globalThis.localStorage?.setItem(na,JSON.stringify(Object.fromEntries(t)))}catch{}}var sa=()=>Object.assign(Error(`This exact Block version has been quarantined by StillMade. Use a reviewed replacement.`),{code:`BLOCK_REVOKED`});async function ca(e,{signal:t}={}){let n=await ta(e),r=aa();if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});let i=new AbortController,a=()=>i.abort();t?.addEventListener(`abort`,a,{once:!0});let o=setTimeout(a,3e3),s;try{let e=await fetch(`/api/blocks/runtime-policy`,{method:`POST`,credentials:`omit`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({digests:n}),signal:i.signal});if(!e.ok)throw Error(`Block security check unavailable`);if(s=await e.json(),!Array.isArray(s.digests)||s.digests.length!==n.length||new Set(s.digests.map(e=>e.digest)).size!==n.length||s.digests.some(e=>!n.includes(e.digest)||typeof e.revoked!=`boolean`||typeof e.published!=`boolean`||!Number.isInteger(e.revision)||e.revision<0))throw Error(`Invalid security response`);oa(s.digests)}catch{if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});if(n.some(e=>r.get(e)?.revoked))throw sa();if(n.some(e=>r.get(e)?.published))throw Object.assign(Error(`Reconnect to check the safety of this published Block before running it.`),{code:`REVOCATION_UNAVAILABLE`});return{checked:!1}}finally{clearTimeout(o),t?.removeEventListener(`abort`,a)}if(n.some(e=>aa().get(e)?.revoked))throw sa();return{checked:!0}}var la=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Z=s(((e,t)=>{t.exports=la()}))(),ua=`modulepreload`,da=function(e){return`/`+e},fa={},pa=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=da(t,n),t=s(t),t in fa)return;fa[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ua,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ma=c({loadViewAssets:()=>ha});async function ha(e,{signal:t}={}){let n={};for(let[r,i]of Object.entries(e?.files||{})){let a=await fetch(`/__dev/files/`+i.sha256,{signal:t});if(!a.ok)throw Error(r+` is missing from the Block folder.`);let o=await _i(e,r,new Uint8Array(await a.arrayBuffer()));n[r]={mediaType:i.mediaType,base64:ga(o)}}return n}var ga,_a=o((()=>{vi(),ga=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}));E(),vt();var va=`stillmade.block.view.v1`,ya=()=>globalThis.crypto.randomUUID(),ba=`*{box-sizing:border-box}html{container:stillmade-view/inline-size;overflow-wrap:anywhere}body{min-width:0;margin:0;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}h1,h2{font:200 italic clamp(26px,8cqi,32px)/1.1 var(--font-display);letter-spacing:var(--tr-display)}button,input,textarea,select,summary{font:inherit;color:inherit;max-width:100%}button,input,textarea,select{min-height:44px;border:1px solid var(--border-tok);border-radius:var(--r-3);padding:10px 14px;background:transparent}summary{display:flex;align-items:center;min-height:44px;cursor:pointer}button{min-width:44px;cursor:pointer;border-radius:var(--r-pill);background:var(--fg);color:var(--bg)}button:disabled{opacity:.5;cursor:default}textarea{display:block;width:100%;min-height:120px}img,video,canvas{max-width:100%}:focus-visible{outline:2px solid var(--signal);outline-offset:3px}@container stillmade-view (max-width:360px){body{padding:12px}button,input,textarea,select{font-size:16px}}`,xa=`*{box-sizing:border-box}html{overflow-wrap:anywhere}body{min-width:0;margin:0;padding:16px;overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}`,Sa=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`);function Ca(e){if(ct(e),new TextEncoder().encode(JSON.stringify(e)).length>yi.messageBytes)throw Error(`Preview data exceeds 4 MiB`);return structuredClone(e)}var wa=e=>B(e)&&[`image`,`video`,`audio`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?lt([e.kind,e.assetId,e.versionId,e.url]):``;function Ta(e){let t=(0,v.useRef)({has:!1,original:null,signature:null,value:null});if(t.current.has&&Object.is(t.current.original,e))return t.current.value;let n=e===void 0?`undefined`:lt(e);return t.current.signature===n?t.current.original=e:t.current={has:!0,original:e,signature:n,value:e},t.current.value}function Ea(e,t=[]){return Array.isArray(e)?(e.forEach(e=>Ea(e,t)),t):B(e)?wa(e)?(t.push(e),t):(Object.values(e).forEach(e=>Ea(e,t)),t):t}var Da=e=>Array.isArray(e)?e.length>0&&e.every(Da):!!wa(e);function Oa(e,t,n){if(!B(e)||!Object.values(e).length||!Object.values(e).every(Da))throw Error(`Only complete saved media references can be chosen as outputs.`);let r=new Set(Ea(t).map(wa));for(let t of Ea(e))if(!r.has(wa(t))&&!n?.authorizesMedia(t))throw Error(`Choose media supplied by this workspace or recorded in this session.`);return Ca(e)}function ka(e){let t=Ca(e);if(!B(t)||!dt(t,`image`))throw Error(`Choose a valid image supplied by this workspace.`);if(t.role!==void 0&&(typeof t.role!=`string`||!/^[a-z][a-z0-9_]{0,79}$/.test(t.role)))throw Error(`This image has an invalid semantic role.`);if(!Array.isArray(t.data)&&!([`assetId`,`versionId`,`url`].every(e=>typeof t[e]==`string`&&t[e].length>0)&&t.assetId.length<=512&&t.versionId.length<=512&&t.url.length<=32768))throw Error(`Keep the complete image reference supplied by this workspace.`);return t}function Aa(e){let t=Ca(e);if(!(B(t)&&Object.keys(t).length===3&&[`url`,`width`,`height`].every(e=>Object.hasOwn(t,e))&&[`width`,`height`].every(e=>Number.isInteger(t[e])&&t[e]>0&&t[e]<=yi.imagePreviewEdge))||typeof t.url!=`string`||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(t.url))throw Error(`The host returned an invalid image preview.`);let n=t.url.slice(22);if(n.length%4!=0)throw Error(`The host returned an invalid image preview.`);let r=atob(n.slice(0,44)),i=e=>r.charCodeAt(e),a=e=>i(e)*16777216+i(e+1)*65536+i(e+2)*256+i(e+3);if(r.length<33||![137,80,78,71,13,10,26,10].every((e,t)=>i(t)===e)||a(8)!==13||r.slice(12,16)!==`IHDR`||a(16)!==t.width||a(20)!==t.height)throw Error(`The host returned an invalid image preview.`);return t}function ja(e,t,n=`light`,r=`package`,i=!1,a=[],o=null,s=!1,c=!1,{assets:l={}}={}){Oi(e);let u=Fi(e),d=r===`package`?e.appearance??`host`:r;d!==`original`&&!u&&Wi(e,{appearance:`host`});let f=(d===`original`?e.css??``:e.themedCss??e.css??``)+`
1573
+ `+(u?``:Ki),p=globalThis.crypto.randomUUID().replaceAll(`-`,``),m=`__sm_view_${p}`,h=`__sm_guard_${globalThis.crypto.randomUUID().replaceAll(`-`,``)}`,g=`(()=>{"use strict";document.currentScript.remove();const session=${Sa(t)},channel=${Sa(va)},send=parent.postMessage.bind(parent);let input={},ready=false,inputRevision=0,editRevision=0,sequence=0,pending=null,pendingAdopt=null,adoptSequence=0,pendingImage=null,imageSequence=0,pendingDesktop=null,desktopSequence=0;const mediaURLs=new Set();const clearMedia=()=>{for(const url of mediaURLs)URL.revokeObjectURL(url);mediaURLs.clear()};const listeners=new Set();let calls=0,started=0;const now=performance.now.bind(performance),resetTask=setTimeout.bind(globalThis);${u?`for(const meta of document.querySelectorAll("meta[http-equiv]"))meta.remove();const frameRuntime=(${zi.toString()})(channel,session,send,${Sa({guardName:h,taskMs:Ai.taskMs,assets:l})});`:`Object.defineProperty(globalThis,${Sa(m)},{configurable:true,value:()=>{if(calls===0){started=now();resetTask(()=>{calls=0},0)}if(++calls>10000||now()-started>50)throw Error("Interface is doing too much work. Move processing into the Block runtime.")}});addEventListener("message",event=>{if(event.isTrusted&&event.source===parent)calls=0},true);`}let controlEffects=0;let assisted=false,trackedCalls=new Set(),trackedFailure=null,controlOffset=0;const track=promise=>{if(assisted){trackedCalls.add(promise);promise.then(()=>trackedCalls.delete(promise),error=>{trackedFailure=error;trackedCalls.delete(promise)})}return promise};const controlSnapshot=(offset=controlOffset,automatic=true)=>{try{let snapshot;try{snapshot=dynamicUI.inspectControls({offset})}catch(error){if(!automatic||error.message!=="Choose a current control page"||!Number.isSafeInteger(offset)||offset<0)throw error;snapshot=dynamicUI.inspectControls({offset:0});}controlOffset=snapshot.offset;send({channel,session,op:"view-controls",snapshot},"*")}catch(error){send({channel,session,op:"view-controls-error",error:String(error.message).slice(0,1000)},"*")}};const dynamicUI=(${Ht.toString()})(document,error=>send({channel,session,op:"interface-error",error},"*"),()=>Promise.resolve().then(controlSnapshot));const sharedLifecycle={};const sharedAPI=(${Vt.toString()})(channel,session,${Sa(Bt)},sharedLifecycle);const textControls=${i?`(()=>{${Mt};return StillMadeTextFrame.installTextFrame(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),channel,session,{token:${Sa(o)},send});})()`:`null`};const sharedControls=(${jt.toString()})(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),textControls,${Sa(a)});const {documentTools,sharedDocuments}=(${Nt})(sharedAPI,status=>send({channel,session,op:"document-store-status",status},"*"));const previews=(${St.toString()})((kind,value)=>{if(kind==="media"){if(mediaURLs.size>=2)throw Error("Release a previous media preview before opening another");if(!["video","audio"].includes(value.kind))throw Error("Choose an audio or video reference");}return new Promise((resolve,reject)=>{const id=String(++imageSequence);pendingImage={id,resolve,reject,media:kind==="media"};send({channel,session,op:kind==="media"?"preview-media":"preview-image",id,value},"*")})});const connectionAPI=(${xt.toString()})(${Sa(va)},${Sa(t)},${c},send),workAPI=(${w.toString()})(${Sa(va)},${Sa(t)},${s},send);const api=Object.freeze({...connectionAPI,...workAPI,${u?`asset:frameRuntime.asset,assetBytes:frameRuntime.assetBytes,`:``}connectedApp(...args){controlEffects++;return track(connectionAPI.connectedApp(...args))},sharedWork(...args){controlEffects++;return track(workAPI.sharedWork(...args))},previewSharedWorkMedia(...args){controlEffects++;return track(workAPI.previewSharedWorkMedia(...args))},schemaFields:(${Ut.toString()})(${JSON.stringify(a)}),...sharedAPI,...documentTools,connectDocument:sharedDocuments.connectDocument,bindShared:sharedControls.bindShared,setSharedDefaults:sharedControls.setSharedDefaults,scheduleSharedEdit:sharedControls.scheduleSharedEdit,render:dynamicUI.render,onAction:dynamicUI.onAction,releaseMedia(url){if(mediaURLs.delete(url))URL.revokeObjectURL(url)},previewMedia(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("media",value))},desktop(operation,args={}){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingDesktop)return Promise.reject(Error("A desktop request is already pending"));if(typeof operation!=="string"||JSON.stringify(args).length>131072)return Promise.reject(Error("Invalid desktop request"));return track(new Promise((resolve,reject)=>{const id=String(++desktopSequence);pendingDesktop={id,resolve,reject};send({channel,session,op:"desktop",id,operation,args},"*")}))},get input(){return structuredClone(input)},onInput(fn){if(typeof fn!=="function")throw Error("Expected a function");listeners.add(fn);if(ready)fn(structuredClone(input));return()=>listeners.delete(fn)},useOutput(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingAdopt)return Promise.reject(Error("An output choice is already pending"));let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded output values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++adoptSequence);pendingAdopt={id,resolve,reject};send({channel,session,op:"use-output",id,outputs:values},"*")}))},previewImage(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("image",value))},run(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pending)return Promise.reject(Error("A run is already in progress"));try{dynamicUI.assertCommitted();sharedControls.assertNoComposition();}catch(error){return Promise.reject(error);}let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded input values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++sequence),requested=JSON.parse(serialized),sourceRevision=inputRevision,localRevision=editRevision,call={id,resolve,reject,sent:false};pending=call;Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>{dynamicUI.assertCommitted();sharedControls.assertNoComposition();if(pending!==call||!ready)throw Error("Preview was closed before its edits were saved.");if(inputRevision!==sourceRevision||editRevision!==localRevision)throw Error("The input changed while edits were saving. Review it before running again.");const savedText=textControls?.getValues?.()||{};for(const [key,value] of Object.entries(savedText)){const captured=typeof requested[key]==="string"?requested[key]:typeof requested[key]?.text==="string"?requested[key].text:null;if(captured!==null&&captured!==value)throw Error("The input changed while shared text was saving. Review it before running again.");}if(!sharedAPI.getShared().canEdit)throw Error("Shared editing is unavailable or read only.");call.sent=true;send({channel,session,op:"run",id,input:requested},"*");}).catch(error=>{if(pending===call){pending=null;call.reject(error);}});}))}});Object.defineProperty(globalThis,"StillMade",{value:api,writable:false,configurable:false});addEventListener("message",event=>{if(event.source!==parent||!event.data||event.data.channel!==channel||event.data.session!==session)return;const data=event.data;if(data.op==="inspect-view-controls"){controlSnapshot(data.offset,false);return;}if(data.op==="dispatch-named-text"&&typeof data.id==="string"){Promise.resolve().then(()=>textControls.dispatchNative(data.control,data.id)).then(()=>send({channel,session,op:"named-text-result",token:${Sa(o)},id:data.id},"*"),error=>send({channel,session,op:"named-text-result",token:${Sa(o)},id:data.id,error:String(error.message).slice(0,1000)},"*")).finally(()=>send({channel,session,op:"named-text-controls",token:${Sa(o)},snapshot:textControls.inspectNative()},"*"));return;}if(data.op==="inspect-named-text"){if(textControls)send({channel,session,op:"named-text-controls",token:${Sa(o)},snapshot:textControls.inspectNative()},"*");return;}if(data.op==="dispatch-view-control"&&typeof data.id==="string"){if(assisted){send({channel,session,op:"view-control-result",id:data.id,error:"A declared control is already running"},"*");return;}assisted=true;trackedFailure=null;const controlDocumentSeal=sharedDocuments.captureControlSettlement(),controlSharedSeal=sharedLifecycle.captureControlState(),controlInputRevision=inputRevision,controlEffectRevision=controlEffects;const personalControlUnchanged=()=>controlDocumentSeal&&inputRevision===controlInputRevision&&controlEffects===controlEffectRevision&&JSON.stringify(sharedLifecycle.captureControlState())===JSON.stringify(controlSharedSeal)&&!controlSharedSeal.closed&&controlSharedSeal.ready&&!controlSharedSeal.pending&&!controlSharedSeal.queued&&!controlSharedSeal.failed&&sharedDocuments.unchangedControlSettlement(controlDocumentSeal);dynamicUI.dispatchControl(data.control,async()=>{for(let round=0;round<16;round++){await Promise.allSettled(Array.from(trackedCalls));await dynamicUI.flushAll();await sharedControls.flushAll();if(personalControlUnchanged())await sharedDocuments.settleControl(controlDocumentSeal);else await sharedDocuments.flushAll();await sharedLifecycle.flushSharedWrites();await new Promise(resolve=>setTimeout(resolve,0));if(trackedFailure)throw trackedFailure;if(!trackedCalls.size){if(controlDocumentSeal&&!personalControlUnchanged())await sharedDocuments.flushAll();dynamicUI.assertCommitted();sharedControls.assertNoComposition();return;}}throw Error("Declared action did not settle");}).then(()=>send({channel,session,op:"view-control-result",id:data.id},"*"),error=>send({channel,session,op:"view-control-result",id:data.id,error:String(error?.message||"Declared action failed").slice(0,1000)},"*")).finally(()=>{assisted=false;controlSnapshot()});return;}if(data.op==="flush-shared"&&typeof data.id==="string"){Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>dynamicUI.flushAll()).then(()=>sharedControls.assertNoComposition()).then(()=>send({channel,session,op:"flush-shared-result",id:data.id},"*"),error=>send({channel,session,op:"flush-shared-result",id:data.id,error:String(error?.message||"Pending edits could not be confirmed").slice(0,1000)},"*"));return;}if(data.op==="desktop-result"&&pendingDesktop&&data.id===pendingDesktop.id){const call=pendingDesktop;pendingDesktop=null;data.error?call.reject(Error(data.error)):call.resolve(data.result)}else if(data.op==="use-output-result"&&pendingAdopt&&data.id===pendingAdopt.id){const call=pendingAdopt;pendingAdopt=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="input"){inputRevision+=1;if(pending&&!pending.sent){pending.reject(Error("Preview input changed before its edits were saved."));pending=null;}clearMedia();previews.reset();if(pendingImage)pendingImage.reject(Error("Preview input changed"));pendingImage=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview input changed"));pendingAdopt=null;input=data.input;ready=true;for(const fn of listeners)try{fn(structuredClone(input))}catch(error){send({channel,session,op:"interface-error",error:String(error?.message||"The Block interface could not display its input").slice(0,1000)},"*")}}else if(data.op==="result"&&pending?.sent&&data.id===pending.id){const call=pending;pending=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="preview-media-result"&&pendingImage?.media&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;if(data.error)call.reject(Error(data.error));else{try{const url=URL.createObjectURL(data.preview.blob);mediaURLs.add(url);call.resolve({kind:data.preview.kind,url,mimeType:data.preview.blob.type,bytes:data.preview.blob.size})}catch(error){call.reject(error)}}}else if(data.op==="preview-image-result"&&pendingImage&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;data.error?call.reject(Error(data.error)):call.resolve(data.preview)}else if(data.op==="dispose"){clearMedia();previews.reset("Preview was reset");dynamicUI.dispose();sharedControls.dispose();textControls?.dispose();sharedDocuments.dispose();if(pendingDesktop)pendingDesktop.reject(Error("Block was closed"));pendingDesktop=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview was reset"));pendingAdopt=null;if(pendingImage)pendingImage.reject(Error("Preview was reset"));pendingImage=null;if(pending)pending.reject(Error("Preview was reset"));pending=null;listeners.clear();ready=false}});addEventListener("input",()=>{editRevision+=1;},true);addEventListener("change",()=>{editRevision+=1;},true);addEventListener("compositionstart",()=>{editRevision+=1;},true);addEventListener("keydown",event=>{if(event.key==="Escape")send({channel,session,op:"escape"},"*")},true);addEventListener("click",event=>{if(event.target.closest?.("a,area"))event.preventDefault()},true);send({channel,session,op:"ready"},"*");})();`,_=u?`document.currentScript.remove();for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${Ri(e.javascript||``,h)}`.replace(/<\/script/gi,`<\\/script`):`document.currentScript.remove();((${m})=>{"use strict";delete globalThis[${Sa(m)}];for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${ki(e.javascript||``,m)}\n})(globalThis[${Sa(m)}]);`.replace(/<\/script/gi,`<\\/script`);return`<!doctype html><html data-mode="${[`dark`,`white`].includes(n)?n:`light`}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${p}'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:;${u?` font-src data: blob:;`:``} connect-src 'none'; frame-src 'none'; worker-src ${u?`blob:`:`'none'`}; object-src 'none'; base-uri 'none'; form-action 'none';"><meta name="referrer" content="no-referrer"><style>${Gi.replace(/@font-face\s*\{[^}]*\}/g,``)}${u?xa:ba}${qi}${(f||``).replace(/<\/style/gi,`<\\/style`)}@media(pointer:coarse){input,textarea,select{font-size:16px!important}}</style></head><body>${e.html}<script nonce="${p}">${g.replace(/<\/script/gi,`<\\/script`)}<\/script><script nonce="${p}">document.currentScript.remove();(${Zi.toString()})(${Sa(va)},${Sa(t)});(${Qi.toString()})(${Sa(va)},${Sa(t)});(${Xi.toString()})(${Sa(va)},${Sa(t)},((validateCursorAnchor)=>(${Yi.toString()}))(${Ji.toString()}));<\/script><script nonce="${p}">${_}<\/script></body></html>`}function Ma({view:e,input:t={},sharedView:n=null,presenceKey:r=null,peers:i=[],actorId:a=null,onSharedChange:o,sharedText:s=null,sharedWork:c=null,connectedApp:l=null,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m,policyContent:h,policyParent:g,currentAppViewPolicy:_=null,title:y=`Block preview`,height:b=480,fitContent:w=!1,resetKey:T=0,theme:E,appearance:D=`package`,lockedInputKeys:O=[],agentContext:k=null}){let A=Ta(e),j=Ta(h),M=Ta(g),ee=[`comfyui`,`capability`].includes(j?.manifest?.runtime)||!!j?.manifest?.desktopTools?.length,N=j?.capability?.operation===`image.generate`?9e5:36e4,P=(0,v.useRef)(null),te=(0,v.useRef)({onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m}),ne=(0,v.useRef)(t),[re,F]=(0,v.useState)(``),[ie,ae]=(0,v.useState)(0),oe=(0,v.useRef)(null),se=(0,v.useRef)(null),[ce,le]=(0,v.useState)(null),[ue,de]=(0,v.useState)(null),[fe,pe]=(0,v.useState)(null),[me,he]=(0,v.useState)(null),[ge,_e]=(0,v.useState)(()=>globalThis.document?.documentElement?.dataset.mode||`light`),ve=(0,v.useRef)(`light`);ve.current=[`dark`,`white`].includes(E||ge)?E||ge:`light`;let ye=(0,v.useRef)(l);ye.current=l;let be=(0,v.useRef)(c);be.current=c;let xe=(0,v.useRef)(s);xe.current=s;let Se=(0,v.useRef)(!1),[Ce,we]=(0,v.useState)(()=>({enabled:!!s,projectId:s?.projectId??null,placementId:s?.placementId??null})),Te=()=>{let e={enabled:!!xe.current,projectId:xe.current?.projectId??null,placementId:xe.current?.placementId??null};we(t=>t.enabled===e.enabled&&t.projectId===e.projectId&&t.placementId===e.placementId?t:e)};(0,v.useEffect)(()=>{Se.current||Te()},[!!s,s?.projectId,s?.placementId]);let Ee=Ce.enabled,De=Ce.projectId,Oe=Ce.placementId,ke=!!me?.count&&!!(me.dirty||me.pending||me.error);(0,v.useEffect)(()=>{let e=globalThis.document.documentElement,t=new MutationObserver(()=>_e(e.dataset.mode||`light`));return t.observe(e,{attributes:!0,attributeFilter:[`data-mode`]}),()=>t.disconnect()},[]);let Ae=(0,v.useMemo)(()=>{try{let e=Ca(t);return{value:e,signature:lt(e)}}catch(e){return{error:e.message}}},[t]);te.current={onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m},ne.current=Ae;let[je,Me]=(0,v.useState)(null),Ne=_?je?.handle===_&&je.allowed:!j||je?.content===j&&je.parent===M&&je.allowed;(0,v.useEffect)(()=>{if(!j&&!_)return;let e=!0,t=new AbortController;return Me(null),(_?S(_,{signal:t.signal}):Promise.all([j,...M?[M]:[]].map(e=>ca(e,{signal:t.signal})))).then(()=>{e&&Me({handle:_,content:j,parent:M,allowed:!0})},t=>{e&&(Me({handle:_,content:j,parent:M,allowed:!1,error:t.message}),te.current.onError?.(t))}),()=>{e=!1,t.abort()}},[j,M,_,ie]);let I=Fi(A)&&A.files?A.files:null,[Pe,Fe]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!I||!Ne){Fe(null);return}let e=!0,t=new AbortController;return Fe(null),Promise.resolve().then(()=>(Oi(A),pa(()=>Promise.resolve().then(()=>(_a(),ma)),void 0))).then(({loadViewAssets:e})=>e(I,{signal:t.signal})).then(t=>{e&&Fe({files:I,assets:t})},t=>{e&&Fe({files:I,error:String(t?.message||`The interface files could not be loaded.`)})}),()=>{e=!1,t.abort()}},[A,I,Ne]);let Ie=I?Pe?.files===I?Pe:{loading:!0}:null,Le=JSON.stringify([...new Set(O.filter(e=>typeof e==`string`))].sort()),Re=[A,Ie,T,D,ie,a,r,ee,N,w,Ee,De,Oe,Le,!!j?.manifest?.sharedWork,j?.capability?.operation],ze=(0,v.useRef)(null);if(!ze.current||Re.some((e,t)=>!Object.is(e,ze.current.inputs[t]))){let e;try{if(Ie?.loading)throw Object.assign(Error(`Loading the interface files.`),{loading:!0});if(Ie?.error)throw Error(Ie.error);let t=ya(),n=ya();e={session:t,nativeTextToken:n,html:ja(A,t,ve.current,D,Ee,JSON.parse(Le),n,!!j?.manifest?.sharedWork,j?.capability?.operation===`connection.execute`,{assets:Ie?.assets||{}})}}catch(t){e=t.loading?{loading:!0}:{error:t.message}}ze.current={inputs:Re,document:e}}let L=ze.current.document,Be=(0,v.useMemo)(()=>({state:{},outputs:{},memory:null,canEdit:!0,localOnly:!0}),[L.session]),R=(0,v.useRef)(n);R.current=n??Be;let Ve=(0,v.useRef)(n==null);Ve.current=n==null;let He=(0,v.useRef)({session:null,count:0}),Ue=(0,v.useRef)(null),We=(0,v.useRef)(null),Ge=(0,v.useRef)(null),Ke=(0,v.useRef)(null),qe=(0,v.useRef)(null);Ke.current={key:r,peers:i,actorId:a};let Je=(0,v.useRef)(null),Ye=(0,v.useRef)(null);Ye.current={input:Ae.signature,error:Ae.error,view:A,policyContent:j,policyParent:M,resetKey:T,appearance:D,policyReady:Ne};let Xe=(0,v.useRef)(null);Xe.current=lt([k?.projectId,k?.placementId,k?.sourceDigest,a].map(e=>e??null));let[Ze,Qe]=(0,v.useState)(null),$e=lt([Ct(),a,Xe.current,L.session,Ae.signature,Ne].map(e=>e??null));(0,v.useEffect)(()=>{let e=!0;if(Qe(null),!k?.projectId||!k?.placementId||!k?.sourceDigest||Ae.error||!Ne||a!==Ct())return()=>{e=!1};let t=$e;return ut(Ae.value).then(n=>{e&&Qe({basis:t,value:{version:1,actorId:a,projectId:k.projectId,placementId:k.placementId,sourceDigest:k.sourceDigest,inputDigest:n}})},()=>{e&&Qe(null)}),()=>{e=!1}},[$e]),Ze?.basis===$e&&Ze.value;let[et,tt]=(0,v.useState)(null),nt=(0,v.useRef)(null),rt=(0,v.useRef)(null),[it,at]=(0,v.useState)(null),[ot,st]=(0,v.useState)(!1),[ct,dt]=(0,v.useState)(!1),[z,ft]=(0,v.useState)(null);z&&z.actor===a&&z.runtimeActor===Ct()&&z.identity===Xe.current&&z.session===L.session&&Object.keys(z.authority).every(e=>z.authority[e]===Ye.current[e])&&z.evidence,{...k},j?.manifest?.id,j?.manifest?.version,L.session,Ae.signature,R.current?.canEdit,{...k},L.session,Ae.signature,R.current?.canEdit,(0,v.useEffect)(()=>{if(tt(null),at(null),dt(!1),st(!1),ft(null),F(``),de(null),pe(null),he(null),L.error||L.loading||!Ne)return;let e=!0,t=!1,n=!1,i=null,o=null,s=null,c=0,l=0,u=[],d=[],f=0,p=0,m,h=0,g=null,_=[],v=0,y=null,b=0,x=0,S=null,T=Fi(A),E=()=>{let t;return t=Kt(j,{onStatus:n=>{e&&m===t&&le(n)},storageScope:`${a||`anonymous`}:${r||`preview`}`}),t};m=E(),oe.current=m,le(null);let D=()=>{if(!e||!R.current?.canEdit)return;let t=m;m=E(),oe.current=m,g=null,le(null),Promise.resolve(t.close()).catch(()=>{})};se.current=D;let O=t=>{e&&P.current?.contentWindow?.postMessage({channel:va,session:L.session,...t},`*`)},k=null,M=null,re=0,ie=!1,ae=a,ce=Ye.current,ue=Xe.current,fe=(t,n)=>{if(!e||ie||t?.signal?.aborted||Ct()!==ae||Xe.current!==ue||M&&ne.current.signature!==M.inputIdentity||k&&ne.current.signature!==k.inputIdentity&&ne.current.signature!==n||Object.keys(ce).filter(e=>e!==`input`).some(e=>ce[e]!==Ye.current[e]))throw ie=!0,dt(!1),Error(`The declared interface source, account or task changed. Reload the preview before further assisted edits.`)},me=e=>{if(!k)return;let t=k;k=null,clearTimeout(t.timer),t.context?.signal?.removeEventListener(`abort`,t.abort),st(!1),t.reject(e)};rt.current={request:(e,n,r={})=>new Promise((a,o)=>{try{if(fe(r),!t||k)throw Error(`The declared interface is loading or busy.`);if(e===`dispatch-view-control`&&!r.taskFence)throw Error(`The declared interface requires its active project task.`);let s=String(++re),c=()=>{ie=!0,dt(!1),i?.abort(),me(Error(`Declared action stopped; reload the preview before more assisted edits.`))},l=setTimeout(c,N);k={id:s,op:e,inputIdentity:ne.current.signature,offset:n.offset,context:r,resolve:a,reject:o,timer:l,abort:c},r.signal?.addEventListener(`abort`,c,{once:!0}),e===`dispatch-view-control`&&st(!0),O({op:e,id:s,...n})}catch(e){o(e)}})},nt.current={request:(e,n)=>new Promise((r,i)=>{try{if(fe(n),!t||k||M||!n.taskFence||n.signal?.aborted)throw Error(`The original text requires its idle current task.`);let a=String(++re),o=()=>{ie=!0,dt(!1),M?.id===a&&(M=null,st(!1),i(Error(`Original text stopped; retain its pending request.`)))},s=setTimeout(o,N);M={id:a,field:e.field,inputIdentity:ne.current.signature,context:n,resolve:r,reject:i,timer:s,abort:o},n.signal?.addEventListener(`abort`,o,{once:!0}),st(!0),O({op:`dispatch-named-text`,id:a,control:e})}catch(e){i(e)}})};let ge=()=>{if(ie)throw Error(`This previous assisted interface is no longer writable. Reload it to recover.`);return k?.op===`dispatch-view-control`?(fe(k.context),k.context):null},_e=!1,Ce=0,we=[],ke=0,Ae=!1,je=0,Me=[],I=0,Pe=0,Fe=[],Ie=null,Le=!1,Re={projectId:De,placementId:Oe,actorId:a},ze=()=>e&&xe.current?.projectId===Re.projectId&&xe.current?.placementId===Re.placementId,Be=e=>({message:String(e?.message||`Shared text failed.`).slice(0,1e3),...typeof e?.code==`string`&&/^[A-Z][A-Z0-9_]{0,79}$/.test(e.code)?{code:e.code}:{}}),He=xe.current?.projectId&&a?Pt({projectId:xe.current.projectId,actorId:a,headers:Ft,onChange:e=>{if(ze()){if(e.kind===`revoked`){Le=!0,O({op:`shared-view`,value:{...R.current,canEdit:!1}});return}[`text`,`document`,`resync`].includes(e.kind)&&(e.scope&&e.scope!==`canvas`||Ie===null&&(Ie=setTimeout(()=>{Ie=null,t&&ze()&&!Le&&O({op:`text-refresh`})},100)))}}}):null,Ze=be.current?.projectId&&a?Pt({projectId:be.current.projectId,actorId:a,headers:Ft,onChange:e=>{t&&[`document`,`resync`,`revoked`,`connection-access`].includes(e.kind)&&(ke++,O({op:`shared-work-refresh`}))}}):null,Qe=()=>{t&&O({op:`theme`,mode:ve.current})};qe.current=Qe;let $e=`[]`,et=()=>{if(!t)return;let{key:e,peers:n,actorId:r}=Ke.current,i=!Ve.current&&e&&localStorage.getItem(`stillmade:show-shared-cursors`)!==`false`?n.filter(t=>t.user_id!==r&&t.selection?.cursor?.visible&&t.selection.cursor.surface===e).slice(0,50).flatMap(e=>{let t=Ji(e.selection.cursor.anchor);return t?[{id:String(e.session_id).slice(0,200),label:String(e.label||`Teammate`).slice(0,120),anchor:t}]:[]}):[],a=JSON.stringify(i);a!==$e&&($e=a,O({op:`peer-cursors`,peers:i}))};Ge.current=et,window.addEventListener(`stillmade:cursor-preferences`,et),window.addEventListener(`storage`,et);let it=e=>{F(e),te.current.onError?.(Error(e))},ot=()=>{e&&(clearInterval(y),S?.disconnect(),it(`This interface stopped responding and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))};Ue.current=T?()=>{e&&(clearInterval(y),it(`This interface tried to leave its frame and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))}:null;let ct=()=>{if(typeof PerformanceObserver!=`function`||!PerformanceObserver.supportedEntryTypes?.includes(`longtask`))return;let e=[],t=e=>Array.from(e.attribution||[]).some(e=>e.containerType===`iframe`&&typeof e.containerSrc==`string`&&e.containerSrc.endsWith(`#${L.session}`));S=new PerformanceObserver(n=>{for(let r of n.getEntries()){if(!t(r))continue;let n=r.startTime+r.duration;if(e=e.filter(e=>e.end>n-5e3),e.push({end:n,duration:r.duration}),r.duration>=Ai.longTaskMs||e.reduce((e,t)=>e+t.duration,0)>=3500)return ot()}});try{S.observe({type:`longtask`})}catch{S=null}},ut=()=>{b=Date.now(),y=setInterval(()=>{if(!e)return clearInterval(y);if(globalThis.document.visibilityState!==`hidden`&&Date.now()-b>8e3)return ot();O({op:`ping`,id:String(++x)})},2e3)},z=setTimeout(()=>{e&&!t&&(it(`The preview could not start. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))},15e3),pt=e=>{let t=o;t&&(ft(null),o=null,t.controller.abort(),e&&O({op:t.media?`preview-media-result`:`preview-image-result`,id:t.id,error:e}))},mt=()=>{if(!t)return;let e=ne.current;if(e.error){pt(`Preview input is unavailable.`),it(e.error);return}s!==e.signature&&(pt(`Preview input changed. Use its current image.`),s=e.signature,O({op:`input`,input:e.value}))};Je.current=mt;let ht=null,gt=!1,_t=0,vt=[],yt=null,xt=0,St=null,wt=At(()=>{if(Ve.current||!t)return Promise.resolve();if(!e)return Promise.reject(Error(`The Block interface is unavailable. Its latest edits could not be checked.`));if(yt)return yt.promise;let n=String(++xt),r,i,a=new Promise((e,t)=>{r=e,i=t}),o=setTimeout(()=>{yt?.id===n&&(yt=null,i(Error(`The Block did not confirm its pending edits. Stay here to recover the draft.`)))},17e3);return yt={id:n,promise:a,resolve:r,reject:i,timer:o},O({op:`flush-shared`,id:n}),a}),Tt=()=>{if(t&&R.current)try{let e=Ca(R.current),t=lt(e);if(t===ht)return;ht=t,O({op:`shared-view`,value:e})}catch(e){it(e.message)}};We.current=Tt;let Dt=t=>{e&&Ve.current&&(R.current.outputs=t,Tt())},Ot=r=>{let s=r.data;if(T&&e&&B(s)&&s.op===`navigated`&&s.channel===va&&s.session===L.session&&(r.source===null||r.source===P.current?.contentWindow)){Ue.current?.();return}if(!e||r.source!==P.current?.contentWindow||!B(s)||s.channel!==va||s.session!==L.session)return;if(s.op===`document-ready`){n||(n=!0,O({op:`document`,html:L.html}));return}if(s.op===`ready`){t||(t=!0,clearTimeout(z),T&&(ut(),ct()),Qe(),mt(),Tt(),et(),O({op:`inspect-view-controls`,offset:0}),O({op:`inspect-named-text`}));return}if(s.op===`flush-shared-result`){if(!yt||s.id!==yt.id)return;let e=yt;yt=null,clearTimeout(e.timer);let t=s.error||St;t?e.reject(Error(String(t).slice(0,1e3))):e.resolve({queued:!0});return}if(s.op===`escape`){let e=Date.now();globalThis.document.activeElement===P.current&&e-v>=300&&(v=e,window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0})));return}if(s.op===`pong`){T&&typeof s.id==`string`&&(b=Date.now());return}if(s.op===`unresponsive`){T&&ot();return}if(s.op===`interface-error`){it(String(s.error||`The Block interface could not display its input`).slice(0,1e3));return}if(s.op===`document-store-status`){let e=s.status;B(e)&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=8)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&pe(e);return}if(s.op===`text-recovery-status`){let e=s.status;Ee&&B(e)&&Object.keys(e).every(e=>[`count`,`dirty`,`pending`,`readonly`,`error`,`retryable`].includes(e))&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=100)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&typeof e.retryable==`boolean`&&he(e);return}if(!t)return;if(s.op===`named-text-controls`){if(s.token===L.nativeTextToken&&Array.isArray(s.snapshot)&&s.snapshot.length<=50){let e=Ca(s.snapshot);e.every(e=>B(e)&&typeof e.field==`string`&&typeof e.identity==`string`&&typeof e.value==`string`&&e.value.length<=1e4&&typeof e.partial==`boolean`&&typeof e.ready==`boolean`&&typeof e.disabled==`boolean`)&&tt(e)}return}if(s.op===`named-text-result`){let e=M;if(!e||s.id!==e.id||s.token!==L.nativeTextToken)return;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));e.resolve()}catch(t){e.reject(t)}finally{M=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),st(!1)}return}if(s.op===`view-controls`){try{let e=Ca(s.snapshot);if(!B(e)||!Number.isSafeInteger(e.revision)||!Number.isSafeInteger(e.total)||e.total<0||e.total>1e4||!Number.isSafeInteger(e.offset)||!Array.isArray(e.controls)||e.controls.length>20||e.controls.some(e=>!B(e)||typeof e.id!=`string`||typeof e.identity!=`string`||typeof e.action!=`string`||typeof e.disabled!=`boolean`||typeof e.hidden!=`boolean`))throw Error(`Invalid declared interface controls.`);if(at(e),dt(!ie),k?.op===`inspect-view-controls`&&e.offset===k.offset){let e=k;fe(e.context),k=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),e.resolve()}}catch(e){me(e)}return}if(s.op===`view-controls-error`){me(Error(String(s.error||`Declared controls are unavailable.`).slice(0,1e3)));return}if(s.op===`view-control-result`){if(k?.op!==`dispatch-view-control`||s.id!==k.id)return;let e=k;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));k=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),st(!1),e.resolve()}catch(e){me(e)}return}if(s.op===`connected-app-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Ce)return;Ce=Number(s.id);let t=e=>O({op:`connected-app-result`,id:s.id,...e}),n=ye.current,r=Ye.current;we=we.filter(e=>Date.now()-e<6e4);try{if(j?.capability?.operation!==`connection.execute`||!n?.request)throw Error(`Open the saved connected Block to choose its task.`);let i=bt(s.operation,Ca(s.args));if(i.operation!==`tasks`&&!R.current?.canEdit)throw Error(`This workspace is read only.`);if(_e||we.length>=30)throw Error(`Wait for the current task request.`);_e=!0,we.push(Date.now()),Promise.resolve().then(()=>n.request(i.operation,i.args)).then(i=>{if(!e||n.projectId!==ye.current?.projectId||n.placementId!==ye.current?.placementId||Object.keys(r).some(e=>r[e]!==Ye.current[e]))throw Error(`The installed app changed. Open its current workspace.`);t({result:Ca(i)})},e=>t({error:String(e.message||`Task selection failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{_e=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-media-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=je)return;je=Number(s.id);let t=be.current,n=Ye.current,r=ke,i=e=>O({op:`shared-work-result`,id:s.id,...e});try{if(!j?.manifest?.sharedWork||!j.manifest.permissions?.project?.includes(`work.shared`)||!t?.previewMedia||typeof s.contributionId!=`string`||!/^[0-9a-f-]{36}$/i.test(s.contributionId))throw Error(`Choose a permitted saved creative in this workspace.`);if(Me=Me.filter(e=>Date.now()-e<6e4),Ae||Me.length>=60)throw Error(`Wait for the current media preview.`);Ae=!0,Me.push(Date.now()),Promise.resolve().then(()=>t.previewMedia(s.contributionId,{signal:AbortSignal.timeout(3e4)})).then(t=>{if(!e||r!==ke||Object.keys(n).some(e=>n[e]!==Ye.current[e]))throw Error(`This workspace changed before the creative preview.`);if(!(t.media instanceof Blob)||!t.media.size||t.media.size>67108864||![`image`,`video`,`audio`].includes(t.kind)||!t.media.type.startsWith(t.kind+`/`))throw Error(`This preview exceeds the media limit.`);i(t)},e=>i({error:String(e.message||`Media preview failed.`).slice(0,1e3)})).catch(e=>i({error:String(e.message).slice(0,1e3)})).finally(()=>{Ae=!1})}catch(e){i({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=je)return;je=Number(s.id);let t=e=>O({op:`shared-work-result`,id:s.id,...e}),n=be.current,r=Ye.current,i=ke;Me=Me.filter(e=>Date.now()-e<6e4);try{if(!j?.manifest?.permissions?.project?.includes(`work.shared`)||!j.manifest.sharedWork||!n?.request)throw Error(`Shared work is unavailable in this preview. Open the saved Block in its project.`);let a=C(s.operation,Ca(s.args));if(![`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation)&&!R.current?.canEdit)throw Error(`This workspace is read only.`);if(Ae||Me.length>=60)throw Error(`Wait for the current shared-work request.`);Ae=!0,Me.push(Date.now()),Promise.resolve().then(()=>n.request(a.operation,a.args)).then(o=>{if(!e||n.projectId!==be.current?.projectId||n.placementId!==be.current?.placementId||Object.keys(r).some(e=>r[e]!==Ye.current[e]))throw Error(`This Block changed before the shared-work response. Reopen its current version.`);if(i!==ke){if([`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation))throw Error(`Saved-work access changed. Read its current version.`);t({result:{saved:!0,refreshRequired:!0}});return}t({result:Ca(o)})},e=>t({error:String(e.message||`Shared work failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{Ae=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`text-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Pe)return;Pe=Number(s.id);let e=e=>O({op:`text-result`,id:s.id,...e}),t=xe.current,n=ne.current.signature,r=Ye.current;if(Fe=Fe.filter(e=>Date.now()-e<6e4),!Ee||!ze()||!t||typeof t.request!=`function`||![`read`,`initialize`,`update`,`reset`].includes(s.action)||typeof s.key!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(s.key)||[`constructor`,`prototype`,`__proto__`].includes(s.key)){e({error:{message:`Shared text is unavailable for this field.`}});return}if(I>=16||Fe.length>=1200){e({error:{message:`Shared text requests are arriving too quickly. Your draft is retained.`}});return}let i=()=>{if(!ze()||ne.current.error||ne.current.signature!==n||Object.keys(r).some(e=>r[e]!==Ye.current[e]))throw Error(`Shared text input or workspace changed. Your draft is retained.`);if(Le||s.action!==`read`&&!R.current?.canEdit)throw Object.assign(Error(`Shared text is read only.`),{code:`READ_ONLY`})},a;try{if(i(),a=Ca(s.body),!B(a)||new TextEncoder().encode(JSON.stringify(a)).length>5e4||Object.keys(a).some(e=>![`protocol`,`requestId`,`sourceIdentity`,`epoch`,`textRevision`,`value`,`update`].includes(e)))throw Error(`Invalid shared text request.`)}catch(t){e({error:Be(t)});return}I++,Fe.push(Date.now()),Promise.resolve().then(async()=>{if(i(),ge()&&s.action!==`read`)throw Error(`Assisted shared-text writes require a task-safe native commit interface; this control is unavailable.`);try{let e=M,n;if(e&&s.action!==`read`){if(fe(e.context),s.action!==`update`||s.key!==e.field||s.nativeText?.token!==L.nativeTextToken||s.nativeText?.callId!==e.id)throw Error(`Unrelated text events cannot use this native task.`);n=e.context}else if(s.nativeText)throw Error(`The original text invocation is no longer current; do not replay.`);return await t.request(s.action,{...a,placementId:t.placementId,fieldKey:s.key},n)}catch(e){if(s.action===`read`&&e.code===`SHARED_TEXT_FIELD_UNSUPPORTED`&&typeof R.current?.state?.[s.key]!=`string`)return{unsupported:!0};throw e}}).then(t=>{i(),e({result:Ca(t)})}).catch(t=>e({error:Be(t)})).finally(()=>{I--});return}if(s.op===`cursor`){let e=s.cursor;if(B(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1){let t=P.current?.getBoundingClientRect(),n=Ji(e.anchor),r=Ke.current.key;t&&window.dispatchEvent(new CustomEvent(`stillmade:sandbox-cursor`,{detail:{x:(t.left+e.x*t.width)/Math.max(1,window.innerWidth),y:(t.top+e.y*t.height)/Math.max(1,window.innerHeight),visible:e.visible!==!1,...n&&typeof r==`string`&&r.length>0&&r.length<=200&&!Ve.current?{anchor:n,surface:r}:{}}}))}return}if(s.op===`shared-view-update`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=_t)return;_t=Number(s.id);let t=e=>{St=e.error?String(e.error):null,O({op:`shared-view-result`,id:s.id,...e})};if(vt=vt.filter(e=>Date.now()-e<6e4),gt||vt.length>=240){t({error:`Shared edits are arriving too quickly. Wait and retry.`});return}if(!R.current?.canEdit||!Ve.current&&typeof te.current.onSharedChange!=`function`){t({error:`Shared editing is unavailable or read only.`});return}let n;try{if(n=Ca(s.request),new TextEncoder().encode(JSON.stringify(n)).length>Bt.requestBytes)throw Error(`Shared edit exceeds the limit`)}catch(e){t({error:e.message});return}gt=!0,vt.push(Date.now()),Promise.resolve().then(()=>{if(!e||!R.current?.canEdit)throw Error(`Shared editing is unavailable or read only.`);if(ge(),Ve.current){R.current.state=V(R.current.state,n),Tt();return}let t=ge();return te.current.onSharedChange(n,t||void 0)}).then(()=>t({queued:!0}),e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{gt=!1});return}if(s.op===`content-size`){w&&Number.isInteger(s.height)&&s.height>0&&s.height<=1e5&&de(Math.max(280,Math.min(3e4,s.height)));return}if(s.op===`desktop`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=h)return;h=Number(s.id);let t=e=>O({op:`desktop-result`,id:s.id,...e});if(_=_.filter(e=>Date.now()-e<6e4),g||_.length>=120){t({error:`Too many desktop requests. Wait before trying again.`});return}let n;try{if(n=Ca(s.args||{}),JSON.stringify(n).length>131072||!B(n))throw Error(`Desktop arguments exceed the limit`)}catch(e){t({error:e.message});return}let r=![`tool.status`,`storage.info`,`storage.list`,`storage.read`,`record.cancel`,`session.close`].includes(s.operation);if(r&&!R.current?.canEdit){t({error:`Desktop changes are unavailable while this workspace is read only.`});return}let i={native:m};_.push(Date.now()),g=i,Promise.resolve().then(()=>{if(!e||i.native!==m||r&&!R.current?.canEdit)throw Error(`Desktop access or edit permission changed before this request.`);if(ge()&&r)throw Error(`Assisted desktop mutations require a task-safe native interface; this control is unavailable.`);return i.native.call(s.operation,n)}).then(n=>{if(!e||i.native!==m||r&&!R.current?.canEdit)throw Error(`Desktop access or edit permission changed before this result could be used.`);t({result:Ca(n)})},e=>t({error:String(e.message).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{g===i&&(g=null)});return}if(s.op===`use-output`){if(typeof s.id!=`string`||!/^[0-9]{1,9}$/.test(s.id))return;let e=e=>O({op:`use-output-result`,id:s.id,...e});try{if(ge())throw Error(`Assisted media adoption requires a task-safe native commit interface; this control is unavailable.`);if(T&&!R.current?.canEdit)throw Error(`This workspace is read only.`);let t=Ca(s.outputs),n=te.current.onUseOutput;if(typeof n!=`function`)throw Error(`Choosing an existing media output is unavailable in this workspace.`);Oa(t,ne.current.value,m),Promise.resolve(n(t)).then(t=>{let n=Ca(t);Dt(n),e({outputs:n})},t=>e({error:String(t?.message||`The media output could not be saved`).slice(0,1e3)}))}catch(t){e({error:String(t.message).slice(0,1e3)})}return}if(s.op===`preview-image`||s.op===`preview-media`){let t=s.op===`preview-media`;if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=l)return;ft(null),l=Number(s.id);let n=e=>O({op:t?`preview-media-result`:`preview-image-result`,id:s.id,...e}),r=Date.now();if(d=d.filter(e=>r-e<6e4),o||d.length>=yi.imagePreviewsPerMinute){++p<=3&&n({error:o?`An image preview is already loading`:`Image preview limit reached. Wait a minute before trying again.`}),p===4&&(it(`Preview paused after too many image requests. Reset it to continue.`),e=!1,pt(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}d.push(r);let c;try{if(c=t?Ca(s.value):ka(s.value),t&&(!B(c)||![`video`,`audio`].includes(c.kind)||![`assetId`,`versionId`,`url`].every(e=>typeof c[e]==`string`&&c[e].length>0&&c[e].length<=32768)))throw Error(`Keep the complete audio or video reference supplied by this workspace.`)}catch(e){n({error:e.message});return}let u=t?te.current.onPreviewMedia:te.current.onPreviewImage;if(typeof u!=`function`){n({error:t?`Audio/video preview is unavailable in this workspace.`:`Image preview is unavailable in this workspace. Choose an image with the host controls.`});return}let f=new AbortController,m=Ye.current,h={controller:f,id:s.id,media:t};o=h;let g=Xe.current,_=a,v=Ct(),y=()=>{if(f.signal.aborted||v!==Ct()||g!==Xe.current||Object.keys(m).some(e=>m[e]!==Ye.current[e]))throw Error(`Image preview input or workspace changed.`)},b=setTimeout(()=>{e&&o===h&&pt(`Image preview timed out. Try a smaller image.`)},yi.imagePreviewMs);f.signal.addEventListener(`abort`,()=>clearTimeout(b),{once:!0}),Promise.resolve().then(()=>(y(),u(c,{signal:f.signal}))).then(r=>{if(e&&!f.signal.aborted&&o===h){if(y(),t&&r?.kind!==c.kind)throw Error(`The host returned a different media kind.`);let e=t?Et(r):Aa(r);y(),typeof c.assetId==`string`&&c.assetId.length<=512&&typeof c.versionId==`string`&&c.versionId.length<=512&&ft({actor:_,runtimeActor:v,identity:g,session:L.session,authority:m,evidence:{assetId:c.assetId,versionId:c.versionId,kind:t?e.kind:`image`,mime:t?e.blob.type:`image/png`,...t?{byteLength:e.blob.size}:{width:e.width,height:e.height},status:`broker-loaded`}}),n({preview:e})}},t=>{e&&!f.signal.aborted&&o===h&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).catch(t=>{e&&!f.signal.aborted&&o===h&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).finally(()=>{clearTimeout(b),o===h&&(o=null)});return}if(s.op!==`run`||typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=c)return;c=Number(s.id);let y=e=>O({op:`result`,id:s.id,...e});if(T&&!R.current?.canEdit){y({error:`Shared editing is unavailable or read only.`});return}let x=Date.now();if(u=u.filter(e=>x-e<6e4),i||u.length>=yi.runsPerMinute){++f<=3&&y({error:i?`A run is already in progress`:`Preview run limit reached. Wait a minute before trying again.`}),f===4&&(it(`Preview paused after too many requests. Reset it to continue.`),e=!1,pt(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}let S;try{if(!B(s.input))throw Error(`Expected input values`);S=Ca(s.input)}catch(e){y({error:e.message});return}u.push(x),F(``);let E=new AbortController;i=E,Se.current=!0,k?.context.signal?.addEventListener(`abort`,()=>E.abort(),{once:!0});let D=setTimeout(()=>{e&&i===E&&(E.abort(),i=null,y({error:ee?`Preview confirmation or execution timed out. Cancellation was requested; the backend may still be finishing.`:`Preview execution timed out. Try a smaller input.`}))},ee?N:15e3);E.signal.addEventListener(`abort`,()=>clearTimeout(D),{once:!0});let A=k?.op===`dispatch-view-control`?k:null,re=A?async e=>{if(k!==A||i!==E||E.signal.aborted||!B(e)||e.receipt?.status!==`completed`||e.receipt.saved!==!0||lt(e.taskFence)!==lt(A.context.taskFence)||lt([e.projectId,e.placementId,e.sourceDigest,e.actorId])!==ue||lt(Ca(e.beforeInput))!==A.inputIdentity)throw Error(`The native input commit does not match this active declared action.`);let t=lt(Ca(e.input));for(let e=0;e<25&&ne.current.signature!==t;e++)if(fe(A.context,t),await new Promise(e=>setTimeout(e,10)),k!==A||i!==E||E.signal.aborted)throw Error(`The native input commit was stopped before its render.`);if(fe(A.context,t),ne.current.signature!==t)throw Error(`The native input commit does not match the current rendered inputs.`);A.inputIdentity=t}:void 0;Promise.resolve().then(()=>te.current.onRun(S,{...ge(),signal:E.signal,...re?{onInputCommitted:re}:{},...j?.manifest?.desktopTools?.length?{nativeDesktopSession:m}:{}})).then(t=>{if(e&&!E.signal.aborted){if(!B(t))throw Error(`Block execution must return named outputs`);let e=Ca(t);Dt(e),y({outputs:e})}},t=>{e&&!E.signal.aborted&&y({error:String(t?.message||`The Block could not run`).slice(0,1e3)})}).catch(t=>{e&&!E.signal.aborted&&y({error:String(t.message).slice(0,1e3)})}).finally(()=>{clearTimeout(D),i===E&&(i=null),Se.current=!1,setTimeout(()=>{e&&!Se.current&&Te()},250)})};return window.addEventListener(`message`,Ot),()=>{M&&=(clearTimeout(M.timer),M.context.signal?.removeEventListener(`abort`,M.abort),M.reject(Error(`Original text closed; retain its pending request.`)),null),nt.current=null,me(Error(`The declared interface was closed.`)),rt.current=null,He?.(),Ze?.(),clearTimeout(Ie),wt(),yt&&=(clearTimeout(yt.timer),yt.reject(Error(`Block closed before pending edits were confirmed.`)),null),clearTimeout(z),clearInterval(y),S?.disconnect(),O({op:`dispose`}),e=!1,m.close(),oe.current===m&&(oe.current=null),se.current===D&&(se.current=null),pt(),i?.abort(),Se.current=!1,window.removeEventListener(`message`,Ot),window.removeEventListener(`stillmade:cursor-preferences`,et),window.removeEventListener(`storage`,et),Ge.current=null,Je.current=null,We.current=null}},[L,Ne,ee,N,w,r,a,De,Oe]),(0,v.useEffect)(()=>{Je.current?.()},[t]),(0,v.useEffect)(()=>{We.current?.(),n?.canEdit===!1&&Promise.resolve(oe.current?.close()).catch(()=>{})},[n,Ne]),(0,v.useEffect)(()=>{Ge.current?.()},[i,r,a,n]),(0,v.useEffect)(()=>{qe.current?.()},[E,ge]);let pt=!!globalThis.stillmadeDesktop?.blockDesktop;return(0,Z.jsxs)(`div`,{className:`bs-sandbox-ui`,children:[ce?.awaitingStart&&(0,Z.jsxs)(`div`,{className:`bs-notice`,role:`status`,children:[(0,Z.jsx)(`p`,{children:`Ready to record. Choose your screen or window after pressing Start.`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn`,onClick:ce.start,children:`Start screen recording`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>oe.current?.close(),children:`Cancel`})]}),ce?.active&&(0,Z.jsxs)(`div`,{role:`status`,className:`bs-notice`,children:[(0,Z.jsxs)(`strong`,{children:[`Recording `,ce.kind||`media`]}),(0,Z.jsx)(`span`,{children:` · This Block has temporary desktop access.`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>oe.current?.close(),children:`Cancel recording and revoke access`})]}),pt&&ce?.closed&&j?.manifest?.permissions?.desktop?.length>0&&(0,Z.jsx)(`button`,{type:`button`,className:`btn`,disabled:!Ne||!R.current?.canEdit,onClick:()=>se.current?.(),children:`Reopen desktop access`}),pt&&!ce?.closed&&!ce?.active&&j?.manifest?.permissions?.desktop?.length>0&&(0,Z.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>oe.current?.close(),children:`Revoke this Block’s desktop access`}),L.loading?(0,Z.jsx)(`p`,{role:`status`,children:`Loading the interface…`}):L.error?(0,Z.jsxs)(`p`,{role:`alert`,children:[`This interface cannot be previewed: `,L.error]}):Ne?(0,Z.jsx)(`iframe`,{ref:P,onLoad:()=>{He.current.session!==L.session&&(He.current={session:L.session,count:0}),++He.current.count>2&&Ue.current?.()},title:y,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,src:`${x(`/block-ui-sandbox.html`)}#${L.session}`,style:{width:`100%`,height:w&&ue||b,minHeight:280,border:`1px solid var(--border-tok)`,borderRadius:`var(--r-3)`,background:`var(--bg)`}},L.session):(0,Z.jsx)(`p`,{role:je?.error?`alert`:`status`,children:je?.error||`Checking Block safety…`}),fe?.count>0&&(fe.error?(0,Z.jsx)(`p`,{role:`alert`,className:`bs-notice`,children:fe.error}):fe.dirty||fe.pending?(0,Z.jsx)(`p`,{role:`status`,className:`bs-notice`,children:`Sharing changes…`}):null),me?.count>0&&(me.error||me.dirty||me.pending)?(0,Z.jsxs)(`div`,{className:`bs-notice`,role:me.error?`alert`:`status`,children:[(0,Z.jsx)(`p`,{children:me.error||`Saving shared text…`}),me.error&&(0,Z.jsx)(`p`,{children:`Your text is retained here. Copy it before leaving; reloading cannot safely recover an unacknowledged draft.`}),me.retryable&&(0,Z.jsx)(`button`,{type:`button`,className:`btn`,disabled:me.pending>0||!R.current?.canEdit,onClick:()=>P.current?.contentWindow?.postMessage({channel:va,session:L.session,op:`text-retry`},`*`),children:`Retry save`})]}):null,(re||je?.error)&&(0,Z.jsxs)(Z.Fragment,{children:[re&&(0,Z.jsx)(`p`,{role:`alert`,children:re}),(0,Z.jsx)(`button`,{type:`button`,className:`btn`,disabled:ke,onClick:()=>{ke||ae(e=>e+1)},children:`Reload preview`})]})]})}var Na=[[`light`,`Light`],[`dark`,`Dark`],[`white`,`White`]],Pa=[[`full`,`Full width`,null],[`tablet`,`Tablet`,768],[`phone`,`Phone`,390]],Fa=e=>{let t=JSON.stringify(e);return t.length>160?`${t.slice(0,157)}...`:t},Ia=(e,t)=>{try{return localStorage.getItem(e)||t}catch{return t}},La=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};async function Ra(e){return(await fetch(`/__dev/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({input:e})})).json()}async function za(e,{signal:t}={}){if(typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`))throw Error(`The local preview shows stand-in media and files mapped in tests/mocks.json.`);let n=await fetch(e.url,{signal:t});if(!n.ok)throw Error(`This image is not available in the local preview. Map it to a file under files in tests/mocks.json.`);let r=await createImageBitmap(await n.blob()),i=Math.min(1,512/Math.max(r.width,r.height)),a=document.createElement(`canvas`);return a.width=Math.max(1,Math.round(r.width*i)),a.height=Math.max(1,Math.round(r.height*i)),a.getContext(`2d`).drawImage(r,0,0,a.width,a.height),r.close?.(),{url:a.toDataURL(`image/png`),width:a.width,height:a.height}}function Ba(e,{signal:t}={}){return typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`)?Promise.reject(Error(`The local preview plays stand-in media and files mapped in tests/mocks.json.`)):Ot(e,{signal:t})}function Va({value:e,onCommit:t,disabled:n}){let r=(0,v.useMemo)(()=>JSON.stringify(e,null,2),[e]),[i,a]=(0,v.useState)(r),[o,s]=(0,v.useState)(``);return(0,v.useEffect)(()=>{a(r),s(``)},[r]),(0,Z.jsxs)(`div`,{className:`dh-input`,children:[(0,Z.jsx)(`textarea`,{"aria-label":`Input JSON`,spellCheck:!1,rows:8,value:i,disabled:n,onChange:e=>a(e.target.value),onBlur:()=>{if(i!==r)try{let e=JSON.parse(i||`{}`);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`The input is one JSON object, keyed by input port.`);s(``),t(e)}catch(e){s(e.message)}}}),o&&(0,Z.jsx)(`p`,{role:`alert`,children:o})]})}var Ha=(0,v.memo)(function({entries:e,onClear:t}){let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,Z.jsxs)(`section`,{className:`dh-console`,"aria-label":`Console`,children:[(0,Z.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Z.jsx)(`h2`,{children:`Console`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,disabled:!e.length,children:`Clear`})]}),(0,Z.jsx)(`ol`,{ref:n,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`dh-entry dh-${e.kind}`,children:[(0,Z.jsx)(`time`,{children:e.time}),(0,Z.jsx)(`span`,{className:`dh-kind`,children:e.label}),(0,Z.jsx)(`pre`,{children:e.text})]},e.id))}),!e.length&&(0,Z.jsx)(`p`,{className:`dh-muted`,children:`Runs, logs, stand-ins, reloads and errors appear here.`})]})}),Ua={run:`Run`,log:`Log`,"stand-in":`Stand-in`,reload:`Reload`,build:`Build`,error:`Error`,view:`View`};function Wa(){let[e,t]=(0,v.useState)({revision:0,content:null,problem:null,folder:``}),[n,r]=(0,v.useState)(0),[i,a]=(0,v.useState)(()=>Ia(`stillmade.dev.theme`,`light`)),[o,s]=(0,v.useState)(()=>Ia(`stillmade.dev.width`,`full`)),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)([]),[y,b]=(0,v.useState)({}),x=(0,v.useRef)({}),S=(0,v.useRef)(0),C=(0,v.useCallback)((e,t)=>_(n=>[...n.slice(-299),{id:++S.current,kind:e,label:Ua[e]||e,time:new Date().toLocaleTimeString(),text:String(t)}]),[]),w=(0,v.useCallback)(async()=>{let e=await(await fetch(`/__dev/package`,{cache:`no-store`})).json();return t(e),e},[]);(0,v.useEffect)(()=>{let e=!0;w().then(t=>{e&&(d(e=>e??(t.content?.tests?.[0]?.input||{})),C(`reload`,`Previewing ${t.folder}`),t.problem&&C(`error`,t.problem))}).catch(e=>C(`error`,e.message));let t=new EventSource(`/__dev/events`);return t.addEventListener(`package`,async t=>{let n=JSON.parse(t.data);try{if(await w(),!e)return;r(e=>e+1),C(n.problem?`error`:`reload`,n.problem?`Reloaded with a problem: ${n.problem}`:`Reloaded after a change`)}catch(e){C(`error`,e.message)}}),t.addEventListener(`build`,e=>{let t=JSON.parse(e.data);t.state===`running`?C(`build`,`Building: ${t.command}`):t.state===`done`?C(`build`,`Build finished`):C(`error`,`Build failed${t.output?`\n${t.output}`:``}`)}),()=>{e=!1,t.close()}},[]),(0,v.useEffect)(()=>{document.documentElement.dataset.mode=i,La(`stillmade.dev.theme`,i)},[i]),(0,v.useEffect)(()=>{La(`stillmade.dev.width`,o)},[o]);let T=e.content,E=T?.manifest,D=T?.tests||[],O=e=>{l(e),d(D[e]?.input||{})},k=(0,v.useCallback)(async(e,{signal:t}={})=>{C(`run`,`Run with ${Fa(e)}`),h(!0);try{let n=await Ra(e);if(t?.aborted)throw Object.assign(Error(`Run cancelled`),{code:`CANCELLED`});for(let e of n.logs||[])C(`log`,e);for(let e of n.standIns||[])C(`stand-in`,`${e.api} ${e.name} (${e.source===`mocks`?`tests/mocks.json`:`recorded stand-in`})`);if(n.error)throw C(`error`,`${n.error}${n.code?` (${n.code})`:``}`),Object.assign(Error(n.error),{code:n.code});return p(n.outputs),C(`run`,`Finished in ${n.ms} ms`),n.outputs}finally{h(!1)}},[C]),A=(0,v.useCallback)(async e=>{let t=V(x.current,e);x.current=t,b(t)},[]),j=()=>{x.current={},b({}),r(e=>e+1),C(`view`,`Shared state cleared`)},M=(0,v.useMemo)(()=>({state:y,outputs:{},memory:null,canEdit:!0}),[y]),ee=(0,v.useCallback)(async e=>{p(e),C(`view`,`The view chose outputs ${Fa(e)}`)},[C]),N=(0,v.useCallback)(e=>C(`error`,String(e?.message||e)),[C]),P=u||{},te=Pa.find(([e])=>e===o)?.[2];return(0,Z.jsxs)(`div`,{className:`dh-page`,children:[(0,Z.jsxs)(`header`,{className:`dh-header`,children:[(0,Z.jsxs)(`div`,{className:`dh-title`,children:[(0,Z.jsx)(`span`,{className:`dh-wordmark`,children:`StillMade AI`}),(0,Z.jsx)(`h1`,{children:E?.name||`Block preview`}),E&&(0,Z.jsxs)(`span`,{className:`dh-meta`,children:[E.id,` · `,E.version,` · `,E.runtime,T.view?.runtime===`frame`?` · frame view`:T.view?` · view`:``]})]}),(0,Z.jsxs)(`div`,{className:`dh-controls`,children:[(0,Z.jsxs)(`label`,{children:[`Appearance`,(0,Z.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:Na.map(([e,t])=>(0,Z.jsx)(`option`,{value:e,children:t},e))})]}),(0,Z.jsxs)(`label`,{children:[`Width`,(0,Z.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:Pa.map(([e,t])=>(0,Z.jsx)(`option`,{value:e,children:t},e))})]}),D.length>1&&(0,Z.jsxs)(`label`,{children:[`Fixture`,(0,Z.jsx)(`select`,{value:c,onChange:e=>O(Number(e.target.value)),children:D.map((e,t)=>(0,Z.jsx)(`option`,{value:t,children:e.name},t))})]}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>r(e=>e+1),children:`Reload view`})]})]}),e.problem&&(0,Z.jsx)(`p`,{className:`dh-problem`,role:`alert`,children:e.problem}),(0,Z.jsxs)(`main`,{className:`dh-main`,children:[(0,Z.jsx)(`section`,{className:`dh-stage`,"aria-label":`Preview`,children:(0,Z.jsx)(`div`,{className:`dh-frame`,style:te?{maxWidth:te}:void 0,children:T?T.view?(0,Z.jsx)(Ma,{view:T.view,policyContent:T,input:P,sharedView:M,onSharedChange:A,onRun:k,onUseOutput:ee,onPreviewImage:za,onPreviewMedia:Ba,onError:N,actorId:`dev-preview`,title:`${E.name} preview`,height:560,fitContent:!0},n):(0,Z.jsxs)(`div`,{className:`dh-noview`,children:[(0,Z.jsx)(`p`,{children:`This Block has no interface. StillMade shows controls for its inputs; run it here with the input on the right.`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:m,onClick:()=>k(P).catch(()=>{}),children:m?`Running`:`Run`})]}):(0,Z.jsx)(`p`,{className:`dh-muted`,role:`status`,children:`Loading the Block`})})}),(0,Z.jsxs)(`aside`,{className:`dh-panel`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Input`,children:[(0,Z.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Z.jsx)(`h2`,{children:`Input`}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m||!T,onClick:()=>k(P).catch(()=>{}),children:`Run with this input`})]}),u&&(0,Z.jsx)(Va,{value:u,onCommit:d,disabled:!T})]}),(0,Z.jsxs)(`section`,{"aria-label":`Outputs`,children:[(0,Z.jsxs)(`div`,{className:`dh-section-head`,children:[(0,Z.jsx)(`h2`,{children:`Last outputs`}),T?.view&&(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:j,children:`Clear shared state`})]}),f?(0,Z.jsx)(`pre`,{className:`dh-json`,children:JSON.stringify(f,null,2)}):(0,Z.jsx)(`p`,{className:`dh-muted`,children:`Nothing has run yet.`})]}),(0,Z.jsx)(Ha,{entries:g,onClear:()=>_([])})]})]})]})}(0,y.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(Wa,{}));