var DA=Object.defineProperty;var OA=(e,t,n)=>t in e?DA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M=(e,t,n)=>(OA(e,typeof t!="symbol"?t+"":t,n),n);function NA(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var ph=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y5={exports:{}},y1={},v5={exports:{}},Te={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ud=Symbol.for("react.element"),FA=Symbol.for("react.portal"),$A=Symbol.for("react.fragment"),BA=Symbol.for("react.strict_mode"),zA=Symbol.for("react.profiler"),HA=Symbol.for("react.provider"),UA=Symbol.for("react.context"),WA=Symbol.for("react.forward_ref"),VA=Symbol.for("react.suspense"),GA=Symbol.for("react.memo"),jA=Symbol.for("react.lazy"),Gw=Symbol.iterator;function YA(e){return e===null||typeof e!="object"?null:(e=Gw&&e[Gw]||e["@@iterator"],typeof e=="function"?e:null)}var E5={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w5=Object.assign,b5={};function ic(e,t,n){this.props=e,this.context=t,this.refs=b5,this.updater=n||E5}ic.prototype.isReactComponent={};ic.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ic.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _5(){}_5.prototype=ic.prototype;function zy(e,t,n){this.props=e,this.context=t,this.refs=b5,this.updater=n||E5}var Hy=zy.prototype=new _5;Hy.constructor=zy;w5(Hy,ic.prototype);Hy.isPureReactComponent=!0;var jw=Array.isArray,x5=Object.prototype.hasOwnProperty,Uy={current:null},S5={key:!0,ref:!0,__self:!0,__source:!0};function k5(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)x5.call(t,r)&&!S5.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,B=$[N];if(0>>1;Ni(j,R))Xi(ee,j)?($[N]=ee,$[X]=R,N=X):($[N]=j,$[W]=R,N=W);else if(Xi(ee,R))$[N]=ee,$[X]=R,N=X;else break e}}return Y}function i($,Y){var R=$.sortIndex-Y.sortIndex;return R!==0?R:$.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,h=3,m=!1,g=!1,p=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var Y=n(c);Y!==null;){if(Y.callback===null)r(c);else if(Y.startTime<=$)r(c),Y.sortIndex=Y.expirationTime,t(l,Y);else break;Y=n(c)}}function x($){if(p=!1,w($),!g)if(n(l)!==null)g=!0,q(C);else{var Y=n(c);Y!==null&&U(x,Y.startTime-$)}}function C($,Y){g=!1,p&&(p=!1,y(T),T=-1),m=!0;var R=h;try{for(w(Y),d=n(l);d!==null&&(!(d.expirationTime>Y)||$&&!F());){var N=d.callback;if(typeof N=="function"){d.callback=null,h=d.priorityLevel;var B=N(d.expirationTime<=Y);Y=e.unstable_now(),typeof B=="function"?d.callback=B:d===n(l)&&r(l),w(Y)}else r(l);d=n(l)}if(d!==null)var z=!0;else{var W=n(c);W!==null&&U(x,W.startTime-Y),z=!1}return z}finally{d=null,h=R,m=!1}}var S=!1,I=null,T=-1,L=5,A=-1;function F(){return!(e.unstable_now()-A$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var Y=3;break;default:Y=h}var R=h;h=Y;try{return $()}finally{h=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,Y){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var R=h;h=$;try{return Y()}finally{h=R}},e.unstable_scheduleCallback=function($,Y,R){var N=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0N?($.sortIndex=R,t(c,$),n(l)===null&&$===n(c)&&(p?(y(T),T=-1):p=!0,U(x,R-N))):($.sortIndex=B,t(l,$),g||m||(g=!0,q(C))),$},e.unstable_shouldYield=F,e.unstable_wrapCallback=function($){var Y=h;return function(){var R=h;h=Y;try{return $.apply(this,arguments)}finally{h=R}}}})(M5);T5.exports=M5;var oL=T5.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var A5=_,ir=oL;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_0=Object.prototype.hasOwnProperty,sL=/^[: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]*$/,Kw={},Zw={};function aL(e){return _0.call(Zw,e)?!0:_0.call(Kw,e)?!1:sL.test(e)?Zw[e]=!0:(Kw[e]=!0,!1)}function lL(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function cL(e,t,n,r){if(t===null||typeof t>"u"||lL(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Cn(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var Jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Jt[e]=new Cn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Jt[t]=new Cn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Jt[e]=new Cn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Jt[e]=new Cn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Jt[e]=new Cn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Jt[e]=new Cn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Jt[e]=new Cn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Jt[e]=new Cn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Jt[e]=new Cn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Gy=/[\-:]([a-z])/g;function jy(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Gy,jy);Jt[t]=new Cn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Gy,jy);Jt[t]=new Cn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Gy,jy);Jt[t]=new Cn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Jt[e]=new Cn(e,1,!1,e.toLowerCase(),null,!1,!1)});Jt.xlinkHref=new Cn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Jt[e]=new Cn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Yy(e,t,n,r){var i=Jt.hasOwnProperty(t)?Jt[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{$g=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?iu(e):""}function uL(e){switch(e.tag){case 5:return iu(e.type);case 16:return iu("Lazy");case 13:return iu("Suspense");case 19:return iu("SuspenseList");case 0:case 2:case 15:return e=Bg(e.type,!1),e;case 11:return e=Bg(e.type.render,!1),e;case 1:return e=Bg(e.type,!0),e;default:return""}}function I0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case nl:return"Fragment";case tl:return"Portal";case x0:return"Profiler";case Ky:return"StrictMode";case S0:return"Suspense";case k0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R5:return(e.displayName||"Context")+".Consumer";case P5:return(e._context.displayName||"Context")+".Provider";case Zy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xy:return t=e.displayName||null,t!==null?t:I0(e.type)||"Memo";case Eo:t=e._payload,e=e._init;try{return I0(e(t))}catch{}}return null}function dL(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return I0(t);case 8:return t===Ky?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function is(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O5(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hL(e){var t=O5(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Eh(e){e._valueTracker||(e._valueTracker=hL(e))}function N5(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=O5(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Qf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function C0(e,t){var n=t.checked;return ft({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=is(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function F5(e,t){t=t.checked,t!=null&&Yy(e,"checked",t,!1)}function T0(e,t){F5(e,t);var n=is(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?M0(e,t.type,n):t.hasOwnProperty("defaultValue")&&M0(e,t.type,is(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Qw(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function M0(e,t,n){(t!=="number"||Qf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ou=Array.isArray;function bl(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=wh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Eu={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},fL=["Webkit","ms","Moz","O"];Object.keys(Eu).forEach(function(e){fL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Eu[t]=Eu[e]})});function H5(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Eu.hasOwnProperty(e)&&Eu[e]?(""+t).trim():t+"px"}function U5(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=H5(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var mL=ft({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 P0(e,t){if(t){if(mL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function R0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var D0=null;function qy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var O0=null,_l=null,xl=null;function t3(e){if(e=Gd(e)){if(typeof O0!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=_1(t),O0(e.stateNode,e.type,t))}}function W5(e){_l?xl?xl.push(e):xl=[e]:_l=e}function V5(){if(_l){var e=_l,t=xl;if(xl=_l=null,t3(e),t)for(e=0;e>>=0,e===0?32:31-(kL(e)/IL|0)|0}var bh=64,_h=4194304;function su(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=su(a):(o&=s,o!==0&&(r=su(o)))}else s=n&~i,s!==0?r=su(s):o!==0&&(r=su(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Wd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Wr(t),e[t]=n}function AL(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=bu),u3=" ",d3=!1;function ux(e,t){switch(e){case"keyup":return i9.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rl=!1;function s9(e,t){switch(e){case"compositionend":return dx(t);case"keypress":return t.which!==32?null:(d3=!0,u3);case"textInput":return e=t.data,e===u3&&d3?null:e;default:return null}}function a9(e,t){if(rl)return e==="compositionend"||!ov&&ux(e,t)?(e=lx(),gf=nv=Po=null,rl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=g3(n)}}function gx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function px(){for(var e=window,t=Qf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Qf(e.document)}return t}function sv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function p9(e){var t=px(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&gx(n.ownerDocument.documentElement,n)){if(r!==null&&sv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=p3(n,o);var s=p3(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,il=null,H0=null,xu=null,U0=!1;function y3(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;U0||il==null||il!==Qf(r)||(r=il,"selectionStart"in r&&sv(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}),xu&&Ju(xu,r)||(xu=r,r=om(H0,"onSelect"),0al||(e.current=K0[al],K0[al]=null,al--)}function Ze(e,t){al++,K0[al]=e.current,e.current=t}var os={},fn=ys(os),Fn=ys(!1),la=os;function $l(e,t){var n=e.type.contextTypes;if(!n)return os;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function $n(e){return e=e.childContextTypes,e!=null}function am(){rt(Fn),rt(fn)}function S3(e,t,n){if(fn.current!==os)throw Error(Q(168));Ze(fn,t),Ze(Fn,n)}function kx(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Q(108,dL(e)||"Unknown",i));return ft({},n,r)}function lm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||os,la=fn.current,Ze(fn,e),Ze(Fn,Fn.current),!0}function k3(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=kx(e,t,la),r.__reactInternalMemoizedMergedChildContext=e,rt(Fn),rt(fn),Ze(fn,e)):rt(Fn),Ze(Fn,n)}var $i=null,x1=!1,Jg=!1;function Ix(e){$i===null?$i=[e]:$i.push(e)}function T9(e){x1=!0,Ix(e)}function vs(){if(!Jg&&$i!==null){Jg=!0;var e=0,t=Ue;try{var n=$i;for(Ue=1;e>=s,i-=s,zi=1<<32-Wr(t)+i|n<T?(L=I,I=null):L=I.sibling;var A=h(y,I,w[T],x);if(A===null){I===null&&(I=L);break}e&&I&&A.alternate===null&&t(y,I),E=o(A,E,T),S===null?C=A:S.sibling=A,S=A,I=L}if(T===w.length)return n(y,I),lt&&Is(y,T),C;if(I===null){for(;TT?(L=I,I=null):L=I.sibling;var F=h(y,I,A.value,x);if(F===null){I===null&&(I=L);break}e&&I&&F.alternate===null&&t(y,I),E=o(F,E,T),S===null?C=F:S.sibling=F,S=F,I=L}if(A.done)return n(y,I),lt&&Is(y,T),C;if(I===null){for(;!A.done;T++,A=w.next())A=d(y,A.value,x),A!==null&&(E=o(A,E,T),S===null?C=A:S.sibling=A,S=A);return lt&&Is(y,T),C}for(I=r(y,I);!A.done;T++,A=w.next())A=m(I,y,T,A.value,x),A!==null&&(e&&A.alternate!==null&&I.delete(A.key===null?T:A.key),E=o(A,E,T),S===null?C=A:S.sibling=A,S=A);return e&&I.forEach(function(P){return t(y,P)}),lt&&Is(y,T),C}function v(y,E,w,x){if(typeof w=="object"&&w!==null&&w.type===nl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case vh:e:{for(var C=w.key,S=E;S!==null;){if(S.key===C){if(C=w.type,C===nl){if(S.tag===7){n(y,S.sibling),E=i(S,w.props.children),E.return=y,y=E;break e}}else if(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Eo&&P3(C)===S.type){n(y,S.sibling),E=i(S,w.props),E.ref=Ac(y,S,w),E.return=y,y=E;break e}n(y,S);break}else t(y,S);S=S.sibling}w.type===nl?(E=na(w.props.children,y.mode,x,w.key),E.return=y,y=E):(x=xf(w.type,w.key,w.props,null,y.mode,x),x.ref=Ac(y,E,w),x.return=y,y=x)}return s(y);case tl:e:{for(S=w.key;E!==null;){if(E.key===S)if(E.tag===4&&E.stateNode.containerInfo===w.containerInfo&&E.stateNode.implementation===w.implementation){n(y,E.sibling),E=i(E,w.children||[]),E.return=y,y=E;break e}else{n(y,E);break}else t(y,E);E=E.sibling}E=ap(w,y.mode,x),E.return=y,y=E}return s(y);case Eo:return S=w._init,v(y,E,S(w._payload),x)}if(ou(w))return g(y,E,w,x);if(kc(w))return p(y,E,w,x);Mh(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,E!==null&&E.tag===6?(n(y,E.sibling),E=i(E,w),E.return=y,y=E):(n(y,E),E=sp(w,y.mode,x),E.return=y,y=E),s(y)):n(y,E)}return v}var zl=Dx(!0),Ox=Dx(!1),jd={},bi=ys(jd),rd=ys(jd),id=ys(jd);function Vs(e){if(e===jd)throw Error(Q(174));return e}function gv(e,t){switch(Ze(id,t),Ze(rd,e),Ze(bi,jd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:L0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=L0(t,e)}rt(bi),Ze(bi,t)}function Hl(){rt(bi),rt(rd),rt(id)}function Nx(e){Vs(id.current);var t=Vs(bi.current),n=L0(t,e.type);t!==n&&(Ze(rd,e),Ze(bi,n))}function pv(e){rd.current===e&&(rt(bi),rt(rd))}var ut=ys(0);function mm(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ep=[];function yv(){for(var e=0;en?n:4,e(!0);var r=tp.transition;tp.transition={};try{e(!1),t()}finally{Ue=n,tp.transition=r}}function Qx(){return _r().memoizedState}function P9(e,t,n){var r=Zo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jx(e))eS(t,n);else if(n=Ax(e,t,n,r),n!==null){var i=Sn();Vr(n,e,r,i),tS(n,t,r)}}function R9(e,t,n){var r=Zo(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jx(e))eS(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Zr(a,s)){var l=t.interleaved;l===null?(i.next=i,fv(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Ax(e,t,i,r),n!==null&&(i=Sn(),Vr(n,e,r,i),tS(n,t,r))}}function Jx(e){var t=e.alternate;return e===ht||t!==null&&t===ht}function eS(e,t){Su=gm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Jy(e,n)}}var pm={readContext:br,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useInsertionEffect:nn,useLayoutEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useMutableSource:nn,useSyncExternalStore:nn,useId:nn,unstable_isNewReconciler:!1},D9={readContext:br,useCallback:function(e,t){return ui().memoizedState=[e,t===void 0?null:t],e},useContext:br,useEffect:D3,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ef(4194308,4,Yx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ef(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ef(4,2,e,t)},useMemo:function(e,t){var n=ui();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ui();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=P9.bind(null,ht,e),[r.memoizedState,e]},useRef:function(e){var t=ui();return e={current:e},t.memoizedState=e},useState:R3,useDebugValue:_v,useDeferredValue:function(e){return ui().memoizedState=e},useTransition:function(){var e=R3(!1),t=e[0];return e=L9.bind(null,e[1]),ui().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ht,i=ui();if(lt){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Wt===null)throw Error(Q(349));ua&30||Bx(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,D3(Hx.bind(null,r,o,e),[e]),r.flags|=2048,ad(9,zx.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ui(),t=Wt.identifierPrefix;if(lt){var n=Hi,r=zi;n=(r&~(1<<32-Wr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=od++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[pi]=t,e[nd]=r,uS(e,t,!1,!1),t.stateNode=e;e:{switch(s=R0(n,r),n){case"dialog":Qe("cancel",e),Qe("close",e),i=r;break;case"iframe":case"object":case"embed":Qe("load",e),i=r;break;case"video":case"audio":for(i=0;iWl&&(t.flags|=128,r=!0,Lc(o,!1),t.lanes=4194304)}else{if(!r)if(e=mm(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Lc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!lt)return rn(t),null}else 2*_t()-o.renderingStartTime>Wl&&n!==1073741824&&(t.flags|=128,r=!0,Lc(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=_t(),t.sibling=null,n=ut.current,Ze(ut,r?n&1|2:n&1),t):(rn(t),null);case 22:case 23:return Tv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xn&1073741824&&(rn(t),t.subtreeFlags&6&&(t.flags|=8192)):rn(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function U9(e,t){switch(lv(t),t.tag){case 1:return $n(t.type)&&am(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hl(),rt(Fn),rt(fn),yv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return pv(t),null;case 13:if(rt(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Bl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return rt(ut),null;case 4:return Hl(),null;case 10:return hv(t.type._context),null;case 22:case 23:return Tv(),null;case 24:return null;default:return null}}var Lh=!1,cn=!1,W9=typeof WeakSet=="function"?WeakSet:Set,ae=null;function dl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yt(e,t,r)}else n.current=null}function s2(e,t,n){try{n()}catch(r){yt(e,t,r)}}var W3=!1;function V9(e,t){if(W0=rm,e=px(),sv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=e,h=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(a=s+i),d!==o||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(m=d.firstChild)!==null;)h=d,d=m;for(;;){if(d===e)break t;if(h===n&&++c===i&&(a=s),h===o&&++u===r&&(l=s),(m=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(V0={focusedElem:e,selectionRange:n},rm=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,v=g.memoizedState,y=t.stateNode,E=y.getSnapshotBeforeUpdate(t.elementType===t.type?p:Dr(t.type,p),v);y.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(x){yt(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return g=W3,W3=!1,g}function ku(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&s2(t,n,o)}i=i.next}while(i!==r)}}function I1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function a2(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function fS(e){var t=e.alternate;t!==null&&(e.alternate=null,fS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pi],delete t[nd],delete t[Y0],delete t[I9],delete t[C9])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mS(e){return e.tag===5||e.tag===3||e.tag===4}function V3(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function l2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sm));else if(r!==4&&(e=e.child,e!==null))for(l2(e,t,n),e=e.sibling;e!==null;)l2(e,t,n),e=e.sibling}function c2(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(c2(e,t,n),e=e.sibling;e!==null;)c2(e,t,n),e=e.sibling}var Yt=null,Nr=!1;function ho(e,t,n){for(n=n.child;n!==null;)gS(e,t,n),n=n.sibling}function gS(e,t,n){if(wi&&typeof wi.onCommitFiberUnmount=="function")try{wi.onCommitFiberUnmount(v1,n)}catch{}switch(n.tag){case 5:cn||dl(n,t);case 6:var r=Yt,i=Nr;Yt=null,ho(e,t,n),Yt=r,Nr=i,Yt!==null&&(Nr?(e=Yt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Yt.removeChild(n.stateNode));break;case 18:Yt!==null&&(Nr?(e=Yt,n=n.stateNode,e.nodeType===8?Qg(e.parentNode,n):e.nodeType===1&&Qg(e,n),qu(e)):Qg(Yt,n.stateNode));break;case 4:r=Yt,i=Nr,Yt=n.stateNode.containerInfo,Nr=!0,ho(e,t,n),Yt=r,Nr=i;break;case 0:case 11:case 14:case 15:if(!cn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&s2(n,t,s),i=i.next}while(i!==r)}ho(e,t,n);break;case 1:if(!cn&&(dl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){yt(n,t,a)}ho(e,t,n);break;case 21:ho(e,t,n);break;case 22:n.mode&1?(cn=(r=cn)||n.memoizedState!==null,ho(e,t,n),cn=r):ho(e,t,n);break;default:ho(e,t,n)}}function G3(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new W9),t.forEach(function(r){var i=J9.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Tr(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=_t()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*j9(r/1960))-r,10e?16:e,Ro===null)var r=!1;else{if(e=Ro,Ro=null,Em=0,Re&6)throw Error(Q(331));var i=Re;for(Re|=4,ae=e.current;ae!==null;){var o=ae,s=o.child;if(ae.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l_t()-Iv?ta(e,0):kv|=n),Bn(e,t)}function xS(e,t){t===0&&(e.mode&1?(t=_h,_h<<=1,!(_h&130023424)&&(_h=4194304)):t=1);var n=Sn();e=qi(e,t),e!==null&&(Wd(e,t,n),Bn(e,n))}function Q9(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xS(e,n)}function J9(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(t),xS(e,n)}var SS;SS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Fn.current)Rn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Rn=!1,z9(e,t,n);Rn=!!(e.flags&131072)}else Rn=!1,lt&&t.flags&1048576&&Cx(t,um,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;wf(e,t),e=t.pendingProps;var i=$l(t,fn.current);kl(t,n),i=Ev(null,t,r,e,i,n);var o=wv();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$n(r)?(o=!0,lm(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,mv(t),i.updater=S1,t.stateNode=i,i._reactInternals=t,J0(t,r,e,n),t=n2(null,t,r,!0,o,n)):(t.tag=0,lt&&o&&av(t),En(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(wf(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=tP(r),e=Dr(r,e),i){case 0:t=t2(null,t,r,e,n);break e;case 1:t=z3(null,t,r,e,n);break e;case 11:t=$3(null,t,r,e,n);break e;case 14:t=B3(null,t,r,Dr(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dr(r,i),t2(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dr(r,i),z3(e,t,r,i,n);case 3:e:{if(aS(t),e===null)throw Error(Q(387));r=t.pendingProps,o=t.memoizedState,i=o.element,Lx(e,t),fm(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Ul(Error(Q(423)),t),t=H3(e,t,r,n,i);break e}else if(r!==i){i=Ul(Error(Q(424)),t),t=H3(e,t,r,n,i);break e}else for(qn=jo(t.stateNode.containerInfo.firstChild),tr=t,lt=!0,Br=null,n=Ox(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Bl(),r===i){t=Qi(e,t,n);break e}En(e,t,r,n)}t=t.child}return t;case 5:return Nx(t),e===null&&X0(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,G0(r,i)?s=null:o!==null&&G0(r,o)&&(t.flags|=32),sS(e,t),En(e,t,s,n),t.child;case 6:return e===null&&X0(t),null;case 13:return lS(e,t,n);case 4:return gv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zl(t,null,r,n):En(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dr(r,i),$3(e,t,r,i,n);case 7:return En(e,t,t.pendingProps,n),t.child;case 8:return En(e,t,t.pendingProps.children,n),t.child;case 12:return En(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,Ze(dm,r._currentValue),r._currentValue=s,o!==null)if(Zr(o.value,s)){if(o.children===i.children&&!Fn.current){t=Qi(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Wi(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),q0(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Q(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),q0(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}En(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,kl(t,n),i=br(i),r=r(i),t.flags|=1,En(e,t,r,n),t.child;case 14:return r=t.type,i=Dr(r,t.pendingProps),i=Dr(r.type,i),B3(e,t,r,i,n);case 15:return iS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dr(r,i),wf(e,t),t.tag=1,$n(r)?(e=!0,lm(t)):e=!1,kl(t,n),Rx(t,r,i),J0(t,r,i,n),n2(null,t,r,!0,e,n);case 19:return cS(e,t,n);case 22:return oS(e,t,n)}throw Error(Q(156,t.tag))};function kS(e,t){return q5(e,t)}function eP(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mr(e,t,n,r){return new eP(e,t,n,r)}function Av(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tP(e){if(typeof e=="function")return Av(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Zy)return 11;if(e===Xy)return 14}return 2}function Xo(e,t){var n=e.alternate;return n===null?(n=mr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xf(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")Av(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case nl:return na(n.children,i,o,t);case Ky:s=8,i|=8;break;case x0:return e=mr(12,n,t,i|2),e.elementType=x0,e.lanes=o,e;case S0:return e=mr(13,n,t,i),e.elementType=S0,e.lanes=o,e;case k0:return e=mr(19,n,t,i),e.elementType=k0,e.lanes=o,e;case D5:return T1(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case P5:s=10;break e;case R5:s=9;break e;case Zy:s=11;break e;case Xy:s=14;break e;case Eo:s=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=mr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function na(e,t,n,r){return e=mr(7,e,r,t),e.lanes=n,e}function T1(e,t,n,r){return e=mr(22,e,r,t),e.elementType=D5,e.lanes=n,e.stateNode={isHidden:!1},e}function sp(e,t,n){return e=mr(6,e,null,t),e.lanes=n,e}function ap(e,t,n){return t=mr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nP(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hg(0),this.expirationTimes=Hg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,i,o,s,a,l){return e=new nP(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=mr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},mv(o),e}function rP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(MS)}catch(e){console.error(e)}}MS(),C5.exports=or;var nr=C5.exports;const lP=rc(nr);var AS,J3=nr;AS=J3.createRoot,J3.hydrateRoot;const LS=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,"at",{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)})};function cP(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cd(e){"@babel/helpers - typeof";return cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cd(e)}function uP(e,t){if(cd(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(cd(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dP(e){var t=uP(e,"string");return cd(t)==="symbol"?t:String(t)}function eb(e,t){for(var n=0;n0){var a=i.maxAge-0;if(isNaN(a))throw new Error("maxAge should be a Number");s+="; Max-Age="+Math.floor(a)}if(i.domain){if(!tb.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain="+i.domain}if(i.path){if(!tb.test(i.path))throw new TypeError("option path is invalid");s+="; Path="+i.path}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},nb={create:function(t,n,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),i&&(o.domain=i),document.cookie=pP(t,encodeURIComponent(n),o)},read:function(t){for(var n=t+"=",r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),o=i.split("&"),s=0;s0){var l=o[s].substring(0,a);l===t.lookupQuerystring&&(n=o[s].substring(a+1))}}}return n}},Rc=null,rb=function(){if(Rc!==null)return Rc;try{Rc=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Rc=!1}return Rc},EP={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&rb()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&rb()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Dc=null,ib=function(){if(Dc!==null)return Dc;try{Dc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Dc=!1}return Dc},wP={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&ib()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&ib()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},bP={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},_P={name:"htmlTag",lookup:function(t){var n,r=t.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},xP={name:"path",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof r[t.lookupFromPathIndex]!="string")return;n=r[t.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},SP={name:"subdomain",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);r instanceof Array&&(typeof t.lookupFromSubdomainIndex=="number"?n=r[t.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):n=r[0].replace("http://","").replace("https://","").replace(".",""))}return n}};function kP(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var RS=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};cP(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return hP(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=gP(r,this.options||{},kP()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(yP),this.addDetector(vP),this.addDetector(EP),this.addDetector(wP),this.addDetector(bP),this.addDetector(_P),this.addDetector(xP),this.addDetector(SP)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(o){if(r.detectors[o]){var s=r.detectors[o].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(o){i.detectors[o]&&i.detectors[o].cacheUserLanguage(n,i.options)}))}}]),e}();RS.type="languageDetector";var IP={VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_DISABLE_TRACKING:"",VITE_APP_GIT_SHA:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const CP=["ai"],Ae=(e,t,n,r)=>{try{typeof window>"u"||IP.VITE_WORKER_ID;return}catch(i){console.error("error during analytics",i)}},TP="#ffffff",MP="#000000",AP=["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],LP=["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],PP=["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],RP=["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],DP=["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],OP=["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],NP=["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],FP=["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],$P=["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],BP=["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],zP=["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],HP=["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],UP=["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"],Ut={white:TP,black:MP,gray:AP,red:LP,pink:PP,grape:RP,violet:DP,indigo:OP,blue:NP,cyan:FP,teal:$P,green:BP,lime:zP,yellow:HP,orange:UP},WP=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{}),VP=5,Qa=5,GP=4,lu=4,cu=1,Mr=[0,2,4,6,8],Ar=(e,t)=>t.map(n=>Ut[e][n]),ve={transparent:"transparent",black:"#1e1e1e",white:"#ffffff",gray:Ar("gray",Mr),red:Ar("red",Mr),pink:Ar("pink",Mr),grape:Ar("grape",Mr),violet:Ar("violet",Mr),blue:Ar("blue",Mr),cyan:Ar("cyan",Mr),teal:Ar("teal",Mr),green:Ar("green",Mr),yellow:Ar("yellow",Mr),orange:Ar("orange",Mr),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},DS=WP(ve,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),OS=[ve.black,ve.red[lu],ve.green[lu],ve.blue[lu],ve.yellow[lu]],NS=[ve.transparent,ve.red[cu],ve.green[cu],ve.blue[cu],ve.yellow[cu]],FS=[ve.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],jP={transparent:ve.transparent,white:ve.white,gray:ve.gray,black:ve.black,bronze:ve.bronze,...DS},YP={transparent:ve.transparent,white:ve.white,gray:ve.gray,black:ve.black,bronze:ve.bronze,...DS},KP=e=>[ve.cyan[e],ve.blue[e],ve.violet[e],ve.grape[e],ve.pink[e],ve.green[e],ve.teal[e],ve.yellow[e],ve.orange[e],ve.red[e]],ZP=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`,XP="invert(93%) hue-rotate(180deg)",qP="302px",$S={themeFilter:XP,rightSidebarWidth:qP},ki=/Mac|iPod|iPhone|iPad/.test(navigator.platform),BS=/^Win/.test(navigator.platform),R1="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,QP=navigator.userAgent.indexOf("Chrome")!==-1;!QP&&navigator.userAgent.indexOf("Safari");const JP=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,eR=()=>{var e,t;return((t=(e=navigator.brave)==null?void 0:e.isBrave)==null?void 0:t.name)==="isBrave"},m2=typeof window<"u"&&"ResizeObserver"in window,Vi="Excalidraw",Ts=10,Sf=8,tR=5,ob=1,nR=30,ss=Math.PI/12,rR="red",Be={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},xs={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},Ms={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"};var Z=(e=>(e.COPY="copy",e.PASTE="paste",e.CUT="cut",e.KEYDOWN="keydown",e.KEYUP="keyup",e.MOUSE_MOVE="mousemove",e.RESIZE="resize",e.UNLOAD="unload",e.FOCUS="focus",e.BLUR="blur",e.DRAG_OVER="dragover",e.DROP="drop",e.GESTURE_END="gestureend",e.BEFORE_UNLOAD="beforeunload",e.GESTURE_START="gesturestart",e.GESTURE_CHANGE="gesturechange",e.POINTER_MOVE="pointermove",e.POINTER_DOWN="pointerdown",e.POINTER_UP="pointerup",e.STATE_CHANGE="statechange",e.WHEEL="wheel",e.TOUCH_START="touchstart",e.TOUCH_END="touchend",e.HASHCHANGE="hashchange",e.VISIBILITY_CHANGE="visibilitychange",e.SCROLL="scroll",e.EXCALIDRAW_LINK="excalidraw-link",e.MENU_ITEM_SELECT="menu.itemSelect",e.MESSAGE="message",e.FULLSCREENCHANGE="fullscreenchange",e))(Z||{});const Dh={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},zS={SHAPE_ACTIONS_MENU:"App-menu__left"},Xt={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},Tt={LIGHT:"light",DARK:"dark"},vt={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},sb="Segoe UI Emoji",Ov=1,Xr=20,oo=Xt.Virgil,D1="left",_m="top",HS="{version}",ud=2,Oh="#ffffff",iR="#1e1e1e",oR="#a2f1a6",Cl=20,Nv={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},sR=["text/plain","text/html"],de={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...Nv},lp={png:"png",svg:"svg",clipboard:"clipboard"},yr={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},Fv=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,aR=500,lR=300,cR=500,uR=1e4,dR=3e4,hR=100,dd=.1,US=.1,fR=300,ab=6e4,lb=3e3,$v=$S.themeFilter,g2={addLibrary:"addLibrary"},p2={addLibrary:"addLibrary"},cb={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},mR=730,gR=1e3,pR=500,yR=1229,vR=parseInt($S.rightSidebarWidth),Oc=2,Bv=[1,2,3],ac=10,ER=1440,ub=2*1024*1024,Ke="http://www.w3.org/2000/svg",WS=128,O1={excalidraw:2,excalidrawLibrary:2},Nt=5,wR=.7,bR=11,Qn={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},hd={LEFT:"left",CENTER:"center",RIGHT:"right"},_R=20,cp=.25,xR=32,Vt={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},Do="__precedingElement__",VS={architect:0,artist:1,cartoonist:2},up={thin:1,bold:2,extraBold:4},dt={strokeColor:ve.black,backgroundColor:ve.transparent,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:VS.artist,opacity:100,locked:!1},zv="library",Tl={name:"default",defaultTab:zv},GS=new Set(["iframe","embeddable","image"]),zt={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},qo={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},jS="Untitled",SR=Bv.includes(devicePixelRatio)?devicePixelRatio:1,qr=()=>({showWelcomeScreen:!1,theme:Tt.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:dt.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:dt.fillStyle,currentItemFontFamily:oo,currentItemFontSize:Xr,currentItemOpacity:dt.opacity,currentItemRoughness:dt.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:dt.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:dt.strokeStyle,currentItemStrokeWidth:dt.strokeWidth,currentItemTextAlign:D1,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:dt.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:SR,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:ve.white,zenModeEnabled:!1,zoom:{value:1},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),kR=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),Hv=(e,t)=>{const n={};for(const r of Object.keys(e)){const i=kR[r];if(i!=null&&i[t]){const o=e[r];n[r]=o}}return n},YS=e=>Hv(e,"browser"),KS=e=>Hv(e,"export"),IR=e=>Hv(e,"server"),mi=({activeTool:e})=>e.type==="eraser",Vl=({activeTool:e})=>e.type==="hand",CR="modulepreload",TR=function(e){return"/"+e},db={},ie=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const o=document.getElementsByTagName("link");i=Promise.all(n.map(s=>{if(s=TR(s),s in db)return;db[s]=!0;const a=s.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let d=o.length-1;d>=0;d--){const h=o[d];if(h.href===s&&(!a||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":CR,a||(u.as="script",u.crossOrigin=""),u.href=s,document.head.appendChild(u),a)return new Promise((d,h)=>{u.addEventListener("load",d),u.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${s}`)))})}))}return i.then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},MR=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+t)))})},ZS={paste:"Paste",pasteAsPlaintext:"Paste as plaintext",pasteCharts:"Paste charts",selectAll:"Select all",multiSelect:"Add element to selection",moveCanvas:"Move canvas",cut:"Cut",copy:"Copy",copyAsPng:"Copy to clipboard as PNG",copyAsSvg:"Copy to clipboard as SVG",copyText:"Copy to clipboard as text",copySource:"Copy source to clipboard",convertToCode:"Convert to code",bringForward:"Bring forward",sendToBack:"Send to back",bringToFront:"Bring to front",sendBackward:"Send backward",delete:"Delete",copyStyles:"Copy styles",pasteStyles:"Paste styles",stroke:"Stroke",background:"Background",fill:"Fill",strokeWidth:"Stroke width",strokeStyle:"Stroke style",strokeStyle_solid:"Solid",strokeStyle_dashed:"Dashed",strokeStyle_dotted:"Dotted",sloppiness:"Sloppiness",opacity:"Opacity",textAlign:"Text align",edges:"Edges",sharp:"Sharp",round:"Round",arrowheads:"Arrowheads",arrowhead_none:"None",arrowhead_arrow:"Arrow",arrowhead_bar:"Bar",arrowhead_circle:"Circle",arrowhead_circle_outline:"Circle (outline)",arrowhead_triangle:"Triangle",arrowhead_triangle_outline:"Triangle (outline)",arrowhead_diamond:"Diamond",arrowhead_diamond_outline:"Diamond (outline)",fontSize:"Font size",fontFamily:"Font family",addWatermark:'Add "Made with Excalidraw"',handDrawn:"Hand-drawn",normal:"Normal",code:"Code",small:"Small",medium:"Medium",large:"Large",veryLarge:"Very large",solid:"Solid",hachure:"Hachure",zigzag:"Zigzag",crossHatch:"Cross-hatch",thin:"Thin",bold:"Bold",left:"Left",center:"Center",right:"Right",extraBold:"Extra bold",architect:"Architect",artist:"Artist",cartoonist:"Cartoonist",fileTitle:"File name",colorPicker:"Color picker",canvasColors:"Used on canvas",canvasBackground:"Canvas background",drawingCanvas:"Drawing canvas",layers:"Layers",actions:"Actions",language:"Language",liveCollaboration:"Live collaboration...",duplicateSelection:"Duplicate",untitled:"Untitled",name:"Name",yourName:"Your name",madeWithExcalidraw:"Made with Excalidraw",group:"Group selection",ungroup:"Ungroup selection",collaborators:"Collaborators",showGrid:"Show grid",addToLibrary:"Add to library",removeFromLibrary:"Remove from library",libraryLoadingMessage:"Loading library…",libraries:"Browse libraries",loadingScene:"Loading scene…",align:"Align",alignTop:"Align top",alignBottom:"Align bottom",alignLeft:"Align left",alignRight:"Align right",centerVertically:"Center vertically",centerHorizontally:"Center horizontally",distributeHorizontally:"Distribute horizontally",distributeVertically:"Distribute vertically",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical",viewMode:"View mode",share:"Share",showStroke:"Show stroke color picker",showBackground:"Show background color picker",toggleTheme:"Toggle theme",personalLib:"Personal Library",excalidrawLib:"Excalidraw Library",decreaseFontSize:"Decrease font size",increaseFontSize:"Increase font size",unbindText:"Unbind text",bindText:"Bind text to the container",createContainerFromText:"Wrap text in a container",link:{edit:"Edit link",editEmbed:"Edit link & embed",create:"Create link",createEmbed:"Create link & embed",label:"Link",labelEmbed:"Link & embed",empty:"No link is set"},lineEditor:{edit:"Edit line",exit:"Exit line editor"},elementLock:{lock:"Lock",unlock:"Unlock",lockAll:"Lock all",unlockAll:"Unlock all"},statusPublished:"Published",sidebarLock:"Keep sidebar open",selectAllElementsInFrame:"Select all elements in frame",removeAllElementsFromFrame:"Remove all elements from frame",eyeDropper:"Pick color from canvas",textToDiagram:"Text to diagram",prompt:"Prompt",followUs:"Follow us",discordChat:"Discord chat"},XS={noItems:"No items added yet...",hint_emptyLibrary:"Select an item on canvas to add it here, or install a library from the public repository, below.",hint_emptyPrivateLibrary:"Select an item on canvas to add it here."},qS={clearReset:"Reset the canvas",exportJSON:"Export to file",exportImage:"Export image...",export:"Save to...",copyToClipboard:"Copy to clipboard",save:"Save to current file",saveAs:"Save as",load:"Open",getShareableLink:"Get shareable link",close:"Close",selectLanguage:"Select language",scrollBackToContent:"Scroll back to content",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoom:"Reset zoom",menu:"Menu",done:"Done",edit:"Edit",undo:"Undo",redo:"Redo",resetLibrary:"Reset library",createNewRoom:"Create new room",fullScreen:"Full screen",darkMode:"Dark mode",lightMode:"Light mode",zenMode:"Zen mode",objectsSnapMode:"Snap to objects",exitZenMode:"Exit zen mode",cancel:"Cancel",clear:"Clear",remove:"Remove",embed:"Toggle embedding",publishLibrary:"Publish",submit:"Submit",confirm:"Confirm",embeddableInteractionButton:"Click to interact"},QS={clearReset:"This will clear the whole canvas. Are you sure?",couldNotCreateShareableLink:"Couldn't create shareable link.",couldNotCreateShareableLinkTooBig:"Couldn't create shareable link: the scene is too big",couldNotLoadInvalidFile:"Couldn't load invalid file",importBackendFailed:"Importing from backend failed.",cannotExportEmptyCanvas:"Cannot export empty canvas.",couldNotCopyToClipboard:"Couldn't copy to clipboard.",decryptFailed:"Couldn't decrypt data.",uploadedSecurly:"The upload has been secured with end-to-end encryption, which means that Excalidraw server and third parties can't read the content.",loadSceneOverridePrompt:"Loading external drawing will replace your existing content. Do you wish to continue?",collabStopOverridePrompt:`Stopping the session will overwrite your previous, locally stored drawing. Are you sure? (If you want to keep your local drawing, simply close the browser tab instead.)`,errorAddingToLibrary:"Couldn't add item to the library",errorRemovingFromLibrary:"Couldn't remove item from the library",confirmAddLibrary:"This will add {{numShapes}} shape(s) to your library. Are you sure?",imageDoesNotContainScene:"This image does not seem to contain any scene data. Have you enabled scene embedding during export?",cannotRestoreFromImage:"Scene couldn't be restored from this image file",invalidSceneUrl:"Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.",resetLibrary:"This will clear your library. Are you sure?",removeItemsFromsLibrary:"Delete {{count}} item(s) from library?",invalidEncryptionKey:"Encryption key must be of 22 characters. Live collaboration is disabled.",collabOfflineWarning:`No internet connection available. Your changes will not be saved!`},JS={unsupportedFileType:"Unsupported file type.",imageInsertError:"Couldn't insert image. Try again later...",fileTooBig:"File is too big. Maximum allowed size is {{maxSize}}.",svgImageInsertError:"Couldn't insert SVG image. The SVG markup looks invalid.",failedToFetchImage:"Failed to fetch image.",cannotResolveCollabServer:"Couldn't connect to the collab server. Please reload the page and try again.",importLibraryError:"Couldn't load library",saveLibraryError:"Couldn't save library to storage. Please save your library to a file locally to make sure you don't lose changes.",collabSaveFailed:"Couldn't save to the backend database. If problems persist, you should save your file locally to ensure you don't lose your work.",collabSaveFailed_sizeExceeded:"Couldn't save to the backend database, the canvas seems to be too big. You should save the file locally to ensure you don't lose your work.",imageToolNotSupported:"Images are disabled.",brave_measure_text_error:{line1:"Looks like you are using Brave browser with the Aggressively Block Fingerprinting setting enabled.",line2:"This could result in breaking the Text Elements in your drawings.",line3:"We strongly recommend disabling this setting. You can follow these steps on how to do so.",line4:"If disabling this setting doesn't fix the display of text elements, please open an issue on our GitHub, or write us on Discord"},libraryElementTypeError:{embeddable:"Embeddable elements cannot be added to the library.",iframe:"IFrame elements cannot be added to the library.",image:"Support for adding images to the library coming soon!"},asyncPasteFailedOnRead:"Couldn't paste (couldn't read from system clipboard).",asyncPasteFailedOnParse:"Couldn't paste.",copyToSystemClipboardFailed:"Couldn't copy to clipboard."},ek={selection:"Selection",image:"Insert image",rectangle:"Rectangle",diamond:"Diamond",ellipse:"Ellipse",arrow:"Arrow",line:"Line",freedraw:"Draw",text:"Text",library:"Library",lock:"Keep selected tool active after drawing",penMode:"Pen mode - prevent touch",link:"Add / Update link for a selected shape",eraser:"Eraser",frame:"Frame tool",magicframe:"Wireframe to code",embeddable:"Web Embed",laser:"Laser pointer",hand:"Hand (panning tool)",extraTools:"More tools",mermaidToExcalidraw:"Mermaid to Excalidraw",magicSettings:"AI settings"},tk={canvasActions:"Canvas actions",selectedShapeActions:"Selected shape actions",shapes:"Shapes"},nk={canvasPanning:"To move canvas, hold mouse wheel or spacebar while dragging, or use the hand tool",linearElement:"Click to start multiple points, drag for single line",freeDraw:"Click and drag, release when you're finished",text:"Tip: you can also add text by double-clicking anywhere with the selection tool",embeddable:"Click-drag to create a website embed",text_selected:"Double-click or press ENTER to edit text",text_editing:"Press Escape or CtrlOrCmd+ENTER to finish editing",linearElementMulti:"Click on last point or press Escape or Enter to finish",lockAngle:"You can constrain angle by holding SHIFT",resize:`You can constrain proportions by holding SHIFT while resizing, hold ALT to resize from the center`,resizeImage:`You can resize freely by holding SHIFT, hold ALT to resize from the center`,rotate:"You can constrain angles by holding SHIFT while rotating",lineEditor_info:"Hold CtrlOrCmd and Double-click or press CtrlOrCmd + Enter to edit points",lineEditor_pointSelected:`Press Delete to remove point(s), CtrlOrCmd+D to duplicate, or drag to move`,lineEditor_nothingSelected:`Select a point to edit (hold SHIFT to select multiple), or hold Alt and click to add new points`,placeImage:"Click to place the image, or click and drag to set its size manually",publishLibrary:"Publish your own library",bindTextToElement:"Press enter to add text",deepBoxSelect:"Hold CtrlOrCmd to deep select, and to prevent dragging",eraserRevert:"Hold Alt to revert the elements marked for deletion",firefox_clipboard_write:'This feature can likely be enabled by setting the "dom.events.asyncClipboard.clipboardItem" flag to "true". To change the browser flags in Firefox, visit the "about:config" page.',disableSnapping:"Hold CtrlOrCmd to disable snapping"},rk={cannotShowPreview:"Cannot show preview",canvasTooBig:"The canvas may be too big.",canvasTooBigTip:"Tip: try moving the farthest elements a bit closer together."},ik={headingMain:"Encountered an error. Try .",clearCanvasMessage:"If reloading doesn't work, try .",clearCanvasCaveat:" This will result in loss of work ",trackedToSentry:"The error with identifier {{eventId}} was tracked on our system.",openIssueMessage:"We were very cautious not to include your scene information on the error. If your scene is not private, please consider following up on our . Please include information below by copying and pasting into the GitHub issue.",sceneContent:"Scene content:"},ok={or:"Or"},sk={desc_intro:"Invite people to collaborate on your drawing.",desc_privacy:"Don't worry, the session is end-to-end encrypted, and fully private. Not even our server can see what you draw.",button_startSession:"Start session",button_stopSession:"Stop session",desc_inProgressIntro:"Live-collaboration session is now in progress.",desc_shareLink:"Share this link with anyone you want to collaborate with:",desc_exitSession:"Stopping the session will disconnect you from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version.",shareTitle:"Join a live collaboration session on Excalidraw"},ak={title:"Error"},lk={disk_title:"Save to disk",disk_details:"Export the scene data to a file from which you can import later.",disk_button:"Save to file",link_title:"Shareable link",link_details:"Export as a read-only link.",link_button:"Export to Link",excalidrawplus_description:"Save the scene to your Excalidraw+ workspace.",excalidrawplus_button:"Export",excalidrawplus_exportError:"Couldn't export to Excalidraw+ at this moment..."},ck={blog:"Read our blog",click:"click",deepSelect:"Deep select",deepBoxSelect:"Deep select within box, and prevent dragging",curvedArrow:"Curved arrow",curvedLine:"Curved line",documentation:"Documentation",doubleClick:"double-click",drag:"drag",editor:"Editor",editLineArrowPoints:"Edit line/arrow points",editText:"Edit text / add label",github:"Found an issue? Submit",howto:"Follow our guides",or:"or",preventBinding:"Prevent arrow binding",tools:"Tools",shortcuts:"Keyboard shortcuts",textFinish:"Finish editing (text editor)",textNewLine:"Add new line (text editor)",title:"Help",view:"View",zoomToFit:"Zoom to fit all elements",zoomToSelection:"Zoom to selection",toggleElementLock:"Lock/unlock selection",movePageUpDown:"Move page up/down",movePageLeftRight:"Move page left/right"},uk={title:"Clear canvas"},dk={title:"Publish library",itemName:"Item name",authorName:"Author name",githubUsername:"GitHub username",twitterUsername:"Twitter username",libraryName:"Library name",libraryDesc:"Library description",website:"Website",placeholder:{authorName:"Your name or username",libraryName:"Name of your library",libraryDesc:"Description of your library to help people understand its usage",githubHandle:"GitHub handle (optional), so you can edit the library once submitted for review",twitterHandle:"Twitter username (optional), so we know who to credit when promoting over Twitter",website:"Link to your personal website or elsewhere (optional)"},errors:{required:"Required",website:"Enter a valid URL"},noteDescription:"Submit your library to be included in the public library repository for other people to use in their drawings.",noteGuidelines:"The library needs to be manually approved first. Please read the guidelines before submitting. You will need a GitHub account to communicate and make changes if requested, but it is not strictly required.",noteLicense:"By submitting, you agree the library will be published under the MIT License, which in short means anyone can use them without restrictions.",noteItems:"Each library item must have its own name so it's filterable. The following library items will be included:",atleastOneLibItem:"Please select at least one library item to get started",republishWarning:"Note: some of the selected items are marked as already published/submitted. You should only resubmit items when updating an existing library or submission."},hk={title:"Library submitted",content:"Thank you {{authorName}}. Your library has been submitted for review. You can track the status here"},fk={resetLibrary:"Reset library",removeItemsFromLib:"Remove selected items from library"},mk={header:"Export image",label:{withBackground:"Background",onlySelected:"Only selected",darkMode:"Dark mode",embedScene:"Embed scene",scale:"Scale",padding:"Padding"},tooltip:{embedScene:`Scene data will be saved into the exported PNG/SVG file so that the scene can be restored from it. Will increase exported file size.`},title:{exportToPng:"Export to PNG",exportToSvg:"Export to SVG",copyPngToClipboard:"Copy PNG to clipboard"},button:{exportToPng:"PNG",exportToSvg:"SVG",copyPngToClipboard:"Copy to clipboard"}},gk={tooltip:"Your drawings are end-to-end encrypted so Excalidraw's servers will never see them.",link:"Blog post on end-to-end encryption in Excalidraw"},pk={angle:"Angle",element:"Element",elements:"Elements",height:"Height",scene:"Scene",selected:"Selected",storage:"Storage",title:"Stats for nerds",total:"Total",version:"Version",versionCopy:"Click to copy",versionNotAvailable:"Version not available",width:"Width"},yk={addedToLibrary:"Added to library",copyStyles:"Copied styles.",copyToClipboard:"Copied to clipboard.",copyToClipboardAsPng:`Copied {{exportSelection}} to clipboard as PNG ({{exportColorScheme}})`,fileSaved:"File saved.",fileSavedToFilename:"Saved to {filename}",canvas:"canvas",selection:"selection",pasteAsSingleElement:`Use {{shortcut}} to paste as a single element, or paste into an existing text editor`,unableToEmbed:"Embedding this url is currently not allowed. Raise an issue on GitHub to request the url whitelisted",unrecognizedLinkFormat:"The link you embedded does not match the expected format. Please try to paste the 'embed' string provided by the source site"},vk={transparent:"Transparent",black:"Black",white:"White",red:"Red",pink:"Pink",grape:"Grape",violet:"Violet",gray:"Gray",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",yellow:"Yellow",orange:"Orange",bronze:"Bronze"},Ek={app:{center_heading:"All your data is saved locally in your browser.",center_heading_plus:"Did you want to go to the Excalidraw+ instead?",menuHint:"Export, preferences, languages, ..."},defaults:{menuHint:"Export, preferences, and more...",center_heading:"Diagrams. Made. Simple.",toolbarHint:"Pick a tool & Start drawing!",helpHint:"Shortcuts & help"}},wk={mostUsedCustomColors:"Most used custom colors",colors:"Colors",shades:"Shades",hexCode:"Hex code",noShades:"No shades available for this color"},bk={action:{exportToImage:{title:"Export as image",button:"Export as image",description:"Export the scene data as an image from which you can import later."},saveToDisk:{title:"Save to disk",button:"Save to disk",description:"Export the scene data to a file from which you can import later."},excalidrawPlus:{title:"Excalidraw+",button:"Export to Excalidraw+",description:"Save the scene to your Excalidraw+ workspace."}},modal:{loadFromFile:{title:"Load from file",button:"Load from file",description:"Loading from a file will replace your existing content.

You can back up your drawing first using one of the options below."},shareableLink:{title:"Load from link",button:"Replace my content",description:"Loading external drawing will replace your existing content.

You can back up your drawing first by using one of the options below."}}},_k={title:"Mermaid to Excalidraw",button:"Insert",description:"Currently only Flowchart, Sequence, and Class Diagrams are supported. The other types will be rendered as image in Excalidraw.",syntax:"Mermaid Syntax",preview:"Preview"},xk={search:{placeholder:"Quick search",empty:"No users found"},hint:{text:"Click on user to follow",followStatus:"You're currently following this user",inCall:"User is in a voice call",micMuted:"User's microphone is muted",isSpeaking:"User is speaking"}},Uv={labels:ZS,library:XS,buttons:qS,alerts:QS,errors:JS,toolBar:ek,headings:tk,hints:nk,canvasError:rk,errorSplash:ik,shareDialog:ok,roomDialog:sk,errorDialog:ak,exportDialog:lk,helpDialog:ck,clearCanvasDialog:uk,publishDialog:dk,publishSuccessDialog:hk,confirmDialog:fk,imageExportDialog:mk,encrypted:gk,stats:pk,toast:yk,colors:vk,welcomeScreen:Ek,colorPicker:wk,overwriteConfirm:bk,mermaid:_k,userList:xk},AR=Object.freeze(Object.defineProperty({__proto__:null,alerts:QS,buttons:qS,canvasError:rk,clearCanvasDialog:uk,colorPicker:wk,colors:vk,confirmDialog:fk,default:Uv,encrypted:gk,errorDialog:ak,errorSplash:ik,errors:JS,exportDialog:lk,headings:tk,helpDialog:ck,hints:nk,imageExportDialog:mk,labels:ZS,library:XS,mermaid:_k,overwriteConfirm:bk,publishDialog:dk,publishSuccessDialog:hk,roomDialog:sk,shareDialog:ok,stats:pk,toast:yk,toolBar:ek,userList:xk,welcomeScreen:Ek},Symbol.toStringTag,{value:"Module"})),Sk=100,kk=36,Ik={"ar-SA":94,"az-AZ":17,"bg-BG":71,"bn-BD":52,"ca-ES":83,"cs-CZ":86,"da-DK":61,"de-DE":100,"el-GR":80,en:Sk,"es-ES":96,"eu-ES":97,"fa-IR":84,"fi-FI":76,"fr-FR":99,"gl-ES":86,"he-IL":77,"hi-IN":76,"hu-HU":76,"id-ID":91,"it-IT":98,"ja-JP":90,kaa:kk,"kab-KAB":76,"kk-KZ":18,"km-KH":83,"ko-KR":100,"ku-TR":87,"lt-LT":48,"lv-LV":77,"mr-IN":98,"my-MM":35,"nb-NO":93,"nl-NL":75,"nn-NO":67,"oc-FR":92,"pa-IN":78,"pl-PL":99,"pt-BR":91,"pt-PT":83,"ro-RO":99,"ru-RU":92,"si-LK":7,"sk-SK":100,"sl-SI":100,"sv-SE":100,"ta-IN":81,"th-TH":44,"tr-TR":87,"uk-UA":93,"vi-VN":49,"zh-CN":100,"zh-HK":22,"zh-TW":100},LR=Object.freeze(Object.defineProperty({__proto__:null,default:Ik,en:Sk,kaa:kk},Symbol.toStringTag,{value:"Module"}));let PR=0;function RR(e,t){const n=`atom${++PR}`,r={toString:()=>n};return typeof e=="function"?r.read=e:(r.init=e,r.read=i=>i(r),r.write=(i,o,s)=>o(r,typeof s=="function"?s(i(r)):s)),t&&(r.write=t),r}var Kn={VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_DISABLE_TRACKING:"",VITE_APP_GIT_SHA:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const as=Symbol(),y2=e=>!!e[as],Nh=e=>!e[as].c,Nc=e=>{var t;const{b:n,c:r}=e[as];r&&(r(),(t=OR.get(n))==null||t())},kf=(e,t)=>{const n=e[as].o,r=t[as].o;return n===r||e===r||y2(n)&&kf(n,t)},v2=(e,t)=>{const n={b:e,o:t,c:null},r=new Promise(i=>{n.c=()=>{n.c=null,i()},t.finally(n.c)});return r[as]=n,r},DR=e=>v2(e[as].b,e[as].o),OR=new WeakMap,Fh=e=>"init"in e,fd="r",xm="w",md="c",Sm="s",hb="h",NR="n",FR="l",$R="a",BR="m",Ck=e=>{const t=new WeakMap,n=new WeakMap,r=new Map;let i,o;if((Kn&&"production")!=="production"&&(i=new Set,o=new Set),e)for(const[R,N]of e){const B={v:N,r:0,y:!0,d:new Map};(Kn&&"production")!=="production"&&(Object.freeze(B),Fh(R)||console.warn("Found initial value for derived atom which can cause unexpected behavior",R)),t.set(R,B)}const s=new WeakMap,a=(R,N,B)=>{let z=s.get(N);z||(z=new Map,s.set(N,z)),B.then(()=>{z.get(R)===B&&(z.delete(R),z.size||s.delete(N))}),z.set(R,B)},l=R=>{const N=new Set,B=s.get(R);return B&&(s.delete(R),B.forEach((z,W)=>{Nc(z),N.add(W)})),N},c=new WeakMap,u=R=>{let N=c.get(R);return N||(N=new Map,c.set(R,N)),N},d=(R,N)=>{if(R){const B=u(R);let z=B.get(N);return z||(z=d(R.p,N),z&&"p"in z&&Nh(z.p)&&(z=void 0),z&&B.set(N,z)),z}return t.get(N)},h=(R,N,B)=>{if((Kn&&"production")!=="production"&&Object.freeze(B),R)u(R).set(N,B);else{const z=t.get(N);t.set(N,B),r.has(N)||r.set(N,z)}},m=(R,N=new Map,B)=>{if(!B)return N;const z=new Map;let W=!1;return B.forEach(j=>{var X;const ee=((X=d(R,j))==null?void 0:X.r)||0;z.set(j,ee),N.get(j)!==ee&&(W=!0)}),N.size===z.size&&!W?N:z},g=(R,N,B,z,W)=>{const j=d(R,N);if(j){if(W&&(!("p"in j)||!kf(j.p,W)))return j;"p"in j&&Nc(j.p)}const X={v:B,r:(j==null?void 0:j.r)||0,y:!0,d:m(R,j==null?void 0:j.d,z)};let ee=!(j!=null&&j.y);return!j||!("v"in j)||!Object.is(j.v,B)?(ee=!0,++X.r,X.d.has(N)&&(X.d=new Map(X.d).set(N,X.r))):X.d!==j.d&&(X.d.size!==j.d.size||!Array.from(X.d.keys()).every(xe=>j.d.has(xe)))&&(ee=!0,Promise.resolve().then(()=>{G(R)})),j&&!ee?j:(h(R,N,X),X)},p=(R,N,B,z,W)=>{const j=d(R,N);if(j){if(W&&(!("p"in j)||!kf(j.p,W)))return j;"p"in j&&Nc(j.p)}const X={e:B,r:((j==null?void 0:j.r)||0)+1,y:!0,d:m(R,j==null?void 0:j.d,z)};return h(R,N,X),X},v=(R,N,B,z)=>{const W=d(R,N);if(W&&"p"in W){if(kf(W.p,B)&&!Nh(W.p))return W.y?W:{...W,y:!0};Nc(W.p)}a(R,N,B);const j={p:B,r:((W==null?void 0:W.r)||0)+1,y:!0,d:m(R,W==null?void 0:W.d,z)};return h(R,N,j),j},y=(R,N,B,z)=>{if(B instanceof Promise){const W=v2(B,B.then(j=>{g(R,N,j,z,W)}).catch(j=>{if(j instanceof Promise)return y2(j)?j.then(()=>{w(R,N,!0)}):j;p(R,N,j,z,W)}));return v(R,N,W,z)}return g(R,N,B,z)},E=(R,N)=>{const B=d(R,N);if(B){const z={...B,y:!1};h(R,N,z)}else(Kn&&"production")!=="production"&&console.warn("[Bug] could not invalidate non existing atom",N)},w=(R,N,B)=>{if(!B){const W=d(R,N);if(W){if(W.y&&"p"in W&&!Nh(W.p))return W;if(W.d.forEach((j,X)=>{if(X!==N)if(!n.has(X))w(R,X);else{const ee=d(R,X);ee&&!ee.y&&w(R,X)}}),Array.from(W.d).every(([j,X])=>{const ee=d(R,j);return ee&&!("p"in ee)&&ee.r===X}))return W.y?W:{...W,y:!0}}}const z=new Set;try{const W=N.read(j=>{z.add(j);const X=j===N?d(R,j):w(R,j);if(X){if("e"in X)throw X.e;if("p"in X)throw X.p;return X.v}if(Fh(j))return j.init;throw new Error("no atom init")});return y(R,N,W,z)}catch(W){if(W instanceof Promise){const j=y2(W)&&Nh(W)?DR(W):v2(W,W);return v(R,N,j,z)}return p(R,N,W,z)}},x=(R,N)=>w(N,R),C=(R,N)=>{let B=n.get(N);return B||(B=P(R,N)),B},S=(R,N)=>!N.l.size&&(!N.t.size||N.t.size===1&&N.t.has(R)),I=(R,N)=>{const B=n.get(N);B&&S(N,B)&&O(R,N)},T=(R,N)=>{const B=n.get(N);B==null||B.t.forEach(z=>{z!==N&&(E(R,z),T(R,z))})},L=(R,N,B)=>{let z=!0;const W=(ee,xe)=>{const Fe=w(R,ee);if("e"in Fe)throw Fe.e;if("p"in Fe){if(xe!=null&&xe.unstable_promise)return Fe.p.then(()=>{const Se=d(R,ee);return Se&&"p"in Se&&Se.p===Fe.p?new Promise(Me=>setTimeout(Me)).then(()=>W(ee,xe)):W(ee,xe)});throw(Kn&&"production")!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ee),Fe.p}if("v"in Fe)return Fe.v;throw(Kn&&"production")!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ee),new Error("no value found")},j=(ee,xe)=>{let Fe;if(ee===N){if(!Fh(ee))throw new Error("atom not writable");l(ee).forEach(it=>{it!==R&&y(it,ee,xe)});const Me=d(R,ee),Et=y(R,ee,xe);Me!==Et&&T(R,ee)}else Fe=L(R,ee,xe);return z||G(R),Fe},X=N.write(W,j,B);return z=!1,X},A=(R,N,B)=>{const z=L(B,R,N);return G(B),z},F=R=>!!R.write,P=(R,N,B)=>{const z={t:new Set(B&&[B]),l:new Set};if(n.set(N,z),(Kn&&"production")!=="production"&&o.add(N),w(void 0,N).d.forEach((j,X)=>{const ee=n.get(X);ee?ee.t.add(N):X!==N&&P(R,X,N)}),F(N)&&N.onMount){const j=ee=>A(N,ee,R),X=N.onMount(j);R=void 0,X&&(z.u=X)}return z},O=(R,N)=>{var B;const z=(B=n.get(N))==null?void 0:B.u;z&&z(),n.delete(N),(Kn&&"production")!=="production"&&o.delete(N);const W=d(R,N);W?("p"in W&&Nc(W.p),W.d.forEach((j,X)=>{if(X!==N){const ee=n.get(X);ee&&(ee.t.delete(N),S(X,ee)&&O(R,X))}})):(Kn&&"production")!=="production"&&console.warn("[Bug] could not find atom state to unmount",N)},V=(R,N,B,z)=>{const W=new Set(B.d.keys());z==null||z.forEach((j,X)=>{if(W.has(X)){W.delete(X);return}const ee=n.get(X);ee&&(ee.t.delete(N),S(X,ee)&&O(R,X))}),W.forEach(j=>{const X=n.get(j);X?X.t.add(N):n.has(N)&&P(R,j,N)})},G=R=>{if(R){u(R).forEach((B,z)=>{const W=t.get(z);if(B!==W){const j=n.get(z);j==null||j.l.forEach(X=>X(R))}});return}for(;r.size;){const N=Array.from(r);r.clear(),N.forEach(([B,z])=>{const W=d(void 0,B);if(W&&W.d!==(z==null?void 0:z.d)&&V(void 0,B,W,z==null?void 0:z.d),z&&!z.y&&(W!=null&&W.y))return;const j=n.get(B);j==null||j.l.forEach(X=>X())})}(Kn&&"production")!=="production"&&i.forEach(N=>N())},q=R=>{u(R).forEach((B,z)=>{const W=t.get(z);(!W||B.r>W.r||B.y!==W.y||B.r===W.r&&B.d!==W.d)&&(t.set(z,B),B.d!==(W==null?void 0:W.d)&&V(R,z,B,W==null?void 0:W.d))})},U=(R,N)=>{N&&q(N),G(void 0)},$=(R,N,B)=>{const W=C(B,R).l;return W.add(N),()=>{W.delete(N),I(B,R)}},Y=(R,N)=>{for(const[B,z]of R)Fh(B)&&(y(N,B,z),T(N,B));G(N)};return(Kn&&"production")!=="production"?{[fd]:x,[xm]:A,[md]:U,[Sm]:$,[hb]:Y,[NR]:R=>(i.add(R),()=>{i.delete(R)}),[FR]:()=>o.values(),[$R]:R=>t.get(R),[BR]:R=>n.get(R)}:{[fd]:x,[xm]:A,[md]:U,[Sm]:$,[hb]:Y}},zR=e=>{const t=Ck(e),n=s=>{const a=t[fd](s);if("e"in a)throw a.e;if(!("p"in a))return a.v},r=s=>new Promise((a,l)=>{const c=t[fd](s);"e"in c?l(c.e):"p"in c?a(c.p.then(()=>r(s))):a(c.v)});return{get:n,asyncGet:r,set:(s,a)=>t[xm](s,a),sub:(s,a)=>t[Sm](s,a),SECRET_INTERNAL_store:t}},Tk=(e,t)=>({s:t?t(e).SECRET_INTERNAL_store:Ck(e)}),dp=new Map,Wv=e=>(dp.has(e)||dp.set(e,_.createContext(Tk())),dp.get(e)),Vv=({children:e,initialValues:t,scope:n,unstable_createStore:r,unstable_enableVersionedWrite:i})=>{const[o,s]=_.useState({});_.useEffect(()=>{const c=a.current;c.w&&(c.s[md](null,o),delete o.p,c.v=o)},[o]);const a=_.useRef();if(!a.current){const c=Tk(t,r);if(i){let u=0;c.w=d=>{s(h=>{const m=u?h:{p:h};return d(m),m})},c.v=o,c.r=d=>{++u,d(),--u}}a.current=c}const l=Wv(n);return _.createElement(l.Provider,{value:a.current},e)};function mt(e,t){return RR(e,t)}function Gl(e,t){const n=Wv(t),r=_.useContext(n),{s:i,v:o}=r,s=h=>{const m=i[fd](e,h);if((Kn&&"production")!=="production"&&!m.y)throw new Error("should not be invalidated");if("e"in m)throw m.e;if("p"in m)throw m.p;if("v"in m)return m.v;throw new Error("no atom value")},[[a,l,c],u]=_.useReducer((h,m)=>{const g=s(m);return Object.is(h[1],g)&&h[2]===e?h:[m,g,e]},o,h=>{const m=s(h);return[h,m,e]});let d=l;return c!==e&&(u(a),d=s(a)),_.useEffect(()=>{const{v:h}=r;h&&i[md](e,h);const m=i[Sm](e,u,h);return u(h),m},[i,e,r]),_.useEffect(()=>{i[md](e,a)}),_.useDebugValue(d),d}function lc(e,t){const n=Wv(t),{s:r,w:i}=_.useContext(n);return _.useCallback(s=>{if((Kn&&"production")!=="production"&&!("write"in e))throw new Error("not writable atom");const a=l=>r[xm](e,s,l);return i?i(a):a()},[r,i,e])}function ze(e,t){return"scope"in e&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),t=e.scope),[Gl(e,t),lc(e,t)]}const en=Symbol(),_i=zR(),HR=(e,t)=>{const[n,r]=ze(e);return _.useLayoutEffect(()=>{r(typeof t=="function"?t():t)},[]),[n,r]},UR=85,Es={code:"en",label:"English"},Gv=[Es,...[{code:"ar-SA",label:"العربية",rtl:!0},{code:"bg-BG",label:"Български"},{code:"ca-ES",label:"Català"},{code:"cs-CZ",label:"Česky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"Ελληνικά"},{code:"es-ES",label:"Español"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"فارسی",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Français"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"עברית",rtl:!0},{code:"hi-IN",label:"हिन्दी"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"日本語"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"Қазақ тілі"},{code:"ko-KR",label:"한국어"},{code:"ku-TR",label:"Kurdî"},{code:"lt-LT",label:"Lietuvių"},{code:"lv-LV",label:"Latviešu"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokmål"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"ਪੰਜਾਬੀ"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Português Brasileiro"},{code:"pt-PT",label:"Português"},{code:"ro-RO",label:"Română"},{code:"ru-RU",label:"Русский"},{code:"sk-SK",label:"Slovenčina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Slovenščina"},{code:"tr-TR",label:"Türkçe"},{code:"uk-UA",label:"Українська"},{code:"zh-CN",label:"简体中文"},{code:"zh-TW",label:"繁體中文"},{code:"vi-VN",label:"Tiếng Việt"},{code:"mr-IN",label:"मराठी"}].filter(e=>Ik[e.code]>=UR).sort((e,t)=>e.label>t.label?1:-1)],Mk="__test__";let fl=Es,If={};const Ak=async e=>{if(fl=e,document.documentElement.dir=fl.rtl?"rtl":"ltr",document.documentElement.lang=fl.code,e.code.startsWith(Mk))If={};else try{If=await MR(Object.assign({"./locales/ar-SA.json":()=>ie(()=>import("./locales/ar-SA.json-SV43LhYq.js"),__vite__mapDeps([])),"./locales/az-AZ.json":()=>ie(()=>import("./locales/az-AZ.json-oLcB2OJI.js"),__vite__mapDeps([])),"./locales/bg-BG.json":()=>ie(()=>import("./locales/bg-BG.json-pnAjs09s.js"),__vite__mapDeps([])),"./locales/bn-BD.json":()=>ie(()=>import("./locales/bn-BD.json-xZvqmnH0.js"),__vite__mapDeps([])),"./locales/ca-ES.json":()=>ie(()=>import("./locales/ca-ES.json-YA_IC9xZ.js"),__vite__mapDeps([])),"./locales/cs-CZ.json":()=>ie(()=>import("./locales/cs-CZ.json-xA16rUn9.js"),__vite__mapDeps([])),"./locales/da-DK.json":()=>ie(()=>import("./locales/da-DK.json-IEeMktGi.js"),__vite__mapDeps([])),"./locales/de-DE.json":()=>ie(()=>import("./locales/de-DE.json-i3JZdkyf.js"),__vite__mapDeps([])),"./locales/el-GR.json":()=>ie(()=>import("./locales/el-GR.json-HpHJuTAr.js"),__vite__mapDeps([])),"./locales/en.json":()=>ie(()=>Promise.resolve().then(()=>AR),void 0),"./locales/es-ES.json":()=>ie(()=>import("./locales/es-ES.json-B52Lj-PT.js"),__vite__mapDeps([])),"./locales/eu-ES.json":()=>ie(()=>import("./locales/eu-ES.json-n0P55DpS.js"),__vite__mapDeps([])),"./locales/fa-IR.json":()=>ie(()=>import("./locales/fa-IR.json-Gtl9UWDE.js"),__vite__mapDeps([])),"./locales/fi-FI.json":()=>ie(()=>import("./locales/fi-FI.json-J5M8FnGK.js"),__vite__mapDeps([])),"./locales/fr-FR.json":()=>ie(()=>import("./locales/fr-FR.json-lfZo79tg.js"),__vite__mapDeps([])),"./locales/gl-ES.json":()=>ie(()=>import("./locales/gl-ES.json--WW2Ul2N.js"),__vite__mapDeps([])),"./locales/he-IL.json":()=>ie(()=>import("./locales/he-IL.json-4DiMSwaz.js"),__vite__mapDeps([])),"./locales/hi-IN.json":()=>ie(()=>import("./locales/hi-IN.json-nhvtlCpV.js"),__vite__mapDeps([])),"./locales/hu-HU.json":()=>ie(()=>import("./locales/hu-HU.json-bmZtU8U3.js"),__vite__mapDeps([])),"./locales/id-ID.json":()=>ie(()=>import("./locales/id-ID.json-XxPjS0Nx.js"),__vite__mapDeps([])),"./locales/it-IT.json":()=>ie(()=>import("./locales/it-IT.json-rBd68gJl.js"),__vite__mapDeps([])),"./locales/ja-JP.json":()=>ie(()=>import("./locales/ja-JP.json-2da-VeKb.js"),__vite__mapDeps([])),"./locales/kaa.json":()=>ie(()=>import("./locales/kaa.json-SGqCLwRa.js"),__vite__mapDeps([])),"./locales/kab-KAB.json":()=>ie(()=>import("./locales/kab-KAB.json-S8YedR0v.js"),__vite__mapDeps([])),"./locales/kk-KZ.json":()=>ie(()=>import("./locales/kk-KZ.json-3Sz1_kBi.js"),__vite__mapDeps([])),"./locales/km-KH.json":()=>ie(()=>import("./locales/km-KH.json-KP5HxHUN.js"),__vite__mapDeps([])),"./locales/ko-KR.json":()=>ie(()=>import("./locales/ko-KR.json-brzJvi-h.js"),__vite__mapDeps([])),"./locales/ku-TR.json":()=>ie(()=>import("./locales/ku-TR.json-3BiS76lb.js"),__vite__mapDeps([])),"./locales/lt-LT.json":()=>ie(()=>import("./locales/lt-LT.json-VZNCnPUp.js"),__vite__mapDeps([])),"./locales/lv-LV.json":()=>ie(()=>import("./locales/lv-LV.json-5aVXkl-5.js"),__vite__mapDeps([])),"./locales/mr-IN.json":()=>ie(()=>import("./locales/mr-IN.json-uScRhQ9i.js"),__vite__mapDeps([])),"./locales/my-MM.json":()=>ie(()=>import("./locales/my-MM.json-Rvx7mHUJ.js"),__vite__mapDeps([])),"./locales/nb-NO.json":()=>ie(()=>import("./locales/nb-NO.json-Jc97XkYt.js"),__vite__mapDeps([])),"./locales/nl-NL.json":()=>ie(()=>import("./locales/nl-NL.json-lulb62bF.js"),__vite__mapDeps([])),"./locales/nn-NO.json":()=>ie(()=>import("./locales/nn-NO.json-19EVdr9m.js"),__vite__mapDeps([])),"./locales/oc-FR.json":()=>ie(()=>import("./locales/oc-FR.json-mgdR7xZo.js"),__vite__mapDeps([])),"./locales/pa-IN.json":()=>ie(()=>import("./locales/pa-IN.json-6nU3HEBq.js"),__vite__mapDeps([])),"./locales/percentages.json":()=>ie(()=>Promise.resolve().then(()=>LR),void 0),"./locales/pl-PL.json":()=>ie(()=>import("./locales/pl-PL.json-e9P_Yfh8.js"),__vite__mapDeps([])),"./locales/pt-BR.json":()=>ie(()=>import("./locales/pt-BR.json-SvBckatZ.js"),__vite__mapDeps([])),"./locales/pt-PT.json":()=>ie(()=>import("./locales/pt-PT.json-kkhuggAD.js"),__vite__mapDeps([])),"./locales/ro-RO.json":()=>ie(()=>import("./locales/ro-RO.json-IuXq2Sgz.js"),__vite__mapDeps([])),"./locales/ru-RU.json":()=>ie(()=>import("./locales/ru-RU.json-AKny6SqI.js"),__vite__mapDeps([])),"./locales/si-LK.json":()=>ie(()=>import("./locales/si-LK.json-htW_YYt1.js"),__vite__mapDeps([])),"./locales/sk-SK.json":()=>ie(()=>import("./locales/sk-SK.json-9kwfDB_I.js"),__vite__mapDeps([])),"./locales/sl-SI.json":()=>ie(()=>import("./locales/sl-SI.json-ASsZh3wt.js"),__vite__mapDeps([])),"./locales/sv-SE.json":()=>ie(()=>import("./locales/sv-SE.json-lo_GRO0H.js"),__vite__mapDeps([])),"./locales/ta-IN.json":()=>ie(()=>import("./locales/ta-IN.json-heb0CKI9.js"),__vite__mapDeps([])),"./locales/th-TH.json":()=>ie(()=>import("./locales/th-TH.json-28RYlLeB.js"),__vite__mapDeps([])),"./locales/tr-TR.json":()=>ie(()=>import("./locales/tr-TR.json-EHF5lOjE.js"),__vite__mapDeps([])),"./locales/uk-UA.json":()=>ie(()=>import("./locales/uk-UA.json-opPb2znK.js"),__vite__mapDeps([])),"./locales/vi-VN.json":()=>ie(()=>import("./locales/vi-VN.json-lNqxPgt2.js"),__vite__mapDeps([])),"./locales/zh-CN.json":()=>ie(()=>import("./locales/zh-CN.json-I6DzD4ui.js"),__vite__mapDeps([])),"./locales/zh-HK.json":()=>ie(()=>import("./locales/zh-HK.json-0R3Wdr1t.js"),__vite__mapDeps([])),"./locales/zh-TW.json":()=>ie(()=>import("./locales/zh-TW.json-b9fBzTxw.js"),__vite__mapDeps([]))}),`./locales/${fl.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),If=Uv}_i.set(Lk,e.code)},Yd=()=>fl,fb=(e,t)=>{for(let n=0;n{if(fl.code.startsWith(Mk))return`‪[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]‬`;const r=e.split(".");let i=fb(If,r)||fb(Uv,r)||n;if(i===void 0){const o=`Can't find translation for ${e}`;return console.warn(o),""}if(t)for(const o in t)i=i.replace(`{{${o}}}`,String(t[o]));return i},Lk=mt(Es.code),xt=()=>{const e=Gl(Lk,en);return{t:b,langCode:e}};function Pk(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t{const[e,t]=_.useState(null),n=_.useCallback(r=>t(r),[]);return[e,n]};function E2(e,t,n){if(e&&e.length){const[r,i]=t,o=Math.PI/180*n,s=Math.cos(o),a=Math.sin(o);for(const l of e){const[c,u]=l;l[0]=(c-r)*s-(u-i)*a+r,l[1]=(c-r)*a+(u-i)*s+i}}}function WR(e,t,n){const r=[];e.forEach(i=>r.push(...i)),E2(r,t,n)}function VR(e,t){return e[0]===t[0]&&e[1]===t[1]}function GR(e,t,n,r=1){const i=n,o=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,a=[0,0];if(i)for(const c of s)E2(c,a,i);const l=jR(s,o,r);if(i){for(const c of s)E2(c,a,-i);WR(l,a,-i)}return l}function jR(e,t,n){const r=[];for(const c of e){const u=[...c];VR(u[0],u[u.length-1])||u.push([u[0][0],u[0][1]]),u.length>2&&r.push(u)}const i=[];t=Math.max(t,.1);const o=[];for(const c of r)for(let u=0;uc.yminu.ymin?1:c.xu.x?1:c.ymax===u.ymax?0:(c.ymax-u.ymax)/Math.abs(c.ymax-u.ymax)),!o.length)return i;let s=[],a=o[0].ymin,l=0;for(;s.length||o.length;){if(o.length){let c=-1;for(let d=0;da);d++)c=d;o.splice(0,c+1).forEach(d=>{s.push({s:a,edge:d})})}if(s=s.filter(c=>!(c.edge.ymax<=a)),s.sort((c,u)=>c.edge.x===u.edge.x?0:(c.edge.x-u.edge.x)/Math.abs(c.edge.x-u.edge.x)),(n!==1||l%t===0)&&s.length>1)for(let c=0;c=s.length)break;const d=s[c].edge,h=s[u].edge;i.push([[Math.round(d.x),a],[Math.round(h.x),a]])}a+=n,s.forEach(c=>{c.edge.x=c.edge.x+n*c.edge.islope}),l++}return i}function Kd(e,t){var n;const r=t.hachureAngle+90;let i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.max(i,.1);let o=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(o=i),GR(e,i,r,o||1)}class jv{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){const r=Kd(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){const r=[];for(const i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}}function N1(e){const t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}class YR extends jv{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);const i=Object.assign({},n,{hachureGap:r}),o=Kd(t,i),s=Math.PI/180*n.hachureAngle,a=[],l=r*.5*Math.cos(s),c=r*.5*Math.sin(s);for(const[d,h]of o)N1([d,h])&&a.push([[d[0]-l,d[1]+c],[...h]],[[d[0]+l,d[1]-c],[...h]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}}class KR extends jv{fillPolygons(t,n){const r=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}}class ZR{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});const r=Kd(t,n);return this.dotsOnLines(r,n)}dotsOnLines(t,n){const r=[];let i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let o=n.fillWeight;o<0&&(o=n.strokeWidth/2);const s=i/4;for(const a of t){const l=N1(a),c=l/i,u=Math.ceil(c)-1,d=l-u*i,h=(a[0][0]+a[1][0])/2-i/4,m=Math.min(a[0][1],a[1][1]);for(let g=0;g{const a=N1(s),l=Math.floor(a/(r+i)),c=(a+i-l*(r+i))/2;let u=s[0],d=s[1];u[0]>d[0]&&(u=s[1],d=s[0]);const h=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let m=0;m{const s=N1(o),a=Math.round(s/(2*n));let l=o[0],c=o[1];l[0]>c[0]&&(l=o[1],c=o[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;du%2?c+n:c+t);o.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":o.push({key:"Q",data:[...a]}),t=a[2],n=a[3];break;case"q":{const l=a.map((c,u)=>u%2?c+n:c+t);o.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":o.push({key:"A",data:[...a]}),t=a[5],n=a[6];break;case"a":t+=a[5],n+=a[6],o.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,n]});break;case"H":o.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],o.push({key:"V",data:[n]});break;case"S":o.push({key:"S",data:[...a]}),t=a[2],n=a[3];break;case"s":{const l=a.map((c,u)=>u%2?c+n:c+t);o.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":o.push({key:"T",data:[...a]}),t=a[0],n=a[1];break;case"t":t+=a[0],n+=a[1],o.push({key:"T",data:[t,n]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,n=i;break}return o}function Fk(e){const t=[];let n="",r=0,i=0,o=0,s=0,a=0,l=0;for(const{key:c,data:u}of e){switch(c){case"M":t.push({key:"M",data:[...u]}),[r,i]=u,[o,s]=u;break;case"C":t.push({key:"C",data:[...u]}),r=u[4],i=u[5],a=u[2],l=u[3];break;case"L":t.push({key:"L",data:[...u]}),[r,i]=u;break;case"H":r=u[0],t.push({key:"L",data:[r,i]});break;case"V":i=u[0],t.push({key:"L",data:[r,i]});break;case"S":{let d=0,h=0;n==="C"||n==="S"?(d=r+(r-a),h=i+(i-l)):(d=r,h=i),t.push({key:"C",data:[d,h,...u]}),a=u[0],l=u[1],r=u[2],i=u[3];break}case"T":{const[d,h]=u;let m=0,g=0;n==="Q"||n==="T"?(m=r+(r-a),g=i+(i-l)):(m=r,g=i);const p=r+2*(m-r)/3,v=i+2*(g-i)/3,y=d+2*(m-d)/3,E=h+2*(g-h)/3;t.push({key:"C",data:[p,v,y,E,d,h]}),a=m,l=g,r=d,i=h;break}case"Q":{const[d,h,m,g]=u,p=r+2*(d-r)/3,v=i+2*(h-i)/3,y=m+2*(d-m)/3,E=g+2*(h-g)/3;t.push({key:"C",data:[p,v,y,E,m,g]}),a=d,l=h,r=m,i=g;break}case"A":{const d=Math.abs(u[0]),h=Math.abs(u[1]),m=u[2],g=u[3],p=u[4],v=u[5],y=u[6];d===0||h===0?(t.push({key:"C",data:[r,i,v,y,v,y]}),r=v,i=y):(r!==v||i!==y)&&($k(r,i,v,y,d,h,m,g,p).forEach(function(w){t.push({key:"C",data:w})}),r=v,i=y);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=s;break}n=c}return t}function nD(e){return Math.PI*e/180}function Fc(e,t,n){const r=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[r,i]}function $k(e,t,n,r,i,o,s,a,l,c){const u=nD(s);let d=[],h=0,m=0,g=0,p=0;if(c)[h,m,g,p]=c;else{[e,t]=Fc(e,t,-u),[n,r]=Fc(n,r,-u);const P=(e-n)/2,O=(t-r)/2;let V=P*P/(i*i)+O*O/(o*o);V>1&&(V=Math.sqrt(V),i=V*i,o=V*o);const G=a===l?-1:1,q=i*i,U=o*o,$=q*U-q*O*O-U*P*P,Y=q*O*O+U*P*P,R=G*Math.sqrt(Math.abs($/Y));g=R*i*O/o+(e+n)/2,p=R*-o*P/i+(t+r)/2,h=Math.asin(parseFloat(((t-p)/o).toFixed(9))),m=Math.asin(parseFloat(((r-p)/o).toFixed(9))),em&&(h=h-Math.PI*2),!l&&m>h&&(m=m-Math.PI*2)}let v=m-h;if(Math.abs(v)>Math.PI*120/180){const P=m,O=n,V=r;l&&m>h?m=h+Math.PI*120/180*1:m=h+Math.PI*120/180*-1,n=g+i*Math.cos(m),r=p+o*Math.sin(m),d=$k(n,r,O,V,i,o,s,0,l,[m,P,g,p])}v=m-h;const y=Math.cos(h),E=Math.sin(h),w=Math.cos(m),x=Math.sin(m),C=Math.tan(v/4),S=4/3*i*C,I=4/3*o*C,T=[e,t],L=[e+S*E,t-I*y],A=[n+S*x,r-I*w],F=[n,r];if(L[0]=2*T[0]-L[0],L[1]=2*T[1]-L[1],c)return[L,A,F].concat(d);{d=[L,A,F].concat(d);const P=[];for(let O=0;O2){const i=[];for(let o=0;oMath.PI*2&&(m=0,g=Math.PI*2);const p=Math.PI*2/l.curveStepCount,v=Math.min(p/2,(g-m)/2),y=wb(v,c,u,d,h,m,g,1,l);if(!l.disableMultiStroke){const E=wb(v,c,u,d,h,m,g,1.5,l);y.push(...E)}return s&&(a?y.push(...Ji(c,u,c+d*Math.cos(m),u+h*Math.sin(m),l),...Ji(c,u,c+d*Math.cos(g),u+h*Math.sin(g),l)):y.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(m),u+h*Math.sin(m)]})),{type:"path",ops:y}}function pb(e,t){const n=Fk(Nk(Yv(e))),r=[];let i=[0,0],o=[0,0];for(const{key:s,data:a}of n)switch(s){case"M":{o=[a[0],a[1]],i=[a[0],a[1]];break}case"L":r.push(...Ji(o[0],o[1],a[0],a[1],t)),o=[a[0],a[1]];break;case"C":{const[l,c,u,d,h,m]=a;r.push(...hD(l,c,u,d,h,m,o,t)),o=[h,m];break}case"Z":r.push(...Ji(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]];break}return{type:"path",ops:r}}function fp(e,t){const n=[];for(const r of e)if(r.length){const i=t.maxRandomnessOffset||0,o=r.length;if(o>2){n.push({op:"move",data:[r[0][0]+fe(i,t),r[0][1]+fe(i,t)]});for(let s=1;sMath.PI*2&&(d=0,h=Math.PI*2);const m=(h-d)/s.curveStepCount,g=[];for(let p=d;p<=h;p=p+m)g.push([a+c*Math.cos(p),l+u*Math.sin(p)]);return g.push([a+c*Math.cos(h),l+u*Math.sin(h)]),g.push([a,l]),Ja([g],s)}function lD(e,t){return fe(e,t)}function cD(e,t,n){return km(e,t,n)}function uD(e,t,n,r,i){return Ji(e,t,n,r,i,!0)}function dD(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function Hk(e){return e.randomizer||(e.randomizer=new Dk(e.seed||0)),e.randomizer.next()}function km(e,t,n,r=1){return n.roughness*r*(Hk(n)*(t-e)+e)}function fe(e,t,n=1){return km(-e,e,t,n)}function Ji(e,t,n,r,i,o=!1){const s=o?i.disableMultiStrokeFill:i.disableMultiStroke,a=yb(e,t,n,r,i,!0,!1);if(s)return a;const l=yb(e,t,n,r,i,!0,!0);return a.concat(l)}function yb(e,t,n,r,i,o,s){const a=Math.pow(e-n,2)+Math.pow(t-r,2),l=Math.sqrt(a);let c=1;l<200?c=1:l>500?c=.4:c=-.0016668*l+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>a&&(u=l/10);const d=u/2,h=.2+Hk(i)*.2;let m=i.bowing*i.maxRandomnessOffset*(r-t)/200,g=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=fe(m,i,c),g=fe(g,i,c);const p=[],v=()=>fe(d,i,c),y=()=>fe(u,i,c),E=i.preserveVertices;return o&&(s?p.push({op:"move",data:[e+(E?0:v()),t+(E?0:v())]}):p.push({op:"move",data:[e+(E?0:fe(u,i,c)),t+(E?0:fe(u,i,c))]})),s?p.push({op:"bcurveTo",data:[m+e+(n-e)*h+v(),g+t+(r-t)*h+v(),m+e+2*(n-e)*h+v(),g+t+2*(r-t)*h+v(),n+(E?0:v()),r+(E?0:v())]}):p.push({op:"bcurveTo",data:[m+e+(n-e)*h+y(),g+t+(r-t)*h+y(),m+e+2*(n-e)*h+y(),g+t+2*(r-t)*h+y(),n+(E?0:y()),r+(E?0:y())]}),p}function vb(e,t,n){const r=[];r.push([e[0][0]+fe(t,n),e[0][1]+fe(t,n)]),r.push([e[0][0]+fe(t,n),e[0][1]+fe(t,n)]);for(let i=1;i3){const o=[],s=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let a=1;a+21&&i.push(o):i.push(o),i.push(e[t+3])}else{const s=e[t+0],a=e[t+1],l=e[t+2],c=e[t+3],u=As(s,a,.5),d=As(a,l,.5),h=As(l,c,.5),m=As(u,d,.5),g=As(d,h,.5),p=As(m,g,.5);_2([s,u,m,p],0,n,i),_2([p,g,h,c],0,n,i)}return i}function yD(e,t){return Cm(e,0,e.length,t)}function Cm(e,t,n,r,i){const o=i||[],s=e[t],a=e[n-1];let l=0,c=1;for(let u=t+1;ul&&(l=d,c=u)}return Math.sqrt(l)>r?(Cm(e,t,c+1,r,o),Cm(e,c,n,r,o)):(o.length||o.push(s),o.push(a)),o}function Uk(e,t=.15,n){const r=[],i=(e.length-1)/3;for(let o=0;o0?Cm(r,0,r.length,n):r}function vD(e,t,n){const r=Yv(e),i=Fk(Nk(r)),o=[];let s=[],a=[0,0],l=[];const c=()=>{l.length>=4&&s.push(...Uk(l,t)),l=[]},u=()=>{c(),s.length&&(o.push(s),s=[])};for(const{key:h,data:m}of i)switch(h){case"M":u(),a=[m[0],m[1]],s.push(a);break;case"L":c(),s.push([m[0],m[1]]);break;case"C":if(!l.length){const g=s.length?s[s.length-1]:a;l.push([g[0],g[1]])}l.push([m[0],m[1]]),l.push([m[2],m[3]]),l.push([m[4],m[5]]);break;case"Z":c(),s.push([a[0],a[1]]);break}if(u(),!n)return o;const d=[];for(const h of o){const m=yD(h,n);m.length&&d.push(m)}return d}const Yn="none";class gd{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return JR()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,i,o){const s=this._o(o);return this._d("line",[Bk(t,n,r,i,s)],s)}rectangle(t,n,r,i,o){const s=this._o(o),a=[],l=oD(t,n,r,i,s);if(s.fill){const c=[[t,n],[t+r,n],[t+r,n+i],[t,n+i]];s.fillStyle==="solid"?a.push(fp([c],s)):a.push(Ja([c],s))}return s.stroke!==Yn&&a.push(l),this._d("rectangle",a,s)}ellipse(t,n,r,i,o){const s=this._o(o),a=[],l=zk(r,i,s),c=b2(t,n,s,l);if(s.fill)if(s.fillStyle==="solid"){const u=b2(t,n,s,l).opset;u.type="fillPath",a.push(u)}else a.push(Ja([c.estimatedPoints],s));return s.stroke!==Yn&&a.push(c.opset),this._d("ellipse",a,s)}circle(t,n,r,i){const o=this.ellipse(t,n,r,r,i);return o.shape="circle",o}linearPath(t,n){const r=this._o(n);return this._d("linearPath",[Cf(t,!1,r)],r)}arc(t,n,r,i,o,s,a=!1,l){const c=this._o(l),u=[],d=gb(t,n,r,i,o,s,a,!0,c);if(a&&c.fill)if(c.fillStyle==="solid"){const h=Object.assign({},c);h.disableMultiStroke=!0;const m=gb(t,n,r,i,o,s,!0,!1,h);m.type="fillPath",u.push(m)}else u.push(aD(t,n,r,i,o,s,c));return c.stroke!==Yn&&u.push(d),this._d("arc",u,c)}curve(t,n){const r=this._o(n),i=[],o=mb(t,r);if(r.fill&&r.fill!==Yn&&t.length>=3)if(r.fillStyle==="solid"){const s=mb(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{const s=fD(t),a=Uk(s,10,(1+r.roughness)/2);i.push(Ja([a],r))}return r.stroke!==Yn&&i.push(o),this._d("curve",i,r)}polygon(t,n){const r=this._o(n),i=[],o=Cf(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(fp([t],r)):i.push(Ja([t],r))),r.stroke!==Yn&&i.push(o),this._d("polygon",i,r)}path(t,n){const r=this._o(n),i=[];if(!t)return this._d("path",i,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const o=r.fill&&r.fill!=="transparent"&&r.fill!==Yn,s=r.stroke!==Yn,a=!!(r.simplification&&r.simplification<1),l=a?4-4*(r.simplification||1):(1+r.roughness)/2,c=vD(t,1,l),u=pb(t,r);if(o)if(r.fillStyle==="solid")if(c.length===1){const d=pb(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(d.ops)})}else i.push(fp(c,r));else i.push(Ja(c,r));return s&&(a?c.forEach(d=>{i.push(Cf(d,!1,r))}):i.push(u)),this._d("path",i,r)}opsToPath(t,n){let r="";for(const i of t.ops){const o=typeof n=="number"&&n>=0?i.data.map(s=>+s.toFixed(n)):i.data;switch(i.op){case"move":r+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":r+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":r+=`L${o[0]} ${o[1]} `;break}}return r.trim()}toPaths(t){const n=t.sets||[],r=t.options||this.defaultOptions,i=[];for(const o of n){let s=null;switch(o.type){case"path":s={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:Yn};break;case"fillPath":s={d:this.opsToPath(o),stroke:Yn,strokeWidth:0,fill:r.fill||Yn};break;case"fillSketch":s=this.fillSketch(o,r);break}s&&i.push(s)}return i}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||Yn,strokeWidth:r,fill:Yn}}_mergedShape(t){return t.filter((n,r)=>r===0?!0:n.op!=="move")}}class ED{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new gd(n)}draw(t){const n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(const s of n)switch(s.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,s,o),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";const a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,o,a),i.restore();break}case"fillSketch":this.fillSketch(i,s,r);break}}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=i,this._drawToContext(t,n,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,r,i="nonzero"){t.beginPath();for(const o of n.ops){const s=typeof r=="number"&&r>=0?o.data.map(a=>+a.toFixed(r)):o.data;switch(o.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,r,i,o){const s=this.gen.line(t,n,r,i,o);return this.draw(s),s}rectangle(t,n,r,i,o){const s=this.gen.rectangle(t,n,r,i,o);return this.draw(s),s}ellipse(t,n,r,i,o){const s=this.gen.ellipse(t,n,r,i,o);return this.draw(s),s}circle(t,n,r,i){const o=this.gen.circle(t,n,r,i);return this.draw(o),o}linearPath(t,n){const r=this.gen.linearPath(t,n);return this.draw(r),r}polygon(t,n){const r=this.gen.polygon(t,n);return this.draw(r),r}arc(t,n,r,i,o,s,a=!1,l){const c=this.gen.arc(t,n,r,i,o,s,a,l);return this.draw(c),c}curve(t,n){const r=this.gen.curve(t,n);return this.draw(r),r}path(t,n){const r=this.gen.path(t,n);return this.draw(r),r}}const Bh="http://www.w3.org/2000/svg";class wD{constructor(t,n){this.svg=t,this.gen=new gd(n)}draw(t){const n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,o=i.createElementNS(Bh,"g"),s=t.options.fixedDecimalPlaceDigits;for(const a of n){let l=null;switch(a.type){case"path":{l=i.createElementNS(Bh,"path"),l.setAttribute("d",this.opsToPath(a,s)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(Bh,"path"),l.setAttribute("d",this.opsToPath(a,s)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,a,r);break}}l&&o.appendChild(l)}return o}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);const o=t.createElementNS(Bh,"path");return o.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),o.setAttribute("stroke",r.fill||""),o.setAttribute("stroke-width",i+""),o.setAttribute("fill","none"),r.fillLineDash&&o.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,r,i,o){const s=this.gen.line(t,n,r,i,o);return this.draw(s)}rectangle(t,n,r,i,o){const s=this.gen.rectangle(t,n,r,i,o);return this.draw(s)}ellipse(t,n,r,i,o){const s=this.gen.ellipse(t,n,r,i,o);return this.draw(s)}circle(t,n,r,i){const o=this.gen.circle(t,n,r,i);return this.draw(o)}linearPath(t,n){const r=this.gen.linearPath(t,n);return this.draw(r)}polygon(t,n){const r=this.gen.polygon(t,n);return this.draw(r)}arc(t,n,r,i,o,s,a=!1,l){const c=this.gen.arc(t,n,r,i,o,s,a,l);return this.draw(c)}curve(t,n){const r=this.gen.curve(t,n);return this.draw(r)}path(t,n){const r=this.gen.path(t,n);return this.draw(r)}}const ws={canvas(e,t){return new ED(e,t)},svg(e,t){return new wD(e,t)},generator(e){return new gd(e)},newSeed(){return gd.newSeed()}};let Kv=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const bb=()=>{const e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),i=`${e.getHours()}`.padStart(2,"0"),o=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${i}${o}`},Mf=e=>e.charAt(0).toUpperCase()+e.slice(1),bD=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),Wk=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,_D=e=>Wk(e)||e instanceof Element&&!!e.closest("label, button"),Ns=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),Zv=({fontFamily:e})=>{for(const[t,n]of Object.entries(Xt))if(n===e)return`${t}, ${sb}`;return sb},Bt=({fontSize:e,fontFamily:t})=>`${e}px ${Zv({fontFamily:t})}`,fa=(e,t)=>{let n=0,r=null;const i=(...o)=>{r=o,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...o)},t)};return i.flush=()=>{if(clearTimeout(n),r){const o=r;r=null,e(...o)}},i.cancel=()=>{r=null,clearTimeout(n)},i},F1=(e,t)=>{let n=null,r=null,i=null;const o=a=>{n=window.requestAnimationFrame(()=>{n=null,e(...a),r=null,i&&(r=i,i=null,o(r))})},s=(...a)=>{r=a,n===null?o(r):t!=null&&t.trailing&&(i=a)};return s.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r&&(e(...i||r),r=i=null)},s.cancel=()=>{r=i=null,n!==null&&(cancelAnimationFrame(n),n=null)},s},ra=e=>1-Math.pow(1-e,4),_b=(e,t,n)=>(t-e)*ra(n)+e,xD=({fromValues:e,toValues:t,onStep:n,duration:r=250,interpolateValue:i,onStart:o,onEnd:s,onCancel:a})=>{let l=!1,c=0,u;function d(h){if(l)return;u===void 0&&(u=h,o==null||o());const m=Math.min(h-u,r),g=ra(m/r),p={};if(Object.keys(e).forEach(v=>{const y=v,E=(t[y]-e[y])*g+e[y];p[y]=E}),n(p),m{const w=E,x=e[w],C=t[w];let S;S=i?i(x,C,v,w):_b(x,C,v),S==null&&(S=_b(x,C,v)),y[w]=S}),n(y),c=window.requestAnimationFrame(d)}else n(t),s==null||s()}return c=window.requestAnimationFrame(d),()=>{a==null||a(),l=!0,window.cancelAnimationFrame(c)}},SD=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0;const i=Array(Math.ceil(e.length/t));for(;nMath.abs(e-t),bt=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked},K=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),ki?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),et=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:s})=>{const a=(e-r)/n.value-o,l=(t-i)/n.value-s;return{x:a,y:l}},Ur=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:s})=>{const a=(e+o)*n.value+r,l=(t+s)*n.value+i;return{x:a,y:l}},zh=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),kD="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿Ⰰ-﬜﷾-﹯﻽-￿",ID="֑-߿יִ-﷽ﹰ-ﻼ",CD=new RegExp(`^[^${kD}]*[${ID}]`),Vk=e=>CD.test(e),Oo=e=>{const[t,n]=e;return{x:t,y:n}},Gk=e=>{if((e==null?void 0:e.name)==="AbortError"){console.warn(e);return}throw e},jk=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},Ei=e=>{const t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===ve.transparent},$1=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},xb=(e,t)=>{const n=[{value:1,symbol:"b"},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"}],r=/\.0+$|(\.[0-9]*[1-9])0+$/;let i;for(i=n.length-1;i>0&&!(e>=n[i].value);i--);return(e/n[i].value).toFixed(t).replace(r,"$1")+n[i].symbol},x2=()=>{var e;return((e=document.querySelector('meta[name="version"]'))==null?void 0:e.content)||HS},TD=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;const{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},MD=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},Xv=e=>{e.preventDefault(),e.returnValue=""},Kk=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),cc=()=>Date.now(),be=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),Zk=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),Xk=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),Af=(e,t)=>{let n=!1;for(const r in t){const i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t}:e},Zd=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},AD=()=>Zd()==="iframe",Xd=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,S2=e=>{const t=e==null?void 0:e.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},Sb=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,Jn=(e,t,n,r=!1)=>{const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(const s of n)if(!(e[s]===t[s]||Sb(e[s],t[s])))return r&&console.warn(`%cisShallowEqual: ${s} not equal ->`,"color: #8B4000",e[s],t[s]),!1;return!0}return i.every(s=>{const a=n==null?void 0:n[s],l=a?a(e[s],t[s]):e[s]===t[s]||Sb(e[s],t[s]);return!l&&r&&console.warn(`%cisShallowEqual: ${s} not equal ->`,"color: #8B4000",e[s],t[s]),l})},B1=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(i){if(e==null||e(i),!n||!(i!=null&&i.defaultPrevented))return t==null?void 0:t(i)},jl=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)},LD=e=>{let t,n;const r=function(i){const o=Object.entries(i);if(t){let a=!0;for(const[l,c]of o)if(t.get(l)!==c){a=!1;break}if(a)return n}const s=e(i);return t=new Map(o),n=s,s};return r.clear=()=>{t=void 0,n=void 0},r},k2=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),Yl=e=>JSON.parse(JSON.stringify(e)),kb=e=>typeof e=="number"&&Number.isFinite(e),mp=(e,t)=>Jn(e,t)?e:t;function gt(e,t,n,r){var i;return e?((i=e==null?void 0:e.addEventListener)==null||i.call(e,t,n,r),()=>{var o;(o=e==null?void 0:e.removeEventListener)==null||o.call(e,t,n,r)}):()=>{}}const Hh=(e,t)=>(e+t)/2;function PD(e,t=!0){const n=e.length;if(n<4)return"";let r=e[0],i=e[1];const o=e[2];let s=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${i[0].toFixed(2)},${i[1].toFixed(2)} ${Hh(i[0],o[0]).toFixed(2)},${Hh(i[1],o[1]).toFixed(2)} T`;for(let a=2,l=n-1;ae.replace(/\r?\n|\r/g,` `),ma=e=>e,I2=async(e,...t)=>new Promise(n=>{n(e(...t))}),Ft=e=>!!e&&e.type==="image"&&!!e.fileId,Gi=e=>!!e&&e.type==="image",bn=e=>!!e&&e.type==="embeddable",Io=e=>!!e&&e.type==="iframe",fr=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),ce=e=>e!=null&&e.type==="text",pd=e=>e!=null&&e.type==="frame",uu=e=>e!=null&&e.type==="magicframe",pe=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Hn=e=>e!=null&&RD(e.type),RD=e=>e==="freedraw",we=e=>e!=null&&qv(e.type),Ge=e=>e!=null&&e.type==="arrow",qv=e=>e==="arrow"||e==="line",dn=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&Qk(e.type),Qk=e=>e==="arrow",yd=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),ia=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||Ge(e)),Jk=e=>{const t=e==null?void 0:e.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return jl(t,null),!1}},ls=e=>{var t;return ia(e)&&!!((t=e.boundElements)!=null&&t.some(({type:n})=>n==="text"))},Mt=e=>e!==null&&"containerId"in e&&e.containerId!==null&&ce(e),uc=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",eI=e=>e==="line"||e==="arrow"||e==="diamond",DD=(e,t)=>!!((e===Vt.ADAPTIVE_RADIUS||e===Vt.LEGACY)&&uc(t.type)||e===Vt.PROPORTIONAL_RADIUS&&eI(t.type)),OD=e=>eI(e.type)?{type:Vt.PROPORTIONAL_RADIUS}:uc(e.type)?{type:Vt.ADAPTIVE_RADIUS}:null;let ND=new Dk(Date.now());const bs=()=>Math.floor(ND.next()*2**31),xr=()=>Kv(),Ib=e=>{const t=new Map,n=[];for(const r of e)r.isDeleted||(n.push(r),t.set(r.id,r));return{elementsMap:t,elements:n}},FD=e=>{const t=["includeBoundTextElement","includeElementsInFrames"];let n="";for(const r of t)n+=`${r}:${e[r]?"1":"0"}`;return n},Cb=e=>typeof e=="string",zs=class zs{constructor(){M(this,"callbacks",new Set);M(this,"nonDeletedElements",[]);M(this,"nonDeletedElementsMap",ma(new Map));M(this,"elements",[]);M(this,"nonDeletedFramesLikes",[]);M(this,"frames",[]);M(this,"elementsMap",ma(new Map));M(this,"selectedElementsCache",{selectedElementIds:null,elements:null,cache:new Map});M(this,"versionNonce");M(this,"addNewElement",t=>{t.frameId?this.insertElementAtIndex(t,this.getElementIndex(t.frameId)):this.replaceAllElements([...this.elements,t])});M(this,"getContainerElement",t=>t&&t.containerId&&this.getElement(t.containerId)||null)}static mapElementToScene(t,n){Cb(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return Cb(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){const n=FD(t),r=(t==null?void 0:t.elements)||this.nonDeletedElements;if(this.selectedElementsCache.elements===r&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){const o=this.selectedElementsCache.cache.get(n);if(o)return o}else(t==null?void 0:t.elements)==null&&this.selectedElementsCache.cache.clear();const i=qe(r,{selectedElementIds:t.selectedElementIds},t);return(t==null?void 0:t.elements)==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,i)),i}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){const n=this.getElement(t);return n&&ty(n)?n:null}mapElements(t){let n=!1;const r=this.elements.map(i=>{const o=t(i);return o!==i&&(n=!0),o});return n&&this.replaceAllElements(r),n}replaceAllElements(t){this.elements=t instanceof Array?t:Array.from(t.values());const n=[];this.elementsMap.clear(),this.elements.forEach(i=>{pe(i)&&n.push(i),this.elementsMap.set(i.id,i),zs.mapElementToScene(i,this)});const r=Ib(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=n,this.nonDeletedFramesLikes=Ib(this.frames).elements,this.informMutation()}informMutation(){this.versionNonce=bs();for(const t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.nonDeletedElements=[],this.elements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),zs.sceneMapById.forEach((t,n)=>{t===this&&zs.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");const r=[...this.elements.slice(0,n),t,...this.elements.slice(n)];this.replaceAllElements(r)}insertElementsAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");const r=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];this.replaceAllElements(r)}getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}};M(zs,"sceneMapByElement",new WeakMap),M(zs,"sceneMapById",new Map);let $t=zs;const tI=e=>{const t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},Kl=(e,t,n,r)=>{const i=n.map(m=>m[e]),o=Math.max(...i),s=Math.min(...i),a=o-s,l=a===0?1:t/a;let c=1/0;const u=n.map(m=>{const g=m[e]*l,p=[...m];return p[e]=g,gm.map((g,p)=>p===e?g+d:g))},_e=(e,t,n,r,i)=>[(e-n)*Math.cos(i)-(t-r)*Math.sin(i)+n,(e-n)*Math.sin(i)+(t-r)*Math.cos(i)+r],st=(e,t,n)=>_e(e[0],e[1],t[0],t[1],n),nI=(e,t,n,r,i,o,s,a)=>{const l=Math.cos(r),c=Math.sin(r);return e.e&&e.w?t+=i+s:e.e?(t+=i*(1+l),n+=i*c,t+=s*(1-l),n+=s*-c):e.w&&(t+=i*(1-l),n+=i*-c,t+=s*(1+l),n+=s*c),e.n&&e.s?n+=o+a:e.n?(t+=o*c,n+=o*(1-l),t+=a*-c,n+=a*(1+l)):e.s&&(t+=o*-c,n+=o*(1+l),t+=a*c,n+=a*(1-l)),[t,n]},kt=(e,t,n,r)=>{const i=n-e,o=r-t;return Math.hypot(i,o)},C2=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],cs=(e,t=1)=>{if(e.length>=3){const[n,r]=[e[0],e[e.length-1]];return kt(n[0],n[1],r[0],r[1])<=Sf/t}return!1},Tb=(e,t,n)=>{const r=e.length;if(r<3)return!1;const i=[Number.MAX_SAFE_INTEGER,n],o=[t,n];let s=0;for(let a=0;at[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]),du=(e,t,n)=>{const r=(t[1]-e[1])*(n[0]-t[0])-(t[0]-e[0])*(n[1]-t[1]);return r===0?0:r>0?1:2},$D=(e,t,n,r)=>{const i=du(e,t,n),o=du(e,t,r),s=du(n,r,e),a=du(n,r,t);return!!(i!==o&&s!==a||i===0&&ml(e,n,t)||o===0&&ml(e,r,t)||s===0&&ml(n,e,r)||a===0&&ml(n,t,r))},jt=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],oa=(e,t)=>{var n,r,i,o;if(((n=t.roundness)==null?void 0:n.type)===Vt.PROPORTIONAL_RADIUS||((r=t.roundness)==null?void 0:r.type)===Vt.LEGACY)return e*cp;if(((i=t.roundness)==null?void 0:i.type)===Vt.ADAPTIVE_RADIUS){const s=((o=t.roundness)==null?void 0:o.value)??xR,a=s/cp;return e<=a?e*cp:s}return 0},rI=(e,t)=>{const n=Xe.generateElementShape(e,null);if(!n)return null;const r=_s(n[0]);let i=[0,0],o=0,s=1/0,a=null;for(;o{const o=(l,c)=>Math.pow(1-l,3)*r[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),s=o(i,0),a=o(i,1);return[s,a]},BD=(e,t)=>{const n=rI(e,t);if(!n)return[];const r=[];let i=1;for(;i>0;){const o=iI(n[0],n[1],n[2],n[3],i);r.push([o[0],o[1]]),i-=.05}return r.length&&sI(r.at(-1),t)&&r.push([t[0],t[1]]),r},oI=(e,t)=>{const n=[];n[0]=0;const r=BD(e,t);let i=0,o=0;for(;ioI(e,t).at(-1),HD=(e,t,n)=>{const r=oI(e,t),i=r.length-1,o=r.at(-1),s=n*o;let a=0,l=i,c=0;for(;as&&c--,r[c]===s?c/i:1-(c+(s-r[c])/(r[c+1]-r[c]))/i},sI=(e,t)=>e[0]===t[0]&&e[1]===t[1],UD=e=>Math.round(e/Math.PI*1e4)%5e3===0,Tm=([e,t],[n,r])=>e<=n?t>=n:e>=n?r>=e:!1,Mm=(e,t)=>{const n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n<=r?[n,r]:null},Uh=(e,t,n)=>e>=t&&e<=n;function WD(e,t){return Math.sqrt(Lf(e,t))}function Lf(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function VD(e,t,n){const r=Lf(t,n);if(r===0)return Lf(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),Lf(e,Ls(t,n,i))}function Ls(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function GD(e,t){const n=e[t+0],r=e[t+1],i=e[t+2],o=e[t+3];let s=3*r[0]-2*n[0]-o[0];s*=s;let a=3*r[1]-2*n[1]-o[1];a*=a;let l=3*i[0]-2*o[0]-n[0];l*=l;let c=3*i[1]-2*o[1]-n[1];return c*=c,s1&&i.push(o):i.push(o),i.push(e[t+3])}else{const s=e[t+0],a=e[t+1],l=e[t+2],c=e[t+3],u=Ls(s,a,.5),d=Ls(a,l,.5),h=Ls(l,c,.5),m=Ls(u,d,.5),g=Ls(d,h,.5),p=Ls(m,g,.5);T2([s,u,m,p],0,n,i),T2([p,g,h,c],0,n,i)}return i}function jD(e,t){return Am(e,0,e.length,t)}function Am(e,t,n,r,i){const o=i||[],s=e[t],a=e[n-1];let l=0,c=1;for(let u=t+1;ul&&(l=d,c=u)}return Math.sqrt(l)>r?(Am(e,t,c+1,r,o),Am(e,c,n,r,o)):(o.length||o.push(s),o.push(a)),o}function YD(e,t=.15,n){const r=[],i=(e.length-1)/3;for(let o=0;o0?Am(r,0,r.length,n):r}const gl=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",M2=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",Mb=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",Ab=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",A2=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond"||e==="image",Lm=e=>e==="arrow",KD=(e,t)=>{let n=null;for(let r=e.length-1;r>=0;--r){const i=e[r];if(!i.isDeleted&&t(i)){n=i;break}}return n},ZD=(e,t)=>{const n=[];return e.filter(i=>!i.isDeleted&&t(i)?Io(i)?(n.push(i),!1):!0:!1).concat(n)},XD=e=>[8,8+e],aI=e=>[1.5,6+e];function qD(e){const t=e.roughness,n=Math.max(e.width,e.height),r=Math.min(e.width,e.height);return r>=20&&n>=50||r>=15&&e.roundness&&A2(e.type)||we(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}const ur=(e,t=!1)=>{const n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?XD(e.strokeWidth):e.strokeStyle==="dotted"?aI(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:qD(e),stroke:e.strokeColor,preserveVertices:t||e.roughnessfr(e)&&(t||bn(e)&&(n==null?void 0:n.get(e.id))!==!0)&&Ei(e.backgroundColor)&&Ei(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Io(e)?{...e,strokeColor:Ei(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:Ei(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,Pb=(e,t,n,r,i,o,s)=>{const a=hN(e,t,n,r);if(a===null)return[];switch(r){case"dot":case"circle":case"circle_outline":{const[l,c,u]=a;return delete o.strokeLineDash,[i.circle(l,c,u,{...o,fill:r==="circle_outline"?s:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,o.roughness||0)})]}case"triangle":case"triangle_outline":{const[l,c,u,d,h,m]=a;return delete o.strokeLineDash,[i.polygon([[l,c],[u,d],[h,m],[l,c]],{...o,fill:r==="triangle_outline"?s:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"diamond":case"diamond_outline":{const[l,c,u,d,h,m,g,p]=a;return delete o.strokeLineDash,[i.polygon([[l,c],[u,d],[h,m],[g,p],[l,c]],{...o,fill:r==="diamond_outline"?s:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"bar":case"arrow":default:{const[l,c,u,d,h,m]=a;if(e.strokeStyle==="dotted"){const g=aI(e.strokeWidth-1);o.strokeLineDash=[g[0],g[1]-1]}else delete o.strokeLineDash;return o.roughness=Math.min(1,o.roughness||0),[i.line(u,d,l,c,o),i.line(h,m,l,c,o)]}}},QD=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let o;if(e.roundness){const s=e.width,a=e.height,l=oa(Math.min(s,a),e);o=t.path(`M ${l} 0 L ${s-l} 0 Q ${s} 0, ${s} ${l} L ${s} ${a-l} Q ${s} ${a}, ${s-l} ${a} L ${l} ${a} Q 0 ${a}, 0 ${a-l} L 0 ${l} Q 0 0, ${l} 0`,ur(Lb(e,n,i),!0))}else o=t.rectangle(0,0,e.width,e.height,ur(Lb(e,n,i),!1));return o}case"diamond":{let o;const[s,a,l,c,u,d,h,m]=aN(e);if(e.roundness){const g=oa(Math.abs(s-h),e),p=oa(Math.abs(c-a),e);o=t.path(`M ${s+g} ${a+p} L ${l-g} ${c-p} C ${l} ${c}, ${l} ${c}, ${l-g} ${c+p} L ${u+g} ${d-p} C ${u} ${d}, ${u} ${d}, ${u-g} ${d-p} L ${h+g} ${m+p} C ${h} ${m}, ${h} ${m}, ${h+g} ${m-p} L ${s-g} ${a+p} C ${s} ${a}, ${s} ${a}, ${s+g} ${a+p}`,ur(e,!0))}else o=t.polygon([[s,a],[l,c],[u,d],[h,m]],ur(e));return o}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,ur(e));case"line":case"arrow":{let o;const s=ur(e),a=e.points.length?e.points:[[0,0]];if(e.roundness?o=[t.curve(a,s)]:s.fill?o=[t.polygon(a,s)]:o=[t.linearPath(a,s)],e.type==="arrow"){const{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){const u=Pb(e,o,"start",l,t,s,r);o.push(...u)}if(c!==null){const u=Pb(e,o,"end",c,t,s,r);o.push(...u)}}return o}case"freedraw":{let o;if(Rz(e),cs(e.points)){const s=jD(e.points,.75);o=t.curve(s,{...ur(e),stroke:"none"})}else o=null;return o}case"frame":case"magicframe":case"text":case"image":return null;default:return jl(e,`generateElementShape(): Unimplemented type ${e==null?void 0:e.type}`),null}},_n=(e,t)=>[0,0,0,0,t,e,1,0],lI=(e,t)=>[0,0,0,0,t,e,0,0],Ra=(e=0,t=0)=>{const n=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(n[t]=e),n},z1=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]],JD=(e,t)=>Qv(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],Pm=(e,t)=>Qv(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],Zl=(e,t)=>Qv(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[eO(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],eO=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],tO=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],cI=(e,t)=>[uI(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],uI=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],nO=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],dI=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),rO=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),H1=e=>{const t=dI(e);if(t===0||t===1)return e;const n=e[6]<0?-1:1;return Zl(e,n/t)},iO=e=>{const t=rO(e);return t===0||t===1?e:Zl(e,1/t)},Qv=e=>typeof e=="number";Ra(1,1);Ra(1,2);Ra(1,3);Ra(1,4);Ra(1,5);Ra(1,6);Ra(1,7);const ga=(e,t,n)=>H1([0,n,e,t,0,0,0,0]),qd=(e,t)=>H1(cI(t,e)),oO=(e,t)=>nO(e,t),sO=(e,t)=>oO(qd(e,t),t),aO=e=>Math.sign(e[1]),pa=([e,t])=>[0,0,0,0,t,e,1,0],ya=e=>[e[5],e[4]],hI=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],lO=(e,t)=>H1(tO(e,t)),Rb=(e,t)=>dI(cI(e,t)),Qr=(e,t)=>uI(e,t),Jv=e=>[0,0,0,0,e[4],e[5],0,0],cO=(e,t)=>iO([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0]),eE=(e,t)=>JD(Zl(e,Math.sin(t/2)),Math.cos(t/2)),uO=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],dO=(e,t)=>{const n=.5*t;return[1,0,0,0,n*e[4],n*e[5],0,0]},hO=(e,t)=>Zl(t,e),Gr=(e,t)=>H1(Zl(Zl(e,t),z1(e))),Db={mouse:8,pen:16,touch:28},fO=16,fI={e:!0,s:!0,n:!0,w:!0},mO={e:!0,s:!0,n:!0,w:!0,rotation:!0},gO={e:!0,s:!0,n:!0,w:!0},Ob={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},gp={e:!0,s:!0,n:!0,w:!0},Li=(e,t,n,r,i,o,s)=>{const[a,l]=_e(e+n/2,t+r/2,i,o,s);return[a-n/2,l-r/2,n,r]},tE=([e,t,n,r,i,o],s,a,l,c={},u=4)=>{const d=Db[l],h=d/a.value,m=d/a.value,g=d/a.value,p=d/a.value,v=n-e,y=r-t,E=u/a.value,w=(d-ud*2)/(2*a.value),x={nw:c.nw?void 0:Li(e-E-g+w,t-E-p+w,h,m,i,o,s),ne:c.ne?void 0:Li(n+E-w,t-E-p+w,h,m,i,o,s),sw:c.sw?void 0:Li(e-E-g+w,r+E-w,h,m,i,o,s),se:c.se?void 0:Li(n+E-w,r+E-w,h,m,i,o,s),rotation:c.rotation?void 0:Li(e+v/2-h/2,t-E-p+w-fO/a.value,h,m,i,o,s)},C=5*Db.mouse/a.value;return Math.abs(v)>C&&(c.n||(x.n=Li(e+v/2-h/2,t-E-p+w,h,m,i,o,s)),c.s||(x.s=Li(e+v/2-h/2,r+E-w,h,m,i,o,s))),Math.abs(y)>C&&(c.w||(x.w=Li(e-E-g+w,t+y/2-m/2,h,m,i,o,s)),c.e||(x.e=Li(n+E-w,t+y/2-m/2,h,m,i,o,s))),x},mI=(e,t,n,r="mouse")=>{if(e.locked)return{};let i={};if(e.type==="freedraw"||we(e)){if(e.points.length===2){const[,s]=e.points;s[0]===0||s[1]===0?i=gp:s[0]>0&&s[1]<0?i=Ob:s[0]>0&&s[1]>0?i=gp:s[0]<0&&s[1]>0?i=Ob:s[0]<0&&s[1]<0&&(i=gp)}}else ce(e)?i=gO:pe(e)&&(i={rotation:!0});const o=we(e)?ud+8:ud;return tE(Ee(e,n,!0),e.angle,t,r,i,o)},nE=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;const n=e[0];return we(n)?n.points.length>2:!0},pO=e=>{if(e.type==="arrow")return!1;if(e.type==="freedraw")return!0;const t=!Ei(e.backgroundColor)||ls(e)||fr(e);return e.type==="line"?t&&cs(e.points):t||Gi(e)},Rm=(e,t,n,r,i,o)=>{const s=10/t.zoom.value,a=[r,i];if(yO(t,e)&&nE([e],t))return U1(e,o,a,s,n);const l=ke(e,o);return l&&Rm(l,t,n,r,i,o)?!0:vd(e,t,n,a,o)},pp=(e,t,n,r,i,o)=>{const s=10/t.zoom.value,a=ke(e,o);return a&&Rm(a,t,n,r,i,o)?!1:!vd(e,t,n,[r,i],o)&&U1(e,o,[r,i],s,n)},vd=(e,t,n,r,i)=>{const o=10/t.zoom.value,s=ce(e)?vO:pO(e)?Tu:EO;return rE({element:e,elementsMap:i,point:r,threshold:o,check:s,frameNameBoundsCache:n})},yO=(e,t)=>e.selectedElementIds[t.id],U1=(e,t,[n,r],i,o)=>{if(pe(e))return rE({element:e,elementsMap:t,point:[n,r],threshold:i,check:Tu,frameNameBoundsCache:o});const[s,a,l,c]=Ee(e,t),u=(s+l)/2,d=(a+c)/2,[h,m]=_e(n,r,u,d,-e.angle);return h>s-i&&ha-i&&m{const i=W1(e,e.width,e.height);return rE({element:e,elementsMap:r,point:[t,n],threshold:i,check:wO,frameNameBoundsCache:null})},W1=(e,t,n)=>{const i=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*i,32))},rE=e=>{var t;switch(e.element.type){case"rectangle":case"iframe":case"embeddable":case"image":case"text":case"diamond":case"ellipse":const n=L2(e.element,e.point,e.elementsMap);return e.check(n,e.threshold);case"freedraw":return e.check(pI(e.element,e.point,e.elementsMap),e.threshold)?kO(e.element,e.point,e.threshold,e.elementsMap):!1;case"arrow":case"line":return IO(e);case"selection":return console.warn("This should not happen, we need to investigate why it does."),!1;case"frame":case"magicframe":{if(e.check(L2(e.element,e.point,e.elementsMap),e.threshold))return!0;const r=(t=e.frameNameBoundsCache)==null?void 0:t.get(e.element);return r?e.check(bO(r,e.point),e.threshold):!1}}},L2=(e,t,n)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return pI(e,t,n);case"diamond":return _O(e,t,n);case"ellipse":return xO(e,t,n)}},vO=(e,t)=>e<0,Tu=(e,t)=>eMath.abs(e)0<=e&&e{const[,r,i,o]=V1(e,t,n);return Math.max(Qr(r,ga(0,1,-o)),Qr(r,ga(1,0,-i)))},bO=(e,t)=>{const[,n,r,i]=CO(t,e);return Math.max(Qr(n,ga(0,1,-i)),Qr(n,ga(1,0,-r)))},_O=(e,t,n)=>{const[,r,i,o]=V1(e,t,n),s=ga(o,i,-o*i);return Qr(r,s)},xO=(e,t,n)=>{const[r,i]=SO(e,t,n);return-aO(i)*Qr(r,i)},SO=(e,t,n)=>{const[,r,i,o]=V1(e,t,n),[s,a]=ya(r);let l=.707,c=.707;const u=i,d=o;[0,1,2,3].forEach(g=>{const p=u*l,v=d*c,y=(u*u-d*d)*l**3/u,E=(d*d-u*u)*c**3/d,w=p-y,x=v-E,C=s-y,S=a-E,I=Math.hypot(x,w),T=Math.hypot(S,C);l=Math.min(1,Math.max(0,(C*I/T+y)/u)),c=Math.min(1,Math.max(0,(S*I/T+E)/d));const L=Math.hypot(c,l);l/=L,c/=L});const h=_n(u*l,d*c),m=sO(r,h);return[r,m]},kO=(e,t,n,r)=>{let i,o;if(e.angle===0)i=t[0]-e.x,o=t[1]-e.y;else{const[u,d,h,m]=Ee(e,r),g=st(t,[u+(h-u)/2,d+(m-d)/2],-e.angle);i=g[0]-e.x,o=g[1]-e.y}let[s,a]=e.points,l;if(kt(s[0],s[1],i,o)h?a:vh?s:l,Math.hypot(o-l[1],i-l[0]){const{element:t,threshold:n}=e;if(!Xe.get(t))return!1;const[r,i,o,s]=V1(e.element,e.point,e.elementsMap),a=ga(0,1,-s),l=ga(1,0,-o);if(!Tu(Qr(i,a),n)||!Tu(Qr(i,l),n))return!1;const[c,u]=ya(r),d=Xe.get(t);return d?e.check===Tu&&d.some(m=>oE(m,c,u,t.roundness?"round":"sharp"))?!0:d.some(h=>vI(h,c,u,n)):!1},V1=(e,t,n)=>{const r=pa(t),[i,o,s,a]=Ee(e,n),l=G1(i,o,s,a),c=eE(l,e.angle),u=Gr(c,r),d=Pm(u,Jv(l)),h=hI(d),m=lI(e.x,e.y),g=Pm(u,m),p=(s-i)/2,v=(a-o)/2;return[g,h,p,v]},CO=(e,t)=>{const n=pa(e),[r,i,o,s]=sN(t),a=G1(r,i,o,s),l=eE(a,t.angle),c=Gr(l,n),u=Pm(c,Jv(a)),d=hI(u),h=lI(t.x,t.y),m=Pm(c,h),g=(o-r)/2,p=(s-i)/2;return[m,d,g,p]},iE=(e,t)=>{const[n,r,i,o]=Ee(e,t),s=G1(n,r,i,o),a=eE(s,e.angle),l=z1(uO(Jv(s)));return hO(a,l)},G1=(e,t,n,r)=>_n((e+n)/2,(t+r)/2),TO=(e,t,n,r)=>{const i=iE(e,r),o=Gr(i,pa(t)),s=Gr(i,pa(n)),a=qd(o,s),l=e.height/e.width,c=e.width/2,u=e.height/2,d=a[2],h=a[3],m=a[1],g=Math.abs(h),p=Math.abs(d);let v;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":v=m/(c*(p+l*g));break;case"diamond":v=g{if(t===0){const[l,c,u,d]=Ee(e,r),h=G1(l,c,u,d);return ya(h)}const i=iE(e,r),o=Gr(i,pa(n)),s=z1(i);let a;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":a=FO(e,t,o);break;case"ellipse":a=NO(e,t,o);break}return ya(Gr(s,a))},AO=(e,t,n,r=0,i)=>{const o=iE(e,i),s=Gr(o,pa(t)),a=Gr(o,pa(n)),l=qd(s,a),c=z1(o);return LO(e,l,s,r).map(d=>ya(Gr(c,d)))},LO=(e,t,n,r=0)=>{let i;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":const s=yI(e);i=s.flatMap((a,l)=>{const c=[a,s[(l+1)%4]];return PO(t,RO(c,r))}).concat(s.flatMap(a=>OO(a,r,t)));break;case"ellipse":i=DO(e,r,t);break}if(i.length<2)return[];const o=i.sort((s,a)=>Rb(s,n)-Rb(a,n));return[o[0],o[o.length-1]]},yI=(e,t=1)=>{const n=t*e.width/2,r=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[_n(n,r),_n(n,-r),_n(-n,-r),_n(-n,r)];case"diamond":return[_n(0,r),_n(n,0),_n(0,-r),_n(-n,0)]}},PO=(e,t)=>{const[n,r]=t,i=Qr(n,e),o=Qr(r,e);return i*o>=0?[]:[lO(e,qd(n,r))]},RO=(e,t)=>{const[n,r]=e,i=dO(cO(n,r),t);return[Gr(i,n),Gr(i,r)]},DO=(e,t,n)=>{const r=e.width/2+t,i=e.height/2+t,o=n[2],s=n[3],a=n[1],l=r*r*o*o+i*i*s*s,c=l-a*a;if(l===0||c<=0)return[];const u=Math.sqrt(c),d=-r*r*o*a,h=-i*i*s*a;return[_n((d+r*i*s*u)/l,(h-r*i*o*u)/l),_n((d-r*i*s*u)/l,(h+r*i*o*u)/l)]},OO=(e,t,n)=>{if(t===0)return Qr(n,e)===0?[e]:[];const r=n[2],i=n[3],o=n[1],[s,a]=ya(e),l=t,c=r*r+i*i,u=l*l*c-(r*s+i*a+o)**2;if(c===0||u<=0)return[];const d=Math.sqrt(u),h=s*i*i-a*r*i-r*o,m=a*r*r-s*r*i-i*o;return[_n((h+i*d)/c,(m-r*d)/c),_n((h-i*d)/c,(m+r*d)/c)]},NO=(e,t,n)=>{const r=Math.abs(t),i=e.width*r/2,o=e.height*r/2,s=Math.sign(t),[a,l]=ya(n),c=l===0?1e-4:l,u=a**2*o**2+c**2*i**2,d=(-a*o**2+s*c*Math.sqrt(Math.max(0,u-i**2*o**2)))/u;let h=(-d*a-1)/c;h===0&&(h=(Object.is(h,-0)?-1:1)*.01);const m=-(i**2*d)/(h**2*o**2+d**2*i**2);return _n(m,(-d*m-1)/h)},FO=(e,t,n)=>{const r=Math.abs(t),i=Math.sign(t),o=yI(e,r);let s=0,a=null;return o.forEach(l=>{const c=i*qd(n,l)[1];c>s&&(s=c,a=l)}),a},$O=(e,t,n,r,[i,o],s)=>{const a=(c,u)=>Math.pow(1-c,3)*r[u]+3*c*Math.pow(1-c,2)*n[u]+3*Math.pow(c,2)*(1-c)*t[u]+e[u]*Math.pow(c,3);let l=0;for(;l<=1;){const c=a(l,0),u=a(l,1);if(Math.sqrt(Math.pow(c-i,2)+Math.pow(u-o,2)){const i=_s(e),o=[];let s=!1;for(const a of i)a.op==="move"?(s=!s,s&&o.push([a.data[0],a.data[1]])):a.op==="bcurveTo"?s&&(o.push([a.data[0],a.data[1]]),o.push([a.data[2],a.data[3]]),o.push([a.data[4],a.data[5]])):a.op==="lineTo"&&s&&o.push([a.data[0],a.data[1]]);if(o.length>=4){if(r==="sharp")return Tb(o,t,n);const a=YD(o,10,5);return Tb(a,t,n)}return!1},vI=(e,t,n,r)=>{const i=_s(e);let o=[0,0];return i.some(({op:s,data:a},l)=>{if(s==="move")o=a;else if(s==="bcurveTo"){const c=[a[0],a[1]],u=[a[2],a[3]],d=[a[4],a[5]],h=o;return o=d,$O(h,c,u,d,[t,n],r)}else{if(s==="lineTo")return oE(e,t,n,"sharp");s==="qcurveTo"&&console.warn("qcurveTo is not implemented yet")}return!1})},De={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},D={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:ki?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},Pf=e=>e===D.ARROW_LEFT||e===D.ARROW_RIGHT||e===D.ARROW_DOWN||e===D.ARROW_UP,yp=e=>e.altKey,Bc=e=>e.shiftKey,Mu=e=>e.shiftKey,BO=e=>!e[D.CTRL_OR_CMD],Gs=e=>e.isBindingEnabled,EI=(e,t)=>{const n=[];return t.forEach(r=>{const i=e.getNonDeletedElement(r);i!=null&&n.push(i)}),n},dc=(e,t,n,r)=>{const i=new Set,o=new Set;Nb(e,t,n,"start",i,o,r),Nb(e,n,t,"end",i,o,r);const s=Array.from(o).filter(a=>!i.has(a));EI($t.getScene(e),s).forEach(a=>{var l;J(a,{boundElements:(l=a.boundElements)==null?void 0:l.filter(c=>c.type!=="arrow"||c.id!==e.id)})})},Nb=(e,t,n,r,i,o,s)=>{if(t!=="keep")if(t!=null)(n==null||(n==="keep"?!sE(e,t,r):r==="start"||n.id!==t.id))&&(Ed(e,t,r,s),i.add(t.id));else{const a=HO(e,r);a!=null&&o.add(a)}},P2=(e,t,n)=>{e.forEach(r=>{dn(r)?dc(r,Dm(r,"start",t,n),Dm(r,"end",t,n),n):yd(r)&&zO(r,n)})},zO=(e,t)=>{_I(e,t).forEach(([n,r])=>dc(n,r==="end"?"keep":e,r==="start"?"keep":e,t))},R2=(e,t,n,r,i)=>{t.startBoundElement!=null&&Ed(e,t.startBoundElement,"start",i);const o=No(r,n.getNonDeletedElements(),i);o!=null&&!sE(e,o,"end")&&Ed(e,o,"end",i)},Ed=(e,t,n,r)=>{J(e,{[n==="start"?"startBinding":"endBinding"]:{elementId:t.id,...UO(e,t,n,r)}}),be(t.boundElements||[]).has(e.id)||J(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},sE=(e,t,n)=>{const r=e[n==="start"?"endBinding":"startBinding"];return wI(e,r==null?void 0:r.elementId,t)},wI=(e,t,n)=>t===n.id&&e.points.length<3,D2=(e,t)=>{e.forEach(n=>{dn(n)&&dc(n,null,null,t)})},HO=(e,t)=>{const n=t==="start"?"startBinding":"endBinding",r=e[n];return r==null?null:(J(e,{[n]:null}),r.elementId)},No=(e,t,n)=>KD(t,i=>yd(i,!1)&&gI(i,e,n)),UO=(e,t,n,r)=>{const i=n==="start"?-1:1,o=i===-1?0:e.points.length-1,s=o-i,a=ue.getPointAtIndexGlobalCoordinates(e,o,r),l=ue.getPointAtIndexGlobalCoordinates(e,s,r);return{focus:TO(t,l,a,r),gap:Math.max(1,L2(t,a,r))}},us=(e,t,n)=>{const r=(e.boundElements??[]).filter(l=>l.type==="arrow");if(r.length===0)return;const{newSize:i,simultaneouslyUpdated:o}=n??{},s=VO(o),a=$t.getScene(e);EI(a,r.map(l=>l.id)).forEach(l=>{if(!we(l))return;const c=e;if(!WO(l,c))return;const u=$b(c,l.startBinding,i),d=$b(c,l.endBinding,i);if(s.has(l.id)){J(l,{startBinding:u,endBinding:d});return}Fb(l,"start",u,e,t),Fb(l,"end",d,e,t),ke(l,a.getNonDeletedElementsMap())&&j1(l,a.getNonDeletedElementsMap(),!1)})},WO=(e,t)=>{var n,r;return((n=e.startBinding)==null?void 0:n.elementId)===t.id||((r=e.endBinding)==null?void 0:r.elementId)===t.id},VO=e=>new Set((e||[]).map(t=>t.id)),Fb=(e,t,n,r,i)=>{if(n==null||n.elementId!==r.id&&e.points.length>2)return;const o=$t.getScene(e).getElement(n.elementId);if(o==null)return;const s=t==="start"?-1:1,a=s===-1?0:e.points.length-1,l=a-s,c=ue.getPointAtIndexGlobalCoordinates(e,l,i),u=MO(o,n.focus,c,i);let d;if(n.gap===0)d=u;else{const h=AO(o,c,u,n.gap,i);h.length===0?d=u:d=h[0]}ue.movePoints(e,[{index:a,point:ue.pointFromAbsoluteCoords(e,d,i)}],{[t==="start"?"startBinding":"endBinding"]:n})},$b=(e,t,n)=>{if(t==null||n==null)return t;const{gap:r,focus:i,elementId:o}=t,{width:s,height:a}=n,{width:l,height:c}=e,u=Math.max(1,Math.min(W1(e,s,a),r*(s{const r=new Set(e.map(({id:i})=>i));return e.flatMap(i=>dn(i,!1)?jO(i,t,n).filter(o=>!r.has(o.id)):yd(i,!1)?_I(i,n).filter(o=>!r.has(o[0].id)):[])},jO=(e,t,n)=>[Dm(e,"start",t,n),Dm(e,"end",t,n)].filter(r=>r!=null),Dm=(e,t,n,r)=>No(bI(e,t,r),n,r),bI=(e,t,n)=>{const r=t==="start"?0:-1;return Oo(ue.getPointAtIndexGlobalCoordinates(e,r,n))},_I=(e,t)=>$t.getScene(e).getNonDeletedElements().map(r=>{if(!dn(r,!1))return null;const i=Bb(r,"start",e,t),o=Bb(r,"end",e,t);return!i&&!o?null:[r,i&&o?"both":i?"start":"end",e]}).filter(r=>r!=null),Bb=(e,t,n,r)=>e[t==="start"?"startBinding":"endBinding"]==null&&!sE(e,n,t)&&gI(n,bI(e,t,r),r),xI=(e,t,n,r)=>{const i=new Set,o=new Set,s=r==="duplicatesServeAsOld";t.forEach(a=>{const{boundElements:l}=a;if(l!=null&&l.length>0&&(l.forEach(c=>{s&&!n.has(c.id)&&i.add(c.id)}),o.add(n.get(a.id))),dn(a)){if(a.startBinding!=null){const{elementId:c}=a.startBinding;s&&!n.has(c)&&o.add(c)}if(a.endBinding!=null){const{elementId:c}=a.endBinding;s&&!n.has(c)&&o.add(c)}(a.startBinding!=null||a.endBinding!=null)&&i.add(n.get(a.id))}}),e.filter(({id:a})=>i.has(a)).forEach(a=>{const{startBinding:l,endBinding:c}=a;J(a,{startBinding:zb(l,n),endBinding:zb(c,n)})}),e.filter(({id:a})=>o.has(a)).forEach(a=>{const{boundElements:l}=a;l!=null&&l.length>0&&J(a,{boundElements:l.map(c=>n.has(c.id)?{id:n.get(c.id),type:c.type}:c)})})},zb=(e,t)=>{if(e==null)return null;const{elementId:n,focus:r,gap:i}=e;return{focus:r,gap:i,elementId:t.get(n)??n}},aE=(e,t)=>{const n=new Set(t.map(i=>i.id)),r=new Set;t.forEach(i=>{var o;yd(i)?(o=i.boundElements)==null||o.forEach(s=>{n.has(s.id)||r.add(s.id)}):dn(i)&&(i.startBinding&&r.add(i.startBinding.elementId),i.endBinding&&r.add(i.endBinding.elementId))}),e.filter(({id:i})=>r.has(i)).forEach(i=>{yd(i)?J(i,{boundElements:YO(i.boundElements,n)}):dn(i)&&J(i,{startBinding:Hb(i.startBinding,n),endBinding:Hb(i.endBinding,n)})})},Hb=(e,t)=>e==null||t.has(e.elementId)?null:e,YO=(e,t)=>e?e.filter(n=>!t.has(n.id)):null,Pi={version:null,points:[],zoom:null},le=class le{constructor(t){M(this,"elementId");M(this,"selectedPointsIndices");M(this,"pointerDownState");M(this,"isDragging");M(this,"lastUncommittedPoint");M(this,"pointerOffset");M(this,"startBindingElement");M(this,"endBindingElement");M(this,"hoverPointIndex");M(this,"segmentMidPointHoveredCoords");this.elementId=t.id,le.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static getElement(t,n){const r=n.get(t);return r||null}static handleBoxSelection(t,n,r,i){var p;if(!n.editingLinearElement||((p=n.draggingElement)==null?void 0:p.type)!=="selection")return!1;const{editingLinearElement:o}=n,{selectedPointsIndices:s,elementId:a}=o,l=le.getElement(a,i);if(!l)return!1;const[c,u,d,h]=Ee(n.draggingElement,i),g=le.getPointsGlobalCoordinates(l,i).reduce((v,y,E)=>((y[0]>=c&&y[0]<=d&&y[1]>=u&&y[1]<=h||t.shiftKey&&(s!=null&&s.includes(E)))&&v.push(E),v),[]);r({editingLinearElement:{...o,selectedPointsIndices:g.length?g:null}})}static handlePointDragging(t,n,r,i,o,s,a){if(!s)return!1;const{selectedPointsIndices:l,elementId:c}=s,u=le.getElement(c,a);if(!u)return!1;const d=u.points[s.pointerDownState.lastClickedPoint];if(l&&d){if(Mu(t)&&l.length===1&&u.points.length>1){const m=l[0],g=u.points[m===0?1:m-1],[p,v]=le._getShiftLockedDelta(u,a,g,[r,i],t[D.CTRL_OR_CMD]?null:n.gridSize);le.movePoints(u,[{index:m,point:[p+g[0],v+g[1]],isDragging:m===s.pointerDownState.lastClickedPoint}])}else{const m=le.createPointAt(u,a,r-s.pointerOffset.x,i-s.pointerOffset.y,t[D.CTRL_OR_CMD]?null:n.gridSize),g=m[0]-d[0],p=m[1]-d[1];le.movePoints(u,l.map(v=>{const y=v===s.pointerDownState.lastClickedPoint?le.createPointAt(u,a,r-s.pointerOffset.x,i-s.pointerOffset.y,t[D.CTRL_OR_CMD]?null:n.gridSize):[u.points[v][0]+g,u.points[v][1]+p];return{index:v,point:y,isDragging:v===s.pointerDownState.lastClickedPoint}}))}if(ke(u,a)&&j1(u,a,!1),dn(u,!1)){const m=[];l[0]===0&&m.push(Oo(le.getPointGlobalCoordinates(u,u.points[0],a)));const p=l[l.length-1];p===u.points.length-1&&m.push(Oo(le.getPointGlobalCoordinates(u,u.points[p],a))),m.length&&o(u,m)}return!0}return!1}static handlePointerUp(t,n,r,i,o){var h;const{elementId:s,selectedPointsIndices:a,isDragging:l,pointerDownState:c}=n,u=le.getElement(s,o);if(!u)return n;const d={};if(l&&a){for(const m of a)if(m===0||m===u.points.length-1){cs(u.points,r.zoom.value)&&le.movePoints(u,[{index:m,point:m===0?u.points[u.points.length-1]:u.points[0]}]);const g=Gs(r)?No(Oo(le.getPointAtIndexGlobalCoordinates(u,m,o)),i,o):null;d[m===0?"startBindingElement":"endBindingElement"]=g}}return{...n,...d,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&((h=c.prevSelectedPointsIndices)!=null&&h.includes(c.lastClickedPoint))?a&&a.filter(m=>m!==c.lastClickedPoint):a:a!=null&&a.includes(c.lastClickedPoint)?[c.lastClickedPoint]:a,isDragging:!1,pointerOffset:{x:0,y:0}}}static isSegmentTooShort(t,n,r,i){let o=kt(n[0],n[1],r[0],r[1]);return t.points.length>2&&t.roundness&&(o=zD(t,r)),o*i.value2&&t.roundness){const a=rI(t,t.points[i]);if(a){const l=HD(t,t.points[i],.5),[c,u]=iI(a[0],a[1],a[2],a[3],l);s=le.getPointGlobalCoordinates(t,[c,u],o)}}return s}static getSegmentMidPointIndex(t,n,r,i){const o=le.getElement(t.elementId,i);if(!o)return-1;const s=le.getEditorMidPoints(o,i,n);let a=0;for(;a=0||d)l.hitElement=u;else{const{startBindingElement:I,endBindingElement:T}=o;Gs(n)&&dn(u)&&dc(u,I,T,a)}const[g,p,v,y]=Ee(u,a),E=(g+v)/2,w=(p+y)/2,x=m>-1&&_e(u.x+u.points[m][0],u.y+u.points[m][1],E,w,u.angle),C=m>-1||t.shiftKey?t.shiftKey||(S=o.selectedPointsIndices)!=null&&S.includes(m)?KO([...o.selectedPointsIndices||[],m]):[m]:null;return l.linearElementEditor={...o,pointerDownState:{prevSelectedPointsIndices:o.selectedPointsIndices,lastClickedPoint:m,origin:{x:i.x,y:i.y},segmentMidpoint:{value:d,index:h,added:!1}},selectedPointsIndices:C,pointerOffset:x?{x:i.x-x[0],y:i.y-x[1]}:{x:0,y:0}},l}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:sI(t,n)}static handlePointerMove(t,n,r,i,o){if(!i.editingLinearElement)return null;const{elementId:s,lastUncommittedPoint:a}=i.editingLinearElement,l=le.getElement(s,o);if(!l)return i.editingLinearElement;const{points:c}=l,u=c[c.length-1];if(!t.altKey)return u===a&&le.deletePoints(l,[c.length-1]),{...i.editingLinearElement,lastUncommittedPoint:null};let d;if(Mu(t)&&c.length>=2){const h=c[c.length-2],[m,g]=le._getShiftLockedDelta(l,o,h,[n,r],t[D.CTRL_OR_CMD]?null:i.gridSize);d=[m+h[0],g+h[1]]}else d=le.createPointAt(l,o,n-i.editingLinearElement.pointerOffset.x,r-i.editingLinearElement.pointerOffset.y,t[D.CTRL_OR_CMD]?null:i.gridSize);return u===a?le.movePoints(l,[{index:l.points.length-1,point:d}]):le.addPoints(l,i,[{point:d}]),{...i.editingLinearElement,lastUncommittedPoint:l.points[l.points.length-1]}}static getPointGlobalCoordinates(t,n,r){const[i,o,s,a]=Ee(t,r),l=(i+s)/2,c=(o+a)/2;let{x:u,y:d}=t;return[u,d]=_e(u+n[0],d+n[1],l,c,t.angle),[u,d]}static getPointsGlobalCoordinates(t,n){const[r,i,o,s]=Ee(t,n),a=(r+o)/2,l=(i+s)/2;return t.points.map(c=>{let{x:u,y:d}=t;return[u,d]=_e(u+c[0],d+c[1],a,l,t.angle),[u,d]})}static getPointAtIndexGlobalCoordinates(t,n,r){const i=n<0?t.points.length+n:n,[o,s,a,l]=Ee(t,r),c=(o+a)/2,u=(s+l)/2,d=t.points[i],{x:h,y:m}=t;return d?_e(h+d[0],m+d[1],c,u,t.angle):_e(h,m,c,u,t.angle)}static pointFromAbsoluteCoords(t,n,r){const[i,o,s,a]=Ee(t,r),l=(i+s)/2,c=(o+a)/2,[u,d]=_e(n[0],n[1],l,c,-t.angle);return[u-t.x,d-t.y]}static getPointIndexUnderCursor(t,n,r,i,o){const s=le.getPointsGlobalCoordinates(t,n);let a=s.length;for(;--a>-1;){const l=s[a];if(kt(i,o,l[0],l[1])*r.value[o[0]-r,o[1]-i]),x:t.x+r,y:t.y+i}}static normalizePoints(t){J(t,le.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){if(!t.editingLinearElement)return!1;const{selectedPointsIndices:r,elementId:i}=t.editingLinearElement,o=le.getElement(i,n);if(!o||r===null)return!1;const{points:s}=o,a=[];let l=!1,c=-1;const u=s.reduce((d,h,m)=>{if(++c,d.push(h),r.includes(m)){const p=s[m+1];p||(l=!0),d.push(p?[(h[0]+p[0])/2,(h[1]+p[1])/2]:[h[0],h[1]]),a.push(c+1),++c}return d},[]);if(J(o,{points:u}),l){const d=o.points[o.points.length-1];le.movePoints(o,[{index:o.points.length-1,point:[d[0]+30,d[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:a}}}}static deletePoints(t,n){let r=0,i=0;if(n.includes(0)){const a=t.points.find((l,c)=>!n.includes(c));a&&(r=a[0],i=a[1])}const s=t.points.reduce((a,l,c)=>(n.includes(c)||a.push(a.length?[l[0]-r,l[1]-i]:[0,0]),a),[]);le._updatePoints(t,s,r,i)}static addPoints(t,n,r){const s=[...t.points,...r.map(a=>a.point)];le._updatePoints(t,s,0,0)}static movePoints(t,n,r){const{points:i}=t;let o=0,s=0;const a=n.find(({index:c})=>c===0);a&&(o=a.point[0]+i[a.index][0],s=a.point[1]+i[a.index][1]);const l=i.map((c,u)=>{const d=n.find(h=>h.index===u);if(d){if(a)return c;const h=d.point[0]-i[d.index][0],m=d.point[1]-i[d.index][1];return[c[0]+h,c[1]+m]}return o||s?[c[0]-o,c[1]-s]:c});le._updatePoints(t,l,o,s,r)}static shouldAddMidpoint(t,n,r,i){if(!le.getElement(t.elementId,i))return!1;const{segmentMidpoint:s}=t.pointerDownState;if(s.added||s.value===null||s.index===null||t.pointerDownState.origin===null)return!1;const a=t.pointerDownState.origin,l=kt(a.x,a.y,n.x,n.y);return!(!r.editingLinearElement&&l{const i=ke(t,n);return!r.editingLinearElement&&t.points.length>2&&!i?[]:(Pi.version===t.version&&Pi.zoom===r.zoom.value||le.updateEditorMidPointsCache(t,n,r),Pi.points)}),M(le,"updateEditorMidPointsCache",(t,n,r)=>{const i=le.getPointsGlobalCoordinates(t,n);let o=0;const s=[];for(;o{const{elementId:o}=t,s=le.getElement(o,i);if(!s||le.getPointIndexUnderCursor(s,i,r.zoom,n.x,n.y)>=0||le.getPointsGlobalCoordinates(s,i).length>=3&&!r.editingLinearElement)return null;const c=le.POINT_HANDLE_SIZE/r.zoom.value,u=t.segmentMidPointHoveredCoords;if(u&&kt(u[0],u[1],n.x,n.y)<=c)return u;let d=0;const h=le.getEditorMidPoints(s,i,r);for(;d{const i=le.getPointsGlobalCoordinates(t,r);i.length<2&&J(n,{isDeleted:!0});let o=0,s=0;if(t.points.length%2===1){const a=Math.floor(t.points.length/2),l=le.getPointGlobalCoordinates(t,t.points[a],r);o=l[0]-n.width/2,s=l[1]-n.height/2}else{const a=t.points.length/2-1;let l=Pi.points[a];t.points.length===2&&(l=C2(i[0],i[1])),(!l||Pi.version!==t.version)&&(l=le.getSegmentMidPoint(t,i[a],i[a+1],a+1,r)),o=l[0]-n.width/2,s=l[1]-n.height/2}return{x:o,y:s}}),M(le,"getMinMaxXYWithBoundText",(t,n,r,i)=>{let[o,s,a,l]=r;const c=(o+a)/2,u=(s+l)/2,{x:d,y:h}=le.getBoundTextElementPosition(t,i,n),m=d+i.width,g=h+i.height,p=st([o,s],[c,u],t.angle),v=st([a,s],[c,u],t.angle),y=st([d,h],[c,u],-t.angle),E=st([m,h],[c,u],-t.angle),w=st([d,g],[c,u],-t.angle),x=st([m,g],[c,u],-t.angle);return p[0]=v[1]?(o=Math.min(o,w[0]),a=Math.max(a,Math.max(E[0],x[0])),s=Math.min(s,y[1]),l=Math.max(l,x[1])):p[0]>=v[0]&&p[1]>v[1]?(o=Math.min(o,x[0]),a=Math.max(a,Math.max(y[0],E[0])),s=Math.min(s,w[1]),l=Math.max(l,E[1])):p[0]>=v[0]?(o=Math.min(o,E[0]),a=Math.max(a,w[0]),s=Math.min(s,x[1]),l=Math.max(l,y[1])):p[1]<=v[1]&&(o=Math.min(o,Math.min(E[0],y[0])),a=Math.max(a,x[0]),s=Math.min(s,E[1]),l=Math.max(l,w[1])),[o,s,a,l,c,u]}),M(le,"getElementAbsoluteCoords",(t,n,r=!1)=>{let i,o,s,a,l;if(t.points.length<2||!Xe.get(t)){const{minX:h,minY:m,maxX:g,maxY:p}=t.points.reduce((v,[y,E])=>(v.minY=Math.min(v.minY,E),v.minX=Math.min(v.minX,y),v.maxX=Math.max(v.maxX,y),v.maxY=Math.max(v.maxY,E),v),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});o=h+t.x,s=m+t.y,a=g+t.x,l=p+t.y}else{const h=Xe.generateElementShape(t,null),m=_s(h[0]),[g,p,v,y]=Z1(m);o=g+t.x,s=p+t.y,a=v+t.x,l=y+t.y}const c=(o+a)/2,u=(s+l)/2;if(i=[o,s,a,l,c,u],!r)return i;const d=ke(t,n);return d&&(i=le.getMinMaxXYWithBoundText(t,n,[o,s,a,l],d)),i});let ue=le;const KO=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,r)=>n-r),t.length?t:null},Xl={},Om=(e,t)=>{const n=Xl[e]||(Xl[e]={height:t});return n.height=t,n},SI=e=>{Xl[e]&&delete Xl[e]},ZO=e=>{var t;return((t=Xl[e])==null?void 0:t.height)??null},wd=e=>qk(e).replace(/\t/g," "),lE=e=>wd(e).split(` `),Mi=(e,t,n)=>{let r;const i={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height};i.text=e.text,t&&(r=Ii(t,e),i.text=Jd(e.originalText,Bt(e),r));const o=ds(i.text,Bt(e),e.lineHeight);if(i.width=o.width,i.height=o.height,t){const s=eh(t,e),a=Ii(t,e);if(!Ge(t)&&o.height>s){const d=Ea(o.height,t.type);J(t,{height:d}),Om(t.id,d)}if(o.width>a){const d=Ea(o.width,t.type);J(t,{width:d})}const l={...e,...i},{x:c,y:u}=Y1(t,l,n);i.x=c,i.y=u}J(e,i)},kI=(e,t,n)=>{const r=be(e);t.forEach(i=>{const o=n.get(i.id),s=va(i);if(s){const a=n.get(s);if(a){const l=r.get(o);l&&J(l,{boundElements:(i.boundElements||[]).filter(u=>u.id!==a&&u.id!==s).concat({type:"text",id:a})});const c=r.get(a);c&&ce(c)&&J(c,{containerId:l?o:null})}}})},j1=(e,t,n,r=!1)=>{if(!va(e))return;SI(e.id);const o=ke(e,t);if(o&&o.text){if(!e)return;let s=o.text,a=o.height,l=o.width;const c=Ii(e,o),u=eh(e,o);let d=e.height;if(r||n!=="n"&&n!=="s"){s&&(s=Jd(o.originalText,Bt(o),c));const h=ds(s,Bt(o),o.lineHeight);a=h.height,l=h.width}if(a>u){d=Ea(a,e.type);const h=d-e.height,m=!Ge(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-h:e.y;J(e,{height:d,y:m})}J(o,{text:s,width:l,height:a}),Ge(e)||J(o,Y1(e,o,t))}},Y1=(e,t,n)=>{if(Ge(e))return ue.getBoundTextElementPosition(e,t,n);const r=LI(e),i=eh(e,t),o=Ii(e,t);let s,a;return t.verticalAlign===Qn.TOP?a=r.y:t.verticalAlign===Qn.BOTTOM?a=r.y+(i-t.height):a=r.y+(i/2-t.height/2),t.textAlign===hd.LEFT?s=r.x:t.textAlign===hd.RIGHT?s=r.x+(o-t.width):s=r.x+(o/2-t.width/2),{x:s,y:a}},ds=(e,t,n)=>{e=e.split(` `).map(s=>s||" ").join(` `);const r=parseFloat(t),i=qO(e,r,n);return{width:K1(e,t),height:i}},XO=e=>{const t=lE(e.text).length;return e.height/t/e.fontSize},Qd=(e,t)=>e*t,II=(e,t,n)=>{const{unitsPerEm:r,ascender:i,descender:o}=Wb[e]||Wb[Xt.Helvetica],s=t/r,a=n-s*i+s*o;return s*i+a},CI=(e,t)=>Qd(e,t)+Nt*2;let vp;const Au=(e,t)=>{vp||(vp=document.createElement("canvas"));const n=vp.getContext("2d");return n.font=t,n.measureText(e).width},K1=(e,t)=>{const n=lE(e);let r=0;return n.forEach(i=>{r=Math.max(r,Au(i,t))}),r},qO=(e,t,n)=>{const r=lE(e).length;return Qd(t,n)*r},QO=e=>{const t=e.split("-");return t.length>1&&t.forEach((n,r)=>{r!==t.length-1&&(t[r]=n+="-")}),t.join(" ").split(" ")},Jd=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;const r=[],i=e.split(` `),o=Au(" ",t);let s="",a=0;const l=u=>{u.trim()&&r.push(u)},c=()=>{s="",a=0};return i.forEach(u=>{if(K1(u,t)<=n){r.push(u);return}const h=QO(u);c();let m=0;for(;mn){for(l(s),c();h[m].length>0;){const p=String.fromCodePoint(h[m].codePointAt(0)),v=TI.calculate(p,t);a+=v,h[m]=h[m].slice(p.length),a>=n?(l(s),s=p,a=v):s+=p}a+o>=n?(l(s),c()):s.endsWith("-")||(s+=" ",a+=o),m++}else for(;an){l(s),c();break}m++;const v=!p.endsWith("-");if(s+=p,v&&(s+=" "),a+o>=n){v?r.push(s.slice(0,-1)):r.push(s),c();break}}}s.slice(-1)===" "&&(s=s.slice(0,-1),l(s))}),r.join(` `)},TI=(()=>{const e={};return{calculate:(r,i)=>{const o=r.charCodeAt(0);if(e[i]||(e[i]=[]),!e[i][o]){const s=Au(r,i);e[i][o]=s}return e[i][o]},getCache:r=>e[r]}})(),MI="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),AI=(e,t)=>{const n=JO(e);return n===0?ds(MI.split("").join(` `),e,t).width+Nt*2:n+Nt*2},JO=e=>{const t=TI.getCache(e);if(!t)return 0;const n=t.filter(r=>r!==void 0);return Math.max(...n)},va=e=>{var t,n,r;return(t=e==null?void 0:e.boundElements)!=null&&t.length&&((r=(n=e==null?void 0:e.boundElements)==null?void 0:n.filter(i=>i.type==="text")[0])==null?void 0:r.id)||null},ke=(e,t)=>{if(!e)return null;const n=va(e);return n&&t.get(n)||null},kn=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,Ep=(e,t,n)=>{if(!Ge(e))return{x:e.x+e.width/2,y:e.y+e.height/2};const r=ue.getPointsGlobalCoordinates(e,n);if(r.length%2===1){const s=Math.floor(e.points.length/2),a=ue.getPointGlobalCoordinates(e,e.points[s],n);return{x:a[0],y:a[1]}}const i=e.points.length/2-1;let o=ue.getEditorMidPoints(e,n,t)[i];return o||(o=ue.getSegmentMidPoint(e,r[i],r[i+1],i+1,n)),{x:o[0],y:o[1]}},LI=e=>{let t=Nt,n=Nt;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},eN=(e,t)=>!t||Ge(t)?e.angle:t.angle,tN=(e,t)=>e.some(n=>{if(Mt(n)){const r=kn(n,t);return!Ge(r)}return!1}),nN=(e,t)=>e.some(n=>{if(Mt(n)){const r=kn(n,t);return!Ge(r)}return ce(n)}),Ub=(e,t,n,r,i)=>{const o=qe(e,t);if(o.length===1)return ia(o[0],!1)?o[0]:null;let s=null;for(let a=e.length-1;a>=0;--a){if(e[a].isDeleted)continue;const[l,c,u,d]=Ee(e[a],i);if(Ge(e[a])&&vd(e[a],t,null,[n,r],i)){s=e[a];break}else if(lrN.has(e.type),Ea=(e,t)=>{e=Math.ceil(e);const n=Nt*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},Ii=(e,t)=>{const{width:n}=e;if(Ge(e)){const r=((t==null?void 0:t.fontSize)??Xr)*bR;return Math.max(wR*n,r)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Nt*2:e.type==="diamond"?Math.round(n/2)-Nt*2:n-Nt*2},eh=(e,t)=>{const{height:n}=e;return Ge(e)?n-Nt*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Nt*2:e.type==="diamond"?Math.round(n/2)-Nt*2:n-Nt*2},oN=()=>K1(MI,Bt({fontSize:Xr,fontFamily:oo}))>0,wp={[Xt.Virgil]:1.25,[Xt.Helvetica]:1.15,[Xt.Cascadia]:1.2},Wb={[Xt.Virgil]:{unitsPerEm:1e3,ascender:886,descender:-374},[Xt.Helvetica]:{unitsPerEm:2048,ascender:1577,descender:-471},[Xt.Cascadia]:{unitsPerEm:2048,ascender:1977,descender:-480},[Xt.Assistant]:{unitsPerEm:1e3,ascender:1021,descender:-287}},wa=e=>e in wp?wp[e]:wp[oo],wl=class wl{static getBounds(t,n){const r=wl.boundsCache.get(t);if(r!=null&&r.version&&r.version===t.version&&!Mt(t))return r.bounds;const i=wl.calculateBounds(t,n);return wl.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let r;const[i,o,s,a,l,c]=Ee(t,n);if(Hn(t)){const[u,d,h,m]=cE(t.points.map(([g,p])=>_e(g,p,l-t.x,c-t.y,t.angle)));return[u+t.x,d+t.y,h+t.x,m+t.y]}else if(we(t))r=mN(t,l,c,n);else if(t.type==="diamond"){const[u,d]=_e(l,o,l,c,t.angle),[h,m]=_e(l,a,l,c,t.angle),[g,p]=_e(i,c,l,c,t.angle),[v,y]=_e(s,c,l,c,t.angle),E=Math.min(u,h,g,v),w=Math.min(d,m,p,y),x=Math.max(u,h,g,v),C=Math.max(d,m,p,y);r=[E,w,x,C]}else if(t.type==="ellipse"){const u=(s-i)/2,d=(a-o)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),g=Math.hypot(u*h,d*m),p=Math.hypot(d*h,u*m);r=[l-g,c-p,l+g,c+p]}else{const[u,d]=_e(i,o,l,c,t.angle),[h,m]=_e(i,a,l,c,t.angle),[g,p]=_e(s,a,l,c,t.angle),[v,y]=_e(s,o,l,c,t.angle),E=Math.min(u,h,g,v),w=Math.min(d,m,p,y),x=Math.max(u,h,g,v),C=Math.max(d,m,p,y);r=[E,w,x,C]}return r}};M(wl,"boundsCache",new WeakMap);let O2=wl;const Ee=(e,t,n=!1)=>{if(Hn(e))return cN(e);if(we(e))return ue.getElementAbsoluteCoords(e,t,n);if(ce(e)){const r=t?kn(e,t):null;if(Ge(r)){const i=ue.getBoundTextElementPosition(r,e,t);return[i.x,i.y,i.x+e.width,i.y+e.height,i.x+e.width/2,i.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},Vb=(e,t)=>{const[n,r,i,o,s,a]=Ee(e,t),l=[s,a];if(we(e)||Hn(e)){const y=[];let E=0;for(;Est(y,l,e.angle));return e.type==="diamond"?[[m,p],[m,v],[g,p],[g,v]]:e.type==="ellipse"?[[m,p],[m,v],[g,p],[g,v],[m,p],[m,v],[g,p],[g,v]]:[[c,u],[d,h],[c,d],[u,h],[c,v],[d,v],[u,p],[h,p]]},sN=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],aN=e=>{const t=Math.floor(e.width/2)+1,n=0,r=e.width,i=Math.floor(e.height/2)+1,o=t,s=e.height;return[t,n,r,i,o,s,0,i]},_s=e=>{for(const t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},Gb=(e,t,n,r,i)=>{const o=1-e;return Math.pow(o,3)*t+3*Math.pow(o,2)*e*n+3*o*Math.pow(e,2)*r+Math.pow(e,3)*i},jb=(e,t,n,r)=>{const i=t-e,o=n-t,s=r-n,a=3*i-6*o+3*s,l=6*o-6*i,c=3*i,u=l*l-4*a*c;if(!(u>=0))return!1;let h=null,m=null,g=1/0,p=1/0;return a===0?g=p=-c/l:(g=(-l+Math.sqrt(u))/(2*a),p=(-l-Math.sqrt(u))/(2*a)),g>=0&&g<=1&&(h=Gb(g,e,t,n,r)),p>=0&&p<=1&&(m=Gb(p,e,t,n,r)),[h,m]},lN=(e,t,n,r)=>{const i=jb(e[0],t[0],n[0],r[0]),o=jb(e[1],t[1],n[1],r[1]);let s=Math.min(e[0],r[0]),a=Math.max(e[0],r[0]);if(i){const u=i.filter(d=>d!==null);s=Math.min(s,...u),a=Math.max(a,...u)}let l=Math.min(e[1],r[1]),c=Math.max(e[1],r[1]);if(o){const u=o.filter(d=>d!==null);l=Math.min(l,...u),c=Math.max(c,...u)}return[s,l,a,c]},Z1=(e,t)=>{let n=[0,0];const{minX:r,minY:i,maxX:o,maxY:s}=e.reduce((a,{op:l,data:c})=>{if(l==="move")n=c;else if(l==="bcurveTo"){const u=[c[0],c[1]],d=[c[2],c[3]],h=[c[4],c[5]],m=t?t(...u):u,g=t?t(...d):d,p=t?t(...h):h,v=t?t(...n):n;n=h;const[y,E,w,x]=lN(v,m,g,p);a.minX=Math.min(a.minX,y),a.minY=Math.min(a.minY,E),a.maxX=Math.max(a.maxX,w),a.maxY=Math.max(a.maxY,x)}return a},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[r,i,o,s]},cE=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(const[o,s]of e)t=Math.min(t,o),n=Math.min(n,s),r=Math.max(r,o),i=Math.max(i,s);return[t,n,r,i]},cN=e=>{const[t,n,r,i]=cE(e.points),o=t+e.x,s=n+e.y,a=r+e.x,l=i+e.y;return[o,s,a,l,(o+a)/2,(s+l)/2]},uN=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},dN=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},hN=(e,t,n,r)=>{const i=_s(t[0]);if(i.length<1)return null;const o=n==="start"?1:i.length-1,s=i[o].data,a=[s[4],s[5]],l=[s[2],s[3]],c=[s[0],s[1]],u=i[o-1];let d=[0,0];u.op==="move"?d=u.data:u.op==="bcurveTo"&&(d=[u.data[4],u.data[5]]);const h=(G,q)=>Math.pow(1-G,3)*a[q]+3*G*Math.pow(1-G,2)*l[q]+3*Math.pow(G,2)*(1-G)*c[q]+d[q]*Math.pow(G,3),[m,g]=n==="start"?d:a,[p,v]=[h(.3,0),h(.3,1)],y=Math.hypot(m-p,g-v),E=(m-p)/y,w=(g-v)/y,x=uN(r);let C=0;{const[G,q]=n==="end"?e.points[e.points.length-1]:e.points[0],[U,$]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];C=Math.hypot(G-U,q-$)}const I=Math.min(x,C*(r==="diamond"||r==="diamond_outline"?.25:.5)),T=m-E*I,L=g-w*I;if(r==="dot"||r==="circle"||r==="circle_outline"){const G=Math.hypot(L-g,T-m)+e.strokeWidth-2;return[m,g,G]}const A=dN(r),[F,P]=_e(T,L,m,g,-A*Math.PI/180),[O,V]=_e(T,L,m,g,A*Math.PI/180);if(r==="diamond"||r==="diamond_outline"){let G,q;if(n==="start"){const[U,$]=e.points.length>1?e.points[1]:[0,0];[G,q]=_e(m+I*2,g,m,g,Math.atan2($-g,U-m))}else{const[U,$]=e.points.length>1?e.points[e.points.length-2]:[0,0];[G,q]=_e(m-I*2,g,m,g,Math.atan2(g-$,m-U))}return[m,g,F,P,G,q,O,V]}return[m,g,F,P,O,V]},fN=e=>{const t=ws.generator(),n=ur(e),r=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[r](e.points,n)},mN=(e,t,n,r)=>{var d;const i=ke(e,r);if(e.points.length<2){const[h,m]=e.points[0],[g,p]=_e(e.x+h,e.y+m,t,n,e.angle);let v=[g,p,g,p];if(i){const y=ue.getMinMaxXYWithBoundText(e,r,[g,p,g,p],i);v=[y[0],y[1],y[2],y[3]]}return v}const s=((d=Xe.get(e))==null?void 0:d[0])??fN(e),a=_s(s),c=Z1(a,(h,m)=>_e(e.x+h,e.y+m,t,n,e.angle));let u=[c[0],c[1],c[2],c[3]];if(i){const h=ue.getMinMaxXYWithBoundText(e,r,u,i);u=[h[0],h[1],h[2],h[3]]}return u},ba=(e,t)=>O2.getBounds(e,t),nt=e=>{if(!e.length)return[0,0,0,0];let t=1/0,n=-1/0,r=1/0,i=-1/0;const o=be(e);return e.forEach(s=>{const[a,l,c,u]=ba(s,o);t=Math.min(t,a),r=Math.min(r,l),n=Math.max(n,c),i=Math.max(i,u)}),[t,r,n,i]},uE=(e,t)=>{const[n,r,i,o]=nt(e);return[n+t.x,r+t.y,i+t.x,o+t.y]},Lu=(e,t,n,r)=>{if(!(we(e)||Hn(e)))return[e.x,e.y,e.x+t,e.y+n];const i=Kl(0,t,Kl(1,n,e.points,r),r);let o;if(Hn(e))o=cE(i);else{const u=ws.generator(),d=e.roundness?u.curve(i,ur(e)):u.linearPath(i,ur(e)),h=_s(d);o=Z1(h)}const[s,a,l,c]=o;return[s+e.x,a+e.y,l+e.x,c+e.y]},Nm=(e,t)=>{const n=ws.generator(),r=e.roundness==null?n.linearPath(t,ur(e)):n.curve(t,ur(e)),i=_s(r),[o,s,a,l]=Z1(i);return[o+e.x,s+e.y,a+e.x,l+e.y]},gN=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,r=e[0];const i=be(e);return e.forEach(o=>{const[s,a,l,c]=ba(o,i),u=kt((s+l)/2,(a+c)/2,t.x,t.y);u{const[t,n,r,i]=nt(e);return{minX:t,minY:n,maxX:r,maxY:i,width:r-t,height:i-n,midX:(t+r)/2,midY:(n+i)/2}},pN=({scrollX:e,scrollY:t,width:n,height:r,zoom:i})=>[-e,-t,-e+n/i.value,-t+r/i.value];function Yb(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}function yN(e){return[-e[0],-e[1]]}function Or(e,t){return[e[0]+t[0],e[1]+t[1]]}function cr(e,t){return[e[0]-t[0],e[1]-t[1]]}function Lr(e,t){return[e[0]*t,e[1]*t]}function vN(e,t){return[e[0]/t,e[1]/t]}function zc(e){return[e[1],-e[0]]}function Kb(e,t){return e[0]*t[0]+e[1]*t[1]}function EN(e,t){return e[0]===t[0]&&e[1]===t[1]}function wN(e){return Math.hypot(e[0],e[1])}function bN(e){return e[0]*e[0]+e[1]*e[1]}function Zb(e,t){return bN(cr(e,t))}function PI(e){return vN(e,wN(e))}function _N(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Hc(e,t,n){let r=Math.sin(n),i=Math.cos(n),o=e[0]-t[0],s=e[1]-t[1],a=o*i-s*r,l=o*r+s*i;return[a+t[0],l+t[1]]}function N2(e,t,n){return Or(e,Lr(cr(t,e),n))}function Xb(e,t,n){return Or(e,Lr(t,n))}var{min:Ua,PI:xN}=Math,qb=.275,Uc=xN+1e-4;function SN(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:o=!0,easing:s=U=>U,start:a={},end:l={},last:c=!1}=t,{cap:u=!0,easing:d=U=>U*(2-U)}=a,{cap:h=!0,easing:m=U=>--U*U*U+1}=l;if(e.length===0||n<=0)return[];let g=e[e.length-1].runningLength,p=a.taper===!1?0:a.taper===!0?Math.max(n,g):a.taper,v=l.taper===!1?0:l.taper===!0?Math.max(n,g):l.taper,y=Math.pow(n*r,2),E=[],w=[],x=e.slice(0,10).reduce((U,$)=>{let Y=$.pressure;if(o){let R=Ua(1,$.distance/n),N=Ua(1,1-R);Y=Ua(1,U+(N-U)*(R*qb))}return(U+Y)/2},e[0].pressure),C=Yb(n,i,e[e.length-1].pressure,s),S,I=e[0].vector,T=e[0].point,L=T,A=T,F=L,P=!1;for(let U=0;Uy)&&(E.push(A),T=A),F=Or(Y,Fe),(U<=1||Zb(L,F)>y)&&(w.push(F),L=F),x=$,I=R}let O=e[0].point.slice(0,2),V=e.length>1?e[e.length-1].point.slice(0,2):Or(e[0].point,[1,1]),G=[],q=[];if(e.length===1){if(!(p||v)||c){let U=Xb(O,PI(zc(cr(O,V))),-(S||C)),$=[];for(let Y=1/13,R=Y;R<=1;R+=Y)$.push(Hc(U,O,Uc*2*R));return $}}else{if(!(p||v&&e.length===1))if(u)for(let $=1/13,Y=$;Y<=1;Y+=$){let R=Hc(w[0],O,Uc*Y);G.push(R)}else{let $=cr(E[0],w[0]),Y=Lr($,.5),R=Lr($,.51);G.push(cr(O,Y),cr(O,R),Or(O,R),Or(O,Y))}let U=zc(yN(e[e.length-1].vector));if(v||p&&e.length===1)q.push(V);else if(h){let $=Xb(V,U,C);for(let Y=1/29,R=Y;R<1;R+=Y)q.push(Hc($,V,Uc*3*R))}else q.push(Or(V,Lr(U,C)),Or(V,Lr(U,C*.99)),cr(V,Lr(U,C*.99)),cr(V,Lr(U,C)))}return E.concat(q,w.reverse(),G)}function kN(e,t={}){var n;let{streamline:r=.5,size:i=16,last:o=!1}=t;if(e.length===0)return[];let s=.15+(1-r)*.85,a=Array.isArray(e[0])?e:e.map(({x:m,y:g,pressure:p=.5})=>[m,g,p]);if(a.length===2){let m=a[1];a=a.slice(0,-1);for(let g=1;g<5;g++)a.push(N2(a[0],m,g/4))}a.length===1&&(a=[...a,[...Or(a[0],[1,1]),...a[0].slice(2)]]);let l=[{point:[a[0][0],a[0][1]],pressure:a[0][2]>=0?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,u=0,d=l[0],h=a.length-1;for(let m=1;m=0?a[m][2]:.5,vector:PI(cr(d.point,g)),distance:p,runningLength:u},l.push(d)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function IN(e,t={}){return SN(kN(e,t),t)}const RI=(e,t,n)=>{const r=n.reduce((i,o)=>(o.groupIds.includes(e)&&(i[o.id]=!0),i),{});return Object.keys(r).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...r}}},Zn=function(){let e=null,t=null,n=null;const r=(o,s,a,l)=>{if(n!==void 0&&s===t&&o===e&&a.editingGroupId===(n==null?void 0:n.editingGroupId))return n;const c={};for(const h of o){let m=h.groupIds;if(a.editingGroupId){const g=m.indexOf(a.editingGroupId);g>-1&&(m=m.slice(0,g))}if(m.length>0){const g=m[m.length-1];c[g]=!0}}const u={},d=s.reduce((h,m)=>{const g=m.groupIds.find(p=>c[p]);return g&&(h[m.id]=!0,Array.isArray(u[g])?u[g].push(m.id):u[g]=[m.id]),h},{});for(const h of Object.keys(u))u[h].length<2&&c[h]&&(c[h]=!1);return t=s,e=o,n={editingGroupId:a.editingGroupId,selectedGroupIds:c,selectedElementIds:$e({...a.selectedElementIds,...d},l)},n},i=(o,s,a,l)=>{const c=l?l.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,elements:s}):qe(s,o);return c.length?r(c,s,o,a):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:$e(o.selectedElementIds,a)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),DI=(e,t)=>OI(e,t)!=null,OI=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Ml=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),NI=(e,t)=>{let n={...t,selectedGroupIds:{}};for(const r of e){let i=r.groupIds;if(t.editingGroupId){const o=i.indexOf(t.editingGroupId);o>-1&&(i=i.slice(0,o))}if(i.length>0){const o=i[i.length-1];n={...n,...RI(o,n,e)}}}return n.selectedGroupIds},CN=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),bd=(e,t)=>e.groupIds.includes(t),It=(e,t)=>{const n=[];for(const r of e.values())bd(r,t)&&n.push(r);return n},TN=(e,t)=>e.groupIds.find(n=>t[n]),MN=(e,t,n)=>{const r=[...e],i=t?e.indexOf(t):-1,o=i>-1?i:e.length;for(let s=0;s{const r=[...e],i=n?r.indexOf(n):-1,o=i>-1?i:r.length;return r.splice(o,0,t),r},LN=(e,t)=>e.filter(n=>!t[n]),X1=(e,t)=>{const n=new Map;return e.forEach(r=>{const i=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],o=n.get(i)||[],s=ke(r,t);s&&o.push(s),n.set(i,[...o,r])}),Array.from(n.values())};var dE={};Object.defineProperty(dE,"__esModule",{value:!0});var FI=dE.sanitizeUrl=void 0,PN=/^([^\w]*)(javascript|data|vbscript)/im,RN=/&#(\w+)(^\w|;)?/g,DN=/&(newline|tab);/gi,ON=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,NN=/^.+(:|:)/gim,FN=[".","/"];function $N(e){return FN.indexOf(e[0])>-1}function BN(e){return e.replace(RN,function(t,n){return String.fromCharCode(n)})}function zN(e){var t=BN(e||"").replace(DN,"").replace(ON,"").trim();if(!t)return"about:blank";if($N(t))return t;var n=t.match(NN);if(!n)return t;var r=n[0];return PN.test(r)?"about:blank":t}FI=dE.sanitizeUrl=zN;const xi=e=>(e=e.trim(),e&&FI(e)),$I=e=>!!(e!=null&&e.includes(location.origin)||e!=null&&e.startsWith("/")),BI=e=>{if(e=xi(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};let F2=[];const ne=e=>(F2=F2.concat(e),e),zI='',HN='',HI='',UN=`data:${de.svg},${encodeURIComponent(`${zI}${HI}`)}`,WN=`data:${de.svg},${encodeURIComponent(`${zI}${HN}${HI}`)}`,Pr=e=>{e&&(e.style.cursor="")},He=(e,t)=>{e&&(e.style.cursor=t)};let oi,Qb;const UI=(e,t)=>{const r=()=>{const i=t===Tt.DARK;oi=document.createElement("canvas"),oi.theme=t,oi.height=20,oi.width=20;const o=oi.getContext("2d");o.lineWidth=1,o.beginPath(),o.arc(oi.width/2,oi.height/2,5,0,2*Math.PI),o.fillStyle=i?Ut.black:Ut.white,o.fill(),o.strokeStyle=i?Ut.white:Ut.black,o.stroke(),Qb=oi.toDataURL(de.svg)};(!oi||oi.theme!==t)&&r(),He(e,`url(${Qb}) ${20/2} ${20/2}, auto`)},di=(e,t)=>{if(e)if(t.activeTool.type==="selection")Pr(e);else if(Vl(t))e.style.cursor=Be.GRAB;else if(mi(t))UI(e,t.theme);else if(t.activeTool.type==="laser"){const n=t.theme===Tt.LIGHT?UN:WN;e.style.cursor=`url(${n}), auto`}else["image","custom"].includes(t.activeTool.type)?t.activeTool.type!=="image"&&(e.style.cursor=Be.AUTO):e.style.cursor=Be.CROSSHAIR},so=(e,{x:t,y:n,strokeColor:r=dt.strokeColor,backgroundColor:i=dt.backgroundColor,fillStyle:o=dt.fillStyle,strokeWidth:s=dt.strokeWidth,strokeStyle:a=dt.strokeStyle,roughness:l=dt.roughness,opacity:c=dt.opacity,width:u=0,height:d=0,angle:h=0,groupIds:m=[],frameId:g=null,roundness:p=null,boundElements:v=null,link:y=null,locked:E=dt.locked,...w})=>({id:w.id||xr(),type:e,x:t,y:n,width:u,height:d,angle:h,strokeColor:r,backgroundColor:i,fillStyle:o,strokeWidth:s,strokeStyle:a,roughness:l,opacity:c,groupIds:m,frameId:g,roundness:p,seed:w.seed??bs(),version:w.version||1,versionNonce:w.versionNonce??0,isDeleted:!1,boundElements:v,updated:cc(),link:y,locked:E,customData:w.customData}),hs=e=>so(e.type,e),Jb=e=>so("embeddable",e),VN=e=>({...so("iframe",e)}),WI=e=>ge({...so("frame",e),type:"frame",name:(e==null?void 0:e.name)||null},{}),$2=e=>ge({...so("magicframe",e),type:"magicframe",name:(e==null?void 0:e.name)||null},{}),VI=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),Sr=e=>{const t=e.fontFamily||oo,n=e.fontSize||Xr,r=e.lineHeight||wa(t),i=wd(e.text),o=ds(i,Bt({fontFamily:t,fontSize:n}),r),s=e.textAlign||D1,a=e.verticalAlign||_m,l=VI({textAlign:s,verticalAlign:a},o);return ge({...so("text",e),text:i,fontSize:n,fontFamily:t,textAlign:s,verticalAlign:a,x:e.x-l.x,y:e.y-l.y,width:o.width,height:o.height,containerId:e.containerId||null,originalText:i,lineHeight:r},{})},GN=(e,t,n)=>{const{width:r,height:i}=ds(n,Bt(e),e.lineHeight),{textAlign:o,verticalAlign:s}=e;let a,l;if(o==="center"&&s===Qn.MIDDLE&&!e.containerId){const c=ds(e.text,Bt(e),e.lineHeight),u=VI(e,{width:r-c.width,height:i-c.height});a=e.x-u.x,l=e.y-u.y}else{const[c,u,d,h]=Ee(e,t),[m,g,p,v]=Lu(e,r,i,!1),y=(c-m)/2,E=(u-g)/2,w=(d-p)/2,x=(h-v)/2;[a,l]=nI({s:!0,e:o==="center"||o==="left",w:o==="center"||o==="right"},e.x,e.y,e.angle,y,E,w,x)}return{width:r,height:i,x:Number.isFinite(a)?a:e.x,y:Number.isFinite(l)?l:e.y}},hE=(e,t,n,r=e.text)=>{if(e.isDeleted)return;t&&(r=Jd(r,Bt(e),Ii(t,e)));const i=GN(e,n,r);return{text:r,...i}},jN=(e,t,n,{text:r,isDeleted:i,originalText:o})=>ge(e,{originalText:o,isDeleted:i??e.isDeleted,...hE(e,t,n,o)}),YN=e=>({...so(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Qo=e=>({...so(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),GI=e=>({...so("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),Fm=(e,t=0)=>{if(e==null||typeof e!="object")return e;if(Object.prototype.toString.call(e)==="[object Object]"){const r=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(const i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;r[i]=Fm(e[i],t+1)}return r}if(Array.isArray(e)){let r=e.length;const i=new Array(r);for(;r--;)i[r]=Fm(e[r],t+1);return i}return e},th=e=>Fm(e),$m=e=>xr(),jI=(e,t,n,r)=>{let i=th(n);return i.id=$m(i.id),i.boundElements=null,i.updated=cc(),i.seed=bs(),i.groupIds=MN(i.groupIds,e,o=>(t.has(o)||t.set(o,$m()),t.get(o))),r&&(i=Object.assign(i,r)),i},YI=(e,t)=>{const n=[],r=be(e),i=new Map,o=a=>{if(i.has(a))return i.get(a);if(r.has(a)){const l=$m();return i.set(a,l),l}return null},s=new Map;for(const a of e){const l=Fm(a);if(l.id=o(a.id),t!=null&&t.randomizeSeed&&(l.seed=bs(),pc(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(s.has(c)||s.set(c,$m()),s.get(c)))),"containerId"in l&&l.containerId){const c=o(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,u)=>{const d=o(u.id);return d&&c.push({...u,id:d}),c},[])),"endBinding"in l&&l.endBinding){const c=o(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){const c=o(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=o(l.frameId)),n.push(l)}return n},Ri=new Map,KN=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,ZN=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,XN=/^https:\/\/(?:www\.)?figma\.com/,qN=/^https:\/\/gist\.github\.com/,QN=/^$/i,e_=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,B2=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","dddice.com"]),pl=e=>`${e}`,yl=e=>{if(!e)return null;if(Ri.has(e))return Ri.get(e);const t=e;let n="generic",r={w:560,h:840};const i=e.match(KN);if(i!=null&&i[2]){const l=i[3]?`&start=${i[3]}`:"",c=e.includes("shorts");switch(n="video",i[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${l}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${i[2]}&enablejsapi=1${l}`;break;default:e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${l}`;break}return r=c?{w:315,h:560}:{w:560,h:315},Ri.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n}}const o=e.match(ZN);if(o!=null&&o[1]){const l=o==null?void 0:o[1],c=/^\d+$/.test(l)?void 0:new URIError("Invalid embed link format");return n="video",e=`https://player.vimeo.com/video/${l}?api=1`,r={w:560,h:315},Ri.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n,error:c}}if(e.match(XN))return n="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,r={w:550,h:550},Ri.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};const a=e.match(tF);if(a)return e=a[1]==="embed"?a[0]:a[0].replace("/v","/embed"),Ri.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};if(JN.test(e)){e=e.replace(/\bx.com\b/,"twitter.com");let l;if(/
c,intrinsicSize:{w:480,h:480}}}else l={type:"document",srcdoc:c=>pl(`