@hattoriai/poney 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,889 +0,0 @@
1
- var HA=Object.defineProperty;var qA=(t,e,n)=>e in t?HA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var en=(t,e,n)=>qA(t,typeof e!="symbol"?e+"":e,n);function KA(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var _G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function PS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var DS={exports:{}},np={},zS={exports:{}},De={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var yd=Symbol.for("react.element"),JA=Symbol.for("react.portal"),GA=Symbol.for("react.fragment"),YA=Symbol.for("react.strict_mode"),QA=Symbol.for("react.profiler"),XA=Symbol.for("react.provider"),e3=Symbol.for("react.context"),t3=Symbol.for("react.forward_ref"),n3=Symbol.for("react.suspense"),r3=Symbol.for("react.memo"),s3=Symbol.for("react.lazy"),B0=Symbol.iterator;function i3(t){return t===null||typeof t!="object"?null:(t=B0&&t[B0]||t["@@iterator"],typeof t=="function"?t:null)}var LS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},FS=Object.assign,BS={};function gl(t,e,n){this.props=t,this.context=e,this.refs=BS,this.updater=n||LS}gl.prototype.isReactComponent={};gl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};gl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function VS(){}VS.prototype=gl.prototype;function av(t,e,n){this.props=t,this.context=e,this.refs=BS,this.updater=n||LS}var lv=av.prototype=new VS;lv.constructor=av;FS(lv,gl.prototype);lv.isPureReactComponent=!0;var V0=Array.isArray,WS=Object.prototype.hasOwnProperty,cv={current:null},US={key:!0,ref:!0,__self:!0,__source:!0};function ZS(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)WS.call(e,r)&&!US.hasOwnProperty(r)&&(s[r]=e[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];s.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:yd,type:t,key:i,ref:o,props:s,_owner:cv.current}}function o3(t,e){return{$$typeof:yd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function dv(t){return typeof t=="object"&&t!==null&&t.$$typeof===yd}function a3(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var W0=/\/+/g;function tm(t,e){return typeof t=="object"&&t!==null&&t.key!=null?a3(""+t.key):e.toString(36)}function Du(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case yd:case JA:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+tm(o,0):r,V0(s)?(n="",t!=null&&(n=t.replace(W0,"$&/")+"/"),Du(s,e,n,"",function(c){return c})):s!=null&&(dv(s)&&(s=o3(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(W0,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",V0(t))for(var a=0;a<t.length;a++){i=t[a];var l=r+tm(i,a);o+=Du(i,e,n,l,s)}else if(l=i3(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=r+tm(i,a++),o+=Du(i,e,n,l,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Hd(t,e,n){if(t==null)return t;var r=[],s=0;return Du(t,r,"","",function(i){return e.call(n,i,s++)}),r}function l3(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var wn={current:null},zu={transition:null},c3={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:zu,ReactCurrentOwner:cv};function HS(){throw Error("act(...) is not supported in production builds of React.")}De.Children={map:Hd,forEach:function(t,e,n){Hd(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Hd(t,function(){e++}),e},toArray:function(t){return Hd(t,function(e){return e})||[]},only:function(t){if(!dv(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};De.Component=gl;De.Fragment=GA;De.Profiler=QA;De.PureComponent=av;De.StrictMode=YA;De.Suspense=n3;De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=c3;De.act=HS;De.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=FS({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=cv.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)WS.call(e,l)&&!US.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:yd,type:t.type,key:s,ref:i,props:r,_owner:o}};De.createContext=function(t){return t={$$typeof:e3,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:XA,_context:t},t.Consumer=t};De.createElement=ZS;De.createFactory=function(t){var e=ZS.bind(null,t);return e.type=t,e};De.createRef=function(){return{current:null}};De.forwardRef=function(t){return{$$typeof:t3,render:t}};De.isValidElement=dv;De.lazy=function(t){return{$$typeof:s3,_payload:{_status:-1,_result:t},_init:l3}};De.memo=function(t,e){return{$$typeof:r3,type:t,compare:e===void 0?null:e}};De.startTransition=function(t){var e=zu.transition;zu.transition={};try{t()}finally{zu.transition=e}};De.unstable_act=HS;De.useCallback=function(t,e){return wn.current.useCallback(t,e)};De.useContext=function(t){return wn.current.useContext(t)};De.useDebugValue=function(){};De.useDeferredValue=function(t){return wn.current.useDeferredValue(t)};De.useEffect=function(t,e){return wn.current.useEffect(t,e)};De.useId=function(){return wn.current.useId()};De.useImperativeHandle=function(t,e,n){return wn.current.useImperativeHandle(t,e,n)};De.useInsertionEffect=function(t,e){return wn.current.useInsertionEffect(t,e)};De.useLayoutEffect=function(t,e){return wn.current.useLayoutEffect(t,e)};De.useMemo=function(t,e){return wn.current.useMemo(t,e)};De.useReducer=function(t,e,n){return wn.current.useReducer(t,e,n)};De.useRef=function(t){return wn.current.useRef(t)};De.useState=function(t){return wn.current.useState(t)};De.useSyncExternalStore=function(t,e,n){return wn.current.useSyncExternalStore(t,e,n)};De.useTransition=function(){return wn.current.useTransition()};De.version="18.3.1";zS.exports=De;var b=zS.exports;const wr=PS(b),yl=KA({__proto__:null,default:wr},[b]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var d3=b,u3=Symbol.for("react.element"),f3=Symbol.for("react.fragment"),h3=Object.prototype.hasOwnProperty,p3=d3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m3={key:!0,ref:!0,__self:!0,__source:!0};function qS(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)h3.call(e,r)&&!m3.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:u3,type:t,key:i,ref:o,props:s,_owner:p3.current}}np.Fragment=f3;np.jsx=qS;np.jsxs=qS;DS.exports=np;var d=DS.exports,KS={exports:{}},Kn={},JS={exports:{}},GS={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(t){function e(A,B){var K=A.length;A.push(B);e:for(;0<K;){var Q=K-1>>>1,D=A[Q];if(0<s(D,B))A[Q]=B,A[K]=D,K=Q;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var B=A[0],K=A.pop();if(K!==B){A[0]=K;e:for(var Q=0,D=A.length,L=D>>>1;Q<L;){var W=2*(Q+1)-1,H=A[W],O=W+1,R=A[O];if(0>s(H,K))O<D&&0>s(R,H)?(A[Q]=R,A[O]=K,Q=O):(A[Q]=H,A[W]=K,Q=W);else if(O<D&&0>s(R,K))A[Q]=R,A[O]=K,Q=O;else break e}}return B}function s(A,B){var K=A.sortIndex-B.sortIndex;return K!==0?K:A.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],f=1,u=null,h=3,m=!1,g=!1,p=!1,x=typeof setTimeout=="function"?setTimeout:null,y=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 k(A){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=A)r(c),B.sortIndex=B.expirationTime,e(l,B);else break;B=n(c)}}function w(A){if(p=!1,k(A),!g)if(n(l)!==null)g=!0,M(j);else{var B=n(c);B!==null&&$(w,B.startTime-A)}}function j(A,B){g=!1,p&&(p=!1,y(S),S=-1),m=!0;var K=h;try{for(k(B),u=n(l);u!==null&&(!(u.expirationTime>B)||A&&!P());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,h=u.priorityLevel;var D=Q(u.expirationTime<=B);B=t.unstable_now(),typeof D=="function"?u.callback=D:u===n(l)&&r(l),k(B)}else r(l);u=n(l)}if(u!==null)var L=!0;else{var W=n(c);W!==null&&$(w,W.startTime-B),L=!1}return L}finally{u=null,h=K,m=!1}}var C=!1,_=null,S=-1,N=5,E=-1;function P(){return!(t.unstable_now()-E<N)}function z(){if(_!==null){var A=t.unstable_now();E=A;var B=!0;try{B=_(!0,A)}finally{B?I():(C=!1,_=null)}}else C=!1}var I;if(typeof v=="function")I=function(){v(z)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,U=F.port2;F.port1.onmessage=z,I=function(){U.postMessage(null)}}else I=function(){x(z,0)};function M(A){_=A,C||(C=!0,I())}function $(A,B){S=x(function(){A(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(A){A.callback=null},t.unstable_continueExecution=function(){g||m||(g=!0,M(j))},t.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<A?Math.floor(1e3/A):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(A){switch(h){case 1:case 2:case 3:var B=3;break;default:B=h}var K=h;h=B;try{return A()}finally{h=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(A,B){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var K=h;h=A;try{return B()}finally{h=K}},t.unstable_scheduleCallback=function(A,B,K){var Q=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Q+K:Q):K=Q,A){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,A={id:f++,callback:B,priorityLevel:A,startTime:K,expirationTime:D,sortIndex:-1},K>Q?(A.sortIndex=K,e(c,A),n(l)===null&&A===n(c)&&(p?(y(S),S=-1):p=!0,$(w,K-Q))):(A.sortIndex=D,e(l,A),g||m||(g=!0,M(j))),A},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(A){var B=h;return function(){var K=h;h=B;try{return A.apply(this,arguments)}finally{h=K}}}})(GS);JS.exports=GS;var g3=JS.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var y3=b,Zn=g3;function X(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var YS=new Set,$c={};function zo(t,e){Pa(t,e),Pa(t+"Capture",e)}function Pa(t,e){for($c[t]=e,t=0;t<e.length;t++)YS.add(e[t])}var _s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ag=Object.prototype.hasOwnProperty,x3=/^[: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]*$/,U0={},Z0={};function v3(t){return Ag.call(Z0,t)?!0:Ag.call(U0,t)?!1:x3.test(t)?Z0[t]=!0:(U0[t]=!0,!1)}function k3(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function w3(t,e,n,r){if(e===null||typeof e>"u"||k3(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function bn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Yt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Yt[t]=new bn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Yt[e]=new bn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Yt[t]=new bn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Yt[t]=new bn(t,2,!1,t,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(t){Yt[t]=new bn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Yt[t]=new bn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Yt[t]=new bn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Yt[t]=new bn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Yt[t]=new bn(t,5,!1,t.toLowerCase(),null,!1,!1)});var uv=/[\-:]([a-z])/g;function fv(t){return t[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(t){var e=t.replace(uv,fv);Yt[e]=new bn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(uv,fv);Yt[e]=new bn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(uv,fv);Yt[e]=new bn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Yt[t]=new bn(t,1,!1,t.toLowerCase(),null,!1,!1)});Yt.xlinkHref=new bn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Yt[t]=new bn(t,1,!1,t.toLowerCase(),null,!0,!0)});function hv(t,e,n,r){var s=Yt.hasOwnProperty(e)?Yt[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(w3(e,n,s,r)&&(n=null),r||s===null?v3(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Is=y3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,qd=Symbol.for("react.element"),fa=Symbol.for("react.portal"),ha=Symbol.for("react.fragment"),pv=Symbol.for("react.strict_mode"),Rg=Symbol.for("react.profiler"),QS=Symbol.for("react.provider"),XS=Symbol.for("react.context"),mv=Symbol.for("react.forward_ref"),Ig=Symbol.for("react.suspense"),Pg=Symbol.for("react.suspense_list"),gv=Symbol.for("react.memo"),Us=Symbol.for("react.lazy"),ej=Symbol.for("react.offscreen"),H0=Symbol.iterator;function $l(t){return t===null||typeof t!="object"?null:(t=H0&&t[H0]||t["@@iterator"],typeof t=="function"?t:null)}var ut=Object.assign,nm;function Hl(t){if(nm===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);nm=e&&e[1]||""}return`
34
- `+nm+t}var rm=!1;function sm(t,e){if(!t||rm)return"";rm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
37
- `+s[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{rm=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Hl(t):""}function b3(t){switch(t.tag){case 5:return Hl(t.type);case 16:return Hl("Lazy");case 13:return Hl("Suspense");case 19:return Hl("SuspenseList");case 0:case 2:case 15:return t=sm(t.type,!1),t;case 11:return t=sm(t.type.render,!1),t;case 1:return t=sm(t.type,!0),t;default:return""}}function Dg(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ha:return"Fragment";case fa:return"Portal";case Rg:return"Profiler";case pv:return"StrictMode";case Ig:return"Suspense";case Pg:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case XS:return(t.displayName||"Context")+".Consumer";case QS:return(t._context.displayName||"Context")+".Provider";case mv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case gv:return e=t.displayName||null,e!==null?e:Dg(t.type)||"Memo";case Us:e=t._payload,t=t._init;try{return Dg(t(e))}catch{}}return null}function S3(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Dg(e);case 8:return e===pv?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ci(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function tj(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function j3(t){var e=tj(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Kd(t){t._valueTracker||(t._valueTracker=j3(t))}function nj(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=tj(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function lf(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function zg(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function q0(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ci(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rj(t,e){e=e.checked,e!=null&&hv(t,"checked",e,!1)}function Lg(t,e){rj(t,e);var n=Ci(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Fg(t,e.type,n):e.hasOwnProperty("defaultValue")&&Fg(t,e.type,Ci(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function K0(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Fg(t,e,n){(e!=="number"||lf(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ql=Array.isArray;function _a(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Ci(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Bg(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(X(91));return ut({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function J0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(X(92));if(ql(n)){if(1<n.length)throw Error(X(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Ci(n)}}function sj(t,e){var n=Ci(e.value),r=Ci(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function G0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function ij(t){switch(t){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 Vg(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?ij(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Jd,oj=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Jd=Jd||document.createElement("div"),Jd.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Jd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Mc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var oc={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},C3=["Webkit","ms","Moz","O"];Object.keys(oc).forEach(function(t){C3.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),oc[e]=oc[t]})});function aj(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||oc.hasOwnProperty(t)&&oc[t]?(""+e).trim():e+"px"}function lj(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=aj(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var _3=ut({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 Wg(t,e){if(e){if(_3[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(X(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(X(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(X(61))}if(e.style!=null&&typeof e.style!="object")throw Error(X(62))}}function Ug(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Zg=null;function yv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Hg=null,Na=null,Ea=null;function Y0(t){if(t=kd(t)){if(typeof Hg!="function")throw Error(X(280));var e=t.stateNode;e&&(e=ap(e),Hg(t.stateNode,t.type,e))}}function cj(t){Na?Ea?Ea.push(t):Ea=[t]:Na=t}function dj(){if(Na){var t=Na,e=Ea;if(Ea=Na=null,Y0(t),e)for(t=0;t<e.length;t++)Y0(e[t])}}function uj(t,e){return t(e)}function fj(){}var im=!1;function hj(t,e,n){if(im)return t(e,n);im=!0;try{return uj(t,e,n)}finally{im=!1,(Na!==null||Ea!==null)&&(fj(),dj())}}function Tc(t,e){var n=t.stateNode;if(n===null)return null;var r=ap(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(X(231,e,typeof n));return n}var qg=!1;if(_s)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){qg=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch{qg=!1}function N3(t,e,n,r,s,i,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(f){this.onError(f)}}var ac=!1,cf=null,df=!1,Kg=null,E3={onError:function(t){ac=!0,cf=t}};function $3(t,e,n,r,s,i,o,a,l){ac=!1,cf=null,N3.apply(E3,arguments)}function M3(t,e,n,r,s,i,o,a,l){if($3.apply(this,arguments),ac){if(ac){var c=cf;ac=!1,cf=null}else throw Error(X(198));df||(df=!0,Kg=c)}}function Lo(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function pj(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Q0(t){if(Lo(t)!==t)throw Error(X(188))}function T3(t){var e=t.alternate;if(!e){if(e=Lo(t),e===null)throw Error(X(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Q0(s),t;if(i===r)return Q0(s),e;i=i.sibling}throw Error(X(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(X(189))}}if(n.alternate!==r)throw Error(X(190))}if(n.tag!==3)throw Error(X(188));return n.stateNode.current===n?t:e}function mj(t){return t=T3(t),t!==null?gj(t):null}function gj(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=gj(t);if(e!==null)return e;t=t.sibling}return null}var yj=Zn.unstable_scheduleCallback,X0=Zn.unstable_cancelCallback,O3=Zn.unstable_shouldYield,A3=Zn.unstable_requestPaint,yt=Zn.unstable_now,R3=Zn.unstable_getCurrentPriorityLevel,xv=Zn.unstable_ImmediatePriority,xj=Zn.unstable_UserBlockingPriority,uf=Zn.unstable_NormalPriority,I3=Zn.unstable_LowPriority,vj=Zn.unstable_IdlePriority,rp=null,Hr=null;function P3(t){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(rp,t,void 0,(t.current.flags&128)===128)}catch{}}var br=Math.clz32?Math.clz32:L3,D3=Math.log,z3=Math.LN2;function L3(t){return t>>>=0,t===0?32:31-(D3(t)/z3|0)|0}var Gd=64,Yd=4194304;function Kl(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function ff(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Kl(a):(i&=o,i!==0&&(r=Kl(i)))}else o=n&~s,o!==0?r=Kl(o):i!==0&&(r=Kl(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-br(e),s=1<<n,r|=t[n],e&=~s;return r}function F3(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 B3(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-br(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=F3(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Jg(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function kj(){var t=Gd;return Gd<<=1,!(Gd&4194240)&&(Gd=64),t}function om(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function xd(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-br(e),t[e]=n}function V3(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-br(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function vv(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-br(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var Je=0;function wj(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var bj,kv,Sj,jj,Cj,Gg=!1,Qd=[],li=null,ci=null,di=null,Oc=new Map,Ac=new Map,Qs=[],W3="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 ek(t,e){switch(t){case"focusin":case"focusout":li=null;break;case"dragenter":case"dragleave":ci=null;break;case"mouseover":case"mouseout":di=null;break;case"pointerover":case"pointerout":Oc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ac.delete(e.pointerId)}}function Tl(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=kd(e),e!==null&&kv(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function U3(t,e,n,r,s){switch(e){case"focusin":return li=Tl(li,t,e,n,r,s),!0;case"dragenter":return ci=Tl(ci,t,e,n,r,s),!0;case"mouseover":return di=Tl(di,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Oc.set(i,Tl(Oc.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Ac.set(i,Tl(Ac.get(i)||null,t,e,n,r,s)),!0}return!1}function _j(t){var e=Yi(t.target);if(e!==null){var n=Lo(e);if(n!==null){if(e=n.tag,e===13){if(e=pj(n),e!==null){t.blockedOn=e,Cj(t.priority,function(){Sj(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Lu(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Yg(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Zg=r,n.target.dispatchEvent(r),Zg=null}else return e=kd(n),e!==null&&kv(e),t.blockedOn=n,!1;e.shift()}return!0}function tk(t,e,n){Lu(t)&&n.delete(e)}function Z3(){Gg=!1,li!==null&&Lu(li)&&(li=null),ci!==null&&Lu(ci)&&(ci=null),di!==null&&Lu(di)&&(di=null),Oc.forEach(tk),Ac.forEach(tk)}function Ol(t,e){t.blockedOn===e&&(t.blockedOn=null,Gg||(Gg=!0,Zn.unstable_scheduleCallback(Zn.unstable_NormalPriority,Z3)))}function Rc(t){function e(s){return Ol(s,t)}if(0<Qd.length){Ol(Qd[0],t);for(var n=1;n<Qd.length;n++){var r=Qd[n];r.blockedOn===t&&(r.blockedOn=null)}}for(li!==null&&Ol(li,t),ci!==null&&Ol(ci,t),di!==null&&Ol(di,t),Oc.forEach(e),Ac.forEach(e),n=0;n<Qs.length;n++)r=Qs[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Qs.length&&(n=Qs[0],n.blockedOn===null);)_j(n),n.blockedOn===null&&Qs.shift()}var $a=Is.ReactCurrentBatchConfig,hf=!0;function H3(t,e,n,r){var s=Je,i=$a.transition;$a.transition=null;try{Je=1,wv(t,e,n,r)}finally{Je=s,$a.transition=i}}function q3(t,e,n,r){var s=Je,i=$a.transition;$a.transition=null;try{Je=4,wv(t,e,n,r)}finally{Je=s,$a.transition=i}}function wv(t,e,n,r){if(hf){var s=Yg(t,e,n,r);if(s===null)gm(t,e,r,pf,n),ek(t,r);else if(U3(s,t,e,n,r))r.stopPropagation();else if(ek(t,r),e&4&&-1<W3.indexOf(t)){for(;s!==null;){var i=kd(s);if(i!==null&&bj(i),i=Yg(t,e,n,r),i===null&&gm(t,e,r,pf,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else gm(t,e,r,null,n)}}var pf=null;function Yg(t,e,n,r){if(pf=null,t=yv(r),t=Yi(t),t!==null)if(e=Lo(t),e===null)t=null;else if(n=e.tag,n===13){if(t=pj(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return pf=t,null}function Nj(t){switch(t){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(R3()){case xv:return 1;case xj:return 4;case uf:case I3:return 16;case vj:return 536870912;default:return 16}default:return 16}}var ri=null,bv=null,Fu=null;function Ej(){if(Fu)return Fu;var t,e=bv,n=e.length,r,s="value"in ri?ri.value:ri.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return Fu=s.slice(t,1<r?1-r:void 0)}function Bu(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Xd(){return!0}function nk(){return!1}function Jn(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Xd:nk,this.isPropagationStopped=nk,this}return ut(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Xd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Xd)},persist:function(){},isPersistent:Xd}),e}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sv=Jn(xl),vd=ut({},xl,{view:0,detail:0}),K3=Jn(vd),am,lm,Al,sp=ut({},vd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jv,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Al&&(Al&&t.type==="mousemove"?(am=t.screenX-Al.screenX,lm=t.screenY-Al.screenY):lm=am=0,Al=t),am)},movementY:function(t){return"movementY"in t?t.movementY:lm}}),rk=Jn(sp),J3=ut({},sp,{dataTransfer:0}),G3=Jn(J3),Y3=ut({},vd,{relatedTarget:0}),cm=Jn(Y3),Q3=ut({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),X3=Jn(Q3),e5=ut({},xl,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),t5=Jn(e5),n5=ut({},xl,{data:0}),sk=Jn(n5),r5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s5={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"},i5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function o5(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=i5[t])?!!e[t]:!1}function jv(){return o5}var a5=ut({},vd,{key:function(t){if(t.key){var e=r5[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Bu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?s5[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jv,charCode:function(t){return t.type==="keypress"?Bu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Bu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),l5=Jn(a5),c5=ut({},sp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ik=Jn(c5),d5=ut({},vd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jv}),u5=Jn(d5),f5=ut({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),h5=Jn(f5),p5=ut({},sp,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),m5=Jn(p5),g5=[9,13,27,32],Cv=_s&&"CompositionEvent"in window,lc=null;_s&&"documentMode"in document&&(lc=document.documentMode);var y5=_s&&"TextEvent"in window&&!lc,$j=_s&&(!Cv||lc&&8<lc&&11>=lc),ok=" ",ak=!1;function Mj(t,e){switch(t){case"keyup":return g5.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tj(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var pa=!1;function x5(t,e){switch(t){case"compositionend":return Tj(e);case"keypress":return e.which!==32?null:(ak=!0,ok);case"textInput":return t=e.data,t===ok&&ak?null:t;default:return null}}function v5(t,e){if(pa)return t==="compositionend"||!Cv&&Mj(t,e)?(t=Ej(),Fu=bv=ri=null,pa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return $j&&e.locale!=="ko"?null:e.data;default:return null}}var k5={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 lk(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!k5[t.type]:e==="textarea"}function Oj(t,e,n,r){cj(r),e=mf(e,"onChange"),0<e.length&&(n=new Sv("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var cc=null,Ic=null;function w5(t){Wj(t,0)}function ip(t){var e=ya(t);if(nj(e))return t}function b5(t,e){if(t==="change")return e}var Aj=!1;if(_s){var dm;if(_s){var um="oninput"in document;if(!um){var ck=document.createElement("div");ck.setAttribute("oninput","return;"),um=typeof ck.oninput=="function"}dm=um}else dm=!1;Aj=dm&&(!document.documentMode||9<document.documentMode)}function dk(){cc&&(cc.detachEvent("onpropertychange",Rj),Ic=cc=null)}function Rj(t){if(t.propertyName==="value"&&ip(Ic)){var e=[];Oj(e,Ic,t,yv(t)),hj(w5,e)}}function S5(t,e,n){t==="focusin"?(dk(),cc=e,Ic=n,cc.attachEvent("onpropertychange",Rj)):t==="focusout"&&dk()}function j5(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ip(Ic)}function C5(t,e){if(t==="click")return ip(e)}function _5(t,e){if(t==="input"||t==="change")return ip(e)}function N5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _r=typeof Object.is=="function"?Object.is:N5;function Pc(t,e){if(_r(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Ag.call(e,s)||!_r(t[s],e[s]))return!1}return!0}function uk(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function fk(t,e){var n=uk(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=uk(n)}}function Ij(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Ij(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Pj(){for(var t=window,e=lf();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=lf(t.document)}return e}function _v(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function E5(t){var e=Pj(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Ij(n.ownerDocument.documentElement,n)){if(r!==null&&_v(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=fk(n,i);var o=fk(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var $5=_s&&"documentMode"in document&&11>=document.documentMode,ma=null,Qg=null,dc=null,Xg=!1;function hk(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xg||ma==null||ma!==lf(r)||(r=ma,"selectionStart"in r&&_v(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}),dc&&Pc(dc,r)||(dc=r,r=mf(Qg,"onSelect"),0<r.length&&(e=new Sv("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ma)))}function eu(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ga={animationend:eu("Animation","AnimationEnd"),animationiteration:eu("Animation","AnimationIteration"),animationstart:eu("Animation","AnimationStart"),transitionend:eu("Transition","TransitionEnd")},fm={},Dj={};_s&&(Dj=document.createElement("div").style,"AnimationEvent"in window||(delete ga.animationend.animation,delete ga.animationiteration.animation,delete ga.animationstart.animation),"TransitionEvent"in window||delete ga.transitionend.transition);function op(t){if(fm[t])return fm[t];if(!ga[t])return t;var e=ga[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Dj)return fm[t]=e[n];return t}var zj=op("animationend"),Lj=op("animationiteration"),Fj=op("animationstart"),Bj=op("transitionend"),Vj=new Map,pk="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 zi(t,e){Vj.set(t,e),zo(e,[t])}for(var hm=0;hm<pk.length;hm++){var pm=pk[hm],M5=pm.toLowerCase(),T5=pm[0].toUpperCase()+pm.slice(1);zi(M5,"on"+T5)}zi(zj,"onAnimationEnd");zi(Lj,"onAnimationIteration");zi(Fj,"onAnimationStart");zi("dblclick","onDoubleClick");zi("focusin","onFocus");zi("focusout","onBlur");zi(Bj,"onTransitionEnd");Pa("onMouseEnter",["mouseout","mouseover"]);Pa("onMouseLeave",["mouseout","mouseover"]);Pa("onPointerEnter",["pointerout","pointerover"]);Pa("onPointerLeave",["pointerout","pointerover"]);zo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zo("onBeforeInput",["compositionend","keypress","textInput","paste"]);zo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jl="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(" "),O5=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jl));function mk(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,M3(r,e,void 0,t),t.currentTarget=null}function Wj(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;mk(s,a,c),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;mk(s,a,c),i=l}}}if(df)throw t=Kg,df=!1,Kg=null,t}function tt(t,e){var n=e[sy];n===void 0&&(n=e[sy]=new Set);var r=t+"__bubble";n.has(r)||(Uj(e,t,2,!1),n.add(r))}function mm(t,e,n){var r=0;e&&(r|=4),Uj(n,t,r,e)}var tu="_reactListening"+Math.random().toString(36).slice(2);function Dc(t){if(!t[tu]){t[tu]=!0,YS.forEach(function(n){n!=="selectionchange"&&(O5.has(n)||mm(n,!1,t),mm(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[tu]||(e[tu]=!0,mm("selectionchange",!1,e))}}function Uj(t,e,n,r){switch(Nj(e)){case 1:var s=H3;break;case 4:s=q3;break;default:s=wv}n=s.bind(null,e,n,t),s=void 0,!qg||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function gm(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Yi(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}hj(function(){var c=i,f=yv(n),u=[];e:{var h=Vj.get(t);if(h!==void 0){var m=Sv,g=t;switch(t){case"keypress":if(Bu(n)===0)break e;case"keydown":case"keyup":m=l5;break;case"focusin":g="focus",m=cm;break;case"focusout":g="blur",m=cm;break;case"beforeblur":case"afterblur":m=cm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=rk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=G3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=u5;break;case zj:case Lj:case Fj:m=X3;break;case Bj:m=h5;break;case"scroll":m=K3;break;case"wheel":m=m5;break;case"copy":case"cut":case"paste":m=t5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=ik}var p=(e&4)!==0,x=!p&&t==="scroll",y=p?h!==null?h+"Capture":null:h;p=[];for(var v=c,k;v!==null;){k=v;var w=k.stateNode;if(k.tag===5&&w!==null&&(k=w,y!==null&&(w=Tc(v,y),w!=null&&p.push(zc(v,w,k)))),x)break;v=v.return}0<p.length&&(h=new m(h,g,null,n,f),u.push({event:h,listeners:p}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",h&&n!==Zg&&(g=n.relatedTarget||n.fromElement)&&(Yi(g)||g[Ns]))break e;if((m||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=c,g=g?Yi(g):null,g!==null&&(x=Lo(g),g!==x||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=c),m!==g)){if(p=rk,w="onMouseLeave",y="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(p=ik,w="onPointerLeave",y="onPointerEnter",v="pointer"),x=m==null?h:ya(m),k=g==null?h:ya(g),h=new p(w,v+"leave",m,n,f),h.target=x,h.relatedTarget=k,w=null,Yi(f)===c&&(p=new p(y,v+"enter",g,n,f),p.target=k,p.relatedTarget=x,w=p),x=w,m&&g)t:{for(p=m,y=g,v=0,k=p;k;k=Ho(k))v++;for(k=0,w=y;w;w=Ho(w))k++;for(;0<v-k;)p=Ho(p),v--;for(;0<k-v;)y=Ho(y),k--;for(;v--;){if(p===y||y!==null&&p===y.alternate)break t;p=Ho(p),y=Ho(y)}p=null}else p=null;m!==null&&gk(u,h,m,p,!1),g!==null&&x!==null&&gk(u,x,g,p,!0)}}e:{if(h=c?ya(c):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var j=b5;else if(lk(h))if(Aj)j=_5;else{j=j5;var C=S5}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=C5);if(j&&(j=j(t,c))){Oj(u,j,n,f);break e}C&&C(t,h,c),t==="focusout"&&(C=h._wrapperState)&&C.controlled&&h.type==="number"&&Fg(h,"number",h.value)}switch(C=c?ya(c):window,t){case"focusin":(lk(C)||C.contentEditable==="true")&&(ma=C,Qg=c,dc=null);break;case"focusout":dc=Qg=ma=null;break;case"mousedown":Xg=!0;break;case"contextmenu":case"mouseup":case"dragend":Xg=!1,hk(u,n,f);break;case"selectionchange":if($5)break;case"keydown":case"keyup":hk(u,n,f)}var _;if(Cv)e:{switch(t){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else pa?Mj(t,n)&&(S="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&($j&&n.locale!=="ko"&&(pa||S!=="onCompositionStart"?S==="onCompositionEnd"&&pa&&(_=Ej()):(ri=f,bv="value"in ri?ri.value:ri.textContent,pa=!0)),C=mf(c,S),0<C.length&&(S=new sk(S,t,null,n,f),u.push({event:S,listeners:C}),_?S.data=_:(_=Tj(n),_!==null&&(S.data=_)))),(_=y5?x5(t,n):v5(t,n))&&(c=mf(c,"onBeforeInput"),0<c.length&&(f=new sk("onBeforeInput","beforeinput",null,n,f),u.push({event:f,listeners:c}),f.data=_))}Wj(u,e)})}function zc(t,e,n){return{instance:t,listener:e,currentTarget:n}}function mf(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Tc(t,n),i!=null&&r.unshift(zc(t,i,s)),i=Tc(t,e),i!=null&&r.push(zc(t,i,s))),t=t.return}return r}function Ho(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function gk(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,s?(l=Tc(n,i),l!=null&&o.unshift(zc(n,l,a))):s||(l=Tc(n,i),l!=null&&o.push(zc(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var A5=/\r\n?/g,R5=/\u0000|\uFFFD/g;function yk(t){return(typeof t=="string"?t:""+t).replace(A5,`
38
- `).replace(R5,"")}function nu(t,e,n){if(e=yk(e),yk(t)!==e&&n)throw Error(X(425))}function gf(){}var ey=null,ty=null;function ny(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ry=typeof setTimeout=="function"?setTimeout:void 0,I5=typeof clearTimeout=="function"?clearTimeout:void 0,xk=typeof Promise=="function"?Promise:void 0,P5=typeof queueMicrotask=="function"?queueMicrotask:typeof xk<"u"?function(t){return xk.resolve(null).then(t).catch(D5)}:ry;function D5(t){setTimeout(function(){throw t})}function ym(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),Rc(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Rc(e)}function ui(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function vk(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var vl=Math.random().toString(36).slice(2),Br="__reactFiber$"+vl,Lc="__reactProps$"+vl,Ns="__reactContainer$"+vl,sy="__reactEvents$"+vl,z5="__reactListeners$"+vl,L5="__reactHandles$"+vl;function Yi(t){var e=t[Br];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Ns]||n[Br]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=vk(t);t!==null;){if(n=t[Br])return n;t=vk(t)}return e}t=n,n=t.parentNode}return null}function kd(t){return t=t[Br]||t[Ns],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ya(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(X(33))}function ap(t){return t[Lc]||null}var iy=[],xa=-1;function Li(t){return{current:t}}function st(t){0>xa||(t.current=iy[xa],iy[xa]=null,xa--)}function et(t,e){xa++,iy[xa]=t.current,t.current=e}var _i={},dn=Li(_i),$n=Li(!1),mo=_i;function Da(t,e){var n=t.type.contextTypes;if(!n)return _i;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Mn(t){return t=t.childContextTypes,t!=null}function yf(){st($n),st(dn)}function kk(t,e,n){if(dn.current!==_i)throw Error(X(168));et(dn,e),et($n,n)}function Zj(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(X(108,S3(t)||"Unknown",s));return ut({},n,r)}function xf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||_i,mo=dn.current,et(dn,t),et($n,$n.current),!0}function wk(t,e,n){var r=t.stateNode;if(!r)throw Error(X(169));n?(t=Zj(t,e,mo),r.__reactInternalMemoizedMergedChildContext=t,st($n),st(dn),et(dn,t)):st($n),et($n,n)}var ps=null,lp=!1,xm=!1;function Hj(t){ps===null?ps=[t]:ps.push(t)}function F5(t){lp=!0,Hj(t)}function Fi(){if(!xm&&ps!==null){xm=!0;var t=0,e=Je;try{var n=ps;for(Je=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}ps=null,lp=!1}catch(s){throw ps!==null&&(ps=ps.slice(t+1)),yj(xv,Fi),s}finally{Je=e,xm=!1}}return null}var va=[],ka=0,vf=null,kf=0,tr=[],nr=0,go=null,gs=1,ys="";function qi(t,e){va[ka++]=kf,va[ka++]=vf,vf=t,kf=e}function qj(t,e,n){tr[nr++]=gs,tr[nr++]=ys,tr[nr++]=go,go=t;var r=gs;t=ys;var s=32-br(r)-1;r&=~(1<<s),n+=1;var i=32-br(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,gs=1<<32-br(e)+s|n<<s|r,ys=i+t}else gs=1<<i|n<<s|r,ys=t}function Nv(t){t.return!==null&&(qi(t,1),qj(t,1,0))}function Ev(t){for(;t===vf;)vf=va[--ka],va[ka]=null,kf=va[--ka],va[ka]=null;for(;t===go;)go=tr[--nr],tr[nr]=null,ys=tr[--nr],tr[nr]=null,gs=tr[--nr],tr[nr]=null}var Wn=null,Bn=null,ot=!1,vr=null;function Kj(t,e){var n=sr(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function bk(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Wn=t,Bn=ui(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Wn=t,Bn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=go!==null?{id:gs,overflow:ys}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=sr(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Wn=t,Bn=null,!0):!1;default:return!1}}function oy(t){return(t.mode&1)!==0&&(t.flags&128)===0}function ay(t){if(ot){var e=Bn;if(e){var n=e;if(!bk(t,e)){if(oy(t))throw Error(X(418));e=ui(n.nextSibling);var r=Wn;e&&bk(t,e)?Kj(r,n):(t.flags=t.flags&-4097|2,ot=!1,Wn=t)}}else{if(oy(t))throw Error(X(418));t.flags=t.flags&-4097|2,ot=!1,Wn=t}}}function Sk(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Wn=t}function ru(t){if(t!==Wn)return!1;if(!ot)return Sk(t),ot=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!ny(t.type,t.memoizedProps)),e&&(e=Bn)){if(oy(t))throw Jj(),Error(X(418));for(;e;)Kj(t,e),e=ui(e.nextSibling)}if(Sk(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(X(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Bn=ui(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Bn=null}}else Bn=Wn?ui(t.stateNode.nextSibling):null;return!0}function Jj(){for(var t=Bn;t;)t=ui(t.nextSibling)}function za(){Bn=Wn=null,ot=!1}function $v(t){vr===null?vr=[t]:vr.push(t)}var B5=Is.ReactCurrentBatchConfig;function Rl(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(X(309));var r=n.stateNode}if(!r)throw Error(X(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(X(284));if(!n._owner)throw Error(X(290,t))}return t}function su(t,e){throw t=Object.prototype.toString.call(e),Error(X(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function jk(t){var e=t._init;return e(t._payload)}function Gj(t){function e(y,v){if(t){var k=y.deletions;k===null?(y.deletions=[v],y.flags|=16):k.push(v)}}function n(y,v){if(!t)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=mi(y,v),y.index=0,y.sibling=null,y}function i(y,v,k){return y.index=k,t?(k=y.alternate,k!==null?(k=k.index,k<v?(y.flags|=2,v):k):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,v,k,w){return v===null||v.tag!==6?(v=Cm(k,y.mode,w),v.return=y,v):(v=s(v,k),v.return=y,v)}function l(y,v,k,w){var j=k.type;return j===ha?f(y,v,k.props.children,w,k.key):v!==null&&(v.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Us&&jk(j)===v.type)?(w=s(v,k.props),w.ref=Rl(y,v,k),w.return=y,w):(w=Ku(k.type,k.key,k.props,null,y.mode,w),w.ref=Rl(y,v,k),w.return=y,w)}function c(y,v,k,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==k.containerInfo||v.stateNode.implementation!==k.implementation?(v=_m(k,y.mode,w),v.return=y,v):(v=s(v,k.children||[]),v.return=y,v)}function f(y,v,k,w,j){return v===null||v.tag!==7?(v=lo(k,y.mode,w,j),v.return=y,v):(v=s(v,k),v.return=y,v)}function u(y,v,k){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Cm(""+v,y.mode,k),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case qd:return k=Ku(v.type,v.key,v.props,null,y.mode,k),k.ref=Rl(y,null,v),k.return=y,k;case fa:return v=_m(v,y.mode,k),v.return=y,v;case Us:var w=v._init;return u(y,w(v._payload),k)}if(ql(v)||$l(v))return v=lo(v,y.mode,k,null),v.return=y,v;su(y,v)}return null}function h(y,v,k,w){var j=v!==null?v.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return j!==null?null:a(y,v,""+k,w);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case qd:return k.key===j?l(y,v,k,w):null;case fa:return k.key===j?c(y,v,k,w):null;case Us:return j=k._init,h(y,v,j(k._payload),w)}if(ql(k)||$l(k))return j!==null?null:f(y,v,k,w,null);su(y,k)}return null}function m(y,v,k,w,j){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(k)||null,a(v,y,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case qd:return y=y.get(w.key===null?k:w.key)||null,l(v,y,w,j);case fa:return y=y.get(w.key===null?k:w.key)||null,c(v,y,w,j);case Us:var C=w._init;return m(y,v,k,C(w._payload),j)}if(ql(w)||$l(w))return y=y.get(k)||null,f(v,y,w,j,null);su(v,w)}return null}function g(y,v,k,w){for(var j=null,C=null,_=v,S=v=0,N=null;_!==null&&S<k.length;S++){_.index>S?(N=_,_=null):N=_.sibling;var E=h(y,_,k[S],w);if(E===null){_===null&&(_=N);break}t&&_&&E.alternate===null&&e(y,_),v=i(E,v,S),C===null?j=E:C.sibling=E,C=E,_=N}if(S===k.length)return n(y,_),ot&&qi(y,S),j;if(_===null){for(;S<k.length;S++)_=u(y,k[S],w),_!==null&&(v=i(_,v,S),C===null?j=_:C.sibling=_,C=_);return ot&&qi(y,S),j}for(_=r(y,_);S<k.length;S++)N=m(_,y,S,k[S],w),N!==null&&(t&&N.alternate!==null&&_.delete(N.key===null?S:N.key),v=i(N,v,S),C===null?j=N:C.sibling=N,C=N);return t&&_.forEach(function(P){return e(y,P)}),ot&&qi(y,S),j}function p(y,v,k,w){var j=$l(k);if(typeof j!="function")throw Error(X(150));if(k=j.call(k),k==null)throw Error(X(151));for(var C=j=null,_=v,S=v=0,N=null,E=k.next();_!==null&&!E.done;S++,E=k.next()){_.index>S?(N=_,_=null):N=_.sibling;var P=h(y,_,E.value,w);if(P===null){_===null&&(_=N);break}t&&_&&P.alternate===null&&e(y,_),v=i(P,v,S),C===null?j=P:C.sibling=P,C=P,_=N}if(E.done)return n(y,_),ot&&qi(y,S),j;if(_===null){for(;!E.done;S++,E=k.next())E=u(y,E.value,w),E!==null&&(v=i(E,v,S),C===null?j=E:C.sibling=E,C=E);return ot&&qi(y,S),j}for(_=r(y,_);!E.done;S++,E=k.next())E=m(_,y,S,E.value,w),E!==null&&(t&&E.alternate!==null&&_.delete(E.key===null?S:E.key),v=i(E,v,S),C===null?j=E:C.sibling=E,C=E);return t&&_.forEach(function(z){return e(y,z)}),ot&&qi(y,S),j}function x(y,v,k,w){if(typeof k=="object"&&k!==null&&k.type===ha&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case qd:e:{for(var j=k.key,C=v;C!==null;){if(C.key===j){if(j=k.type,j===ha){if(C.tag===7){n(y,C.sibling),v=s(C,k.props.children),v.return=y,y=v;break e}}else if(C.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Us&&jk(j)===C.type){n(y,C.sibling),v=s(C,k.props),v.ref=Rl(y,C,k),v.return=y,y=v;break e}n(y,C);break}else e(y,C);C=C.sibling}k.type===ha?(v=lo(k.props.children,y.mode,w,k.key),v.return=y,y=v):(w=Ku(k.type,k.key,k.props,null,y.mode,w),w.ref=Rl(y,v,k),w.return=y,y=w)}return o(y);case fa:e:{for(C=k.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(y,v.sibling),v=s(v,k.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else e(y,v);v=v.sibling}v=_m(k,y.mode,w),v.return=y,y=v}return o(y);case Us:return C=k._init,x(y,v,C(k._payload),w)}if(ql(k))return g(y,v,k,w);if($l(k))return p(y,v,k,w);su(y,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,k),v.return=y,y=v):(n(y,v),v=Cm(k,y.mode,w),v.return=y,y=v),o(y)):n(y,v)}return x}var La=Gj(!0),Yj=Gj(!1),wf=Li(null),bf=null,wa=null,Mv=null;function Tv(){Mv=wa=bf=null}function Ov(t){var e=wf.current;st(wf),t._currentValue=e}function ly(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Ma(t,e){bf=t,Mv=wa=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(En=!0),t.firstContext=null)}function or(t){var e=t._currentValue;if(Mv!==t)if(t={context:t,memoizedValue:e,next:null},wa===null){if(bf===null)throw Error(X(308));wa=t,bf.dependencies={lanes:0,firstContext:t}}else wa=wa.next=t;return e}var Qi=null;function Av(t){Qi===null?Qi=[t]:Qi.push(t)}function Qj(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Av(e)):(n.next=s.next,s.next=n),e.interleaved=n,Es(t,r)}function Es(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Zs=!1;function Rv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xj(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ks(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function fi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,We&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Es(t,n)}return s=r.interleaved,s===null?(e.next=e,Av(r)):(e.next=s.next,s.next=e),r.interleaved=e,Es(t,n)}function Vu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vv(t,n)}}function Ck(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=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};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Sf(t,e,n,r){var s=t.updateQueue;Zs=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var f=t.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var u=s.baseState;o=0,f=c=l=null,a=i;do{var h=a.lane,m=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=t,p=a;switch(h=e,m=n,p.tag){case 1:if(g=p.payload,typeof g=="function"){u=g.call(m,u,h);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,h=typeof g=="function"?g.call(m,u,h):g,h==null)break e;u=ut({},u,h);break e;case 2:Zs=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=m,l=u):f=f.next=m,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(f===null&&(l=u),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=f,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);xo|=o,t.lanes=o,t.memoizedState=u}}function _k(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(X(191,s));s.call(r)}}}var wd={},qr=Li(wd),Fc=Li(wd),Bc=Li(wd);function Xi(t){if(t===wd)throw Error(X(174));return t}function Iv(t,e){switch(et(Bc,e),et(Fc,t),et(qr,wd),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Vg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Vg(e,t)}st(qr),et(qr,e)}function Fa(){st(qr),st(Fc),st(Bc)}function eC(t){Xi(Bc.current);var e=Xi(qr.current),n=Vg(e,t.type);e!==n&&(et(Fc,t),et(qr,n))}function Pv(t){Fc.current===t&&(st(qr),st(Fc))}var lt=Li(0);function jf(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var vm=[];function Dv(){for(var t=0;t<vm.length;t++)vm[t]._workInProgressVersionPrimary=null;vm.length=0}var Wu=Is.ReactCurrentDispatcher,km=Is.ReactCurrentBatchConfig,yo=0,ct=null,_t=null,It=null,Cf=!1,uc=!1,Vc=0,V5=0;function tn(){throw Error(X(321))}function zv(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!_r(t[n],e[n]))return!1;return!0}function Lv(t,e,n,r,s,i){if(yo=i,ct=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Wu.current=t===null||t.memoizedState===null?H5:q5,t=n(r,s),uc){i=0;do{if(uc=!1,Vc=0,25<=i)throw Error(X(301));i+=1,It=_t=null,e.updateQueue=null,Wu.current=K5,t=n(r,s)}while(uc)}if(Wu.current=_f,e=_t!==null&&_t.next!==null,yo=0,It=_t=ct=null,Cf=!1,e)throw Error(X(300));return t}function Fv(){var t=Vc!==0;return Vc=0,t}function Ir(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?ct.memoizedState=It=t:It=It.next=t,It}function ar(){if(_t===null){var t=ct.alternate;t=t!==null?t.memoizedState:null}else t=_t.next;var e=It===null?ct.memoizedState:It.next;if(e!==null)It=e,_t=t;else{if(t===null)throw Error(X(310));_t=t,t={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},It===null?ct.memoizedState=It=t:It=It.next=t}return It}function Wc(t,e){return typeof e=="function"?e(t):e}function wm(t){var e=ar(),n=e.queue;if(n===null)throw Error(X(311));n.lastRenderedReducer=t;var r=_t,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,c=i;do{var f=c.lane;if((yo&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var u={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=u,o=r):l=l.next=u,ct.lanes|=f,xo|=f}c=c.next}while(c!==null&&c!==i);l===null?o=r:l.next=a,_r(r,e.memoizedState)||(En=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,ct.lanes|=i,xo|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function bm(t){var e=ar(),n=e.queue;if(n===null)throw Error(X(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);_r(i,e.memoizedState)||(En=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function tC(){}function nC(t,e){var n=ct,r=ar(),s=e(),i=!_r(r.memoizedState,s);if(i&&(r.memoizedState=s,En=!0),r=r.queue,Bv(iC.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,Uc(9,sC.bind(null,n,r,s,e),void 0,null),Lt===null)throw Error(X(349));yo&30||rC(n,e,s)}return s}function rC(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function sC(t,e,n,r){e.value=n,e.getSnapshot=r,oC(e)&&aC(t)}function iC(t,e,n){return n(function(){oC(e)&&aC(t)})}function oC(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_r(t,n)}catch{return!0}}function aC(t){var e=Es(t,1);e!==null&&Sr(e,t,1,-1)}function Nk(t){var e=Ir();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wc,lastRenderedState:t},e.queue=t,t=t.dispatch=Z5.bind(null,ct,t),[e.memoizedState,t]}function Uc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function lC(){return ar().memoizedState}function Uu(t,e,n,r){var s=Ir();ct.flags|=t,s.memoizedState=Uc(1|e,n,void 0,r===void 0?null:r)}function cp(t,e,n,r){var s=ar();r=r===void 0?null:r;var i=void 0;if(_t!==null){var o=_t.memoizedState;if(i=o.destroy,r!==null&&zv(r,o.deps)){s.memoizedState=Uc(e,n,i,r);return}}ct.flags|=t,s.memoizedState=Uc(1|e,n,i,r)}function Ek(t,e){return Uu(8390656,8,t,e)}function Bv(t,e){return cp(2048,8,t,e)}function cC(t,e){return cp(4,2,t,e)}function dC(t,e){return cp(4,4,t,e)}function uC(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function fC(t,e,n){return n=n!=null?n.concat([t]):null,cp(4,4,uC.bind(null,e,t),n)}function Vv(){}function hC(t,e){var n=ar();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&zv(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function pC(t,e){var n=ar();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&zv(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function mC(t,e,n){return yo&21?(_r(n,e)||(n=kj(),ct.lanes|=n,xo|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,En=!0),t.memoizedState=n)}function W5(t,e){var n=Je;Je=n!==0&&4>n?n:4,t(!0);var r=km.transition;km.transition={};try{t(!1),e()}finally{Je=n,km.transition=r}}function gC(){return ar().memoizedState}function U5(t,e,n){var r=pi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},yC(t))xC(e,n);else if(n=Qj(t,e,n,r),n!==null){var s=yn();Sr(n,t,r,s),vC(n,e,r)}}function Z5(t,e,n){var r=pi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(yC(t))xC(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,_r(a,o)){var l=e.interleaved;l===null?(s.next=s,Av(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}n=Qj(t,e,s,r),n!==null&&(s=yn(),Sr(n,t,r,s),vC(n,e,r))}}function yC(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function xC(t,e){uc=Cf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function vC(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vv(t,n)}}var _f={readContext:or,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useInsertionEffect:tn,useLayoutEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useMutableSource:tn,useSyncExternalStore:tn,useId:tn,unstable_isNewReconciler:!1},H5={readContext:or,useCallback:function(t,e){return Ir().memoizedState=[t,e===void 0?null:e],t},useContext:or,useEffect:Ek,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Uu(4194308,4,uC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Uu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Uu(4,2,t,e)},useMemo:function(t,e){var n=Ir();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ir();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=U5.bind(null,ct,t),[r.memoizedState,t]},useRef:function(t){var e=Ir();return t={current:t},e.memoizedState=t},useState:Nk,useDebugValue:Vv,useDeferredValue:function(t){return Ir().memoizedState=t},useTransition:function(){var t=Nk(!1),e=t[0];return t=W5.bind(null,t[1]),Ir().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ct,s=Ir();if(ot){if(n===void 0)throw Error(X(407));n=n()}else{if(n=e(),Lt===null)throw Error(X(349));yo&30||rC(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,Ek(iC.bind(null,r,i,t),[t]),r.flags|=2048,Uc(9,sC.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Ir(),e=Lt.identifierPrefix;if(ot){var n=ys,r=gs;n=(r&~(1<<32-br(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Vc++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=V5++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},q5={readContext:or,useCallback:hC,useContext:or,useEffect:Bv,useImperativeHandle:fC,useInsertionEffect:cC,useLayoutEffect:dC,useMemo:pC,useReducer:wm,useRef:lC,useState:function(){return wm(Wc)},useDebugValue:Vv,useDeferredValue:function(t){var e=ar();return mC(e,_t.memoizedState,t)},useTransition:function(){var t=wm(Wc)[0],e=ar().memoizedState;return[t,e]},useMutableSource:tC,useSyncExternalStore:nC,useId:gC,unstable_isNewReconciler:!1},K5={readContext:or,useCallback:hC,useContext:or,useEffect:Bv,useImperativeHandle:fC,useInsertionEffect:cC,useLayoutEffect:dC,useMemo:pC,useReducer:bm,useRef:lC,useState:function(){return bm(Wc)},useDebugValue:Vv,useDeferredValue:function(t){var e=ar();return _t===null?e.memoizedState=t:mC(e,_t.memoizedState,t)},useTransition:function(){var t=bm(Wc)[0],e=ar().memoizedState;return[t,e]},useMutableSource:tC,useSyncExternalStore:nC,useId:gC,unstable_isNewReconciler:!1};function yr(t,e){if(t&&t.defaultProps){e=ut({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function cy(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ut({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var dp={isMounted:function(t){return(t=t._reactInternals)?Lo(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=yn(),s=pi(t),i=ks(r,s);i.payload=e,n!=null&&(i.callback=n),e=fi(t,i,s),e!==null&&(Sr(e,t,s,r),Vu(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=yn(),s=pi(t),i=ks(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=fi(t,i,s),e!==null&&(Sr(e,t,s,r),Vu(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=yn(),r=pi(t),s=ks(n,r);s.tag=2,e!=null&&(s.callback=e),e=fi(t,s,r),e!==null&&(Sr(e,t,r,n),Vu(e,t,r))}};function $k(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Pc(n,r)||!Pc(s,i):!0}function kC(t,e,n){var r=!1,s=_i,i=e.contextType;return typeof i=="object"&&i!==null?i=or(i):(s=Mn(e)?mo:dn.current,r=e.contextTypes,i=(r=r!=null)?Da(t,s):_i),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=dp,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function Mk(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&dp.enqueueReplaceState(e,e.state,null)}function dy(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Rv(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=or(i):(i=Mn(e)?mo:dn.current,s.context=Da(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(cy(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&dp.enqueueReplaceState(s,s.state,null),Sf(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Ba(t,e){try{var n="",r=e;do n+=b3(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:t,source:e,stack:s,digest:null}}function Sm(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function uy(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var J5=typeof WeakMap=="function"?WeakMap:Map;function wC(t,e,n){n=ks(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ef||(Ef=!0,wy=r),uy(t,e)},n}function bC(t,e,n){n=ks(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){uy(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){uy(t,e),typeof r!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Tk(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new J5;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=cR.bind(null,t,e,n),e.then(t,t))}function Ok(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Ak(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=ks(-1,1),e.tag=2,fi(n,e,1))),n.lanes|=1),t)}var G5=Is.ReactCurrentOwner,En=!1;function hn(t,e,n,r){e.child=t===null?Yj(e,null,n,r):La(e,t.child,n,r)}function Rk(t,e,n,r,s){n=n.render;var i=e.ref;return Ma(e,s),r=Lv(t,e,n,r,i,s),n=Fv(),t!==null&&!En?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,$s(t,e,s)):(ot&&n&&Nv(e),e.flags|=1,hn(t,e,r,s),e.child)}function Ik(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!Gv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,SC(t,e,i,r,s)):(t=Ku(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Pc,n(o,r)&&t.ref===e.ref)return $s(t,e,s)}return e.flags|=1,t=mi(i,r),t.ref=e.ref,t.return=e,e.child=t}function SC(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Pc(i,r)&&t.ref===e.ref)if(En=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(En=!0);else return e.lanes=t.lanes,$s(t,e,s)}return fy(t,e,n,r,s)}function jC(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(Sa,zn),zn|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,et(Sa,zn),zn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,et(Sa,zn),zn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,et(Sa,zn),zn|=r;return hn(t,e,s,n),e.child}function CC(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function fy(t,e,n,r,s){var i=Mn(n)?mo:dn.current;return i=Da(e,i),Ma(e,s),n=Lv(t,e,n,r,i,s),r=Fv(),t!==null&&!En?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,$s(t,e,s)):(ot&&r&&Nv(e),e.flags|=1,hn(t,e,n,s),e.child)}function Pk(t,e,n,r,s){if(Mn(n)){var i=!0;xf(e)}else i=!1;if(Ma(e,s),e.stateNode===null)Zu(t,e),kC(e,n,r),dy(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=or(c):(c=Mn(n)?mo:dn.current,c=Da(e,c));var f=n.getDerivedStateFromProps,u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Mk(e,o,r,c),Zs=!1;var h=e.memoizedState;o.state=h,Sf(e,r,o,s),l=e.memoizedState,a!==r||h!==l||$n.current||Zs?(typeof f=="function"&&(cy(e,n,f,r),l=e.memoizedState),(a=Zs||$k(e,n,a,r,h,l,c))?(u||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"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Xj(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:yr(e.type,a),o.props=c,u=e.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=or(l):(l=Mn(n)?mo:dn.current,l=Da(e,l));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||h!==l)&&Mk(e,o,r,l),Zs=!1,h=e.memoizedState,o.state=h,Sf(e,r,o,s);var g=e.memoizedState;a!==u||h!==g||$n.current||Zs?(typeof m=="function"&&(cy(e,n,m,r),g=e.memoizedState),(c=Zs||$k(e,n,c,r,h,g,l)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),o.props=r,o.state=g,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return hy(t,e,n,r,i,s)}function hy(t,e,n,r,s,i){CC(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&wk(e,n,!1),$s(t,e,i);r=e.stateNode,G5.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=La(e,t.child,null,i),e.child=La(e,null,a,i)):hn(t,e,a,i),e.memoizedState=r.state,s&&wk(e,n,!0),e.child}function _C(t){var e=t.stateNode;e.pendingContext?kk(t,e.pendingContext,e.pendingContext!==e.context):e.context&&kk(t,e.context,!1),Iv(t,e.containerInfo)}function Dk(t,e,n,r,s){return za(),$v(s),e.flags|=256,hn(t,e,n,r),e.child}var py={dehydrated:null,treeContext:null,retryLane:0};function my(t){return{baseLanes:t,cachePool:null,transitions:null}}function NC(t,e,n){var r=e.pendingProps,s=lt.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),et(lt,s&1),t===null)return ay(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=hp(o,r,0,null),t=lo(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=my(n),e.memoizedState=py,t):Wv(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return Y5(t,e,o,r,a,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=mi(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=mi(a,i):(i=lo(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?my(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=py,r}return i=t.child,t=i.sibling,r=mi(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Wv(t,e){return e=hp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function iu(t,e,n,r){return r!==null&&$v(r),La(e,t.child,null,n),t=Wv(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Y5(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=Sm(Error(X(422))),iu(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=hp({mode:"visible",children:r.children},s,0,null),i=lo(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&La(e,t.child,null,o),e.child.memoizedState=my(o),e.memoizedState=py,i);if(!(e.mode&1))return iu(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(X(419)),r=Sm(i,r,void 0),iu(t,e,o,r)}if(a=(o&t.childLanes)!==0,En||a){if(r=Lt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Es(t,s),Sr(r,t,s,-1))}return Jv(),r=Sm(Error(X(421))),iu(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=dR.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Bn=ui(s.nextSibling),Wn=e,ot=!0,vr=null,t!==null&&(tr[nr++]=gs,tr[nr++]=ys,tr[nr++]=go,gs=t.id,ys=t.overflow,go=e),e=Wv(e,r.children),e.flags|=4096,e)}function zk(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ly(t.return,e,n)}function jm(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function EC(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(hn(t,e,r.children,n),r=lt.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&zk(t,n,e);else if(t.tag===19)zk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(et(lt,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&jf(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),jm(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&jf(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}jm(e,!0,n,null,i);break;case"together":jm(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Zu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function $s(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),xo|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(X(153));if(e.child!==null){for(t=e.child,n=mi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=mi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Q5(t,e,n){switch(e.tag){case 3:_C(e),za();break;case 5:eC(e);break;case 1:Mn(e.type)&&xf(e);break;case 4:Iv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;et(wf,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(et(lt,lt.current&1),e.flags|=128,null):n&e.child.childLanes?NC(t,e,n):(et(lt,lt.current&1),t=$s(t,e,n),t!==null?t.sibling:null);et(lt,lt.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return EC(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),et(lt,lt.current),r)break;return null;case 22:case 23:return e.lanes=0,jC(t,e,n)}return $s(t,e,n)}var $C,gy,MC,TC;$C=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};gy=function(){};MC=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Xi(qr.current);var i=null;switch(n){case"input":s=zg(t,s),r=zg(t,r),i=[];break;case"select":s=ut({},s,{value:void 0}),r=ut({},r,{value:void 0}),i=[];break;case"textarea":s=Bg(t,s),r=Bg(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=gf)}Wg(n,r);var o;n=null;for(c in s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var a=s[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&($c.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=s!=null?s[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&($c.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&tt("scroll",t),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(e.updateQueue=c)&&(e.flags|=4)}};TC=function(t,e,n,r){n!==r&&(e.flags|=4)};function Il(t,e){if(!ot)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function nn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function X5(t,e,n){var r=e.pendingProps;switch(Ev(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(e),null;case 1:return Mn(e.type)&&yf(),nn(e),null;case 3:return r=e.stateNode,Fa(),st($n),st(dn),Dv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(ru(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,vr!==null&&(jy(vr),vr=null))),gy(t,e),nn(e),null;case 5:Pv(e);var s=Xi(Bc.current);if(n=e.type,t!==null&&e.stateNode!=null)MC(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(X(166));return nn(e),null}if(t=Xi(qr.current),ru(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Br]=e,r[Lc]=i,t=(e.mode&1)!==0,n){case"dialog":tt("cancel",r),tt("close",r);break;case"iframe":case"object":case"embed":tt("load",r);break;case"video":case"audio":for(s=0;s<Jl.length;s++)tt(Jl[s],r);break;case"source":tt("error",r);break;case"img":case"image":case"link":tt("error",r),tt("load",r);break;case"details":tt("toggle",r);break;case"input":q0(r,i),tt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},tt("invalid",r);break;case"textarea":J0(r,i),tt("invalid",r)}Wg(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&nu(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&nu(r.textContent,a,t),s=["children",""+a]):$c.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&tt("scroll",r)}switch(n){case"input":Kd(r),K0(r,i,!0);break;case"textarea":Kd(r),G0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=gf)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=ij(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Br]=e,t[Lc]=r,$C(t,e,!1,!1),e.stateNode=t;e:{switch(o=Ug(n,r),n){case"dialog":tt("cancel",t),tt("close",t),s=r;break;case"iframe":case"object":case"embed":tt("load",t),s=r;break;case"video":case"audio":for(s=0;s<Jl.length;s++)tt(Jl[s],t);s=r;break;case"source":tt("error",t),s=r;break;case"img":case"image":case"link":tt("error",t),tt("load",t),s=r;break;case"details":tt("toggle",t),s=r;break;case"input":q0(t,r),s=zg(t,r),tt("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=ut({},r,{value:void 0}),tt("invalid",t);break;case"textarea":J0(t,r),s=Bg(t,r),tt("invalid",t);break;default:s=r}Wg(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?lj(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&oj(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Mc(t,l):typeof l=="number"&&Mc(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($c.hasOwnProperty(i)?l!=null&&i==="onScroll"&&tt("scroll",t):l!=null&&hv(t,i,l,o))}switch(n){case"input":Kd(t),K0(t,r,!1);break;case"textarea":Kd(t),G0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ci(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?_a(t,!!r.multiple,i,!1):r.defaultValue!=null&&_a(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=gf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return nn(e),null;case 6:if(t&&e.stateNode!=null)TC(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(X(166));if(n=Xi(Bc.current),Xi(qr.current),ru(e)){if(r=e.stateNode,n=e.memoizedProps,r[Br]=e,(i=r.nodeValue!==n)&&(t=Wn,t!==null))switch(t.tag){case 3:nu(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&nu(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Br]=e,e.stateNode=r}return nn(e),null;case 13:if(st(lt),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ot&&Bn!==null&&e.mode&1&&!(e.flags&128))Jj(),za(),e.flags|=98560,i=!1;else if(i=ru(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(X(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(X(317));i[Br]=e}else za(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;nn(e),i=!1}else vr!==null&&(jy(vr),vr=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||lt.current&1?Et===0&&(Et=3):Jv())),e.updateQueue!==null&&(e.flags|=4),nn(e),null);case 4:return Fa(),gy(t,e),t===null&&Dc(e.stateNode.containerInfo),nn(e),null;case 10:return Ov(e.type._context),nn(e),null;case 17:return Mn(e.type)&&yf(),nn(e),null;case 19:if(st(lt),i=e.memoizedState,i===null)return nn(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)Il(i,!1);else{if(Et!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=jf(t),o!==null){for(e.flags|=128,Il(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return et(lt,lt.current&1|2),e.child}t=t.sibling}i.tail!==null&&yt()>Va&&(e.flags|=128,r=!0,Il(i,!1),e.lanes=4194304)}else{if(!r)if(t=jf(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Il(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ot)return nn(e),null}else 2*yt()-i.renderingStartTime>Va&&n!==1073741824&&(e.flags|=128,r=!0,Il(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=yt(),e.sibling=null,n=lt.current,et(lt,r?n&1|2:n&1),e):(nn(e),null);case 22:case 23:return Kv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?zn&1073741824&&(nn(e),e.subtreeFlags&6&&(e.flags|=8192)):nn(e),null;case 24:return null;case 25:return null}throw Error(X(156,e.tag))}function eR(t,e){switch(Ev(e),e.tag){case 1:return Mn(e.type)&&yf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Fa(),st($n),st(dn),Dv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Pv(e),null;case 13:if(st(lt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(X(340));za()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return st(lt),null;case 4:return Fa(),null;case 10:return Ov(e.type._context),null;case 22:case 23:return Kv(),null;case 24:return null;default:return null}}var ou=!1,sn=!1,tR=typeof WeakSet=="function"?WeakSet:Set,fe=null;function ba(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pt(t,e,r)}else n.current=null}function yy(t,e,n){try{n()}catch(r){pt(t,e,r)}}var Lk=!1;function nR(t,e){if(ey=hf,t=Pj(),_v(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,f=0,u=t,h=null;t:for(;;){for(var m;u!==n||s!==0&&u.nodeType!==3||(a=o+s),u!==i||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(m=u.firstChild)!==null;)h=u,u=m;for(;;){if(u===t)break t;if(h===n&&++c===s&&(a=o),h===i&&++f===r&&(l=o),(m=u.nextSibling)!==null)break;u=h,h=u.parentNode}u=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ty={focusedElem:t,selectionRange:n},hf=!1,fe=e;fe!==null;)if(e=fe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,fe=t;else for(;fe!==null;){e=fe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,x=g.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?p:yr(e.type,p),x);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(X(163))}}catch(w){pt(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,fe=t;break}fe=e.return}return g=Lk,Lk=!1,g}function fc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&yy(e,n,i)}s=s.next}while(s!==r)}}function up(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function xy(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function OC(t){var e=t.alternate;e!==null&&(t.alternate=null,OC(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Br],delete e[Lc],delete e[sy],delete e[z5],delete e[L5])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function AC(t){return t.tag===5||t.tag===3||t.tag===4}function Fk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||AC(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function vy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=gf));else if(r!==4&&(t=t.child,t!==null))for(vy(t,e,n),t=t.sibling;t!==null;)vy(t,e,n),t=t.sibling}function ky(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(ky(t,e,n),t=t.sibling;t!==null;)ky(t,e,n),t=t.sibling}var Ht=null,xr=!1;function Fs(t,e,n){for(n=n.child;n!==null;)RC(t,e,n),n=n.sibling}function RC(t,e,n){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(rp,n)}catch{}switch(n.tag){case 5:sn||ba(n,e);case 6:var r=Ht,s=xr;Ht=null,Fs(t,e,n),Ht=r,xr=s,Ht!==null&&(xr?(t=Ht,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ht.removeChild(n.stateNode));break;case 18:Ht!==null&&(xr?(t=Ht,n=n.stateNode,t.nodeType===8?ym(t.parentNode,n):t.nodeType===1&&ym(t,n),Rc(t)):ym(Ht,n.stateNode));break;case 4:r=Ht,s=xr,Ht=n.stateNode.containerInfo,xr=!0,Fs(t,e,n),Ht=r,xr=s;break;case 0:case 11:case 14:case 15:if(!sn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&yy(n,e,o),s=s.next}while(s!==r)}Fs(t,e,n);break;case 1:if(!sn&&(ba(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){pt(n,e,a)}Fs(t,e,n);break;case 21:Fs(t,e,n);break;case 22:n.mode&1?(sn=(r=sn)||n.memoizedState!==null,Fs(t,e,n),sn=r):Fs(t,e,n);break;default:Fs(t,e,n)}}function Bk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new tR),e.forEach(function(r){var s=uR.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function pr(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Ht=a.stateNode,xr=!1;break e;case 3:Ht=a.stateNode.containerInfo,xr=!0;break e;case 4:Ht=a.stateNode.containerInfo,xr=!0;break e}a=a.return}if(Ht===null)throw Error(X(160));RC(i,o,s),Ht=null,xr=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(c){pt(s,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)IC(e,t),e=e.sibling}function IC(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(pr(e,t),Ar(t),r&4){try{fc(3,t,t.return),up(3,t)}catch(p){pt(t,t.return,p)}try{fc(5,t,t.return)}catch(p){pt(t,t.return,p)}}break;case 1:pr(e,t),Ar(t),r&512&&n!==null&&ba(n,n.return);break;case 5:if(pr(e,t),Ar(t),r&512&&n!==null&&ba(n,n.return),t.flags&32){var s=t.stateNode;try{Mc(s,"")}catch(p){pt(t,t.return,p)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&rj(s,i),Ug(a,o);var c=Ug(a,i);for(o=0;o<l.length;o+=2){var f=l[o],u=l[o+1];f==="style"?lj(s,u):f==="dangerouslySetInnerHTML"?oj(s,u):f==="children"?Mc(s,u):hv(s,f,u,c)}switch(a){case"input":Lg(s,i);break;case"textarea":sj(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?_a(s,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?_a(s,!!i.multiple,i.defaultValue,!0):_a(s,!!i.multiple,i.multiple?[]:"",!1))}s[Lc]=i}catch(p){pt(t,t.return,p)}}break;case 6:if(pr(e,t),Ar(t),r&4){if(t.stateNode===null)throw Error(X(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(p){pt(t,t.return,p)}}break;case 3:if(pr(e,t),Ar(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rc(e.containerInfo)}catch(p){pt(t,t.return,p)}break;case 4:pr(e,t),Ar(t);break;case 13:pr(e,t),Ar(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Hv=yt())),r&4&&Bk(t);break;case 22:if(f=n!==null&&n.memoizedState!==null,t.mode&1?(sn=(c=sn)||f,pr(e,t),sn=c):pr(e,t),Ar(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!f&&t.mode&1)for(fe=t,f=t.child;f!==null;){for(u=fe=f;fe!==null;){switch(h=fe,m=h.child,h.tag){case 0:case 11:case 14:case 15:fc(4,h,h.return);break;case 1:ba(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(p){pt(r,n,p)}}break;case 5:ba(h,h.return);break;case 22:if(h.memoizedState!==null){Wk(u);continue}}m!==null?(m.return=h,fe=m):Wk(u)}f=f.sibling}e:for(f=null,u=t;;){if(u.tag===5){if(f===null){f=u;try{s=u.stateNode,c?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=u.stateNode,l=u.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=aj("display",o))}catch(p){pt(t,t.return,p)}}}else if(u.tag===6){if(f===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(p){pt(t,t.return,p)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===t)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===t)break e;for(;u.sibling===null;){if(u.return===null||u.return===t)break e;f===u&&(f=null),u=u.return}f===u&&(f=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:pr(e,t),Ar(t),r&4&&Bk(t);break;case 21:break;default:pr(e,t),Ar(t)}}function Ar(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(AC(n)){var r=n;break e}n=n.return}throw Error(X(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Mc(s,""),r.flags&=-33);var i=Fk(t);ky(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Fk(t);vy(t,a,o);break;default:throw Error(X(161))}}catch(l){pt(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function rR(t,e,n){fe=t,PC(t)}function PC(t,e,n){for(var r=(t.mode&1)!==0;fe!==null;){var s=fe,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ou;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||sn;a=ou;var c=sn;if(ou=o,(sn=l)&&!c)for(fe=s;fe!==null;)o=fe,l=o.child,o.tag===22&&o.memoizedState!==null?Uk(s):l!==null?(l.return=o,fe=l):Uk(s);for(;i!==null;)fe=i,PC(i),i=i.sibling;fe=s,ou=a,sn=c}Vk(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,fe=i):Vk(t)}}function Vk(t){for(;fe!==null;){var e=fe;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:sn||up(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!sn)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:yr(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&_k(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}_k(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.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(e.memoizedState===null){var c=e.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var u=f.dehydrated;u!==null&&Rc(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(X(163))}sn||e.flags&512&&xy(e)}catch(h){pt(e,e.return,h)}}if(e===t){fe=null;break}if(n=e.sibling,n!==null){n.return=e.return,fe=n;break}fe=e.return}}function Wk(t){for(;fe!==null;){var e=fe;if(e===t){fe=null;break}var n=e.sibling;if(n!==null){n.return=e.return,fe=n;break}fe=e.return}}function Uk(t){for(;fe!==null;){var e=fe;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{up(4,e)}catch(l){pt(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(l){pt(e,s,l)}}var i=e.return;try{xy(e)}catch(l){pt(e,i,l)}break;case 5:var o=e.return;try{xy(e)}catch(l){pt(e,o,l)}}}catch(l){pt(e,e.return,l)}if(e===t){fe=null;break}var a=e.sibling;if(a!==null){a.return=e.return,fe=a;break}fe=e.return}}var sR=Math.ceil,Nf=Is.ReactCurrentDispatcher,Uv=Is.ReactCurrentOwner,ir=Is.ReactCurrentBatchConfig,We=0,Lt=null,St=null,Gt=0,zn=0,Sa=Li(0),Et=0,Zc=null,xo=0,fp=0,Zv=0,hc=null,Cn=null,Hv=0,Va=1/0,fs=null,Ef=!1,wy=null,hi=null,au=!1,si=null,$f=0,pc=0,by=null,Hu=-1,qu=0;function yn(){return We&6?yt():Hu!==-1?Hu:Hu=yt()}function pi(t){return t.mode&1?We&2&&Gt!==0?Gt&-Gt:B5.transition!==null?(qu===0&&(qu=kj()),qu):(t=Je,t!==0||(t=window.event,t=t===void 0?16:Nj(t.type)),t):1}function Sr(t,e,n,r){if(50<pc)throw pc=0,by=null,Error(X(185));xd(t,n,r),(!(We&2)||t!==Lt)&&(t===Lt&&(!(We&2)&&(fp|=n),Et===4&&Xs(t,Gt)),Tn(t,r),n===1&&We===0&&!(e.mode&1)&&(Va=yt()+500,lp&&Fi()))}function Tn(t,e){var n=t.callbackNode;B3(t,e);var r=ff(t,t===Lt?Gt:0);if(r===0)n!==null&&X0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&X0(n),e===1)t.tag===0?F5(Zk.bind(null,t)):Hj(Zk.bind(null,t)),P5(function(){!(We&6)&&Fi()}),n=null;else{switch(wj(r)){case 1:n=xv;break;case 4:n=xj;break;case 16:n=uf;break;case 536870912:n=vj;break;default:n=uf}n=UC(n,DC.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function DC(t,e){if(Hu=-1,qu=0,We&6)throw Error(X(327));var n=t.callbackNode;if(Ta()&&t.callbackNode!==n)return null;var r=ff(t,t===Lt?Gt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Mf(t,r);else{e=r;var s=We;We|=2;var i=LC();(Lt!==t||Gt!==e)&&(fs=null,Va=yt()+500,ao(t,e));do try{aR();break}catch(a){zC(t,a)}while(!0);Tv(),Nf.current=i,We=s,St!==null?e=0:(Lt=null,Gt=0,e=Et)}if(e!==0){if(e===2&&(s=Jg(t),s!==0&&(r=s,e=Sy(t,s))),e===1)throw n=Zc,ao(t,0),Xs(t,r),Tn(t,yt()),n;if(e===6)Xs(t,r);else{if(s=t.current.alternate,!(r&30)&&!iR(s)&&(e=Mf(t,r),e===2&&(i=Jg(t),i!==0&&(r=i,e=Sy(t,i))),e===1))throw n=Zc,ao(t,0),Xs(t,r),Tn(t,yt()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(X(345));case 2:Ki(t,Cn,fs);break;case 3:if(Xs(t,r),(r&130023424)===r&&(e=Hv+500-yt(),10<e)){if(ff(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){yn(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=ry(Ki.bind(null,t,Cn,fs),e);break}Ki(t,Cn,fs);break;case 4:if(Xs(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-br(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=yt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sR(r/1960))-r,10<r){t.timeoutHandle=ry(Ki.bind(null,t,Cn,fs),r);break}Ki(t,Cn,fs);break;case 5:Ki(t,Cn,fs);break;default:throw Error(X(329))}}}return Tn(t,yt()),t.callbackNode===n?DC.bind(null,t):null}function Sy(t,e){var n=hc;return t.current.memoizedState.isDehydrated&&(ao(t,e).flags|=256),t=Mf(t,e),t!==2&&(e=Cn,Cn=n,e!==null&&jy(e)),t}function jy(t){Cn===null?Cn=t:Cn.push.apply(Cn,t)}function iR(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!_r(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Xs(t,e){for(e&=~Zv,e&=~fp,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-br(e),r=1<<n;t[n]=-1,e&=~r}}function Zk(t){if(We&6)throw Error(X(327));Ta();var e=ff(t,0);if(!(e&1))return Tn(t,yt()),null;var n=Mf(t,e);if(t.tag!==0&&n===2){var r=Jg(t);r!==0&&(e=r,n=Sy(t,r))}if(n===1)throw n=Zc,ao(t,0),Xs(t,e),Tn(t,yt()),n;if(n===6)throw Error(X(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Ki(t,Cn,fs),Tn(t,yt()),null}function qv(t,e){var n=We;We|=1;try{return t(e)}finally{We=n,We===0&&(Va=yt()+500,lp&&Fi())}}function vo(t){si!==null&&si.tag===0&&!(We&6)&&Ta();var e=We;We|=1;var n=ir.transition,r=Je;try{if(ir.transition=null,Je=1,t)return t()}finally{Je=r,ir.transition=n,We=e,!(We&6)&&Fi()}}function Kv(){zn=Sa.current,st(Sa)}function ao(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,I5(n)),St!==null)for(n=St.return;n!==null;){var r=n;switch(Ev(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&yf();break;case 3:Fa(),st($n),st(dn),Dv();break;case 5:Pv(r);break;case 4:Fa();break;case 13:st(lt);break;case 19:st(lt);break;case 10:Ov(r.type._context);break;case 22:case 23:Kv()}n=n.return}if(Lt=t,St=t=mi(t.current,null),Gt=zn=e,Et=0,Zc=null,Zv=fp=xo=0,Cn=hc=null,Qi!==null){for(e=0;e<Qi.length;e++)if(n=Qi[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Qi=null}return t}function zC(t,e){do{var n=St;try{if(Tv(),Wu.current=_f,Cf){for(var r=ct.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Cf=!1}if(yo=0,It=_t=ct=null,uc=!1,Vc=0,Uv.current=null,n===null||n.return===null){Et=1,Zc=e,St=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=Gt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,u=f.tag;if(!(f.mode&1)&&(u===0||u===11||u===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=Ok(o);if(m!==null){m.flags&=-257,Ak(m,o,a,i,e),m.mode&1&&Tk(i,c,e),e=m,l=c;var g=e.updateQueue;if(g===null){var p=new Set;p.add(l),e.updateQueue=p}else g.add(l);break e}else{if(!(e&1)){Tk(i,c,e),Jv();break e}l=Error(X(426))}}else if(ot&&a.mode&1){var x=Ok(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Ak(x,o,a,i,e),$v(Ba(l,a));break e}}i=l=Ba(l,a),Et!==4&&(Et=2),hc===null?hc=[i]:hc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=wC(i,l,e);Ck(i,y);break e;case 1:a=l;var v=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(hi===null||!hi.has(k)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=bC(i,a,e);Ck(i,w);break e}}i=i.return}while(i!==null)}BC(n)}catch(j){e=j,St===n&&n!==null&&(St=n=n.return);continue}break}while(!0)}function LC(){var t=Nf.current;return Nf.current=_f,t===null?_f:t}function Jv(){(Et===0||Et===3||Et===2)&&(Et=4),Lt===null||!(xo&268435455)&&!(fp&268435455)||Xs(Lt,Gt)}function Mf(t,e){var n=We;We|=2;var r=LC();(Lt!==t||Gt!==e)&&(fs=null,ao(t,e));do try{oR();break}catch(s){zC(t,s)}while(!0);if(Tv(),We=n,Nf.current=r,St!==null)throw Error(X(261));return Lt=null,Gt=0,Et}function oR(){for(;St!==null;)FC(St)}function aR(){for(;St!==null&&!O3();)FC(St)}function FC(t){var e=WC(t.alternate,t,zn);t.memoizedProps=t.pendingProps,e===null?BC(t):St=e,Uv.current=null}function BC(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=eR(n,e),n!==null){n.flags&=32767,St=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,St=null;return}}else if(n=X5(n,e,zn),n!==null){St=n;return}if(e=e.sibling,e!==null){St=e;return}St=e=t}while(e!==null);Et===0&&(Et=5)}function Ki(t,e,n){var r=Je,s=ir.transition;try{ir.transition=null,Je=1,lR(t,e,n,r)}finally{ir.transition=s,Je=r}return null}function lR(t,e,n,r){do Ta();while(si!==null);if(We&6)throw Error(X(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(X(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(V3(t,i),t===Lt&&(St=Lt=null,Gt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||au||(au=!0,UC(uf,function(){return Ta(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ir.transition,ir.transition=null;var o=Je;Je=1;var a=We;We|=4,Uv.current=null,nR(t,n),IC(n,t),E5(ty),hf=!!ey,ty=ey=null,t.current=n,rR(n),A3(),We=a,Je=o,ir.transition=i}else t.current=n;if(au&&(au=!1,si=t,$f=s),i=t.pendingLanes,i===0&&(hi=null),P3(n.stateNode),Tn(t,yt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Ef)throw Ef=!1,t=wy,wy=null,t;return $f&1&&t.tag!==0&&Ta(),i=t.pendingLanes,i&1?t===by?pc++:(pc=0,by=t):pc=0,Fi(),null}function Ta(){if(si!==null){var t=wj($f),e=ir.transition,n=Je;try{if(ir.transition=null,Je=16>t?16:t,si===null)var r=!1;else{if(t=si,si=null,$f=0,We&6)throw Error(X(331));var s=We;for(We|=4,fe=t.current;fe!==null;){var i=fe,o=i.child;if(fe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(fe=c;fe!==null;){var f=fe;switch(f.tag){case 0:case 11:case 15:fc(8,f,i)}var u=f.child;if(u!==null)u.return=f,fe=u;else for(;fe!==null;){f=fe;var h=f.sibling,m=f.return;if(OC(f),f===c){fe=null;break}if(h!==null){h.return=m,fe=h;break}fe=m}}}var g=i.alternate;if(g!==null){var p=g.child;if(p!==null){g.child=null;do{var x=p.sibling;p.sibling=null,p=x}while(p!==null)}}fe=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,fe=o;else e:for(;fe!==null;){if(i=fe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fc(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,fe=y;break e}fe=i.return}}var v=t.current;for(fe=v;fe!==null;){o=fe;var k=o.child;if(o.subtreeFlags&2064&&k!==null)k.return=o,fe=k;else e:for(o=v;fe!==null;){if(a=fe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:up(9,a)}}catch(j){pt(a,a.return,j)}if(a===o){fe=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,fe=w;break e}fe=a.return}}if(We=s,Fi(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(rp,t)}catch{}r=!0}return r}finally{Je=n,ir.transition=e}}return!1}function Hk(t,e,n){e=Ba(n,e),e=wC(t,e,1),t=fi(t,e,1),e=yn(),t!==null&&(xd(t,1,e),Tn(t,e))}function pt(t,e,n){if(t.tag===3)Hk(t,t,n);else for(;e!==null;){if(e.tag===3){Hk(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hi===null||!hi.has(r))){t=Ba(n,t),t=bC(e,t,1),e=fi(e,t,1),t=yn(),e!==null&&(xd(e,1,t),Tn(e,t));break}}e=e.return}}function cR(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=yn(),t.pingedLanes|=t.suspendedLanes&n,Lt===t&&(Gt&n)===n&&(Et===4||Et===3&&(Gt&130023424)===Gt&&500>yt()-Hv?ao(t,0):Zv|=n),Tn(t,e)}function VC(t,e){e===0&&(t.mode&1?(e=Yd,Yd<<=1,!(Yd&130023424)&&(Yd=4194304)):e=1);var n=yn();t=Es(t,e),t!==null&&(xd(t,e,n),Tn(t,n))}function dR(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),VC(t,n)}function uR(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(X(314))}r!==null&&r.delete(e),VC(t,n)}var WC;WC=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||$n.current)En=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return En=!1,Q5(t,e,n);En=!!(t.flags&131072)}else En=!1,ot&&e.flags&1048576&&qj(e,kf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Zu(t,e),t=e.pendingProps;var s=Da(e,dn.current);Ma(e,n),s=Lv(null,e,r,t,s,n);var i=Fv();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Mn(r)?(i=!0,xf(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Rv(e),s.updater=dp,e.stateNode=s,s._reactInternals=e,dy(e,r,t,n),e=hy(null,e,r,!0,i,n)):(e.tag=0,ot&&i&&Nv(e),hn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Zu(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=hR(r),t=yr(r,t),s){case 0:e=fy(null,e,r,t,n);break e;case 1:e=Pk(null,e,r,t,n);break e;case 11:e=Rk(null,e,r,t,n);break e;case 14:e=Ik(null,e,r,yr(r.type,t),n);break e}throw Error(X(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),fy(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),Pk(t,e,r,s,n);case 3:e:{if(_C(e),t===null)throw Error(X(387));r=e.pendingProps,i=e.memoizedState,s=i.element,Xj(t,e),Sf(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Ba(Error(X(423)),e),e=Dk(t,e,r,n,s);break e}else if(r!==s){s=Ba(Error(X(424)),e),e=Dk(t,e,r,n,s);break e}else for(Bn=ui(e.stateNode.containerInfo.firstChild),Wn=e,ot=!0,vr=null,n=Yj(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(za(),r===s){e=$s(t,e,n);break e}hn(t,e,r,n)}e=e.child}return e;case 5:return eC(e),t===null&&ay(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,ny(r,s)?o=null:i!==null&&ny(r,i)&&(e.flags|=32),CC(t,e),hn(t,e,o,n),e.child;case 6:return t===null&&ay(e),null;case 13:return NC(t,e,n);case 4:return Iv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=La(e,null,r,n):hn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),Rk(t,e,r,s,n);case 7:return hn(t,e,e.pendingProps,n),e.child;case 8:return hn(t,e,e.pendingProps.children,n),e.child;case 12:return hn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,et(wf,r._currentValue),r._currentValue=o,i!==null)if(_r(i.value,o)){if(i.children===s.children&&!$n.current){e=$s(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=ks(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),ly(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(X(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ly(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}hn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Ma(e,n),s=or(s),r=r(s),e.flags|=1,hn(t,e,r,n),e.child;case 14:return r=e.type,s=yr(r,e.pendingProps),s=yr(r.type,s),Ik(t,e,r,s,n);case 15:return SC(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),Zu(t,e),e.tag=1,Mn(r)?(t=!0,xf(e)):t=!1,Ma(e,n),kC(e,r,s),dy(e,r,s,n),hy(null,e,r,!0,t,n);case 19:return EC(t,e,n);case 22:return jC(t,e,n)}throw Error(X(156,e.tag))};function UC(t,e){return yj(t,e)}function fR(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 sr(t,e,n,r){return new fR(t,e,n,r)}function Gv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hR(t){if(typeof t=="function")return Gv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===mv)return 11;if(t===gv)return 14}return 2}function mi(t,e){var n=t.alternate;return n===null?(n=sr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ku(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Gv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ha:return lo(n.children,s,i,e);case pv:o=8,s|=8;break;case Rg:return t=sr(12,n,e,s|2),t.elementType=Rg,t.lanes=i,t;case Ig:return t=sr(13,n,e,s),t.elementType=Ig,t.lanes=i,t;case Pg:return t=sr(19,n,e,s),t.elementType=Pg,t.lanes=i,t;case ej:return hp(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case QS:o=10;break e;case XS:o=9;break e;case mv:o=11;break e;case gv:o=14;break e;case Us:o=16,r=null;break e}throw Error(X(130,t==null?t:typeof t,""))}return e=sr(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function lo(t,e,n,r){return t=sr(7,t,r,e),t.lanes=n,t}function hp(t,e,n,r){return t=sr(22,t,r,e),t.elementType=ej,t.lanes=n,t.stateNode={isHidden:!1},t}function Cm(t,e,n){return t=sr(6,t,null,e),t.lanes=n,t}function _m(t,e,n){return e=sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function pR(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=om(0),this.expirationTimes=om(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=om(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Yv(t,e,n,r,s,i,o,a,l){return t=new pR(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=sr(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rv(i),t}function mR(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fa,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function ZC(t){if(!t)return _i;t=t._reactInternals;e:{if(Lo(t)!==t||t.tag!==1)throw Error(X(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Mn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(X(171))}if(t.tag===1){var n=t.type;if(Mn(n))return Zj(t,n,e)}return e}function HC(t,e,n,r,s,i,o,a,l){return t=Yv(n,r,!0,t,s,i,o,a,l),t.context=ZC(null),n=t.current,r=yn(),s=pi(n),i=ks(r,s),i.callback=e??null,fi(n,i,s),t.current.lanes=s,xd(t,s,r),Tn(t,r),t}function pp(t,e,n,r){var s=e.current,i=yn(),o=pi(s);return n=ZC(n),e.context===null?e.context=n:e.pendingContext=n,e=ks(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=fi(s,e,o),t!==null&&(Sr(t,s,o,i),Vu(t,s,o)),o}function Tf(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function qk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Qv(t,e){qk(t,e),(t=t.alternate)&&qk(t,e)}function gR(){return null}var qC=typeof reportError=="function"?reportError:function(t){console.error(t)};function Xv(t){this._internalRoot=t}mp.prototype.render=Xv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(X(409));pp(t,e,null,null)};mp.prototype.unmount=Xv.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;vo(function(){pp(null,t,null,null)}),e[Ns]=null}};function mp(t){this._internalRoot=t}mp.prototype.unstable_scheduleHydration=function(t){if(t){var e=jj();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Qs.length&&e!==0&&e<Qs[n].priority;n++);Qs.splice(n,0,t),n===0&&_j(t)}};function e1(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function gp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Kk(){}function yR(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var c=Tf(o);i.call(c)}}var o=HC(e,r,t,0,null,!1,!1,"",Kk);return t._reactRootContainer=o,t[Ns]=o.current,Dc(t.nodeType===8?t.parentNode:t),vo(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var c=Tf(l);a.call(c)}}var l=Yv(t,0,!1,null,null,!1,!1,"",Kk);return t._reactRootContainer=l,t[Ns]=l.current,Dc(t.nodeType===8?t.parentNode:t),vo(function(){pp(e,l,n,r)}),l}function yp(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=Tf(o);a.call(l)}}pp(e,o,t,s)}else o=yR(n,e,t,s,r);return Tf(o)}bj=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Kl(e.pendingLanes);n!==0&&(vv(e,n|1),Tn(e,yt()),!(We&6)&&(Va=yt()+500,Fi()))}break;case 13:vo(function(){var r=Es(t,1);if(r!==null){var s=yn();Sr(r,t,1,s)}}),Qv(t,1)}};kv=function(t){if(t.tag===13){var e=Es(t,134217728);if(e!==null){var n=yn();Sr(e,t,134217728,n)}Qv(t,134217728)}};Sj=function(t){if(t.tag===13){var e=pi(t),n=Es(t,e);if(n!==null){var r=yn();Sr(n,t,e,r)}Qv(t,e)}};jj=function(){return Je};Cj=function(t,e){var n=Je;try{return Je=t,e()}finally{Je=n}};Hg=function(t,e,n){switch(e){case"input":if(Lg(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=ap(r);if(!s)throw Error(X(90));nj(r),Lg(r,s)}}}break;case"textarea":sj(t,n);break;case"select":e=n.value,e!=null&&_a(t,!!n.multiple,e,!1)}};uj=qv;fj=vo;var xR={usingClientEntryPoint:!1,Events:[kd,ya,ap,cj,dj,qv]},Pl={findFiberByHostInstance:Yi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vR={bundleType:Pl.bundleType,version:Pl.version,rendererPackageName:Pl.rendererPackageName,rendererConfig:Pl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Is.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=mj(t),t===null?null:t.stateNode},findFiberByHostInstance:Pl.findFiberByHostInstance||gR,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 lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{rp=lu.inject(vR),Hr=lu}catch{}}Kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xR;Kn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e1(e))throw Error(X(200));return mR(t,e,null,n)};Kn.createRoot=function(t,e){if(!e1(t))throw Error(X(299));var n=!1,r="",s=qC;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Yv(t,1,!1,null,null,n,!1,r,s),t[Ns]=e.current,Dc(t.nodeType===8?t.parentNode:t),new Xv(e)};Kn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(X(188)):(t=Object.keys(t).join(","),Error(X(268,t)));return t=mj(e),t=t===null?null:t.stateNode,t};Kn.flushSync=function(t){return vo(t)};Kn.hydrate=function(t,e,n){if(!gp(e))throw Error(X(200));return yp(null,t,e,!0,n)};Kn.hydrateRoot=function(t,e,n){if(!e1(t))throw Error(X(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=qC;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=HC(e,null,t,1,n??null,s,!1,i,o),t[Ns]=e.current,Dc(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new mp(e)};Kn.render=function(t,e,n){if(!gp(e))throw Error(X(200));return yp(null,t,e,!1,n)};Kn.unmountComponentAtNode=function(t){if(!gp(t))throw Error(X(40));return t._reactRootContainer?(vo(function(){yp(null,null,t,!1,function(){t._reactRootContainer=null,t[Ns]=null})}),!0):!1};Kn.unstable_batchedUpdates=qv;Kn.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!gp(n))throw Error(X(200));if(t==null||t._reactInternals===void 0)throw Error(X(38));return yp(t,e,n,!1,r)};Kn.version="18.3.1-next-f1338f8080-20240426";function KC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(KC)}catch(t){console.error(t)}}KC(),KS.exports=Kn;var bd=KS.exports;const kR=PS(bd);var JC,Jk=bd;JC=Jk.createRoot,Jk.hydrateRoot;function ko(t,e=8){if(t.length<2)return"";let n=`M ${t[0].x} ${t[0].y}`;for(let s=1;s<t.length-1;s++){const i=t[s-1],o=t[s],a=t[s+1],l=Math.hypot(o.x-i.x,o.y-i.y),c=Math.hypot(a.x-o.x,a.y-o.y),f=Math.min(e,l/2,c/2);if(f<.5){n+=` L ${o.x} ${o.y}`;continue}const u={x:o.x-(o.x-i.x)/l*f,y:o.y-(o.y-i.y)/l*f},h={x:o.x+(a.x-o.x)/c*f,y:o.y+(a.y-o.y)/c*f};n+=` L ${u.x} ${u.y} Q ${o.x} ${o.y} ${h.x} ${h.y}`}const r=t[t.length-1];return`${n} L ${r.x} ${r.y}`}function GC(t,e){if(t.length<2||e<=0)return t;const n=t.slice(),r=n[n.length-2],s=n[n.length-1],i=Math.hypot(s.x-r.x,s.y-r.y);return i<=e||(n[n.length-1]={x:s.x-(s.x-r.x)/i*e,y:s.y-(s.y-r.y)/i*e}),n}function YC(t){const e=t[t.length-2],n=t[t.length-1];return Math.atan2(n.y-e.y,n.x-e.x)}function wR(t){const e=t[1],n=t[0];return Math.atan2(n.y-e.y,n.x-e.x)}function bR(t){let e=0,n=-1;for(let i=0;i<t.length-1;i++){const o=Math.hypot(t[i+1].x-t[i].x,t[i+1].y-t[i].y);o>n&&(n=o,e=i)}const r=t[e],s=t[e+1]??r;return{x:(r.x+s.x)/2,y:(r.y+s.y)/2,horizontal:Math.abs(s.x-r.x)>=Math.abs(s.y-r.y)}}function Ni(t){if(t.length===0)return{x:0,y:0,w:0,h:0};const e=Math.min(...t.map(i=>i.x)),n=Math.min(...t.map(i=>i.y)),r=Math.max(...t.map(i=>i.x+i.w)),s=Math.max(...t.map(i=>i.y+i.h));return{x:e,y:n,w:r-e,h:s-n}}const SR=(t,e,n,r)=>t.length*e*(r==="mono"?.6:n>=600?.56:.52);let jR={sans:'"Hanken Grotesk Variable", ui-sans-serif, system-ui, sans-serif',mono:'"JetBrains Mono Variable", ui-monospace, monospace'};function CR(){if(typeof document>"u")return;const t=document.createElement("canvas").getContext("2d");if(t)return(e,n,r,s)=>(t.font=`${r} ${n}px ${jR[s]}`,t.measureText(e).width)}let Gk;function Oe(t,e=13,n=400,r="sans"){return Gk??(Gk=CR()??SR),Gk(t,e,n,r)}function Of(t,e,n=13,r=400,s=2){const i=t.split(/\s+/).filter(Boolean),o=[];let a="";for(const f of i){const u=a?`${a} ${f}`:f;Oe(u,n,r)<=e||!a?a=u:(o.push(a),a=f)}if(a&&o.push(a),o.length<=s)return o;const l=o.slice(0,s);let c=l[s-1];for(;c.length>1&&Oe(`${c}…`,n,r)>e;)c=c.slice(0,-1).trimEnd();return l[s-1]=`${c}…`,l}function Nt(t,e,n=13,r=400,s="sans"){if(Oe(t,n,r,s)<=e)return t;let i=t;for(;i.length>1&&Oe(`${i}…`,n,r,s)>e;)i=i.slice(0,-1);return`${i.trimEnd()}…`}const _R="modulepreload",NR=function(t){return"/"+t},Yk={},t1=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=NR(l),l in Yk)return;Yk[l]=!0;const c=l.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":_R,c||(u.as="script"),u.crossOrigin="",u.href=l,a&&u.setAttribute("nonce",a),document.head.appendChild(u),c)return new Promise((h,m)=>{u.addEventListener("load",h),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};let ER;const $R=()=>ER??(ER=t1(()=>import("./elk.bundled-Iz862-nW.js").then(t=>t.e),[]).then(t=>new t.default)),Sd={"elk.algorithm":"layered","elk.edgeRouting":"ORTHOGONAL","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"};async function jd(t){var a;const e=await(await $R()).layout(t),n=new Map,r=new Map([[e.id,{x:0,y:0}]]),s=(l,c,f,u)=>{var g;const h=c+(l.x??0),m=f+(l.y??0);r.set(l.id,{x:h,y:m}),n.set(l.id,{id:l.id,parent:u,x:h,y:m,w:l.width??0,h:l.height??0}),(g=l.children)==null||g.forEach(p=>s(p,h,m,l.id))};(a=e.children)==null||a.forEach(l=>s(l,0,0));const i=new Map,o=l=>{var c,f;(c=l.edges)==null||c.forEach(u=>{var v;const h=u.container??l.id,m=r.get(h)??{x:0,y:0},g=k=>({x:k.x+m.x,y:k.y+m.y}),p=(v=u.sections)==null?void 0:v[0],x=p?[p.startPoint,...p.bendPoints??[],p.endPoint].map(g):[],y=(u.labels??[]).map(k=>({text:k.text??"",x:(k.x??0)+m.x,y:(k.y??0)+m.y,w:k.width??0,h:k.height??0}));i.set(u.id,{id:u.id,points:x,labels:y})}),(f=l.children)==null||f.forEach(o)};return o(e),{width:e.width??0,height:e.height??0,nodes:n,edges:i}}var Ve;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ve||(Ve={}));var Qk;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Qk||(Qk={}));const he=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hs=t=>{switch(typeof t){case"undefined":return he.undefined;case"string":return he.string;case"number":return Number.isNaN(t)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(t)?he.array:t===null?he.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?he.promise:typeof Map<"u"&&t instanceof Map?he.map:typeof Set<"u"&&t instanceof Set?he.set:typeof Date<"u"&&t instanceof Date?he.date:he.object;default:return he.unknown}},ee=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let wo=class QC extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof QC))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};wo.create=t=>new wo(t);const Cy=(t,e)=>{let n;switch(t.code){case ee.invalid_type:t.received===he.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ve.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ve.joinValues(t.keys,", ")}`;break;case ee.invalid_union:n="Invalid input";break;case ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ve.joinValues(t.options)}`;break;case ee.invalid_enum_value:n=`Invalid enum value. Expected ${Ve.joinValues(t.options)}, received '${t.received}'`;break;case ee.invalid_arguments:n="Invalid function arguments";break;case ee.invalid_return_type:n="Invalid function return type";break;case ee.invalid_date:n="Invalid date";break;case ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ve.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ee.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ee.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ee.custom:n="Invalid input";break;case ee.invalid_intersection_types:n="Intersection results could not be merged";break;case ee.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ee.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ve.assertNever(t)}return{message:n}};let MR=Cy;function TR(){return MR}const OR=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ie(t,e){const n=TR(),r=OR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Cy?void 0:Cy].filter(s=>!!s)});t.common.issues.push(r)}let Hn=class XC{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return je;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return XC.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return je;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}};const je=Object.freeze({status:"aborted"}),Gl=t=>({status:"dirty",value:t}),cr=t=>({status:"valid",value:t}),Xk=t=>t.status==="aborted",ew=t=>t.status==="dirty",Wa=t=>t.status==="valid",Af=t=>typeof Promise<"u"&&t instanceof Promise;var ge;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ge||(ge={}));let Jr=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const tw=(t,e)=>{if(Wa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new wo(t.common.issues);return this._error=n,this._error}}};function Ae(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let Fe=class{get description(){return this._def.description}_getType(e){return Hs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hn,ctx:{common:e.parent.common,data:e.data,parsedType:Hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Af(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return tw(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Wa(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Wa(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Af(s)?s:Promise.resolve(s));return tw(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ee.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new bo({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ws.create(this,this._def)}nullable(){return So.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ua.create(this)}promise(){return Ff.create(this,this._def)}or(e){return If.create([this,e],this._def)}and(e){return Pf.create(this,e,this._def)}transform(e){return new bo({...Ae(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Bf({...Ae(this._def),innerType:this,defaultValue:n,typeName:Ce.ZodDefault})}brand(){return new i_({typeName:Ce.ZodBranded,type:this,...Ae(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Vf({...Ae(this._def),innerType:this,catchValue:n,typeName:Ce.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return tI.create(this,e)}readonly(){return Wf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const AR=/^c[^\s-]{8,}$/i,RR=/^[0-9a-z]+$/,IR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,DR=/^[a-z0-9_-]{21}$/i,zR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,FR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,BR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nm;const VR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,WR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ZR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,e_="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",KR=new RegExp(`^${e_}$`);function t_(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function JR(t){return new RegExp(`^${t_(t)}$`)}function GR(t){let e=`${e_}T${t_(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function YR(t,e){return!!((e==="v4"||!e)&&VR.test(t)||(e==="v6"||!e)&&UR.test(t))}function QR(t,e){if(!zR.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function XR(t,e){return!!((e==="v4"||!e)&&WR.test(t)||(e==="v6"||!e)&&ZR.test(t))}let Rf=class Yl extends Fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==he.string){const i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:he.string,received:i.parsedType}),je}const r=new Hn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ie(s,{code:ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ie(s,{code:ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")FR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"email",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Nm||(Nm=new RegExp(BR,"u")),Nm.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"emoji",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")PR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"uuid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")DR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"nanoid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")AR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cuid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")RR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cuid2",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")IR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"ulid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ie(s,{validation:"url",code:ee.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"regex",code:ee.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?GR(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?KR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?JR(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?LR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"duration",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?YR(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"ip",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?QR(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"jwt",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?XR(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cidr",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?HR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"base64",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?qR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"base64url",code:ee.invalid_string,message:i.message}),r.dirty()):Ve.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ee.invalid_string,...ge.errToObj(r)})}_addCheck(e){return new Yl({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ge.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ge.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ge.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ge.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ge.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ge.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ge.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ge.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ge.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ge.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ge.errToObj(n)})}nonempty(e){return this.min(1,ge.errToObj(e))}trim(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Rf.create=t=>new Rf({checks:[],typeName:Ce.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ae(t)});function eI(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let _y=class Ny extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==he.number){const i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:he.number,received:i.parsedType}),je}let r;const s=new Hn;for(const i of this._def.checks)i.kind==="int"?Ve.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?eI(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.not_finite,message:i.message}),s.dirty()):Ve.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ge.toString(n))}setLimit(e,n,r,s){return new Ny({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(e){return new Ny({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ve.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};_y.create=t=>new _y({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ae(t)});let nw=class Ey extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==he.bigint)return this._getInvalidInput(e);let r;const s=new Hn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ve.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ie(n,{code:ee.invalid_type,expected:he.bigint,received:n.parsedType}),je}gte(e,n){return this.setLimit("min",e,!0,ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ge.toString(n))}setLimit(e,n,r,s){return new Ey({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(e){return new Ey({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};nw.create=t=>new nw({checks:[],typeName:Ce.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ae(t)});let $y=class extends Fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==he.boolean){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.boolean,received:r.parsedType}),je}return cr(e.data)}};$y.create=t=>new $y({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ae(t)});let rw=class n_ extends Fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==he.date){const i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_type,expected:he.date,received:i.parsedType}),je}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ie(i,{code:ee.invalid_date}),je}const r=new Hn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ve.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n_({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ge.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ge.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};rw.create=t=>new rw({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ce.ZodDate,...Ae(t)});let sw=class extends Fe{_parse(e){if(this._getType(e)!==he.symbol){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.symbol,received:r.parsedType}),je}return cr(e.data)}};sw.create=t=>new sw({typeName:Ce.ZodSymbol,...Ae(t)});let My=class extends Fe{_parse(e){if(this._getType(e)!==he.undefined){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.undefined,received:r.parsedType}),je}return cr(e.data)}};My.create=t=>new My({typeName:Ce.ZodUndefined,...Ae(t)});let Ty=class extends Fe{_parse(e){if(this._getType(e)!==he.null){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.null,received:r.parsedType}),je}return cr(e.data)}};Ty.create=t=>new Ty({typeName:Ce.ZodNull,...Ae(t)});let iw=class extends Fe{constructor(){super(...arguments),this._any=!0}_parse(e){return cr(e.data)}};iw.create=t=>new iw({typeName:Ce.ZodAny,...Ae(t)});let Oy=class extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return cr(e.data)}};Oy.create=t=>new Oy({typeName:Ce.ZodUnknown,...Ae(t)});let Ei=class extends Fe{_parse(e){const n=this._getOrReturnCtx(e);return ie(n,{code:ee.invalid_type,expected:he.never,received:n.parsedType}),je}};Ei.create=t=>new Ei({typeName:Ce.ZodNever,...Ae(t)});let ow=class extends Fe{_parse(e){if(this._getType(e)!==he.undefined){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.void,received:r.parsedType}),je}return cr(e.data)}};ow.create=t=>new ow({typeName:Ce.ZodVoid,...Ae(t)});let Ua=class Ju extends Fe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==he.array)return ie(n,{code:ee.invalid_type,expected:he.array,received:n.parsedType}),je;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ie(n,{code:o?ee.too_big:ee.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ie(n,{code:ee.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ie(n,{code:ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Jr(n,o,n.path,a)))).then(o=>Hn.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Jr(n,o,n.path,a)));return Hn.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Ju({...this._def,minLength:{value:e,message:ge.toString(n)}})}max(e,n){return new Ju({...this._def,maxLength:{value:e,message:ge.toString(n)}})}length(e,n){return new Ju({...this._def,exactLength:{value:e,message:ge.toString(n)}})}nonempty(e){return this.min(1,e)}};Ua.create=(t,e)=>new Ua({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Ae(e)});function ea(t){if(t instanceof Ms){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ws.create(ea(r))}return new Ms({...t._def,shape:()=>e})}else return t instanceof Ua?new Ua({...t._def,type:ea(t.element)}):t instanceof ws?ws.create(ea(t.unwrap())):t instanceof So?So.create(ea(t.unwrap())):t instanceof Hc?Hc.create(t.items.map(e=>ea(e))):t}let Ms=class mr extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Ve.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==he.object){const c=this._getOrReturnCtx(e);return ie(c,{code:ee.invalid_type,expected:he.object,received:c.parsedType}),je}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const f=i[c],u=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Jr(s,u,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ei){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")a.length>0&&(ie(s,{code:ee.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Jr(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const u=await f.key,h=await f.value;c.push({key:u,value:h,alwaysSet:f.alwaysSet})}return c}).then(c=>Hn.mergeObjectSync(r,c)):Hn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ge.errToObj,new mr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ge.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new mr({...this._def,unknownKeys:"strip"})}passthrough(){return new mr({...this._def,unknownKeys:"passthrough"})}extend(e){return new mr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new mr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new mr({...this._def,catchall:e})}pick(e){const n={};for(const r of Ve.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new mr({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Ve.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new mr({...this._def,shape:()=>n})}deepPartial(){return ea(this)}partial(e){const n={};for(const r of Ve.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new mr({...this._def,shape:()=>n})}required(e){const n={};for(const r of Ve.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ws;)i=i._def.innerType;n[r]=i}return new mr({...this._def,shape:()=>n})}keyof(){return s_(Ve.objectKeys(this.shape))}};Ms.create=(t,e)=>new Ms({shape:()=>t,unknownKeys:"strip",catchall:Ei.create(),typeName:Ce.ZodObject,...Ae(e)});Ms.strictCreate=(t,e)=>new Ms({shape:()=>t,unknownKeys:"strict",catchall:Ei.create(),typeName:Ce.ZodObject,...Ae(e)});Ms.lazycreate=(t,e)=>new Ms({shape:t,unknownKeys:"strip",catchall:Ei.create(),typeName:Ce.ZodObject,...Ae(e)});let If=class extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new wo(a.ctx.common.issues));return ie(n,{code:ee.invalid_union,unionErrors:o}),je}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new wo(l));return ie(n,{code:ee.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}};If.create=(t,e)=>new If({options:t,typeName:Ce.ZodUnion,...Ae(e)});const ds=t=>t instanceof zf?ds(t.schema):t instanceof bo?ds(t.innerType()):t instanceof Lf?[t.value]:t instanceof xp?t.options:t instanceof Py?Ve.objectValues(t.enum):t instanceof Bf?ds(t._def.innerType):t instanceof My?[void 0]:t instanceof Ty?[null]:t instanceof ws?[void 0,...ds(t.unwrap())]:t instanceof So?[null,...ds(t.unwrap())]:t instanceof i_||t instanceof Wf?ds(t.unwrap()):t instanceof Vf?ds(t._def.innerType):[];class n1 extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==he.object)return ie(n,{code:ee.invalid_type,expected:he.object,received:n.parsedType}),je;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ie(n,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=ds(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new n1({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Ae(r)})}}function Ay(t,e){const n=Hs(t),r=Hs(e);if(t===e)return{valid:!0,data:t};if(n===he.object&&r===he.object){const s=Ve.objectKeys(e),i=Ve.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Ay(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===he.array&&r===he.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Ay(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===he.date&&r===he.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let Pf=class extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Xk(i)||Xk(o))return je;const a=Ay(i.value,o.value);return a.valid?((ew(i)||ew(o))&&n.dirty(),{status:n.value,value:a.data}):(ie(r,{code:ee.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Pf.create=(t,e,n)=>new Pf({left:t,right:e,typeName:Ce.ZodIntersection,...Ae(n)});let Hc=class r_ extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.array)return ie(r,{code:ee.invalid_type,expected:he.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return ie(r,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(ie(r,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Jr(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Hn.mergeArray(n,o)):Hn.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new r_({...this._def,rest:e})}};Hc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hc({items:t,typeName:Ce.ZodTuple,rest:null,...Ae(e)})};class Df extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.object)return ie(r,{code:ee.invalid_type,expected:he.object,received:r.parsedType}),je;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Jr(r,a,r.path,a)),value:o._parse(new Jr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hn.mergeObjectAsync(n,s):Hn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Fe?new Df({keyType:e,valueType:n,typeName:Ce.ZodRecord,...Ae(r)}):new Df({keyType:Rf.create(),valueType:e,typeName:Ce.ZodRecord,...Ae(n)})}}let aw=class extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.map)return ie(r,{code:ee.invalid_type,expected:he.map,received:r.parsedType}),je;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Jr(r,a,r.path,[c,"key"])),value:i._parse(new Jr(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return je;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return je;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}};aw.create=(t,e,n)=>new aw({valueType:e,keyType:t,typeName:Ce.ZodMap,...Ae(n)});let lw=class Ry extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.set)return ie(r,{code:ee.invalid_type,expected:he.set,received:r.parsedType}),je;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ie(r,{code:ee.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ie(r,{code:ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const f of l){if(f.status==="aborted")return je;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Jr(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Ry({...this._def,minSize:{value:e,message:ge.toString(n)}})}max(e,n){return new Ry({...this._def,maxSize:{value:e,message:ge.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};lw.create=(t,e)=>new lw({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Ae(e)});let zf=class extends Fe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};zf.create=(t,e)=>new zf({getter:t,typeName:Ce.ZodLazy,...Ae(e)});let Lf=class extends Fe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ie(n,{received:n.data,code:ee.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lf.create=(t,e)=>new Lf({value:t,typeName:Ce.ZodLiteral,...Ae(e)});function s_(t,e){return new xp({values:t,typeName:Ce.ZodEnum,...Ae(e)})}let xp=class Iy extends Fe{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ie(n,{expected:Ve.joinValues(r),received:n.parsedType,code:ee.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ie(n,{received:n.data,code:ee.invalid_enum_value,options:r}),je}return cr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Iy.create(e,{...this._def,...n})}exclude(e,n=this._def){return Iy.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};xp.create=s_;let Py=class extends Fe{_parse(e){const n=Ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==he.string&&r.parsedType!==he.number){const s=Ve.objectValues(n);return ie(r,{expected:Ve.joinValues(s),received:r.parsedType,code:ee.invalid_type}),je}if(this._cache||(this._cache=new Set(Ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Ve.objectValues(n);return ie(r,{received:r.data,code:ee.invalid_enum_value,options:s}),je}return cr(e.data)}get enum(){return this._def.values}};Py.create=(t,e)=>new Py({values:t,typeName:Ce.ZodNativeEnum,...Ae(e)});let Ff=class extends Fe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==he.promise&&n.common.async===!1)return ie(n,{code:ee.invalid_type,expected:he.promise,received:n.parsedType}),je;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return cr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Ff.create=(t,e)=>new Ff({type:t,typeName:Ce.ZodPromise,...Ae(e)});let bo=class extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ie(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?Gl(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?Gl(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wa(o))return je;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Wa(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):je);Ve.assertNever(s)}};bo.create=(t,e,n)=>new bo({schema:t,typeName:Ce.ZodEffects,effect:e,...Ae(n)});bo.createWithPreprocess=(t,e,n)=>new bo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Ae(n)});let ws=class extends Fe{_parse(e){return this._getType(e)===he.undefined?cr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ws.create=(t,e)=>new ws({innerType:t,typeName:Ce.ZodOptional,...Ae(e)});let So=class extends Fe{_parse(e){return this._getType(e)===he.null?cr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};So.create=(t,e)=>new So({innerType:t,typeName:Ce.ZodNullable,...Ae(e)});let Bf=class extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Bf.create=(t,e)=>new Bf({innerType:t,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ae(e)});let Vf=class extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Af(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wo(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new wo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Vf.create=(t,e)=>new Vf({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ae(e)});let cw=class extends Fe{_parse(e){if(this._getType(e)!==he.nan){const r=this._getOrReturnCtx(e);return ie(r,{code:ee.invalid_type,expected:he.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}};cw.create=t=>new cw({typeName:Ce.ZodNaN,...Ae(t)});let i_=class extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},tI=class o_ extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(n.dirty(),Gl(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new o_({in:e,out:n,typeName:Ce.ZodPipeline})}},Wf=class extends Fe{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Wa(s)&&(s.value=Object.freeze(s.value)),s);return Af(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Wf.create=(t,e)=>new Wf({innerType:t,typeName:Ce.ZodReadonly,...Ae(e)});var Ce;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const Z=Rf.create,On=_y.create,jr=$y.create,a_=Oy.create;Ei.create;const ue=Ua.create,be=Ms.create,Fo=If.create,r1=n1.create;Pf.create;Hc.create;const ei=Df.create,l_=zf.create,un=Lf.create,mt=xp.create;Ff.create;ws.create;So.create;const se=Z().regex(/^[a-z0-9][a-z0-9-_.]*$/,'Identifiers use lowercase letters, digits, "-", "_" and "."'),c_=be({path:Z(),line:On().int().positive().optional(),symbol:Z().optional(),repository:Z().optional()}),d_=ei(Z(),Fo([Z(),On(),jr()])),Cd=ei(Z(),a_()),u_=Z().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/,'Extension kinds look like "extension/kind"'),f_=mt(["person","system","web-app","service","gateway","database","cache","message-broker","external","component","interface","library"]),nI=Fo([f_,u_]),Uf=be({id:se,kind:nI,name:Z().min(1),summary:Z(),description:Z().optional(),parent:se.optional(),technology:Z().optional(),tags:ue(Z()).default([]),sourceRefs:ue(c_).default([]),metadata:d_.default({}),ext:Cd.default({})}),h_=mt(["uses","calls","reads","writes","reads-writes","publishes","subscribes","depends-on","implements"]),rI=Fo([h_,u_]),Zf=be({id:se,kind:rI,source:se,target:se,label:Z(),description:Z().optional(),protocol:Z().optional(),data:ue(se).default([]),metadata:d_.default({}),ext:Cd.default({})}),sI=be({name:Z(),type:Z(),description:Z().optional(),primaryKey:jr().default(!1),nullable:jr().default(!1),unique:jr().default(!1),references:be({dataType:se,field:Z()}).optional()}),iI=mt(["table","record","event","document"]),oI=be({id:se,kind:iI,name:Z(),summary:Z(),description:Z().optional(),fields:ue(sI).default([]),ownedBy:se.optional(),storedIn:se.optional(),sourceRefs:ue(c_).default([]),ext:Cd.default({})}),dw=mt(["exactly-one","zero-or-one","one-or-many","zero-or-many"]),aI=be({id:se,from:se,to:se,fromCardinality:dw,toCardinality:dw,label:Z(),via:Z().optional(),logical:jr().default(!1)}),lI=be({id:se,source:se,target:se,data:ue(se).min(1),label:Z(),description:Z().optional(),via:se.optional()}),cI=mt(["call","return","async","self"]),dI=be({type:un("message"),id:se,kind:cI,from:se,to:se,label:Z(),description:Z().optional(),relationship:se.optional(),data:ue(se).default([])}),uI=l_(()=>be({type:un("fragment"),id:se,kind:mt(["alt","opt","loop","par"]),label:Z(),branches:ue(be({guard:Z(),steps:ue(p_)})).min(1)})),p_=l_(()=>Fo([dI,uI])),fI=be({kind:un("interaction"),id:se,name:Z(),summary:Z(),description:Z().optional(),participants:ue(se).min(2),steps:ue(p_).min(1)}),hI=be({id:se,kind:mt(["initial","final","action","decision","merge","fork","join"]),label:Z(),description:Z().optional(),performedBy:se.optional(),outcome:mt(["success","failure"]).optional()}),pI=be({id:se,from:se,to:se,guard:Z().optional()}),mI=be({kind:un("activity"),id:se,name:Z(),summary:Z(),description:Z().optional(),nodes:ue(hI).min(2),flows:ue(pI).min(1)}),gI=be({id:se,kind:mt(["initial","state","final"]),name:Z(),description:Z().optional(),entryActions:ue(Z()).default([]),outcome:mt(["success","failure","neutral"]).default("neutral")}),m_=be({id:se,from:se,to:se,event:Z(),guard:Z().optional(),actions:ue(Z()).default([]),description:Z().optional(),triggeredBy:se.optional()}),yI=be({kind:un("state-machine"),id:se,name:Z(),summary:Z(),description:Z().optional(),subject:se.optional(),owner:se.optional(),states:ue(gI).min(2),transitions:ue(m_).min(1)}),xI=r1("kind",[fI,mI,yI]),vI=be({id:se,name:Z(),summary:Z(),area:Z(),actors:ue(se).min(1),supporting:ue(se).default([]),realizedBy:ue(se).default([]),behaviors:ue(se).default([]),includes:ue(se).default([]),ext:Cd.default({})}),kI=be({entities:ue(Uf).default([]),relationships:ue(Zf).default([]),dataTypes:ue(oI).default([]),dataRelations:ue(aI).default([]),dataFlows:ue(lI).default([]),behaviors:ue(xI).default([]),useCases:ue(vI).default([])});mt(["extension","map","architecture","sequence","dataflow","activity","erd","state","usecase","dependency"]);const uw=["overview","behavior","data","structure","use-cases"],g_=Z().min(1),y_=mt(["right","down"]),wI=be({x:On(),y:On()}),ts=be({id:se,title:Z(),description:Z(),category:g_,positions:ei(Z(),wI).default({}),ext:Cd.default({})}),x_=be({id:se,label:Z(),description:Z().optional(),members:ue(se)}),v_=ts.extend({type:un("architecture"),entities:ue(se).min(1),relationships:ue(se).optional(),groups:ue(x_).default([]),collapsed:ue(se).default([]),layout:be({direction:y_.default("right")}).default({})}),k_=ts.extend({type:un("map"),entities:ue(se).min(1),relationships:ue(se).optional(),passThrough:ue(se).default([]),collapsed:ue(se).default([]),layout:be({direction:y_.default("right")}).default({})}),w_=ts.extend({type:un("sequence"),interaction:se}),b_=ts.extend({type:un("dataflow"),flows:ue(se).min(1),showControlFlow:jr().default(!0)}),S_=ts.extend({type:un("activity"),activity:se,swimlanes:jr().default(!0)}),j_=ts.extend({type:un("erd"),dataTypes:ue(se).min(1),groupByStore:jr().default(!0),fieldLimit:On().int().positive().default(6)}),C_=ts.extend({type:un("state"),stateMachine:se}),__=ts.extend({type:un("usecase"),useCases:ue(se).min(1)}),N_=ts.extend({type:un("dependency"),entities:ue(se).min(1),relationships:ue(se).optional(),layers:ue(x_).min(1)}),bI=ts.extend({type:un("extension"),extension:Z().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),entities:ue(se).default([]),data:a_()}),SI=r1("type",[v_,k_,w_,b_,S_,j_,C_,__,N_,bI]),ss={id:se.optional(),title:Z().optional(),description:Z().default(""),category:g_.default("walkthrough")},E_=r1("type",[k_.extend(ss),w_.extend(ss),C_.extend(ss),S_.extend(ss),v_.extend(ss),b_.extend(ss),j_.extend(ss),__.extend(ss),N_.extend(ss)]),jI=mt(["lapis","malachite","ochre","umber","tyrian","slate","accent","verdigris"]),vp=Fo([jI,Z().regex(/^#[0-9a-fA-F]{6}$/)]),CI=mt(["card","cylinder","person","stack","frame","chip"]),_I=be({shape:CI,tone:vp,icon:Z(),label:Z()}),NI=be({pattern:mt(["solid","dashed","dotted"]),head:mt(["arrow","open-arrow","none","triangle"])}),fw=be({tone:vp.optional(),icon:Z().optional(),width:On().positive().optional(),height:On().positive().optional(),emphasis:jr().optional()}),EI=be({kinds:ei(Z(),_I),relationships:ei(Z(),NI),elements:ei(Z(),fw).default({}),views:ei(Z(),ei(Z(),fw)).default({})}),Za=Z().regex(/^[a-zA-Z]+:[a-z0-9][a-z0-9-_.:#]*$/,'A ref looks like "entity:order-service"'),$I=mt(["new","changed","removed"]),MI=be({ref:Za,state:$I,note:Z().optional()}),TI=be({kind:mt(["add","del","ctx"]),old:On().int().positive().optional(),new:On().int().positive().optional(),text:Z()}),OI=be({header:Z().optional(),lines:ue(TI).min(1)}),AI=be({path:Z(),title:Z().optional(),hunks:ue(OI).min(1).optional(),start:On().int().positive().optional(),text:Z().optional(),notes:ue(be({line:On().int().positive(),text:Z()})).default([])}).refine(t=>t.hunks?t.text===void 0&&t.start===void 0:t.text!==void 0&&t.start!==void 0,{message:'Give "hunks" (a diff), or "start" and "text" (an excerpt), not both'}).transform(({start:t,text:e,hunks:n,...r})=>({...r,hunks:n??[{lines:e.replace(/\n$/,"").split(`
41
- `).map((s,i)=>({kind:"ctx",new:t+i,text:s}))}]})),$_=mt(["look","routine"]),RI=mt(["flow","attention","hot-path","slow","failing","blocked"]),II=be({target:Za,as:RI,tone:vp.optional()}),PI=be({target:Za,text:Z().min(1),tone:vp.optional()}),DI=be({ref:Za,caption:Z().optional()}),zI=be({id:se,title:Z(),text:Z(),risk:$_.default("routine"),view:Fo([se,E_]).optional(),focus:ue(Za).default([]),callouts:ue(be({target:Za,text:Z()})).default([]),cases:ue(be({when:Z(),then:Z(),note:Z().optional()})).default([]),proof:ue(be({text:Z(),source:Z().optional(),test:Z().optional(),missing:jr().default(!1)})).default([]),question:Z().optional(),questions:ue(Z()).default([]),code:ue(AI).default([]),trace:ue(DI).default([]),effects:ue(II).default([]),badges:ue(PI).default([])}),LI=mt(["change","tour"]),FI=be({id:se,kind:LI.default("change"),title:Z(),summary:Z(),source:be({kind:Z(),ref:Z().optional(),head:Z().optional(),url:Z().optional(),repository:Z().optional(),base:Z().optional(),author:Z().optional(),files:On().int().nonnegative().optional(),added:On().int().nonnegative().optional(),removed:On().int().nonnegative().optional()}).optional(),story:be({text:Z(),before:Z().optional(),after:Z().optional()}),overview:Fo([se,E_]).optional(),verdict:be({risk:$_,facts:ue(be({label:Z(),value:Z()})).default([]),findings:ue(be({text:Z(),severity:mt(["risk","note"]).default("risk"),scene:se.optional()})).default([])}).optional(),marks:ue(MI).default([]),removed:be({entities:ue(Uf).default([]),relationships:ue(Zf).default([]),transitions:ue(be({stateMachine:se,transition:m_})).default([])}).default({}),scenes:ue(zI).min(1)}),M_={kinds:{person:{shape:"person",tone:"slate",icon:"user-round",label:"Person"},system:{shape:"frame",tone:"slate",icon:"boxes",label:"Software system"},"web-app":{shape:"card",tone:"tyrian",icon:"app-window",label:"Web app"},gateway:{shape:"card",tone:"slate",icon:"route",label:"Gateway"},service:{shape:"card",tone:"lapis",icon:"server",label:"Service"},database:{shape:"cylinder",tone:"malachite",icon:"database",label:"Database"},cache:{shape:"cylinder",tone:"verdigris",icon:"zap",label:"Cache"},"message-broker":{shape:"stack",tone:"ochre",icon:"waypoints",label:"Message broker"},external:{shape:"card",tone:"umber",icon:"globe",label:"External system"},component:{shape:"chip",tone:"lapis",icon:"box",label:"Component"},interface:{shape:"chip",tone:"tyrian",icon:"plug",label:"Interface"},library:{shape:"chip",tone:"slate",icon:"library",label:"Library"}},relationships:{uses:{pattern:"solid",head:"arrow"},calls:{pattern:"solid",head:"arrow"},reads:{pattern:"solid",head:"arrow"},writes:{pattern:"solid",head:"arrow"},"reads-writes":{pattern:"solid",head:"none"},publishes:{pattern:"dashed",head:"open-arrow"},subscribes:{pattern:"dashed",head:"open-arrow"},"depends-on":{pattern:"solid",head:"arrow"},implements:{pattern:"dashed",head:"triangle"}},elements:{},views:{}},T_="0.2.0",BI=be({id:se,name:Z(),description:Z().default(""),repository:Z().optional(),defaultView:se.optional()}),VI=be({name:Z().regex(/^[a-z][a-z0-9-]*$/),version:Z(),required:jr().default(!1)}),WI=be({poneyVersion:un(T_),project:BI,extensions:ue(VI).default([]),model:kI.default({}),views:ue(SI).default([]),walkthroughs:ue(FI).default([]),presentation:EI.default(M_)}),UI=WI.transform(t=>{const e=[...t.views],n=(s,i,o)=>{if(s===void 0||typeof s=="string")return s;const a={...s,id:s.id??i,title:s.title??o};return e.push(a),a.id},r=t.walkthroughs.map(s=>({...s,overview:n(s.overview,`${s.id}.overview`,s.title),scenes:s.scenes.map(i=>({...i,view:n(i.view,`${s.id}.${i.id}`,i.title)}))}));return{...t,views:e,walkthroughs:r}});function hw(t){const e=t.indexOf("/");return e>0?t.slice(0,e):void 0}function Wr(t,e,n){var o,a;const r=(o=t.facets)==null?void 0:o[e],s=(a=n==null?void 0:n.ext)==null?void 0:a[t.name];if(!r||s===void 0)return;const i=r.safeParse(s);return i.success?i.data:void 0}const ZI={shape:"card",tone:"slate",icon:"box",label:"Element"};class HI{constructor(e){en(this,"entities",new Map);en(this,"relationships",new Map);en(this,"dataTypes",new Map);en(this,"dataRelations",new Map);en(this,"dataFlows",new Map);en(this,"behaviors",new Map);en(this,"useCases",new Map);en(this,"views",new Map);en(this,"out",new Map);en(this,"in",new Map);en(this,"kids",new Map);en(this,"flatCache",new Map);en(this,"outgoing",e=>this.out.get(e)??[]);en(this,"incoming",e=>this.in.get(e)??[]);en(this,"children",e=>this.kids.get(e)??[]);this.doc=e;const n=e.model;n.entities.forEach(r=>this.entities.set(r.id,r)),n.relationships.forEach(r=>{this.relationships.set(r.id,r),Dl(this.out,r.source,r),Dl(this.in,r.target,r)}),n.dataTypes.forEach(r=>this.dataTypes.set(r.id,r)),n.dataRelations.forEach(r=>this.dataRelations.set(r.id,r)),n.dataFlows.forEach(r=>this.dataFlows.set(r.id,r)),n.behaviors.forEach(r=>this.behaviors.set(r.id,r)),n.useCases.forEach(r=>this.useCases.set(r.id,r)),n.entities.forEach(r=>r.parent&&Dl(this.kids,r.parent,r)),e.views.forEach(r=>this.views.set(r.id,r))}ancestors(e){var s;const n=[];let r=(s=this.entities.get(e))==null?void 0:s.parent;for(;r;){const i=this.entities.get(r);if(!i)break;n.push(i),r=i.parent}return n}style(e,n){var l;const r=typeof e=="string"?this.entities.get(e):e,s=this.doc.presentation,i=(r&&s.kinds[r.kind])??ZI,o=(r?s.elements[r.id]:void 0)??{},a=(r&&n?(l=s.views[n])==null?void 0:l[r.id]:void 0)??{};return{...i,tone:a.tone??o.tone??i.tone,icon:a.icon??o.icon??i.icon,emphasis:a.emphasis??o.emphasis??!1}}interaction(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="interaction"?n:void 0}activity(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="activity"?n:void 0}stateMachine(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="state-machine"?n:void 0}messages(e){const n=this.flatCache.get(e);if(n)return n;const r=[],s=(o,a)=>{for(const l of o)l.type==="message"?r.push({message:l,number:r.length+1,context:a}):l.branches.forEach(c=>s(c.steps,[...a,{fragment:l,guard:c.guard}]))},i=this.interaction(e);return i&&s(i.steps,[]),this.flatCache.set(e,r),r}findFragment(e,n){let r;const s=o=>o.forEach(a=>{a.type==="fragment"&&(a.id===n&&(r=a),a.branches.forEach(l=>s(l.steps)))}),i=this.interaction(e);return i&&s(i.steps),r}behaviorsInvolving(e){return this.doc.model.behaviors.filter(n=>n.kind==="interaction"?n.participants.includes(e):n.kind==="activity"?n.nodes.some(r=>r.performedBy===e):n.owner===e||n.transitions.some(r=>r.triggeredBy===e))}dataOf(e){const n=new Map,r=new Map;for(const i of this.doc.model.dataFlows)i.target===e&&i.data.forEach(o=>Dl(n,o,i)),i.source===e&&i.data.forEach(o=>Dl(r,o,i));const s=this.doc.model.dataTypes.filter(i=>i.ownedBy===e||i.storedIn===e);return{consumed:n,produced:r,owned:s}}useCasesOf(e){return this.doc.model.useCases.filter(n=>n.actors.includes(e)||n.supporting.includes(e)||n.realizedBy.includes(e))}usagesOfData(e){const n=this.doc.model.dataFlows.filter(a=>a.data.includes(e)),r=this.doc.model.relationships.filter(a=>a.data.includes(e)),s=[];for(const a of this.doc.model.behaviors)if(a.kind==="interaction")for(const l of this.messages(a.id))l.message.data.includes(e)&&s.push({interaction:a,item:l});const i=this.doc.model.behaviors.filter(a=>a.kind==="state-machine"&&a.subject===e),o=this.doc.model.dataRelations.filter(a=>a.from===e||a.to===e);return{flows:n,relationships:r,messages:s,lifecycles:i,relations:o}}messagesAlong(e){const n=[];for(const r of this.doc.model.behaviors)if(r.kind==="interaction")for(const s of this.messages(r.id))s.message.relationship===e&&n.push({interaction:r,item:s});return n}viewShows(e,n){var r;switch(e.type){case"architecture":case"map":case"dependency":{if(n.kind==="entity")return e.entities.includes(n.id);if(n.kind==="relationship"){const s=this.relationships.get(n.id);return s?e.relationships?e.relationships.includes(s.id):e.type==="map"&&(e.passThrough.includes(s.source)||e.passThrough.includes(s.target))?!0:e.entities.includes(s.source)&&e.entities.includes(s.target):!1}return n.kind==="group"?n.view===e.id&&e.type!=="map":!1}case"sequence":{const s=this.messages(e.interaction);return n.kind==="entity"?!!((r=this.interaction(e.interaction))!=null&&r.participants.includes(n.id)):n.kind==="behavior"?n.id===e.interaction:n.kind==="message"||n.kind==="fragment"?n.behavior===e.interaction:n.kind==="relationship"?s.some(i=>i.message.relationship===n.id):n.kind==="dataType"?s.some(i=>i.message.data.includes(n.id)):!1}case"dataflow":{const s=e.flows.map(i=>this.dataFlows.get(i)).filter(jo);return n.kind==="entity"?s.some(i=>i.source===n.id||i.target===n.id):n.kind==="dataFlow"?e.flows.includes(n.id):n.kind==="dataType"?s.some(i=>i.data.includes(n.id)):n.kind==="relationship"?s.some(i=>i.via===n.id):!1}case"activity":{const s=this.activity(e.activity);return n.kind==="entity"?!!(s!=null&&s.nodes.some(i=>i.performedBy===n.id)):n.kind==="behavior"?n.id===e.activity:n.kind==="activityNode"||n.kind==="activityFlow"?n.behavior===e.activity:!1}case"erd":{if(n.kind==="dataType")return e.dataTypes.includes(n.id);if(n.kind==="dataRelation"){const s=this.dataRelations.get(n.id);return!!s&&e.dataTypes.includes(s.from)&&e.dataTypes.includes(s.to)}return n.kind==="entity"?e.dataTypes.some(s=>{var i;return((i=this.dataTypes.get(s))==null?void 0:i.storedIn)===n.id}):!1}case"state":{const s=this.stateMachine(e.stateMachine);return s?n.kind==="behavior"?n.id===s.id:n.kind==="state"||n.kind==="transition"?n.behavior===s.id:n.kind==="entity"?s.transitions.some(i=>i.triggeredBy===n.id):n.kind==="dataType"?n.id===s.subject:!1:!1}case"extension":return n.kind==="entity"&&e.entities.includes(n.id);case"usecase":{const s=e.useCases.map(i=>this.useCases.get(i)).filter(jo);return n.kind==="useCase"?e.useCases.includes(n.id):n.kind==="entity"?s.some(i=>i.actors.includes(n.id)||i.supporting.includes(n.id)):!1}}}viewsShowing(e){return this.doc.views.filter(n=>this.viewShows(n,e))}bestViewFor(e,n){const r=n?this.views.get(n):void 0;if(r&&this.viewShows(r,e))return r;const s=this.viewsShowing(e),i=["architecture","dependency","sequence","state","activity","dataflow","erd","usecase","map","extension"];return s.sort((o,a)=>{const l=i.indexOf(o.type)-i.indexOf(a.type);if(l!==0)return l;const c=o.type==="architecture"?o.collapsed.length:0,f=a.type==="architecture"?a.collapsed.length:0;return c-f})[0]}viewsForBehavior(e){return this.doc.views.filter(n=>n.type==="sequence"&&n.interaction===e||n.type==="activity"&&n.activity===e||n.type==="state"&&n.stateMachine===e)}exists(e){var n,r,s,i;switch(e.kind){case"entity":return this.entities.has(e.id);case"relationship":return this.relationships.has(e.id);case"dataType":{const o=this.dataTypes.get(e.id);return!!o&&(!e.field||o.fields.some(a=>a.name===e.field))}case"dataRelation":return this.dataRelations.has(e.id);case"dataFlow":return this.dataFlows.has(e.id);case"useCase":return this.useCases.has(e.id);case"behavior":return this.behaviors.has(e.id);case"message":return this.messages(e.behavior).some(o=>o.message.id===e.id);case"fragment":return!!this.findFragment(e.behavior,e.id);case"activityNode":return!!((n=this.activity(e.behavior))!=null&&n.nodes.some(o=>o.id===e.id));case"activityFlow":return!!((r=this.activity(e.behavior))!=null&&r.flows.some(o=>o.id===e.id));case"state":return!!((s=this.stateMachine(e.behavior))!=null&&s.states.some(o=>o.id===e.id));case"transition":return!!((i=this.stateMachine(e.behavior))!=null&&i.transitions.some(o=>o.id===e.id));case"group":{const o=this.views.get(e.view);return((o==null?void 0:o.type)==="architecture"?o.groups:(o==null?void 0:o.type)==="dependency"?o.layers:[]).some(l=>l.id===e.id)}}}describe(e){var n,r,s,i,o,a,l,c,f,u,h,m,g;switch(e.kind){case"entity":{const p=this.entities.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:p?this.style(p).label:"Entity",summary:p==null?void 0:p.summary}}case"relationship":{const p=this.relationships.get(e.id);if(!p)return{title:e.id,kind:"Relationship"};const x=((n=this.entities.get(p.source))==null?void 0:n.name)??p.source,y=((r=this.entities.get(p.target))==null?void 0:r.name)??p.target;return{title:`${x} → ${y}`,kind:p.protocol?`Connection · ${p.protocol}`:"Connection",summary:p.label}}case"group":{const p=this.views.get(e.view),y=((p==null?void 0:p.type)==="architecture"?p.groups:(p==null?void 0:p.type)==="dependency"?p.layers:[]).find(v=>v.id===e.id);return{title:(y==null?void 0:y.label)??e.id,kind:"Group",summary:y==null?void 0:y.description}}case"dataType":{const p=this.dataTypes.get(e.id);if(e.field){const x=p==null?void 0:p.fields.find(y=>y.name===e.field);return{title:`${(p==null?void 0:p.name)??e.id}.${e.field}`,kind:`Field · ${(x==null?void 0:x.type)??""}`,summary:x==null?void 0:x.description}}return{title:(p==null?void 0:p.name)??e.id,kind:p?qI(p.kind):"Data",summary:p==null?void 0:p.summary}}case"dataRelation":{const p=this.dataRelations.get(e.id);return p?{title:`${(s=this.dataTypes.get(p.from))==null?void 0:s.name} ${p.label} ${(i=this.dataTypes.get(p.to))==null?void 0:i.name}`,kind:p.logical?"Logical relation":"Foreign key"}:{title:e.id,kind:"Relation"}}case"dataFlow":{const p=this.dataFlows.get(e.id);return p?{title:p.label,kind:"Data flow",summary:`${(o=this.entities.get(p.source))==null?void 0:o.name} → ${(a=this.entities.get(p.target))==null?void 0:a.name}`}:{title:e.id,kind:"Data flow"}}case"message":{const p=this.messages(e.behavior).find(y=>y.message.id===e.id);if(!p)return{title:e.id,kind:"Message"};const x=p.message;return{title:x.label,kind:`Message ${p.number}`,summary:`${(l=this.entities.get(x.from))==null?void 0:l.name} → ${(c=this.entities.get(x.to))==null?void 0:c.name}`}}case"fragment":{const p=this.findFragment(e.behavior,e.id);return{title:(p==null?void 0:p.label)??e.id,kind:p?_d(p.kind):"Fragment",summary:p==null?void 0:p.branches.map(x=>x.guard).join(" · ")}}case"activityNode":{const p=(f=this.activity(e.behavior))==null?void 0:f.nodes.find(x=>x.id===e.id);return{title:(p==null?void 0:p.label)??e.id,kind:p?KI(p.kind):"Step",summary:p==null?void 0:p.description}}case"activityFlow":{const p=this.activity(e.behavior),x=p==null?void 0:p.flows.find(k=>k.id===e.id),y=(u=p==null?void 0:p.nodes.find(k=>k.id===(x==null?void 0:x.from)))==null?void 0:u.label,v=(h=p==null?void 0:p.nodes.find(k=>k.id===(x==null?void 0:x.to)))==null?void 0:h.label;return{title:x!=null&&x.guard?`${x.guard}: ${v}`:`${y} → ${v}`,kind:"Flow"}}case"state":{const p=(m=this.stateMachine(e.behavior))==null?void 0:m.states.find(x=>x.id===e.id);return{title:(p==null?void 0:p.name)??e.id,kind:"State",summary:p==null?void 0:p.description}}case"transition":{const p=(g=this.stateMachine(e.behavior))==null?void 0:g.transitions.find(x=>x.id===e.id);return{title:(p==null?void 0:p.event)??e.id,kind:"Transition",summary:p!=null&&p.guard?`Only when ${p.guard}`:p==null?void 0:p.description}}case"useCase":{const p=this.useCases.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:`Use case · ${(p==null?void 0:p.area)??""}`,summary:p==null?void 0:p.summary}}case"behavior":{const p=this.behaviors.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:p?JI(p.kind):"Behavior",summary:p==null?void 0:p.summary}}}}}const pw=new WeakMap;function ft(t){let e=pw.get(t);return e||(e=new HI(t),pw.set(t,e)),e}function Dl(t,e,n){const r=t.get(e);r?r.push(n):t.set(e,[n])}function jo(t){return t!=null}function qI(t){return{table:"Table",record:"Record",event:"Event",document:"Document"}[t]}function _d(t){return{alt:"Alternatives",opt:"Optional",loop:"Loop",par:"In parallel"}[t]}function KI(t){return{initial:"Initial node",final:"Final node",action:"Action",decision:"Decision",merge:"Merge",fork:"Fork",join:"Join"}[t]}function JI(t){return{interaction:"Interaction",activity:"Activity","state-machine":"State machine"}[t]}function de(t){switch(t.kind){case"group":return`group:${t.view}:${t.id}`;case"dataType":return t.field?`dataType:${t.id}#${t.field}`:`dataType:${t.id}`;case"message":case"fragment":case"activityNode":case"activityFlow":case"state":case"transition":return`${t.kind}:${t.behavior}:${t.id}`;default:return`${t.kind}:${t.id}`}}function an(t){const[e,...n]=t.split(":"),r=n.join(":");if(!r)return null;switch(e){case"entity":case"relationship":case"useCase":case"dataFlow":case"dataRelation":case"behavior":return{kind:e,id:r};case"dataType":{const[s,i]=r.split("#");return i?{kind:e,id:s,field:i}:{kind:e,id:s}}case"group":return n.length>=2?{kind:e,view:n[0],id:n.slice(1).join(":")}:null;case"message":case"fragment":case"state":case"transition":case"activityNode":case"activityFlow":return n.length>=2?{kind:e,behavior:n[0],id:n.slice(1).join(":")}:null;default:return null}}const qs=t=>!!t&&typeof t=="object"&&!Array.isArray(t),Bs=t=>Array.isArray(t)?t.filter(qs):[],Em={module:"component",queue:"message-broker"},mw={module:["Module","Component"],queue:["Event bus","Message broker"]},gw={one:"exactly-one",many:"zero-or-many"};function GI(t){if(!qs(t)||t.poneyVersion!=="0.1.0")return t;const e=JSON.parse(JSON.stringify(t));e.poneyVersion="0.2.0";const n=qs(e.model)?e.model:void 0;for(const o of Bs(n==null?void 0:n.entities))typeof o.kind=="string"&&Em[o.kind]&&(o.kind=Em[o.kind]);for(const o of Bs(n==null?void 0:n.dataRelations))for(const a of["fromCardinality","toCardinality"])typeof o[a]=="string"&&gw[o[a]]&&(o[a]=gw[o[a]]);n&&"capabilities"in n&&(n.useCases=n.capabilities,delete n.capabilities);for(const o of Bs(n==null?void 0:n.behaviors)){if(o.kind==="process"){o.kind="activity";for(const a of Bs(o.nodes))a.kind=a.kind==="start"?"initial":a.kind==="end"?"final":a.kind}if(o.kind==="state-machine")for(const a of Bs(o.states))a.kind==="normal"&&(a.kind="state")}const r=qs(e.presentation)?e.presentation:void 0,s=qs(r==null?void 0:r.kinds)?r.kinds:void 0;if(s)for(const[o,a]of Object.entries(Em)){if(!(o in s))continue;const l=s[o];qs(l)&&l.label===mw[o][0]&&(l.label=mw[o][1]),s[a]=l,delete s[o]}const i=[...Bs(e.views),...Bs(e.walkthroughs).flatMap(o=>[o.overview,...Bs(o.scenes).map(a=>a.view)]).filter(qs)];for(const o of i)o.type==="usecase"&&"capabilities"in o&&(o.useCases=o.capabilities,delete o.capabilities),o.category==="capabilities"&&(o.category="use-cases"),o.type==="activity"&&"process"in o&&(o.activity=o.process,delete o.process);return Dy(e)}function Dy(t,e){if(typeof t=="string")return t.startsWith("capability:")?`useCase:${t.slice(11)}`:e==="tone"&&t==="poney"?"accent":t;if(Array.isArray(t))return t.map(n=>Dy(n,e));if(qs(t)){for(const[n,r]of Object.entries(t))t[n]=Dy(r,n);return t}return t}function YI(t,e,n=3){var i;const r=[];for(const o of e){const a=QI(t,o),l=Math.max(2,Math.floor(Math.max(t.length,o.length)/3));(a<=l||o.includes(t)||t.includes(o))&&r.push([a,o])}r.sort((o,a)=>o[0]-a[0]);const s=((i=r[0])==null?void 0:i[0])??0;return r.filter(([o])=>o<=s+1).slice(0,n).map(([,o])=>o)}function QI(t,e){const n=Array.from({length:e.length+1},(r,s)=>s);for(let r=1;r<=t.length;r++){let s=n[0];n[0]=r;for(let i=1;i<=e.length;i++){const o=n[i];n[i]=Math.min(n[i]+1,n[i-1]+1,s+(t[r-1]===e[i-1]?0:1)),s=o}}return n[e.length]}const Ws=(t,e,n)=>{const r=YI(t,e);return r.length?`Did you mean ${r.map(s=>`"${s}"`).join(" or ")}?`:`Add a ${n} with this id, or use an existing one.`};function kl(t,e={}){const n=UI.safeParse(GI(t));if(!n.success)return{ok:!1,issues:n.error.issues.map(s=>({path:s.path.join("."),message:s.message,severity:"error",hint:XI(s)}))};const r=[...O_(n.data),...eP(n.data,e.extensions??[])];return r.some(s=>s.severity==="error")?{ok:!1,document:n.data,issues:r}:{ok:!0,document:n.data,issues:r}}function XI(t){const e=t;if(e.code==="invalid_union_discriminator"&&Array.isArray(e.options))return`Use one of: ${e.options.join(", ")}.`;if(e.code==="invalid_enum_value"&&Array.isArray(e.options))return`Use one of: ${e.options.join(", ")}.`;if(e.code==="invalid_type"&&e.received==="undefined")return`Add "${e.path[e.path.length-1]}".`;if(e.code==="unrecognized_keys"&&Array.isArray(e.keys))return`Remove ${e.keys.map(n=>`"${n}"`).join(", ")}: this place has no such field.`;if(e.code==="invalid_string"&&/lowercase|ref/.test(e.message))return'Ids are lowercase letters, digits, "-", "_" and ".", e.g. "order-service".'}function O_(t){const e=[],n=t.model,r=(p,x,y)=>e.push({path:p,message:x,severity:"error",...y?{hint:y}:{}}),s=(p,x)=>{const y=new Map;return p.forEach((v,k)=>{y.has(v.id)&&r(`${x}.${k}.id`,`Duplicate id "${v.id}"`),y.set(v.id,v)}),y},i=s(n.entities,"model.entities"),o=s(n.relationships,"model.relationships"),a=s(n.dataTypes,"model.dataTypes");s(n.dataRelations,"model.dataRelations"),s(n.dataFlows,"model.dataFlows");const l=s(n.behaviors,"model.behaviors"),c=s(n.useCases,"model.useCases");s(t.views,"views");const f=(p,x)=>{p!==void 0&&!i.has(p)&&r(x,`Unknown entity "${p}"`,Ws(p,i.keys(),"entity to model.entities"))},u=(p,x)=>{p!==void 0&&!a.has(p)&&r(x,`Unknown data type "${p}"`,Ws(p,a.keys(),"data type to model.dataTypes"))},h=(p,x)=>{p!==void 0&&!o.has(p)&&r(x,`Unknown relationship "${p}"`,Ws(p,o.keys(),"relationship to model.relationships"))};n.entities.forEach((p,x)=>{f(p.parent,`model.entities.${x}.parent`);const y=new Set([p.id]);let v=p.parent?i.get(p.parent):void 0;for(;v;){if(y.has(v.id)){r(`model.entities.${x}.parent`,`Containment cycle through "${v.id}"`);break}y.add(v.id),v=v.parent?i.get(v.parent):void 0}}),n.relationships.forEach((p,x)=>{f(p.source,`model.relationships.${x}.source`),f(p.target,`model.relationships.${x}.target`),p.data.forEach((y,v)=>u(y,`model.relationships.${x}.data.${v}`))}),n.dataTypes.forEach((p,x)=>{f(p.ownedBy,`model.dataTypes.${x}.ownedBy`),f(p.storedIn,`model.dataTypes.${x}.storedIn`);const y=new Set;p.fields.forEach((v,k)=>{const w=`model.dataTypes.${x}.fields.${k}`;if(y.has(v.name)&&r(w,`Duplicate field "${v.name}" in "${p.id}"`),y.add(v.name),v.references){const j=a.get(v.references.dataType);j?j.fields.some(C=>C.name===v.references.field)||r(`${w}.references`,`"${j.id}" has no field "${v.references.field}"`):r(`${w}.references`,`Unknown data type "${v.references.dataType}"`)}})}),n.dataRelations.forEach((p,x)=>{u(p.from,`model.dataRelations.${x}.from`),u(p.to,`model.dataRelations.${x}.to`),p.via&&([p.from,p.to].some(v=>{var k;return(k=a.get(v))==null?void 0:k.fields.some(w=>w.name===p.via)})||r(`model.dataRelations.${x}.via`,`Neither end has field "${p.via}"`))}),n.dataFlows.forEach((p,x)=>{f(p.source,`model.dataFlows.${x}.source`),f(p.target,`model.dataFlows.${x}.target`),h(p.via,`model.dataFlows.${x}.via`),p.data.forEach((y,v)=>u(y,`model.dataFlows.${x}.data.${v}`))}),n.behaviors.forEach((p,x)=>{const y=`model.behaviors.${x}`;if(p.kind==="interaction"){p.participants.forEach((j,C)=>f(j,`${y}.participants.${C}`));const v=new Set(p.participants),k=new Set,w=(j,C)=>j.forEach((_,S)=>{const N=`${C}.${S}`;k.has(_.id)&&r(`${N}.id`,`Duplicate step id "${_.id}"`),k.add(_.id),_.type==="message"?(v.has(_.from)||r(`${N}.from`,`"${_.from}" is not a participant`,`Add "${_.from}" to participants, or send from one of: ${[...v].join(", ")}.`),v.has(_.to)||r(`${N}.to`,`"${_.to}" is not a participant`,`Add "${_.to}" to participants, or send to one of: ${[...v].join(", ")}.`),h(_.relationship,`${N}.relationship`),_.data.forEach((E,P)=>u(E,`${N}.data.${P}`))):_.branches.forEach((E,P)=>w(E.steps,`${N}.branches.${P}.steps`))});w(p.steps,`${y}.steps`)}else if(p.kind==="activity"){const v=s(p.nodes,`${y}.nodes`);p.nodes.forEach((k,w)=>f(k.performedBy,`${y}.nodes.${w}.performedBy`)),p.nodes.filter(k=>k.kind==="initial").length!==1&&r(`${y}.nodes`,"A process needs exactly one start node"),p.flows.forEach((k,w)=>{v.has(k.from)||r(`${y}.flows.${w}.from`,`Unknown node "${k.from}"`,Ws(k.from,v.keys(),"node")),v.has(k.to)||r(`${y}.flows.${w}.to`,`Unknown node "${k.to}"`,Ws(k.to,v.keys(),"node"))})}else{u(p.subject,`${y}.subject`),f(p.owner,`${y}.owner`);const v=s(p.states,`${y}.states`);p.states.filter(k=>k.kind==="initial").length!==1&&r(`${y}.states`,"A state machine needs exactly one initial state"),p.transitions.forEach((k,w)=>{v.has(k.from)||r(`${y}.transitions.${w}.from`,`Unknown state "${k.from}"`,Ws(k.from,v.keys(),"state")),v.has(k.to)||r(`${y}.transitions.${w}.to`,`Unknown state "${k.to}"`,Ws(k.to,v.keys(),"state")),f(k.triggeredBy,`${y}.transitions.${w}.triggeredBy`)})}}),n.useCases.forEach((p,x)=>{const y=`model.useCases.${x}`;p.actors.forEach((v,k)=>f(v,`${y}.actors.${k}`)),p.supporting.forEach((v,k)=>f(v,`${y}.supporting.${k}`)),p.realizedBy.forEach((v,k)=>f(v,`${y}.realizedBy.${k}`)),p.behaviors.forEach((v,k)=>{l.has(v)||r(`${y}.behaviors.${k}`,`Unknown behavior "${v}"`)}),p.includes.forEach((v,k)=>{c.has(v)||r(`${y}.includes.${k}`,`Unknown use case "${v}"`)})});const m=(p,x,y)=>{const v=l.get(p);v?v.kind!==x&&r(y,`"${p}" is a ${v.kind}, expected ${x}`):r(y,`Unknown behavior "${p}"`)};return t.views.forEach((p,x)=>{var v;const y=`views.${x}`;switch(p.type){case"architecture":case"map":case"dependency":{p.entities.forEach((j,C)=>f(j,`${y}.entities.${C}`)),(v=p.relationships)==null||v.forEach((j,C)=>h(j,`${y}.relationships.${C}`));const k=new Set(p.entities),w=p.type==="architecture"?p.groups:p.type==="dependency"?p.layers:[];w.forEach((j,C)=>j.members.forEach((_,S)=>{k.has(_)||r(`${y}.groups.${C}.members.${S}`,`"${_}" is not in this view`)})),p.type==="map"&&(p.passThrough.forEach((j,C)=>f(j,`${y}.passThrough.${C}`)),p.collapsed.forEach((j,C)=>{k.has(j)?p.entities.some(_=>{var S;return((S=i.get(_))==null?void 0:S.parent)===j})||r(`${y}.collapsed.${C}`,`"${j}" has nothing inside it in this view`,'A group is an entity whose children (entities with "parent" set to it) are also in the map.'):r(`${y}.collapsed.${C}`,`"${j}" is not in this view`)})),p.type==="architecture"&&p.collapsed.forEach((j,C)=>{!k.has(j)&&!w.some(_=>_.id===j)&&r(`${y}.collapsed.${C}`,`"${j}" is not in this view`)});break}case"sequence":m(p.interaction,"interaction",`${y}.interaction`);break;case"activity":m(p.activity,"activity",`${y}.activity`);break;case"state":m(p.stateMachine,"state-machine",`${y}.stateMachine`);break;case"erd":p.dataTypes.forEach((k,w)=>u(k,`${y}.dataTypes.${w}`));break;case"dataflow":{const k=new Set(n.dataFlows.map(w=>w.id));p.flows.forEach((w,j)=>{k.has(w)||r(`${y}.flows.${j}`,`Unknown data flow "${w}"`)});break}case"extension":p.entities.forEach((k,w)=>f(k,`${y}.entities.${w}`));break;case"usecase":p.useCases.forEach((k,w)=>{c.has(k)||r(`${y}.useCases.${w}`,`Unknown use case "${k}"`)});break}}),tP(t,r),t.project.defaultView&&!t.views.some(p=>p.id===t.project.defaultView)&&r("project.defaultView",`Unknown view "${t.project.defaultView}"`),new Set(n.entities.map(p=>p.kind)).forEach(p=>{t.presentation.kinds[p]||e.push({path:`presentation.kinds.${p}`,message:`No style for entity kind "${p}"; readers use a default`,severity:"warning"})}),e}function eP(t,e){var f;const n=[],r=(u,h)=>n.push({path:u,message:h,severity:"error"}),s=(u,h)=>n.push({path:u,message:h,severity:"warning"}),i=new Map(t.extensions.map(u=>[u.name,u])),o=new Map(e.map(u=>[u.name,u]));t.extensions.forEach((u,h)=>{o.has(u.name)||(u.required?r(`extensions.${h}`,`This document requires the "${u.name}" extension, which this reader does not know`):s(`extensions.${h}`,`Extension "${u.name}" is not known here; its data is kept but not checked`))});const a=(u,h,m,g)=>{var y;if(m.includes(u))return;const p=hw(u);if(!p)return r(h,`Unknown kind "${u}"`);if(!i.has(p))return r(h,`Kind "${u}" uses the undeclared extension "${p}"`);const x=o.get(p);x&&!((y=x[g])!=null&&y[u.slice(p.length+1)])&&r(h,`Extension "${p}" does not define the kind "${u}"`)},l=(u,h,m)=>{var g,p;for(const[x,y]of Object.entries(u)){if(!i.has(x)){r(`${h}.ext.${x}`,`Data for the undeclared extension "${x}"`);continue}const v=(p=(g=o.get(x))==null?void 0:g.facets)==null?void 0:p[m];if(!o.has(x))continue;if(!v){r(`${h}.ext.${x}`,`Extension "${x}" defines no data for a ${m}`);continue}const k=v.safeParse(y);k.success||k.error.issues.forEach(w=>r(`${h}.ext.${x}.${w.path.join(".")}`,w.message))}};if(t.model.entities.forEach((u,h)=>{a(u.kind,`model.entities.${h}.kind`,f_.options,"entityKinds"),l(u.ext,`model.entities.${h}`,"entity")}),t.model.relationships.forEach((u,h)=>{a(u.kind,`model.relationships.${h}.kind`,h_.options,"relationshipKinds"),l(u.ext,`model.relationships.${h}`,"relationship")}),t.model.dataTypes.forEach((u,h)=>l(u.ext,`model.dataTypes.${h}`,"dataType")),t.model.useCases.forEach((u,h)=>l(u.ext,`model.useCases.${h}`,"useCase")),t.views.forEach((u,h)=>{var y;if(l(u.ext,`views.${h}`,"view"),u.type!=="extension")return;const m=hw(u.extension);if(!i.has(m))return r(`views.${h}.extension`,`View uses the undeclared extension "${m}"`);const g=o.get(m);if(!g)return;const p=(y=g.views)==null?void 0:y[u.extension.slice(m.length+1)];if(!p)return r(`views.${h}.extension`,`Extension "${m}" does not define the view "${u.extension}"`);const x=p.schema.safeParse(u.data);x.success||x.error.issues.forEach(v=>r(`views.${h}.data.${v.path.join(".")}`,v.message))}),n.some(u=>u.severity==="error"))return n;const c=ft(t);for(const u of e)i.has(u.name)&&((f=u.validate)==null||f.call(u,t,{index:c,report:r}));return n}function tP(t,e){const n=ft(t),r=new Set(t.views.map(s=>s.id));t.walkthroughs.forEach((s,i)=>{const o=`walkthroughs.${i}`,a=new Set([...s.removed.entities.map(f=>de({kind:"entity",id:f.id})),...s.removed.relationships.map(f=>de({kind:"relationship",id:f.id})),...s.removed.transitions.map(f=>de({kind:"transition",behavior:f.stateMachine,id:f.transition.id}))]),l=new Set(s.removed.entities.map(f=>f.id));s.removed.entities.forEach((f,u)=>{n.entities.has(f.id)&&e(`${o}.removed.entities.${u}.id`,`"${f.id}" is removed but still in the model`)}),s.removed.relationships.forEach((f,u)=>{n.relationships.has(f.id)&&e(`${o}.removed.relationships.${u}.id`,`"${f.id}" is removed but still in the model`);for(const h of["source","target"])!n.entities.has(f[h])&&!l.has(f[h])&&e(`${o}.removed.relationships.${u}.${h}`,`Unknown entity "${f[h]}"`)}),s.removed.transitions.forEach((f,u)=>{const h=n.stateMachine(f.stateMachine);if(!h)return e(`${o}.removed.transitions.${u}.stateMachine`,`Unknown state machine "${f.stateMachine}"`);for(const m of["from","to"])h.states.some(g=>g.id===f.transition[m])||e(`${o}.removed.transitions.${u}.transition.${m}`,`Unknown state "${f.transition[m]}"`)});const c=(f,u)=>{const h=an(f);if(!h)return e(u,`"${f}" is not a ref`,'Write refs as "entity:<id>", "relationship:<id>", "state:<machine>:<id>", "transition:<machine>:<id>", "message:<interaction>:<id>" or "dataType:<id>#<field>".');!n.exists(h)&&!a.has(de(h))&&e(u,`Nothing in the model matches "${f}"`,Ws(f,nP(n,a),"element"))};if(s.kind==="change")for(const f of["before","after"])s.story[f]||e(`${o}.story.${f}`,`A change walkthrough needs "story.${f}"`,`Say in one line how it is ${f} the change, or set "kind": "tour" for a tour of code as it is.`);s.kind==="tour"&&s.marks.forEach((f,u)=>e(`${o}.marks.${u}`,"A tour has no marks",'A tour shows code as it is. Remove the marks, or set "kind": "change".')),s.overview&&!r.has(s.overview)&&e(`${o}.overview`,`Unknown view "${s.overview}"`),s.marks.forEach((f,u)=>{c(f.ref,`${o}.marks.${u}.ref`);const h=an(f.ref);h&&f.state==="removed"!==a.has(de(h))&&e(`${o}.marks.${u}.state`,f.state==="removed"?`"${f.ref}" is marked removed but is not in "removed"`:`"${f.ref}" is in "removed" but marked ${f.state}`)}),s.scenes.forEach((f,u)=>{s.kind==="tour"&&f.code.forEach((h,m)=>h.hunks.forEach((g,p)=>g.lines.forEach((x,y)=>{x.kind!=="ctx"&&e(`${o}.scenes.${u}.code.${m}.hunks.${p}.lines.${y}.kind`,`A tour shows code as it is, but this line is "${x.kind}"`,'Show an excerpt with "start" and "text", or use "ctx" lines.')}))),f.view&&!r.has(f.view)&&e(`${o}.scenes.${u}.view`,`Unknown view "${f.view}"`),f.focus.forEach((h,m)=>c(h,`${o}.scenes.${u}.focus.${m}`)),f.callouts.forEach((h,m)=>c(h.target,`${o}.scenes.${u}.callouts.${m}.target`)),f.trace.forEach((h,m)=>c(h.ref,`${o}.scenes.${u}.trace.${m}.ref`)),f.effects.forEach((h,m)=>c(h.target,`${o}.scenes.${u}.effects.${m}.target`)),f.badges.forEach((h,m)=>c(h.target,`${o}.scenes.${u}.badges.${m}.target`))})})}function nP(t,e){const n=[...e];return t.entities.forEach((r,s)=>n.push(`entity:${s}`)),t.relationships.forEach((r,s)=>n.push(`relationship:${s}`)),t.dataTypes.forEach((r,s)=>{n.push(`dataType:${s}`),r.fields.forEach(i=>n.push(`dataType:${s}#${i.name}`))}),t.useCases.forEach((r,s)=>n.push(`useCase:${s}`)),t.behaviors.forEach((r,s)=>{n.push(`behavior:${s}`),r.kind==="interaction"&&t.messages(s).forEach(i=>n.push(`message:${s}:${i.message.id}`)),r.kind==="activity"&&r.nodes.forEach(i=>n.push(`activityNode:${s}:${i.id}`)),r.kind==="state-machine"&&(r.states.forEach(i=>n.push(`state:${s}:${i.id}`)),r.transitions.forEach(i=>n.push(`transition:${s}:${i.id}`)))}),n}function A_(t){const e=new Map;for(const n of t.marks){const r=an(n.ref);r&&e.set(de(r),n.state)}return e}function rP(t,e){return t.walkthroughs.filter(n=>n.overview===e||n.scenes.some(r=>r.view===e))}class pn extends Error{constructor(e,n=[]){super(e),this.issues=n}}function sP(t,e){const n=iP(t,e),r=O_(n).filter(s=>s.severity==="error");if(r.length>0)throw new pn(`"${e.type}" would break the model: ${r[0].message}`,r);return n}function iP(t,e){const n=t.model;switch(e.type){case"entity.add":{const r=Uf.parse(e.entity);return{...t,model:{...n,entities:[...n.entities,r]}}}case"entity.update":{$m(t,e.id);const r=n.entities.map(s=>s.id===e.id?Uf.parse({...s,...e.changes,id:s.id}):s);return{...t,model:{...n,entities:r}}}case"entity.remove":{if($m(t,e.id),n.entities.some(f=>f.parent===e.id))throw new pn(`Move or remove the children of "${e.id}" first`);const r=oP(t,e.id);if(r)throw new pn(`"${e.id}" takes part in "${r}". Change that behavior first`);const s=n.relationships.filter(f=>f.source!==e.id&&f.target!==e.id),i=new Set(n.relationships.filter(f=>!s.includes(f)).map(f=>f.id)),o=n.dataFlows.filter(f=>f.source!==e.id&&f.target!==e.id).map(f=>f.via&&i.has(f.via)?{...f,via:void 0}:f),a=new Set(n.dataFlows.filter(f=>!o.some(u=>u.id===f.id)).map(f=>f.id)),l=n.useCases.map(f=>({...f,supporting:f.supporting.filter(u=>u!==e.id),realizedBy:f.realizedBy.filter(u=>u!==e.id)}));if(l.some(f=>f.actors.includes(e.id)))throw new pn(`"${e.id}" is an actor of a use case. Change the use case first`);const c=t.views.map(f=>f.type==="dataflow"?{...f,flows:f.flows.filter(u=>!a.has(u))}:yw(f,e.id,i));return{...t,model:{...n,entities:n.entities.filter(f=>f.id!==e.id),relationships:s,dataFlows:o,useCases:l},views:c}}case"relationship.add":{const r=Zf.parse(e.relationship);return{...t,model:{...n,relationships:[...n.relationships,r]}}}case"relationship.update":{if(!n.relationships.some(s=>s.id===e.id))throw new pn(`Unknown relationship "${e.id}"`);const r=n.relationships.map(s=>s.id===e.id?Zf.parse({...s,...e.changes,id:s.id}):s);return{...t,model:{...n,relationships:r}}}case"relationship.remove":{if(!n.relationships.some(s=>s.id===e.id))throw new pn(`Unknown relationship "${e.id}"`);const r=new Set([e.id]);return{...t,model:{...n,relationships:n.relationships.filter(s=>s.id!==e.id)},views:t.views.map(s=>(s.type==="architecture"||s.type==="dependency"||s.type==="map")&&s.relationships?{...s,relationships:s.relationships.filter(i=>!r.has(i))}:s)}}case"view.addEntity":case"view.removeEntity":{const r=t.views.map(s=>{if(s.id!==e.viewId)return s;if(s.type!=="architecture"&&s.type!=="dependency"&&s.type!=="map")throw new pn(`Entities are added to ${s.type} views through their behavior, not directly`);return e.type==="view.addEntity"?($m(t,e.entityId),s.entities.includes(e.entityId)?s:{...s,entities:[...s.entities,e.entityId]}):yw(s,e.entityId,new Set)});return{...t,views:r}}case"layout.move":{const r=t.views.map(s=>{if(s.id!==e.viewId)return s;const i={...s.positions};return e.position?i[e.elementId]=e.position:delete i[e.elementId],{...s,positions:i}});return{...t,views:r}}case"presentation.override":{const r={...t.presentation.elements};return e.changes?r[e.elementId]={...r[e.elementId],...e.changes}:delete r[e.elementId],{...t,presentation:{...t.presentation,elements:r}}}case"behavior.rename":{const r=e.value.trim();if(!r)throw new pn("A name cannot be empty");let s=!1;const i=n.behaviors.map(o=>{if(o.id!==e.behaviorId)return o;if(o.kind==="interaction"&&e.element==="message"){const a=l=>l.map(c=>c.type==="message"&&c.id===e.id?(s=!0,{...c,label:r}):c.type==="fragment"?{...c,branches:c.branches.map(f=>({...f,steps:a(f.steps)}))}:c);return{...o,steps:a(o.steps)}}return o.kind==="state-machine"&&e.element==="state"?{...o,states:o.states.map(a=>a.id===e.id?(s=!0,{...a,name:r}):a)}:o.kind==="state-machine"&&e.element==="transition"?{...o,transitions:o.transitions.map(a=>a.id===e.id?(s=!0,{...a,event:r}):a)}:o.kind==="activity"&&e.element==="activityNode"?{...o,nodes:o.nodes.map(a=>a.id===e.id?(s=!0,{...a,label:r}):a)}:o});if(!s)throw new pn(`No ${e.element} "${e.id}" in "${e.behaviorId}"`);return{...t,model:{...n,behaviors:i}}}case"walkthrough.setText":{const r=t.walkthroughs.findIndex(i=>i.id===e.walkthroughId);if(r<0)throw new pn(`Unknown walkthrough "${e.walkthroughId}"`);const s=R_(t.walkthroughs[r],e.path,e.value);return{...t,walkthroughs:t.walkthroughs.map((i,o)=>o===r?s:i)}}}}function R_(t,e,n){const[r,...s]=e;if(r===void 0||t===null||typeof t!="object")throw new pn(`No text at "${e.join(".")}"`);const i=t[r];if(s.length===0){if(i!==void 0&&typeof i!="string")throw new pn(`"${r}" is not text`);if(i===void 0&&Array.isArray(t))throw new pn(`No item ${r}`)}else if(i===null||typeof i!="object")throw new pn(`No text at "${e.join(".")}"`);const o=s.length===0?n:R_(i,s,n);return Array.isArray(t)?t.map((a,l)=>l===r?o:a):{...t,[r]:o}}function $m(t,e){if(!t.model.entities.some(n=>n.id===e))throw new pn(`Unknown entity "${e}"`)}function oP(t,e){var n;return(n=t.model.behaviors.find(r=>r.kind==="interaction"?r.participants.includes(e):r.kind==="activity"?r.nodes.some(s=>s.performedBy===e):r.owner===e||r.transitions.some(s=>s.triggeredBy===e)))==null?void 0:n.id}function yw(t,e,n){var s,i;const r={...t.positions};return delete r[e],t.type==="architecture"?{...t,positions:r,entities:t.entities.filter(o=>o!==e),relationships:(s=t.relationships)==null?void 0:s.filter(o=>!n.has(o)),groups:t.groups.map(o=>({...o,members:o.members.filter(a=>a!==e)})),collapsed:t.collapsed.filter(o=>o!==e)}:t.type==="dependency"?{...t,positions:r,entities:t.entities.filter(o=>o!==e),relationships:(i=t.relationships)==null?void 0:i.filter(o=>!n.has(o)),layers:t.layers.map(o=>({...o,members:o.members.filter(a=>a!==e)}))}:t.type==="extension"||t.type==="map"?{...t,positions:r,entities:t.entities.filter(o=>o!==e)}:t}const xw=t=>({past:[],present:t,future:[]});function aP(t,e){const n=sP(t.present,e);return{past:[...t.past,{doc:t.present,command:e}],present:n,future:[]}}function lP(t){const e=t.past[t.past.length-1];return e?{past:t.past.slice(0,-1),present:e.doc,future:[{doc:t.present,command:e.command},...t.future]}:t}function cP(t){const[e,...n]=t.future;return e?{past:[...t.past,{doc:t.present,command:e.command}],present:e.doc,future:n}:t}function s1(t){return`${JSON.stringify(t,null,2)}
42
- `}function dP(t,e={}){let n;try{n=JSON.parse(t)}catch(r){return{ok:!1,issues:[{path:"",message:`Not valid JSON: ${r.message}`,severity:"error"}]}}return kl(n,e)}function uP(t){const e=t.trimStart();return e.startsWith("{")&&/"poneyVersion"\s*:/.test(e)}class on extends Error{constructor(e,n){super(n?`Line ${n}: ${e}`:e),this.line=n}}function I_(t){var n;const e=((n=P_(t)[0])==null?void 0:n.text)??"";if(/^sequenceDiagram\b/.test(e))return"sequence";if(/^(flowchart|graph)\b/.test(e))return"flowchart";if(/^stateDiagram(-v2)?\b/.test(e))return"state";if(/^erDiagram\b/.test(e))return"er"}function fP(t,e={}){const n=I_(t);if(!n)throw new on("Not a supported Mermaid diagram. Start with sequenceDiagram, flowchart, stateDiagram or erDiagram.");const r=P_(t).filter(a=>!/^(title|accTitle|accDescr)\b/.test(a.text)),s=e.name??hP(t),i={sequence:mP,flowchart:vP,state:kP,er:bP}[n](r.slice(1),s),o=kl(i);if(!o.ok){const a=o.issues.find(l=>l.severity==="error");throw new on(`The diagram converted to an invalid model (${a==null?void 0:a.path}: ${a==null?void 0:a.message})`)}return{kind:n,document:o.document}}function P_(t){const e=[];let n=!1;return t.split(/\r?\n/).forEach((r,s)=>{const i=r.trim();if(s===0&&i==="---")return void(n=!0);if(n){i==="---"&&(n=!1);return}!i||i.startsWith("%%")||e.push({text:i,no:s+1})}),e}function hP(t){var e,n;return(n=(e=/^\s*title:?\s+(.+)$/m.exec(t))==null?void 0:e[1])==null?void 0:n.trim()}function D_(t){const e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e&&/^[a-z0-9]/.test(e)?e:`x-${e||"item"}`}function qc(t){const e=t.trim();return e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))?e.slice(1,-1):e}function kp(){const t=new Set;return e=>{const n=D_(e);let r=n;for(let s=2;t.has(r);s++)r=`${n}-${s}`;return t.add(r),r}}function wp(t,e){return{poneyVersion:T_,project:{id:D_(t),name:t,description:e},model:{entities:[],relationships:[]},views:[],presentation:M_}}const pP=/^(.+?)\s*(-->>|->>|--x|-x|--\)|-\)|-->|->)\s*([+-]?)\s*(.+?)\s*:\s*(.*)$/;function mP(t,e){const n=e??"Imported sequence",r=wp(n,"Imported from a Mermaid sequence diagram."),s=kp(),i=new Map,o=r.model.entities,a=(m,g,p=!1)=>{const x=m.trim();let y=i.get(x);return y||(y=s(x),i.set(x,y),o.push({id:y,kind:p?"person":"service",name:g??x,summary:""})),y},l=[],c=[{steps:l}],f=()=>c[c.length-1];let u=0,h=0;for(const{text:m,no:g}of t){let p;if(!/^(autonumber|activate|deactivate|title|Note|note|create|destroy|links?|properties)\b/.test(m)){if(p=/^(participant|actor)\s+(.+?)(?:\s+as\s+(.+))?$/.exec(m)){a(p[2],p[3]?qc(p[3]):void 0,p[1]==="actor");continue}if(/^(box|rect)\b/.test(m)){c.push({steps:f().steps,ignore:!0});continue}if(p=/^(alt|opt|loop|par|critical|break)\b\s*(.*)$/.exec(m)){const x=p[1]==="critical"||p[1]==="break"?"opt":p[1],y=p[2]||p[1],v={type:"fragment",id:`f${++h}`,kind:x,label:{alt:"Alternatives",opt:"Optional",loop:"Loop",par:"In parallel"}[x],branches:[{guard:y,steps:[]}]};f().steps.push(v),c.push({fragment:v,steps:v.branches[0].steps});continue}if(p=/^(else|and|option)\b\s*(.*)$/.exec(m)){const x=f();if(!x.fragment)throw new on(`"${p[1]}" outside of a block`,g);const y={guard:p[2]||"otherwise",steps:[]};x.fragment.branches.push(y),x.steps=y.steps;continue}if(m==="end"){if(c.length===1)throw new on('"end" without a block',g);c.pop();continue}if(p=pP.exec(m)){const x=a(p[1]),y=a(p[4]),v=p[2],k=x===y?"self":v.startsWith("--")&&v.endsWith(">")?"return":v.endsWith(")")?"async":"call";f().steps.push({type:"message",id:`m${++u}`,kind:k,from:x,to:y,label:p[5]||"(message)",data:[]});continue}throw new on(`Cannot read "${m}"`,g)}}if(c.length>1)throw new on('A block is missing its "end"');if(o.length<2)throw new on("A sequence needs at least two participants");if(l.length===0)throw new on("The sequence has no messages");return r.model.behaviors=[{kind:"interaction",id:"sequence",name:n,summary:"",participants:[...i.values()],steps:l}],r.views=[{id:"sequence",type:"sequence",category:"behavior",title:n,description:"Imported from Mermaid.",interaction:"sequence"}],r.project.defaultView="sequence",r}const gP=/^([A-Za-z0-9_][\w\-.]*)\s*(\(\[[\s\S]*\]\)|\[\[[\s\S]*\]\]|\[\([\s\S]*\)\]|\(\([\s\S]*\)\)|\{\{[\s\S]*\}\}|\[\/[\s\S]*\/\]|\[\\[\s\S]*\\\]|\[[\s\S]*\]|\([\s\S]*\)|\{[\s\S]*\}|>[\s\S]*\])?\s*(?::::[\w-]+)?$/,yP=/\s*(<-->|-->|---|-\.->|-\.-|==>|===|--x|--o)\s*(?:\|([^|]*)\|)?\s*/;function xP(t,e){const n=gP.exec(t.trim());if(!n)throw new on(`Cannot read the node "${t.trim()}"`,e);const r=n[2];if(!r)return{key:n[1],shape:"rect"};const s=[["([","])","stadium"],["((","))","circle"],["{{","}}","other"],["[[","]]","rect"],["[(",")]","other"],["[/","/]","other"],["[\\","\\]","other"],["[","]","rect"],["(",")","round"],["{","}","diamond"],[">","]","other"]];for(const[i,o,a]of s)if(r.startsWith(i)&&r.endsWith(o))return{key:n[1],label:qc(r.slice(i.length,-o.length)),shape:a};return{key:n[1],shape:"rect"}}function vP(t,e){var x;const n=e??"Imported flowchart",r=wp(n,"Imported from a Mermaid flowchart."),s=kp(),i=new Map,o=[],a=[],l=[],c=(y,v)=>{const k=xP(y,v);let w=i.get(k.key);return w?k.label&&(w.label=k.label,w.shape=k.shape):(w={id:s(k.key),label:k.label??k.key,shape:k.shape,lane:l[l.length-1]},i.set(k.key,w)),w};for(const{text:y,no:v}of t){let k;if(/^(classDef|class|style|linkStyle|click|direction|accTitle|accDescr|title)\b/.test(y))continue;if(k=/^subgraph\s+(.+)$/.exec(y)){const S=/^([\w-]+)\s*\[(.+)\]$/.exec(k[1].trim()),N=qc(S?S[2]:k[1]),E=s(`lane-${S?S[1]:N}`);a.push({id:E,name:N}),l.push(E);continue}if(y==="end"){l.pop();continue}const j=y.replace(/;$/,"").replace(/--\s+([^-|>][^>]*?)\s+-->/g,"-->|$1|").replace(/-\.\s+([^.]+?)\s+\.->/g,"-.->|$1|").replace(/==\s+([^=]+?)\s+==>/g,"==>|$1|").split(yP),C=S=>S.split(/\s*&\s*/);let _=C(j[0]).map(S=>c(S,v));for(let S=1;S+2<j.length+1&&j[S+2]!==void 0;S+=3){const N=(x=j[S+1])==null?void 0:x.trim(),E=C(j[S+2]).map(P=>c(P,v));for(const P of _)for(const z of E)o.push({from:P.id,to:z.id,guard:N?qc(N):void 0});_=E}}if(i.size===0)throw new on("The flowchart has no nodes");const f=new Set(o.map(y=>y.to)),u=new Set(o.map(y=>y.from)),h=[...i.values()],m=y=>y.shape==="diamond"?"decision":(y.shape==="circle"||y.shape==="stadium")&&!f.has(y.id)?"initial":(y.shape==="circle"||y.shape==="stadium")&&!u.has(y.id)?"final":"action",g=h.map(y=>({id:y.id,kind:m(y),label:y.label,performedBy:y.lane})),p=g.filter(y=>y.kind==="initial");if(p.length!==1){p.forEach(k=>k.kind="action");const y=g.filter(k=>!f.has(k.id)),v={id:s("start"),kind:"initial",label:"Start",performedBy:(y[0]??g[0]).performedBy};g.unshift(v);for(const k of y.length?y:[g[1]])o.push({from:v.id,to:k.id})}return r.model.entities=a.map(y=>({id:y.id,kind:"component",name:y.name,summary:""})),r.model.behaviors=[{kind:"activity",id:"flow",name:n,summary:"",nodes:g,flows:o.map((y,v)=>({id:`e${v+1}`,...y}))}],r.views=[{id:"flow",type:"activity",category:"behavior",title:n,description:"Imported from Mermaid.",activity:"flow",swimlanes:a.length>0}],r.project.defaultView="flow",r}function kP(t,e){var g;const n=e??"Imported lifecycle",r=wp(n,"Imported from a Mermaid state diagram."),s=kp(),i=new Map,o=[],a="[*]:initial",l="[*]:final",c=p=>{let x=i.get(p);return x||(x={id:s(p===a?"start":p===l?"end":p),name:p===a?"Start":p===l?"End":p},i.set(p,x)),x};for(const{text:p,no:x}of t){let y;if(!(/^(note|direction|classDef|class|style)\b/i.test(p)||p==="}"||p==="--")){if(y=/^state\s+"([^"]+)"\s+as\s+([\w-]+)/.exec(p)){c(y[2]).name=y[1];continue}if(y=/^state\s+([\w-]+)/.exec(p)){c(y[1]);continue}if(y=/^(\[\*\]|[\w-]+)\s*-->\s*(\[\*\]|[\w-]+)\s*(?::\s*(.*))?$/.exec(p)){const v=y[1]==="[*]"?a:y[1],k=y[2]==="[*]"?l:y[2];c(v),c(k),o.push({from:v,to:k,label:(g=y[3])==null?void 0:g.trim()});continue}if(y=/^([\w-]+)\s*:\s*(.+)$/.exec(p)){c(y[1]).description=y[2];continue}throw new on(`Cannot read "${p}"`,x)}}if(o.length===0)throw new on("The state diagram has no transitions");if(!i.has(a)){const p=o[0].from;c(a),o.unshift({from:a,to:p})}const f=new Set,u=o.filter(p=>p.to===l);for(const p of u)o.some(x=>x.from===p.from&&x.to!==l)||f.add(p.from);const h=o.filter(p=>!(p.to===l&&f.has(p.from)));h.some(p=>p.to===l)||i.delete(l);const m=p=>{if(!p)return{event:"Next"};const x=/^(.*?)\s*(?:\[(.*?)\])?\s*(?:\/\s*(.*))?$/.exec(p);return{event:x[1]||p,guard:x[2]||void 0,actions:x[3]?x[3].split(/\s*[;,]\s*/).filter(Boolean):[]}};return r.model.behaviors=[{kind:"state-machine",id:"lifecycle",name:n,summary:"",states:[...i.entries()].map(([p,x])=>({id:x.id,kind:p===a?"initial":p===l||f.has(p)?"final":"state",name:x.name,description:x.description})),transitions:h.map((p,x)=>({id:`t${x+1}`,from:i.get(p.from).id,to:i.get(p.to).id,...m(p.label)}))}],r.views=[{id:"lifecycle",type:"state",category:"behavior",title:n,description:"Imported from Mermaid.",stateMachine:"lifecycle"}],r.project.defaultView="lifecycle",r}const vw="(\\|\\||\\|o|o\\||\\}\\||\\|\\{|\\}o|o\\{)",wP=new RegExp(`^([\\w-]+)\\s*${vw}(--|\\.\\.)${vw}\\s*([\\w-]+)\\s*:\\s*(.+)$`);function kw(t){return t==="||"?"exactly-one":t==="|o"||t==="o|"?"zero-or-one":t==="}|"||t==="|{"?"one-or-many":"zero-or-many"}function bP(t,e){const n=e??"Imported data model",r=wp(n,"Imported from a Mermaid ER diagram."),s=kp(),i=new Map,o=[];let a=null;function l(c){let f=i.get(c);return f||(f={id:s(c),name:c,fields:[]},i.set(c,f)),f}for(const{text:c,no:f}of t){let u;if(a){if(c==="}"){a=null;continue}const h=/^([\w<>[\](),.-]+)\s+([\w-]+)(?:\s+((?:PK|FK|UK)(?:\s*,\s*(?:PK|FK|UK))*))?(?:\s+"([^"]*)")?$/.exec(c);if(!h)throw new on(`Cannot read the attribute "${c}"`,f);const m=(h[3]??"").split(/\s*,\s*/);a.fields.push({name:h[2],type:h[1],primaryKey:m.includes("PK")||void 0,unique:m.includes("UK")||void 0,description:[m.includes("FK")?"Foreign key.":"",h[4]??""].filter(Boolean).join(" ")||void 0});continue}if(u=/^([\w-]+)(?:\["?([^"\]]+)"?\])?\s*\{$/.exec(c)){a=l(u[1]),u[2]&&(a.name=u[2]);continue}if(u=wP.exec(c)){const h=l(u[1]),m=l(u[5]);o.push({id:s(`rel-${u[1]}-${u[5]}`),from:h.id,to:m.id,fromCardinality:kw(u[2]),toCardinality:kw(u[4]),label:qc(u[6]),logical:u[3]===".."});continue}if(u=/^([\w-]+)$/.exec(c)){l(u[1]);continue}throw new on(`Cannot read "${c}"`,f)}if(i.size===0)throw new on("The ER diagram has no entities");return r.model.dataTypes=[...i.values()].map(c=>({id:c.id,kind:"table",name:c.name,summary:"",fields:c.fields})),r.model.dataRelations=o,r.views=[{id:"data-model",type:"erd",category:"data",title:n,description:"Imported from Mermaid.",dataTypes:[...i.values()].map(c=>c.id)}],r.project.defaultView="data-model",r}const cu=t=>`g:${t}`;function SP(t,e,n={}){const r=ft(t),s=new Set(e.entities.filter(k=>r.entities.has(k))),i=new Set(n.collapsed??e.collapsed),o=k=>{var w;return(w=r.ancestors(k).find(j=>s.has(j.id)))==null?void 0:w.id},a=new Map;for(const k of e.groups)for(const w of k.members)s.has(w)&&a.set(w,k.id);const l=new Map;for(const k of e.groups){const w=k.members.find(j=>s.has(j));w&&l.set(k.id,o(w))}const c=new Map;for(const k of s){const w=a.get(k);c.set(k,w?cu(w):o(k))}for(const[k,w]of l)c.set(cu(k),w);const f=new Map;for(const[k,w]of c){const j=f.get(w)??[];j.push(k),f.set(w,j)}const u=new Map;e.entities.forEach((k,w)=>u.set(k,w)),e.groups.forEach(k=>u.set(cu(k.id),Math.min(...k.members.map(w=>u.get(w)??1/0))));for(const k of f.values())k.sort((w,j)=>(u.get(w)??0)-(u.get(j)??0));const h=k=>(f.get(k)??[]).reduce((j,C)=>j+(C.startsWith("g:")?0:1)+h(C),0),m=k=>{const w=k.startsWith("g:"),j=w?k.slice(2):k,C=f.get(k)??[],_=C.length>0&&i.has(j);return{id:k,type:w?"group":"entity",entityId:w?void 0:k,groupId:w?j:void 0,parent:c.get(k),children:_?[]:C.map(m),collapsed:_,hiddenCount:_?h(k):0}},g=(f.get(void 0)??[]).map(m),p={};for(const k of s){let w=k,j=c.get(k);for(;j;){const C=j.startsWith("g:")?j.slice(2):j;i.has(C)&&(w=j),j=c.get(j)}p[k]=w}for(const k of e.groups){const w=cu(k.id);let j=w,C=c.get(w);for(;C;)i.has(C.startsWith("g:")?C.slice(2):C)&&(j=C),C=c.get(C);p[w]=j}const x=e.relationships??t.model.relationships.filter(k=>s.has(k.source)&&s.has(k.target)).map(k=>k.id),y=new Map;for(const k of x){const w=r.relationships.get(k);if(!w||!s.has(w.source)||!s.has(w.target))continue;const j=p[w.source],C=p[w.target];if(j===C)continue;const _=`${j}->${C}`,S=j!==w.source||C!==w.target,N=y.get(_);N?(N.relationships.push(w.id),N.lifted||(N.lifted=S)):y.set(_,{id:w.id,source:j,target:C,relationships:[w.id],lifted:S})}const v=[...y.values()].map(k=>k.relationships.length>1?{...k,id:`lifted:${k.source}->${k.target}`}:k);return{roots:g,edges:v,representative:p,direction:e.layout.direction}}function jP(t){return t==="person"||t==="external"?"terminator":t==="database"||t==="cache"||t==="message-broker"?"store":"process"}function CP(t,e,n={}){const r=ft(t),s=e.flows.map(g=>r.dataFlows.get(g)).filter(jo),i=[];for(const g of s)for(const p of[g.source,g.target])i.includes(p)||i.push(p);const o=new Set(i),a=new Set(s.map(g=>g.via).filter(jo)),c=n.controlFlow??e.showControlFlow?t.model.relationships.filter(g=>o.has(g.source)&&o.has(g.target)&&!a.has(g.id)&&g.kind!=="depends-on"&&g.kind!=="implements").map(g=>({id:g.id,source:g.source,target:g.target})):[],f=g=>{var p;return jP(((p=r.entities.get(g))==null?void 0:p.kind)??"service")},u=new Set(s.map(g=>g.source)),h=new Set(i.filter(g=>{if(f(g)!=="terminator"||!u.has(g))return!1;const p=s.filter(x=>x.target===g);return p.length>0&&p.every(x=>f(x.source)==="terminator")})),m=i.map(g=>({id:g,entityId:g,role:f(g)}));for(const g of h)m.push({id:`${g}~in`,entityId:g,role:"terminator"});return{nodes:m,flows:s.map(g=>({id:g.id,source:g.source,target:h.has(g.target)?`${g.target}~in`:g.target,label:g.label,data:g.data})),control:c}}function _P(t,e,n={}){const r=ft(t),s=new Set(e.dataTypes),i=new Set(n.expanded??[]),o=t.model.dataRelations.filter(c=>s.has(c.from)&&s.has(c.to)),a=e.dataTypes.map(c=>r.dataTypes.get(c)).filter(jo).map(c=>{const f=x=>x.primaryKey||!!x.references||o.some(y=>y.via===x.name&&(y.from===c.id||y.to===c.id)),u=c.fields.filter(f),h=c.fields.filter(x=>!f(x)),g=i.has(c.id)||c.fields.length<=e.fieldLimit+1?c.fields:[...u,...h.slice(0,Math.max(0,e.fieldLimit-u.length))],p=c.fields.filter(x=>g.includes(x));return{dataTypeId:c.id,name:c.name,store:e.groupByStore?c.storedIn:void 0,fields:p,hiddenCount:c.fields.length-p.length,expanded:i.has(c.id)}}),l=[...new Set(a.map(c=>c.store).filter(jo))];return{tables:a,relations:o,stores:l}}const NP=new RegExp("`([^`\\n]+)`|\\[([^\\]\\n]+)\\]\\(([^)\\s]+)\\)|\\*\\*(.+?)\\*\\*|(?<![\\w*])\\*(?!\\s)(.+?)(?<!\\s)\\*(?![\\w*])|(?<![\\w_])_(?!\\s)(.+?)(?<!\\s)_(?![\\w_])","gs");function Oa(t,e=[],n){const r=[];let s=0;for(const i of t.matchAll(NP))i.index>s&&r.push({text:t.slice(s,i.index),marks:e,...n?{href:n}:{}}),i[1]!==void 0?r.push({text:i[1],marks:[...e,"code"],...n?{href:n}:{}}):i[2]!==void 0?r.push(...Oa(i[2],e,i[3])):i[4]!==void 0?r.push(...Oa(i[4],ww(e,"bold"),n)):r.push(...Oa(i[5]??i[6],ww(e,"italic"),n)),s=i.index+i[0].length;return s<t.length&&r.push({text:t.slice(s),marks:e,...n?{href:n}:{}}),z_(r)}const i1=t=>t.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean),Nr=t=>i1(t).map(e=>Oa(e).map(n=>n.text).join("")).join(`
43
-
44
- `);function EP(t){const e=[];for(const n of z_(t)){const r=e[e.length-1];r&&r[0].href===n.href?r.push(n):e.push([n])}return e.map(n=>{const r=n.map($P).join("");return n[0].href?`[${r}](${n[0].href})`:r}).join("")}function $P(t){if(!t.text)return"";const[,e,n,r]=/^(\s*)(.*?)(\s*)$/s.exec(t.text);if(!n)return t.text;let s=n;return t.marks.includes("code")&&(s=`\`${s}\``),t.marks.includes("italic")&&(s=`*${s}*`),t.marks.includes("bold")&&(s=`**${s}**`),`${e}${s}${r}`}const ww=(t,e)=>t.includes(e)?t:[...t,e],MP=(t,e)=>t.href===e.href&&t.marks.length===e.marks.length&&t.marks.every(n=>e.marks.includes(n));function z_(t){const e=[];for(const n of t){if(!n.text)continue;const r=e[e.length-1];r&&MP(r,n)?r.text+=n.text:e.push({...n,marks:[...n.marks]})}return e}const bw={card:{w:248,h:104},cylinder:{w:240,h:112},stack:{w:240,h:104},person:{w:176,h:120},frame:{w:330,h:150},chip:{w:220,h:64},group:{w:248,h:104}},Sw={container:56,group:38};async function TP(t,e,n={}){var y;const r=ft(t),s=SP(t,e,n),i=v=>{var N;const k=v.children.length>0,w=v.type==="group"?"group":r.style(v.entityId,e.id).shape,j=v.collapsed&&v.type==="entity"?bw.frame:bw[w],C=e.positions[v.id],_={id:v.id};if(k){const E=v.type==="group"?Sw.group:Sw.container;_.layoutOptions={"elk.padding":`[top=${E},left=24,bottom=24,right=24]`,"elk.spacing.nodeNode":"28"},_.children=v.children.map(i)}else _.width=j.w,_.height=j.h;const S=v.entityId?(N=r.entities.get(v.entityId))==null?void 0:N.kind:void 0;return!k&&(S==="person"||S==="external")&&(_.layoutOptions={"elk.layered.layering.layerConstraint":S==="person"?"FIRST":"LAST"}),C&&(_.x=C.x,_.y=C.y),_},o=v=>{var k;return(k=r.entities.get(v))==null?void 0:k.kind},a=new Set(s.edges.filter(v=>o(v.source)==="external"&&o(v.target)!=="external").map(v=>v.id)),l={id:"root",layoutOptions:{...Sd,"elk.direction":s.direction==="down"?"DOWN":"RIGHT","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":"36","elk.layered.spacing.nodeNodeBetweenLayers":"84","elk.spacing.edgeNode":"22","elk.spacing.edgeEdge":"14","elk.layered.spacing.edgeNodeBetweenLayers":"26","elk.layered.spacing.edgeEdgeBetweenLayers":"14","elk.padding":"[top=24,left=24,bottom=24,right=24]"},children:s.roots.map(i),edges:s.edges.map(v=>a.has(v.id)?{id:v.id,sources:[v.target],targets:[v.source]}:{id:v.id,sources:[v.source],targets:[v.target]})},c=await jd(l),f=new Map,u=new Map,h=(v,k)=>{f.set(v.id,v),u.set(v.id,k),v.children.forEach(w=>h(w,k+1))};s.roots.forEach(v=>h(v,0));const m=[...c.nodes.values()].map(v=>{const k=f.get(v.id);return{id:v.id,type:k.type,entityId:k.entityId,groupId:k.groupId,parent:k.parent,compound:k.children.length>0,collapsed:k.collapsed,expandable:k.collapsed||k.children.length>0,hiddenCount:k.hiddenCount,depth:u.get(v.id)??0,x:v.x,y:v.y,w:v.w,h:v.h}}).sort((v,k)=>v.depth-k.depth),g=s.edges.map(v=>{var w;const k=((w=c.edges.get(v.id))==null?void 0:w.points)??[];return{...v,points:a.has(v.id)?k.slice().reverse():k}}).filter(v=>v.points.length>=2),p=new Map(m.map(v=>[v.id,v])),x={};for(const v of m)v.entityId&&(x[de({kind:"entity",id:v.entityId})]=v),v.groupId&&(x[de({kind:"group",view:e.id,id:v.groupId})]=v);for(const[v,k]of Object.entries(s.representative)){const w=p.get(k);w&&!v.startsWith("g:")&&(x[y=de({kind:"entity",id:v})]??(x[y]=w))}for(const v of g){const k=Ni(v.points.map(w=>({x:w.x,y:w.y,w:1,h:1})));for(const w of v.relationships)x[de({kind:"relationship",id:w})]=k}return{width:c.width,height:c.height,nodes:m,edges:g,anchors:x}}const Rt={headerH:64,headerGap:30,row:44,selfRow:58,fragmentHeader:34,branchHeader:30,fragmentEnd:14,activationW:10,margin:32,labelSize:12.5};function L_(t,e){const n=[];for(const r of t){if(r.type==="message"){e.has(r.id)&&n.push(r);continue}const s=r.branches.map(i=>({...i,steps:L_(i.steps,e)})).filter(i=>i.steps.length>0);s.length&&n.push({...r,branches:s})}return n}function OP(t,e,n={}){var O;const r=ft(t),s=r.interaction(e.interaction);if(!s)throw new Error(`Unknown interaction "${e.interaction}"`);const i=new Map(r.messages(s.id).map(R=>[R.message.id,R.number])),o=(O=n.only)!=null&&O.length?new Set(n.only):void 0,a=o?L_(s.steps,o):s.steps,l=new Set,c=R=>R.forEach(V=>V.type==="message"?(l.add(V.from),l.add(V.to)):V.branches.forEach(J=>c(J.steps)));c(a);const f={...s,steps:a,participants:o?s.participants.filter(R=>l.has(R)):s.participants},u=[],h=R=>R.forEach(V=>V.type==="message"?u.push({message:V}):V.branches.forEach(J=>h(J.steps)));h(a);const m=f.participants,g=new Map(m.map((R,V)=>[R,V])),p=!!n.compact,x=m.map(R=>{var V;return Math.max(p?128:156,Oe(((V=r.entities.get(R))==null?void 0:V.name)??R,14.5,650)+(p?60:70))}),y=m.map((R,V)=>V===0?0:x[V-1]/2+x[V]/2+(p?28:36)),v=R=>(Oe(R.label,Rt.labelSize,500)+44+(p?60:0))*(p?.62:1);for(const{message:R}of u){const V=g.get(R.from),J=g.get(R.to);if(V===J){V+1<m.length&&(y[V+1]=Math.max(y[V+1],v(R)+(p?40:56)));continue}const[re,Te]=V<J?[V,J]:[J,V],Le=y.slice(re+1,Te+1).reduce((gt,Xt)=>gt+Xt,0),Ke=v(R)+24;if(Le<Ke)for(let gt=re+1;gt<=Te;gt++)y[gt]+=(Ke-Le)/(Te-re)}const k=[];m.forEach((R,V)=>k.push(V===0?Rt.margin+40+x[0]/2:k[V-1]+y[V]));const w=R=>k[g.get(R)],j=[],C=[],_=[],S=new Map(m.map(R=>[R,[]])),N=R=>S.get(R).length,E=(R,V)=>w(R)-Rt.activationW/2+Math.max(0,V-1)*4,P=(R,V)=>{const J=N(R);if(J===0)return w(R);const re=E(R,J);return V?re+Rt.activationW:re},z=(R,V)=>S.get(R).push(V),I=(R,V)=>{const J=S.get(R),re=J.pop();re!==void 0&&_.push({entityId:R,x:E(R,J.length+1),y1:re,y2:Math.max(V,re+12)})},F=()=>new Map([...S].map(([R,V])=>[R,V.length])),U=(R,V)=>{for(const J of m){for(;N(J)>0;)I(J,V);for(let re=0;re<(R.get(J)??0);re++)z(J,V)}};let M=Rt.headerH+Rt.headerGap,$=k[k.length-1]+x[x.length-1]/2;const A=(R,V=new Set)=>{for(const J of R)J.type==="message"?(V.add(J.from),V.add(J.to)):J.branches.forEach(re=>A(re.steps,V));return V},B=R=>Math.max(0,...R.map(V=>V.type==="fragment"?1+Math.max(...V.branches.map(J=>B(J.steps))):0)),K=(R,V,J)=>{for(const re of R){if(re.type==="message"){const le=re;if(le.kind==="self"){const Zt=P(le.from,!0);z(le.from,M+6);const hr=34;j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:M,x1:Zt,x2:Zt,loop:{x:Zt,y1:M-2,y2:M+20,w:hr},fragments:V}),$=Math.max($,Zt+hr+Oe(le.label,Rt.labelSize,500)+48),I(le.from,M+28),M+=Rt.selfRow;continue}const it=w(le.to)>w(le.from);if(le.kind==="call"){N(le.from)===0&&!p&&z(le.from,M-10);const Zt=P(le.from,it);z(le.to,M);const hr=P(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:M,x1:Zt,x2:hr,fragments:V})}else if(le.kind==="return"){const Zt=P(le.from,it);I(le.from,M);const hr=P(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:M,x1:Zt,x2:hr,fragments:V})}else{const Zt=P(le.from,it),hr=P(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:M,x1:Zt,x2:hr,fragments:V})}M+=Rt.row;continue}const Te=re,Le=M-18,Ke=[...A([Te])].map(le=>g.get(le)).sort((le,it)=>le-it),gt=30+(B([Te])-1)*12,Xt=k[Ke[0]]-gt;let Wt=k[Ke[Ke.length-1]]+gt;M=Le+Rt.fragmentHeader+18;const At=[],Qe=F(),Dn=j.length;Te.branches.forEach((le,it)=>{if(it>0){const Zt=M-18;At.push({guard:le.guard,y:Zt}),U(Qe,Zt),M=Zt+Rt.branchHeader+18}else At.push({guard:le.guard,y:Le});K(le.steps,[...V,Te.id],J+1)});for(const le of j.slice(Dn))le.loop&&(Wt=Math.max(Wt,le.loop.x+le.loop.w+Oe(le.label,Rt.labelSize,500)+48));const Ut=M-18+Rt.fragmentEnd;C.push({id:Te.id,kind:Te.kind,label:Te.label,depth:J,branches:At,x:Xt,y:Le,w:Wt-Xt,h:Ut-Le}),$=Math.max($,Wt),M=Ut+26}};K(f.steps,[],0);const Q=M+4;for(const R of m)for(;N(R)>0;)I(R,Q-18);const D=m.map((R,V)=>({entityId:R,x:k[V],header:{x:k[V]-x[V]/2,y:0,w:x[V],h:Rt.headerH},lifeline:{y1:Rt.headerH,y2:Q}})),W=-Math.min(0,...C.map(R=>R.x-Rt.margin));W&&(D.forEach(R=>{R.x+=W,R.header.x+=W}),j.forEach(R=>{R.x1+=W,R.x2+=W,R.loop&&(R.loop.x+=W)}),_.forEach(R=>R.x+=W),C.forEach(R=>R.x+=W),$+=W);const H={};H[de({kind:"behavior",id:f.id})]={x:0,y:0,w:$+Rt.margin,h:Q};for(const R of D)H[de({kind:"entity",id:R.entityId})]=R.header;for(const R of j){const V=Math.min(R.x1,R.x2),J=Math.max(Math.abs(R.x2-R.x1),R.loop?R.loop.w+120:0);H[de({kind:"message",behavior:f.id,id:R.id})]={x:V,y:R.y-22,w:J,h:32}}for(const R of C)H[de({kind:"fragment",behavior:f.id,id:R.id})]=R;return{interactionId:f.id,width:$+Rt.margin,height:Q+24,participants:D,messages:j,activations:_,fragments:C,anchors:H}}const jw={terminator:{w:184,h:64},process:{w:196,h:64},store:{w:204,h:52}};async function AP(t,e,n={}){var f,u;const r=ft(t),s=CP(t,e,n),i=h=>{var y;if(((y=s.nodes.find(v=>v.id===h))==null?void 0:y.role)!=="terminator")return{};const g=s.flows.some(v=>v.target===h),p=s.flows.some(v=>v.source===h),x=g?p?void 0:"LAST":"FIRST";return x?{layoutOptions:{"elk.layered.layering.layerConstraint":x}}:{}},o=await jd({id:"root",layoutOptions:{...Sd,"elk.direction":"DOWN","elk.spacing.nodeNode":"48","elk.layered.spacing.nodeNodeBetweenLayers":"48","elk.spacing.edgeNode":"24","elk.spacing.edgeEdge":"16","elk.spacing.edgeLabel":"6","elk.edgeLabels.placement":"CENTER","elk.padding":"[top=32,left=32,bottom=32,right=32]"},children:s.nodes.map(h=>({id:h.id,width:jw[h.role].w,height:jw[h.role].h,...e.positions[h.id],...i(h.id)})),edges:[...s.flows.map(h=>({id:h.id,sources:[h.source],targets:[h.target],labels:[{text:h.label,width:Oe(h.label,11.5,500)+26,height:22}]})),...s.control.map(h=>({id:h.id,sources:[h.source],targets:[h.target],layoutOptions:{"elk.layered.priority.direction":"0"}}))]}),a=s.nodes.map(h=>({...o.nodes.get(h.id),id:h.id,entityId:h.entityId,role:h.role})),l=[...s.control.map(h=>{var m;return{id:h.id,control:!0,source:h.source,target:h.target,points:((m=o.edges.get(h.id))==null?void 0:m.points)??[],data:[]}}),...s.flows.map(h=>{const m=o.edges.get(h.id);return{id:h.id,control:!1,source:h.source,target:h.target.replace(/~in$/,""),points:(m==null?void 0:m.points)??[],label:m==null?void 0:m.labels[0],data:h.data}})].filter(h=>h.points.length>=2),c={};for(const h of a)c[f=de({kind:"entity",id:h.entityId})]??(c[f]=h);for(const h of l){const m=Ni([...h.points.map(p=>({x:p.x,y:p.y,w:1,h:1})),...h.label?[h.label]:[]]);c[de(h.control?{kind:"relationship",id:h.id}:{kind:"dataFlow",id:h.id})]=m;const g=r.dataFlows.get(h.id);g!=null&&g.via&&(c[u=de({kind:"relationship",id:g.via})]??(c[u]=m))}return{width:o.width,height:o.height,nodes:a,edges:l,anchors:c}}const RP=92,zy=52,IP=zy+40,du=212;function PP(t,e){var U;const n=ft(t),r=n.activity(e.activity);if(!r)throw new Error(`Unknown activity "${e.activity}"`);const s=r.nodes,i=new Map,o=new Map;for(const M of r.flows)i.set(M.from,[...i.get(M.from)??[],M.to]),o.set(M.to,[...o.get(M.to)??[],M.from]);const a=s.find(M=>M.kind==="initial")??s[0],l=new Set,c=new Map,f=M=>{c.set(M,"open");for(const $ of r.flows.filter(A=>A.from===M)){const A=c.get($.to);A==="open"?l.add($.id):A||f($.to)}c.set(M,"done")};f(a.id),s.forEach(M=>!c.has(M.id)&&f(M.id));const u=r.flows.filter(M=>!l.has(M.id)),h=new Map(s.map(M=>[M.id,0])),m=new Map(s.map(M=>[M.id,0]));u.forEach(M=>m.set(M.to,(m.get(M.to)??0)+1));const g=s.filter(M=>(m.get(M.id)??0)===0).map(M=>M.id);for(;g.length;){const M=g.shift();for(const $ of u.filter(A=>A.from===M))h.set($.to,Math.max(h.get($.to),h.get(M)+1)),m.set($.to,m.get($.to)-1),m.get($.to)===0&&g.push($.to)}const p=[];if(e.swimlanes)for(const M of s)p.includes(M.performedBy)||p.push(M.performedBy);p.length===0&&p.push(void 0);const x=M=>e.swimlanes?p.indexOf(M.performedBy):0,y=new Map;for(const M of s){const $=`${x(M)}:${h.get(M.id)}`;y.set($,[...y.get($)??[],M.id])}const v=p.map((M,$)=>Math.max(240,...[...y.entries()].filter(([A])=>A.startsWith(`${$}:`)).map(([,A])=>A.length*du+28))),k=[];let w=0;p.forEach((M,$)=>{var A;k.push({entityId:M,label:M?((A=n.entities.get(M))==null?void 0:A.name)??M:e.swimlanes?"Unassigned":r.name,x:w,w:v[$]}),w+=v[$]});const j=new Map;for(const M of s){const $=x(M),A=h.get(M.id),B=y.get(`${$}:${A}`),K=B.indexOf(M.id),Q=k[$].x+k[$].w/2+(K-(B.length-1)/2)*du,D=IP+A*RP;let L=0,W=0,H=[M.label];switch(M.kind){case"initial":L=W=22;break;case"final":L=W=26;break;case"fork":case"join":L=120,W=6;break;case"decision":case"merge":L=Math.max(96,Oe(M.label,12.5,600)+60),W=54;break;default:H=Of(M.label,156,13,500,2),L=Math.min(188,Math.max(124,Math.max(...H.map(O=>Oe(O,13,500)))+32)),W=H.length>1?58:42}j.set(M.id,{id:M.id,kind:M.kind,label:M.label,lines:H,outcome:M.outcome,lane:$,rank:A,x:Q-L/2,y:D-W/2,w:L,h:W})}for(const M of j.values()){if(M.kind!=="fork"&&M.kind!=="join")continue;const $=((U=M.kind==="fork"?i.get(M.id):o.get(M.id))==null?void 0:U.map(Q=>j.get(Q)))??[];if($.length<2)continue;const A=$.map(Q=>Q.x+Q.w/2),B=Math.min(...A,M.x+M.w/2)-28,K=Math.max(...A,M.x+M.w/2)+28;M.x=B,M.w=K-B}const C=M=>M.x+M.w/2,_=M=>M.y+M.h/2,S=new Map;for(const M of j.values()){if(M.kind!=="decision")continue;const A=r.flows.filter(Q=>Q.from===M.id&&!l.has(Q.id)).slice().sort((Q,D)=>C(j.get(Q.to))-C(j.get(D.to))),B=new Set(["left","bottom","right"]),K=Q=>{const D=C(j.get(Q.to))-C(M);return Math.abs(D)<2?"bottom":D<0?"left":"right"};for(const Q of A){const D=K(Q),W=(D==="left"?["left","bottom","right"]:D==="right"?["right","bottom","left"]:["bottom","left","right"]).find(H=>B.has(H))??"bottom";B.delete(W),S.set(Q.id,W)}for(const Q of r.flows.filter(D=>D.from===M.id&&l.has(D.id)))S.set(Q.id,B.has("right")?"right":"bottom")}const N=[];let E=0;for(const M of r.flows){const $=j.get(M.from),A=j.get(M.to);if(l.has(M.id)){const W=Math.min(A.rank,$.rank),H=Math.max(A.rank,$.rank),O=Math.min($.x,A.x),R=Math.max($.x+$.w,A.x+A.w),V=[...j.values()].filter(Ke=>Ke.rank>=W&&Ke.rank<=H&&Ke.x+Ke.w>=O-du/2&&Ke.x<=R+du/2),J=Math.max(...V.map(Ke=>Ke.x+Ke.w))+28+E++*14,re=$.y+$.h+16+(E-1)*6,Te=S.get(M.id)==="right"?{x:$.x+$.w,y:_($)}:{x:C($),y:$.y+$.h},Le=S.get(M.id)==="right"?[Te,{x:J,y:Te.y},{x:J,y:_(A)},{x:A.x+A.w,y:_(A)}]:[Te,{x:Te.x,y:re},{x:J,y:re},{x:J,y:_(A)},{x:A.x+A.w,y:_(A)}];N.push({id:M.id,from:M.from,to:M.to,points:Le,guard:M.guard,guardAt:M.guard?{x:Te.x+8,y:Te.y+14,anchor:"start"}:void 0,back:!0});continue}const B=A.kind==="join"?C($):C(A),K={x:B,y:A.y};let Q,D;const L=$.kind==="decision"?S.get(M.id):void 0;if(L==="left"||L==="right"){const W={x:L==="right"?$.x+$.w:$.x,y:_($)};Q=Math.abs(B-W.x)<1?[W,K]:[W,{x:B,y:W.y},K],D={x:W.x+(L==="right"?10:-10),y:W.y-9,anchor:L==="right"?"start":"end"}}else{const H={x:$.kind==="fork"?C(A):C($),y:$.y+$.h},O=K.y-22;Q=Math.abs(H.x-K.x)<1?[H,K]:[H,{x:H.x,y:O},{x:K.x,y:O},K],D={x:H.x+8,y:H.y+16,anchor:"start"}}N.push({id:M.id,from:M.from,to:M.to,points:Q,guard:M.guard,guardAt:M.guard?D:void 0,back:!1})}const P=[...j.values()],z=Math.max(w,...N.flatMap(M=>M.points.map($=>$.x+24))),I=Math.max(...P.map(M=>M.y+M.h))+72;z>w&&(k[k.length-1].w+=z-w);const F={};for(const M of P)F[de({kind:"activityNode",behavior:r.id,id:M.id})]=M;for(const M of N)F[de({kind:"activityFlow",behavior:r.id,id:M.id})]=Ni(M.points.map($=>({...$,w:1,h:1})));return k.forEach(M=>{M.entityId&&(F[de({kind:"entity",id:M.entityId})]={x:M.x,y:0,w:M.w,h:zy})}),F[de({kind:"behavior",id:r.id})]={x:0,y:0,w:z,h:I},{processId:r.id,width:Math.max(w,z),height:I,lanes:k,laneHeader:zy,nodes:P,edges:N,anchors:F}}const at={header:40,row:26,more:28,bottom:6};function DP(t){const e=Oe(t.name,13.5,650)+64,n=Math.max(0,...t.fields.map(i=>Oe(i.name,12.5,500,"mono")+Oe(i.type,11.5,400,"mono")+78)),r=Math.ceil(Math.max(232,e,n)),s=at.header+t.fields.length*at.row+(t.hiddenCount>0||t.expanded?at.more:0)+at.bottom;return{w:r,h:s}}async function zP(t,e,n={}){const r=_P(t,e,n),s=m=>{const g=DP(m);return{id:m.dataTypeId,width:g.w,height:g.h,...e.positions[m.dataTypeId]}},i=await jd({id:"root",layoutOptions:{...Sd,"elk.direction":"RIGHT","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":"36","elk.layered.spacing.nodeNodeBetweenLayers":"96","elk.spacing.edgeNode":"24","elk.spacing.edgeEdge":"16","elk.padding":"[top=32,left=32,bottom=32,right=32]"},children:[...r.stores.map(m=>({id:`store:${m}`,layoutOptions:{"elk.padding":"[top=44,left=20,bottom=20,right=20]","elk.spacing.nodeNode":"28"},children:r.tables.filter(g=>g.store===m).map(s)})),...r.tables.filter(m=>!m.store).map(s)],edges:r.relations.map(m=>({id:m.id,sources:[m.from],targets:[m.to]}))}),o=r.tables.map(m=>{const g=i.nodes.get(m.dataTypeId),p=new Set(r.relations.filter(x=>x.via&&(x.from===m.dataTypeId||x.to===m.dataTypeId)).map(x=>x.via));return{...g,dataTypeId:m.dataTypeId,name:m.name,store:m.store,hiddenCount:m.hiddenCount,expanded:m.expanded,rows:m.fields.map((x,y)=>({...x,y:g.y+at.header+y*at.row,foreign:!!x.references||p.has(x.name)&&!x.primaryKey}))}}),a=new Map(o.map(m=>[m.dataTypeId,m])),l=(m,g)=>{const p=m.rows.find(x=>x.name===g)??m.rows.find(x=>x.primaryKey);return p?p.y+at.row/2:void 0},c=(m,g,p)=>{if(p===void 0||m.length<2)return m;const x=m[m.length-1],y=m[m.length-2];if(Math.abs(y.y-x.y)>.5||Math.abs(x.y-p)<.5)return m;const v=Math.abs(x.x-g.x)<2,k=x.x+(v?-18:18);return v&&y.x>k||!v&&y.x<k?m:[...m.slice(0,-1),{x:k,y:x.y},{x:k,y:p},{x:x.x,y:p}]},f=r.relations.map(m=>{var v;let g=((v=i.edges.get(m.id))==null?void 0:v.points)??[];const p=a.get(m.from),x=a.get(m.to),y=p.rows.some(k=>k.name===m.via)&&m.from!==m.to?m.via:void 0;return g=c(g,x,l(x,m.via)),g=c(g.slice().reverse(),p,l(p,y)).reverse(),{...m,points:g}}).filter(m=>m.points.length>=2),u=r.stores.map(m=>({...i.nodes.get(`store:${m}`),entityId:m})),h={};for(const m of o){h[de({kind:"dataType",id:m.dataTypeId})]=m;for(const g of m.rows)h[de({kind:"dataType",id:m.dataTypeId,field:g.name})]={x:m.x,y:g.y,w:m.w,h:at.row}}for(const m of u)h[de({kind:"entity",id:m.entityId})]=m;for(const m of f)h[de({kind:"dataRelation",id:m.id})]=Ni(m.points.map(g=>({...g,w:1,h:1})));return{width:i.width,height:i.height,stores:u,tables:o,relations:f,anchors:h}}function LP(t,e){const n=Math.max(Oe(t,11.5,600),e?Oe(`[${e}]`,10.5,400):0)+16;return{width:Math.ceil(n),height:e?34:22}}async function FP(t,e,n={}){const s=ft(t).stateMachine(e.stateMachine);if(!s)throw new Error(`Unknown state machine "${e.stateMachine}"`);const i={...s,transitions:[...s.transitions,...n.extraTransitions??[]]},o=u=>{if(u.kind==="initial")return{w:22,h:22};const h=u.entryActions.length?`On entry: ${u.entryActions[0]}${u.entryActions.length>1?` +${u.entryActions.length-1}`:""}`:"",m=Math.max(148,Oe(u.name,14,600)+52,h?Oe(h,11,400)+36:0);return{w:Math.ceil(m),h:h?64:48}},a=await jd({id:"root",layoutOptions:{...Sd,"elk.direction":"DOWN","elk.spacing.nodeNode":"56","elk.layered.spacing.nodeNodeBetweenLayers":"44","elk.spacing.edgeNode":"22","elk.spacing.edgeEdge":"18","elk.spacing.edgeLabel":"6","elk.edgeLabels.placement":"CENTER","elk.padding":"[top=40,left=40,bottom=40,right=40]"},children:i.states.map(u=>({id:u.id,width:o(u).w,height:o(u).h,...e.positions[u.id]})),edges:i.transitions.map(u=>({id:u.id,sources:[u.from],targets:[u.to],labels:[{text:u.event,...LP(u.event,u.guard)}]}))}),l=i.states.map(u=>({...a.nodes.get(u.id),id:u.id,kind:u.kind,name:u.name,outcome:u.outcome,entryActions:u.entryActions})),c=i.transitions.map(u=>{const h=a.edges.get(u.id);return{id:u.id,from:u.from,to:u.to,event:u.event,guard:u.guard,points:(h==null?void 0:h.points)??[],label:h==null?void 0:h.labels[0]}}).filter(u=>u.points.length>=2),f={};for(const u of l)f[de({kind:"state",behavior:i.id,id:u.id})]=u;for(const u of c)f[de({kind:"transition",behavior:i.id,id:u.id})]=Ni([...u.points.map(h=>({...h,w:1,h:1})),...u.label?[u.label]:[]]);return f[de({kind:"behavior",id:i.id})]={x:0,y:0,w:a.width,h:a.height},i.subject&&(f[de({kind:"dataType",id:i.subject})]={x:0,y:0,w:a.width,h:a.height}),{machineId:i.id,width:a.width,height:a.height,states:l,transitions:c,anchors:f}}const zl={w:168,h:96},BP=40,VP=52;function WP(t,e){const n=ft(t),r=e.useCases.map(S=>n.useCases.get(S)).filter(jo),s=[];for(const S of r)s.includes(S.area)||s.push(S.area);const i=Math.min(340,Math.max(240,...r.map(S=>Oe(S.name,13.5,600)+56))),o=zl.w+200,a=i+140,l=o+(a-i)/2;let c=76;const f=[],u=[];for(const S of s){const N=c;c+=34;for(const E of r.filter(P=>P.area===S))u.push({id:E.id,name:E.name,x:l,y:c,w:i,h:BP}),c+=VP;c+=6,f.push({label:S,x:o+16,y:N,w:a-32,h:c-N}),c+=14}const h={x:o,y:24,w:a,h:c+4-24,title:t.project.name},m=new Map(u.map(S=>[S.id,S])),g=(S,N)=>{const E=N==="left"?24:o+a+176,P=S.map(I=>{const F=r.filter(M=>(N==="left"?M.actors:M.supporting).includes(I)).map(M=>m.get(M.id)),U=F.reduce((M,$)=>M+$.y+$.h/2,0)/Math.max(1,F.length);return{id:I,cy:U}});P.sort((I,F)=>I.cy-F.cy);let z=0;return P.map(({id:I,cy:F})=>{const U=Math.max(z,F-zl.h/2);return z=U+zl.h+28,{entityId:I,side:N,x:E,y:U,w:zl.w,h:zl.h}})},p=[...new Set(r.flatMap(S=>S.actors))],x=[...new Set(r.flatMap(S=>S.supporting))].filter(S=>!p.includes(S)),y=[...g(p,"left"),...g(x,"right")],v=new Map(y.map(S=>[S.entityId,S])),k=[];for(const S of r){const N=m.get(S.id);for(const E of S.actors){const P=v.get(E);P&&k.push({id:`${E}->${S.id}`,actor:E,useCase:S.id,side:"left",from:{x:P.x+P.w-22,y:P.y+30},to:{x:N.x,y:N.y+N.h/2}})}for(const E of S.supporting){const P=v.get(E);(P==null?void 0:P.side)==="right"&&k.push({id:`${E}->${S.id}`,actor:E,useCase:S.id,side:"right",from:{x:P.x+22,y:P.y+30},to:{x:N.x+N.w,y:N.y+N.h/2}})}}const w=[];for(const S of r)for(const N of S.includes){const E=m.get(S.id),P=m.get(N);!E||!P||w.push({id:`${S.id}=>${N}`,from:S.id,to:N,a:{x:E.x+E.w-24,y:E.y+E.h},b:{x:P.x+P.w-24,y:P.y},bulge:0})}const j=Math.max(...y.map(S=>S.x+S.w),h.x+h.w)+32,C=Math.max(h.y+h.h,...y.map(S=>S.y+S.h))+32,_={};for(const S of u)_[de({kind:"useCase",id:S.id})]=S;for(const S of y)_[de({kind:"entity",id:S.entityId})]=S;return{width:j,height:C,boundary:h,areas:f,useCases:u,actors:y,associations:k,includes:w,anchors:_}}const Wi=132,Mm=168,uu=58,Tm=28,fu=14,UP=9;function ZP(t,e){const n=ft(t),r=new Set(e.entities),s=new Map;e.layers.forEach((I,F)=>I.members.forEach(U=>r.has(U)&&s.set(U,F)));for(const I of e.entities)s.has(I)||s.set(I,e.layers.length-1);const i=(e.relationships??t.model.relationships.filter(I=>r.has(I.source)&&r.has(I.target)).map(I=>I.id)).map(I=>n.relationships.get(I)).filter(I=>!!I&&r.has(I.source)&&r.has(I.target)),o=I=>{var F;return Math.ceil(Math.max(184,Oe(((F=n.entities.get(I))==null?void 0:F.name)??I,13.5,600)+70))},a=e.layers.map((I,F)=>e.entities.filter(U=>s.get(U)===F)),l=new Map;a.forEach(I=>I.forEach((F,U)=>l.set(F,U/Math.max(1,I.length-1))));const f=I=>i.flatMap(F=>F.source===I?[F.target]:F.target===I?[F.source]:[]),u=I=>{for(const F of I){const U=a[F],M=new Map(U.map($=>{const A=f($).filter(B=>s.get(B)!==F);return[$,A.length?A.reduce((B,K)=>B+l.get(K),0)/A.length:l.get($)]}));U.sort(($,A)=>M.get($)-M.get(A)),U.forEach(($,A)=>l.set($,A/Math.max(1,U.length-1)))}},h=a.map((I,F)=>F);u(h.slice(1)),u(h.slice(0,-1).reverse()),u(h.slice(1));const m=a.map(I=>I.reduce((F,U)=>F+o(U),0)+Math.max(0,I.length-1)*Tm),g=Math.max(...m,400),p=[];a.forEach((I,F)=>{let U=Mm+24+(g-m[F])/2;for(const M of I)p.push({entityId:M,band:F,x:U,y:F*Wi+(Wi-uu)/2,w:o(M),h:uu}),U+=o(M)+Tm});const x=new Map(p.map(I=>[I.entityId,I])),y=Mm+24+g+40,v=e.layers.map((I,F)=>({id:I.id,label:I.label,description:I.description,x:0,y:F*Wi,w:y,h:Wi})),k=new Map,w=(I,F)=>`${I}:${F}`,j=i.map(I=>{const F=x.get(I.source),U=x.get(I.target),M=U.band>F.band?"down":U.band<F.band?"up":"across",$=M==="down"?"bottom":"top",A=M==="down"?"top":M==="up"?"bottom":"top";return k.set(w(I.source,$),[...k.get(w(I.source,$))??[],I.id]),k.set(w(I.target,A),[...k.get(w(I.target,A))??[],I.id]),{r:I,a:F,b:U,direction:M,out:$,inn:A}}),C=(I,F,U,M)=>{const $=x.get(I),A=(k.get(w(I,F))??[]).slice(),B=D=>{const L=n.relationships.get(D),W=x.get(L.source===I?L.target:L.source);return W.x+W.w/2};A.sort((D,L)=>B(D)-B(L));const K=A.indexOf(U),Q=Math.min($.w*.6,(A.length-1)*18);return $.x+$.w/2-Q/2+(A.length>1?K/(A.length-1)*Q:0)},_=new Map,S=a.map(I=>{const F=I.map($=>x.get($)).sort(($,A)=>$.x-A.x),U=[];let M=Mm+24-Tm;for(const $ of F)U.push({from:M+fu,to:$.x-fu}),M=$.x+$.w;return U.push({from:M+fu,to:y-fu}),U.filter($=>$.to>=$.from)}),N=(I,F)=>{let U={gap:0,x:F,cost:1/0};S[I].forEach((K,Q)=>{const D=Math.min(K.to,Math.max(K.from,F));Math.abs(D-F)<U.cost&&(U={gap:Q,x:D,cost:Math.abs(D-F)})});const M=`${I}:${U.gap}`,$=_.get(M)??0;_.set(M,$+1);const A=S[I][U.gap],B=U.x+($===0?0:($%2?1:-1)*Math.ceil($/2)*UP);return Math.min(A.to,Math.max(A.from,B))},E=(I,F)=>{const U=Math.max(20,Math.abs(F.y-I.y)*.45)*(F.y>=I.y?1:-1);return[{x:I.x,y:I.y+U},{x:F.x,y:F.y-U},F]},P=j.map(({r:I,a:F,b:U,direction:M,out:$,inn:A})=>{const B={x:C(I.source,$,I.id),y:$==="bottom"?F.y+F.h:F.y},K={x:C(I.target,A,I.id),y:A==="top"?U.y:U.y+U.h};if(M==="across")return{id:I.id,source:I.source,target:I.target,kind:I.kind,d:[B,{x:B.x,y:B.y-46},{x:K.x,y:K.y-46},K],direction:M};const Q=M==="down"?1:-1,D=[];for(let H=F.band+Q;H!==U.band;H+=Q)D.push(H);const L=[B];let W=B;return D.forEach((H,O)=>{const R=(O+1)/(D.length+1),V=N(H,B.x+(K.x-B.x)*R),J=H*Wi+(Wi-uu)/2-6,re=J+uu+12,Te={x:V,y:Q>0?J:re},Le={x:V,y:Q>0?re:J};L.push(...E(W,Te),{x:V,y:Te.y+(Le.y-Te.y)/3},{x:V,y:Te.y+(Le.y-Te.y)*2/3},Le),W=Le}),L.push(...E(W,K)),{id:I.id,source:I.source,target:I.target,kind:I.kind,d:L,direction:M}}),z={};for(const I of p)z[de({kind:"entity",id:I.entityId})]=I;for(const I of v)z[de({kind:"group",view:e.id,id:I.id})]=I;for(const I of P){const F=I.d.map(M=>M.x),U=I.d.map(M=>M.y);z[de({kind:"relationship",id:I.id})]={x:Math.min(...F),y:Math.min(...U),w:Math.max(...F)-Math.min(...F),h:Math.max(...U)-Math.min(...U)}}return{width:y,height:e.layers.length*Wi,bands:v,nodes:p,edges:P,anchors:z}}const qo={head:52,pad:24},ja={h:72,gapX:120,gapY:44,minW:184,maxW:260},Om={size:12,h:22,subH:36};function HP(t){return Math.round(Math.min(ja.maxW,Math.max(ja.minW,Oe(t,15,600)+76)))}function qP(t,e){const n=Math.max(Oe(t,Om.size,500),e?Oe(e,11,400):0)+18;return{w:Math.ceil(n),h:e?Om.subH:Om.h}}async function KP(t,e,n={}){var H;const r=ft(t),s=new Map((n.extraEntities??[]).map(O=>[O.id,O])),i=O=>r.entities.get(O)??s.get(O),o=new Set(e.passThrough),a=[...e.entities.filter(O=>r.entities.has(O)&&!o.has(O)),...[...s.keys()].filter(O=>!e.entities.includes(O))],l=new Set(a),c=e.relationships?new Set(e.relationships):void 0,f=[...t.model.relationships,...n.extraRelationships??[]],u=O=>!c||c.has(O.id)||(n.extraRelationships??[]).includes(O),h=f.filter(O=>u(O)&&l.has(O.source)&&l.has(O.target)).map(O=>({id:O.id,relationships:[O.id],source:O.source,target:O.target,text:O.label}));for(const O of o){const R=f.filter(J=>u(J)&&J.target===O&&l.has(J.source)),V=f.filter(J=>u(J)&&J.source===O&&l.has(J.target));for(const J of R)for(const re of V)h.push({id:J.id,relationships:[J.id,re.id],source:J.source,target:re.target,via:O,text:J.label})}const m=O=>{var V,J;let R=(V=i(O))==null?void 0:V.parent;for(let re=0;R&&!l.has(R)&&re<32;re++)R=(J=i(R))==null?void 0:J.parent;return R&&l.has(R)&&R!==O?R:void 0},g=new Map;for(const O of a){const R=m(O);R&&g.set(R,[...g.get(R)??[],O])}const p=new Set((n.collapsed??e.collapsed).filter(O=>g.has(O))),x=O=>{const R=[];for(let V=m(O);V&&R.length<32&&!R.includes(V);V=m(V))R.push(V);return R},y=O=>[O,...x(O)].filter((R,V)=>V===0||p.has(R)).pop(),v=O=>(g.get(O)??[]).flatMap(R=>[R,...v(R)]),k=a.filter(O=>y(O)===O),w=O=>g.has(O)&&!p.has(O),j=new Map;for(const O of h){const R=y(O.source),V=y(O.target);if(R===V||x(R).includes(V)||x(V).includes(R))continue;const J=`${R}>${V}`,re=j.get(J);re?(re.relationships.push(...O.relationships),re.texts.push(O.text)):j.set(J,{...O,source:R,target:V,relationships:[...O.relationships],texts:[O.text]})}h.length=0;for(const O of j.values()){const R=[...new Set(O.texts)],V=R.join(", "),J=R.length===1?R[0]:V.length<=40?V:`${R[0]} +${R.length-1} more`;h.push({id:O.id,relationships:O.relationships,source:O.source,target:O.target,via:R.length>1?void 0:O.via,text:J})}const C=O=>w(O)?C(g.get(O).find(R=>y(R)===R)??O):O,_=O=>{var J,re;const R=((J=i(O))==null?void 0:J.name)??O;if(!w(O))return{id:O,width:HP(R),height:ja.h,...e.positions[O]};const V=Math.ceil(Oe(R,14,600)+Oe(((re=i(O))==null?void 0:re.technology)??"",12,400)+qo.pad*2+40);return{id:O,layoutOptions:{"elk.padding":`[top=${qo.head},left=${qo.pad},bottom=${qo.pad},right=${qo.pad}]`,"elk.nodeSize.constraints":"MINIMUM_SIZE","elk.nodeSize.minimum":`(${V}, ${ja.h})`},children:g.get(O).filter(Te=>y(Te)===Te).map(_)}},S=e.layout.direction==="down",N=await jd({id:"root",layoutOptions:{...Sd,"elk.direction":S?"DOWN":"RIGHT","elk.spacing.nodeNode":String(S?56:ja.gapY),"elk.layered.spacing.nodeNodeBetweenLayers":String(S?84:ja.gapX),"elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.nodePlacement.bk.fixedAlignment":"BALANCED","elk.padding":"[top=48,left=48,bottom=48,right=48]",...g.size?{"elk.hierarchyHandling":"INCLUDE_CHILDREN"}:{}},children:k.filter(O=>!m(O)).map(_),edges:h.flatMap((O,R)=>{const[V,J]=[C(O.source),C(O.target)];return V===J?[]:[{id:`e${R}`,sources:[V],targets:[J]}]})}),E=O=>{const R=N.nodes.get(O);return{x:R.x,y:R.y,w:R.w,h:R.h}},P=k.filter(O=>!w(O)).map(O=>({...E(O),entityId:O,...p.has(O)?{members:v(O)}:{}})),z=k.filter(w).map(O=>({...E(O),entityId:O,members:v(O),depth:x(O).length})).sort((O,R)=>O.depth-R.depth),I=new Map([...P.map(O=>[O.entityId,O]),...z.map(O=>[O.entityId,O])]),F=O=>{const R=I.get(O.source),V=I.get(O.target),J=Math.max(V.x-(R.x+R.w),R.x-(V.x+V.w)),re=Math.max(V.y-(R.y+R.h),R.y-(V.y+V.h));return J>=re&&J>0?V.x>R.x?{out:"right",in:"left"}:{out:"left",in:"right"}:V.y>R.y?{out:"bottom",in:"top"}:{out:"top",in:"bottom"}},U=new Map,M=h.map((O,R)=>{const V=F(O),J=`${O.source}:${V.out}`,re=`${O.target}:${V.in}`;return U.set(J,[...U.get(J)??[],R]),U.set(re,[...U.get(re)??[],R]),{l:O,s:V,k1:J,k2:re,i:R}}),$=O=>{const R=I.get(O);return{x:R.x+R.w/2,y:R.y+R.h/2}},A=(O,R,V,J)=>{const re=I.get(O),Te=R==="left"||R==="right",Le=At=>$(h[At].source===O?h[At].target:h[At].source),Ke=(U.get(V)??[]).slice().sort((At,Qe)=>Te?Le(At).y-Le(Qe).y:Le(At).x-Le(Qe).x),gt=Ke.indexOf(J),Xt=Math.min((Te?re.h:re.w)*.55,(Ke.length-1)*14),Wt=Ke.length>1?-Xt/2+gt/(Ke.length-1)*Xt:0;return R==="right"?{x:re.x+re.w,y:re.y+re.h/2+Wt}:R==="left"?{x:re.x,y:re.y+re.h/2+Wt}:R==="bottom"?{x:re.x+re.w/2+Wt,y:re.y+re.h}:{x:re.x+re.w/2+Wt,y:re.y}},B=[...P.map(O=>({x:O.x-6,y:O.y-6,w:O.w+12,h:O.h+12})),...z.map(O=>({x:O.x,y:O.y,w:O.w,h:qo.head-8}))],K={right:[1,0],left:[-1,0],bottom:[0,1],top:[0,-1]},Q=({l:O,s:R,k1:V,k2:J,i:re})=>{const Te=A(O.source,R.out,V,re),Le=A(O.target,R.in,J,re),gt=R.out==="left"||R.out==="right"?Math.max(48,Math.abs(Le.x-Te.x)*.45):Math.max(36,Math.abs(Le.y-Te.y)*.45),[Xt,Wt]=K[R.out],[At,Qe]=K[R.in];return[Te,{x:Te.x+Xt*gt,y:Te.y+Wt*gt},{x:Le.x+At*gt,y:Le.y+Qe*gt},Le]},D=M.map(Q),L=M.map(({l:O,i:R})=>{var At;const V=D[R],J=O.via?`through ${((At=i(O.via))==null?void 0:At.name)??O.via}`:void 0,re=qP(O.text,J),Te=D.filter((Qe,Dn)=>Dn!==R),Le=Qe=>{let Dn=0;for(const Ut of B)Dn+=8*Math.max(0,Math.min(Qe.x+Qe.w,Ut.x+Ut.w)-Math.max(Qe.x,Ut.x))*Math.max(0,Math.min(Qe.y+Qe.h,Ut.y+Ut.h)-Math.max(Qe.y,Ut.y));for(const Ut of Te)for(let le=1;le<24;le++){const it=mc(Ut,le/24);it.x>Qe.x&&it.x<Qe.x+Qe.w&&it.y>Qe.y&&it.y<Qe.y+Qe.h&&(Dn+=600)}return Dn};let Ke,gt,Xt=1/0;const Wt=[.5,.44,.56,.38,.62,.32,.68,.26,.74];for(const Qe of[0,1,-1,2,-2,3,-3,4,-4]){for(const Dn of Wt){const Ut=mc(V,Dn),le=JP(V,Dn),it=Math.hypot(le.x,le.y)||1,Zt=Qe*(Math.abs(le.x/it)>.7?re.h/2+12:re.w/2+12),hr={x:-le.y/it,y:le.x/it},L0={x:Ut.x+hr.x*Zt-re.w/2,y:Ut.y+hr.y*Zt-re.h/2,w:re.w,h:re.h},F0=Le(L0)+Math.abs(Dn-.5)*40+Math.abs(Qe)*250;F0<Xt&&(Xt=F0,Ke=L0,gt=Qe?Ut:void 0)}if(Xt<=10)break}return Ke??(Ke={x:0,y:0,...re}),B.push(Ke),{id:O.id,relationships:O.relationships,source:O.source,target:O.target,via:O.via,curve:V,label:{...Ke,text:O.text,sub:J},leader:gt}}),W={};for(const O of P)W[de({kind:"entity",id:O.entityId})]=O;for(const O of z)W[de({kind:"entity",id:O.entityId})]=O;for(const O of a)y(O)!==O&&(W[de({kind:"entity",id:O})]=I.get(y(O)));for(const O of L){const R=O.curve.map(Le=>Le.x),V=O.curve.map(Le=>Le.y),J=[...R,O.label.x,O.label.x+O.label.w],re=[...V,O.label.y,O.label.y+O.label.h],Te={x:Math.min(...J),y:Math.min(...re),w:Math.max(...J)-Math.min(...J),h:Math.max(...re)-Math.min(...re)};for(const Le of O.relationships)W[H=de({kind:"relationship",id:Le})]??(W[H]=Te)}return{width:N.width,height:N.height,nodes:P,groups:z,edges:L,anchors:W}}function mc([t,e,n,r],s){const i=1-s;return{x:i*i*i*t.x+3*i*i*s*e.x+3*i*s*s*n.x+s*s*s*r.x,y:i*i*i*t.y+3*i*i*s*e.y+3*i*s*s*n.y+s*s*s*r.y}}function JP([t,e,n,r],s){const i=1-s;return{x:3*i*i*(e.x-t.x)+6*i*s*(n.x-e.x)+3*s*s*(r.x-n.x),y:3*i*i*(e.y-t.y)+6*i*s*(n.y-e.y)+3*s*s*(r.y-n.y)}}const F_=new Map;function GP(t,e){F_.set(t,e)}async function B_(t,e,n={}){switch(e.type){case"architecture":return TP(t,e,n);case"map":return KP(t,e,n);case"sequence":return OP(t,e,n);case"dataflow":return AP(t,e,n);case"activity":return PP(t,e);case"erd":return zP(t,e,n);case"state":return FP(t,e,n);case"usecase":return WP(t,e);case"dependency":return ZP(t,e);case"extension":{const r=F_.get(e.extension);if(!r)throw new Error(`No layout registered for "${e.extension}"`);return r(t,e,n)}}}const V_=b.createContext({marks:new Map,mode:"after",focus:null,callouts:new Map,hot:null,setHot:()=>{}}),o1=({value:t,children:e})=>d.jsx(V_.Provider,{value:t,children:e}),dr=()=>b.useContext(V_);function Ps(t){return W_(dr(),t)}function wl(t){var r,s;const e=dr(),n=t.map(i=>W_(e,i));return{state:(r=n.find(i=>i.state))==null?void 0:r.state,hidden:n.every(i=>i.hidden),dim:n.every(i=>i.dim),hot:n.some(i=>i.hot),focused:n.some(i=>i.focused),callout:(s=n.find(i=>i.callout))==null?void 0:s.callout}}function W_(t,e){const n=t.marks.get(e),r=t.mode==="before"&&n==="new"||t.mode==="after"&&n==="removed",s=!t.focus||t.focus.has(e);return{state:t.mode==="change"?n:void 0,hidden:r,dim:!s&&t.hot!==e,hot:t.hot===e,focused:s,callout:t.callouts.get(e)}}const Mr=t=>`poney-story-el ${t.hidden?"poney-story-hidden":t.dim?"poney-story-dim":""}`,bl=(t,e="var(--poney-story-rule)")=>t?`var(--poney-${t})`:e,a1=(t,e="var(--poney-story-node)")=>t?`var(--poney-${t}-wash)`:e,l1={new:"New",changed:"Changed",removed:"Removed"};function Nd({state:t,x:e,y:n,anchor:r="start"}){if(!t)return null;const s=l1[t],i=Oe(s,11,650)+14,o=r==="start"?e:r==="end"?e-i:e-i/2;return d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{x:o,y:n-9,width:i,height:18,rx:9,fill:`var(--poney-${t}-wash)`,stroke:`var(--poney-${t})`,strokeWidth:1}),d.jsx("text",{x:o+i/2,y:n+4,textAnchor:"middle",fontSize:11,fontWeight:650,fill:`var(--poney-${t})`,children:s})]})}function Sl({n:t,x:e,y:n,hot:r}){return d.jsxs("g",{pointerEvents:"none",className:"poney-story-el",children:[d.jsx("circle",{cx:e,cy:n,r:12,fill:r?"var(--poney-accent)":"var(--poney-ink)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5}),d.jsx("text",{x:e,y:n+4.2,textAnchor:"middle",fontSize:12,fontWeight:700,fill:"var(--poney-paper-raised)",className:"poney-numbers",children:t})]})}function Hf({x:t,y:e,angle:n,color:r,size:s=7}){const i=Math.cos(n),o=Math.sin(n),a=(l,c)=>`${t+l*i-c*o},${e+l*o+c*i}`;return d.jsx("polygon",{points:`${a(0,0)} ${a(-s*1.35,-s*.62)} ${a(-s*1.35,s*.62)}`,fill:r})}const jl=b.createContext(null),YP=({value:t,children:e})=>d.jsx(jl.Provider,{value:t,children:e});function fn(){const t=b.useContext(jl);if(!t)throw new Error("Poney renderers need a RenderProvider (from @hattoriai/poney-react) with the model index");return t.idx}const QP=(t,e)=>({"data-ref":de(t),"aria-label":e});function Sn(){var t;return((t=b.useContext(jl))==null?void 0:t.bind)??QP}function Ds(){const t=b.useContext(jl),e=(t==null?void 0:t.selection)??null,n=(t==null?void 0:t.hover)??null;return{subject:n??e,selection:e,hover:n}}function bp(t){var a;const e=b.useContext(jl),[n,r]=b.useState({}),s=!!(e!=null&&e.setViewState),i=(s?(a=e.viewState)==null?void 0:a.call(e,t):n)??{},o=b.useCallback(l=>s?e.setViewState(t,l):r(c=>({...c,...l})),[s,e,t]);return[i,o]}const U_=b.createContext(1),XP=({value:t,children:e})=>d.jsx(U_.Provider,{value:t,children:e}),c1=()=>b.useContext(U_),eD=()=>{var t;return!!((t=b.useContext(jl))!=null&&t.still)};function tD(t,e,n){const r={};if(e&&t.type==="state"&&(r.extraTransitions=e.removed.transitions.filter(s=>s.stateMachine===t.stateMachine).map(s=>s.transition)),e&&t.type==="map"&&(r.extraEntities=e.removed.entities,r.extraRelationships=e.removed.relationships),t.type==="sequence"){r.compact=!0;const s=n.map(an).flatMap(i=>(i==null?void 0:i.kind)==="message"&&i.behavior===t.interaction?[i.id]:[]);s.length&&(r.only=s)}return r}const Ly=t=>t.map(an).flatMap(e=>e?[de(e)]:[]);function d1(t,e,n){var s,i;const r=new Set(Ly(t));for(const o of[...r]){const a=an(o);if(a){if(a.kind==="relationship"){const l=(e==null?void 0:e.relationships.get(a.id))??(n==null?void 0:n.removed.relationships.find(c=>c.id===a.id));if(l)for(const c of[l.source,l.target])r.add(`entity:${c}`)}if(a.kind==="transition"){const l=((s=e==null?void 0:e.stateMachine(a.behavior))==null?void 0:s.transitions.find(c=>c.id===a.id))??((i=n==null?void 0:n.removed.transitions.find(c=>c.stateMachine===a.behavior&&c.transition.id===a.id))==null?void 0:i.transition);if(l)for(const c of[l.from,l.to])r.add(`state:${a.behavior}:${c}`)}}}return[...r]}const nD=/^(entity|state|dataType|activityNode|useCase):/;function rD(t,e,n,r,s){const i=d1(n,r,s).map(l=>t.anchors[l]).filter(l=>!!l);if(!i.length||e.type==="sequence")return{x:0,y:0,w:t.width,h:t.height};let o=Ni(i);const a=24;for(let l=0;l<3;l++){const c={x:o.x-a,y:o.y-a,w:o.w+a*2,h:o.h+a*2},f=Object.entries(t.anchors).filter(([u])=>nD.test(u)).map(([,u])=>u).filter(u=>u.x<c.x+c.w&&u.x+u.w>c.x&&u.y<c.y+c.h&&u.y+u.h>c.y).filter(u=>u.x<c.x||u.y<c.y||u.x+u.w>c.x+c.w||u.y+u.h>c.y+c.h);if(!f.length)break;o=Ni([o,...f])}return o}function sD(t,e,n,r,s){const i={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2};let o=Math.max(i.w,e/s),a=Math.max(i.h,n/s);const l=e/Math.max(n,1);return o/a<l?o=a*l:a=o/l,{x:i.x+i.w/2-o/2,y:i.y+i.h/2-a/2,w:o,h:a}}function iD(t){var r,s;const e=d1(t.focus,t.idx,t.walkthrough),n=(i=[])=>{const o=new Map;for(const a of i){const l=an(a.target);l&&o.set(de(l),[...o.get(de(l))??[],a])}return o};return{marks:t.marks,mode:t.mode,focus:e.length&&t.view.type!=="sequence"?new Set(e):null,callouts:new Map(Ly(t.callouts).map((i,o)=>[i,o+1])),hot:t.hot??null,setHot:t.setHot??(()=>{}),allLabels:((r=t.walkthrough)==null?void 0:r.kind)==="tour"&&e.length===0,effects:n(t.effects),badges:n(t.badges),trace:(s=t.trace)!=null&&s.length?{steps:Ly(t.trace.map(i=>i.ref)),current:t.traceStep??null,animate:t.animate!==!1,numbered:!!t.numberSteps}:void 0}}/**
45
- * @license lucide-react v1.75.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */const oD=t=>t==null?void 0:t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
50
- * @license lucide-react v1.75.0 - ISC
51
- *
52
- * This source code is licensed under the ISC license.
53
- * See the LICENSE file in the root directory of this source tree.
54
- */function aD(t,e,n=[]){if(e==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:oD(t),size:24,node:e,...n.length>0?{aliases:n}:{}}}/**
55
- * @license lucide-react v1.75.0 - ISC
56
- *
57
- * This source code is licensed under the ISC license.
58
- * See the LICENSE file in the root directory of this source tree.
59
- */const lD=t=>{let e="",n=!1;for(const r of t){if(r==="-"||r==="_"||r<=" "){n=e.length>0;continue}e.length===0?e+=r.toLowerCase():e+=n?r.toUpperCase():r,n=!1}return e};/**
60
- * @license lucide-react v1.75.0 - ISC
61
- *
62
- * This source code is licensed under the ISC license.
63
- * See the LICENSE file in the root directory of this source tree.
64
- */const cD=t=>{const e=lD(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
65
- * @license lucide-react v1.75.0 - ISC
66
- *
67
- * This source code is licensed under the ISC license.
68
- * See the LICENSE file in the root directory of this source tree.
69
- */const Fy=(...t)=>{const e=new Set;for(const n of t)if(typeof n=="string")for(const r of n.split(/\s+/))r&&e.add(r);return[...e].join(" ")};/**
70
- * @license lucide-react v1.75.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- */const Ui={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
75
- * @license lucide-react v1.75.0 - ISC
76
- *
77
- * This source code is licensed under the ISC license.
78
- * See the LICENSE file in the root directory of this source tree.
79
- */function Am(t){return t!=null}function dD(t,e={}){var h,m;const n=e.attributeNames??{},r=g=>n[g]??g,s=t.size??t.width??Ui.width,i=t.size??t.height??Ui.height,o=((h=t.aliases)==null?void 0:h.filter(g=>typeof g=="string"&&g.trim()!=="").map(g=>`lucide-${g}`))??[],a=[...t.name?[`lucide-${t.name}`]:[],...o],l=((m=e.className)==null?void 0:m.split(" ").filter(Boolean))??[],c=e.includeDefaultClasses===!1?Fy(...l):Fy("lucide",...a,...l),f=e.absoluteStrokeWidth?Number(e.strokeWidth??Ui["stroke-width"])*Number(t.size??t.width??Ui.width)/Number(e.size??e.width??Ui.width):e.strokeWidth??Ui["stroke-width"];return["svg",{...Object.entries(Ui).reduce((g,[p,x])=>(g[r(p)]=x,g),{}),..."color"in e&&e.color&&{[r("stroke")]:e.color},..."size"in e&&Am(e.size)&&{[r("width")]:e.size,[r("height")]:e.size},..."width"in e&&Am(e.width)&&{[r("width")]:e.width},..."height"in e&&Am(e.height)&&{[r("height")]:e.height},[r("stroke-width")]:f,...c&&{[r("class")]:c},[r("viewBox")]:`0 0 ${s} ${i}`,...e.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in e&&e.attributes},t.node.map(g=>{const[p,x,y]=g,v=e.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...x}:x;return y?[p,v,y]:[p,v]})]}/**
80
- * @license lucide-react v1.75.0 - ISC
81
- *
82
- * This source code is licensed under the ISC license.
83
- * See the LICENSE file in the root directory of this source tree.
84
- */function uD(t,e={}){return dD(t,{...e,attributeNames:{...e.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}/**
85
- * @license lucide-react v1.75.0 - ISC
86
- *
87
- * This source code is licensed under the ISC license.
88
- * See the LICENSE file in the root directory of this source tree.
89
- */const fD=t=>{if(t==null||typeof t!="object")return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(e.startsWith("aria-")||e==="role"||e==="title")&&t[e]!=null)return!0;return!1},hD=b.createContext({}),pD=()=>b.useContext(hD),mD=b.forwardRef(({color:t,size:e,width:n,height:r,strokeWidth:s,absoluteStrokeWidth:i,nonScalingStroke:o,className:a="",children:l,iconNode:c=[],icon:f={node:c,aliases:[],size:24},...u},h)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:p=!1,nonScalingStroke:x=!1,color:y="currentColor",className:v=""}=pD()??{},k=!!l||fD(u),[w,j,C=[]]=uD(f,{color:t??y,width:n??e??m,height:r??e??m,strokeWidth:s??g,absoluteStrokeWidth:i??p,nonScalingStroke:o??x,className:Fy(v,a),hasA11yProp:k,attributes:u});return b.createElement(w,{ref:h,...j},[...C.map(([_,S])=>b.createElement(_,S)),...Array.isArray(l)?l:[l]])});/**
90
- * @license lucide-react v1.75.0 - ISC
91
- *
92
- * This source code is licensed under the ISC license.
93
- * See the LICENSE file in the root directory of this source tree.
94
- */function q(t,e=[],n=[]){const r=typeof t=="string"?aD(t,e,n):t,s=b.forwardRef(({className:i,...o},a)=>b.createElement(mD,{ref:a,icon:r,className:i,...o}));return r.name&&(s.displayName=cD(r.name)),s}/**
95
- * @license lucide-react v1.75.0 - ISC
96
- *
97
- * This source code is licensed under the ISC license.
98
- * See the LICENSE file in the root directory of this source tree.
99
- */const Z_={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};Z_.node;const gD=q(Z_);/**
100
- * @license lucide-react v1.75.0 - ISC
101
- *
102
- * This source code is licensed under the ISC license.
103
- * See the LICENSE file in the root directory of this source tree.
104
- */const H_={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};H_.node;const yD=q(H_);/**
105
- * @license lucide-react v1.75.0 - ISC
106
- *
107
- * This source code is licensed under the ISC license.
108
- * See the LICENSE file in the root directory of this source tree.
109
- */const q_={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};q_.node;const K_=q(q_);/**
110
- * @license lucide-react v1.75.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- */const J_={name:"arrow-right-left",size:24,node:[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]};J_.node;const xD=q(J_);/**
115
- * @license lucide-react v1.75.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */const G_={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};G_.node;const Gr=q(G_);/**
120
- * @license lucide-react v1.75.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */const Y_={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};Y_.node;const qf=q(Y_);/**
125
- * @license lucide-react v1.75.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */const Q_={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Q_.node;const X_=q(Q_);/**
130
- * @license lucide-react v1.75.0 - ISC
131
- *
132
- * This source code is licensed under the ISC license.
133
- * See the LICENSE file in the root directory of this source tree.
134
- */const eN={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};eN.node;const vD=q(eN);/**
135
- * @license lucide-react v1.75.0 - ISC
136
- *
137
- * This source code is licensed under the ISC license.
138
- * See the LICENSE file in the root directory of this source tree.
139
- */const tN={name:"book-open-text",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M16 13h2",key:"weia3s"}],["path",{d:"M16 9h2",key:"1n7gjm"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}],["path",{d:"M6 13h2",key:"1cckiz"}],["path",{d:"M6 9h2",key:"1k7j9f"}]]};tN.node;const Sp=q(tN);/**
140
- * @license lucide-react v1.75.0 - ISC
141
- *
142
- * This source code is licensed under the ISC license.
143
- * See the LICENSE file in the root directory of this source tree.
144
- */const nN={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};nN.node;const rN=q(nN);/**
145
- * @license lucide-react v1.75.0 - ISC
146
- *
147
- * This source code is licensed under the ISC license.
148
- * See the LICENSE file in the root directory of this source tree.
149
- */const sN={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};sN.node;const iN=q(sN);/**
150
- * @license lucide-react v1.75.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */const oN={name:"boxes",size:24,node:[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]};oN.node;const kD=q(oN);/**
155
- * @license lucide-react v1.75.0 - ISC
156
- *
157
- * This source code is licensed under the ISC license.
158
- * See the LICENSE file in the root directory of this source tree.
159
- */const aN={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};aN.node;const bs=q(aN);/**
160
- * @license lucide-react v1.75.0 - ISC
161
- *
162
- * This source code is licensed under the ISC license.
163
- * See the LICENSE file in the root directory of this source tree.
164
- */const lN={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};lN.node;const cN=q(lN);/**
165
- * @license lucide-react v1.75.0 - ISC
166
- *
167
- * This source code is licensed under the ISC license.
168
- * See the LICENSE file in the root directory of this source tree.
169
- */const dN={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};dN.node;const uN=q(dN);/**
170
- * @license lucide-react v1.75.0 - ISC
171
- *
172
- * This source code is licensed under the ISC license.
173
- * See the LICENSE file in the root directory of this source tree.
174
- */const fN={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};fN.node;const Ed=q(fN);/**
175
- * @license lucide-react v1.75.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */const hN={name:"chevrons-down-up",size:24,node:[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]};hN.node;const u1=q(hN);/**
180
- * @license lucide-react v1.75.0 - ISC
181
- *
182
- * This source code is licensed under the ISC license.
183
- * See the LICENSE file in the root directory of this source tree.
184
- */const pN={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]};pN.node;const f1=q(pN);/**
185
- * @license lucide-react v1.75.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */const mN={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};mN.node;const gN=q(mN);/**
190
- * @license lucide-react v1.75.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */const yN={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};yN.node;const wD=q(yN);/**
195
- * @license lucide-react v1.75.0 - ISC
196
- *
197
- * This source code is licensed under the ISC license.
198
- * See the LICENSE file in the root directory of this source tree.
199
- */const xN={name:"circle-exclamation-point",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle","circle-alert"]};xN.node;const $d=q(xN);/**
200
- * @license lucide-react v1.75.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */const vN={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};vN.node;const bD=q(vN);/**
205
- * @license lucide-react v1.75.0 - ISC
206
- *
207
- * This source code is licensed under the ISC license.
208
- * See the LICENSE file in the root directory of this source tree.
209
- */const kN={name:"clipboard-copy",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]};kN.node;const wN=q(kN);/**
210
- * @license lucide-react v1.75.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */const bN={name:"clipboard-list",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};bN.node;const SD=q(bN);/**
215
- * @license lucide-react v1.75.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */const SN={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]};SN.node;const jN=q(SN);/**
220
- * @license lucide-react v1.75.0 - ISC
221
- *
222
- * This source code is licensed under the ISC license.
223
- * See the LICENSE file in the root directory of this source tree.
224
- */const CN={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};CN.node;const jD=q(CN);/**
225
- * @license lucide-react v1.75.0 - ISC
226
- *
227
- * This source code is licensed under the ISC license.
228
- * See the LICENSE file in the root directory of this source tree.
229
- */const _N={name:"compass",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]};_N.node;const h1=q(_N);/**
230
- * @license lucide-react v1.75.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */const NN={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};NN.node;const ta=q(NN);/**
235
- * @license lucide-react v1.75.0 - ISC
236
- *
237
- * This source code is licensed under the ISC license.
238
- * See the LICENSE file in the root directory of this source tree.
239
- */const EN={name:"credit-card",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}],["path",{d:"M6 14h2",key:"mk7k0u"}]]};EN.node;const CD=q(EN);/**
240
- * @license lucide-react v1.75.0 - ISC
241
- *
242
- * This source code is licensed under the ISC license.
243
- * See the LICENSE file in the root directory of this source tree.
244
- */const $N={name:"crosshair",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]};$N.node;const MN=q($N);/**
245
- * @license lucide-react v1.75.0 - ISC
246
- *
247
- * This source code is licensed under the ISC license.
248
- * See the LICENSE file in the root directory of this source tree.
249
- */const TN={name:"database-zap",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]};TN.node;const _D=q(TN);/**
250
- * @license lucide-react v1.75.0 - ISC
251
- *
252
- * This source code is licensed under the ISC license.
253
- * See the LICENSE file in the root directory of this source tree.
254
- */const ON={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};ON.node;const AN=q(ON);/**
255
- * @license lucide-react v1.75.0 - ISC
256
- *
257
- * This source code is licensed under the ISC license.
258
- * See the LICENSE file in the root directory of this source tree.
259
- */const RN={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};RN.node;const ND=q(RN);/**
260
- * @license lucide-react v1.75.0 - ISC
261
- *
262
- * This source code is licensed under the ISC license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */const IN={name:"file-code-corner",size:24,node:[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],aliases:["file-code-2"]};IN.node;const jp=q(IN);/**
265
- * @license lucide-react v1.75.0 - ISC
266
- *
267
- * This source code is licensed under the ISC license.
268
- * See the LICENSE file in the root directory of this source tree.
269
- */const PN={name:"file-input",size:24,node:[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1",key:"1q9hii"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]};PN.node;const p1=q(PN);/**
270
- * @license lucide-react v1.75.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */const DN={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};DN.node;const Kf=q(DN);/**
275
- * @license lucide-react v1.75.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */const zN={name:"file-up",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]};zN.node;const Cw=q(zN);/**
280
- * @license lucide-react v1.75.0 - ISC
281
- *
282
- * This source code is licensed under the ISC license.
283
- * See the LICENSE file in the root directory of this source tree.
284
- */const LN={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};LN.node;const m1=q(LN);/**
285
- * @license lucide-react v1.75.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */const FN={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};FN.node;const BN=q(FN);/**
290
- * @license lucide-react v1.75.0 - ISC
291
- *
292
- * This source code is licensed under the ISC license.
293
- * See the LICENSE file in the root directory of this source tree.
294
- */const VN={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};VN.node;const WN=q(VN);/**
295
- * @license lucide-react v1.75.0 - ISC
296
- *
297
- * This source code is licensed under the ISC license.
298
- * See the LICENSE file in the root directory of this source tree.
299
- */const UN={name:"git-merge",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]};UN.node;const ED=q(UN);/**
300
- * @license lucide-react v1.75.0 - ISC
301
- *
302
- * This source code is licensed under the ISC license.
303
- * See the LICENSE file in the root directory of this source tree.
304
- */const ZN={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};ZN.node;const $D=q(ZN);/**
305
- * @license lucide-react v1.75.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */const HN={name:"hash",size:24,node:[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]};HN.node;const MD=q(HN);/**
310
- * @license lucide-react v1.75.0 - ISC
311
- *
312
- * This source code is licensed under the ISC license.
313
- * See the LICENSE file in the root directory of this source tree.
314
- */const qN={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};qN.node;const TD=q(qN);/**
315
- * @license lucide-react v1.75.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */const KN={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};KN.node;const OD=q(KN);/**
320
- * @license lucide-react v1.75.0 - ISC
321
- *
322
- * This source code is licensed under the ISC license.
323
- * See the LICENSE file in the root directory of this source tree.
324
- */const JN={name:"italic",size:24,node:[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]};JN.node;const AD=q(JN);/**
325
- * @license lucide-react v1.75.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */const GN={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};GN.node;const g1=q(GN);/**
330
- * @license lucide-react v1.75.0 - ISC
331
- *
332
- * This source code is licensed under the ISC license.
333
- * See the LICENSE file in the root directory of this source tree.
334
- */const YN={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]};YN.node;const RD=q(YN);/**
335
- * @license lucide-react v1.75.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */const QN={name:"keyboard",size:24,node:[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]};QN.node;const XN=q(QN);/**
340
- * @license lucide-react v1.75.0 - ISC
341
- *
342
- * This source code is licensed under the ISC license.
343
- * See the LICENSE file in the root directory of this source tree.
344
- */const eE={name:"landmark",size:24,node:[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]]};eE.node;const ID=q(eE);/**
345
- * @license lucide-react v1.75.0 - ISC
346
- *
347
- * This source code is licensed under the ISC license.
348
- * See the LICENSE file in the root directory of this source tree.
349
- */const tE={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};tE.node;const Co=q(tE);/**
350
- * @license lucide-react v1.75.0 - ISC
351
- *
352
- * This source code is licensed under the ISC license.
353
- * See the LICENSE file in the root directory of this source tree.
354
- */const nE={name:"letter-b",size:24,node:[["path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8",key:"n8tvfh"}]],aliases:["bold"]};nE.node;const PD=q(nE);/**
355
- * @license lucide-react v1.75.0 - ISC
356
- *
357
- * This source code is licensed under the ISC license.
358
- * See the LICENSE file in the root directory of this source tree.
359
- */const rE={name:"library",size:24,node:[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]};rE.node;const DD=q(rE);/**
360
- * @license lucide-react v1.75.0 - ISC
361
- *
362
- * This source code is licensed under the ISC license.
363
- * See the LICENSE file in the root directory of this source tree.
364
- */const sE={name:"lightbulb",size:24,node:[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]};sE.node;const Rm=q(sE);/**
365
- * @license lucide-react v1.75.0 - ISC
366
- *
367
- * This source code is licensed under the ISC license.
368
- * See the LICENSE file in the root directory of this source tree.
369
- */const iE={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};iE.node;const co=q(iE);/**
370
- * @license lucide-react v1.75.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */const oE={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};oE.node;const zD=q(oE);/**
375
- * @license lucide-react v1.75.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */const aE={name:"list-ordered",size:24,node:[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]};aE.node;const LD=q(aE);/**
380
- * @license lucide-react v1.75.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */const lE={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};lE.node;const _o=q(lE);/**
385
- * @license lucide-react v1.75.0 - ISC
386
- *
387
- * This source code is licensed under the ISC license.
388
- * See the LICENSE file in the root directory of this source tree.
389
- */const cE={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};cE.node;const FD=q(cE);/**
390
- * @license lucide-react v1.75.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */const dE={name:"map",size:24,node:[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]};dE.node;const BD=q(dE);/**
395
- * @license lucide-react v1.75.0 - ISC
396
- *
397
- * This source code is licensed under the ISC license.
398
- * See the LICENSE file in the root directory of this source tree.
399
- */const uE={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};uE.node;const VD=q(uE);/**
400
- * @license lucide-react v1.75.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */const fE={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};fE.node;const hE=q(fE);/**
405
- * @license lucide-react v1.75.0 - ISC
406
- *
407
- * This source code is licensed under the ISC license.
408
- * See the LICENSE file in the root directory of this source tree.
409
- */const pE={name:"message-circle-plus",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]};pE.node;const WD=q(pE);/**
410
- * @license lucide-react v1.75.0 - ISC
411
- *
412
- * This source code is licensed under the ISC license.
413
- * See the LICENSE file in the root directory of this source tree.
414
- */const mE={name:"message-circle-question-mark",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5",key:"1awbb0"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["message-circle-question"]};mE.node;const gE=q(mE);/**
415
- * @license lucide-react v1.75.0 - ISC
416
- *
417
- * This source code is licensed under the ISC license.
418
- * See the LICENSE file in the root directory of this source tree.
419
- */const yE={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};yE.node;const eo=q(yE);/**
420
- * @license lucide-react v1.75.0 - ISC
421
- *
422
- * This source code is licensed under the ISC license.
423
- * See the LICENSE file in the root directory of this source tree.
424
- */const xE={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};xE.node;const UD=q(xE);/**
425
- * @license lucide-react v1.75.0 - ISC
426
- *
427
- * This source code is licensed under the ISC license.
428
- * See the LICENSE file in the root directory of this source tree.
429
- */const vE={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};vE.node;const kE=q(vE);/**
430
- * @license lucide-react v1.75.0 - ISC
431
- *
432
- * This source code is licensed under the ISC license.
433
- * See the LICENSE file in the root directory of this source tree.
434
- */const wE={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};wE.node;const y1=q(wE);/**
435
- * @license lucide-react v1.75.0 - ISC
436
- *
437
- * This source code is licensed under the ISC license.
438
- * See the LICENSE file in the root directory of this source tree.
439
- */const bE={name:"network",size:24,node:[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]};bE.node;const ZD=q(bE);/**
440
- * @license lucide-react v1.75.0 - ISC
441
- *
442
- * This source code is licensed under the ISC license.
443
- * See the LICENSE file in the root directory of this source tree.
444
- */const SE={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};SE.node;const HD=q(SE);/**
445
- * @license lucide-react v1.75.0 - ISC
446
- *
447
- * This source code is licensed under the ISC license.
448
- * See the LICENSE file in the root directory of this source tree.
449
- */const jE={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};jE.node;const CE=q(jE);/**
450
- * @license lucide-react v1.75.0 - ISC
451
- *
452
- * This source code is licensed under the ISC license.
453
- * See the LICENSE file in the root directory of this source tree.
454
- */const _E={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};_E.node;const qD=q(_E);/**
455
- * @license lucide-react v1.75.0 - ISC
456
- *
457
- * This source code is licensed under the ISC license.
458
- * See the LICENSE file in the root directory of this source tree.
459
- */const NE={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};NE.node;const KD=q(NE);/**
460
- * @license lucide-react v1.75.0 - ISC
461
- *
462
- * This source code is licensed under the ISC license.
463
- * See the LICENSE file in the root directory of this source tree.
464
- */const EE={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};EE.node;const JD=q(EE);/**
465
- * @license lucide-react v1.75.0 - ISC
466
- *
467
- * This source code is licensed under the ISC license.
468
- * See the LICENSE file in the root directory of this source tree.
469
- */const $E={name:"phone-call",size:24,node:[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]};$E.node;const GD=q($E);/**
470
- * @license lucide-react v1.75.0 - ISC
471
- *
472
- * This source code is licensed under the ISC license.
473
- * See the LICENSE file in the root directory of this source tree.
474
- */const ME={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};ME.node;const YD=q(ME);/**
475
- * @license lucide-react v1.75.0 - ISC
476
- *
477
- * This source code is licensed under the ISC license.
478
- * See the LICENSE file in the root directory of this source tree.
479
- */const TE={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};TE.node;const Md=q(TE);/**
480
- * @license lucide-react v1.75.0 - ISC
481
- *
482
- * This source code is licensed under the ISC license.
483
- * See the LICENSE file in the root directory of this source tree.
484
- */const OE={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};OE.node;const x1=q(OE);/**
485
- * @license lucide-react v1.75.0 - ISC
486
- *
487
- * This source code is licensed under the ISC license.
488
- * See the LICENSE file in the root directory of this source tree.
489
- */const AE={name:"puzzle",size:24,node:[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]};AE.node;const RE=q(AE);/**
490
- * @license lucide-react v1.75.0 - ISC
491
- *
492
- * This source code is licensed under the ISC license.
493
- * See the LICENSE file in the root directory of this source tree.
494
- */const IE={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};IE.node;const QD=q(IE);/**
495
- * @license lucide-react v1.75.0 - ISC
496
- *
497
- * This source code is licensed under the ISC license.
498
- * See the LICENSE file in the root directory of this source tree.
499
- */const PE={name:"receipt",size:24,node:[["path",{d:"M12 17V7",key:"pyj7ub"}],["path",{d:"M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8",key:"1elt7d"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]]};PE.node;const XD=q(PE);/**
500
- * @license lucide-react v1.75.0 - ISC
501
- *
502
- * This source code is licensed under the ISC license.
503
- * See the LICENSE file in the root directory of this source tree.
504
- */const DE={name:"redo-2",size:24,node:[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]};DE.node;const ez=q(DE);/**
505
- * @license lucide-react v1.75.0 - ISC
506
- *
507
- * This source code is licensed under the ISC license.
508
- * See the LICENSE file in the root directory of this source tree.
509
- */const zE={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};zE.node;const tz=q(zE);/**
510
- * @license lucide-react v1.75.0 - ISC
511
- *
512
- * This source code is licensed under the ISC license.
513
- * See the LICENSE file in the root directory of this source tree.
514
- */const LE={name:"route",size:24,node:[["path",{d:"M9 5h8.5a1 1 0 010 7h-11a1 1 0 000 7H15",key:"1r1aam"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]};LE.node;const nz=q(LE);/**
515
- * @license lucide-react v1.75.0 - ISC
516
- *
517
- * This source code is licensed under the ISC license.
518
- * See the LICENSE file in the root directory of this source tree.
519
- */const FE={name:"scan",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]};FE.node;const BE=q(FE);/**
520
- * @license lucide-react v1.75.0 - ISC
521
- *
522
- * This source code is licensed under the ISC license.
523
- * See the LICENSE file in the root directory of this source tree.
524
- */const VE={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};VE.node;const By=q(VE);/**
525
- * @license lucide-react v1.75.0 - ISC
526
- *
527
- * This source code is licensed under the ISC license.
528
- * See the LICENSE file in the root directory of this source tree.
529
- */const WE={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};WE.node;const rz=q(WE);/**
530
- * @license lucide-react v1.75.0 - ISC
531
- *
532
- * This source code is licensed under the ISC license.
533
- * See the LICENSE file in the root directory of this source tree.
534
- */const UE={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};UE.node;const sz=q(UE);/**
535
- * @license lucide-react v1.75.0 - ISC
536
- *
537
- * This source code is licensed under the ISC license.
538
- * See the LICENSE file in the root directory of this source tree.
539
- */const ZE={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};ZE.node;const iz=q(ZE);/**
540
- * @license lucide-react v1.75.0 - ISC
541
- *
542
- * This source code is licensed under the ISC license.
543
- * See the LICENSE file in the root directory of this source tree.
544
- */const HE={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};HE.node;const oz=q(HE);/**
545
- * @license lucide-react v1.75.0 - ISC
546
- *
547
- * This source code is licensed under the ISC license.
548
- * See the LICENSE file in the root directory of this source tree.
549
- */const qE={name:"share",size:24,node:[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]]};qE.node;const az=q(qE);/**
550
- * @license lucide-react v1.75.0 - ISC
551
- *
552
- * This source code is licensed under the ISC license.
553
- * See the LICENSE file in the root directory of this source tree.
554
- */const KE={name:"shopping-cart",size:24,node:[["path",{d:"m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18",key:"uebgi3"}],["path",{d:"M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25",key:"1j7c9p"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]};KE.node;const lz=q(KE);/**
555
- * @license lucide-react v1.75.0 - ISC
556
- *
557
- * This source code is licensed under the ISC license.
558
- * See the LICENSE file in the root directory of this source tree.
559
- */const JE={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};JE.node;const GE=q(JE);/**
560
- * @license lucide-react v1.75.0 - ISC
561
- *
562
- * This source code is licensed under the ISC license.
563
- * See the LICENSE file in the root directory of this source tree.
564
- */const YE={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};YE.node;const QE=q(YE);/**
565
- * @license lucide-react v1.75.0 - ISC
566
- *
567
- * This source code is licensed under the ISC license.
568
- * See the LICENSE file in the root directory of this source tree.
569
- */const XE={name:"store",size:24,node:[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]};XE.node;const cz=q(XE);/**
570
- * @license lucide-react v1.75.0 - ISC
571
- *
572
- * This source code is licensed under the ISC license.
573
- * See the LICENSE file in the root directory of this source tree.
574
- */const e$={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};e$.node;const t$=q(e$);/**
575
- * @license lucide-react v1.75.0 - ISC
576
- *
577
- * This source code is licensed under the ISC license.
578
- * See the LICENSE file in the root directory of this source tree.
579
- */const n$={name:"table-2",size:24,node:[["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]};n$.node;const Td=q(n$);/**
580
- * @license lucide-react v1.75.0 - ISC
581
- *
582
- * This source code is licensed under the ISC license.
583
- * See the LICENSE file in the root directory of this source tree.
584
- */const r$={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};r$.node;const dz=q(r$);/**
585
- * @license lucide-react v1.75.0 - ISC
586
- *
587
- * This source code is licensed under the ISC license.
588
- * See the LICENSE file in the root directory of this source tree.
589
- */const s$={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s$.node;const uz=q(s$);/**
590
- * @license lucide-react v1.75.0 - ISC
591
- *
592
- * This source code is licensed under the ISC license.
593
- * See the LICENSE file in the root directory of this source tree.
594
- */const i$={name:"triangle-exclamation-point",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle","triangle-alert"]};i$.node;const fz=q(i$);/**
595
- * @license lucide-react v1.75.0 - ISC
596
- *
597
- * This source code is licensed under the ISC license.
598
- * See the LICENSE file in the root directory of this source tree.
599
- */const o$={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};o$.node;const hz=q(o$);/**
600
- * @license lucide-react v1.75.0 - ISC
601
- *
602
- * This source code is licensed under the ISC license.
603
- * See the LICENSE file in the root directory of this source tree.
604
- */const a$={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};a$.node;const pz=q(a$);/**
605
- * @license lucide-react v1.75.0 - ISC
606
- *
607
- * This source code is licensed under the ISC license.
608
- * See the LICENSE file in the root directory of this source tree.
609
- */const l$={name:"user-cog",size:24,node:[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};l$.node;const mz=q(l$);/**
610
- * @license lucide-react v1.75.0 - ISC
611
- *
612
- * This source code is licensed under the ISC license.
613
- * See the LICENSE file in the root directory of this source tree.
614
- */const c$={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};c$.node;const gz=q(c$);/**
615
- * @license lucide-react v1.75.0 - ISC
616
- *
617
- * This source code is licensed under the ISC license.
618
- * See the LICENSE file in the root directory of this source tree.
619
- */const d$={name:"users-round",size:24,node:[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],aliases:["users-2"]};d$.node;const yz=q(d$);/**
620
- * @license lucide-react v1.75.0 - ISC
621
- *
622
- * This source code is licensed under the ISC license.
623
- * See the LICENSE file in the root directory of this source tree.
624
- */const u$={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};u$.node;const v1=q(u$);/**
625
- * @license lucide-react v1.75.0 - ISC
626
- *
627
- * This source code is licensed under the ISC license.
628
- * See the LICENSE file in the root directory of this source tree.
629
- */const f$={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};f$.node;const h$=q(f$);/**
630
- * @license lucide-react v1.75.0 - ISC
631
- *
632
- * This source code is licensed under the ISC license.
633
- * See the LICENSE file in the root directory of this source tree.
634
- */const p$={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};p$.node;const Od=q(p$);/**
635
- * @license lucide-react v1.75.0 - ISC
636
- *
637
- * This source code is licensed under the ISC license.
638
- * See the LICENSE file in the root directory of this source tree.
639
- */const m$={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};m$.node;const xz=q(m$);/**
640
- * @license lucide-react v1.75.0 - ISC
641
- *
642
- * This source code is licensed under the ISC license.
643
- * See the LICENSE file in the root directory of this source tree.
644
- */const g$={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};g$.node;const Bo=q(g$);/**
645
- * @license lucide-react v1.75.0 - ISC
646
- *
647
- * This source code is licensed under the ISC license.
648
- * See the LICENSE file in the root directory of this source tree.
649
- */const y$={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};y$.node;const x$=q(y$),vz={"app-window":yD,"book-open":rN,box:iN,boxes:kD,"clipboard-list":SD,"credit-card":CD,database:AN,"file-text":Kf,globe:$D,"key-round":g1,landmark:ID,library:DD,mail:FD,package:HD,plug:Md,radio:QD,receipt:XD,route:nz,send:rz,server:sz,"shopping-cart":lz,store:cz,table:Td,timer:dz,"user-cog":mz,"user-round":gz,users:v1,waypoints:h$,zap:x$};function Ad(t){return vz[t]??iN}function lr({name:t,x:e,y:n,size:r=16,color:s="currentColor",strokeWidth:i=1.75}){const o=Ad(t);return d.jsx(o,{x:e,y:n,width:r,height:r,color:s,strokeWidth:i,"aria-hidden":!0})}const dt=t=>t.startsWith("#")?t:`var(--poney-${t})`,mn=(t,e=10)=>`color-mix(in srgb, ${dt(t)} ${e}%, var(--poney-paper-raised))`;function v$({scene:t,extra:e=[]}){const n=fn(),r=new Map(e.map(i=>[i.id,i])),s=i=>n.entities.get(i)??r.get(i);return d.jsxs("g",{children:[(t.groups??[]).map(i=>{const o=s(i.entityId);return o?d.jsx(bz,{group:i,entity:o},i.entityId):null}),t.edges.map(i=>d.jsx(Sz,{edge:i},i.id)),t.nodes.map(i=>{const o=s(i.entityId);return o?d.jsx(wz,{node:i,entity:o},i.entityId):null}),t.edges.map(i=>d.jsx(jz,{edge:i},`l-${i.id}`)),[...t.groups??[],...t.nodes].map(i=>d.jsx(Cz,{node:i},`c-${i.entityId}`)),t.edges.map(i=>d.jsx(_z,{edge:i},`ec-${i.id}`)),t.nodes.filter(i=>{var o;return(o=i.members)==null?void 0:o.length}).map(i=>d.jsx(kz,{node:i,names:i.members.map(o=>{var a;return((a=s(o))==null?void 0:a.name)??o})},`p-${i.entityId}`))]})}function kz({node:t,names:e}){const{hot:n}=dr();if(n!==`entity:${t.entityId}`)return null;const r=e.slice(0,6),s=e.length-r.length,i=[...r,...s>0?[`and ${s} more`]:[]],o=Math.max(t.w,Math.max(...i.map(f=>Oe(f,12.5,500)))+40),a=i.length*22+38,l=t.x+t.w/2-o/2,c=t.y+t.h+12;return d.jsxs("g",{pointerEvents:"none",transform:`translate(${l} ${c})`,children:[d.jsx("rect",{width:o,height:a,rx:12,fill:"var(--poney-paper-raised)",stroke:"var(--poney-story-rule)"}),d.jsx("text",{x:16,y:22,fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-3)",children:"Inside"}),i.map((f,u)=>d.jsx("text",{x:16,y:44+u*22,fontSize:12.5,fontWeight:u<r.length?500:400,fill:u<r.length?"var(--poney-ink)":"var(--poney-ink-3)",children:f},u))]})}function wz({node:t,entity:e}){const n=fn(),r=Sn(),s=`entity:${e.id}`,i=t.members??[],o=wl([s,...i.map(v=>`entity:${v}`)]),a=n.style(e),{setHot:l,toggleGroup:c}=dr(),{x:f,y:u,w:h,h:m}=t,g=o.hot?"var(--poney-accent)":bl(o.state,o.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),p=o.state==="removed",x=i.length?`${i.length} inside${e.technology?` · ${e.technology}`:""}`:e.technology??a.label,y=r({kind:"entity",id:e.id},`${e.name}. ${e.summary}`);return d.jsxs("g",{transform:`translate(${f} ${u})`,...y,className:`poney-el ${Mr(o)}`,onMouseEnter:()=>{var v;(v=y.onMouseEnter)==null||v.call(y),l(s)},onMouseLeave:()=>{var v;(v=y.onMouseLeave)==null||v.call(y),l(null)},children:[i.length>0&&d.jsx("rect",{x:5,y:5,width:h,height:m,rx:14,fill:"var(--poney-story-node)",stroke:"var(--poney-story-rule)",strokeWidth:1.2}),d.jsx("rect",{width:h,height:m,rx:14,fill:a1(o.state),stroke:g,strokeWidth:o.state||o.hot?1.75:1.2,strokeDasharray:p||e.kind==="external"?"6 4":void 0}),i.length>0&&c&&d.jsx(k$,{open:!1,name:e.name,x:h-22,y:m/2,onToggle:()=>c(e.id)}),d.jsx(lr,{name:a.icon,x:18,y:m/2-9,size:18,color:o.state?`var(--poney-${o.state})`:dt(a.tone)}),d.jsx("text",{x:48,y:m/2-2,fontSize:15,fontWeight:600,fill:"var(--poney-ink)",textDecoration:p?"line-through":void 0,children:Nt(e.name,h-(i.length&&c?92:60),15,600)}),d.jsx("text",{x:48,y:m/2+17,fontSize:12.5,fill:"var(--poney-ink-3)",children:Nt(x,h-(i.length&&c?92:60),12.5)}),d.jsx(Nd,{state:o.state,x:h-12,y:0,anchor:"end"}),d.jsx("rect",{className:"poney-focus",x:-5,y:-5,width:h+10,height:m+10,rx:18,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2,strokeDasharray:"4 3"})]})}function bz({group:t,entity:e}){const n=fn(),r=Sn(),s=`entity:${e.id}`,i=Ps(s),o=wl(t.members.map(y=>`entity:${y}`)),{setHot:a,toggleGroup:l}=dr(),c=n.style(e),{x:f,y:u,w:h,h:m}=t,g=r({kind:"entity",id:e.id},`${e.name}. ${e.summary}`),p=i.hot?"var(--poney-accent)":bl(i.state,"var(--poney-story-rule)"),x=e.technology??c.label;return d.jsxs("g",{transform:`translate(${f} ${u})`,className:`poney-el ${Mr({...i,dim:i.dim&&o.dim})}`,children:[d.jsx("rect",{width:h,height:m,rx:18,fill:i.state?`var(--poney-${i.state}-wash)`:"var(--poney-sunken)",fillOpacity:i.state?.55:.45,stroke:p,strokeWidth:i.state||i.hot?1.6:1.1}),d.jsxs("g",{...g,onMouseEnter:()=>{var y;(y=g.onMouseEnter)==null||y.call(g),a(s)},onMouseLeave:()=>{var y;(y=g.onMouseLeave)==null||y.call(g),a(null)},children:[d.jsx("rect",{width:h,height:44,rx:18,fill:"transparent"}),d.jsx(lr,{name:c.icon,x:16,y:14,size:16,color:i.state?`var(--poney-${i.state})`:dt(c.tone)}),d.jsx("text",{x:40,y:27,fontSize:14,fontWeight:600,fill:"var(--poney-ink)",children:Nt(e.name,h-(l?150:110),14,600)}),d.jsx("text",{x:40+Math.min(_w(e.name),h-(l?150:110))+10,y:27,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(x,Math.max(0,h-40-_w(e.name)-(l?56:24)),12)})]}),d.jsx(Nd,{state:i.state,x:h-(l?44:14),y:22,anchor:"end"}),l&&d.jsx(k$,{open:!0,name:e.name,x:h-24,y:22,onToggle:()=>l(e.id)})]})}const _w=t=>Oe(t,14,600);function k$({open:t,name:e,x:n,y:r,onToggle:s}){return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${t?"Close":"Open"} ${e}`,className:"poney-control",onClick:i=>{i.stopPropagation(),s()},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s())},children:[d.jsx("title",{children:t?`Close ${e}`:`Open ${e}`}),d.jsx("circle",{cx:n,cy:r,r:11,fill:"var(--poney-paper-raised)",stroke:"var(--poney-story-line)",strokeWidth:1.1}),d.jsx("line",{x1:n-4.5,y1:r,x2:n+4.5,y2:r,stroke:"var(--poney-ink-2)",strokeWidth:1.6,strokeLinecap:"round"}),!t&&d.jsx("line",{x1:n,y1:r-4.5,x2:n,y2:r+4.5,stroke:"var(--poney-ink-2)",strokeWidth:1.6,strokeLinecap:"round"})]})}function Sz({edge:t}){const e=fn(),n=Sn(),{setHot:r}=dr(),s=`relationship:${t.id}`,i=wl(t.relationships.map(x=>`relationship:${x}`)),o=e.relationships.get(t.id),[a,l,c,f]=t.curve,u=i.hot?"var(--poney-accent)":bl(i.state,i.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),h=Math.atan2(f.y-c.y,f.x-c.x),m={x:f.x-Math.cos(h)*8,y:f.y-Math.sin(h)*8},g=(o==null?void 0:o.kind)==="publishes"||(o==null?void 0:o.kind)==="subscribes",p=n({kind:"relationship",id:t.id},(o==null?void 0:o.label)??t.id);return d.jsxs("g",{...p,className:`poney-el ${Mr(i)}`,onMouseEnter:()=>{var x;(x=p.onMouseEnter)==null||x.call(p),r(s)},onMouseLeave:()=>{var x;(x=p.onMouseLeave)==null||x.call(p),r(null)},children:[d.jsx("path",{d:`M ${a.x} ${a.y} C ${l.x} ${l.y} ${c.x} ${c.y} ${f.x} ${f.y}`,fill:"none",stroke:"transparent",strokeWidth:16}),d.jsx("path",{d:`M ${a.x} ${a.y} C ${l.x} ${l.y} ${c.x} ${c.y} ${m.x} ${m.y}`,fill:"none",stroke:u,strokeWidth:i.state||i.hot?2:1.4,strokeDasharray:i.state==="removed"||g?"6 5":void 0,strokeLinecap:"round"}),d.jsx(Hf,{x:f.x,y:f.y,angle:h,color:u})]})}function jz({edge:t}){const e=dr(),n=wl(t.relationships.map(g=>`relationship:${g}`));if(!(!n.hidden&&(n.hot||e.allLabels||!!n.callout||!!e.focus&&n.focused||!e.focus&&!!n.state)))return null;const{x:s,y:i,w:o,h:a,text:l,sub:c}=t.label,f=n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-ink-2)",u=n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-story-line)",h=t.leader,m=h?{x:Math.max(s,Math.min(s+o,h.x)),y:Math.max(i,Math.min(i+a,h.y))}:void 0;return d.jsxs("g",{pointerEvents:"none",className:`poney-story-el ${n.dim?"poney-story-dim":""}`,children:[h&&m&&d.jsxs(d.Fragment,{children:[d.jsx("line",{x1:m.x,y1:m.y,x2:h.x,y2:h.y,stroke:u,strokeWidth:1,strokeDasharray:"2 3"}),d.jsx("circle",{cx:h.x,cy:h.y,r:2.5,fill:u})]}),d.jsxs("g",{transform:`translate(${s} ${i})`,children:[d.jsx("rect",{width:o,height:a,rx:11,fill:"var(--poney-paper-raised)",stroke:n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-story-rule)"}),d.jsx("text",{x:o/2,y:15,textAnchor:"middle",fontSize:12,fontWeight:500,fill:f,children:l}),c&&d.jsx("text",{x:o/2,y:29,textAnchor:"middle",fontSize:11,fill:"var(--poney-ink-3)",children:c})]})]})}function Cz({node:t}){const e=wl([`entity:${t.entityId}`,...(("depth"in t?[]:t.members)??[]).map(n=>`entity:${n}`)]);return!e.callout||e.hidden?null:d.jsx(Sl,{n:e.callout,x:t.x-2,y:t.y-2,hot:e.hot})}function _z({edge:t}){const e=wl(t.relationships.map(n=>`relationship:${n}`));return!e.callout||e.hidden?null:d.jsx(Sl,{n:e.callout,x:t.label.x-14,y:t.label.y+t.label.h/2,hot:e.hot})}function Nz({scene:t}){const e=t.interactionId;return d.jsxs("g",{children:[t.fragments.slice().sort((n,r)=>n.depth-r.depth).map(n=>d.jsx(Oz,{f:n,behavior:e},n.id)),t.participants.map(n=>d.jsx(Ez,{p:n},n.entityId)),t.activations.map((n,r)=>d.jsx("rect",{x:n.x+1,y:n.y1,width:8,height:n.y2-n.y1,rx:3,fill:"var(--poney-sunken)",stroke:"var(--poney-story-rule)"},r)),t.fragments.map(n=>d.jsx(Az,{f:n,behavior:e},`fl-${n.id}`)),t.messages.map(n=>d.jsx(Tz,{m:n,behavior:e},n.id)),t.participants.map(n=>d.jsx($z,{p:n},`h-${n.entityId}`))]})}function Ez({p:t}){const e=Ps(`entity:${t.entityId}`);return d.jsx("line",{x1:t.x,x2:t.x,y1:t.lifeline.y1,y2:t.lifeline.y2,stroke:e.hot?"var(--poney-accent)":"var(--poney-story-rule)",strokeWidth:e.hot?1.5:1,className:Mr({...e,dim:!1})})}function $z({p:t}){const e=fn(),n=Sn(),{setHot:r}=dr(),s=`entity:${t.entityId}`,i=Ps(s),o=e.entities.get(t.entityId);if(!o)return null;const a=e.style(o),{x:l,y:c,w:f,h:u}=t.header,h=n({kind:"entity",id:o.id},`${o.name}, ${a.label}`);return d.jsxs("g",{transform:`translate(${l} ${c})`,...h,className:`poney-el ${Mr({...i,dim:!1})}`,onMouseEnter:()=>{var m;(m=h.onMouseEnter)==null||m.call(h),r(s)},onMouseLeave:()=>{var m;(m=h.onMouseLeave)==null||m.call(h),r(null)},children:[d.jsx("rect",{width:f,height:u,rx:14,fill:a1(i.state),stroke:i.hot?"var(--poney-accent)":bl(i.state,"var(--poney-story-line)"),strokeWidth:i.state?1.75:1.2,strokeDasharray:o.kind==="external"?"6 4":void 0}),d.jsx(lr,{name:a.icon,x:16,y:u/2-9,size:18,color:i.state?`var(--poney-${i.state})`:dt(a.tone)}),d.jsx("text",{x:44,y:u/2-1,fontSize:14.5,fontWeight:600,fill:"var(--poney-ink)",children:Nt(o.name,f-54,14.5,600)}),d.jsx("text",{x:44,y:u/2+16,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(o.technology??a.label,f-54,12)}),d.jsx(Nd,{state:i.state,x:f-10,y:0,anchor:"end"}),i.callout&&d.jsx(Sl,{n:i.callout,x:-2,y:-2,hot:i.hot})]})}function Mz(t){return t.hot?"var(--poney-accent)":t.state?`var(--poney-${t.state})`:"var(--poney-ink-2)"}function Tz({m:t,behavior:e}){const n=Sn(),{setHot:r}=dr(),s=`message:${e}:${t.id}`,i=Ps(s),o=Mz(i),a=i.state||i.hot?1.9:1.35,l=String(t.number),c=Oe(l,11.5,600)+8,f=Oe(t.label,13,i.state?600:500),u=n({kind:"message",behavior:e,id:t.id},`Step ${t.number}: ${t.label}`),h={...u,className:`poney-el ${Mr(i)}`,onMouseEnter:()=>{var p;(p=u.onMouseEnter)==null||p.call(u),r(s)},onMouseLeave:()=>{var p;(p=u.onMouseLeave)==null||p.call(u),r(null)}},m=(p,x,y)=>{const v=c+f,k=y==="middle"?p-v/2:p;return d.jsxs(d.Fragment,{children:[d.jsx("text",{x:k,y:x,fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-3)",className:"poney-numbers",stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round",children:l}),d.jsx("text",{x:k+c,y:x,stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round",fontSize:13,fontWeight:i.state?600:500,fill:i.state||i.hot?o:t.kind==="return"?"var(--poney-ink-2)":"var(--poney-ink)",children:t.label}),d.jsx(Nd,{state:i.state,x:k+v+14,y:x-4.5}),i.callout&&d.jsx(Sl,{n:i.callout,x:k-18,y:x-4.5,hot:i.hot})]})};if(t.loop){const{x:p,y1:x,y2:y,w:v}=t.loop;return d.jsxs("g",{...h,children:[d.jsx("rect",{x:p-4,y:x-14,width:v+f+c+90,height:y-x+26,fill:"transparent"}),d.jsx("path",{d:`M ${p} ${x} H ${p+v} V ${y} H ${p+8}`,fill:"none",stroke:o,strokeWidth:a,strokeLinejoin:"round"}),d.jsx(Hf,{x:p+1,y,angle:Math.PI,color:o,size:6}),m(p+v+14,(x+y)/2+4.5,"start")]})}const g=t.x2>t.x1;return d.jsxs("g",{...h,children:[d.jsx("rect",{x:Math.min(t.x1,t.x2),y:t.y-24,width:Math.abs(t.x2-t.x1),height:32,fill:"transparent"}),d.jsx("line",{x1:t.x1,x2:t.x2+(g?-8:8),y1:t.y,y2:t.y,stroke:o,strokeWidth:a,strokeDasharray:t.kind==="return"?"5 4":t.kind==="async"?"2 4":void 0,strokeLinecap:"round"}),d.jsx(Hf,{x:t.x2,y:t.y,angle:g?0:Math.PI,color:o,size:6}),m((t.x1+t.x2)/2,t.y-9,"middle")]})}function Oz({f:t,behavior:e}){const n=Ps(`fragment:${e}:${t.id}`);return d.jsxs("g",{className:Mr(n),children:[d.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,rx:14,fill:"var(--poney-paper)",fillOpacity:.55,stroke:"var(--poney-story-rule)"}),t.branches.slice(1).map((r,s)=>d.jsx("line",{x1:t.x+10,x2:t.x+t.w-10,y1:r.y,y2:r.y,stroke:"var(--poney-story-rule)",strokeDasharray:"4 4"},s))]})}function Az({f:t,behavior:e}){var a;const n=Ps(`fragment:${e}:${t.id}`),r=_d(t.kind),s=((a=t.branches[0])==null?void 0:a.guard)??"",i=Oe(r,11.5,650),o={stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round"};return d.jsxs("g",{className:Mr(n),pointerEvents:"none",children:[d.jsx("text",{x:t.x+14,y:t.y+19,fontSize:11.5,fontWeight:650,fill:"var(--poney-ink-3)",...o,children:r}),d.jsx("text",{x:t.x+24+i,y:t.y+19,fontSize:12,fill:"var(--poney-ink-2)",...o,children:t.kind==="loop"||t.kind==="opt"?s:`if ${s}`}),t.branches.slice(1).map((l,c)=>d.jsx("text",{x:t.x+14,y:l.y+18,fontSize:12,fill:"var(--poney-ink-2)",...o,children:t.kind==="par"?`and ${l.guard}`:`else, if ${l.guard}`},c))]})}function Rz({scene:t}){return d.jsxs("g",{children:[t.transitions.map(e=>d.jsx(Pz,{t:e,machine:t.machineId},e.id)),t.states.map(e=>d.jsx(Iz,{s:e,machine:t.machineId},e.id)),t.transitions.map(e=>d.jsx(Dz,{t:e,machine:t.machineId},`l-${e.id}`))]})}function w$(t,e,n,r){const s=Sn(),{setHot:i}=dr(),o=s(e,n);return{...o,className:`poney-el ${r}`,onMouseEnter:()=>{var a;(a=o.onMouseEnter)==null||a.call(o),i(t)},onMouseLeave:()=>{var a;(a=o.onMouseLeave)==null||a.call(o),i(null)}}}function Iz({s:t,machine:e}){const n=`state:${e}:${t.id}`,r=Ps(n),s=w$(n,{kind:"state",behavior:e,id:t.id},`State ${t.name}`,Mr(r)),i=t.outcome==="success"?"var(--poney-success)":t.outcome==="failure"?"var(--poney-failure)":void 0;if(t.kind==="initial")return d.jsx("g",{transform:`translate(${t.x} ${t.y})`,...s,children:d.jsx("circle",{cx:t.w/2,cy:t.h/2,r:8,fill:"var(--poney-ink)"})});const o=r.hot?"var(--poney-accent)":bl(r.state,r.focused?"var(--poney-story-line)":"var(--poney-story-rule)");return d.jsxs("g",{transform:`translate(${t.x} ${t.y})`,...s,children:[d.jsx("rect",{width:t.w,height:t.h,rx:t.h/2,fill:a1(r.state),stroke:o,strokeWidth:r.state||r.hot?1.8:1.25}),t.kind==="final"&&d.jsx("rect",{x:4,y:4,width:t.w-8,height:t.h-8,rx:(t.h-8)/2,fill:"none",stroke:o,strokeWidth:1}),i&&d.jsx("circle",{cx:20,cy:t.h/2,r:4,fill:i}),d.jsx("text",{x:t.w/2,y:t.entryActions.length?t.h/2-2:t.h/2+5,textAnchor:"middle",fontSize:14.5,fontWeight:600,fill:"var(--poney-ink)",children:t.name}),t.entryActions.length>0&&d.jsxs("text",{x:t.w/2,y:t.h/2+15,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:[t.entryActions[0],t.entryActions.length>1?`, +${t.entryActions.length-1}`:""]}),d.jsx(Nd,{state:r.state,x:t.w-14,y:0,anchor:"end"}),r.callout&&d.jsx(Sl,{n:r.callout,x:0,y:0,hot:r.hot})]})}function Pz({t,machine:e}){const n=`transition:${e}:${t.id}`,r=Ps(n),s=w$(n,{kind:"transition",behavior:e,id:t.id},`Transition: ${t.event}`,Mr(r)),i=r.hot?"var(--poney-accent)":bl(r.state,r.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),o=ko(GC(t.points,7),18),a=t.points[t.points.length-1];return d.jsxs("g",{...s,children:[d.jsx("path",{d:ko(t.points,18),fill:"none",stroke:"transparent",strokeWidth:16}),d.jsx("path",{d:o,fill:"none",stroke:i,strokeWidth:r.state||r.hot?2:1.4,strokeDasharray:r.state==="removed"?"6 5":void 0,strokeLinecap:"round"}),d.jsx(Hf,{x:a.x,y:a.y,angle:YC(t.points),color:i,size:6})]})}function Dz({t,machine:e}){const n=`transition:${e}:${t.id}`,r=Ps(n);if(!t.label)return null;const{x:s,y:i,w:o,h:a}=t.label,l=r.hot?"var(--poney-accent)":r.state?`var(--poney-${r.state})`:"var(--poney-ink)";return d.jsxs("g",{transform:`translate(${s} ${i})`,pointerEvents:"none",className:Mr(r),children:[d.jsx("rect",{width:o,height:a,rx:8,fill:r.state?`var(--poney-${r.state}-wash)`:"var(--poney-paper-raised)",stroke:r.state?`var(--poney-${r.state})`:"var(--poney-story-rule)"}),d.jsx("text",{x:o/2,y:15,textAnchor:"middle",fontSize:11.5,fontWeight:600,fill:l,textDecoration:r.state==="removed"?"line-through":void 0,children:t.event}),t.guard&&d.jsxs("text",{x:o/2,y:28,textAnchor:"middle",fontSize:10.5,fill:"var(--poney-ink-3)",children:["[",t.guard,"]"]}),r.callout&&d.jsx(Sl,{n:r.callout,x:-4,y:a/2,hot:r.hot})]})}function b$(t,e){const n=new Map;if(e.type==="map")for(const r of t.edges){const s=r.curve,i={d:`M ${s[0].x} ${s[0].y} C ${s[1].x} ${s[1].y} ${s[2].x} ${s[2].y} ${s[3].x} ${s[3].y}`,at:o=>{const a=mc(s,o),l=mc(s,Math.min(1,o+.01)),c=mc(s,Math.max(0,o-.01));return{...a,angle:Math.atan2(l.y-c.y,l.x-c.x)}},stepAt:.18,badge:{x:r.label.x+r.label.w/2,y:r.label.y+r.label.h+13},sign:{x:r.label.x+r.label.w+13,y:r.label.y+r.label.h/2}};for(const o of r.relationships)n.set(`relationship:${o}`,i)}if(e.type==="sequence"){const r=t;for(const s of r.messages){const i=s.loop?[{x:s.loop.x,y:s.loop.y1},{x:s.loop.x+s.loop.w,y:s.loop.y1},{x:s.loop.x+s.loop.w,y:s.loop.y2},{x:s.loop.x+8,y:s.loop.y2}]:[{x:s.x1,y:s.y},{x:s.x2,y:s.y}],o=Nw(i,0),a=Math.abs(s.x2-s.x1)||60,l=o.at(.5);n.set(`message:${r.interactionId}:${s.id}`,{...o,stepAt:Math.min(.4,22/a),badge:s.loop?{x:s.loop.x+s.loop.w+40,y:s.loop.y2+14}:{x:l.x,y:l.y+15},sign:s.loop?o.at(.5):{x:o.at(.9).x,y:s.y+15}})}}if(e.type==="state"){const r=t;for(const s of r.transitions){const i=Nw(s.points,18),o=i.at(.5);n.set(`transition:${r.machineId}:${s.id}`,{...i,stepAt:.22,badge:s.label?{x:s.label.x+s.label.w/2,y:s.label.y+s.label.h+13}:{x:o.x,y:o.y+15},sign:s.label?{x:s.label.x+s.label.w+13,y:s.label.y+s.label.h/2}:i.at(.3)})}}return n}function Nw(t,e){const n=t.slice(1).map((s,i)=>Math.hypot(s.x-t[i].x,s.y-t[i].y)),r=n.reduce((s,i)=>s+i,0)||1;return{d:e?ko(t,e):`M ${t.map(s=>`${s.x} ${s.y}`).join(" L ")}`,at(s){let i=Math.max(0,Math.min(1,s))*r;for(let o=0;o<n.length;o++){const a=t[o],l=t[o+1];if(i<=n[o]||o===n.length-1){const c=n[o]?Math.min(1,i/n[o]):0;return{x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c,angle:Math.atan2(l.y-a.y,l.x-a.x)}}i-=n[o]}return{...t[0],angle:0}}}}const zz={flow:"var(--poney-lapis)",attention:"var(--poney-accent)","hot-path":"var(--poney-accent)",slow:"var(--poney-ochre)",failing:"var(--poney-failure)",blocked:"var(--poney-failure)"},S$=(t,e)=>e?dt(e):zz[t],Lz=t=>/^(entity|state|dataType|activityNode|useCase):/.test(t);function Fz({scene:t,view:e}){var i;const n=dr();if(!((i=n.effects)!=null&&i.size))return null;const r=b$(t,e),s=[];return n.effects.forEach((o,a)=>{const l=r.get(a);if(l)for(const c of o){if(c.as==="flow")continue;const f=c.as==="hot-path";s.push(d.jsx("path",{d:l.d,fill:"none",stroke:S$(c.as,c.tone),strokeOpacity:f?.3:.2,strokeWidth:f?9:11,strokeLinecap:"round",strokeDasharray:c.as==="slow"?"1 14":void 0,className:c.as==="attention"?"poney-pulse":void 0},`${a}-${c.as}`))}}),d.jsx("g",{pointerEvents:"none",children:s})}function j$({scene:t,view:e}){var a,l;const n=dr(),r=b$(t,e),s=c=>{const f=Lz(c)?t.anchors[c]:void 0;return f!=null&&f.entityId&&c.startsWith("entity:")&&f.entityId!==c.slice(7)?void 0:f},i=[];(a=n.effects)==null||a.forEach((c,f)=>{const u=r.get(f),h=s(f);c.forEach((m,g)=>{const p=S$(m.as,m.tone),x=`${f}-${m.as}-${g}`;u?(m.as==="flow"&&i.push(d.jsx("path",{d:u.d,fill:"none",stroke:p,strokeWidth:3,strokeLinecap:"round",strokeDasharray:"0.1 11",className:"poney-flow"},x)),(m.as==="slow"||m.as==="failing"||m.as==="blocked")&&i.push(d.jsx(Ew,{as:m.as,x:u.sign.x,y:u.sign.y,color:p},x))):h&&(i.push(d.jsx("rect",{x:h.x-6,y:h.y-6,width:h.w+6*2,height:h.h+6*2,rx:Math.min(20,(h.h+6*2)/2),fill:"none",stroke:p,strokeWidth:m.as==="hot-path"?2.5:2,strokeDasharray:m.as==="blocked"?"6 4":m.as==="slow"?"2 4":void 0,strokeLinecap:"round",className:m.as==="attention"?"poney-pulse":void 0},x)),(m.as==="slow"||m.as==="failing"||m.as==="blocked")&&i.push(d.jsx(Ew,{as:m.as,x:h.x+h.w+2,y:h.y+h.h+2,color:p},`${x}-s`)))})}),(l=n.badges)==null||l.forEach((c,f)=>{const u=r.get(f),h=s(f);let m=0,g=0;if(u)m=u.badge.x,g=u.badge.y;else if(h)m=h.x+h.w/2,g=h.y+h.h;else return;const p=c.map(y=>Oe(y.text,11,600)+16);let x=m-(p.reduce((y,v)=>y+v,0)+(c.length-1)*4)/2;c.forEach((y,v)=>{const k=y.tone?dt(y.tone):"var(--poney-ink-2)";i.push(d.jsxs("g",{transform:`translate(${x} ${g-10})`,children:[d.jsx("rect",{width:p[v],height:20,rx:10,fill:"var(--poney-paper-raised)",stroke:k,strokeWidth:1.1}),d.jsx("text",{x:p[v]/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:600,fill:k,className:"poney-numbers",children:y.text})]},`b-${f}-${v}`)),x+=p[v]+4})});const o=n.trace;if(o!=null&&o.steps.length){if(o.current===null&&o.numbered)o.steps.forEach((c,f)=>{const u=r.get(c),h=s(c),m=u?u.at(u.stepAt):h?{x:h.x+14,y:h.y+h.h-2}:void 0;m&&i.push(d.jsx(Bz,{n:f+1,x:m.x,y:m.y},`t-${f}`))});else if(o.current!==null){const c=o.steps[o.current],f=r.get(c),u=s(c);f?i.push(d.jsxs("g",{children:[d.jsx("circle",{r:7,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5,children:o.animate?d.jsx("animateMotion",{dur:"0.9s",fill:"freeze",path:f.d,keyPoints:"0;1",keyTimes:"0;1",calcMode:"spline",keySplines:"0.4 0 0.2 1"}):null}),!o.animate&&d.jsx("circle",{cx:f.at(1).x,cy:f.at(1).y,r:7,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5})]},`token-${o.current}`)):u&&i.push(d.jsx("rect",{x:u.x-7,y:u.y-7,width:u.w+14,height:u.h+14,rx:20,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2.5,className:o.animate?"poney-pulse":void 0},`token-${o.current}`))}}return i.length?d.jsx("g",{pointerEvents:"none",children:i}):null}function Ew({as:t,x:e,y:n,color:r}){return d.jsxs("g",{children:[d.jsx("circle",{cx:e,cy:n,r:10,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.6}),t==="slow"&&d.jsx(lr,{name:"timer",x:e-6.5,y:n-6.5,size:13,color:r}),t==="failing"&&d.jsx("path",{d:`M ${e-3.6} ${n-3.6} L ${e+3.6} ${n+3.6} M ${e+3.6} ${n-3.6} L ${e-3.6} ${n+3.6}`,stroke:r,strokeWidth:2,strokeLinecap:"round"}),t==="blocked"&&d.jsx("path",{d:`M ${e-4.5} ${n} L ${e+4.5} ${n}`,stroke:r,strokeWidth:2.4,strokeLinecap:"round"})]})}const k1=t=>t<26?String.fromCharCode(65+t):`${String.fromCharCode(65+Math.floor(t/26)-1)}${String.fromCharCode(65+t%26)}`;function Bz({n:t,x:e,y:n}){return d.jsxs("g",{children:[d.jsx("rect",{x:e-8.5,y:n-8.5,width:17,height:17,rx:5,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:1.75}),d.jsx("text",{x:e,y:n+3.8,textAnchor:"middle",fontSize:10.5,fontWeight:700,fill:"var(--poney-paper-raised)",className:"poney-numbers",children:k1(t-1)})]})}function Vz({view:t,scene:e,extra:n}){const r=t.type==="map"?d.jsx(v$,{scene:e,extra:n}):t.type==="sequence"?d.jsx(Nz,{scene:e}):t.type==="state"?d.jsx(Rz,{scene:e}):null;return r?d.jsxs("g",{children:[d.jsx(Fz,{scene:e,view:t}),r,d.jsx(j$,{scene:e,view:t})]}):null}const C$=t=>t.type==="extension"?t.extension:t.type;function Ha({at:t,angle:e,kind:n,color:r,size:s=8}){if(n==="none")return null;const i=n==="triangle"?s*.75:s*.55,o=n==="triangle"?s*1.25:s,a=Math.cos(e),l=Math.sin(e),c=(f,u)=>`${t.x+f*a-u*l},${t.y+f*l+u*a}`;return n==="open-arrow"?d.jsx("polyline",{points:`${c(-o,-i)} ${c(0,0)} ${c(-o,i)}`,fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}):n==="triangle"?d.jsx("polygon",{points:`${c(0,0)} ${c(-o,-i)} ${c(-o,i)}`,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.3,strokeLinejoin:"round"}):d.jsx("polygon",{points:`${c(0,0)} ${c(-o,-i)} ${c(-o*.72,0)} ${c(-o,i)}`,fill:r})}function Cp({points:t,style:e,radius:n=8}){const r=e.head==="none"?0:e.head==="triangle"?10:6,s=GC(t,r),i=ko(s,n);return d.jsxs("g",{opacity:e.opacity??1,children:[d.jsx("path",{d:ko(t,n),fill:"none",stroke:"transparent",strokeWidth:14}),d.jsx("path",{d:i,className:`poney-edge ${e.flowing?"poney-flowing":""}`,fill:"none",stroke:e.color,strokeWidth:e.width,strokeDasharray:e.flowing?void 0:e.dash,strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx(Ha,{at:t[t.length-1],angle:YC(t),kind:e.head,color:e.color}),e.tail&&e.tail!=="none"&&d.jsx(Ha,{at:t[0],angle:wR(t),kind:e.tail,color:e.color})]})}function Wz({at:t,text:e,secondary:n,tone:r="var(--poney-ink-2)",strong:s,size:i=11.5}){const o=Oe(e,i,s?600:500),a=n?Oe(n,i-1,400):0,l=Math.max(o,a)+i*1.2,c=n?i*3:i*1.75;return d.jsxs("g",{transform:`translate(${t.x-l/2} ${t.y-c/2})`,pointerEvents:"none",children:[d.jsx("rect",{width:l,height:c,rx:i/2,fill:"var(--poney-paper-raised)",stroke:s?r:"var(--poney-rule)",strokeWidth:s?1.2:1}),d.jsx("text",{x:l/2,y:i*1.22,textAnchor:"middle",fontSize:i,fontWeight:s?600:500,fill:s?r:"var(--poney-ink-2)",children:e}),n&&d.jsx("text",{x:l/2,y:i*2.4,textAnchor:"middle",fontSize:i-1,fill:"var(--poney-ink-3)",children:n})]})}function gc(t,e=11.5,n=30){const r=c1(),s=e/r;return s<=t?t:Math.min(n,Math.ceil(s/2)*2)}function xn({w:t,h:e,rx:n=12,selected:r}){return d.jsxs(d.Fragment,{children:[r&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:-5,y:-5,width:t+10,height:e+10,rx:n+5,fill:"none",stroke:"var(--poney-accent-ring)",strokeWidth:6}),d.jsx("rect",{x:-2.5,y:-2.5,width:t+5,height:e+5,rx:n+2.5,fill:"none",stroke:"var(--poney-accent)",strokeWidth:1.75})]}),d.jsx("rect",{className:"poney-focus",x:-5,y:-5,width:t+10,height:e+10,rx:n+5,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2,strokeDasharray:"4 3"})]})}function _p({entity:t,style:e,w:n,h:r,emphasis:s,detail:i,footer:o}){const a=dt(e.tone),l=t.kind==="external",c=s==="selected",f=b.useMemo(()=>t.summary?Of(t.summary,e.shape==="person"?n-12:n-30,e.shape==="person"?11.5:12,400,2):[],[t.summary,n,e.shape]),u=t.technology??e.label,h=gc(14,10.5),m=h>14&&e.shape!=="person",g=b.useMemo(()=>m?Of(t.name,n-28,h,650,2):[],[m,t.name,n,h]),p=e.emphasis?`color-mix(in srgb, ${a} 55%, var(--poney-rule-strong))`:"var(--poney-rule-strong)";if(e.shape==="person"){const w=n/2;return d.jsxs("g",{children:[d.jsx("rect",{width:n,height:r,rx:14,fill:"transparent"}),d.jsx("circle",{cx:w,cy:22,r:15,fill:mn(e.tone,16),stroke:a,strokeWidth:1.4}),d.jsx("path",{d:`M ${w-27} 64 Q ${w-27} 42 ${w} 42 Q ${w+27} 42 ${w+27} 64 Z`,fill:mn(e.tone,16),stroke:a,strokeWidth:1.4,strokeLinejoin:"round"}),d.jsx("text",{x:w,y:70+Math.min(h,20),textAnchor:"middle",fontSize:Math.min(h,20),fontWeight:650,fill:"var(--poney-ink)",children:Nt(t.name,n+40,Math.min(h,20),650)}),i&&!m&&h===14&&f.map((j,C)=>d.jsx("text",{x:w,y:101+C*14,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:j},C)),d.jsx(xn,{w:n,h:r,rx:14,selected:c})]})}const x=(w=0)=>g.map((j,C)=>d.jsx("text",{x:n/2,y:w+r/2+h*.36+(C-(g.length-1)/2)*h*1.1,textAnchor:"middle",fontSize:h,fontWeight:650,fill:"var(--poney-ink)",children:j},C));if(e.shape==="chip"){const w=t.kind==="interface";return d.jsxs("g",{children:[d.jsx("rect",{className:"poney-body",width:n,height:r,rx:10,fill:t.kind==="library"?"var(--poney-paper)":"var(--poney-paper-raised)",stroke:w?a:p,strokeDasharray:w?"5 3":void 0,strokeWidth:1.1}),m?x():d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:11,y:(r-30)/2,width:30,height:30,rx:8,fill:mn(e.tone,13)}),d.jsx(lr,{name:e.icon,x:18,y:(r-30)/2+7,size:16,color:a}),d.jsx("text",{x:52,y:r/2-3,fontSize:13.5,fontWeight:600,fill:"var(--poney-ink)",fontFamily:t.kind==="interface"?"var(--poney-font-mono)":void 0,children:Nt(t.name,n-62,13.5,600,t.kind==="interface"?"mono":"sans")}),d.jsx("text",{x:52,y:r/2+13,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(u,n-62,11.5)})]}),d.jsx(xn,{w:n,h:r,rx:10,selected:c})]})}const y=e.shape==="cylinder"?12:0,v=e.shape==="cylinder"?d.jsxs(d.Fragment,{children:[d.jsx("path",{className:"poney-body",d:`M 0 10 A ${n/2} 10 0 0 1 ${n} 10 V ${r-10} A ${n/2} 10 0 0 1 0 ${r-10} Z`,fill:"var(--poney-paper-raised)",stroke:p,strokeWidth:1.1}),d.jsx("ellipse",{cx:n/2,cy:10,rx:n/2,ry:10,fill:mn(e.tone,9),stroke:p,strokeWidth:1.1})]}):d.jsxs(d.Fragment,{children:[e.shape==="stack"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:8,y:-8,width:n,height:r,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)",strokeWidth:1}),d.jsx("rect",{x:4,y:-4,width:n,height:r,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)",strokeWidth:1})]}),d.jsx("rect",{className:"poney-body",width:n,height:r,rx:e.shape==="frame"?16:12,fill:e.shape==="frame"?mn(e.tone,6):"var(--poney-paper-raised)",stroke:l?a:p,strokeDasharray:l?"6 4":void 0,strokeWidth:e.shape==="frame"?1.5:1.1})]}),k=e.shape==="frame";return d.jsxs("g",{children:[v,m&&x(y/2),d.jsxs("g",{transform:`translate(0 ${y})`,display:m?"none":void 0,children:[d.jsx("rect",{x:14,y:14,width:k?38:32,height:k?38:32,rx:9,fill:mn(e.tone,14)}),d.jsx(lr,{name:e.icon,x:k?23:21.5,y:k?23:21.5,size:k?20:17,color:a}),d.jsx("text",{x:k?64:56,y:k?31:29,fontSize:k?16:14,fontWeight:650,fill:"var(--poney-ink)",children:Nt(t.name,n-(k?76:68),k?16:14,650)}),d.jsx("text",{x:k?64:56,y:k?48:45.5,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(u,n-(k?76:68),11.5)}),i&&f.map((w,j)=>d.jsx("text",{x:14,y:(k?76:70)+j*15,fontSize:12,fill:"var(--poney-ink-2)",children:w},j)),o&&d.jsx("text",{x:14,y:r-y-16,fontSize:12,fontWeight:600,fill:a,children:o})]}),d.jsx(xn,{w:n,h:r,rx:k?16:12,selected:c})]})}function Kt({shape:t,tone:e,label:n,dashed:r}){const s=dt(e),i=mn(e,14);return d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,className:"poney-legend-mark",children:[t==="person"&&d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"5",r:"3.6",fill:i,stroke:s,strokeWidth:"1.2"}),d.jsx("path",{d:"M4.5 15 Q4.5 9.5 11 9.5 Q17.5 9.5 17.5 15 Z",fill:i,stroke:s,strokeWidth:"1.2"})]}),t==="cylinder"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M2 4 A9 2.6 0 0 1 20 4 V12 A9 2.6 0 0 1 2 12 Z",fill:i,stroke:s,strokeWidth:"1.2"}),d.jsx("ellipse",{cx:"11",cy:"4",rx:"9",ry:"2.6",fill:i,stroke:s,strokeWidth:"1.2"})]}),t==="stack"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"5",y:"1",width:"15",height:"10",rx:"2.5",fill:"none",stroke:s,strokeWidth:"1",opacity:"0.6"}),d.jsx("rect",{x:"2",y:"4",width:"15",height:"10",rx:"2.5",fill:i,stroke:s,strokeWidth:"1.2"})]}),(t==="card"||t==="frame"||t==="chip")&&d.jsx("rect",{x:"2",y:"2",width:"18",height:"12",rx:"3",fill:i,stroke:s,strokeWidth:"1.2",strokeDasharray:r?"3 2":void 0}),t==="pill"&&d.jsx("rect",{x:"1",y:"3",width:"20",height:"10",rx:"5",fill:i,stroke:s,strokeWidth:"1.2"}),t==="diamond"&&d.jsx("path",{d:"M11 1 L20 8 L11 15 L2 8 Z",fill:i,stroke:s,strokeWidth:"1.2"}),t==="dot"&&d.jsx("circle",{cx:"11",cy:"8",r:"5",fill:s}),t==="bullseye"&&d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"8",r:"6",fill:"none",stroke:s,strokeWidth:"1.2"}),d.jsx("circle",{cx:"11",cy:"8",r:"3.4",fill:s})]}),t==="store"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M2 3 H20 M2 13 H20",stroke:s,strokeWidth:"1.2"}),d.jsx("rect",{x:"2",y:"3",width:"18",height:"10",fill:i})]}),t==="bar"&&d.jsx("rect",{x:"2",y:"6",width:"18",height:"4",rx:"2",fill:s})]}),d.jsx("span",{children:n})]})}function Vn({line:t,label:e,color:n="var(--poney-ink-3)",head:r=!0}){return d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,className:"poney-legend-mark",children:[d.jsx("line",{x1:"1",y1:"8",x2:r?15:21,y2:"8",stroke:n,strokeWidth:"1.4",strokeDasharray:t==="dashed"?"4 3":t==="dotted"?"1.4 3":void 0}),r&&d.jsx("path",{d:"M14 4.5 L21 8 L14 11.5 Z",fill:n})]}),d.jsx("span",{children:e})]})}function Uz(t){const[e,n]=bp(t.id),r=e.collapsed??t.collapsed;return{collapsed:r,toggle:i=>n({collapsed:r.includes(i)?r.filter(o=>o!==i):[...r,i]})}}function hu({x:t,y:e,open:n,label:r,onToggle:s}){return eD()?null:d.jsxs("g",{transform:`translate(${t} ${e})`,role:"button",tabIndex:0,"aria-label":`${n?"Close":"Open"} ${r}`,"aria-expanded":n,className:"poney-control","data-ref":"toggle",onClick:i=>{i.stopPropagation(),s()},onDoubleClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopPropagation(),s())},children:[d.jsx("rect",{width:26,height:26,rx:7,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)"}),d.jsx("g",{transform:"translate(5 5)",color:"var(--poney-ink-2)",children:n?d.jsx(u1,{width:16,height:16,strokeWidth:1.8}):d.jsx(f1,{width:16,height:16,strokeWidth:1.8})}),d.jsx("rect",{className:"poney-focus",x:-3,y:-3,width:32,height:32,rx:9,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2})]})}function Zz({scene:t,view:e}){var v,k;const n=fn(),r=Sn(),s=c1(),{subject:i,selection:o}=Ds(),{toggle:a}=Uz(e),l=n.doc.presentation.relationships,c=gc(12.5,11,26),f=gc(15,12,32),u=gc(11.5,10.5,26),h=b.useMemo(()=>{if(!i)return null;const w=new Set,j=new Set,C=new Map(t.nodes.map(E=>[E.id,E])),_=E=>t.nodes.filter(P=>Hz(P,E,C)).forEach(P=>w.add(P.id)),S=E=>{var P;return((P=t.nodes.find(z=>z.entityId===E))==null?void 0:P.id)??N(E)},N=E=>{var z;const P=t.anchors[`entity:${E}`];return P?(z=t.nodes.find(I=>I.x===P.x&&I.y===P.y&&I.w===P.w&&I.h===P.h))==null?void 0:z.id:void 0};if(i.kind==="entity"){const E=S(i.id);if(!E)return null;w.add(E),_(E);const P=new Set(w);for(const z of t.edges)(P.has(z.source)||P.has(z.target))&&(j.add(z.id),w.add(z.source),w.add(z.target))}else if(i.kind==="relationship"){const E=t.edges.find(P=>P.relationships.includes(i.id));if(!E)return null;j.add(E.id),w.add(E.source),w.add(E.target)}else if(i.kind==="group"&&i.view===e.id){const E=`g:${i.id}`;w.add(E),_(E);const P=new Set(w);for(const z of t.edges)(P.has(z.source)||P.has(z.target))&&j.add(z.id)}else return null;return{nodes:w,edges:j}},[i,t,e.id]),m=(o==null?void 0:o.kind)==="entity"?(v=t.nodes.find(w=>w.entityId===o.id))==null?void 0:v.id:(o==null?void 0:o.kind)==="group"?`g:${o.id}`:void 0,g=(o==null?void 0:o.kind)==="relationship"?(k=t.edges.find(w=>w.relationships.includes(o.id)))==null?void 0:k.id:void 0,p=w=>!!h&&!w.compound&&!h.nodes.has(w.id),x=t.nodes.filter(w=>w.compound),y=t.nodes.filter(w=>!w.compound);return d.jsxs("g",{children:[x.map(w=>{if(w.type==="group"){const _=e.groups.find(S=>S.id===w.groupId);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"group",view:e.id,id:_.id},`Group ${_.label}`),children:[d.jsx("rect",{width:w.w,height:w.h,rx:14,fill:"var(--poney-plaster)",fillOpacity:.55,stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("text",{x:16,y:12+c,fontSize:c,fontWeight:600,fill:"var(--poney-ink-2)",children:_.label}),d.jsx(hu,{x:w.w-36,y:7,open:!0,label:_.label,onToggle:()=>a(_.id)}),d.jsx(xn,{w:w.w,h:w.h,rx:14,selected:m===w.id})]},w.id)}const j=n.entities.get(w.entityId),C=n.style(j,e.id);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"entity",id:j.id},`${j.name}, ${C.label}, contains ${w.hiddenCount||"several"} parts`),children:[d.jsx("rect",{width:w.w,height:w.h,rx:18,fill:`color-mix(in srgb, ${dt(C.tone)} 4%, var(--poney-paper))`,stroke:"var(--poney-rule-strong)",strokeWidth:1.25}),d.jsx(lr,{name:C.icon,x:20,y:18,size:18,color:dt(C.tone)}),d.jsx("text",{x:46,y:f>15?16+f:32,fontSize:f,fontWeight:650,fill:"var(--poney-ink)",children:j.name}),f===15&&d.jsx("text",{x:20,y:48,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(j.summary,w.w-80,12)}),d.jsx(hu,{x:w.w-40,y:12,open:!0,label:j.name,onToggle:()=>a(j.id)}),d.jsx(xn,{w:w.w,h:w.h,rx:18,selected:m===w.id})]},w.id)}),t.edges.map(w=>{const j=n.relationships.get(w.relationships[0]),C=l[j.kind]??{pattern:"solid",head:"arrow"},_=h==null?void 0:h.edges.has(w.id),S=g===w.id,N=_||S?"var(--poney-accent)":"var(--poney-ink-4)",E=w.relationships.length>1?`${w.relationships.length} connections`:j.label;return d.jsx("g",{...r({kind:"relationship",id:w.relationships[0]},`${n.describe({kind:"relationship",id:j.id}).title}: ${E}`),className:`poney-el ${h&&!_?"poney-dim":""}`,children:d.jsx(Cp,{points:w.points,style:{color:N,width:_||S?1.9:1.3,dash:C.pattern==="dashed"?"6 4":C.pattern==="dotted"?"1.5 4":void 0,head:C.head,flowing:S&&(j.kind==="publishes"||j.kind==="subscribes")}})},w.id)}),y.map(w=>{if(w.type==="group"){const S=e.groups.find(N=>N.id===w.groupId);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"group",view:e.id,id:S.id},`Group ${S.label}, closed`),className:`poney-el ${p(w)?"poney-dim":""}`,children:[d.jsx("rect",{x:6,y:-6,width:w.w,height:w.h,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)"}),d.jsx("rect",{width:w.w,height:w.h,rx:12,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("text",{x:16,y:30,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:S.label}),d.jsxs("text",{x:16,y:50,fontSize:12,fill:"var(--poney-ink-3)",children:[w.hiddenCount," parts inside"]}),S.description&&s>.55&&d.jsx("text",{x:16,y:74,fontSize:12,fill:"var(--poney-ink-2)",children:Nt(S.description,w.w-32,12)}),d.jsx(hu,{x:w.w-36,y:10,open:!1,label:S.label,onToggle:()=>a(S.id)}),d.jsx(xn,{w:w.w,h:w.h,selected:m===w.id})]},w.id)}const j=n.entities.get(w.entityId),C=n.style(j,e.id),_=w.collapsed?{...C,shape:"frame"}:C;return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"entity",id:j.id},`${j.name}, ${C.label}. ${j.summary}`),className:`poney-el ${p(w)?"poney-dim":""}`,children:[d.jsx(_p,{entity:j,style:_,w:w.w,h:w.h,emphasis:m===w.id?"selected":"normal",detail:s>.55,footer:w.collapsed?`${w.hiddenCount} parts inside`:void 0}),w.collapsed&&d.jsx(hu,{x:w.w-40,y:12,open:!1,label:j.name,onToggle:()=>a(j.id)})]},w.id)}),t.edges.filter(w=>(h==null?void 0:h.edges.has(w.id))||g===w.id).map(w=>{const j=n.relationships.get(w.relationships[0]),C=w.relationships.length>1;return d.jsx(Wz,{at:bR(w.points),text:C?`${w.relationships.length} connections`:j.label,secondary:C?void 0:j.protocol,tone:"var(--poney-accent)",strong:g===w.id,size:u},`l-${w.id}`)})]})}function Hz(t,e,n){var s;let r=t.parent;for(;r;){if(r===e)return!0;r=(s=n.get(r))==null?void 0:s.parent}return!1}function qz({view:t}){const e=fn(),n=[...new Set(t.entities.map(r=>{var s;return(s=e.entities.get(r))==null?void 0:s.kind}).filter(Boolean))];return d.jsxs("div",{className:"poney-legend",children:[n.map(r=>{const s=e.doc.presentation.kinds[r];return s?d.jsx(Kt,{shape:s.shape,tone:s.tone,label:s.label,dashed:r==="external"},r):null}),d.jsx(Vn,{line:"solid",label:"Request and response"}),d.jsx(Vn,{line:"dashed",label:"Event, sent and forgotten"})]})}const Kz={key:"architecture",label:"Architecture",icon:ZD,howToRead:"Boxes are the running parts of the system; lines show who calls whom. Select a part to see what it talks to. Open or close a group with its corner button.",Renderer:Zz,Legend:qz};function Jz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.interactionId,o=e.messages(i),a=b.useMemo(()=>{if(!r)return null;const u=new Set,h=new Set,m=g=>{var x;const p=(x=o.find(y=>y.message.id===g))==null?void 0:x.message;p&&(u.add(g),h.add(p.from),h.add(p.to))};if(r.kind==="entity"){if(!t.participants.some(g=>g.entityId===r.id))return null;h.add(r.id),o.forEach(g=>(g.message.from===r.id||g.message.to===r.id)&&u.add(g.message.id))}else if(r.kind==="message"&&r.behavior===i)m(r.id);else if(r.kind==="fragment"&&r.behavior===i)o.forEach(g=>g.context.some(p=>p.fragment.id===r.id)&&m(g.message.id));else if(r.kind==="relationship")o.forEach(g=>g.message.relationship===r.id&&m(g.message.id));else if(r.kind==="dataType")o.forEach(g=>g.message.data.includes(r.id)&&m(g.message.id));else return null;return u.size||h.size?{msgs:u,people:h}:null},[r,o,t.participants,i]),l=(s==null?void 0:s.kind)==="message"&&s.behavior===i?s.id:void 0,c=(s==null?void 0:s.kind)==="fragment"&&s.behavior===i?s.id:void 0,f=(s==null?void 0:s.kind)==="entity"?s.id:void 0;return d.jsxs("g",{children:[t.fragments.map(u=>{const h=(a==null?void 0:a.msgs.size)&&o.some(m=>a.msgs.has(m.message.id)&&m.context.some(g=>g.fragment.id===u.id));return d.jsx("rect",{x:u.x,y:u.y,width:u.w,height:u.h,rx:10,fill:"var(--poney-paper)",fillOpacity:.5,stroke:c===u.id?"var(--poney-accent)":h?"var(--poney-ink-4)":"var(--poney-rule-strong)",strokeWidth:c===u.id?1.6:1},`bg-${u.id}`)}),t.participants.map(u=>{const h=a==null?void 0:a.people.has(u.entityId);return d.jsx("line",{x1:u.x,x2:u.x,y1:u.lifeline.y1,y2:u.lifeline.y2,stroke:h&&(r==null?void 0:r.kind)==="entity"?"var(--poney-accent)":"var(--poney-ink-4)",strokeOpacity:h?.8:1,strokeWidth:h&&(r==null?void 0:r.kind)==="entity"?1.6:1,strokeDasharray:"4 5",className:a&&!h?"poney-dim":""},`l-${u.entityId}`)}),t.activations.map((u,h)=>{const m=e.style(u.entityId);return d.jsx("rect",{x:u.x,y:u.y1,width:10,height:u.y2-u.y1,rx:2,fill:mn(m.tone,18),stroke:dt(m.tone),strokeWidth:1,className:a&&!a.people.has(u.entityId)?"poney-dim":""},h)}),t.messages.map(u=>{var _,S;const h=a==null?void 0:a.msgs.has(u.id),m=l===u.id,g=m||h&&(r==null?void 0:r.kind)!=="entity"?"var(--poney-accent)":h?"var(--poney-ink)":"var(--poney-ink-2)",p=u.kind==="return"?"5 4":void 0,x=u.kind==="call"?"arrow":"open-arrow",y=Oe(u.label,12.5,500),v=(N,E)=>d.jsxs("g",{children:[d.jsx("circle",{cx:N,cy:E,r:9,fill:m?"var(--poney-accent)":"var(--poney-paper-raised)",stroke:m?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:N,y:E+3.5,textAnchor:"middle",fontSize:10,fontWeight:650,fill:m?"var(--poney-paper)":"var(--poney-ink-2)",className:"poney-numbers",children:u.number})]}),k=`Step ${u.number}: ${(_=e.entities.get(u.from))==null?void 0:_.name} to ${(S=e.entities.get(u.to))==null?void 0:S.name}, ${u.label}`;if(u.loop){const{x:N,y1:E,y2:P,w:z}=u.loop;return d.jsxs("g",{...n({kind:"message",behavior:i,id:u.id},k),className:`poney-el ${a&&!h?"poney-dim":""}`,children:[d.jsx("rect",{x:N-4,y:E-16,width:z+y+60,height:P-E+24,fill:"transparent"}),d.jsx("path",{d:`M ${N} ${E} H ${N+z} V ${P} H ${N+6}`,fill:"none",stroke:g,strokeWidth:m?1.8:1.3,strokeLinejoin:"round"}),d.jsx(Ha,{at:{x:N+2,y:P},angle:Math.PI,kind:"arrow",color:g}),v(N+z+18,(E+P)/2),d.jsx("text",{x:N+z+32,y:(E+P)/2+4.5,fontSize:12.5,fontWeight:m?650:500,fill:m?"var(--poney-accent)":"var(--poney-ink)",children:u.label}),m&&d.jsx("rect",{x:N-6,y:E-14,width:z+y+64,height:P-E+22,rx:8,fill:"var(--poney-accent-wash)"})]},u.id)}const w=u.x2>u.x1,j=(u.x1+u.x2)/2,C=y+26;return d.jsxs("g",{...n({kind:"message",behavior:i,id:u.id},k),className:`poney-el ${a&&!h?"poney-dim":""}`,children:[d.jsx("rect",{x:Math.min(u.x1,u.x2),y:u.y-22,width:Math.abs(u.x2-u.x1),height:30,fill:m?"var(--poney-accent-wash)":"transparent",rx:6}),d.jsx("line",{x1:u.x1,x2:u.x2+(w?-6:6),y1:u.y,y2:u.y,stroke:g,strokeWidth:m?1.8:1.3,strokeDasharray:p}),d.jsx(Ha,{at:{x:u.x2,y:u.y},angle:w?0:Math.PI,kind:x,color:g}),v(j-C/2+9,u.y-12),d.jsx("text",{x:j-C/2+24,y:u.y-7.5,fontSize:12.5,fontWeight:m?650:500,fill:m?"var(--poney-accent)":u.kind==="return"?"var(--poney-ink-2)":"var(--poney-ink)",children:u.label})]},u.id)}),[...t.fragments].sort((u,h)=>u.depth-h.depth).map(u=>{var p;const h=_d(u.kind),m=Oe(h,11.5,650)+20,g=(p=u.branches[0])==null?void 0:p.guard;return d.jsxs("g",{children:[d.jsxs("g",{...n({kind:"fragment",behavior:i,id:u.id},`${h}: ${u.branches.map(x=>x.guard).join(", or ")}`),children:[d.jsx("path",{d:`M ${u.x} ${u.y+24} V ${u.y+10} Q ${u.x} ${u.y} ${u.x+10} ${u.y} H ${u.x+m} V ${u.y+16} L ${u.x+m-8} ${u.y+24} Z`,fill:c===u.id?"var(--poney-accent)":"var(--poney-ink-2)"}),d.jsx("text",{x:u.x+10,y:u.y+16,fontSize:11.5,fontWeight:650,fill:"var(--poney-paper)",children:h}),d.jsx("rect",{x:u.x+m+4,y:u.y+3,width:Oe(u.kind==="loop"||u.kind==="opt"?g:`If ${g}`,12,500)+12,height:18,rx:4,fill:"var(--poney-plaster)"}),d.jsx("text",{x:u.x+m+10,y:u.y+16,fontSize:12,fontWeight:500,fill:"var(--poney-ink-2)",children:u.kind==="loop"||u.kind==="opt"?g:`If ${g}`})]}),u.branches.slice(1).map((x,y)=>d.jsxs("g",{children:[d.jsx("line",{x1:u.x,x2:u.x+u.w,y1:x.y,y2:x.y,stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("rect",{x:u.x+6,y:x.y+4,width:Oe(u.kind==="par"?`And ${x.guard}`:`Else, if ${x.guard}`,12,500)+12,height:18,rx:4,fill:"var(--poney-plaster)"}),d.jsx("text",{x:u.x+12,y:x.y+17,fontSize:12,fontWeight:500,fill:"var(--poney-ink-2)",children:u.kind==="par"?`And ${x.guard}`:`Else, if ${x.guard}`})]},y))]},u.id)}),t.participants.map(u=>{const h=e.entities.get(u.entityId),m=e.style(h),g=a==null?void 0:a.people.has(u.entityId),{x:p,y:x,w:y,h:v}=u.header;return d.jsxs("g",{transform:`translate(${p} ${x})`,...n({kind:"entity",id:h.id},`${h.name}, ${m.label}`),className:`poney-el ${a&&!g?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:y,height:v,rx:12,fill:"var(--poney-paper-raised)",stroke:g?dt(m.tone):"var(--poney-rule-strong)",strokeDasharray:h.kind==="external"?"6 4":void 0}),d.jsx("rect",{x:12,y:(v-32)/2,width:32,height:32,rx:9,fill:mn(m.tone,14)}),d.jsx(lr,{name:m.icon,x:19.5,y:(v-32)/2+7.5,size:17,color:dt(m.tone)}),d.jsx("text",{x:54,y:v/2-2,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:Nt(h.name,y-64,14,650)}),d.jsx("text",{x:54,y:v/2+14,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(h.technology??m.label,y-64,11.5)}),d.jsx(xn,{w:y,h:v,selected:f===h.id})]},u.entityId)})]})}function Gz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Vn,{line:"solid",label:"Request: the sender waits",color:"var(--poney-ink-2)"}),d.jsx(Vn,{line:"dashed",label:"Answer to a request",color:"var(--poney-ink-2)"}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsx("svg",{width:"22",height:"16","aria-hidden":!0,children:d.jsx("rect",{x:"7",y:"1",width:"8",height:"14",rx:"2",fill:"var(--poney-sunken)",stroke:"var(--poney-lapis)"})}),"Busy: handling a request"]}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,children:[d.jsx("rect",{x:"1",y:"2",width:"20",height:"12",rx:"3",fill:"none",stroke:"var(--poney-rule-strong)"}),d.jsx("rect",{x:"1",y:"2",width:"9",height:"5",rx:"1.5",fill:"var(--poney-ink-2)"})]}),"Condition, loop or parallel paths"]})]})}const Yz={key:"sequence",label:"Sequence",icon:LD,howToRead:"Time runs down the page. Each column is a participant; arrows are the messages between them, numbered in order. Boxes mark steps that happen only under a condition, repeat, or run in parallel.",Renderer:Jz,Legend:Gz,initialView:"start"};function Qz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=b.useMemo(()=>{if(!r)return null;const l=new Set,c=new Set,f=u=>{c.add(u.id),l.add(u.source),l.add(u.target)};if(r.kind==="entity"){if(!t.nodes.some(u=>u.entityId===r.id))return null;l.add(r.id),t.edges.forEach(u=>(u.source===r.id||u.target===r.id)&&f(u))}else if(r.kind==="dataFlow"||r.kind==="relationship")t.edges.forEach(u=>{var h;return(u.id===r.id||((h=e.dataFlows.get(u.id))==null?void 0:h.via)===r.id)&&f(u)});else if(r.kind==="dataType")t.edges.forEach(u=>u.data.includes(r.id)&&f(u));else return null;return c.size||l.size?{nodes:l,edges:c}:null},[r,t,e]),o=(s==null?void 0:s.kind)==="dataFlow"||(s==null?void 0:s.kind)==="relationship"?s.id:void 0,a=(s==null?void 0:s.kind)==="entity"?s.id:void 0;return d.jsxs("g",{children:[t.edges.map(l=>{const c=i==null?void 0:i.edges.has(l.id),f=o===l.id,u=l.control?{kind:"relationship",id:l.id}:{kind:"dataFlow",id:l.id},h=f||c?"var(--poney-accent)":l.control?"var(--poney-ink-4)":"var(--poney-ink-2)";return d.jsx("g",{...n(u,e.describe(u).title),className:`poney-el ${i&&!c?"poney-dim":""}`,children:d.jsx(Cp,{points:l.points,style:{color:h,width:l.control?1:f||c?2:1.6,dash:l.control?"1.5 4":void 0,head:l.control?"open-arrow":"arrow",flowing:!l.control&&(f||c)}})},l.id)}),t.nodes.map(l=>{const c=e.entities.get(l.entityId),f=e.style(c),u=dt(f.tone),h=i&&!i.nodes.has(l.entityId),{w:m,h:g}=l;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"entity",id:c.id},`${c.name}, ${l.role}`),className:`poney-el ${h?"poney-dim":""}`,children:[l.role==="process"&&d.jsx("rect",{className:"poney-body",width:m,height:g,rx:g/2,fill:"var(--poney-paper-raised)",stroke:u,strokeWidth:1.3}),l.role==="terminator"&&d.jsx("rect",{className:"poney-body",width:m,height:g,rx:4,fill:mn(f.tone,10),stroke:u,strokeWidth:1.3}),l.role==="store"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{width:m,height:g,fill:mn(f.tone,10)}),d.jsx("line",{x1:0,x2:m,y1:.5,y2:.5,stroke:u,strokeWidth:1.5}),d.jsx("line",{x1:0,x2:m,y1:g-.5,y2:g-.5,stroke:u,strokeWidth:1.5}),d.jsx("line",{x1:34,x2:34,y1:0,y2:g,stroke:u,strokeWidth:1})]}),d.jsx(lr,{name:f.icon,x:l.role==="store"?9:l.role==="process"?20:14,y:g/2-8,size:16,color:u}),d.jsx("text",{x:l.role==="store"?46:l.role==="process"?44:38,y:g/2+(l.role==="store"?4.5:-1),fontSize:13.5,fontWeight:650,fill:"var(--poney-ink)",children:Nt(c.name,m-60,13.5,650)}),l.role!=="store"&&d.jsx("text",{x:l.role==="process"?44:38,y:g/2+15,fontSize:11.5,fill:"var(--poney-ink-3)",children:l.role==="process"?"Process":f.label}),d.jsx(xn,{w:m,h:g,rx:l.role==="process"?g/2:4,selected:a===c.id})]},l.id)}),t.edges.map(l=>{if(!l.label)return null;const c=(i==null?void 0:i.edges.has(l.id))||o===l.id,{x:f,y:u,w:h,h:m}=l.label;return d.jsxs("g",{transform:`translate(${f} ${u})`,className:i&&!c?"poney-dim":"",pointerEvents:"none",children:[d.jsx("rect",{width:h,height:m,rx:m/2,fill:"var(--poney-paper-raised)",stroke:c?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("circle",{cx:11,cy:m/2,r:3,fill:c?"var(--poney-accent)":"var(--poney-malachite)"}),d.jsx("text",{x:19,y:m/2+4,fontSize:11.5,fontWeight:c?650:500,fill:c?"var(--poney-accent)":"var(--poney-ink-2)",children:l.label.text})]},`l-${l.id}`)})]})}function Xz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"card",tone:"umber",label:"Outside the system: people and providers"}),d.jsx(Kt,{shape:"pill",tone:"lapis",label:"Process: code that changes data"}),d.jsx(Kt,{shape:"store",tone:"malachite",label:"Store: where data rests"}),d.jsx(Vn,{line:"solid",label:"Data moving, with what it carries",color:"var(--poney-ink-2)"}),d.jsx(Vn,{line:"dotted",label:"Control only: a call with no data shown",color:"var(--poney-ink-4)"})]})}const eL={key:"dataflow",label:"Data flow",icon:h$,howToRead:"Arrows follow the data, not the calls: each one says what moves and in which direction. Select a flow to see its fields.",Renderer:Qz,Legend:Xz};function tL({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.processId,o=b.useMemo(()=>{if(!r)return null;const l=new Set,c=new Set;if(r.kind==="activityNode"&&r.behavior===i)l.add(r.id),t.edges.forEach(f=>{(f.from===r.id||f.to===r.id)&&(c.add(f.id),l.add(f.from),l.add(f.to))});else if(r.kind==="activityFlow"&&r.behavior===i){const f=t.edges.find(u=>u.id===r.id);if(!f)return null;c.add(f.id),l.add(f.from),l.add(f.to)}else if(r.kind==="entity"){const f=t.lanes.findIndex(u=>u.entityId===r.id);if(f<0)return null;t.nodes.forEach(u=>u.lane===f&&l.add(u.id)),t.edges.forEach(u=>l.has(u.from)&&l.has(u.to)&&c.add(u.id))}else return null;return{nodes:l,edges:c}},[r,t,i]),a=(l,c)=>(s==null?void 0:s.kind)===l&&s.behavior===i&&s.id===c;return d.jsxs("g",{children:[t.lanes.map((l,c)=>{const f=l.entityId?e.entities.get(l.entityId):void 0,u=f?e.style(f):void 0,h=(r==null?void 0:r.kind)==="entity"&&r.id===l.entityId;return d.jsxs("g",{children:[d.jsx("rect",{x:l.x,y:0,width:l.w,height:t.height,fill:c%2?"var(--poney-paper)":"transparent",fillOpacity:.45}),c>0&&d.jsx("line",{x1:l.x,x2:l.x,y1:0,y2:t.height,stroke:"var(--poney-rule)"}),d.jsxs("g",{...f?n({kind:"entity",id:f.id},`Lane: ${f.name}`):{},children:[d.jsx("rect",{x:l.x+8,y:8,width:l.w-16,height:t.laneHeader-16,rx:8,fill:h?"var(--poney-accent-wash)":"var(--poney-paper-raised)",stroke:h?"var(--poney-accent)":"var(--poney-rule)"}),u&&d.jsx(lr,{name:u.icon,x:l.x+l.w/2-Oe(l.label,13,650)/2-12,y:t.laneHeader/2-7,size:14,color:dt(u.tone)}),d.jsx("text",{x:l.x+l.w/2+(u?9:0),y:t.laneHeader/2+4.5,textAnchor:"middle",fontSize:13,fontWeight:650,fill:"var(--poney-ink)",children:l.label})]})]},c)}),t.edges.map(l=>{const c=(o==null?void 0:o.edges.has(l.id))||a("activityFlow",l.id),f=c?"var(--poney-accent)":"var(--poney-ink-3)";return d.jsxs("g",{...n({kind:"activityFlow",behavior:i,id:l.id},e.describe({kind:"activityFlow",behavior:i,id:l.id}).title),className:`poney-el ${o&&!c?"poney-dim":""}`,children:[d.jsx(Cp,{points:l.points,style:{color:f,width:c?1.9:1.3,head:"arrow",dash:l.back?"6 4":void 0}}),l.guard&&l.guardAt&&d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{x:l.guardAt.anchor==="end"?l.guardAt.x-Oe(l.guard,11.5,650)-12:l.guardAt.x-2,y:l.guardAt.y-11,width:Oe(l.guard,11.5,650)+14,height:19,rx:9.5,fill:"var(--poney-plaster)",stroke:c?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:l.guardAt.anchor==="end"?l.guardAt.x-5:l.guardAt.x+5,y:l.guardAt.y+2.5,textAnchor:l.guardAt.anchor==="end"?"end":"start",fontSize:11.5,fontWeight:650,fill:c?"var(--poney-accent)":"var(--poney-ink-2)",children:l.guard})]})]},l.id)}),t.nodes.map(l=>{const c=o&&!o.nodes.has(l.id),f=a("activityNode",l.id),u={kind:"activityNode",behavior:i,id:l.id},h=`${e.describe(u).kind}: ${l.label}`,{x:m,y:g,w:p,h:x}=l,y=l.outcome==="failure"?"var(--poney-failure)":l.outcome==="success"?"var(--poney-success)":"var(--poney-ink)";let v;switch(l.kind){case"initial":v=d.jsx("circle",{cx:p/2,cy:x/2,r:p/2,fill:"var(--poney-ink)"});break;case"final":v=d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:p/2,cy:x/2,r:p/2,fill:"var(--poney-paper-raised)",stroke:y,strokeWidth:1.6}),d.jsx("circle",{cx:p/2,cy:x/2,r:p/2-5.5,fill:y}),d.jsx("text",{x:p/2,y:x+17,textAnchor:"middle",fontSize:12.5,fontWeight:650,fill:y,children:l.label})]});break;case"fork":case"join":v=d.jsx("rect",{width:p,height:x,rx:3,fill:"var(--poney-ink)"});break;case"decision":case"merge":v=d.jsxs(d.Fragment,{children:[d.jsx("path",{className:"poney-body",d:`M ${p/2} 0 L ${p} ${x/2} L ${p/2} ${x} L 0 ${x/2} Z`,fill:"var(--poney-paper-raised)",stroke:"var(--poney-ochre)",strokeWidth:1.4,strokeLinejoin:"round"}),d.jsx("text",{x:p/2,y:x/2+4.5,textAnchor:"middle",fontSize:12.5,fontWeight:650,fill:"var(--poney-ink)",children:l.label})]});break;default:v=d.jsxs(d.Fragment,{children:[d.jsx("rect",{className:"poney-body",width:p,height:x,rx:10,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)",strokeWidth:1.1}),l.lines.map((w,j)=>d.jsx("text",{x:p/2,y:x/2+4.5+(j-(l.lines.length-1)/2)*16,textAnchor:"middle",fontSize:13,fontWeight:500,fill:"var(--poney-ink)",children:w},j))]})}const k=l.kind==="fork"||l.kind==="join"?6:0;return d.jsxs("g",{transform:`translate(${m} ${g})`,...n(u,h),className:`poney-el ${c?"poney-dim":""}`,children:[k>0&&d.jsx("rect",{x:0,y:-k,width:p,height:x+k*2,fill:"transparent"}),v,d.jsx(xn,{w:p,h:x,rx:l.kind==="initial"||l.kind==="final"?p/2:10,selected:f})]},l.id)})]})}function nL(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"dot",tone:"ink",label:"Start"}),d.jsx(Kt,{shape:"card",tone:"slate",label:"Action"}),d.jsx(Kt,{shape:"diamond",tone:"ochre",label:"Decision: one way out per answer"}),d.jsx(Kt,{shape:"bar",tone:"ink",label:"Split into, or join, parallel paths"}),d.jsx(Kt,{shape:"bullseye",tone:"success",label:"End, in success"}),d.jsx(Kt,{shape:"bullseye",tone:"failure",label:"End, in failure"})]})}const rL={key:"activity",label:"Activity",icon:WN,howToRead:"Follow the arrows from the black dot. Each column is who does the step. Diamonds ask a question; dashed arrows go back to an earlier step.",Renderer:tL,Legend:nL};function Vy({p:t,d:e,card:n,color:r}){const s={x:-e.y,y:e.x},i=(c,f=0)=>({x:t.x-e.x*c+s.x*f,y:t.y-e.y*c+s.y*f}),o=c=>{const f=i(c,6),u=i(c,-6);return d.jsx("line",{x1:f.x,y1:f.y,x2:u.x,y2:u.y,stroke:r,strokeWidth:1.4})},a=c=>{const f=i(c);return d.jsx("circle",{cx:f.x,cy:f.y,r:4,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.3})},l=()=>{const c=i(13);return d.jsx(d.Fragment,{children:[-6.5,0,6.5].map(f=>{const u=i(0,f);return d.jsx("line",{x1:c.x,y1:c.y,x2:u.x,y2:u.y,stroke:r,strokeWidth:1.3},f)})})};return d.jsxs("g",{children:[n==="exactly-one"&&d.jsxs(d.Fragment,{children:[o(6),o(11)]}),n==="zero-or-one"&&d.jsxs(d.Fragment,{children:[o(6),a(15)]}),n==="zero-or-many"&&d.jsxs(d.Fragment,{children:[l(),a(18)]}),n==="one-or-many"&&d.jsxs(d.Fragment,{children:[l(),o(17)]})]})}const $w=(t,e)=>{const n=Math.hypot(e.x-t.x,e.y-t.y)||1;return{x:(e.x-t.x)/n,y:(e.y-t.y)/n}};function sL({scene:t,view:e}){const n=fn(),r=Sn(),{subject:s,selection:i}=Ds(),[o,a]=bp(e.id),l=o.expandedTables??[],c=b.useMemo(()=>{if(!s)return null;const u=new Set,h=new Set,m=new Set;if(s.kind==="dataType"){if(!t.tables.some(g=>g.dataTypeId===s.id))return null;u.add(s.id);for(const g of t.relations)if(!(g.from!==s.id&&g.to!==s.id)){if(s.field){const x=t.tables.find(v=>v.dataTypeId===s.id).rows.find(v=>v.name===s.field);if(!(g.via===s.field||(x==null?void 0:x.primaryKey)&&g.from===s.id))continue;m.add(`${g.from}#${g.from===s.id?s.field:g.via}`),m.add(`${g.to}#${g.to===s.id?s.field:g.via}`)}h.add(g.id),u.add(g.from),u.add(g.to)}s.field&&m.add(`${s.id}#${s.field}`)}else if(s.kind==="dataRelation"){const g=t.relations.find(p=>p.id===s.id);if(!g)return null;h.add(g.id),u.add(g.from),u.add(g.to),g.via&&(m.add(`${g.to}#${g.via}`),m.add(`${g.from}#${g.via}`))}else if(s.kind==="entity"){if(t.tables.forEach(g=>g.store===s.id&&u.add(g.dataTypeId)),!u.size)return null;t.relations.forEach(g=>u.has(g.from)&&u.has(g.to)&&h.add(g.id))}else return null;return{tables:u,rels:h,rows:m}},[s,t]),f=u=>a({expandedTables:l.includes(u)?l.filter(h=>h!==u):[...l,u]});return d.jsxs("g",{children:[t.stores.map(u=>{const h=n.entities.get(u.entityId),m=n.style(h),g=(i==null?void 0:i.kind)==="entity"&&i.id===h.id;return d.jsxs("g",{children:[d.jsx("rect",{x:u.x,y:u.y,width:u.w,height:u.h,rx:16,fill:mn(m.tone,5),stroke:"var(--poney-rule-strong)"}),d.jsxs("g",{transform:`translate(${u.x} ${u.y})`,...r({kind:"entity",id:h.id},`${h.name}, ${h.technology??"database"}`),children:[d.jsx("rect",{x:10,y:8,width:Math.min(u.w-20,320),height:26,rx:7,fill:"transparent"}),d.jsx(lr,{name:m.icon,x:18,y:13,size:15,color:dt(m.tone)}),d.jsx("text",{x:40,y:25,fontSize:12.5,fontWeight:650,fill:"var(--poney-ink)",children:h.name}),d.jsx("text",{x:50+Oe(h.name,12.5,650),y:25,fontSize:11.5,fill:"var(--poney-ink-3)",children:h.technology}),g&&d.jsx("rect",{x:6,y:4,width:Math.min(u.w-12,330),height:34,rx:9,fill:"none",stroke:"var(--poney-accent)",strokeWidth:1.5})]})]},u.entityId)}),t.relations.map(u=>{const h=c==null?void 0:c.rels.has(u.id),m=(i==null?void 0:i.kind)==="dataRelation"&&i.id===u.id,g=h||m?"var(--poney-accent)":"var(--poney-ink-3)",p=u.points,x=p.length;return d.jsxs("g",{...r({kind:"dataRelation",id:u.id},n.describe({kind:"dataRelation",id:u.id}).title),className:`poney-el ${c&&!h?"poney-dim":""}`,children:[d.jsx("path",{d:ko(p,8),fill:"none",stroke:"transparent",strokeWidth:14}),d.jsx("path",{d:ko(p,8),fill:"none",stroke:g,strokeWidth:h||m?1.8:1.2,strokeDasharray:u.logical?"6 4":void 0,className:"poney-edge"}),d.jsx(Vy,{p:p[0],d:$w(p[1],p[0]),card:u.fromCardinality,color:g}),d.jsx(Vy,{p:p[x-1],d:$w(p[x-2],p[x-1]),card:u.toCardinality,color:g})]},u.id)}),t.tables.map(u=>{const h=n.dataTypes.get(u.dataTypeId),m=c&&!c.tables.has(u.dataTypeId),g=(i==null?void 0:i.kind)==="dataType"&&i.id===u.dataTypeId&&!i.field,p=h.storedIn?n.style(h.storedIn).tone:"malachite";return d.jsxs("g",{transform:`translate(${u.x} ${u.y})`,className:`poney-fade ${m?"poney-dim":""}`,children:[d.jsx("rect",{width:u.w,height:u.h,rx:10,fill:"var(--poney-paper-raised)",stroke:c!=null&&c.tables.has(u.dataTypeId)&&(s==null?void 0:s.kind)==="dataType"&&s.id===u.dataTypeId?dt(p):"var(--poney-rule-strong)"}),d.jsxs("g",{...r({kind:"dataType",id:u.dataTypeId},`Table ${u.name}, ${h.fields.length} fields`),children:[d.jsx("path",{d:`M 0 10 Q 0 0 10 0 H ${u.w-10} Q ${u.w} 0 ${u.w} 10 V ${at.header} H 0 Z`,fill:mn(p,9)}),d.jsx("line",{x1:0,x2:u.w,y1:at.header,y2:at.header,stroke:"var(--poney-rule)"}),d.jsx("g",{transform:"translate(13 12)",color:dt(p),children:d.jsx(Td,{width:16,height:16,strokeWidth:1.8})}),d.jsx("text",{x:38,y:25,fontSize:13.5,fontWeight:650,fontFamily:"var(--poney-font-mono)",fill:"var(--poney-ink)",children:u.name}),d.jsxs("text",{x:u.w-12,y:25,textAnchor:"end",fontSize:11,fill:"var(--poney-ink-3)",className:"poney-numbers",children:[h.fields.length," fields"]})]}),u.rows.map(x=>{const y=x.y-u.y,v=c==null?void 0:c.rows.has(`${u.dataTypeId}#${x.name}`),k=(i==null?void 0:i.kind)==="dataType"&&i.id===u.dataTypeId&&i.field===x.name;return d.jsxs("g",{...r({kind:"dataType",id:u.dataTypeId,field:x.name},`Field ${x.name}, ${x.type}${x.primaryKey?", primary key":""}${x.foreign?", foreign key":""}`),children:[d.jsx("rect",{x:1,y,width:u.w-2,height:at.row,fill:k?"var(--poney-accent-wash)":v?mn(p,10):"transparent",className:"poney-row"}),x.primaryKey&&d.jsx("g",{transform:`translate(13 ${y+6})`,color:"var(--poney-ochre)",children:d.jsx(g1,{width:13,height:13,strokeWidth:2})}),!x.primaryKey&&x.foreign&&d.jsx("g",{transform:`translate(13 ${y+6})`,color:"var(--poney-lapis)",children:d.jsx(co,{width:13,height:13,strokeWidth:2})}),d.jsx("text",{x:38,y:y+17,fontSize:12.5,fontFamily:"var(--poney-font-mono)",fontWeight:x.primaryKey?600:450,fill:k?"var(--poney-accent)":"var(--poney-ink)",children:x.name}),d.jsxs("text",{x:u.w-12,y:y+17,textAnchor:"end",fontSize:11.5,fontFamily:"var(--poney-font-mono)",fill:"var(--poney-ink-3)",children:[Nt(x.type,u.w/2-20,11.5,400,"mono"),x.nullable?"?":""]})]},x.name)}),(u.hiddenCount>0||u.expanded)&&d.jsxs("g",{role:"button",tabIndex:0,"data-ref":"toggle","aria-label":u.expanded?`Show fewer fields of ${u.name}`:`Show ${u.hiddenCount} more fields of ${u.name}`,className:"poney-control",onClick:x=>{x.stopPropagation(),f(u.dataTypeId)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),f(u.dataTypeId))},children:[d.jsx("rect",{x:1,y:u.h-at.more-at.bottom,width:u.w-2,height:at.more,fill:"transparent"}),d.jsx("line",{x1:0,x2:u.w,y1:u.h-at.more-at.bottom,y2:u.h-at.more-at.bottom,stroke:"var(--poney-rule)"}),d.jsx("text",{x:u.w/2,y:u.h-at.bottom-10,textAnchor:"middle",fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-2)",children:u.expanded?"Show fewer fields":`Show ${u.hiddenCount} more field${u.hiddenCount===1?"":"s"}`}),d.jsx("rect",{className:"poney-focus",x:4,y:u.h-at.more-at.bottom+2,width:u.w-8,height:at.more-4,rx:6,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2})]}),d.jsx(xn,{w:u.w,h:u.h,rx:10,selected:g})]},u.dataTypeId)})]})}function iL(){const t=(e,n)=>d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"30",height:"16","aria-hidden":!0,children:[d.jsx("line",{x1:"0",y1:"8",x2:"28",y2:"8",stroke:"var(--poney-ink-3)",strokeWidth:"1.2"}),d.jsx(Vy,{p:{x:28,y:8},d:{x:1,y:0},card:e,color:"var(--poney-ink-2)"})]}),n]});return d.jsxs("div",{className:"poney-legend",children:[t("exactly-one","Exactly one"),t("zero-or-one","Zero or one"),t("one-or-many","One or more"),t("zero-or-many","Zero or many"),d.jsx(Vn,{line:"dashed",label:"Across databases, kept by code",head:!1}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsx(g1,{size:13,style:{margin:"0 4px",color:"var(--poney-ochre)"}})," Primary key",d.jsx(co,{size:13,style:{marginLeft:8,color:"var(--poney-lapis)"}})," Reference"]})]})}const oL={key:"erd",label:"Entity relationships",icon:Td,howToRead:"Each box is a table; the symbols at the line ends say how many rows can be on each side. Tables show their keys first. Select a field to see what it links to.",Renderer:sL,Legend:iL};function aL({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.machineId,o=e.stateMachine(i),a=b.useMemo(()=>{if(!r)return null;const c=new Set,f=new Set,u=h=>{h&&(f.add(h.id),c.add(h.from),c.add(h.to))};if(r.kind==="state"&&r.behavior===i)c.add(r.id),t.transitions.forEach(h=>(h.from===r.id||h.to===r.id)&&u(h));else if(r.kind==="transition"&&r.behavior===i)u(t.transitions.find(h=>h.id===r.id));else if(r.kind==="entity")o.transitions.forEach(h=>h.triggeredBy===r.id&&u(t.transitions.find(m=>m.id===h.id)));else return null;return f.size||c.size?{states:c,trans:f}:null},[r,t,i,o]),l=(c,f)=>(s==null?void 0:s.kind)===c&&s.behavior===i&&s.id===f;return d.jsxs("g",{children:[t.transitions.map(c=>{const f=(a==null?void 0:a.trans.has(c.id))||l("transition",c.id),u=f?"var(--poney-accent)":"var(--poney-ink-3)";return d.jsxs("g",{...n({kind:"transition",behavior:i,id:c.id},`Transition: ${c.event}${c.guard?`, when ${c.guard}`:""}`),className:`poney-el ${a&&!f?"poney-dim":""}`,children:[d.jsx(Cp,{points:c.points,style:{color:u,width:f?1.9:1.3,head:"arrow"}}),c.label&&d.jsxs("g",{transform:`translate(${c.label.x} ${c.label.y})`,children:[d.jsx("rect",{width:c.label.w,height:c.label.h,rx:7,fill:"var(--poney-paper-raised)",stroke:f?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:c.label.w/2,y:15,textAnchor:"middle",fontSize:11.5,fontWeight:650,fill:f?"var(--poney-accent)":"var(--poney-ink)",children:c.event}),c.guard&&d.jsxs("text",{x:c.label.w/2,y:28,textAnchor:"middle",fontSize:10.5,fill:"var(--poney-ink-3)",children:["[",c.guard,"]"]})]})]},c.id)}),t.states.map(c=>{const f=a&&!a.states.has(c.id),u=l("state",c.id),h={kind:"state",behavior:i,id:c.id},m=c.outcome==="success"?"var(--poney-success)":c.outcome==="failure"?"var(--poney-failure)":"var(--poney-rule-strong)";return c.kind==="initial"?d.jsxs("g",{transform:`translate(${c.x} ${c.y})`,...n(h,"Start"),className:`poney-el ${f?"poney-dim":""}`,children:[d.jsx("circle",{cx:c.w/2,cy:c.h/2,r:c.w/2,fill:"var(--poney-ink)"}),d.jsx(xn,{w:c.w,h:c.h,rx:c.w/2,selected:u})]},c.id):d.jsxs("g",{transform:`translate(${c.x} ${c.y})`,...n(h,`State ${c.name}${c.kind==="final"?", final":""}`),className:`poney-el ${f?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:c.w,height:c.h,rx:16,fill:"var(--poney-paper-raised)",stroke:m,strokeWidth:c.outcome==="neutral"?1.1:1.5}),c.kind==="final"&&d.jsx("rect",{x:4,y:4,width:c.w-8,height:c.h-8,rx:12,fill:"none",stroke:m,strokeWidth:1.1}),c.outcome!=="neutral"&&d.jsx("circle",{cx:18,cy:c.entryActions.length?22:c.h/2,r:4,fill:m}),d.jsx("text",{x:c.w/2,y:c.entryActions.length?27:c.h/2+5,textAnchor:"middle",fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:c.name}),c.entryActions.length>0&&d.jsxs("text",{x:c.w/2,y:46,textAnchor:"middle",fontSize:11,fill:"var(--poney-ink-3)",children:["On entry: ",c.entryActions[0],c.entryActions.length>1?` +${c.entryActions.length-1}`:""]}),d.jsx(xn,{w:c.w,h:c.h,rx:16,selected:u})]},c.id)})]})}function lL(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"dot",tone:"ink",label:"Where it starts"}),d.jsx(Kt,{shape:"pill",tone:"slate",label:"A state it can be in"}),d.jsx(Kt,{shape:"pill",tone:"success",label:"A good outcome"}),d.jsx(Kt,{shape:"pill",tone:"failure",label:"A failed or stopped outcome"}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,children:[d.jsx("rect",{x:"1",y:"2",width:"20",height:"12",rx:"5",fill:"none",stroke:"var(--poney-ink-3)"}),d.jsx("rect",{x:"3.5",y:"4.5",width:"15",height:"7",rx:"3",fill:"none",stroke:"var(--poney-ink-3)"})]}),"Final: nothing happens after it"]}),d.jsx("p",{className:"poney-legend-note",children:"Labels on arrows are events. Text in brackets is the condition that must be true."})]})}const cL={key:"state",label:"State machine",icon:wD,howToRead:"Each box is a status. Arrows are the events that move it on; select one to see what causes it and what happens next.",Renderer:aL,Legend:lL};function dL({scene:t}){const e=fn(),n=Sn(),r=c1(),{subject:s,selection:i}=Ds(),o=b.useMemo(()=>{if(!s)return null;const l=new Set,c=new Set;if(s.kind==="entity"&&t.actors.some(f=>f.entityId===s.id))l.add(s.id),t.associations.forEach(f=>f.actor===s.id&&c.add(f.useCase));else if(s.kind==="useCase"&&t.useCases.some(f=>f.id===s.id))c.add(s.id),t.associations.forEach(f=>f.useCase===s.id&&l.add(f.actor)),t.includes.forEach(f=>f.from===s.id&&c.add(f.to));else return null;return{actors:l,caps:c}},[s,t]),a=l=>!!o&&o.caps.has(l.useCase)&&o.actors.has(l.actor);return d.jsxs("g",{children:[d.jsx("rect",{x:t.boundary.x,y:t.boundary.y,width:t.boundary.w,height:t.boundary.h,rx:22,fill:"var(--poney-paper)",fillOpacity:.6,stroke:"var(--poney-rule-strong)"}),d.jsx("text",{x:t.boundary.x+20,y:t.boundary.y+30,fontSize:13,fontWeight:650,fill:"var(--poney-ink-2)",children:t.boundary.title}),t.areas.map((l,c)=>d.jsxs("g",{children:[c>0&&d.jsx("line",{x1:l.x,x2:l.x+l.w,y1:l.y-7,y2:l.y-7,stroke:"var(--poney-rule)"}),d.jsx("text",{x:l.x+4,y:l.y+18,fontSize:12,fontWeight:650,fill:"var(--poney-ink-3)",children:l.label})]},l.label)),t.associations.map(l=>{const c=a(l),f=(l.from.x+l.to.x)/2;return d.jsx("path",{d:`M ${l.from.x} ${l.from.y} C ${f} ${l.from.y} ${f} ${l.to.y} ${l.to.x} ${l.to.y}`,fill:"none",stroke:c?"var(--poney-accent)":"var(--poney-ink-4)",strokeWidth:c?1.8:1.1,strokeDasharray:l.side==="right"?"5 4":void 0,className:`poney-edge ${o&&!c?"poney-dim":""}`},l.id)}),t.includes.map(l=>{const c=(o==null?void 0:o.caps.has(l.from))&&o.caps.has(l.to),f=c?"var(--poney-accent)":"var(--poney-ink-3)",u=`M ${l.a.x} ${l.a.y} C ${l.a.x+48} ${l.a.y+6} ${l.b.x+48} ${l.b.y-6} ${l.b.x+4} ${l.b.y-1}`;return d.jsxs("g",{className:o&&!c?"poney-dim":"",children:[d.jsx("path",{d:u,fill:"none",stroke:f,strokeDasharray:"4 3",strokeWidth:1.2}),d.jsx(Ha,{at:{x:l.b.x+2,y:l.b.y},angle:Math.PI*.62,kind:"open-arrow",color:f}),d.jsx("text",{x:l.a.x+44,y:(l.a.y+l.b.y)/2+4,fontSize:11,fontStyle:"italic",fill:f,children:"includes"})]},l.id)}),t.useCases.map(l=>{const c=e.useCases.get(l.id),f=o&&!o.caps.has(l.id),u=(i==null?void 0:i.kind)==="useCase"&&i.id===l.id;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"useCase",id:l.id},`${c.name}. ${c.summary}`),className:`poney-el ${f?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:l.w,height:l.h,rx:l.h/2,fill:"var(--poney-paper-raised)",stroke:o!=null&&o.caps.has(l.id)?"var(--poney-tyrian)":"var(--poney-rule-strong)",strokeWidth:1.2}),d.jsx("text",{x:l.w/2,y:l.h/2+5,textAnchor:"middle",fontSize:13.5,fontWeight:600,fill:"var(--poney-ink)",children:Nt(c.name,l.w-32,13.5,600)}),d.jsx(xn,{w:l.w,h:l.h,rx:l.h/2,selected:u})]},l.id)}),t.actors.map(l=>{const c=e.entities.get(l.entityId),f=e.style(c),u=o&&!o.actors.has(l.entityId),h=(i==null?void 0:i.kind)==="entity"&&i.id===c.id,m=t.associations.filter(g=>g.actor===c.id).length;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"entity",id:c.id},`${c.name}: ${m} things they can do`),className:`poney-el ${u?"poney-dim":""}`,children:[d.jsx(_p,{entity:c,style:f.shape==="person"?f:{...f,shape:"card"},w:l.w,h:l.h,emphasis:h?"selected":"normal",detail:!1}),r>.5&&d.jsx("text",{x:l.w/2,y:l.h+16,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:l.side==="left"?`Can do ${m} thing${m===1?"":"s"}`:`Supports ${m}`})]},l.entityId)})]})}function uL(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"person",tone:"slate",label:"Person who uses the system"}),d.jsx(Kt,{shape:"card",tone:"umber",label:"Outside system that helps",dashed:!0}),d.jsx(Kt,{shape:"pill",tone:"tyrian",label:"Something a person can do"}),d.jsx(Vn,{line:"solid",label:"Does it",head:!1}),d.jsx(Vn,{line:"dashed",label:"Helps with it",head:!1})]})}const fL={key:"usecase",label:"Use cases",icon:yz,howToRead:"People on the left, the things they can do in the middle, outside services that help on the right. Select a person to see everything they can do.",Renderer:dL,Legend:uL},Wy="var(--poney-lapis)",Uy="var(--poney-ochre)";function hL({scene:t,view:e}){const n=fn(),r=Sn(),{subject:s,selection:i}=Ds(),o=bp(e.id)[0].transitive??!1,a=n.doc.presentation.relationships,l=gc(13,11,22),c=b.useMemo(()=>{if(!s)return null;const u=new Set,h=new Set,m=new Set,g=new Set;if(s.kind==="entity"&&t.nodes.some(p=>p.entityId===s.id)){const p=(x,y)=>{for(const v of t.edges){const k=y?v.source:v.target,w=y?v.target:v.source;if(k!==x)continue;(y?m:g).add(v.id);const j=y?u:h;j.has(w)||w===s.id||(j.add(w),o&&p(w,y))}};return p(s.id,!0),p(s.id,!1),{node:s.id,deps:u,users:h,depEdges:m,userEdges:g,group:null}}if(s.kind==="relationship"){const p=t.edges.find(x=>x.id===s.id);return p?(m.add(p.id),u.add(p.target),h.add(p.source),{node:null,deps:u,users:h,depEdges:m,userEdges:g,group:null}):null}if(s.kind==="group"&&s.view===e.id){const p=t.bands.findIndex(x=>x.id===s.id);return t.nodes.forEach(x=>x.band===p&&u.add(x.entityId)),{node:null,deps:u,users:h,depEdges:m,userEdges:g,group:s.id}}return null},[s,t,o,e.id]),f=u=>c!=null&&c.deps.has(u)?Wy:c!=null&&c.users.has(u)?Uy:void 0;return d.jsxs("g",{children:[t.bands.map((u,h)=>{const m=(i==null?void 0:i.kind)==="group"&&i.id===u.id;return d.jsxs("g",{children:[d.jsx("rect",{x:u.x,y:u.y,width:u.w,height:u.h,fill:h%2?"var(--poney-paper)":"transparent",fillOpacity:.55}),h>0&&d.jsx("line",{x1:u.x,x2:u.x+u.w,y1:u.y,y2:u.y,stroke:"var(--poney-rule)"}),d.jsxs("g",{...r({kind:"group",view:e.id,id:u.id},`Layer ${u.label}`),children:[d.jsx("rect",{x:12,y:u.y+12,width:148,height:u.h-24,rx:10,fill:m?"var(--poney-accent-wash)":"transparent"}),d.jsx("text",{x:24,y:u.y+u.h/2-(u.description&&l===13?4:-4),fontSize:l,fontWeight:650,fill:m?"var(--poney-accent)":"var(--poney-ink-2)",children:u.label}),u.description&&l===13&&d.jsx("text",{x:24,y:u.y+u.h/2+13,fontSize:11,fill:"var(--poney-ink-3)",children:Nt(u.description,136,11)})]})]},u.id)}),t.edges.map(u=>{var N,E;const h=a[u.kind]??{pattern:"solid",head:"arrow"},m=c==null?void 0:c.depEdges.has(u.id),g=c==null?void 0:c.userEdges.has(u.id),p=(c==null?void 0:c.group)&&(c.deps.has(u.source)||c.deps.has(u.target)),x=m?Wy:g?Uy:p?"var(--poney-ink-2)":"var(--poney-ink-4)",y=u.d[u.d.length-1],v=u.d[u.d.length-2],k=Math.atan2(y.y-v.y,y.x-v.x),w=h.head==="triangle"?10:6,j={x:y.x-Math.cos(k)*w,y:y.y-Math.sin(k)*w},C=P=>{let z=`M ${u.d[0].x} ${u.d[0].y}`;for(let I=1;I+2<u.d.length;I+=3){const F=I+2===u.d.length-1?P:u.d[I+2];z+=` C ${u.d[I].x} ${u.d[I].y} ${u.d[I+1].x} ${u.d[I+1].y} ${F.x} ${F.y}`}return z},_=c&&!m&&!g&&!p,S=n.relationships.get(u.id);return d.jsxs("g",{...r({kind:"relationship",id:u.id},`${(N=n.entities.get(u.source))==null?void 0:N.name} ${(S==null?void 0:S.kind)==="implements"?"implements":"depends on"} ${(E=n.entities.get(u.target))==null?void 0:E.name}`),className:`poney-el ${_?"poney-dim":""}`,children:[d.jsx("path",{d:C(y),fill:"none",stroke:"transparent",strokeWidth:12}),d.jsx("path",{d:C(j),fill:"none",stroke:x,strokeWidth:m||g?1.9:1.2,strokeDasharray:h.pattern==="dashed"?"5 4":void 0,className:"poney-edge"}),d.jsx(Ha,{at:y,angle:k,kind:h.head,color:x})]},u.id)}),t.nodes.map(u=>{const h=n.entities.get(u.entityId),m=n.style(h),g=(c==null?void 0:c.node)===u.entityId,p=f(u.entityId),x=c&&!g&&!p,y=(i==null?void 0:i.kind)==="entity"&&i.id===h.id;return d.jsxs("g",{transform:`translate(${u.x} ${u.y})`,...r({kind:"entity",id:h.id},`${h.name}, ${m.label}`),className:`poney-el ${x?"poney-dim":""}`,children:[d.jsx(_p,{entity:h,style:{...m,shape:"chip"},w:u.w,h:u.h,emphasis:y?"selected":"normal",detail:!1}),p&&!y&&d.jsx("rect",{x:-2,y:-2,width:u.w+4,height:u.h+4,rx:12,fill:"none",stroke:p,strokeWidth:1.6}),d.jsx(xn,{w:u.w,h:u.h,rx:10,selected:!1})]},u.entityId)})]})}function pL(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Vn,{line:"solid",label:"Depends on",color:"var(--poney-ink-3)"}),d.jsx(Vn,{line:"dashed",label:"Implements, or sends events to",color:"var(--poney-ink-3)"}),d.jsx(Vn,{line:"solid",label:"When selected: what it needs",color:Wy}),d.jsx(Vn,{line:"solid",label:"When selected: what needs it",color:Uy}),d.jsx("p",{className:"poney-legend-note",children:"Arrows should point down. An arrow that points up is a dependency turned around on purpose, such as an adapter that implements a domain interface."})]})}const mL={key:"dependency",label:"Dependencies",icon:vD,howToRead:"Layers run from the outside in, top to bottom. Select a part: blue shows what it needs, amber shows what needs it. Turn on “follow all the way” to see the full chain.",Renderer:hL,Legend:pL};function gL({scene:t,view:e}){const n=fn().doc,[r,s]=b.useState(null),i=rP(n,e.id)[0],[o,a]=bp(e.id),l=o.collapsed,c=b.useMemo(()=>({marks:i?A_(i):new Map,mode:"after",focus:null,callouts:new Map,hot:r,setHot:s,toggleGroup:f=>{const u=l??e.collapsed;a({collapsed:u.includes(f)?u.filter(h=>h!==f):[...u,f]})}}),[i,r,l,e,a]);return d.jsx(o1,{value:c,children:d.jsx(v$,{scene:t})})}const yL={key:"map",label:"Map",icon:BD,howToRead:"A picture of how parts connect. A part drawn inside another belongs to it; open or close a group with its round button. Hover a line to read what it does.",Renderer:gL},xL=[Kz,yL,Yz,eL,rL,oL,cL,fL,mL],_$=new Map(xL.map(t=>[t.key,t]));function vL(t){_$.set(t.key,t)}function Yr(t){return _$.get(C$(t))}const w1=[];function N$(t){var e;w1.push(t),(e=t.diagrams)==null||e.forEach(vL),Object.entries(t.layouts??{}).forEach(([n,r])=>GP(n,r))}const Rd=()=>w1.map(t=>t.core),kL=()=>w1.flatMap(t=>t.inspector??[]);var He;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(He||(He={}));var Mw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Mw||(Mw={}));const pe=He.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ks=t=>{switch(typeof t){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(t)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(t)?pe.array:t===null?pe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pe.promise:typeof Map<"u"&&t instanceof Map?pe.map:typeof Set<"u"&&t instanceof Set?pe.set:typeof Date<"u"&&t instanceof Date?pe.date:pe.object;default:return pe.unknown}},te=He.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let No=class E$ extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof E$))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,He.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};No.create=t=>new No(t);const Zy=(t,e)=>{let n;switch(t.code){case te.invalid_type:t.received===pe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case te.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,He.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:n=`Unrecognized key(s) in object: ${He.joinValues(t.keys,", ")}`;break;case te.invalid_union:n="Invalid input";break;case te.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${He.joinValues(t.options)}`;break;case te.invalid_enum_value:n=`Invalid enum value. Expected ${He.joinValues(t.options)}, received '${t.received}'`;break;case te.invalid_arguments:n="Invalid function arguments";break;case te.invalid_return_type:n="Invalid function return type";break;case te.invalid_date:n="Invalid date";break;case te.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:He.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case te.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case te.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case te.custom:n="Invalid input";break;case te.invalid_intersection_types:n="Intersection results could not be merged";break;case te.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case te.not_finite:n="Number must be finite";break;default:n=e.defaultError,He.assertNever(t)}return{message:n}};let wL=Zy;function bL(){return wL}const SL=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function oe(t,e){const n=bL(),r=SL({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zy?void 0:Zy].filter(s=>!!s)});t.common.issues.push(r)}let Er=class $${constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Ne;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return $$.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ne;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}};const Ne=Object.freeze({status:"aborted"}),Ql=t=>({status:"dirty",value:t}),ur=t=>({status:"valid",value:t}),Tw=t=>t.status==="aborted",Ow=t=>t.status==="dirty",qa=t=>t.status==="valid",Jf=t=>typeof Promise<"u"&&t instanceof Promise;var ye;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ye||(ye={}));let $i=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Aw=(t,e)=>{if(qa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new No(t.common.issues);return this._error=n,this._error}}};function Ie(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let Ue=class{get description(){return this._def.description}_getType(e){return Ks(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Er,ctx:{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Jf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Aw(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return qa(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>qa(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Jf(s)?s:Promise.resolve(s));return Aw(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:te.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ja({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return gi.create(this,this._def)}nullable(){return Ga.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ka.create(this)}promise(){return Qf.create(this,this._def)}or(e){return Gf.create([this,e],this._def)}and(e){return Yf.create(this,e,this._def)}transform(e){return new Ja({...Ie(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Xy({...Ie(this._def),innerType:this,defaultValue:n,typeName:$e.ZodDefault})}brand(){return new HL({typeName:$e.ZodBranded,type:this,...Ie(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ex({...Ie(this._def),innerType:this,catchValue:n,typeName:$e.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return qL.create(this,e)}readonly(){return tx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const jL=/^c[^\s-]{8,}$/i,CL=/^[0-9a-z]+$/,_L=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NL=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,EL=/^[a-z0-9_-]{21}$/i,$L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ML=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,OL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Im;const AL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,RL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,IL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,PL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,M$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",LL=new RegExp(`^${M$}$`);function T$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function FL(t){return new RegExp(`^${T$(t)}$`)}function BL(t){let e=`${M$}T${T$(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function VL(t,e){return!!((e==="v4"||!e)&&AL.test(t)||(e==="v6"||!e)&&IL.test(t))}function WL(t,e){if(!$L.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function UL(t,e){return!!((e==="v4"||!e)&&RL.test(t)||(e==="v6"||!e)&&PL.test(t))}let Hy=class Xl extends Ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){const i=this._getOrReturnCtx(e);return oe(i,{code:te.invalid_type,expected:pe.string,received:i.parsedType}),Ne}const r=new Er;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:te.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:te.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?oe(s,{code:te.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&oe(s,{code:te.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")TL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"email",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Im||(Im=new RegExp(OL,"u")),Im.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"emoji",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")NL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"uuid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")EL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"nanoid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")jL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cuid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")CL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cuid2",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")_L.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"ulid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),oe(s,{validation:"url",code:te.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"regex",code:te.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?BL(i).test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?LL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?FL(i).test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:te.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?ML.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"duration",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?VL(e.data,i.version)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"ip",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?WL(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"jwt",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?UL(e.data,i.version)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cidr",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?DL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"base64",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?zL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"base64url",code:te.invalid_string,message:i.message}),r.dirty()):He.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:te.invalid_string,...ye.errToObj(r)})}_addCheck(e){return new Xl({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ye.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ye.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ye.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ye.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ye.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ye.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ye.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ye.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ye.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ye.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ye.errToObj(n)})}nonempty(e){return this.min(1,ye.errToObj(e))}trim(){return new Xl({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xl({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xl({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Hy.create=t=>new Hy({checks:[],typeName:$e.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ie(t)});function ZL(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let Rw=class qy extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==pe.number){const i=this._getOrReturnCtx(e);return oe(i,{code:te.invalid_type,expected:pe.number,received:i.parsedType}),Ne}let r;const s=new Er;for(const i of this._def.checks)i.kind==="int"?He.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),oe(r,{code:te.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?ZL(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),oe(r,{code:te.not_finite,message:i.message}),s.dirty()):He.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ye.toString(n))}setLimit(e,n,r,s){return new qy({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ye.toString(s)}]})}_addCheck(e){return new qy({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ye.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&He.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Rw.create=t=>new Rw({checks:[],typeName:$e.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ie(t)});let Iw=class Ky extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==pe.bigint)return this._getInvalidInput(e);let r;const s=new Er;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):He.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:pe.bigint,received:n.parsedType}),Ne}gte(e,n){return this.setLimit("min",e,!0,ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ye.toString(n))}setLimit(e,n,r,s){return new Ky({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ye.toString(s)}]})}_addCheck(e){return new Ky({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Iw.create=t=>new Iw({checks:[],typeName:$e.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ie(t)});let Jy=class extends Ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.boolean,received:r.parsedType}),Ne}return ur(e.data)}};Jy.create=t=>new Jy({typeName:$e.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ie(t)});let Pw=class O$ extends Ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){const i=this._getOrReturnCtx(e);return oe(i,{code:te.invalid_type,expected:pe.date,received:i.parsedType}),Ne}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return oe(i,{code:te.invalid_date}),Ne}const r=new Er;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:te.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:te.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):He.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new O$({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ye.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ye.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Pw.create=t=>new Pw({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:$e.ZodDate,...Ie(t)});let Dw=class extends Ue{_parse(e){if(this._getType(e)!==pe.symbol){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.symbol,received:r.parsedType}),Ne}return ur(e.data)}};Dw.create=t=>new Dw({typeName:$e.ZodSymbol,...Ie(t)});let zw=class extends Ue{_parse(e){if(this._getType(e)!==pe.undefined){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.undefined,received:r.parsedType}),Ne}return ur(e.data)}};zw.create=t=>new zw({typeName:$e.ZodUndefined,...Ie(t)});let Lw=class extends Ue{_parse(e){if(this._getType(e)!==pe.null){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.null,received:r.parsedType}),Ne}return ur(e.data)}};Lw.create=t=>new Lw({typeName:$e.ZodNull,...Ie(t)});let Fw=class extends Ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ur(e.data)}};Fw.create=t=>new Fw({typeName:$e.ZodAny,...Ie(t)});let Bw=class extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ur(e.data)}};Bw.create=t=>new Bw({typeName:$e.ZodUnknown,...Ie(t)});let Mi=class extends Ue{_parse(e){const n=this._getOrReturnCtx(e);return oe(n,{code:te.invalid_type,expected:pe.never,received:n.parsedType}),Ne}};Mi.create=t=>new Mi({typeName:$e.ZodNever,...Ie(t)});let Vw=class extends Ue{_parse(e){if(this._getType(e)!==pe.undefined){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.void,received:r.parsedType}),Ne}return ur(e.data)}};Vw.create=t=>new Vw({typeName:$e.ZodVoid,...Ie(t)});let Ka=class Gu extends Ue{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==pe.array)return oe(n,{code:te.invalid_type,expected:pe.array,received:n.parsedType}),Ne;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(oe(n,{code:o?te.too_big:te.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(oe(n,{code:te.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(oe(n,{code:te.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new $i(n,o,n.path,a)))).then(o=>Er.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new $i(n,o,n.path,a)));return Er.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Gu({...this._def,minLength:{value:e,message:ye.toString(n)}})}max(e,n){return new Gu({...this._def,maxLength:{value:e,message:ye.toString(n)}})}length(e,n){return new Gu({...this._def,exactLength:{value:e,message:ye.toString(n)}})}nonempty(e){return this.min(1,e)}};Ka.create=(t,e)=>new Ka({type:t,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ie(e)});function na(t){if(t instanceof Ts){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=gi.create(na(r))}return new Ts({...t._def,shape:()=>e})}else return t instanceof Ka?new Ka({...t._def,type:na(t.element)}):t instanceof gi?gi.create(na(t.unwrap())):t instanceof Ga?Ga.create(na(t.unwrap())):t instanceof Kc?Kc.create(t.items.map(e=>na(e))):t}let Ts=class gr extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=He.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==pe.object){const c=this._getOrReturnCtx(e);return oe(c,{code:te.invalid_type,expected:pe.object,received:c.parsedType}),Ne}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mi&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const f=i[c],u=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new $i(s,u,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Mi){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")a.length>0&&(oe(s,{code:te.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new $i(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const u=await f.key,h=await f.value;c.push({key:u,value:h,alwaysSet:f.alwaysSet})}return c}).then(c=>Er.mergeObjectSync(r,c)):Er.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ye.errToObj,new gr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ye.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new gr({...this._def,unknownKeys:"strip"})}passthrough(){return new gr({...this._def,unknownKeys:"passthrough"})}extend(e){return new gr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new gr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$e.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new gr({...this._def,catchall:e})}pick(e){const n={};for(const r of He.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new gr({...this._def,shape:()=>n})}omit(e){const n={};for(const r of He.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new gr({...this._def,shape:()=>n})}deepPartial(){return na(this)}partial(e){const n={};for(const r of He.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new gr({...this._def,shape:()=>n})}required(e){const n={};for(const r of He.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof gi;)i=i._def.innerType;n[r]=i}return new gr({...this._def,shape:()=>n})}keyof(){return R$(He.objectKeys(this.shape))}};Ts.create=(t,e)=>new Ts({shape:()=>t,unknownKeys:"strip",catchall:Mi.create(),typeName:$e.ZodObject,...Ie(e)});Ts.strictCreate=(t,e)=>new Ts({shape:()=>t,unknownKeys:"strict",catchall:Mi.create(),typeName:$e.ZodObject,...Ie(e)});Ts.lazycreate=(t,e)=>new Ts({shape:t,unknownKeys:"strip",catchall:Mi.create(),typeName:$e.ZodObject,...Ie(e)});let Gf=class extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new No(a.ctx.common.issues));return oe(n,{code:te.invalid_union,unionErrors:o}),Ne}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new No(l));return oe(n,{code:te.invalid_union,unionErrors:a}),Ne}}get options(){return this._def.options}};Gf.create=(t,e)=>new Gf({options:t,typeName:$e.ZodUnion,...Ie(e)});function Gy(t,e){const n=Ks(t),r=Ks(e);if(t===e)return{valid:!0,data:t};if(n===pe.object&&r===pe.object){const s=He.objectKeys(e),i=He.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Gy(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===pe.array&&r===pe.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Gy(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===pe.date&&r===pe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let Yf=class extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Tw(i)||Tw(o))return Ne;const a=Gy(i.value,o.value);return a.valid?((Ow(i)||Ow(o))&&n.dirty(),{status:n.value,value:a.data}):(oe(r,{code:te.invalid_intersection_types}),Ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Yf.create=(t,e,n)=>new Yf({left:t,right:e,typeName:$e.ZodIntersection,...Ie(n)});let Kc=class A$ extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.array)return oe(r,{code:te.invalid_type,expected:pe.array,received:r.parsedType}),Ne;if(r.data.length<this._def.items.length)return oe(r,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ne;!this._def.rest&&r.data.length>this._def.items.length&&(oe(r,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new $i(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Er.mergeArray(n,o)):Er.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new A$({...this._def,rest:e})}};Kc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kc({items:t,typeName:$e.ZodTuple,rest:null,...Ie(e)})};let Ww=class extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.map)return oe(r,{code:te.invalid_type,expected:pe.map,received:r.parsedType}),Ne;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new $i(r,a,r.path,[c,"key"])),value:i._parse(new $i(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return Ne;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return Ne;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}};Ww.create=(t,e,n)=>new Ww({valueType:e,keyType:t,typeName:$e.ZodMap,...Ie(n)});let Uw=class Yy extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.set)return oe(r,{code:te.invalid_type,expected:pe.set,received:r.parsedType}),Ne;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(oe(r,{code:te.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(oe(r,{code:te.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const f of l){if(f.status==="aborted")return Ne;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new $i(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Yy({...this._def,minSize:{value:e,message:ye.toString(n)}})}max(e,n){return new Yy({...this._def,maxSize:{value:e,message:ye.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Uw.create=(t,e)=>new Uw({valueType:t,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ie(e)});let Zw=class extends Ue{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Zw.create=(t,e)=>new Zw({getter:t,typeName:$e.ZodLazy,...Ie(e)});let Hw=class extends Ue{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return oe(n,{received:n.data,code:te.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Hw.create=(t,e)=>new Hw({value:t,typeName:$e.ZodLiteral,...Ie(e)});function R$(t,e){return new b1({values:t,typeName:$e.ZodEnum,...Ie(e)})}let b1=class Qy extends Ue{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return oe(n,{expected:He.joinValues(r),received:n.parsedType,code:te.invalid_type}),Ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return oe(n,{received:n.data,code:te.invalid_enum_value,options:r}),Ne}return ur(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Qy.create(e,{...this._def,...n})}exclude(e,n=this._def){return Qy.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};b1.create=R$;let qw=class extends Ue{_parse(e){const n=He.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==pe.string&&r.parsedType!==pe.number){const s=He.objectValues(n);return oe(r,{expected:He.joinValues(s),received:r.parsedType,code:te.invalid_type}),Ne}if(this._cache||(this._cache=new Set(He.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=He.objectValues(n);return oe(r,{received:r.data,code:te.invalid_enum_value,options:s}),Ne}return ur(e.data)}get enum(){return this._def.values}};qw.create=(t,e)=>new qw({values:t,typeName:$e.ZodNativeEnum,...Ie(e)});let Qf=class extends Ue{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.promise&&n.common.async===!1)return oe(n,{code:te.invalid_type,expected:pe.promise,received:n.parsedType}),Ne;const r=n.parsedType===pe.promise?n.data:Promise.resolve(n.data);return ur(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Qf.create=(t,e)=>new Qf({type:t,typeName:$e.ZodPromise,...Ie(e)});let Ja=class extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{oe(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ne;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ne:l.status==="dirty"||n.value==="dirty"?Ql(l.value):l});{if(n.value==="aborted")return Ne;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ne:a.status==="dirty"||n.value==="dirty"?Ql(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ne:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ne:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qa(o))return Ne;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>qa(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Ne);He.assertNever(s)}};Ja.create=(t,e,n)=>new Ja({schema:t,typeName:$e.ZodEffects,effect:e,...Ie(n)});Ja.createWithPreprocess=(t,e,n)=>new Ja({schema:e,effect:{type:"preprocess",transform:t},typeName:$e.ZodEffects,...Ie(n)});let gi=class extends Ue{_parse(e){return this._getType(e)===pe.undefined?ur(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gi.create=(t,e)=>new gi({innerType:t,typeName:$e.ZodOptional,...Ie(e)});let Ga=class extends Ue{_parse(e){return this._getType(e)===pe.null?ur(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ga.create=(t,e)=>new Ga({innerType:t,typeName:$e.ZodNullable,...Ie(e)});let Xy=class extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Xy.create=(t,e)=>new Xy({innerType:t,typeName:$e.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ie(e)});let ex=class extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Jf(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new No(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new No(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ex.create=(t,e)=>new ex({innerType:t,typeName:$e.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ie(e)});let Kw=class extends Ue{_parse(e){if(this._getType(e)!==pe.nan){const r=this._getOrReturnCtx(e);return oe(r,{code:te.invalid_type,expected:pe.nan,received:r.parsedType}),Ne}return{status:"valid",value:e.data}}};Kw.create=t=>new Kw({typeName:$e.ZodNaN,...Ie(t)});let HL=class extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},qL=class I$ extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ne:i.status==="dirty"?(n.dirty(),Ql(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ne:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new I$({in:e,out:n,typeName:$e.ZodPipeline})}},tx=class extends Ue{_parse(e){const n=this._def.innerType._parse(e),r=s=>(qa(s)&&(s.value=Object.freeze(s.value)),s);return Jf(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};tx.create=(t,e)=>new tx({innerType:t,typeName:$e.ZodReadonly,...Ie(e)});var $e;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})($e||($e={}));const Pm=Hy.create,KL=Jy.create;Mi.create;const JL=Ka.create,P$=Ts.create;Gf.create;Yf.create;Kc.create;b1.create;Qf.create;gi.create;Ga.create;const GL=P$({team:se.optional(),oncall:Pm().optional(),channel:Pm().optional(),mission:Pm().optional()}).strict(),nx=P$({teams:JL(se).min(1),showUnowned:KL().default(!1)}),Xf="ownership/team",Np={name:"ownership",version:"0.1.0",description:"Teams, who owns what, and how to reach them.",entityKinds:{team:{label:"Team",description:"A group of people who own and run parts of the system."}},facets:{entity:GL},views:{"team-map":{label:"Team map",description:"Every team and the parts of the system it owns.",schema:nx}},validate(t,{index:e,report:n}){t.model.entities.forEach((r,s)=>{const i=Wr(Np,"entity",r);if(!(i!=null&&i.team))return;const o=e.entities.get(i.team);o?o.kind!==Xf&&n(`model.entities.${s}.ext.ownership.team`,`"${i.team}" is not a team`):n(`model.entities.${s}.ext.ownership.team`,`Unknown team "${i.team}"`)}),t.views.forEach((r,s)=>{if(r.type!=="extension"||r.extension!=="ownership/team-map")return;const i=nx.safeParse(r.data);i.success&&i.data.teams.forEach((o,a)=>{var l;((l=e.entities.get(o))==null?void 0:l.kind)!==Xf&&n(`views.${s}.data.teams.${a}`,`"${o}" is not a team`)})})}},Ya=t=>Wr(Np,"entity",t);function YL(t,e){var r;const n=(r=Ya(e))==null?void 0:r.team;return n?t.model.entities.find(s=>s.id===n):void 0}function D$(t,e){return t.model.entities.filter(n=>{var r;return((r=Ya(n))==null?void 0:r.team)===e})}const Ll=248,Dm=28,zm=104,Lm=50,Fm=4;function QL(t,e){const n=nx.safeParse(e.data);if(!n.success)throw new Error(`The ${Np.name} team map has invalid data`);const r=[],s=[];let i=24;for(let l=0;l<n.data.teams.length;l+=Fm){const c=n.data.teams.slice(l,l+Fm);let f=0;c.forEach((u,h)=>{const m=t.model.entities.find(v=>v.id===u);if(!m)return;const g=Ya(m),p=24+h*(Ll+Dm),x=D$(t,u);x.forEach((v,k)=>s.push({entityId:v.id,team:u,x:p+12,y:i+zm+12+k*(Lm+8),w:Ll-24,h:Lm}));const y=zm+12+x.length*(Lm+8)+8;f=Math.max(f,y),r.push({entityId:u,x:p,y:i,w:Ll,h:y,header:zm,mission:Of((g==null?void 0:g.mission)??m.summary,Ll-32,12,400,2),oncall:g==null?void 0:g.oncall,channel:g==null?void 0:g.channel})});for(const u of r.filter(h=>h.y===i))u.h=f;i+=f+Dm}const o={};for(const l of r)o[de({kind:"entity",id:l.entityId})]=l;for(const l of s)o[de({kind:"entity",id:l.entityId})]=l;const a=Math.min(Fm,n.data.teams.length);return{width:48+a*Ll+(a-1)*Dm,height:i,teams:r,owned:s,anchors:o}}function XL({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=b.useMemo(()=>{var a;if((r==null?void 0:r.kind)!=="entity")return null;const o=e.entities.get(r.id);return(o==null?void 0:o.kind)===Xf?o.id:((a=Ya(o))==null?void 0:a.team)??null},[r,e]);return d.jsxs("g",{children:[t.teams.map(o=>{const a=e.entities.get(o.entityId),l=e.style(a),c=dt(l.tone),f=i&&i!==o.entityId,u=(s==null?void 0:s.kind)==="entity"&&s.id===o.entityId;return d.jsxs("g",{className:`poney-fade ${f?"poney-dim":""}`,children:[d.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,rx:16,fill:"var(--poney-paper)",fillOpacity:.6,stroke:"var(--poney-rule-strong)"}),d.jsxs("g",{transform:`translate(${o.x} ${o.y})`,...n({kind:"entity",id:a.id},`${a.name}. ${a.summary}`),children:[d.jsx("path",{d:`M 0 16 Q 0 0 16 0 H ${o.w-16} Q ${o.w} 0 ${o.w} 16 V ${o.header} H 0 Z`,fill:mn(l.tone,12)}),d.jsx(lr,{name:l.icon,x:16,y:16,size:16,color:c}),d.jsx("text",{x:40,y:29,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:a.name}),o.mission.map((h,m)=>d.jsx("text",{x:16,y:52+m*15,fontSize:12,fill:"var(--poney-ink-2)",children:h},m)),d.jsxs("text",{x:16,y:o.header-12,fontSize:11,fill:"var(--poney-ink-3)",children:["On call: ",o.oncall??"none"]}),d.jsx(xn,{w:o.w,h:o.header,rx:16,selected:u})]})]},o.entityId)}),t.owned.map(o=>{var f;const a=e.entities.get(o.entityId),l=i&&i!==o.team,c=(s==null?void 0:s.kind)==="entity"&&s.id===a.id;return d.jsx("g",{transform:`translate(${o.x} ${o.y})`,...n({kind:"entity",id:a.id},`${a.name}, owned by ${(f=e.entities.get(o.team))==null?void 0:f.name}`),className:`poney-el ${l?"poney-dim":""}`,children:d.jsx(_p,{entity:a,style:{...e.style(a),shape:"chip"},w:o.w,h:o.h,emphasis:c?"selected":"normal",detail:!1})},o.entityId)})]})}const e6={key:"ownership/team-map",label:"Team map",icon:v1,howToRead:"One column per team, with everything it owns. Select a part anywhere in the studio to see its team and who is on call.",Renderer:XL},Jw=t=>{let e;const n=new Set,r=(c,f)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const h=e;e=f??(typeof u!="object"||u===null)?u:Object.assign({},e,u),n.forEach(m=>m(e,h))}},s=()=>e,a={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,s,a);return a},t6=t=>t?Jw(t):Jw,n6=t=>t;function r6(t,e=n6){const n=wr.useSyncExternalStore(t.subscribe,wr.useCallback(()=>e(t.getState()),[t,e]),()=>e(t.getInitialState()));return wr.useDebugValue(n),n}const s6=t=>{const e=t6(t),n=r=>r6(e,r);return Object.assign(n,e),n},i6=t=>s6,xt="__overview",Fr="walk:",Ep=t=>t.startsWith(Fr)?t.slice(Fr.length):void 0,Id=t=>t.live.state==="on"&&(!!t.agent.session||t.agent.listening),pu={get(t,e){try{const n=localStorage.getItem(`poney:${t}`);return n?JSON.parse(n):e}catch{return e}},set(t,e){try{localStorage.setItem(`poney:${t}`,JSON.stringify(e))}catch{}}};let o6=0;const Ko=(t,e=null)=>({ref:e,mode:t,nonce:++o6}),T=i6()((t,e)=>({projects:[],projectId:"",importOpen:!1,importText:"",shortcutsOpen:!1,setImportOpen:(n,r)=>t({importOpen:n,importText:r??(n?e().importText:"")}),setShortcutsOpen:n=>t({shortcutsOpen:n}),history:void 0,viewId:xt,selection:null,hover:null,focus:null,back:[],forward:[],sidebarOpen:typeof window>"u"||window.innerWidth>900,inspectorOpen:typeof window>"u"||window.innerWidth>1180,paletteOpen:!1,theme:pu.get("theme","light"),pinned:pu.get("pinned",[]),viewUi:{},notice:null,live:{state:"off"},activeScene:null,conversation:[],agent:{session:null,listening:!1},jump:null,startOpen:!0,showStart:n=>t({startOpen:n||!e().history}),setLive:n=>t({live:n}),setActiveScene:n=>t({activeScene:n}),setConversation:n=>t({conversation:n}),putMessage(n){const r=e().conversation,s=r.findIndex(i=>i.id===n.id);t({conversation:s<0?[...r,n]:r.map((i,o)=>o===s?n:i)})},setAgent:n=>t({agent:n}),connectOpen:!1,agentPanelOpen:!1,setConnectOpen:n=>t({connectOpen:n}),setAgentPanelOpen:n=>t({agentPanelOpen:n}),liveFile:null,fileOpen:!1,setLiveFile:n=>t({liveFile:n}),setFileOpen:n=>t({fileOpen:n}),project:null,overlays:{},importCodeOpen:!1,projectOpen:!1,setProject:n=>t({project:n}),setOverlays:n=>t({overlays:n}),setImportCodeOpen:n=>t({importCodeOpen:n}),setProjectOpen:n=>t({projectOpen:n}),renaming:null,setRenaming:n=>t({renaming:n}),chips:[],pointing:!1,contextMenu:null,addChip(n){const r=e().chips,s=r.some(i=>n.ref?i.ref===n.ref:i.quote===n.quote);t({chips:s?r:[...r,n]})},removeChip:n=>t({chips:e().chips.filter((r,s)=>s!==n)}),clearChips:()=>t({chips:[]}),takeChips(){const n=e().chips;return n.length&&t({chips:[]}),n},setPointing:n=>t({pointing:n}),openContextMenu:n=>t({contextMenu:n}),jumpTo:n=>t({jump:{scene:n,nonce:Date.now()}}),reviseDocument(n,r){var h,m;const{viewId:s,selection:i,projectId:o}=e();if(n.project.id!==o)return e().loadDocument(n,r);const a=ft(n),l=(h=e().history)==null?void 0:h.present,f=!(!!l&&l.views.length===0&&l.walkthroughs.length===0)&&(s===xt||a.views.has(s)||n.walkthroughs.some(g=>`${Fr}${g.id}`===s)),u=i&&a.exists(i)?i:null;t({startOpen:!1,projects:[...e().projects.filter(g=>g.id!==n.project.id),{id:n.project.id,doc:n,origin:r}],history:xw(n),viewId:f?s:n.walkthroughs[0]?`${Fr}${n.walkthroughs[0].id}`:n.project.defaultView??((m=n.views[0])==null?void 0:m.id)??xt,selection:u,hover:null})},loadDocument(n,r="imported"){var f;const{projects:s,projectId:i,history:o}=e(),l=s.map(u=>u.id===i&&o?{...u,doc:o.present}:u).filter(u=>u.id!==n.project.id),c=n.walkthroughs[0]?`${Fr}${n.walkthroughs[0].id}`:n.project.defaultView??((f=n.views[0])==null?void 0:f.id)??xt;t({startOpen:!1,projects:[...l,{id:n.project.id,doc:n,origin:r}],projectId:n.project.id,history:xw(n),viewId:c,selection:null,hover:null,back:[],forward:[],viewUi:{},focus:null})},keepProject(n,r){t({projects:[...e().projects.filter(s=>s.id!==n.project.id),{id:n.project.id,doc:n,origin:r}]})},switchProject(n){const r=e().projects.find(s=>s.id===n);!r||n===e().projectId||e().loadDocument(r.doc,r.origin)},dispatch(n){try{t({history:aP(e().history,n)})}catch(r){t({notice:r instanceof Error?r.message:String(r)})}},undo:()=>t({history:lP(e().history)}),redo:()=>t({history:cP(e().history)}),navigate(n,r={}){const{viewId:s,selection:i,history:o}=e(),a=ft(o.present);let l=r.select!==void 0?r.select:i;if(l&&n!==xt&&!n.startsWith(Fr)){const f=a.views.get(n);(!f||!a.viewShows(f,l))&&(l=r.select??null)}(n===xt||n.startsWith(Fr))&&(l=r.select??null);const c=s!==n;c&&n.startsWith(Fr)&&typeof window<"u"&&window.innerWidth<1700&&t({sidebarOpen:!1}),t({viewId:n,selection:l,hover:null,back:c?[...e().back,{viewId:s,selection:i}].slice(-50):e().back,forward:c?[]:e().forward,focus:r.focus?Ko(r.focus,l):l?Ko("center",l):null})},goBack(){const{back:n,viewId:r,selection:s}=e(),i=n[n.length-1];i&&t({viewId:i.viewId,selection:i.selection,back:n.slice(0,-1),forward:[{viewId:r,selection:s},...e().forward],focus:i.selection?Ko("center",i.selection):null})},goForward(){const{forward:n,viewId:r,selection:s}=e(),i=n[0];i&&t({viewId:i.viewId,selection:i.selection,forward:n.slice(1),back:[...e().back,{viewId:r,selection:s}],focus:i.selection?Ko("center",i.selection):null})},select(n,r={}){const s=e().selection;n&&s&&de(n)===de(s)&&!r.focus||(t({selection:n,focus:r.focus?Ko(r.focus,n):e().focus}),n&&!e().inspectorOpen&&typeof window<"u"&&window.innerWidth>1180&&t({inspectorOpen:!0}))},setHover(n){const r=e().hover;r===n||r&&n&&de(r)===de(n)||t({hover:n})},requestFocus:(n,r=null)=>t({focus:Ko(n,r)}),toggleSidebar:n=>t({sidebarOpen:n??!e().sidebarOpen}),toggleInspector:n=>t({inspectorOpen:n??!e().inspectorOpen}),setPaletteOpen:n=>t({paletteOpen:n}),toggleTheme(){const n=e().theme==="light"?"dark":"light";pu.set("theme",n),t({theme:n})},togglePin(n){const r=e().pinned.includes(n)?e().pinned.filter(s=>s!==n):[...e().pinned,n];pu.set("pinned",r),t({pinned:r})},updateViewUi(n,r){t({viewUi:{...e().viewUi,[n]:{...e().viewUi[n],...r}}})},notify:n=>t({notice:n})})),S1=()=>T(t=>t.history.present),ze=()=>ft(S1());function Pd(t){const e=T.getState(),n=ft(e.history.present),r=e.viewId!==xt?n.views.get(e.viewId):void 0;if(r&&n.viewShows(r,t)){e.select(t,{focus:"center"});return}const s=n.bestViewFor(t);s?e.navigate(s.id,{select:t,focus:"center"}):e.select(t)}function a6(t,e){T.getState().navigate(t,{select:e??null,focus:e?"center":void 0})}function ve({title:t,count:e,children:n}){return d.jsxs("section",{className:"border-t border-rule px-4 py-3.5 first:border-t-0",children:[d.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-[12px] font-semibold text-ink-3",children:[t,e!==void 0&&d.jsx("span",{className:"font-tabular font-normal text-ink-4",children:e})]}),n]})}function An({items:t}){const e=t.filter(([,n])=>n!==void 0&&n!==""&&n!==null);return e.length?d.jsx("dl",{className:"grid grid-cols-[96px_1fr] gap-x-3 gap-y-1.5 text-[12.5px]",children:e.map(([n,r])=>d.jsxs("div",{className:"contents",children:[d.jsx("dt",{className:"text-ink-3",children:n}),d.jsx("dd",{className:"min-w-0 break-words text-ink",children:r})]},n))}):null}function vt({to:t,label:e,secondary:n,icon:r,tone:s,onClick:i}){return d.jsxs("button",{type:"button",onClick:i??(()=>t&&Pd(t)),className:"group -mx-2 flex w-[calc(100%+16px)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-sunken",children:[r&&d.jsx("span",{className:"mt-[1px] shrink-0",style:{color:s},children:r}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[12.5px] leading-snug text-ink",children:e}),n&&d.jsx("span",{className:"block text-[11.5px] leading-snug text-ink-3",children:n})]}),d.jsx(Ed,{size:13,className:"mt-0.5 shrink-0 text-ink-4 opacity-0 transition-opacity group-hover:opacity-100"})]})}function Mt({id:t,secondary:e}){const n=ze(),r=n.entities.get(t);if(!r)return null;const s=n.style(r),i=Ad(s.icon);return d.jsx(vt,{to:{kind:"entity",id:t},label:r.name,secondary:e??s.label,icon:d.jsx(i,{size:14}),tone:dt(s.tone)})}function Dd({view:t,select:e,verb:n="Open"}){const r=Yr(t),s=(r==null?void 0:r.icon)??Co;return d.jsxs("button",{type:"button",onClick:()=>a6(t.id,e),className:"group -mx-2 flex w-[calc(100%+16px)] items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-sunken",children:[d.jsx(s,{size:14,className:"shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0 flex-1 text-[12.5px] text-ink",children:[n," ",t.title.charAt(0).toLowerCase()+t.title.slice(1)]}),d.jsx(qf,{size:13,className:"shrink-0 text-ink-4 group-hover:text-poney"})]})}function z$({refs:t}){return t.length?d.jsx(ve,{title:"In the code",count:t.length,children:d.jsx("ul",{className:"space-y-1",children:t.map((e,n)=>d.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[d.jsx(jp,{size:13,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0",children:[d.jsxs("code",{className:"block break-all font-mono text-[11.5px] text-ink",children:[e.path,e.line?`:${e.line}`:""]}),e.symbol&&d.jsx("span",{className:"text-ink-3",children:e.symbol})]})]},n))})}):null}function Bt({children:t}){return d.jsx("p",{className:"text-[13px] leading-relaxed text-ink-2",children:t})}function l6({items:t}){return t.length?d.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(e=>d.jsx("span",{className:"rounded-md bg-sunken px-1.5 py-0.5 text-[11.5px] text-ink-2",children:e},e))}):null}const c6={core:Np,diagrams:[e6],layouts:{"ownership/team-map":QL},inspector:[{id:"ownership",title:"Ownership",render({ref:t,doc:e,idx:n}){if(t.kind!=="entity")return null;const r=n.entities.get(t.id);if(!r)return null;if(r.kind===Xf){const o=Ya(r),a=D$(e,r.id);return d.jsxs("div",{children:[d.jsx(An,{items:[["On call",(o==null?void 0:o.oncall)&&d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx(GD,{size:12,className:"text-ink-3"}),o.oncall]})],["Channel",(o==null?void 0:o.channel)&&d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx(MD,{size:12,className:"text-ink-3"}),o.channel.replace(/^#/,"")]})]]}),d.jsxs("p",{className:"mb-1 mt-3 text-[11.5px] text-ink-3",children:["Owns ",a.length]}),a.map(l=>d.jsx(Mt,{id:l.id},l.id))]})}const s=YL(e,r);if(!s)return null;const i=Ya(s);return d.jsxs("div",{children:[d.jsx(Mt,{id:s.id,secondary:"Owning team"}),d.jsx("div",{className:"mt-2",children:d.jsx(An,{items:[["On call",i==null?void 0:i.oncall],["Channel",i==null?void 0:i.channel]]})})]})}}]};var qe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(qe||(qe={}));var Gw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Gw||(Gw={}));const me=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Js=t=>{switch(typeof t){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(t)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(t)?me.array:t===null?me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?me.promise:typeof Map<"u"&&t instanceof Map?me.map:typeof Set<"u"&&t instanceof Set?me.set:typeof Date<"u"&&t instanceof Date?me.date:me.object;default:return me.unknown}},ne=qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Os extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Os))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Os.create=t=>new Os(t);const rx=(t,e)=>{let n;switch(t.code){case ne.invalid_type:t.received===me.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ne.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,qe.jsonStringifyReplacer)}`;break;case ne.unrecognized_keys:n=`Unrecognized key(s) in object: ${qe.joinValues(t.keys,", ")}`;break;case ne.invalid_union:n="Invalid input";break;case ne.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qe.joinValues(t.options)}`;break;case ne.invalid_enum_value:n=`Invalid enum value. Expected ${qe.joinValues(t.options)}, received '${t.received}'`;break;case ne.invalid_arguments:n="Invalid function arguments";break;case ne.invalid_return_type:n="Invalid function return type";break;case ne.invalid_date:n="Invalid date";break;case ne.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:qe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ne.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ne.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ne.custom:n="Invalid input";break;case ne.invalid_intersection_types:n="Intersection results could not be merged";break;case ne.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ne.not_finite:n="Number must be finite";break;default:n=e.defaultError,qe.assertNever(t)}return{message:n}};let d6=rx;function u6(){return d6}const f6=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ae(t,e){const n=u6(),r=f6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===rx?void 0:rx].filter(s=>!!s)});t.common.issues.push(r)}class qn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Ee;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return qn.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),ec=t=>({status:"dirty",value:t}),fr=t=>({status:"valid",value:t}),Yw=t=>t.status==="aborted",Qw=t=>t.status==="dirty",Qa=t=>t.status==="valid",eh=t=>typeof Promise<"u"&&t instanceof Promise;var xe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(xe||(xe={}));class Ti{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Xw=(t,e)=>{if(Qa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Os(t.common.issues);return this._error=n,this._error}}};function Pe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Ze{get description(){return this._def.description}_getType(e){return Js(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qn,ctx:{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(eh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Js(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Xw(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Js(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Qa(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Qa(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Js(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(eh(s)?s:Promise.resolve(s));return Xw(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ne.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new el({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return yi.create(this,this._def)}nullable(){return tl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this)}promise(){return sh.create(this,this._def)}or(e){return nh.create([this,e],this._def)}and(e){return rh.create(this,e,this._def)}transform(e){return new el({...Pe(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ox({...Pe(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new I6({typeName:Me.ZodBranded,type:this,...Pe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ax({...Pe(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return j1.create(this,e)}readonly(){return lx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const h6=/^c[^\s-]{8,}$/i,p6=/^[0-9a-z]+$/,m6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,y6=/^[a-z0-9_-]{21}$/i,x6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,v6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,k6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bm;const b6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,S6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,j6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,N6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",E6=new RegExp(`^${L$}$`);function F$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function $6(t){return new RegExp(`^${F$(t)}$`)}function M6(t){let e=`${L$}T${F$(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function T6(t,e){return!!((e==="v4"||!e)&&b6.test(t)||(e==="v6"||!e)&&j6.test(t))}function O6(t,e){if(!x6.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function A6(t,e){return!!((e==="v4"||!e)&&S6.test(t)||(e==="v6"||!e)&&C6.test(t))}class ii extends Ze{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==me.string){const i=this._getOrReturnCtx(e);return ae(i,{code:ne.invalid_type,expected:me.string,received:i.parsedType}),Ee}const r=new qn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ae(s,{code:ne.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ae(s,{code:ne.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")k6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"email",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Bm||(Bm=new RegExp(w6,"u")),Bm.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"emoji",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")g6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"uuid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")y6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"nanoid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")h6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cuid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")p6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cuid2",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")m6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"ulid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ae(s,{validation:"url",code:ne.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"regex",code:ne.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?M6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?E6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?$6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?v6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"duration",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?T6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"ip",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?O6(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"jwt",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?A6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cidr",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?_6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"base64",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?N6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"base64url",code:ne.invalid_string,message:i.message}),r.dirty()):qe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ne.invalid_string,...xe.errToObj(r)})}_addCheck(e){return new ii({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...xe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...xe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...xe.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...xe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...xe.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...xe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...xe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...xe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...xe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...xe.errToObj(n)})}nonempty(e){return this.min(1,xe.errToObj(e))}trim(){return new ii({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ii({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ii({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ii.create=t=>new ii({checks:[],typeName:Me.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Pe(t)});function R6(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Jc extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==me.number){const i=this._getOrReturnCtx(e);return ae(i,{code:ne.invalid_type,expected:me.number,received:i.parsedType}),Ee}let r;const s=new qn;for(const i of this._def.checks)i.kind==="int"?qe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?R6(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.not_finite,message:i.message}),s.dirty()):qe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,xe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,xe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,xe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,xe.toString(n))}setLimit(e,n,r,s){return new Jc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:xe.toString(s)}]})}_addCheck(e){return new Jc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:xe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&qe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Jc.create=t=>new Jc({checks:[],typeName:Me.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Pe(t)});class Gc extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==me.bigint)return this._getInvalidInput(e);let r;const s=new qn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:ne.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):qe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ae(n,{code:ne.invalid_type,expected:me.bigint,received:n.parsedType}),Ee}gte(e,n){return this.setLimit("min",e,!0,xe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,xe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,xe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,xe.toString(n))}setLimit(e,n,r,s){return new Gc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:xe.toString(s)}]})}_addCheck(e){return new Gc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Gc.create=t=>new Gc({checks:[],typeName:Me.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Pe(t)});class sx extends Ze{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==me.boolean){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.boolean,received:r.parsedType}),Ee}return fr(e.data)}}sx.create=t=>new sx({typeName:Me.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Pe(t)});class th extends Ze{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==me.date){const i=this._getOrReturnCtx(e);return ae(i,{code:ne.invalid_type,expected:me.date,received:i.parsedType}),Ee}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ae(i,{code:ne.invalid_date}),Ee}const r=new qn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:ne.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):qe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new th({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:xe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:xe.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}th.create=t=>new th({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Me.ZodDate,...Pe(t)});class eb extends Ze{_parse(e){if(this._getType(e)!==me.symbol){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.symbol,received:r.parsedType}),Ee}return fr(e.data)}}eb.create=t=>new eb({typeName:Me.ZodSymbol,...Pe(t)});class tb extends Ze{_parse(e){if(this._getType(e)!==me.undefined){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.undefined,received:r.parsedType}),Ee}return fr(e.data)}}tb.create=t=>new tb({typeName:Me.ZodUndefined,...Pe(t)});class nb extends Ze{_parse(e){if(this._getType(e)!==me.null){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.null,received:r.parsedType}),Ee}return fr(e.data)}}nb.create=t=>new nb({typeName:Me.ZodNull,...Pe(t)});class rb extends Ze{constructor(){super(...arguments),this._any=!0}_parse(e){return fr(e.data)}}rb.create=t=>new rb({typeName:Me.ZodAny,...Pe(t)});class sb extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fr(e.data)}}sb.create=t=>new sb({typeName:Me.ZodUnknown,...Pe(t)});class Oi extends Ze{_parse(e){const n=this._getOrReturnCtx(e);return ae(n,{code:ne.invalid_type,expected:me.never,received:n.parsedType}),Ee}}Oi.create=t=>new Oi({typeName:Me.ZodNever,...Pe(t)});class ib extends Ze{_parse(e){if(this._getType(e)!==me.undefined){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.void,received:r.parsedType}),Ee}return fr(e.data)}}ib.create=t=>new ib({typeName:Me.ZodVoid,...Pe(t)});class Kr extends Ze{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==me.array)return ae(n,{code:ne.invalid_type,expected:me.array,received:n.parsedType}),Ee;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ae(n,{code:o?ne.too_big:ne.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ae(n,{code:ne.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ae(n,{code:ne.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Ti(n,o,n.path,a)))).then(o=>qn.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Ti(n,o,n.path,a)));return qn.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Kr({...this._def,minLength:{value:e,message:xe.toString(n)}})}max(e,n){return new Kr({...this._def,maxLength:{value:e,message:xe.toString(n)}})}length(e,n){return new Kr({...this._def,exactLength:{value:e,message:xe.toString(n)}})}nonempty(e){return this.min(1,e)}}Kr.create=(t,e)=>new Kr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Pe(e)});function ra(t){if(t instanceof wt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=yi.create(ra(r))}return new wt({...t._def,shape:()=>e})}else return t instanceof Kr?new Kr({...t._def,type:ra(t.element)}):t instanceof yi?yi.create(ra(t.unwrap())):t instanceof tl?tl.create(ra(t.unwrap())):t instanceof Eo?Eo.create(t.items.map(e=>ra(e))):t}class wt extends Ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=qe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==me.object){const c=this._getOrReturnCtx(e);return ae(c,{code:ne.invalid_type,expected:me.object,received:c.parsedType}),Ee}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Oi&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const f=i[c],u=s.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Ti(s,u,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Oi){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(c==="strict")a.length>0&&(ae(s,{code:ne.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Ti(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of l){const u=await f.key,h=await f.value;c.push({key:u,value:h,alwaysSet:f.alwaysSet})}return c}).then(c=>qn.mergeObjectSync(r,c)):qn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return xe.errToObj,new wt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:xe.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new wt({...this._def,unknownKeys:"strip"})}passthrough(){return new wt({...this._def,unknownKeys:"passthrough"})}extend(e){return new wt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new wt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Me.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new wt({...this._def,catchall:e})}pick(e){const n={};for(const r of qe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new wt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of qe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new wt({...this._def,shape:()=>n})}deepPartial(){return ra(this)}partial(e){const n={};for(const r of qe.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new wt({...this._def,shape:()=>n})}required(e){const n={};for(const r of qe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof yi;)i=i._def.innerType;n[r]=i}return new wt({...this._def,shape:()=>n})}keyof(){return B$(qe.objectKeys(this.shape))}}wt.create=(t,e)=>new wt({shape:()=>t,unknownKeys:"strip",catchall:Oi.create(),typeName:Me.ZodObject,...Pe(e)});wt.strictCreate=(t,e)=>new wt({shape:()=>t,unknownKeys:"strict",catchall:Oi.create(),typeName:Me.ZodObject,...Pe(e)});wt.lazycreate=(t,e)=>new wt({shape:t,unknownKeys:"strip",catchall:Oi.create(),typeName:Me.ZodObject,...Pe(e)});class nh extends Ze{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Os(a.ctx.common.issues));return ae(n,{code:ne.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Os(l));return ae(n,{code:ne.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}nh.create=(t,e)=>new nh({options:t,typeName:Me.ZodUnion,...Pe(e)});function ix(t,e){const n=Js(t),r=Js(e);if(t===e)return{valid:!0,data:t};if(n===me.object&&r===me.object){const s=qe.objectKeys(e),i=qe.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=ix(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===me.array&&r===me.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=ix(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===me.date&&r===me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class rh extends Ze{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Yw(i)||Yw(o))return Ee;const a=ix(i.value,o.value);return a.valid?((Qw(i)||Qw(o))&&n.dirty(),{status:n.value,value:a.data}):(ae(r,{code:ne.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}rh.create=(t,e,n)=>new rh({left:t,right:e,typeName:Me.ZodIntersection,...Pe(n)});class Eo extends Ze{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.array)return ae(r,{code:ne.invalid_type,expected:me.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return ae(r,{code:ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(ae(r,{code:ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ti(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>qn.mergeArray(n,o)):qn.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Eo({...this._def,rest:e})}}Eo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Eo({items:t,typeName:Me.ZodTuple,rest:null,...Pe(e)})};class ob extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.map)return ae(r,{code:ne.invalid_type,expected:me.map,received:r.parsedType}),Ee;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Ti(r,a,r.path,[c,"key"])),value:i._parse(new Ti(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return Ee;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return Ee;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(c.value,f.value)}return{status:n.value,value:a}}}}ob.create=(t,e,n)=>new ob({valueType:e,keyType:t,typeName:Me.ZodMap,...Pe(n)});class Yc extends Ze{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.set)return ae(r,{code:ne.invalid_type,expected:me.set,received:r.parsedType}),Ee;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ae(r,{code:ne.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ae(r,{code:ne.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const f of l){if(f.status==="aborted")return Ee;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Ti(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Yc({...this._def,minSize:{value:e,message:xe.toString(n)}})}max(e,n){return new Yc({...this._def,maxSize:{value:e,message:xe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Yc.create=(t,e)=>new Yc({valueType:t,minSize:null,maxSize:null,typeName:Me.ZodSet,...Pe(e)});class ab extends Ze{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ab.create=(t,e)=>new ab({getter:t,typeName:Me.ZodLazy,...Pe(e)});class lb extends Ze{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ae(n,{received:n.data,code:ne.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}lb.create=(t,e)=>new lb({value:t,typeName:Me.ZodLiteral,...Pe(e)});function B$(t,e){return new Xa({values:t,typeName:Me.ZodEnum,...Pe(e)})}class Xa extends Ze{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ae(n,{expected:qe.joinValues(r),received:n.parsedType,code:ne.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ae(n,{received:n.data,code:ne.invalid_enum_value,options:r}),Ee}return fr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Xa.create(e,{...this._def,...n})}exclude(e,n=this._def){return Xa.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Xa.create=B$;class cb extends Ze{_parse(e){const n=qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==me.string&&r.parsedType!==me.number){const s=qe.objectValues(n);return ae(r,{expected:qe.joinValues(s),received:r.parsedType,code:ne.invalid_type}),Ee}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=qe.objectValues(n);return ae(r,{received:r.data,code:ne.invalid_enum_value,options:s}),Ee}return fr(e.data)}get enum(){return this._def.values}}cb.create=(t,e)=>new cb({values:t,typeName:Me.ZodNativeEnum,...Pe(e)});class sh extends Ze{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==me.promise&&n.common.async===!1)return ae(n,{code:ne.invalid_type,expected:me.promise,received:n.parsedType}),Ee;const r=n.parsedType===me.promise?n.data:Promise.resolve(n.data);return fr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}sh.create=(t,e)=>new sh({type:t,typeName:Me.ZodPromise,...Pe(e)});class el extends Ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ae(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?ec(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?ec(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Qa(o))return Ee;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Qa(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Ee);qe.assertNever(s)}}el.create=(t,e,n)=>new el({schema:t,typeName:Me.ZodEffects,effect:e,...Pe(n)});el.createWithPreprocess=(t,e,n)=>new el({schema:e,effect:{type:"preprocess",transform:t},typeName:Me.ZodEffects,...Pe(n)});class yi extends Ze{_parse(e){return this._getType(e)===me.undefined?fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yi.create=(t,e)=>new yi({innerType:t,typeName:Me.ZodOptional,...Pe(e)});class tl extends Ze{_parse(e){return this._getType(e)===me.null?fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tl.create=(t,e)=>new tl({innerType:t,typeName:Me.ZodNullable,...Pe(e)});class ox extends Ze{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===me.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ox.create=(t,e)=>new ox({innerType:t,typeName:Me.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pe(e)});class ax extends Ze{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return eh(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ax.create=(t,e)=>new ax({innerType:t,typeName:Me.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pe(e)});class db extends Ze{_parse(e){if(this._getType(e)!==me.nan){const r=this._getOrReturnCtx(e);return ae(r,{code:ne.invalid_type,expected:me.nan,received:r.parsedType}),Ee}return{status:"valid",value:e.data}}}db.create=t=>new db({typeName:Me.ZodNaN,...Pe(t)});class I6 extends Ze{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class j1 extends Ze{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),ec(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new j1({in:e,out:n,typeName:Me.ZodPipeline})}}class lx extends Ze{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Qa(s)&&(s.value=Object.freeze(s.value)),s);return eh(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}lx.create=(t,e)=>new lx({innerType:t,typeName:Me.ZodReadonly,...Pe(e)});var Me;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Me||(Me={}));const P6=ii.create,D6=sx.create;Oi.create;const z6=Kr.create,C1=wt.create;nh.create;rh.create;Eo.create;const V$=Xa.create;sh.create;yi.create;tl.create;const L6=V$(["personal","secret","payment","health"]),ih={personal:"Personal data",secret:"Secrets",payment:"Payment data",health:"Health data"},F6=V$(["public","internal","restricted"]),B6=C1({zone:se.optional(),trust:F6.optional()}).strict(),V6=C1({classes:z6(L6).min(1)}).strict(),W6=C1({encrypted:D6().optional(),auth:P6().min(1).optional()}).strict(),Qc="security/zone",xs={name:"security",version:"0.1.0",description:"Trust zones, sensitive data, and how connections are protected.",entityKinds:{zone:{label:"Trust zone",description:"Where parts trust each other. A line between zones crosses a trust boundary."}},facets:{entity:B6,dataType:V6,relationship:W6},validate(t,{index:e,report:n}){t.model.entities.forEach((r,s)=>{var a;const i=(a=Wr(xs,"entity",r))==null?void 0:a.zone;if(!i)return;const o=e.entities.get(i);o?o.kind!==Qc&&n(`model.entities.${s}.ext.security.zone`,`"${i}" is not a zone (kind "${Qc}")`):n(`model.entities.${s}.ext.security.zone`,`Unknown zone "${i}"`)})},lint(t,{warn:e}){var n,r;for(const s of U$(t)){if(!s.classes.length)continue;const i=s.classes.map(a=>ih[a].toLowerCase()).join(" and "),o=`from ${s.from.name} to ${s.to.name}`;((n=s.protection)==null?void 0:n.encrypted)!==!0&&e(`model.relationships.${s.index}`,"security-unencrypted-crossing",`"${s.relationship.label}" carries ${i} ${o} without encryption.`,"If it is encrypted (TLS counts), set ext.security.encrypted to true on the relationship. If not, the data should not cross this boundary as it is."),(r=s.protection)!=null&&r.auth||e(`model.relationships.${s.index}`,"security-unknown-auth",`"${s.relationship.label}" carries ${i} ${o}, and the document does not say how the caller is authenticated.`,'Set ext.security.auth on the relationship, e.g. "mTLS", "OAuth token" or "none".')}t.model.relationships.forEach((s,i)=>{var c,f;const o=(c=Wr(xs,"relationship",s))==null?void 0:c.auth,a=t.model.entities.find(u=>u.id===s.target),l=nl(t,a);(o==null?void 0:o.toLowerCase())==="none"&&l&&((f=Wr(xs,"entity",l))==null?void 0:f.trust)==="restricted"&&e(`model.relationships.${i}`,"security-open-restricted",`"${s.label}" reaches the restricted zone ${l.name} with no authentication.`,"Name the authentication, or say why this part of a restricted zone is open.")}),t.model.dataTypes.forEach((s,i)=>{var l;if(!oh(s).length||!s.storedIn)return;const o=t.model.entities.find(c=>c.id===s.storedIn),a=nl(t,o);a&&((l=Wr(xs,"entity",a))==null?void 0:l.trust)==="public"&&e(`model.dataTypes.${i}`,"security-sensitive-in-public",`${s.name} holds ${oh(s).map(c=>ih[c].toLowerCase()).join(" and ")}, and is stored in ${o.name}, in the public zone ${a.name}.`,"Move the store to a zone that is not public, or check that the zone is right.")})}};function nl(t,e){var s;const n=new Map(t.model.entities.map(i=>[i.id,i])),r=new Set;for(let i=e;i&&!r.has(i.id);i=i.parent?n.get(i.parent):void 0){if(r.add(i.id),i.kind===Qc)return i;const o=(s=Wr(xs,"entity",i))==null?void 0:s.zone;if(o)return n.get(o)}}const oh=t=>{var e;return((e=Wr(xs,"dataType",t))==null?void 0:e.classes)??[]},W$=t=>Wr(xs,"relationship",t);function U$(t){const e=new Map(t.model.entities.map(s=>[s.id,s])),n=new Map(t.model.dataTypes.map(s=>[s.id,s])),r=[];return t.model.relationships.forEach((s,i)=>{const o=e.get(s.source),a=e.get(s.target),l=nl(t,o),c=nl(t,a);if(!o||!a||!l||!c||l.id===c.id)return;const f=new Set([...s.data,...t.model.dataFlows.filter(h=>h.via===s.id).flatMap(h=>h.data)]),u=[...new Set([...f].flatMap(h=>oh(n.get(h))))];r.push({index:i,relationship:s,from:o,to:a,fromZone:l,toZone:c,classes:u,protection:W$(s)})}),r}function U6(t,e){return t.model.entities.filter(n=>{var r;return n.id!==e&&n.kind!==Qc&&((r=nl(t,n))==null?void 0:r.id)===e})}const Z6={public:"Public: anyone can reach it",internal:"Internal",restricted:"Restricted"},H6=(t,e,n)=>t===void 0?"Not stated":t?e:n,q6={core:xs,inspector:[{id:"security",title:"Security",render({ref:t,doc:e,idx:n}){var r;if(!e.extensions.some(s=>s.name==="security"))return null;if(t.kind==="entity"){const s=n.entities.get(t.id);if(!s)return null;if(s.kind===Qc){const o=(r=Wr(xs,"entity",s))==null?void 0:r.trust,a=U6(e,s.id);return d.jsxs("div",{children:[d.jsx(An,{items:[["Trust",o&&Z6[o]]]}),d.jsxs("p",{className:"mb-1 mt-3 text-[11.5px] text-ink-3",children:["In this zone: ",a.length]}),a.map(l=>d.jsx(Mt,{id:l.id},l.id))]})}const i=nl(e,s);return i?d.jsx(Mt,{id:i.id,secondary:"Trust zone"}):null}if(t.kind==="relationship"){const s=U$(e).find(o=>o.relationship.id===t.id),i=W$(n.relationships.get(t.id));return!s&&!i?null:d.jsx(An,{items:[["Crosses",s&&`${s.fromZone.name} → ${s.toZone.name}`],["Carries",s!=null&&s.classes.length?s.classes.map(o=>ih[o]).join(", "):void 0],["Encrypted",H6(i==null?void 0:i.encrypted,"Yes","No")],["Auth",(i==null?void 0:i.auth)??"Not stated"]]})}if(t.kind==="dataType"){const s=oh(n.dataTypes.get(t.id));return s.length?d.jsx(An,{items:[["Sensitive",s.map(i=>ih[i]).join(", ")]]}):null}return null}}]};var K6=Object.defineProperty,Cl=(t,e)=>K6(t,"name",{value:e,configurable:!0}),Z$=!!(typeof window<"u"&&window.document&&window.document.createElement);function _n(t,e,{checkForDefaultPrevented:n=!0}={}){return Cl(function(s){if(t==null||t(s),n===!1||!s||!s.defaultPrevented)return e==null?void 0:e(s)},"handleEvent")}Cl(_n,"composeEventHandlers");function J6(t){var e;if(!Z$)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}Cl(J6,"getOwnerWindow");function cx(t){if(!Z$)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}Cl(cx,"getOwnerDocument");function H$(t,e=!1){const{activeElement:n}=cx(t);if(!(n!=null&&n.nodeName))return null;if(q$(n)&&n.contentDocument)return H$(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const s=cx(n).getElementById(r);if(s)return s}}return n}Cl(H$,"getActiveElement");function q$(t){return t.tagName==="IFRAME"}Cl(q$,"isFrame");var G6=Object.defineProperty,_1=(t,e)=>G6(t,"name",{value:e,configurable:!0});function dx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}_1(dx,"setRef");function $o(...t){return e=>{let n=!1;const r=t.map(s=>{const i=dx(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():dx(t[s],null)}}}}_1($o,"composeRefs");function Tr(...t){return b.useCallback($o(...t),t)}_1(Tr,"useComposedRefs");var Y6=Object.defineProperty,rr=(t,e)=>Y6(t,"name",{value:e,configurable:!0});function Q6(t,e){const n=b.createContext(e);n.displayName=t+"Context";const r=rr(i=>{const{children:o,...a}=i,l=b.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:o})},"Provider");r.displayName=t+"Provider";function s(i,o={}){const{optional:a=!1}=o,l=b.useContext(n);if(l)return l;if(e!==void 0)return e;if(!a)throw new Error(`\`${i}\` must be used within \`${t}\``)}return rr(s,"useContext"),[r,s]}rr(Q6,"createContext");function $p(t,e=[]){let n=[];function r(i,o){const a=b.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const c=rr(u=>{var y;const{scope:h,children:m,...g}=u,p=((y=h==null?void 0:h[t])==null?void 0:y[l])||a,x=b.useMemo(()=>g,Object.values(g));return d.jsx(p.Provider,{value:x,children:m})},"Provider");c.displayName=i+"Provider";function f(u,h,m={}){var y;const{optional:g=!1}=m,p=((y=h==null?void 0:h[t])==null?void 0:y[l])||a,x=b.useContext(p);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${u}\` must be used within \`${i}\``)}return rr(f,"useContext"),[c,f]}rr(r,"createContext");const s=rr(()=>{const i=n.map(o=>b.createContext(o));return rr(function(a){const l=(a==null?void 0:a[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])},"useScope")},"createScope");return s.scopeName=t,[r,K$(s,...e)]}rr($p,"createContextScope");function K$(...t){const e=t[0];if(t.length===1)return e;const n=rr(()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return rr(function(i){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(i)[`__scope${c}`];return{...a,...u}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}rr(K$,"composeContextScopes");var X6=Object.defineProperty,Gn=(t,e)=>X6(t,"name",{value:e,configurable:!0});function N1(t){const e=b.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];s=tM(s),b.Children.forEach(s,h=>{var m;if(X$(h)){a=!0;const g=h;let p="child"in g.props?g.props.child:g.props.children;for(;E1(p)&&typeof ah=="function";)p=ah(p._payload);o=e8(g,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(h)}),o?o=b.cloneElement(o,void 0,l):!a&&b.Children.count(s)===1&&b.isValidElement(s)&&(o=s);const c=o?Q$(o):void 0,f=Tr(r,c);if(!o){if(s||s===0)throw new Error(a?r8(t):n8(t));return s}const u=Y$(i,o.props??{});return o.type!==b.Fragment&&(u.ref=r?f:c),b.cloneElement(o,u)});return e.displayName=`${t}.Slot`,e}Gn(N1,"createSlot");var J$=Symbol.for("radix.slottable");function G$(t){const e=Gn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=J$,e}Gn(G$,"createSlottable");var e8=Gn((t,e)=>"child"in t.props?b.isValidElement(e)?b.cloneElement(e,void 0,t.props.children(e.props.children)):null:b.isValidElement(e)?e:null,"getSlottableElementFromSlottable");function Y$(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"?n[r]=[s,i].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=nM(i,s))}return{...t,...n}}Gn(Y$,"mergeProps");function Q$(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Gn(Q$,"getElementRef");function X$(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===J$}Gn(X$,"isSlottable");var t8=Symbol.for("react.lazy");function E1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===t8&&"_payload"in t&&eM(t._payload)}Gn(E1,"isLazyComponent");function eM(t){return typeof t=="object"&&t!==null&&"then"in t}Gn(eM,"isPromiseLike");function tM(t){let e=t;for(;E1(e)&&typeof ah=="function";)e=ah(e._payload);return e}Gn(tM,"useUnwrappedLazy");function nM(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Gn(nM,"concatAriaDescribedby");var n8=Gn(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),r8=Gn(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ah=yl[" use ".trim().toString()],s8=Object.defineProperty,i8=(t,e)=>s8(t,"name",{value:e,configurable:!0}),o8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ot=o8.reduce((t,e)=>{const n=N1(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function rM(t,e){t&&bd.flushSync(()=>t.dispatchEvent(e))}i8(rM,"dispatchDiscreteCustomEvent");var Rn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},a8=Object.defineProperty,l8=(t,e)=>a8(t,"name",{value:e,configurable:!0}),ub=yl[" useInsertionEffect ".trim().toString()];function Mo(t){const e=b.useRef(t);return typeof ub=="function"?ub(()=>{e.current=t}):Rn(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}l8(Mo,"useCallbackRef");var c8=Object.defineProperty,Pt=(t,e)=>c8(t,"name",{value:e,configurable:!0}),ux="dismissableLayer.update",d8="dismissableLayer.pointerDownOutside",u8="dismissableLayer.focusOutside",fb,sM=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),iM=b.forwardRef(Pt(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...f}=e,u=b.useContext(sM),[h,m]=b.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=b.useState({}),x=Tr(n,m),y=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),k=v?y.indexOf(v):-1,w=h?y.indexOf(h):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,C=w>=k,_=b.useRef(!1),S=aM(z=>{o==null||o(z),l==null||l(z),z.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:_,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:b.useCallback(z=>{if(!(z instanceof Node))return!1;const I=[...u.branches].some(F=>F.contains(z));return C&&!I},[u.branches,C])}),N=lM(z=>{if(s&&_.current)return;const I=z.target;[...u.branches].some(U=>U.contains(I))||(a==null||a(z),l==null||l(z),z.defaultPrevented||c==null||c())},g),E=h?w===y.length-1:!1,P=Mo(z=>{z.key==="Escape"&&(i==null||i(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))});return b.useEffect(()=>{if(E)return g.addEventListener("keydown",P,{capture:!0}),()=>g.removeEventListener("keydown",P,{capture:!0})},[g,E,P]),b.useEffect(()=>{if(h)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(fb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),fx(),()=>{r&&(u.layersWithOutsidePointerEventsDisabled.delete(h),u.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=fb))}},[h,g,r,u]),b.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),fx())},[h,u]),b.useEffect(()=>{const z=Pt(()=>p({}),"handleUpdate");return document.addEventListener(ux,z),()=>document.removeEventListener(ux,z)},[]),d.jsx(Ot.div,{...f,ref:x,style:{pointerEvents:j?C?"auto":"none":void 0,...e.style},onFocusCapture:_n(e.onFocusCapture,N.onFocusCapture),onBlurCapture:_n(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:_n(e.onPointerDownCapture,S.onPointerDownCapture)})},"DismissableLayer"));function oM(){const t=b.useContext(sM),[e,n]=b.useState(null);return b.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Pt(oM,"useDismissableLayerSurface");var f8=Pt(()=>!0,"IS_TRUE");function aM(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=f8}=e,a=Mo(t),l=b.useRef(!1),c=b.useRef(!1),f=b.useRef(new Map),u=b.useRef(()=>{});return b.useEffect(()=>{function h(){c.current=!1,s.current=!1,f.current.clear()}Pt(h,"resetOutsideInteraction");function m(){return Array.from(f.current.values()).some(Boolean)}Pt(m,"isOutsideInteractionIntercepted");function g(k){if(!c.current)return;const w=k.target;w instanceof Node&&[...i].some(C=>C.contains(w))||f.current.set(k.type,!0),k.type==="click"&&window.setTimeout(()=>{c.current&&u.current()},0)}Pt(g,"handleInteractionCapture");function p(k){c.current&&f.current.set(k.type,!1)}Pt(p,"handleInteractionBubble");const x=Pt(k=>{if(k.target&&!l.current){let w=function(){n.removeEventListener("click",u.current);const C=m();h(),C||$1(d8,a,j,{discrete:!0})};if(Pt(w,"handleAndDispatchPointerDownOutsideEvent"),!o(k.target)){n.removeEventListener("click",u.current),h(),l.current=!1;return}const j={originalEvent:k};c.current=!0,s.current=r&&k.button===0,f.current.clear(),!r||k.button!==0?w():(n.removeEventListener("click",u.current),u.current=w,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),h();l.current=!1},"handlePointerDown"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const k of y)n.addEventListener(k,g,!0),n.addEventListener(k,p);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",x),n.removeEventListener("click",u.current);for(const k of y)n.removeEventListener(k,g,!0),n.removeEventListener(k,p)}},[n,a,r,s,i,o]),{onPointerDownCapture:Pt(()=>l.current=!0,"onPointerDownCapture")}}Pt(aM,"usePointerDownOutside");function lM(t,e=globalThis==null?void 0:globalThis.document){const n=Mo(t),r=b.useRef(!1);return b.useEffect(()=>{const s=Pt(i=>{i.target&&!r.current&&$1(u8,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:Pt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Pt(()=>r.current=!1,"onBlurCapture")}}Pt(lM,"useFocusOutside");function fx(){const t=new CustomEvent(ux);document.dispatchEvent(t)}Pt(fx,"dispatchUpdate");function $1(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?rM(s,i):s.dispatchEvent(i)}Pt($1,"handleAndDispatchCustomEvent");var h8=Object.defineProperty,jt=(t,e)=>h8(t,"name",{value:e,configurable:!0}),Vm="focusScope.autoFocusOnMount",Wm="focusScope.autoFocusOnUnmount",hb={bubbles:!1,cancelable:!0},p8=b.forwardRef(jt(function(e,n){const{loop:r=!1,trapped:s=!1,branches:i,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,f]=b.useState(null),u=Mo(o),h=Mo(a),m=b.useRef(null),g=Tr(n,f),p=b.useRef(i);b.useEffect(()=>{p.current=i});const x=b.useCallback(k=>{var w;return k?c!=null&&c.contains(k)?!0:!!((w=p.current)!=null&&w.some(j=>j.contains(k))):!1},[c]),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(s){let k=function(_){if(y.paused||!c)return;const S=_.target;x(S)?m.current=S:hs(m.current,{select:!0})},w=function(_){if(y.paused||!c)return;const S=_.relatedTarget;S!==null&&(x(S)||hs(m.current,{select:!0}))},j=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&hs(c)};jt(k,"handleFocusIn"),jt(w,"handleFocusOut"),jt(j,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",w);const C=new MutationObserver(j);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",w),C.disconnect()}}},[s,c,y.paused,x]),b.useEffect(()=>{if(c){pb.add(y);const k=document.activeElement;if(!c.contains(k)){const j=new CustomEvent(Vm,hb);c.addEventListener(Vm,u),c.dispatchEvent(j),j.defaultPrevented||(hM(xM(M1(c)),{select:!0}),document.activeElement===k&&hs(c))}return()=>{c.removeEventListener(Vm,u);const j=c.ownerDocument,C=CustomEvent;setTimeout(()=>{const _=new C(Wm,hb);c.addEventListener(Wm,h),c.dispatchEvent(_),_.defaultPrevented||hs(k??j.body,{select:!0}),c.removeEventListener(Wm,h),pb.remove(y)},0)}}},[c,u,h,y]);const v=b.useCallback(k=>{if(!r&&!s||y.paused)return;const w=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,j=document.activeElement;if(w&&j){const C=k.currentTarget,[_,S]=pM(C);_&&S?!k.shiftKey&&j===S?(k.preventDefault(),r&&hs(_,{select:!0})):k.shiftKey&&j===_&&(k.preventDefault(),r&&hs(S,{select:!0})):j===C&&k.preventDefault()}},[r,s,y.paused]);return d.jsx(Ot.div,{tabIndex:-1,...l,ref:g,onKeyDown:v})},"FocusScope")),cM=b.createContext(null);function dM({registry:t,children:e}){return t?d.jsx(cM.Provider,{value:t,children:e}):e}jt(dM,"FocusScopeBranchProvider");function uM(){const[t,e]=b.useState([]),n=b.useMemo(()=>({add:jt(r=>e(s=>s.includes(r)?s:[...s,r]),"add"),remove:jt(r=>e(s=>s.filter(i=>i!==r)),"remove")}),[]);return{nodes:t,registry:n}}jt(uM,"useFocusScopeBranchRegistry");function fM(t){const e=b.useContext(cM);b.useEffect(()=>{if(!(!t||!e))return e.add(t),()=>e.remove(t)},[t,e])}jt(fM,"useFocusScopeBranch");function hM(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(hs(r,{select:e}),document.activeElement!==n)return}jt(hM,"focusFirst");function pM(t){const e=M1(t),n=hx(e,t),r=hx(e.reverse(),t);return[n,r]}jt(pM,"getTabbableEdges");function M1(t){const e=[],r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:jt(s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)e.push(r.currentNode);return e}jt(M1,"getTabbableCandidates");function hx(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):mM(r,{upTo:e})))return r}jt(hx,"findVisible");function mM(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}jt(mM,"isHidden");function gM(t){return t.tagName==="INPUT"&&typeof t.select=="function"}jt(gM,"isSelectableInput");function hs(t,{select:e=!1}={}){if(t&&t.focus){const r=(t.ownerDocument??document).activeElement;t.focus({preventScroll:!0}),t!==r&&gM(t)&&e&&t.select()}}jt(hs,"focus");var pb=yM();function yM(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=px(t,e),t.unshift(e)},remove(e){var n;t=px(t,e),(n=t[0])==null||n.resume()}}}jt(yM,"createFocusScopesStack");function px(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}jt(px,"arrayRemove");function xM(t){return t.filter(e=>e.tagName!=="A")}jt(xM,"removeLinks");var m8=Object.defineProperty,g8=(t,e)=>m8(t,"name",{value:e,configurable:!0}),y8=yl[" useId ".trim().toString()]||(()=>{}),x8=0;function Cr(t){const[e,n]=b.useState(y8());return Rn(()=>{t||n(r=>r??String(x8++))},[t]),t||(e?`radix-${e}`:"")}g8(Cr,"useId");const v8=["top","right","bottom","left"],Ai=Math.min,Ss=Math.max,lh=Math.round,mu=Math.floor,js=t=>({x:t,y:t}),k8={left:"right",right:"left",bottom:"top",top:"bottom"};function vM(t,e,n){return Ss(t,Ai(e,n))}function As(t,e){return typeof t=="function"?t(e):t}function Ri(t){return t.split("-")[0]}function _l(t){return t.split("-")[1]}function T1(t){return t==="x"?"y":"x"}function O1(t){return t==="y"?"height":"width"}function Ur(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function A1(t){return T1(Ur(t))}function w8(t,e,n){n===void 0&&(n=!1);const r=_l(t),s=A1(t),i=O1(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=ch(o)),[o,ch(o)]}function b8(t){const e=ch(t);return[mx(t),e,mx(e)]}function mx(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const mb=["left","right"],gb=["right","left"],S8=["top","bottom"],j8=["bottom","top"];function C8(t,e,n){switch(t){case"top":case"bottom":return n?e?gb:mb:e?mb:gb;case"left":case"right":return e?S8:j8;default:return[]}}function _8(t,e,n,r){const s=_l(t);let i=C8(Ri(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(mx)))),i}function ch(t){const e=Ri(t);return k8[e]+t.slice(e.length)}function N8(t){var e,n,r,s;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(s=t.left)!=null?s:0}}function kM(t){return typeof t!="number"?N8(t):{top:t,right:t,bottom:t,left:t}}function dh(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function yb(t,e,n){let{reference:r,floating:s}=t;const i=Ur(e),o=A1(e),a=O1(o),l=Ri(e),c=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}const g=_l(e);return g&&(m[o]+=h*(g==="end"?1:-1)*(n&&c?-1:1)),m}async function E8(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=As(e,t),g=kM(m),x=a[h?u==="floating"?"reference":"floating":u],y=dh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),v=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(k))&&await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1},j=dh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:l}):v);return{top:(y.top-j.top+g.top)/w.y,bottom:(j.bottom-y.bottom+g.bottom)/w.y,left:(y.left-j.left+g.left)/w.x,right:(j.right-y.right+g.right)/w.x}}const $8=50,M8=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:E8},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:u}=yb(c,r,l),h=r,m=0;const g={};for(let p=0;p<i.length;p++){const x=i[p];if(!x)continue;const{name:y,fn:v}=x,{x:k,y:w,data:j,reset:C}=await v({x:f,y:u,initialPlacement:r,placement:h,strategy:s,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});f=k??f,u=w??u,g[y]={...g[y],...j},C&&m<$8&&(m++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:f,y:u}=yb(c,h,l)),p=-1)}return{x:f,y:u,placement:h,strategy:s,middlewareData:g}},T8=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:f=0}=As(t,e)||{};if(c==null)return{};const u=kM(f),h={x:n,y:r},m=A1(s),g=O1(m),p=await o.getDimensions(c),x=m==="y",y=x?"top":"left",v=x?"bottom":"right",k=x?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[m]-h[m]-i.floating[g],j=h[m]-i.reference[m],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let _=C?C[k]:0;(!_||!await(o.isElement==null?void 0:o.isElement(C)))&&(_=a.floating[k]||i.floating[g]);const S=w/2-j/2,N=_/2-p[g]/2-1,E=Ai(u[y],N),P=Ai(u[v],N),z=_-p[g]-P,I=_/2-p[g]/2+S,F=vM(E,I,z),U=!l.arrow&&_l(s)!=null&&I!==F&&i.reference[g]/2-(I<E?E:P)-p[g]/2<0,M=U?I<E?I-E:I-z:0;return{[m]:h[m]+M,data:{[m]:F,centerOffset:I-F-M,...U&&{alignmentOffset:M}},reset:U}}}),O8=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...x}=As(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Ri(s),v=Ur(a),k=Ri(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),j=h||(k||!p?[ch(a)]:b8(a)),C=g!=="none";!h&&C&&j.push(..._8(a,p,g,w));const _=[a,...j],S=await l.detectOverflow(e,x),N=[];let E=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&N.push(S[y]),u){const F=w8(s,o,w);N.push(S[F[0]],S[F[1]])}if(E=[...E,{placement:s,overflows:N}],!N.every(F=>F<=0)){var P,z;const F=(((P=i.flip)==null?void 0:P.index)||0)+1,U=_[F];if(U&&(!(u==="alignment"?v!==Ur(U):!1)||E.every(A=>Ur(A.placement)===v?A.overflows[0]>0:!0)))return{data:{index:F,overflows:E},reset:{placement:U}};let M=(z=E.filter($=>$.overflows[0]<=0).sort(($,A)=>$.overflows[1]-A.overflows[1])[0])==null?void 0:z.placement;if(!M)switch(m){case"bestFit":{var I;const $=(I=E.filter(A=>{if(C){const B=Ur(A.placement);return B===v||B==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(B=>B>0).reduce((B,K)=>B+K,0)]).sort((A,B)=>A[1]-B[1])[0])==null?void 0:I[0];$&&(M=$);break}case"initialPlacement":M=a;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function xb(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function vb(t){return v8.some(e=>t[e]>=0)}const A8=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=As(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),a=xb(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:vb(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),a=xb(o,n.floating);return{data:{escapedOffsets:a,escaped:vb(a)}}}default:return{}}}}},wM=new Set(["left","top"]);async function R8(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ri(n),a=_l(n),l=Ur(n)==="y",c=wM.has(o)?-1:1,f=i&&l?-1:1,u=As(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*f,y:h*c}:{x:h*c,y:m*f}}const I8=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await R8(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},P8=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:k,y:w}=v;return{x:k,y:w}}},...c}=As(t,e),f={x:n,y:r},u=await i.detectOverflow(e,c),h=Ur(s),m=T1(h);let g=f[m],p=f[h];const x=(v,k)=>vM(k+u[v==="y"?"top":"left"],k,k-u[v==="y"?"bottom":"right"]);o&&(g=x(m,g)),a&&(p=x(h,p));const y=l.fn({...e,[m]:g,[h]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[h]:a}}}}}},D8=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:s,y:i,placement:o,rects:a,middlewareData:l}=e,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=As(t,e),h={x:s,y:i},m=Ur(o),g=T1(m);let p=h[g],x=h[m];const y=As(c,e),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(f){const j=g==="y"?"height":"width",C=a.reference[g]-a.floating[j]+v.mainAxis,_=a.reference[g]+a.reference[j]-v.mainAxis;p<C?p=C:p>_&&(p=_)}if(u){var k,w;const j=g==="y"?"width":"height",C=wM.has(Ri(o)),_=a.reference[m]-a.floating[j]+(C&&((k=l.offset)==null?void 0:k[m])||0)+(C?0:v.crossAxis),S=a.reference[m]+a.reference[j]+(C?0:((w=l.offset)==null?void 0:w[m])||0)-(C?v.crossAxis:0);x<_?x=_:x>S&&(x=S)}return{[g]:p,[m]:x}}}},z8=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=As(t,e),l=await s.detectOverflow(e,a),c=Ri(n),f=_l(n),u=Ur(n)==="y",{width:h,height:m}=r.floating;let g,p;c==="top"||c==="bottom"?(g=c,p=f===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(p=c,g=f==="end"?"top":"bottom");const x=m-l.top-l.bottom,y=h-l.left-l.right,v=Ai(m-l[g],x),k=Ai(h-l[p],y),w=e.middlewareData.shift,j=!w;let C=v,_=k;w!=null&&w.enabled.x&&(_=y),w!=null&&w.enabled.y&&(C=x),j&&!f&&(u?_=h-2*Ss(l.left,l.right):C=m-2*Ss(l.top,l.bottom)),await o({...e,availableWidth:_,availableHeight:C});const S=await s.getDimensions(i.floating);return h!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function Mp(){return typeof window<"u"}function Nl(t){return bM(t)?(t.nodeName||"").toLowerCase():"#document"}function In(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zs(t){var e;return(e=(bM(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function bM(t){return Mp()?t instanceof Node||t instanceof In(t).Node:!1}function Qr(t){return Mp()?t instanceof Element||t instanceof In(t).Element:!1}function Bi(t){return Mp()?t instanceof HTMLElement||t instanceof In(t).HTMLElement:!1}function kb(t){return!Mp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof In(t).ShadowRoot}function Tp(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Xr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function L8(t){return/^(table|td|th)$/.test(Nl(t))}function Op(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const F8=/transform|translate|scale|rotate|perspective|filter/,B8=/paint|layout|strict|content/,Zi=t=>!!t&&t!=="none";let Um;function R1(t){const e=Qr(t)?Xr(t):t;return Zi(e.transform)||Zi(e.translate)||Zi(e.scale)||Zi(e.rotate)||Zi(e.perspective)||!I1()&&(Zi(e.backdropFilter)||Zi(e.filter))||F8.test(e.willChange||"")||B8.test(e.contain||"")}function V8(t){let e=To(t);for(;Bi(e)&&!Xc(e);){if(R1(e))return e;if(Op(e))return null;e=To(e)}return null}function I1(){return Um==null&&(Um=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Um}function Xc(t){return/^(html|body|#document)$/.test(Nl(t))}function Xr(t){return In(t).getComputedStyle(t)}function Ap(t){return Qr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function To(t){if(Nl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kb(t)&&t.host||zs(t);return kb(e)?e.host:e}function SM(t){const e=To(t);return Xc(e)?(t.ownerDocument||t).body:Bi(e)&&Tp(e)?e:SM(e)}function ed(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=SM(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=In(s);if(i){const a=gx(o);return e.concat(o,o.visualViewport||[],Tp(s)?s:[],a&&n?ed(a):[])}else return e.concat(s,ed(s,[],n))}function gx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function jM(t){const e=Xr(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Bi(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,a=lh(n)!==i||lh(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function P1(t){return Qr(t)?t:t.contextElement}function Aa(t){const e=P1(t);if(!Bi(e))return js(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=jM(e);let o=(i?lh(n.width):n.width)/r,a=(i?lh(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const W8=js(0);function CM(t){const e=In(t);return!I1()||!e.visualViewport?W8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function U8(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===In(t)}function Oo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=P1(t);let o=js(1);e&&(r?Qr(r)&&(o=Aa(r)):o=Aa(t));const a=U8(i,n,r)?CM(i):js(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i&&r){const h=In(i),m=Qr(r)?In(r):r;let g=h,p=gx(g);for(;p&&m!==g;){const x=Aa(p),y=p.getBoundingClientRect(),v=Xr(p),k=y.left+(p.clientLeft+parseFloat(v.paddingLeft))*x.x,w=y.top+(p.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,c*=x.y,f*=x.x,u*=x.y,l+=k,c+=w,g=In(p),p=gx(g)}}return dh({width:f,height:u,x:l,y:c})}function Rp(t,e){const n=Ap(t).scrollLeft;return e?e.left+n:Oo(zs(t)).left+n}function _M(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Rp(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function Z8(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=zs(r),a=e?Op(e.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=js(1);const f=js(0),u=Bi(r);if((u||!i)&&((Nl(r)!=="body"||Tp(o))&&(l=Ap(r)),u)){const m=Oo(r);c=Aa(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const h=o&&!u&&!i?_M(o,l):js(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+h.x,y:n.y*c.y-l.scrollTop*c.y+f.y+h.y}}function H8(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function q8(t){const e=Ap(t),n=t.ownerDocument.body,r=Ss(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Ss(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+Rp(t);const o=-e.scrollTop;return Xr(n).direction==="rtl"&&(i+=Ss(t.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}const K8=25;function J8(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=In(t),i=zs(t),o=s.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,f=0;if(o){const h=!I1()||e==="fixed";r?h||(c=-o.offsetLeft,f=-o.offsetTop):(a=o.width,l=o.height,h&&(c=o.offsetLeft,f=o.offsetTop))}if(Rp(i)<=0){const h=i.ownerDocument,m=h.body,g=getComputedStyle(m),p=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(i.clientWidth-m.clientWidth-p),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?x/2:x;y<=K8&&(a-=y)}return{width:a,height:l,x:c,y:f}}function G8(t,e){const n=Oo(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Aa(t),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function wb(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=J8(t,n,e);else if(e==="document")r=q8(zs(t));else if(Qr(e))r=G8(e,n);else{const s=CM(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return dh(r)}function Y8(t,e){const n=e.get(t);if(n)return n;let r=ed(t,[],!1).filter(a=>Qr(a)&&Nl(a)!=="body"),s=null;const i=Xr(t).position==="fixed";let o=i?To(t):t;for(;Qr(o)&&!Xc(o);){const a=Xr(o),l=R1(o),c=s?s.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(u=>u!==o):s=a,o=To(o)}return e.set(t,r),r}function Q8(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?Op(e)?[]:Y8(e,this._c):[].concat(n),r],a=wb(e,o[0],s);let l=a.top,c=a.right,f=a.bottom,u=a.left;for(let h=1;h<o.length;h++){const m=wb(e,o[h],s);l=Ss(m.top,l),c=Ai(m.right,c),f=Ai(m.bottom,f),u=Ss(m.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function X8(t){const{width:e,height:n}=jM(t);return{width:e,height:n}}function eF(t,e,n){const r=Bi(e),s=zs(e),i=n==="fixed",o=Oo(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=js(0);if((r||!i)&&((Nl(e)!=="body"||Tp(s))&&(a=Ap(e)),r)){const h=Oo(e,!0,i,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!r&&s&&(l.x=Rp(s));const c=s&&!r&&!i?_M(s,a):js(0),f=o.left+a.scrollLeft-l.x-c.x,u=o.top+a.scrollTop-l.y-c.y;return{x:f,y:u,width:o.width,height:o.height}}function Zm(t){return Xr(t).position==="static"}function bb(t,e){if(!Bi(t)||Xr(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return zs(t)===n&&(n=n.ownerDocument.body),n}function NM(t,e){const n=In(t);if(Op(t))return n;if(!Bi(t)){let s=To(t);for(;s&&!Xc(s);){if(Qr(s)&&!Zm(s))return s;s=To(s)}return n}let r=bb(t,e);for(;r&&L8(r)&&Zm(r);)r=bb(r,e);return r&&Xc(r)&&Zm(r)&&!R1(r)?n:r||V8(t)||n}const tF=async function(t){const e=this.getOffsetParent||NM,n=this.getDimensions,r=await n(t.floating);return{reference:eF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nF(t){return Xr(t).direction==="rtl"}const rF={convertOffsetParentRelativeRectToViewportRelativeRect:Z8,getDocumentElement:zs,getClippingRect:Q8,getOffsetParent:NM,getElementRects:tF,getClientRects:H8,getDimensions:X8,getScale:Aa,isElement:Qr,isRTL:nF};function EM(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function sF(t,e,n){let r=null,s;const i=zs(t);function o(){var f;clearTimeout(s),(f=r)==null||f.disconnect(),r=null}function a(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),o();const h=t.getBoundingClientRect(),{left:m,top:g,width:p,height:x}=h;if(f||e(),!p||!x)return;const y=mu(g),v=mu(i.clientWidth-(m+p)),k=mu(i.clientHeight-(g+x)),w=mu(m),C={rootMargin:-y+"px "+-v+"px "+-k+"px "+-w+"px",threshold:Ss(0,Ai(1,u))||1};let _=!0;function S(N){const E=N[0].intersectionRatio;if(!EM(h,t.getBoundingClientRect()))return a();if(E!==u){if(!_)return a();E?a(!1,E):s=setTimeout(()=>{a(!1,1e-7)},1e3)}_=!1}try{r=new IntersectionObserver(S,{...C,root:i.ownerDocument})}catch{r=new IntersectionObserver(S,C)}r.observe(t)}const l=In(t),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function iF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=P1(t),f=s||i?[...c?ed(c):[],...e?ed(e):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const u=c&&a?sF(c,n,i):null;let h=-1,m=null;o&&(m=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&m&&e&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=m)==null||k.observe(e)})),n()}),c&&!l&&m.observe(c),e&&m.observe(e));let g,p=l?Oo(t):null;l&&x();function x(){const y=Oo(t);p&&!EM(p,y)&&n(),p=y,g=requestAnimationFrame(x)}return n(),()=>{var y;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(y=m)==null||y.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const oF=I8,aF=P8,lF=O8,cF=z8,dF=A8,Sb=T8,uF=D8,fF=(t,e,n)=>{const r=new Map,s=n??{},i={...rF,...s.platform,_c:r};return M8(t,e,{...s,platform:i})};var hF=typeof document<"u",pF=function(){},Yu=hF?b.useLayoutEffect:pF;function uh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!uh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!uh(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function $M(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function jb(t,e){const n=$M(t);return Math.round(e*n)/n}function Hm(t){const e=b.useRef(t);return Yu(()=>{e.current=t}),e}function mF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[f,u]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,m]=b.useState(r);uh(h,r)||m(r);const[g,p]=b.useState(null),[x,y]=b.useState(null),v=b.useCallback(A=>{A!==C.current&&(C.current=A,p(A))},[]),k=b.useCallback(A=>{A!==_.current&&(_.current=A,y(A))},[]),w=i||g,j=o||x,C=b.useRef(null),_=b.useRef(null),S=b.useRef(f),N=l!=null,E=Hm(l),P=Hm(s),z=Hm(c),I=b.useCallback(()=>{if(!C.current||!_.current)return;const A={placement:e,strategy:n,middleware:h};P.current&&(A.platform=P.current),fF(C.current,_.current,A).then(B=>{const K={...B,isPositioned:z.current!==!1};F.current&&!uh(S.current,K)&&(S.current=K,bd.flushSync(()=>{u(K)}))})},[h,e,n,P,z]);Yu(()=>{c===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,u(A=>({...A,isPositioned:!1})))},[c]);const F=b.useRef(!1);Yu(()=>(F.current=!0,()=>{F.current=!1}),[]),Yu(()=>{if(w&&(C.current=w),j&&(_.current=j),w&&j){if(E.current)return E.current(w,j,I);I()}},[w,j,I,E,N]);const U=b.useMemo(()=>({reference:C,floating:_,setReference:v,setFloating:k}),[v,k]),M=b.useMemo(()=>({reference:w,floating:j}),[w,j]),$=b.useMemo(()=>{const A={position:n,left:0,top:0};if(!M.floating)return A;const B=jb(M.floating,f.x),K=jb(M.floating,f.y);return a?{...A,transform:"translate("+B+"px, "+K+"px)",...$M(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:K}},[n,a,M.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:I,refs:U,elements:M,floatingStyles:$}),[f,I,U,M,$])}const gF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Sb({element:r.current,padding:s}).fn(n):{}:r?Sb({element:r,padding:s}).fn(n):{}}}},yF=(t,e)=>{const n=oF(t);return{name:n.name,fn:n.fn,options:[t,e]}},xF=(t,e)=>{const n=aF(t);return{name:n.name,fn:n.fn,options:[t,e]}},vF=(t,e)=>({fn:uF(t).fn,options:[t,e]}),kF=(t,e)=>{const n=lF(t);return{name:n.name,fn:n.fn,options:[t,e]}},wF=(t,e)=>{const n=cF(t);return{name:n.name,fn:n.fn,options:[t,e]}},bF=(t,e)=>{const n=dF(t);return{name:n.name,fn:n.fn,options:[t,e]}},SF=(t,e)=>{const n=gF(t);return{name:n.name,fn:n.fn,options:[t,e]}};var jF=Object.defineProperty,CF=(t,e)=>jF(t,"name",{value:e,configurable:!0});function MM(t){const[e,n]=b.useState(void 0);return Rn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=0;const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,f=Array.isArray(c)?c[0]:c;a=f.inlineSize,l=f.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})})});return s.observe(t,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}else n(void 0)},[t]),e}CF(MM,"useSize");var _F=Object.defineProperty,xi=(t,e)=>_F(t,"name",{value:e,configurable:!0}),Cb={Partial:"partial"},_b={Optimized:"optimized",Always:"always"},TM="Popper",[OM,AM]=$p(TM),[NF,RM]=OM(TM),EF=xi(t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null),[i,o]=b.useState(void 0);return d.jsx(NF,{scope:e,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})},"Popper"),$F="PopperAnchor",MF=b.forwardRef(xi(function(e,n){const{__scopePopper:r,virtualRef:s,...i}=e,o=RM($F,r),a=b.useRef(null),l=o.onAnchorChange,c=b.useCallback(p=>{a.current=p,p&&l(p)},[l]),f=Tr(n,c),u=b.useRef(null);b.useEffect(()=>{if(!s)return;const p=u.current;u.current=s.current,p!==u.current&&l(u.current)});const h=o.placementState&&Ip(o.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return s?null:d.jsx(Ot.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...i,ref:f})},"PopperAnchor")),IM="PopperContent",[TF,SY]=OM(IM),OF=b.forwardRef(xi(function(e,n){var J,re,Te,Le,Ke,gt,Xt;const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:h=Cb.Partial,hideWhenDetached:m=!1,updatePositionStrategy:g=_b.Optimized,onPlaced:p,...x}=e,y=RM(IM,r),[v,k]=b.useState(null),w=Tr(n,k),[j,C]=b.useState(null),_=MM(j),S=(_==null?void 0:_.width)??0,N=(_==null?void 0:_.height)??0,E=s+(o!=="center"?"-"+o:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},z=Array.isArray(f)?f:[f],I=z.length>0,F={padding:P,boundary:z.filter(PM),altBoundary:I},{refs:U,floatingStyles:M,placement:$,isPositioned:A,middlewareData:B}=mF({strategy:"fixed",placement:E,whileElementsMounted:xi((...Wt)=>iF(...Wt,{animationFrame:g===_b.Always}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[yF({mainAxis:i+N,alignmentAxis:a}),c&&xF({mainAxis:!0,crossAxis:!1,...h===Cb.Partial?{limiter:vF()}:{},...F}),c&&kF({...F}),wF({...F,apply:xi(({elements:Wt,rects:At,availableWidth:Qe,availableHeight:Dn})=>{const{width:Ut,height:le}=At.reference,it=Wt.floating.style;it.setProperty("--radix-popper-available-width",`${Qe}px`),it.setProperty("--radix-popper-available-height",`${Dn}px`),it.setProperty("--radix-popper-anchor-width",`${Ut}px`),it.setProperty("--radix-popper-anchor-height",`${le}px`)},"apply")}),j&&SF({element:j,padding:l}),AF({arrowWidth:S,arrowHeight:N}),m&&bF(I?{strategy:"referenceHidden",...F}:{strategy:"referenceHidden",padding:F.padding,altBoundary:F.altBoundary})]}),K=y.setPlacementState;Rn(()=>(K($),()=>{K(void 0)}),[$,K]);const[Q,D]=Ip($),L=Mo(p);Rn(()=>{A&&(L==null||L())},[A,L]);const W=(J=B.arrow)==null?void 0:J.x,H=(re=B.arrow)==null?void 0:re.y,O=((Te=B.arrow)==null?void 0:Te.centerOffset)!==0,[R,V]=b.useState();return Rn(()=>{v&&V(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:A?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(Le=B.transformOrigin)==null?void 0:Le.x,(Ke=B.transformOrigin)==null?void 0:Ke.y].join(" "),...((gt=B.hide)==null?void 0:gt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(TF,{scope:r,placedSide:Q,placedAlign:D,onArrowChange:C,arrowX:W,arrowY:H,shouldHideArrow:O,children:d.jsx(Ot.div,{"data-side":Q,"data-align":D,...x,ref:w,style:{...x.style,animation:A?(Xt=x.style)==null?void 0:Xt.animation:"none"}})})})},"PopperContent"));function PM(t){return t!==null}xi(PM,"isNotNull");var AF=xi(t=>({name:"transformOrigin",options:t,fn(e){var x,y,v;const{placement:n,rects:r,middlewareData:s}=e,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,f]=Ip(n),u={start:"0%",center:"50%",end:"100%"}[f],h=(((y=s.arrow)==null?void 0:y.x)??0)+a/2,m=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let g="",p="";return c==="bottom"?(g=o?u:`${h}px`,p=`${-l}px`):c==="top"?(g=o?u:`${h}px`,p=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,p=o?u:`${m}px`):c==="left"&&(g=`${r.floating.width+l}px`,p=o?u:`${m}px`),{data:{x:g,y:p}}}}),"transformOrigin");function Ip(t){const[e,n="center"]=t.split("-");return[e,n]}xi(Ip,"getSideAndAlignFromPlacement");var RF=Object.defineProperty,IF=(t,e)=>RF(t,"name",{value:e,configurable:!0}),DM=b.forwardRef(IF(function(e,n){var l;const{container:r,...s}=e,[i,o]=b.useState(!1);Rn(()=>o(!0),[]);const a=r||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?bd.createPortal(d.jsx(Ot.div,{...s,ref:n}),a):null},"Portal")),PF=Object.defineProperty,Rs=(t,e)=>PF(t,"name",{value:e,configurable:!0});function zM(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}Rs(zM,"useStateMachine");var zd=Rs(t=>{const{present:e,children:n}=t,r=LM(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=FM(r.ref,BM(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:i}):null},"Presence");function LM(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),i=b.useRef("none"),o=b.useRef(void 0),a=t?"mounted":"unmounted",[l,c]=zM(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{l==="mounted"?(i.current=o.current??sa(r.current),o.current=void 0):i.current="none"},[l]),Rn(()=>{const f=r.current,u=s.current;if(u!==t){const m=i.current,g=sa(f);t?(o.current=g,c("MOUNT")):g==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(u&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Rn(()=>{if(e){let f;const u=e.ownerDocument.defaultView??window,h=Rs(g=>{const x=sa(r.current).includes(CSS.escape(g.animationName));if(g.target===e&&x&&(c("ANIMATION_END"),!s.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",f=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},"handleAnimationEnd"),m=Rs(g=>{g.target===e&&(i.current=sa(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{u.clearTimeout(f),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(f=>{if(f){const u=getComputedStyle(f);r.current=u,o.current=sa(u)}else r.current=null;n(f)},[])}}Rs(LM,"usePresence");function yx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Rs(yx,"setRef");function FM(...t){const e=b.useRef(t);return e.current=t,b.useCallback(n=>{const r=e.current;let s=!1;const i=r.map(o=>{const a=yx(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():yx(r[o],null)}}},[])}Rs(FM,"useStableComposedRefs");function sa(t){return(t==null?void 0:t.animationName)||"none"}Rs(sa,"getAnimationName");function BM(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Rs(BM,"getElementRef");var DF=Object.defineProperty,zF=(t,e)=>DF(t,"name",{value:e,configurable:!0}),Nb=yl[" useEffectEvent ".trim().toString()],Eb=yl[" useInsertionEffect ".trim().toString()];function VM(t){if(typeof Nb=="function")return Nb(t);const e=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Eb=="function"?Eb(()=>{e.current=t}):Rn(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}zF(VM,"useEffectEvent");var LF=Object.defineProperty,Ld=(t,e)=>LF(t,"name",{value:e,configurable:!0}),FF=yl[" useInsertionEffect ".trim().toString()]||Rn;function D1({prop:t,defaultProp:e,onChange:n=Ld(()=>{},"onChange"),caller:r}){const[s,i,o]=WM({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:s,c=b.useCallback(f=>{var u;if(a){const h=UM(f)?f(t):f;h!==t&&((u=o.current)==null||u.call(o,h))}else i(f)},[a,t,i,o]);return[l,c]}Ld(D1,"useControllableState");function WM({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),i=b.useRef(e);return FF(()=>{i.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}Ld(WM,"useUncontrolledState");function UM(t){return typeof t=="function"}Ld(UM,"isFunction");var $b=Symbol("RADIX:SYNC_STATE");function BF(t,e,n,r){const{prop:s,defaultProp:i,onChange:o,caller:a}=e,l=s!==void 0,c=VM(o),f=[{...n,state:i}];r&&f.push(r);const[u,h]=b.useReducer((x,y)=>{if(y.type===$b)return{...x,state:y.state};const v=t(x,y);return l&&!Object.is(v.state,x.state)&&c(v.state),v},...f),m=u.state,g=b.useRef(m);b.useEffect(()=>{g.current!==m&&(g.current=m,l||c(m))},[m,g,l]);const p=b.useMemo(()=>s!==void 0?{...u,state:s}:u,[u,s]);return b.useEffect(()=>{l&&!Object.is(s,u.state)&&h({type:$b,state:s})},[s,u.state,l]),[p,h]}Ld(BF,"useControllableStateReducer");var VF=Object.defineProperty,WF=(t,e)=>VF(t,"name",{value:e,configurable:!0}),UF=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ZF=b.forwardRef(WF(function(e,n){return d.jsx(Ot.span,{...e,ref:n,style:{...UF,...e.style}})},"VisuallyHidden")),HF=Object.defineProperty,$t=(t,e)=>HF(t,"name",{value:e,configurable:!0}),[z1,jY]=$p("Tooltip",[AM]),L1=AM(),qF="TooltipProvider",KF=700,xx="tooltip.open",[JF,F1]=z1(qF),ZM=$t(t=>{const{__scopeTooltip:e,delayDuration:n=KF,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=b.useRef(!0),a=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(JF,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:b.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})},"TooltipProvider"),vx="Tooltip",[GF,Fd]=z1(vx),YF=$t(t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=F1(vx,t.__scopeTooltip),c=L1(e),[f,u]=b.useState(null),[h,m]=b.useState(void 0),g=Cr(),p=b.useRef(0),x=o??l.disableHoverableContent,y=a??l.delayDuration,v=b.useRef(!1),[k,w]=D1({prop:r,defaultProp:s??!1,onChange:$t(E=>{E?(l.onOpen(),document.dispatchEvent(new CustomEvent(xx))):l.onClose(),i==null||i(E)},"onChange"),caller:vx}),j=b.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),C=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,w(!0)},[w]),_=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,w(!0),p.current=0},y)},[y,w]);b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]);const N=h??g;return d.jsx(EF,{...c,children:d.jsx(GF,{scope:e,contentId:N,setContentId:m,open:k,stateAttribute:j,trigger:f,onTriggerChange:u,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?S():C()},[l.isOpenDelayedRef,S,C]),onTriggerLeave:b.useCallback(()=>{x?_():(window.clearTimeout(p.current),p.current=0)},[_,x]),onOpen:C,onClose:_,disableHoverableContent:x,children:n})})},"Tooltip"),Mb="TooltipTrigger",QF=b.forwardRef($t(function(e,n){const{__scopeTooltip:r,"aria-describedby":s,...i}=e,o=Fd(Mb,r),a=F1(Mb,r),l=L1(r),c=b.useRef(null),f=Tr(n,c,o.onTriggerChange),u=b.useRef(!1),h=b.useRef(!1),m=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),d.jsx(MF,{asChild:!0,...l,children:d.jsx(Ot.button,{"aria-describedby":o.open?eT(s,o.contentId):s,"data-state":o.stateAttribute,...i,ref:f,onPointerMove:_n(e.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:_n(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:_n(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:_n(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:_n(e.onBlur,o.onClose),onClick:_n(e.onClick,o.onClose)})})},"TooltipTrigger")),HM="TooltipPortal",[XF,e9]=z1(HM,{forceMount:void 0}),t9=$t(t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Fd(HM,e);return d.jsx(XF,{scope:e,forceMount:n,children:d.jsx(zd,{present:n||i.open,children:d.jsx(DM,{asChild:!0,container:s,children:r})})})},"TooltipPortal"),td="TooltipContent",n9=b.forwardRef($t(function(e,n){const r=e9(td,e.__scopeTooltip),{forceMount:s=r.forceMount,side:i="top",...o}=e,a=Fd(td,e.__scopeTooltip);return d.jsx(zd,{present:s||a.open,children:a.disableHoverableContent?d.jsx(qM,{side:i,...o,ref:n}):d.jsx(r9,{side:i,...o,ref:n})})},"TooltipContent")),r9=b.forwardRef($t(function(e,n){const r=Fd(td,e.__scopeTooltip),s=F1(td,e.__scopeTooltip),i=b.useRef(null),o=Tr(n,i),[a,l]=b.useState(null),{trigger:c,onClose:f}=r,u=i.current,{onPointerInTransitChange:h}=s,m=b.useCallback(()=>{l(null),h(!1)},[h]),g=b.useCallback((p,x)=>{const y=p.currentTarget,v={x:p.clientX,y:p.clientY},k=KM(v,y.getBoundingClientRect()),w=JM(v,k),j=GM(x.getBoundingClientRect()),C=QM([...w,...j]);l(C),h(!0)},[h]);return b.useEffect(()=>()=>m(),[m]),b.useEffect(()=>{if(c&&u){const p=$t(y=>g(y,u),"handleTriggerLeave"),x=$t(y=>g(y,c),"handleContentLeave");return c.addEventListener("pointerleave",p),u.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",x)}}},[c,u,g,m]),b.useEffect(()=>{if(a){const p=$t(x=>{const y=x.target,v={x:x.clientX,y:x.clientY},k=(c==null?void 0:c.contains(y))||(u==null?void 0:u.contains(y)),w=!YM(v,a);k?m():w&&(m(),f())},"handleTrackPointerGrace");return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,u,a,f,m]),d.jsx(qM,{...e,ref:o})},"TooltipContentHoverable")),s9=G$("TooltipContent"),qM=b.forwardRef($t(function(e,n){const{__scopeTooltip:r,children:s,"aria-label":i,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=e,f=Fd(td,r),u=L1(r),{onClose:h}=f,[m,g]=b.useState(null),p=Tr(n,g);fM(m),b.useEffect(()=>(document.addEventListener(xx,h),()=>document.removeEventListener(xx,h)),[h]),b.useEffect(()=>{if(f.trigger){const y=$t(v=>{v.target instanceof Node&&v.target.contains(f.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[f.trigger,h]);const{setContentId:x}=f;return Rn(()=>(x(o),()=>{x(void 0)}),[o,x]),d.jsx(iM,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:h,children:d.jsxs(OF,{"data-state":f.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:f.contentId,...u,...c,ref:p,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(s9,{children:s}),i?d.jsx(ZF,{id:f.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function KM(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}$t(KM,"getExitSideFromRect");function JM(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}$t(JM,"getPaddedExitPoints");function GM(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}$t(GM,"getPointsFromRect");function YM(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,f=a.y,u=l.x,h=l.y;f>r!=h>r&&n<(u-c)*(r-f)/(h-f)+c&&(s=!s)}return s}$t(YM,"isPointInPolygon");function QM(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),XM(e)}$t(QM,"getHull");function XM(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}$t(XM,"getHullPresorted");function eT(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}$t(eT,"concatAriaDescribedby");function Pp(t){const e=t.trim();if(!e)return{kind:"unknown",label:"Paste Poney JSON or a Mermaid diagram"};if(uP(e))return{kind:"poney",label:"Poney document"};const n=I_(e);return n?{kind:"mermaid",label:{sequence:"Mermaid sequence diagram",flowchart:"Mermaid flowchart",state:"Mermaid state diagram",er:"Mermaid ER diagram"}[n]}:e.startsWith("{")?{kind:"json",label:'JSON, but not a Poney document (no "poneyVersion")'}:{kind:"unknown",label:"Not recognized"}}function B1(t){const e=Pp(t);if(e.kind==="poney"||e.kind==="json"){const n=dP(t,{extensions:Rd()});return n.ok?{ok:!0,doc:n.document,warnings:n.issues}:{ok:!1,issues:n.issues.filter(r=>r.severity==="error")}}if(e.kind==="mermaid")try{return{ok:!0,doc:fP(t).document,warnings:[]}}catch(n){return{ok:!1,issues:[{path:"",message:n instanceof on?n.message:String(n)}]}}return{ok:!1,issues:[{path:"",message:'Paste a Poney document (JSON with "poneyVersion") or a Mermaid diagram.'}]}}function tT(t,e){const n=T.getState(),r=B1(t);return r.ok?(n.loadDocument(r.doc,e),n.setImportOpen(!1),n.notify(`Opened “${r.doc.project.name}”.${r.warnings.length?` ${r.warnings.length} note${r.warnings.length>1?"s":""} in the inspector.`:""}`),!0):(n.setImportOpen(!0,t),!1)}async function V1(){const t=T.getState(),e=s1(t.history.present);try{await navigator.clipboard.writeText(e),t.notify("Copied the model to the clipboard as Poney JSON.")}catch{t.notify("The browser blocked clipboard access. Use “Download JSON” instead.")}}function i9(){const t=T.getState().history.present,e=new Blob([s1(t)],{type:"application/json"}),n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=`${t.project.id}.poney`,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}const W1=t=>t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT");function o9(){const t=e=>{var s;if(W1(e.target)||T.getState().importOpen)return;const n=((s=e.clipboardData)==null?void 0:s.getData("text/plain"))??"";if(!n.trim())return;if(Pp(n).kind==="unknown"){T.getState().notify("The clipboard has no Poney JSON or Mermaid diagram.");return}e.preventDefault(),tT(n,"pasted")};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)}const a9=new Set(["entity","relationship","message","state","transition","activityNode"]),nT=t=>a9.has(t.kind);function l9(t,e){var n,r,s,i,o,a,l,c;switch(e.kind){case"entity":return(n=t.entities.get(e.id))==null?void 0:n.name;case"relationship":return(r=t.relationships.get(e.id))==null?void 0:r.label;case"message":return(s=t.messages(e.behavior).find(f=>f.message.id===e.id))==null?void 0:s.message.label;case"state":return(o=(i=t.stateMachine(e.behavior))==null?void 0:i.states.find(f=>f.id===e.id))==null?void 0:o.name;case"transition":return(l=(a=t.stateMachine(e.behavior))==null?void 0:a.transitions.find(f=>f.id===e.id))==null?void 0:l.event;case"activityNode":{const f=t.behaviors.get(e.behavior);return(f==null?void 0:f.kind)==="activity"?(c=f.nodes.find(u=>u.id===e.id))==null?void 0:c.label:void 0}default:return}}function c9(t,e){switch(t.kind){case"entity":return{type:"entity.update",id:t.id,changes:{name:e}};case"relationship":return{type:"relationship.update",id:t.id,changes:{label:e}};case"message":case"state":case"transition":case"activityNode":return{type:"behavior.rename",behaviorId:t.behavior,element:t.kind,id:t.id,value:e};default:return}}function U1(t,e){var o;const n=T.getState();if(!n.history||!nT(t))return!1;const r=l9(ft(n.history.present),t);if(r===void 0)return!1;const s=e.getBoundingClientRect(),i=[...e.querySelectorAll("text")].find(a=>{const l=(a.textContent??"").replace(/…$/,"");return l.length>0&&r.startsWith(l)});if(i){const a=i.getBoundingClientRect(),l=((o=i.getScreenCTM())==null?void 0:o.a)??1,c=parseFloat(i.getAttribute("font-size")??getComputedStyle(i).fontSize)*l,f=i.getAttribute("text-anchor")==="middle",u=f?Math.max(a.width,s.width-16*l,280):Math.max(s.right-a.left-12*l,320);n.setRenaming({ref:t,value:r,text:i,rect:{x:a.x,y:a.y,w:a.width,h:a.height},room:u,font:{size:c,weight:i.getAttribute("font-weight")??"600"},align:f?"center":"left"})}else n.setRenaming({ref:t,value:r,rect:{x:s.x,y:s.y,w:s.width,h:s.height},room:Math.max(s.width,160),font:{size:14,weight:"600"},align:"center"});return!0}function gu(t){const e=T.getState(),n=e.renaming;if(e.setRenaming(null),!n||t===null)return;const r=t.trim();if(!r||r===n.value)return;const s=c9(n.ref,r);s&&e.dispatch(s)}function rT(){const t=/^#\/([^?]*)(?:\?select=(.+))?$/.exec(window.location.hash);if(!t)return;const e=T.getState(),n=ft(e.history.present),r=decodeURIComponent(t[1])||xt,s=r.startsWith("walk:")&&n.doc.walkthroughs.some(o=>`walk:${o.id}`===r);if(r!==xt&&!s&&!n.views.has(r))return;const i=t[2]?an(decodeURIComponent(t[2])):null;e.navigate(r,{select:i})}function d9(t,e,n){const r=`#/${t===xt?"":encodeURIComponent(t)}${e&&n?`?select=${encodeURIComponent(n)}`:""}`;window.location.hash!==r&&window.history.replaceState(null,"",r)}function u9({label:t,shortcut:e,children:n,side:r="top"}){return d.jsxs(YF,{delayDuration:350,children:[d.jsx(QF,{asChild:!0,children:n}),d.jsx(t9,{children:d.jsxs(n9,{side:r,sideOffset:6,className:"fade-in z-50 flex items-center gap-2 rounded-md bg-ink px-2 py-1 text-[11.5px] text-paper shadow-float",children:[t,e&&d.jsx("kbd",{className:"rounded bg-paper/15 px-1 font-sans text-[10.5px] text-paper/80",children:e})]})})]})}function rt({label:t,shortcut:e,onClick:n,active:r,disabled:s,children:i,side:o="top"}){return d.jsx(u9,{label:t,shortcut:e,side:o,children:d.jsx("button",{type:"button","aria-label":t,"aria-pressed":r,disabled:s,onClick:n,className:`grid h-8 min-w-8 place-items-center rounded-md px-1.5 text-ink-2 transition-colors hover:bg-sunken hover:text-ink disabled:pointer-events-none disabled:opacity-35 ${r?"bg-poney-wash !text-poney":""}`,children:i})})}const Tb=()=>d.jsx("span",{className:"mx-1 h-5 w-px bg-rule","aria-hidden":!0}),f9={overview:"Overview",behavior:"Behavior",data:"Data",structure:"Structure","use-cases":"Use cases"};function Bd(t){return f9[t]??t.charAt(0).toUpperCase()+t.slice(1).replace(/-/g," ")}function sT(t){const e=uw.filter(r=>t.includes(r)),n=t.filter(r=>!uw.includes(r)).sort();return[...e,...n]}function h9(){const t=T.getState().live;return t.state==="on"&&t.url?Promise.resolve(t.url):t.state==="off"?Promise.resolve(void 0):new Promise(e=>{const n=window.setTimeout(()=>(r(),e(void 0)),15e3),r=T.subscribe(s=>{s.live.state==="on"&&s.live.url&&(window.clearTimeout(n),r(),e(s.live.url))})})}async function Qt(t,e){const n=await h9();if(!n)throw new Error('The Studio cannot reach Poney on this computer. Run "npm run studio" in the Poney folder.');const r=await fetch(`${n}${t}`,e===void 0?void 0:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error??`Poney answered ${r.status}`);return s}function Dp(t,e=[]){var o;const n=T.getState(),r=Ep(n.viewId),s=(o=n.history)==null?void 0:o.present,i=s&&n.selection&&ft(s).exists(n.selection)?ft(s).describe(n.selection):void 0;return Qt("/api/live/ask",{text:t,walkthrough:n.startOpen?void 0:r,scene:!n.startOpen&&r?n.activeScene??void 0:void 0,selection:!n.startOpen&&n.selection?{ref:de(n.selection),title:(i==null?void 0:i.title)??"",kind:(i==null?void 0:i.kind)??n.selection.kind}:void 0,...e.length?{context:e}:{}})}const Z1=()=>Qt("/api/agent"),Ob=(t,e)=>Qt("/api/agent/connect",{cwd:t,...e}),p9=(t,e=!1)=>Qt("/api/agent/check",{...t,fresh:e}),m9=()=>Qt("/api/agent/disconnect",{}),g9=()=>Qt("/api/agent/cancel",{}),y9=(t,e)=>Qt("/api/agent/permission",{messageId:t,optionId:e}),x9=t=>Qt(`/api/workspace/folders${t?`?path=${encodeURIComponent(t)}`:""}`),kx=(t,e)=>Qt("/api/agent/setting",{id:t,value:e}),iT=t=>Qt("/api/project/open",{path:t}),wx=(t,e)=>Qt("/api/agent/connect-here",{...t,...e?{folder:e}:{}}),oT="poney:agent-for:",fh=t=>{if(t)try{return JSON.parse(localStorage.getItem(oT+t)??"null")??void 0}catch{return}},v9=(t,e)=>{try{localStorage.setItem(oT+t,JSON.stringify(e))}catch{}},aT=t=>Qt("/api/files/open",{path:t}),k9=t=>Qt("/api/workspace/clone",{url:t}),lT=()=>Qt("/api/plugins"),w9=t=>Qt("/api/import",{importer:t}),b9=t=>Qt("/api/overlays/run",{id:t}),S9=t=>Qt("/api/overlays/clear",{id:t}),cT=[{label:"Give me a tour of this codebase",prompt:"Give me a Poney tour of this codebase: what it is for, its main parts, one main flow end to end, and where to start a change. Open it in the Studio."},{label:"Walk me through the last commit",prompt:"Write a Poney walkthrough of the last commit in this repository, check it against the code, and open it in the Studio."},{label:"How is this code organised?",prompt:"Show me how this codebase is organised: its parts and how they connect, as a Poney map with groups. Open it in the Studio."}],j9=[{label:"What should I read first?",prompt:"Using the open Poney document and the code, tell me in a few sentences what to read first and why. Do not change the document."},{label:"Explain this scene",prompt:"Explain the scene I am on in plain words: what it shows and why it matters. Do not change the document."},{label:"Add the last commit",prompt:"Add a walkthrough of the last commit in this repository to the open Poney document. Get the document with poney_read first and keep everything in it. Check it against the code, and open it again."}],C9=t=>t&&(t.walkthroughs.length||t.views.length)?j9:cT,dT="poney:agents";function bx(){try{return JSON.parse(localStorage.getItem(dT)??"[]")}catch{return[]}}function Ab(t){try{localStorage.setItem(dT,JSON.stringify(t))}catch{}}const uT="poney:workspace",hh=()=>{try{return localStorage.getItem(uT)??void 0}catch{return}},fT=t=>{try{localStorage.setItem(uT,t)}catch{}};function _9(){const t=T(e=>{var n,r,s,i,o;return((n=e.project)==null?void 0:n.root)??((r=e.agent.session)==null?void 0:r.cwd)??(e.liveFile?(s=/^(.*)\/docs\/poney\/[^/]+\.poney$/.exec(e.liveFile))==null?void 0:s[1]:void 0)??((o=fh((i=e.history)==null?void 0:i.present.project.id))==null?void 0:o.folder)??null});return t?{root:t,name:t.split("/").pop()??t}:null}function N9(){const t=T(g=>g.live.state==="on"),e=T(g=>g.project),n=T(g=>g.overlays),[r,s]=b.useState(!1),[i,o]=b.useState([]),[a,l]=b.useState(null),[c,f]=b.useState(null),u=b.useRef(null);if(b.useEffect(()=>{if(!r)return;lT().then(x=>o(x.overlays),x=>f(x instanceof Error?x.message:String(x)));const g=x=>{var y;return!((y=u.current)!=null&&y.contains(x.target))&&s(!1)},p=x=>x.key==="Escape"&&s(!1);return window.addEventListener("pointerdown",g,!0),window.addEventListener("keydown",p),()=>{window.removeEventListener("pointerdown",g,!0),window.removeEventListener("keydown",p)}},[r]),!t||!e)return null;const h=Object.keys(n).length,m=async g=>{l(g),f(null);try{await(n[g]?S9(g):b9(g))}catch(p){f(p instanceof Error?p.message:String(p))}finally{l(null)}};return d.jsxs("div",{ref:u,className:"relative mr-1",children:[d.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,onClick:()=>s(!r),title:"Live facts on the parts: test coverage, recent changes",className:`inline-flex h-8 items-center gap-1.5 rounded-lg px-2 text-[12.5px] font-medium ${h?"bg-poney-wash text-poney":"text-ink-2 hover:bg-sunken"}`,children:[d.jsx(gD,{size:15}),d.jsxs("span",{className:"hidden lg:inline",children:["Facts",h?` (${h})`:""]})]}),r&&d.jsxs("div",{role:"menu","aria-label":"Facts",className:"fade-in absolute right-0 top-10 z-50 w-80 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[i.map(g=>{const p=!!n[g.id],x=g.files.length>0;return d.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":p,disabled:!x&&!p,onClick:()=>void m(g.id),className:"flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left hover:bg-sunken disabled:cursor-default disabled:opacity-50 disabled:hover:bg-transparent",children:[d.jsx("span",{className:`mt-0.5 grid h-4 w-4 shrink-0 place-items-center rounded border ${p?"border-poney bg-poney text-paper":"border-rule-strong"}`,children:a===g.id?d.jsx(_o,{size:11,className:"animate-spin text-ink-3"}):p&&d.jsx(bs,{size:11})}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block text-[13px] font-medium",children:g.name}),d.jsx("span",{className:"block text-[12px] text-ink-3",children:p?n[g.id].notes[0]:x?g.description:"Nothing to read in this folder."})]})]},g.id)}),c&&d.jsx("p",{className:"px-2.5 py-1.5 text-[12px] text-removed",children:c})]})]})}function E9(){const t=ze(),e=T(),n=e.viewId===xt?void 0:t.views.get(e.viewId),r=t.doc.walkthroughs.find(a=>a.id===Ep(e.viewId)),s=n?Yr(n):void 0,i=e.selection?t.describe(e.selection):void 0,o=n?e.pinned.includes(n.id):!1;return d.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-1 border-b border-rule bg-paper px-2",children:[d.jsx(rt,{label:e.sidebarOpen?"Hide sidebar":"Show sidebar",shortcut:"[",onClick:()=>e.toggleSidebar(),side:"bottom",active:!1,children:d.jsx(CE,{size:16})}),d.jsx(rt,{label:"Back",shortcut:"⌥←",onClick:e.goBack,disabled:e.back.length===0,side:"bottom",children:d.jsx(K_,{size:16})}),d.jsx("span",{className:"hidden sm:contents",children:d.jsx(rt,{label:"Forward",shortcut:"⌥→",onClick:e.goForward,disabled:e.forward.length===0,side:"bottom",children:d.jsx(Gr,{size:16})})}),d.jsxs("nav",{"aria-label":"Breadcrumb",className:"ml-2 flex min-w-0 items-center gap-1.5 text-[13px]",children:[d.jsx("button",{type:"button",className:`truncate rounded px-1 text-ink-2 hover:text-ink ${n||r?"hidden sm:inline":""}`,onClick:()=>e.navigate(xt),children:t.doc.project.name}),r&&d.jsxs(d.Fragment,{children:[d.jsx(Fl,{className:"hidden sm:inline"}),d.jsx("span",{className:"hidden text-ink-3 sm:inline",children:"Walkthrough"}),d.jsx(Fl,{className:"hidden sm:inline"}),d.jsx("span",{className:"truncate font-semibold text-ink",children:Nr(r.title)})]}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Fl,{className:"hidden sm:inline"}),d.jsx("span",{className:"hidden truncate text-ink-3 sm:inline",children:Bd(n.category)}),d.jsx(Fl,{className:"hidden sm:inline"}),d.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 font-semibold text-ink",children:[s&&d.jsx(s.icon,{size:14,className:"shrink-0 text-ink-3","aria-hidden":!0}),d.jsx("span",{className:"truncate",children:n.title})]})]}),i&&!r&&d.jsxs(d.Fragment,{children:[d.jsx(Fl,{className:"hidden md:inline"}),d.jsx("button",{type:"button",className:"hidden max-w-[220px] truncate rounded px-1 text-poney hover:underline md:inline",onClick:()=>e.selection&&e.requestFocus("zoom",e.selection),title:"Zoom to the selection",children:i.title})]}),n&&d.jsx("span",{className:"hidden sm:contents",children:d.jsx(rt,{label:o?"Unpin this diagram":"Pin this diagram",onClick:()=>e.togglePin(n.id),active:o,side:"bottom",children:d.jsx(QE,{size:14,fill:o?"currentColor":"none"})})})]}),d.jsx("div",{className:"flex-1"}),d.jsx(M9,{}),d.jsx(rt,{label:"Undo",shortcut:"⌘Z",onClick:e.undo,disabled:!e.history.past.length,side:"bottom",children:d.jsx(hz,{size:16})}),d.jsx(rt,{label:"Redo",shortcut:"⇧⌘Z",onClick:e.redo,disabled:!e.history.future.length,side:"bottom",children:d.jsx(ez,{size:16})}),d.jsx("span",{className:"mx-1 h-5 w-px bg-rule","aria-hidden":!0}),d.jsx(T9,{}),d.jsx(N9,{}),d.jsxs("button",{type:"button",onClick:()=>e.setPaletteOpen(!0),className:"mr-1 hidden h-8 w-64 items-center gap-2 rounded-lg border border-rule bg-plaster px-2.5 text-left text-ink-3 transition-colors hover:border-rule-strong hover:text-ink-2 md:flex",children:[d.jsx(By,{size:14}),d.jsx("span",{className:"flex-1",children:"Search this document"}),d.jsx("kbd",{className:"rounded border border-rule bg-raised px-1 text-[11px]",children:"⌘K"})]}),d.jsx("span",{className:"md:hidden",children:d.jsx(rt,{label:"Search",shortcut:"⌘K",onClick:()=>e.setPaletteOpen(!0),side:"bottom",children:d.jsx(By,{size:16})})}),d.jsxs("span",{className:"hidden sm:contents",children:[d.jsx(rt,{label:"Open or paste a model",onClick:()=>e.setImportOpen(!0),side:"bottom",children:d.jsx(p1,{size:16})}),d.jsx($9,{}),d.jsx(rt,{label:e.theme==="light"?"Dark theme":"Light theme",onClick:e.toggleTheme,side:"bottom",children:e.theme==="light"?d.jsx(y1,{size:16}):d.jsx(t$,{size:16})}),d.jsx(rt,{label:"Keyboard shortcuts",shortcut:"?",onClick:()=>e.setShortcutsOpen(!0),side:"bottom",children:d.jsx(XN,{size:16})})]}),d.jsx(rt,{label:e.inspectorOpen?"Hide inspector":"Show inspector",shortcut:"]",onClick:()=>e.toggleInspector(),side:"bottom",children:d.jsx(qD,{size:16})})]})}function Fl({className:t=""}){return d.jsx("span",{className:`text-ink-4 ${t}`,"aria-hidden":!0,children:"/"})}function $9(){const[t,e]=b.useState(!1),n=b.useRef(null);b.useEffect(()=>{if(!t)return;const s=o=>{var a;return!((a=n.current)!=null&&a.contains(o.target))&&e(!1)},i=o=>o.key==="Escape"&&e(!1);return window.addEventListener("mousedown",s),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",i)}},[t]);const r="flex w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-[13px] hover:bg-sunken";return d.jsxs("div",{className:"relative",ref:n,children:[d.jsx(rt,{label:"Export the model",onClick:()=>e(!t),active:t,side:"bottom",children:d.jsx(az,{size:16})}),t&&d.jsxs("div",{role:"menu",className:"fade-in absolute right-0 top-10 z-40 w-64 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[d.jsxs("button",{role:"menuitem",type:"button",className:r,onClick:()=>{e(!1),V1()},children:[d.jsx(wN,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:"Copy JSON"}),d.jsx("kbd",{className:"text-[11px] text-ink-3",children:"⇧⌘C"})]}),d.jsxs("button",{role:"menuitem",type:"button",className:r,onClick:()=>{e(!1),i9()},children:[d.jsx(ND,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:"Download .poney"})]}),d.jsx("p",{className:"px-2.5 pb-1.5 pt-1 text-[11.5px] leading-snug text-ink-3",children:"Paste Poney JSON or Mermaid anywhere in the studio to open it."})]})]})}function M9(){const t=T(n=>n.live.state==="on"?n.liveFile:null);return T(n=>n.history.past.length>0||n.history.future.length>0)?d.jsx("span",{className:"mr-1 hidden text-[12px] text-ink-3 lg:inline",title:t?`Every change is saved to ${t}. Undo goes back one change at a time.`:"Changes are kept in this browser. Use Download to keep a file.",children:t?`Saved to ${t.split("/").pop()}`:"Kept in this browser"}):null}function T9(){const t=T(r=>r.live);if(t.state==="off")return null;const e=t.state==="on",n=e?"Live":t.state==="connecting"?"Connecting":"Offline";return d.jsxs("span",{title:e?"Linked to Poney on this computer: agents can open documents here, you can talk to them, and documents are saved to their files.":"Poney on this computer does not answer. Agents and saving to files are off until it is back.",className:`mr-2 hidden items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px] font-semibold sm:inline-flex ${e?"border-new/40 bg-new-wash text-new":"border-rule text-ink-3"}`,children:[d.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${e?"bg-new":"bg-ink-4"}`}),n]})}function O9(){const t=T(n=>n.sidebarOpen),e=T(n=>n.toggleSidebar);return d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"fixed inset-0 z-20 bg-ink/20 lg:hidden",onClick:()=>e(!1),"aria-hidden":!0}),d.jsxs("aside",{"aria-label":"Project navigation",className:`scrollbar-quiet z-30 flex w-[264px] shrink-0 flex-col overflow-y-auto border-r border-rule bg-paper transition-[margin] duration-200 max-lg:fixed max-lg:bottom-0 max-lg:top-12 max-lg:shadow-float ${t?"ml-0":"-ml-[264px] max-lg:invisible"}`,children:[d.jsx(A9,{}),d.jsx("div",{className:"px-2 pb-1",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setPaletteOpen(!0),className:"flex h-8 w-full items-center gap-2 rounded-md px-2 text-ink-3 hover:bg-sunken hover:text-ink-2",children:[d.jsx(By,{size:14}),d.jsx("span",{className:"flex-1 text-left",children:"Search"}),d.jsx("kbd",{className:"text-[11px]",children:"/"})]})}),d.jsx(I9,{}),d.jsx(P9,{})]})]})}function A9(){const t=T(o=>o.projects),e=T(o=>o.projectId),n=ze(),[r,s]=b.useState(!1),i=b.useRef(null);return b.useEffect(()=>{if(!r)return;const o=l=>{var c;return!((c=i.current)!=null&&c.contains(l.target))&&s(!1)},a=l=>l.key==="Escape"&&s(!1);return window.addEventListener("mousedown",o),window.addEventListener("keydown",a),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",a)}},[r]),d.jsxs("div",{className:"relative p-2",ref:i,children:[d.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":r,onClick:()=>s(!r),className:"flex w-full items-center gap-2.5 rounded-lg p-1.5 text-left hover:bg-sunken",children:[d.jsx(hT,{}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate text-[13.5px] font-semibold",children:n.doc.project.name}),d.jsx(R9,{fallback:`Poney ${n.doc.poneyVersion}`})]}),d.jsx(cN,{size:14,className:"text-ink-3"})]}),r&&d.jsxs("div",{role:"listbox","aria-label":"Projects",className:"fade-in absolute left-2 right-2 top-14 z-40 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[t.map(o=>d.jsxs("button",{role:"option","aria-selected":o.id===e,type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left hover:bg-sunken",onClick:()=>{s(!1),T.getState().switchProject(o.id)},children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate",children:o.doc.project.name}),d.jsx("span",{className:"block text-[11.5px] text-ink-3",children:o.origin==="example"?"Example":o.origin==="pasted"?"Pasted":"Imported"})]}),o.id===e&&d.jsx(bs,{size:14,className:"text-poney"})]},o.id)),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setImportOpen(!0)},children:[d.jsx(p1,{size:14}),"Open or paste a model…"]}),T.getState().live.state==="on"&&d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setProjectOpen(!0)},children:[d.jsx(m1,{size:14}),"Open a project…"]}),T.getState().live.state==="on"&&T.getState().project&&d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setImportCodeOpen(!0)},children:[d.jsx(_D,{size:14}),"Import from the code…"]}),d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().showStart(!0)},children:[d.jsx(TD,{size:14}),"Start page"]})]})]})}function R9({fallback:t}){const e=T(r=>r.live.state==="on"?r.liveFile:null);if(!e)return d.jsx("span",{className:"block truncate text-[11.5px] text-ink-3",children:t});const n=e.split("/").slice(-3).join("/");return d.jsxs("span",{className:"block truncate text-[11.5px] text-ink-3",title:`Saved to ${e}`,children:["Saved to ",n]})}function hT(){return d.jsxs("svg",{width:"30",height:"30",viewBox:"-22 -18 156 152","aria-hidden":!0,className:"shrink-0",children:[d.jsx("rect",{x:"-22",y:"-18",width:"156",height:"152",rx:"36",fill:"var(--ink)"}),d.jsx("path",{d:"M40 26V86M40 26H62A17 17 0 0 1 62 60H40",fill:"none",stroke:"var(--paper)",strokeWidth:"6",strokeLinejoin:"round"}),d.jsx("rect",{x:"28",y:"16",width:"24",height:"20",rx:"5",fill:"var(--paper)"}),d.jsx("rect",{x:"28",y:"50",width:"24",height:"20",rx:"5",fill:"var(--paper)"}),d.jsx("rect",{x:"28",y:"76",width:"24",height:"20",rx:"5",fill:"var(--accent)"})]})}function Rb({view:t,active:e}){const n=Yr(t),r=(n==null?void 0:n.icon)??Co;return d.jsxs("button",{type:"button","aria-current":e?"page":void 0,onClick:()=>T.getState().navigate(t.id),className:`group flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-left transition-colors ${e?"bg-sunken font-semibold text-ink":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,title:t.description,children:[d.jsx(r,{size:15,className:e?"text-poney":"text-ink-3 group-hover:text-ink-2","aria-hidden":!0}),d.jsx("span",{className:"truncate",children:t.title})]})}function I9(){const t=ze(),e=T(i=>i.viewId),n=T(i=>i.pinned),r=sT([...new Set(t.doc.views.map(i=>i.category))]).filter(i=>i!=="walkthrough"),s=n.map(i=>t.views.get(i)).filter(i=>!!i);return d.jsxs("nav",{"aria-label":"Diagrams",className:"px-2",children:[d.jsxs("button",{type:"button","aria-current":e===xt?"page":void 0,onClick:()=>T.getState().navigate(xt),className:`flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-left ${e===xt?"bg-sunken font-semibold":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,children:[d.jsx(Co,{size:15,className:e===xt?"text-poney":"text-ink-3"}),"Project overview"]}),t.doc.walkthroughs.length>0&&d.jsx(Qu,{title:"Walkthroughs",children:t.doc.walkthroughs.map(i=>{const o=e===`walk:${i.id}`;return d.jsxs("button",{type:"button","aria-current":o?"page":void 0,onClick:()=>T.getState().navigate(`walk:${i.id}`),className:`group flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors ${o?"bg-sunken font-semibold text-ink":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,children:[d.jsx(Sp,{size:15,className:`mt-[2px] shrink-0 ${o?"text-poney":"text-ink-3"}`,"aria-hidden":!0}),d.jsx("span",{className:"leading-snug",children:Nr(i.title)})]},i.id)})}),s.length>0&&d.jsx(Qu,{title:"Pinned",icon:d.jsx(QE,{size:11,className:"text-ink-3"}),children:s.map(i=>d.jsx(Rb,{view:i,active:!1},`pin-${i.id}`))}),r.map(i=>d.jsx(Qu,{title:Bd(i),children:t.doc.views.filter(o=>o.category===i).map(o=>d.jsx(Rb,{view:o,active:o.id===e},o.id))},i))]})}function Qu({title:t,icon:e,children:n}){return d.jsxs("div",{className:"mt-4",children:[d.jsxs("h2",{className:"mb-1 flex items-center gap-1.5 px-2 text-[11.5px] font-semibold text-ink-3",children:[e,t]}),d.jsx("div",{className:"space-y-px",children:n})]})}function P9(){const t=ze(),e=b.useMemo(()=>t.doc.model.entities.filter(r=>!r.parent&&!r.kind.includes("/")),[t]),n=[{title:"System",items:e.filter(r=>r.kind!=="person"&&r.kind!=="external")},{title:"People",items:e.filter(r=>r.kind==="person")},{title:"Outside services",items:e.filter(r=>r.kind==="external")}].filter(r=>r.items.length);return d.jsx("div",{className:"mt-2 px-2 pb-6",children:n.map(r=>d.jsx(Qu,{title:r.title,children:d.jsx("ul",{role:"tree","aria-label":r.title,children:r.items.map(s=>d.jsx(pT,{entity:s,depth:0},s.id))})},r.title))})}function pT({entity:t,depth:e}){const n=ze(),r=T(f=>f.selection),s=n.children(t.id),[i,o]=b.useState(e===0),a=n.style(t),l=Ad(a.icon),c=(r==null?void 0:r.kind)==="entity"&&r.id===t.id;return d.jsxs("li",{role:"treeitem","aria-expanded":s.length?i:void 0,"aria-selected":c,children:[d.jsxs("div",{className:`flex h-7 items-center rounded-md ${c?"bg-poney-wash":"hover:bg-sunken/70"}`,style:{paddingLeft:e*14},children:[s.length?d.jsx("button",{type:"button","aria-label":i?`Close ${t.name}`:`Open ${t.name}`,className:"grid h-6 w-5 place-items-center text-ink-3 hover:text-ink",onClick:()=>o(!i),children:d.jsx(Ed,{size:13,className:`transition-transform ${i?"rotate-90":""}`})}):d.jsx("span",{className:"w-5"}),d.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 pr-2 text-left",onClick:()=>Pd({kind:"entity",id:t.id}),title:t.summary,children:[d.jsx(l,{size:13,style:{color:dt(a.tone)},className:"shrink-0","aria-hidden":!0}),d.jsx("span",{className:`truncate text-[12.5px] ${c?"font-semibold text-poney":"text-ink-2"}`,children:t.name})]})]}),i&&s.length>0&&d.jsx("ul",{role:"group",children:s.map(f=>d.jsx(pT,{entity:f,depth:e+1},f.id))})]})}const D9=t=>t==="table"?d.jsx(Td,{size:14}):t==="event"?d.jsx(x$,{size:14}):d.jsx(AN,{size:14});function vi({id:t,secondary:e}){const r=ze().dataTypes.get(t);return r?d.jsx(vt,{to:{kind:"dataType",id:t},label:d.jsx("span",{className:r.kind==="table"?"font-mono text-[12px]":"",children:r.name}),secondary:e??r.summary,icon:D9(r.kind),tone:"var(--malachite)"}):null}function zp({refValue:t,title:e="Seen in diagrams",exclude:n=[]}){const r=ze(),s=T(o=>o.viewId),i=r.viewsShowing(t).filter(o=>o.id!==s&&!n.includes(o.id));return i.length?d.jsx(ve,{title:e,count:i.length,children:i.map(o=>d.jsx(Dd,{view:o,select:t},o.id))}):null}function z9({refValue:t}){const e=ze();return d.jsx(d.Fragment,{children:kL().map(n=>{const r=n.render({ref:t,doc:e.doc,idx:e});return r?d.jsx(ve,{title:n.title,children:r},n.id):null})})}function L9({id:t}){const e=ze(),n=e.entities.get(t);if(!n)return null;const r=e.outgoing(t).filter(h=>h.kind!=="depends-on"&&h.kind!=="implements"),s=e.incoming(t).filter(h=>h.kind!=="depends-on"&&h.kind!=="implements"),i=e.outgoing(t).filter(h=>h.kind==="depends-on"||h.kind==="implements"),o=e.incoming(t).filter(h=>h.kind==="depends-on"||h.kind==="implements"),a=e.behaviorsInvolving(t),l=e.dataOf(t),c=e.useCasesOf(t),f=e.children(t),u=n.parent?e.entities.get(n.parent):void 0;return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.description??n.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",e.style(n).label],["Technology",n.technology],["Part of",u?d.jsx("button",{className:"text-left hover:text-poney hover:underline",onClick:()=>T.getState().select({kind:"entity",id:u.id}),children:u.name}):void 0]]})}),n.tags.length>0&&d.jsx("div",{className:"mt-3",children:d.jsx(l6,{items:n.tags})})]}),d.jsx(z9,{refValue:{kind:"entity",id:t}}),(r.length>0||s.length>0)&&d.jsxs(ve,{title:"Connections",count:r.length+s.length,children:[r.map(h=>{var m;return d.jsx(vt,{to:{kind:"relationship",id:h.id},label:d.jsxs(d.Fragment,{children:[h.label," ",d.jsxs("span",{className:"text-ink-3",children:["→ ",(m=e.entities.get(h.target))==null?void 0:m.name]})]}),secondary:h.protocol,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},h.id)}),s.map(h=>{var m;return d.jsx(vt,{to:{kind:"relationship",id:h.id},label:d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"text-ink-3",children:[(m=e.entities.get(h.source))==null?void 0:m.name," →"]})," ",h.label.charAt(0).toLowerCase()+h.label.slice(1)]}),secondary:h.protocol,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},h.id)})]}),(i.length>0||o.length>0)&&d.jsxs(ve,{title:"Code dependencies",count:i.length+o.length,children:[i.map(h=>d.jsx(Mt,{id:h.target,secondary:h.kind==="implements"?"Implements this interface":`Uses it: ${h.label.toLowerCase()}`},h.id)),o.map(h=>d.jsx(Mt,{id:h.source,secondary:h.kind==="implements"?"Implements this":`Depends on this: ${h.label.toLowerCase()}`},h.id))]}),a.length>0&&d.jsx(ve,{title:"Takes part in",count:a.length,children:a.map(h=>e.viewsForBehavior(h.id).map(m=>d.jsx(Dd,{view:m,select:{kind:"entity",id:t},verb:"Open"},`${h.id}-${m.id}`)))}),(l.consumed.size>0||l.produced.size>0||l.owned.length>0)&&d.jsxs(ve,{title:"Data",children:[l.owned.length>0&&d.jsx("p",{className:"mb-1 text-[11.5px] text-ink-3",children:"Owns or stores"}),l.owned.map(h=>d.jsx(vi,{id:h.id},`o-${h.id}`)),l.consumed.size>0&&d.jsx("p",{className:"mb-1 mt-2 text-[11.5px] text-ink-3",children:"Receives"}),[...l.consumed.entries()].map(([h,m])=>d.jsx(vi,{id:h,secondary:`From ${m.map(g=>{var p;return(p=e.entities.get(g.source))==null?void 0:p.name}).join(", ")}`},`c-${h}`)),l.produced.size>0&&d.jsx("p",{className:"mb-1 mt-2 text-[11.5px] text-ink-3",children:"Sends"}),[...l.produced.entries()].map(([h,m])=>d.jsx(vi,{id:h,secondary:`To ${m.map(g=>{var p;return(p=e.entities.get(g.target))==null?void 0:p.name}).join(", ")}`},`p-${h}`))]}),f.length>0&&d.jsx(ve,{title:"Contains",count:f.length,children:f.map(h=>d.jsx(Mt,{id:h.id},h.id))}),c.length>0&&d.jsx(ve,{title:n.kind==="person"?"Can":"Makes possible",count:c.length,children:c.map(h=>d.jsx(vt,{to:{kind:"useCase",id:h.id},label:h.name,secondary:h.summary,icon:d.jsx(Od,{size:14}),tone:"var(--tyrian)"},h.id))}),d.jsx(zp,{refValue:{kind:"entity",id:t},title:"Also seen in",exclude:a.flatMap(h=>e.viewsForBehavior(h.id).map(m=>m.id))}),d.jsx(z$,{refs:n.sourceRefs})]})}function F9({id:t}){var s,i;const e=ze(),n=e.relationships.get(t);if(!n)return null;const r=e.messagesAlong(t);return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.description??`${(s=e.entities.get(n.source))==null?void 0:s.name} ${n.label.charAt(0).toLowerCase()+n.label.slice(1)} ${(i=e.entities.get(n.target))==null?void 0:i.name}.`}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",B9(n.kind)],["Protocol",n.protocol]]})})]}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:n.source,secondary:"From"}),d.jsx(Mt,{id:n.target,secondary:"To"})]}),n.data.length>0&&d.jsx(ve,{title:"Carries",count:n.data.length,children:n.data.map(o=>d.jsx(vi,{id:o},o))}),r.length>0&&d.jsx(ve,{title:"Used in these steps",count:r.length,children:r.map(({interaction:o,item:a})=>d.jsx(vt,{to:{kind:"message",behavior:o.id,id:a.message.id},label:a.message.label,secondary:`${o.name}, step ${a.number}`,icon:d.jsx(Od,{size:14}),tone:"var(--lapis)"},`${o.id}-${a.message.id}`))}),d.jsx(zp,{refValue:{kind:"relationship",id:t}})]})}const B9=t=>({uses:"Used by a person",calls:"Request, waits for an answer",reads:"Reads",writes:"Writes","reads-writes":"Reads and writes",publishes:"Publishes events",subscribes:"Subscribes to events","depends-on":"Code dependency",implements:"Implements an interface"})[t]??t;function V9({id:t,field:e}){var a,l,c;const n=ze(),r=n.dataTypes.get(t);if(!r)return null;const s=n.usagesOfData(t),i=e?r.fields.find(f=>f.name===e):void 0,o=e?s.relations.filter(f=>f.via===e):[];return d.jsxs(d.Fragment,{children:[i&&d.jsxs(ve,{title:`Field ${i.name}`,children:[i.description&&d.jsx(Bt,{children:i.description}),d.jsx("div",{className:"mt-2",children:d.jsx(An,{items:[["Type",d.jsx("code",{className:"font-mono text-[12px]",children:i.type})],["Key",i.primaryKey?"Primary key":i.references?"Foreign key":void 0],["Unique",i.unique?"Yes":void 0],["Can be empty",i.nullable?"Yes":"No"]]})}),i.references&&d.jsx("div",{className:"mt-2",children:d.jsx(vt,{to:{kind:"dataType",id:i.references.dataType,field:i.references.field},label:d.jsxs("span",{className:"font-mono text-[12px]",children:[(a=n.dataTypes.get(i.references.dataType))==null?void 0:a.name,".",i.references.field]}),secondary:"References",icon:d.jsx(co,{size:14}),tone:"var(--lapis)"})}),o.map(f=>{var h;const u=f.from===t?f.to:f.from;return d.jsx(vt,{to:{kind:"dataType",id:u},label:d.jsx("span",{className:"font-mono text-[12px]",children:(h=n.dataTypes.get(u))==null?void 0:h.name}),secondary:f.logical?"Logical reference across services; no database constraint":"Linked by this field",icon:d.jsx(co,{size:14}),tone:"var(--lapis)"},f.id)})]}),d.jsxs(ve,{title:i?`About ${r.name}`:"About",children:[d.jsx(Bt,{children:r.description??r.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",r.kind==="table"?"Table":r.kind==="event"?"Event":r.kind==="document"?"Document":"Record"],["Owned by",r.ownedBy?d.jsx("button",{className:"text-left hover:text-poney hover:underline",onClick:()=>T.getState().select({kind:"entity",id:r.ownedBy}),children:(l=n.entities.get(r.ownedBy))==null?void 0:l.name}):void 0],["Stored in",r.storedIn?(c=n.entities.get(r.storedIn))==null?void 0:c.name:void 0]]})})]}),!i&&r.fields.length>0&&d.jsx(ve,{title:"Fields",count:r.fields.length,children:d.jsx("ul",{className:"space-y-0.5",children:r.fields.map(f=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>T.getState().select({kind:"dataType",id:t,field:f.name}),className:"-mx-2 flex w-[calc(100%+16px)] items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-sunken",children:[d.jsx("span",{className:"w-3.5 shrink-0",children:f.primaryKey?d.jsx(RD,{size:12,className:"text-[color:var(--ochre)]"}):f.references?d.jsx(co,{size:12,className:"text-[color:var(--lapis)]"}):null}),d.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",children:f.name}),d.jsxs("code",{className:"shrink-0 font-mono text-[11px] text-ink-3",children:[f.type,f.nullable?"?":""]})]})},f.name))})}),s.lifecycles.length>0&&d.jsx(ve,{title:"Lifecycle",children:s.lifecycles.flatMap(f=>n.viewsForBehavior(f.id)).map(f=>d.jsx(Dd,{view:f,select:{kind:"dataType",id:t}},f.id))}),s.flows.length>0&&d.jsx(ve,{title:"Moves between",count:s.flows.length,children:s.flows.map(f=>{var u,h;return d.jsx(vt,{to:{kind:"dataFlow",id:f.id},label:`${(u=n.entities.get(f.source))==null?void 0:u.name} → ${(h=n.entities.get(f.target))==null?void 0:h.name}`,secondary:f.label,icon:d.jsx(Gr,{size:14}),tone:"var(--malachite)"},f.id)})}),s.messages.length>0&&d.jsx(ve,{title:"Sent in these steps",count:s.messages.length,children:s.messages.map(({interaction:f,item:u})=>d.jsx(vt,{to:{kind:"message",behavior:f.id,id:u.message.id},label:u.message.label,secondary:`${f.name}, step ${u.number}`,icon:d.jsx(Od,{size:14}),tone:"var(--lapis)"},`${f.id}-${u.message.id}`))}),d.jsx(zp,{refValue:{kind:"dataType",id:t}}),d.jsx(z$,{refs:r.sourceRefs})]})}function W9({id:t}){const e=ze(),n=e.dataRelations.get(t);if(!n)return null;const r=e.dataTypes.get(n.from),s=e.dataTypes.get(n.to),i=o=>({one:"exactly one","zero-or-one":"at most one",many:"any number of","one-or-many":"at least one"})[o];return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"Reads as",children:[d.jsxs(Bt,{children:["Each ",d.jsx("code",{className:"font-mono",children:r==null?void 0:r.name})," row ",n.label," ",i(n.toCardinality)," ",d.jsx("code",{className:"font-mono",children:s==null?void 0:s.name})," row",n.toCardinality==="exactly-one"||n.toCardinality==="zero-or-one"?"":"s",". Each ",d.jsx("code",{className:"font-mono",children:s==null?void 0:s.name})," row belongs to ",i(n.fromCardinality)," ",d.jsx("code",{className:"font-mono",children:r==null?void 0:r.name})," row",n.fromCardinality==="exactly-one"||n.fromCardinality==="zero-or-one"?"":"s","."]}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Through",n.via?d.jsx("code",{className:"font-mono text-[12px]",children:n.via}):void 0],["Enforced",n.logical?"No. The tables live in different databases; the services keep it consistent.":"Yes, by a foreign key"]]})})]}),d.jsxs(ve,{title:"Tables",children:[d.jsx(vi,{id:n.from}),d.jsx(vi,{id:n.to})]})]})}function U9({id:t}){var r,s,i;const e=ze(),n=e.dataFlows.get(t);return n?d.jsxs(d.Fragment,{children:[d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.description??`${(r=e.entities.get(n.source))==null?void 0:r.name} sends ${n.label.charAt(0).toLowerCase()+n.label.slice(1)} to ${(s=e.entities.get(n.target))==null?void 0:s.name}.`})}),d.jsx(ve,{title:"Data",count:n.data.length,children:n.data.map(o=>{const a=e.dataTypes.get(o);return d.jsxs("div",{className:"mb-2",children:[d.jsx(vi,{id:o}),a&&a.fields.length>0&&d.jsx("p",{className:"ml-6 font-mono text-[11px] leading-relaxed text-ink-3",children:a.fields.map(l=>l.name).join(", ")})]},o)})}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:n.source,secondary:"From"}),d.jsx(Mt,{id:n.target,secondary:"To"}),n.via&&d.jsx(vt,{to:{kind:"relationship",id:n.via},label:(i=e.relationships.get(n.via))==null?void 0:i.label,secondary:"Carried by this connection",icon:d.jsx(co,{size:14}),tone:"var(--ink-3)"})]}),d.jsx(zp,{refValue:{kind:"dataFlow",id:t}})]}):null}function Z9({behavior:t,id:e}){var c,f;const n=ze(),r=n.messages(t).find(u=>u.message.id===e);if(!r)return null;const s=r.message,i=n.messages(t),o=i[r.number-2],a=i[r.number],l={call:"Request, waits for an answer",return:"Answer to an earlier request",async:"Sent without waiting",self:"Work done inside one participant"}[s.kind];return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Step",`${r.number} of ${i.length}`],["Kind",l],["When",r.context.length?r.context.map(u=>`${_d(u.fragment.kind).toLowerCase()}: ${u.guard}`).join(", then "):void 0]]})})]}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:s.from,secondary:"From"}),s.to!==s.from&&d.jsx(Mt,{id:s.to,secondary:"To"})]}),s.data.length>0&&d.jsx(ve,{title:"Carries",children:s.data.map(u=>d.jsx(vi,{id:u},u))}),s.relationship&&d.jsx(ve,{title:"Connection",children:d.jsx(vt,{to:{kind:"relationship",id:s.relationship},label:(c=n.relationships.get(s.relationship))==null?void 0:c.label,secondary:(f=n.relationships.get(s.relationship))==null?void 0:f.protocol,icon:d.jsx(co,{size:14}),tone:"var(--ink-3)"})}),d.jsx(ve,{title:"Step through",children:d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("button",{type:"button",disabled:!o,onClick:()=>o&&T.getState().select({kind:"message",behavior:t,id:o.message.id},{focus:"center"}),className:"flex-1 rounded-md border border-rule px-2 py-1.5 text-[12px] hover:bg-sunken disabled:opacity-35",children:["← Step ",r.number-1||""]}),d.jsxs("button",{type:"button",disabled:!a,onClick:()=>a&&T.getState().select({kind:"message",behavior:t,id:a.message.id},{focus:"center"}),className:"flex-1 rounded-md border border-rule px-2 py-1.5 text-[12px] hover:bg-sunken disabled:opacity-35",children:["Step ",a?r.number+1:""," →"]})]})})]})}function H9({behavior:t,id:e}){const r=ze().findFragment(t,e);if(!r)return null;const s={alt:"Exactly one of these paths happens, depending on the condition.",opt:"This happens only when the condition is true.",loop:"These steps repeat.",par:"These paths happen at the same time."}[r.kind];return d.jsxs(ve,{title:_d(r.kind),children:[d.jsx(Bt,{children:s}),d.jsx("ol",{className:"mt-2 space-y-1.5",children:r.branches.map((i,o)=>d.jsxs("li",{className:"rounded-md bg-sunken px-2.5 py-1.5 text-[12.5px]",children:[d.jsx("span",{className:"text-ink-3",children:r.kind==="loop"?"Repeat":r.kind==="par"?"Path":"If"})," ",i.guard,d.jsxs("span",{className:"text-ink-3",children:[" — ",i.steps.length," step",i.steps.length===1?"":"s"]})]},o))})]})}function q9({behavior:t,id:e}){const n=ze(),r=n.activity(t),s=r==null?void 0:r.nodes.find(l=>l.id===e);if(!r||!s)return null;const i=r.flows.filter(l=>l.from===e),o=r.flows.filter(l=>l.to===e),a=l=>{var c;return(c=r.nodes.find(f=>f.id===l))==null?void 0:c.label};return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Step",n.describe({kind:"activityNode",behavior:t,id:e}).kind],["Outcome",s.outcome==="failure"?"Ends in failure":s.outcome==="success"?"Ends in success":void 0]]})})]}),s.performedBy&&d.jsx(ve,{title:"Done by",children:d.jsx(Mt,{id:s.performedBy})}),o.length>0&&d.jsx(ve,{title:"Comes after",children:o.map(l=>d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:l.from},label:a(l.from),secondary:l.guard?`When “${l.guard}”`:void 0,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},l.id))}),i.length>0&&d.jsx(ve,{title:s.kind==="decision"?"Branches":"Leads to",children:i.map(l=>d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:l.to},label:a(l.to),secondary:l.guard?`When “${l.guard}”`:void 0,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},l.id))})]})}function K9({behavior:t,id:e}){var i,o;const r=ze().activity(t),s=r==null?void 0:r.flows.find(a=>a.id===e);return!r||!s?null:d.jsxs(ve,{title:"Flow",children:[s.guard&&d.jsxs(Bt,{children:["Taken when the answer is “",s.guard,"”."]}),d.jsxs("div",{className:"mt-2",children:[d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:s.from},label:(i=r.nodes.find(a=>a.id===s.from))==null?void 0:i.label,secondary:"From"}),d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:s.to},label:(o=r.nodes.find(a=>a.id===s.to))==null?void 0:o.label,secondary:"To"})]})]})}function J9({behavior:t,id:e}){var l;const n=ze(),r=n.stateMachine(t),s=r==null?void 0:r.states.find(c=>c.id===e);if(!r||!s)return null;const i=c=>{var f;return(f=r.states.find(u=>u.id===c))==null?void 0:f.name},o=r.transitions.filter(c=>c.from===e),a=r.transitions.filter(c=>c.to===e);return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Kind",s.kind==="initial"?"Where every lifecycle starts":s.kind==="final"?"Final. Nothing happens after this.":"State"],["Stored as",r.subject?d.jsxs("code",{className:"font-mono text-[12px]",children:[(l=n.dataTypes.get(r.subject))==null?void 0:l.name,".status"]}):void 0]]})})]}),s.entryActions.length>0&&d.jsx(ve,{title:"On entry",children:d.jsx("ul",{className:"list-disc space-y-0.5 pl-4 text-[12.5px] text-ink-2",children:s.entryActions.map(c=>d.jsx("li",{children:c},c))})}),o.length>0&&d.jsx(ve,{title:"Can move to",count:o.length,children:o.map(c=>d.jsx(vt,{to:{kind:"transition",behavior:t,id:c.id},label:i(c.to),secondary:`${c.event}${c.guard?`, only when ${c.guard}`:""}`,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},c.id))}),a.length>0&&d.jsx(ve,{title:"Reached from",count:a.length,children:a.map(c=>d.jsx(vt,{to:{kind:"transition",behavior:t,id:c.id},label:i(c.from),secondary:c.event,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},c.id))})]})}function G9({behavior:t,id:e}){var o;const n=ze(),r=n.stateMachine(t),s=r==null?void 0:r.transitions.find(a=>a.id===e);if(!r||!s)return null;const i=a=>{var l;return(l=r.states.find(c=>c.id===a))==null?void 0:l.name};return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"What causes it",children:[d.jsxs(Bt,{children:["When ",d.jsx("strong",{className:"text-ink",children:s.event.charAt(0).toLowerCase()+s.event.slice(1)}),s.guard?d.jsxs(d.Fragment,{children:[", and only if ",s.guard,","]}):""," the ",r.subject?(o=n.dataTypes.get(r.subject))==null?void 0:o.name.replace(/s$/,""):"item"," moves from ",d.jsx("strong",{className:"text-ink",children:i(s.from)})," to ",d.jsx("strong",{className:"text-ink",children:i(s.to)}),"."]}),s.description&&d.jsx("p",{className:"mt-2 text-[12.5px] text-ink-2",children:s.description})]}),s.actions.length>0&&d.jsx(ve,{title:"What happens then",children:d.jsx("ol",{className:"list-decimal space-y-0.5 pl-4 text-[12.5px] text-ink-2",children:s.actions.map(a=>d.jsx("li",{children:a},a))})}),s.triggeredBy&&d.jsx(ve,{title:"Raised by",children:d.jsx(Mt,{id:s.triggeredBy})}),d.jsxs(ve,{title:"States",children:[d.jsx(vt,{to:{kind:"state",behavior:t,id:s.from},label:i(s.from),secondary:"From"}),d.jsx(vt,{to:{kind:"state",behavior:t,id:s.to},label:i(s.to),secondary:"To"})]})]})}function Y9({id:t}){const e=ze(),n=e.useCases.get(t);if(!n)return null;const r=n.behaviors.flatMap(s=>e.viewsForBehavior(s));return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Area",n.area]]})})]}),d.jsxs(ve,{title:"Who",children:[n.actors.map(s=>d.jsx(Mt,{id:s,secondary:"Does it"},s)),n.supporting.map(s=>d.jsx(Mt,{id:s,secondary:"Helps"},s))]}),n.realizedBy.length>0&&d.jsx(ve,{title:"Built by",count:n.realizedBy.length,children:n.realizedBy.map(s=>d.jsx(Mt,{id:s},s))}),r.length>0&&d.jsx(ve,{title:"See how it works",children:r.map(s=>d.jsx(Dd,{view:s},s.id))}),n.includes.length>0&&d.jsx(ve,{title:"Includes",children:n.includes.map(s=>{var i,o;return d.jsx(vt,{to:{kind:"useCase",id:s},label:(i=e.useCases.get(s))==null?void 0:i.name,secondary:(o=e.useCases.get(s))==null?void 0:o.summary,icon:d.jsx(Od,{size:14}),tone:"var(--tyrian)"},s)})})]})}function Q9({view:t,id:e}){const r=ze().views.get(t),i=((r==null?void 0:r.type)==="architecture"?r.groups:(r==null?void 0:r.type)==="dependency"?r.layers:[]).find(o=>o.id===e);return i?d.jsxs(d.Fragment,{children:[i.description&&d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:i.description})}),d.jsx(ve,{title:"Members",count:i.members.length,children:i.members.map(o=>d.jsx(Mt,{id:o},o))})]}):null}function X9({id:t}){const e=ze(),n=e.behaviors.get(t);return n?d.jsxs(d.Fragment,{children:[d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.description??n.summary})}),d.jsx(ve,{title:"Diagrams",children:e.viewsForBehavior(t).map(r=>d.jsx(Dd,{view:r},r.id))})]}):null}function eB(t){switch(t.kind){case"entity":return d.jsx(L9,{id:t.id});case"relationship":return d.jsx(F9,{id:t.id});case"dataType":return d.jsx(V9,{id:t.id,field:t.field});case"dataRelation":return d.jsx(W9,{id:t.id});case"dataFlow":return d.jsx(U9,{id:t.id});case"message":return d.jsx(Z9,{behavior:t.behavior,id:t.id});case"fragment":return d.jsx(H9,{behavior:t.behavior,id:t.id});case"activityNode":return d.jsx(q9,{behavior:t.behavior,id:t.id});case"activityFlow":return d.jsx(K9,{behavior:t.behavior,id:t.id});case"state":return d.jsx(J9,{behavior:t.behavior,id:t.id});case"transition":return d.jsx(G9,{behavior:t.behavior,id:t.id});case"useCase":return d.jsx(Y9,{id:t.id});case"group":return d.jsx(Q9,{view:t.view,id:t.id});case"behavior":return d.jsx(X9,{id:t.id})}}function tB(){const t=T(o=>o.inspectorOpen),e=T(o=>o.selection),n=T(o=>o.viewId),r=T(o=>o.toggleInspector),s=ze(),i=n===xt?void 0:s.views.get(n);return t?d.jsx("aside",{"aria-label":"Inspector",className:"scrollbar-quiet z-20 flex w-[340px] shrink-0 flex-col overflow-y-auto border-l border-rule bg-paper max-xl:fixed max-xl:bottom-0 max-xl:right-0 max-xl:top-12 max-xl:shadow-float max-sm:w-full",children:e?d.jsx(nB,{selection:e,onClose:()=>r(!1)},de(e)):i?d.jsx(rB,{view:i,onClose:()=>r(!1)}):d.jsx(sB,{onClose:()=>r(!1)})}):null}function H1({kind:t,title:e,icon:n,tone:r,onClose:s,actions:i}){return d.jsxs("div",{className:"sticky top-0 z-10 border-b border-rule bg-paper/95 px-4 pb-3 pt-3.5 backdrop-blur",children:[d.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-ink-3",children:[d.jsx("span",{className:"flex-1 truncate",children:t}),i,d.jsx("button",{type:"button","aria-label":"Hide inspector",onClick:s,className:"rounded p-1 hover:bg-sunken hover:text-ink",children:d.jsx(Bo,{size:14})})]}),d.jsxs("h2",{className:"mt-1 flex items-start gap-2 text-[17px] font-semibold leading-snug tracking-[-0.01em]",children:[n&&d.jsx("span",{className:"mt-[3px] shrink-0",style:{color:r},children:n}),d.jsx("span",{className:"min-w-0 break-words",children:e})]})]})}function nB({selection:t,onClose:e}){const n=ze(),r=n.describe(t),s=t.kind==="entity"?n.entities.get(t.id):void 0,i=s?n.style(s):void 0,o=i?Ad(i.icon):void 0;return d.jsxs("div",{className:"fade-in",children:[d.jsx(H1,{kind:r.kind,title:r.title,icon:o?d.jsx(o,{size:17}):void 0,tone:i?dt(i.tone):void 0,onClose:e,actions:d.jsx("button",{type:"button","aria-label":"Zoom to this element",title:"Zoom to this element (F)",onClick:()=>T.getState().requestFocus("zoom",t),className:"rounded p-1 hover:bg-sunken hover:text-ink",children:d.jsx(BE,{size:14})})}),eB(t)]})}function rB({view:t,onClose:e}){const n=Yr(t),r=ze(),s=n==null?void 0:n.Legend;return d.jsxs("div",{className:"fade-in",children:[d.jsx(H1,{kind:`${Bd(t.category)} · ${(n==null?void 0:n.label)??"Extension view"}`,title:t.title,onClose:e}),d.jsx(ve,{title:"What this shows",children:d.jsx(Bt,{children:t.description})}),n&&d.jsx(ve,{title:"How to read it",children:d.jsx(Bt,{children:n.howToRead})}),s&&d.jsx(ve,{title:"Key",children:d.jsx(s,{view:t})}),t.type==="extension"&&d.jsx(ve,{title:"Extension",children:d.jsxs("p",{className:"flex items-center gap-2 text-[12.5px] text-ink-2",children:[d.jsx(RE,{size:14,className:"text-ink-3"}),"Drawn by the ",d.jsx("code",{className:"font-mono text-[12px]",children:t.extension.split("/")[0]})," extension."]})}),d.jsx(ve,{title:"Try this",children:d.jsxs("ul",{className:"list-disc space-y-1 pl-4 text-[12.5px] text-ink-2",children:[d.jsx("li",{children:"Select anything to see what it connects to and where else it appears."}),d.jsx("li",{children:"Double-click a name to change it; it changes in every diagram. Press F to zoom in, Esc to clear."}),d.jsx("li",{children:r.doc.views.length>1?"Use the links in this panel to follow an element into other diagrams.":"Paste another model to open it."})]})})]})}function sB({onClose:t}){const n=ze().doc;return d.jsxs("div",{className:"fade-in",children:[d.jsx(H1,{kind:"Project",title:n.project.name,onClose:t}),d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.project.description})}),d.jsx(ve,{title:"Document",children:d.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-y-1 text-[12.5px]",children:[d.jsx("dt",{className:"text-ink-3",children:"Format"}),d.jsxs("dd",{children:["Poney ",n.poneyVersion]}),d.jsx("dt",{className:"text-ink-3",children:"Extensions"}),d.jsx("dd",{children:n.extensions.length?n.extensions.map(r=>`${r.name} ${r.version}`).join(", "):"None"}),n.project.repository&&d.jsxs(d.Fragment,{children:[d.jsx("dt",{className:"text-ink-3",children:"Repository"}),d.jsx("dd",{className:"break-all font-mono text-[11.5px]",children:n.project.repository})]})]})})]})}function mT(t){var s;const e=(s=T.getState().history)==null?void 0:s.present;if(!e)return;const n=ft(e);if(!n.exists(t))return;const r=n.describe(t);return{ref:de(t),title:Nr(r.title),kind:r.kind.toLowerCase()}}function iB(t){var n;const e=(n=T.getState().history)==null?void 0:n.present.views.find(r=>r.id===t);return e?{ref:`view:${e.id}`,title:e.title,kind:"diagram"}:void 0}const gT=t=>({title:t.length>60?`${t.slice(0,57)}…`:t,kind:"text",quote:t.slice(0,2e3)}),yT=(t,e,n)=>({title:`${t.split("/").slice(-2).join("/")}:${e}`,kind:"code",quote:`${t}:${e}
650
- ${n}`});function Ib(t,e,n,r){return s=>{var i;(i=window.getSelection())!=null&&i.toString().trim()||(s.preventDefault(),T.getState().openContextMenu({on:"code",path:t,line:e,text:n,note:r,x:s.clientX,y:s.clientY}))}}function to(t){if(!t)return;const e=T.getState();e.addChip(t),e.setAgentPanelOpen(!0),requestAnimationFrame(()=>{var n;return(n=document.querySelector('[aria-label="Your question"]'))==null?void 0:n.focus()})}function xT(t){return e=>{e.target.closest("[data-ref]")||(e.preventDefault(),T.getState().openContextMenu({on:"diagram",viewId:t,x:e.clientX,y:e.clientY}))}}function oB(){window.addEventListener("contextmenu",t=>{var r;if(t.defaultPrevented)return;const e=t.target;if(e.closest('input, textarea, [contenteditable="true"]')||!e.closest("main"))return;const n=(r=window.getSelection())==null?void 0:r.toString().trim();n&&(t.preventDefault(),T.getState().openContextMenu({on:"text",text:n,x:t.clientX,y:t.clientY}))})}function vT(){const t=T(e=>e.overlays);return b.useMemo(()=>{const e=Object.values(t).flatMap(n=>n.marks);return{effects:e.flatMap(n=>n.effect?[{target:n.target,as:n.effect}]:[]),badges:e.flatMap(n=>n.badge?[{target:n.target,text:n.badge.text,tone:n.badge.tone}]:[])}},[t])}function Pb(t){const e=new Map;for(const n of t)e.set(n.target,[...e.get(n.target)??[],n]);return e}function aB({view:t}){const e=ze(),n=T(i=>{var o;return(o=i.viewUi[t.id])==null?void 0:o.collapsed})??t.collapsed,r=T(i=>i.updateViewUi),s=t.entities.filter(i=>e.children(i).some(o=>t.entities.includes(o.id)));return d.jsxs(d.Fragment,{children:[d.jsx(rt,{label:"Open everything",onClick:()=>r(t.id,{collapsed:[]}),disabled:n.length===0,children:d.jsx(f1,{size:15})}),d.jsx(rt,{label:"Show as one system",onClick:()=>r(t.id,{collapsed:[...s]}),disabled:s.every(i=>n.includes(i)),children:d.jsx(u1,{size:15})})]})}function lB({view:t}){const e=T(s=>s.viewUi[t.id]),n=T(s=>s.updateViewUi),r=(e==null?void 0:e.controlFlow)??t.showControlFlow;return d.jsx(rt,{label:r?"Hide calls that carry no data":"Show calls that carry no data",onClick:()=>n(t.id,{controlFlow:!r}),active:r,children:d.jsx(xD,{size:15})})}function cB({view:t}){const e=T(r=>{var s;return((s=r.viewUi[t.id])==null?void 0:s.transitive)??!1}),n=T(r=>r.updateViewUi);return d.jsx(rt,{label:e?"Show direct dependencies only":"Follow dependencies all the way",onClick:()=>n(t.id,{transitive:!e}),active:e,children:d.jsx(oz,{size:15})})}function dB({view:t}){var s;const e=T(i=>i.viewUi[t.id]),n=T(i=>i.updateViewUi),r=((s=e==null?void 0:e.expandedTables)==null?void 0:s.length)===t.dataTypes.length;return d.jsx(rt,{label:r?"Show key fields only":"Show every field",onClick:()=>n(t.id,{expandedTables:r?[]:[...t.dataTypes]}),active:r,children:r?d.jsx(u1,{size:15}):d.jsx(f1,{size:15})})}function uB({view:t}){const e=ze(),n=T(a=>a.selection),r=T(a=>a.select),s=e.messages(t.interaction),i=(n==null?void 0:n.kind)==="message"&&n.behavior===t.interaction?s.findIndex(a=>a.message.id===n.id):-1,o=a=>s[a]&&r({kind:"message",behavior:t.interaction,id:s[a].message.id},{focus:"center"});return d.jsxs(d.Fragment,{children:[d.jsx(rt,{label:"Previous step",onClick:()=>o(i<=0?0:i-1),disabled:i===0,children:d.jsx(uN,{size:15})}),d.jsx("span",{className:"font-tabular min-w-[54px] text-center text-[12px] text-ink-2","aria-live":"polite",children:i>=0?`${i+1} / ${s.length}`:`${s.length} steps`}),d.jsx(rt,{label:i<0?"Start stepping through":"Next step",onClick:()=>o(i+1),disabled:i===s.length-1,children:d.jsx(Ed,{size:15})})]})}const fB={architecture:aB,dataflow:lB,dependency:cB,erd:dB,sequence:uB},Db=new WeakMap,hB=document.fonts?Promise.all([document.fonts.load('400 13px "Hanken Grotesk Variable"'),document.fonts.load('600 13px "Hanken Grotesk Variable"'),document.fonts.load('400 12px "JetBrains Mono Variable"')]).catch(()=>{}):Promise.resolve();function pB(t,e,n){let r=Db.get(t);r||Db.set(t,r=new Map);const s=`${e.id}|${JSON.stringify(n)}`;let i=r.get(s);return i||(i=hB.then(()=>B_(t,e,n)),r.set(s,i)),i}function mB(t){const e=S1(),n=T(i=>i.viewUi[t.id]),[r,s]=b.useState({viewId:t.id});return b.useEffect(()=>{let i=!0;const o={collapsed:n==null?void 0:n.collapsed,expanded:n==null?void 0:n.expandedTables,controlFlow:n==null?void 0:n.controlFlow};return pB(e,t,o).then(a=>i&&s({viewId:t.id,scene:a}),a=>i&&s({viewId:t.id,error:a instanceof Error?a.message:String(a)})),()=>{i=!1}},[e,t,n==null?void 0:n.collapsed,n==null?void 0:n.expandedTables,n==null?void 0:n.controlFlow]),r.viewId===t.id?r:{}}function gB(){const t=T(s=>s.select),e=T(s=>s.setHover),n=T(s=>s.selection),r=n?de(n):null;return b.useCallback((s,i)=>{const o=de(s);return{"data-ref":o,className:"poney-el",tabIndex:0,role:"button","aria-label":i,"aria-pressed":r===o,onClick:a=>{if(a.stopPropagation(),T.getState().pointing){const l=mT(s);T.getState().setPointing(!1),l&&to(l);return}a.currentTarget.focus({preventScroll:!0}),t(s)},onDoubleClick:a=>{a.stopPropagation(),t(s),U1(s,a.currentTarget)||t(s,{focus:"zoom"})},onContextMenu:a=>{a.preventDefault(),a.stopPropagation(),t(s),T.getState().openContextMenu({on:"element",ref:s,x:a.clientX,y:a.clientY})},onMouseEnter:()=>e(s),onMouseLeave:()=>e(null),onFocus:()=>e(s),onBlur:()=>e(null),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t(s,{focus:"center"}))}}},[t,e,r])}function kT(t,e,n){var c;const r=new Set,s=[...t.querySelectorAll("[data-ref][tabindex]")].filter(f=>{const u=f.getAttribute("data-ref"),h=f.getBoundingClientRect();return r.has(u)||h.width===0||getComputedStyle(f).visibility==="hidden"?!1:(r.add(u),!0)}).map(f=>({el:f,r:f.getBoundingClientRect()})).sort((f,u)=>Math.round((f.r.top+f.r.height/2)/28)-Math.round((u.r.top+u.r.height/2)/28)||f.r.left-u.r.left);if(!s.length)return;const i=(c=e==null?void 0:e.closest("[data-ref]"))==null?void 0:c.getAttribute("data-ref"),o=i?s.findIndex(f=>f.el.getAttribute("data-ref")===i):-1,a=o<0?n?s.length-1:0:o+(n?-1:1);if(a<0||a>=s.length)return;const l=s[a].el;return l.focus({preventScroll:!0}),l}function yB({pointer:t}){const e=T(l=>l.hover),n=T(l=>l.selection),r=ze(),[s,i]=b.useState(null),o=b.useRef(null);if(b.useEffect(()=>{if(i(null),!e)return;const l=setTimeout(()=>i(e),420);return()=>clearTimeout(l)},[e]),b.useEffect(()=>{if(!s)return;let l=0;const c=()=>{const f=o.current;if(f){const u=f.parentElement.getBoundingClientRect(),h=Math.min(t.current.x+14,u.width-f.offsetWidth-8),m=t.current.y+18+f.offsetHeight>u.height?t.current.y-f.offsetHeight-10:t.current.y+18;f.style.transform=`translate(${h}px, ${m}px)`}l=requestAnimationFrame(c)};return l=requestAnimationFrame(c),()=>cancelAnimationFrame(l)},[s,t]),!s||n&&de(n)===de(s))return null;const a=r.describe(s);return d.jsxs("div",{ref:o,role:"tooltip",className:"fade-in pointer-events-none absolute left-0 top-0 z-20 max-w-[280px] rounded-lg border border-rule bg-raised px-3 py-2 shadow-float",children:[d.jsx("div",{className:"text-[11px] text-ink-3",children:a.kind}),d.jsx("div",{className:"text-[13px] font-semibold leading-snug text-ink",children:a.title}),a.summary&&d.jsx("div",{className:"mt-0.5 text-[12px] leading-snug text-ink-2",children:a.summary})]})}function wT({size:t=14,className:e=""}){const n=T(i=>i.live.state==="on"),r=T(Id),s=T(i=>i.pointing);return n?d.jsx("button",{type:"button","aria-label":r?"Point at something for the agent":"Point at something for the agent (connect an agent first)","aria-pressed":r?s:void 0,title:r?"Point at a part, a line, a message or a state, to put it in your question":"No agent is connected. Click to connect one, then point at something to ask about it.",onClick:()=>r?T.getState().setPointing(!s):T.getState().setConnectOpen(!0),className:`grid place-items-center rounded-md ${r?s?"bg-poney-wash text-poney":"text-ink-2 hover:bg-sunken":"text-ink-4 hover:bg-sunken hover:text-ink-3"} ${e}`,children:d.jsx(MN,{size:t})}):null}const zb=.15,Lb=3,Hi=56,qm=new Map,Fb=(t,e,n)=>Math.min(n,Math.max(e,t)),xB=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function vB({viewId:t,scene:e,label:n,children:r,tools:s,overlay:i,initial:o="fit"}){var M;const a=b.useRef(null),[l,c]=b.useState({w:0,h:0}),[f,u]=b.useState(()=>qm.get(t)??{x:0,y:0,k:1}),h=b.useRef(f),m=b.useRef(0),g=b.useRef(null),p=b.useRef({x:0,y:0}),x=T($=>$.select),y=T($=>$.selection),v=T($=>$.focus),k=b.useRef(0),w=b.useRef(null),j=b.useCallback($=>{h.current=$,qm.set(t,$),u($)},[t]),C=b.useCallback($=>{if(cancelAnimationFrame(m.current),xB())return j($);const A=h.current,B=performance.now(),K=380,Q=D=>{const L=Math.min(1,(D-B)/K),W=1-Math.pow(1-L,3);j({x:A.x+($.x-A.x)*W,y:A.y+($.y-A.y)*W,k:A.k+($.k-A.k)*W}),L<1&&(m.current=requestAnimationFrame(Q))};m.current=requestAnimationFrame(Q)},[j]),_=b.useCallback(($,A=1.1)=>{const{w:B,h:K}=l,Q=Fb(Math.min((B-Hi*2)/Math.max($.w,1),(K-Hi*2)/Math.max($.h,1),A),zb,Lb);return{k:Q,x:B/2-($.x+$.w/2)*Q,y:K/2-($.y+$.h/2)*Q}},[l]),S=b.useCallback(()=>_({x:0,y:0,w:e.width,h:e.height},1),[_,e.width,e.height]),N=b.useCallback(($,A=l.w/2,B=l.h/2,K=!1)=>{const Q=h.current,D=Fb(Q.k*$,zb,Lb),L={k:D,x:A-(A-Q.x)/Q.k*D,y:B-(B-Q.y)/Q.k*D};K?C(L):j(L)},[l,j,C]),E=b.useCallback($=>{const A=e.anchors[de($)];if(A)return A;if($.kind==="dataType"&&$.field)return e.anchors[de({kind:"dataType",id:$.id})]},[e.anchors]);b.useLayoutEffect(()=>{const $=a.current;if(!$)return;const A=new ResizeObserver(([B])=>c({w:B.contentRect.width,h:B.contentRect.height}));return A.observe($),()=>A.disconnect()},[]),b.useLayoutEffect(()=>{if(!l.w||!l.h||w.current===t)return;w.current=t;const $=qm.get(t),A=S();j($??(o==="start"&&A.k<.7?{k:.85,x:Hi/2,y:Hi/2}:A))},[l,t,S,j,o]),b.useEffect(()=>{if(!v||!l.w||v.nonce===k.current)return;if(k.current=v.nonce,v.mode==="fit")return C(S());if(v.mode==="reset"){const W=S();return C({k:1,x:l.w/2-e.width/2,y:W.k<1?Hi:W.y})}if(!v.ref)return;const $=E(v.ref);if(!$)return;const A=h.current,B=W=>({...W,x:Math.min(W.x,Hi),y:Math.min(W.y,Hi)});if(v.mode==="zoom")return C(B(_({x:$.x-80,y:$.y-80,w:$.w+160,h:$.h+160},1.6)));const K=$.x*A.k+A.x,Q=$.y*A.k+A.y;if(K>40&&Q>40&&K+$.w*A.k<l.w-40&&Q+$.h*A.k<l.h-40&&A.k>=.6)return;const L=Math.max(A.k,.8);C(B({k:L,x:l.w/2-($.x+$.w/2)*L,y:l.h/2-($.y+$.h/2)*L}))},[v,l,E,C,S,_,e.width]),b.useEffect(()=>{const $=a.current;if(!$)return;const A=B=>{B.preventDefault(),cancelAnimationFrame(m.current);const K=$.getBoundingClientRect();if(B.ctrlKey||B.metaKey)N(Math.exp(-B.deltaY*.0045),B.clientX-K.left,B.clientY-K.top);else{const Q=h.current;j({...Q,x:Q.x-B.deltaX,y:Q.y-B.deltaY})}};return $.addEventListener("wheel",A,{passive:!1}),()=>$.removeEventListener("wheel",A)},[N,j]);const P=$=>{if($.key==="Tab"&&!$.altKey&&!$.metaKey&&!$.ctrlKey){const Q=($.target===$.currentTarget?null:$.target)??(y?$.currentTarget.querySelector(`[data-ref="${CSS.escape(de(y))}"]`):null),D=kT($.currentTarget,Q,$.shiftKey);if(D){$.preventDefault();const L=an(D.getAttribute("data-ref"));L&&T.getState().requestFocus("center",L)}return}if($.target!==$.currentTarget&&!($.target instanceof SVGElement))return;const A=$.shiftKey?160:60,B=h.current;switch($.key){case"+":case"=":N(1.25,void 0,void 0,!0);break;case"-":case"_":N(.8,void 0,void 0,!0);break;case"ArrowLeft":if($.target!==$.currentTarget)return;j({...B,x:B.x+A});break;case"ArrowRight":if($.target!==$.currentTarget)return;j({...B,x:B.x-A});break;case"ArrowUp":if($.target!==$.currentTarget)return;j({...B,y:B.y+A});break;case"ArrowDown":if($.target!==$.currentTarget)return;j({...B,y:B.y-A});break;default:return}$.preventDefault()},z=$=>{$.button!==0&&$.button!==1||$.target.closest("[data-ref]")&&$.button===0||(cancelAnimationFrame(m.current),g.current={x:$.clientX,y:$.clientY,moved:!1,id:$.pointerId})},I=$=>{const A=a.current.getBoundingClientRect();p.current={x:$.clientX-A.left,y:$.clientY-A.top};const B=g.current;if(!B)return;const K=$.clientX-B.x,Q=$.clientY-B.y;if(!B.moved&&Math.hypot(K,Q)<3)return;B.moved||a.current.setPointerCapture(B.id),B.moved=!0,B.x=$.clientX,B.y=$.clientY;const D=h.current;j({...D,x:D.x+K,y:D.y+Q})},F=()=>{const $=g.current;g.current=null,$&&!$.moved&&x(null)},U=22*f.k;return d.jsx(XP,{value:f.k,children:d.jsxs("div",{ref:a,className:"relative h-full w-full touch-none select-none overflow-hidden outline-none",style:{backgroundColor:"var(--plaster)",backgroundImage:U>7?"radial-gradient(var(--plaster-dot) 1px, transparent 1.2px)":void 0,backgroundSize:`${U}px ${U}px`,backgroundPosition:`${f.x}px ${f.y}px`,cursor:(M=g.current)!=null&&M.moved?"grabbing":"default"},tabIndex:0,role:"application","aria-roledescription":"diagram canvas","aria-label":`${n}. Use Tab to move between elements, Enter to select, plus and minus to zoom, arrow keys to pan.`,onKeyDown:P,onPointerDown:z,onPointerMove:I,onPointerUp:F,onPointerCancel:()=>g.current=null,onDoubleClick:$=>{$.target.closest("[data-ref]")||C(S())},children:[d.jsx("svg",{className:"absolute inset-0 h-full w-full",role:"group","aria-label":n,children:d.jsx("g",{transform:`translate(${f.x} ${f.y}) scale(${f.k})`,children:r})}),i&&d.jsx("div",{className:"pointer-events-none absolute left-4 top-4",children:i}),d.jsx(yB,{pointer:p}),d.jsxs("div",{className:"absolute bottom-4 left-1/2 flex -translate-x-1/2 items-center gap-0.5 rounded-xl border border-rule bg-raised/95 p-1 shadow-float backdrop-blur",children:[d.jsx(rt,{label:"Zoom out",shortcut:"−",onClick:()=>N(.8,void 0,void 0,!0),children:d.jsx(kE,{size:15})}),d.jsxs("button",{type:"button",className:"font-tabular h-8 w-12 rounded-md text-[12px] text-ink-2 hover:bg-sunken",onClick:()=>T.getState().requestFocus("reset"),title:"Reset to 100%","aria-label":`Zoom ${Math.round(f.k*100)} percent. Reset to 100 percent`,children:[Math.round(f.k*100),"%"]}),d.jsx(rt,{label:"Zoom in",shortcut:"+",onClick:()=>N(1.25,void 0,void 0,!0),children:d.jsx(x1,{size:15})}),d.jsx(Tb,{}),d.jsx(rt,{label:"Fit to view",shortcut:"⇧1",onClick:()=>C(S()),children:d.jsx(hE,{size:15})}),d.jsx(rt,{label:"Zoom to selection",shortcut:"F",onClick:()=>{const $=T.getState().selection;$&&T.getState().requestFocus("zoom",$)},children:d.jsx(BE,{size:15})}),d.jsx(wT,{size:15,className:"h-8 w-8"}),s&&d.jsxs(d.Fragment,{children:[d.jsx(Tb,{}),s]})]})]})})}function kB({view:t}){return Yr(t)?d.jsx(wB,{view:t}):d.jsx(bB,{view:t})}function wB({view:t}){const e=Yr(t),{scene:n,error:r}=mB(t),s=vT(),i=b.useMemo(()=>({marks:new Map,mode:"after",focus:null,callouts:new Map,hot:null,setHot:()=>{},effects:Pb(s.effects),badges:Pb(s.badges)}),[s]);if(r)return d.jsx("div",{className:"grid h-full place-items-center p-8",children:d.jsxs("div",{className:"max-w-md rounded-xl border border-rule bg-raised p-5",children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"This diagram could not be laid out"}),d.jsx("p",{className:"mt-1 text-ink-2",children:r})]})});if(!n)return d.jsxs("div",{className:"grid h-full place-items-center text-ink-3",role:"status",children:["Arranging ",t.title.toLowerCase(),"…"]});const{Renderer:o,initialView:a}=e,l=fB[C$(t)];return d.jsx("div",{className:"fade-in h-full",onContextMenu:xT(t.id),children:d.jsxs(vB,{viewId:t.id,scene:n,label:`${t.title}, ${e.label.toLowerCase()} diagram`,tools:l?d.jsx(l,{view:t}):void 0,initial:a,children:[d.jsx(o,{scene:n,view:t}),(s.effects.length>0||s.badges.length>0)&&d.jsx(o1,{value:i,children:d.jsx(j$,{scene:n,view:t})})]})})}function bB({view:t}){const e=t.type==="extension"?t.extension.split("/")[0]:t.type;return d.jsx("div",{className:"grid h-full place-items-center p-8",children:d.jsxs("div",{className:"max-w-md text-center",children:[d.jsx(RE,{className:"mx-auto text-ink-3",size:28}),d.jsxs("h2",{className:"mt-3 text-[16px] font-semibold",children:["This studio cannot draw “",t.title,"”"]}),d.jsxs("p",{className:"mt-1.5 text-ink-2",children:["The view uses the ",d.jsx("strong",{children:e})," extension, which is not installed here. Its data stays in the document and is kept when you export it."]})]})})}function rl({text:t,multiline:e=!1}){const n=e?i1(t):[t];return n.length<=1?d.jsx(Bb,{text:n[0]??""}):d.jsx(d.Fragment,{children:n.map((r,s)=>d.jsx("span",{className:`block ${s>0?"mt-[0.8em]":""}`,children:d.jsx(Bb,{text:r})},s))})}function Bb({text:t}){return d.jsx(d.Fragment,{children:Oa(t).map((e,n)=>d.jsx(b.Fragment,{children:SB(e)},n))})}function SB(t){let e=t.text;return t.marks.includes("code")&&(e=d.jsx("code",{className:"rounded-[4px] bg-sunken px-1 py-px font-mono text-[0.88em] [font-variant-ligatures:none]",children:e})),t.marks.includes("italic")&&(e=d.jsx("em",{children:e})),t.marks.includes("bold")&&(e=d.jsx("strong",{className:"font-semibold text-ink",children:e})),t.href&&(e=d.jsx("a",{href:t.href,target:"_blank",rel:"noreferrer",className:"text-poney underline decoration-poney/40 underline-offset-2 hover:decoration-poney",children:e})),e}function jB(){const e=ze().doc,n=T(l=>l.navigate),r=b.useMemo(()=>kl(e,{extensions:Rd()}),[e]),s=CB(e.views),o=[...sT([...new Set(e.views.map(l=>l.category))]).filter(l=>l!=="walkthrough").map(l=>({key:l,label:Bd(l),views:e.views.filter(c=>c.category===l)})),...e.walkthroughs.map(l=>{const c=new Set([l.overview,...l.scenes.map(f=>f.view)].filter(Boolean));return{key:`walk:${l.id}`,label:`In “${Nr(l.title)}”`,views:e.views.filter(f=>f.category==="walkthrough"&&c.has(f.id))}})].filter(l=>l.views.length>0),a=[[e.model.entities.length,"parts"],[e.model.relationships.length,"connections"],[e.model.dataTypes.length,"data types"],[e.model.behaviors.length,"behaviors"],[e.model.useCases.length,"use cases"]].filter(([l])=>l>0);return e.views.length===0&&e.walkthroughs.length===0?d.jsx(_B,{name:e.project.name,description:e.project.description}):d.jsx("div",{className:"scrollbar-quiet h-full overflow-y-auto",children:d.jsxs("div",{className:"mx-auto max-w-[920px] px-6 pb-20 pt-12 sm:px-10",children:[d.jsx("p",{className:"text-[13px] text-ink-3",children:"Project"}),d.jsx("h1",{className:"mt-1 text-[34px] font-semibold leading-tight tracking-[-0.02em]",children:e.project.name}),d.jsx("p",{className:"mt-3 max-w-[64ch] text-[16px] leading-relaxed text-ink-2",children:e.project.description}),d.jsxs("p",{className:"font-tabular mt-4 text-[13px] text-ink-3",children:[a.map(([l,c])=>`${l} ${c}`).join(", "),", shown in ",e.views.length," diagram",e.views.length===1?"":"s","."]}),e.walkthroughs.length>0&&d.jsxs("section",{className:"mt-10","aria-labelledby":"walkthroughs",children:[d.jsx("h2",{id:"walkthroughs",className:"text-[15px] font-semibold",children:"Walkthroughs and tours"}),d.jsx("ul",{className:"mt-3 space-y-3",children:e.walkthroughs.map(l=>{var c;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(`walk:${l.id}`),className:"group flex w-full items-start gap-4 rounded-xl border border-rule bg-raised p-5 text-left transition-colors hover:border-rule-strong",children:[d.jsx(Sp,{size:20,className:"mt-0.5 shrink-0 text-poney"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[16px] font-semibold",children:d.jsx(rl,{text:l.title})}),d.jsx("span",{className:"mt-1 block max-w-[70ch] text-[13.5px] leading-snug text-ink-2",children:d.jsx(rl,{text:l.summary})}),d.jsxs("span",{className:"mt-2 block text-[12.5px] text-ink-3",children:[l.scenes.length," scenes",(c=l.source)!=null&&c.ref?`, ${l.source.kind.toLowerCase()} ${l.source.ref}`:""]})]}),d.jsx(qf,{size:16,className:"mt-1 shrink-0 text-ink-4 group-hover:text-poney"})]})},l.id)})})]}),s.length>0&&d.jsxs("section",{className:"mt-10","aria-labelledby":"start-here",children:[d.jsx("h2",{id:"start-here",className:"text-[15px] font-semibold",children:"Start here"}),d.jsx("ol",{className:"mt-3 grid gap-3 md:grid-cols-3",children:s.map(({view:l,why:c},f)=>{const u=Yr(l),h=(u==null?void 0:u.icon)??Co;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(l.id),className:"group flex h-full w-full flex-col rounded-xl border border-rule bg-raised p-4 text-left transition-colors hover:border-rule-strong",children:[d.jsxs("span",{className:"flex items-center gap-2 text-[12px] text-ink-3",children:[d.jsx("span",{className:"font-tabular grid h-5 w-5 place-items-center rounded-full bg-sunken text-[11px] font-semibold text-ink-2",children:f+1}),u==null?void 0:u.label]}),d.jsxs("span",{className:"mt-3 flex items-center gap-2 text-[15px] font-semibold",children:[d.jsx(h,{size:16,className:"text-poney"}),l.title]}),d.jsx("span",{className:"mt-1 text-[13px] leading-snug text-ink-2",children:c})]})},l.id)})})]}),o.length>0&&d.jsxs("section",{className:"mt-12","aria-labelledby":"all-diagrams",children:[d.jsx("h2",{id:"all-diagrams",className:"text-[15px] font-semibold",children:"Every diagram"}),d.jsx("p",{className:"mt-1 text-[13px] text-ink-2",children:"All of them read from one model. Select something in one diagram, and follow it into the others."}),d.jsx("div",{className:"mt-4 grid gap-x-10 gap-y-6 md:grid-cols-2",children:o.map(l=>d.jsxs("div",{children:[d.jsx("h3",{className:"mb-1.5 text-[12px] font-semibold text-ink-3",children:l.label}),d.jsx("ul",{children:l.views.map(c=>{const f=Yr(c),u=(f==null?void 0:f.icon)??Co;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(c.id),className:"group -mx-2 flex w-[calc(100%+16px)] items-start gap-3 rounded-lg px-2 py-2 text-left hover:bg-sunken",children:[d.jsx(u,{size:16,className:"mt-0.5 shrink-0 text-ink-3 group-hover:text-poney"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[13.5px] font-semibold",children:c.title}),d.jsx("span",{className:"block text-[12.5px] leading-snug text-ink-2",children:c.description})]}),d.jsx(qf,{size:14,className:"mt-0.5 shrink-0 text-ink-4 opacity-0 group-hover:opacity-100"})]})},c.id)})})]},l.key))})]}),d.jsxs("section",{className:"mt-12 grid gap-6 border-t border-rule pt-8 md:grid-cols-2","aria-label":"About this document",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"The model"}),r.ok?d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(gN,{size:15,className:"mt-0.5 shrink-0 text-[color:var(--success)]"}),"A valid Poney ",e.poneyVersion," document",e.extensions.length?`, using the ${e.extensions.map(l=>l.name).join(", ")} extension`:"",". Every reference resolves."]}):d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(fz,{size:15,className:"mt-0.5 shrink-0 text-[color:var(--failure)]"}),r.issues.length," problem",r.issues.length===1?"":"s"," in the model."]}),r.issues.length>0&&d.jsx("ul",{className:"mt-2 space-y-1 text-[12px] text-ink-2",children:r.issues.slice(0,6).map((l,c)=>d.jsxs("li",{children:[d.jsx("code",{className:"font-mono text-[11px] text-ink-3",children:l.path})," ",l.message]},c))})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"Bring your own"}),d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(jN,{size:15,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{children:["Paste a Poney document or a Mermaid diagram anywhere in the studio to open it."," ",d.jsx("button",{type:"button",className:"font-semibold text-poney hover:underline",onClick:()=>T.getState().setImportOpen(!0),children:"Open or paste a model"})]})]})]})]})]})})}function CB(t){const e=[],n=t.find(i=>i.type==="architecture"&&i.collapsed.length>0),r=t.find(i=>i.type==="architecture"&&i.collapsed.length===0),s=t.find(i=>i.type==="sequence"&&/checkout|order/i.test(i.id))??t.find(i=>i.type==="sequence");return n&&e.push({view:n,why:"The whole system as one box: who uses it and what it depends on."}),r&&e.push({view:r,why:"Open the box: every app, service and store, and how they connect."}),s&&e.push({view:s,why:"Follow one request, step by step, through the services."}),e.length===0&&e.push(...t.slice(0,3).map(i=>({view:i,why:i.description}))),e}function _B({name:t,description:e}){const{session:n,listening:r}=T(o=>o.agent),s=n==null?void 0:n.busy,i=o=>{T.getState().setAgentPanelOpen(!0),Dp(o)};return d.jsx("div",{className:"scrollbar-quiet h-full overflow-y-auto",children:d.jsxs("div",{className:"mx-auto max-w-[760px] px-6 pb-20 pt-14 sm:px-10",children:[d.jsx("p",{className:"text-[13px] text-ink-3",children:"Project"}),d.jsx("h1",{className:"mt-1 text-[34px] font-semibold leading-tight tracking-[-0.02em]",children:t}),e&&d.jsx("p",{className:"mt-3 max-w-[64ch] text-[16px] leading-relaxed text-ink-2",children:e}),d.jsx("p",{className:"mt-8 text-[15px] text-ink-2",children:s?"The agent is working on it. What it opens shows here.":"Nothing is drawn yet."}),s?d.jsxs("p",{className:"mt-4 inline-flex items-center gap-2 text-[14px] text-ink-3",children:[d.jsx(_o,{size:15,className:"animate-spin"})," ",n==null?void 0:n.name," is reading the code…"]}):n||r?d.jsxs("ul",{className:"mt-5 space-y-2",children:[cT.map(o=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>i(o.prompt),className:"group flex w-full items-center gap-3 rounded-xl border border-rule bg-raised px-5 py-4 text-left transition-colors hover:border-rule-strong",children:[d.jsx(Sp,{size:18,className:"shrink-0 text-poney"}),d.jsx("span",{className:"flex-1 text-[15px] font-semibold",children:o.label}),d.jsx(qf,{size:16,className:"shrink-0 text-ink-4 group-hover:text-poney"})]})},o.label)),d.jsx("li",{className:"pt-2 text-[13.5px] text-ink-3",children:"Or ask anything in the agent panel."})]}):d.jsx("div",{className:"mt-5",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",children:[d.jsx(Md,{size:15})," Connect an agent"]})})]})})}var Vb=1,NB=.9,EB=.8,$B=.17,Km=.1,Jm=.999,MB=.9999,TB=.99,OB=/[\\\/_+.#"@\[\(\{&]/,AB=/[\\\/_+.#"@\[\(\{&]/g,RB=/[\s-]/,bT=/[\s-]/g;function Sx(t,e,n,r,s,i,o){if(i===e.length)return s===t.length?Vb:TB;var a=`${s},${i}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(i),c=n.indexOf(l,s),f=0,u,h,m,g;c>=0;)u=Sx(t,e,n,r,c+1,i+1,o),u>f&&(c===s?u*=Vb:OB.test(t.charAt(c-1))?(u*=EB,m=t.slice(s,c-1).match(AB),m&&s>0&&(u*=Math.pow(Jm,m.length))):RB.test(t.charAt(c-1))?(u*=NB,g=t.slice(s,c-1).match(bT),g&&s>0&&(u*=Math.pow(Jm,g.length))):(u*=$B,s>0&&(u*=Math.pow(Jm,c-s))),t.charAt(c)!==e.charAt(i)&&(u*=MB)),(u<Km&&n.charAt(c-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(c-1)!==r.charAt(i))&&(h=Sx(t,e,n,r,c+1,i+2,o),h*Km>u&&(u=h*Km)),u>f&&(f=u),c=n.indexOf(l,c+1);return o[a]=f,f}function Wb(t){return t.toLowerCase().replace(bT," ")}function IB(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,Sx(t,e,Wb(t),Wb(e),0,0,{})}var PB=Object.defineProperty,q1=(t,e)=>PB(t,"name",{value:e,configurable:!0}),yu=0,Rr=null;function DB(t){return K1(),t.children}q1(DB,"FocusGuards");function K1(){b.useEffect(()=>{Rr||(Rr={start:jx(),end:jx()});const{start:t,end:e}=Rr;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),yu++,()=>{yu===1&&(Rr==null||Rr.start.remove(),Rr==null||Rr.end.remove(),Rr=null),yu=Math.max(0,yu-1)}},[])}q1(K1,"useFocusGuards");function jx(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}q1(jx,"createFocusGuard");var Vr=function(){return Vr=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vr.apply(this,arguments)};function ST(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function zB(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Xu="right-scroll-bar-position",ef="width-before-scroll-bar",LB="with-scroll-bars-hidden",FB="--removed-body-scroll-bar-size";function Gm(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function BB(t,e){var n=b.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var VB=typeof window<"u"?b.useLayoutEffect:b.useEffect,Ub=new WeakMap;function WB(t,e){var n=BB(null,function(r){return t.forEach(function(s){return Gm(s,r)})});return VB(function(){var r=Ub.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(a){i.has(a)||Gm(a,null)}),i.forEach(function(a){s.has(a)||Gm(a,o)})}Ub.set(n,t)},[t]),n}function UB(t){return t}function ZB(t,e){e===void 0&&(e=UB);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(f){o.push(f),c()},filter:function(f){return o=o.filter(f),n}}}};return s}function HB(t){t===void 0&&(t={});var e=ZB(null);return e.options=Vr({async:!0,ssr:!1},t),e}var jT=function(t){var e=t.sideCar,n=ST(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Vr({},n))};jT.isSideCarExport=!0;function qB(t,e){return t.useMedium(e),jT}var CT=HB(),Ym=function(){},Lp=b.forwardRef(function(t,e){var n=b.useRef(null),r=b.useState({onScrollCapture:Ym,onWheelCapture:Ym,onTouchMoveCapture:Ym}),s=r[0],i=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,f=t.enabled,u=t.shards,h=t.sideCar,m=t.noRelative,g=t.noIsolation,p=t.inert,x=t.allowPinchZoom,y=t.as,v=y===void 0?"div":y,k=t.gapMode,w=ST(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,C=WB([n,e]),_=Vr(Vr({},w),s);return b.createElement(b.Fragment,null,f&&b.createElement(j,{sideCar:CT,removeScrollBar:c,shards:u,noRelative:m,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:k}),o?b.cloneElement(b.Children.only(a),Vr(Vr({},_),{ref:C})):b.createElement(v,Vr({},_,{className:l,ref:C}),a))});Lp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lp.classNames={fullWidth:ef,zeroRight:Xu};var KB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JB(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=KB();return e&&t.setAttribute("nonce",e),t}function GB(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function YB(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var QB=function(){var t=0,e=null;return{add:function(n){t==0&&(e=JB())&&(GB(e,n),YB(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},XB=function(){var t=QB();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},_T=function(){var t=XB(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},eV={left:0,top:0,right:0,gap:0},Qm=function(t){return parseInt(t||"",10)||0},tV=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Qm(n),Qm(r),Qm(s)]},nV=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return eV;var e=tV(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},rV=_T(),Ra="data-scroll-locked",sV=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
651
- .`.concat(LB,` {
652
- overflow: hidden `).concat(r,`;
653
- padding-right: `).concat(a,"px ").concat(r,`;
654
- }
655
- body[`).concat(Ra,`] {
656
- overflow: hidden `).concat(r,`;
657
- overscroll-behavior: contain;
658
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
659
- padding-left: `.concat(s,`px;
660
- padding-top: `).concat(i,`px;
661
- padding-right: `).concat(o,`px;
662
- margin-left:0;
663
- margin-top:0;
664
- margin-right: `).concat(a,"px ").concat(r,`;
665
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
666
- }
667
-
668
- .`).concat(Xu,` {
669
- right: `).concat(a,"px ").concat(r,`;
670
- }
671
-
672
- .`).concat(ef,` {
673
- margin-right: `).concat(a,"px ").concat(r,`;
674
- }
675
-
676
- .`).concat(Xu," .").concat(Xu,` {
677
- right: 0 `).concat(r,`;
678
- }
679
-
680
- .`).concat(ef," .").concat(ef,` {
681
- margin-right: 0 `).concat(r,`;
682
- }
683
-
684
- body[`).concat(Ra,`] {
685
- `).concat(FB,": ").concat(a,`px;
686
- }
687
- `)},Zb=function(){var t=parseInt(document.body.getAttribute(Ra)||"0",10);return isFinite(t)?t:0},iV=function(){b.useEffect(function(){return document.body.setAttribute(Ra,(Zb()+1).toString()),function(){var t=Zb()-1;t<=0?document.body.removeAttribute(Ra):document.body.setAttribute(Ra,t.toString())}},[])},oV=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;iV();var i=b.useMemo(function(){return nV(s)},[s]);return b.createElement(rV,{styles:sV(i,!e,s,n?"":"!important")})},Cx=!1;if(typeof window<"u")try{var xu=Object.defineProperty({},"passive",{get:function(){return Cx=!0,!0}});window.addEventListener("test",xu,xu),window.removeEventListener("test",xu,xu)}catch{Cx=!1}var Jo=Cx?{passive:!1}:!1,aV=function(t){return t.tagName==="TEXTAREA"},NT=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!aV(t)&&n[e]==="visible")},lV=function(t){return NT(t,"overflowY")},cV=function(t){return NT(t,"overflowX")},Hb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=ET(t,r);if(s){var i=$T(t,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},dV=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},uV=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ET=function(t,e){return t==="v"?lV(e):cV(e)},$T=function(t,e){return t==="v"?dV(e):uV(e)},fV=function(t,e){return t==="h"&&e==="rtl"?-1:1},hV=function(t,e,n,r,s){var i=fV(t,window.getComputedStyle(e).direction),o=i*r,a=n.target,l=e.contains(a),c=!1,f=o>0,u=0,h=0;do{if(!a)break;var m=$T(t,a),g=m[0],p=m[1],x=m[2],y=p-x-i*g;(g||y)&&ET(t,a)&&(u+=y,h+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(f&&Math.abs(u)<1||!f&&Math.abs(h)<1)&&(c=!0),c},vu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},qb=function(t){return[t.deltaX,t.deltaY]},Kb=function(t){return t&&"current"in t?t.current:t},pV=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mV=function(t){return`
688
- .block-interactivity-`.concat(t,` {pointer-events: none;}
689
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
690
- `)},gV=0,Go=[];function yV(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(gV++)[0],i=b.useState(_T)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var p=zB([t.lockRef.current],(t.shards||[]).map(Kb),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var a=b.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var y=vu(p),v=n.current,k="deltaX"in p?p.deltaX:v[0]-y[0],w="deltaY"in p?p.deltaY:v[1]-y[1],j,C=p.target,_=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in p&&_==="h"&&C.type==="range")return!1;var S=window.getSelection(),N=S&&S.anchorNode,E=N?N===C||N.contains(C):!1;if(E)return!1;var P=Hb(_,C);if(!P)return!0;if(P?j=_:(j=_==="v"?"h":"v",P=Hb(_,C)),!P)return!1;if(!r.current&&"changedTouches"in p&&(k||w)&&(r.current=j),!j)return!0;var z=r.current||j;return hV(z,x,p,z==="h"?k:w)},[]),l=b.useCallback(function(p){var x=p;if(!(!Go.length||Go[Go.length-1]!==i)){var y="deltaY"in x?qb(x):vu(x),v=e.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&pV(j.delta,y)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var k=(o.current.shards||[]).map(Kb).filter(Boolean).filter(function(j){return j.contains(x.target)}),w=k.length>0?a(x,k[0]):!o.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),c=b.useCallback(function(p,x,y,v){var k={name:p,delta:x,target:y,should:v,shadowParent:xV(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(w){return w!==k})},1)},[]),f=b.useCallback(function(p){n.current=vu(p),r.current=void 0},[]),u=b.useCallback(function(p){c(p.type,qb(p),p.target,a(p,t.lockRef.current))},[]),h=b.useCallback(function(p){c(p.type,vu(p),p.target,a(p,t.lockRef.current))},[]);b.useEffect(function(){return Go.push(i),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Jo),document.addEventListener("touchmove",l,Jo),document.addEventListener("touchstart",f,Jo),function(){Go=Go.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Jo),document.removeEventListener("touchmove",l,Jo),document.removeEventListener("touchstart",f,Jo)}},[]);var m=t.removeScrollBar,g=t.inert;return b.createElement(b.Fragment,null,g?b.createElement(i,{styles:mV(s)}):null,m?b.createElement(oV,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function xV(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const vV=qB(CT,yV);var MT=b.forwardRef(function(t,e){return b.createElement(Lp,Vr({},t,{ref:e,sideCar:vV}))});MT.classNames=Lp.classNames;var kV=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Yo=new WeakMap,ku=new WeakMap,wu={},Xm=0,TT=function(t){return t&&(t.host||TT(t.parentNode))},wV=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=TT(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},bV=function(t,e,n,r){var s=wV(e,Array.isArray(t)?t:[t]);wu[n]||(wu[n]=new WeakMap);var i=wu[n],o=[],a=new Set,l=new Set(s),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};s.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(h){if(a.has(h))f(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Yo.get(h)||0)+1,x=(i.get(h)||0)+1;Yo.set(h,p),i.set(h,x),o.push(h),p===1&&g&&ku.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return f(e),a.clear(),Xm++,function(){o.forEach(function(u){var h=Yo.get(u)-1,m=i.get(u)-1;Yo.set(u,h),i.set(u,m),h||(ku.has(u)||u.removeAttribute(r),ku.delete(u)),m||u.removeAttribute(n)}),Xm--,Xm||(Yo=new WeakMap,Yo=new WeakMap,ku=new WeakMap,wu={})}},SV=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=kV(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),bV(r,s,n,"aria-hidden")):function(){return null}},jV=Object.defineProperty,Yn=(t,e)=>jV(t,"name",{value:e,configurable:!0}),J1="Dialog",[OT,CY]=$p(J1),[CV,ns]=OT(J1),AT=Yn(t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,a=b.useRef(null),l=b.useRef(null),{nodes:c,registry:f}=uM(),[u,h]=D1({prop:r,defaultProp:s??!1,onChange:i,caller:J1}),[m,g]=b.useState(0),[p,x]=b.useState(0);return d.jsx(CV,{scope:e,triggerRef:a,contentRef:l,contentId:Cr(),titleId:Cr(),descriptionId:Cr(),titlePresent:m>0,descriptionPresent:p>0,setTitleCount:g,setDescriptionCount:x,open:u,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(y=>!y),[h]),modal:o,branchNodes:c,branchRegistry:f,children:n})},"Dialog"),RT="DialogPortal",[_V,IT]=OT(RT,{forceMount:void 0}),PT=Yn(t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=ns(RT,e);return d.jsx(_V,{scope:e,forceMount:n,children:b.Children.map(r,o=>d.jsx(zd,{present:n||i.open,children:d.jsx(DM,{asChild:!0,container:s,children:o})}))})},"DialogPortal"),_x="DialogOverlay",DT=b.forwardRef(Yn(function(e,n){const r=IT(_x,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,o=ns(_x,e.__scopeDialog);return o.modal?d.jsx(zd,{present:s||o.open,children:d.jsx(EV,{...i,ref:n})}):null},"DialogOverlay")),NV=N1("DialogOverlay.RemoveScroll"),EV=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns(_x,r),o=oM(),a=Tr(n,o);return d.jsx(MT,{as:NV,allowPinchZoom:!0,shards:b.useMemo(()=>[i.contentRef,...i.branchNodes.map(l=>({current:l}))],[i.contentRef,i.branchNodes]),children:d.jsx(Ot.div,{"data-state":G1(i.open),...s,ref:a,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),nd="DialogContent",zT=b.forwardRef(Yn(function(e,n){const r=IT(nd,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,o=ns(nd,e.__scopeDialog);return d.jsx(zd,{present:s||o.open,children:o.modal?d.jsx($V,{...i,ref:n}):d.jsx(MV,{...i,ref:n})})},"DialogContent")),$V=b.forwardRef(Yn(function(e,n){const r=ns(nd,e.__scopeDialog),s=b.useRef(null),i=Tr(n,r.contentRef,s);return b.useEffect(()=>{const o=s.current;if(o)return SV(o)},[]),d.jsx(LT,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:_n(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:_n(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&o.preventDefault()}),onFocusOutside:_n(e.onFocusOutside,o=>o.preventDefault())})},"DialogContentModal")),MV=b.forwardRef(Yn(function(e,n){const r=ns(nd,e.__scopeDialog),s=b.useRef(!1),i=b.useRef(!1);return d.jsx(LT,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(s.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var c,f;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})},"DialogContentNonModal")),LT=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,"aria-describedby":a,children:l,...c}=e,f=ns(nd,r);return K1(),d.jsx(dM,{registry:f.branchRegistry,children:d.jsx(p8,{asChild:!0,loop:!0,trapped:s,branches:f.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(iM,{role:"dialog",id:f.contentId,"aria-labelledby":f.titlePresent?f.titleId:void 0,"aria-describedby":f.descriptionPresent?FT(a,f.descriptionId):a,"data-state":G1(f.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1),children:l})})})},"DialogContentImpl")),Jb=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns("DialogTitle",r),{setTitleCount:o}=i;return Rn(()=>(o(a=>a+1),()=>o(a=>a-1)),[o]),d.jsx(Ot.h2,{id:i.titleId,...s,ref:n})},"DialogTitle")),eg=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns("DialogDescription",r),{setDescriptionCount:o}=i;return Rn(()=>(o(a=>a+1),()=>o(a=>a-1)),[o]),d.jsx(Ot.p,{id:i.descriptionId,...s,ref:n})},"DialogDescription")),TV="DialogClose",OV=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns(TV,r);return d.jsx(Ot.button,{type:"button",...s,ref:n,onClick:_n(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function FT(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Yn(FT,"concatAriaDescribedby");function G1(t){return t?"open":"closed"}Yn(G1,"getState");var Bl='[cmdk-group=""]',tg='[cmdk-group-items=""]',AV='[cmdk-group-heading=""]',BT='[cmdk-item=""]',Gb=`${BT}:not([aria-disabled="true"])`,Nx="cmdk-item-select",ia="data-value",RV=(t,e,n)=>IB(t,e,n),VT=b.createContext(void 0),Vd=()=>b.useContext(VT),WT=b.createContext(void 0),Y1=()=>b.useContext(WT),UT=b.createContext(void 0),ZT=b.forwardRef((t,e)=>{let n=oa(()=>{var D,L;return{search:"",value:(L=(D=t.value)!=null?D:t.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=oa(()=>new Set),s=oa(()=>new Map),i=oa(()=>new Map),o=oa(()=>new Set),a=HT(t),{label:l,children:c,value:f,onValueChange:u,filter:h,shouldFilter:m,loop:g,disablePointerSelection:p=!1,vimBindings:x=!0,...y}=t,v=Cr(),k=Cr(),w=Cr(),j=b.useRef(null),C=ZV();Ao(()=>{if(f!==void 0){let D=f.trim();n.current.value=D,_.emit()}},[f]),Ao(()=>{C(6,I)},[]);let _=b.useMemo(()=>({subscribe:D=>(o.current.add(D),()=>o.current.delete(D)),snapshot:()=>n.current,setState:(D,L,W)=>{var H,O,R,V;if(!Object.is(n.current[D],L)){if(n.current[D]=L,D==="search")z(),E(),C(1,P);else if(D==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let J=document.getElementById(w);J?J.focus():(H=document.getElementById(v))==null||H.focus()}if(C(7,()=>{var J;n.current.selectedItemId=(J=F())==null?void 0:J.id,_.emit()}),W||C(5,I),((O=a.current)==null?void 0:O.value)!==void 0){let J=L??"";(V=(R=a.current).onValueChange)==null||V.call(R,J);return}}_.emit()}},emit:()=>{o.current.forEach(D=>D())}}),[]),S=b.useMemo(()=>({value:(D,L,W)=>{var H;L!==((H=i.current.get(D))==null?void 0:H.value)&&(i.current.set(D,{value:L,keywords:W}),n.current.filtered.items.set(D,N(L,W)),C(2,()=>{E(),_.emit()}))},item:(D,L)=>(r.current.add(D),L&&(s.current.has(L)?s.current.get(L).add(D):s.current.set(L,new Set([D]))),C(3,()=>{z(),E(),n.current.value||P(),_.emit()}),()=>{i.current.delete(D),r.current.delete(D),n.current.filtered.items.delete(D);let W=F();C(4,()=>{z(),(W==null?void 0:W.getAttribute("id"))===D&&P(),_.emit()})}),group:D=>(s.current.has(D)||s.current.set(D,new Set),()=>{i.current.delete(D),s.current.delete(D)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:w,labelId:k,listInnerRef:j}),[]);function N(D,L){var W,H;let O=(H=(W=a.current)==null?void 0:W.filter)!=null?H:RV;return D?O(D,n.current.search,L):0}function E(){if(!n.current.search||a.current.shouldFilter===!1)return;let D=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(H=>{let O=s.current.get(H),R=0;O.forEach(V=>{let J=D.get(V);R=Math.max(J,R)}),L.push([H,R])});let W=j.current;U().sort((H,O)=>{var R,V;let J=H.getAttribute("id"),re=O.getAttribute("id");return((R=D.get(re))!=null?R:0)-((V=D.get(J))!=null?V:0)}).forEach(H=>{let O=H.closest(tg);O?O.appendChild(H.parentElement===O?H:H.closest(`${tg} > *`)):W.appendChild(H.parentElement===W?H:H.closest(`${tg} > *`))}),L.sort((H,O)=>O[1]-H[1]).forEach(H=>{var O;let R=(O=j.current)==null?void 0:O.querySelector(`${Bl}[${ia}="${encodeURIComponent(H[0])}"]`);R==null||R.parentElement.appendChild(R)})}function P(){let D=U().find(W=>W.getAttribute("aria-disabled")!=="true"),L=D==null?void 0:D.getAttribute(ia);_.setState("value",L||void 0)}function z(){var D,L,W,H;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let O=0;for(let R of r.current){let V=(L=(D=i.current.get(R))==null?void 0:D.value)!=null?L:"",J=(H=(W=i.current.get(R))==null?void 0:W.keywords)!=null?H:[],re=N(V,J);n.current.filtered.items.set(R,re),re>0&&O++}for(let[R,V]of s.current)for(let J of V)if(n.current.filtered.items.get(J)>0){n.current.filtered.groups.add(R);break}n.current.filtered.count=O}function I(){var D,L,W;let H=F();H&&(((D=H.parentElement)==null?void 0:D.firstChild)===H&&((W=(L=H.closest(Bl))==null?void 0:L.querySelector(AV))==null||W.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function F(){var D;return(D=j.current)==null?void 0:D.querySelector(`${BT}[aria-selected="true"]`)}function U(){var D;return Array.from(((D=j.current)==null?void 0:D.querySelectorAll(Gb))||[])}function M(D){let L=U()[D];L&&_.setState("value",L.getAttribute(ia))}function $(D){var L;let W=F(),H=U(),O=H.findIndex(V=>V===W),R=H[O+D];(L=a.current)!=null&&L.loop&&(R=O+D<0?H[H.length-1]:O+D===H.length?H[0]:H[O+D]),R&&_.setState("value",R.getAttribute(ia))}function A(D){let L=F(),W=L==null?void 0:L.closest(Bl),H;for(;W&&!H;)W=D>0?WV(W,Bl):UV(W,Bl),H=W==null?void 0:W.querySelector(Gb);H?_.setState("value",H.getAttribute(ia)):$(D)}let B=()=>M(U().length-1),K=D=>{D.preventDefault(),D.metaKey?B():D.altKey?A(1):$(1)},Q=D=>{D.preventDefault(),D.metaKey?M(0):D.altKey?A(-1):$(-1)};return b.createElement(Ot.div,{ref:e,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:D=>{var L;(L=y.onKeyDown)==null||L.call(y,D);let W=D.nativeEvent.isComposing||D.keyCode===229;if(!(D.defaultPrevented||W))switch(D.key){case"n":case"j":{x&&D.ctrlKey&&K(D);break}case"ArrowDown":{K(D);break}case"p":case"k":{x&&D.ctrlKey&&Q(D);break}case"ArrowUp":{Q(D);break}case"Home":{D.preventDefault(),M(0);break}case"End":{D.preventDefault(),B();break}case"Enter":{D.preventDefault();let H=F();if(H){let O=new Event(Nx);H.dispatchEvent(O)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:qV},l),Fp(t,D=>b.createElement(WT.Provider,{value:_},b.createElement(VT.Provider,{value:S},D))))}),IV=b.forwardRef((t,e)=>{var n,r;let s=Cr(),i=b.useRef(null),o=b.useContext(UT),a=Vd(),l=HT(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ao(()=>{if(!c)return a.item(s,o==null?void 0:o.id)},[c]);let f=qT(s,i,[t.value,t.children,i],t.keywords),u=Y1(),h=Ii(C=>C.value&&C.value===f.current),m=Ii(C=>c||a.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);b.useEffect(()=>{let C=i.current;if(!(!C||t.disabled))return C.addEventListener(Nx,g),()=>C.removeEventListener(Nx,g)},[m,t.onSelect,t.disabled]);function g(){var C,_;p(),(_=(C=l.current).onSelect)==null||_.call(C,f.current)}function p(){u.setState("value",f.current,!0)}if(!m)return null;let{disabled:x,value:y,onSelect:v,forceMount:k,keywords:w,...j}=t;return b.createElement(Ot.div,{ref:$o(i,e),...j,id:s,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!h,"data-disabled":!!x,"data-selected":!!h,onPointerMove:x||a.getDisablePointerSelection()?void 0:p,onClick:x?void 0:g},t.children)}),PV=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,o=Cr(),a=b.useRef(null),l=b.useRef(null),c=Cr(),f=Vd(),u=Ii(m=>s||f.filter()===!1?!0:m.search?m.filtered.groups.has(o):!0);Ao(()=>f.group(o),[]),qT(o,a,[t.value,t.heading,l]);let h=b.useMemo(()=>({id:o,forceMount:s}),[s]);return b.createElement(Ot.div,{ref:$o(a,e),...i,"cmdk-group":"",role:"presentation",hidden:u?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Fp(t,m=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},b.createElement(UT.Provider,{value:h},m))))}),DV=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=Ii(o=>!o.search);return!n&&!i?null:b.createElement(Ot.div,{ref:$o(s,e),...r,"cmdk-separator":"",role:"separator"})}),zV=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=Y1(),o=Ii(c=>c.search),a=Ii(c=>c.selectedItemId),l=Vd();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Ot.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:s?t.value:o,onChange:c=>{s||i.setState("search",c.target.value),n==null||n(c.target.value)}})}),LV=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),o=b.useRef(null),a=Ii(c=>c.selectedItemId),l=Vd();return b.useEffect(()=>{if(o.current&&i.current){let c=o.current,f=i.current,u,h=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=c.offsetHeight;f.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return h.observe(c),()=>{cancelAnimationFrame(u),h.unobserve(c)}}},[]),b.createElement(Ot.div,{ref:$o(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Fp(t,c=>b.createElement("div",{ref:$o(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),FV=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...a}=t;return b.createElement(AT,{open:n,onOpenChange:r},b.createElement(PT,{container:o},b.createElement(DT,{"cmdk-overlay":"",className:s}),b.createElement(zT,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(ZT,{ref:e,...a}))))}),BV=b.forwardRef((t,e)=>Ii(n=>n.filtered.count===0)?b.createElement(Ot.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),VV=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Ot.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Fp(t,o=>b.createElement("div",{"aria-hidden":!0},o)))}),Ye=Object.assign(ZT,{List:LV,Item:IV,Input:zV,Group:PV,Separator:DV,Dialog:FV,Empty:BV,Loading:VV});function WV(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function UV(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function HT(t){let e=b.useRef(t);return Ao(()=>{e.current=t}),e}var Ao=typeof window>"u"?b.useEffect:b.useLayoutEffect;function oa(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function Ii(t){let e=Y1(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function qT(t,e,n,r=[]){let s=b.useRef(),i=Vd();return Ao(()=>{var o;let a=(()=>{var c;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(c=f.current.textContent)==null?void 0:c.trim():s.current}})(),l=r.map(c=>c.trim());i.value(t,a,l),(o=e.current)==null||o.setAttribute(ia,a),s.current=a}),s}var ZV=()=>{let[t,e]=b.useState(),n=oa(()=>new Map);return Ao(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function HV(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Fp({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(HV(e),{ref:e.ref},n(e.props.children)):n(e)}var qV={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Vo({open:t,onOpenChange:e,title:n,description:r,children:s,width:i=560,hideHeader:o}){return d.jsx(AT,{open:t,onOpenChange:e,children:d.jsxs(PT,{children:[d.jsx(DT,{className:"fade-in fixed inset-0 z-40 bg-ink/25 backdrop-blur-[1px]"}),d.jsxs(zT,{className:"fade-in fixed left-1/2 top-[12vh] z-50 flex max-h-[76vh] w-[calc(100vw-32px)] -translate-x-1/2 flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",style:{maxWidth:i},"aria-describedby":void 0,children:[o?d.jsx(Jb,{className:"sr-only",children:n}):d.jsxs("div",{className:"flex items-start gap-3 border-b border-rule px-5 py-4",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx(Jb,{className:"text-[15px] font-semibold",children:n}),r&&d.jsx(eg,{className:"mt-0.5 text-[12.5px] text-ink-2",children:r})]}),d.jsx(OV,{"aria-label":"Close",className:"rounded-md p-1 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(Bo,{size:16})})]}),!r&&!o&&d.jsx(eg,{className:"sr-only",children:n}),o&&d.jsx(eg,{className:"sr-only",children:r??n}),s]})]})})}function KV(){const t=T(l=>l.paletteOpen),e=T(l=>l.setPaletteOpen),n=ze(),r=n.doc,s=l=>{e(!1),l()},i=l=>s(()=>Pd(l)),o="flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-[13px] aria-selected:bg-sunken";return d.jsx(Vo,{open:t,onOpenChange:e,title:"Search",description:"Find anything in the open document: parts, states, messages, data and diagrams",width:620,hideHeader:!0,children:d.jsxs(Ye,{label:"Search the model",loop:!0,filter:JV,className:"flex min-h-0 flex-col",children:[d.jsx(Ye.Input,{autoFocus:!0,placeholder:"Search parts, states, messages, data, diagrams…",className:"h-12 w-full border-b border-rule bg-transparent px-5 text-[15px] outline-none placeholder:text-ink-3 focus-visible:outline-none"}),d.jsxs(Ye.List,{className:"scrollbar-quiet max-h-[56vh] overflow-y-auto p-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:text-[11.5px] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-ink-3",children:[d.jsx(Ye.Empty,{className:"px-3 py-8 text-center text-ink-3",children:"Nothing in this document matches. Try a part, a state, a message or a diagram name."}),r.walkthroughs.length>0&&d.jsx(Ye.Group,{heading:"Walkthroughs",children:r.walkthroughs.map(l=>d.jsxs(Ye.Item,{className:o,value:`${Nr(l.title)} walkthrough change`,onSelect:()=>s(()=>T.getState().navigate(`walk:${l.id}`)),children:[d.jsx(Sp,{size:15,className:"text-poney"}),d.jsx("span",{className:"flex-1",children:Nr(l.title)}),d.jsxs("span",{className:"text-[12px] text-ink-3",children:[l.scenes.length," scenes"]})]},l.id))}),d.jsxs(Ye.Group,{heading:"Diagrams",children:[d.jsxs(Ye.Item,{className:o,value:"Project overview",onSelect:()=>s(()=>T.getState().navigate(xt)),children:[d.jsx(Co,{size:15,className:"text-ink-3"}),"Project overview"]}),r.views.map(l=>{var f;const c=((f=Yr(l))==null?void 0:f.icon)??Co;return d.jsxs(Ye.Item,{className:o,value:`${l.title} ${l.type} diagram`,onSelect:()=>s(()=>T.getState().navigate(l.id)),children:[d.jsx(c,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.title}),d.jsx("span",{className:"text-[12px] text-ink-3",children:Bd(l.category)})]},l.id)})]}),d.jsx(Ye.Group,{heading:"Parts of the system",children:r.model.entities.map(l=>{const c=n.style(l),f=Ad(c.icon);return d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.id} ${c.label} ${l.technology??""} ${l.summary}`,onSelect:()=>i({kind:"entity",id:l.id}),children:[d.jsx(f,{size:15,style:{color:dt(c.tone)}}),d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[l.name," ",d.jsxs("span",{className:"text-ink-3",children:["— ",l.summary]})]}),d.jsx("span",{className:"shrink-0 text-[12px] text-ink-3",children:c.label})]},l.id)})}),d.jsx(Ye.Group,{heading:"Data",children:r.model.dataTypes.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.id} ${l.kind} ${l.summary} ${l.fields.map(c=>c.name).join(" ")}`,onSelect:()=>i({kind:"dataType",id:l.id}),children:[d.jsx(Td,{size:15,className:"text-ink-3"}),d.jsx("span",{className:`flex-1 ${l.kind==="table"?"font-mono text-[12.5px]":""}`,children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:l.kind==="table"?"Table":l.kind==="event"?"Event":"Record"})]},l.id))}),d.jsxs(Ye.Group,{heading:"Behaviors and use cases",children:[r.model.behaviors.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.summary}`,onSelect:()=>s(()=>{const c=n.viewsForBehavior(l.id)[0];c?T.getState().navigate(c.id):T.getState().select({kind:"behavior",id:l.id})}),children:[d.jsx(Od,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:n.describe({kind:"behavior",id:l.id}).kind})]},l.id)),r.model.useCases.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.summary} ${l.area} use case`,onSelect:()=>i({kind:"useCase",id:l.id}),children:[d.jsx(v1,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:"Use case"})]},l.id))]}),d.jsx(Ye.Group,{heading:"States, steps and messages",children:r.model.behaviors.flatMap(l=>l.kind==="state-machine"?[...l.states.filter(c=>c.kind!=="initial").map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.name} ${c.id} state ${c.description??""} ${l.name}`,onSelect:()=>i({kind:"state",behavior:l.id,id:c.id}),children:[d.jsx(bD,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["State in ",l.name]})]},`s-${l.id}-${c.id}`)),...l.transitions.map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.event} ${c.guard??""} transition ${l.name}`,onSelect:()=>i({kind:"transition",behavior:l.id,id:c.id}),children:[d.jsx(Gr,{size:15,className:"text-ink-3"}),d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[c.event,c.guard&&d.jsxs("span",{className:"text-ink-3",children:[" [",c.guard,"]"]})]}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Transition in ",l.name]})]},`t-${l.id}-${c.id}`))]:l.kind==="interaction"?n.messages(l.id).map(({message:c})=>d.jsxs(Ye.Item,{className:o,value:`${c.label} ${c.id} message ${l.name}`,onSelect:()=>i({kind:"message",behavior:l.id,id:c.id}),children:[d.jsx(Gr,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Message in ",l.name]})]},`m-${l.id}-${c.id}`)):l.kind==="activity"?l.nodes.filter(c=>c.label).map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.label} ${c.id} step ${l.name}`,onSelect:()=>i({kind:"activityNode",behavior:l.id,id:c.id}),children:[d.jsx(GE,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Step in ",l.name]})]},`n-${l.id}-${c.id}`)):[])}),d.jsxs(Ye.Group,{heading:"Actions",children:[d.jsxs(Ye.Item,{className:o,value:"Fit diagram to view",onSelect:()=>s(()=>T.getState().requestFocus("fit")),children:[d.jsx(hE,{size:15,className:"text-ink-3"}),"Fit the diagram to the view"]}),d.jsxs(Ye.Item,{className:o,value:"Copy JSON export clipboard",onSelect:()=>s(()=>void V1()),children:[d.jsx(wN,{size:15,className:"text-ink-3"}),"Copy the model as JSON"]}),d.jsxs(Ye.Item,{className:o,value:"Open paste import Mermaid JSON",onSelect:()=>s(()=>T.getState().setImportOpen(!0)),children:[d.jsx(p1,{size:15,className:"text-ink-3"}),"Open or paste a model (Poney JSON or Mermaid)"]}),d.jsxs(Ye.Item,{className:o,value:"Toggle dark light theme",onSelect:()=>s(()=>T.getState().toggleTheme()),children:[d.jsx(y1,{size:15,className:"text-ink-3"}),"Switch theme"]}),d.jsxs(Ye.Item,{className:o,value:"Keyboard shortcuts help",onSelect:()=>s(()=>T.getState().setShortcutsOpen(!0)),children:[d.jsx(XN,{size:15,className:"text-ink-3"}),"Keyboard shortcuts"]})]})]})]})})}function JV(t,e){const n=e.toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return 1;const r=t.toLowerCase(),s=r.split(/[^\p{L}\p{N}]+/u).filter(Boolean);let i=0;for(const o of n){const a=s.findIndex(l=>l.startsWith(o));if(a>=0)i+=a===0?1:a<4?.8:.6;else if(r.includes(o))i+=.3;else return 0}return i/n.length}const GV=[{label:"Sequence",text:`sequenceDiagram
691
- title Password reset
692
- actor User
693
- participant Web as Web app
694
- participant Auth as Auth service
695
- participant Mail as Email provider
696
- User->>Web: Ask for a reset link
697
- Web->>Auth: RequestReset(email)
698
- alt account exists
699
- Auth->>Mail: Send reset email
700
- Mail-->>Auth: Accepted
701
- else no account
702
- Auth->>Auth: Wait, to hide the difference
703
- end
704
- Auth-->>Web: 202 Accepted
705
- Web-->>User: Check your inbox`},{label:"Flowchart",text:`flowchart TD
706
- title Deploy pipeline
707
- subgraph CI
708
- A([Push to main]) --> B[Run tests]
709
- B --> C{Tests pass?}
710
- end
711
- subgraph Release
712
- C -->|Yes| D[Build image]
713
- D --> E[Deploy to staging]
714
- E --> F{Smoke tests pass?}
715
- F -->|Yes| G[Promote to production]
716
- G --> H([Done])
717
- end
718
- C -->|No| I[Notify author]
719
- F -->|No| J[Roll back]
720
- J --> I`},{label:"State",text:`stateDiagram-v2
721
- title Support ticket
722
- [*] --> Open
723
- Open --> InProgress : Agent picks up
724
- InProgress --> Waiting : Needs customer [question asked] / pause SLA
725
- Waiting --> InProgress : Customer replies / resume SLA
726
- InProgress --> Resolved : Fix shipped
727
- Resolved --> Open : Customer reopens [within 7 days]
728
- Resolved --> [*]`},{label:"ER",text:`erDiagram
729
- CUSTOMER ||--o{ INVOICE : receives
730
- INVOICE ||--|{ LINE_ITEM : contains
731
- PRODUCT ||--o{ LINE_ITEM : "is billed as"
732
- CUSTOMER {
733
- uuid id PK
734
- string email UK
735
- string name
736
- }
737
- INVOICE {
738
- uuid id PK
739
- uuid customer_id FK
740
- date issued_on
741
- int total_cents
742
- }
743
- LINE_ITEM {
744
- uuid id PK
745
- uuid invoice_id FK
746
- uuid product_id FK
747
- int quantity
748
- }
749
- PRODUCT {
750
- uuid id PK
751
- string sku UK
752
- int price_cents
753
- }`}];function KT(){const t=T(c=>c.importOpen),e=T(c=>c.importText),n=T(c=>c.setImportOpen),[r,s]=b.useState(""),i=b.useRef(null);b.useEffect(()=>{t&&s(e)},[t,e]);const o=Pp(r),a=b.useMemo(()=>r.trim()?B1(r):null,[r]),l=async c=>s(await c.text());return d.jsx(Vo,{open:t,onOpenChange:c=>n(c),title:"Open a model",description:"Paste or drop a Poney document, or a Mermaid sequence, flowchart, state or ER diagram. Mermaid is converted to a Poney model.",width:720,children:d.jsxs("div",{className:"flex min-h-0 flex-col gap-3 p-5",onDragOver:c=>c.preventDefault(),onDrop:c=>{c.preventDefault();const f=c.dataTransfer.files[0];f&&l(f)},children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-[12px] text-ink-3",children:"Try a Mermaid example:"}),GV.map(c=>d.jsx("button",{type:"button",className:"rounded-md border border-rule px-2 py-1 text-[12px] text-ink-2 hover:border-rule-strong hover:text-ink",onClick:()=>s(c.text),children:c.label},c.label)),d.jsx("span",{className:"flex-1"}),d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md border border-rule px-2 py-1 text-[12px] text-ink-2 hover:border-rule-strong hover:text-ink",onClick:()=>{var c;return(c=i.current)==null?void 0:c.click()},children:[d.jsx(pz,{size:13})," Choose a file"]}),d.jsx("input",{ref:i,type:"file",accept:".poney,.json,.mmd,.mermaid,.txt,application/json",className:"hidden",onChange:c=>{var f;return((f=c.target.files)==null?void 0:f[0])&&void l(c.target.files[0])}})]}),d.jsx("label",{className:"sr-only",htmlFor:"import-text",children:"Model text"}),d.jsx("textarea",{id:"import-text",value:r,onChange:c=>s(c.target.value),spellCheck:!1,placeholder:`{ "poneyVersion": "0.1.0", … }
754
-
755
- or
756
-
757
- sequenceDiagram
758
- Alice->>Bob: Hello`,className:"scrollbar-quiet h-[300px] w-full resize-none rounded-xl border border-rule bg-plaster p-3 font-mono text-[12px] leading-relaxed outline-none focus:border-rule-strong"}),d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"min-w-0 flex-1 text-[12.5px]","aria-live":"polite",children:[(a==null?void 0:a.ok)&&d.jsxs("p",{className:"flex items-center gap-1.5 text-[color:var(--success)]",children:[d.jsx(gN,{size:14})," ",o.label,": “",a.doc.project.name,"”, ",a.doc.views.length," view",a.doc.views.length>1?"s":"","."]}),a&&!a.ok&&d.jsxs("div",{className:"text-[color:var(--failure)]",children:[d.jsxs("p",{className:"flex items-center gap-1.5 font-semibold",children:[d.jsx($d,{size:14})," ",o.label,". It cannot be opened yet:"]}),d.jsx("ul",{className:"mt-1 max-h-24 list-disc overflow-y-auto pl-5 text-ink-2",children:a.issues.slice(0,8).map((c,f)=>d.jsxs("li",{children:[c.path&&d.jsx("code",{className:"font-mono text-[11.5px]",children:c.path})," ",c.message]},f))})]}),!a&&d.jsxs("p",{className:"text-ink-3",children:[o.label,"."]})]}),d.jsx("button",{type:"button",disabled:!(a!=null&&a.ok),onClick:()=>tT(r,"imported"),className:"h-9 shrink-0 rounded-lg bg-ink px-4 font-semibold text-paper transition-opacity hover:opacity-90 disabled:opacity-30",children:"Open model"})]})]})})}const YV=[{title:"Find and move",keys:[["⌘K or /","Search this document"],["⌘Z ⇧⌘Z","Undo and redo a change"],["⌥← ⌥→","Back and forward"],["O","Project overview"],["[ ]","Show or hide the sidebar and the inspector"]]},{title:"Canvas",keys:[["Tab","Move between elements"],["Enter","Select the focused element"],["Double-click","Rename a part, a line, a message, a state or a step"],["F","Zoom to the selection"],["Esc","Clear the selection"],["+ −","Zoom in and out"],["⇧1 ⇧0","Fit the diagram, or 100%"],["Arrows","Pan, when the canvas has focus"],["Scroll · ⌘ + scroll","Pan · zoom at the pointer"]]},{title:"Model",keys:[["⇧⌘C","Copy the model as Poney JSON"],["⌘V","Open pasted Poney JSON or Mermaid"]]}];function QV(){const t=T(n=>n.shortcutsOpen),e=T(n=>n.setShortcutsOpen);return d.jsx(Vo,{open:t,onOpenChange:e,title:"Keyboard shortcuts",width:520,children:d.jsx("div",{className:"scrollbar-quiet overflow-y-auto px-5 py-4",children:YV.map(n=>d.jsxs("section",{className:"mb-4 last:mb-0",children:[d.jsx("h3",{className:"mb-1.5 text-[12px] font-semibold text-ink-3",children:n.title}),d.jsx("dl",{className:"divide-y divide-rule",children:n.keys.map(([r,s])=>d.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[d.jsx("dt",{className:"text-ink-2",children:s}),d.jsx("dd",{className:"shrink-0 rounded-md bg-sunken px-1.5 py-0.5 text-[12px] text-ink",children:r})]},r))})]},n.title))})})}function XV(){const t=T(n=>n.notice),e=T(n=>n.notify);return b.useEffect(()=>{if(!t)return;const n=setTimeout(()=>e(null),4200);return()=>clearTimeout(n)},[t,e]),d.jsx("div",{role:"status","aria-live":"polite",className:"pointer-events-none fixed bottom-20 left-1/2 z-50 -translate-x-1/2",children:t&&d.jsxs("div",{className:"fade-in pointer-events-auto flex max-w-[520px] items-center gap-3 rounded-xl bg-ink px-4 py-2.5 text-[13px] text-paper shadow-float",children:[d.jsx("span",{children:t}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-paper/60 hover:text-paper",onClick:()=>e(null),children:d.jsx(Bo,{size:14})})]})})}const JT=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches;function e7({frame:t,label:e,children:n,pad:r=56,maxScale:s=1.25}){var _;const i=b.useRef(null),[o,a]=b.useState({w:0,h:0}),[l,c]=b.useState(null),[f,u]=b.useState(!1),h=b.useRef(null),m=b.useRef(0),g=b.useRef(null);b.useLayoutEffect(()=>{const S=i.current;if(!S)return;const N=new ResizeObserver(([E])=>a({w:E.contentRect.width,h:E.contentRect.height}));return N.observe(S),()=>N.disconnect()},[]);const p=b.useMemo(()=>o.w&&o.h?sD(t,o.w,o.h,r,s):null,[t,o,r,s]),x=b.useCallback(S=>{h.current=S,c(S)},[]),y=b.useCallback(S=>{cancelAnimationFrame(m.current);const N=h.current;if(!N||JT())return x(S);const E=performance.now(),P=700,z=I=>{const F=Math.min(1,(I-E)/P),U=F<.5?4*F*F*F:1-Math.pow(-2*F+2,3)/2;x({x:N.x+(S.x-N.x)*U,y:N.y+(S.y-N.y)*U,w:N.w+(S.w-N.w)*U,h:N.h+(S.h-N.h)*U}),F<1&&(m.current=requestAnimationFrame(z))};m.current=requestAnimationFrame(z)},[x]);b.useEffect(()=>{if(p)return u(!1),y(p),()=>cancelAnimationFrame(m.current)},[p,y]);const v=b.useCallback((S,N=.5,E=.5)=>{const P=h.current;if(!P||!p)return;cancelAnimationFrame(m.current);const z=Math.min(p.w*4,Math.max(p.w/6,P.w/S)),I=z*(P.h/P.w),F=P.x+N*P.w,U=P.y+E*P.h;x({x:F-N*z,y:U-E*I,w:z,h:I}),u(!0)},[p,x]);b.useEffect(()=>{const S=i.current;if(!S)return;const N=P=>{if(!(P.ctrlKey||P.metaKey))return;P.preventDefault();const z=S.getBoundingClientRect();v(Math.exp(-Math.max(-24,Math.min(24,P.deltaY))*.012),(P.clientX-z.left)/z.width,(P.clientY-z.top)/z.height)},E=P=>P.preventDefault();return S.addEventListener("wheel",N,{passive:!1}),S.addEventListener("gesturestart",E),S.addEventListener("gesturechange",E),()=>{S.removeEventListener("wheel",N),S.removeEventListener("gesturestart",E),S.removeEventListener("gesturechange",E)}},[v]);const k=S=>{S.button===0&&(g.current={x:S.clientX,y:S.clientY,id:S.pointerId,moved:!1})},w=S=>{const N=g.current,E=h.current;if(!N||!E||!i.current)return;const P=S.clientX-N.x,z=S.clientY-N.y;if(!N.moved&&Math.hypot(P,z)<4)return;if(!N.moved)try{i.current.setPointerCapture(N.id)}catch{}N.moved=!0,N.x=S.clientX,N.y=S.clientY;const I=i.current.getBoundingClientRect();cancelAnimationFrame(m.current),x({...E,x:E.x-P*E.w/I.width,y:E.y-z*E.h/I.height}),u(!0)},j=()=>{var S;if((S=g.current)!=null&&S.moved){const N=E=>{E.stopPropagation(),E.preventDefault()};window.addEventListener("click",N,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",N,{capture:!0}),0)}g.current=null},C=l&&o.w?o.w/l.w:1;return d.jsxs("div",{ref:i,className:`relative h-full w-full touch-none select-none ${(_=g.current)!=null&&_.moved?"cursor-grabbing":"cursor-grab"}`,onPointerDown:k,onPointerMove:w,onPointerUp:j,onPointerCancel:()=>g.current=null,onKeyDown:S=>{S.key!=="Tab"||S.altKey||S.metaKey||S.ctrlKey||!S.target.closest("[data-ref]")||kT(S.currentTarget,S.target,S.shiftKey)&&S.preventDefault()},onDoubleClick:S=>{if(S.target.closest("[data-ref]"))return;const N=i.current.getBoundingClientRect();v(1.6,(S.clientX-N.left)/N.width,(S.clientY-N.top)/N.height)},children:[l&&d.jsx("svg",{className:"absolute inset-0 h-full w-full",viewBox:`${l.x} ${l.y} ${l.w} ${l.h}`,role:"img","aria-label":e,children:n}),d.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-0.5 rounded-lg border border-rule bg-raised/95 p-0.5 shadow-float backdrop-blur",onPointerDown:S=>S.stopPropagation(),children:[d.jsx("button",{type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:()=>v(1/1.3),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken",children:d.jsx(kE,{size:14})}),d.jsxs("span",{className:"font-tabular w-11 text-center text-[11.5px] text-ink-3",children:[Math.round(C*100),"%"]}),d.jsx("button",{type:"button","aria-label":"Zoom in",title:"Zoom in (or pinch)",onClick:()=>v(1.3),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken",children:d.jsx(x1,{size:14})}),f&&d.jsx("button",{type:"button",onClick:()=>p?(u(!1),y(p)):void 0,className:"h-7 rounded-md px-2 text-[12px] font-medium text-ink-2 hover:bg-sunken",children:"Reset view"}),d.jsx(wT,{className:"h-7 w-7"})]})]})}const Yb=new WeakMap;function t7(t,e){const n=S1(),r=`${t.id}|${JSON.stringify(e)}`,[s,i]=b.useState(null);return b.useEffect(()=>{let o=!0,a=Yb.get(n);a||Yb.set(n,a=new Map);let l=a.get(r);return l||(l=document.fonts.ready.then(()=>B_(n,t,e)),a.set(r,l)),l.then(c=>o&&i({key:r,scene:c})),()=>{o=!1}},[n,r]),(s==null?void 0:s.key)===r?s.scene:s==null?void 0:s.scene}function bu({view:t,walkthrough:e,marks:n,mode:r,focus:s,callouts:i,hot:o,setHot:a,maxScale:l,sceneData:c,traceStep:f=null}){var C;const[u,h]=b.useState(void 0);b.useEffect(()=>h(void 0),[t]);const m=b.useCallback(_=>h(S=>{const N=S??(t.type==="map"?t.collapsed:[]);return N.includes(_)?N.filter(E=>E!==_):[...N,_]}),[t]),g=b.useMemo(()=>({...tD(t,e,s),...u?{collapsed:u}:{}}),[t,e,s,u]),p=t7(t,g),x=ze(),y=b.useMemo(()=>p?rD(p,t,s,x,e):null,[p,t,s,x,e]),v=f!==null?(C=c==null?void 0:c.trace[f])==null?void 0:C.ref:void 0,k=b.useMemo(()=>{var U;if(!p||!y||!v)return y;const _=an(v),S=d1([v],x,e);if((_==null?void 0:_.kind)==="message"){const M=(U=x.messages(_.behavior).find($=>$.message.id===_.id))==null?void 0:U.message;M&&S.push(`entity:${M.from}`,`entity:${M.to}`)}const N=S.map(M=>p.anchors[M]).filter(M=>!!M);if(!N.length)return y;const E=Ni(N),P=Math.min(y.w,Math.max(E.w,620)),z=Math.min(y.h,Math.max(E.h,340)),I=Math.max(y.x+P/2,Math.min(y.x+y.w-P/2,E.x+E.w/2)),F=Math.max(y.y+z/2,Math.min(y.y+y.h-z/2,E.y+E.h/2));return{x:I-P/2,y:F-z/2,w:P,h:z}},[p,y,v,x,e]),w=vT(),j=b.useMemo(()=>({...iD({marks:n,mode:r,view:t,focus:s,callouts:i,hot:o,setHot:a,idx:x,walkthrough:e,effects:[...(c==null?void 0:c.effects)??[],...w.effects],badges:[...(c==null?void 0:c.badges)??[],...w.badges],trace:c==null?void 0:c.trace,traceStep:f,animate:!JT()}),...t.type==="map"?{toggleGroup:m}:{}}),[n,r,t,s,i,o,a,x,e,m,c,f,w]);return!p||!k?d.jsx("div",{className:"grid h-full place-items-center text-ink-3",children:"Drawing…"}):d.jsx(o1,{value:j,children:d.jsx("div",{className:"h-full",onContextMenu:xT(t.id),children:d.jsx(e7,{frame:k,label:t.title,maxScale:l,children:t.type==="map"||t.type==="sequence"||t.type==="state"?d.jsx(Vz,{view:t,scene:p,extra:e==null?void 0:e.removed.entities}):d.jsx(n7,{view:t,scene:p})})})})}function n7({view:t,scene:e}){const n=Yr(t);if(!n)return null;const r=n.Renderer;return d.jsx(r,{view:t,scene:e})}let Qb;const ng=new Map,r7={ex:"elixir",exs:"elixir",heex:"html",eex:"html",leex:"html",rb:"ruby",rake:"ruby",gemspec:"ruby",ru:"ruby",erb:"erb",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",php:"php",cs:"csharp",c:"c",h:"c",cc:"cpp",cpp:"cpp",hpp:"cpp",scala:"scala",clj:"clojure",erl:"erlang",hs:"haskell",sql:"sql",graphql:"graphql",gql:"graphql",proto:"proto",json:"json",jsonc:"jsonc",yml:"yaml",yaml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",sh:"shellscript",bash:"shellscript",zsh:"shellscript",vue:"vue",svelte:"svelte",tf:"hcl"},s7={Gemfile:"ruby",Rakefile:"ruby",Dockerfile:"docker",Makefile:"make","mix.lock":"elixir"};function i7(t){const e=t.split("/").pop()??t;return s7[e]??r7[e.includes(".")?e.split(".").pop().toLowerCase():""]}async function o7(t){Qb??(Qb=t1(()=>import("./dist-Db6f3Sb_.js"),[]).then(n=>n.createHighlighter({themes:["github-light","github-dark"],langs:[]})));const e=await Qb;return ng.has(t)||ng.set(t,e.loadLanguage(t).then(()=>!0,()=>!1)),await ng.get(t)?e:void 0}function a7(t,e,n){return t.codeToTokens(n.join(`
759
- `),{lang:e,themes:{light:"github-light",dark:"github-dark"},defaultColor:!1}).tokens.map(r=>r.map(s=>({content:s.content,style:s.htmlStyle})))}function l7(t){const[e,n]=b.useState(),r=i7(t.path);return b.useEffect(()=>{if(n(void 0),!r)return;let s=!0;return o7(r).then(i=>{if(!i||!s)return;const o=new Map;t.hunks.forEach((a,l)=>{for(const c of["new","old"]){const f=a.lines.map((h,m)=>({l:h,li:m})).filter(({l:h})=>c==="new"?h.kind!=="del":h.kind!=="add"),u=a7(i,r,f.map(({l:h})=>h.text));f.forEach(({l:h,li:m},g)=>{(c==="new"||h.kind==="del")&&o.set(`${l}:${m}`,u[g]??[])})}}),n(o)}),()=>{s=!1}},[t,r]),e}var GT={exports:{}},YT={};/**
760
- * @license React
761
- * use-sync-external-store-shim.production.js
762
- *
763
- * Copyright (c) Meta Platforms, Inc. and affiliates.
764
- *
765
- * This source code is licensed under the MIT license found in the
766
- * LICENSE file in the root directory of this source tree.
767
- */var sl=b;function c7(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var d7=typeof Object.is=="function"?Object.is:c7,u7=sl.useState,f7=sl.useEffect,h7=sl.useLayoutEffect,p7=sl.useDebugValue;function m7(t,e){var n=e(),r=u7({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return h7(function(){s.value=n,s.getSnapshot=e,rg(s)&&i({inst:s})},[t,n,e]),f7(function(){return rg(s)&&i({inst:s}),t(function(){rg(s)&&i({inst:s})})},[t]),p7(n),n}function rg(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!d7(t,n)}catch{return!0}}function g7(t,e){return e()}var y7=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g7:m7;YT.useSyncExternalStore=sl.useSyncExternalStore!==void 0?sl.useSyncExternalStore:y7;GT.exports=YT;var Q1=GT.exports;function qt(t){this.content=t}qt.prototype={constructor:qt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new qt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new qt(n)},addToStart:function(t,e){return new qt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new qt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new qt(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=qt.from(t),t.size?new qt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=qt.from(t),t.size?new qt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=qt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};qt.from=function(t){if(t instanceof qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new qt(e)};function QT(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,l=0;for(;o[l]==a[l];l++)n++;return l&&l<o.length&&l<a.length&&t4(o.charCodeAt(l-1))&&e4(o.charCodeAt(l))&&n--,n}if(s.content.size||i.content.size){let o=QT(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function XT(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=o.text,f=a.text,u=c.length,h=f.length;for(;u>0&&h>0&&c[u-1]==f[h-1];)u--,h--,n--,r--;return u&&h&&u<c.length&&t4(c.charCodeAt(u-1))&&e4(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(o.content.size||a.content.size){let c=XT(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}function e4(t){return t>=56320&&t<57344}function t4(t){return t>=55296&&t<56320}class G{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let f=a+1;l.nodesBetween(Math.max(0,e-f),Math.min(l.content.size,n-f),r,s+f)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new G(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new G(r,s)}cutByIndex(e,n){return e==n?G.empty:e==0&&n==this.content.length?this:new G(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new G(s,i)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return QT(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return XT(this,e,n,r)}findIndex(e){if(e==0)return Su(0,e);if(e==this.size)return Su(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?Su(n+1,i):Su(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return G.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return G.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new G(n||e,r)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const sg={index:0,offset:0};function Su(t,e){return sg.index=t,sg.offset=e,sg}function ph(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ph(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ph(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ge=class Ex{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ph(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ex.none;if(e instanceof Ex)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ge.none=[];class rd extends Error{}class ce{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=r4(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new ce(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ce(n4(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ce.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ce(G.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new ce(e,r,s)}}ce.empty=new ce(G.empty,0,0);function n4(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(n4(i.content,e-s-1,n-s-1)))}function r4(t,e,n,r,s,i){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=r4(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,l);return c&&t.replaceChild(o,l.copy(c))}function x7(t,e,n){if(n.openStart>t.depth)throw new rd("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new rd("Inconsistent open depths");return s4(t,e,n,0)}function s4(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=s4(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return fo(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=v7(n,t);return fo(i,o4(t,o,a,e,r))}else return fo(i,mh(t,e,r))}function i4(t,e){if(!e.type.compatibleContent(t.type))throw new rd("Cannot join "+e.type.name+" onto "+t.type.name)}function $x(t,e,n){let r=t.node(n);return i4(r,e.node(n)),r}function uo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function yc(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(uo(t.nodeAfter,r),i++));for(let a=i;a<o;a++)uo(s.child(a),r);e&&e.depth==n&&e.textOffset&&uo(e.nodeBefore,r)}function fo(t,e){if(!t.type.validContent(e))throw new rd("Invalid content for node "+t.type.name);return t.copy(e)}function o4(t,e,n,r,s){let i=t.depth>s&&$x(t,e,s+1),o=r.depth>s&&$x(n,r,s+1),a=[];return yc(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(i4(i,o),uo(fo(i,o4(t,e,n,r,s+1)),a)):(i&&uo(fo(i,mh(t,e,s+1)),a),yc(e,n,s,a),o&&uo(fo(o,mh(n,r,s+1)),a)),yc(r,null,s,a),new G(a)}function mh(t,e,n){let r=[];if(yc(null,t,n,r),t.depth>n){let s=$x(t,e,n+1);uo(fo(s,mh(t,e,n+1)),r)}return yc(e,null,n,r),new G(r)}function v7(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(G.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class sd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ge.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new gh(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new sd(n,r,i)}static resolveCached(e,n){let r=Xb.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Xb.set(e,r=new k7);let s=r.elts[r.i]=sd.resolve(e,n);return r.i=(r.i+1)%w7,s}}class k7{constructor(){this.elts=[],this.i=0}}const w7=12,Xb=new WeakMap;class gh{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const b7=Object.create(null);let ki=class Mx{constructor(e,n,r,s=Ge.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||G.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ph(this.attrs,n||e.defaultAttrs||b7)&&Ge.sameSet(this.marks,r||Ge.none)}copy(e=null){return e==this.content?this:new Mx(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mx(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ce.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ce(c,s.depth-o,i.depth-o)}replace(e,n,r){return x7(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return sd.resolveCached(this,e)}resolveNoCache(e){return sd.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),a4(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=G.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),t2(this.type.attrs,this.attrs,"node",this.type.name);let e=Ge.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];t2(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Ge.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=G.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,s,r)}};ki.prototype.text=void 0;const e2=(()=>{let{stack:t}=new Error("/");if(!t||!/\n\s*at\s/.test(t))return n=>n;let e=Object.create(null);return n=>(e[n],n)})();class yh extends ki{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):a4(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return e2(this.text.slice(e,n))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new yh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(e2(this.text.slice(e,n)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function a4(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function t2(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}class Ro{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new S7(e,n);if(r.next==null)return Ro.empty;let s=l4(r);r.next&&r.err("Unexpected trailing text");let i=M7($7(s));return T7(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return G.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:f,next:u}=o.next[c];if(!(f.isText||f.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let h=i(u,a.concat(f));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
768
- `)}}Ro.empty=new Ro(!0);class S7{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function l4(t){let e=[];do e.push(j7(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function j7(t){let e=[];do e.push(C7(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function C7(t){let e=E7(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=_7(t,e);else break;return e}function n2(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function _7(t,e){let n=n2(t),r=n;return t.eat(",")&&(t.next!="}"?r=n2(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function N7(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function E7(t){if(t.eat("(")){let e=l4(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=N7(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $7(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let f=n();s(i(o.expr,l),f),l=f}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let f=n();r(l,f),s(i(o.expr,l),f),l=f}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function c4(t,e){return e-t}function r2(t,e){let n=[];return r(e),n.sort(c4);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function M7(t){let e=Object.create(null);return n(r2(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let f=0;f<s.length;f++)s[f][0]==a&&(c=s[f][1]);r2(t,l).forEach(f=>{c||s.push([a,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let i=e[r.join(",")]=new Ro(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(c4);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function T7(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function d4(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function u4(t,e){let n=Object.create(null);for(let r in t){let s=t[r],i=e&&e[r];if(i===void 0)if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r);else s.validate&&s.validate(i);n[r]=i}return n}function f4(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new A7(t,r,e[r]);return n}let Tx=class h4{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=f4(e,r.attrs),this.defaultAttrs=d4(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ro.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:u4(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ki(this,this.computeAttrs(e),G.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=G.from(n),this.checkContent(n),new ki(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=G.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(G.empty,!0);return i?new ki(this,e,n.append(i),Ge.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new h4(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function O7(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class A7{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?O7(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Bp{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=f4(e,s.attrs),this.excluded=null;let i=d4(this.attrs);this.instance=i?new Ge(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,u4(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Bp(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class p4{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=qt.from(e.nodes),n.marks=qt.from(e.marks||{}),this.nodes=Tx.compile(this.spec.nodes,this),this.marks=Bp.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Ro.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?s2(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:s2(this,o.split(" "))}this.nodeFromJSON=s=>ki.fromJSON(this,s),this.markFromJSON=s=>Ge.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Tx){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new yh(r,r.defaultAttrs,e,Ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function s2(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function R7(t){return t.tag!=null}function I7(t){return t.style!=null}class wi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(R7(s))this.tags.push(s);else if(I7(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new o2(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new o2(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),ce.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(z7(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=a2(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=a2(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wi(e,wi.schemaRules(e)))}}const m4={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},P7={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},g4={ol:!0,ul:!0},id=1,Ox=2,xc=4;function i2(t,e,n){return e!=null?(e?id:0)|(e==="full"?Ox:0):t&&t.whitespace=="pre"?id|Ox:n&~xc}class ju{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ge.none,this.match=i||(o&xc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&id)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!m4.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class o2{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=i2(null,n.preserveWhitespace,0)|(r?xc:0);s?i=new ju(s.type,s.attrs,Ge.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new ju(null,null,Ge.none,!0,null,o):i=new ju(e.schema.topNodeType,null,Ge.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Ox?"full":this.localPreserveWS||(s.options&id)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
769
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;g4.hasOwnProperty(o)&&this.parser.normalizeLists&&D7(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:P7.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,f=this.needsBlock;if(m4.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=l&&l.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=f}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
770
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Ge.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):l2(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=i2(e,i,o.options);o.options&xc&&o.content.length==0&&(a|=xc);let l=Ge.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):l2(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ju(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=id)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let f=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function D7(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&g4.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function z7(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function a2(t){let e={};for(let n in t)e[n]=t[n];return e}function l2(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:f}=a.edge(l);if(c==e||i.indexOf(f)<0&&o(f))return!0}};if(o(s.contentMatch))return!0}}class Wo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Cu(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],f=this.serializeMark(c,o.isInline,n);f&&(i.push([c,s]),s.appendChild(f.dom),s=f.contentDOM||f.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Cu(n).createTextNode(e.text);let{dom:r,contentDOM:s}=tf(Cu(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&tf(Cu(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:tf(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=c2(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return c2(e.marks)}}function c2(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Cu(t){return t.document||window.document}const d2=new WeakMap;function L7(t){let e=d2.get(t);return e===void 0&&d2.set(t,e=F7(t)),e}function F7(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function tf(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=L7(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=f;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof h=="string")l.appendChild(t.createTextNode(h));else{let{dom:m,contentDOM:g}=tf(t,h,n,r);if(l.appendChild(m),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:l,contentDOM:a}}const y4=65535,x4=Math.pow(2,16);function B7(t,e){return t+e*x4}function u2(t){return t&y4}function V7(t){return(t-(t&y4))/x4}const v4=1,k4=2,nf=4,w4=8;class Ax{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&w4)>0}get deletedBefore(){return(this.delInfo&(v4|nf))>0}get deletedAfter(){return(this.delInfo&(k4|nf))>0}get deletedAcross(){return(this.delInfo&nf)>0}}class Fn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fn.empty)return Fn.empty}recover(e){let n=0,r=u2(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+V7(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],f=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:n:n,m=l+s+(h<0?0:f);if(r)return m;let g=e==(n<0?l:u)?null:B7(a/3,e-l),p=0;return c&&(p|=e==l?k4:e==u?v4:nf,(n<0?e!=l:e!=u)&&(p|=w4)),new Ax(m,p,g)}s+=f-c}return r?e+s:new Ax(e+s,0,null)}touches(e,n){let r=0,s=u2(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],f=l+c;if(e<=f&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],f=this.ranges[s+r];e(a,a+c,l,l+f),i+=f-c}}invert(){return new Fn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fn.empty:new Fn(e<0?[0,-e,0]:[0,0,e])}}Fn.empty=new Fn([]);class xh{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new xh(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=e.from,r=this._maps.length;n<e.to;n++){let s=e.getMirror(n);s!=null&&(s=s<n&&s>=e.from?r+(s-e.from):void 0),this.appendMap(e._maps[n],s)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.to-1,r=this._maps.length+e._maps.length;n>=e.from;n--){let s=e.getMirror(n);s!=null&&(s=s>n&&s<e.to?r-(s-e.from)-1:void 0),this.appendMap(e._maps[n].invert(),s)}}invert(){let e=new xh;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new Ax(e,s,null)}}const ig=Object.create(null);class Tt{getMap(){return Fn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ig[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ig)throw new RangeError("Duplicate use of step JSON ID "+e);return ig[e]=n,n.prototype.jsonID=e,n}}class kt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new kt(e,null)}static fail(e){return new kt(null,e)}static fromReplace(e,n,r,s){try{return kt.ok(e.replace(n,r,s))}catch(i){if(i instanceof rd)return kt.fail(i.message);throw i}}}function X1(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(X1(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return G.fromArray(r)}class ms extends Tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ce(X1(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,i)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,s)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!Ge.sameSet(i,r.marks)){let o=Math.max(this.from,s),a=Math.min(this.to,s+r.nodeSize);vh(Zr,o,a,this.mark,n);for(let l of r.marks)l.isInSet(i)||vh(ms,o,a,l,n)}}}),n.length==1?n[0]:new ho(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new ms(n,r,this.mark)}merge(e){return e instanceof ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ms(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ms(n.from,n.to,e.markFromJSON(n.mark))}}Tt.jsonID("addMark",ms);class Zr extends Tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ce(X1(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,r)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,s)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&vh(ms,Math.max(this.from,s),Math.min(this.to,s+r.nodeSize),this.mark,n)}),n.length==1?n[0]:new ho(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new Zr(n,r,this.mark)}merge(e){return e instanceof Zr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Zr(n.from,n.to,e.markFromJSON(n.mark))}}Tt.jsonID("removeMark",Zr);function vh(t,e,n,r,s){let i=s.length?s[s.length-1]:null;i&&i instanceof t&&i.to==e&&i.mark.eq(r)?s[s.length-1]=new t(i.from,n,r):s.push(new t(e,n,r))}class ho extends Tt{constructor(e){super(),this.steps=e}apply(e){for(let n of this.steps){let r=n.apply(e);if(!r.doc)return r;e=r.doc}return new kt(e,null)}invert(e){return new ho(this.steps.map(n=>n.invert(e)))}map(e){let n=[];for(let r of this.steps){let s=r.map(e);s&&n.push(s)}return n.length?new ho(n):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,n){if(!Array.isArray(n.steps)||!n.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new ho(n.steps.map(r=>Tt.fromJSON(e,r)))}}Tt.jsonID("markSet",ho);class oi extends Tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new ce(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new oi(this.pos,n.marks[s]);return new oi(this.pos,this.mark)}}return new Io(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new oi(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new oi(n.pos,e.markFromJSON(n.mark))}}Tt.jsonID("addNodeMark",oi);class Io extends Tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new ce(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new oi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Io(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Io(n.pos,e.markFromJSON(n.mark))}}Tt.jsonID("removeNodeMark",Io);class bt extends Tt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Rx(e,this.from,this.to)?kt.fail("Structure replace would overwrite content"):kt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fn([this.from,this.to-this.from,this.slice.size])}invert(e){return new bt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&bt.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new bt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof bt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ce.empty:new ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new bt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ce.empty:new ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new bt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new bt(n.from,n.to,ce.fromJSON(e,n.slice),!!n.structure)}}bt.MAP_BIAS=1;Tt.jsonID("replace",bt);class Ft extends Tt{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Rx(e,this.from,this.gapFrom)||Rx(e,this.gapTo,this.to)))return kt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return kt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?kt.fromReplace(e,this.from,this.to,r):kt.fail("Content does not fit in gap")}getMap(){return new Fn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ft(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos||s>i?null:new Ft(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ft(n.from,n.to,n.gapFrom,n.gapTo,ce.fromJSON(e,n.slice),n.insert,!!n.structure)}}Tt.jsonID("replaceAround",Ft);function Rx(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function W7(t,e,n,r){let s=[];t.doc.nodesBetween(e,n,(i,o,a)=>{if(!i.isInline)return;let l=i.marks;if(!r.isInSet(l)&&a.type.allowsMarkType(r.type)){let c=Math.max(o,e),f=Math.min(o+i.nodeSize,n);vh(ms,c,f,r,s)}}),s.forEach(i=>t.step(i))}function U7(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline||!o.isAtom)return;i++;let l=null;if(r instanceof Bp){let c=o.marks,f;for(;f=r.isInSet(c);)(l||(l=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let f=0;f<l.length;f++){let u=l[f],h;for(let m=0;m<s.length;m++){let g=s[m];g.step==i-1&&u.eq(s[m].style)&&(h=g)}h?(h.to=c,h.step=i):s.push({style:u,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Zr(o.from,o.to,o.style)))}function e0(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),f=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new bt(a,f,ce.empty));else{r=u;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Zr(a,f,c.marks[h]));if(s&&c.isText&&n.whitespace!="pre"){let h,m=/\r?\n|\r/g,g;for(;h=m.exec(c.text);)g||(g=new ce(G.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new bt(a+h.index,a+h.index+h[0].length,g))}}a=f}if(!r.validEnd){let l=r.fillBefore(G.empty,!0);t.replace(a,a,new ce(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function Z7(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function El(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!Z7(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function H7(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,f=G.empty,u=0;for(let g=i,p=!1;g>n;g--)p||r.index(g)>0?(p=!0,f=G.from(r.node(g).copy(f)),u++):l--;let h=G.empty,m=0;for(let g=i,p=!1;g>n;g--)p||s.after(g+1)<s.end(g)?(p=!0,h=G.from(s.node(g).copy(h)),m++):c++;t.step(new Ft(l,c,o,a,new ce(f.append(h),u,m),f.size-u,!0))}function b4(t,e,n=null,r=t){let s=q7(t,e),i=s&&K7(r,e);return i?s.map(f2).concat({type:e,attrs:n}).concat(i.map(f2)):null}function f2(t){return{type:t,attrs:null}}function q7(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function K7(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function J7(t,e,n){let r=G.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Ft(s,i,s,i,new ce(r,0,0),n.length,!0))}function G7(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&Y7(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let m=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);m&&!g?c=!1:!m&&g&&(c=!0)}c===!1&&j4(t,o,a,i),e0(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let f=t.mapping.slice(i),u=f.map(a,1),h=f.map(a+o.nodeSize,1);return t.step(new Ft(u,h,u+1,h-1,new ce(G.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&S4(t,o,a,i),!1}})}function S4(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function j4(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
771
- `))}})}function Y7(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function Q7(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ft(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ce(G.from(o),0,0),1,!0))}function Cs(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,f=n-2;c>i;c--,f--){let u=s.node(c),h=s.index(c);if(u.type.spec.isolating)return!1;let m=u.content.cutByIndex(h,u.childCount),g=r&&r[f+1];g&&(m=m.replaceChild(0,g.type.create(g.attrs)));let p=r&&r[f]||u;if(!u.canReplace(h+1,u.childCount)||!p.type.validContent(m))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function X7(t,e,n=1,r){let s=t.doc.resolve(e),i=G.empty,o=G.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=G.from(s.node(a).copy(i));let f=r&&r[c];o=G.from(f?f.type.create(f.attrs,o):s.node(a).copy(o))}t.step(new bt(e,e,new ce(i.append(o),n,n),!0))}function Uo(t,e){let n=t.resolve(e),r=n.index();return C4(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eW(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function C4(t,e){return!!(t&&e&&!t.isLeaf&&eW(t,e))}function Vp(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&C4(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function tW(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let f=o.whitespace=="pre",u=!!o.contentMatch.matchType(s);f&&!u?r=!1:!f&&u&&(r=!0)}let a=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);j4(t,f.node(),f.before(),a)}o.inlineContent&&e0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new bt(c,l.map(e+n,-1),ce.empty,!0)),r===!0){let f=t.doc.resolve(c);S4(t,f.node(),f.before(),t.steps.length)}return t}function nW(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function rW(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1;for(let l=0;l<2;l++){if(l){if(!a)break;a=-a}let c=r.index(o)+(a>0?1:0),f=r.node(o),u=!1;if(i==1)u=f.canReplace(c,c,s);else{let h=f.contentMatchAt(c).findWrapping(s.firstChild.type);u=h&&f.canReplaceWith(c,c,h[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}}return null}function Wp(t,e,n=e,r=ce.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return _4(s,i,r)?new bt(e,n,r):new sW(s,i,r).fit()}function _4(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class sW{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=G.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new ce(i,o,a);return e>-1?new Ft(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new bt(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=h2(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],f,u=null;if(n==1&&(o?c.matchType(o.type)||(u=c.fillBefore(G.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(n==2&&o&&(f=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:f};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return p2(e,-1)<=n?!1:(this.unplaced.size>1&&p2(e,1)>r&&r++,this.unplaced=new ce(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=h2(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new ce(tc(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ce(tc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let p=0;p<i.length;p++)this.openFrontierNode(i[p]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,f=[],{match:u,type:h}=this.frontier[n];if(s){for(let p=0;p<s.childCount;p++)f.push(s.child(p));u=u.matchFragment(s)}let m=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let p=a.child(c),x=u.matchType(p.type);if(!x)break;c++,(c>1||l==0||p.content.size)&&(u=x,f.push(N4(p.mark(h.allowedMarks(p.marks)),c==1?l:0,c==a.childCount?m:-1)))}let g=c==a.childCount;g||(m=-1),this.placed=nc(this.placed,n,G.from(f)),this.frontier[n].match=u,g&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let p=0,x=f[f.length-1];x&&p<m;p++)this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),x=x.lastChild;this.unplaced=g?e==0?ce.empty:new ce(tc(o.content,e-1,1),e-1,m<0?o.openEnd:e-1):new ce(tc(o.content,e,c),e,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!og(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=og(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],f=og(e,a,c,l,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=nc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=nc(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=nc(this.placed,this.frontier.length,n))}}function tc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(tc(t.firstChild.content,e-1,n)))}function nc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(nc(t.lastChild.content,e-1,n)))}function h2(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function N4(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,N4(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function og(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!iW(n,i.content,o)?a:null}function iW(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function oW(t){return t.spec.defining||t.spec.definingForContent}function p2(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function aW(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(_4(s,i,r))return t.step(new bt(e,n,r));let o=$4(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,m=s.pos-1;h>0;h--,m--){let g=s.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==m&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],f=r.openStart;for(let h=r.content,m=0;;m++){let g=h.firstChild;if(c.push(g),m==r.openStart)break;h=g.content}for(let h=f-1;h>=0;h--){let m=c[h],g=oW(m.type);if(g&&!m.sameMarkup(s.node(Math.abs(a)-1)))f=h;else if(g||!m.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let m=(h+f+1)%(r.openStart+1),g=c[m];if(g)for(let p=0;p<o.length;p++){let x=o[(p+l)%o.length],y=!0;x<0&&(y=!1,x=-x);let v=s.node(x-1),k=s.index(x-1);if(v.canReplaceWith(k,k,g.type,g.marks))return t.replace(s.before(x),y?i.after(x):n,new ce(E4(r.content,0,r.openStart,m),m,r.openEnd))}}let u=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>u));h--){let m=o[h];m<0||(e=s.before(m),n=i.after(m))}}function E4(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(E4(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(G.empty,!0))}return t}function lW(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=nW(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new ce(G.from(r),0,0))}function cW(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=s.depth;l>o;l--)s.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=s.depth;l>0&&n==s.start(l);l--)n=s.before(l);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=$4(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function $4(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Ia extends Tt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return kt.fromReplace(e,this.pos,this.pos+1,new ce(G.from(s),0,n.isLeaf?0:1))}getMap(){return Fn.empty}invert(e){return new Ia(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ia(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ia(n.pos,n.attr,n.value)}}Tt.jsonID("attr",Ia);class od extends Tt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return kt.ok(r)}getMap(){return Fn.empty}invert(e){return new od(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new od(n.attr,n.value)}}Tt.jsonID("docAttr",od);let il=class extends Error{};il=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};il.prototype=Object.create(Error.prototype);il.prototype.constructor=il;il.prototype.name="TransformError";class M4{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new il(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ce.empty){let s=Wp(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new ce(G.from(r),0,0))}delete(e,n){return this.replace(e,n,ce.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return aW(this,e,n,r),this}replaceRangeWith(e,n,r){return lW(this,e,n,r),this}deleteRange(e,n){return cW(this,e,n),this}lift(e,n){return H7(this,e,n),this}join(e,n=1){return tW(this,e,n),this}wrap(e,n){return J7(this,e,n),this}setBlockType(e,n=e,r,s=null){return G7(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return Q7(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Ia(e,n,r)),this}setDocAttribute(e,n){return this.step(new od(e,n)),this}addNodeMark(e,n){return this.step(new oi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ge)n.isInSet(r.marks)&&this.step(new Io(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Io(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return X7(this,e,n,r),this}addMark(e,n,r){return W7(this,e,n,r),this}removeMark(e,n,r){return U7(this,e,n,r),this}clearIncompatible(e,n,r){return e0(this,e,n,r),this}}const ag=Object.create(null);class Be{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new dW(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ce.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],f=e.mapping.slice(i);e.replaceRange(f.map(l.pos),f.map(c.pos),a?ce.empty:n),a==0&&y2(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),f=l.map(a.pos);i?e.deleteRange(c,f):(e.replaceRangeWith(c,f,n),y2(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new _e(e):aa(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?aa(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):aa(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Un(e.node(0))}static atStart(e){return aa(e,e,0,0,1)||new Un(e)}static atEnd(e){return aa(e,e,e.content.size,e.childCount,-1)||new Un(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ag[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ag)throw new RangeError("Duplicate use of selection JSON ID "+e);return ag[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}Be.prototype.visible=!0;class dW{constructor(e,n){this.$from=e,this.$to=n}}let m2=!1;function g2(t){!m2&&!t.parent.inlineContent&&(m2=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _e extends Be{constructor(e,n=e){g2(e),g2(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Be.near(r);let s=e.resolve(n.map(this.anchor));return new _e(s.parent.inlineContent?s:r,r)}replace(e,n=ce.empty){if(super.replace(e,n),n==ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Up(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Be.findFrom(n,r,!0)||Be.findFrom(n,-r,!0);if(i)n=i.$head;else return Be.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Be.findFrom(e,-r,!0)||Be.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new _e(e,n)}}Be.jsonID("text",_e);class Up{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Up(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends Be{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?Be.near(i):new we(i)}content(){return new ce(G.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new t0(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(n.anchor))}static create(e,n){return new we(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1;Be.jsonID("node",we);class t0{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Up(r,r):new t0(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&we.isSelectable(r)?new we(n):Be.near(n)}}class Un extends Be{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ce.empty){if(n==ce.empty){e.delete(0,e.doc.content.size);let r=Be.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Un(e)}map(e){return new Un(e)}eq(e){return e instanceof Un}getBookmark(){return uW}}Be.jsonID("all",Un);const uW={map(){return this},resolve(t){return new Un(t)}};function aa(t,e,n,r,s,i=!1){if(e.inlineContent)return _e.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&we.isSelectable(a))return we.create(t,n-(s<0?a.nodeSize:0))}else{let l=aa(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function y2(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof bt||s instanceof Ft))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,f)=>{o==null&&(o=f)}),t.setSelection(Be.near(t.doc.resolve(o),n))}const x2=1,_u=2,v2=4;class fW extends M4{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|x2)&~_u,this.storedMarks=null,this}get selectionSet(){return(this.updated&x2)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_u,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_u)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~_u,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Be.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=v2,this}get scrolledIntoView(){return(this.updated&v2)>0}}function k2(t,e){return!e||!t?t:t.bind(e)}class rc{constructor(e,n,r){this.name=e,this.init=k2(n.init,r),this.apply=k2(n.apply,r)}}const hW=[new rc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new rc("selection",{init(t,e){return t.selection||Be.atStart(e.doc)},apply(t){return t.selection}}),new rc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new rc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class lg{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hW.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new rc(r.key,r.spec.state,r))})}}class no{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,f=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(f&&r.filterTransaction(f,o)){if(f.setMeta("appendedTransaction",e),!s){s=[];for(let u=0;u<this.config.plugins.length;u++)s.push(u<o?{state:r,n:n.length}:{state:this,n:0})}n.push(f),r=r.applyInner(f),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new no(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new fW(this)}static create(e){let n=new lg(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new no(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new lg(this.schema,e.plugins),r=n.fields,s=new no(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new lg(e.schema,e.plugins),i=new no(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=ki.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=Be.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function T4(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=T4(s,e,{})),n[r]=s}return n}class Pn{constructor(e){this.spec=e,this.props={},e.props&&T4(e.props,this,this.props),this.key=e.key?e.key.key:O4("plugin")}getState(e){return e[this.key]}}const cg=Object.create(null);function O4(t){return t in cg?t+"$"+ ++cg[t]:(cg[t]=0,t+"$")}class Or{constructor(e="key"){this.key=O4(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const A4=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function R4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const I4=(t,e,n)=>{let r=R4(t,n);if(!r)return!1;let s=n0(r);if(!s){let o=r.blockRange(),a=o&&El(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(U4(t,s,e,-1))return!0;if(r.parent.content.size==0&&(ol(i,"end")||we.isSelectable(i)))for(let o=r.depth;;o--){let a=Wp(t.doc,r.before(o),r.after(o),ce.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(ol(i,"end")?Be.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):we.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},pW=(t,e,n)=>{let r=R4(t,n);if(!r)return!1;let s=n0(r);return s?P4(t,s,e):!1},mW=(t,e,n)=>{let r=z4(t,n);if(!r)return!1;let s=r0(r);return s?P4(t,s,e):!1};function P4(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let f=s.lastChild;if(!f)return!1;s=f}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let f=a.firstChild;if(!f)return!1;a=f}let c=Wp(t.doc,i,l,ce.empty);if(!c||c.from!=i||c instanceof bt&&c.slice.size>=l-i)return!1;if(n){let f=t.tr.step(c);f.setSelection(_e.create(f.doc,i)),n(f.scrollIntoView())}return!0}function ol(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const D4=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=n0(r)}let o=i&&i.nodeBefore;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function n0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function z4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const L4=(t,e,n)=>{let r=z4(t,n);if(!r)return!1;let s=r0(r);if(!s)return!1;let i=s.nodeAfter;if(U4(t,s,e,1))return!0;if(r.parent.content.size==0&&(ol(i,"start")||we.isSelectable(i))){let o=Wp(t.doc,r.before(),r.after(),ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ol(i,"start")?Be.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):we.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},F4=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=r0(r)}let o=i&&i.nodeAfter;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,i.pos)).scrollIntoView()),!0)};function r0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const gW=(t,e)=>{let n=t.selection,r=n instanceof we,s;if(r){if(n.node.isTextblock||!Uo(t.doc,n.from))return!1;s=n.from}else if(s=Vp(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(we.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},yW=(t,e)=>{let n=t.selection,r;if(n instanceof we){if(n.node.isTextblock||!Uo(t.doc,n.to))return!1;r=n.to}else if(r=Vp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},xW=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&El(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},B4=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
772
- `).scrollIntoView()),!0)};function s0(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const vW=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=s0(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Be.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},V4=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Un||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=s0(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(_e.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},W4=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Cs(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&El(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function kW(t){return(e,n)=>{if(e.selection instanceof we&&e.selection.node.isBlock){let{$from:m}=e.selection;return!m.parentOffset||!Cs(e.doc,m.pos)?!1:(n&&n(e.tr.split(m.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof _e||e.selection instanceof Un)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,l,c=!1,f=!1;for(let m=s.depth;;m--)if(s.node(m).isBlock){c=s.end(m)==s.pos+(s.depth-m),f=s.start(m)==s.pos-(s.depth-m),l=s0(s.node(m-1).contentMatchAt(s.indexAfter(m-1))),o.unshift(c&&l?{type:l}:null),a=m;break}else{if(m==1)return!1;o.unshift(null)}let u=s.pos,h=Cs(r.doc,u,o.length,o);if(h||(o[0]=l?{type:l}:null,h=Cs(r.doc,u,o.length,o)),!h)return!1;if(r.split(u,o.length,o),!c&&f&&s.node(a).type!=l){let m=r.mapping.slice(i),g=m.map(s.before(a)),p=r.doc.resolve(g);l&&s.node(a-1).canReplaceWith(p.index(),p.index()+1,l)&&r.setNodeMarkup(m.map(s.before(a)),l)}return n&&n(r.scrollIntoView()),!0}}const wW=kW(),bW=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(we.create(t.doc,s))),!0)};function SW(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Uo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function U4(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&SW(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let m=e.pos+i.nodeSize,g=G.empty;for(let y=o.length-1;y>=0;y--)g=G.from(o[y].create(null,g));g=G.from(s.copy(g));let p=t.tr.step(new Ft(e.pos-1,m,e.pos,m,new ce(g,1,0),o.length,!0)),x=p.doc.resolve(m+2*o.length);x.nodeAfter&&x.nodeAfter.type==s.type&&Uo(p.doc,x.pos)&&p.join(x.pos),n(p.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&l?null:Be.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),h=u&&El(u);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(u,h).scrollIntoView()),!0;if(c&&ol(i,"start",!0)&&ol(s,"end")){let m=s,g=[];for(;g.push(m),!m.isTextblock;)m=m.lastChild;let p=i,x=1;for(;!p.isTextblock;p=p.firstChild)x++;if(m.canReplace(m.childCount,m.childCount,p.content)){if(n){let y=G.empty;for(let k=g.length-1;k>=0;k--)y=G.from(g[k].copy(y));let v=t.tr.step(new Ft(e.pos-g.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new ce(y,g.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Z4(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(_e.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const jW=Z4(-1),CW=Z4(1);function _W(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&b4(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function w2(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let f=n.doc.resolve(c),u=f.index();s=f.parent.canReplaceWith(u,u+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function i0(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}i0(A4,I4,D4);i0(A4,L4,F4);i0(B4,V4,W4,wW);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function NW(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return EW(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function EW(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new gh(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new gh(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=b4(i,n,r,e);return a?(t&&$W(t,e,a,s,n),!0):!1}function $W(t,e,n,r,s){let i=G.empty;for(let f=n.length-1;f>=0;f--)i=G.from(n[f].type.create(n[f].attrs,i));t.step(new Ft(e.start-(r?2:0),e.end,e.start,e.end,new ce(i,0,0),n.length,!0));let o=0;for(let f=0;f<n.length;f++)n[f].type==s&&(o=f+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let f=e.startIndex,u=e.endIndex,h=!0;f<u;f++,h=!1)!h&&a&&Cs(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(f).nodeSize;return t}function kh(t,e){return t instanceof Tx?e==t:t.indexOf(e)>-1}function MW(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&kh(t,o.firstChild.type));return i?n?kh(t,r.node(i.depth-1).type)?TW(e,n,i):OW(e,n,i):!0:!1}}function TW(t,e,n){let r=t.tr,s=n.end,i=n.$to.end(n.depth),o=n.parent.child(n.endIndex-1).type;s<i&&(r.step(new Ft(s-1,i,s,i,new ce(G.from(o.create(null,n.parent.copy())),1,0),1,!0)),n=new gh(r.doc.resolve(n.$from.pos),r.doc.resolve(i),n.depth));const a=El(n);if(a==null)return!1;r.lift(n,a);let l=r.doc.resolve(r.mapping.map(s,-1)-1);return Uo(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function OW(t,e,n){let r=t.tr,s=n.parent;for(let m=n.end,g=n.endIndex-1,p=n.startIndex;g>p;g--)m-=s.child(g).nodeSize,r.delete(m-1,m+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),f=i.index(-1);if(!c.canReplace(f+(a?0:1),f+1,o.content.append(l?G.empty:G.from(s))))return!1;let u=i.pos,h=u+o.nodeSize;return r.step(new Ft(u-(a?1:0),h+(l?1:0),u+1,h-1,new ce((a?G.empty:G.from(s.copy(G.empty))).append(l?G.empty:G.from(s.copy(G.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function AW(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&kh(t,c.firstChild.type));if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(!kh(t,l.type))return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,f=G.from(c?l.lastChild.lastChild.type.create():null),u=new ce(G.from(l.type.create(null,G.from(a.type.create(null,f)))),c?3:1,0),h=i.start,m=i.end;n(e.tr.step(new Ft(h-(c?3:1),m,h,m,u,1,!0)).scrollIntoView())}return!0}}const ln=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e};function al(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e}let Ix=null;function zr(t,e,n){let r=Ix||(Ix=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r}function RW(){Ix=null}function vc(t,e,n,r){return n&&(S2(t,e,n,r,-1)||S2(t,e,n,r,1))}const b2=/^(img|br|input|textarea|hr)$/i;function S2(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:zt(t))){let o=t.parentNode;if(!o||!Se(o)||ad(t)||b2.test(t.nodeName)||t.contentEditable=="false")return!1;e=ln(t)+(s<0?0:1),t=o}else if(Se(t)){let o=t.childNodes[e+(s<0?-1:0)];if(Se(o)&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else{if(ad(o)||b2.test(o.nodeName))return!1;t=o,e=s<0?zt(t):0}}else return!1}}function zt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Se(t){return t.nodeType==1}function Ct(t){return t.nodeType==3}function ll(t,e){return e?t.contains(Se(e)?e:e.parentNode):!1}function o0(t,e){for(;;){if(Ct(t)&&e)return t;if(Se(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=zt(t)}else if(t.parentNode&&!ad(t,!0))e=ln(t),t=t.parentNode;else return null}}function a0(t,e){for(;;){if(Ct(t)&&e<t.nodeValue.length)return t;if(Se(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ad(t,!0))e=ln(t)+1,t=t.parentNode;else return null}}function IW(t,e,n){for(let r=e==0,s=e==zt(t);r||s;){if(t==n)return!0;let i=ln(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==zt(t)}}function ad(t,e=!1){let n;for(let r=t;r&&!(n=r.pmViewDesc);r=r.parentNode);return n&&n.node&&(!e||n.node.isBlock)&&(n.dom==t||n.contentDOM==t)}function Zp(t){return t.focusNode&&vc(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)}function H4(t,e){t.collapse(e.anchorNode,e.anchorOffset),(e.focusNode!=e.anchorNode||e.focusOffset!=e.anchorOffset)&&t.extend(e.focusNode,e.focusOffset)}function PW(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function DW(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function zW(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(zt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(zt(r.startContainer),r.startOffset)}}}const es=typeof navigator<"u"?navigator:null,j2=typeof document<"u"?document:null,cl=es&&es.userAgent||"",$r=/gecko\/(\d+)/i.test(cl)&&!/edge?\//i.test(cl);$r&&+(/Firefox\/(\d+)/.exec(cl)||[0,0])[1];const Px=/Chrome\/(\d+)/.exec(cl),gn=!!Px,q4=Px?+Px[1]:0,cn=!!es&&/Apple Computer/.test(es.vendor),dl=cn&&(/Mobile\/\w+/.test(cl)||!!es&&es.maxTouchPoints>2),er=dl||(es?/Mac/.test(es.platform):!1),K4=es?/Win/.test(es.platform):!1,vs=/Android \d/.test(cl),Hp=!!j2&&"webkitFontSmoothing"in j2.documentElement.style,LW=Hp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function FW(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function is(t,e){return typeof t=="number"?t:t[e]}function BW(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function C2(t,e,n){for(;;)if(n<0?e:e<zt(t)){if(Ct(t))return Lr(zr(t,e+(n<0?-1:0),e+(n>0?1:0)),-n);let r=t.childNodes[n<0?e-1:e];if(Ct(r))t=r,e=n<0?r.nodeValue.length:0;else return Se(r)?Lr(r,-n):null}else{if(ad(t,!0)||!t.parentNode)return null;e=ln(t)+(n<0?0:1),t=t.parentNode}}function _2(t,e,n){if(!Dx(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(!Se(o)){o=al(o);continue}let a=o==i.body,l=a?FW(i):BW(o),c=0,f=0;if(e.top<l.top+is(r,"top")?f=-(l.top-e.top+is(s,"top")):e.bottom>l.bottom-is(r,"bottom")&&(f=e.bottom-e.top>l.bottom-l.top?e.top+is(s,"top")-l.top:e.bottom-l.bottom+is(s,"bottom")),e.left<l.left+is(r,"left")?c=-(l.left-e.left+is(s,"left")):e.right>l.right-is(r,"right")&&(c=e.right-l.right+is(s,"right")),c||f)if(a)i.defaultView.scrollBy(c,f);else{let h=o.scrollLeft,m=o.scrollTop;f&&(o.scrollTop+=f),c&&(o.scrollLeft+=c);let g=o.scrollLeft-h,p=o.scrollTop-m;e={left:e.left-g,top:e.top-p,right:e.right-g,bottom:e.bottom-p}}let u=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u=="absolute"?o.offsetParent:al(o)}}function VW(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:J4(t.dom)}}function J4(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=al(r));return e}function WW({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;G4(n,r==0?0:r-e)}function G4(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Qo=null;function Y4(t){if(t.setActive)return t.setActive();if(Qo)return t.focus(Qo);let e=J4(t);t.focus(Qo==null?{get preventScroll(){return Qo={preventScroll:!0},!0}}:void 0),Qo||(Qo=!1,G4(e,0))}function Q4(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let f=t.firstChild,u=0;f;f=f.nextSibling,u++){let h;if(Se(f))h=f.getClientRects();else if(Ct(f))h=zr(f).getClientRects();else continue;for(let m=0;m<h.length;m++){let g=h[m];if(g.top<=o&&g.bottom>=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let p=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(p<r){n=f,r=p,s=p&&Ct(n)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,Se(f)&&p&&(i=u+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!l&&g.left<=e.left&&g.right>=e.left&&(l=f,c={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!n&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(i=u+1)}}return!n&&l&&(n=l,s=c,r=0),n&&Ct(n)?UW(n,s):!n||r?{node:t,offset:i}:Q4(n,s)}function UW(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Lr(r,1);if(o.top!=o.bottom&&l0(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function l0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ZW(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function HW(t,e,n){let{node:r,offset:s}=Q4(e,n),i=-1;if(Se(r)&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return{pos:t.docView.posFromDOM(r,s,i),affinity:X4(r,s,n)}}function N2(t,e){return t<e.left?e.left-t:t>e.right?t-e.right:0}function X4(t,e,n){let r=C2(t,e,-1),s=C2(t,e,1);return r?s?r.bottom<=s.top?n.top>(r.bottom+s.top)/2?1:-1:N2(n.left,r)<N2(n.left,s)?-1:1:-1:1}function qW(t,e,n,r){let s=-1;for(let i=e;i!=t.dom;){let o=t.docView.nearestDesc(i,!0),a;if(!o)return null;if(Se(o.dom)&&((a=o.dom.getBoundingClientRect()).width||a.height)){if(!o.contentDOM&&!o.node.isText&&r.left>=a.left&&r.left<=a.right&&r.top>=a.top&&r.top<=a.bottom){let l=o.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2;return{pos:l?o.posBefore:o.posAfter,affinity:l?1:-1}}o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(r.top<a.top||r.top>a.bottom)&&(s=r.top<a.top?o.posBefore:o.posAfter)}i=o.dom.parentNode}return s>-1?{pos:s,affinity:0}:{pos:t.docView.posFromDOM(e,n,-1),affinity:X4(e,n,r)}}function eO(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(Se(o)){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(l0(e,c))return eO(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function KW(t,e){let n=t.dom.ownerDocument,r,s=0,i=zW(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a,l=0;if(!o||!t.dom.contains(o)){let f=t.dom.getBoundingClientRect();if(!l0(e,f)||(o=eO(t.dom,e,f),!o))return null}if(cn)for(let f=o;r&&f;f=al(f))f.draggable&&(r=void 0);if(o=ZW(o,e),r){if($r&&Se(r)&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],h;u.nodeName=="IMG"&&(h=u.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&s++}let f;if(Hp&&s&&Se(r)&&Se(f=r.childNodes[s-1])&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&Se(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom)a=t.state.doc.content.size;else if(s==0||!Se(r)||r.childNodes[s-1].nodeName!="BR"){let u=qW(t,r,s,e);u&&({pos:a,affinity:l}=u)}}a==null&&({pos:a,affinity:l}=HW(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1,affinity:l}}function Dx(t){return t.top<t.bottom||t.left<t.right}function Lr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Dx(r))return r}return Array.prototype.find.call(n,Dx)||t.getBoundingClientRect()}const JW=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tO(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Hp||$r;if(Ct(r))if(o&&(JW.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Lr(zr(r,s,s),n);if($r&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Lr(zr(r,s-1,s-1),-1);if(c.top==l.top){let f=Lr(zr(r,s,s+1),-1);if(f.top!=l.top)return Vl(f,f.left<c.left)}}return l}else{let l=s,c=s,f=n<0?1:-1;return n<0&&!s?(c++,f=-1):n>=0&&s==r.nodeValue.length?(l--,f=1):n<0?l--:c++,Vl(Lr(zr(r,l,c),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==zt(r))){let l=r.childNodes[s-1];if(Se(l))return dg(l.getBoundingClientRect(),!1)}if(i==null&&s<zt(r)){let l=r.childNodes[s];if(Se(l))return dg(l.getBoundingClientRect(),!0)}return dg(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==zt(r))){let l=r.childNodes[s-1],c=Ct(l)?zr(l,zt(l)-(o?0:1)):Se(l)&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Vl(Lr(c,1),!1)}if(i==null&&s<zt(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?Ct(l)?zr(l,0,o?0:1):Se(l)?l:null:null;if(c)return Vl(Lr(c,-1),!0)}return Vl(Lr(Ct(r)?zr(r):r,-n),n>=0)}function Vl(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function dg(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function nO(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function GW(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return nO(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=tO(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(Se(a))l=a.getClientRects();else if(Ct(a))l=zr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let f=l[c];if(f.bottom>f.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const YW=/[\u0590-\u08ac]/;function QW(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!YW.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:nO(t,e,()=>{let l=t.domSel.readRange(),c=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:u,focusOffset:h}=t.domSel.readRange(),m=u&&!ll(f,u)||l.focusNode==u&&l.focusOffset==h;return H4(a,l),c!=null&&(a.caretBidiLevel=c),m}):r.pos==r.start()||r.pos==r.end()}let E2=null,$2=null,M2=!1;function XW(t,e,n){return E2==e&&$2==n?M2:(E2=e,$2=n,M2=n=="up"||n=="down"?GW(t,e,n):QW(t,e,n))}class Wd{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.damage=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&ll(this.contentDOM,e))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>ln(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?s=n>Array.from(e.childNodes).findIndex(o=>o.contains(this.contentDOM)):s=!(i&4)}else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(Se(o)?ll(o,e):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof sO||i instanceof rO&&i.side>=0))break}if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ln(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ln(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let f=o+l.border;if(e>=f&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,f);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=ln(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let f=a+1;f<this.children.length;f++){let u=this.children[f];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=ln(u.dom);break}n+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(!Se(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDamage(e){e&&(this.damage|=e,this.markParentDamage())}markParentDamage(){for(let e=this;;){let{parent:n}=e;if(!n||n.damage&1)break;n.damage|=1,e=n}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class rO extends Wd{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){let a=Se(o)?o:document.createElement("span");a!=o&&(a.appendChild(o),o=a),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return!this.damage&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class eU extends Wd{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bi extends Wd{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Wo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new bi(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.damage&4||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return!(this.damage&4)&&this.mark.eq(e)}markDamage(e){var n;this.damage|=e,(n=this.parent)===null||n===void 0||n.markDamage(2)}slice(e,n,r){let s=bi.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=zx(i,n,o,r)),e>0&&(i=zx(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Si extends Wd{constructor(e,n,r,s,i,o,a){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),f=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(!Ct(f))throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:u}=Wo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let h=f;return f=aO(f,r,n),c?l=new iO(e,n,r,s,f,u||null,h,c):n.isText?new Ud(e,n,r,s,f,h):new Si(e,n,r,s,f,u||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(s=>Se(s)&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>G.empty}}return n}matchesNode(e,n,r){return!this.damage&&e.eq(this.node)&&wh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new nU(this,o&&o.node,e),c=this.node.inlineContent,f=c&&this.node.isBlock;iU(this.node,this.innerDeco,(u,h,m)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e,h):u.type.side>=0&&!m&&l.syncToMarks(h==this.node.childCount?Ge.none:this.node.child(h).marks,r,e,h),l.placeWidget(u,e,s)},(u,h,m,g)=>{l.syncToMarks(u.marks,r,e,g),f&&u.isAtom&&!u.isText&&l.addHackNode("IMG",l.top);let p;l.findNodeMatch(u,h,m,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(u,h,m,p,e,s)||l.updateNextNode(u,h,m,e,g,s)||l.addNode(u,h,m,e,s),s+=u.nodeSize,c&&(f=u.isAtom&&!u.isText)}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.damage&2)&&(o&&this.protectLocalComposition(e,o),oO(this.contentDOM,this.children,e),dl&&oU(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof _e)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=aU(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new eU(this,i,n,s);e.input.compositionNodes.push(o),this.children=zx(this.children,r,r+s.length,e,o)}update(e,n,r,s,i){return this.damage&4||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s,i),!0)}updateInner(e,n,r,s,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,i+1),this.damage=0}updateOuterDeco(e){if(wh(e,this.outerDeco))return;let n=!Se(this.nodeDOM),r=this.dom;this.dom=c0(this.dom,this.nodeDOM,ld(this.outerDeco,this.node,n),ld(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Se(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Se(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function T2(t,e,n,r,s,i){i?c0(r,r,ld(i,t,!1),ld(e,t,!1)):aO(r,e,t);let o=new Si(void 0,t,e,n,r,r,r);return o.contentDOM&&o.updateChildren(s,0),o}class Ud extends Si{constructor(e,n,r,s,i,o){super(e,n,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.damage&4||this.damage&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.damage&8||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.damage=0,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return!1}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Ud(this.parent,s,this.outerDeco,this.innerDeco,i,i)}get domAtom(){return!1}isText(e){return this.node.text==e}}class sO extends Wd{parseRule(){return{ignore:!0}}matchesHack(e){return!this.damage&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class iO extends Si{constructor(e,n,r,s,i,o,a,l){super(e,n,r,s,i,o,a),this.spec=l}update(e,n,r,s,i){if(this.damage&4)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,s,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function oO(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=O2(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof bi){let l=r?r.previousSibling:t.lastChild;oO(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=O2(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const kc=function(t){t&&(this.nodeName=t)};kc.prototype=Object.create(null);const ro=[new kc];function ld(t,e,n){if(t.length==0)return ro;let r=n?ro[0]:new kc,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new kc(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new kc(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function c0(t,e,n,r){if(n==ro&&r==ro)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=ro[0]),s=l}tU(s,a||ro[0],o)}return s}function tU(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function aO(t,e,n){return c0(t,t,ro,ld(e,n,!Se(t)))}function wh(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function O2(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class nU{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=rU(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.damage=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let f=this.index;f<c;f++){let u=this.top.children[f];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){l=f;break}}if(l<0&&this.index<this.top.children.length){let f=this.top.children[this.index];f instanceof bi&&!(f.damage&4)&&f.mark.type==e[o].type&&f.spec.update&&!this.isLocked(f.dom)&&f.spec.update(e[o])&&(f.mark=e[o],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let f=bi.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i,o){let a=this.top.children[s];return a.damage&4&&a.dom==a.contentDOM&&(a.damage=2),a.update(e,n,r,i,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Si){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let f=l.dom,u,h=this.isLocked(f)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&!(l.damage&4)&&wh(n,l.outerDeco));if(!h&&l.update(e,n,r,s,o))return this.destroyBetween(this.index,a),l.dom!=f&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.damage|=2,u.updateChildren(s,o+1),u.damage=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.damage&3||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!wh(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=Si.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=Si.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new rO(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof bi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ud)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((cn||gn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new sO(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Se(e)&&e.contains(this.lock.parentNode))}}function rU(t,e){let n=e,r=n.children.length,s=[],i=t.childCount,o=new Map,a=[];e:for(;i>0;){let l;for(;;)if(r){let f=n.children[r-1];if(f instanceof bi)s.push(r-1),n=f,r=f.children.length;else{l=f,r--;break}}else{if(n==e)break e;r=s.pop(),n=n.parent}let c=l.node;if(c){if(c!=t.child(i-1))break;--i,o.set(l,i),a.push(l)}}return{index:i,matched:o,matches:a.reverse()}}function sU(t,e){return t.type.side-e.type.side}function iU(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let f=t.child(c);r(f,s,e.forChild(i,f),c),i+=f.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let f,u;for(;o<s.length&&s[o].to==i;){let x=s[o++];x.widget&&(f?(u||(u=[f])).push(x):f=x)}if(f)if(u){u.sort(sU);for(let x=0;x<u.length;x++)n(u[x],c,!!l)}else n(f,c,!!l);let h,m;if(l)m=-1,h=l,l=null;else if(c<t.childCount)m=c,h=t.child(c++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let g=i+h.nodeSize;if(h.isText){let x=g;o<s.length&&s[o].from<x&&(x=s[o].from);for(let y=0;y<a.length;y++)a[y].to<x&&(x=a[y].to);x<g&&(l=h.cut(x-i),h=h.cut(0,x-i),g=x,m=-1)}else for(;o<s.length&&s[o].to<g;)o++;let p=h.isInline&&!h.isLeaf?a.filter(x=>!x.inline):a.slice();r(h,p,e.forChild(i,h),m),i=g}}function oU(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function aU(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function zx(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,f=a+=l.size;c>=n||f<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),f>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Lx(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Be.findFrom(i,e)}function Gs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function A2(t,e,n){let r=t.state.selection;if(r instanceof _e)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Gs(t,new _e(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Lx(t.state,e);return s&&s instanceof we?Gs(t,s):!1}else if(!er||n.indexOf("m")<0){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?we.isSelectable(i)?Gs(t,new we(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Gs(t,new _e(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof we&&r.node.isInline)return Gs(t,new _e(e>0?r.$to:r.$from));{let s=Lx(t.state,e);return s?Gs(t,s):!1}}}function wc(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):Se(t)&&t.contentEditable=="false"}function Xo(t,e){return e<0?lU(t):cU(t)}function lU(t){let e=t.domSel.readRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for($r&&Se(n)&&r<zt(n)&&wc(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!Se(n))break;let a=n.childNodes[r-1];if(wc(a,-1))s=n,i=--r;else if(Ct(a))n=a,r=n.nodeValue.length;else break}else{if(lO(n))break;{let a=n.previousSibling;for(;a&&wc(a,-1);)s=n.parentNode,i=ln(a),a=a.previousSibling;if(a)n=a,r=zt(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Fx(t,n,r):s&&Fx(t,s,i)}function cU(t){let e=t.domSel.readRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=zt(n),i,o;for(;;)if(r<s){if(!Se(n))break;let a=n.childNodes[r];if(wc(a,1))i=n,o=++r;else break}else{if(lO(n))break;{let a=n.nextSibling;for(;a&&wc(a,1);)i=a.parentNode,o=ln(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=zt(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Fx(t,i,o)}function lO(t){for(let e=t;e;e=e.parentNode){let n=e.pmViewDesc;if(n)return n.node?n.node.isBlock:!1}return!1}function Fx(t,e,n){if(!Ct(e)){let o,a;(a=a0(e,n))?(e=a,n=0):(o=o0(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection(),s=t.domSel.readRange();if(!r)return;Zp(s)?r.collapse(e,n):r.extend&&(r.collapse(s.anchorNode,s.anchorOffset),r.extend(e,n)),t.domSel.ignore();let{state:i}=t;setTimeout(()=>{t.state==i&&t.domSel.sync()},50)}function R2(t,e){let n=t.state.doc.resolve(e);if(!(gn||K4)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}let r=t.dom;for(let i=n.depth;i>0;i--)if(n.node(i).isBlock){r=t.nodeDOM(n.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function I2(t,e,n){let r=t.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||er&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Lx(t.state,e);if(o&&o instanceof we)return Gs(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Un?Be.near(o,e):Be.findFrom(o,e);return a?Gs(t,a):!1}return!1}function P2(t,e){if(!(t.state.selection instanceof _e))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function D2(t,e,n){t.domObserver.stopped(()=>e.contentEditable=n)}function dU(t){if(!cn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSel.readRange();if(e&&Se(e)&&n==0&&e.firstChild&&Se(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;D2(t,r,"true"),setTimeout(()=>D2(t,r,"false"),20)}return!1}function uU(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function fU(t,e){let n=e.keyCode,r=uU(e);if(n==8||er&&n==72&&r=="c")return P2(t,-1)||Xo(t,-1);if(n==46&&!e.shiftKey||er&&n==68&&r=="c")return P2(t,1)||Xo(t,1);if(n==13||n==27)return!0;if(n==37||er&&n==66&&r=="c"){let s=n==37?R2(t,t.state.selection.from)=="ltr"?-1:1:-1;return A2(t,s,r)||Xo(t,s)}else if(n==39||er&&n==70&&r=="c"){let s=n==39?R2(t,t.state.selection.from)=="ltr"?1:-1:1;return A2(t,s,r)||Xo(t,s)}else{if(n==38||er&&n==80&&r=="c")return I2(t,-1,r)||Xo(t,-1);if(n==40||er&&n==78&&r=="c")return dU(t)||I2(t,1,r)||Xo(t,1);if(r==(er?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function d0(t,e){t.someProp("transformCopied",m=>{e=m(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let m=r.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),r=m.content}let o=t.someProp("clipboardSerializer")||Wo.fromSchema(t.state.schema),a=pO(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,f,u=0;for(;c&&Se(c)&&(f=hO[c.nodeName.toLowerCase()]);){for(let m=f.length-1;m>=0;m--){let g=a.createElement(f[m]);for(;l.firstChild;)g.appendChild(l.firstChild);l.appendChild(g),u++}c=l.firstChild}c&&Se(c)&&c.setAttribute("data-pm-slice",`${s} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,`
773
-
774
- `);return{dom:l,text:h,slice:e}}function cO(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return a=new ce(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
775
- `))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let u=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(u)a=u;else{let h=s.marks(),{schema:m}=t.state,g=Wo.fromSchema(m);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(p=>{let x=o.appendChild(document.createElement("p"));p&&x.appendChild(g.serializeNode(m.text(p,h)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),o=gU(n),Hp&&yU(o);let c=o&&o.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let u=+f[3];u>0;u--){let h=o.firstChild;for(;h&&!Se(h);)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||wi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||f),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!hU.test(h.parentNode.nodeName)?{ignore:!0}:null}})),f)a=xU(z2(a,+f[1],+f[2]),f[4]);else if(a=ce.maxOpen(pU(a.content,s),!0),a.openStart||a.openEnd){let u=0,h=0;for(let m=a.content.firstChild;u<a.openStart&&!m.type.spec.isolating;u++,m=m.firstChild);for(let m=a.content.lastChild;h<a.openEnd&&!m.type.spec.isolating;h++,m=m.lastChild);a=z2(a,u,h)}return t.someProp("transformPasted",u=>{a=u(a,t,r)}),a}const hU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function pU(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&uO(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=fO(o[o.length-1],i.length));let f=dO(a,l);o.push(f),s=s.matchType(f.type),i=l}}),o)return G.from(o)}return t}function dO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function uO(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=uO(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(G.from(dO(n,t,s+1))))}}function fO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,fO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(r))}function Bx(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Bx(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function z2(t,e,n){return e<t.openStart&&(t=new ce(Bx(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ce(Bx(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const hO={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function pO(){return document.implementation.createHTMLDocument("title")}let Wl=null;function mU(t){let e=window.trustedTypes;if(!e)return t;if(!Wl){if(Wl=e.defaultPolicy)try{return Wl.createHTML(t)}catch{}Wl=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Wl.createHTML(t)}function gU(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=pO(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&hO[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=mU(t),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<n.styleSheets.length;o++){let a=n.styleSheets[o];for(let l=0;l<a.rules.length;l++){let c=a.rules[l];if(c instanceof CSSStyleRule){let f=r.querySelectorAll(c.selectorText);for(let u=0;u<f.length;u++)f[u].style.cssText+=c.style.cssText}}}return r}function yU(t){let e=t.querySelectorAll(gn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function xU(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs()||!l.createAndFill(null,s))break;try{s=G.from(l.create(r[a+1],s))}catch{break}i++,o++}return new ce(s,i,o)}class jn{constructor(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}static from(e){return e instanceof jn?e:new jn(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}jn.null=new jn(null,0,null,0);class vU{constructor(e){this.view=e,this.range=jn.null,this.active=!1,this.synced=!1,this.suppress=!1,this.currentDocument=null,this.onSelectionChange=this.onSelectionChange.bind(this)}ensureListener(){let e=this.view.dom.ownerDocument;e!=this.currentDocument&&(this.currentDocument&&this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=e,e.addEventListener("selectionchange",this.onSelectionChange))}destroy(){this.currentDocument&&(this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=null),this.active=!1,this.range=jn.null}suppressChanges(){this.suppress=!0,setTimeout(()=>this.suppress=!1,50)}onSelectionChange(){if(this.suppress&&this.view.hasFocus())return this.sync();this.read()&&this.view.domObserver.flush(!1)}readRange(){let{view:e}=this,n=e.dom.isConnected!==!1&&e.domSelection();return n?cn&&e.root.nodeType===11&&DW(e.dom.ownerDocument)==e.dom?jn.from(kU(e,n)||n):jn.from(n):jn.null}read(){this.ensureListener();let e=yO(this.view);if(!e){this.active=!1,this.range=jn.null;return}return this.active=!0,this.range.eq(e)?!1:(this.range=e,this.synced=!1,!0)}sync(e=!1){let{view:n}=this;n.docView&&(this.ensureListener(),n.domObserver.stopped(()=>{CU(n,n.state.selection);let r=n.state.selection;if(n.input.mouseSelecting||mO(n)){let{desc:s,start:i}=gO(n.docView,r.from,r.to,0);n.cursorWrapper?jU(n):s instanceof iO&&s.spec.setSelection?s.spec.setSelection(r.anchor-i,r.head-i,n.root):wU(n,e,s,i),this.synced=this.active=!0}r.visible==n.dom.classList.contains("ProseMirror-hideselection")&&(r.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),SU(n))),this.range=this.readRange()}))}ignore(e=this.readRange()){this.range=jn.from(e),this.synced=!0}deactivate(){this.range=jn.null,this.active=this.synced=!1}}function kU(t,e){if(e.getComposedRanges){let s=e.getComposedRanges({shadowRoots:[t.root]})[0];if(s)return L2(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?L2(t,n):null}function L2(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return vc(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),new jn(n,r,s,i)}function u0(t,e,n=null){let r=t.state.doc;if(!e.focusNode)return null;let s=t.docView.nearestDesc(e.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Zp(e)){for(l=o;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&we.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&IW(e.focusNode,e.focusOffset,s.dom))){let u=s.posBefore;c=new we(o==u?a:r.resolve(u))}else if($r&&n=="key"&&o>t.state.selection.to&&Se(e.focusNode)&&e.focusOffset==e.focusNode.childNodes.length&&s&&s.posAtStart>t.state.selection.to)for(let u=e.focusNode;;u=u.parentNode){if(getComputedStyle(u).overflow!="visible"){c=Be.findFrom(r.resolve(s.posAtStart),1);break}if(u==s.dom||u.nextSibling||!u.parentNode||!Se(u.parentNode))break}}else{if(e instanceof t.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let u=o,h=o;for(let m=0;m<e.rangeCount;m++){let g=e.getRangeAt(m);u=Math.min(u,t.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(u<0)return null;[l,o]=h==t.state.selection.anchor?[h,u]:[u,h],a=r.resolve(o)}else l=t.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(l<0)return null}let f=r.resolve(l);if(!c){let u=n=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=ul(t,f,a,u)}return c}function mO(t){return t.editable?t.hasFocus():xO(t,t.domSel.readRange())&&(!document.activeElement||document.activeElement.contains(t.dom))}function wU(t,e,n,r){let s=t.state.selection,{anchor:i,head:o}=s,a,l;F2&&!(s instanceof _e)&&(s.$from.parent.inlineContent||(a=B2(t,s.from)),!s.empty&&!s.$from.parent.inlineContent&&(l=B2(t,s.to)));let c=n.domFromPos(i-r,i>r?-1:1),f=o==i?c:n.domFromPos(o-r,o>r?-1:1);bU(i,o,c,f,t,e),F2&&(a&&V2(a),l&&V2(l))}function gO(t,e,n,r=0){for(let s=0,i=r;s<t.children.length;s++){let o=t.children[s],a=i+o.size;if(e>i&&n<a)return gO(o,e,n,i+o.border);i=a}return{desc:t,start:r}}function bU(t,e,n,r,s,i){let o=!1;if(($r||cn)&&t==e){let{node:f,offset:u}=n;if(Ct(f)){if(o=!!(u&&f.nodeValue[u-1]==`
776
- `),o&&u==f.nodeValue.length)for(let h=f,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(n=r={node:m.parentNode,offset:ln(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=f.childNodes[u-1];o=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}let a=s.domSel.readRange();if($r&&a.focusNode&&a.focusNode!=r.node&&Se(a.focusNode)){let f=a.focusNode.childNodes[a.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||o&&cn)&&vc(n.node,n.offset,a.anchorNode,a.anchorOffset)&&vc(r.node,r.offset,a.focusNode,a.focusOffset))return;let l=s.domSelection(),c=s.input.mouseSelecting;if(c&&c.affinity&&t==e&&c.pos==t){let{affinity:f}=c,{node:u,offset:h}=r,m,g=0;if(Ct(u)&&(f>0?h<zt(u):h>0)?(m=u,g=h+f):(m=(f>0?a0:o0)(u,h),m&&(g=f>0?1:m.nodeValue.length-1)),m){l.collapse(m,g),l.modify("move",f>0?"backward":"forward","lineboundary");let{focusNode:p,focusOffset:x}=l;if(cn&&s.root.nodeType==11){let y=l.getComposedRanges({shadowRoots:[s.root]});y.length&&(p=y[0].startContainer,x=y[0].startOffset)}if(vc(u,h,p,x))return}}H4(l,{focusNode:r.node,focusOffset:r.offset,anchorNode:n.node,anchorOffset:n.offset})}const F2=cn||gn&&q4<63;function B2(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(cn&&s&&s.contentEditable=="false")return ug(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ug(s);if(i)return ug(i)}}function ug(t){return t.contentEditable="true",cn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function V2(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function SU(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSel.readRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function jU(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom;n.nodeName=="IMG"?e.collapse(n.parentNode,ln(n)+1):e.collapse(n,0)}function CU(t,e){if(e instanceof we){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(W2(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else W2(t)}function W2(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ul(t,e,n,r){let s=t.someProp("createSelectionBetween",i=>i(t,e,n))||_e.between(e,n,r);return t.someProp("adjustSelectionFromDOM",i=>{s=i(t,s)}),s}function yO(t){if(t.editable&&!t.hasFocus())return null;let e=t.domSel.readRange();return e&&xO(t,e)?e:null}function xO(t,e){if(!e.anchorNode)return!1;try{return ll(t.dom,e.anchorNode)&&(t.editable||ll(t.dom,e.focusNode))}catch{return!1}}const vn={},kn={},_U={touchstart:!0,touchmove:!0};class NU{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.mouseSelecting=null,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function EU(t){for(let e in vn){let n=vn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{MU(t,r)&&(t.input.composing&&(r.type=="keydown"||r.type=="beforeinput")&&r.isComposing===!1&&wO(t,!0),!f0(t,r)&&(t.editable||!(r.type in kn))&&n(t,r))},_U[e]?{passive:!0}:void 0)}cn&&t.dom.addEventListener("input",()=>null),Vx(t)}function qp(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function $U(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>f0(t,r))})}function f0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function MU(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function TU(t,e){!f0(t,e)&&vn[e.type]&&(t.editable||!(e.type in kn))&&vn[e.type](t,e)}function ti(t,e){let{input:n}=t;return n.lastKeyDispatched||t.composing?!1:(n.lastKeyDispatched=!0,typeof e=="string"&&(e=PW(e=="Backspace"?8:13,e)),t.someProp("handleKeyDown",r=>r(t,e)))}kn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),t.input.lastKeyDispatched=!1,!(vs&&gn&&n.keyCode==13)){if(dl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(ti(t,"Enter"),t.input.lastIOSEnter=0)},200);return}n.keyCode!=229&&t.domObserver.forceFlush(!0),ti(t,n)||fU(t,n)?n.preventDefault():qp(t,"key")}};kn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};kn.keypress=(t,e)=>{let n=e;if(FU(t)||!n.charCode||n.ctrlKey&&!n.altKey||er&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _e)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function cd(t){return{left:t.clientX,top:t.clientY}}function OU(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function h0(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function vO(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function AU(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&we.isSelectable(r)?(vO(t,new we(n)),!0):!1}function RU(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof we&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(we.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(vO(t,we.create(t.state.doc,s)),!0):!1}function IU(t,e,n,r,s){return h0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?RU(t,n):AU(t,n))}function PU(t,e,n,r){return h0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function DU(t,e,n,r){return h0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))}function U2(t,e,n){if(e==-1)return t.inlineContent?_e.create(t,0,t.content.size):null;let r=t.resolve(e);for(let s=r.depth+1;s>0;s--){let i=s>r.depth?r.nodeAfter:r.node(s),o=r.before(s);if(i.inlineContent)return _e.create(t,o+1,o+1+i.content.size);if(n&&we.isSelectable(i))return we.create(t,o)}return null}let Wx=/[\w_\u00a1-\uffff]+/g;try{Wx=new RegExp("[\\p{L}\\p{N}_]+","gu")}catch{}function Z2(t,e){let n=t.resolve(e),r=n.node(),s="",i=e,o=e;for(let p=n.indexAfter(),x=!1;p>0;p--){let y=r.child(p-1);if(!y.text)break;let v=i==e?e-n.posAtIndex(p-1):y.text.length,k=v;for(;k>0;k--)if(/\S/.test(y.text[k-1]))x=!0;else if(x)break;if(s=y.text.slice(k,v)+s,i-=v-k,k||i<e-50)break}for(let p=n.index(),x=!1;p<r.childCount;p++){let y=r.child(p);if(!y.text)break;let v=o==e?e-n.posAtIndex(p):0,k=v;for(;k<y.text.length;k++)if(/\S/.test(y.text[k]))x=!0;else if(x)break;if(s+=y.text.slice(v,k),o+=k-v,k<y.text.length||o>e+50)break}let a=i,l=o;if(Intl.Segmenter){for(let p of new Intl.Segmenter(void 0,{granularity:"word"}).segment(s))if(p.isWordLike){let x=p.index+i,y=x+p.segment.length;if(y<e)a=y;else if(x>e){l=x;break}else return _e.create(t,x,y)}}else{Wx.lastIndex=0;for(let p;p=Wx.exec(s);){let x=p.index+i,y=x+p[0].length;if(y<e)a=y;else if(x>e){l=x;break}else return _e.create(t,x,y)}}let c=s.slice(a-i,e-i),f=s.slice(e-i,l-i),u=/\S*$/.exec(c)[0].length,h=/^\S*/.exec(f)[0].length;if(u||h)return _e.create(t,e-u,e+h);let m=/\s*$/.exec(c)[0].length,g=/^\s*/.exec(f)[0].length;return _e.create(t,e-m,e+g)}const kO=er?"metaKey":"ctrlKey";vn.mousedown=(t,e)=>{let n=e,r=Date.now();if(t.input.shiftKey=n.shiftKey,t.input.lastTouch>r-500)return!1;Po(t);let s="singleClick";r-t.input.lastClick.time<500&&OU(n,t.input.lastClick)&&!n[kO]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let i=t.posAtCoords(cd(n));if(i)if(n.button==0){if(!t.hasFocus()){Y4(t.dom);let a=t.root.activeElement;a&&!a.contains(t.dom)&&a.blur()}(t.input.mouseDown=new zU(t,i,n,s)).mightDrag||n.preventDefault()}else qp(t,"pointer")};class zU{constructor(e,n,r,s){var i;this.view=e,this.startPos=n,this.event=r,this.type=s,this.didMove=!1,this.lastPos=-1,this.anchorRange=null,this.startDoc=e.state.doc,this.selectNode=!!r[kO],this.extend=r.shiftKey,this.anchorDoc=this.startDoc;let o=H2(e);if(this.extend){let a=e.state.selection;this.anchorRange=a instanceof we?{from:a.from,to:a.to}:{from:a.anchor,to:a.anchor};let l=a instanceof we?e.nodeDOM(a.from).getBoundingClientRect():e.coordsAtPos(a.anchor);this.anchorOffset={x:(l.left+l.right)/2-o.x,y:(l.top+l.bottom)/2-o.y}}else this.anchorOffset={x:r.clientX-o.x,y:r.clientY-o.y};if(s=="singleClick"){let{selection:a}=e.state,l,c,f=!1;if(a instanceof we&&a.from<=n.pos&&a.to>=n.pos)c=a.from,l=a.node,f=!0;else if(n.inside>-1)l=e.state.doc.nodeAt(n.inside),c=n.inside;else{let u=e.state.doc.resolve(n.pos);l=u.parent,c=u.depth?u.before():-1}if(f||c>-1&&l.type.spec.draggable&&l.type.spec.selectable!==!1){let u=(i=e.docView.descAt(c))===null||i===void 0?void 0:i.nodeDOM;this.mightDrag={node:l,elt:u,pos:c,addAttr:!1},u&&!u.draggable&&(this.mightDrag.addAttr=!0,e.domObserver.stopped(()=>u.draggable=!0))}else this.mightDrag=LU(e,r)}else this.mightDrag=!1;e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),this.mightDrag||this.select(this.startPos,!0)}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null),typeof this.mightDrag=="object"&&this.mightDrag.addAttr&&this.view.domObserver.stopped(()=>this.mightDrag.elt.removeAttribute("draggable"))}maybeRunHandler(e,n){return(this.type=="singleClick"?IU:this.type=="doubleClick"?PU:DU)(this.view,e.pos,e.inside,n,this.selectNode)}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.startPos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(cd(e))),n&&(this.didMove||this.maybeRunHandler(n,e)||this.select(n,!0),e.preventDefault())}move(e){if(e.buttons==0){this.done();return}if(!this.didMove&&(Math.abs(this.event.x-e.clientX)>8||Math.abs(this.event.y-e.clientY)>8)&&(this.didMove=!0,this.mightDrag=!1),!this.mightDrag){let n=this.view.posAtCoords(cd(e));n&&this.select(n,!1)}e.preventDefault()}select(e,n){if(e.pos==this.lastPos)return;this.lastPos=e.pos;let{view:r}=this,{doc:s}=r.state,i=this.type=="singleClick"?q2(r,s,e):this.type=="doubleClick"?Z2(s,e.pos):U2(s,e.inside,n);i&&(n&&!this.extend?this.anchorRange=i:(!n||this.extend)&&(s.eq(this.anchorDoc)||this.restoreAnchor(),this.anchorRange&&this.anchorRange.from<i.from?i=ul(r,s.resolve(this.anchorRange.from),s.resolve(i.to)):this.anchorRange&&this.anchorRange.to>i.to&&(i=ul(r,s.resolve(this.anchorRange.to),s.resolve(i.from)))),i.eq(r.state.selection)||(r.input.mouseSelecting=e,r.dispatch(r.state.tr.setSelection(i).setMeta("pointer",!0).scrollIntoView()),r.input.mouseSelecting=null))}restoreAnchor(){let e=H2(this.view),n=this.view.posAtCoords({left:this.anchorOffset.x+e.x,top:this.anchorOffset.y+e.y});if(!n)this.anchorRange=null;else{let{doc:r}=this.view.state;this.anchorRange=this.type=="singleClick"?q2(this.view,r,n):this.type=="doubleClick"?Z2(r,n.pos):U2(r,n.inside,!1),this.anchorDoc=this.view.state.doc}}}function H2(t){let e=t.dom.getBoundingClientRect();return{x:e.left-t.dom.scrollLeft,y:e.top-t.dom.scrollTop}}function q2(t,e,n){if(n.inside>-1){let s=e.nodeAt(n.inside);if(s.isAtom&&we.isSelectable(s))return we.create(e,n.inside)}let r=e.resolve(n.pos);return ul(t,r,r)}function LU(t,e){let{selection:n}=t.state;if(n.empty)return!1;let r=t.domSelection();if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}vn.touchstart=t=>{t.input.lastTouch=Date.now(),Po(t),qp(t,"pointer")};vn.touchmove=t=>{t.input.lastTouch=Date.now(),qp(t,"pointer")};vn.contextmenu=t=>Po(t);function FU(t,e){return t.composing?!0:cn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const BU=vs?5e3:-1;kn.compositionstart=kn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _e&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||gn&&K4&&VU(t)))t.markCursor=t.state.storedMarks||n.marks(),Po(t,!0),t.markCursor=null;else if(Po(t,!e.selection.empty),$r&&t.domSel.active&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(let{focusNode:r,focusOffset:s}=t.domSel.range;r&&Se(r)&&s!=0;){let i=s<0?r.lastChild:r.childNodes[s-1];if(!i)break;if(Ct(i)){let o=t.domSelection();o&&o.collapse(i,i.nodeValue.length);break}else r=i,s=-1}t.input.composing=!0}bO(t,BU)};function VU(t){let{focusNode:e,focusOffset:n}=t.domSel.range;if(!e||!Se(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return Se(r)&&r.contentEditable=="false"}kn.compositionend=(t,e)=>{t.composing&&wO(t)};function wO(t,e=!1){t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,e?Po(t):bO(t,20)}function bO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Po(t),e))}function SO(t){t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());for(let e;e=t.input.compositionNodes.pop();)e.markParentDamage()}function WU(t){let e=t.domSel.range;if(!t.domSel.active||!e.focusNode)return null;let n=o0(e.focusNode,e.focusOffset),r=a0(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Po(t,e=!1){if(!(vs&&t.domObserver.flushingSoon>=0)&&(t.domObserver.forceFlush(),SO(t),e||t.docView&&t.docView.damage)){let n=u0(t,t.domSel.readRange()),r=t.state.selection;n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state)}}function UU(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const dd=dl&&LW<604;vn.copy=kn.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=dd?null:n.clipboardData,o=r.content(),{dom:a,text:l}=d0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):UU(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ZU(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function HU(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ud(t,r.value,null,s,e):ud(t,r.textContent,r.innerHTML,s,e)},50)}function ud(t,e,n,r,s){let i=cO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||ce.empty)))return!0;if(!i)return!1;let o=ZU(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function jO(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kn.paste=(t,e)=>{let n=e;if(t.composing&&!vs)return;let r=dd?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ud(t,jO(r),r.getData("text/html"),s,n)?n.preventDefault():HU(t,n)};class CO{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const qU=er?"altKey":"ctrlKey";function _O(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[qU]}vn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(cd(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof we?s.to-1:s.to))){if(r&&typeof r.mightDrag=="object")o=we.create(t.state.doc,r.mightDrag.pos);else if(n.target&&Se(n.target)){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(o=we.create(t.state.doc,u.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:f}=d0(t,a);(!n.dataTransfer.files.length||!gn||q4>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(dd?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",dd||n.dataTransfer.setData("text/plain",c),t.dragging=new CO(f,_O(t,n),o)};vn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};kn.dragover=kn.dragenter=(t,e)=>e.preventDefault();kn.drop=(t,e)=>{try{KU(t,e,t.dragging)}finally{t.dragging=null}};function KU(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(cd(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",m=>{i=m(i,t,!1)}):i=cO(t,jO(e.dataTransfer),dd?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&_O(t,e));if(t.someProp("handleDrop",m=>m(t,e,i||ce.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?rW(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=t.state.tr;if(o){let{node:m}=n;m?m.replace(l):l.deleteSelection()}let c=l.mapping.map(a),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=l.doc;if(f?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(u))return;let h=l.doc.resolve(c);if(f&&we.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new we(h));else{let m=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,p,x,y)=>m=y),l.setSelection(ul(t,h,l.doc.resolve(m)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}vn.focus=t=>{if(t.input.lastFocus=Date.now(),!t.focused&&(t.domObserver.stopped(()=>t.dom.classList.add("ProseMirror-focused")),t.focused=!0,t.domSel.read(),!t.domSel.synced)){let e=t.domSel.range;setTimeout(()=>{let n=t.domSel.readRange();n&&e.eq(n)&&t.domSel.sync()},20)}};vn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stopped(()=>t.dom.classList.remove("ProseMirror-focused")),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domSel.deactivate(),t.focused=!1)};vn.beforeinput=(t,e)=>{if(vs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||t.domObserver.pendingRecords().length||(t.dom.blur(),t.focus(),ti(t,"Backspace")))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in kn)vn[t]=kn[t];function fd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ux{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let n=this.frag.child(this.index);if(this.off==e)return n;this.off+=n.nodeSize,this.index++}return null}}class bh{constructor(e,n){this.toDOM=e,this.spec=n||po,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new kr(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ji{constructor(e,n){this.attrs=e,this.spec=n||po}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new kr(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ji&&fd(this.attrs,e.attrs)&&fd(this.spec,e.spec)}static is(e){return e.type instanceof ji}destroy(){}}class p0{constructor(e,n){this.attrs=e,this.spec=n||po}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new kr(i.pos-r,o.pos-r,this)}valid(e,n,r){let s=r.nodeAt(n.from);return!!s&&!s.isText&&n.from+s.nodeSize==n.to}eq(e){return this==e||e instanceof p0&&fd(this.attrs,e.attrs)&&fd(this.spec,e.spec)}destroy(){}}class kr{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new kr(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new kr(e,e,new bh(n,r))}static inline(e,n,r,s){return new kr(e,n,new ji(r,s))}static node(e,n,r,s){return new kr(e,n,new p0(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof ji}get widget(){return this.type instanceof bh}}const la=[],po={};class Dt{constructor(e,n){this.local=e.length?e:la,this.children=n.length?n:la}static create(e,n){return n.length?Sh(n,e,0,po):rn}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];if(a.from>n)break;a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length&&!(this.children[o]>=n);o+=3)if(this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==rn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||po)}mapInner(e,n,r,s,i){let o;if(this.local.length){let a=new Ux(n.content);for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,s);c&&c.type.valid(n,c,a)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}}return this.children.length?JU(this.children,o||[],e,n,r,s,i):o?new Dt(o.sort(ai),la):rn}add(e,n){return n.length?this==rn?Dt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,f;if(f=EO(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,f,c+1):s.splice(i,0,l,l+a.nodeSize,Sh(f,a,c+1,po)),i+=3}});let o=NO(i?$O(n):n,-r).sort(ai);if(o.length){let a=new Ux(e.content);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l],a)||o.splice(l--,1)}return new Dt(o.length?this.local.concat(o).sort(ai):this.local,s||this.children)}remove(e){return e.length==0||this==rn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let f=0,u;f<e.length;f++)(u=e[f])&&u.from>a&&u.to<l&&(e[f]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=rn?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Dt(s,r):rn}forChild(e,n){if(this==rn)return this;if(n.isLeaf)return Dt.empty;let r,s,i=0,o=this.children.length/3;for(;i<o;){let c=i+o>>>1,f=c*3,u=this.children[f];if(u<e)i=c+1;else if(u>e)o=c;else{r=this.children[f+2];break}}let a=e+1,l=a+n.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<l&&f.to>a&&f.type instanceof ji){let u=Math.max(a,f.from)-a,h=Math.min(l,f.to)-a;u<h&&(s||(s=[])).push(f.copy(u,h))}}if(s){let c=new Dt(s.sort(ai),la);return r?new ni([c,r]):c}return r||rn}eq(e){if(this==e)return!0;if(!(e instanceof Dt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return m0(this.localsInner(e))}localsInner(e){if(this==rn)return la;if(e.inlineContent||!this.local.some(ji.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ji||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Dt.empty=new Dt([],[]);Dt.removeOverlap=m0;const rn=Dt.empty;class ni{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,po));return ni.from(r)}forChild(e,n){if(n.isLeaf)return Dt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=rn&&(i instanceof ni?r=r.concat(i.members):r.push(i))}return ni.from(r)}eq(e){if(!(e instanceof ni)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?m0(r?n:n.sort(ai)):la}static from(e){switch(e.length){case 0:return rn;case 1:return e[0];default:return new ni(e.every(n=>n instanceof Dt)?e:e.reduce((n,r)=>n.concat(r instanceof Dt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function JU(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,f=i;c<n.maps.length;c++){let u=0;n.maps[c].forEach((h,m,g,p)=>{let x=p-g-(m-h);for(let y=0;y<a.length;y+=3){let v=a[y+1];if(v<0||h>v+f-u)continue;let k=a[y]+f-u;m>=k?a[y+1]=h<=k?-2:-1:h>=f&&x&&(a[y]+=x,a[y+1]+=x)}u+=x}),f=n.maps[c].map(f,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let f=n.map(t[c]+i),u=f-s;if(u<0||u>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+i,-1),m=h-s,{index:g,offset:p}=r.content.findIndex(u),x=r.maybeChild(g);if(x&&p==u&&p+x.nodeSize==m){let y=a[c+2].mapInner(n,x,f+1,t[c]+i+1,o);y!=rn?(a[c]=u,a[c+1]=m,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=GU(a,t,e,n,s,i,o),f=Sh(c,r,0,o);e=f.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<f.children.length;u+=3){let m=f.children[u];for(;h<a.length&&a[h]<m;)h+=3;a.splice(h,0,f.children[u],f.children[u+1],f.children[u+2])}}return new Dt(e.sort(ai),a)}function NO(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new kr(s.from+e,s.to+e,s.type))}return n}function GU(t,e,n,r,s,i,o){function a(l,c){for(let f=0;f<l.local.length;f++){let u=l.local[f].map(r,s,c);u?n.push(u):o.onRemove&&o.onRemove(l.local[f].spec)}for(let f=0;f<l.children.length;f+=3)a(l.children[f+2],l.children[f]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function EO(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function $O(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Sh(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=EO(t,a,l+n);if(c){i=!0;let f=Sh(c,a,n+l+1,r);f!=rn&&s.push(l,l+a.nodeSize,f)}});let o=NO(i?$O(t):t,-n).sort(ai);if(o.length){let a=new Ux(e.content);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l],a)||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1))}return o.length||s.length?new Dt(o,s):rn}function ai(t,e){return t.from-e.from||t.to-e.to}function m0(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),K2(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),K2(e,s,r.copy(i.from,r.to)));break}}}return e}function K2(t,e,n){for(;e<t.length&&ai(n,t[e])>0;)e++;t.splice(e,0,n)}function fg(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=rn&&e.push(r)}),t.cursorWrapper&&e.push(Dt.create(t.state.doc,[t.cursorWrapper.deco])),ni.from(e)}function YU(t,e,n,r){let{node:s,fromOffset:i,toOffset:o,from:a,to:l}=t.docView.parseRange(e,n),c=t.domSel.range,f,u=c.anchorNode;if(u&&ll(t.dom,u)&&(f=[{node:u,offset:c.anchorOffset}],Zp(c)||f.push({node:c.focusNode,offset:c.focusOffset})),gn&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let v=s.childNodes[y-1],k=v.pmViewDesc;if(v.nodeName=="BR"&&!k){o=y;break}if(!k||k.size)break}let h=t.state.doc,m=t.someProp("domParser")||wi.fromSchema(t.state.schema),g=h.resolve(a),p=null,x=m.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:QU(r),context:g});if(f&&f[0].pos!=null){let y=f[0].pos,v=f[1]&&f[1].pos;v==null&&(v=y),p={anchor:y+a,head:v+a}}return{doc:x,sel:p,from:a,to:l}}const QU=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(cn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||cn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},XU=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function eZ(t,e,n,r,s,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=u0(t,t.domSel.range,S);if(N&&!t.state.selection.eq(N)&&t.domSel.active){if(gn&&vs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&ti(t,"Enter"))return;let E=t.state.tr.setSelection(N);S=="pointer"?E.setMeta("pointer",!0):S=="key"&&E.scrollIntoView(),o&&E.setMeta("composition",o),t.dispatch(E)}return}let a=t.state.doc.resolve(e),l=a.sharedDepth(n);e=a.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,f=YU(t,e,n,i),u=t.state.doc,h=u.slice(f.from,f.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let p=sZ(h.content,f.doc.content,f.from,m,g);if(p&&t.input.domChangeCount++,(dl&&t.input.lastIOSEnter>Date.now()-225||vs)&&i.some(S=>Se(S)&&!XU.test(S.nodeName))&&(!p||p.endA>=p.endB)&&ti(t,"Enter")){t.input.lastIOSEnter=0;return}if(!p)if(s&&c instanceof _e&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))p={start:c.from,endA:c.to,endB:c.to};else{if(f.sel){let S=J2(t,t.state.doc,f.sel);if(S&&!S.eq(t.state.selection)){let N=t.state.tr.setSelection(S);o&&N.setMeta("composition",o),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof _e&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to));let x=f.doc.resolveNoCache(p.start-f.from),y=f.doc.resolveNoCache(p.endB-f.from),v=u.resolve(p.start),k=x.sameParent(y)&&x.parent.inlineContent&&v.end()>=p.endA;if((dl&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!k&&rZ(f.doc,x.pos,y.pos))&&ti(t,"Enter")){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&(k?p.endA>p.start&&p.endB==p.start:nZ(u,p.start,p.endA,x,y))&&ti(t,"Backspace")){vs&&gn&&t.domSel.suppressChanges();return}gn&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),vs&&!k&&x.start()!=y.start()&&y.parentOffset==0&&x.depth==y.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==p.endA&&(p.endB-=2,y=f.doc.resolveNoCache(p.endB-f.from),setTimeout(()=>ti(t,"Enter"),20));let w=p.start,j=p.endA,C=S=>{let N=S||t.state.tr.replace(w,j,f.doc.slice(p.start-f.from,p.endB-f.from));if(f.sel){let E=J2(t,N.doc,f.sel);E&&!(gn&&t.composing&&E.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(E.head==w||E.head==N.mapping.map(j)-1))&&N.setSelection(E)}return o&&N.setMeta("composition",o),N.scrollIntoView()},_;if(k)if(x.pos==y.pos){let S=C(t.state.tr.delete(w,j)),N=u.resolve(p.start).marksAcross(u.resolve(p.endA));N&&S.ensureMarks(N),t.dispatch(S)}else if(p.endA==p.endB&&(_=tZ(x.parent.content.cut(x.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let S=C(t.state.tr);_.type=="add"?S.addMark(w,j,_.mark):S.removeMark(w,j,_.mark),t.dispatch(S)}else if(x.parent.child(x.index()).isText&&x.index()==y.index()-(y.textOffset?0:1)){let S=x.parent.textBetween(x.parentOffset,y.parentOffset),N=()=>C(t.state.tr.insertText(S,w,j));t.someProp("handleTextInput",E=>E(t,w,j,S,N))||t.dispatch(N())}else t.dispatch(C());else t.dispatch(C())}function J2(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ul(t,e.resolve(n.anchor),e.resolve(n.head))}function tZ(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let f=0;f<r.length;f++)s=r[f].removeFromSet(s);for(let f=0;f<n.length;f++)i=n[f].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=f=>f.mark(a.addToSet(f.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=f=>f.mark(a.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(l(e.child(f)));if(G.from(c).eq(t))return{mark:a,type:o}}function nZ(t,e,n,r,s){if(n-e<=s.pos-r.pos||hg(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.inlineContent){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(hg(i,!0,!0));return!o.parent.isTextblock||o.pos>n||hg(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function rZ(t,e,n){let r=0,s=0;return t.nodesBetween(e,n,(i,o)=>{i.isTextblock&&o>=e&&o<n?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-o),Math.min(i.nodeSize,n-o))):i.isLeaf)&&s++}),s==0&&r==1}function hg(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function sZ(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,a=n+e.size;if(i==null)return null;let{a:l,b:c}=t.findDiffEnd(e,o,a);if(s=="end"){let f=Math.max(0,i-Math.min(l,c));r-=l+f-i}if(l<i&&o<a){let f=r<=i&&r>=l?i-r:0;i-=f,c=i+(c-l),l=i}else if(c<i){let f=r<=i&&r>=c?i-r:0;i-=f,l=i+(l-c),c=i}return{start:i,endA:l,endB:c}}const iZ={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0};class oZ{constructor(e){this.view=e,this.queue=[],this.flushingSoon=-1,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.started=!1,this.observer=new window.MutationObserver(n=>{for(let r=0;r<n.length;r++)this.queue.push(n[r]);cn&&e.composing&&n.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()})}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(e=!1){this.flushingSoon>-1?(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush(!0)):e&&this.flush(!0)}start(){this.observer.takeRecords(),this.observer.observe(this.view.dom,iZ),this.started=!0}stop(){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect(),this.started=!1}stopped(e){if(!this.started)return e();this.stop();try{return e()}finally{this.start()}}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=al(i))n.add(i);for(let i=e.anchorNode;i;i=al(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Ct(r)?r.parentNode:r}))return this.view.domSel.ignore(e),!0}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(e=!0){let{view:n}=this;if(!n.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]),e&&n.domSel.read();let s=!n.domSel.suppress&&!n.domSel.synced&&!!yO(n)&&!this.ignoreSelectionChange(n.domSel.range),i=-1,o=-1,a=!1,l=[];if(n.editable)for(let f=0;f<r.length;f++){let u=this.registerMutation(r[f],l);u&&(i=i<0?u.from:Math.min(u.from,i),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(l.some(f=>f.nodeName=="BR")&&(n.input.lastKeyCode==8||n.input.lastKeyCode==46||gn&&(n.composing||n.input.compositionEndedAt>Date.now()-50)&&r.some(f=>f.type=="childList"&&f.removedNodes.length))){for(let f of l)if(f.nodeName=="BR"&&f.parentNode){let u=f.nextSibling;for(;u&&Se(u);){if(u.contentEditable=="false"){f.parentNode.removeChild(f);break}u=u.firstChild}}}else if($r&&l.length){let f=l.filter(u=>u.nodeName=="BR");if(f.length==2){let[u,h]=f;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=n.domSel.range;for(let h of f){let m=h.parentNode;m&&m.nodeName=="LI"&&(!u||lZ(n,u)!=m)&&h.remove()}}}let c=null;i<0&&s&&n.domSel.active&&n.input.lastFocus>Date.now()-200&&n.input.lastTouch<Date.now()-300&&Zp(n.domSel.range)&&(c=u0(n,n.domSel.range))&&c.eq(Be.near(n.state.doc.resolve(0),1))?(n.input.lastFocus=0,n.domSel.sync(),n.scrollToSelection()):(i>-1||s)&&(i>-1&&aZ(n),n.input.badSafariComposition&&(n.input.badSafariComposition=!1,cZ(n,l)),eZ(this.view,i,o,s,a,l),n.docView&&n.docView.damage?n.updateState(n.state):s&&n.domSel.sync())}registerMutation(e,n){var r;if(n.indexOf(e.target)>-1)return null;let s;for(let i=e.target;i&&!(s=this.view.docView.getDesc(i));i=i.parentNode);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let h=e.addedNodes[u];n.push(h),Ct(h)&&(this.lastChangedTextNode=h)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return s.markDamage(4),{from:s.posBefore,to:s.posAfter};let i=e.previousSibling,o=e.nextSibling,a=i&&i.parentNode==e.target?ln(i)+1:0,l=s.localPosFromDOM(e.target,a,-1),c=o&&o.parentNode==e.target?ln(o):e.target.childNodes.length,f=s.localPosFromDOM(e.target,c,1);return s.markDamage(!((r=s.contentDOM)===null||r===void 0)&&r.contains(e.target)?2:4),{from:l,to:f}}else return e.type=="attributes"?(s.markDamage(4),{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}):(this.lastChangedTextNode=e.target,s.markDamage(s instanceof Ud&&e.target==s.nodeDOM?8:4),{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let G2=new WeakMap,Y2=!1;function aZ(t){if(!G2.has(t)&&(G2.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=$r,Y2)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Y2=!0}}function lZ(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function cZ(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSel.range;for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||!Se(l)||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}class MO{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new NU,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(nS),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=eS(this),X2(this),this.nodeViews=tS(this),this.docView=T2(this.state.doc,Q2(this),fg(this),this.dom,this),this.domObserver=new oZ(this),this.domSel=new vU(this),this.domObserver.start(),this.domSel.read(),EU(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nS),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(SO(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let m=tS(this);uZ(m,this.nodeViews)&&(this.nodeViews=m,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vx(this),this.editable=eS(this),X2(this);let l=fg(this),c=Q2(this),f=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(s.selection))&&(o=!0);let h=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&VW(this);o&&this.domObserver.stopped(()=>{let m=u&&gn&&!this.composing&&!s.selection.empty&&!e.selection.empty&&dZ(s.selection,e.selection);if(u){let g=gn?this.trackWrites=this.domSel.range.focusNode:null;if(this.composing&&(this.input.compositionNode=WU(this)),i||!this.docView.update(e.doc,c,l,this,-1)){let p=this.docView.outerDeco;this.docView.destroy(),this.docView=T2(e.doc,c,l,this.dom,this,p)}g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(m=!0)}this.domSel.sync(m)}),this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():h&&WW(h)}scrollToSelection(){let e=this.domSel.range.focusNode;if(!(!e||!this.domSel.active)){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof we){let n=this.docView.domAfterPos(this.state.selection.from);Se(n)&&_2(this,n.getBoundingClientRect(),e)}else _2(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new CO(e.slice,e.move,s<0?void 0:we.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){return this.root.activeElement==this.dom}focus(){this.editable&&Y4(this.dom),this.domSel.sync()}get root(){let e=this.dom.isConnected!==!1;e||(this._root=null);let n=this._root;if(n==null&&e){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return n||document}updateRoot(){this._root=null}posAtCoords(e){return KW(this,e)}coordsAtPos(e,n=1){return tO(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return XW(this,n||this.state,e)}pasteHTML(e,n){return ud(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ud(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return d0(this,e)}destroy(){this.docView&&($U(this),this.domSel.destroy(),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fg(this),this,-1),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,RW())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return TU(this,e)}domSelection(){return this.root.getSelection()}}MO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Q2(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[kr.node(0,t.state.doc.content.size,e)]}function X2(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:kr.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function eS(t){return!t.someProp("editable",e=>e(t.state)===!1)}function dZ(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function tS(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function uZ(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function nS(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Pi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fZ=typeof navigator<"u"&&/Mac/.test(navigator.platform),hZ=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Jt=0;Jt<10;Jt++)Pi[48+Jt]=Pi[96+Jt]=String(Jt);for(var Jt=1;Jt<=24;Jt++)Pi[Jt+111]="F"+Jt;for(var Jt=65;Jt<=90;Jt++)Pi[Jt]=String.fromCharCode(Jt+32),jh[Jt]=String.fromCharCode(Jt);for(var pg in Pi)jh.hasOwnProperty(pg)||(jh[pg]=Pi[pg]);function pZ(t){var e=fZ&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hZ&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?jh:Pi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const mZ=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gZ=typeof navigator<"u"&&/Win/.test(navigator.platform);function yZ(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))mZ?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function xZ(t){let e=Object.create(null);for(let n in t)e[yZ(n)]=t[n];return e}function mg(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function vZ(t){return new Pn({props:{handleKeyDown:kZ(t)}})}function kZ(t){let e=xZ(t);return function(n,r){let s=pZ(r),i,o=e[mg(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[mg(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gZ&&r.ctrlKey&&r.altKey)&&(i=Pi[r.keyCode])&&i!=s){let a=e[mg(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var wZ=Object.defineProperty,g0=(t,e)=>{for(var n in e)wZ(t,n,{get:e[n],enumerable:!0})};function Kp(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Jp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const f=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(u=>u===!0)),f={...Object.fromEntries(Object.entries(n).map(([u,h])=>[u,(...g)=>{const p=this.buildProps(l,e),x=h(...g)(p);return o.push(x),f}])),run:c};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Kp({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},TO={};g0(TO,{blur:()=>bZ,clearContent:()=>SZ,clearNodes:()=>jZ,command:()=>CZ,createParagraphNear:()=>_Z,cut:()=>NZ,deleteCurrentNode:()=>EZ,deleteNode:()=>$Z,deleteRange:()=>MZ,deleteSelection:()=>AZ,enter:()=>RZ,exitCode:()=>IZ,extendMarkRange:()=>PZ,first:()=>DZ,focus:()=>LZ,forEach:()=>FZ,insertContent:()=>BZ,insertContentAt:()=>WZ,insertDefaultBlock:()=>UZ,joinBackward:()=>qZ,joinDown:()=>HZ,joinForward:()=>KZ,joinItemBackward:()=>JZ,joinItemForward:()=>GZ,joinTextblockBackward:()=>YZ,joinTextblockForward:()=>QZ,joinUp:()=>ZZ,keyboardShortcut:()=>eH,lift:()=>tH,liftEmptyBlock:()=>nH,liftListItem:()=>rH,newlineInCode:()=>sH,resetAttributes:()=>iH,scrollIntoView:()=>oH,selectAll:()=>aH,selectNodeBackward:()=>lH,selectNodeForward:()=>cH,selectParentNode:()=>dH,selectTextblockEnd:()=>uH,selectTextblockStart:()=>fH,setContent:()=>hH,setMark:()=>MH,setMeta:()=>TH,setNode:()=>OH,setNodeSelection:()=>AH,setTextDirection:()=>RH,setTextSelection:()=>IH,sinkListItem:()=>PH,splitBlock:()=>DH,splitListItem:()=>zH,toggleList:()=>FH,toggleMark:()=>BH,toggleNode:()=>VH,toggleWrap:()=>WH,undoInputRule:()=>UH,unsetAllMarks:()=>ZH,unsetMark:()=>HH,unsetTextDirection:()=>qH,updateAttributes:()=>KH,wrapIn:()=>JH,wrapInList:()=>GH});var bZ=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),SZ=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),jZ=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:f}=e,u=c.resolve(f.map(l)),h=c.resolve(f.map(l+a.nodeSize)),m=u.blockRange(h);if(!m)return;const g=El(m);if(a.type.isTextblock){const{defaultType:p}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(m.start,p)}(g||g===0)&&e.lift(m,g)})}),!0},CZ=t=>e=>t(e),_Z=()=>({state:t,dispatch:e})=>V4(t,e),NZ=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new _e(r.doc.resolve(Math.max(o-1,0)))),!0},EZ=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1};function Vt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var $Z=t=>({tr:e,state:n,dispatch:r})=>{const s=Vt(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},MZ=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},TZ=t=>t.content?/^text(\*|\+)/.test(t.content):!1,rS=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return TZ(r)?n==="left"?t.start()-1:t.end()+1:t.pos},OZ=(t,e,n)=>{const r=rS(t,n,"left"),s=rS(e,n,"right");return{from:r,to:s}},AZ=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),a=n.doc.resolve(o.map(i.$from.pos)),l=n.doc.resolve(o.map(i.$to.pos)),{from:c,to:f}=OZ(a,l,t.schema);n.deleteRange(c,f)}),n.selection.empty||n.setSelection(_e.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},RZ=()=>({commands:t})=>t.keyboardShortcut("Enter"),IZ=()=>({state:t,dispatch:e})=>vW(t,e);function y0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ch(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:y0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function OO(t,e,n={}){return t.find(r=>r.type===e&&Ch(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function sS(t,e,n={}){return!!OO(t,e,n)}function x0(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(f=>f.type===e);c&&(n=c.attrs)}if(!OO([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,a=i+1,l=o+r.node.nodeSize;for(;i>0&&sS([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&sS([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Ls(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var PZ=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=Ls(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:f}=a;if(s){const u=x0(l,i,e);if(u&&u.from<=c&&u.to>=f){const h=_e.create(o,u.from,u.to);n.setSelection(h)}}return!0},DZ=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function AO(t){return t instanceof _e}function so(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Zx(t,e=null){if(!e)return null;const n=Be.atStart(t),r=Be.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?_e.create(t,so(0,s,i),so(t.content.size,s,i)):_e.create(t,so(e,s,i),so(e,s,i))}function iS(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function _h(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function zZ(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var LZ=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(_h()||iS())&&r.dom.focus(),zZ()&&!_h()&&!iS()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!AO(n.state.selection))return o(),!0;const a=Zx(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},FZ=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),BZ=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),RO=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&RO(r)}return t};function Nu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return RO(n)}function fl(t,e,n){if(t instanceof ki||t instanceof G)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return G.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),fl("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new p4({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?wi.fromSchema(l).parseSlice(Nu(t),n.parseOptions):wi.fromSchema(l).parse(Nu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=wi.fromSchema(e);return n.slice?i.parseSlice(Nu(t),n.parseOptions).content:i.parse(Nu(t),n.parseOptions)}return fl("",e,n)}function IO(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof bt||s instanceof Ft))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,c,f)=>{o===0&&(o=f)}),t.setSelection(Be.near(t.doc.resolve(o),n))}var VZ=t=>!("type"in t),WZ=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=x=>{i.emit("contentError",{editor:i,error:x,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{fl(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(x){l(x)}try{a=fl(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(x){return l(x),!1}let{from:f,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,m=!0;if((VZ(a)?a:[a]).forEach(x=>{x.check(),h=h?x.isText&&x.marks.length===0:!1,m=m?x.isBlock:!1}),f===u&&m){const{parent:x}=r.doc.resolve(f);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(f-=1,u+=1)}let p;if(h){if(Array.isArray(e))p=e.map(x=>x.text||"").join("");else if(e instanceof G){let x="";e.forEach(y=>{y.text&&(x+=y.text)}),p=x}else typeof e=="object"&&e&&e.text?p=e.text:p=e;r.insertText(p,f,u)}else{p=a;const x=r.doc.resolve(f),y=x.node(),v=x.parentOffset===0,k=y.isText||y.isTextblock,w=y.content.size>0;v&&k&&w&&m&&(f=Math.max(0,f-1)),r.replaceWith(f,u,p)}n.updateSelection&&IO(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:p}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:p})}return!0};function PO(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var UZ=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=t;let l;typeof s=="number"?l=e.doc.resolve(s):s?l=s:l=e.selection.$from;const c=PO(l.parent.contentMatchAt(l.index()));if(!c)return!1;const f=Object.keys(c.spec.attrs||{}),u=i?Object.fromEntries(Object.entries(i).filter(([m])=>f.includes(m))):{};let h;if(o){const m=fl(o,r.schema);h=c.createAndFill(u,m)}else h=c.createAndFill(u);return h?(n&&(e.insert(l.pos,h),a&&IO(e,e.steps.length-1,-1)),!0):!1},ZZ=()=>({state:t,dispatch:e})=>gW(t,e),HZ=()=>({state:t,dispatch:e})=>yW(t,e),qZ=()=>({state:t,dispatch:e})=>I4(t,e),KZ=()=>({state:t,dispatch:e})=>L4(t,e),JZ=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Vp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},GZ=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Vp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},YZ=()=>({state:t,dispatch:e})=>pW(t,e),QZ=()=>({state:t,dispatch:e})=>mW(t,e);function DO(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function XZ(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))_h()||DO()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var eH=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=XZ(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const f=c.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function hd(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Vt(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(u,h)=>{if(u.isText)return;const m=Math.max(r,h),g=Math.min(s,h+u.nodeSize);a.push({node:u,from:m,to:g})});const l=s-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Ch(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var tH=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return hd(n,s,e)?xW(n,r):!1},nH=()=>({state:t,dispatch:e})=>W4(t,e),rH=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return MW(r)(e,n)},sH=()=>({state:t,dispatch:e})=>B4(t,e);function Gp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function oS(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var iH=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Gp(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(o=Ls(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(f,u)=>{i&&i===f.type&&(l=!0,s&&n.setNodeMarkup(u,void 0,oS(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(h=>{o===h.type&&(l=!0,s&&n.addMark(u,u+f.nodeSize,o.create(oS(h.attrs,e))))})})}),l},oH=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),aH=()=>({tr:t,dispatch:e})=>{if(e){const n=new Un(t.doc);t.setSelection(n)}return!0},lH=()=>({state:t,dispatch:e})=>D4(t,e),cH=()=>({state:t,dispatch:e})=>F4(t,e),dH=()=>({state:t,dispatch:e})=>bW(t,e),uH=()=>({state:t,dispatch:e})=>CW(t,e),fH=()=>({state:t,dispatch:e})=>jW(t,e);function Hx(t,e,n={},r={}){return fl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var hH=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Hx(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function zO(t,e){const n=Ls(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function LO(t,e){const n=new M4(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function pH(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function mH(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function v0(t){return e=>mH(e.$from,t)}function ke(t,e,n){return t.config[e]===void 0&&t.parent?ke(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ke(t.parent,e,n):null}):t.config[e]}function k0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=ke(e,"addExtensions",n);return r?[e,...k0(r())]:e}).flat(10)}function w0(t,e){const n=Wo.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function FO(t){return typeof t=="function"}function Xe(t,e=void 0,...n){return FO(t)?e?t.bind(e)(...n):t(...n):t}function gH(t={}){return Object.keys(t).length===0&&t.constructor===Object}function hl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function BO(t){const e=[],{nodeExtensions:n,markExtensions:r}=hl(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return t.forEach(c=>{const f={name:c.name,options:c.options,storage:c.storage,extensions:s},u=ke(c,"addGlobalAttributes",f);if(!u)return;u().forEach(m=>{let g;Array.isArray(m.types)?g=m.types:m.types==="*"?g=l:m.types==="nodes"?g=o:m.types==="marks"?g=a:g=[],g.forEach(p=>{Object.entries(m.attributes).forEach(([x,y])=>{e.push({type:p,name:x,attribute:{...i,...y}})})})})}),s.forEach(c=>{const f={name:c.name,options:c.options,storage:c.storage},u=ke(c,"addAttributes",f);if(!u)return;const h=u();Object.entries(h).forEach(([m,g])=>{const p={...i,...g};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:c.name,name:m,attribute:p})})}),e}function yH(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!s){r=!r,n+=l;continue}if(l==='"'&&!r){s=!s,n+=l;continue}if(!r&&!s){if(l==="("){i+=1,n+=l;continue}if(l===")"&&i>0){i-=1,n+=l;continue}if(l===";"&&i===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function aS(t){const e=[],n=yH(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),l=i.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function Di(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(f=>!l.includes(f));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=new Map([...aS(r[s]),...aS(i)]);r[s]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[s]=i}),r},{})}function Nh(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Di(n,r),{})}function xH(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function lS(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):xH(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function cS(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&gH(n)?!1:n!=null))}function dS(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function vH(t,e){var n;const r=BO(t),{nodeExtensions:s,markExtensions:i}=hl(t),o=(n=s.find(c=>ke(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const f=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,v)=>{const k=ke(v,"extendNodeSchema",u);return{...y,...k?k(c):{}}},{}),m=cS({...h,content:Xe(ke(c,"content",u)),marks:Xe(ke(c,"marks",u)),group:Xe(ke(c,"group",u)),inline:Xe(ke(c,"inline",u)),atom:Xe(ke(c,"atom",u)),selectable:Xe(ke(c,"selectable",u)),draggable:Xe(ke(c,"draggable",u)),code:Xe(ke(c,"code",u)),whitespace:Xe(ke(c,"whitespace",u)),linebreakReplacement:Xe(ke(c,"linebreakReplacement",u)),defining:Xe(ke(c,"defining",u)),isolating:Xe(ke(c,"isolating",u)),attrs:Object.fromEntries(f.map(dS))}),g=Xe(ke(c,"parseHTML",u));g&&(m.parseDOM=g.map(y=>lS(y,f)));const p=ke(c,"renderHTML",u);p&&(m.toDOM=y=>p({node:y,HTMLAttributes:Nh(y,f)}));const x=ke(c,"renderText",u);return x&&(m.toText=x),[c.name,m]})),l=Object.fromEntries(i.map(c=>{const f=r.filter(x=>x.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((x,y)=>{const v=ke(y,"extendMarkSchema",u);return{...x,...v?v(c):{}}},{}),m=cS({...h,inclusive:Xe(ke(c,"inclusive",u)),excludes:Xe(ke(c,"excludes",u)),group:Xe(ke(c,"group",u)),spanning:Xe(ke(c,"spanning",u)),code:Xe(ke(c,"code",u)),attrs:Object.fromEntries(f.map(dS))}),g=Xe(ke(c,"parseHTML",u));g&&(m.parseDOM=g.map(x=>lS(x,f)));const p=ke(c,"renderHTML",u);return p&&(m.toDOM=x=>p({mark:x,HTMLAttributes:Nh(x,f)})),[c.name,m]}));return new p4({topNode:o,nodes:a,marks:l})}function kH(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function bc(t){return t.sort((n,r)=>{const s=ke(n,"priority")||100,i=ke(r,"priority")||100;return s>i?-1:s<i?1:0})}function VO(t){const e=bc(k0(t)),n=kH(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function WO(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
777
-
778
- `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,c,f,u)=>{var h;l.isBlock&&c>r&&(a+=i);const m=o==null?void 0:o[l.type.name];if(m)return f&&(a+=m({node:l,pos:c,parent:f,index:u,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)==null?void 0:h.slice(Math.max(r,c)-c,s-c))}),a}function wH(t,e){const n={from:0,to:t.content.size};return WO(t,n,e)}function UO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function bH(t,e){const n=Vt(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function ZO(t,e){const n=Gp(typeof e=="string"?e:e.name,t.schema);return n==="node"?bH(t,e):n==="mark"?zO(t,e):{}}function SH(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function jH(t){const e=SH(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function HO(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),f=e.slice(i).map(l),u=e.invert().map(c,-1),h=e.invert().map(f);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:f}})})}),jH(r)}function b0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=x0(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}function Ul(t,e){return e.nodes[t]||e.marks[t]||null}function rf(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var CH=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const f=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-i))}),n};function qx(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Ls(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Ch(u.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:u,$to:h})=>{const m=u.pos,g=h.pos;t.doc.nodesBetween(m,g,(p,x)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;const y=Math.max(m,x),v=Math.min(g,x+p.nodeSize),k=v-y;o+=k,a.push(...p.marks.map(w=>({mark:w,from:y,to:v})))})}),o===0)return!1;const l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Ch(u.mark.attrs,n,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function _H(t,e,n={}){if(!e)return hd(t,null,n)||qx(t,null,n);const r=Gp(e,t.schema);return r==="node"?hd(t,e,n):r==="mark"?qx(t,e,n):!1}function uS(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function gg(t,e){const{nodeExtensions:n}=hl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Xe(ke(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function S0(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(S0(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}var qO=class KO{constructor(e){this.position=e}static fromJSON(e){return new KO(e.position)}toJSON(){return{position:this.position}}};function NH(t,e){const n=e.mapping.mapResult(t.position);return{position:new qO(n.pos),mapResult:n}}function EH(t){return new qO(t)}function $H(t,e,n){var r;const{selection:s}=e;let i=null;if(AO(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(f,u,h)=>{if(c)return!1;if(f.isInline){const m=!h||h.type.allowsMarkType(n),g=!!n.isInSet(f.marks)||!f.marks.some(p=>p.type.excludes(n));c=m&&g}return!c}),c})}var MH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=Ls(t,r.schema);if(s)if(o){const c=zO(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const f=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(f,u,(h,m)=>{const g=Math.max(m,f),p=Math.min(m+h.nodeSize,u);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&n.addMark(g,p,l.create({...y.attrs,...e}))}):n.addMark(g,p,l.create(e))})});return $H(r,n,l)},TH=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),OH=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Vt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>w2(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>w2(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},AH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=so(t,0,r.content.size),i=we.create(r,s);e.setSelection(i)}return!0},RH=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&n.doc.nodesBetween(o,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},IH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=_e.atStart(r).from,a=_e.atEnd(r).to,l=so(s,o,a),c=so(i,o,a),f=_e.create(r,l,c);e.setSelection(f)}return!0},PH=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return AW(r)(e,n)};function fS(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var DH=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,f=rf(c,a.node().type.name,a.node().attrs);if(i instanceof we&&i.node.isBlock)return!a.parentOffset||!Cs(o,a.pos)?!1:(r&&(t&&fS(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:PO(a.node(-1).contentMatchAt(a.indexAfter(-1)));let m=u&&h?[{type:h,attrs:f}]:void 0,g=Cs(e.doc,e.mapping.map(a.pos),1,m);if(!m&&!g&&Cs(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(g=!0,m=h?[{type:h,attrs:f}]:void 0),r){if(g&&(i instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,m),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const p=e.mapping.map(a.before()),x=e.doc.resolve(p);a.node(-1).canReplaceWith(x.index(),x.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&fS(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return g},zH=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Vt(t,r.schema),{$from:l,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let y=G.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let S=l.depth-v;S>=l.depth-3;S-=1)y=G.from(l.node(S).copy(y));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w={...rf(h,l.node().type.name,l.node().attrs),...e},j=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(w))||void 0;y=y.append(G.from(a.createAndFill(null,j)||void 0));const C=l.before(l.depth-(v-1));n.replace(C,l.after(-k),new ce(y,4-v,0));let _=-1;n.doc.nodesBetween(C,n.doc.content.size,(S,N)=>{if(_>-1)return!1;S.isTextblock&&S.content.size===0&&(_=N+1)}),_>-1&&n.setSelection(_e.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const m=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,g={...rf(h,u.type.name,u.attrs),...e},p={...rf(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const x=m?[{type:a,attrs:g},{type:m,attrs:p}]:[{type:a,attrs:g}];if(!Cs(n.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:v}=r,{splittableMarks:k}=i.extensionManager,w=v||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,x).scrollIntoView(),!w||!s)return!0;const j=w.filter(C=>k.includes(C.type.name));n.ensureMarks(j)}return!0};function hS(t){return!t||t==="1"?null:t}function JO(t,e){return hS(t)===hS(e)}var yg=(t,e)=>{const n=v0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Uo(t.doc,n.pos))||!JO(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},xg=(t,e)=>{const n=v0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Uo(t.doc,r))||!JO(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function LH(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return _e.between(r,s)}var FH=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:f})=>{const{extensions:u,splittableMarks:h}=s.extensionManager,m=Vt(t,o.schema),g=Vt(e,o.schema),{selection:p,storedMarks:x}=o,{$from:y,$to:v}=p,k=y.blockRange(v),w=x||p.$to.parentOffset&&p.$from.marks();if(!k)return!1;const j=v0(I=>gg(I.type.name,u))(p),C=p.from===0&&p.to===o.doc.content.size,_=o.doc.content.content,S=_.length===1?_[0]:null,N=C&&S&&gg(S.type.name,u)?{node:S,pos:0}:null,E=j??N,P=!!j&&k.depth>=1&&k.depth-j.depth<=1,z=!!N;if((P||z)&&E){if(E.node.type===m)return C&&z?l().command(({tr:I,dispatch:F})=>{const U=LH(I);return U?(I.setSelection(U),F&&F(I),!0):!1}).liftListItem(g).run():c.liftListItem(g);if(gg(E.node.type.name,u)&&m.validContent(E.node.content))return l().command(()=>(i.setNodeMarkup(E.pos,m),!0)).command(()=>yg(i,m)).command(()=>xg(i,m)).run()}return!n||!w||!a?l().command(()=>f().wrapInList(m,r)?!0:c.clearNodes()).wrapInList(m,r).command(()=>yg(i,m)).command(()=>xg(i,m)).run():l().command(()=>{const I=f().wrapInList(m,r),F=w.filter(U=>h.includes(U.type.name));return i.ensureMarks(F),I?!0:c.clearNodes()}).wrapInList(m,r).command(()=>yg(i,m)).command(()=>xg(i,m)).run()},BH=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ls(t,r.schema);return qx(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},VH=(t,e,n={})=>({state:r,commands:s})=>{const i=Vt(t,r.schema),o=Vt(e,r.schema),a=hd(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},WH=(t,e={})=>({state:n,commands:r})=>{const s=Vt(t,n.schema);return hd(n,s,e)?r.lift(s):r.wrapIn(s,e)},UH=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},ZH=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(f=>s||!l.includes(f.name));a.forEach(f=>{for(const u of c)e.removeMark(f.$from.pos,f.$to.pos,u)})}return!0},HH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Ls(t,r.schema),{$from:c,empty:f,ranges:u}=a;if(!s)return!0;if(f&&o){let{from:h,to:m}=a;const g=(i=c.marks().find(x=>x.type===l))==null?void 0:i.attrs,p=x0(c,l,g);p&&(h=p.from,m=p.to),n.removeMark(h,m,l)}else u.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},qH=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},KH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Gp(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(o=Ls(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const f=c.$from.pos,u=c.$to.pos;let h,m,g,p;n.selection.empty?r.doc.nodesBetween(f,u,(x,y)=>{i&&i===x.type&&(l=!0,g=Math.max(y,f),p=Math.min(y+x.nodeSize,u),h=y,m=x)}):r.doc.nodesBetween(f,u,(x,y)=>{y<f&&i&&i===x.type&&(l=!0,g=Math.max(y,f),p=Math.min(y+x.nodeSize,u),h=y,m=x),y>=f&&y<=u&&(i&&i===x.type&&(l=!0,s&&n.setNodeMarkup(y,void 0,{...x.attrs,...e})),o&&x.marks.length&&x.marks.forEach(v=>{if(o===v.type&&(l=!0,s)){const k=Math.max(y,f),w=Math.min(y+x.nodeSize,u);n.addMark(k,w,o.create({...v.attrs,...e}))}}))}),m&&(h!==void 0&&s&&n.setNodeMarkup(h,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(x=>{o===x.type&&s&&n.addMark(g,p,o.create({...x.attrs,...e}))}))}),l},JH=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return _W(s,e)(n,r)},GH=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return NW(s,e)(n,r)},YH=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function QH(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function XH(t){return typeof t=="number"}function eq(t){return Object.prototype.toString.call(t).slice(8,-1)}function Eu(t){return eq(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var tq={};g0(tq,{createAtomBlockMarkdownSpec:()=>nq,createBlockMarkdownSpec:()=>rq,createInlineMarkdownSpec:()=>oq,parseAttributes:()=>j0,parseIndentedBlocks:()=>aq,renderNestedMarkdownContent:()=>lq,serializeAttributes:()=>C0});function j0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([\w-]+)/g);if(s){const c=s.map(f=>f.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([\w-]+)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,f])=>{var u;const h=parseInt(((u=f.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),m=n[h];m&&(e[c]=m.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function C0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function nq(t){const{nodeName:e,name:n,parseAttributes:r=j0,serializeAttributes:s=C0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=f=>{if(!a)return f;const u={};return a.forEach(h=>{h in f&&(u[h]=f[h])}),u};return{parseMarkdown:(f,u)=>{const h={...i,...f.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(f){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),m=(u=f.match(h))==null?void 0:u.index;return m!==void 0?m:-1},tokenize(f,u,h){const m=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=f.match(m);if(!g)return;const p=g[1]||"",x=r(p);if(!o.find(v=>!(v in x)))return{type:e,raw:g[0],attributes:x}}},renderMarkdown:f=>{const u=c(f.attrs||{}),h=s(u),m=h?` {${h}}`:"";return`:::${l}${m} :::`}}}function rq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=j0,serializeAttributes:i=C0,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,f=u=>{if(!l)return u;const h={};return l.forEach(m=>{m in u&&(h[m]=u[m])}),h};return{parseMarkdown:(u,h)=>{let m;if(r){const p=r(u);m=typeof p=="string"?[{type:"text",text:p}]:p}else a==="block"?m=h.parseChildren(u.tokens||[]):m=h.parseInline(u.tokens||[]);const g={...o,...u.attributes};return h.createNode(e,g,m)},markdownTokenizer:{name:e,level:"block",start(u){var h;const m=new RegExp(`^:::${c}`,"m"),g=(h=u.match(m))==null?void 0:h.index;return g!==void 0?g:-1},tokenize(u,h,m){var g;const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=u.match(p);if(!x)return;const[y,v=""]=x,k=s(v);let w=1;const j=y.length;let C="";const _=/^:::([\w-]*)(\s.*)?/gm,S=u.slice(j);for(_.lastIndex=0;;){const N=_.exec(S);if(N===null)break;const E=N.index,P=N[1];if(!((g=N[2])!=null&&g.endsWith(":::"))){if(P)w+=1;else if(w-=1,w===0){const z=S.slice(0,E);C=z.trim();const I=u.slice(0,j+E+N[0].length);let F=[];if(C)if(a==="block")for(F=m.blockTokens(z),F.forEach(U=>{U.text&&(!U.tokens||U.tokens.length===0)&&(U.tokens=m.inlineTokens(U.text))});F.length>0;){const U=F[F.length-1];if(U.type==="paragraph"&&(!U.text||U.text.trim()===""))F.pop();else break}else F=m.inlineTokens(C);return{type:e,raw:I,attributes:k,content:C,tokens:F}}}}}},renderMarkdown:(u,h)=>{const m=f(u.attrs||{}),g=i(m),p=g?` {${g}}`:"",x=h.renderChildren(u.content||[],`
779
-
780
- `);return`:::${c}${p}
781
-
782
- ${x}
783
-
784
- :::`}}}function sq(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function iq(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function oq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=sq,serializeAttributes:i=iq,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,f=h=>{if(!l)return h;const m={};return l.forEach(g=>{const p=typeof g=="string"?g:g.name,x=typeof g=="string"?void 0:g.skipIfDefault;if(p in h){const y=h[p];if(x!==void 0&&y===x)return;m[p]=y}}),m},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,m)=>{const g={...o,...h.attributes};if(a)return m.createNode(e,g);const p=r?r(h):h.content||"";return p?m.createNode(e,g,[m.createTextNode(p)]):m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(h){const m=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),g=h.match(m),p=g==null?void 0:g.index;return p!==void 0?p:-1},tokenize(h,m,g){const p=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),x=h.match(p);if(!x)return;let y="",v="";if(a){const[,w]=x;v=w}else{const[,w,j]=x;v=w,y=j||""}const k=s(v.trim());return{type:e,raw:x[0],content:y.trim(),attributes:k}}},renderMarkdown:h=>{let m="";r?m=r(h):h.content&&h.content.length>0&&(m=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const g=f(h.attrs||{}),p=i(g),x=p?` ${p}`:"";return a?`[${c}${x}]`:`[${c}${x}]${m}[/${c}]`}}}function aq(t,e,n){var r,s,i,o;const a=t.split(`
785
- `),l=[];let c="",f=0;const u=e.baseIndentSize||2;for(;f<a.length;){const h=a[f],m=h.match(e.itemPattern);if(!m){if(l.length>0)break;if(h.trim()===""){f+=1,c=`${c}${h}
786
- `;continue}else return}const g=e.extractItemData(m),{indentLevel:p,mainContent:x}=g;c=`${c}${h}
787
- `;const y=[x];for(f+=1;f<a.length;){const j=a[f];if(j.trim()===""){const _=a.slice(f+1).findIndex(E=>E.trim()!=="");if(_===-1)break;if((((s=(r=a[f+1+_].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>p){y.push(j),c=`${c}${j}
788
- `,f+=1;continue}else break}if((((o=(i=j.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>p)y.push(j),c=`${c}${j}
789
- `,f+=1;else break}let v;const k=y.slice(1);if(k.length>0){const j=k.map(C=>C.slice(p+u)).join(`
790
- `);j.trim()&&(e.customNestedParser?v=e.customNestedParser(j):v=n.blockTokens(j))}const w=e.createToken(g,v);l.push(w)}if(l.length!==0)return{items:l,raw:c}}function lq(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,a=e.renderChildren([i]);let l=`${s}${a}`;return o&&o.length>0&&o.forEach((c,f)=>{var u,h;const m=(h=(u=e.renderChild)==null?void 0:u.call(e,c,f+1))!=null?h:e.renderChildren([c]);if(m!=null){const g=m.split(`
791
- `).map(p=>p?e.indent(p):e.indent("")).join(`
792
- `);l+=c.type==="paragraph"?`
793
-
794
- ${g}`:`
795
- ${g}`}}),l}function GO(t,e){const n={...t};return Eu(t)&&Eu(e)&&Object.keys(e).forEach(r=>{Eu(e[r])&&Eu(t[r])?n[r]=GO(t[r],e[r]):n[r]=e[r]}),n}function cq(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const c=i.mapping.map(l),f=i.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(m=>{if(m!==o)return!1;u=m}),!u)return;let h=!1;if(Object.keys(n).forEach(m=>{n[m]!==u.attrs[m]&&(h=!0)}),h){const m=t.type.create({...t.attrs,...n});i.removeMark(c,f,t.type),i.addMark(c,f,m)}}),i.docChanged&&e.view.dispatch(i)}var YO=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},dq=(t,e)=>{if(y0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function $u(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let f=!1;const u=CH(c)+i;return o.forEach(h=>{if(f)return;const m=dq(u,h.find);if(!m)return;const g=m[0].length-i.length;if(g>0){const C=c.parentOffset-g;if(C<0||c.parent.textBetween(C,c.parentOffset)!==m[0].slice(0,g))return}const p=l.state.tr,x=Kp({state:l.state,transaction:p}),y={from:r-(m[0].length-i.length),to:s},{commands:v,chain:k,can:w}=new Jp({editor:n,state:x});h.handler({state:x,range:y,match:m,commands:v,chain:k,can:w})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:s,text:i}),l.dispatch(p),f=!0)}),f}function uq(t){const{editor:e,rules:n}=t,r=new Pn({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:f}=l;typeof f=="string"?f=f:f=w0(G.from(f),o.schema);const{from:u}=l,h=u+f.length;$u({editor:e,from:u,to:h,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return $u({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&$u({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?$u({editor:e,from:o.pos,to:o.pos,text:`
796
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var _0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Xe(ke(this,"addOptions",{name:this.name}))}}get storage(){return{...Xe(ke(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>GO(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Zd=class QO extends _0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new QO(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},XO=class{constructor(t){this.find=t.find,this.handler=t.handler}},fq=(t,e,n)=>{if(y0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function hq(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:f}=new Jp({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,s,(m,g)=>{var p,x,y,v,k;if((x=(p=m.type)==null?void 0:p.spec)!=null&&x.code||!(m.isText||m.isTextblock||m.isInline))return;const w=(k=(v=(y=m.content)==null?void 0:y.size)!=null?v:m.nodeSize)!=null?k:0,j=Math.max(r,g),C=Math.min(s,g+w);if(j>=C)return;const _=m.isText?m.text||"":m.textBetween(j-g,C-g,void 0,"");fq(_,i.find,o).forEach(N=>{if(N.index===void 0)return;const E=j+N.index+1,P=E+N[0].length,z={from:n.tr.mapping.map(E),to:n.tr.mapping.map(P)},I=i.handler({state:n,range:z,match:N,commands:l,chain:c,can:f,pasteEvent:o,dropEvent:a});u.push(I)})}),u.every(m=>m!==null)}var Mu=null,pq=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function mq(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:f,from:u,to:h,rule:m,pasteEvt:g})=>{const p=f.tr,x=Kp({state:f,transaction:p});if(!(!hq({editor:e,state:x,from:Math.max(u-1,0),to:h.b-1,rule:m,pasteEvent:g,dropEvent:a})||!p.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(f=>new Pn({view(u){const h=g=>{var p;r=(p=u.dom.parentElement)!=null&&p.contains(g.target)?u.dom.parentElement:null,r&&(Mu=e)},m=()=>{Mu&&(Mu=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",m),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",m)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(i=r===u.dom.parentElement,a=h,!i){const m=Mu;m!=null&&m.isEditable&&setTimeout(()=>{const g=m.state.selection;g&&m.commands.deleteRange({from:g.from,to:g.to})},10)}return!1},paste:(u,h)=>{var m;const g=(m=h.clipboardData)==null?void 0:m.getData("text/html");return o=h,s=!!(g!=null&&g.includes("data-pm-slice")),!1}}},appendTransaction:(u,h,m)=>{const g=u[0],p=g.getMeta("uiEvent")==="paste"&&!s,x=g.getMeta("uiEvent")==="drop"&&!i,y=g.getMeta("applyPasteRules"),v=!!y;if(!p&&!x&&!v)return;if(v){let{text:j}=y;typeof j=="string"?j=j:j=w0(G.from(j),m.schema);const{from:C}=y,_=C+j.length,S=pq(j);return l({rule:f,state:m,from:C,to:{b:_},pasteEvt:S})}const k=h.doc.content.findDiffStart(m.doc.content),w=h.doc.content.findDiffEnd(m.doc.content);if(!(!XH(k)||!w||k===w.b))return l({rule:f,state:m,from:k,to:w,pasteEvt:o})}}))}var Yp=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=VO(t),this.schema=vH(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ul(e.name,this.schema)},r=ke(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return bc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ul(r.name,this.schema)},i=[],o=ke(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&ke(r,"exitable",s)&&(a.ArrowRight=()=>Zd.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([m,g])=>[m,()=>g({editor:t})]));a={...a,...h}}const l=vZ(a);i.push(l);const c=ke(r,"addInputRules",s);if(uS(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const m=uq({editor:t,rules:h}),g=Array.isArray(m)?m:[m];i.push(...g)}}const f=ke(r,"addPasteRules",s);if(uS(r,t.options.enablePasteRules)&&f){const h=f();if(h&&h.length){const m=mq({editor:t,rules:h});i.push(...m)}}const u=ke(r,"addProseMirrorPlugins",s);if(u){const h=u();i.push(...h)}return i})}get attributes(){return BO(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=hl(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Vt(n.name,this.schema)},i=ke(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,f,u,h)=>{const m=Nh(l,r);return o({node:l,view:c,getPos:f,decorations:u,innerDecorations:h,editor:t,extension:n,HTMLAttributes:m})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return bc([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ul(s.name,this.schema)},o=ke(s,"dispatchTransaction",i);return o?a=>{o.call(i,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return bc([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ul(s.name,this.schema)},o=ke(s,"transformPastedHTML",i);return o?(a,l)=>{const c=r(a,l);return o.call(i,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=hl(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ls(n.name,this.schema)},i=ke(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const f=Nh(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:f,updateAttributes:u=>{cq(a,t,u)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ul(e.name,this.schema)};e.type==="mark"&&(((n=Xe(ke(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=Xe(ke(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=ke(e,"onBeforeCreate",s),o=ke(e,"onCreate",s),a=ke(e,"onUpdate",s),l=ke(e,"onSelectionUpdate",s),c=ke(e,"onTransaction",s),f=ke(e,"onFocus",s),u=ke(e,"onBlur",s),h=ke(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),f&&this.editor.on("focus",f),u&&this.editor.on("blur",u),h&&this.editor.on("destroy",h)})}};Yp.resolve=VO;Yp.sort=bc;Yp.flatten=k0;var gq={};g0(gq,{ClipboardTextSerializer:()=>tA,Commands:()=>nA,Delete:()=>rA,Drop:()=>sA,Editable:()=>iA,FocusEvents:()=>aA,Keymap:()=>lA,Paste:()=>cA,Tabindex:()=>dA,TextDirection:()=>uA,focusEventsPluginKey:()=>oA});var rs=class eA extends _0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new eA(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},tA=rs.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pn({key:new Or("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=UO(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((c,f)=>c.$from.pos-f.$from.pos).map(({$from:c,$to:f})=>WO(r,{from:c.pos,to:f.pos},a)).join(o??`
797
-
798
- `)}}})]}}),nA=rs.create({name:"commands",addCommands(){return{...TO}}}),rA=rs.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const f=LO(t.before,[t,...e]);HO(f).forEach(m=>{f.mapping.mapResult(m.oldRange.from).deletedAfter&&f.mapping.mapResult(m.oldRange.to).deletedBefore&&f.before.nodesBetween(m.oldRange.from,m.oldRange.to,(g,p)=>{const x=p+g.nodeSize-2,y=m.oldRange.from<=p&&x<=m.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:p,to:x,newFrom:f.mapping.map(p),newTo:f.mapping.map(x),deletedRange:m.oldRange,newRange:m.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:f})})});const h=f.mapping;f.steps.forEach((m,g)=>{var p,x;if(m instanceof Zr){const y=h.slice(g).map(m.from,-1),v=h.slice(g).map(m.to),k=h.invert().map(y,-1),w=h.invert().map(v),j=y>0?(p=f.doc.nodeAt(y-1))==null?void 0:p.marks.some(_=>_.eq(m.mark)):!1,C=(x=f.doc.nodeAt(v))==null?void 0:x.marks.some(_=>_.eq(m.mark));this.editor.emit("delete",{type:"mark",mark:m.mark,from:m.from,to:m.to,deletedRange:{from:k,to:w},newRange:{from:y,to:v},partial:!!(C||j),editor:this.editor,transaction:t,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),sA=rs.create({name:"drop",addProseMirrorPlugins(){return[new Pn({key:new Or("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),iA=rs.create({name:"editable",addProseMirrorPlugins(){return[new Pn({key:new Or("editable"),props:{editable:()=>this.editor.options.editable}})]}}),oA=new Or("focusEvents"),aA=rs.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Pn({key:oA,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),lA=rs.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:f,$anchor:u}=l,{pos:h,parent:m}=u,g=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,p=g.parent.type.spec.isolating,x=u.pos-u.parentOffset,y=p&&g.parent.childCount===1?x===u.pos:Be.atStart(c).from===h;return!f||!m.type.isTextblock||m.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return _h()||DO()?i:s},addProseMirrorPlugins(){return[new Pn({key:new Or("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(p=>p.getMeta("composition")))return;const r=t.some(p=>p.docChanged)&&!e.doc.eq(n.doc),s=t.some(p=>p.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=Be.atStart(e.doc).from,c=Be.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!S0(n.doc))return;const h=n.tr,m=Kp({state:n,transaction:h}),{commands:g}=new Jp({editor:this.editor,state:m});if(g.clearNodes(),!!h.steps.length)return h}})]}}),cA=rs.create({name:"paste",addProseMirrorPlugins(){return[new Pn({key:new Or("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),dA=rs.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Pn({key:new Or("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),uA=rs.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=hl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pn({key:new Or("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),yq=class sc{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new sc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new sc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new sc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const c=new sc(l,this.editor,s,s||o?n:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},xq=`.ProseMirror {
799
- position: relative;
800
- }
801
-
802
- .ProseMirror {
803
- word-wrap: break-word;
804
- white-space: pre-wrap;
805
- white-space: break-spaces;
806
- -webkit-font-variant-ligatures: none;
807
- font-variant-ligatures: none;
808
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
809
- }
810
-
811
- .ProseMirror [contenteditable="false"] {
812
- white-space: normal;
813
- }
814
-
815
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
816
- white-space: pre-wrap;
817
- }
818
-
819
- .ProseMirror pre {
820
- white-space: pre-wrap;
821
- }
822
-
823
- img.ProseMirror-separator {
824
- display: inline !important;
825
- border: none !important;
826
- margin: 0 !important;
827
- width: 0 !important;
828
- height: 0 !important;
829
- }
830
-
831
- .ProseMirror-gapcursor {
832
- display: none;
833
- pointer-events: none;
834
- position: absolute;
835
- margin: 0;
836
- }
837
-
838
- .ProseMirror-gapcursor:after {
839
- content: "";
840
- display: block;
841
- position: absolute;
842
- top: -2px;
843
- width: 20px;
844
- border-top: 1px solid black;
845
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
846
- }
847
-
848
- @keyframes ProseMirror-cursor-blink {
849
- to {
850
- visibility: hidden;
851
- }
852
- }
853
-
854
- .ProseMirror-hideselection *::selection {
855
- background: transparent;
856
- }
857
-
858
- .ProseMirror-hideselection *::-moz-selection {
859
- background: transparent;
860
- }
861
-
862
- .ProseMirror-hideselection * {
863
- caret-color: transparent;
864
- }
865
-
866
- .ProseMirror-focused .ProseMirror-gapcursor {
867
- display: block;
868
- }`,vq=class extends YH{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:NH,createMappablePosition:EH},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Zx(e,this.options.autofocus);this.editorState=no.create({doc:e,schema:this.schema,selection:n||void 0})}this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=QH(xq,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=FO(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[iA,tA.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),nA,aA,lA,dA.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),sA,cA,rA,uA.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Yp(i,this)}createCommandManager(){this.commandManager=new Jp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Hx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=Hx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=no.create({doc:n,schema:this.schema,selection:Zx(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new MO(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return ZO(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return _H(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return w0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
869
-
870
- `,textSerializers:n={}}=t||{};return wH(this.state.doc,{blockSeparator:e,textSerializers:{...UO(this.schema),...n}})}get isEmpty(){return S0(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new yq(e,this,!1,n)}get $doc(){return this.$pos(0)}};function pl(t){return new YO({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Xe(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),f=c+o.length;if(b0(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(p=>p===t.type&&p!==m.mark.type)).filter(m=>m.to>c).length)return null;f<n.to&&i.delete(f,n.to),c>n.from&&i.delete(n.from+l,c);const h=n.from+l+o.length;i.addMark(n.from+l,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}var Qp=class fA extends _0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new fA(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Do(t){return new XO({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=Xe(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const f=l.search(/\S/),u=n.from+l.indexOf(a),h=u+a.length;if(b0(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;h<n.to&&o.delete(h,n.to),u>n.from&&o.delete(n.from+f,u),c=n.from+f+a.length,o.addMark(n.from+f,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:kq,getOwnPropertySymbols:wq}=Object,{hasOwnProperty:bq}=Object.prototype;function vg(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function Zl(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),a=i.get(r);if(o&&a)return o===r&&a===n;i.set(n,r),i.set(r,n);const l=t(n,r,s);return i.delete(n),i.delete(r),l}}function Sq(t){return t!=null?t[Symbol.toStringTag]:void 0}function pS(t){return kq(t).concat(wq(t))}const jq=Object.hasOwn||((t,e)=>bq.call(t,e));function Zo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Cq="__v",_q="__o",Nq="_owner",Eq=64,{getOwnPropertyDescriptor:Kx,keys:Eh}=Object,{propertyIsEnumerable:sf}=Object.prototype,$q=Kx(Object.getPrototypeOf(Int8Array.prototype),Symbol.toStringTag).get;function Mq(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t),new Uint8Array(e))}function Tq(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function Oq(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Aq(t,e){return Zo(t.getTime(),e.getTime())}function Rq(t,e,n){if(t.name!==e.name||t.message!==e.message||t.stack!==e.stack)return!1;const r=t.cause,s=e.cause;if(r!==s&&!n.equals(r,s,"cause","cause",t,e,n))return!1;const i=t.errors,o=e.errors;if(i!==o&&!n.equals(i,o,"errors","errors",t,e,n))return!1;const a=Eh(t),l=Eh(e);let c=a.length;if(!c&&!l.length)return!0;let f=0,u;for(;c-- >0;)if(u=a[c],!(u==="cause"||u==="errors")){if(u!==l[c]&&!sf.call(e,u)||!n.equals(t[u],e[u],u,u,t,e,n))return!1;++f}const h=l.length-f;return!h||h===(sf.call(e,"cause")?1:0)+(sf.call(e,"errors")?1:0)}function Iq(t,e){return t===e}function Pq(t,e,n){return t.name===e.name&&t.message===e.message&&t.stack===e.stack&&ca(t,e,n)}function mS(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,a,l=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let f=!1,u=0;for(;(a=c.next())&&!a.done;){if(s[u]){u++;continue}const h=o.value,m=a.value;if(n.equals(h[0],m[0],l,u,t,e,n)&&n.equals(h[1],m[1],h[0],m[0],t,e,n)){f=s[u]=!0;break}u++}if(!f)return!1;l++}return!0}const Dq=Zo;function zq(t,e,n){const r=Eh(t),s=Eh(e);let i=r.length;if(s.length!==i)return!1;const o=i<=Eq;let a;for(;i-- >0;)if(a=r[i],!hA(t,e,a)&&(a!==s[i]&&!(o?s.includes(a):sf.call(e,a))||!n.equals(t[a],e[a],a,a,t,e,n)))return!1;return!0}function ca(t,e,n){const r=pS(t);let s=r.length;if(pS(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!hA(t,e,i)&&(!jq(e,i)||!n.equals(t[i],e[i],i,i,t,e,n))||(o=Kx(t,i),a=Kx(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Lq(t,e){return Zo(t.valueOf(),e.valueOf())}function Fq(t,e){return t.source===e.source&&t.flags===e.flags}function gS(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const l=e.values();let c=!1,f=0;for(;(a=l.next())&&!a.done;){if(!s[f]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=s[f]=!0;break}f++}if(!c)return!1}return!0}function $h(t,e){let n=t.length;if(e.length!==n||t.byteOffset!==e.byteOffset)return!1;const r=$q.call(t);if(r==="Float64Array"||r==="Float32Array"||r==="Float16Array"){for(;n-- >0;)if(t[n]!==e[n]&&(t[n]===t[n]||e[n]===e[n]))return!1;return!0}for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Bq(t,e){return t.href===e.href?!0:t.protocol===e.protocol&&t.username===e.username&&t.password===e.password&&t.host===e.host&&t.pathname===e.pathname&&t.hash===e.hash&&Vq(t.searchParams,e.searchParams)}function Vq(t,e){const n=t.toString(),r=e.toString();return n===r||yS(n)===yS(r)}function yS(t){return t.split("&").sort().join("&")}function hA(t,e,n){return(n===Nq||n===_q||n===Cq)&&!!(t.$$typeof||e.$$typeof)}const Wq="[object ArrayBuffer]",Uq="[object Arguments]",Zq="[object Boolean]",Hq="[object DataView]",qq="[object Date]",Kq="[object Error]",Jq="[object Map]",Gq="[object Number]",Yq="[object Object]",Qq="[object RegExp]",Xq="[object Set]",eK="[object String]",tK={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},nK="[object URL]",rK=Object.prototype.toString;function sK({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:f,areSetsEqual:u,areTypedArraysEqual:h,areUrlsEqual:m,unknownTagComparators:g}){return function(x,y,v){if(x===y)return!0;if(x==null||y==null)return!1;const k=typeof x;if(k!==typeof y)return!1;if(k!=="object")return k==="number"?a(x,y,v):k==="function"?i(x,y,v):!1;const w=x.constructor;if(w!==y.constructor)return!1;if(w===Object)return l(x,y,v);if(Array.isArray(x))return e(x,y,v);if(w===Date)return r(x,y,v);if(w===RegExp)return f(x,y,v);if(w===Map)return o(x,y,v);if(w===Set)return u(x,y,v);if(w==null)return l(x,y,v);const j=rK.call(x);if(j===qq)return r(x,y,v);if(j===Qq)return f(x,y,v);if(j===Jq)return o(x,y,v);if(j===Xq)return u(x,y,v);if(j===Yq)return typeof x.then!="function"&&typeof y.then!="function"&&l(x,y,v);if(j===nK)return m(x,y,v);if(j===Kq)return s(x,y,v);if(j===Uq)return l(x,y,v);if(tK[j])return h(x,y,v);if(j===Wq)return t(x,y,v);if(j===Hq)return n(x,y,v);if(j===Zq||j===Gq||j===eK)return c(x,y,v);if(g){let C=g[j];if(!C){const _=Sq(x);_&&(C=g[_])}if(C)return C(x,y,v)}return!1}}function iK({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Mq,areArraysEqual:n?ca:Tq,areDataViewsEqual:Oq,areDatesEqual:Aq,areErrorsEqual:n?Pq:Rq,areFunctionsEqual:Iq,areMapsEqual:n?vg(mS,ca):mS,areNumbersEqual:Dq,areObjectsEqual:n?ca:zq,arePrimitiveWrappersEqual:Lq,areRegExpsEqual:Fq,areSetsEqual:n?vg(gS,ca):gS,areTypedArraysEqual:n?vg($h,ca):$h,areUrlsEqual:Bq,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Zl(r.areArraysEqual),i=Zl(r.areErrorsEqual),o=Zl(r.areMapsEqual),a=Zl(r.areObjectsEqual),l=Zl(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areErrorsEqual:i,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function oK(t){return function(e,n,r,s,i,o,a){return t(e,n,a)}}function aK({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:f}=n();return e(a,l,{cache:c,equals:r,meta:f,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,i)}}const lK=Vi();Vi({strict:!0});Vi({circular:!0});Vi({circular:!0,strict:!0});Vi({createInternalComparator:()=>Zo});Vi({strict:!0,createInternalComparator:()=>Zo});Vi({circular:!0,createInternalComparator:()=>Zo});Vi({circular:!0,createInternalComparator:()=>Zo,strict:!0});function Vi(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=iK(t),o=sK(i),a=n?n(o):oK(o);return aK({circular:e,comparator:o,createState:r,equals:a,strict:s})}var pA={exports:{}},mA={};/**
871
- * @license React
872
- * use-sync-external-store-shim/with-selector.production.js
873
- *
874
- * Copyright (c) Meta Platforms, Inc. and affiliates.
875
- *
876
- * This source code is licensed under the MIT license found in the
877
- * LICENSE file in the root directory of this source tree.
878
- */var Xp=b,cK=Q1;function dK(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var uK=typeof Object.is=="function"?Object.is:dK,fK=cK.useSyncExternalStore,hK=Xp.useRef,pK=Xp.useEffect,mK=Xp.useMemo,gK=Xp.useDebugValue;mA.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=hK(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=mK(function(){function l(m){if(!c){if(c=!0,f=m,m=r(m),s!==void 0&&o.hasValue){var g=o.value;if(s(g,m))return u=g}return u=m}if(g=u,uK(f,m))return g;var p=r(m);return s!==void 0&&s(g,p)?(f=m,g):(f=m,u=p)}var c=!1,f,u,h=n===void 0?null:n;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,n,r,s]);var a=fK(t,i[0],i[1]);return pK(function(){o.hasValue=!0,o.value=a},[a]),gK(a),a};pA.exports=mA;var yK=pA.exports,xK=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},vK=({contentComponent:t})=>{const e=Q1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return d.jsx(d.Fragment,{children:Object.values(e)})};function kK(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:kR.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var wK=class extends wr.Component{constructor(t){super(t),this.editorContentRef=wr.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=kK(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:xK(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&d.jsx(vK,{contentComponent:t.contentComponent})]})}},bK=b.forwardRef((t,e)=>{const n=wr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return wr.createElement(wK,{key:n,innerRef:e,...t})}),N0=wr.memo(bK),SK=typeof window<"u"?b.useLayoutEffect:b.useEffect,jK=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{(s==null?void 0:s.transaction)!==void 0&&s.transaction===e||(e=s==null?void 0:s.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function CK(t){var e;const[n]=b.useState(()=>new jK(t.editor)),r=yK.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:lK);return SK(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var _K=!1,gA=typeof window>"u",NK=gA||!!(typeof window<"u"&&window.next),EK=class yA{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return gA?(n&&_K&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):NK&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)},onMount:(...r)=>{var s,i;return(i=(s=this.options.current).onMount)==null?void 0:i.call(s,...r)},onUnmount:(...r)=>{var s,i;return(i=(s=this.options.current).onUnmount)==null?void 0:i.call(s,...r)}};return new vq(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?yA.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function xA(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new EK(n)),s=Q1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),CK({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var vA=b.createContext({editor:null});vA.Consumer;var $K=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),MK=()=>b.useContext($K);wr.forwardRef((t,e)=>{const{onDragStart:n}=MK(),r=t.as||"div";return d.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});wr.createContext({markViewContentRef:()=>{}});var E0=b.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});E0.displayName="TiptapContext";var TK=()=>b.useContext(E0);function kA({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=b.useMemo(()=>({editor:n}),[n]),s=b.useMemo(()=>({editor:n}),[n]);return d.jsx(vA.Provider,{value:s,children:d.jsx(E0.Provider,{value:r,children:t})})}kA.displayName="Tiptap";function wA({...t}){const{editor:e}=TK();return d.jsx(N0,{editor:e,...t})}wA.displayName="Tiptap.Content";Object.assign(kA,{Content:wA});var OK=Qp.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
879
-
880
- `):""}),bA=OK,Tu="&nbsp;",kg=" ",AK=Qp.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Di(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Tu||n[0].text===Tu||n[0].raw===kg||n[0].text===kg)&&r.length===1&&r[0].type==="text"&&(r[0].text===Tu||r[0].text===kg)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?Tu:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),SA=AK,RK=Qp.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),jA=RK,xS=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},IK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,PK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,DK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,zK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,LK=Zd.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return xS("strong",{...Di(this.options.HTMLAttributes,t),children:xS("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[pl({find:IK,type:this.type}),pl({find:DK,type:this.type})]},addPasteRules(){return[Do({find:PK,type:this.type}),Do({find:zK,type:this.type})]}}),FK=LK,BK=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,VK=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,WK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,UK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ZK=Zd.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Di(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[pl({find:BK,type:this.type}),pl({find:WK,type:this.type})]},addPasteRules(){return[Do({find:VK,type:this.type}),Do({find:UK,type:this.type})]}}),HK=ZK,qK=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},KK=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},JK=Zd.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Di(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[pl({find:qK,type:this.type})]},addPasteRules(){return[Do({find:KK,type:this.type})]}}),GK=JK;const YK="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos6kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12b0cam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",QK="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Jx="numeric",Gx="ascii",Yx="alpha",Sc="asciinumeric",ic="alphanumeric",Qx="domain",CA="emoji",XK="scheme",eJ="slashscheme",wg="whitespace";function tJ(t,e){return t in e||(e[t]=[]),e[t]}function io(t,e,n){e[Jx]&&(e[Sc]=!0,e[ic]=!0),e[Gx]&&(e[Sc]=!0,e[Yx]=!0),e[Sc]&&(e[ic]=!0),e[Yx]&&(e[ic]=!0),e[ic]&&(e[Qx]=!0),e[CA]&&(e[Qx]=!0);for(const r in e){const s=tJ(r,n);s.indexOf(t)<0&&s.push(t)}}function nJ(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Nn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nn.groups={};Nn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Nn.groups;let s;return e&&e.j?s=e:(s=new Nn(e),n&&r&&io(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Nn.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Nn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Nn,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(nJ(o.t,r),n);io(i,l,r)}else n&&io(i,n,r);o.t=i}return s.j[t]=o,o}};const Re=(t,e,n,r,s)=>t.ta(e,n,r,s),ht=(t,e,n,r,s)=>t.tr(e,n,r,s),vS=(t,e,n,r,s)=>t.ts(e,n,r,s),Y=(t,e,n,r,s)=>t.tt(e,n,r,s),us="WORD",Xx="UWORD",_A="ASCIINUMERICAL",NA="ALPHANUMERICAL",pd="LOCALHOST",ev="TLD",tv="UTLD",of="SCHEME",da="SLASH_SCHEME",$0="NUM",nv="WS",M0="NL",jc="OPENBRACE",Cc="CLOSEBRACE",Mh="OPENBRACKET",Th="CLOSEBRACKET",Oh="OPENPAREN",Ah="CLOSEPAREN",Rh="OPENANGLEBRACKET",Ih="CLOSEANGLEBRACKET",Ph="FULLWIDTHLEFTPAREN",Dh="FULLWIDTHRIGHTPAREN",zh="LEFTCORNERBRACKET",Lh="RIGHTCORNERBRACKET",Fh="LEFTWHITECORNERBRACKET",Bh="RIGHTWHITECORNERBRACKET",Vh="FULLWIDTHLESSTHAN",Wh="FULLWIDTHGREATERTHAN",Uh="AMPERSAND",Zh="APOSTROPHE",Hh="ASTERISK",Ys="AT",qh="BACKSLASH",Kh="BACKTICK",Jh="CARET",oo="COLON",T0="COMMA",Gh="DOLLAR",Pr="DOT",Yh="EQUALS",O0="EXCLAMATION",Xn="HYPHEN",_c="PERCENT",Qh="PIPE",Xh="PLUS",Ca="POUND",Ji="QUERY",A0="QUOTE",EA="FULLWIDTHMIDDLEDOT",R0="SEMI",Dr="SLASH",Nc="TILDE",ep="UNDERSCORE",$A="EMOJI",tp="SYM";var MA=Object.freeze({__proto__:null,ALPHANUMERICAL:NA,AMPERSAND:Uh,APOSTROPHE:Zh,ASCIINUMERICAL:_A,ASTERISK:Hh,AT:Ys,BACKSLASH:qh,BACKTICK:Kh,CARET:Jh,CLOSEANGLEBRACKET:Ih,CLOSEBRACE:Cc,CLOSEBRACKET:Th,CLOSEPAREN:Ah,COLON:oo,COMMA:T0,DOLLAR:Gh,DOT:Pr,EMOJI:$A,EQUALS:Yh,EXCLAMATION:O0,FULLWIDTHGREATERTHAN:Wh,FULLWIDTHLEFTPAREN:Ph,FULLWIDTHLESSTHAN:Vh,FULLWIDTHMIDDLEDOT:EA,FULLWIDTHRIGHTPAREN:Dh,HYPHEN:Xn,LEFTCORNERBRACKET:zh,LEFTWHITECORNERBRACKET:Fh,LOCALHOST:pd,NL:M0,NUM:$0,OPENANGLEBRACKET:Rh,OPENBRACE:jc,OPENBRACKET:Mh,OPENPAREN:Oh,PERCENT:_c,PIPE:Qh,PLUS:Xh,POUND:Ca,QUERY:Ji,QUOTE:A0,RIGHTCORNERBRACKET:Lh,RIGHTWHITECORNERBRACKET:Bh,SCHEME:of,SEMI:R0,SLASH:Dr,SLASH_SCHEME:da,SYM:tp,TILDE:Nc,TLD:ev,UNDERSCORE:ep,UTLD:tv,UWORD:Xx,WORD:us,WS:nv});const as=/[a-z]/;let ua=/[a-z]/i,af=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}]|\u{FE0F}/u;try{ua=new RegExp("\\p{L}","u"),af=new RegExp("\\p{Emoji}","u")}catch{}const ls=/\d/,bg=/\s/,kS="\r",Sg=`
881
- `,rJ="️",sJ="‍",jg="";let Ou=null,Au=null;function iJ(t=[]){const e={};Nn.groups=e;const n=new Nn;Ou==null&&(Ou=wS(YK)),Au==null&&(Au=wS(QK)),Y(n,"'",Zh),Y(n,"{",jc),Y(n,"}",Cc),Y(n,"[",Mh),Y(n,"]",Th),Y(n,"(",Oh),Y(n,")",Ah),Y(n,"<",Rh),Y(n,">",Ih),Y(n,"(",Ph),Y(n,")",Dh),Y(n,"「",zh),Y(n,"」",Lh),Y(n,"『",Fh),Y(n,"』",Bh),Y(n,"<",Vh),Y(n,">",Wh),Y(n,"&",Uh),Y(n,"*",Hh),Y(n,"@",Ys),Y(n,"`",Kh),Y(n,"^",Jh),Y(n,":",oo),Y(n,",",T0),Y(n,"$",Gh),Y(n,".",Pr),Y(n,"=",Yh),Y(n,"!",O0),Y(n,"-",Xn),Y(n,"%",_c),Y(n,"|",Qh),Y(n,"+",Xh),Y(n,"#",Ca),Y(n,"?",Ji),Y(n,'"',A0),Y(n,"/",Dr),Y(n,";",R0),Y(n,"~",Nc),Y(n,"_",ep),Y(n,"\\",qh),Y(n,"・",EA);const r=ht(n,ls,$0,{[Jx]:!0});ht(r,ls,r);const s=ht(r,as,_A,{[Sc]:!0}),i=ht(r,ua,NA,{[ic]:!0}),o=ht(n,as,us,{[Gx]:!0});ht(o,ls,s),ht(o,as,o),ht(s,ls,s),ht(s,as,s);const a=ht(n,ua,Xx,{[Yx]:!0});ht(a,as),ht(a,ls,i),ht(a,ua,a),ht(i,ls,i),ht(i,as),ht(i,ua,i);const l=Y(n,Sg,M0,{[wg]:!0}),c=Y(n,kS,nv,{[wg]:!0}),f=ht(n,bg,nv,{[wg]:!0});Y(n,jg,f),Y(c,Sg,l),Y(c,jg,f),ht(c,bg,f),Y(f,kS),Y(f,Sg),ht(f,bg,f),Y(f,jg,f);const u=ht(n,af,$A,{[CA]:!0});Y(u,"#"),ht(u,af,u),Y(u,rJ,u);const h=Y(u,sJ);Y(h,"#"),ht(h,af,u);const m=[[as,o],[ls,s]],g=[[as,null],[ua,a],[ls,i]];for(let p=0;p<Ou.length;p++)Vs(n,Ou[p],ev,us,m);for(let p=0;p<Au.length;p++)Vs(n,Au[p],tv,Xx,g);io(ev,{tld:!0,ascii:!0},e),io(tv,{utld:!0,alpha:!0},e),Vs(n,"file",of,us,m),Vs(n,"mailto",of,us,m),Vs(n,"http",da,us,m),Vs(n,"https",da,us,m),Vs(n,"ftp",da,us,m),Vs(n,"ftps",da,us,m),io(of,{scheme:!0,ascii:!0},e),io(da,{slashscheme:!0,ascii:!0},e),t=t.sort((p,x)=>p[0]>x[0]?1:-1);for(let p=0;p<t.length;p++){const x=t[p][0],v=t[p][1]?{[XK]:!0}:{[eJ]:!0};x.indexOf("-")>=0?v[Qx]=!0:as.test(x)?ls.test(x)?v[Sc]=!0:v[Gx]=!0:v[Jx]=!0,vS(n,x,x,v)}return vS(n,"localhost",pd,{ascii:!0}),n.jd=new Nn(tp),{start:n,tokens:Object.assign({groups:e},MA)}}function TA(t,e){const n=oJ(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,f=null,u=-1,h=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(u=0,h=0,f=a):u>=0&&(u+=n[o].length,h++),c+=n[o].length,i+=n[o].length,o++;i-=u,o-=h,c-=u,s.push({t:f.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function oJ(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Vs(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Nn(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Nn(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function wS(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const md={defaultProtocol:"http",events:null,format:bS,formatHref:bS,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function I0(t,e=null){let n=Object.assign({},md);t&&(n=Object.assign(n,t instanceof I0?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s,this.ignoreClasses=n.ignoreClasses.slice()}I0.prototype={o:md,ignoreTags:[],ignoreClasses:[],isIgnoredClass(t){if(typeof t!="string"||this.ignoreClasses.length===0)return!1;const e=t.split(/\s+/);for(let n=0;n<e.length;n++)if(this.ignoreClasses.indexOf(e[n])>=0)return!0;return!1},defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:md[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function bS(t){return t}function OA(t,e){this.t="token",this.v=t,this.tk=e}OA.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=md.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),f=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),f&&Object.assign(o,f),{tagName:s,attributes:o,content:i,eventListeners:u}}};function em(t,e){class n extends OA{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const aJ=em("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),SS=em("text"),lJ=em("nl"),Ru=em("url",{isLink:!0,toHref(t=md.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==pd&&t[1].t===oo}}),Qn=t=>new Nn(t);function cJ({groups:t}){const e=t.domain.concat([Uh,Hh,Ys,qh,Kh,Jh,Gh,Yh,Xn,$0,_c,Qh,Xh,Ca,Dr,tp,Nc,ep]),n=[Zh,oo,T0,Pr,O0,_c,Ji,A0,R0,Rh,Ih,jc,Cc,Th,Mh,Oh,Ah,Ph,Dh,zh,Lh,Fh,Bh,Vh,Wh],r=[Uh,Zh,Hh,qh,Kh,Jh,Gh,Yh,Xn,jc,Cc,_c,Qh,Xh,Ca,Ji,Dr,tp,Nc,ep],s=Qn(),i=Y(s,Nc);Re(i,r,i),Re(i,t.domain,i);const o=Qn(),a=Qn(),l=Qn();Re(s,t.domain,o),Re(s,t.scheme,a),Re(s,t.slashscheme,l),Re(o,r,i),Re(o,t.domain,o);const c=Y(o,Ys);Y(i,Ys,c),Y(a,Ys,c),Y(l,Ys,c);const f=Y(i,Pr);Re(f,r,i),Re(f,t.domain,i);const u=Qn();Re(c,t.domain,u),Re(u,t.domain,u);const h=Y(u,Pr);Re(h,t.domain,u);const m=Qn(aJ);Re(h,t.tld,m),Re(h,t.utld,m),Y(c,pd,m);const g=Y(u,Xn);Y(g,Xn,g),Re(g,t.domain,u),Re(m,t.domain,u),Y(m,Pr,h),Y(m,Xn,g);const p=Y(o,Xn),x=Y(o,Pr);Y(p,Xn,p),Re(p,t.domain,o),Re(x,r,i),Re(x,t.domain,o);const y=Qn(Ru);Re(x,t.tld,y),Re(x,t.utld,y),Re(y,t.domain,o),Re(y,r,i),Y(y,Pr,x),Y(y,Xn,p),Y(y,Ys,c);const v=Y(y,oo),k=Qn(Ru);Re(v,t.numeric,k);const w=Qn(Ru),j=Qn();Re(w,e,w),Re(w,n,j),Re(j,e,w),Re(j,n,j),Y(y,Dr,w),Y(k,Dr,w),Y(y,Ji,j),Y(y,Ca,w),Y(k,Ji,j),Y(k,Ca,w);const C=Y(a,oo),_=Y(l,oo),S=Y(_,Dr),N=Y(S,Dr);Re(a,t.domain,o),Y(a,Pr,x),Y(a,Xn,p),Re(l,t.domain,o),Y(l,Pr,x),Y(l,Xn,p),Re(C,t.domain,w),Y(C,Dr,w),Y(C,Ji,w),Re(N,t.domain,w),Re(N,e,w),Y(N,Dr,w);const E=[[jc,Cc],[Mh,Th],[Oh,Ah],[Rh,Ih],[Ph,Dh],[zh,Lh],[Fh,Bh],[Vh,Wh]];for(let P=0;P<E.length;P++){const[z,I]=E[P],F=Y(w,z);Y(j,z,F);const U=Qn(Ru);Re(F,e,U);const M=Qn();Re(F,n,M),Y(F,I,w),Re(U,e,U),Re(U,n,M),Re(M,e,U),Re(M,n,M),Y(U,I,w),Y(M,I,w)}return Y(s,pd,y),Y(s,M0,lJ),{start:s,tokens:MA}}function dJ(t,e,n){let r=n.length,s=0,i=[],o=[];const a=[];for(;s<r;){let l=t,c=null,f=null,u=0,h=null,m=-1,g=[];for(;s<r&&!(c=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(f=c||l.go(n[s].t));)if(c=null,l=f,s++,u++,l.accepts())m=0,h=l,g=[];else if(m>=0&&m++,g.push(l),a[s]&&a[s].has(l))break;for(let p=0,x=s-g.length+1;p<g.length;p++,x++)(a[x]||(a[x]=new Set)).add(g[p]);if(m<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Cg(SS,e,o)),o=[]),s-=m,u-=m;const p=h.t,x=n.slice(s-u,s);i.push(Cg(p,e,x))}}return o.length>0&&i.push(Cg(SS,e,o)),i}function Cg(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const uJ=typeof console<"u"&&console&&console.warn||(()=>{}),fJ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hJ(){return Nn.groups={},nt.scanner=null,nt.parser=null,nt.tokenQueue=[],nt.pluginQueue=[],nt.customSchemes=[],nt.initialized=!1,nt}function jS(t,e=!1){if(nt.initialized&&uJ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${fJ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
882
- 1. Must only contain digits, lowercase ASCII letters or "-"
883
- 2. Cannot start or end with "-"
884
- 3. "-" cannot repeat`);nt.customSchemes.push([t,e])}function pJ(){nt.scanner=iJ(nt.customSchemes);for(let t=0;t<nt.tokenQueue.length;t++)nt.tokenQueue[t][1]({scanner:nt.scanner});nt.parser=cJ(nt.scanner.tokens);for(let t=0;t<nt.pluginQueue.length;t++)nt.pluginQueue[t][1]({scanner:nt.scanner,parser:nt.parser});return nt.initialized=!0,nt}function P0(t){return nt.initialized||pJ(),dJ(nt.parser.start,t,TA(nt.scanner.start,t))}P0.scan=TA;function AA(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new I0(n),s=P0(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var D0="[\0-   ᠎ -\u2029  ]",mJ=new RegExp(D0),gJ=new RegExp(`${D0}$`),yJ=new RegExp(D0,"g");function xJ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function vJ(t){return new Pn({key:new Or("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=LO(n.doc,[...e]);if(HO(a).forEach(({newRange:c})=>{const f=pH(r.doc,c,m=>m.isTextblock);let u,h;if(f.length>1)u=f[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(f.length){const m=r.doc.textBetween(c.from,c.to," "," ");if(!gJ.test(m))return;u=f[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const m=h.split(mJ).filter(Boolean);if(m.length<=0)return!1;const g=m[m.length-1],p=u.pos+h.lastIndexOf(g);if(!g)return!1;const x=P0(g).map(y=>y.toObject(t.defaultProtocol));if(!xJ(x))return!1;x.filter(y=>y.isLink).map(y=>({...y,from:p+y.start+1,to:p+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{b0(y.from,y.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function kJ(t){return new Pn({key:new Or("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=ZO(e.state,t.type.name),c=(s=o.href)!=null?s:l.href,f=(i=o.target)!=null?i:l.target;c&&(window.open(c,f),a=!0)}return a}}})}var wJ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,bJ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function RA(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function SJ(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&RA(t,r)){r+=1;continue}let s=0;for(;r<e&&t[r]==="`";)s+=1,r+=1;n===0?n=s:s===n&&(n=0)}return n>0}function IA(t,e,n){var r,s;const[,i,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||RA(t,(r=e.index)!=null?r:0)||SJ(t,(s=e.index)!=null?s:0)?!1:!!i.trim()&&n(o)}function PA(t){var e,n;const[r,s,i,,o,a,l]=t,c=(e=o??a)!=null?e:l;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:s,data:{href:i,title:c||null,markdown:!0}}}function jJ(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function DA(t){var e,n,r;return{href:(e=t.data)==null?void 0:e.href,title:(r=(n=t.data)==null?void 0:n.title)!=null?r:null}}function CJ(t){const e=pl({find:n=>{const r=wJ.exec(n);return!r||!IA(n,r,t.isAllowedHref)?null:PA(r)},type:t.type,getAttributes:DA});return new YO({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function _J(t){const e=Do({find:n=>{var r,s;const i=[];for(const a of n.matchAll(bJ))IA(n,a,t.isAllowedHref)&&i.push(PA(a));const o=((s=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?s:[]).filter(a=>!i.some(l=>jJ(l,a)));return[...i,...o]},type:t.type,getAttributes:DA});return new XO({find:e.find,handler:n=>{var r;const s=e.handler(n);return s!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),s}})}function NJ(t){return new Pn({key:new Or("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(f=>{l+=f.textContent});const c=AA(l,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===l);return!l||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function cs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(yJ,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var EJ=Zd.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){jS(t);return}jS(t.scheme,t.optionalSlashes)})},onDestroy(){hJ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!cs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!cs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!cs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Di(this.options.HTMLAttributes,t),0]:["a",Di(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[CJ({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!cs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;AA(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!cs(a,r),protocols:r,defaultProtocol:s})).forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n};return this.options.markdownLinks?[_J({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!cs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Do({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(vJ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!cs(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(kJ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(NJ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),$J=EJ;function Ln({value:t,onSave:e,as:n="span",className:r="",multiline:s=!1,label:i,id:o}){const[a,l]=b.useState(!1);if(a)return d.jsx(MJ,{value:t,multiline:s,className:r,label:i,onDone:f=>{l(!1),f!==void 0&&f.trim()&&f!==t&&e(f)}});const c=()=>{var f;(f=window.getSelection())!=null&&f.toString()||l(!0)};return d.jsx(n,{id:o,className:`${r} -mx-1 cursor-text rounded-md px-1 transition-[background-color] hover:bg-sunken/60 focus-visible:bg-sunken/60`,tabIndex:0,title:"Click to edit","aria-description":`${i}. Press Enter to edit.`,onClick:f=>{f.target.closest("a")||c()},onKeyDown:f=>{f.key==="Enter"&&f.target===f.currentTarget&&(f.preventDefault(),l(!0))},children:d.jsx(rl,{text:t,multiline:s})})}function MJ({value:t,multiline:e,className:n,label:r,onDone:s}){const i=b.useRef(null),o=b.useRef(!1),a=(f,u)=>{o.current||(o.current=!0,s(u&&f?AJ(f.getJSON()):void 0))},l=xA({extensions:[bA,SA,jA,FK,HK,GK,$J.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0})],content:OJ(t,e),autofocus:"end",immediatelyRender:!0,editorProps:{attributes:{class:"outline-none [&>p+p]:mt-[0.8em]","aria-label":r,role:"textbox","aria-multiline":String(e)},handleKeyDown:(f,u)=>u.key==="Escape"?(a(null,!1),!0):u.key==="Enter"&&!u.shiftKey&&(!e||u.metaKey||u.ctrlKey)?(a(c.current,!0),!0):!1},onBlur:({editor:f,event:u})=>{var h;u.relatedTarget instanceof Node&&((h=i.current)!=null&&h.contains(u.relatedTarget))||a(f,!0)}}),c=b.useRef(null);return c.current=l,d.jsxs("div",{className:`${n} relative -mx-1 rounded-md bg-raised px-1 ring-2 ring-poney/50`,children:[d.jsx(TJ,{editor:l,bar:i}),d.jsx(N0,{editor:l})]})}function TJ({editor:t,bar:e}){const[n,r]=b.useState(!1),[s,i]=b.useState("");if(!t)return null;const o=(l,c,f,u,h)=>d.jsx("button",{type:"button","aria-label":c,"aria-pressed":l,title:`${c} (${h})`,onMouseDown:m=>m.preventDefault(),onClick:u,className:`grid h-7 w-7 place-items-center rounded-md ${l?"bg-ink text-paper":"text-ink-2 hover:bg-sunken"}`,children:f}),a=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+";return d.jsxs("div",{ref:e,className:"absolute -top-10 left-0 z-20 flex items-center gap-0.5 rounded-lg border border-rule bg-raised p-0.5 font-sans text-[13px] font-normal leading-none tracking-normal shadow-float",children:[o(t.isActive("bold"),"Bold",d.jsx(PD,{size:14}),()=>t.chain().focus().toggleBold().run(),`${a}B`),o(t.isActive("italic"),"Italic",d.jsx(AD,{size:14}),()=>t.chain().focus().toggleItalic().run(),`${a}I`),o(t.isActive("code"),"Code",d.jsx(jD,{size:14}),()=>t.chain().focus().toggleCode().run(),`${a}E`),o(t.isActive("link"),"Link",d.jsx(zD,{size:14}),()=>{if(t.isActive("link"))return void t.chain().focus().unsetLink().run();i(""),r(!0)},"paste a URL on a selection"),n&&d.jsx("form",{className:"flex items-center gap-1 pl-1",onSubmit:l=>{l.preventDefault(),s.trim()?t.chain().focus().setLink({href:s.trim()}).run():t.commands.focus(),r(!1)},children:d.jsx("input",{autoFocus:!0,value:s,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Escape"&&(r(!1),t.commands.focus()),placeholder:"https://","aria-label":"Link address",className:"h-7 w-56 rounded-md border border-rule bg-paper px-2 text-[12.5px] outline-none focus:border-rule-strong"})})]})}function OJ(t,e){const n=e?i1(t):[t.replace(/\n+/g," ")];return{type:"doc",content:(n.length?n:[""]).map(r=>{const s=Oa(r).map(i=>({type:"text",text:i.text,marks:[...i.marks.map(o=>({type:o})),...i.href?[{type:"link",attrs:{href:i.href}}]:[]]}));return s.length?{type:"paragraph",content:s}:{type:"paragraph"}})}}function AJ(t){return(t.content??[]).map(e=>EP((e.content??[]).map(n=>{var i,o,a;const r=(n.marks??[]).map(l=>l.type).filter(l=>l==="bold"||l==="italic"||l==="code"),s=(a=(o=(i=n.marks)==null?void 0:i.find(l=>l.type==="link"))==null?void 0:o.attrs)==null?void 0:a.href;return{text:n.text??"",marks:r,...s?{href:s}:{}}})).trim()).filter(Boolean).join(`
885
-
886
- `)}function RJ({block:t,onEditNote:e}){var m,g;const n=l7(t),r=T(Id),s=t.hunks.flatMap(p=>p.lines),i=s.filter(p=>p.kind==="add").length,o=s.filter(p=>p.kind==="del").length,a=i===0&&o===0&&s.every(p=>p.old===void 0),l=(m=s[0])==null?void 0:m.new,c=(g=s[s.length-1])==null?void 0:g.new,f=new Map;t.notes.forEach((p,x)=>f.set(p.line,[...f.get(p.line)??[],{text:p.text,index:x}]));const u=t.path.split("/").slice(-2).join("/"),h=(p,x)=>yT(t.path,p,x);return d.jsxs("figure",{className:"overflow-hidden rounded-xl border border-rule bg-raised",children:[d.jsxs("figcaption",{className:"flex min-w-0 items-center gap-2 border-b border-rule px-3.5 py-2.5 text-[12.5px]",children:[d.jsx(jp,{size:14,className:"shrink-0 text-ink-3","aria-hidden":!0}),d.jsx("code",{className:"min-w-0 truncate font-mono text-[12px] text-ink",title:t.path,children:u}),t.title&&d.jsx("span",{className:"shrink-0 text-ink-3",children:t.title}),d.jsx("span",{className:"flex-1"}),a?l!==void 0&&d.jsx("span",{className:"font-tabular shrink-0 font-mono text-[11.5px] text-ink-3",children:l===c?`line ${l}`:`lines ${l}–${c}`}):d.jsxs("span",{className:"font-tabular shrink-0 font-mono text-[11.5px]",children:[d.jsxs("span",{className:"text-new",children:["+",i]})," ",d.jsxs("span",{className:"text-removed",children:["−",o]})]})]}),d.jsx("div",{className:"scrollbar-quiet overflow-x-auto",children:d.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[21px] [font-variant-ligatures:none]",children:d.jsx("tbody",{children:t.hunks.map((p,x)=>d.jsxs(b.Fragment,{children:[p.header&&d.jsx("tr",{children:d.jsx("td",{colSpan:a?2:4,className:"bg-sunken/60 px-3.5 py-1 text-[11px] text-ink-3",children:p.header})}),p.lines.map((y,v)=>{var C;const k=y.kind==="add"?"bg-new-wash":y.kind==="del"?"bg-removed-wash":"",w=y.kind==="add"?"+":y.kind==="del"?"−":"",j=y.kind!=="del"&&y.new?f.get(y.new):void 0;return d.jsxs(b.Fragment,{children:[d.jsxs("tr",{className:`group/line ${k}`,onContextMenu:y.new!==void 0?Ib(t.path,y.new,y.text):void 0,children:[!a&&d.jsx("td",{className:"w-10 select-none pr-1 text-right align-top text-ink-4",children:y.old??""}),d.jsxs("td",{className:`relative w-10 select-none text-right align-top text-ink-4 ${a?"pr-4":"pr-2"}`,children:[d.jsx("span",{className:r&&y.new?"group-hover/line:invisible":"",children:y.new??""}),r&&y.new!==void 0&&d.jsx("button",{type:"button",title:"Ask the agent about this line","aria-label":`Ask the agent about line ${y.new}`,onClick:()=>to(h(y.new,y.text)),className:`absolute inset-y-0 grid place-items-center text-poney opacity-0 focus-visible:opacity-100 group-hover/line:opacity-100 ${a?"right-3":"right-1"}`,children:d.jsx(WD,{size:14})})]}),!a&&d.jsx("td",{className:`w-4 select-none align-top ${y.kind==="add"?"text-new":"text-removed"}`,children:w}),d.jsx("td",{className:"whitespace-pre pr-4 text-ink",children:((C=n==null?void 0:n.get(`${x}:${v}`))==null?void 0:C.map((_,S)=>d.jsx("span",{className:"code-token",style:_.style,children:_.content},S)))??(y.text||" ")})]}),j==null?void 0:j.map(_=>d.jsxs("tr",{onContextMenu:y.new!==void 0?Ib(t.path,y.new,y.text,_.text):void 0,children:[d.jsx("td",{colSpan:a?1:3}),d.jsx("td",{className:"py-1.5 pr-4",children:d.jsxs("span",{className:"inline-flex max-w-[56ch] items-start gap-2 whitespace-normal rounded-lg border border-rule bg-paper px-2.5 py-1.5 font-sans text-[12.5px] leading-snug text-ink-2",children:[d.jsx(UD,{size:13,className:"mt-0.5 shrink-0 text-ink-3","aria-hidden":!0}),e?d.jsx(Ln,{label:"Note on the code",value:_.text,onSave:S=>e(_.index,S),className:"min-w-[8ch]"}):_.text]})})]},`n${_.index}`))]},v)})]},x))})})})]})}function _g(t,e){const[n,r]=b.useState(()=>{try{const i=localStorage.getItem(t);return i?JSON.parse(i):e}catch{return e}}),s=b.useCallback(i=>{r(i);try{localStorage.setItem(t,JSON.stringify(i))}catch{}window.dispatchEvent(new Event("poney:local"))},[t]);return[n,s]}function rv({risk:t}){return t==="look"?d.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-changed/40 bg-changed-wash px-2.5 py-0.5 text-[12px] font-semibold text-changed",children:[d.jsx($d,{size:12,strokeWidth:2.4})," Look closely"]}):d.jsx("span",{className:"inline-flex items-center rounded-full border border-rule bg-sunken/70 px-2.5 py-0.5 text-[12px] font-semibold text-ink-2",children:"Routine"})}function CS({mode:t,onChange:e}){const n=[{id:"before",label:"Before"},{id:"change",label:"Change"},{id:"after",label:"After"}];return d.jsx("div",{role:"radiogroup","aria-label":"Show the system",className:"inline-flex rounded-lg border border-rule bg-sunken/60 p-0.5",children:n.map(r=>d.jsx("button",{role:"radio","aria-checked":t===r.id,type:"button",onClick:()=>e(r.id),className:`h-7 rounded-md px-3 text-[12.5px] font-medium transition-colors ${t===r.id?"bg-raised text-ink shadow-[0_1px_2px_#0000001a]":"text-ink-3 hover:text-ink"}`,children:r.label},r.id))})}function _S(){return d.jsx("div",{className:"flex items-center gap-3 text-[12px] text-ink-3","aria-label":"Key",children:["new","changed","removed"].map(t=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:"h-2.5 w-2.5 rounded-full border-[1.5px]",style:{borderColor:`var(--${t})`,background:`var(--${t}-wash)`}}),l1[t]]},t))})}function NS({walkthrough:t}){var o;const e=ze(),n=T(a=>a.selection),r=T(a=>a.select);if(!n||!e.exists(n))return null;const s=e.describe(n),i=t==null?void 0:t.marks.find(a=>{const l=an(a.ref);return l&&de(l)===de(n)});return d.jsxs("div",{className:"fade-in absolute bottom-4 left-4 z-10 w-[300px] rounded-xl border border-rule bg-raised p-3.5 shadow-float",children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"text-[11.5px] text-ink-3",children:s.kind}),d.jsx("div",{className:"text-[14px] font-semibold leading-snug",children:s.title})]}),d.jsx("button",{type:"button","aria-label":"Close",className:"rounded p-0.5 text-ink-3 hover:bg-sunken hover:text-ink",onClick:()=>r(null),children:d.jsx(Bo,{size:14})})]}),s.summary&&d.jsx("p",{className:"mt-1.5 text-[12.5px] leading-snug text-ink-2",children:s.summary}),n.kind==="entity"&&(((o=e.entities.get(n.id))==null?void 0:o.sourceRefs.length)??0)>0&&d.jsx("ul",{className:"mt-2 space-y-0.5",children:e.entities.get(n.id).sourceRefs.map((a,l)=>d.jsxs("li",{className:"flex min-w-0 items-center gap-1.5 text-ink-3",children:[d.jsx(jp,{size:12,className:"shrink-0","aria-hidden":!0}),d.jsxs("code",{className:"truncate font-mono text-[11.5px]",title:a.path,children:[a.path,a.line?`:${a.line}`:"",a.symbol?` › ${a.symbol}`:""]})]},l))}),i&&d.jsxs("p",{className:"mt-2 text-[12.5px] leading-snug",children:[d.jsx("span",{className:"font-semibold",style:{color:`var(--${i.state})`},children:l1[i.state]}),i.note?d.jsxs("span",{className:"text-ink-2",children:[": ",i.note]}):" in this change"]}),d.jsxs("button",{type:"button",onClick:()=>Pd(n),className:"mt-3 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-poney hover:underline",children:[d.jsx(h1,{size:13})," Explore it in the whole system"]})]})}function ES({title:t,onClose:e,children:n}){return b.useEffect(()=>{const r=s=>s.key==="Escape"&&e();return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),d.jsx("div",{className:"fade-in fixed inset-0 z-40 bg-ink/30 p-4 backdrop-blur-[2px] sm:p-8",onClick:e,children:d.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":t,className:"flex h-full flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",onClick:r=>r.stopPropagation(),children:[d.jsxs("div",{className:"flex items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsx("span",{className:"flex-1 text-[14px] font-semibold",children:t}),d.jsx("button",{type:"button",autoFocus:!0,onClick:e,"aria-label":"Close",className:"rounded-md p-1.5 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(Bo,{size:16})})]}),d.jsx("div",{className:"relative min-h-0 flex-1",children:n})]})})}function $S({onClick:t}){return d.jsx("button",{type:"button",onClick:t,"aria-label":"Expand the diagram",title:"Expand",className:"rounded-md p-1.5 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(VD,{size:15})})}function IJ({walkthrough:t}){const e=ze(),n=t.kind==="tour",r=b.useMemo(()=>A_(t),[t]),s=b.useCallback((L,W)=>T.getState().dispatch({type:"walkthrough.setText",walkthroughId:t.id,path:L,value:W}),[t.id]),[i,o]=b.useState(n?"after":"change"),[a,l]=b.useState(n?"after":"change"),[c,f]=b.useState(null),[u,h]=b.useState(0),[m,g]=b.useState(null),[p,x]=_g(`poney:read:${e.doc.project.id}:${t.id}`,[]),[y,v]=_g(`poney:answers:${e.doc.project.id}:${t.id}`,{}),[k,w]=_g(`poney:notes:${e.doc.project.id}:${t.id}`,{}),j=T(L=>L.live.state==="on"),C=T(L=>L.setActiveScene),_=b.useRef(null),S=b.useRef([]),N=t.overview?e.views.get(t.overview):void 0,E=t.scenes[Math.min(u,t.scenes.length-1)];b.useEffect(()=>C(E.id),[E.id,C]);const P=E.view?e.views.get(E.view):void 0,[z,I]=b.useState(null),[F,U]=b.useState(!1);b.useEffect(()=>{I(null),U(!1)},[E.id]),b.useEffect(()=>{if(!F)return;const L=window.setTimeout(()=>{const W=(z??-1)+1;W>=E.trace.length?U(!1):I(W)},z===null?60:1900);return()=>clearTimeout(L)},[F,z,E.trace.length]);const M=z!==null&&E.trace[z]&&an(E.trace[z].ref)?de(an(E.trace[z].ref)):null,$=L=>{U(!1),I(L===null?null:Math.max(0,Math.min(E.trace.length-1,L)))};b.useEffect(()=>{const L=_.current;if(!L)return;const W=new IntersectionObserver(H=>{for(const O of H)O.isIntersecting&&h(Number(O.target.dataset.index))},{root:L,rootMargin:"-38% 0px -58% 0px"});return S.current.forEach(H=>H&&W.observe(H)),()=>W.disconnect()},[t]);const A=T(L=>L.jump);b.useEffect(()=>{var W;const L=A?t.scenes.findIndex(H=>H.id===A.scene):-1;L>=0&&((W=S.current[L])==null||W.scrollIntoView({behavior:"smooth",block:"start"}))},[A,t]);const B=L=>{var W;return(W=S.current[L])==null?void 0:W.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})},K=L=>x(p.includes(L)?p.filter(W=>W!==L):[...p,L]),Q=L=>{const W=an(L);return W?de(W):L},D=t.source;return d.jsxs("div",{ref:_,className:"scrollbar-quiet relative h-full overflow-y-auto bg-paper",children:[d.jsxs("header",{className:"mx-auto max-w-[1320px] px-6 pt-10 sm:px-10 sm:pt-14",children:[D&&d.jsxs("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-ink-3",children:[d.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-ink-2",children:[n?d.jsx(m1,{size:14}):d.jsx(ED,{size:14})," ",D.kind," ",D.ref??(n?D.repository:void 0)]}),D.head&&d.jsxs("span",{children:["head ",d.jsx("code",{className:"font-mono text-[12px] text-ink-2",children:D.head.slice(0,7)})]}),D.files!==void 0&&d.jsxs("span",{children:[D.files," files"]}),D.added!==void 0&&d.jsxs("span",{className:"font-tabular font-mono text-[12px]",children:[d.jsxs("span",{className:"text-new",children:["+",D.added]})," ",d.jsxs("span",{className:"text-removed",children:["−",D.removed??0]})]}),D.author&&d.jsxs("span",{children:["Walkthrough by ",D.author.charAt(0).toLowerCase()+D.author.slice(1)]})]}),d.jsx(Ln,{as:"h1",label:"Title",value:t.title,onSave:L=>s(["title"],L),className:"mt-4 block max-w-[24ch] text-[34px] font-semibold leading-[1.08] tracking-[-0.025em] sm:text-[44px]"}),d.jsx(Ln,{as:"p",label:"Summary",value:t.summary,onSave:L=>s(["summary"],L),className:"mt-5 block max-w-[60ch] text-[18px] leading-relaxed text-ink-2"})]}),d.jsxs("section",{"aria-labelledby":"story",className:"mx-auto mt-14 max-w-[1320px] px-6 sm:px-10",children:[d.jsxs("div",{className:`grid gap-x-12 gap-y-6 ${t.story.before||t.story.after?"lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]":""}`,children:[d.jsxs("div",{children:[d.jsx("h2",{id:"story",className:"text-[22px] font-semibold tracking-[-0.01em]",children:n?"What this code is for":"What changes for a person"}),d.jsx(Ln,{as:"p",multiline:!0,label:"Story",value:t.story.text,onSave:L=>s(["story","text"],L),className:"mt-4 block max-w-[66ch] text-[16.5px] leading-[1.7] text-ink-2"})]}),(t.story.before||t.story.after)&&d.jsxs("dl",{className:"space-y-3 lg:pt-11",children:[d.jsxs("div",{className:"rounded-xl border border-rule bg-raised px-4 py-3.5",children:[d.jsx("dt",{className:"text-[12.5px] font-semibold text-ink-3",children:"Before"}),d.jsx(Ln,{as:"dd",label:"Before",value:t.story.before??"",onSave:L=>s(["story","before"],L),className:"mt-1 block text-[15px] leading-snug"})]}),d.jsxs("div",{className:"rounded-xl border border-new/40 bg-new-wash px-4 py-3.5",children:[d.jsx("dt",{className:"text-[12.5px] font-semibold text-new",children:"After"}),d.jsx(Ln,{as:"dd",label:"After",value:t.story.after??"",onSave:L=>s(["story","after"],L),className:"mt-1 block text-[15px] leading-snug"})]})]})]}),N&&d.jsxs("figure",{className:"relative mt-8 flex h-[min(620px,72vh)] flex-col overflow-hidden rounded-2xl border border-rule bg-raised",children:[d.jsxs("figcaption",{className:"flex flex-wrap items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsx("span",{className:"text-[13px] font-semibold",children:N.title}),d.jsx("span",{className:"hidden text-[12.5px] text-ink-3 md:inline",children:n?"Open a group to see what is inside it.":"Switch between before and after to see what moves."}),d.jsx("span",{className:"flex-1"}),!n&&d.jsx(_S,{}),!n&&d.jsx(CS,{mode:i,onChange:o}),d.jsx($S,{onClick:()=>g("hero")})]}),d.jsxs("div",{className:"relative min-h-0 flex-1",children:[d.jsx(bu,{view:N,walkthrough:t,marks:r,mode:i,focus:[],callouts:[],hot:c,setHot:f,maxScale:1.1}),d.jsx(NS,{walkthrough:t})]})]})]}),t.verdict&&d.jsx("section",{"aria-labelledby":"verdict",className:"mx-auto mt-10 max-w-[1320px] px-6 sm:px-10",children:d.jsxs("div",{className:"rounded-2xl border border-rule bg-raised px-5 py-5 sm:px-6",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("h2",{id:"verdict",className:"text-[16px] font-semibold",children:n?"At a glance":"Verdict"}),(!n||t.verdict.risk==="look")&&d.jsx(rv,{risk:t.verdict.risk})]}),d.jsx("dl",{className:"mt-4 grid gap-x-8 gap-y-4 sm:grid-cols-2 lg:grid-cols-5",children:t.verdict.facts.map(L=>d.jsxs("div",{children:[d.jsx("dt",{className:"text-[12.5px] text-ink-3",children:L.label}),d.jsx("dd",{className:"mt-1 text-[14px] leading-snug",children:L.value})]},L.label))}),t.verdict.findings.length>0&&d.jsxs("div",{className:"mt-5 border-t border-rule pt-4",children:[d.jsx("h3",{className:"text-[13px] font-semibold text-ink-3",children:n?"Good to know":"Findings"}),d.jsx("ul",{className:"mt-2 space-y-1.5",children:t.verdict.findings.map((L,W)=>{const H=L.scene?t.scenes.findIndex(O=>O.id===L.scene):-1;return d.jsxs("li",{className:"flex items-start gap-2.5 text-[14px] leading-snug",children:[L.severity==="risk"?d.jsx($d,{size:15,className:"mt-0.5 shrink-0 text-changed"}):d.jsx(OD,{size:15,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{children:[d.jsx(Ln,{label:"Finding",value:L.text,onSave:O=>s(["verdict","findings",W,"text"],O)}),H>=0&&d.jsxs("button",{type:"button",onClick:()=>B(H),className:"ml-2 text-[12.5px] font-semibold text-poney hover:underline",children:["See scene ",H+1]})]})]},W)})})]})]})}),d.jsxs("section",{"aria-labelledby":"path",className:"mx-auto mt-14 max-w-[1320px] px-6 sm:px-10",children:[d.jsxs("div",{className:"flex items-end gap-4",children:[d.jsx("h2",{id:"path",className:"text-[22px] font-semibold tracking-[-0.01em]",children:"Read in this order"}),d.jsxs("span",{className:"font-tabular pb-1 text-[13px] text-ink-3",children:[p.length," of ",t.scenes.length," read"]})]}),d.jsx("div",{className:"mt-3 h-1 overflow-hidden rounded-full bg-sunken","aria-hidden":!0,children:d.jsx("div",{className:"h-full rounded-full bg-new transition-[width] duration-500",style:{width:`${p.length/t.scenes.length*100}%`}})}),d.jsx("ol",{className:"mt-5 grid gap-2 md:grid-cols-2 xl:grid-cols-3",children:t.scenes.map((L,W)=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>B(W),className:"group flex h-full w-full items-start gap-3 rounded-xl border border-rule bg-raised px-4 py-3.5 text-left transition-colors hover:border-rule-strong",children:[d.jsx("span",{className:`font-tabular mt-0.5 grid h-6 w-6 shrink-0 place-items-center rounded-full text-[12px] font-semibold ${p.includes(L.id)?"bg-new text-paper":"bg-sunken text-ink-2"}`,children:p.includes(L.id)?d.jsx(bs,{size:13,strokeWidth:3}):W+1}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14.5px] font-semibold leading-snug",children:d.jsx(rl,{text:L.title})}),d.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-2 text-[12px] text-ink-3",children:[(!n||L.risk==="look")&&d.jsx(rv,{risk:L.risk}),L.code.map(H=>d.jsx("code",{className:"font-mono text-[11.5px]",children:H.path.split("/").pop()},H.path))]})]})]})},L.id))})]}),d.jsxs("section",{"aria-label":"Scenes",className:"mx-auto mt-16 grid max-w-[1480px] gap-10 px-6 pb-[30vh] sm:px-10 lg:grid-cols-[minmax(360px,500px)_minmax(0,1fr)]",children:[d.jsx("div",{className:"order-2 lg:order-1",children:t.scenes.map((L,W)=>d.jsx(PJ,{edit:s,s:L,i:W,count:t.scenes.length,refCb:H=>S.current[W]=H,active:W===u,hot:c,setHot:f,keyOf:Q,read:p.includes(L.id),onRead:()=>{K(L.id),!p.includes(L.id)&&W+1<t.scenes.length&&B(W+1)},answers:y,onAnswer:(H,O)=>v({...y,[H]:O}),note:k[L.id]??"",onNote:H=>w({...k,[L.id]:H}),live:j,tour:n,traceStep:W===u?z:null,onTraceStep:H=>W===u?$(H):B(W)},L.id))}),d.jsx("div",{className:"order-1 lg:order-2",children:d.jsxs("figure",{className:"sticky top-4 flex h-[46vh] flex-col overflow-hidden rounded-2xl border border-rule bg-raised lg:top-8 lg:h-[calc(100vh-8rem)]",children:[d.jsxs("figcaption",{className:"flex flex-wrap items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsxs("span",{className:"font-tabular text-[12.5px] text-ink-3",children:[u+1," / ",t.scenes.length]}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:(P==null?void 0:P.title)??"Code only"}),E.trace.length>0&&P&&d.jsx(zJ,{count:E.trace.length,step:z,playing:F,onPlay:()=>{z!==null&&z>=E.trace.length-1&&I(null),U(!0)},onPause:()=>U(!1),onStep:$}),!n&&d.jsx(_S,{}),!n&&d.jsx(CS,{mode:a,onChange:l}),P&&d.jsx($S,{onClick:()=>g("scene")})]}),d.jsxs("div",{className:"relative min-h-0 flex-1",children:[P?d.jsx(bu,{view:P,walkthrough:t,marks:r,mode:a,focus:E.focus,callouts:E.callouts.map(L=>L.target),hot:M??c,setHot:f,sceneData:E,traceStep:z},P.id):d.jsx("div",{className:"grid h-full place-items-center px-8 text-center text-ink-3",children:"This scene is about code only. Read it on the left."}),z!==null&&E.trace[z]&&d.jsxs("p",{className:"fade-in pointer-events-none absolute left-1/2 top-3 z-10 max-w-[80%] -translate-x-1/2 rounded-full border border-rule bg-raised/95 px-3.5 py-1.5 text-center text-[13px] leading-snug shadow-float backdrop-blur","aria-live":"polite",children:[d.jsxs("span",{className:"font-tabular mr-2 font-semibold text-poney",children:[k1(z)," · ",z+1," of ",E.trace.length]}),E.trace[z].caption?d.jsx(rl,{text:E.trace[z].caption}):e.exists(an(E.trace[z].ref))?e.describe(an(E.trace[z].ref)).title:E.trace[z].ref]}),d.jsx(NS,{walkthrough:t})]})]})})]}),m==="hero"&&N&&d.jsx(ES,{title:N.title,onClose:()=>g(null),children:d.jsx(bu,{view:N,walkthrough:t,marks:r,mode:i,focus:[],callouts:[],hot:c,setHot:f,maxScale:1.4})}),m==="scene"&&P&&d.jsx(ES,{title:`${u+1}. ${Nr(E.title)}`,onClose:()=>g(null),children:d.jsx(bu,{view:P,walkthrough:t,marks:r,mode:a,focus:E.focus,callouts:E.callouts.map(L=>L.target),hot:M??c,setHot:f,maxScale:1.4,sceneData:E,traceStep:z})}),d.jsx("footer",{className:"mx-auto max-w-[1320px] border-t border-rule px-6 py-10 sm:px-10",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().navigate(xt),className:"inline-flex items-center gap-2 text-[14px] font-semibold text-poney hover:underline",children:[d.jsx(h1,{size:15})," Explore the whole system"]})})]})}function PJ({s:t,i:e,count:n,refCb:r,active:s,hot:i,setHot:o,keyOf:a,read:l,onRead:c,answers:f,onAnswer:u,note:h,onNote:m,live:g,tour:p,traceStep:x,onTraceStep:y,edit:v}){const k=(...C)=>_=>v(["scenes",e,...C],_),[w,j]=b.useState(!!h);return d.jsxs("article",{ref:r,"data-index":e,"aria-labelledby":`scene-${t.id}`,className:`scroll-mt-6 border-t border-rule pb-16 pt-10 transition-opacity duration-300 first:border-t-0 first:pt-0 lg:min-h-[85vh] ${s?"":"lg:opacity-55"}`,children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"font-tabular text-[13px] text-ink-3",children:[e+1," of ",n]}),(!p||t.risk==="look")&&d.jsx(rv,{risk:t.risk})]}),d.jsx(Ln,{as:"h3",id:`scene-${t.id}`,label:"Scene title",value:t.title,onSave:k("title"),className:"mt-3 block text-[26px] font-semibold leading-tight tracking-[-0.015em]"}),d.jsx(Ln,{as:"p",multiline:!0,label:"Scene text",value:t.text,onSave:k("text"),className:"mt-4 block text-[16px] leading-[1.7] text-ink-2"}),t.callouts.length>0&&d.jsx("ol",{className:"mt-6 space-y-1","aria-label":"Notes on the diagram",children:t.callouts.map((C,_)=>{const S=a(C.target);return d.jsxs("li",{onMouseEnter:()=>o(S),onMouseLeave:()=>o(null),onFocus:()=>o(S),onBlur:()=>o(null),tabIndex:0,className:`-mx-2 flex cursor-default gap-3 rounded-lg px-2 py-2 outline-none transition-colors ${i===S?"bg-poney-wash":""}`,children:[d.jsx("span",{className:`font-tabular grid h-[22px] w-[22px] shrink-0 place-items-center rounded-full text-[11.5px] font-bold text-paper ${i===S?"bg-poney":"bg-ink"}`,children:_+1}),d.jsx(Ln,{label:`Note ${_+1}`,value:C.text,onSave:k("callouts",_,"text"),className:"text-[14.5px] leading-snug"})]},_)})}),t.trace.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"Follow the path"}),d.jsx("ol",{className:"mt-2 space-y-0.5",children:t.trace.map((C,_)=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>y(_),"aria-current":x===_?"step":void 0,className:`-mx-2 flex w-full items-start gap-3 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-sunken/70 ${x===_?"bg-poney-wash":""}`,children:[d.jsx("span",{className:`font-tabular mt-px grid h-[19px] w-[19px] shrink-0 place-items-center rounded-[5px] text-[11px] font-bold ${x===_?"bg-poney text-paper":"bg-sunken text-ink-2"}`,children:k1(_)}),d.jsx("span",{className:"text-[14px] leading-snug",children:C.caption?d.jsx(rl,{text:C.caption}):C.ref})]})},_))})]}),t.cases.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"In each case"}),d.jsxs("table",{className:"mt-2 w-full text-left text-[13.5px]",children:[d.jsx("thead",{className:"sr-only",children:d.jsxs("tr",{children:[d.jsx("th",{children:"When"}),d.jsx("th",{children:"Then"})]})}),d.jsx("tbody",{children:t.cases.map((C,_)=>d.jsxs("tr",{className:"border-b border-rule last:border-b-0",children:[d.jsx("td",{className:"py-2.5 pr-4 align-top text-ink-2",children:d.jsx(Ln,{label:"When",value:C.when,onSave:k("cases",_,"when")})}),d.jsxs("td",{className:"py-2.5 align-top",children:[d.jsx(Ln,{label:"Then",value:C.then,onSave:k("cases",_,"then"),className:"font-medium"}),C.note&&d.jsx("span",{className:"block text-[12.5px] text-ink-3",children:C.note})]})]},_))})]})]}),t.proof.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:p?"Tests that show it":"Proof"}),d.jsx("ul",{className:"mt-2 space-y-1.5",children:t.proof.map((C,_)=>d.jsxs("li",{className:"flex items-start gap-2.5 text-[13.5px] leading-snug",children:[C.missing?d.jsx($d,{size:15,className:"mt-0.5 shrink-0 text-changed"}):d.jsx(bs,{size:15,strokeWidth:2.6,className:"mt-0.5 shrink-0 text-new"}),d.jsxs("span",{children:[d.jsx("span",{className:C.missing?"text-changed":"",children:C.missing?`No test yet: ${C.text.charAt(0).toLowerCase()}${C.text.slice(1)}`:C.text}),(C.source||C.test)&&d.jsx("code",{className:"block font-mono text-[11.5px] text-ink-3",children:[C.source,C.test].filter(Boolean).join(" › ")})]})]},_))})]}),[...t.question?[t.question]:[],...t.questions].map((C,_)=>{const S=_===0&&t.question?t.id:`${t.id}#${_}`,N=_===0&&t.question?k("question"):k("questions",t.question?_-1:_),E=f[S];return p?d.jsx(DJ,{question:C,answer:E??"",onAnswer:P=>u(S,P),live:g},S):d.jsxs("div",{className:"mt-8 rounded-xl border border-changed/40 bg-changed-wash px-4 py-4",children:[d.jsxs("p",{className:"flex items-start gap-2.5 text-[14.5px] leading-snug",children:[d.jsx(gE,{size:17,className:"mt-0.5 shrink-0 text-changed"}),d.jsx(Ln,{label:"Question",value:C,onSave:N})]}),E?d.jsxs("p",{className:"mt-3 flex items-center gap-2 pl-7 text-[13px] text-ink-2",children:[d.jsx(bs,{size:14,className:"text-new"})," You answered: ",d.jsx("strong",{className:"font-semibold text-ink",children:E}),d.jsx("button",{type:"button",className:"text-ink-3 underline-offset-2 hover:underline",onClick:()=>u(S,""),children:"Change"})]}):d.jsxs("div",{className:"mt-3 flex gap-2 pl-7",children:[d.jsx("button",{type:"button",onClick:()=>u(S,"Keep it"),className:"h-8 rounded-lg bg-ink px-3 text-[13px] font-semibold text-paper hover:opacity-90",children:"Keep it"}),d.jsx("button",{type:"button",onClick:()=>u(S,"Ask for a change"),className:"h-8 rounded-lg border border-rule-strong bg-raised px-3 text-[13px] font-semibold hover:bg-sunken",children:"Ask for a change"})]})]},S)}),t.code.length>0&&d.jsxs("div",{className:"mt-8 space-y-4",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"The code"}),t.code.map((C,_)=>d.jsx(RJ,{block:C,onEditNote:(S,N)=>k("code",_,"notes",S,"text")(N)},`${_}:${C.path}`))]}),d.jsx("div",{className:"mt-8",children:w?d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"text-[13px] font-semibold text-ink-3",children:g?"Note for the agent":"Your note"}),d.jsx("textarea",{value:h,onChange:C=>m(C.target.value),rows:3,placeholder:g?"What should change here? The agent reads this.":"What should change here?",className:"mt-1.5 w-full resize-y rounded-xl border border-rule bg-raised px-3 py-2.5 text-[14px] leading-snug outline-none placeholder:text-ink-4 focus:border-rule-strong"})]}):d.jsxs("button",{type:"button",onClick:()=>j(!0),className:"text-[13px] font-semibold text-ink-3 hover:text-ink",children:["+ ",g?"Add a note for the agent":"Add a note"]})}),d.jsxs("button",{type:"button",onClick:c,"aria-pressed":l,className:`mt-8 inline-flex h-9 items-center gap-2 rounded-lg px-3.5 text-[13.5px] font-semibold transition-colors ${l?"bg-new-wash text-new":"border border-rule-strong bg-raised hover:bg-sunken"}`,children:[d.jsx(bs,{size:15,strokeWidth:2.6})," ",l?"Read":e+1<n?"Mark as read, then next":"Mark as read"]})]})}function DJ({question:t,answer:e,onAnswer:n,live:r}){const[s,i]=b.useState(e),o=e.trim()!==""&&s===e;return d.jsxs("div",{className:"mt-8 rounded-xl border border-rule bg-raised px-4 py-4",children:[d.jsxs("p",{className:"flex items-start gap-2.5 text-[14.5px] font-medium leading-snug",children:[d.jsx(gE,{size:17,className:"mt-0.5 shrink-0 text-poney"}),t]}),d.jsxs("form",{className:"mt-3 pl-7",onSubmit:a=>{a.preventDefault(),n(s.trim())},children:[d.jsx("textarea",{value:s,onChange:a=>i(a.target.value),rows:2,"aria-label":"Your answer",placeholder:"Your answer",className:"w-full resize-y rounded-lg border border-rule bg-paper px-3 py-2 text-[14px] leading-snug outline-none placeholder:text-ink-4 focus:border-rule-strong"}),d.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[d.jsx("button",{type:"submit",disabled:!s.trim()||o,className:"h-8 rounded-lg bg-ink px-3 text-[13px] font-semibold text-paper disabled:opacity-35",children:o?"Saved":"Save answer"}),o&&d.jsx("span",{className:"text-[12.5px] text-ink-3",children:r?"The agent can read it. Ask it whether you are right.":"Kept in this browser."})]})]})]})}function zJ({count:t,step:e,playing:n,onPlay:r,onPause:s,onStep:i}){const o="grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken disabled:opacity-30";return d.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-rule bg-sunken/60 p-0.5",role:"group","aria-label":"Play the path",children:[d.jsx("button",{type:"button",className:o,"aria-label":"Previous step",disabled:e===null||e===0,onClick:()=>i((e??0)-1),children:d.jsx(uN,{size:15})}),n?d.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-raised px-2.5 text-[12.5px] font-semibold text-ink shadow-[0_1px_2px_#0000001a]",children:[d.jsx(KD,{size:13})," Pause"]}):d.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-raised px-2.5 text-[12.5px] font-semibold text-ink shadow-[0_1px_2px_#0000001a]",children:[d.jsx(YD,{size:13})," ",e===null?"Play the path":e>=t-1?"Again":"Play"]}),d.jsx("button",{type:"button",className:o,"aria-label":"Next step",disabled:e!==null&&e>=t-1,onClick:()=>i(e===null?0:e+1),children:d.jsx(Ed,{size:15})})]})}function LJ(){const t=T(o=>o.theme),e=T(o=>o.viewId),n=T(o=>o.selection),r=ze(),s=e===xt?void 0:r.views.get(e),i=r.doc.walkthroughs.find(o=>o.id===Ep(e));return b.useEffect(()=>{document.documentElement.dataset.theme=t,document.documentElement.dataset.poneyTheme=t},[t]),b.useEffect(()=>d9(e,n,n?de(n):null),[e,n]),b.useEffect(()=>{const o=r.doc.project.name,a=(i?Nr(i.title):void 0)??(s==null?void 0:s.title);document.title=a&&a!==o?`${a} · ${o} · Poney`:`${o} · Poney`},[s,i,r.doc.project.name]),b.useEffect(()=>o9(),[]),b.useEffect(()=>{const o=a=>{const l=T.getState(),c=a.metaKey||a.ctrlKey;if(c&&a.key.toLowerCase()==="k"){a.preventDefault(),l.setPaletteOpen(!l.paletteOpen);return}if(c&&a.shiftKey&&a.key.toLowerCase()==="c"){a.preventDefault(),V1();return}if(!(W1(a.target)||l.paletteOpen||l.importOpen||l.shortcutsOpen)){if(a.key==="F2"&&l.selection){const f=document.querySelector(`[data-ref="${CSS.escape(de(l.selection))}"]`);if(f&&U1(l.selection,f))return void a.preventDefault()}if(c&&a.key.toLowerCase()==="z")return a.preventDefault(),void(a.shiftKey?l.redo():l.undo());if(c&&a.key.toLowerCase()==="y")return a.preventDefault(),void l.redo();if(a.altKey&&a.key==="ArrowLeft")return a.preventDefault(),void l.goBack();if(a.altKey&&a.key==="ArrowRight")return a.preventDefault(),void l.goForward();if(!(c||a.altKey))switch(a.key){case"/":a.preventDefault(),l.setPaletteOpen(!0);break;case"[":l.toggleSidebar();break;case"]":l.toggleInspector();break;case"Escape":l.selection&&l.select(null);break;case"f":case"F":l.selection&&l.requestFocus("zoom",l.selection);break;case"!":l.requestFocus("fit");break;case")":l.requestFocus("reset");break;case"?":l.setShortcutsOpen(!0);break;case"o":l.navigate(xt);break;default:return}}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[]),d.jsxs(ZM,{children:[d.jsxs("div",{className:"flex h-full flex-col bg-plaster text-ink",children:[d.jsx("a",{href:"#main",className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-50 focus:rounded focus:bg-raised focus:px-3 focus:py-2",children:"Skip to diagram"}),d.jsx(E9,{}),d.jsxs("div",{className:"flex min-h-0 flex-1",children:[d.jsx(O9,{}),d.jsx("main",{id:"main",className:"relative min-w-0 flex-1","aria-label":i?`Walkthrough: ${Nr(i.title)}`:s?`${s.title} diagram`:"Project overview",children:i?d.jsx(IJ,{walkthrough:i},i.id):s?d.jsx(kB,{view:s},s.id):d.jsx(jB,{})}),!i&&d.jsx(tB,{})]})]}),d.jsx(KV,{}),d.jsx(KT,{}),d.jsx(QV,{}),d.jsx(XV,{})]})}const zA="poney:recent",LA="poney:last",FJ=8;function ml(){try{const t=localStorage.getItem(zA);return t?JSON.parse(t):[]}catch{return[]}}function FA(t){try{localStorage.setItem(zA,JSON.stringify(t.slice(0,FJ)))}catch{}}function BJ(t,e,n){const r={id:t.project.id,name:t.project.name,description:t.project.description,origin:e,at:new Date().toISOString(),json:s1(t),...n?{path:n}:{}};FA([r,...ml().filter(s=>s.id!==t.project.id)]);try{sessionStorage.setItem(LA,t.project.id)}catch{}}function VJ(t){FA(ml().filter(e=>e.id!==t))}async function BA(t){if(t.path&&T.getState().live.state==="on")try{return await aT(t.path),!0}catch{}const e=kl(JSON.parse(t.json),{extensions:Rd()});return!e.ok||!e.document?!1:(T.getState().loadDocument(e.document,t.origin),!0)}function WJ(){let t=new URLSearchParams(window.location.search).get("doc");try{t??(t=sessionStorage.getItem(LA))}catch{if(!t)return!1}const e=ml().find(n=>n.id===t&&n.origin!=="example");return e?(BA(e),!0):!1}function UJ(){let t=0,e;T.subscribe(n=>{var r;ZJ(n.history&&!n.startOpen&&((r=n.projects.find(s=>s.id===n.projectId))==null?void 0:r.origin)!=="example"?n.projectId:null),!(!n.history||n.startOpen||n.history.present===e)&&(e=n.history.present,clearTimeout(t),t=window.setTimeout(()=>{const s=T.getState(),i=s.projects.find(o=>o.id===s.projectId);s.history&&(i==null?void 0:i.origin)!=="example"&&BJ(s.history.present,(i==null?void 0:i.origin)??"imported",s.live.state==="on"?s.liveFile??void 0:void 0)},600))})}function ZJ(t){const e=new URL(window.location.href);(e.searchParams.get("doc")??null)!==t&&(t?e.searchParams.set("doc",t):e.searchParams.delete("doc"),window.history.replaceState(window.history.state,"",e))}async function VA(){var n,r;const{commerce:t}=await t1(async()=>{const{commerce:s}=await import("./src-2FlYo1t7.js");return{commerce:s}},[]),e=kl(t,{extensions:Rd()});if(!e.ok||!e.document)throw new Error(`The example is invalid: ${(n=e.issues[0])==null?void 0:n.path} ${(r=e.issues[0])==null?void 0:r.message}`);T.getState().loadDocument(e.document,"example")}const HJ={command:"npx",args:["-y","--package=@hattoriai/poney","poney-mcp"]},MS=t=>[t.command,...t.args].map(e=>/\s/.test(e)?`"${e}"`:e).join(" "),Ng=[{id:"claude",name:"Claude Code",how:"Run in a terminal:",text:t=>`claude mcp add poney -- ${MS(t)}`},{id:"codex",name:"Codex",how:"Run in a terminal:",text:t=>`codex mcp add poney -- ${MS(t)}`},{id:"opencode",name:"OpenCode",how:"Add to opencode.json:",text:t=>JSON.stringify({mcp:{poney:{type:"local",command:[t.command,...t.args],enabled:!0}}},null,2)},{id:"copilot",name:"Copilot",how:"Add to ~/.copilot/mcp-config.json:",text:t=>JSON.stringify({mcpServers:{poney:{type:"local",command:t.command,args:t.args,tools:["*"]}}},null,2)},{id:"other",name:"Other",how:"Add to its MCP settings:",text:t=>JSON.stringify({mcpServers:{poney:{command:t.command,args:t.args}}},null,2)}];function TS(){const t=T(c=>c.live.state==="on"),[e,n]=b.useState(HJ),[r,s]=b.useState(Ng[0].id),[i,o]=b.useState(!1);b.useEffect(()=>{t&&Z1().then(c=>c.mcpServer&&n(c.mcpServer),()=>{})},[t]);const a=Ng.find(c=>c.id===r),l=a.text(e);return d.jsxs("div",{children:[d.jsx("div",{role:"tablist","aria-label":"Your agent",className:"flex flex-wrap gap-1",children:Ng.map(c=>d.jsx("button",{type:"button",role:"tab","aria-selected":c.id===r,onClick:()=>(s(c.id),o(!1)),className:`h-7 rounded-md px-2 text-[12.5px] font-medium ${c.id===r?"bg-sunken text-ink":"text-ink-3 hover:text-ink"}`,children:c.name},c.id))}),d.jsx("p",{className:"mt-2 text-[12.5px] text-ink-3",children:a.how}),d.jsxs("div",{className:"relative mt-1",children:[d.jsx("pre",{className:"scrollbar-quiet overflow-x-auto whitespace-pre-wrap break-all rounded-lg bg-sunken py-2 pl-2.5 pr-9 font-mono text-[11.5px] text-ink",children:l}),d.jsx("button",{type:"button","aria-label":"Copy",title:"Copy",onClick:()=>{var c;return void((c=navigator.clipboard)==null?void 0:c.writeText(l).then(()=>o(!0)))},className:"absolute right-1.5 top-1.5 grid h-6 w-6 place-items-center rounded-md text-ink-3 hover:bg-raised hover:text-ink",children:i?d.jsx(bs,{size:13}):d.jsx(ta,{size:13})})]})]})}const Ec="#/start";function qJ(){const t=T(S=>S.theme),e=T(S=>S.live),n=T(S=>!!S.history),r=T(S=>S.projects),s=T(S=>S.sidebarOpen),[i,o]=b.useState(()=>ml()),[a,l]=b.useState(null),[c,f]=b.useState(!1),[u,h]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{document.documentElement.dataset.theme=t,document.documentElement.dataset.poneyTheme=t,document.title="Poney Studio"},[t]),b.useEffect(()=>{window.location.hash!==Ec&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${Ec}`)},[]);const g=(S,N,E)=>{const P=B1(S);if(!P.ok)return l({title:`${E} is not a Poney document`,lines:P.issues.slice(0,6).map(z=>z.path?`${z.path}: ${z.message}`:z.message)});l(null),T.getState().loadDocument(P.doc,N)};b.useEffect(()=>{const S=N=>{var P;if(W1(N.target)||T.getState().importOpen)return;const E=((P=N.clipboardData)==null?void 0:P.getData("text/plain"))??"";if(E.trim()){if(N.preventDefault(),Pp(E).kind==="unknown")return l({title:"The clipboard has no Poney document",lines:['Copy Poney JSON (it has "poneyVersion") or a Mermaid diagram, then paste again.']});g(E,"pasted","The pasted text")}};return window.addEventListener("paste",S),()=>window.removeEventListener("paste",S)},[]);const p=async S=>g(await S.text(),"imported",`“${S.name}”`),x=async()=>{h(!0);try{await VA()}catch(S){l({title:"The example did not open",lines:[S instanceof Error?S.message:String(S)]})}finally{h(!1)}},y=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+",v=()=>{var S;return e.state==="on"?T.getState().setFileOpen(!0):(S=m.current)==null?void 0:S.click()},k="group flex w-full items-start gap-4 rounded-xl px-4 py-3.5 text-left transition-colors hover:bg-sunken/70 focus-visible:bg-sunken/70 outline-none",w=S=>{const N=T.getState();if(N.history&&N.projectId===S.id)return N.showStart(!1);BA(S).then(E=>E||l({title:`“${S.name}” no longer opens`,lines:["It may come from an older version of Poney, or its file moved. Remove it from the list."]}))},j=r.filter(S=>S.origin!=="example"),C=i.filter(S=>S.origin!=="example"&&!r.some(N=>N.id===S.id)),_="flex w-full min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[13.5px] hover:bg-sunken";return d.jsxs(ZM,{children:[d.jsxs("div",{className:"flex h-full flex-col bg-plaster text-ink",children:[d.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-1 border-b border-rule bg-paper px-2",children:[d.jsx(rt,{label:s?"Hide sidebar":"Show sidebar",onClick:()=>T.getState().toggleSidebar(),side:"bottom",children:d.jsx(CE,{size:16})}),d.jsx("span",{className:"ml-2 text-[13px] font-semibold",children:"Start"}),d.jsx("span",{className:"flex-1"}),d.jsx(rt,{label:t==="light"?"Dark theme":"Light theme",onClick:()=>T.getState().toggleTheme(),side:"bottom",children:t==="light"?d.jsx(y1,{size:16}):d.jsx(t$,{size:16})})]}),d.jsxs("div",{className:"flex min-h-0 flex-1",children:[d.jsxs("aside",{"aria-label":"Documents",className:`scrollbar-quiet flex w-[264px] shrink-0 flex-col overflow-y-auto border-r border-rule bg-paper transition-[margin] duration-200 max-lg:hidden ${s?"ml-0":"-ml-[264px]"}`,children:[d.jsxs("div",{className:"flex items-center gap-2.5 p-3.5",children:[d.jsx(hT,{}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block truncate text-[13.5px] font-semibold",children:"Poney Studio"}),d.jsx("span",{className:"block truncate text-[11.5px] text-ink-3",children:j.length?`${j.length} open`:"Nothing open"})]})]}),d.jsx("div",{className:"px-2",children:d.jsxs("button",{type:"button",className:`${_} text-ink-2`,onClick:v,children:[d.jsx(Cw,{size:14,className:"shrink-0 text-ink-3"})," Open a file…"]})}),j.length>0&&d.jsxs("nav",{"aria-label":"Open documents",className:"mt-4 px-2",children:[d.jsx("h2",{className:"px-2 pb-1 text-[11.5px] font-medium text-ink-3",children:"Open"}),j.map(S=>d.jsxs("button",{type:"button",className:_,onClick:()=>S.id===T.getState().projectId?T.getState().showStart(!1):T.getState().switchProject(S.id),children:[d.jsx(Kf,{size:14,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:"truncate",children:S.doc.project.name})]},S.id))]}),C.length>0&&d.jsxs("nav",{"aria-label":"Recent documents",className:"mt-4 px-2 pb-4",children:[d.jsx("h2",{className:"px-2 pb-1 text-[11.5px] font-medium text-ink-3",children:"Recent"}),C.map(S=>d.jsxs("div",{className:"group relative",children:[d.jsxs("button",{type:"button",className:`${_} pr-8`,onClick:()=>w(S),title:`${S.name}, ${OS(S.at)}`,children:[d.jsx(Kf,{size:14,className:"shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block truncate",children:S.name}),d.jsxs("span",{className:"block truncate text-[11.5px] text-ink-3",children:[S.origin==="example"?"Example":S.origin==="live"?"From an agent":S.origin==="pasted"?"Pasted":"File",", ",OS(S.at)]})]})]}),d.jsx("button",{type:"button","aria-label":`Remove ${S.name} from the list`,title:"Remove from the list",onClick:()=>{VJ(S.id),o(ml())},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-ink-4 opacity-0 hover:bg-raised hover:text-ink focus-visible:opacity-100 group-hover:opacity-100",children:d.jsx(Bo,{size:13})})]},S.id))]})]}),d.jsxs("div",{className:"scrollbar-quiet relative min-w-0 flex-1 overflow-y-auto bg-paper text-ink",onDragOver:S=>{S.preventDefault(),f(!0)},onDragLeave:S=>{S.currentTarget===S.target&&f(!1)},onDrop:S=>{S.preventDefault(),f(!1);const N=S.dataTransfer.files[0];N&&p(N)},children:[d.jsxs("main",{className:"mx-auto grid max-w-[1080px] gap-x-14 gap-y-12 px-6 pb-20 pt-14 sm:px-10 sm:pt-20 xl:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-[14px] font-semibold text-poney",children:"Poney Studio"}),d.jsx("h1",{className:"mt-3 max-w-[18ch] text-[36px] font-semibold leading-[1.08] tracking-[-0.025em] sm:text-[44px]",children:"Software, explained in diagrams."}),d.jsx("p",{className:"mt-5 max-w-[52ch] text-[17px] leading-relaxed text-ink-2",children:"An agent writes walkthroughs of a change, or tours of a codebase. You read them here, explore the system, and ask the agent questions."}),n&&d.jsxs("button",{type:"button",onClick:()=>T.getState().showStart(!1),className:"mt-6 text-[14px] font-semibold text-poney hover:underline",children:["Back to “",T.getState().history.present.project.name,"”"]}),d.jsxs("section",{"aria-labelledby":"open",className:"mt-12",children:[d.jsx("h2",{id:"open",className:"px-4 text-[13px] font-semibold text-ink-3",children:"Open"}),d.jsxs("div",{className:"mt-2",children:[e.state==="on"&&d.jsxs("button",{type:"button",className:k,onClick:()=>T.getState().setProjectOpen(!0),children:[d.jsx(m1,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Open a project"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"A folder or a Git repository. Its Poney document opens."})]})]}),d.jsxs("button",{type:"button",className:k,onClick:v,children:[d.jsx(Cw,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Open a file"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"A .poney or Mermaid file. You can also drop it here."})]})]}),d.jsxs("button",{type:"button",className:k,onClick:()=>T.getState().setImportOpen(!0),children:[d.jsx(jN,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Paste a document"}),d.jsxs("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:["Poney JSON or Mermaid. Or press ",d.jsxs("kbd",{className:"rounded border border-rule bg-raised px-1 font-sans text-[12px]",children:[y,"V"]})," anywhere on this page."]})]})]}),d.jsxs("button",{type:"button",className:k,onClick:()=>void x(),disabled:u,children:[d.jsx(rN,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:u?"Opening the example…":"Try the example"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"Kestrel Commerce, an online store: a walkthrough of one change, and a tour of the code."})]})]})]}),d.jsx("input",{ref:m,type:"file",accept:".poney,.json,.mmd,.mermaid,.txt,application/json",className:"hidden",onChange:S=>{var E;const N=(E=S.target.files)==null?void 0:E[0];N&&p(N),S.target.value=""}}),a&&d.jsxs("div",{role:"alert",className:"mx-4 mt-4 rounded-xl border border-removed/40 bg-removed-wash px-4 py-3",children:[d.jsx("p",{className:"text-[14px] font-semibold text-removed",children:a.title}),d.jsx("ul",{className:"mt-1.5 space-y-0.5 font-mono text-[12px] text-ink-2",children:a.lines.map((S,N)=>d.jsx("li",{children:S},N))})]})]})]}),d.jsx("aside",{"aria-labelledby":"agent",className:"xl:pt-[164px]",children:d.jsxs("div",{className:"rounded-2xl border border-rule bg-raised px-5 py-5",children:[d.jsx("h2",{id:"agent",className:"text-[15.5px] font-semibold",children:"Agent"}),d.jsx(KJ,{})]})})]}),c&&d.jsx("div",{className:"pointer-events-none fixed inset-3 z-50 grid place-items-center rounded-3xl border-2 border-dashed border-poney bg-poney-wash/80",children:d.jsx("p",{className:"text-[18px] font-semibold text-poney",children:"Drop to open"})})]})]})]}),d.jsx(KT,{})]})}function OS(t){const e=new Date(t),n=Math.floor((Date.now()-e.getTime())/864e5);return n<=0?"today":n===1?"yesterday":n<7?`${n} days ago`:e.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function KJ(){const t=T(i=>i.live.state==="on"),{session:e,listening:n}=T(i=>i.agent),r="mt-3 inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",s="mt-1.5 block break-all rounded-lg bg-sunken px-2.5 py-2 font-mono text-[11.5px] text-ink";return e||n?d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsxs("p",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-new","aria-hidden":!0}),e?d.jsxs("span",{children:[d.jsx("span",{className:"font-semibold text-ink",children:e.name})," is ready in ",e.cwd.split("/").pop(),"."]}):"Linked from your terminal."]}),d.jsxs("button",{type:"button",onClick:()=>T.getState().setAgentPanelOpen(!0),className:r,children:[d.jsx(eo,{size:15})," Ask the agent"]})]}):t?d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:r,children:[d.jsx(Md,{size:15})," Connect an agent"]}),d.jsx("p",{className:"mt-4 border-t border-rule pt-4 text-[13px] font-semibold text-ink",children:"Or use the one in your terminal"}),d.jsx("div",{className:"mt-2",children:d.jsx(TS,{})})]}):d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsx("p",{children:"Agents need Poney running on this computer. In the Poney folder, run:"}),d.jsx("code",{className:s,children:"npm run studio"}),d.jsx("p",{className:"mt-4 border-t border-rule pt-4 text-[13px] font-semibold text-ink",children:"Or use the one in your terminal"}),d.jsx("div",{className:"mt-2",children:d.jsx(TS,{})})]})}const JJ=Qp.create({name:"chip",group:"inline",inline:!0,atom:!0,selectable:!1,addAttributes:()=>({ref:{default:null},title:{default:""},kind:{default:""},quote:{default:null}}),parseHTML:()=>[{tag:"span[data-chip]"}],renderHTML:({node:t,HTMLAttributes:e})=>["span",Di(e,{"data-chip":"",title:t.attrs.quote??t.attrs.ref??"",class:"mx-px inline-flex max-w-[16rem] items-baseline gap-1 truncate rounded-md border border-poney/30 bg-poney-wash px-1.5 align-baseline text-[12.5px] leading-[1.45]"}),["span",{class:"text-ink-3"},t.attrs.kind==="text"?"“":t.attrs.kind],["span",{class:"font-medium text-ink"},`${t.attrs.title}${t.attrs.kind==="text"?"”":""}`]],renderText:({node:t})=>`“${t.attrs.title}”`});function GJ(t){const e=[];return{text:(t.content??[]).map(r=>(r.content??[]).map(s=>{if(s.type!=="chip")return s.text??"";const i=s.attrs;return e.some(o=>i.ref?o.ref===i.ref:o.quote===i.quote)||e.push({...i.ref?{ref:i.ref}:{},title:i.title,kind:i.kind,...i.quote?{quote:i.quote}:{}}),`“${i.title}”`}).join("")).join(`
887
- `).trim(),context:e}}function YJ({placeholder:t,onSend:e,actions:n}){const[r,s]=b.useState(!0),i=b.useRef(()=>{}),o=xA({extensions:[bA,SA,jA,JJ],immediatelyRender:!0,autofocus:"end",editorProps:{attributes:{class:"min-h-[112px] max-h-[45vh] overflow-y-auto px-3 py-2.5 text-[14px] leading-snug outline-none",role:"textbox","aria-multiline":"true","aria-label":"Your question"},handleKeyDown:(l,c)=>c.key==="Enter"&&!c.shiftKey&&!c.isComposing?(i.current(),!0):!1},onUpdate:({editor:l})=>s(l.isEmpty)}),a=T(l=>l.chips.length);return b.useEffect(()=>{if(!o)return;const l=T.getState().takeChips();l.length&&(QJ(o,l),s(!1))},[a,o]),i.current=()=>{if(!o)return;const l=GJ(o.getJSON());l.text&&e(l).then(c=>{c&&(o.commands.clearContent(),s(!0))})},d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsxs("div",{className:"relative min-w-0 flex-1 rounded-xl border border-rule bg-paper focus-within:border-rule-strong [&_p]:m-0",children:[r&&d.jsx("span",{className:"pointer-events-none absolute left-3 top-2.5 text-[14px] text-ink-4",children:t}),d.jsx(N0,{editor:o})]}),n(()=>i.current(),r)]})}function QJ(t,e){const n=e.flatMap(r=>[{type:"chip",attrs:{ref:r.ref??null,title:r.title,kind:r.kind,quote:r.quote??null}},{type:"text",text:" "}]);t.chain().focus().insertContent(n).run()}function XJ(){const t=T(a=>a.agent.session),[e,n]=b.useState(null);if(!t)return null;const r=a=>a.then(()=>n(null)).catch(l=>n(l instanceof Error?l.message:String(l))),s=t.settings.find(a=>a.category==="model"),i=t.settings.find(a=>a.category==="effort"),o=t.settings.filter(a=>a.category==="speed");return d.jsxs("div",{className:"mt-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1 text-[12.5px]",children:[d.jsx(eG,{session:t,model:s,onError:n,run:r}),d.jsx("span",{className:"flex-1"}),(i||o.length>0)&&d.jsx(UA,{label:i?WA(i):"Options",title:"Effort and options",children:a=>d.jsxs(d.Fragment,{children:[o.map(l=>d.jsx(sv,{title:l.name,children:gd(l).map(c=>d.jsx(Gi,{on:l.current===c.value,label:c.name,hint:c.description,onClick:()=>(a(),r(kx(l.id,c.value)))},String(c.value)))},l.id)),i&&d.jsx(sv,{title:i.name,children:gd(i).map(l=>d.jsx(Gi,{on:i.current===l.value,label:l.name,hint:l.description,onClick:()=>(a(),r(kx(i.id,l.value)))},String(l.value)))})]})})]}),e&&d.jsx("p",{className:"mt-1 text-[12px] text-removed",children:e})]})}function eG({session:t,model:e,run:n,onError:r}){const[s,i]=b.useState(e?"models":"agents"),[o,a]=b.useState([]),[l,c]=b.useState(""),f=e?`${t.name} · ${WA(e)}`:t.name;return d.jsx(UA,{label:f,title:"Agent and model",align:"left",onOpen:()=>{i(e?"models":"agents"),c(""),Z1().then(u=>a(u.providers.filter(h=>h.available)),()=>r("The list of agents is not available."))},children:u=>s==="agents"?d.jsxs(d.Fragment,{children:[d.jsxs(sv,{title:"Agent",children:[o.map(h=>d.jsx(Gi,{on:h.id===t.providerId,label:h.name,trailing:h.id===t.providerId&&e?d.jsx(Ed,{size:13}):void 0,onClick:()=>{if(h.id===t.providerId)return e?i("models"):u();u(),n(Ob(t.cwd,{providerId:h.id}))}},h.id)),bx().map(h=>{const m=`custom:${h.name}`;return d.jsx(Gi,{on:m===t.providerId,label:h.name,onClick:()=>{u(),m!==t.providerId&&n(Ob(t.cwd,{custom:h}))}},m)})]}),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsx(Gi,{label:"Configure…",icon:d.jsx(iz,{size:13}),onClick:()=>(u(),T.getState().setConnectOpen(!0))})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"px-2.5 pb-1 pt-1.5 text-[11.5px] font-semibold text-ink-3",children:t.name}),d.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:gd(e).filter(h=>!l||h.name.toLowerCase().includes(l.toLowerCase())).map(h=>d.jsx(Gi,{on:e.current===h.value,label:h.name,hint:h.description,tags:[...h.recommended?["Recommended"]:[],...e.initial===h.value&&!h.recommended?["Your setting"]:[]],onClick:()=>(u(),n(kx(e.id,h.value)))},String(h.value)))}),gd(e).length>8&&d.jsx("input",{autoFocus:!0,value:l,onChange:h=>c(h.target.value),placeholder:"Search models…","aria-label":"Search models",className:"mx-1 my-1 h-8 w-[calc(100%-8px)] rounded-md border border-rule bg-paper px-2 text-[12.5px] focus:border-rule-strong",style:{outline:"none"}}),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsx(Gi,{label:"Other agents",icon:d.jsx(K_,{size:13}),onClick:()=>i("agents")})]})})}const gd=t=>t.kind==="boolean"?[{value:!0,name:"On"},{value:!1,name:"Off"}]:t.options,WA=t=>{var e;return((e=gd(t).find(n=>n.value===t.current))==null?void 0:e.name)??String(t.current)};function UA({label:t,title:e,align:n="right",onOpen:r,children:s}){const[i,o]=b.useState(!1),[a,l]=b.useState(null),c=b.useRef(null),f=b.useRef(null);return b.useEffect(()=>{if(!i)return;const u=m=>{var g;return!((g=c.current)!=null&&g.contains(m.target))&&o(!1)},h=m=>m.key==="Escape"&&o(!1);return window.addEventListener("pointerdown",u,!0),window.addEventListener("keydown",h),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("keydown",h)}},[i]),d.jsxs("div",{ref:c,className:"relative min-w-0",children:[d.jsxs("button",{ref:f,type:"button","aria-haspopup":"menu","aria-expanded":i,title:e,onClick:()=>{if(!i){r==null||r();const u=f.current.getBoundingClientRect();l({...n==="left"?{left:u.left}:{right:window.innerWidth-u.right},bottom:window.innerHeight-u.top+6,maxHeight:u.top-16})}o(!i)},className:`inline-flex h-7 max-w-full items-center gap-1 rounded-md px-2 font-medium text-ink-2 hover:bg-sunken hover:text-ink ${i?"bg-sunken text-ink":""}`,children:[d.jsx("span",{className:"truncate",children:t}),d.jsx(cN,{size:12,className:"shrink-0"})]}),i&&a&&d.jsx("div",{role:"menu","aria-label":e,className:"fade-in fixed z-50 flex w-72 flex-col overflow-y-auto rounded-xl border border-rule bg-raised p-1 shadow-float",style:a,children:s(()=>o(!1))})]})}function sv({title:t,children:e}){return d.jsxs("div",{className:"[&+&]:mt-1 [&+&]:border-t [&+&]:border-rule [&+&]:pt-1",children:[d.jsx("div",{className:"px-2.5 pb-0.5 pt-1.5 text-[11.5px] font-semibold text-ink-3",children:t}),e]})}function Gi({label:t,hint:e,tags:n=[],on:r,icon:s,trailing:i,onClick:o}){return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":!!r,onClick:o,title:e,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[13px] hover:bg-sunken",children:[s&&d.jsx("span",{className:"shrink-0 text-ink-3",children:s}),d.jsx("span",{className:"min-w-0 flex-1",children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx("span",{className:"truncate",children:t}),n.map(a=>d.jsx("span",{className:`shrink-0 rounded-full px-1.5 text-[10.5px] font-semibold ${a==="Recommended"?"bg-new-wash text-new":"bg-sunken text-ink-3"}`,children:a},a))]})}),r&&d.jsx(bs,{size:13,className:"shrink-0 text-poney"}),i&&d.jsx("span",{className:"shrink-0 text-ink-3",children:i})]})}function tG(){const t=T(g=>g.live.state==="on"),e=T(g=>g.agentPanelOpen),n=T(g=>g.setAgentPanelOpen),r=T(g=>g.conversation),{session:s,listening:i}=T(g=>g.agent),[o,a]=b.useState(0),l=b.useRef(null),c=r.filter(g=>g.from==="agent"||g.from==="permission").length,f=e?0:Math.max(0,c-o);b.useEffect(()=>{e&&a(c)},[e,c]),b.useEffect(()=>{var g,p;e&&((p=(g=l.current)==null?void 0:g.lastElementChild)==null||p.scrollIntoView({block:"end"}))},[e,r]);const u=T(g=>{var p;return(p=g.history)==null?void 0:p.present});if(!t)return null;if(!e)return d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"fixed bottom-5 right-5 z-30 inline-flex h-11 items-center gap-2 rounded-full bg-ink pl-4 pr-5 text-[14px] font-semibold text-paper shadow-float hover:opacity-95",children:[s!=null&&s.busy?d.jsx(_o,{size:17,className:"animate-spin"}):d.jsx(eo,{size:17}),"Agent",f>0&&d.jsx("span",{className:"font-tabular ml-1 grid h-5 min-w-5 place-items-center rounded-full bg-poney px-1.5 text-[11.5px] text-paper",children:f})]});const h=C9(u),m=!s&&r.length>0&&r[r.length-1].from==="person";return d.jsxs("section",{"aria-label":"Agent",className:"fade-in fixed bottom-5 right-5 z-30 flex max-h-[min(680px,80vh)] w-[min(420px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",children:[d.jsxs("header",{className:"flex items-start gap-3 border-b border-rule px-4 py-3",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("h2",{className:"text-[14px] font-semibold",children:s?s.name:"Agent"}),d.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-[12px] text-ink-3",children:[d.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${s||i?"bg-new":"bg-ink-4"}`,"aria-hidden":!0}),s?d.jsxs("span",{className:"truncate",title:s.cwd,children:[s.busy?"Working":"Ready"," in ",s.cwd.split("/").slice(-2).join("/")]}):i?"Linked from another session":m?"Waiting for an agent":"Not connected"]})]}),s&&d.jsx("button",{type:"button",onClick:()=>void m9(),title:"Stop the agent",className:"rounded-md px-2 py-1 text-[12px] font-medium text-ink-3 hover:bg-sunken hover:text-ink",children:"Disconnect"}),d.jsx("button",{type:"button","aria-label":"Close",onClick:()=>n(!1),className:"rounded-md p-1 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(Bo,{size:16})})]}),d.jsxs("ol",{ref:l,className:"scrollbar-quiet min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4","aria-live":"polite",children:[r.length===0&&d.jsx(nG,{}),r.map(g=>d.jsx(rG,{m:g},g.id)),(s==null?void 0:s.busy)&&d.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-3",children:[d.jsx(_o,{size:13,className:"animate-spin"})," Working…"]})]}),s&&r.filter(g=>g.from==="person").length===0&&d.jsx("div",{className:"flex flex-wrap gap-1.5 border-t border-rule px-3 py-3",children:h.map(g=>d.jsx("button",{type:"button",onClick:()=>void Dp(g.prompt),className:"rounded-full border border-rule bg-paper px-3 py-1.5 text-[12.5px] font-medium hover:border-rule-strong",children:g.label},g.label))}),d.jsx(sG,{busy:!!(s!=null&&s.busy)})]})}function nG(){const{session:t,listening:e}=T(n=>n.agent);return t||e?d.jsx("li",{className:"text-[13.5px] leading-snug text-ink-3",children:"It sees the scene you are on and what you select."}):d.jsx("li",{className:"space-y-2.5 text-[13.5px] leading-snug",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",children:[d.jsx(Md,{size:15})," Connect an agent"]})})}function rG({m:t}){var e;switch(t.from){case"person":return d.jsxs("li",{className:"ml-8 rounded-xl bg-sunken px-3 py-2.5",children:[d.jsx("p",{className:"whitespace-pre-wrap text-[13.5px] leading-snug",children:d.jsx(iG,{text:t.text,context:t.context??[]})}),d.jsx(AS,{walkthrough:t.walkthrough,scene:t.scene,prefix:"On"})]});case"agent":return d.jsxs("li",{className:"mr-4",children:[d.jsx("div",{className:"space-y-2 text-[13.5px] leading-relaxed text-ink",children:t.text.split(/\n{2,}/).map((n,r)=>d.jsx("p",{className:"whitespace-pre-wrap",children:n},r))}),d.jsx(AS,{walkthrough:t.walkthrough,scene:t.scene,prefix:"Show",link:!0})]});case"tool":return d.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-3",children:[t.status==="completed"?d.jsx(bs,{size:13,className:"shrink-0 text-new"}):t.status==="failed"?d.jsx($d,{size:13,className:"shrink-0 text-removed"}):d.jsx(xz,{size:13,className:"shrink-0"}),d.jsx("span",{className:"truncate",title:t.title,children:t.title})]});case"permission":return d.jsxs("li",{className:"rounded-xl border border-changed/40 bg-changed-wash px-3 py-2.5",children:[d.jsxs("p",{className:"text-[13px] font-medium leading-snug",children:["The agent asks: ",t.title]}),t.chosen?d.jsx("p",{className:"mt-1.5 text-[12px] text-ink-3",children:t.chosen==="cancelled"?"Cancelled":`You chose: ${((e=t.options.find(n=>n.id===t.chosen))==null?void 0:e.name)??t.chosen}`}):d.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.options.map(n=>d.jsx("button",{type:"button",onClick:()=>void y9(t.id,n.id),className:`h-7 rounded-lg px-2.5 text-[12.5px] font-semibold ${n.kind.startsWith("allow")?"bg-ink text-paper hover:opacity-90":"border border-rule-strong bg-raised hover:bg-sunken"}`,children:n.name},n.id))})]});case"notice":return d.jsx("li",{className:`text-center text-[12px] ${t.tone==="error"?"text-removed":"text-ink-3"}`,children:t.text})}}function AS({walkthrough:t,scene:e,prefix:n,link:r}){const s=T(l=>{var c;return(c=l.history)==null?void 0:c.present});if(!s||!e)return null;const i=t?s.walkthroughs.find(l=>l.id===t):s.walkthroughs.find(l=>l.scenes.some(c=>c.id===e)),o=i?i.scenes.findIndex(l=>l.id===e):-1;if(!i||o<0)return null;const a=`${n} scene ${o+1}: ${Nr(i.scenes[o].title)}`;return r?d.jsx("button",{type:"button",onClick:()=>{const l=T.getState();l.showStart(!1),l.viewId!==`${Fr}${i.id}`&&l.navigate(`${Fr}${i.id}`),setTimeout(()=>T.getState().jumpTo(e),60)},className:"mt-2 text-[12.5px] font-semibold text-poney hover:underline",children:a}):d.jsx("p",{className:"mt-1 text-[11.5px] text-ink-3",children:a})}function sG({busy:t}){const[e,n]=b.useState(null),r=async({text:s,context:i})=>{try{return await Dp(s,i),n(null),!0}catch(o){return n(o instanceof Error?o.message:String(o)),!1}};return d.jsxs("div",{className:"border-t border-rule p-3",children:[d.jsx(YJ,{placeholder:t?"Ask next; it waits its turn":"Ask about the code",onSend:r,actions:(s,i)=>d.jsxs(d.Fragment,{children:[t&&d.jsx("button",{type:"button","aria-label":"Stop",title:"Stop this request",onClick:()=>void g9(),className:"grid h-10 w-10 shrink-0 place-items-center rounded-full border border-rule-strong bg-raised text-ink hover:bg-sunken",children:d.jsx(GE,{size:13,fill:"currentColor"})}),d.jsx("button",{type:"button","aria-label":"Send",disabled:i,onClick:s,className:"grid h-10 w-10 shrink-0 place-items-center rounded-full bg-ink text-paper disabled:opacity-35",children:d.jsx(X_,{size:17,strokeWidth:2.4})})]})}),d.jsx(XJ,{}),e&&d.jsx("p",{className:"mt-1.5 text-[12px] text-removed",children:e})]})}function iG({text:t,context:e}){if(!e.length)return d.jsx(d.Fragment,{children:t});const n=e.map(s=>`“${s.title}”`),r=t.split(new RegExp(`(${n.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})`));return d.jsx(d.Fragment,{children:r.map((s,i)=>{const o=e[n.indexOf(s)];return o?d.jsxs("span",{title:o.quote??o.ref,className:"mx-px inline-flex items-baseline gap-1 rounded-md bg-raised px-1.5 text-[12.5px]",children:[d.jsx("span",{className:"text-ink-3",children:o.kind==="text"?"“":o.kind}),d.jsxs("span",{className:"font-medium",children:[o.title,o.kind==="text"?"”":""]})]},i):d.jsx("span",{children:s},i)})})}function z0({start:t,onPickFolder:e,onOpenFile:n}){const[r,s]=b.useState(null),[i,o]=b.useState(null),a=c=>x9(c).then(f=>{s(f),o(null)}).catch(f=>o(f instanceof Error?f.message:String(f)));if(b.useEffect(()=>{a(t)},[]),i)return d.jsx("p",{className:"text-[12.5px] text-removed",children:i});if(!r)return d.jsx("p",{className:"text-[12.5px] text-ink-3",children:"Reading folders…"});const l=n?r.files:[];return d.jsxs("div",{className:"overflow-hidden rounded-xl border border-rule",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-rule bg-sunken/50 px-2 py-1.5",children:[d.jsx("button",{type:"button","aria-label":"Up one folder",disabled:!r.parent,onClick:()=>void a(r.parent),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-raised disabled:opacity-30",children:d.jsx(X_,{size:14})}),d.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2",title:r.path,children:r.path}),e&&d.jsx("button",{type:"button",onClick:()=>e(r.path),className:"h-7 shrink-0 rounded-md bg-ink px-2.5 text-[12.5px] font-semibold text-paper hover:opacity-90",children:"Use this folder"})]}),d.jsxs("ul",{className:"scrollbar-quiet max-h-[260px] overflow-y-auto py-1",children:[r.folders.length===0&&l.length===0&&d.jsx("li",{className:"px-3 py-2 text-[12.5px] text-ink-3",children:n?"No folders or Poney files here.":"No folders inside."}),l.map(c=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(c.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[13px] font-medium hover:bg-sunken",children:[d.jsx(Kf,{size:14,className:"shrink-0 text-poney"}),d.jsx("span",{className:"truncate",children:c.name})]})},c.path)),r.folders.map(c=>d.jsx("li",{children:d.jsxs("button",{type:"button",onDoubleClick:()=>e==null?void 0:e(c.path),onClick:()=>void a(c.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[13px] hover:bg-sunken",children:[c.git?d.jsx(WN,{size:14,className:"shrink-0 text-poney"}):d.jsx(BN,{size:14,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:"truncate",children:c.name}),c.git&&d.jsx("span",{className:"ml-auto shrink-0 text-[11.5px] text-ink-3",children:"Git repository"})]})},c.path))]})]})}const Eg=t=>t.kind==="provider"?t.id:`custom:${t.name}`,Iu=t=>t.kind==="provider"?{providerId:t.id}:{custom:{name:t.name,command:t.command}};function oG(){var _,S;const t=T(N=>N.connectOpen),e=T(N=>N.setConnectOpen),n=_9(),r=T(N=>N.startOpen||!N.history),[s,i]=b.useState([]),[o,a]=b.useState(()=>bx()),[l,c]=b.useState(null),[f,u]=b.useState(null),[h,m]=b.useState(null),[g,p]=b.useState({}),[x,y]=b.useState(null),[v,k]=b.useState(!1),w=(N,E=!1)=>(p(P=>({...P,[Eg(N)]:"checking"})),p9(Iu(N),E).catch(P=>({state:"error",detail:P instanceof Error?P.message:String(P)})).then(P=>(p(z=>({...z,[Eg(N)]:P})),P.state==="ready"&&c(z=>z??N),P)));b.useEffect(()=>{var P,z;if(!t)return;m(null);const N=(P=T.getState().history)==null?void 0:P.present.project.id,E=(n==null?void 0:n.root)??((z=fh(N))==null?void 0:z.folder)??hh()??null;y(E),k(!E),Z1().then(I=>{i(I.providers);for(const F of I.providers)F.available&&w({kind:"provider",id:F.id});for(const F of bx())w({kind:"custom",...F})}).catch(I=>m(I instanceof Error?I.message:String(I)))},[t]);const j=async()=>{var N;if(!(!x||!l)){u("Starting the agent…"),m(null);try{const E=(N=T.getState().history)==null?void 0:N.present.project.id;T.getState().startOpen||!E?(await iT(x),await wx(Iu(l))):await wx(Iu(l),x),fT(x);const P=await lG(E);P&&v9(P,{folder:x,agent:Iu(l)}),e(!1),T.getState().setAgentPanelOpen(!0)}catch(E){m(E instanceof Error?E.message:String(E))}finally{u(null)}}},C=!!x&&!!l&&RS(g[Eg(l)]);return d.jsxs(Vo,{open:t,onOpenChange:e,title:"Connect an agent",description:r?"It reads the code in the folder below, and writes to its Poney document.":"It reads the code in the folder below and writes to this document.",width:640,children:[d.jsxs("div",{className:"scrollbar-quiet min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5",children:[d.jsxs("section",{"aria-labelledby":"code-folder",children:[d.jsx("h3",{id:"code-folder",className:"text-[13px] font-semibold",children:"Code"}),d.jsxs("div",{className:"mt-2 flex items-center gap-3 rounded-xl bg-sunken px-3.5 py-2.5 text-[13px]",children:[d.jsx(BN,{size:15,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:`min-w-0 flex-1 truncate ${x?"":"text-ink-3"}`,title:x??void 0,children:x?d.jsx("code",{className:"font-mono text-[12px]",children:x}):"Choose a folder"}),!v&&d.jsx("button",{type:"button",onClick:()=>k(!0),className:"shrink-0 font-semibold text-poney hover:underline",children:"Change"})]}),v&&d.jsx("div",{className:"mt-2",children:d.jsx(z0,{start:x??((S=fh((_=T.getState().history)==null?void 0:_.present.project.id))==null?void 0:S.folder)??hh(),onPickFolder:N=>{y(N),k(!1)}})})]}),d.jsxs("section",{"aria-labelledby":"ag",children:[d.jsx("h3",{id:"ag",className:"text-[13px] font-semibold",children:"Agent"}),d.jsxs("ul",{className:"mt-2 divide-y divide-rule rounded-xl border border-rule",children:[s.map(N=>{const E={kind:"provider",id:N.id},P=(l==null?void 0:l.kind)==="provider"&&l.id===N.id,z=g[N.id],I=N.available&&RS(z);return d.jsx("li",{children:d.jsxs("label",{className:`flex items-start gap-3 px-3.5 py-3 ${I?"cursor-pointer":"cursor-default"}`,children:[d.jsx("input",{type:"radio",name:"agent",className:"mt-1 accent-[var(--accent)]",checked:P,disabled:!I,onChange:()=>c(E)}),d.jsxs("span",{className:`min-w-0 flex-1 ${N.available?"":"opacity-70"}`,children:[d.jsx("span",{className:"block text-[14px] font-medium",children:N.name}),N.available?d.jsx(IS,{status:z,signIn:N.signIn,onRetry:()=>void w(E,!0)}):d.jsx("span",{className:"block text-[12.5px] text-ink-3",children:N.install})]})]})},N.id)}),o.map(N=>{const E=(l==null?void 0:l.kind)==="custom"&&l.name===N.name;return d.jsxs("li",{className:"flex items-start gap-3 px-3.5 py-3",children:[d.jsx("input",{type:"radio",name:"agent","aria-label":N.name,className:"mt-1 accent-[var(--accent)]",checked:E,onChange:()=>c({kind:"custom",...N})}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14px] font-medium",children:N.name}),d.jsx("code",{className:"block truncate font-mono text-[11.5px] text-ink-3",children:N.command}),d.jsx(IS,{status:g[`custom:${N.name}`],signIn:"Sign in as the agent's documentation says.",onRetry:()=>void w({kind:"custom",...N},!0)})]}),d.jsx("button",{type:"button","aria-label":`Remove ${N.name}`,onClick:()=>{const P=o.filter(z=>z.name!==N.name);a(P),Ab(P),E&&c(null)},className:"rounded p-1 text-ink-4 hover:bg-sunken hover:text-ink",children:d.jsx(uz,{size:14})})]},N.name)})]}),d.jsx(aG,{onAdd:N=>{const E=[...o.filter(P=>P.name!==N.name),N];a(E),Ab(E),c({kind:"custom",...N}),w({kind:"custom",...N},!0)}})]})]}),d.jsxs("div",{className:"flex items-center gap-3 border-t border-rule px-5 py-3.5",children:[d.jsx("p",{role:h?"alert":void 0,className:`min-w-0 flex-1 text-[12.5px] ${h?"text-removed":"text-ink-3"}`,children:h??f??(x?"":"Choose the folder with the code.")}),d.jsxs("button",{type:"button",disabled:!C||!!f,onClick:()=>void j(),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-4 text-[13.5px] font-semibold text-paper disabled:opacity-35",children:[f&&d.jsx(_o,{size:14,className:"animate-spin"})," Connect"]})]})]})}function aG({onAdd:t}){const[e,n]=b.useState(!1),[r,s]=b.useState(""),[i,o]=b.useState("");return e?d.jsxs("form",{className:"mt-3 space-y-2 rounded-xl border border-rule p-3",onSubmit:a=>{a.preventDefault(),t({name:r.trim(),command:i.trim()}),n(!1),s(""),o("")},children:[d.jsxs("label",{className:"block text-[12.5px] font-medium",children:["Name",d.jsx("input",{value:r,onChange:a=>s(a.target.value),placeholder:"My agent",className:"mt-1 h-8 w-full rounded-lg border border-rule bg-paper px-2.5 text-[13px] outline-none focus:border-rule-strong"})]}),d.jsxs("label",{className:"block text-[12.5px] font-medium",children:["Command",d.jsx("input",{value:i,onChange:a=>o(a.target.value),placeholder:"my-agent --acp",className:"mt-1 h-8 w-full rounded-lg border border-rule bg-paper px-2.5 font-mono text-[12.5px] outline-none focus:border-rule-strong"}),d.jsx("span",{className:"mt-1 block font-normal text-ink-3",children:"The command that starts the agent in ACP mode."})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim(),className:"h-8 rounded-lg bg-ink px-3 text-[12.5px] font-semibold text-paper disabled:opacity-35",children:"Add agent"}),d.jsx("button",{type:"button",onClick:()=>n(!1),className:"h-8 rounded-lg px-3 text-[12.5px] font-semibold text-ink-3 hover:bg-sunken",children:"Cancel"})]})]}):d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"mt-2 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-ink-3 hover:text-ink",children:[d.jsx(x1,{size:13})," Add another ACP agent"]})}const RS=t=>!!t&&t!=="checking"&&(t.state==="ready"||t.state==="unsure");function IS({status:t,signIn:e,onRetry:n}){if(!t||t==="checking")return d.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 text-[12.5px] text-ink-3",children:[d.jsx(_o,{size:12,className:"animate-spin"})," Checking the sign-in…"]});const r=t.state==="ready"?"text-new":t.state==="unsure"?"text-changed":"text-removed",s=t.state==="ready"?"Ready":t.state==="unsure"?"Maybe not signed in":t.state==="sign-in"?"Not signed in":"Cannot start";return d.jsxs("span",{className:"mt-0.5 block text-[12.5px] leading-snug text-ink-3",children:[d.jsxs("span",{className:`font-semibold ${r}`,children:[s,"."]})," ",t.detail,(t.state==="sign-in"||t.state==="unsure")&&d.jsx("span",{className:"block",children:e}),t.state!=="ready"&&d.jsxs("button",{type:"button",onClick:i=>{i.preventDefault(),n()},className:"mt-1 inline-flex items-center gap-1 font-semibold text-ink-2 hover:text-ink",children:[d.jsx(tz,{size:11})," Check again"]})]})}async function lG(t){var e,n;for(let r=0;r<20;r++){const s=T.getState(),i=(e=s.history)==null?void 0:e.present.project.id;if(i&&(i!==t||!s.startOpen))return i;await new Promise(o=>setTimeout(o,100))}return(n=T.getState().history)==null?void 0:n.present.project.id}function cG(){const t=T(s=>s.fileOpen),e=T(s=>s.setFileOpen),[n,r]=b.useState(null);return d.jsx(Vo,{open:t,onOpenChange:e,title:"Open a Poney file",description:"A .poney file on this computer. Changes are saved to it, and changes made to it elsewhere show here.",width:600,children:d.jsxs("div",{className:"space-y-3 px-5 py-5",children:[d.jsx(z0,{start:hh(),onOpenFile:async s=>{try{await aT(s),r(null),e(!1)}catch(i){r(i instanceof Error?i.message:String(i))}}}),n&&d.jsx("p",{role:"alert",className:"whitespace-pre-wrap text-[12.5px] text-removed",children:n})]})})}function dG(){const t=T(c=>c.projectOpen),e=T(c=>c.setProjectOpen),[n,r]=b.useState("local"),[s,i]=b.useState(null),[o,a]=b.useState(null),l=async c=>{a(null);try{await iT(c),fT(c),e(!1)}catch(f){a(f instanceof Error?f.message:String(f))}};return d.jsx(Vo,{open:t,onOpenChange:e,title:"Open a project",description:"A folder on this computer, usually a Git repository. Its Poney document is saved in docs/poney/, and agents work there.",width:620,children:d.jsxs("div",{className:"space-y-3 px-5 py-5",children:[d.jsx("div",{role:"tablist",className:"inline-flex rounded-lg border border-rule bg-sunken/60 p-0.5 text-[12.5px]",children:["local","git"].map(c=>d.jsx("button",{role:"tab",type:"button","aria-selected":n===c,onClick:()=>r(c),className:`h-7 rounded-md px-3 font-medium ${n===c?"bg-raised text-ink shadow-[0_1px_2px_#0000001a]":"text-ink-3 hover:text-ink"}`,children:c==="local"?"On this computer":"From a Git address"},c))}),n==="local"?d.jsx(z0,{start:hh(),onPickFolder:c=>void l(c)}):d.jsx(uG,{onCloned:c=>void l(c),setBusy:i,setError:a}),(o||s)&&d.jsx("p",{role:o?"alert":"status",className:`text-[12.5px] ${o?"text-removed":"text-ink-3"}`,children:o??s})]})})}function uG({onCloned:t,setBusy:e,setError:n}){const[r,s]=b.useState("");return d.jsxs("form",{className:"flex gap-2",onSubmit:async i=>{i.preventDefault(),e("Cloning the repository…"),n(null);try{t((await k9(r)).path)}catch(o){n(o instanceof Error?o.message:String(o))}finally{e(null)}},children:[d.jsx("input",{value:r,onChange:i=>s(i.target.value),"aria-label":"Git address",placeholder:"https://github.com/owner/repository",className:"h-9 min-w-0 flex-1 rounded-lg border border-rule bg-paper px-3 font-mono text-[12.5px] outline-none placeholder:text-ink-4 focus:border-rule-strong"}),d.jsx("button",{type:"submit",disabled:!r.trim(),className:"h-9 shrink-0 rounded-lg border border-rule-strong bg-raised px-3 text-[13px] font-semibold hover:bg-sunken disabled:opacity-35",children:"Clone"})]})}function fG({children:t}){const e=ze(),n=gB(),r=T(l=>l.selection),s=T(l=>l.hover),i=T(l=>l.viewUi),o=T(l=>l.updateViewUi),a=b.useMemo(()=>({idx:e,bind:n,selection:r,hover:s,viewState:l=>i[l],setViewState:o}),[e,n,r,s,i,o]);return d.jsx(YP,{value:a,children:t})}function hG(){const t=T(u=>u.importCodeOpen),e=T(u=>u.setImportCodeOpen),[n,r]=b.useState([]),[s,i]=b.useState(null),[o,a]=b.useState(null),[l,c]=b.useState(null);b.useEffect(()=>{t&&(c(null),lT().then(u=>{r(u.importers),i(u.root)},u=>c(u instanceof Error?u.message:String(u))))},[t]);const f=async u=>{a(u),c(null);try{const{summary:h}=await w9(u);e(!1),T.getState().notify(h.split(`
888
- `)[0])}catch(h){c(h instanceof Error?h.message:String(h))}finally{a(null)}};return d.jsxs(Vo,{open:t,onOpenChange:e,title:"Import from the code",description:s?`Adds to this document what it reads in ${s.split("/").pop()}. What the document has stays.`:"Connect an agent or open a project first.",children:[d.jsx("ul",{className:"divide-y divide-rule px-5 py-3",children:n.map(u=>d.jsxs("li",{className:"flex items-center gap-4 py-3",children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14px] font-semibold",children:u.name}),d.jsx("span",{className:"mt-0.5 block text-[12.5px] text-ink-3",children:u.files.length?`Reads ${u.files.join(", ")}`:"Nothing to read in this folder."})]}),d.jsxs("button",{type:"button",disabled:!u.files.length||!!o,onClick:()=>void f(u.id),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-rule-strong px-3 text-[13px] font-semibold hover:bg-sunken disabled:opacity-40",children:[o===u.id&&d.jsx(_o,{size:13,className:"animate-spin"})," Import"]})]},u.id))}),l&&d.jsx("p",{className:"px-5 pb-4 text-[12.5px] text-removed",children:l})]})}function pG(){const t=T(g=>g.renaming),[e,n]=b.useState(""),r=b.useRef(null),s=b.useRef(null),[i,o]=b.useState(0);if(b.useEffect(()=>{if(!t)return;n(t.value);const g=t.text;g&&(g.style.visibility="hidden"),requestAnimationFrame(()=>{var x;return(x=r.current)==null?void 0:x.select()});const p=()=>{var x;return gu(((x=r.current)==null?void 0:x.value)??null)};return window.addEventListener("resize",p),window.addEventListener("wheel",p,{passive:!0}),()=>{g&&(g.style.visibility=""),window.removeEventListener("resize",p),window.removeEventListener("wheel",p)}},[t]),b.useLayoutEffect(()=>{t&&s.current&&o(Math.min(Math.max(s.current.offsetWidth+6,t.rect.w+6,40),Math.max(t.room,t.rect.w+6)))},[e,t]),!t)return null;const{rect:a,font:l,align:c}=t,f=Math.round(l.size*1.35),u=c==="center"?a.x+a.w/2-i/2:a.x-2,h=a.y+a.h/2-f/2,m={fontSize:l.size,fontWeight:Number(l.weight)||600,lineHeight:`${f}px`};return d.jsxs(d.Fragment,{children:[d.jsx("span",{ref:s,"aria-hidden":!0,className:"pointer-events-none invisible fixed left-0 top-0 whitespace-pre font-sans",style:m,children:e||" "}),d.jsx("input",{ref:r,value:e,"aria-label":`New name for ${t.value}`,title:"Enter to save, Esc to cancel. The name changes in every diagram.",onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&gu(e),g.key==="Escape"&&gu(null)},onBlur:()=>gu(e),className:`fixed z-50 rounded-sm border-0 border-b-2 border-poney p-0 px-[2px] font-sans text-ink caret-[var(--accent)] ${c==="center"?"text-center":""}`,style:{...m,left:u,top:h,width:i,height:f+2,outline:"none",boxShadow:"none",background:"var(--story-node)"}})]})}function mG(){const t=T(f=>f.contextMenu),e=()=>T.getState().openContextMenu(null),n=b.useRef(null),[r,s]=b.useState({x:0,y:0}),[i,o]=b.useState(0),a=t?gG(t):[];if(b.useLayoutEffect(()=>{if(!t||!n.current)return;const f=n.current.getBoundingClientRect();s({x:Math.min(t.x,window.innerWidth-f.width-8),y:Math.min(t.y,window.innerHeight-f.height-8)}),o(Math.max(0,a.findIndex(u=>u.label!=="-"&&!u.disabled))),n.current.focus()},[t]),b.useEffect(()=>{if(!t)return;const f=u=>{var h;return!((h=n.current)!=null&&h.contains(u.target))&&e()};return window.addEventListener("pointerdown",f,!0),window.addEventListener("resize",e),window.addEventListener("blur",e),()=>{window.removeEventListener("pointerdown",f,!0),window.removeEventListener("resize",e),window.removeEventListener("blur",e)}},[t]),!t||!a.length)return null;const l=f=>{const u=a[f];!u||u.label==="-"||u.disabled||(e(),u.run())},c=f=>{let u=i;do u=(u+f+a.length)%a.length;while(a[u].label==="-"||a[u].disabled);o(u)};return d.jsx("div",{ref:n,role:"menu",tabIndex:-1,"aria-label":"Actions",className:"fade-in fixed z-50 min-w-[230px] rounded-xl border border-rule bg-raised p-1 shadow-float outline-none",style:{left:r.x,top:r.y},onContextMenu:f=>f.preventDefault(),onKeyDown:f=>{if(f.key==="Escape")e();else if(f.key==="ArrowDown")c(1);else if(f.key==="ArrowUp")c(-1);else if(f.key==="Enter")l(i);else return;f.preventDefault()},children:a.map((f,u)=>f.label==="-"?d.jsx("div",{className:"my-1 h-px bg-rule",role:"separator"},u):d.jsxs("button",{type:"button",role:"menuitem","aria-disabled":f.disabled||void 0,onMouseEnter:()=>!f.disabled&&o(u),onClick:()=>l(u),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] ${f.disabled?"cursor-default text-ink-4":u===i?"bg-sunken":""}`,children:[d.jsx("span",{className:`shrink-0 ${f.disabled?"text-ink-4":"text-ink-3"}`,children:f.icon}),d.jsx("span",{className:"flex-1",children:f.label}),f.hint&&d.jsx("kbd",{className:"font-sans text-[11.5px] text-ink-4",children:f.hint})]},u))})}const iv={label:"-",icon:null,run:()=>{}};function Pu(t,e){return t?[...e,iv]:[...e.map(n=>({...n,disabled:!0,hint:"No agent"})),{label:"Connect an agent…",icon:d.jsx(Md,{size:14}),run:()=>T.getState().setConnectOpen(!0)},iv]}function gG(t){const e=T.getState().live.state==="on",n=Id(T.getState()),r=(i,o)=>{o&&(T.getState().setAgentPanelOpen(!0),Dp(i,[o]))};if(t.on==="element"){const i=mT(t.ref),o=(i==null?void 0:i.kind)??"element";return[...e?Pu(n,[{label:"Ask the agent about this",icon:d.jsx(eo,{size:14}),run:()=>to(i)},{label:"Explain this",icon:d.jsx(Rm,{size:14}),run:()=>r(`Explain this ${o}: what it does, why it is here, and where its code is.`,i)},{label:"Show its code in a scene",icon:d.jsx(jp,{size:14}),run:()=>r(`Add a scene to the open document that shows the code of this ${o}, with short excerpts and notes, and open it.`,i)}]):[],...nT(t.ref)?[{label:"Rename",icon:d.jsx(JD,{size:14}),hint:"F2",run:()=>{var c;const l=((c=document.elementFromPoint(t.x,t.y))==null?void 0:c.closest("[data-ref]"))??document.querySelector(`[data-ref="${CSS.escape(de(t.ref))}"]`);l&&U1(t.ref,l)}}]:[],{label:"Explore in the whole system",icon:d.jsx(h1,{size:14}),run:()=>Pd(t.ref)},{label:"Copy reference",icon:d.jsx(ta,{size:14}),hint:de(t.ref),run:()=>{var l;return void((l=navigator.clipboard)==null?void 0:l.writeText(de(t.ref)))}}]}if(t.on==="code"){const i=yT(t.path,t.line,t.text),o=`${t.path}:${t.line}`;return[...e?Pu(n,[{label:t.note?"Ask the agent about this note":"Ask the agent about this line",icon:d.jsx(eo,{size:14}),run:()=>to(t.note?{...i,quote:`${i.quote}
889
- Note: ${t.note}`}:i)},{label:"Explain this line",icon:d.jsx(Rm,{size:14}),run:()=>r("Explain this line of code: what it does and why it is here.",i)}]):[],...t.note?[{label:"Copy note",icon:d.jsx(ta,{size:14}),run:()=>{var a;return void((a=navigator.clipboard)==null?void 0:a.writeText(t.note))}}]:[],{label:"Copy line",icon:d.jsx(ta,{size:14}),run:()=>{var a;return void((a=navigator.clipboard)==null?void 0:a.writeText(t.text.trim()))}},{label:"Copy location",icon:d.jsx(ta,{size:14}),hint:o.split("/").pop(),run:()=>{var a;return void((a=navigator.clipboard)==null?void 0:a.writeText(o))}}]}if(t.on==="text")return[...e?Pu(n,[{label:"Ask the agent about this text",icon:d.jsx(eo,{size:14}),run:()=>to(gT(t.text))}]):[],{label:"Copy",icon:d.jsx(ta,{size:14}),run:()=>{var i;return void((i=navigator.clipboard)==null?void 0:i.writeText(t.text))}}];const s=iB(t.viewId);return e?Pu(n,[{label:"Ask the agent about this diagram",icon:d.jsx(eo,{size:14}),run:()=>to(s)},{label:"Explain this diagram",icon:d.jsx(Rm,{size:14}),run:()=>r("Explain what this diagram shows, in a few sentences, and what to look at first.",s)}]).filter(i=>i!==iv):[]}function yG(){const t=T(n=>n.pointing),e=T(Id);return b.useEffect(()=>{!e&&t&&T.getState().setPointing(!1)},[e,t]),b.useEffect(()=>{if(document.documentElement.classList.toggle("pointing",t),!t)return;const n=r=>r.key==="Escape"&&T.getState().setPointing(!1);return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),t?d.jsxs("div",{role:"status",className:"fade-in fixed left-1/2 top-3 z-50 flex -translate-x-1/2 items-center gap-2 rounded-full bg-ink px-4 py-2 text-[13px] font-medium text-paper shadow-float",children:[d.jsx(MN,{size:14})," Click a part, a line, a message or a state to add it to your message.",d.jsx("button",{type:"button",onClick:()=>T.getState().setPointing(!1),className:"ml-1 rounded-full px-2 py-0.5 text-[12px] text-paper/70 hover:bg-paper/15 hover:text-paper",children:"Esc"})]}):null}function xG(){const t=T(Id),[e,n]=b.useState(null);return b.useEffect(()=>{if(!t)return;const r=()=>{var f;const i=window.getSelection(),o=i==null?void 0:i.toString().trim(),a=(i==null?void 0:i.anchorNode)instanceof Element?i.anchorNode:(f=i==null?void 0:i.anchorNode)==null?void 0:f.parentElement;if(!i||!o||i.rangeCount===0||!(a!=null&&a.closest("main"))||a.closest('input, textarea, [contenteditable="true"], svg'))return n(null);const l=i.getRangeAt(0),c=l.getClientRects()[0]??l.getBoundingClientRect();if(!c.width)return n(null);n({x:c.left+c.width/2,y:c.top,text:o})},s=()=>n(null);return document.addEventListener("selectionchange",r),window.addEventListener("scroll",s,!0),()=>{document.removeEventListener("selectionchange",r),window.removeEventListener("scroll",s,!0)}},[t]),e?d.jsxs("button",{type:"button",onMouseDown:r=>r.preventDefault(),onClick:()=>{var r;to(gT(e.text)),(r=window.getSelection())==null||r.removeAllRanges(),n(null)},className:"fade-in fixed z-50 inline-flex -translate-x-1/2 -translate-y-full items-center gap-1.5 rounded-full bg-ink px-3 py-1.5 text-[12.5px] font-semibold text-paper shadow-float hover:opacity-95",style:{left:e.x,top:e.y-8},children:[d.jsx(eo,{size:13})," Ask the agent"]}):null}const vG=new URLSearchParams(window.location.search).get("doc"),$g=window.location.hash;function kG(){const t=new URLSearchParams(window.location.search).get("live"),e=t??window.location.origin;fetch(`${e}/api/live`).then(n=>n.ok?n.json():Promise.reject(new Error("no hub"))).then(()=>ZA(e)).catch(()=>{t&&T.getState().setLive({state:"lost",url:e})})}function ZA(t,e=0){const n=T.getState();e===0&&n.setLive({state:"connecting",url:t});const r=new EventSource(`${t}/api/live/events`);r.onopen=()=>{e=0,T.getState().setLive({...T.getState().live,state:"on",url:t}),bG(t).then(()=>wG(t))},r.onerror=()=>{T.getState().setLive({...T.getState().live,state:"lost"}),r.readyState===EventSource.CLOSED&&(r.close(),window.setTimeout(()=>ZA(t,e+1),Math.min(1e4,500*2**e)))};let s=!0;r.addEventListener("document",o=>{var p,x;const{revision:a,document:l,source:c}=JSON.parse(o.data),f=kl(l,{extensions:Rd()}),u=T.getState();if(!f.ok||!f.document)return u.notify("The agent sent a document with errors. It was not opened.");const h=s;if(s=!1,h&&u.history&&!u.startOpen&&u.projectId!==f.document.project.id)return u.keepProject(f.document,"live"),u.setLive({state:"on",url:t,revision:a}),u.notify(`“${f.document.project.name}” from Poney on this computer is in the project menu.`);const m=vG===f.document.project.id;if(h&&u.startOpen&&!m)return u.keepProject(f.document,"live"),u.setLive({state:"on",url:t,revision:a});const g=(p=u.projects.find(y=>y.id===f.document.project.id))==null?void 0:p.doc;if(Og(f.document)&&g&&!Og(g)){u.reviseDocument(g,"live"),u.setLive({state:"on",url:t,revision:a}),fetch(`${t}/api/live/open`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({document:g})}).catch(()=>{});return}u.reviseDocument(f.document,"live"),h&&m&&$g.startsWith("#/")&&$g!=="#/start"&&(window.history.replaceState(window.history.state,"",$g),rT()),u.setLive({state:"on",url:t,revision:a}),u.notify(Og(f.document)?`Opened the project “${f.document.project.name}”. Ask the agent for a tour to fill it.`:c==="file"?`Opened “${f.document.project.name}” from its file.`:`The agent opened “${Nr(((x=f.document.walkthroughs[0])==null?void 0:x.title)??f.document.project.name)}” (revision ${a}).`),ov="",Tg(t)}),r.addEventListener("thread",o=>T.getState().setConversation(JSON.parse(o.data).messages)),r.addEventListener("message",o=>T.getState().putMessage(JSON.parse(o.data))),r.addEventListener("agent",o=>T.getState().setAgent(JSON.parse(o.data))),r.addEventListener("project",o=>{const a=JSON.parse(o.data);T.getState().setProject(a.root?{root:a.root,name:a.name??a.root}:null)}),r.addEventListener("overlays",o=>T.getState().setOverlays(JSON.parse(o.data))),r.addEventListener("file",o=>T.getState().setLiveFile(JSON.parse(o.data).path));let i=0;T.subscribe(()=>{clearTimeout(i),i=window.setTimeout(()=>Tg(t),400)}),window.addEventListener("poney:local",()=>{clearTimeout(i),i=window.setTimeout(()=>Tg(t),400)})}let ov="";function Mg(t){try{const e=localStorage.getItem(t);return e?JSON.parse(e):void 0}catch{return}}function Tg(t){const e=T.getState();if(!e.history)return;const n=e.history.present,r=Ep(e.viewId),s=c=>`poney:${c}:${n.project.id}:${r??""}`,i=ft(n),o=e.selection&&i.exists(e.selection)?i.describe(e.selection):void 0,a={projectId:n.project.id,viewId:e.viewId,walkthrough:r,scene:r?e.activeScene??void 0:void 0,selection:e.selection?{ref:de(e.selection),title:(o==null?void 0:o.title)??"",kind:(o==null?void 0:o.kind)??e.selection.kind}:void 0,answers:r?Mg(s("answers")):void 0,notes:r?Mg(s("notes")):void 0,read:r?Mg(s("read")):void 0,document:e.history.past.length||e.history.future.length?n:void 0},l=JSON.stringify(a);l!==ov&&(ov=l,fetch(`${t}/api/live/state`,{method:"POST",headers:{"content-type":"application/json"},body:l}).catch(()=>{}))}const Og=t=>t.views.length===0&&t.walkthroughs.length===0;async function wG(t){var o,a,l,c;const e=T.getState(),n=(o=e.history)==null?void 0:o.present,r=(a=e.projects.find(f=>f.id===e.projectId))==null?void 0:a.origin,s=fh(n==null?void 0:n.project.id);if(!n||!s||r==="example"||e.startOpen)return;const i=await fetch(`${t}/api/agent`).then(f=>f.json()).catch(()=>({}));!i.canStart||(l=i.status)!=null&&l.session||(c=i.status)!=null&&c.listening||await wx(s.agent,s.folder).catch(f=>e.notify(`The agent did not start again: ${f instanceof Error?f.message:String(f)}`))}async function bG(t){var l,c,f;const e=T.getState(),n=(l=e.history)==null?void 0:l.present,r=(c=e.projects.find(u=>u.id===e.projectId))==null?void 0:c.origin;if(!n||r==="example"||e.startOpen||(await fetch(`${t}/api/live`).then(u=>u.json()).catch(()=>({}))).revision!==0)return;const i=e.liveFile??((f=ml().find(u=>u.id===n.project.id))==null?void 0:f.path),o=(u,h)=>fetch(`${t}${u}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(h)});(i?await o("/api/files/open",{path:i}).then(u=>u.ok).catch(()=>!1):!1)||await o("/api/live/open",{document:n}).catch(()=>{})}N$(c6);N$(q6);async function SG(){new URLSearchParams(window.location.search).get("example")==="kestrel"?await VA():WJ();const t=T.getState();!t.history&&window.location.hash!==Ec&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${Ec}`),window.location.hash===Ec?t.showStart(!0):t.history&&(t.viewId.startsWith("walk:")&&window.innerWidth<1700&&t.toggleSidebar(!1),rT()),UJ(),kG(),oB()}function jG(){const t=T(e=>!e.history||e.startOpen);return d.jsxs(d.Fragment,{children:[t?d.jsx(qJ,{}):d.jsx(fG,{children:d.jsx(LJ,{})}),d.jsx(tG,{}),d.jsx(oG,{}),d.jsx(cG,{}),d.jsx(dG,{}),d.jsx(hG,{}),d.jsx(pG,{}),d.jsx(mG,{}),d.jsx(yG,{}),d.jsx(xG,{})]})}window.__poneyStarted?window.location.reload():(window.__poneyStarted=!0,SG().finally(()=>JC(document.getElementById("root")).render(d.jsx(b.StrictMode,{children:d.jsx(jG,{})}))));export{T_ as P,t1 as _,_G as c,PS as g};