@myoc/element 0.19.519 → 0.19.520

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/dev/index.js +1138 -355
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +13 -13
  4. package/dist/types/common/src/constants.d.ts +8 -5
  5. package/dist/types/common/src/utils.d.ts +0 -42
  6. package/dist/types/element/src/comparisons.d.ts +1 -0
  7. package/dist/types/element/src/image.d.ts +5 -0
  8. package/dist/types/element/src/newElement.d.ts +2 -0
  9. package/dist/types/element/src/types.d.ts +8 -0
  10. package/dist/types/excalidraw/actions/actionBoundText.d.ts +4 -2
  11. package/dist/types/excalidraw/actions/actionCanvas.d.ts +22 -11
  12. package/dist/types/excalidraw/actions/actionClipboard.d.ts +4 -2
  13. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -1
  14. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +6 -3
  15. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
  16. package/dist/types/excalidraw/actions/actionElementLink.d.ts +2 -1
  17. package/dist/types/excalidraw/actions/actionElementLock.d.ts +4 -2
  18. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +2 -1
  19. package/dist/types/excalidraw/actions/actionExport.d.ts +4 -2
  20. package/dist/types/excalidraw/actions/actionFrame.d.ts +10 -4
  21. package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -2
  22. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +4 -1
  23. package/dist/types/excalidraw/actions/actionLink.d.ts +2 -1
  24. package/dist/types/excalidraw/actions/actionMenu.d.ts +2 -1
  25. package/dist/types/excalidraw/actions/actionProperties.d.ts +16 -5
  26. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +2 -1
  27. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -1
  28. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +2 -1
  29. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -1
  30. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +2 -1
  31. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -1
  32. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -1
  33. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -1
  34. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -1
  35. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -1
  36. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  37. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  38. package/dist/types/excalidraw/appState.d.ts +2 -1
  39. package/dist/types/excalidraw/components/App.d.ts +12 -28
  40. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  41. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  42. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  43. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  44. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  45. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  46. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +2 -1
  47. package/dist/types/excalidraw/components/icons.d.ts +2 -0
  48. package/dist/types/excalidraw/data/blob.d.ts +2 -1
  49. package/dist/types/excalidraw/data/json.d.ts +2 -1
  50. package/dist/types/excalidraw/renderer/animation.d.ts +1 -0
  51. package/dist/types/excalidraw/scene/Renderer.d.ts +2 -0
  52. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  53. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  54. package/dist/types/excalidraw/scroll.d.ts +46 -0
  55. package/dist/types/excalidraw/types.d.ts +16 -3
  56. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  57. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  58. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  59. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  60. package/package.json +5 -4
@@ -1,31 +1,31 @@
1
- var qu=Object.create;var Ts=Object.defineProperty;var Ku=Object.getOwnPropertyDescriptor;var Qu=Object.getOwnPropertyNames;var Ju=Object.getPrototypeOf,ep=Object.prototype.hasOwnProperty;var tp=(e,t)=>()=>(e&&(t=e(e=0)),t);var yo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var np=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qu(t))!ep.call(e,i)&&i!==n&&Ts(e,i,{get:()=>t[i],enumerable:!(o=Ku(t,i))||o.enumerable});return e};var ii=(e,t,n)=>(n=e!=null?qu(Ju(e)):{},np(t||!e||!e.__esModule?Ts(n,"default",{value:e,enumerable:!0}):n,e));var C,I=tp(()=>{C={PROD:!0}});var Cc=yo((A6,Lc)=>{I();var Tc="Expected a function",Ac=NaN,O0="[object Symbol]",R0=/^\s+|\s+$/g,F0=/^[-+]0x[0-9a-f]+$/i,N0=/^0b[01]+$/i,H0=/^0o[0-7]+$/i,z0=parseInt,W0=typeof global=="object"&&global&&global.Object===Object&&global,_0=typeof self=="object"&&self&&self.Object===Object&&self,j0=W0||_0||Function("return this")(),V0=Object.prototype,Y0=V0.toString,U0=Math.max,X0=Math.min,es=function(){return j0.Date.now()};function $0(e,t,n){var o,i,r,a,s,l,d=0,c=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(Tc);t=kc(t)||0,dr(n)&&(c=!!n.leading,u="maxWait"in n,r=u?U0(kc(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h);function m(S){var v=o,k=i;return o=i=void 0,d=S,a=e.apply(k,v),a}function g(S){return d=S,s=setTimeout(x,t),c?m(S):a}function f(S){var v=S-l,k=S-d,T=t-v;return u?X0(T,r-k):T}function E(S){var v=S-l,k=S-d;return l===void 0||v>=t||v<0||u&&k>=r}function x(){var S=es();if(E(S))return y(S);s=setTimeout(x,f(S))}function y(S){return s=void 0,h&&o?m(S):(o=i=void 0,a)}function w(){s!==void 0&&clearTimeout(s),d=0,o=l=i=s=void 0}function M(){return s===void 0?a:y(es())}function b(){var S=es(),v=E(S);if(o=arguments,i=this,l=S,v){if(s===void 0)return g(l);if(u)return s=setTimeout(x,t),m(l)}return s===void 0&&(s=setTimeout(x,t)),a}return b.cancel=w,b.flush=M,b}function Z0(e,t,n){var o=!0,i=!0;if(typeof e!="function")throw new TypeError(Tc);return dr(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),$0(e,t,{leading:o,maxWait:t,trailing:i})}function dr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function q0(e){return!!e&&typeof e=="object"}function K0(e){return typeof e=="symbol"||q0(e)&&Y0.call(e)==O0}function kc(e){if(typeof e=="number")return e;if(K0(e))return Ac;if(dr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=dr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(R0,"");var n=N0.test(e);return n||H0.test(e)?z0(e.slice(2),n?2:8):F0.test(e)?Ac:+e}Lc.exports=Z0});var Tu=yo(J=>{"use strict";I();var ws=Symbol.for("react.transitional.element"),hg=Symbol.for("react.portal"),mg=Symbol.for("react.fragment"),fg=Symbol.for("react.strict_mode"),gg=Symbol.for("react.profiler"),Eg=Symbol.for("react.consumer"),xg=Symbol.for("react.context"),yg=Symbol.for("react.forward_ref"),wg=Symbol.for("react.suspense"),bg=Symbol.for("react.memo"),Pu=Symbol.for("react.lazy"),xu=Symbol.iterator;function Mg(e){return e===null||typeof e!="object"?null:(e=xu&&e[xu]||e["@@iterator"],typeof e=="function"?e:null)}var Iu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Su=Object.assign,vu={};function Eo(e,t,n){this.props=e,this.context=t,this.refs=vu,this.updater=n||Iu}Eo.prototype.isReactComponent={};Eo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Eo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Au(){}Au.prototype=Eo.prototype;function bs(e,t,n){this.props=e,this.context=t,this.refs=vu,this.updater=n||Iu}var Ms=bs.prototype=new Au;Ms.constructor=bs;Su(Ms,Eo.prototype);Ms.isPureReactComponent=!0;var yu=Array.isArray,ge={H:null,A:null,T:null,S:null},ku=Object.prototype.hasOwnProperty;function Ps(e,t,n,o,i,r){return n=r.ref,{$$typeof:ws,type:e,key:t,ref:n!==void 0?n:null,props:r}}function Pg(e,t){return Ps(e.type,t,void 0,void 0,void 0,e.props)}function Is(e){return typeof e=="object"&&e!==null&&e.$$typeof===ws}function Ig(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var wu=/\/+/g;function ys(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ig(""+e.key):t.toString(36)}function bu(){}function Sg(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(bu,bu):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function go(e,t,n,o,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(r){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case ws:case hg:a=!0;break;case Pu:return a=e._init,go(a(e._payload),t,n,o,i)}}if(a)return i=i(e),a=o===""?"."+ys(e,0):o,yu(i)?(n="",a!=null&&(n=a.replace(wu,"$&/")+"/"),go(i,t,n,"",function(d){return d})):i!=null&&(Is(i)&&(i=Pg(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(wu,"$&/")+"/")+a)),t.push(i)),1;a=0;var s=o===""?".":o+":";if(yu(e))for(var l=0;l<e.length;l++)o=e[l],r=s+ys(o,l),a+=go(o,t,n,r,i);else if(l=Mg(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,r=s+ys(o,l++),a+=go(o,t,n,r,i);else if(r==="object"){if(typeof e.then=="function")return go(Sg(e),t,n,o,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function br(e,t,n){if(e==null)return e;var o=[],i=0;return go(e,o,"","",function(r){return t.call(n,r,i++)}),o}function vg(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Mu=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function Ag(){}J.Children={map:br,forEach:function(e,t,n){br(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return br(e,function(){t++}),t},toArray:function(e){return br(e,function(t){return t})||[]},only:function(e){if(!Is(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};J.Component=Eo;J.Fragment=mg;J.Profiler=gg;J.PureComponent=bs;J.StrictMode=fg;J.Suspense=wg;J.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ge;J.act=function(){throw Error("act(...) is not supported in production builds of React.")};J.cache=function(e){return function(){return e.apply(null,arguments)}};J.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Su({},e.props),i=e.key,r=void 0;if(t!=null)for(a in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(i=""+t.key),t)!ku.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(o[a]=t[a]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];o.children=s}return Ps(e.type,i,void 0,void 0,r,o)};J.createContext=function(e){return e={$$typeof:xg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Eg,_context:e},e};J.createElement=function(e,t,n){var o,i={},r=null;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)ku.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(i[o]=t[o]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];i.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)i[o]===void 0&&(i[o]=a[o]);return Ps(e,r,void 0,void 0,null,i)};J.createRef=function(){return{current:null}};J.forwardRef=function(e){return{$$typeof:yg,render:e}};J.isValidElement=Is;J.lazy=function(e){return{$$typeof:Pu,_payload:{_status:-1,_result:e},_init:vg}};J.memo=function(e,t){return{$$typeof:bg,type:e,compare:t===void 0?null:t}};J.startTransition=function(e){var t=ge.T,n={};ge.T=n;try{var o=e(),i=ge.S;i!==null&&i(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(Ag,Mu)}catch(r){Mu(r)}finally{ge.T=t}};J.unstable_useCacheRefresh=function(){return ge.H.useCacheRefresh()};J.use=function(e){return ge.H.use(e)};J.useActionState=function(e,t,n){return ge.H.useActionState(e,t,n)};J.useCallback=function(e,t){return ge.H.useCallback(e,t)};J.useContext=function(e){return ge.H.useContext(e)};J.useDebugValue=function(){};J.useDeferredValue=function(e,t){return ge.H.useDeferredValue(e,t)};J.useEffect=function(e,t){return ge.H.useEffect(e,t)};J.useId=function(){return ge.H.useId()};J.useImperativeHandle=function(e,t,n){return ge.H.useImperativeHandle(e,t,n)};J.useInsertionEffect=function(e,t){return ge.H.useInsertionEffect(e,t)};J.useLayoutEffect=function(e,t){return ge.H.useLayoutEffect(e,t)};J.useMemo=function(e,t){return ge.H.useMemo(e,t)};J.useOptimistic=function(e,t){return ge.H.useOptimistic(e,t)};J.useReducer=function(e,t,n){return ge.H.useReducer(e,t,n)};J.useRef=function(e){return ge.H.useRef(e)};J.useState=function(e){return ge.H.useState(e)};J.useSyncExternalStore=function(e,t,n){return ge.H.useSyncExternalStore(e,t,n)};J.useTransition=function(){return ge.H.useTransition()};J.version="19.0.0"});var Cu=yo((wM,Lu)=>{"use strict";I();Lu.exports=Tu()});var Du=yo(Mr=>{"use strict";I();var kg=Symbol.for("react.transitional.element"),Tg=Symbol.for("react.fragment");function Bu(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:kg,type:e,key:o,ref:t!==void 0?t:null,props:n}}Mr.Fragment=Tg;Mr.jsx=Bu;Mr.jsxs=Bu});var Ss=yo((IM,Gu)=>{"use strict";I();Gu.exports=Du()});I();import{toIterable as Yg}from"@excalidraw/common";I();import{SHIFT_LOCKING_ANGLE as on,viewportCoordsToSceneCoords as ar}from"@excalidraw/common";import{normalizeRadians as uc,radiansBetweenAngles as t0,radiansDifference as n0}from"@excalidraw/math";import{pointsEqual as o0}from"@excalidraw/math";I();I();I();I();I();I();I();I();I();function Ar(e,t,n){if(e&&e.length){let[o,i]=t,r=Math.PI/180*n,a=Math.cos(r),s=Math.sin(r);for(let l of e){let[d,c]=l;l[0]=(d-o)*a-(c-i)*s+o,l[1]=(d-o)*s+(c-i)*a+i}}}function ip(e,t,n){let o=[];e.forEach(i=>o.push(...i)),Ar(o,t,n)}function rp(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ls(e,t,n,o=1){let i=n,r=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let d of a)Ar(d,s,i);let l=ap(a,r,o);if(i){for(let d of a)Ar(d,s,-i);ip(l,s,-i)}return l}function ap(e,t,n){let o=[];for(let d of e){let c=[...d];rp(c[0],c[c.length-1])||c.push([c[0][0],c[0][1]]),c.length>2&&o.push(c)}let i=[];t=Math.max(t,.1);let r=[];for(let d of o)for(let c=0;c<d.length-1;c++){let u=d[c],h=d[c+1];if(u[1]!==h[1]){let m=Math.min(u[1],h[1]);r.push({ymin:m,ymax:Math.max(u[1],h[1]),x:m===u[1]?u[0]:h[0],islope:(h[0]-u[0])/(h[1]-u[1])})}}if(r.sort((d,c)=>d.ymin<c.ymin?-1:d.ymin>c.ymin?1:d.x<c.x?-1:d.x>c.x?1:d.ymax===c.ymax?0:(d.ymax-c.ymax)/Math.abs(d.ymax-c.ymax)),!r.length)return i;let a=[],s=r[0].ymin,l=0;for(;a.length||r.length;){if(r.length){let d=-1;for(let u=0;u<r.length&&!(r[u].ymin>s);u++)d=u;r.splice(0,d+1).forEach(u=>{a.push({s,edge:u})})}if(a=a.filter(d=>!(d.edge.ymax<=s)),a.sort((d,c)=>d.edge.x===c.edge.x?0:(d.edge.x-c.edge.x)/Math.abs(d.edge.x-c.edge.x)),(n!==1||l%t===0)&&a.length>1)for(let d=0;d<a.length;d=d+2){let c=d+1;if(c>=a.length)break;let u=a[d].edge,h=a[c].edge;i.push([[Math.round(u.x),s],[Math.round(h.x),s]])}s+=n,a.forEach(d=>{d.edge.x=d.edge.x+n*d.edge.islope}),l++}return i}function kt(e,t){var n;let o=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.max(i,.1);let r=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(r=i),Ls(e,i,o,r||1)}var ln=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let o=kt(t,n);return{type:"fillSketch",ops:this.renderLines(o,n)}}renderLines(t,n){let o=[];for(let i of t)o.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return o}};I();I();function dn(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var ri=class extends ln{fillPolygons(t,n){let o=n.hachureGap;o<0&&(o=n.strokeWidth*4),o=Math.max(o,.1);let i=Object.assign({},n,{hachureGap:o}),r=kt(t,i),a=Math.PI/180*n.hachureAngle,s=[],l=o*.5*Math.cos(a),d=o*.5*Math.sin(a);for(let[u,h]of r)dn([u,h])&&s.push([[u[0]-l,u[1]+d],[...h]],[[u[0]+l,u[1]-d],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};I();var ai=class extends ln{fillPolygons(t,n){let o=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),r=this._fillPolygons(t,i);return o.ops=o.ops.concat(r.ops),o}};I();var si=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let o=kt(t,n);return this.dotsOnLines(o,n)}dotsOnLines(t,n){let o=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);let a=i/4;for(let s of t){let l=dn(s),d=l/i,c=Math.ceil(d)-1,u=l-c*i,h=(s[0][0]+s[1][0])/2-i/4,m=Math.min(s[0][1],s[1][1]);for(let g=0;g<c;g++){let f=m+u+g*i,E=h-a+Math.random()*2*a,x=f-a+Math.random()*2*a,y=this.helper.ellipse(E,x,r,r,n);o.push(...y.ops)}}return{type:"fillSketch",ops:o}}};I();var li=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=kt(t,n);return{type:"fillSketch",ops:this.dashedLine(o,n)}}dashedLine(t,n){let o=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,r=[];return t.forEach(a=>{let s=dn(a),l=Math.floor(s/(o+i)),d=(s+i-l*(o+i))/2,c=a[0],u=a[1];c[0]>u[0]&&(c=a[1],u=a[0]);let h=Math.atan((u[1]-c[1])/(u[0]-c[0]));for(let m=0;m<l;m++){let g=m*(o+i),f=g+o,E=[c[0]+g*Math.cos(h)+d*Math.cos(h),c[1]+g*Math.sin(h)+d*Math.sin(h)],x=[c[0]+f*Math.cos(h)+d*Math.cos(h),c[1]+f*Math.sin(h)+d*Math.sin(h)];r.push(...this.helper.doubleLineOps(E[0],E[1],x[0],x[1],n))}}),r}};I();var di=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?o:n.zigzagOffset;n=Object.assign({},n,{hachureGap:o+i});let r=kt(t,n);return{type:"fillSketch",ops:this.zigzagLines(r,i,n)}}zigzagLines(t,n,o){let i=[];return t.forEach(r=>{let a=dn(r),s=Math.round(a/(2*n)),l=r[0],d=r[1];l[0]>d[0]&&(l=r[1],d=r[0]);let c=Math.atan((d[1]-l[1])/(d[0]-l[0]));for(let u=0;u<s;u++){let h=u*2*n,m=(u+1)*2*n,g=Math.sqrt(2*Math.pow(n,2)),f=[l[0]+h*Math.cos(c),l[1]+h*Math.sin(c)],E=[l[0]+m*Math.cos(c),l[1]+m*Math.sin(c)],x=[f[0]+g*Math.cos(c+Math.PI/4),f[1]+g*Math.sin(c+Math.PI/4)];i.push(...this.helper.doubleLineOps(f[0],f[1],x[0],x[1],o),...this.helper.doubleLineOps(x[0],x[1],E[0],E[1],o))}}),i}};var Ye={};function Cs(e,t){let n=e.fillStyle||"hachure";if(!Ye[n])switch(n){case"zigzag":Ye[n]||(Ye[n]=new ri(t));break;case"cross-hatch":Ye[n]||(Ye[n]=new ai(t));break;case"dots":Ye[n]||(Ye[n]=new si(t));break;case"dashed":Ye[n]||(Ye[n]=new li(t));break;case"zigzag-line":Ye[n]||(Ye[n]=new di(t));break;case"hachure":default:n="hachure",Ye[n]||(Ye[n]=new ln(t));break}return Ye[n]}I();function Bs(){return Math.floor(Math.random()*2**31)}var ci=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};I();I();var ui={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function sp(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function kr(e,t){return e.type===t}function Qn(e){let t=[],n=sp(e),o="BOD",i=0,r=n[i];for(;!kr(r,2);){let a=0,s=[];if(o==="BOD")if(r.text==="M"||r.text==="m")i++,a=ui[r.text],o=r.text;else return Qn("M0,0"+e);else kr(r,1)?a=ui[o]:(i++,a=ui[r.text],o=r.text);if(i+a<n.length){for(let l=i;l<i+a;l++){let d=n[l];if(kr(d,1))s[s.length]=+d.text;else throw new Error("Param not a number: "+o+","+d.text)}if(typeof ui[o]=="number"){let l={key:o,data:s};t.push(l),i+=a,r=n[i],o==="M"&&(o="L"),o==="m"&&(o="l")}else throw new Error("Bad segment: "+o)}else throw new Error("Path data ended short")}return t}I();function wo(e){let t=0,n=0,o=0,i=0,r=[];for(let{key:a,data:s}of e)switch(a){case"M":r.push({key:"M",data:[...s]}),[t,n]=s,[o,i]=s;break;case"m":t+=s[0],n+=s[1],r.push({key:"M",data:[t,n]}),o=t,i=n;break;case"L":r.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],r.push({key:"L",data:[t,n]});break;case"C":r.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":r.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":r.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],r.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":r.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],r.push({key:"V",data:[n]});break;case"S":r.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":r.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],r.push({key:"T",data:[t,n]});break;case"Z":case"z":r.push({key:"Z",data:[]}),t=o,n=i;break}return r}I();function Mo(e){let t=[],n="",o=0,i=0,r=0,a=0,s=0,l=0;for(let{key:d,data:c}of e){switch(d){case"M":t.push({key:"M",data:[...c]}),[o,i]=c,[r,a]=c;break;case"C":t.push({key:"C",data:[...c]}),o=c[4],i=c[5],s=c[2],l=c[3];break;case"L":t.push({key:"L",data:[...c]}),[o,i]=c;break;case"H":o=c[0],t.push({key:"L",data:[o,i]});break;case"V":i=c[0],t.push({key:"L",data:[o,i]});break;case"S":{let u=0,h=0;n==="C"||n==="S"?(u=o+(o-s),h=i+(i-l)):(u=o,h=i),t.push({key:"C",data:[u,h,...c]}),s=c[0],l=c[1],o=c[2],i=c[3];break}case"T":{let[u,h]=c,m=0,g=0;n==="Q"||n==="T"?(m=o+(o-s),g=i+(i-l)):(m=o,g=i);let f=o+2*(m-o)/3,E=i+2*(g-i)/3,x=u+2*(m-u)/3,y=h+2*(g-h)/3;t.push({key:"C",data:[f,E,x,y,u,h]}),s=m,l=g,o=u,i=h;break}case"Q":{let[u,h,m,g]=c,f=o+2*(u-o)/3,E=i+2*(h-i)/3,x=m+2*(u-m)/3,y=g+2*(h-g)/3;t.push({key:"C",data:[f,E,x,y,m,g]}),s=u,l=h,o=m,i=g;break}case"A":{let u=Math.abs(c[0]),h=Math.abs(c[1]),m=c[2],g=c[3],f=c[4],E=c[5],x=c[6];u===0||h===0?(t.push({key:"C",data:[o,i,E,x,E,x]}),o=E,i=x):(o!==E||i!==x)&&(Ds(o,i,E,x,u,h,m,g,f).forEach(function(w){t.push({key:"C",data:w})}),o=E,i=x);break}case"Z":t.push({key:"Z",data:[]}),o=r,i=a;break}n=d}return t}function lp(e){return Math.PI*e/180}function bo(e,t,n){let o=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[o,i]}function Ds(e,t,n,o,i,r,a,s,l,d){let c=lp(a),u=[],h=0,m=0,g=0,f=0;if(d)[h,m,g,f]=d;else{[e,t]=bo(e,t,-c),[n,o]=bo(n,o,-c);let N=(e-n)/2,G=(t-o)/2,q=N*N/(i*i)+G*G/(r*r);q>1&&(q=Math.sqrt(q),i=q*i,r=q*r);let U=s===l?-1:1,le=i*i,H=r*r,A=le*H-le*G*G-H*N*N,_=le*G*G+H*N*N,X=U*Math.sqrt(Math.abs(A/_));g=X*i*G/r+(e+n)/2,f=X*-r*N/i+(t+o)/2,h=Math.asin(parseFloat(((t-f)/r).toFixed(9))),m=Math.asin(parseFloat(((o-f)/r).toFixed(9))),e<g&&(h=Math.PI-h),n<g&&(m=Math.PI-m),h<0&&(h=Math.PI*2+h),m<0&&(m=Math.PI*2+m),l&&h>m&&(h=h-Math.PI*2),!l&&m>h&&(m=m-Math.PI*2)}let E=m-h;if(Math.abs(E)>Math.PI*120/180){let N=m,G=n,q=o;l&&m>h?m=h+Math.PI*120/180*1:m=h+Math.PI*120/180*-1,n=g+i*Math.cos(m),o=f+r*Math.sin(m),u=Ds(n,o,G,q,i,r,a,0,l,[m,N,g,f])}E=m-h;let x=Math.cos(h),y=Math.sin(h),w=Math.cos(m),M=Math.sin(m),b=Math.tan(E/4),S=4/3*i*b,v=4/3*r*b,k=[e,t],T=[e+S*y,t-v*x],R=[n+S*M,o-v*w],O=[n,o];if(T[0]=2*k[0]-T[0],T[1]=2*k[1]-T[1],d)return[T,R,O].concat(u);{u=[T,R,O].concat(u);let N=[];for(let G=0;G<u.length;G+=3){let q=bo(u[G][0],u[G][1],c),U=bo(u[G+1][0],u[G+1][1],c),le=bo(u[G+2][0],u[G+2][1],c);N.push([q[0],q[1],U[0],U[1],le[0],le[1]])}return N}}var dp={randOffset:pp,randOffsetWithRange:hp,ellipse:up,doubleLineOps:mp};function Tr(e,t,n,o,i){return{type:"path",ops:Ht(e,t,n,o,i)}}function Po(e,t,n){let o=(e||[]).length;if(o>2){let i=[];for(let r=0;r<o-1;r++)i.push(...Ht(e[r][0],e[r][1],e[r+1][0],e[r+1][1],n));return t&&i.push(...Ht(e[o-1][0],e[o-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(o===2)return Tr(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function cp(e,t){return Po(e,!0,t)}function Ns(e,t,n,o,i){let r=[[e,t],[e+n,t],[e+n,t+o],[e,t+o]];return cp(r,i)}function Lr(e,t){let n=Os(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let o=Os(e,1.5*(1+t.roughness*.22),fp(t));n=n.concat(o)}return{type:"path",ops:n}}function up(e,t,n,o,i){let r=Cr(n,o,i);return mi(e,t,i,r).opset}function Cr(e,t,n){let o=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*o)),r=Math.PI*2/i,a=Math.abs(e/2),s=Math.abs(t/2),l=1-n.curveFitting;return a+=z(a*l,n),s+=z(s*l,n),{increment:r,rx:a,ry:s}}function mi(e,t,n,o){let[i,r]=Rs(o.increment,e,t,o.rx,o.ry,1,o.increment*pi(.1,pi(.4,1,n),n),n),a=hi(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=Rs(o.increment,e,t,o.rx,o.ry,1.5,0,n),l=hi(s,null,n);a=a.concat(l)}return{estimatedPoints:r,opset:{type:"path",ops:a}}}function Br(e,t,n,o,i,r,a,s,l){let d=e,c=t,u=Math.abs(n/2),h=Math.abs(o/2);u+=z(u*.01,l),h+=z(h*.01,l);let m=i,g=r;for(;m<0;)m+=Math.PI*2,g+=Math.PI*2;g-m>Math.PI*2&&(m=0,g=Math.PI*2);let f=Math.PI*2/l.curveStepCount,E=Math.min(f/2,(g-m)/2),x=Fs(E,d,c,u,h,m,g,1,l);if(!l.disableMultiStroke){let y=Fs(E,d,c,u,h,m,g,1.5,l);x.push(...y)}return a&&(s?x.push(...Ht(d,c,d+u*Math.cos(m),c+h*Math.sin(m),l),...Ht(d,c,d+u*Math.cos(g),c+h*Math.sin(g),l)):x.push({op:"lineTo",data:[d,c]},{op:"lineTo",data:[d+u*Math.cos(m),c+h*Math.sin(m)]})),{type:"path",ops:x}}function Dr(e,t){let n=Mo(wo(Qn(e))),o=[],i=[0,0],r=[0,0];for(let{key:a,data:s}of n)switch(a){case"M":{r=[s[0],s[1]],i=[s[0],s[1]];break}case"L":o.push(...Ht(r[0],r[1],s[0],s[1],t)),r=[s[0],s[1]];break;case"C":{let[l,d,c,u,h,m]=s;o.push(...gp(l,d,c,u,h,m,r,t)),r=[h,m];break}case"Z":o.push(...Ht(r[0],r[1],i[0],i[1],t)),r=[i[0],i[1]];break}return{type:"path",ops:o}}function fi(e,t){let n=[];for(let o of e)if(o.length){let i=t.maxRandomnessOffset||0,r=o.length;if(r>2){n.push({op:"move",data:[o[0][0]+z(i,t),o[0][1]+z(i,t)]});for(let a=1;a<r;a++)n.push({op:"lineTo",data:[o[a][0]+z(i,t),o[a][1]+z(i,t)]})}}return{type:"fillPath",ops:n}}function Rn(e,t){return Cs(t,dp).fillPolygons(e,t)}function Hs(e,t,n,o,i,r,a){let s=e,l=t,d=Math.abs(n/2),c=Math.abs(o/2);d+=z(d*.01,a),c+=z(c*.01,a);let u=i,h=r;for(;u<0;)u+=Math.PI*2,h+=Math.PI*2;h-u>Math.PI*2&&(u=0,h=Math.PI*2);let m=(h-u)/a.curveStepCount,g=[];for(let f=u;f<=h;f=f+m)g.push([s+d*Math.cos(f),l+c*Math.sin(f)]);return g.push([s+d*Math.cos(h),l+c*Math.sin(h)]),g.push([s,l]),Rn([g],a)}function pp(e,t){return z(e,t)}function hp(e,t,n){return pi(e,t,n)}function mp(e,t,n,o,i){return Ht(e,t,n,o,i,!0)}function fp(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function zs(e){return e.randomizer||(e.randomizer=new ci(e.seed||0)),e.randomizer.next()}function pi(e,t,n,o=1){return n.roughness*o*(zs(n)*(t-e)+e)}function z(e,t,n=1){return pi(-e,e,t,n)}function Ht(e,t,n,o,i,r=!1){let a=r?i.disableMultiStrokeFill:i.disableMultiStroke,s=Gs(e,t,n,o,i,!0,!1);if(a)return s;let l=Gs(e,t,n,o,i,!0,!0);return s.concat(l)}function Gs(e,t,n,o,i,r,a){let s=Math.pow(e-n,2)+Math.pow(t-o,2),l=Math.sqrt(s),d=1;l<200?d=1:l>500?d=.4:d=-.0016668*l+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>s&&(c=l/10);let u=c/2,h=.2+zs(i)*.2,m=i.bowing*i.maxRandomnessOffset*(o-t)/200,g=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=z(m,i,d),g=z(g,i,d);let f=[],E=()=>z(u,i,d),x=()=>z(c,i,d),y=i.preserveVertices;return r&&(a?f.push({op:"move",data:[e+(y?0:E()),t+(y?0:E())]}):f.push({op:"move",data:[e+(y?0:z(c,i,d)),t+(y?0:z(c,i,d))]})),a?f.push({op:"bcurveTo",data:[m+e+(n-e)*h+E(),g+t+(o-t)*h+E(),m+e+2*(n-e)*h+E(),g+t+2*(o-t)*h+E(),n+(y?0:E()),o+(y?0:E())]}):f.push({op:"bcurveTo",data:[m+e+(n-e)*h+x(),g+t+(o-t)*h+x(),m+e+2*(n-e)*h+x(),g+t+2*(o-t)*h+x(),n+(y?0:x()),o+(y?0:x())]}),f}function Os(e,t,n){let o=[];o.push([e[0][0]+z(t,n),e[0][1]+z(t,n)]),o.push([e[0][0]+z(t,n),e[0][1]+z(t,n)]);for(let i=1;i<e.length;i++)o.push([e[i][0]+z(t,n),e[i][1]+z(t,n)]),i===e.length-1&&o.push([e[i][0]+z(t,n),e[i][1]+z(t,n)]);return hi(o,null,n)}function hi(e,t,n){let o=e.length,i=[];if(o>3){let r=[],a=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<o;s++){let l=e[s];r[0]=[l[0],l[1]],r[1]=[l[0]+(a*e[s+1][0]-a*e[s-1][0])/6,l[1]+(a*e[s+1][1]-a*e[s-1][1])/6],r[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],r[3]=[e[s+1][0],e[s+1][1]],i.push({op:"bcurveTo",data:[r[1][0],r[1][1],r[2][0],r[2][1],r[3][0],r[3][1]]})}if(t&&t.length===2){let s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+z(s,n),t[1]+z(s,n)]})}}else o===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):o===2&&i.push(...Ht(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function Rs(e,t,n,o,i,r,a,s){let l=s.roughness===0,d=[],c=[];if(l){e=e/4,c.push([t+o*Math.cos(-e),n+i*Math.sin(-e)]);for(let u=0;u<=Math.PI*2;u=u+e){let h=[t+o*Math.cos(u),n+i*Math.sin(u)];d.push(h),c.push(h)}c.push([t+o*Math.cos(0),n+i*Math.sin(0)]),c.push([t+o*Math.cos(e),n+i*Math.sin(e)])}else{let u=z(.5,s)-Math.PI/2;c.push([z(r,s)+t+.9*o*Math.cos(u-e),z(r,s)+n+.9*i*Math.sin(u-e)]);let h=Math.PI*2+u-.01;for(let m=u;m<h;m=m+e){let g=[z(r,s)+t+o*Math.cos(m),z(r,s)+n+i*Math.sin(m)];d.push(g),c.push(g)}c.push([z(r,s)+t+o*Math.cos(u+Math.PI*2+a*.5),z(r,s)+n+i*Math.sin(u+Math.PI*2+a*.5)]),c.push([z(r,s)+t+.98*o*Math.cos(u+a),z(r,s)+n+.98*i*Math.sin(u+a)]),c.push([z(r,s)+t+.9*o*Math.cos(u+a*.5),z(r,s)+n+.9*i*Math.sin(u+a*.5)])}return[c,d]}function Fs(e,t,n,o,i,r,a,s,l){let d=r+z(.1,l),c=[];c.push([z(s,l)+t+.9*o*Math.cos(d-e),z(s,l)+n+.9*i*Math.sin(d-e)]);for(let u=d;u<=a;u=u+e)c.push([z(s,l)+t+o*Math.cos(u),z(s,l)+n+i*Math.sin(u)]);return c.push([t+o*Math.cos(a),n+i*Math.sin(a)]),c.push([t+o*Math.cos(a),n+i*Math.sin(a)]),hi(c,null,l)}function gp(e,t,n,o,i,r,a,s){let l=[],d=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],c=[0,0],u=s.disableMultiStroke?1:2,h=s.preserveVertices;for(let m=0;m<u;m++)m===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(h?0:z(d[0],s)),a[1]+(h?0:z(d[0],s))]}),c=h?[i,r]:[i+z(d[m],s),r+z(d[m],s)],l.push({op:"bcurveTo",data:[e+z(d[m],s),t+z(d[m],s),n+z(d[m],s),o+z(d[m],s),c[0],c[1]]});return l}I();function Io(e){return[...e]}function Ws(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let o=[];if(n===3)o.push(Io(e[0]),Io(e[1]),Io(e[2]),Io(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let r=[],a=1-t;o.push(Io(i[0]));for(let s=1;s+2<i.length;s++){let l=i[s];r[0]=[l[0],l[1]],r[1]=[l[0]+(a*i[s+1][0]-a*i[s-1][0])/6,l[1]+(a*i[s+1][1]-a*i[s-1][1])/6],r[2]=[i[s+1][0]+(a*i[s][0]-a*i[s+2][0])/6,i[s+1][1]+(a*i[s][1]-a*i[s+2][1])/6],r[3]=[i[s+1][0],i[s+1][1]],o.push(r[1],r[2],r[3])}}return o}I();function Ep(e,t){return Math.sqrt(gi(e,t))}function gi(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function xp(e,t,n){let o=gi(t,n);if(o===0)return gi(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/o;return i=Math.max(0,Math.min(1,i)),gi(e,Fn(t,n,i))}function Fn(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function yp(e,t){let n=e[t+0],o=e[t+1],i=e[t+2],r=e[t+3],a=3*o[0]-2*n[0]-r[0];a*=a;let s=3*o[1]-2*n[1]-r[1];s*=s;let l=3*i[0]-2*r[0]-n[0];l*=l;let d=3*i[1]-2*r[1]-n[1];return d*=d,a<l&&(a=l),s<d&&(s=d),a+s}function Gr(e,t,n,o){let i=o||[];if(yp(e,t)<n){let r=e[t+0];i.length?Ep(i[i.length-1],r)>1&&i.push(r):i.push(r),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],l=e[t+2],d=e[t+3],c=Fn(a,s,.5),u=Fn(s,l,.5),h=Fn(l,d,.5),m=Fn(c,u,.5),g=Fn(u,h,.5),f=Fn(m,g,.5);Gr([a,c,m,f],0,n,i),Gr([f,g,h,d],0,n,i)}return i}function So(e,t){return Ei(e,0,e.length,t)}function Ei(e,t,n,o,i){let r=i||[],a=e[t],s=e[n-1],l=0,d=1;for(let c=t+1;c<n-1;++c){let u=xp(e[c],a,s);u>l&&(l=u,d=c)}return Math.sqrt(l)>o?(Ei(e,t,d+1,o,r),Ei(e,d,n,o,r)):(r.length||r.push(a),r.push(s)),r}function zt(e,t=.15,n){let o=[],i=(e.length-1)/3;for(let r=0;r<i;r++){let a=r*3;Gr(e,a,t,o)}return n&&n>0?Ei(o,0,o.length,n):o}I();function _s(e,t,n){let o=Qn(e),i=Mo(wo(o)),r=[],a=[],s=[0,0],l=[],d=()=>{l.length>=4&&a.push(...zt(l,t)),l=[]},c=()=>{d(),a.length&&(r.push(a),a=[])};for(let{key:h,data:m}of i)switch(h){case"M":c(),s=[m[0],m[1]],a.push(s);break;case"L":d(),a.push([m[0],m[1]]);break;case"C":if(!l.length){let g=a.length?a[a.length-1]:s;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":d(),a.push([s[0],s[1]]);break}if(c(),!n)return r;let u=[];for(let h of r){let m=So(h,n);m.length&&u.push(m)}return u}var tt="none",lt=class{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 Bs()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,o){return{shape:t,sets:n||[],options:o||this.defaultOptions}}line(t,n,o,i,r){let a=this._o(r);return this._d("line",[Tr(t,n,o,i,a)],a)}rectangle(t,n,o,i,r){let a=this._o(r),s=[],l=Ns(t,n,o,i,a);if(a.fill){let d=[[t,n],[t+o,n],[t+o,n+i],[t,n+i]];a.fillStyle==="solid"?s.push(fi([d],a)):s.push(Rn([d],a))}return a.stroke!==tt&&s.push(l),this._d("rectangle",s,a)}ellipse(t,n,o,i,r){let a=this._o(r),s=[],l=Cr(o,i,a),d=mi(t,n,a,l);if(a.fill)if(a.fillStyle==="solid"){let c=mi(t,n,a,l).opset;c.type="fillPath",s.push(c)}else s.push(Rn([d.estimatedPoints],a));return a.stroke!==tt&&s.push(d.opset),this._d("ellipse",s,a)}circle(t,n,o,i){let r=this.ellipse(t,n,o,o,i);return r.shape="circle",r}linearPath(t,n){let o=this._o(n);return this._d("linearPath",[Po(t,!1,o)],o)}arc(t,n,o,i,r,a,s=!1,l){let d=this._o(l),c=[],u=Br(t,n,o,i,r,a,s,!0,d);if(s&&d.fill)if(d.fillStyle==="solid"){let h=Object.assign({},d);h.disableMultiStroke=!0;let m=Br(t,n,o,i,r,a,!0,!1,h);m.type="fillPath",c.push(m)}else c.push(Hs(t,n,o,i,r,a,d));return d.stroke!==tt&&c.push(u),this._d("arc",c,d)}curve(t,n){let o=this._o(n),i=[],r=Lr(t,o);if(o.fill&&o.fill!==tt&&t.length>=3)if(o.fillStyle==="solid"){let a=Lr(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=Ws(t),s=zt(a,10,(1+o.roughness)/2);i.push(Rn([s],o))}return o.stroke!==tt&&i.push(r),this._d("curve",i,o)}polygon(t,n){let o=this._o(n),i=[],r=Po(t,!0,o);return o.fill&&(o.fillStyle==="solid"?i.push(fi([t],o)):i.push(Rn([t],o))),o.stroke!==tt&&i.push(r),this._d("polygon",i,o)}path(t,n){let o=this._o(n),i=[];if(!t)return this._d("path",i,o);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let r=o.fill&&o.fill!=="transparent"&&o.fill!==tt,a=o.stroke!==tt,s=!!(o.simplification&&o.simplification<1),l=s?4-4*(o.simplification||1):(1+o.roughness)/2,d=_s(t,1,l),c=Dr(t,o);if(r)if(o.fillStyle==="solid")if(d.length===1){let u=Dr(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(fi(d,o));else i.push(Rn(d,o));return a&&(s?d.forEach(u=>{i.push(Po(u,!1,o))}):i.push(c)),this._d("path",i,o)}opsToPath(t,n){let o="";for(let i of t.ops){let r=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):i.data;switch(i.op){case"move":o+=`M${r[0]} ${r[1]} `;break;case"bcurveTo":o+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `;break;case"lineTo":o+=`L${r[0]} ${r[1]} `;break}}return o.trim()}toPaths(t){let n=t.sets||[],o=t.options||this.defaultOptions,i=[];for(let r of n){let a=null;switch(r.type){case"path":a={d:this.opsToPath(r),stroke:o.stroke,strokeWidth:o.strokeWidth,fill:tt};break;case"fillPath":a={d:this.opsToPath(r),stroke:tt,strokeWidth:0,fill:o.fill||tt};break;case"fillSketch":a=this.fillSketch(r,o);break}a&&i.push(a)}return i}fillSketch(t,n){let o=n.fillWeight;return o<0&&(o=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||tt,strokeWidth:o,fill:tt}}_mergedShape(t){return t.filter((n,o)=>o===0?!0:n.op!=="move")}};var xi=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new lt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(let a of n)switch(a.type){case"path":i.save(),i.strokeStyle=o.stroke==="none"?"transparent":o.stroke,i.lineWidth=o.strokeWidth,o.strokeLineDash&&i.setLineDash(o.strokeLineDash),o.strokeLineDashOffset&&(i.lineDashOffset=o.strokeLineDashOffset),this._drawToContext(i,a,r),i.restore();break;case"fillPath":{i.save(),i.fillStyle=o.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,a,r,s),i.restore();break}case"fillSketch":this.fillSketch(i,a,o);break}}fillSketch(t,n,o){let i=o.fillWeight;i<0&&(i=o.strokeWidth/2),t.save(),o.fillLineDash&&t.setLineDash(o.fillLineDash),o.fillLineDashOffset&&(t.lineDashOffset=o.fillLineDashOffset),t.strokeStyle=o.fill||"",t.lineWidth=i,this._drawToContext(t,n,o.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,o,i="nonzero"){t.beginPath();for(let r of n.ops){let a=typeof o=="number"&&o>=0?r.data.map(s=>+s.toFixed(o)):r.data;switch(r.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,o,i,r){let a=this.gen.line(t,n,o,i,r);return this.draw(a),a}rectangle(t,n,o,i,r){let a=this.gen.rectangle(t,n,o,i,r);return this.draw(a),a}ellipse(t,n,o,i,r){let a=this.gen.ellipse(t,n,o,i,r);return this.draw(a),a}circle(t,n,o,i){let r=this.gen.circle(t,n,o,i);return this.draw(r),r}linearPath(t,n){let o=this.gen.linearPath(t,n);return this.draw(o),o}polygon(t,n){let o=this.gen.polygon(t,n);return this.draw(o),o}arc(t,n,o,i,r,a,s=!1,l){let d=this.gen.arc(t,n,o,i,r,a,s,l);return this.draw(d),d}curve(t,n){let o=this.gen.curve(t,n);return this.draw(o),o}path(t,n){let o=this.gen.path(t,n);return this.draw(o),o}};I();I();var vo="http://www.w3.org/2000/svg";var yi=class{constructor(t,n){this.svg=t,this.gen=new lt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,r=i.createElementNS(vo,"g"),a=t.options.fixedDecimalPlaceDigits;for(let s of n){let l=null;switch(s.type){case"path":{l=i.createElementNS(vo,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke",o.stroke),l.setAttribute("stroke-width",o.strokeWidth+""),l.setAttribute("fill","none"),o.strokeLineDash&&l.setAttribute("stroke-dasharray",o.strokeLineDash.join(" ").trim()),o.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${o.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(vo,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",o.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,s,o);break}}l&&r.appendChild(l)}return r}fillSketch(t,n,o){let i=o.fillWeight;i<0&&(i=o.strokeWidth/2);let r=t.createElementNS(vo,"path");return r.setAttribute("d",this.opsToPath(n,o.fixedDecimalPlaceDigits)),r.setAttribute("stroke",o.fill||""),r.setAttribute("stroke-width",i+""),r.setAttribute("fill","none"),o.fillLineDash&&r.setAttribute("stroke-dasharray",o.fillLineDash.join(" ").trim()),o.fillLineDashOffset&&r.setAttribute("stroke-dashoffset",`${o.fillLineDashOffset}`),r}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,o,i,r){let a=this.gen.line(t,n,o,i,r);return this.draw(a)}rectangle(t,n,o,i,r){let a=this.gen.rectangle(t,n,o,i,r);return this.draw(a)}ellipse(t,n,o,i,r){let a=this.gen.ellipse(t,n,o,i,r);return this.draw(a)}circle(t,n,o,i){let r=this.gen.circle(t,n,o,i);return this.draw(r)}linearPath(t,n){let o=this.gen.linearPath(t,n);return this.draw(o)}polygon(t,n){let o=this.gen.polygon(t,n);return this.draw(o)}arc(t,n,o,i,r,a,s=!1,l){let d=this.gen.arc(t,n,o,i,r,a,s,l);return this.draw(d)}curve(t,n){let o=this.gen.curve(t,n);return this.draw(o)}path(t,n){let o=this.gen.path(t,n);return this.draw(o)}};var Nn={canvas(e,t){return new xi(e,t)},svg(e,t){return new yi(e,t)},generator(e){return new lt(e)},newSeed(){return lt.newSeed()}};import{arrayToMap as Va,invariant as _a,rescalePoints as rc,sizeOf as jm}from"@excalidraw/common";import{degreesToRadians as Wa,lineSegment as fe,pointDistance as Vm,pointFrom as B,pointFromArray as cc,pointRotateRads as ie}from"@excalidraw/math";I();import{invariant as wp}from"@excalidraw/common";import{curve as bp,lineSegment as Mp,pointFrom as he,pointDistance as T2,pointFromArray as Pp,pointFromVector as Ip,pointRotateRads as mt,polygon as js,polygonFromPoints as Or,PRECISION as L2,segmentsIntersectAt as C2,vector as Sp,vectorAdd as vp,vectorFromPoint as Ap,vectorScale as B2}from"@excalidraw/math";import{getElementAbsoluteCoords as G2}from"@excalidraw/element";var Vs=e=>{let{angle:t,width:n,height:o,x:i,y:r}=e,a=i+n/2,s=r+o/2,l=he(a,s),d;return e.type==="diamond"?d=js(mt(he(a,r),l,t),mt(he(i+n,s),l,t),mt(he(a,r+o),l,t),mt(he(i,s),l,t)):d=js(mt(he(i,r),l,t),mt(he(i+n,r),l,t),mt(he(i+n,r+o),l,t),mt(he(i,r+o),l,t)),{type:"polygon",data:d}};var Ys=e=>{let{width:t,height:n,angle:o,x:i,y:r}=e;return{type:"ellipse",data:{center:he(i+t/2,r+n/2),angle:o,halfWidth:t/2,halfHeight:n/2}}},Wt=e=>{if(!e)return[];for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},Us=(e,t=he(0,0),n,o)=>{let i=l=>mt(he(l[0]+t[0],l[1]+t[1]),o,n),r=Wt(e),a=[],s=he(0,0);for(let l of r){if(l.op==="move"){let d=Pp(l.data);wp(d!=null,"Ops data is not a point"),s=i(d)}if(l.op==="bcurveTo"){let d=i(he(l.data[0],l.data[1])),c=i(he(l.data[2],l.data[3])),u=i(he(l.data[4],l.data[5]));a.push(bp(s,d,c,u)),s=u}}return{type:"polycurve",data:a}},kp=e=>{let t=e[0],n=[];for(let o=1;o<e.length;o++){let i=e[o];n.push(Mp(t,i)),t=i}return n},Xs=(e,t,n=!1)=>{let o=r=>mt(Ip(vp(Ap(r),Sp(e.x,e.y))),t,e.angle),i=kp(e.points.map(r=>o(r)));return n?{type:"polygon",data:Or(i.flat())}:{type:"polyline",data:i}},$s=(e,t,n=he(0,0),o,i)=>{let r=c=>mt(he(c[0]+n[0],c[1]+n[1]),i,o);if(e.roundness===null)return{type:"polygon",data:Or(e.points.map(c=>r(c)))};let a=Wt(t),s=[],l=!1;for(let c of a)c.op==="move"?(l=!l,l&&s.push(he(c.data[0],c.data[1]))):c.op==="bcurveTo"?l&&(s.push(he(c.data[0],c.data[1])),s.push(he(c.data[2],c.data[3])),s.push(he(c.data[4],c.data[5]))):c.op==="lineTo"&&l&&s.push(he(c.data[0],c.data[1]));let d=zt(s,10,5).map(c=>r(c));return{type:"polygon",data:Or(d)}};I();I();function Zs(e,t,n,o=i=>i){return e*o(.5-t*(.5-n))}function Tp(e){return[-e[0],-e[1]]}function gt(e,t){return[e[0]+t[0],e[1]+t[1]]}function dt(e,t){return[e[0]-t[0],e[1]-t[1]]}function ft(e,t){return[e[0]*t,e[1]*t]}function Lp(e,t){return[e[0]/t,e[1]/t]}function Ao(e){return[e[1],-e[0]]}function qs(e,t){return e[0]*t[0]+e[1]*t[1]}function Cp(e,t){return e[0]===t[0]&&e[1]===t[1]}function Bp(e){return Math.hypot(e[0],e[1])}function Dp(e){return e[0]*e[0]+e[1]*e[1]}function Ks(e,t){return Dp(dt(e,t))}function el(e){return Lp(e,Bp(e))}function Gp(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ko(e,t,n){let o=Math.sin(n),i=Math.cos(n),r=e[0]-t[0],a=e[1]-t[1],s=r*i-a*o,l=r*o+a*i;return[s+t[0],l+t[1]]}function Rr(e,t,n){return gt(e,ft(dt(t,e),n))}function Qs(e,t,n){return gt(e,ft(t,n))}var{min:Jn,PI:Op}=Math,Js=.275,To=Op+1e-4;function Rp(e,t={}){let{size:n=16,smoothing:o=.5,thinning:i=.5,simulatePressure:r=!0,easing:a=H=>H,start:s={},end:l={},last:d=!1}=t,{cap:c=!0,easing:u=H=>H*(2-H)}=s,{cap:h=!0,easing:m=H=>--H*H*H+1}=l;if(e.length===0||n<=0)return[];let g=e[e.length-1].runningLength,f=s.taper===!1?0:s.taper===!0?Math.max(n,g):s.taper,E=l.taper===!1?0:l.taper===!0?Math.max(n,g):l.taper,x=Math.pow(n*o,2),y=[],w=[],M=e.slice(0,10).reduce((H,A)=>{let _=A.pressure;if(r){let X=Jn(1,A.distance/n),ve=Jn(1,1-X);_=Jn(1,H+(ve-H)*(X*Js))}return(H+_)/2},e[0].pressure),b=Zs(n,i,e[e.length-1].pressure,a),S,v=e[0].vector,k=e[0].point,T=k,R=k,O=T,N=!1;for(let H=0;H<e.length;H++){let{pressure:A}=e[H],{point:_,vector:X,distance:ve,runningLength:At}=e[H];if(H<e.length-1&&g-At<3)continue;if(i){if(r){let et=Jn(1,ve/n),st=Jn(1,1-et);A=Jn(1,M+(st-M)*(et*Js))}b=Zs(n,i,A,a)}else b=n/2;S===void 0&&(S=b);let ei=At<f?u(At/f):1,Sr=g-At<E?m((g-At)/E):1;b=Math.max(.01,b*Math.min(ei,Sr));let ti=(H<e.length-1?e[H+1]:e[H]).vector,xo=H<e.length-1?qs(X,ti):1,vr=qs(X,v)<0&&!N,ni=xo!==null&&xo<0;if(vr||ni){let et=ft(Ao(v),b);for(let st=1/13,sn=0;sn<=1;sn+=st)R=ko(dt(_,et),_,To*sn),y.push(R),O=ko(gt(_,et),_,To*-sn),w.push(O);k=R,T=O,ni&&(N=!0);continue}if(N=!1,H===e.length-1){let et=ft(Ao(X),b);y.push(dt(_,et)),w.push(gt(_,et));continue}let oi=ft(Ao(Rr(ti,X,xo)),b);R=dt(_,oi),(H<=1||Ks(k,R)>x)&&(y.push(R),k=R),O=gt(_,oi),(H<=1||Ks(T,O)>x)&&(w.push(O),T=O),M=A,v=X}let G=e[0].point.slice(0,2),q=e.length>1?e[e.length-1].point.slice(0,2):gt(e[0].point,[1,1]),U=[],le=[];if(e.length===1){if(!(f||E)||d){let H=Qs(G,el(Ao(dt(G,q))),-(S||b)),A=[];for(let _=1/13,X=_;X<=1;X+=_)A.push(ko(H,G,To*2*X));return A}}else{if(!(f||E&&e.length===1))if(c)for(let A=1/13,_=A;_<=1;_+=A){let X=ko(w[0],G,To*_);U.push(X)}else{let A=dt(y[0],w[0]),_=ft(A,.5),X=ft(A,.51);U.push(dt(G,_),dt(G,X),gt(G,X),gt(G,_))}let H=Ao(Tp(e[e.length-1].vector));if(E||f&&e.length===1)le.push(q);else if(h){let A=Qs(q,H,b);for(let _=1/29,X=_;X<1;X+=_)le.push(ko(A,q,To*3*X))}else le.push(gt(q,ft(H,b)),gt(q,ft(H,b*.99)),dt(q,ft(H,b*.99)),dt(q,ft(H,b)))}return y.concat(le,w.reverse(),U)}function Fp(e,t={}){var n;let{streamline:o=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let a=.15+(1-o)*.85,s=Array.isArray(e[0])?e:e.map(({x:m,y:g,pressure:f=.5})=>[m,g,f]);if(s.length===2){let m=s[1];s=s.slice(0,-1);for(let g=1;g<5;g++)s.push(Rr(s[0],m,g/4))}s.length===1&&(s=[...s,[...gt(s[0],[1,1]),...s[0].slice(2)]]);let l=[{point:[s[0][0],s[0][1]],pressure:s[0][2]>=0?s[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,c=0,u=l[0],h=s.length-1;for(let m=1;m<s.length;m++){let g=r&&m===h?s[m].slice(0,2):Rr(u.point,s[m],a);if(Cp(u.point,g))continue;let f=Gp(g,u.point);if(c+=f,m<h&&!d){if(c<i)continue;d=!0}u={point:g,pressure:s[m][2]>=0?s[m][2]:.5,vector:el(dt(u.point,g)),distance:f,runningLength:c},l.push(u)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function tl(e,t={}){return Rp(Fp(e,t),t)}import{pointFrom as me,pointDistance as Jd,pointRotateRads as nn}from"@excalidraw/math";import{ROUGHNESS as Bm,THEME as za,isTransparent as qo,assertNever as Dm,COLOR_PALETTE as Gm,LINE_POLYGON_POINT_MERGE_DISTANCE as Om,applyDarkModeFilter as Ko}from"@excalidraw/common";I();import{isRightAngleRads as ym,lineSegment as $d,pointFrom as Ji,pointRotateRads as Ra}from"@excalidraw/math";import{BOUND_TEXT_PADDING as er,DEFAULT_REDUCED_GLOBAL_ALPHA as wm,ELEMENT_READY_TO_ERASE_OPACITY as bm,FRAME_STYLE as tr,DARK_THEME_FILTER as Mm,MIME_TYPES as Na,THEME as lo,distance as kn,getFontString as Pm,isRTL as Im,getVerticalOffset as Sm,invariant as vm,applyDarkModeFilter as or,isSafari as Am}from"@excalidraw/common";I();import{pointFrom as _t,pointCenter as Np,pointRotateRads as cn,vectorFromPoint as Fr,vectorNormalize as nl,vectorSubtract as ol,vectorAdd as wi,vectorScale as bi,pointFromVector as il,clamp as Le,isCloseTo as rl}from"@excalidraw/math";var Ce=10,W2=(e,t,n,o,i,r,a,s)=>{let{width:l,height:d}=Nr(e),c=o/l,u=i/d,h=(e.crop?.x??0)/c,m=(e.crop?.y??0)/u,g=cn(_t(r,a),de(e,t),-e.angle);r=g[0],a=g[1];let f=e.width,E=e.height,x=e.crop??{x:0,y:0,width:o,height:i,naturalWidth:o,naturalHeight:i},y=x.height,w=x.width,M=e.scale[0]===-1,b=e.scale[1]===-1,S=a-e.y,v=r-e.x;n.includes("n")&&(E=Le(e.height-S,Ce,b?d-m:e.height+m)),n.includes("s")&&(S=a-e.y-e.height,E=Le(e.height+S,Ce,b?e.height+m:d-m)),n.includes("e")&&(v=r-e.x-e.width,f=Le(e.width+v,Ce,M?e.width+h:l-h)),n.includes("w")&&(f=Le(e.width-v,Ce,M?l-h:e.width+h));let k=O=>{O.height=E*u,O.width=f*c};k(x);let T=(O,N)=>{k(N),O.includes("n")&&(b||(N.y+=y-N.height)),O.includes("s")&&b&&(N.y+=y-N.height),O.includes("e")&&M&&(N.x+=w-N.width),O.includes("w")&&(M||(N.x+=w-N.width))};switch(n){case"n":{if(s){let O=h+e.width/2,N=l-h-e.width/2,G=Math.min(O,N)*2;f=Le(E*s,Ce,G),E=f/s}T(n,x),s&&(x.x+=(w-x.width)/2);break}case"s":{if(s){let O=h+e.width/2,N=l-h-e.width/2,G=Math.min(O,N)*2;f=Le(E*s,Ce,G),E=f/s}T(n,x),s&&(x.x+=(w-x.width)/2);break}case"w":{if(s){let O=m+e.height/2,N=d-m-e.height/2,G=Math.min(O,N)*2;E=Le(f/s,Ce,G),f=E*s}T(n,x),s&&(x.y+=(y-x.height)/2);break}case"e":{if(s){let O=m+e.height/2,N=d-m-e.height/2,G=Math.min(O,N)*2;E=Le(f/s,Ce,G),f=E*s}T(n,x),s&&(x.y+=(y-x.height)/2);break}case"ne":{if(s)if(v>-S){let O=b?d-m:m+e.height;E=Le(f/s,Ce,O),f=E*s}else{let O=M?h+e.width:l-h;f=Le(E*s,Ce,O),E=f/s}T(n,x);break}case"nw":{if(s)if(v<S){let O=b?d-m:m+e.height;E=Le(f/s,Ce,O),f=E*s}else{let O=M?l-h:h+e.width;f=Le(E*s,Ce,O),E=f/s}T(n,x);break}case"se":{if(s)if(v>S){let O=b?m+e.height:d-m;E=Le(f/s,Ce,O),f=E*s}else{let O=M?h+e.width:l-h;f=Le(E*s,Ce,O),E=f/s}T(n,x);break}case"sw":{if(s)if(-v>S){let O=b?m+e.height:d-m;E=Le(f/s,Ce,O),f=E*s}else{let O=M?l-h:h+e.width;f=Le(E*s,Ce,O),E=f/s}T(n,x);break}default:break}let R=Hp(e,n,f,E,!!s);return rl(x.width,x.naturalWidth)&&rl(x.height,x.naturalHeight)&&(x=null),{x:R[0],y:R[1],width:f,height:E,crop:x}},Hp=(e,t,n,o,i)=>{let[r,a,s,l]=un(e,e.width,e.height,!0),d=_t(r,a),c=_t(s,l),u=Np(d,c),[h,m,g,f]=un(e,n,o,!0),E=g-h,x=f-m,y=[...d];if(["n","w","nw"].includes(t)&&(y=[c[0]-Math.abs(E),c[1]-Math.abs(x)]),t==="ne"){let k=[d[0],c[1]];y=[k[0],k[1]-Math.abs(x)]}if(t==="sw"){let k=[c[0],d[1]];y=[k[0]-Math.abs(E),k[1]]}i&&(["s","n"].includes(t)&&(y[0]=u[0]-E/2),["e","w"].includes(t)&&(y[1]=u[1]-x/2));let w=e.angle,M=cn(y,u,w),b=[y[0]+Math.abs(E)/2,y[1]+Math.abs(x)/2],S=cn(b,u,w);y=cn(M,S,-w);let v=[...y];return v[0]+=e.x-h,v[1]+=e.y-m,v},al=(e,t)=>{if(e.crop){let{width:n,height:o}=Nr(e),[i,r,a,s,l,d]=K(e,t),c=Fr(cn(_t(i,r),_t(l,d),e.angle)),u=Fr(cn(_t(a,r),_t(l,d),e.angle)),h=nl(ol(u,c)),m=Fr(cn(_t(i,s),_t(l,d),e.angle)),g=ol(m,c),f=nl(g),{cropX:E,cropY:x}=zp(e.crop,e.scale),y=wi(wi(c,bi(h,-E*n/e.crop.naturalWidth)),bi(f,-x*o/e.crop.naturalHeight)),w=il(wi(wi(y,bi(h,n/2)),bi(f,o/2))),M=cn(il(y),w,-e.angle);return{...e,x:M[0],y:M[1],width:n,height:o,crop:null}}return e},Nr=e=>{if(e.crop){let t=e.width/(e.crop.width/e.crop.naturalWidth),n=e.height/(e.crop.height/e.crop.naturalHeight);return{width:t,height:n}}return{width:e.width,height:e.height}},zp=(e,t)=>{let n=e.x,o=e.y,i=t[0]===-1,r=t[1]===-1;return i&&(n=e.naturalWidth-Math.abs(n)-e.width),r&&(o=e.naturalHeight-Math.abs(o)-e.height),{cropX:n,cropY:o}},_2=(e,t=!1)=>{let n=e.crop;if(!n)return null;let o=e.scale[0]===-1,i=e.scale[1]===-1,r=n.x,a=n.y;if(o&&(r=n.naturalWidth-n.width-n.x),i&&(a=n.naturalHeight-n.height-n.y),t)return{x:r,y:a};let{width:s,height:l}=Nr(e);return{x:r/(n.naturalWidth/s),y:a/(n.naturalHeight/l)}};I();import{pointCenter as Wd,pointFrom as F,pointRotateRads as _e,pointsEqual as _d,pointDistance as Xn,vectorFromPoint as hm,curveLength as mm,curvePointAtLength as fm}from"@excalidraw/math";import{DRAGGING_THRESHOLD as gm,KEYS as Un,shouldRotateWithDiscreteAngle as Uo,getGridPoint as jd,invariant as Ke,isShallowEqual as Em,getFeatureFlag as so}from"@excalidraw/common";I();import{arrayToMap as ld,getFeatureFlag as xh,invariant as wt,isTransparent as yh}from"@excalidraw/common";import{PRECISION as jo,clamp as wa,lineSegment as Ui,pointDistance as bn,pointDistanceSq as tn,pointFrom as se,pointFromVector as Vi,pointRotateRads as pe,pointsEqual as wh,vectorFromPoint as Wo,vectorNormalize as ya,vectorScale as Yi}from"@excalidraw/math";I();import{invariant as Fl,isTransparent as Nl}from"@excalidraw/common";import{curveIntersectLineSegment as Hl,isPointWithinBounds as oa,lineSegment as Fo,lineSegmentIntersectionPoints as zl,pointFrom as Pe,pointFromVector as N1,pointRotateRads as it,pointsEqual as Wl,vectorFromPoint as H1,vectorNormalize as z1,vectorScale as W1}from"@excalidraw/math";import{ellipse as _1,ellipseSegmentInterceptPoints as j1}from"@excalidraw/math/ellipse";I();import{DEFAULT_ADAPTIVE_RADIUS as $p,DEFAULT_PROPORTIONAL_RADIUS as zr,invariant as Zp,LINE_CONFIRM_THRESHOLD as qp,ROUNDNESS as Wr}from"@excalidraw/common";import{bezierEquation as Kp,curve as Vt,curveCatmullRomCubicApproxPoints as El,curveOffsetPoints as xl,lineSegment as Ie,lineSegmentIntersectionPoints as fl,pointDistance as zn,pointFrom as W,pointFromArray as Qp,pointFromVector as Jp,pointRotateRads as nt,pointTranslate as gl,rectangle as e1,vectorFromPoint as yl,vectorNormalize as t1,vectorScale as _r}from"@excalidraw/math";I();import{ROUNDNESS as Lo,assertNever as Wp}from"@excalidraw/common";import{pointsEqual as sl}from"@excalidraw/math";var Hn=e=>!!e&&e.type==="image"&&!!e.fileId,Ae=e=>!!e&&e.type==="image",ll=e=>!!e&&e.type==="embeddable",Mi=e=>!!e&&e.type==="iframe",Pi=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),te=e=>e!=null&&e.type==="text",Ii=e=>e!=null&&e.type==="frame",dl=e=>e!=null&&e.type==="magicframe",ee=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Se=e=>e!=null&&_p(e.type),_p=e=>e==="freedraw",ne=e=>e!=null&&Yp(e.type),jt=e=>e!=null&&e.type==="line",j=e=>e!=null&&e.type==="arrow",Y=e=>j(e)&&e.elbowed,X2=e=>j(e)&&!e.elbowed,jp=e=>j(e)&&!e.elbowed&&!e.roundness,Vp=e=>j(e)&&!e.elbowed&&e.roundness!==null,Yp=e=>e==="arrow"||e==="line",Be=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&Up(e.type),Up=e=>e==="arrow",Ee=(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),cl=e=>e!=null&&(e.type==="rectangle"||e.type==="diamond"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Co=e=>e!=null&&(e.type==="rectangle"||e.type==="image"||e.type==="text"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="freedraw"),Xp=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||j(e)),ul=e=>{let t=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 Wp(t,null),!1}},Hr=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",Tt=e=>Xp(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),xe=e=>e!==null&&"containerId"in e&&e.containerId!==null&&te(e),$2=e=>!!e.startBinding||!!e.endBinding,pl=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",hl=e=>e==="line"||e==="arrow"||e==="diamond",Z2=(e,t)=>!!((e===Lo.ADAPTIVE_RADIUS||e===Lo.LEGACY)&&pl(t.type)||e===Lo.PROPORTIONAL_RADIUS&&hl(t.type)),q2=e=>hl(e.type)?{type:Lo.PROPORTIONAL_RADIUS}:pl(e.type)?{type:Lo.ADAPTIVE_RADIUS}:null,K2=e=>jp(e)?"sharpArrow":Vp(e)?"curvedArrow":Y(e)?"elbowArrow":"line",Q2=e=>e.length>3&&sl(e[0],e[e.length-1]),ml=e=>e.length>3||e.length===3&&!sl(e[0],e[e.length-1]),J2=e=>{switch(e){case"rectangle":case"diamond":case"ellipse":case"arrow":case"line":case"freedraw":case"text":case"image":case"frame":case"embeddable":return!0;default:return!1}};var Bo=new WeakMap,jr=(e,t)=>{let n=Bo.get(e);if(!n)return;let{version:o,shapes:i}=n;if(o!==e.version){Bo.delete(e);return}return i.get(t)},Vr=(e,t,n)=>{let o=Bo.get(e);if(!o){Bo.set(e,{version:e.version,shapes:new Map([[n,t]])});return}let{version:i,shapes:r}=o;if(i!==e.version){Bo.set(e,{version:e.version,shapes:new Map([[n,t]])});return}r.set(n,t)};function Wn(e,t){let n=jr(e,0);if(n)return n;let o=bl(e,t),i=[],r=[];for(let s=0;s<o.length;s+=1){let l=o[s],d=o[s-1]&&Qp(o[s-1].data.slice(-2));switch(l.op){case"move":continue;case"lineTo":if(!d)throw new Error("prevPoint is undefined");i.push(Ie(W(e.x+d[0],e.y+d[1]),W(e.x+l.data[0],e.y+l.data[1])));continue;case"bcurveTo":if(!d)throw new Error("prevPoint is undefined");r.push(Vt(W(e.x+d[0],e.y+d[1]),W(e.x+l.data[0],e.y+l.data[1]),W(e.x+l.data[2],e.y+l.data[3]),W(e.x+l.data[4],e.y+l.data[5])));continue;default:console.error("Unknown op type",l.op)}}let a=[i,r];return Vr(e,a,0),a}function pn(e,t=0){let n=jr(e,t);if(n)return n;let o=Yt(Math.min(e.width,e.height),e);o===0&&(o=.01);let i=e1(W(e.x,e.y),W(e.x+e.width,e.y+e.height)),r=Ie(W(i[0][0]+o,i[0][1]),W(i[1][0]-o,i[0][1])),a=Ie(W(i[1][0],i[0][1]+o),W(i[1][0],i[1][1]-o)),s=Ie(W(i[0][0]+o,i[1][1]),W(i[1][0]-o,i[1][1])),l=Ie(W(i[0][0],i[1][1]-o),W(i[0][0],i[0][1]+o)),d=[Vt(l[1],W(l[1][0]+2/3*(i[0][0]-l[1][0]),l[1][1]+2/3*(i[0][1]-l[1][1])),W(r[0][0]+2/3*(i[0][0]-r[0][0]),r[0][1]+2/3*(i[0][1]-r[0][1])),r[0]),Vt(r[1],W(r[1][0]+2/3*(i[1][0]-r[1][0]),r[1][1]+2/3*(i[0][1]-r[1][1])),W(a[0][0]+2/3*(i[1][0]-a[0][0]),a[0][1]+2/3*(i[0][1]-a[0][1])),a[0]),Vt(a[1],W(a[1][0]+2/3*(i[1][0]-a[1][0]),a[1][1]+2/3*(i[1][1]-a[1][1])),W(s[1][0]+2/3*(i[1][0]-s[1][0]),s[1][1]+2/3*(i[1][1]-s[1][1])),s[1]),Vt(s[0],W(s[0][0]+2/3*(i[0][0]-s[0][0]),s[0][1]+2/3*(i[1][1]-s[0][1])),W(l[0][0]+2/3*(i[0][0]-l[0][0]),l[0][1]+2/3*(i[1][1]-l[0][1])),l[0])],c=t>0?d.map(m=>El(xl(m,t))):[[d[0]],[d[1]],[d[2]],[d[3]]],h=[[Ie(c[0][c[0].length-1][3],c[1][0][0]),Ie(c[1][c[1].length-1][3],c[2][0][0]),Ie(c[2][c[2].length-1][3],c[3][0][0]),Ie(c[3][c[3].length-1][3],c[0][0][0])],c.flat()];return Vr(e,h,t),h}function wl(e,t=0){let[n,o,i,r,a,s,l,d]=to(e),c=e.roundness?Yt(Math.abs(n-l),e):(n-l)*.01,u=e.roundness?Yt(Math.abs(r-o),e):(r-o)*.01,[h,m,g,f]=[W(e.x+n,e.y+o),W(e.x+i,e.y+r),W(e.x+a,e.y+s),W(e.x+l,e.y+d)];return[Vt(W(m[0]-c,m[1]-u),m,m,W(m[0]-c,m[1]+u)),Vt(W(g[0]+c,g[1]-u),g,g,W(g[0]-c,g[1]-u)),Vt(W(f[0]+c,f[1]+u),f,f,W(f[0]+c,f[1]-u)),Vt(W(h[0]-c,h[1]+u),h,h,W(h[0]+c,h[1]+u))]}function hn(e,t=0){let n=jr(e,t);if(n)return n;let i=wl(e,t).map(s=>El(xl(s,t))),a=[[Ie(i[0][i[0].length-1][3],i[1][0][0]),Ie(i[1][i[1].length-1][3],i[2][0][0]),Ie(i[2][i[2].length-1][3],i[3][0][0]),Ie(i[3][i[3].length-1][3],i[0][0][0])],i.flat()];return Vr(e,a,t),a}var Ut=(e,t=1)=>{if(e.length>=3){let[n,o]=[e[0],e[e.length-1]];return zn(n,o)<=qp/t}return!1},Yt=(e,t)=>{if(t.roundness?.type===Wr.PROPORTIONAL_RADIUS||t.roundness?.type===Wr.LEGACY)return e*zr;if(t.roundness?.type===Wr.ADAPTIVE_RADIUS){let n=t.roundness?.value??$p,o=n/zr;return e<=o?e*zr:n}return 0},n1=(e,t)=>{let n=e.type==="rectangle"?15:0,o=s=>{let l=t1(yl(s[1],s[0])),d=_r(l,n);return Ie(gl(s[0],d),gl(s[1],_r(d,-1)))},i=de(e,t),r=o(Co(e)?Ie(nt(W(e.x,e.y),i,e.angle),nt(W(e.x+e.width,e.y+e.height),i,e.angle)):Ie(nt(W(e.x+e.width/2,e.y),i,e.angle),nt(W(e.x+e.width/2,e.y+e.height),i,e.angle))),a=o(Co(e)?Ie(nt(W(e.x+e.width,e.y),i,e.angle),nt(W(e.x,e.y+e.height),i,e.angle)):Ie(nt(W(e.x,e.y+e.height/2),i,e.angle),nt(W(e.x+e.width,e.y+e.height/2),i,e.angle)));return[r,a]},Si=(e,t,n,o)=>{let i=de(t,n);return(t.type==="diamond"?wl(t).map(s=>{let l=Kp(s,.5),d=nt(l,i,t.angle);return W(d[0],d[1])}):[nt(W(t.x+t.width,t.y+t.height/2),i,t.angle),nt(W(t.x+t.width/2,t.y+t.height),i,t.angle),nt(W(t.x,t.y+t.height/2),i,t.angle),nt(W(t.x+t.width/2,t.y),i,t.angle)]).find(s=>zn(e,s)<=Et(o)+t.strokeWidth/2&&!Lt({point:e,element:t,threshold:0,elementsMap:n,overrideShouldTestInside:!0}))},eo=(e,t,n,o,i,r,a=!0)=>{if(Zp(e.points.length>=2,"Arrow must have at least two points"),e.width<3&&e.height<3)return null;if(a){let x=Si(t,n,i,r);if(x)return x}let[s,l]=n1(n,i),d=D.getPointAtIndexGlobalCoordinates(e,o==="start"?1:e.points.length-2,i);if(e.points.length===2){let x=o==="start"?e.endBinding:e.startBinding,y=x&&i.get(x.elementId),w=x&&y&&Ue(mn(x.fixedPoint),y,i);w&&(d=w)}let c=Jp(_r(yl(t,d),2*zn(d,t)+Math.max(zn(s[0],s[1]),zn(l[0],l[1]))),d),u=Ie(c,d),h=fl(s,u),m=fl(l,u),g=h&&zn(d,h),f=m&&zn(d,m),E=null;return g!=null&&f!=null?E=g<f?h:m:E=h||m||null,E&&Xt(E,n,i)?E:null};I();import{ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO as S1,ARROW_LABEL_WIDTH_FRACTION as v1,BOUND_TEXT_PADDING as Ct,DEFAULT_FONT_SIZE as A1,TEXT_ALIGN as kl,VERTICAL_ALIGN as Tl,getFontString as Ci,isProdEnv as k1,invariant as T1}from"@excalidraw/common";import{pointFrom as Ll,pointRotateRads as L1}from"@excalidraw/math";I();var Do={},Ml=(e,t)=>{let n=Do[e]||(Do[e]={height:t});return n.height=t,n},Pl=e=>{Do[e]&&delete Do[e]},hx=e=>Do[e]?.height??null;I();import{BOUND_TEXT_PADDING as Ai,DEFAULT_FONT_SIZE as o1,DEFAULT_FONT_FAMILY as i1,getFontString as r1,isTestEnv as a1,normalizeEOL as s1}from"@excalidraw/common";var ot=(e,t,n)=>{let o=e.split(`
1
+ var bp=Object.create;var Ws=Object.defineProperty;var Mp=Object.getOwnPropertyDescriptor;var Pp=Object.getOwnPropertyNames;var Ip=Object.getPrototypeOf,Sp=Object.prototype.hasOwnProperty;var vp=(e,t)=>()=>(e&&(t=e(e=0)),t);var Do=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ap=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pp(t))!Sp.call(e,i)&&i!==n&&Ws(e,i,{get:()=>t[i],enumerable:!(o=Mp(t,i))||o.enumerable});return e};var gi=(e,t,n)=>(n=e!=null?bp(Ip(e)):{},Ap(t||!e||!e.__esModule?Ws(n,"default",{value:e,enumerable:!0}):n,e));var D,I=vp(()=>{D={PROD:!0}});var nu=Do((O4,tu)=>{I();var eu="Expected a function",Qc=NaN,bf="[object Symbol]",Mf=/^\s+|\s+$/g,Pf=/^[-+]0x[0-9a-f]+$/i,If=/^0b[01]+$/i,Sf=/^0o[0-7]+$/i,vf=parseInt,Af=typeof global=="object"&&global&&global.Object===Object&&global,kf=typeof self=="object"&&self&&self.Object===Object&&self,Tf=Af||kf||Function("return this")(),Lf=Object.prototype,Cf=Lf.toString,Df=Math.max,Bf=Math.min,hs=function(){return Tf.Date.now()};function Gf(e,t,n){var o,i,r,a,s,l,d=0,c=!1,p=!1,h=!0;if(typeof e!="function")throw new TypeError(eu);t=Jc(t)||0,yr(n)&&(c=!!n.leading,p="maxWait"in n,r=p?Df(Jc(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h);function m(S){var v=o,k=i;return o=i=void 0,d=S,a=e.apply(k,v),a}function g(S){return d=S,s=setTimeout(x,t),c?m(S):a}function f(S){var v=S-l,k=S-d,A=t-v;return p?Bf(A,r-k):A}function E(S){var v=S-l,k=S-d;return l===void 0||v>=t||v<0||p&&k>=r}function x(){var S=hs();if(E(S))return y(S);s=setTimeout(x,f(S))}function y(S){return s=void 0,h&&o?m(S):(o=i=void 0,a)}function w(){s!==void 0&&clearTimeout(s),d=0,o=l=i=s=void 0}function M(){return s===void 0?a:y(hs())}function b(){var S=hs(),v=E(S);if(o=arguments,i=this,l=S,v){if(s===void 0)return g(l);if(p)return s=setTimeout(x,t),m(l)}return s===void 0&&(s=setTimeout(x,t)),a}return b.cancel=w,b.flush=M,b}function Of(e,t,n){var o=!0,i=!0;if(typeof e!="function")throw new TypeError(eu);return yr(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Gf(e,t,{leading:o,maxWait:t,trailing:i})}function yr(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Rf(e){return!!e&&typeof e=="object"}function Ff(e){return typeof e=="symbol"||Rf(e)&&Cf.call(e)==bf}function Jc(e){if(typeof e=="number")return e;if(Ff(e))return Qc;if(yr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=yr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Mf,"");var n=If.test(e);return n||Sf.test(e)?vf(e.slice(2),n?2:8):Pf.test(e)?Qc:+e}tu.exports=Of});var Ju=Do(ne=>{"use strict";I();var Bs=Symbol.for("react.transitional.element"),qg=Symbol.for("react.portal"),Kg=Symbol.for("react.fragment"),Qg=Symbol.for("react.strict_mode"),Jg=Symbol.for("react.profiler"),e2=Symbol.for("react.consumer"),t2=Symbol.for("react.context"),n2=Symbol.for("react.forward_ref"),o2=Symbol.for("react.suspense"),i2=Symbol.for("react.memo"),Xu=Symbol.for("react.lazy"),Wu=Symbol.iterator;function r2(e){return e===null||typeof e!="object"?null:(e=Wu&&e[Wu]||e["@@iterator"],typeof e=="function"?e:null)}var $u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zu=Object.assign,qu={};function Co(e,t,n){this.props=e,this.context=t,this.refs=qu,this.updater=n||$u}Co.prototype.isReactComponent={};Co.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Co.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ku(){}Ku.prototype=Co.prototype;function Gs(e,t,n){this.props=e,this.context=t,this.refs=qu,this.updater=n||$u}var Os=Gs.prototype=new Ku;Os.constructor=Gs;Zu(Os,Co.prototype);Os.isPureReactComponent=!0;var ju=Array.isArray,Se={H:null,A:null,T:null,S:null},Qu=Object.prototype.hasOwnProperty;function Rs(e,t,n,o,i,r){return n=r.ref,{$$typeof:Bs,type:e,key:t,ref:n!==void 0?n:null,props:r}}function a2(e,t){return Rs(e.type,t,void 0,void 0,void 0,e.props)}function Fs(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bs}function s2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Vu=/\/+/g;function Ds(e,t){return typeof e=="object"&&e!==null&&e.key!=null?s2(""+e.key):t.toString(36)}function Uu(){}function l2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Uu,Uu):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Lo(e,t,n,o,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(r){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Bs:case qg:a=!0;break;case Xu:return a=e._init,Lo(a(e._payload),t,n,o,i)}}if(a)return i=i(e),a=o===""?"."+Ds(e,0):o,ju(i)?(n="",a!=null&&(n=a.replace(Vu,"$&/")+"/"),Lo(i,t,n,"",function(d){return d})):i!=null&&(Fs(i)&&(i=a2(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(Vu,"$&/")+"/")+a)),t.push(i)),1;a=0;var s=o===""?".":o+":";if(ju(e))for(var l=0;l<e.length;l++)o=e[l],r=s+Ds(o,l),a+=Lo(o,t,n,r,i);else if(l=r2(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,r=s+Ds(o,l++),a+=Lo(o,t,n,r,i);else if(r==="object"){if(typeof e.then=="function")return Lo(l2(e),t,n,o,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Cr(e,t,n){if(e==null)return e;var o=[],i=0;return Lo(e,o,"","",function(r){return t.call(n,r,i++)}),o}function d2(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Yu=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function c2(){}ne.Children={map:Cr,forEach:function(e,t,n){Cr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Cr(e,function(){t++}),t},toArray:function(e){return Cr(e,function(t){return t})||[]},only:function(e){if(!Fs(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ne.Component=Co;ne.Fragment=Kg;ne.Profiler=Jg;ne.PureComponent=Gs;ne.StrictMode=Qg;ne.Suspense=o2;ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Se;ne.act=function(){throw Error("act(...) is not supported in production builds of React.")};ne.cache=function(e){return function(){return e.apply(null,arguments)}};ne.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Zu({},e.props),i=e.key,r=void 0;if(t!=null)for(a in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(i=""+t.key),t)!Qu.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(o[a]=t[a]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];o.children=s}return Rs(e.type,i,void 0,void 0,r,o)};ne.createContext=function(e){return e={$$typeof:t2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:e2,_context:e},e};ne.createElement=function(e,t,n){var o,i={},r=null;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)Qu.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(i[o]=t[o]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];i.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)i[o]===void 0&&(i[o]=a[o]);return Rs(e,r,void 0,void 0,null,i)};ne.createRef=function(){return{current:null}};ne.forwardRef=function(e){return{$$typeof:n2,render:e}};ne.isValidElement=Fs;ne.lazy=function(e){return{$$typeof:Xu,_payload:{_status:-1,_result:e},_init:d2}};ne.memo=function(e,t){return{$$typeof:i2,type:e,compare:t===void 0?null:t}};ne.startTransition=function(e){var t=Se.T,n={};Se.T=n;try{var o=e(),i=Se.S;i!==null&&i(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(c2,Yu)}catch(r){Yu(r)}finally{Se.T=t}};ne.unstable_useCacheRefresh=function(){return Se.H.useCacheRefresh()};ne.use=function(e){return Se.H.use(e)};ne.useActionState=function(e,t,n){return Se.H.useActionState(e,t,n)};ne.useCallback=function(e,t){return Se.H.useCallback(e,t)};ne.useContext=function(e){return Se.H.useContext(e)};ne.useDebugValue=function(){};ne.useDeferredValue=function(e,t){return Se.H.useDeferredValue(e,t)};ne.useEffect=function(e,t){return Se.H.useEffect(e,t)};ne.useId=function(){return Se.H.useId()};ne.useImperativeHandle=function(e,t,n){return Se.H.useImperativeHandle(e,t,n)};ne.useInsertionEffect=function(e,t){return Se.H.useInsertionEffect(e,t)};ne.useLayoutEffect=function(e,t){return Se.H.useLayoutEffect(e,t)};ne.useMemo=function(e,t){return Se.H.useMemo(e,t)};ne.useOptimistic=function(e,t){return Se.H.useOptimistic(e,t)};ne.useReducer=function(e,t,n){return Se.H.useReducer(e,t,n)};ne.useRef=function(e){return Se.H.useRef(e)};ne.useState=function(e){return Se.H.useState(e)};ne.useSyncExternalStore=function(e,t,n){return Se.H.useSyncExternalStore(e,t,n)};ne.useTransition=function(){return Se.H.useTransition()};ne.version="19.0.0"});var tp=Do((bP,ep)=>{"use strict";I();ep.exports=Ju()});var op=Do(Dr=>{"use strict";I();var u2=Symbol.for("react.transitional.element"),p2=Symbol.for("react.fragment");function np(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:u2,type:e,key:o,ref:t!==void 0?t:null,props:n}}Dr.Fragment=p2;Dr.jsx=np;Dr.jsxs=np});var Ns=Do((SP,ip)=>{"use strict";I();ip.exports=op()});I();import{toIterable as k2}from"@excalidraw/common";I();import{SHIFT_LOCKING_ANGLE as fn,viewportCoordsToSceneCoords as gr}from"@excalidraw/common";import{normalizeRadians as Rc,radiansBetweenAngles as z0,radiansDifference as _0}from"@excalidraw/math";import{pointsEqual as W0}from"@excalidraw/math";I();I();I();I();I();I();I();I();I();function Or(e,t,n){if(e&&e.length){let[o,i]=t,r=Math.PI/180*n,a=Math.cos(r),s=Math.sin(r);for(let l of e){let[d,c]=l;l[0]=(d-o)*a-(c-i)*s+o,l[1]=(d-o)*s+(c-i)*a+i}}}function Tp(e,t,n){let o=[];e.forEach(i=>o.push(...i)),Or(o,t,n)}function Lp(e,t){return e[0]===t[0]&&e[1]===t[1]}function js(e,t,n,o=1){let i=n,r=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let d of a)Or(d,s,i);let l=Cp(a,r,o);if(i){for(let d of a)Or(d,s,-i);Tp(l,s,-i)}return l}function Cp(e,t,n){let o=[];for(let d of e){let c=[...d];Lp(c[0],c[c.length-1])||c.push([c[0][0],c[0][1]]),c.length>2&&o.push(c)}let i=[];t=Math.max(t,.1);let r=[];for(let d of o)for(let c=0;c<d.length-1;c++){let p=d[c],h=d[c+1];if(p[1]!==h[1]){let m=Math.min(p[1],h[1]);r.push({ymin:m,ymax:Math.max(p[1],h[1]),x:m===p[1]?p[0]:h[0],islope:(h[0]-p[0])/(h[1]-p[1])})}}if(r.sort((d,c)=>d.ymin<c.ymin?-1:d.ymin>c.ymin?1:d.x<c.x?-1:d.x>c.x?1:d.ymax===c.ymax?0:(d.ymax-c.ymax)/Math.abs(d.ymax-c.ymax)),!r.length)return i;let a=[],s=r[0].ymin,l=0;for(;a.length||r.length;){if(r.length){let d=-1;for(let p=0;p<r.length&&!(r[p].ymin>s);p++)d=p;r.splice(0,d+1).forEach(p=>{a.push({s,edge:p})})}if(a=a.filter(d=>!(d.edge.ymax<=s)),a.sort((d,c)=>d.edge.x===c.edge.x?0:(d.edge.x-c.edge.x)/Math.abs(d.edge.x-c.edge.x)),(n!==1||l%t===0)&&a.length>1)for(let d=0;d<a.length;d=d+2){let c=d+1;if(c>=a.length)break;let p=a[d].edge,h=a[c].edge;i.push([[Math.round(p.x),s],[Math.round(h.x),s]])}s+=n,a.forEach(d=>{d.edge.x=d.edge.x+n*d.edge.islope}),l++}return i}function Ht(e,t){var n;let o=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.max(i,.1);let r=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(r=i),js(e,i,o,r||1)}var xn=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let o=Ht(t,n);return{type:"fillSketch",ops:this.renderLines(o,n)}}renderLines(t,n){let o=[];for(let i of t)o.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return o}};I();I();function yn(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var Ei=class extends xn{fillPolygons(t,n){let o=n.hachureGap;o<0&&(o=n.strokeWidth*4),o=Math.max(o,.1);let i=Object.assign({},n,{hachureGap:o}),r=Ht(t,i),a=Math.PI/180*n.hachureAngle,s=[],l=o*.5*Math.cos(a),d=o*.5*Math.sin(a);for(let[p,h]of r)yn([p,h])&&s.push([[p[0]-l,p[1]+d],[...h]],[[p[0]+l,p[1]-d],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};I();var xi=class extends xn{fillPolygons(t,n){let o=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),r=this._fillPolygons(t,i);return o.ops=o.ops.concat(r.ops),o}};I();var yi=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let o=Ht(t,n);return this.dotsOnLines(o,n)}dotsOnLines(t,n){let o=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);let a=i/4;for(let s of t){let l=yn(s),d=l/i,c=Math.ceil(d)-1,p=l-c*i,h=(s[0][0]+s[1][0])/2-i/4,m=Math.min(s[0][1],s[1][1]);for(let g=0;g<c;g++){let f=m+p+g*i,E=h-a+Math.random()*2*a,x=f-a+Math.random()*2*a,y=this.helper.ellipse(E,x,r,r,n);o.push(...y.ops)}}return{type:"fillSketch",ops:o}}};I();var wi=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=Ht(t,n);return{type:"fillSketch",ops:this.dashedLine(o,n)}}dashedLine(t,n){let o=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,r=[];return t.forEach(a=>{let s=yn(a),l=Math.floor(s/(o+i)),d=(s+i-l*(o+i))/2,c=a[0],p=a[1];c[0]>p[0]&&(c=a[1],p=a[0]);let h=Math.atan((p[1]-c[1])/(p[0]-c[0]));for(let m=0;m<l;m++){let g=m*(o+i),f=g+o,E=[c[0]+g*Math.cos(h)+d*Math.cos(h),c[1]+g*Math.sin(h)+d*Math.sin(h)],x=[c[0]+f*Math.cos(h)+d*Math.cos(h),c[1]+f*Math.sin(h)+d*Math.sin(h)];r.push(...this.helper.doubleLineOps(E[0],E[1],x[0],x[1],n))}}),r}};I();var bi=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?o:n.zigzagOffset;n=Object.assign({},n,{hachureGap:o+i});let r=Ht(t,n);return{type:"fillSketch",ops:this.zigzagLines(r,i,n)}}zigzagLines(t,n,o){let i=[];return t.forEach(r=>{let a=yn(r),s=Math.round(a/(2*n)),l=r[0],d=r[1];l[0]>d[0]&&(l=r[1],d=r[0]);let c=Math.atan((d[1]-l[1])/(d[0]-l[0]));for(let p=0;p<s;p++){let h=p*2*n,m=(p+1)*2*n,g=Math.sqrt(2*Math.pow(n,2)),f=[l[0]+h*Math.cos(c),l[1]+h*Math.sin(c)],E=[l[0]+m*Math.cos(c),l[1]+m*Math.sin(c)],x=[f[0]+g*Math.cos(c+Math.PI/4),f[1]+g*Math.sin(c+Math.PI/4)];i.push(...this.helper.doubleLineOps(f[0],f[1],x[0],x[1],o),...this.helper.doubleLineOps(x[0],x[1],E[0],E[1],o))}}),i}};var at={};function Vs(e,t){let n=e.fillStyle||"hachure";if(!at[n])switch(n){case"zigzag":at[n]||(at[n]=new Ei(t));break;case"cross-hatch":at[n]||(at[n]=new xi(t));break;case"dots":at[n]||(at[n]=new yi(t));break;case"dashed":at[n]||(at[n]=new wi(t));break;case"zigzag-line":at[n]||(at[n]=new bi(t));break;case"hachure":default:n="hachure",at[n]||(at[n]=new xn(t));break}return at[n]}I();function Us(){return Math.floor(Math.random()*2**31)}var Mi=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};I();I();var Pi={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Dp(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function Rr(e,t){return e.type===t}function uo(e){let t=[],n=Dp(e),o="BOD",i=0,r=n[i];for(;!Rr(r,2);){let a=0,s=[];if(o==="BOD")if(r.text==="M"||r.text==="m")i++,a=Pi[r.text],o=r.text;else return uo("M0,0"+e);else Rr(r,1)?a=Pi[o]:(i++,a=Pi[r.text],o=r.text);if(i+a<n.length){for(let l=i;l<i+a;l++){let d=n[l];if(Rr(d,1))s[s.length]=+d.text;else throw new Error("Param not a number: "+o+","+d.text)}if(typeof Pi[o]=="number"){let l={key:o,data:s};t.push(l),i+=a,r=n[i],o==="M"&&(o="L"),o==="m"&&(o="l")}else throw new Error("Bad segment: "+o)}else throw new Error("Path data ended short")}return t}I();function Bo(e){let t=0,n=0,o=0,i=0,r=[];for(let{key:a,data:s}of e)switch(a){case"M":r.push({key:"M",data:[...s]}),[t,n]=s,[o,i]=s;break;case"m":t+=s[0],n+=s[1],r.push({key:"M",data:[t,n]}),o=t,i=n;break;case"L":r.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],r.push({key:"L",data:[t,n]});break;case"C":r.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":r.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":r.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],r.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":r.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],r.push({key:"V",data:[n]});break;case"S":r.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let l=s.map((d,c)=>c%2?d+n:d+t);r.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":r.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],r.push({key:"T",data:[t,n]});break;case"Z":case"z":r.push({key:"Z",data:[]}),t=o,n=i;break}return r}I();function Oo(e){let t=[],n="",o=0,i=0,r=0,a=0,s=0,l=0;for(let{key:d,data:c}of e){switch(d){case"M":t.push({key:"M",data:[...c]}),[o,i]=c,[r,a]=c;break;case"C":t.push({key:"C",data:[...c]}),o=c[4],i=c[5],s=c[2],l=c[3];break;case"L":t.push({key:"L",data:[...c]}),[o,i]=c;break;case"H":o=c[0],t.push({key:"L",data:[o,i]});break;case"V":i=c[0],t.push({key:"L",data:[o,i]});break;case"S":{let p=0,h=0;n==="C"||n==="S"?(p=o+(o-s),h=i+(i-l)):(p=o,h=i),t.push({key:"C",data:[p,h,...c]}),s=c[0],l=c[1],o=c[2],i=c[3];break}case"T":{let[p,h]=c,m=0,g=0;n==="Q"||n==="T"?(m=o+(o-s),g=i+(i-l)):(m=o,g=i);let f=o+2*(m-o)/3,E=i+2*(g-i)/3,x=p+2*(m-p)/3,y=h+2*(g-h)/3;t.push({key:"C",data:[f,E,x,y,p,h]}),s=m,l=g,o=p,i=h;break}case"Q":{let[p,h,m,g]=c,f=o+2*(p-o)/3,E=i+2*(h-i)/3,x=m+2*(p-m)/3,y=g+2*(h-g)/3;t.push({key:"C",data:[f,E,x,y,m,g]}),s=p,l=h,o=m,i=g;break}case"A":{let p=Math.abs(c[0]),h=Math.abs(c[1]),m=c[2],g=c[3],f=c[4],E=c[5],x=c[6];p===0||h===0?(t.push({key:"C",data:[o,i,E,x,E,x]}),o=E,i=x):(o!==E||i!==x)&&(Ys(o,i,E,x,p,h,m,g,f).forEach(function(w){t.push({key:"C",data:w})}),o=E,i=x);break}case"Z":t.push({key:"Z",data:[]}),o=r,i=a;break}n=d}return t}function Bp(e){return Math.PI*e/180}function Go(e,t,n){let o=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[o,i]}function Ys(e,t,n,o,i,r,a,s,l,d){let c=Bp(a),p=[],h=0,m=0,g=0,f=0;if(d)[h,m,g,f]=d;else{[e,t]=Go(e,t,-c),[n,o]=Go(n,o,-c);let R=(e-n)/2,C=(t-o)/2,j=R*R/(i*i)+C*C/(r*r);j>1&&(j=Math.sqrt(j),i=j*i,r=j*r);let W=s===l?-1:1,q=i*i,N=r*r,T=q*N-q*C*C-N*R*R,z=q*C*C+N*R*R,_=W*Math.sqrt(Math.abs(T/z));g=_*i*C/r+(e+n)/2,f=_*-r*R/i+(t+o)/2,h=Math.asin(parseFloat(((t-f)/r).toFixed(9))),m=Math.asin(parseFloat(((o-f)/r).toFixed(9))),e<g&&(h=Math.PI-h),n<g&&(m=Math.PI-m),h<0&&(h=Math.PI*2+h),m<0&&(m=Math.PI*2+m),l&&h>m&&(h=h-Math.PI*2),!l&&m>h&&(m=m-Math.PI*2)}let E=m-h;if(Math.abs(E)>Math.PI*120/180){let R=m,C=n,j=o;l&&m>h?m=h+Math.PI*120/180*1:m=h+Math.PI*120/180*-1,n=g+i*Math.cos(m),o=f+r*Math.sin(m),p=Ys(n,o,C,j,i,r,a,0,l,[m,R,g,f])}E=m-h;let x=Math.cos(h),y=Math.sin(h),w=Math.cos(m),M=Math.sin(m),b=Math.tan(E/4),S=4/3*i*b,v=4/3*r*b,k=[e,t],A=[e+S*y,t-v*x],O=[n+S*M,o-v*w],G=[n,o];if(A[0]=2*k[0]-A[0],A[1]=2*k[1]-A[1],d)return[A,O,G].concat(p);{p=[A,O,G].concat(p);let R=[];for(let C=0;C<p.length;C+=3){let j=Go(p[C][0],p[C][1],c),W=Go(p[C+1][0],p[C+1][1],c),q=Go(p[C+2][0],p[C+2][1],c);R.push([j[0],j[1],W[0],W[1],q[0],q[1]])}return R}}var Gp={randOffset:Fp,randOffsetWithRange:Np,ellipse:Rp,doubleLineOps:Hp};function Fr(e,t,n,o,i){return{type:"path",ops:Zt(e,t,n,o,i)}}function Ro(e,t,n){let o=(e||[]).length;if(o>2){let i=[];for(let r=0;r<o-1;r++)i.push(...Zt(e[r][0],e[r][1],e[r+1][0],e[r+1][1],n));return t&&i.push(...Zt(e[o-1][0],e[o-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(o===2)return Fr(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function Op(e,t){return Ro(e,!0,t)}function Ks(e,t,n,o,i){let r=[[e,t],[e+n,t],[e+n,t+o],[e,t+o]];return Op(r,i)}function Nr(e,t){let n=$s(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let o=$s(e,1.5*(1+t.roughness*.22),zp(t));n=n.concat(o)}return{type:"path",ops:n}}function Rp(e,t,n,o,i){let r=Hr(n,o,i);return vi(e,t,i,r).opset}function Hr(e,t,n){let o=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*o)),r=Math.PI*2/i,a=Math.abs(e/2),s=Math.abs(t/2),l=1-n.curveFitting;return a+=V(a*l,n),s+=V(s*l,n),{increment:r,rx:a,ry:s}}function vi(e,t,n,o){let[i,r]=Zs(o.increment,e,t,o.rx,o.ry,1,o.increment*Ii(.1,Ii(.4,1,n),n),n),a=Si(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=Zs(o.increment,e,t,o.rx,o.ry,1.5,0,n),l=Si(s,null,n);a=a.concat(l)}return{estimatedPoints:r,opset:{type:"path",ops:a}}}function zr(e,t,n,o,i,r,a,s,l){let d=e,c=t,p=Math.abs(n/2),h=Math.abs(o/2);p+=V(p*.01,l),h+=V(h*.01,l);let m=i,g=r;for(;m<0;)m+=Math.PI*2,g+=Math.PI*2;g-m>Math.PI*2&&(m=0,g=Math.PI*2);let f=Math.PI*2/l.curveStepCount,E=Math.min(f/2,(g-m)/2),x=qs(E,d,c,p,h,m,g,1,l);if(!l.disableMultiStroke){let y=qs(E,d,c,p,h,m,g,1.5,l);x.push(...y)}return a&&(s?x.push(...Zt(d,c,d+p*Math.cos(m),c+h*Math.sin(m),l),...Zt(d,c,d+p*Math.cos(g),c+h*Math.sin(g),l)):x.push({op:"lineTo",data:[d,c]},{op:"lineTo",data:[d+p*Math.cos(m),c+h*Math.sin(m)]})),{type:"path",ops:x}}function _r(e,t){let n=Oo(Bo(uo(e))),o=[],i=[0,0],r=[0,0];for(let{key:a,data:s}of n)switch(a){case"M":{r=[s[0],s[1]],i=[s[0],s[1]];break}case"L":o.push(...Zt(r[0],r[1],s[0],s[1],t)),r=[s[0],s[1]];break;case"C":{let[l,d,c,p,h,m]=s;o.push(..._p(l,d,c,p,h,m,r,t)),r=[h,m];break}case"Z":o.push(...Zt(r[0],r[1],i[0],i[1],t)),r=[i[0],i[1]];break}return{type:"path",ops:o}}function Ai(e,t){let n=[];for(let o of e)if(o.length){let i=t.maxRandomnessOffset||0,r=o.length;if(r>2){n.push({op:"move",data:[o[0][0]+V(i,t),o[0][1]+V(i,t)]});for(let a=1;a<r;a++)n.push({op:"lineTo",data:[o[a][0]+V(i,t),o[a][1]+V(i,t)]})}}return{type:"fillPath",ops:n}}function Xn(e,t){return Vs(t,Gp).fillPolygons(e,t)}function Qs(e,t,n,o,i,r,a){let s=e,l=t,d=Math.abs(n/2),c=Math.abs(o/2);d+=V(d*.01,a),c+=V(c*.01,a);let p=i,h=r;for(;p<0;)p+=Math.PI*2,h+=Math.PI*2;h-p>Math.PI*2&&(p=0,h=Math.PI*2);let m=(h-p)/a.curveStepCount,g=[];for(let f=p;f<=h;f=f+m)g.push([s+d*Math.cos(f),l+c*Math.sin(f)]);return g.push([s+d*Math.cos(h),l+c*Math.sin(h)]),g.push([s,l]),Xn([g],a)}function Fp(e,t){return V(e,t)}function Np(e,t,n){return Ii(e,t,n)}function Hp(e,t,n,o,i){return Zt(e,t,n,o,i,!0)}function zp(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function Js(e){return e.randomizer||(e.randomizer=new Mi(e.seed||0)),e.randomizer.next()}function Ii(e,t,n,o=1){return n.roughness*o*(Js(n)*(t-e)+e)}function V(e,t,n=1){return Ii(-e,e,t,n)}function Zt(e,t,n,o,i,r=!1){let a=r?i.disableMultiStrokeFill:i.disableMultiStroke,s=Xs(e,t,n,o,i,!0,!1);if(a)return s;let l=Xs(e,t,n,o,i,!0,!0);return s.concat(l)}function Xs(e,t,n,o,i,r,a){let s=Math.pow(e-n,2)+Math.pow(t-o,2),l=Math.sqrt(s),d=1;l<200?d=1:l>500?d=.4:d=-.0016668*l+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>s&&(c=l/10);let p=c/2,h=.2+Js(i)*.2,m=i.bowing*i.maxRandomnessOffset*(o-t)/200,g=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=V(m,i,d),g=V(g,i,d);let f=[],E=()=>V(p,i,d),x=()=>V(c,i,d),y=i.preserveVertices;return r&&(a?f.push({op:"move",data:[e+(y?0:E()),t+(y?0:E())]}):f.push({op:"move",data:[e+(y?0:V(c,i,d)),t+(y?0:V(c,i,d))]})),a?f.push({op:"bcurveTo",data:[m+e+(n-e)*h+E(),g+t+(o-t)*h+E(),m+e+2*(n-e)*h+E(),g+t+2*(o-t)*h+E(),n+(y?0:E()),o+(y?0:E())]}):f.push({op:"bcurveTo",data:[m+e+(n-e)*h+x(),g+t+(o-t)*h+x(),m+e+2*(n-e)*h+x(),g+t+2*(o-t)*h+x(),n+(y?0:x()),o+(y?0:x())]}),f}function $s(e,t,n){let o=[];o.push([e[0][0]+V(t,n),e[0][1]+V(t,n)]),o.push([e[0][0]+V(t,n),e[0][1]+V(t,n)]);for(let i=1;i<e.length;i++)o.push([e[i][0]+V(t,n),e[i][1]+V(t,n)]),i===e.length-1&&o.push([e[i][0]+V(t,n),e[i][1]+V(t,n)]);return Si(o,null,n)}function Si(e,t,n){let o=e.length,i=[];if(o>3){let r=[],a=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<o;s++){let l=e[s];r[0]=[l[0],l[1]],r[1]=[l[0]+(a*e[s+1][0]-a*e[s-1][0])/6,l[1]+(a*e[s+1][1]-a*e[s-1][1])/6],r[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],r[3]=[e[s+1][0],e[s+1][1]],i.push({op:"bcurveTo",data:[r[1][0],r[1][1],r[2][0],r[2][1],r[3][0],r[3][1]]})}if(t&&t.length===2){let s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+V(s,n),t[1]+V(s,n)]})}}else o===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):o===2&&i.push(...Zt(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function Zs(e,t,n,o,i,r,a,s){let l=s.roughness===0,d=[],c=[];if(l){e=e/4,c.push([t+o*Math.cos(-e),n+i*Math.sin(-e)]);for(let p=0;p<=Math.PI*2;p=p+e){let h=[t+o*Math.cos(p),n+i*Math.sin(p)];d.push(h),c.push(h)}c.push([t+o*Math.cos(0),n+i*Math.sin(0)]),c.push([t+o*Math.cos(e),n+i*Math.sin(e)])}else{let p=V(.5,s)-Math.PI/2;c.push([V(r,s)+t+.9*o*Math.cos(p-e),V(r,s)+n+.9*i*Math.sin(p-e)]);let h=Math.PI*2+p-.01;for(let m=p;m<h;m=m+e){let g=[V(r,s)+t+o*Math.cos(m),V(r,s)+n+i*Math.sin(m)];d.push(g),c.push(g)}c.push([V(r,s)+t+o*Math.cos(p+Math.PI*2+a*.5),V(r,s)+n+i*Math.sin(p+Math.PI*2+a*.5)]),c.push([V(r,s)+t+.98*o*Math.cos(p+a),V(r,s)+n+.98*i*Math.sin(p+a)]),c.push([V(r,s)+t+.9*o*Math.cos(p+a*.5),V(r,s)+n+.9*i*Math.sin(p+a*.5)])}return[c,d]}function qs(e,t,n,o,i,r,a,s,l){let d=r+V(.1,l),c=[];c.push([V(s,l)+t+.9*o*Math.cos(d-e),V(s,l)+n+.9*i*Math.sin(d-e)]);for(let p=d;p<=a;p=p+e)c.push([V(s,l)+t+o*Math.cos(p),V(s,l)+n+i*Math.sin(p)]);return c.push([t+o*Math.cos(a),n+i*Math.sin(a)]),c.push([t+o*Math.cos(a),n+i*Math.sin(a)]),Si(c,null,l)}function _p(e,t,n,o,i,r,a,s){let l=[],d=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],c=[0,0],p=s.disableMultiStroke?1:2,h=s.preserveVertices;for(let m=0;m<p;m++)m===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(h?0:V(d[0],s)),a[1]+(h?0:V(d[0],s))]}),c=h?[i,r]:[i+V(d[m],s),r+V(d[m],s)],l.push({op:"bcurveTo",data:[e+V(d[m],s),t+V(d[m],s),n+V(d[m],s),o+V(d[m],s),c[0],c[1]]});return l}I();function Fo(e){return[...e]}function el(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let o=[];if(n===3)o.push(Fo(e[0]),Fo(e[1]),Fo(e[2]),Fo(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let r=[],a=1-t;o.push(Fo(i[0]));for(let s=1;s+2<i.length;s++){let l=i[s];r[0]=[l[0],l[1]],r[1]=[l[0]+(a*i[s+1][0]-a*i[s-1][0])/6,l[1]+(a*i[s+1][1]-a*i[s-1][1])/6],r[2]=[i[s+1][0]+(a*i[s][0]-a*i[s+2][0])/6,i[s+1][1]+(a*i[s][1]-a*i[s+2][1])/6],r[3]=[i[s+1][0],i[s+1][1]],o.push(r[1],r[2],r[3])}}return o}I();function Wp(e,t){return Math.sqrt(ki(e,t))}function ki(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function jp(e,t,n){let o=ki(t,n);if(o===0)return ki(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/o;return i=Math.max(0,Math.min(1,i)),ki(e,$n(t,n,i))}function $n(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Vp(e,t){let n=e[t+0],o=e[t+1],i=e[t+2],r=e[t+3],a=3*o[0]-2*n[0]-r[0];a*=a;let s=3*o[1]-2*n[1]-r[1];s*=s;let l=3*i[0]-2*r[0]-n[0];l*=l;let d=3*i[1]-2*r[1]-n[1];return d*=d,a<l&&(a=l),s<d&&(s=d),a+s}function Wr(e,t,n,o){let i=o||[];if(Vp(e,t)<n){let r=e[t+0];i.length?Wp(i[i.length-1],r)>1&&i.push(r):i.push(r),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],l=e[t+2],d=e[t+3],c=$n(a,s,.5),p=$n(s,l,.5),h=$n(l,d,.5),m=$n(c,p,.5),g=$n(p,h,.5),f=$n(m,g,.5);Wr([a,c,m,f],0,n,i),Wr([f,g,h,d],0,n,i)}return i}function No(e,t){return Ti(e,0,e.length,t)}function Ti(e,t,n,o,i){let r=i||[],a=e[t],s=e[n-1],l=0,d=1;for(let c=t+1;c<n-1;++c){let p=jp(e[c],a,s);p>l&&(l=p,d=c)}return Math.sqrt(l)>o?(Ti(e,t,d+1,o,r),Ti(e,d,n,o,r)):(r.length||r.push(a),r.push(s)),r}function qt(e,t=.15,n){let o=[],i=(e.length-1)/3;for(let r=0;r<i;r++){let a=r*3;Wr(e,a,t,o)}return n&&n>0?Ti(o,0,o.length,n):o}I();function tl(e,t,n){let o=uo(e),i=Oo(Bo(o)),r=[],a=[],s=[0,0],l=[],d=()=>{l.length>=4&&a.push(...qt(l,t)),l=[]},c=()=>{d(),a.length&&(r.push(a),a=[])};for(let{key:h,data:m}of i)switch(h){case"M":c(),s=[m[0],m[1]],a.push(s);break;case"L":d(),a.push([m[0],m[1]]);break;case"C":if(!l.length){let g=a.length?a[a.length-1]:s;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":d(),a.push([s[0],s[1]]);break}if(c(),!n)return r;let p=[];for(let h of r){let m=No(h,n);m.length&&p.push(m)}return p}var ft="none",bt=class{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 Us()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,o){return{shape:t,sets:n||[],options:o||this.defaultOptions}}line(t,n,o,i,r){let a=this._o(r);return this._d("line",[Fr(t,n,o,i,a)],a)}rectangle(t,n,o,i,r){let a=this._o(r),s=[],l=Ks(t,n,o,i,a);if(a.fill){let d=[[t,n],[t+o,n],[t+o,n+i],[t,n+i]];a.fillStyle==="solid"?s.push(Ai([d],a)):s.push(Xn([d],a))}return a.stroke!==ft&&s.push(l),this._d("rectangle",s,a)}ellipse(t,n,o,i,r){let a=this._o(r),s=[],l=Hr(o,i,a),d=vi(t,n,a,l);if(a.fill)if(a.fillStyle==="solid"){let c=vi(t,n,a,l).opset;c.type="fillPath",s.push(c)}else s.push(Xn([d.estimatedPoints],a));return a.stroke!==ft&&s.push(d.opset),this._d("ellipse",s,a)}circle(t,n,o,i){let r=this.ellipse(t,n,o,o,i);return r.shape="circle",r}linearPath(t,n){let o=this._o(n);return this._d("linearPath",[Ro(t,!1,o)],o)}arc(t,n,o,i,r,a,s=!1,l){let d=this._o(l),c=[],p=zr(t,n,o,i,r,a,s,!0,d);if(s&&d.fill)if(d.fillStyle==="solid"){let h=Object.assign({},d);h.disableMultiStroke=!0;let m=zr(t,n,o,i,r,a,!0,!1,h);m.type="fillPath",c.push(m)}else c.push(Qs(t,n,o,i,r,a,d));return d.stroke!==ft&&c.push(p),this._d("arc",c,d)}curve(t,n){let o=this._o(n),i=[],r=Nr(t,o);if(o.fill&&o.fill!==ft&&t.length>=3)if(o.fillStyle==="solid"){let a=Nr(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=el(t),s=qt(a,10,(1+o.roughness)/2);i.push(Xn([s],o))}return o.stroke!==ft&&i.push(r),this._d("curve",i,o)}polygon(t,n){let o=this._o(n),i=[],r=Ro(t,!0,o);return o.fill&&(o.fillStyle==="solid"?i.push(Ai([t],o)):i.push(Xn([t],o))),o.stroke!==ft&&i.push(r),this._d("polygon",i,o)}path(t,n){let o=this._o(n),i=[];if(!t)return this._d("path",i,o);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let r=o.fill&&o.fill!=="transparent"&&o.fill!==ft,a=o.stroke!==ft,s=!!(o.simplification&&o.simplification<1),l=s?4-4*(o.simplification||1):(1+o.roughness)/2,d=tl(t,1,l),c=_r(t,o);if(r)if(o.fillStyle==="solid")if(d.length===1){let p=_r(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(p.ops)})}else i.push(Ai(d,o));else i.push(Xn(d,o));return a&&(s?d.forEach(p=>{i.push(Ro(p,!1,o))}):i.push(c)),this._d("path",i,o)}opsToPath(t,n){let o="";for(let i of t.ops){let r=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):i.data;switch(i.op){case"move":o+=`M${r[0]} ${r[1]} `;break;case"bcurveTo":o+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `;break;case"lineTo":o+=`L${r[0]} ${r[1]} `;break}}return o.trim()}toPaths(t){let n=t.sets||[],o=t.options||this.defaultOptions,i=[];for(let r of n){let a=null;switch(r.type){case"path":a={d:this.opsToPath(r),stroke:o.stroke,strokeWidth:o.strokeWidth,fill:ft};break;case"fillPath":a={d:this.opsToPath(r),stroke:ft,strokeWidth:0,fill:o.fill||ft};break;case"fillSketch":a=this.fillSketch(r,o);break}a&&i.push(a)}return i}fillSketch(t,n){let o=n.fillWeight;return o<0&&(o=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||ft,strokeWidth:o,fill:ft}}_mergedShape(t){return t.filter((n,o)=>o===0?!0:n.op!=="move")}};var Li=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new bt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(let a of n)switch(a.type){case"path":i.save(),i.strokeStyle=o.stroke==="none"?"transparent":o.stroke,i.lineWidth=o.strokeWidth,o.strokeLineDash&&i.setLineDash(o.strokeLineDash),o.strokeLineDashOffset&&(i.lineDashOffset=o.strokeLineDashOffset),this._drawToContext(i,a,r),i.restore();break;case"fillPath":{i.save(),i.fillStyle=o.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,a,r,s),i.restore();break}case"fillSketch":this.fillSketch(i,a,o);break}}fillSketch(t,n,o){let i=o.fillWeight;i<0&&(i=o.strokeWidth/2),t.save(),o.fillLineDash&&t.setLineDash(o.fillLineDash),o.fillLineDashOffset&&(t.lineDashOffset=o.fillLineDashOffset),t.strokeStyle=o.fill||"",t.lineWidth=i,this._drawToContext(t,n,o.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,o,i="nonzero"){t.beginPath();for(let r of n.ops){let a=typeof o=="number"&&o>=0?r.data.map(s=>+s.toFixed(o)):r.data;switch(r.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,o,i,r){let a=this.gen.line(t,n,o,i,r);return this.draw(a),a}rectangle(t,n,o,i,r){let a=this.gen.rectangle(t,n,o,i,r);return this.draw(a),a}ellipse(t,n,o,i,r){let a=this.gen.ellipse(t,n,o,i,r);return this.draw(a),a}circle(t,n,o,i){let r=this.gen.circle(t,n,o,i);return this.draw(r),r}linearPath(t,n){let o=this.gen.linearPath(t,n);return this.draw(o),o}polygon(t,n){let o=this.gen.polygon(t,n);return this.draw(o),o}arc(t,n,o,i,r,a,s=!1,l){let d=this.gen.arc(t,n,o,i,r,a,s,l);return this.draw(d),d}curve(t,n){let o=this.gen.curve(t,n);return this.draw(o),o}path(t,n){let o=this.gen.path(t,n);return this.draw(o),o}};I();I();var Ho="http://www.w3.org/2000/svg";var Ci=class{constructor(t,n){this.svg=t,this.gen=new bt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,r=i.createElementNS(Ho,"g"),a=t.options.fixedDecimalPlaceDigits;for(let s of n){let l=null;switch(s.type){case"path":{l=i.createElementNS(Ho,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke",o.stroke),l.setAttribute("stroke-width",o.strokeWidth+""),l.setAttribute("fill","none"),o.strokeLineDash&&l.setAttribute("stroke-dasharray",o.strokeLineDash.join(" ").trim()),o.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${o.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(Ho,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",o.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,s,o);break}}l&&r.appendChild(l)}return r}fillSketch(t,n,o){let i=o.fillWeight;i<0&&(i=o.strokeWidth/2);let r=t.createElementNS(Ho,"path");return r.setAttribute("d",this.opsToPath(n,o.fixedDecimalPlaceDigits)),r.setAttribute("stroke",o.fill||""),r.setAttribute("stroke-width",i+""),r.setAttribute("fill","none"),o.fillLineDash&&r.setAttribute("stroke-dasharray",o.fillLineDash.join(" ").trim()),o.fillLineDashOffset&&r.setAttribute("stroke-dashoffset",`${o.fillLineDashOffset}`),r}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,o,i,r){let a=this.gen.line(t,n,o,i,r);return this.draw(a)}rectangle(t,n,o,i,r){let a=this.gen.rectangle(t,n,o,i,r);return this.draw(a)}ellipse(t,n,o,i,r){let a=this.gen.ellipse(t,n,o,i,r);return this.draw(a)}circle(t,n,o,i){let r=this.gen.circle(t,n,o,i);return this.draw(r)}linearPath(t,n){let o=this.gen.linearPath(t,n);return this.draw(o)}polygon(t,n){let o=this.gen.polygon(t,n);return this.draw(o)}arc(t,n,o,i,r,a,s=!1,l){let d=this.gen.arc(t,n,o,i,r,a,s,l);return this.draw(d)}curve(t,n){let o=this.gen.curve(t,n);return this.draw(o)}path(t,n){let o=this.gen.path(t,n);return this.draw(o)}};var po={canvas(e,t){return new Li(e,t)},svg(e,t){return new Ci(e,t)},generator(e){return new bt(e)},newSeed(){return bt.newSeed()}};import{arrayToMap as os,invariant as ts,rescalePoints as Lc,sizeOf as k0}from"@excalidraw/common";import{degreesToRadians as es,lineSegment as Ie,pointDistance as T0,pointFrom as B,pointFromArray as Oc,pointRotateRads as le}from"@excalidraw/math";I();import{invariant as Up}from"@excalidraw/common";import{curve as Yp,lineSegment as Xp,pointFrom as be,pointDistance as px,pointFromArray as $p,pointFromVector as Zp,pointRotateRads as At,polygon as nl,polygonFromPoints as jr,PRECISION as hx,segmentsIntersectAt as mx,vector as qp,vectorAdd as Kp,vectorFromPoint as Qp,vectorScale as fx}from"@excalidraw/math";import{getElementAbsoluteCoords as Ex}from"@excalidraw/element";var ol=e=>{let{angle:t,width:n,height:o,x:i,y:r}=e,a=i+n/2,s=r+o/2,l=be(a,s),d;return e.type==="diamond"?d=nl(At(be(a,r),l,t),At(be(i+n,s),l,t),At(be(a,r+o),l,t),At(be(i,s),l,t)):d=nl(At(be(i,r),l,t),At(be(i+n,r),l,t),At(be(i+n,r+o),l,t),At(be(i,r+o),l,t)),{type:"polygon",data:d}};var il=e=>{let{width:t,height:n,angle:o,x:i,y:r}=e;return{type:"ellipse",data:{center:be(i+t/2,r+n/2),angle:o,halfWidth:t/2,halfHeight:n/2}}},Kt=e=>{if(!e)return[];for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},rl=(e,t=be(0,0),n,o)=>{let i=l=>At(be(l[0]+t[0],l[1]+t[1]),o,n),r=Kt(e),a=[],s=be(0,0);for(let l of r){if(l.op==="move"){let d=$p(l.data);Up(d!=null,"Ops data is not a point"),s=i(d)}if(l.op==="bcurveTo"){let d=i(be(l.data[0],l.data[1])),c=i(be(l.data[2],l.data[3])),p=i(be(l.data[4],l.data[5]));a.push(Yp(s,d,c,p)),s=p}}return{type:"polycurve",data:a}},Jp=e=>{let t=e[0],n=[];for(let o=1;o<e.length;o++){let i=e[o];n.push(Xp(t,i)),t=i}return n},al=(e,t,n=!1)=>{let o=r=>At(Zp(Kp(Qp(r),qp(e.x,e.y))),t,e.angle),i=Jp(e.points.map(r=>o(r)));return n?{type:"polygon",data:jr(i.flat())}:{type:"polyline",data:i}},sl=(e,t,n=be(0,0),o,i)=>{let r=c=>At(be(c[0]+n[0],c[1]+n[1]),i,o);if(e.roundness===null)return{type:"polygon",data:jr(e.points.map(c=>r(c)))};let a=Kt(t),s=[],l=!1;for(let c of a)c.op==="move"?(l=!l,l&&s.push(be(c.data[0],c.data[1]))):c.op==="bcurveTo"?l&&(s.push(be(c.data[0],c.data[1])),s.push(be(c.data[2],c.data[3])),s.push(be(c.data[4],c.data[5]))):c.op==="lineTo"&&l&&s.push(be(c.data[0],c.data[1]));let d=qt(s,10,5).map(c=>r(c));return{type:"polygon",data:jr(d)}};I();I();function ll(e,t,n,o=i=>i){return e*o(.5-t*(.5-n))}function e1(e){return[-e[0],-e[1]]}function Tt(e,t){return[e[0]+t[0],e[1]+t[1]]}function Mt(e,t){return[e[0]-t[0],e[1]-t[1]]}function kt(e,t){return[e[0]*t,e[1]*t]}function t1(e,t){return[e[0]/t,e[1]/t]}function zo(e){return[e[1],-e[0]]}function dl(e,t){return e[0]*t[0]+e[1]*t[1]}function n1(e,t){return e[0]===t[0]&&e[1]===t[1]}function o1(e){return Math.hypot(e[0],e[1])}function i1(e){return e[0]*e[0]+e[1]*e[1]}function cl(e,t){return i1(Mt(e,t))}function hl(e){return t1(e,o1(e))}function r1(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function _o(e,t,n){let o=Math.sin(n),i=Math.cos(n),r=e[0]-t[0],a=e[1]-t[1],s=r*i-a*o,l=r*o+a*i;return[s+t[0],l+t[1]]}function Vr(e,t,n){return Tt(e,kt(Mt(t,e),n))}function ul(e,t,n){return Tt(e,kt(t,n))}var{min:ho,PI:a1}=Math,pl=.275,Wo=a1+1e-4;function s1(e,t={}){let{size:n=16,smoothing:o=.5,thinning:i=.5,simulatePressure:r=!0,easing:a=N=>N,start:s={},end:l={},last:d=!1}=t,{cap:c=!0,easing:p=N=>N*(2-N)}=s,{cap:h=!0,easing:m=N=>--N*N*N+1}=l;if(e.length===0||n<=0)return[];let g=e[e.length-1].runningLength,f=s.taper===!1?0:s.taper===!0?Math.max(n,g):s.taper,E=l.taper===!1?0:l.taper===!0?Math.max(n,g):l.taper,x=Math.pow(n*o,2),y=[],w=[],M=e.slice(0,10).reduce((N,T)=>{let z=T.pressure;if(r){let _=ho(1,T.distance/n),he=ho(1,1-_);z=ho(1,N+(he-N)*(_*pl))}return(N+z)/2},e[0].pressure),b=ll(n,i,e[e.length-1].pressure,a),S,v=e[0].vector,k=e[0].point,A=k,O=k,G=A,R=!1;for(let N=0;N<e.length;N++){let{pressure:T}=e[N],{point:z,vector:_,distance:he,runningLength:ve}=e[N];if(N<e.length-1&&g-ve<3)continue;if(i){if(r){let J=ho(1,he/n),ie=ho(1,1-J);T=ho(1,M+(ie-M)*(J*pl))}b=ll(n,i,T,a)}else b=n/2;S===void 0&&(S=b);let we=ve<f?p(ve/f):1,xe=g-ve<E?m((g-ve)/E):1;b=Math.max(.01,b*Math.min(we,xe));let ge=(N<e.length-1?e[N+1]:e[N]).vector,Ne=N<e.length-1?dl(_,ge):1,$=dl(_,v)<0&&!R,ce=Ne!==null&&Ne<0;if($||ce){let J=kt(zo(v),b);for(let ie=1/13,rt=0;rt<=1;rt+=ie)O=_o(Mt(z,J),z,Wo*rt),y.push(O),G=_o(Tt(z,J),z,Wo*-rt),w.push(G);k=O,A=G,ce&&(R=!0);continue}if(R=!1,N===e.length-1){let J=kt(zo(_),b);y.push(Mt(z,J)),w.push(Tt(z,J));continue}let Be=kt(zo(Vr(ge,_,Ne)),b);O=Mt(z,Be),(N<=1||cl(k,O)>x)&&(y.push(O),k=O),G=Tt(z,Be),(N<=1||cl(A,G)>x)&&(w.push(G),A=G),M=T,v=_}let C=e[0].point.slice(0,2),j=e.length>1?e[e.length-1].point.slice(0,2):Tt(e[0].point,[1,1]),W=[],q=[];if(e.length===1){if(!(f||E)||d){let N=ul(C,hl(zo(Mt(C,j))),-(S||b)),T=[];for(let z=1/13,_=z;_<=1;_+=z)T.push(_o(N,C,Wo*2*_));return T}}else{if(!(f||E&&e.length===1))if(c)for(let T=1/13,z=T;z<=1;z+=T){let _=_o(w[0],C,Wo*z);W.push(_)}else{let T=Mt(y[0],w[0]),z=kt(T,.5),_=kt(T,.51);W.push(Mt(C,z),Mt(C,_),Tt(C,_),Tt(C,z))}let N=zo(e1(e[e.length-1].vector));if(E||f&&e.length===1)q.push(j);else if(h){let T=ul(j,N,b);for(let z=1/29,_=z;_<1;_+=z)q.push(_o(T,j,Wo*3*_))}else q.push(Tt(j,kt(N,b)),Tt(j,kt(N,b*.99)),Mt(j,kt(N,b*.99)),Mt(j,kt(N,b)))}return y.concat(q,w.reverse(),W)}function l1(e,t={}){var n;let{streamline:o=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let a=.15+(1-o)*.85,s=Array.isArray(e[0])?e:e.map(({x:m,y:g,pressure:f=.5})=>[m,g,f]);if(s.length===2){let m=s[1];s=s.slice(0,-1);for(let g=1;g<5;g++)s.push(Vr(s[0],m,g/4))}s.length===1&&(s=[...s,[...Tt(s[0],[1,1]),...s[0].slice(2)]]);let l=[{point:[s[0][0],s[0][1]],pressure:s[0][2]>=0?s[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,c=0,p=l[0],h=s.length-1;for(let m=1;m<s.length;m++){let g=r&&m===h?s[m].slice(0,2):Vr(p.point,s[m],a);if(n1(p.point,g))continue;let f=r1(g,p.point);if(c+=f,m<h&&!d){if(c<i)continue;d=!0}p={point:g,pressure:s[m][2]>=0?s[m][2]:.5,vector:hl(Mt(p.point,g)),distance:f,runningLength:c},l.push(p)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function ml(e,t={}){return s1(l1(e,t),t)}I();I();I();function Me([e,t,n],[o,i,r]){return[e+o,t+i,n+r]}function mo([e,t,n],[o,i,r]){return[e-o,t-i,n-r]}function Ge([e,t,n],o){return[e*o,t*o,n*o]}function qn([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function ze([e,t,n],o){return[Math.cos(o)*e-Math.sin(o)*t,Math.sin(o)*e+Math.cos(o)*t,n]}function fl(e,t,n){return Me(e,Ge(mo(t,e),n))}function Ur(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function Yr(e){return Math.atan2(Math.sin(e),Math.cos(e))}function Xr([e,t]){return Math.sqrt(e**2+t**2)}function Zn([e,t],[n,o]){return Math.sqrt((n-e)**2+(o-t)**2)}function gl(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=Zn(e[n-1],e[n]);return t+=Zn(e[e.length-2],e[e.length-1]),t}var d1=(e,t,n)=>Math.max(t,Math.min(n,e));function El(e,t,n){let o=Zn(t,n);if(o===0)return Zn(e,t);let i=d1(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/o**2,0,1),r=[t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]];return Zn(r,e)}I();function jo(e,t){if(t===0||e.length<=2)return e;let n=e[0],o=e[e.length-1],[i,r]=e.reduce(([a,s],l,d)=>{let c=El(l,n,o);return c>a?[c,d]:[a,s]},[0,-1]);if(i>=t){let a=e[r];return[...jo([n,...e.slice(1,r),a],t).slice(0,-1),a,...jo([a,...e.slice(r,-1),o],t).slice(1)]}return[n,o]}var Di=class e{static defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:"output",keepHead:!1,sizeMapping:()=>1};static constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:t=>t>35?.5:1,maxTailLength:50};options;constructor(t){this.options=Object.assign({},e.defaults,t)}originalPoints=[];stablePoints=[];tailPoints=[];isFresh=!0;get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=fl(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),gl(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase==="tail")throw new Error("Not implemented yet");this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(t,n,o,i,r){return(t??this.options.size)*this.options.sizeMapping({pressure:n,runningLength:r,currentIndex:o,totalLength:i})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase==="input"&&(n=jo(n,this.options.simplify));let o=n.length;if(o===0)return[];if(o===1){let v=n[0],k=this.getSize(t,v[2],0,o,0);if(k<.5)return[];let A=[];for(let O=0;O<=Math.PI*2;O+=Math.PI/16)A.push(Me(v,Ge(ze([1,0,0],O),k)));return A.push(Me(v,Ge([1,0,0],this.getSize(t,v[2],0,o,0)))),A}if(o===2){let v=n[0],k=n[1],A=this.getSize(t,v[2],0,o,0),O=this.getSize(t,k[2],0,o,0);if(A<.5||O<.5)return[];let G=[],R=Ur(v,[v[0],v[1]-100,v[2]],k);for(let C=R;C<=Math.PI+R;C+=Math.PI/16)G.push(Me(v,Ge(ze([1,0,0],C),A)));for(let C=Math.PI+R;C<=Math.PI*2+R;C+=Math.PI/16)G.push(Me(k,Ge(ze([1,0,0],C),O)));return G.push(G[0]),G}let i=[],r=[],a=0,s=0,l=0,d=0;for(let v=1;v<o-1;v++){let k=n[v-1],A=n[v],O=n[v+1],G=A[2],R=Zn(k,A);d+=R,a=s+(R-s)*.2;let C=this.getSize(t,G,v,o,d);if(C===0){l=v+1;continue}let j=qn(mo(k,A)),W=qn(mo(O,A)),q=ze(j,Math.PI/2),N=ze(j,-Math.PI/2),T=ze(W,Math.PI/2),z=ze(W,-Math.PI/2),_=Me(A,Ge(q,C)),he=Me(A,Ge(N,C)),ve=Me(A,Ge(T,C)),we=Me(A,Ge(z,C)),xe=Me(q,z),ge=Me(N,T),Ne=Me(A,Ge(Xr(xe)===0?j:qn(xe),C)),$=Me(A,Ge(Xr(ge)===0?W:qn(ge),C)),ce=Yr(Ur(A,k,O)),Be=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(a);if(Math.abs(ce)<Be){let J=Math.abs(Yr(Math.PI-ce));if(J===0)continue;if(ce<0){r.push(he,$);for(let ie=0;ie<=J;ie+=J/4)i.push(Me(A,ze(Ge(q,C),ie)));for(let ie=J;ie>=0;ie-=J/4)r.push(Me(A,ze(Ge(q,C),ie)));r.push($,ve)}else{i.push(_,Ne);for(let ie=0;ie<=J;ie+=J/4)r.push(Me(A,ze(Ge(q,-C),-ie)));for(let ie=J;ie>=0;ie-=J/4)i.push(Me(A,ze(Ge(q,-C),-ie)));i.push(Ne,we)}}else i.push(Ne),r.push($);s=a}if(l>=o-2){if(this.options.keepHead){let v=n[o-1],k=[];for(let A=0;A<=Math.PI*2;A+=Math.PI/16)k.push(Me(v,Ge(ze([1,0,0],A),this.options.size)));return k.push(Me(v,Ge([1,0,0],this.options.size))),k}return[]}let c=n[l],p=n[l+1],h=n[o-2],m=n[o-1],g=qn(mo(p,c)),f=qn(mo(h,m)),E=ze(g,-Math.PI/2),x=ze(f,Math.PI/2),y=this.getSize(t,c[2],0,o,0),w=[],M=this.options.keepHead?this.options.size:this.getSize(t,h[2],o-2,o,d),b=[];if(y>.1){for(let v=0;v<=Math.PI;v+=Math.PI/16)w.unshift(Me(c,ze(Ge(E,y),-v)));w.unshift(Me(c,Ge(E,-y)))}else w.push(c);for(let v=0;v<=Math.PI*3;v+=Math.PI/16)b.push(Me(m,ze(Ge(x,-M),-v)));let S=[...w,...i,...b.reverse(),...r.reverse()];return w.length>0&&S.push(w[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?jo(S,this.options.simplify):S}};import{pointFrom as Pe,pointDistance as Pc,pointRotateRads as mn}from"@excalidraw/math";import{ROUGHNESS as p0,THEME as Ja,isTransparent as ui,assertNever as h0,COLOR_PALETTE as m0,LINE_POLYGON_POINT_MERGE_DISTANCE as f0,applyDarkModeFilter as pi,DEFAULT_STROKE_STREAMLINE as g0}from"@excalidraw/common";I();import{isRightAngleRads as e0,lineSegment as Ec,pointFrom as pr,pointRotateRads as Xa}from"@excalidraw/math";import{BOUND_TEXT_PADDING as Hn,DEFAULT_REDUCED_GLOBAL_ALPHA as t0,ELEMENT_READY_TO_ERASE_OPACITY as n0,FRAME_STYLE as hr,DARK_THEME_FILTER as o0,MIME_TYPES as Za,THEME as ro,distance as Po,getFontString as i0,isRTL as r0,getVerticalOffset as a0,invariant as s0,applyDarkModeFilter as li,isSafari as l0}from"@excalidraw/common";I();import{pointFrom as Qt,pointCenter as u1,pointRotateRads as wn,vectorFromPoint as $r,vectorNormalize as xl,vectorSubtract as yl,vectorAdd as Bi,vectorScale as Gi,pointFromVector as wl,clamp as Ve,isCloseTo as bl}from"@excalidraw/math";var Ue=10,Gx=(e,t,n,o,i,r,a,s)=>{let{width:l,height:d}=Zr(e),c=o/l,p=i/d,h=(e.crop?.x??0)/c,m=(e.crop?.y??0)/p,g=wn(Qt(r,a),me(e,t),-e.angle);r=g[0],a=g[1];let f=e.width,E=e.height,x=e.crop??{x:0,y:0,width:o,height:i,naturalWidth:o,naturalHeight:i},y=x.height,w=x.width,M=e.scale[0]===-1,b=e.scale[1]===-1,S=a-e.y,v=r-e.x;n.includes("n")&&(E=Ve(e.height-S,Ue,b?d-m:e.height+m)),n.includes("s")&&(S=a-e.y-e.height,E=Ve(e.height+S,Ue,b?e.height+m:d-m)),n.includes("e")&&(v=r-e.x-e.width,f=Ve(e.width+v,Ue,M?e.width+h:l-h)),n.includes("w")&&(f=Ve(e.width-v,Ue,M?l-h:e.width+h));let k=G=>{G.height=E*p,G.width=f*c};k(x);let A=(G,R)=>{k(R),G.includes("n")&&(b||(R.y+=y-R.height)),G.includes("s")&&b&&(R.y+=y-R.height),G.includes("e")&&M&&(R.x+=w-R.width),G.includes("w")&&(M||(R.x+=w-R.width))};switch(n){case"n":{if(s){let G=h+e.width/2,R=l-h-e.width/2,C=Math.min(G,R)*2;f=Ve(E*s,Ue,C),E=f/s}A(n,x),s&&(x.x+=(w-x.width)/2);break}case"s":{if(s){let G=h+e.width/2,R=l-h-e.width/2,C=Math.min(G,R)*2;f=Ve(E*s,Ue,C),E=f/s}A(n,x),s&&(x.x+=(w-x.width)/2);break}case"w":{if(s){let G=m+e.height/2,R=d-m-e.height/2,C=Math.min(G,R)*2;E=Ve(f/s,Ue,C),f=E*s}A(n,x),s&&(x.y+=(y-x.height)/2);break}case"e":{if(s){let G=m+e.height/2,R=d-m-e.height/2,C=Math.min(G,R)*2;E=Ve(f/s,Ue,C),f=E*s}A(n,x),s&&(x.y+=(y-x.height)/2);break}case"ne":{if(s)if(v>-S){let G=b?d-m:m+e.height;E=Ve(f/s,Ue,G),f=E*s}else{let G=M?h+e.width:l-h;f=Ve(E*s,Ue,G),E=f/s}A(n,x);break}case"nw":{if(s)if(v<S){let G=b?d-m:m+e.height;E=Ve(f/s,Ue,G),f=E*s}else{let G=M?l-h:h+e.width;f=Ve(E*s,Ue,G),E=f/s}A(n,x);break}case"se":{if(s)if(v>S){let G=b?m+e.height:d-m;E=Ve(f/s,Ue,G),f=E*s}else{let G=M?h+e.width:l-h;f=Ve(E*s,Ue,G),E=f/s}A(n,x);break}case"sw":{if(s)if(-v>S){let G=b?m+e.height:d-m;E=Ve(f/s,Ue,G),f=E*s}else{let G=M?l-h:h+e.width;f=Ve(E*s,Ue,G),E=f/s}A(n,x);break}default:break}let O=p1(e,n,f,E,!!s);return bl(x.width,x.naturalWidth)&&bl(x.height,x.naturalHeight)&&(x=null),{x:O[0],y:O[1],width:f,height:E,crop:x}},p1=(e,t,n,o,i)=>{let[r,a,s,l]=bn(e,e.width,e.height,!0),d=Qt(r,a),c=Qt(s,l),p=u1(d,c),[h,m,g,f]=bn(e,n,o,!0),E=g-h,x=f-m,y=[...d];if(["n","w","nw"].includes(t)&&(y=[c[0]-Math.abs(E),c[1]-Math.abs(x)]),t==="ne"){let k=[d[0],c[1]];y=[k[0],k[1]-Math.abs(x)]}if(t==="sw"){let k=[c[0],d[1]];y=[k[0]-Math.abs(E),k[1]]}i&&(["s","n"].includes(t)&&(y[0]=p[0]-E/2),["e","w"].includes(t)&&(y[1]=p[1]-x/2));let w=e.angle,M=wn(y,p,w),b=[y[0]+Math.abs(E)/2,y[1]+Math.abs(x)/2],S=wn(b,p,w);y=wn(M,S,-w);let v=[...y];return v[0]+=e.x-h,v[1]+=e.y-m,v},Ml=(e,t)=>{if(e.crop){let{width:n,height:o}=Zr(e),[i,r,a,s,l,d]=ee(e,t),c=$r(wn(Qt(i,r),Qt(l,d),e.angle)),p=$r(wn(Qt(a,r),Qt(l,d),e.angle)),h=xl(yl(p,c)),m=$r(wn(Qt(i,s),Qt(l,d),e.angle)),g=yl(m,c),f=xl(g),{cropX:E,cropY:x}=h1(e.crop,e.scale),y=Bi(Bi(c,Gi(h,-E*n/e.crop.naturalWidth)),Gi(f,-x*o/e.crop.naturalHeight)),w=wl(Bi(Bi(y,Gi(h,n/2)),Gi(f,o/2))),M=wn(wl(y),w,-e.angle);return{...e,x:M[0],y:M[1],width:n,height:o,crop:null}}return e},Zr=e=>{if(e.crop){let t=e.width/(e.crop.width/e.crop.naturalWidth),n=e.height/(e.crop.height/e.crop.naturalHeight);return{width:t,height:n}}return{width:e.width,height:e.height}},h1=(e,t)=>{let n=e.x,o=e.y,i=t[0]===-1,r=t[1]===-1;return i&&(n=e.naturalWidth-Math.abs(n)-e.width),r&&(o=e.naturalHeight-Math.abs(o)-e.height),{cropX:n,cropY:o}},Ox=(e,t=!1)=>{let n=e.crop;if(!n)return null;let o=e.scale[0]===-1,i=e.scale[1]===-1,r=n.x,a=n.y;if(o&&(r=n.naturalWidth-n.width-n.x),i&&(a=n.naturalHeight-n.height-n.y),t)return{x:r,y:a};let{width:s,height:l}=Zr(e);return{x:r/(n.naturalWidth/s),y:a/(n.naturalHeight/l)}};I();import{pointCenter as ic,pointFrom as H,pointRotateRads as nt,pointsEqual as rc,pointDistance as io,vectorFromPoint as _m,curveLength as Wm,curvePointAtLength as jm}from"@excalidraw/math";import{DRAGGING_THRESHOLD as Vm,KEYS as oo,shouldRotateWithDiscreteAngle as ai,getGridPoint as ac,invariant as pt,isShallowEqual as Um,getFeatureFlag as Mo}from"@excalidraw/common";I();import{arrayToMap as Id,getFeatureFlag as Uh,invariant as hn,isTransparent as Yh}from"@excalidraw/common";import{PRECISION as oi,clamp as Ca,lineSegment as rr,pointDistance as Dn,pointDistanceSq as pn,pointFrom as pe,pointFromVector as or,pointRotateRads as ye,pointsEqual as Xh,vectorFromPoint as ti,vectorNormalize as La,vectorScale as ir}from"@excalidraw/math";I();import{invariant as Jl,isTransparent as ed}from"@excalidraw/common";import{curveIntersectLineSegment as td,isPointWithinBounds as ma,lineSegment as Ko,lineSegmentIntersectionPoints as nd,pointFrom as Oe,pointFromVector as uh,pointRotateRads as xt,pointsEqual as od,vectorFromPoint as ph,vectorNormalize as hh,vectorScale as mh}from"@excalidraw/math";import{ellipse as fh,ellipseSegmentInterceptPoints as gh}from"@excalidraw/math/ellipse";I();import{DEFAULT_ADAPTIVE_RADIUS as b1,DEFAULT_PROPORTIONAL_RADIUS as Kr,invariant as M1,LINE_CONFIRM_THRESHOLD as P1,ROUNDNESS as Qr}from"@excalidraw/common";import{bezierEquation as I1,curve as en,curveCatmullRomCubicApproxPoints as Bl,curveOffsetPoints as Gl,lineSegment as Fe,lineSegmentIntersectionPoints as Cl,pointDistance as Kn,pointFrom as U,pointFromArray as S1,pointFromVector as v1,pointRotateRads as gt,pointTranslate as Dl,rectangle as A1,vectorFromPoint as Ol,vectorNormalize as k1,vectorScale as Jr}from"@excalidraw/math";I();import{ROUNDNESS as Vo,assertNever as m1}from"@excalidraw/common";import{pointsEqual as Pl}from"@excalidraw/math";var Mn=e=>!!e&&e.type==="image"&&!!e.fileId,_e=e=>!!e&&e.type==="image",Il=e=>!!e&&e.type==="embeddable",Oi=e=>!!e&&e.type==="iframe",Ri=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),re=e=>e!=null&&e.type==="text",Fi=e=>e!=null&&e.type==="frame",Sl=e=>e!=null&&e.type==="magicframe",oe=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),He=e=>e!=null&&f1(e.type),f1=e=>e==="freedraw",ae=e=>e!=null&&x1(e.type),Jt=e=>e!=null&&e.type==="line",Y=e=>e!=null&&e.type==="arrow",Z=e=>Y(e)&&e.elbowed,zx=e=>Y(e)&&!e.elbowed,g1=e=>Y(e)&&!e.elbowed&&!e.roundness,E1=e=>Y(e)&&!e.elbowed&&e.roundness!==null,x1=e=>e==="arrow"||e==="line",Ye=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&y1(e.type),y1=e=>e==="arrow",Ae=(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),vl=e=>e!=null&&(e.type==="rectangle"||e.type==="diamond"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Uo=e=>e!=null&&(e.type==="rectangle"||e.type==="image"||e.type==="text"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="freedraw"),w1=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||Y(e)),Al=e=>{let t=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 m1(t,null),!1}},qr=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",zt=e=>w1(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),ke=e=>e!==null&&"containerId"in e&&e.containerId!==null&&re(e),_x=e=>!!e.startBinding||!!e.endBinding,kl=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",Tl=e=>e==="line"||e==="arrow"||e==="diamond",Wx=(e,t)=>!!((e===Vo.ADAPTIVE_RADIUS||e===Vo.LEGACY)&&kl(t.type)||e===Vo.PROPORTIONAL_RADIUS&&Tl(t.type)),jx=e=>Tl(e.type)?{type:Vo.PROPORTIONAL_RADIUS}:kl(e.type)?{type:Vo.ADAPTIVE_RADIUS}:null,Vx=e=>g1(e)?"sharpArrow":E1(e)?"curvedArrow":Z(e)?"elbowArrow":"line",Ux=e=>e.length>3&&Pl(e[0],e[e.length-1]),Ll=e=>e.length>3||e.length===3&&!Pl(e[0],e[e.length-1]),Yx=e=>{switch(e){case"rectangle":case"diamond":case"ellipse":case"arrow":case"line":case"freedraw":case"text":case"image":case"frame":case"embeddable":return!0;default:return!1}};var Yo=new WeakMap,ea=(e,t)=>{let n=Yo.get(e);if(!n)return;let{version:o,shapes:i}=n;if(o!==e.version){Yo.delete(e);return}return i.get(t)},ta=(e,t,n)=>{let o=Yo.get(e);if(!o){Yo.set(e,{version:e.version,shapes:new Map([[n,t]])});return}let{version:i,shapes:r}=o;if(i!==e.version){Yo.set(e,{version:e.version,shapes:new Map([[n,t]])});return}r.set(n,t)};function Qn(e,t){let n=ea(e,0);if(n)return n;let o=Fl(e,t),i=[],r=[];for(let s=0;s<o.length;s+=1){let l=o[s],d=o[s-1]&&S1(o[s-1].data.slice(-2));switch(l.op){case"move":continue;case"lineTo":if(!d)throw new Error("prevPoint is undefined");i.push(Fe(U(e.x+d[0],e.y+d[1]),U(e.x+l.data[0],e.y+l.data[1])));continue;case"bcurveTo":if(!d)throw new Error("prevPoint is undefined");r.push(en(U(e.x+d[0],e.y+d[1]),U(e.x+l.data[0],e.y+l.data[1]),U(e.x+l.data[2],e.y+l.data[3]),U(e.x+l.data[4],e.y+l.data[5])));continue;default:console.error("Unknown op type",l.op)}}let a=[i,r];return ta(e,a,0),a}function Pn(e,t=0){let n=ea(e,t);if(n)return n;let o=tn(Math.min(e.width,e.height),e);o===0&&(o=.01);let i=A1(U(e.x,e.y),U(e.x+e.width,e.y+e.height)),r=Fe(U(i[0][0]+o,i[0][1]),U(i[1][0]-o,i[0][1])),a=Fe(U(i[1][0],i[0][1]+o),U(i[1][0],i[1][1]-o)),s=Fe(U(i[0][0]+o,i[1][1]),U(i[1][0]-o,i[1][1])),l=Fe(U(i[0][0],i[1][1]-o),U(i[0][0],i[0][1]+o)),d=[en(l[1],U(l[1][0]+2/3*(i[0][0]-l[1][0]),l[1][1]+2/3*(i[0][1]-l[1][1])),U(r[0][0]+2/3*(i[0][0]-r[0][0]),r[0][1]+2/3*(i[0][1]-r[0][1])),r[0]),en(r[1],U(r[1][0]+2/3*(i[1][0]-r[1][0]),r[1][1]+2/3*(i[0][1]-r[1][1])),U(a[0][0]+2/3*(i[1][0]-a[0][0]),a[0][1]+2/3*(i[0][1]-a[0][1])),a[0]),en(a[1],U(a[1][0]+2/3*(i[1][0]-a[1][0]),a[1][1]+2/3*(i[1][1]-a[1][1])),U(s[1][0]+2/3*(i[1][0]-s[1][0]),s[1][1]+2/3*(i[1][1]-s[1][1])),s[1]),en(s[0],U(s[0][0]+2/3*(i[0][0]-s[0][0]),s[0][1]+2/3*(i[1][1]-s[0][1])),U(l[0][0]+2/3*(i[0][0]-l[0][0]),l[0][1]+2/3*(i[1][1]-l[0][1])),l[0])],c=t>0?d.map(m=>Bl(Gl(m,t))):[[d[0]],[d[1]],[d[2]],[d[3]]],h=[[Fe(c[0][c[0].length-1][3],c[1][0][0]),Fe(c[1][c[1].length-1][3],c[2][0][0]),Fe(c[2][c[2].length-1][3],c[3][0][0]),Fe(c[3][c[3].length-1][3],c[0][0][0])],c.flat()];return ta(e,h,t),h}function Rl(e,t=0){let[n,o,i,r,a,s,l,d]=go(e),c=e.roundness?tn(Math.abs(n-l),e):(n-l)*.01,p=e.roundness?tn(Math.abs(r-o),e):(r-o)*.01,[h,m,g,f]=[U(e.x+n,e.y+o),U(e.x+i,e.y+r),U(e.x+a,e.y+s),U(e.x+l,e.y+d)];return[en(U(m[0]-c,m[1]-p),m,m,U(m[0]-c,m[1]+p)),en(U(g[0]+c,g[1]-p),g,g,U(g[0]-c,g[1]-p)),en(U(f[0]+c,f[1]+p),f,f,U(f[0]+c,f[1]-p)),en(U(h[0]-c,h[1]+p),h,h,U(h[0]+c,h[1]+p))]}function In(e,t=0){let n=ea(e,t);if(n)return n;let i=Rl(e,t).map(s=>Bl(Gl(s,t))),a=[[Fe(i[0][i[0].length-1][3],i[1][0][0]),Fe(i[1][i[1].length-1][3],i[2][0][0]),Fe(i[2][i[2].length-1][3],i[3][0][0]),Fe(i[3][i[3].length-1][3],i[0][0][0])],i.flat()];return ta(e,a,t),a}var nn=(e,t=1)=>{if(e.length>=3){let[n,o]=[e[0],e[e.length-1]];return Kn(n,o)<=P1/t}return!1},tn=(e,t)=>{if(t.roundness?.type===Qr.PROPORTIONAL_RADIUS||t.roundness?.type===Qr.LEGACY)return e*Kr;if(t.roundness?.type===Qr.ADAPTIVE_RADIUS){let n=t.roundness?.value??b1,o=n/Kr;return e<=o?e*Kr:n}return 0},T1=(e,t)=>{let n=e.type==="rectangle"?15:0,o=s=>{let l=k1(Ol(s[1],s[0])),d=Jr(l,n);return Fe(Dl(s[0],d),Dl(s[1],Jr(d,-1)))},i=me(e,t),r=o(Uo(e)?Fe(gt(U(e.x,e.y),i,e.angle),gt(U(e.x+e.width,e.y+e.height),i,e.angle)):Fe(gt(U(e.x+e.width/2,e.y),i,e.angle),gt(U(e.x+e.width/2,e.y+e.height),i,e.angle))),a=o(Uo(e)?Fe(gt(U(e.x+e.width,e.y),i,e.angle),gt(U(e.x,e.y+e.height),i,e.angle)):Fe(gt(U(e.x,e.y+e.height/2),i,e.angle),gt(U(e.x+e.width,e.y+e.height/2),i,e.angle)));return[r,a]},Ni=(e,t,n,o)=>{let i=me(t,n);return(t.type==="diamond"?Rl(t).map(s=>{let l=I1(s,.5),d=gt(l,i,t.angle);return U(d[0],d[1])}):[gt(U(t.x+t.width,t.y+t.height/2),i,t.angle),gt(U(t.x+t.width/2,t.y+t.height),i,t.angle),gt(U(t.x,t.y+t.height/2),i,t.angle),gt(U(t.x+t.width/2,t.y),i,t.angle)]).find(s=>Kn(e,s)<=Lt(o)+t.strokeWidth/2&&!_t({point:e,element:t,threshold:0,elementsMap:n,overrideShouldTestInside:!0}))},fo=(e,t,n,o,i,r,a=!0)=>{if(M1(e.points.length>=2,"Arrow must have at least two points"),e.width<3&&e.height<3)return null;if(a){let x=Ni(t,n,i,r);if(x)return x}let[s,l]=T1(n,i),d=F.getPointAtIndexGlobalCoordinates(e,o==="start"?1:e.points.length-2,i);if(e.points.length===2){let x=o==="start"?e.endBinding:e.startBinding,y=x&&i.get(x.elementId),w=x&&y&&st(Sn(x.fixedPoint),y,i);w&&(d=w)}let c=v1(Jr(Ol(t,d),2*Kn(d,t)+Math.max(Kn(s[0],s[1]),Kn(l[0],l[1]))),d),p=Fe(c,d),h=Cl(s,p),m=Cl(l,p),g=h&&Kn(d,h),f=m&&Kn(d,m),E=null;return g!=null&&f!=null?E=g<f?h:m:E=h||m||null,E&&on(E,n,i)?E:null};I();import{ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO as Q1,ARROW_LABEL_WIDTH_FRACTION as J1,BOUND_TEXT_PADDING as Wt,DEFAULT_FONT_SIZE as eh,TEXT_ALIGN as Vl,VERTICAL_ALIGN as Ul,getFontString as Vi,isProdEnv as th,invariant as nh}from"@excalidraw/common";import{pointFrom as Yl,pointRotateRads as oh}from"@excalidraw/math";I();var Xo={},Nl=(e,t)=>{let n=Xo[e]||(Xo[e]={height:t});return n.height=t,n},Hl=e=>{Xo[e]&&delete Xo[e]},ay=e=>Xo[e]?.height??null;I();import{BOUND_TEXT_PADDING as zi,DEFAULT_FONT_SIZE as L1,DEFAULT_FONT_FAMILY as C1,getFontString as D1,isTestEnv as B1,normalizeEOL as G1}from"@excalidraw/common";var Et=(e,t,n)=>{let o=e.split(`
2
2
  `).map(s=>s||" ").join(`
3
- `),i=parseFloat(t),r=l1(o,i,n);return{width:Al(o,t),height:r}},Il="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),Sl=(e,t)=>{let n=d1(e);return n===0?ot(Il.split("").join(`
4
- `),e,t).width+Ai*2:n+Ai*2},ki=(e,t)=>ot("",e,t).width+Ai*2,Ex=()=>Al(Il,r1({fontSize:o1,fontFamily:i1}))>0,Go=e=>s1(e).replace(/\t/g," "),Ur=e=>Go(e).split(`
5
- `),xx=e=>{let t=Ur(e.text).length;return e.height/t/e.fontSize},Ti=(e,t)=>e*t,vl=(e,t)=>Ti(e,t)+Ai*2,vi,yx=e=>{vi=e},Yr=class{canvas;constructor(){this.canvas=document.createElement("canvas")}getLineWidth(t,n){let o=this.canvas.getContext("2d");o.font=n;let r=o.measureText(t).width;return a1()?r*10:r}},fn=(e,t)=>(vi||(vi=new Yr),vi.getLineWidth(e,t)),Al=(e,t)=>{let n=Ur(e),o=0;return n.forEach(i=>{o=Math.max(o,fn(i,t))}),o},l1=(e,t,n)=>{let o=Ur(e).length;return Ti(t,n)*o},no=(()=>{let e={};return{calculate:(i,r)=>{let a=i.charCodeAt(0);if(e[r]||(e[r]=[]),!e[r][a]){let s=fn(i,r);e[r][a]=s}return e[r][a]},getCache:i=>e[i],clearCache:i=>{e[i]=[]}}})(),wx=e=>{let t=no.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.min(...n)},d1=e=>{let t=no.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.max(...n)};I();import{isDevEnv as c1,isTestEnv as u1}from"@excalidraw/common";var Xr,Li,$r,Sx=e=>(Xr||(Xr=re.class(...Object.values($t))),Xr.test(e)),p1=()=>{if(!Li)try{Li=m1()}catch{Li=h1()}return Li},Zr=()=>($r||($r=f1()),$r),ct={WHITESPACE:/\s/u,HYPHEN:/-/u,OPENING:/<\(\[\{/u,CLOSING:/>\)\]\}.,:;!\?…\//u},$t={CHAR:/\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}`'^〃〰〆#&*+-ー/\=|¦〒¬ ̄/u,OPENING:/([{〈《⦅「「『【〖〔〘〚<〝/u,CLOSING:/)]}〉》⦆」」』】〗〕〙〛>。.,、〟‥?!:;・〜〞/u,CURRENCY:/¥₩£¢$/u},_n={FLAG:/\p{RI}\p{RI}/u,JOINER:/(?:\p{Emoji_Modifier}|\uFE0F\u20E3?|[\u{E0020}-\u{E007E}]+\u{E007F})?/u,ZWJ:/\u200D/u,ANY:/[\p{Emoji}]/u,MOST:/[\p{Extended_Pictographic}\p{Emoji_Presentation}]/u},h1=()=>re.or(Zr(),ye.On(ct.HYPHEN,ct.WHITESPACE,$t.CHAR)),m1=()=>re.or(Zr(),ye.Before(ct.WHITESPACE).Build(),ye.After(ct.WHITESPACE,ct.HYPHEN).Build(),ye.Before($t.CHAR,$t.CURRENCY).NotPrecededBy(ct.OPENING,$t.OPENING).Build(),ye.After($t.CHAR).NotFollowedBy(ct.HYPHEN,ct.CLOSING,$t.CLOSING).Build(),ye.BeforeMany($t.OPENING).NotPrecededBy(ct.OPENING).Build(),ye.AfterMany($t.CLOSING).NotFollowedBy(ct.CLOSING).Build(),ye.AfterMany(ct.CLOSING).FollowedBy(ct.OPENING).Build()),f1=()=>re.group(re.or(_n.FLAG,re.and(_n.MOST,_n.JOINER,re.build(`(?:${_n.ZWJ.source}(?:${_n.FLAG.source}|${_n.ANY.source}${_n.JOINER.source}))*`)))),re={build:e=>new RegExp(e,"u"),join:(...e)=>e.map(t=>t.source).join(""),and:(...e)=>re.build(re.join(...e)),or:(...e)=>re.build(e.map(t=>t.source).join("|")),group:(...e)=>re.build(`(${re.join(...e)})`),class:(...e)=>re.build(`[${re.join(...e)}]`)},ye={On:(...e)=>{let t=re.join(...e);return re.build(`([${t}])`)},Before:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?=[${t}])`);return ye.Chain(n)},After:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?<=[${t}])`);return ye.Chain(n)},BeforeMany:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?<![${t}])(?=[${t}])`);return ye.Chain(n)},AfterMany:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?<=[${t}])(?![${t}])`);return ye.Chain(n)},NotBefore:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?![${t}])`);return ye.Chain(n)},NotAfter:(...e)=>{let t=re.join(...e),n=()=>re.build(`(?<![${t}])`);return ye.Chain(n)},Chain:e=>({Build:e,PreceededBy:(...t)=>{let n=e(),o=ye.After(...t).Build(),i=()=>re.and(o,n);return ye.Chain(i)},FollowedBy:(...t)=>{let n=e(),o=ye.Before(...t).Build(),i=()=>re.and(n,o);return ye.Chain(i)},NotPrecededBy:(...t)=>{let n=e(),o=ye.NotAfter(...t).Build(),i=()=>re.and(o,n);return ye.Chain(i)},NotFollowedBy:(...t)=>{let n=e(),o=ye.NotBefore(...t).Build(),i=()=>re.and(n,o);return ye.Chain(i)}})},g1=e=>{let t=p1();return e.normalize("NFC").split(t).filter(Boolean)},Zt=(e,t,n)=>x1(e,t,n).map(o=>o.text).join(`
6
- `),E1=e=>{let t=0;return e.split(`
7
- `).map(n=>{let o=t,i=o+n.length;return t=i+1,{text:n,start:o,end:i}})},x1=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return E1(e);let o=[],i=0;for(let r of e.split(`
8
- `))fn(r,t)<=n?o.push({text:r,start:i,end:i+r.length}):o.push(...y1(r,t,n,i)),i+=r.length+1;return o},y1=(e,t,n,o)=>{let i=[],r=g1(e),a="",s=o,l=o,d=0,c=o,u=0;for(;u<r.length;){let h=r[u],m=c,g=m+h.length,f=a+h,E=P1(h)?d+no.calculate(h,t):fn(f,t);if(/\s/.test(h)||E<=n){a||(s=m),a=f,l=g,d=E,c=g,u++;continue}if(a)i.push(M1(a,s,l)),a="",s=m,l=m,d=0;else{let x=w1(h,t,n,m),y=x[x.length-1]??{text:"",start:m,end:m},w=x.slice(0,-1);i.push(...w),a=y.text,s=y.start,l=y.end,d=fn(y.text,t),c=g,u++}}if(a){let h=b1(a,s,l,t,n);i.push(h)}return i},w1=(e,t,n,o)=>{if(Zr().test(e))return[{text:e,start:o,end:o+e.length}];I1(e);let i=[],r=Array.from(e),a="",s=o,l=o,d=0,c=o;for(let u of r){let h=c,m=h+u.length,g=no.calculate(u,t),f=d+g;if(f<=n){a||(s=h),a=a+u,l=m,d=f,c=m;continue}a&&i.push({text:a,start:s,end:l}),a=u,s=h,l=m,d=g,c=m}return a&&i.push({text:a,start:s,end:l}),i},b1=(e,t,n,o,i)=>{if(!(fn(e,o)>i))return{text:e,start:t,end:n};let[,a,s]=e.match(/^(.+?)(\s+)$/)??[e,e.trimEnd(),""],l=fn(a,o);for(let d of Array.from(s)){let c=no.calculate(d,o),u=l+c;if(u>i)break;a=a+d,l=u}return{text:a,start:t,end:n-(e.length-a.length)}},M1=(e,t,n)=>{let o=e.trimEnd();return{text:o,start:t,end:n-(e.length-o.length)}},P1=e=>e.codePointAt(0)!==void 0&&e.codePointAt(1)===void 0,I1=e=>{if((u1()||c1())&&/\s/.test(e))throw new Error("Word should not contain any whitespaces!")};var Bi=(e,t,n)=>{let o=n.getNonDeletedElementsMap(),i;k1()||T1(!t||!j(t)||e.angle===0,"text element angle must be 0 if bound to arrow container");let r={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,angle:t?j(t)?0:t.angle:e.angle};r.text=e.text,(t||!e.autoResize)&&(i=t?xt(t,e):e.width,r.text=Zt(e.originalText,Ci(e),i));let a=ot(r.text,Ci(e),e.lineHeight);if(e.autoResize&&(r.width=a.width),r.height=a.height,t){let s=Ro(t,e),l=xt(t,e);if(!j(t)&&a.height>s){let h=qr(a.height,t.type);n.mutateElement(t,{height:h}),Ml(t.id,h)}if(a.width>l){let h=qr(a.width,t.type);n.mutateElement(t,{width:h})}let d={...e,...r},{x:c,y:u}=Oo(t,d,o);r.x=c,r.y=u}n.mutateElement(e,r)},jn=(e,t,n,o=!1)=>{let i=t.getNonDeletedElementsMap();if(!qt(e))return;Pl(e.id);let a=Q(e,i);if(a&&a.text){if(!e)return;let s=a.text,l=a.height,d=a.width,c=xt(e,a),u=Ro(e,a),h=e.height;if(o||n!=="n"&&n!=="s"){s&&(s=Zt(a.originalText,Ci(a),c));let m=ot(s,Ci(a),a.lineHeight);l=m.height,d=m.width}if(l>u){h=qr(l,e.type);let m=h-e.height,g=!j(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-m:e.y;t.mutateElement(e,{height:h,y:g})}t.mutateElement(a,{text:s,width:d,height:l}),j(e)||t.mutateElement(a,Oo(e,a,i))}},Oo=(e,t,n)=>{if(j(e))return D.getBoundTextElementPosition(e,t,n);let o=Kr(e),i=Ro(e,t),r=xt(e,t),a,s;t.verticalAlign===Tl.TOP?s=o.y:t.verticalAlign===Tl.BOTTOM?s=o.y+(i-t.height):s=o.y+(i/2-t.height/2),t.textAlign===kl.LEFT?a=o.x:t.textAlign===kl.RIGHT?a=o.x+(r-t.width):a=o.x+(r/2-t.width/2);let l=e.angle??0;if(l!==0){let d=Ll(o.x+r/2,o.y+i/2),c=Ll(a+t.width/2,s+t.height/2),[u,h]=L1(c,d,l);return{x:u-t.width/2,y:h-t.height/2}}return{x:a,y:s}},qt=e=>e?.boundElements?.length&&e?.boundElements?.find(t=>t.type==="text")?.id||null,Q=(e,t)=>{if(!e)return null;let n=qt(e);return n&&t.get(n)||null},De=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,Ox=(e,t,n)=>{if(!j(e))return{x:e.x+e.width/2,y:e.y+e.height/2};if(D.getPointsGlobalCoordinates(e,n).length%2===1){let a=Math.floor(e.points.length/2),s=D.getPointGlobalCoordinates(e,e.points[a],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,r=D.getEditorMidPoints(e,n,t)[i];return r||(r=D.getSegmentMidPoint(e,i+1,n)),{x:r[0],y:r[1]}},Kr=e=>{let t=Ct,n=Ct;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}},Rx=(e,t)=>j(t)?0:t?t.angle:e.angle,Fx=(e,t,n)=>{if(j(e))return D.getBoundTextElementPosition(e,t,n)},Nx=(e,t)=>e.some(n=>{if(xe(n)){let o=De(n,t);return!j(o)}return!1}),Hx=(e,t)=>e.some(n=>{if(xe(n)){let o=De(n,t);return!j(o)}return te(n)}),C1=new Set(["rectangle","ellipse","diamond","arrow"]),zx=e=>C1.has(e.type),qr=(e,t)=>{e=Math.ceil(e);let n=Ct*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},xt=(e,t)=>{let{width:n}=e;if(j(e)){let o=(t?.fontSize??A1)*S1;return Math.max(v1*n,o)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Ct*2:e.type==="diamond"?Math.round(n/2)-Ct*2:n-Ct*2},Ro=(e,t)=>{let{height:n}=e;return j(e)?n-Ct*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Ct*2:e.type==="diamond"?Math.round(n/2)-Ct*2:n-Ct*2},Wx=(e,t=`
3
+ `),i=parseFloat(t),r=O1(o,i,n);return{width:jl(o,t),height:r}},zl="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),_l=(e,t)=>{let n=R1(e);return n===0?Et(zl.split("").join(`
4
+ `),e,t).width+zi*2:n+zi*2},_i=(e,t)=>Et("",e,t).width+zi*2,cy=()=>jl(zl,D1({fontSize:L1,fontFamily:C1}))>0,$o=e=>G1(e).replace(/\t/g," "),oa=e=>$o(e).split(`
5
+ `),uy=e=>{let t=oa(e.text).length;return e.height/t/e.fontSize},Wi=(e,t)=>e*t,Wl=(e,t)=>Wi(e,t)+zi*2,Hi,py=e=>{Hi=e},na=class{canvas;constructor(){this.canvas=document.createElement("canvas")}getLineWidth(t,n){let o=this.canvas.getContext("2d");o.font=n;let r=o.measureText(t).width;return B1()?r*10:r}},vn=(e,t)=>(Hi||(Hi=new na),Hi.getLineWidth(e,t)),jl=(e,t)=>{let n=oa(e),o=0;return n.forEach(i=>{o=Math.max(o,vn(i,t))}),o},O1=(e,t,n)=>{let o=oa(e).length;return Wi(t,n)*o},Eo=(()=>{let e={};return{calculate:(i,r)=>{let a=i.charCodeAt(0);if(e[r]||(e[r]=[]),!e[r][a]){let s=vn(i,r);e[r][a]=s}return e[r][a]},getCache:i=>e[i],clearCache:i=>{e[i]=[]}}})(),hy=e=>{let t=Eo.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.min(...n)},R1=e=>{let t=Eo.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.max(...n)};I();import{isDevEnv as F1,isTestEnv as N1}from"@excalidraw/common";var ia,ji,ra,xy=e=>(ia||(ia=de.class(...Object.values(rn))),ia.test(e)),H1=()=>{if(!ji)try{ji=_1()}catch{ji=z1()}return ji},aa=()=>(ra||(ra=W1()),ra),Pt={WHITESPACE:/\s/u,HYPHEN:/-/u,OPENING:/<\(\[\{/u,CLOSING:/>\)\]\}.,:;!\?…\//u},rn={CHAR:/\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}`'^〃〰〆#&*+-ー/\=|¦〒¬ ̄/u,OPENING:/([{〈《⦅「「『【〖〔〘〚<〝/u,CLOSING:/)]}〉》⦆」」』】〗〕〙〛>。.,、〟‥?!:;・〜〞/u,CURRENCY:/¥₩£¢$/u},Jn={FLAG:/\p{RI}\p{RI}/u,JOINER:/(?:\p{Emoji_Modifier}|\uFE0F\u20E3?|[\u{E0020}-\u{E007E}]+\u{E007F})?/u,ZWJ:/\u200D/u,ANY:/[\p{Emoji}]/u,MOST:/[\p{Extended_Pictographic}\p{Emoji_Presentation}]/u},z1=()=>de.or(aa(),Te.On(Pt.HYPHEN,Pt.WHITESPACE,rn.CHAR)),_1=()=>de.or(aa(),Te.Before(Pt.WHITESPACE).Build(),Te.After(Pt.WHITESPACE,Pt.HYPHEN).Build(),Te.Before(rn.CHAR,rn.CURRENCY).NotPrecededBy(Pt.OPENING,rn.OPENING).Build(),Te.After(rn.CHAR).NotFollowedBy(Pt.HYPHEN,Pt.CLOSING,rn.CLOSING).Build(),Te.BeforeMany(rn.OPENING).NotPrecededBy(Pt.OPENING).Build(),Te.AfterMany(rn.CLOSING).NotFollowedBy(Pt.CLOSING).Build(),Te.AfterMany(Pt.CLOSING).FollowedBy(Pt.OPENING).Build()),W1=()=>de.group(de.or(Jn.FLAG,de.and(Jn.MOST,Jn.JOINER,de.build(`(?:${Jn.ZWJ.source}(?:${Jn.FLAG.source}|${Jn.ANY.source}${Jn.JOINER.source}))*`)))),de={build:e=>new RegExp(e,"u"),join:(...e)=>e.map(t=>t.source).join(""),and:(...e)=>de.build(de.join(...e)),or:(...e)=>de.build(e.map(t=>t.source).join("|")),group:(...e)=>de.build(`(${de.join(...e)})`),class:(...e)=>de.build(`[${de.join(...e)}]`)},Te={On:(...e)=>{let t=de.join(...e);return de.build(`([${t}])`)},Before:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?=[${t}])`);return Te.Chain(n)},After:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?<=[${t}])`);return Te.Chain(n)},BeforeMany:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?<![${t}])(?=[${t}])`);return Te.Chain(n)},AfterMany:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?<=[${t}])(?![${t}])`);return Te.Chain(n)},NotBefore:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?![${t}])`);return Te.Chain(n)},NotAfter:(...e)=>{let t=de.join(...e),n=()=>de.build(`(?<![${t}])`);return Te.Chain(n)},Chain:e=>({Build:e,PreceededBy:(...t)=>{let n=e(),o=Te.After(...t).Build(),i=()=>de.and(o,n);return Te.Chain(i)},FollowedBy:(...t)=>{let n=e(),o=Te.Before(...t).Build(),i=()=>de.and(n,o);return Te.Chain(i)},NotPrecededBy:(...t)=>{let n=e(),o=Te.NotAfter(...t).Build(),i=()=>de.and(o,n);return Te.Chain(i)},NotFollowedBy:(...t)=>{let n=e(),o=Te.NotBefore(...t).Build(),i=()=>de.and(n,o);return Te.Chain(i)}})},j1=e=>{let t=H1();return e.normalize("NFC").split(t).filter(Boolean)},an=(e,t,n)=>U1(e,t,n).map(o=>o.text).join(`
6
+ `),V1=e=>{let t=0;return e.split(`
7
+ `).map(n=>{let o=t,i=o+n.length;return t=i+1,{text:n,start:o,end:i}})},U1=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return V1(e);let o=[],i=0;for(let r of e.split(`
8
+ `))vn(r,t)<=n?o.push({text:r,start:i,end:i+r.length}):o.push(...Y1(r,t,n,i)),i+=r.length+1;return o},Y1=(e,t,n,o)=>{let i=[],r=j1(e),a="",s=o,l=o,d=0,c=o,p=0;for(;p<r.length;){let h=r[p],m=c,g=m+h.length,f=a+h,E=q1(h)?d+Eo.calculate(h,t):vn(f,t);if(/\s/.test(h)||E<=n){a||(s=m),a=f,l=g,d=E,c=g,p++;continue}if(a)i.push(Z1(a,s,l)),a="",s=m,l=m,d=0;else{let x=X1(h,t,n,m),y=x[x.length-1]??{text:"",start:m,end:m},w=x.slice(0,-1);i.push(...w),a=y.text,s=y.start,l=y.end,d=vn(y.text,t),c=g,p++}}if(a){let h=$1(a,s,l,t,n);i.push(h)}return i},X1=(e,t,n,o)=>{if(aa().test(e))return[{text:e,start:o,end:o+e.length}];K1(e);let i=[],r=Array.from(e),a="",s=o,l=o,d=0,c=o;for(let p of r){let h=c,m=h+p.length,g=Eo.calculate(p,t),f=d+g;if(f<=n){a||(s=h),a=a+p,l=m,d=f,c=m;continue}a&&i.push({text:a,start:s,end:l}),a=p,s=h,l=m,d=g,c=m}return a&&i.push({text:a,start:s,end:l}),i},$1=(e,t,n,o,i)=>{if(!(vn(e,o)>i))return{text:e,start:t,end:n};let[,a,s]=e.match(/^(.+?)(\s+)$/)??[e,e.trimEnd(),""],l=vn(a,o);for(let d of Array.from(s)){let c=Eo.calculate(d,o),p=l+c;if(p>i)break;a=a+d,l=p}return{text:a,start:t,end:n-(e.length-a.length)}},Z1=(e,t,n)=>{let o=e.trimEnd();return{text:o,start:t,end:n-(e.length-o.length)}},q1=e=>e.codePointAt(0)!==void 0&&e.codePointAt(1)===void 0,K1=e=>{if((N1()||F1())&&/\s/.test(e))throw new Error("Word should not contain any whitespaces!")};var Ui=(e,t,n)=>{let o=n.getNonDeletedElementsMap(),i;th()||nh(!t||!Y(t)||e.angle===0,"text element angle must be 0 if bound to arrow container");let r={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,angle:t?Y(t)?0:t.angle:e.angle};r.text=e.text,(t||!e.autoResize)&&(i=t?Ct(t,e):e.width,r.text=an(e.originalText,Vi(e),i));let a=Et(r.text,Vi(e),e.lineHeight);if(e.autoResize&&(r.width=a.width),r.height=a.height,t){let s=qo(t,e),l=Ct(t,e);if(!Y(t)&&a.height>s){let h=sa(a.height,t.type);n.mutateElement(t,{height:h}),Nl(t.id,h)}if(a.width>l){let h=sa(a.width,t.type);n.mutateElement(t,{width:h})}let d={...e,...r},{x:c,y:p}=Zo(t,d,o);r.x=c,r.y=p}n.mutateElement(e,r)},eo=(e,t,n,o=!1)=>{let i=t.getNonDeletedElementsMap();if(!sn(e))return;Hl(e.id);let a=te(e,i);if(a&&a.text){if(!e)return;let s=a.text,l=a.height,d=a.width,c=Ct(e,a),p=qo(e,a),h=e.height;if(o||n!=="n"&&n!=="s"){s&&(s=an(a.originalText,Vi(a),c));let m=Et(s,Vi(a),a.lineHeight);l=m.height,d=m.width}if(l>p){h=sa(l,e.type);let m=h-e.height,g=!Y(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-m:e.y;t.mutateElement(e,{height:h,y:g})}t.mutateElement(a,{text:s,width:d,height:l}),Y(e)||t.mutateElement(a,Zo(e,a,i))}},Zo=(e,t,n)=>{if(Y(e))return F.getBoundTextElementPosition(e,t,n);let o=la(e),i=qo(e,t),r=Ct(e,t),a,s;t.verticalAlign===Ul.TOP?s=o.y:t.verticalAlign===Ul.BOTTOM?s=o.y+(i-t.height):s=o.y+(i/2-t.height/2),t.textAlign===Vl.LEFT?a=o.x:t.textAlign===Vl.RIGHT?a=o.x+(r-t.width):a=o.x+(r/2-t.width/2);let l=e.angle??0;if(l!==0){let d=Yl(o.x+r/2,o.y+i/2),c=Yl(a+t.width/2,s+t.height/2),[p,h]=oh(c,d,l);return{x:p-t.width/2,y:h-t.height/2}}return{x:a,y:s}},sn=e=>e?.boundElements?.length&&e?.boundElements?.find(t=>t.type==="text")?.id||null,te=(e,t)=>{if(!e)return null;let n=sn(e);return n&&t.get(n)||null},Xe=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,ky=(e,t,n)=>{if(!Y(e))return{x:e.x+e.width/2,y:e.y+e.height/2};if(F.getPointsGlobalCoordinates(e,n).length%2===1){let a=Math.floor(e.points.length/2),s=F.getPointGlobalCoordinates(e,e.points[a],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,r=F.getEditorMidPoints(e,n,t)[i];return r||(r=F.getSegmentMidPoint(e,i+1,n)),{x:r[0],y:r[1]}},la=e=>{let t=Wt,n=Wt;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}},Ty=(e,t)=>Y(t)?0:t?t.angle:e.angle,Ly=(e,t,n)=>{if(Y(e))return F.getBoundTextElementPosition(e,t,n)},Cy=(e,t)=>e.some(n=>{if(ke(n)){let o=Xe(n,t);return!Y(o)}return!1}),Dy=(e,t)=>e.some(n=>{if(ke(n)){let o=Xe(n,t);return!Y(o)}return re(n)}),ih=new Set(["rectangle","ellipse","diamond","arrow"]),By=e=>ih.has(e.type),sa=(e,t)=>{e=Math.ceil(e);let n=Wt*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},Ct=(e,t)=>{let{width:n}=e;if(Y(e)){let o=(t?.fontSize??eh)*Q1;return Math.max(J1*n,o)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Wt*2:e.type==="diamond"?Math.round(n/2)-Wt*2:n-Wt*2},qo=(e,t)=>{let{height:n}=e;return Y(e)?n-Wt*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Wt*2:e.type==="diamond"?Math.round(n/2)-Wt*2:n-Wt*2},Gy=(e,t=`
9
9
 
10
- `)=>e.reduce((o,i)=>(te(i)&&o.push(i.text),o),[]).join(t);I();import{curvePointDistance as Qr,distanceToLineSegment as Jr,pointRotateRads as ea}from"@excalidraw/math";import{ellipse as B1,ellipseDistanceFromPoint as D1}from"@excalidraw/math/ellipse";var gn=(e,t,n)=>{switch(e.type){case"selection":case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return G1(e,t,n);case"diamond":return O1(e,t,n);case"ellipse":return R1(e,t,n);case"line":case"arrow":case"freedraw":return F1(e,t,n)}},G1=(e,t,n)=>{let o=de(e,t),i=ea(n,o,-e.angle),[r,a]=pn(e);return Math.min(...r.map(s=>Jr(i,s)),...a.map(s=>Qr(s,i)).filter(s=>s!==null))},O1=(e,t,n)=>{let o=de(e,t),i=ea(n,o,-e.angle),[r,a]=hn(e);return Math.min(...r.map(s=>Jr(i,s)),...a.map(s=>Qr(s,i)).filter(s=>s!==null))},R1=(e,t,n)=>{let o=de(e,t);return D1(ea(n,o,-e.angle),B1(o,e.width/2,e.height/2))},F1=(e,t,n)=>{let[o,i]=Wn(e,t);return Math.min(...o.map(r=>Jr(n,r)),...i.map(r=>Qr(r,n)))};I();var ta=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",qx=e=>e==="rectangle"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="text"||e==="embeddable",Kx=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",Qx=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",Cl=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image",Jx=e=>e==="arrow",ey=e=>e==="arrow";var Di=e=>{if(e.type==="arrow")return!1;let t=ta(e.type)&&!Nl(e.backgroundColor)||Tt(e)||Pi(e)||te(e);return e.type==="line"?t&&Ut(e.points):e.type==="freedraw"?t&&Ut(e.points):t||Ae(e)},na=null,Bl=null,Dl=1/0,Gl=!1,Ol=!1,Lt=({point:e,element:t,threshold:n,elementsMap:o,frameNameBound:i=null,overrideShouldTestInside:r=!1})=>{if(na&&Wl(e,na)&&Dl<=n&&r===Ol){let u=Bl?.deref();if(u&&u.id===t.id&&u.version===t.version&&u.versionNonce===t.versionNonce)return Gl}let a=i?oa(Pe(i.x-n,i.y-n),e,Pe(i.x+i.width+n,i.y+i.height+n)):!1,s=ue(t,o,!0);if(!_l(e,s,t.angle,n)&&!a)return!1;let c=(r||Di(t))&&Xt(e,t,o)||Rl(e,t,o,n)||a;return na=e,Bl=new WeakRef(t),Dl=n,Ol=r,Gl=c,c},_l=(e,t,n,o=0)=>{let i=n===0?e:it(e,En(t),-n);return oa(Pe(t[0]-o,t[1]-o),i,Pe(t[2]+o,t[3]+o))},V1=(e,t,n,o=0)=>{let i=ue(t,n,!0);return _l(e,i,t.angle,o)},fy=(e,t)=>!Lt(e)&&!Y1(e.point,e.element,t)&&V1(e.point,e.element,t),Y1=(e,t,n)=>{let o=Q(t,n);if(!o)return!1;let i=ne(t)?{...o,...D.getBoundTextElementPosition(t,o,n)}:o;return Xt(e,i,n)},jl=(e,[t,n],o,i=0)=>{let r=Pe(t,n),a=!ee(e),s=Math.max(1,i),l=[t-s,n-s,t+s,n+s],d=ue(e,o);if(!Qt(l,d))return!1;if(e.frameId){let h=o.get(e.frameId);if(h&&ee(h)){let m=ue(h,o);if(!Dt(r,m))return!1}}let c=Bt(e,o,Fo(de(e,o),r)),u=gn(e,o,r);return a?c.length===0||u<=i:c.length>0&&u<=s},Gi=(e,t,n,o)=>{let i=[];for(let r=t.length-1;r>=0;--r){let a=t[r];if(Fl(!a.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Ee(a,!1)&&jl(a,e,n,o)&&(i.push(a),ta(a.type)&&!Nl(a.backgroundColor)))break}return i},Kt=(e,t,n,o)=>{let i=Gi(e,t,n,o);return!i||i.length===0?null:i.length===1?i[0]:i.sort((r,a)=>a.width**2+a.height**2-(r.width**2+r.height**2)).pop()},Vl=(e,t,n,o,i)=>{let r=[];for(let s=n.length-1;s>=0;--s){let l=n[s];Fl(!l.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Ee(l,!1)&&jl(l,e,o,i)&&r.push(l)}if(!r||r.length===0)return null;if(r.length===1)return r[0];let a=r.filter(s=>gn(s,o,e)<=Ne(s,t)||Xt(e,s,o));return a.length===0?null:a[0]},Bt=(e,t,n,o=0,i=!1)=>{let r=[Math.min(n[0][0]-o,n[1][0]-o),Math.min(n[0][1]-o,n[1][1]-o),Math.max(n[0][0]+o,n[1][0]+o),Math.max(n[0][1]+o,n[1][1]+o)],a=ue(e,t);if(!Qt(r,a))return[];switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"selection":case"magicframe":return X1(e,t,n,o,i);case"diamond":return $1(e,t,n,o,i);case"ellipse":return Z1(e,t,n,o);case"line":case"freedraw":case"arrow":return U1(e,n,t,i)}},Yl=(e,t,n,o,i,r=!1)=>{for(let a of e){let s=Oi(a[0],a[1],a[2],a[3]),l=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])];if(!Qt(s,l))continue;let d=Hl(a,t);if(d.length>0){for(let c of d)n.push(it(c,o,i));if(r)return n}}return n},Ul=(e,t,n,o,i,r=!1)=>{for(let a of e){let s=zl(a,t);if(s&&(n.push(it(s,o,i)),r))return n}return n},U1=(e,t,n,o=!1)=>{let[i,r]=Wn(e,n),a=[];for(let s of i){let l=zl(s,t);if(l&&(a.push(l),o))return a}for(let s of r){let l=Oi(s[0],s[1],s[2],s[3]),d=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])];if(!Qt(l,d))continue;let c=Hl(s,t,{iterLimit:10});if(c.length>0&&(a.push(...c),o))return a}return a},X1=(e,t,n,o=0,i=!1)=>{let r=de(e,t),a=it(n[0],r,-e.angle),s=it(n[1],r,-e.angle),l=Fo(a,s),[d,c]=pn(e,o),u=[];return Ul(d,l,u,r,e.angle,i),i&&u.length>0||Yl(c,l,u,r,e.angle,i),u},$1=(e,t,n,o=0,i=!1)=>{let r=de(e,t),a=it(n[0],r,-e.angle),s=it(n[1],r,-e.angle),l=Fo(a,s),[d,c]=hn(e,o),u=[];return Ul(d,l,u,r,e.angle,i),i&&u.length>0||Yl(c,l,u,r,e.angle,i),u},Z1=(e,t,n,o=0)=>{let i=de(e,t),r=it(n[0],i,-e.angle),a=it(n[1],i,-e.angle);return j1(_1(i,e.width/2+o,e.height/2+o),Fo(r,a)).map(s=>it(s,i,e.angle))},Rl=(e,t,n,o=1)=>gn(t,n,e)<=o,Xt=(e,t,n)=>{if((ne(t)||Se(t))&&!Ut(t.points))return!1;let[o,i,r,a]=ue(t,n);if(!oa(Pe(o,i),e,Pe(r,a)))return!1;let s=Pe((o+r)/2,(i+a)/2),l=N1(W1(z1(H1(e,s,.1)),Math.max(t.width,t.height)*2),s),d=Fo(e,l);return Bt(t,n,d).filter((u,h,m)=>m.findIndex(g=>Wl(g,u))===h).length%2===1},ia=(e,t,n)=>{let o=(a,s)=>{let{x:l,y:d,width:c,height:u,angle:h}=a,m=de(a,n);if(a.type==="diamond"){let[f,E,x,y,w,M,b,S]=to(a);return[Pe(l+f,d+E-s),Pe(l+x+s,d+y),Pe(l+w,d+M+s),Pe(l+b-s,d+S)].map(k=>it(k,m,h))}if(a.type==="ellipse"){let f=l+c/2,E=d+u/2,x=c/2,y=u/2;return[Pe(f,E-y-s),Pe(f+x+s,E),Pe(f,E+y+s),Pe(f-x-s,E)].map(M=>it(M,m,h))}return[Pe(l-s,d-s),Pe(l+c+s,d-s),Pe(l+c+s,d+u+s),Pe(l-s,d+u+s)].map(f=>it(f,m,h))},i=-1*Math.max(e.width,e.height)/20;return o(e,i).every(a=>Xt(a,t,n))};I();import{invariant as Xl,isDevEnv as q1,isTestEnv as K1}from"@excalidraw/common";import{pointFrom as xn,pointFromVector as Ri,pointRotateRads as Fi,pointScaleFromOrigin as Ni,pointsEqual as Q1,triangleIncludesPoint as ra,vectorCross as Xe,vectorFromPoint as oe,vectorScale as Hi}from"@excalidraw/math";var be=[1,0],ke=[0,1],Ze=[-1,0],rt=[0,-1],Jt=e=>{let[t,n]=e,o=Math.abs(t),i=Math.abs(n);return t>i?be:t<=-i?Ze:n>o?ke:rt},$e=(e,t)=>Jt(oe(e,t)),yt=(e,t)=>qe($e(e,t)),we=(e,t)=>e[0]===t[0]&&e[1]===t[1],qe=e=>we(e,be)||we(e,Ze),by=e=>!qe(e),J1=(e,t,n)=>{let o=En(t);(q1()||K1())&&(Xl(e.width>0&&e.height>0,"Diamond element has no width or height"),Xl(!Q1(o,n),"The point is too close to the element mid point to determine heading"));let i=.95,r=Ri(Hi(oe(Fi(xn(e.x+e.width/2,e.y),o,e.angle),o),i),o),a=Ri(Hi(oe(Fi(xn(e.x+e.width,e.y+e.height/2),o,e.angle),o),i),o),s=Ri(Hi(oe(Fi(xn(e.x+e.width/2,e.y+e.height),o,e.angle),o),i),o),l=Ri(Hi(oe(Fi(xn(e.x,e.y+e.height/2),o,e.angle),o),i),o);if(Xe(oe(n,r),oe(r,a))<=0&&Xe(oe(n,r),oe(r,l))>0)return $e(r,o);if(Xe(oe(n,a),oe(a,s))<=0&&Xe(oe(n,a),oe(a,r))>0)return $e(a,o);if(Xe(oe(n,s),oe(s,l))<=0&&Xe(oe(n,s),oe(s,a))>0)return $e(s,o);if(Xe(oe(n,l),oe(l,r))<=0&&Xe(oe(n,l),oe(l,s))>0)return $e(l,o);if(Xe(oe(n,o),oe(r,o))<=0&&Xe(oe(n,o),oe(a,o))>0){let c=e.width>e.height?r:a;return $e(c,o)}else if(Xe(oe(n,o),oe(a,o))<=0&&Xe(oe(n,o),oe(s,o))>0){let c=e.width>e.height?s:a;return $e(c,o)}else if(Xe(oe(n,o),oe(s,o))<=0&&Xe(oe(n,o),oe(l,o))>0){let c=e.width>e.height?s:l;return $e(c,o)}let d=e.width>e.height?r:l;return $e(d,o)},No=(e,t,n)=>{let i=En(t);if(e.type==="diamond")return J1(e,t,n);let r=Ni(xn(t[0],t[1]),i,2),a=Ni(xn(t[2],t[1]),i,2),s=Ni(xn(t[0],t[3]),i,2),l=Ni(xn(t[2],t[3]),i,2);return ra([r,a,i],n)?rt:ra([a,l,i],n)?be:ra([l,s,i],n)?ke:Ze},aa=e=>[e[0]===0?0:e[0]>0?-1:1,e[1]===0?0:e[1]>0?-1:1];I();import{getSizeFromPoints as Eh,randomInteger as Ea,getUpdatedTimestamp as xa}from"@excalidraw/common";I();import{clamp as zi,pointDistance as da,pointFrom as Z,pointScaleFromOrigin as eh,pointsEqual as zo,pointTranslate as la,vector as Gt,vectorCross as Wi,vectorFromPoint as ca,vectorScale as th}from"@excalidraw/math";import{BinaryHeap as nh,invariant as oo,isAnyTrue as oh,getSizeFromPoints as $l,isDevEnv as ih,arrayToMap as rh}from"@excalidraw/common";var ua=1,ae=40,ah=(e,t)=>{let n=e.fixedSegments?e.fixedSegments.slice():null;if(n){let o=[];e.points.map(a=>Z(e.x+a[0],e.y+a[1])).forEach((a,s,l)=>{if(s<2)return o.push(a);let d=$e(a,l[s-1]),c=$e(l[s-1],l[s-2]);if(we(d,c)){let u=n?.findIndex(m=>m.index===s-1)??-1,h=n?.findIndex(m=>m.index===s)??-1;h!==-1&&(n[h].start=Z(l[s-2][0]-e.x,l[s-2][1]-e.y)),u!==-1&&n.splice(u,1),o.splice(-1,1),n.forEach(m=>{m.index>s-1&&(m.index-=1)})}return o.push(a)});let i=[];o.forEach((a,s,l)=>{if(s<3)return i.push(a);if(da(l[s-2],l[s-1])<ua){let d=n?.findIndex(h=>h.index===s-2)??-1,c=n?.findIndex(h=>h.index===s-1)??-1;c!==-1&&n.splice(c,1),d!==-1&&n.splice(d,1),i.splice(-2,2),n.forEach(h=>{h.index>s-2&&(h.index-=2)});let u=yt(a,l[s-1]);return i.push(Z(u?a[0]:l[s-2][0],u?l[s-2][1]:a[1]))}i.push(a)});let r=n.filter(a=>a.index!==1&&a.index!==i.length-1);return r.length===0?en(ma(fa(ha(e,pa(e,t,i.map(a=>Z(a[0]-e.x,a[1]-e.y))))??[])),r,null,null):(ih()&&oo(td(i),"Invalid elbow points with fixed segments"),en(i,r,e.startIsSpecial,e.endIsSpecial))}return{x:e.x,y:e.y,points:e.points,fixedSegments:e.fixedSegments,startIsSpecial:e.startIsSpecial,endIsSpecial:e.endIsSpecial}},sh=(e,t,n)=>{let o=t.map(T=>T.index),r=(e.fixedSegments?.map(T=>T.index)??[]).findIndex(T=>!o.includes(T));if(r===-1||!e.fixedSegments?.[r])return{points:e.points};let a=e.fixedSegments[r].index,s=e.fixedSegments[r-1],l=e.fixedSegments[r+1],d=e.x+(s?s.end[0]:0),c=e.y+(s?s.end[1]:0),u=s?null:e.startBinding,h=l?null:e.endBinding,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...w}=pa({x:d,y:c,startBinding:u,endBinding:h,startArrowhead:null,endArrowhead:null,points:e.points},n,[Z(0,0),Z(e.x+(l?.start[0]??e.points[e.points.length-1][0])-d,e.y+(l?.start[1]??e.points[e.points.length-1][1])-c)],{isDragging:!1}),{points:M}=en(ma(fa(ha(e,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...w})??[])),t,null,null);if(!M||M.length<2)throw new Error("Property 'points' is required in the update returned by normalizeArrowElementUpdate()");let b=[];if(s)for(let T=0;T<s.index;T++)b.push(Z(e.x+e.points[T][0],e.y+e.points[T][1]));if(M.forEach(T=>{b.push(Z(e.x+(s?s.end[0]:0)+T[0],e.y+(s?s.end[1]:0)+T[1]))}),l)for(let T=l.index;T<e.points.length;T++)b.push(Z(e.x+e.points[T][0],e.y+e.points[T][1]));let S=(l?.index??e.points.length)-(s?.index??0)-1,v=t.map(T=>T.index>a?{...T,index:T.index-S+(M.length-1)}:T),k=b.flatMap((T,R)=>{let O=b[R-1],N=b[R+1];if(O&&N){let G=$e(T,O),q=$e(N,T);if(we(G,q))return v.forEach(U=>{U.index>R&&(U.index-=1)}),[];if(we(G,aa(q)))return v.forEach(U=>{U.index>R&&(U.index+=1)}),[T,T]}return[T]});return en(k,v,!1,!1)},lh=(e,t,n,o,i,r)=>{let a=t.map((b,S)=>e.fixedSegments==null||e.fixedSegments[S]===void 0||e.fixedSegments[S].index!==b.index||(b.start[0]!==e.fixedSegments[S].start[0]&&b.end[0]!==e.fixedSegments[S].end[0])!=(b.start[1]!==e.fixedSegments[S].start[1]&&b.end[1]!==e.fixedSegments[S].end[1])?S:null).filter(b=>b!==null).shift();if(a==null)return{points:e.points};let s=e.fixedSegments?.findIndex(b=>b.index===1)??-1,l=e.fixedSegments?.findIndex(b=>b.index===e.points.length-1)??-1,d=da(t[a].start,t[a].end),c=d<ae+5;if(s===-1&&t[a].index===1&&i){let b=qe(n),v=(b?we(n,be):we(n,ke))?c?d/2:ae:c?-d/2:-ae;t[a].start=Z(t[a].start[0]+(b?v:0),t[a].start[1]+(b?0:v))}if(l===-1&&t[a].index===e.points.length-1&&r){let b=qe(o),v=(b?we(o,be):we(o,ke))?c?d/2:ae:c?-d/2:-ae;t[a].end=Z(t[a].end[0]+(b?v:0),t[a].end[1]+(b?0:v))}let u=t.map(b=>({...b,start:Z(e.x+b.start[0],e.y+b.start[1]),end:Z(e.x+b.end[0],e.y+b.end[1])})),h=e.points.map((b,S)=>Z(e.x+b[0],e.y+b[1])),m=u[a].index-1,g=u[a].index,f=u[a].start,E=u[a].end,x=h[m-1]&&!zo(h[m],h[m-1])?yt(h[m-1],h[m]):void 0,y=h[g+1]&&!zo(h[g],h[g+1])?yt(h[g+1],h[g]):void 0;if(x!==void 0){let b=x?1:0;h[m-1][b]=f[b]}if(h[m]=f,h[g]=E,y!==void 0){let b=y?1:0;h[g+1][b]=E[b]}let w=u.findIndex(b=>b.index===m);if(w!==-1){let b=yt(u[w].end,u[w].start)?1:0;u[w].start[b]=f[b],u[w].end=f}let M=u.findIndex(b=>b.index===g+1);if(M!==-1){let b=yt(u[M].end,u[M].start)?1:0;u[M].end[b]=E[b],u[M].start=E}if(s===-1&&m===0){let b=i?qe(n):yt(h[1],h[0]);h.unshift(Z(b?f[0]:e.x+e.points[0][0],b?e.y+e.points[0][1]:f[1])),i&&h.unshift(Z(e.x+e.points[0][0],e.y+e.points[0][1]));for(let S of u)S.index+=i?2:1}if(l===-1&&g===e.points.length-1){let b=qe(o);h.push(Z(b?E[0]:e.x+e.points[e.points.length-1][0],b?e.y+e.points[e.points.length-1][1]:E[1])),r&&h.push(Z(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]))}return en(h,u.map(b=>({...b,start:Z(b.start[0]-e.x,b.start[1]-e.y),end:Z(b.end[0]-e.x,b.end[1]-e.y)})),!1,!1)},dh=(e,t,n,o,i,r,a,s,l)=>{let d=e.startIsSpecial??null,c=e.endIsSpecial??null,u=t.map((E,x)=>x===0?Z(e.x+E[0],e.y+E[1]):x===t.length-1?Z(e.x+E[0],e.y+E[1]):Z(e.x+e.points[x][0],e.y+e.points[x][1])),h=n.map(E=>({...E,start:Z(e.x+(E.start[0]-t[0][0]),e.y+(E.start[1]-t[0][1])),end:Z(e.x+(E.end[0]-t[0][0]),e.y+(E.end[1]-t[0][1]))})),m=[],g=2+(d?1:0),f=2+(c?1:0);for(;m.length+g<u.length-f;)m.push(u[m.length+g]);{let E=u.at(d?2:1),x=u.at(d?3:2);if(!E||!x)throw new Error(`Second and third points must exist when handling endpoint drag (${d})`);let y=qe(o),w=qe(Jt(ca(E,x)));if(s&&y===w){let M=y?we(o,be):we(o,ke);if(m.unshift(Z(w?r[0]+(M?ae:-ae):x[0],w?x[1]:r[1]+(M?ae:-ae))),m.unshift(Z(y?r[0]+(M?ae:-ae):r[0],y?r[1]:r[1]+(M?ae:-ae))),!d){d=!0;for(let b of h)b.index>1&&(b.index+=1)}}else if(m.unshift(Z(w?r[0]:E[0],w?E[1]:r[1])),d){d=!1;for(let M of h)M.index>1&&(M.index-=1)}m.unshift(r)}{let E=u.at(u.length-(c?3:2)),x=u.at(u.length-(c?4:3));if(!E||!x)throw new Error(`Second and third to last points must exist when handling endpoint drag (${c})`);let y=qe(i),w=yt(x,E);if(l&&y===w){let M=y?we(i,be):we(i,ke);m.push(Z(w?a[0]+(M?ae:-ae):x[0],w?x[1]:a[1]+(M?ae:-ae))),m.push(Z(y?a[0]+(M?ae:-ae):a[0],y?a[1]:a[1]+(M?ae:-ae))),c||(c=!0)}else m.push(Z(w?a[0]:E[0],w?E[1]:a[1])),c&&(c=!1)}return m.push(a),en(m,h.map(({index:E})=>({index:E,start:m[E-1],end:m[E]})).map(E=>({...E,start:Z(E.start[0]-r[0],E.start[1]-r[1]),end:Z(E.end[0]-r[0],E.end[1]-r[1])})),d,c)},yn=1e6,io=(e,t,n,o)=>{if(e.points.length<2)return{points:n.points??e.points};C.PROD||(oo(!n.points||n.points.length>=2,"Updated point array length must match the arrow point length, contain exactly the new start and end points or not be specified at all (i.e. you can't add new points between start and end manually to elbow arrows)"),oo(!e.fixedSegments||e.fixedSegments.map(b=>b.start[0]===b.end[0]||b.start[1]===b.end[1]).every(Boolean),"Fixed segments must be either horizontal or vertical"),oo(!n.fixedSegments||n.fixedSegments.map(b=>b.start[0]===b.end[0]||b.start[1]===b.end[1]).every(Boolean),"Updates to fixed segments must be either horizontal or vertical"),oo(e.points.slice(1).map((b,S)=>b[0]===e.points[S][0]||b[1]===e.points[S][1]),"Elbow arrow segments must be either horizontal or vertical"),oo(n.fixedSegments?.find(b=>b.index===1&&zo(b.start,(n.points??e.points)[0]))==null&&n.fixedSegments?.find(b=>b.index===(n.points??e.points).length-1&&zo(b.end,(n.points??e.points)[(n.points??e.points).length-1]))==null,"The first and last segments cannot be fixed"));let i=n.fixedSegments??e.fixedSegments??[],r=n.points?n.points&&n.points.length===2?e.points.map((b,S)=>S===0?n.points[0]:S===e.points.length-1?n.points[1]:b):n.points.slice():e.points.slice(),{startBinding:a,endBinding:s,...l}=n,d=typeof a<"u"?a:e.startBinding,c=typeof s<"u"?s:e.endBinding,u=d&&ji(d.elementId,t),h=c&&ji(c.elementId,t),m=td(r);if(d&&!u&&m||c&&!h&&m||t.size===0&&m||Object.keys(l).length===0&&(u?.id!==d?.elementId||h?.id!==c?.elementId))return en(r.map(b=>Z(e.x+b[0],e.y+b[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial);let{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:w,...M}=pa({x:e.x,y:e.y,startBinding:d,endBinding:c,startArrowhead:e.startArrowhead,endArrowhead:e.endArrowhead,points:e.points},t,r,o);return t.size===0&&m?en(r.map(b=>Z(e.x+b[0],e.y+b[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial):!n.points&&!n.fixedSegments&&!n.startBinding&&!n.endBinding?ah(e,t):n.startBinding===e.startBinding&&n.endBinding===e.endBinding&&(n.points??[]).every((b,S)=>zo(b,e.points[S]??Z(1/0,1/0)))&&m?{}:i.length===0?en(ma(fa(ha(e,{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:w,...M})??[])),i,null,null):(e.fixedSegments?.length??0)>i.length?sh(e,i,t):n.points?n.points&&n.fixedSegments?n:dh(e,r,i,g,f,E,x,y,w):lh(e,i,g,f,y,w)},pa=(e,t,n,o)=>{let i=la(n[0],Gt(e.x,e.y)),r=la(n[n.length-1],Gt(e.x,e.y)),a=null,s=null;if(o?.isDragging&&o?.isBindingEnabled!==!1){let b=Array.from(t.values());a=Ql(i,t,b,o?.zoom)||null,s=Ql(r,t,b,o?.zoom)||null}else a=e.startBinding&&ji(e.startBinding.elementId,t)||null,s=e.endBinding&&ji(e.endBinding.elementId,t)||null;let l=ql({...e,angle:0,type:"arrow",elbowed:!0,points:n},"start",e.startBinding?.fixedPoint,i,a,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),d=ql({...e,angle:0,type:"arrow",elbowed:!0,points:n},"end",e.endBinding?.fixedPoint,r,s,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),c=Kl(l,d,a,i,t,o?.zoom),u=Kl(d,l,s,r,t,o?.zoom),h=[l[0]-2,l[1]-2,l[0]+2,l[1]+2],m=[d[0]-2,d[1]-2,d[0]+2,d[1]+2],g=a?ut(a,t,wn(c,e.startArrowhead?Ne(a,{elbowed:!0})*6:Ne(a,{elbowed:!0})*2,1)):h,f=s?ut(s,t,wn(u,e.endArrowhead?Ne(s,{elbowed:!0})*6:Ne(s,{elbowed:!0})*2,1)):m,E=Dt(l,s?ut(s,t,wn(u,ae,ae)):m)||Dt(d,a?ut(a,t,wn(c,ae,ae)):h),x=ed(E?[h,m]:[g,f]),y=ph(E?h:g,E?m:f,x,E?wn(c,!a&&!s?0:ae,0):wn(c,!a&&!s?0:ae-(e.startArrowhead?Vn*6:Vn*2),ae),E?wn(u,!a&&!s?0:ae,0):wn(u,!a&&!s?0:ae-(e.endArrowhead?Vn*6:Vn*2),ae),E,a&&ut(a,t),s&&ut(s,t)),w=Zl(y[0],c,l),M=Zl(y[1],u,d);return{dynamicAABBs:y,startDonglePosition:w,startGlobalPoint:l,startHeading:c,endDonglePosition:M,endGlobalPoint:d,endHeading:u,commonBounds:x,hoveredStartElement:a,hoveredEndElement:s,boundsOverlap:E,startElementBounds:g,endElementBounds:f}},ha=(e,t)=>{let{dynamicAABBs:n,startDonglePosition:o,startGlobalPoint:i,startHeading:r,endDonglePosition:a,endGlobalPoint:s,endHeading:l,commonBounds:d,hoveredEndElement:c}=t,u=hh(n,o||i,r,a||s,l,d),h=o&&_i(o,u),m=a&&_i(a,u),g=_i(s,u);g&&c&&(g.closed=!0);let f=_i(i,u);f&&e.startBinding&&(f.closed=!0);let E=h&&m&&(Dt(h.pos,n[1])||Dt(m.pos,n[0])),x=ch(h||f,m||g,u,r||be,l||be,E?[]:n);if(x){let y=x.map(w=>[w.pos[0],w.pos[1]]);return h&&y.unshift(i),m&&y.push(s),y}return null},wn=(e,t,n)=>{switch(e){case rt:return[t,n,n,n];case be:return[n,t,n,n];case ke:return[n,n,t,n]}return[n,n,n,t]},ch=(e,t,n,o,i,r)=>{let a=sa(e.pos,t.pos),s=new nh(l=>l.f);for(s.push(e);s.size()>0;){let l=s.pop();if(!l||l.closed)continue;if(l===t)return uh(e,l);l.closed=!0;let d=fh(l.addr,n);for(let c=0;c<4;c++){let u=d[c];if(!u||u.closed)continue;let h=eh(u.pos,l.pos,.5);if(oh(...r.map(M=>Dt(h,M))))continue;let m=gh(c),g=l.parent?Jt(ca(l.pos,l.parent.pos)):o,f=aa(g);if(we(f,m)||Jl(e.addr,u.addr)&&we(m,o)||Jl(t.addr,u.addr)&&we(m,i))continue;let x=g!==m,y=l.g+sa(u.pos,l.pos)+(x?Math.pow(a,3):0),w=u.visited;if(!w||y<u.g){let M=mh(u,t,m,i);u.visited=!0,u.parent=l,u.h=sa(t.pos,u.pos)+M*Math.pow(a,2),u.g=y,u.f=u.g+u.h,w?s.rescoreElement(u):s.push(u)}}}return null},uh=(e,t)=>{let n=t,o=[];for(;n.parent;)o.unshift(n),n=n.parent;return o.unshift(e),o},sa=(e,t)=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),ph=(e,t,n,o,i,r,a,s)=>{let l=a??e,d=s??t,[c,u,h,m]=o??[0,0,0,0],[g,f,E,x]=i??[0,0,0,0],y=[e[0]>t[2]?e[1]>t[3]||e[3]<t[1]?Math.min((l[0]+d[2])/2,e[0]-m):(l[0]+d[2])/2:e[0]>t[0]?e[0]-m:n[0]-m,e[1]>t[3]?e[0]>t[2]||e[2]<t[0]?Math.min((l[1]+d[3])/2,e[1]-c):(l[1]+d[3])/2:e[1]>t[1]?e[1]-c:n[1]-c,e[2]<t[0]?e[1]>t[3]||e[3]<t[1]?Math.max((l[2]+d[0])/2,e[2]+u):(l[2]+d[0])/2:e[2]<t[2]?e[2]+u:n[2]+u,e[3]<t[1]?e[0]>t[2]||e[2]<t[0]?Math.max((l[3]+d[1])/2,e[3]+h):(l[3]+d[1])/2:e[3]<t[3]?e[3]+h:n[3]+h],w=[t[0]>e[2]?t[1]>e[3]||t[3]<e[1]?Math.min((d[0]+l[2])/2,t[0]-x):(d[0]+l[2])/2:t[0]>e[0]?t[0]-x:n[0]-x,t[1]>e[3]?t[0]>e[2]||t[2]<e[0]?Math.min((d[1]+l[3])/2,t[1]-g):(d[1]+l[3])/2:t[1]>e[1]?t[1]-g:n[1]-g,t[2]<e[0]?t[1]>e[3]||t[3]<e[1]?Math.max((d[2]+l[0])/2,t[2]+f):(d[2]+l[0])/2:t[2]<e[2]?t[2]+f:n[2]+f,t[3]<e[1]?t[0]>e[2]||t[2]<e[0]?Math.max((d[3]+l[1])/2,t[3]+E):(d[3]+l[1])/2:t[3]<e[3]?t[3]+E:n[3]+E],M=ed([y,w]);if(!r&&y[2]-y[0]+w[2]-w[0]>M[2]-M[0]+1e-11&&y[3]-y[1]+w[3]-w[1]>M[3]-M[1]+1e-11){let[b,S]=[(w[0]+w[2])/2,(w[1]+w[3])/2];if(t[0]>e[2]&&e[1]>t[3]){let v=y[2]+(w[0]-y[2])/2,k=w[3]+(y[1]-w[3])/2;return Wi(Gt(e[2]-b,e[1]-S),Gt(e[0]-b,e[3]-S))>0?[[y[0],y[1],v,y[3]],[v,w[1],w[2],w[3]]]:[[y[0],k,y[2],y[3]],[w[0],w[1],w[2],k]]}else if(e[2]<t[0]&&e[3]<t[1]){let v=y[2]+(w[0]-y[2])/2,k=y[3]+(w[1]-y[3])/2;return Wi(Gt(e[0]-b,e[1]-S),Gt(e[2]-b,e[3]-S))>0?[[y[0],y[1],y[2],k],[w[0],k,w[2],w[3]]]:[[y[0],y[1],v,y[3]],[v,w[1],w[2],w[3]]]}else if(e[0]>t[2]&&e[3]<t[1]){let v=w[2]+(y[0]-w[2])/2,k=y[3]+(w[1]-y[3])/2;return Wi(Gt(e[2]-b,e[1]-S),Gt(e[0]-b,e[3]-S))>0?[[v,y[1],y[2],y[3]],[w[0],w[1],v,w[3]]]:[[y[0],y[1],y[2],k],[w[0],k,w[2],w[3]]]}else if(e[0]>t[2]&&e[1]>t[3]){let v=w[2]+(y[0]-w[2])/2,k=w[3]+(y[1]-w[3])/2;return Wi(Gt(e[0]-b,e[1]-S),Gt(e[2]-b,e[3]-S))>0?[[v,y[1],y[2],y[3]],[w[0],w[1],v,w[3]]]:[[y[0],k,y[2],y[3]],[w[0],w[1],w[2],k]]}}return[y,w]},hh=(e,t,n,o,i,r)=>{let a=new Set,s=new Set;n===Ze||n===be?s.add(t[1]):a.add(t[0]),i===Ze||i===be?s.add(o[1]):a.add(o[0]),e.forEach(c=>{a.add(c[0]),a.add(c[2]),s.add(c[1]),s.add(c[3])}),a.add(r[0]),a.add(r[2]),s.add(r[1]),s.add(r[3]);let l=Array.from(s).sort((c,u)=>c-u),d=Array.from(a).sort((c,u)=>c-u);return{row:l.length,col:d.length,data:l.flatMap((c,u)=>d.map((h,m)=>({f:0,g:0,h:0,closed:!1,visited:!1,parent:null,addr:[m,u],pos:[h,c]})))}},Zl=(e,t,n)=>{switch(t){case rt:return Z(n[0],e[1]);case be:return Z(e[2],n[1]);case ke:return Z(n[0],e[3])}return Z(e[0],n[1])},mh=(e,t,n,o)=>{if(o===be)switch(n){case be:return e.pos[0]>=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2;case rt:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case ke:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case Ze:return e.pos[1]===t.pos[1]?4:2}else if(o===Ze)switch(n){case be:return e.pos[1]===t.pos[1]?4:2;case rt:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case ke:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case Ze:return e.pos[0]<=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2}else if(o===rt)switch(n){case be:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case rt:return e.pos[1]>=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case ke:return e.pos[0]===t.pos[0]?4:2;case Ze:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3}else if(o===ke)switch(n){case be:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case rt:return e.pos[0]===t.pos[0]?4:2;case ke:return e.pos[1]<=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case Ze:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3}return 0},fh=([e,t],n)=>[Ho([e,t-1],n),Ho([e+1,t],n),Ho([e,t+1],n),Ho([e-1,t],n)],Ho=([e,t],n)=>e<0||e>=n.col||t<0||t>=n.row?null:n.data[t*n.col+e]??null,_i=(e,t)=>{for(let n=0;n<t.col;n++)for(let o=0;o<t.row;o++){let i=Ho([n,o],t);if(i&&e[0]===i.pos[0]&&e[1]===i.pos[1])return i}return null},ed=e=>[Math.min(...e.map(t=>t[0])),Math.min(...e.map(t=>t[1])),Math.max(...e.map(t=>t[2])),Math.max(...e.map(t=>t[3]))],ji=(e,t)=>{let n=t.get(e);return n&&Ee(n)?n:null},en=(e,t,n,o)=>{let i=e[0][0],r=e[0][1],a=e.map(s=>la(s,th(ca(e[0]),-1)));return(i<-yn||i>yn||r<-yn||r>yn||i+a[a.length-1][0]<-yn||i+a[a.length-1][0]>yn||r+a[a.length-1][1]<-yn||r+a[a.length-1][1]>yn)&&console.error("Elbow arrow normalization is outside reasonable bounds (> 1e6)",{x:i,y:r,points:a,...$l(a)}),a=a.map(([s,l])=>Z(zi(s,-1e6,1e6),zi(l,-1e6,1e6))),{points:a,x:zi(i,-1e6,1e6),y:zi(r,-1e6,1e6),fixedSegments:(t?.length??0)>0?t:null,...$l(a),startIsSpecial:n,endIsSpecial:o}},ma=e=>{if(e.length>1){let t=Math.abs(e[0][1]-e[1][1])<Math.abs(e[0][0]-e[1][0]);return e.filter((n,o)=>{if(o===0||o===e.length-1)return!0;let i=e[o+1],r=Math.abs(n[1]-i[1])<Math.abs(n[0]-i[0]);return t===r?(t=r,!1):(t=r,!0)})}return e},fa=e=>e.length>=4?e.filter((t,n)=>{if(n===0||n===e.length-1)return!0;let o=e[n-1];return da(o,t)>ua}):e,gh=e=>{switch(e){case 0:return rt;case 1:return be;case 2:return ke}return Ze},ql=(e,t,n,o,i,r,a,s=!0,l=!0)=>a?s&&i&&r?ga(e,i,t,r,void 0,l):o:i?Ue(n||[0,0],i,r??rh([i])):o,Kl=(e,t,n,o,i,r)=>nd(e,t,n,n&&ut(n,i,Array(4).fill(gn(n,i,e))),o,i,r),Ql=(e,t,n,o)=>Kt(e,n,t,Et(o)),Jl=(e,t)=>e[0]===t[0]&&e[1]===t[1],td=(e,t=ua)=>e.slice(1).map((n,o)=>Math.abs(n[0]-e[o][0])<t||Math.abs(n[1]-e[o][1])<t).every(Boolean);var Te=(e,t,n,o)=>{let i=!1,{points:r,fixedSegments:a,fileId:s}=n;Y(e)&&(Object.keys(n).length===0||typeof r<"u"||typeof a<"u")?n={...n,angle:0,...io({...e,x:n.x||e.x,y:n.y||e.y},t,n,o)}:typeof r<"u"&&(n={...Eh(r),...n});for(let l in n){let d=n[l];if(typeof d<"u"){if(e[l]===d&&(typeof d!="object"||d===null||l==="groupIds"||l==="scale"))continue;if(l==="scale"){let c=e[l],u=d;if(c[0]===u[0]&&c[1]===u[1])continue}else if(l==="points"){let c=e[l],u=d;if(c.length===u.length){let h=!1,m=c.length;for(;--m;){let g=c[m],f=u[m];if(g[0]!==f[0]||g[1]!==f[1]){h=!0;break}}if(!h)continue}}e[l]=d,i=!0}}return i&&((typeof n.height<"u"||typeof n.width<"u"||typeof s<"u"||typeof r<"u")&&at.delete(e),e.version=n.version??e.version+1,e.versionNonce=n.versionNonce??Ea(),e.updated=xa()),e},He=(e,t,n=!1)=>{let o=!1;for(let i in t){let r=t[i];if(typeof r<"u"){if(e[i]===r&&(typeof r!="object"||r===null))continue;o=!0}}return!o&&!n?e:{...e,...t,version:t.version??e.version+1,versionNonce:t.versionNonce??Ea(),updated:xa()}},od=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=Ea(),e.updated=xa(),e);var dd=5,Vn=5,bh=10,Vo=10/1.5,Ne=(e,t)=>(t.elbowed?Vn:dd)+e.strokeWidth/2,Et=e=>{let t=Math.max(dd,15),n=e?.value&&e.value<1?e.value:1;return wa(t/(n*1.5),t,t*2)},Ot=e=>e.isBindingEnabled,Mh=(e,t,n,o,i,r,a)=>{let{start:s,end:l}=ba(e,t,n,o,i.getNonDeletedElementsMap(),i.getNonDeletedElements(),r,{...a,finalize:!0});if(id(e,s,"start",i,r.isBindingEnabled),id(e,l,"end",i,r.isBindingEnabled),s.focusPoint||l.focusPoint){let d=new Map;s.focusPoint&&d.set(0,{point:bt(e,"startBinding",e.startBinding,s.element,i.getNonDeletedElementsMap())||e.points[0]}),l.focusPoint&&d.set(e.points.length-1,{point:bt(e,"endBinding",e.endBinding,l.element,i.getNonDeletedElementsMap())||e.points[e.points.length-1]}),D.movePoints(e,i,d)}return{start:s,end:l}},id=(e,{mode:t,element:n,focusPoint:o},i,r,a=!0)=>{t===null?Oe(e,i,r):t!==void 0&&Rt(e,n,t,i,r,o,a)},cd=(e,t,n,o,i)=>{wt(t.size===1,"Bound elbow arrows cannot be moved");let r=t.entries().next().value;wt(r,"There should be a position update for dragging an elbow arrow endpoint");let[a,{point:s}]=r,l=D.getPointGlobalCoordinates(e,s,n),d=Kt(l,o,n,Et(i)),c=d?{element:d,mode:"orbit",focusPoint:D.getPointAtIndexGlobalCoordinates(e,a,n)}:{mode:null},u={mode:void 0};return a===0?{start:c,end:u}:{start:u,end:c}},Ph=(e,t,n,o,i,r,a,s,l,d,c)=>{let u={mode:void 0},h={mode:void 0},m=e.points.length>2,g=D.getPointGlobalCoordinates(e,t.get(i?a:s).point,n),f=Kt(g,o,n);if(i)return f?u={element:f,mode:"inside",focusPoint:g}:u={mode:null},{start:u,end:h};if(r){let E=l?.selectedLinearElement?.initialState.origin;if(f&&e.startBinding?.elementId===f.id){let x=se(f.x+f.width/2,f.y+f.height/2);return{start:m?{mode:void 0}:{mode:"inside",element:f,focusPoint:E??x},end:m?{mode:"orbit",element:f,focusPoint:g}:{mode:"inside",element:f,focusPoint:g}}}if(f&&e.startBinding){let x=e.startBinding;if(Gi(g,o,n).find(w=>w.id===x.elementId)){let w=n.get(e.startBinding.elementId);return wt(w,"Other element must be in the elements map"),{start:m?{mode:void 0}:{mode:w.id!==f.id?"orbit":"inside",element:w,focusPoint:E??se(e.x,e.y)},end:{mode:"orbit",element:f,focusPoint:g}}}}if(e.startBinding&&e.startBinding.elementId!==f?.id){let x=n.get(e.startBinding.elementId);wt(x,"Other element must be in the elements map");let w={mode:!!l.selectedLinearElement?.initialState.arrowStartIsInside?"inside":"orbit",element:x,focusPoint:c?de(x,n):E??se(e.x,e.y)},M=f&&ia(x,f,n),b;if(f){let S=d==="inside"||d==="skip";b={mode:S&&!M?"inside":"orbit",element:f,focusPoint:g}}else b={mode:null};return{start:m?{mode:void 0}:w,end:b}}if(!e.startBinding)return f?h={mode:d==="inside"||d==="skip"?"inside":"orbit",element:f,focusPoint:g}:h={mode:null},{start:u,end:h}}wt(!1,"New arrow creation should not reach here")},rd=(e,t,n,o,i,r,a,s)=>{let l={mode:void 0},d={mode:void 0},c=a.points.length>2,u=Kt(e,i,o),h=n?Gi(e,i,o).some(E=>E.id===n.elementId):!1,m=n?o.get(n.elementId):null,g=h&&m?yh(m.backgroundColor):!1,f=u&&m&&ia(m,u,o);return r==="inside"||r==="skip"?(l=u?{element:!h||!m||g?u:m,focusPoint:e,mode:"inside"}:{mode:null},d=s&&u&&u.id===n?.elementId?{mode:null}:d,{current:l,other:d}):u?u.id===t?.elementId&&t.mode==="inside"?{current:{mode:"inside",focusPoint:e,element:u},other:d}:n?n.elementId===u.id?n.mode==="orbit"?(l={element:u,mode:"orbit",focusPoint:e},d={mode:s?null:void 0},{current:l,other:c?{mode:void 0}:d}):(l={element:u,mode:"inside",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):(h&&m&&!g?l={element:m,mode:"inside",focusPoint:e}:l={element:u,mode:"orbit",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):(l={element:u,mode:"orbit",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):{current:{mode:null},other:d}},ba=(e,t,n,o,i,r,a,s)=>xh("COMPLEX_BINDINGS")?Ih(e,t,i,r,a,s):ud(e,t,n,o,i,r,a,s),ud=(e,t,n,o,i,r,a,s)=>{let d=e.points.length-1,c=t.has(0),u=t.has(d),h={mode:void 0},m={mode:void 0};if(wt(e.points.length>1,"Do not attempt to bind linear elements with a single point"),!c&&!u)return{start:h,end:m};if(c&&u)return{start:{mode:null},end:{mode:null}};if(!Ot(a))return h=c?{mode:null}:h,m=u?{mode:null}:m,{start:h,end:m};if(Y(e))return cd(e,t,i,r,s?.zoom);let g=c?e.endBinding:e.startBinding,f=t.get(c?0:d)?.point;wt(f,`Local point must be defined for ${c?"start":"end"} dragging`);let E=D.getPointGlobalCoordinates(e,f,i),x=Kt(E,r,i,Et(a.zoom)),y=x&&(s?.angleLocked?Xt(se(n,o),x,i):Xt(E,x,i)),w=g?i.get(g.elementId):void 0,M=g&&w&&Ue(g.fixedPoint,w,i),b=w&&M&&Lt({point:M,element:w,elementsMap:i,threshold:0,overrideShouldTestInside:!0});if(g&&g.elementId===x?.id&&(!s?.newArrow||a.selectedLinearElement?.initialState.origin))return{start:{mode:"inside",element:x,focusPoint:c?E:s?.newArrow?a.selectedLinearElement.initialState.origin:D.getPointAtIndexGlobalCoordinates(e,0,i)},end:{mode:"inside",element:x,focusPoint:u?E:D.getPointAtIndexGlobalCoordinates(e,-1,i)}};if(s?.altKey)return{start:c?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:h,end:u?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:m};let S=x?y?{mode:"inside",element:x,focusPoint:E}:{mode:"orbit",element:x,focusPoint:eo(e,E,x,c?"start":"end",i,a.zoom,a.isMidpointSnappingEnabled)||E}:{mode:null},v=D.getPointAtIndexGlobalCoordinates(e,c?-1:0,i),k=M&&w&&Lt({point:E,element:w,elementsMap:i,threshold:Et(a.zoom),overrideShouldTestInside:!0}),R=(s?.newArrow?a.selectedLinearElement?.initialState.arrowStartIsInside:g?.mode==="inside")?{mode:void 0}:w&&!b&&!k&&a.selectedLinearElement?.initialState.altFocusPoint?{mode:"orbit",element:w,focusPoint:a.selectedLinearElement.initialState.altFocusPoint}:s?.angleLocked&&w?{mode:"orbit",element:w,focusPoint:eo(e,v,w,c?"end":"start",i,a.zoom,a.isMidpointSnappingEnabled)||v}:{mode:void 0};return{start:c?S:R,end:u?S:R}},Ih=(e,t,n,o,i,r)=>{let a=i.bindMode||"orbit",s=0,l=e.points.length-1,d=t.has(s),c=t.has(l),u={mode:void 0},h={mode:void 0};if(wt(e.points.length>1,"Do not attempt to bind linear elements with a single point"),!d&&!c)return{start:u,end:h};if(d&&c)return{start:{mode:null},end:{mode:null}};if(!Ot(i))return u=d?{mode:null}:u,h=c?{mode:null}:h,{start:u,end:h};if(Y(e))return cd(e,t,n,o);if(r?.newArrow){let{start:m,end:g}=Ph(e,t,n,o,d,c,s,l,i,a,r?.shiftKey);return{start:m,end:g}}if(d){let m=t.get(s)?.point;wt(m,"Local point must be defined for start dragging");let g=D.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=rd(g,e.startBinding,e.endBinding,n,o,a,e,r?.finalize);return{start:f,end:E}}if(c){let m=t.get(l)?.point;wt(m,"Local point must be defined for end dragging");let g=D.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=rd(g,e.endBinding,e.startBinding,n,o,a,e,r?.finalize);return{start:E,end:f}}return{start:u,end:h}},Jy=(e,t,n)=>{e.forEach(o=>{Mh(o,new Map,1/0,1/0,t,n)})},Rt=(e,t,n,o,i,r,a=!0)=>{let s=i.getNonDeletedElementsMap(),l;Y(e)?l={elementId:t.id,mode:"orbit",...Lh(e,t,o,s,a)}:l={elementId:t.id,mode:n,...ro(e,t,o,s,r)},i.mutateElement(e,{[o==="start"?"startBinding":"endBinding"]:l}),ld(t.boundElements||[]).has(e.id)||i.mutateElement(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},Oe=(e,t,n)=>{let o=t==="start"?"startBinding":"endBinding",i=e[o];if(i==null)return null;let r=e[t==="start"?"endBinding":"startBinding"];if(!r||r.elementId!==i.elementId){let a=n.getNonDeletedElementsMap().get(i.elementId);n.mutateElement(a,{boundElements:a.boundElements?.filter(s=>s.id!==e.id)})}return n.mutateElement(e,{[o]:null}),i.elementId},Re=(e,t,n)=>{if(!Ee(e))return;let{simultaneouslyUpdated:o}=n??{},i=vh(o),r=t.getNonDeletedElementsMap();n?.changedElements&&(r=new Map(r),n.changedElements.forEach(s=>{r.set(s.id,s)})),Xi(r,e,s=>{if(!j(s)||s.isDeleted||!Sh(s,e))return;let l=s.startBinding?r.get(s.startBinding.elementId):null,d=s.endBinding?l?.id===s.endBinding.elementId?l:r.get(s.endBinding.elementId):null;if(i.has(s.id))return;let c=$i(r,s,(h,m)=>{if(h&&Ee(h)&&(m==="startBinding"||m==="endBinding")&&(e.id===s[m]?.elementId||e.id===s[m==="startBinding"?"endBinding":"startBinding"]?.elementId)){let g=bt(s,m,s[m],h,r);if(g)return[m==="startBinding"?0:s.points.length-1,{point:g}]}return null}).filter(h=>h!==null);D.movePoints(s,t,new Map(c),{moveMidPointsWithElement:!!l&&l?.id===d?.id});let u=Q(s,r);u&&!u.isDeleted&&jn(s,t,!1)})},ad=(e,t,n,o,i)=>{wt(!Y(e),"Elbow arrows not supported for indirect updates");let r=e[t],a=r&&n.get(r.elementId),s=D.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?0:-1,n),l=a&&Lt({element:a,point:s,elementsMap:n,threshold:Et(i.zoom)}),d=t==="startBinding"?"start":"end";if(Oe(e,d,o),l){let c=t==="startBinding"?0:e.points.length-1,u=e.points[c],h=ud(e,new Map([[c,{point:u}]]),s[0],s[1],n,o.getNonDeletedElements(),i);h[d]&&h[d].element?.id===a.id&&h[d].mode&&Rt(e,a,h[d].mode,d,o,h[d].focusPoint)}},e3=(e,t,n,o)=>{if(j(e)){let i=t.getNonDeletedElementsMap();e.startBinding&&ad(e,"startBinding",i,t,n),e.endBinding&&ad(e,"endBinding",i,t,n)}else Re(e,t,{...o,changedElements:new Map([[e.id,e]])})},Sh=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,vh=e=>new Set((e||[]).map(t=>t.id)),nd=(e,t,n,o,i,r,a)=>{let s=Jt(Wo(t,e));return!n||!o?s:Ah(i,n,r,a)?No(n,o,e):Jt(Wo(e,de(n,r)))},Ah=(e,t,n,o)=>{let i=gn(t,n,e),r=Et(o);return i>r?null:i},ga=(e,t,n,o,i,r=!0)=>{let a=Y(e),s=D.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o);if(e.points.length<2)return s;let l=cl(t)&&a?kh(e,t,o,s):s,d=i&&!a?i[1]:D.getPointAtIndexGlobalCoordinates(e,n==="start"?1:-2,o),c=Ne(t,e),u=ut(t,o),h=En(u),m=null;if(a){let g=qe(No(t,u,s)),E=(r?Ma(t,o,l,.05,e):void 0)||s,x=se(g?h[0]:E[0],g?E[1]:h[1]),y=i??Ui(x,Vi(Yi(ya(Wo(E,x)),Math.max(t.width,t.height)*2),x));if(m=Bt(t,o,y,c).sort(tn)[0],!m){let w=se(g?E[0]:h[0],g?h[1]:E[1]),M=Ui(w,Vi(Yi(ya(Wo(E,w)),Math.max(t.width,t.height)*2),w));m=Bt(t,o,M,Vn).sort(tn)[0]}}else{let g=i;if(!g){let f=Yi(ya(Wo(l,d)),bn(l,d)+Math.max(t.width,t.height)+c*2);g=i??Ui(Vi(f,d),Vi(Yi(f,-1),d))}m=bn(l,d)<1?l:Bt(t,o,g,c).sort((f,E)=>tn(f,d)-tn(E,d))[0]}return!m||tn(l,m)<jo?l:m},kh=(e,t,n,o)=>{let i=de(t,n),r=pe(o,i,-t.angle),a=Ne(t,e);return r[0]<t.x&&r[1]<t.y?r[1]-t.y>-a?pe(se(t.x-a,t.y),i,t.angle):pe(se(t.x,t.y-a),i,t.angle):r[0]<t.x&&r[1]>t.y+t.height?r[0]-t.x>-a?pe(se(t.x,t.y+t.height+a),i,t.angle):pe(se(t.x-a,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]>t.y+t.height?r[0]-t.x<t.width+a?pe(se(t.x+t.width,t.y+t.height+a),i,t.angle):pe(se(t.x+t.width+a,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]<t.y?r[0]-t.x<t.width+a?pe(se(t.x+t.width,t.y-a),i,t.angle):pe(se(t.x+t.width+a,t.y),i,t.angle):o},Ma=(e,t,n,o=.05,i)=>{let{x:r,y:a,width:s,height:l,angle:d}=e,c=de(e,t,-.1,-.1),u=pe(n,c,-d),h=i?Ne(e,i):0,m=wa(o*l,5,80),g=wa(o*s,5,80);if(!(bn(c,u)<h)){if(u[0]<=r+s/2&&u[1]>c[1]-m&&u[1]<c[1]+m)return pe(se(r-h,c[1]),c,d);if(u[1]<=a+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return pe(se(c[0],a-h),c,d);if(u[0]>=r+s/2&&u[1]>c[1]-m&&u[1]<c[1]+m)return pe(se(r+s+h,c[1]),c,d);if(u[1]>=a+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return pe(se(c[0],a+l+h),c,d);if(e.type==="diamond"){let f=h,E=se(r+s/4-f,a+l/4-f),x=se(r+3*s/4+f,a+l/4-f),y=se(r+s/4-f,a+3*l/4+f),w=se(r+3*s/4+f,a+3*l/4+f);if(bn(E,u)<Math.max(g,m))return pe(E,c,d);if(bn(x,u)<Math.max(g,m))return pe(x,c,d);if(bn(y,u)<Math.max(g,m))return pe(y,c,d);if(bn(w,u)<Math.max(g,m))return pe(w,c,d)}}},Th=(e,t,n)=>{let o=e[t];if(!o)return{element:null,fixedPoint:null,focusPoint:null,binding:o,mode:null};let i=n.get(o.elementId);return{element:i,fixedPoint:o.fixedPoint,focusPoint:Ue(mn(o.fixedPoint),i,n),binding:o,mode:o.mode}},sd=e=>e.width*e.height,bt=(e,t,n,o,i,r)=>{if(n==null||n.elementId!==o.id&&e.points.length>2||wh(e.points[e.points.length-1],se(0,0)))return null;let a=Ue(mn(n.fixedPoint),o,i);if(n.mode==="inside")return D.createPointAt(e,i,a[0],a[1],null);let{element:s,focusPoint:l}=Th(e,t==="startBinding"?"endBinding":"startBinding",i),d=D.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?1:-2,i),c=e.points.length===2&&l||d,u=c&&Ui(a,c),h=s&&u&&Bt(s,i,u,Ne(s,e)).sort((w,M)=>tn(w,a)-tn(M,a))[0],m=u&&Bt(o,i,u,Ne(o,e)).sort((w,M)=>tn(w,c)-tn(M,c))[0],g=e.startArrowhead!==null,f=e.endArrowhead!==null,E=!g&&!f||t==="startBinding"&&g||t==="endBinding"&&f?a:m||a;if(s&&m&&!r&&sd(s)<sd(o)*2&&Lt({element:s,point:m,elementsMap:i,threshold:Ne(s,e),overrideShouldTestInside:!0}))return D.createPointAt(e,i,E[0],E[1],null);let y=bn(s&&(h||l)||d,m||a)<=bh;return s?y?D.createPointAt(e,i,E?.[0]||a[0],E?.[1]||a[1],null):D.createPointAt(e,i,m?.[0]||a[0],m?.[1]||a[1],null):D.createPointAt(e,i,y?a[0]:m?.[0]??a[0],y?a[1]:m?.[1]??a[1],null)},Lh=(e,t,n,o,i=!0,r=!0)=>{let a=[t.x,t.y,t.x+t.width,t.y+t.height],s=i?ga(e,t,n,o,void 0,r):D.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),l=se(a[0]+(a[2]-a[0])/2,a[1]+(a[3]-a[1])/2),d=pe(s,l,-t.angle);return{fixedPoint:mn([(d[0]-t.x)/Math.max(t.width,jo),(d[1]-t.y)/Math.max(t.height,jo)])}},ro=(e,t,n,o,i)=>{let r=i||D.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),a=de(t,o),s=pe(r,a,-t.angle),l=(s[0]-t.x)/Math.max(t.width,jo),d=(s[1]-t.y)/Math.max(t.height,jo);return{fixedPoint:mn([l,d])}},pd=(e,t,n)=>{for(let o of e){if("boundElements"in o&&o.boundElements&&Object.assign(o,{boundElements:o.boundElements.reduce((i,r)=>{let a=t.get(r.id);return a&&i.push({...r,id:a}),i},[])}),"containerId"in o&&o.containerId&&Object.assign(o,{containerId:t.get(o.containerId)??null}),"endBinding"in o&&o.endBinding){let i=t.get(o.endBinding.elementId);Object.assign(o,{endBinding:i?{...o.endBinding,elementId:i}:null})}if("startBinding"in o&&o.startBinding){let i=t.get(o.startBinding.elementId);Object.assign(o,{startBinding:i?{...o.startBinding,elementId:i}:null})}Y(o)&&Object.assign(o,io(o,n,{points:[o.points[0],o.points[o.points.length-1]]}))}},t3=(e,t)=>{let n=ld(e);for(let o of t)Mn.unbindAffected(n,o,(i,r)=>Te(i,n,r)),Pn.unbindAffected(n,o,(i,r)=>Te(i,n,r))},_o=(e,t,n=[])=>{if(!e)return null;let o=e.filter(i=>!t.has(i.id));return o.push(...n.map(i=>({id:i.id,type:i.type}))),o},hd=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),Xi=(e,t,n)=>{Ee(t)&&(t.boundElements?.slice()??[]).forEach(({id:i})=>{n(e.get(i),"boundElements",i)})},$i=(e,t,n)=>{let o=[];if(t.frameId){let i=t.frameId;o.push(n(e.get(i),"frameId",i))}if(xe(t)){let i=t.containerId;o.push(n(e.get(i),"containerId",i))}if(j(t)){if(t.startBinding){let i=t.startBinding.elementId;o.push(n(e.get(i),"startBinding",i))}if(t.endBinding){let i=t.endBinding.elementId;o.push(n(e.get(i),"endBinding",i))}}return o},Mn=class{static unbindAffected(t,n,o){n&&$i(t,n,i=>{!i||i.isDeleted||Xi(t,i,(r,a,s)=>{s===n.id&&o(i,{boundElements:_o(i.boundElements,new Set([s]))})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||$i(t,n,(i,r)=>{if(!i||i.isDeleted){o(n,{[r]:null});return}r!=="frameId"&&(i.boundElements?.find(a=>a.id===n.id)||(j(n)&&o(i,{boundElements:_o(i.boundElements,new Set,new Array(n))}),te(n)&&(i.boundElements?.find(a=>a.type==="text")?o(n,{[r]:null}):o(i,{boundElements:_o(i.boundElements,new Set,new Array(n))}))))})}},Pn=class{static unbindAffected(t,n,o){n&&Xi(t,n,i=>{!i||i.isDeleted||$i(t,i,(r,a,s)=>{s===n.id&&o(i,{[a]:null})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||Xi(t,n,(i,r,a)=>{if(!i||i.isDeleted){o(n,{boundElements:_o(n.boundElements,new Set([a]))});return}te(i)&&((n.boundElements?.slice()??[]).reverse().find(l=>l.type==="text")?.id===i.id?i.containerId!==n.id&&o(i,{containerId:n.id}):(i.containerId!==null&&o(i,{containerId:null}),o(n,{boundElements:_o(n.boundElements,new Set([i.id]))})))})}},Ue=(e,t,n)=>{let[o,i]=mn(e);return pe(se(t.x+t.width*o,t.y+t.height*i),de(t,n),t.angle)},Ch=(e,t)=>{let n=e.startBinding&&t.get(e.startBinding.elementId),o=e.endBinding&&t.get(e.endBinding.elementId),i=n&&e.startBinding?Ue(e.startBinding.fixedPoint,n,t):se(e.x+e.points[0][0],e.y+e.points[0][1]),r=o&&e.endBinding?Ue(e.endBinding.fixedPoint,o,t):se(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]);return[i,r]},md=(e,t)=>{let[n,o]=Ch(e,t);return[D.pointFromAbsoluteCoords(e,n,t),D.pointFromAbsoluteCoords(e,o,t)]},Bh=e=>Array.isArray(e)&&e.length===2&&e.every(t=>Number.isFinite(t)),mn=e=>{if(!Bh(e))return[.5001,.5001];let t=1e-4;return Math.abs(e[0]-.5)<t||Math.abs(e[1]-.5)<t?e.map(n=>Math.abs(n-.5)<t?.5001:n):e},Dh=e=>e.type==="ellipse"||e.type==="diamond"?e.type:"rectangle",Gh={rectangle:[{centerAngle:0,sectorWidth:75,side:"right"},{centerAngle:45,sectorWidth:15,side:"bottom-right"},{centerAngle:90,sectorWidth:75,side:"bottom"},{centerAngle:135,sectorWidth:15,side:"bottom-left"},{centerAngle:180,sectorWidth:75,side:"left"},{centerAngle:225,sectorWidth:15,side:"top-left"},{centerAngle:270,sectorWidth:75,side:"top"},{centerAngle:315,sectorWidth:15,side:"top-right"}],diamond:[{centerAngle:0,sectorWidth:15,side:"right"},{centerAngle:45,sectorWidth:75,side:"bottom-right"},{centerAngle:90,sectorWidth:15,side:"bottom"},{centerAngle:135,sectorWidth:75,side:"bottom-left"},{centerAngle:180,sectorWidth:15,side:"left"},{centerAngle:225,sectorWidth:75,side:"top-left"},{centerAngle:270,sectorWidth:15,side:"top"},{centerAngle:315,sectorWidth:75,side:"top-right"}],ellipse:[{centerAngle:0,sectorWidth:15,side:"right"},{centerAngle:45,sectorWidth:75,side:"bottom-right"},{centerAngle:90,sectorWidth:15,side:"bottom"},{centerAngle:135,sectorWidth:75,side:"bottom-left"},{centerAngle:180,sectorWidth:15,side:"left"},{centerAngle:225,sectorWidth:75,side:"top-left"},{centerAngle:270,sectorWidth:15,side:"top"},{centerAngle:315,sectorWidth:75,side:"top-right"}]},Oh=e=>e.map((t,n)=>{let o=t.sectorWidth/2,i=t.centerAngle-o,r=t.centerAngle+o;return i=(i%360+360)%360,r=(r%360+360)%360,{start:i,end:r,side:t.side}}),Rh=(e,t)=>{let[n,o]=e,i=n-.5,r=o-.5,a=Math.atan2(r,i);a<0&&(a+=2*Math.PI);let s=a*180/Math.PI,l=Gh[t],d=Oh(l);for(let h of d)if(h.start<=h.end){if(s>=h.start&&s<=h.end)return h.side}else if(s>=h.start||s<=h.end)return h.side;let c=1/0,u=l[0].side;for(let h of l){let m=Math.abs(s-h.centerAngle);m>180&&(m=360-m),m<c&&(c=m,u=h.side)}return u},n3=(e,t)=>{let n=t.get(e.elementId);if(!n||n.isDeleted||!Ee(n))return null;let o=de(n,t),i=Dh(n),r=Rh(mn(e.fixedPoint),i),a=.01;if(n.type==="diamond"){let[s,l]=hn(n),[d,c,u,h]=s,m,g;switch(r){case"left":{if(l.length>=3){let E=l[2][1];m=E[0]-a,g=E[1]}else{let f=Ge(c[1],u[0]);m=f[0]-a,g=f[1]}break}case"right":{if(l.length>=1){let E=l[0][1];m=E[0]+a,g=E[1]}else{let f=Ge(h[1],d[0]);m=f[0]+a,g=f[1]}break}case"top":{if(l.length>=4){let E=l[3][1];m=E[0],g=E[1]-a}else{let f=Ge(u[1],h[0]);m=f[0],g=f[1]-a}break}case"bottom":{if(l.length>=2){let E=l[1][1];m=E[0],g=E[1]+a}else{let f=Ge(d[1],c[0]);m=f[0],g=f[1]+a}break}case"top-right":{let f=Ge(h[0],h[1]);m=f[0]+a*.707,g=f[1]-a*.707;break}case"bottom-right":{let f=Ge(d[0],d[1]);m=f[0]+a*.707,g=f[1]+a*.707;break}case"bottom-left":{let f=Ge(c[0],c[1]);m=f[0]-a*.707,g=f[1]+a*.707;break}case"top-left":{let f=Ge(u[0],u[1]);m=f[0]-a*.707,g=f[1]-a*.707;break}default:return null}return pe(se(m,g),o,n.angle)}if(n.type==="ellipse"){let s=n.x+n.width/2,l=n.y+n.height/2,d=n.width/2,c=n.height/2,u,h;switch(r){case"top":{u=s,h=l-c-a;break}case"right":{u=s+d+a,h=l;break}case"bottom":{u=s,h=l+c+a;break}case"left":{u=s-d-a,h=l;break}case"top-right":{let m=-Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=s+g+a*.707,h=l+f-a*.707;break}case"bottom-right":{let m=Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=s+g+a*.707,h=l+f+a*.707;break}case"bottom-left":{let m=3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=s+g-a*.707,h=l+f+a*.707;break}case"top-left":{let m=-3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=s+g-a*.707,h=l+f-a*.707;break}default:return null}return pe(se(u,h),o,n.angle)}if(Co(n)){let[s,l]=pn(n),[d,c,u,h]=s,m,g;switch(r){case"top":{let f=Ge(d[0],d[1]);m=f[0],g=f[1]-a;break}case"right":{let f=Ge(c[0],c[1]);m=f[0]+a,g=f[1];break}case"bottom":{let f=Ge(u[0],u[1]);m=f[0],g=f[1]+a;break}case"left":{let f=Ge(h[0],h[1]);m=f[0]-a,g=f[1];break}case"top-left":{if(l.length>=1){let f=l[0],E=f[0],x=f[3],y=Ge(E,x);m=y[0]-a*.707,g=y[1]-a*.707}else m=n.x-a,g=n.y-a;break}case"top-right":{if(l.length>=2){let f=l[1],E=f[0],x=f[3],y=Ge(E,x);m=y[0]+a*.707,g=y[1]-a*.707}else m=n.x+n.width+a,g=n.y-a;break}case"bottom-right":{if(l.length>=3){let f=l[2],E=f[0],x=f[3],y=Ge(E,x);m=y[0]+a*.707,g=y[1]+a*.707}else m=n.x+n.width+a,g=n.y+n.height+a;break}case"bottom-left":{if(l.length>=4){let f=l[3],E=f[0],x=f[3],y=Ge(E,x);m=y[0]-a*.707,g=y[1]+a*.707}else m=n.x-a,g=n.y+n.height+a;break}default:return null}return pe(se(m,g),o,n.angle)}return null},Ge=(e,t)=>se((e[0]+t[0])/2,(e[1]+t[1])/2);I();import{arrayToMap as Dd,findIndex as Gd,findLastIndex as Od}from"@excalidraw/common";I();I();import{arrayToMap as Jh,isShallowEqual as em}from"@excalidraw/common";I();import{arrayToMap as Mt}from"@excalidraw/common";import{isPointWithinBounds as Wh,pointFrom as Aa,segmentsIntersectAt as _h}from"@excalidraw/math";I();import{arrayToMap as Zi}from"@excalidraw/common";import{validateOrderKey as Fh,generateNKeysBetween as Nh}from"@excalidraw/fractional-indexing";var Pa=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"},Hh=(e,{shouldThrow:t=!1,includeBoundTextValidation:n=!1,ignoreLogs:o,reconciliationContext:i})=>{let r=[],a=l=>`${l?.index}:${l?.id}:${l?.type}:${l?.isDeleted}:${l?.version}:${l?.versionNonce}`,s=e.map(l=>l.index);for(let[l,d]of s.entries()){let c=s[l-1],u=s[l+1];if(Ia(d,c,u)||r.push(`Fractional indices invariant has been compromised: "${a(e[l-1])}", "${a(e[l])}", "${a(e[l+1])}"`),n&&Tt(e[l])){let h=e[l],m=Q(h,Zi(e));m&&m.index<=h.index&&r.push(`Fractional indices invariant for bound elements has been compromised: "${a(m)}", "${a(h)}"`)}}if(r.length){let l=new Pa,d=[];if(i&&(d.push("Additional reconciliation context:"),d.push(i.localElements.map(c=>a(c))),d.push(i.remoteElements.map(c=>a(c)))),o||console.error(r.join(`
10
+ `)=>e.reduce((o,i)=>(re(i)&&o.push(i.text),o),[]).join(t);I();import{curvePointDistance as da,distanceToLineSegment as ca,pointRotateRads as ua}from"@excalidraw/math";import{ellipse as rh,ellipseDistanceFromPoint as ah}from"@excalidraw/math/ellipse";var An=(e,t,n)=>{switch(e.type){case"selection":case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return sh(e,t,n);case"diamond":return lh(e,t,n);case"ellipse":return dh(e,t,n);case"line":case"arrow":case"freedraw":return ch(e,t,n)}},sh=(e,t,n)=>{let o=me(e,t),i=ua(n,o,-e.angle),[r,a]=Pn(e);return Math.min(...r.map(s=>ca(i,s)),...a.map(s=>da(s,i)).filter(s=>s!==null))},lh=(e,t,n)=>{let o=me(e,t),i=ua(n,o,-e.angle),[r,a]=In(e);return Math.min(...r.map(s=>ca(i,s)),...a.map(s=>da(s,i)).filter(s=>s!==null))},dh=(e,t,n)=>{let o=me(e,t);return ah(ua(n,o,-e.angle),rh(o,e.width/2,e.height/2))},ch=(e,t,n)=>{let[o,i]=Qn(e,t);return Math.min(...o.map(r=>ca(n,r)),...i.map(r=>da(r,n)))};I();var pa=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",jy=e=>e==="rectangle"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="text"||e==="embeddable",Vy=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",Uy=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",Yy=e=>e==="freedraw",Xl=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image",Xy=e=>e==="arrow",$y=e=>e==="arrow";var Yi=e=>{if(e.type==="arrow")return!1;let t=pa(e.type)&&!ed(e.backgroundColor)||zt(e)||Ri(e)||re(e);return e.type==="line"?t&&nn(e.points):e.type==="freedraw"?t&&nn(e.points):t||_e(e)},ha=null,$l=null,Zl=1/0,ql=!1,Kl=!1,_t=({point:e,element:t,threshold:n,elementsMap:o,frameNameBound:i=null,overrideShouldTestInside:r=!1})=>{if(ha&&od(e,ha)&&Zl<=n&&r===Kl){let p=$l?.deref();if(p&&p.id===t.id&&p.version===t.version&&p.versionNonce===t.versionNonce)return ql}let a=i?ma(Oe(i.x-n,i.y-n),e,Oe(i.x+i.width+n,i.y+i.height+n)):!1,s=Ee(t,o,!0);if(!id(e,s,t.angle,n)&&!a)return!1;let c=(r||Yi(t))&&on(e,t,o)||Ql(e,t,o,n)||a;return ha=e,$l=new WeakRef(t),Zl=n,Kl=r,ql=c,c},id=(e,t,n,o=0)=>{let i=n===0?e:xt(e,kn(t),-n);return ma(Oe(t[0]-o,t[1]-o),i,Oe(t[2]+o,t[3]+o))},Eh=(e,t,n,o=0)=>{let i=Ee(t,n,!0);return id(e,i,t.angle,o)},d3=(e,t)=>!_t(e)&&!xh(e.point,e.element,t)&&Eh(e.point,e.element,t),xh=(e,t,n)=>{let o=te(t,n);if(!o)return!1;let i=ae(t)?{...o,...F.getBoundTextElementPosition(t,o,n)}:o;return on(e,i,n)},rd=(e,[t,n],o,i=0)=>{let r=Oe(t,n),a=!oe(e),s=Math.max(1,i),l=[t-s,n-s,t+s,n+s],d=Ee(e,o);if(!dn(l,d))return!1;if(e.frameId){let h=o.get(e.frameId);if(h&&oe(h)){let m=Ee(h,o);if(!Vt(r,m))return!1}}let c=jt(e,o,Ko(me(e,o),r)),p=An(e,o,r);return a?c.length===0||p<=i:c.length>0&&p<=s},Xi=(e,t,n,o)=>{let i=[];for(let r=t.length-1;r>=0;--r){let a=t[r];if(Jl(!a.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Ae(a,!1)&&rd(a,e,n,o)&&(i.push(a),pa(a.type)&&!ed(a.backgroundColor)))break}return i},ln=(e,t,n,o)=>{let i=Xi(e,t,n,o);return!i||i.length===0?null:i.length===1?i[0]:i.sort((r,a)=>a.width**2+a.height**2-(r.width**2+r.height**2)).pop()},ad=(e,t,n,o,i)=>{let r=[];for(let s=n.length-1;s>=0;--s){let l=n[s];Jl(!l.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Ae(l,!1)&&rd(l,e,o,i)&&r.push(l)}if(!r||r.length===0)return null;if(r.length===1)return r[0];let a=r.filter(s=>An(s,o,e)<=Qe(s,t)||on(e,s,o));return a.length===0?null:a[0]},jt=(e,t,n,o=0,i=!1)=>{let r=[Math.min(n[0][0]-o,n[1][0]-o),Math.min(n[0][1]-o,n[1][1]-o),Math.max(n[0][0]+o,n[1][0]+o),Math.max(n[0][1]+o,n[1][1]+o)],a=Ee(e,t);if(!dn(r,a))return[];switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"selection":case"magicframe":return wh(e,t,n,o,i);case"diamond":return bh(e,t,n,o,i);case"ellipse":return Mh(e,t,n,o);case"line":case"freedraw":case"arrow":return yh(e,n,t,i)}},sd=(e,t,n,o,i,r=!1)=>{for(let a of e){let s=$i(a[0],a[1],a[2],a[3]),l=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])];if(!dn(s,l))continue;let d=td(a,t);if(d.length>0){for(let c of d)n.push(xt(c,o,i));if(r)return n}}return n},ld=(e,t,n,o,i,r=!1)=>{for(let a of e){let s=nd(a,t);if(s&&(n.push(xt(s,o,i)),r))return n}return n},yh=(e,t,n,o=!1)=>{let[i,r]=Qn(e,n),a=[];for(let s of i){let l=nd(s,t);if(l&&(a.push(l),o))return a}for(let s of r){let l=$i(s[0],s[1],s[2],s[3]),d=[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])];if(!dn(l,d))continue;let c=td(s,t,{iterLimit:10});if(c.length>0&&(a.push(...c),o))return a}return a},wh=(e,t,n,o=0,i=!1)=>{let r=me(e,t),a=xt(n[0],r,-e.angle),s=xt(n[1],r,-e.angle),l=Ko(a,s),[d,c]=Pn(e,o),p=[];return ld(d,l,p,r,e.angle,i),i&&p.length>0||sd(c,l,p,r,e.angle,i),p},bh=(e,t,n,o=0,i=!1)=>{let r=me(e,t),a=xt(n[0],r,-e.angle),s=xt(n[1],r,-e.angle),l=Ko(a,s),[d,c]=In(e,o),p=[];return ld(d,l,p,r,e.angle,i),i&&p.length>0||sd(c,l,p,r,e.angle,i),p},Mh=(e,t,n,o=0)=>{let i=me(e,t),r=xt(n[0],i,-e.angle),a=xt(n[1],i,-e.angle);return gh(fh(i,e.width/2+o,e.height/2+o),Ko(r,a)).map(s=>xt(s,i,e.angle))},Ql=(e,t,n,o=1)=>An(t,n,e)<=o,on=(e,t,n)=>{if((ae(t)||He(t))&&!nn(t.points))return!1;let[o,i,r,a]=Ee(t,n);if(!ma(Oe(o,i),e,Oe(r,a)))return!1;let s=Oe((o+r)/2,(i+a)/2),l=uh(mh(hh(ph(e,s,.1)),Math.max(t.width,t.height)*2),s),d=Ko(e,l);return jt(t,n,d).filter((p,h,m)=>m.findIndex(g=>od(g,p))===h).length%2===1},fa=(e,t,n)=>{let o=(a,s)=>{let{x:l,y:d,width:c,height:p,angle:h}=a,m=me(a,n);if(a.type==="diamond"){let[f,E,x,y,w,M,b,S]=go(a);return[Oe(l+f,d+E-s),Oe(l+x+s,d+y),Oe(l+w,d+M+s),Oe(l+b-s,d+S)].map(k=>xt(k,m,h))}if(a.type==="ellipse"){let f=l+c/2,E=d+p/2,x=c/2,y=p/2;return[Oe(f,E-y-s),Oe(f+x+s,E),Oe(f,E+y+s),Oe(f-x-s,E)].map(M=>xt(M,m,h))}return[Oe(l-s,d-s),Oe(l+c+s,d-s),Oe(l+c+s,d+p+s),Oe(l-s,d+p+s)].map(f=>xt(f,m,h))},i=-1*Math.max(e.width,e.height)/20;return o(e,i).every(a=>on(a,t,n))};I();import{invariant as dd,isDevEnv as Ph,isTestEnv as Ih}from"@excalidraw/common";import{pointFrom as Tn,pointFromVector as Zi,pointRotateRads as qi,pointScaleFromOrigin as Ki,pointsEqual as Sh,triangleIncludesPoint as ga,vectorCross as lt,vectorFromPoint as se,vectorScale as Qi}from"@excalidraw/math";var Ce=[1,0],We=[0,1],ct=[-1,0],yt=[0,-1],cn=e=>{let[t,n]=e,o=Math.abs(t),i=Math.abs(n);return t>i?Ce:t<=-i?ct:n>o?We:yt},dt=(e,t)=>cn(se(e,t)),Dt=(e,t)=>ut(dt(e,t)),Le=(e,t)=>e[0]===t[0]&&e[1]===t[1],ut=e=>Le(e,Ce)||Le(e,ct),f3=e=>!ut(e),vh=(e,t,n)=>{let o=kn(t);(Ph()||Ih())&&(dd(e.width>0&&e.height>0,"Diamond element has no width or height"),dd(!Sh(o,n),"The point is too close to the element mid point to determine heading"));let i=.95,r=Zi(Qi(se(qi(Tn(e.x+e.width/2,e.y),o,e.angle),o),i),o),a=Zi(Qi(se(qi(Tn(e.x+e.width,e.y+e.height/2),o,e.angle),o),i),o),s=Zi(Qi(se(qi(Tn(e.x+e.width/2,e.y+e.height),o,e.angle),o),i),o),l=Zi(Qi(se(qi(Tn(e.x,e.y+e.height/2),o,e.angle),o),i),o);if(lt(se(n,r),se(r,a))<=0&&lt(se(n,r),se(r,l))>0)return dt(r,o);if(lt(se(n,a),se(a,s))<=0&&lt(se(n,a),se(a,r))>0)return dt(a,o);if(lt(se(n,s),se(s,l))<=0&&lt(se(n,s),se(s,a))>0)return dt(s,o);if(lt(se(n,l),se(l,r))<=0&&lt(se(n,l),se(l,s))>0)return dt(l,o);if(lt(se(n,o),se(r,o))<=0&&lt(se(n,o),se(a,o))>0){let c=e.width>e.height?r:a;return dt(c,o)}else if(lt(se(n,o),se(a,o))<=0&&lt(se(n,o),se(s,o))>0){let c=e.width>e.height?s:a;return dt(c,o)}else if(lt(se(n,o),se(s,o))<=0&&lt(se(n,o),se(l,o))>0){let c=e.width>e.height?s:l;return dt(c,o)}let d=e.width>e.height?r:l;return dt(d,o)},Qo=(e,t,n)=>{let i=kn(t);if(e.type==="diamond")return vh(e,t,n);let r=Ki(Tn(t[0],t[1]),i,2),a=Ki(Tn(t[2],t[1]),i,2),s=Ki(Tn(t[0],t[3]),i,2),l=Ki(Tn(t[2],t[3]),i,2);return ga([r,a,i],n)?yt:ga([a,l,i],n)?Ce:ga([l,s,i],n)?We:ct},Ea=e=>[e[0]===0?0:e[0]>0?-1:1,e[1]===0?0:e[1]>0?-1:1];I();import{getSizeFromPoints as Vh,randomInteger as ka,getUpdatedTimestamp as Ta}from"@excalidraw/common";I();import{clamp as Ji,pointDistance as wa,pointFrom as Q,pointScaleFromOrigin as Ah,pointsEqual as ei,pointTranslate as ya,vector as Ut,vectorCross as er,vectorFromPoint as ba,vectorScale as kh}from"@excalidraw/math";import{BinaryHeap as Th,invariant as xo,isAnyTrue as Lh,getSizeFromPoints as cd,isDevEnv as Ch,arrayToMap as Dh}from"@excalidraw/common";var Ma=1,ue=40,Bh=(e,t)=>{let n=e.fixedSegments?e.fixedSegments.slice():null;if(n){let o=[];e.points.map(a=>Q(e.x+a[0],e.y+a[1])).forEach((a,s,l)=>{if(s<2)return o.push(a);let d=dt(a,l[s-1]),c=dt(l[s-1],l[s-2]);if(Le(d,c)){let p=n?.findIndex(m=>m.index===s-1)??-1,h=n?.findIndex(m=>m.index===s)??-1;h!==-1&&(n[h].start=Q(l[s-2][0]-e.x,l[s-2][1]-e.y)),p!==-1&&n.splice(p,1),o.splice(-1,1),n.forEach(m=>{m.index>s-1&&(m.index-=1)})}return o.push(a)});let i=[];o.forEach((a,s,l)=>{if(s<3)return i.push(a);if(wa(l[s-2],l[s-1])<Ma){let d=n?.findIndex(h=>h.index===s-2)??-1,c=n?.findIndex(h=>h.index===s-1)??-1;c!==-1&&n.splice(c,1),d!==-1&&n.splice(d,1),i.splice(-2,2),n.forEach(h=>{h.index>s-2&&(h.index-=2)});let p=Dt(a,l[s-1]);return i.push(Q(p?a[0]:l[s-2][0],p?l[s-2][1]:a[1]))}i.push(a)});let r=n.filter(a=>a.index!==1&&a.index!==i.length-1);return r.length===0?un(Sa(va(Ia(e,Pa(e,t,i.map(a=>Q(a[0]-e.x,a[1]-e.y))))??[])),r,null,null):(Ch()&&xo(Ed(i),"Invalid elbow points with fixed segments"),un(i,r,e.startIsSpecial,e.endIsSpecial))}return{x:e.x,y:e.y,points:e.points,fixedSegments:e.fixedSegments,startIsSpecial:e.startIsSpecial,endIsSpecial:e.endIsSpecial}},Gh=(e,t,n)=>{let o=t.map(A=>A.index),r=(e.fixedSegments?.map(A=>A.index)??[]).findIndex(A=>!o.includes(A));if(r===-1||!e.fixedSegments?.[r])return{points:e.points};let a=e.fixedSegments[r].index,s=e.fixedSegments[r-1],l=e.fixedSegments[r+1],d=e.x+(s?s.end[0]:0),c=e.y+(s?s.end[1]:0),p=s?null:e.startBinding,h=l?null:e.endBinding,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...w}=Pa({x:d,y:c,startBinding:p,endBinding:h,startArrowhead:null,endArrowhead:null,points:e.points},n,[Q(0,0),Q(e.x+(l?.start[0]??e.points[e.points.length-1][0])-d,e.y+(l?.start[1]??e.points[e.points.length-1][1])-c)],{isDragging:!1}),{points:M}=un(Sa(va(Ia(e,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...w})??[])),t,null,null);if(!M||M.length<2)throw new Error("Property 'points' is required in the update returned by normalizeArrowElementUpdate()");let b=[];if(s)for(let A=0;A<s.index;A++)b.push(Q(e.x+e.points[A][0],e.y+e.points[A][1]));if(M.forEach(A=>{b.push(Q(e.x+(s?s.end[0]:0)+A[0],e.y+(s?s.end[1]:0)+A[1]))}),l)for(let A=l.index;A<e.points.length;A++)b.push(Q(e.x+e.points[A][0],e.y+e.points[A][1]));let S=(l?.index??e.points.length)-(s?.index??0)-1,v=t.map(A=>A.index>a?{...A,index:A.index-S+(M.length-1)}:A),k=b.flatMap((A,O)=>{let G=b[O-1],R=b[O+1];if(G&&R){let C=dt(A,G),j=dt(R,A);if(Le(C,j))return v.forEach(W=>{W.index>O&&(W.index-=1)}),[];if(Le(C,Ea(j)))return v.forEach(W=>{W.index>O&&(W.index+=1)}),[A,A]}return[A]});return un(k,v,!1,!1)},Oh=(e,t,n,o,i,r)=>{let a=t.map((b,S)=>e.fixedSegments==null||e.fixedSegments[S]===void 0||e.fixedSegments[S].index!==b.index||(b.start[0]!==e.fixedSegments[S].start[0]&&b.end[0]!==e.fixedSegments[S].end[0])!=(b.start[1]!==e.fixedSegments[S].start[1]&&b.end[1]!==e.fixedSegments[S].end[1])?S:null).filter(b=>b!==null).shift();if(a==null)return{points:e.points};let s=e.fixedSegments?.findIndex(b=>b.index===1)??-1,l=e.fixedSegments?.findIndex(b=>b.index===e.points.length-1)??-1,d=wa(t[a].start,t[a].end),c=d<ue+5;if(s===-1&&t[a].index===1&&i){let b=ut(n),v=(b?Le(n,Ce):Le(n,We))?c?d/2:ue:c?-d/2:-ue;t[a].start=Q(t[a].start[0]+(b?v:0),t[a].start[1]+(b?0:v))}if(l===-1&&t[a].index===e.points.length-1&&r){let b=ut(o),v=(b?Le(o,Ce):Le(o,We))?c?d/2:ue:c?-d/2:-ue;t[a].end=Q(t[a].end[0]+(b?v:0),t[a].end[1]+(b?0:v))}let p=t.map(b=>({...b,start:Q(e.x+b.start[0],e.y+b.start[1]),end:Q(e.x+b.end[0],e.y+b.end[1])})),h=e.points.map((b,S)=>Q(e.x+b[0],e.y+b[1])),m=p[a].index-1,g=p[a].index,f=p[a].start,E=p[a].end,x=h[m-1]&&!ei(h[m],h[m-1])?Dt(h[m-1],h[m]):void 0,y=h[g+1]&&!ei(h[g],h[g+1])?Dt(h[g+1],h[g]):void 0;if(x!==void 0){let b=x?1:0;h[m-1][b]=f[b]}if(h[m]=f,h[g]=E,y!==void 0){let b=y?1:0;h[g+1][b]=E[b]}let w=p.findIndex(b=>b.index===m);if(w!==-1){let b=Dt(p[w].end,p[w].start)?1:0;p[w].start[b]=f[b],p[w].end=f}let M=p.findIndex(b=>b.index===g+1);if(M!==-1){let b=Dt(p[M].end,p[M].start)?1:0;p[M].end[b]=E[b],p[M].start=E}if(s===-1&&m===0){let b=i?ut(n):Dt(h[1],h[0]);h.unshift(Q(b?f[0]:e.x+e.points[0][0],b?e.y+e.points[0][1]:f[1])),i&&h.unshift(Q(e.x+e.points[0][0],e.y+e.points[0][1]));for(let S of p)S.index+=i?2:1}if(l===-1&&g===e.points.length-1){let b=ut(o);h.push(Q(b?E[0]:e.x+e.points[e.points.length-1][0],b?e.y+e.points[e.points.length-1][1]:E[1])),r&&h.push(Q(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]))}return un(h,p.map(b=>({...b,start:Q(b.start[0]-e.x,b.start[1]-e.y),end:Q(b.end[0]-e.x,b.end[1]-e.y)})),!1,!1)},Rh=(e,t,n,o,i,r,a,s,l)=>{let d=e.startIsSpecial??null,c=e.endIsSpecial??null,p=t.map((E,x)=>x===0?Q(e.x+E[0],e.y+E[1]):x===t.length-1?Q(e.x+E[0],e.y+E[1]):Q(e.x+e.points[x][0],e.y+e.points[x][1])),h=n.map(E=>({...E,start:Q(e.x+(E.start[0]-t[0][0]),e.y+(E.start[1]-t[0][1])),end:Q(e.x+(E.end[0]-t[0][0]),e.y+(E.end[1]-t[0][1]))})),m=[],g=2+(d?1:0),f=2+(c?1:0);for(;m.length+g<p.length-f;)m.push(p[m.length+g]);{let E=p.at(d?2:1),x=p.at(d?3:2);if(!E||!x)throw new Error(`Second and third points must exist when handling endpoint drag (${d})`);let y=ut(o),w=ut(cn(ba(E,x)));if(s&&y===w){let M=y?Le(o,Ce):Le(o,We);if(m.unshift(Q(w?r[0]+(M?ue:-ue):x[0],w?x[1]:r[1]+(M?ue:-ue))),m.unshift(Q(y?r[0]+(M?ue:-ue):r[0],y?r[1]:r[1]+(M?ue:-ue))),!d){d=!0;for(let b of h)b.index>1&&(b.index+=1)}}else if(m.unshift(Q(w?r[0]:E[0],w?E[1]:r[1])),d){d=!1;for(let M of h)M.index>1&&(M.index-=1)}m.unshift(r)}{let E=p.at(p.length-(c?3:2)),x=p.at(p.length-(c?4:3));if(!E||!x)throw new Error(`Second and third to last points must exist when handling endpoint drag (${c})`);let y=ut(i),w=Dt(x,E);if(l&&y===w){let M=y?Le(i,Ce):Le(i,We);m.push(Q(w?a[0]+(M?ue:-ue):x[0],w?x[1]:a[1]+(M?ue:-ue))),m.push(Q(y?a[0]+(M?ue:-ue):a[0],y?a[1]:a[1]+(M?ue:-ue))),c||(c=!0)}else m.push(Q(w?a[0]:E[0],w?E[1]:a[1])),c&&(c=!1)}return m.push(a),un(m,h.map(({index:E})=>({index:E,start:m[E-1],end:m[E]})).map(E=>({...E,start:Q(E.start[0]-r[0],E.start[1]-r[1]),end:Q(E.end[0]-r[0],E.end[1]-r[1])})),d,c)},Ln=1e6,yo=(e,t,n,o)=>{if(e.points.length<2)return{points:n.points??e.points};D.PROD||(xo(!n.points||n.points.length>=2,"Updated point array length must match the arrow point length, contain exactly the new start and end points or not be specified at all (i.e. you can't add new points between start and end manually to elbow arrows)"),xo(!e.fixedSegments||e.fixedSegments.map(b=>b.start[0]===b.end[0]||b.start[1]===b.end[1]).every(Boolean),"Fixed segments must be either horizontal or vertical"),xo(!n.fixedSegments||n.fixedSegments.map(b=>b.start[0]===b.end[0]||b.start[1]===b.end[1]).every(Boolean),"Updates to fixed segments must be either horizontal or vertical"),xo(e.points.slice(1).map((b,S)=>b[0]===e.points[S][0]||b[1]===e.points[S][1]),"Elbow arrow segments must be either horizontal or vertical"),xo(n.fixedSegments?.find(b=>b.index===1&&ei(b.start,(n.points??e.points)[0]))==null&&n.fixedSegments?.find(b=>b.index===(n.points??e.points).length-1&&ei(b.end,(n.points??e.points)[(n.points??e.points).length-1]))==null,"The first and last segments cannot be fixed"));let i=n.fixedSegments??e.fixedSegments??[],r=n.points?n.points&&n.points.length===2?e.points.map((b,S)=>S===0?n.points[0]:S===e.points.length-1?n.points[1]:b):n.points.slice():e.points.slice(),{startBinding:a,endBinding:s,...l}=n,d=typeof a<"u"?a:e.startBinding,c=typeof s<"u"?s:e.endBinding,p=d&&nr(d.elementId,t),h=c&&nr(c.elementId,t),m=Ed(r);if(d&&!p&&m||c&&!h&&m||t.size===0&&m||Object.keys(l).length===0&&(p?.id!==d?.elementId||h?.id!==c?.elementId))return un(r.map(b=>Q(e.x+b[0],e.y+b[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial);let{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:w,...M}=Pa({x:e.x,y:e.y,startBinding:d,endBinding:c,startArrowhead:e.startArrowhead,endArrowhead:e.endArrowhead,points:e.points},t,r,o);return t.size===0&&m?un(r.map(b=>Q(e.x+b[0],e.y+b[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial):!n.points&&!n.fixedSegments&&!n.startBinding&&!n.endBinding?Bh(e,t):n.startBinding===e.startBinding&&n.endBinding===e.endBinding&&(n.points??[]).every((b,S)=>ei(b,e.points[S]??Q(1/0,1/0)))&&m?{}:i.length===0?un(Sa(va(Ia(e,{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:w,...M})??[])),i,null,null):(e.fixedSegments?.length??0)>i.length?Gh(e,i,t):n.points?n.points&&n.fixedSegments?n:Rh(e,r,i,g,f,E,x,y,w):Oh(e,i,g,f,y,w)},Pa=(e,t,n,o)=>{let i=ya(n[0],Ut(e.x,e.y)),r=ya(n[n.length-1],Ut(e.x,e.y)),a=null,s=null;if(o?.isDragging&&o?.isBindingEnabled!==!1){let b=Array.from(t.values());a=md(i,t,b,o?.zoom)||null,s=md(r,t,b,o?.zoom)||null}else a=e.startBinding&&nr(e.startBinding.elementId,t)||null,s=e.endBinding&&nr(e.endBinding.elementId,t)||null;let l=pd({...e,angle:0,type:"arrow",elbowed:!0,points:n},"start",e.startBinding?.fixedPoint,i,a,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),d=pd({...e,angle:0,type:"arrow",elbowed:!0,points:n},"end",e.endBinding?.fixedPoint,r,s,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),c=hd(l,d,a,i,t,o?.zoom),p=hd(d,l,s,r,t,o?.zoom),h=[l[0]-2,l[1]-2,l[0]+2,l[1]+2],m=[d[0]-2,d[1]-2,d[0]+2,d[1]+2],g=a?It(a,t,Cn(c,e.startArrowhead?Qe(a,{elbowed:!0})*6:Qe(a,{elbowed:!0})*2,1)):h,f=s?It(s,t,Cn(p,e.endArrowhead?Qe(s,{elbowed:!0})*6:Qe(s,{elbowed:!0})*2,1)):m,E=Vt(l,s?It(s,t,Cn(p,ue,ue)):m)||Vt(d,a?It(a,t,Cn(c,ue,ue)):h),x=gd(E?[h,m]:[g,f]),y=Hh(E?h:g,E?m:f,x,E?Cn(c,!a&&!s?0:ue,0):Cn(c,!a&&!s?0:ue-(e.startArrowhead?to*6:to*2),ue),E?Cn(p,!a&&!s?0:ue,0):Cn(p,!a&&!s?0:ue-(e.endArrowhead?to*6:to*2),ue),E,a&&It(a,t),s&&It(s,t)),w=ud(y[0],c,l),M=ud(y[1],p,d);return{dynamicAABBs:y,startDonglePosition:w,startGlobalPoint:l,startHeading:c,endDonglePosition:M,endGlobalPoint:d,endHeading:p,commonBounds:x,hoveredStartElement:a,hoveredEndElement:s,boundsOverlap:E,startElementBounds:g,endElementBounds:f}},Ia=(e,t)=>{let{dynamicAABBs:n,startDonglePosition:o,startGlobalPoint:i,startHeading:r,endDonglePosition:a,endGlobalPoint:s,endHeading:l,commonBounds:d,hoveredEndElement:c}=t,p=zh(n,o||i,r,a||s,l,d),h=o&&tr(o,p),m=a&&tr(a,p),g=tr(s,p);g&&c&&(g.closed=!0);let f=tr(i,p);f&&e.startBinding&&(f.closed=!0);let E=h&&m&&(Vt(h.pos,n[1])||Vt(m.pos,n[0])),x=Fh(h||f,m||g,p,r||Ce,l||Ce,E?[]:n);if(x){let y=x.map(w=>[w.pos[0],w.pos[1]]);return h&&y.unshift(i),m&&y.push(s),y}return null},Cn=(e,t,n)=>{switch(e){case yt:return[t,n,n,n];case Ce:return[n,t,n,n];case We:return[n,n,t,n]}return[n,n,n,t]},Fh=(e,t,n,o,i,r)=>{let a=xa(e.pos,t.pos),s=new Th(l=>l.f);for(s.push(e);s.size()>0;){let l=s.pop();if(!l||l.closed)continue;if(l===t)return Nh(e,l);l.closed=!0;let d=Wh(l.addr,n);for(let c=0;c<4;c++){let p=d[c];if(!p||p.closed)continue;let h=Ah(p.pos,l.pos,.5);if(Lh(...r.map(M=>Vt(h,M))))continue;let m=jh(c),g=l.parent?cn(ba(l.pos,l.parent.pos)):o,f=Ea(g);if(Le(f,m)||fd(e.addr,p.addr)&&Le(m,o)||fd(t.addr,p.addr)&&Le(m,i))continue;let x=g!==m,y=l.g+xa(p.pos,l.pos)+(x?Math.pow(a,3):0),w=p.visited;if(!w||y<p.g){let M=_h(p,t,m,i);p.visited=!0,p.parent=l,p.h=xa(t.pos,p.pos)+M*Math.pow(a,2),p.g=y,p.f=p.g+p.h,w?s.rescoreElement(p):s.push(p)}}}return null},Nh=(e,t)=>{let n=t,o=[];for(;n.parent;)o.unshift(n),n=n.parent;return o.unshift(e),o},xa=(e,t)=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),Hh=(e,t,n,o,i,r,a,s)=>{let l=a??e,d=s??t,[c,p,h,m]=o??[0,0,0,0],[g,f,E,x]=i??[0,0,0,0],y=[e[0]>t[2]?e[1]>t[3]||e[3]<t[1]?Math.min((l[0]+d[2])/2,e[0]-m):(l[0]+d[2])/2:e[0]>t[0]?e[0]-m:n[0]-m,e[1]>t[3]?e[0]>t[2]||e[2]<t[0]?Math.min((l[1]+d[3])/2,e[1]-c):(l[1]+d[3])/2:e[1]>t[1]?e[1]-c:n[1]-c,e[2]<t[0]?e[1]>t[3]||e[3]<t[1]?Math.max((l[2]+d[0])/2,e[2]+p):(l[2]+d[0])/2:e[2]<t[2]?e[2]+p:n[2]+p,e[3]<t[1]?e[0]>t[2]||e[2]<t[0]?Math.max((l[3]+d[1])/2,e[3]+h):(l[3]+d[1])/2:e[3]<t[3]?e[3]+h:n[3]+h],w=[t[0]>e[2]?t[1]>e[3]||t[3]<e[1]?Math.min((d[0]+l[2])/2,t[0]-x):(d[0]+l[2])/2:t[0]>e[0]?t[0]-x:n[0]-x,t[1]>e[3]?t[0]>e[2]||t[2]<e[0]?Math.min((d[1]+l[3])/2,t[1]-g):(d[1]+l[3])/2:t[1]>e[1]?t[1]-g:n[1]-g,t[2]<e[0]?t[1]>e[3]||t[3]<e[1]?Math.max((d[2]+l[0])/2,t[2]+f):(d[2]+l[0])/2:t[2]<e[2]?t[2]+f:n[2]+f,t[3]<e[1]?t[0]>e[2]||t[2]<e[0]?Math.max((d[3]+l[1])/2,t[3]+E):(d[3]+l[1])/2:t[3]<e[3]?t[3]+E:n[3]+E],M=gd([y,w]);if(!r&&y[2]-y[0]+w[2]-w[0]>M[2]-M[0]+1e-11&&y[3]-y[1]+w[3]-w[1]>M[3]-M[1]+1e-11){let[b,S]=[(w[0]+w[2])/2,(w[1]+w[3])/2];if(t[0]>e[2]&&e[1]>t[3]){let v=y[2]+(w[0]-y[2])/2,k=w[3]+(y[1]-w[3])/2;return er(Ut(e[2]-b,e[1]-S),Ut(e[0]-b,e[3]-S))>0?[[y[0],y[1],v,y[3]],[v,w[1],w[2],w[3]]]:[[y[0],k,y[2],y[3]],[w[0],w[1],w[2],k]]}else if(e[2]<t[0]&&e[3]<t[1]){let v=y[2]+(w[0]-y[2])/2,k=y[3]+(w[1]-y[3])/2;return er(Ut(e[0]-b,e[1]-S),Ut(e[2]-b,e[3]-S))>0?[[y[0],y[1],y[2],k],[w[0],k,w[2],w[3]]]:[[y[0],y[1],v,y[3]],[v,w[1],w[2],w[3]]]}else if(e[0]>t[2]&&e[3]<t[1]){let v=w[2]+(y[0]-w[2])/2,k=y[3]+(w[1]-y[3])/2;return er(Ut(e[2]-b,e[1]-S),Ut(e[0]-b,e[3]-S))>0?[[v,y[1],y[2],y[3]],[w[0],w[1],v,w[3]]]:[[y[0],y[1],y[2],k],[w[0],k,w[2],w[3]]]}else if(e[0]>t[2]&&e[1]>t[3]){let v=w[2]+(y[0]-w[2])/2,k=w[3]+(y[1]-w[3])/2;return er(Ut(e[0]-b,e[1]-S),Ut(e[2]-b,e[3]-S))>0?[[v,y[1],y[2],y[3]],[w[0],w[1],v,w[3]]]:[[y[0],k,y[2],y[3]],[w[0],w[1],w[2],k]]}}return[y,w]},zh=(e,t,n,o,i,r)=>{let a=new Set,s=new Set;n===ct||n===Ce?s.add(t[1]):a.add(t[0]),i===ct||i===Ce?s.add(o[1]):a.add(o[0]),e.forEach(c=>{a.add(c[0]),a.add(c[2]),s.add(c[1]),s.add(c[3])}),a.add(r[0]),a.add(r[2]),s.add(r[1]),s.add(r[3]);let l=Array.from(s).sort((c,p)=>c-p),d=Array.from(a).sort((c,p)=>c-p);return{row:l.length,col:d.length,data:l.flatMap((c,p)=>d.map((h,m)=>({f:0,g:0,h:0,closed:!1,visited:!1,parent:null,addr:[m,p],pos:[h,c]})))}},ud=(e,t,n)=>{switch(t){case yt:return Q(n[0],e[1]);case Ce:return Q(e[2],n[1]);case We:return Q(n[0],e[3])}return Q(e[0],n[1])},_h=(e,t,n,o)=>{if(o===Ce)switch(n){case Ce:return e.pos[0]>=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2;case yt:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case We:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case ct:return e.pos[1]===t.pos[1]?4:2}else if(o===ct)switch(n){case Ce:return e.pos[1]===t.pos[1]?4:2;case yt:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case We:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case ct:return e.pos[0]<=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2}else if(o===yt)switch(n){case Ce:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case yt:return e.pos[1]>=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case We:return e.pos[0]===t.pos[0]?4:2;case ct:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3}else if(o===We)switch(n){case Ce:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case yt:return e.pos[0]===t.pos[0]?4:2;case We:return e.pos[1]<=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case ct:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3}return 0},Wh=([e,t],n)=>[Jo([e,t-1],n),Jo([e+1,t],n),Jo([e,t+1],n),Jo([e-1,t],n)],Jo=([e,t],n)=>e<0||e>=n.col||t<0||t>=n.row?null:n.data[t*n.col+e]??null,tr=(e,t)=>{for(let n=0;n<t.col;n++)for(let o=0;o<t.row;o++){let i=Jo([n,o],t);if(i&&e[0]===i.pos[0]&&e[1]===i.pos[1])return i}return null},gd=e=>[Math.min(...e.map(t=>t[0])),Math.min(...e.map(t=>t[1])),Math.max(...e.map(t=>t[2])),Math.max(...e.map(t=>t[3]))],nr=(e,t)=>{let n=t.get(e);return n&&Ae(n)?n:null},un=(e,t,n,o)=>{let i=e[0][0],r=e[0][1],a=e.map(s=>ya(s,kh(ba(e[0]),-1)));return(i<-Ln||i>Ln||r<-Ln||r>Ln||i+a[a.length-1][0]<-Ln||i+a[a.length-1][0]>Ln||r+a[a.length-1][1]<-Ln||r+a[a.length-1][1]>Ln)&&console.error("Elbow arrow normalization is outside reasonable bounds (> 1e6)",{x:i,y:r,points:a,...cd(a)}),a=a.map(([s,l])=>Q(Ji(s,-1e6,1e6),Ji(l,-1e6,1e6))),{points:a,x:Ji(i,-1e6,1e6),y:Ji(r,-1e6,1e6),fixedSegments:(t?.length??0)>0?t:null,...cd(a),startIsSpecial:n,endIsSpecial:o}},Sa=e=>{if(e.length>1){let t=Math.abs(e[0][1]-e[1][1])<Math.abs(e[0][0]-e[1][0]);return e.filter((n,o)=>{if(o===0||o===e.length-1)return!0;let i=e[o+1],r=Math.abs(n[1]-i[1])<Math.abs(n[0]-i[0]);return t===r?(t=r,!1):(t=r,!0)})}return e},va=e=>e.length>=4?e.filter((t,n)=>{if(n===0||n===e.length-1)return!0;let o=e[n-1];return wa(o,t)>Ma}):e,jh=e=>{switch(e){case 0:return yt;case 1:return Ce;case 2:return We}return ct},pd=(e,t,n,o,i,r,a,s=!0,l=!0)=>a?s&&i&&r?Aa(e,i,t,r,void 0,l):o:i?st(n||[0,0],i,r??Dh([i])):o,hd=(e,t,n,o,i,r)=>xd(e,t,n,n&&It(n,i,Array(4).fill(An(n,i,e))),o,i,r),md=(e,t,n,o)=>ln(e,n,t,Lt(o)),fd=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ed=(e,t=Ma)=>e.slice(1).map((n,o)=>Math.abs(n[0]-e[o][0])<t||Math.abs(n[1]-e[o][1])<t).every(Boolean);var je=(e,t,n,o)=>{let i=!1,{points:r,fixedSegments:a,fileId:s}=n;Z(e)&&(Object.keys(n).length===0||typeof r<"u"||typeof a<"u")?n={...n,angle:0,...yo({...e,x:n.x||e.x,y:n.y||e.y},t,n,o)}:typeof r<"u"&&(n={...Vh(r),...n});for(let l in n){let d=n[l];if(typeof d<"u"){if(e[l]===d&&(typeof d!="object"||d===null||l==="groupIds"||l==="scale"))continue;if(l==="scale"){let c=e[l],p=d;if(c[0]===p[0]&&c[1]===p[1])continue}else if(l==="points"){let c=e[l],p=d;if(c.length===p.length){let h=!1,m=c.length;for(;--m;){let g=c[m],f=p[m];if(g[0]!==f[0]||g[1]!==f[1]){h=!0;break}}if(!h)continue}}e[l]=d,i=!0}}return i&&((typeof n.height<"u"||typeof n.width<"u"||typeof s<"u"||typeof r<"u")&&wt.delete(e),e.version=n.version??e.version+1,e.versionNonce=n.versionNonce??ka(),e.updated=Ta()),e},Je=(e,t,n=!1)=>{let o=!1;for(let i in t){let r=t[i];if(typeof r<"u"){if(e[i]===r&&(typeof r!="object"||r===null))continue;o=!0}}return!o&&!n?e:{...e,...t,version:t.version??e.version+1,versionNonce:t.versionNonce??ka(),updated:Ta()}},yd=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=ka(),e.updated=Ta(),e);var Sd=5,to=5,$h=10,ii=10/1.5,Qe=(e,t)=>(t.elbowed?to:Sd)+e.strokeWidth/2,Lt=e=>{let t=Math.max(Sd,15),n=e?.value&&e.value<1?e.value:1;return Ca(t/(n*1.5),t,t*2)},Yt=e=>e.isBindingEnabled,Zh=(e,t,n,o,i,r,a)=>{let{start:s,end:l}=Da(e,t,n,o,i.getNonDeletedElementsMap(),i.getNonDeletedElements(),r,{...a,finalize:!0});if(wd(e,s,"start",i,r.isBindingEnabled),wd(e,l,"end",i,r.isBindingEnabled),s.focusPoint||l.focusPoint){let d=new Map;s.focusPoint&&d.set(0,{point:Bt(e,"startBinding",e.startBinding,s.element,i.getNonDeletedElementsMap())||e.points[0]}),l.focusPoint&&d.set(e.points.length-1,{point:Bt(e,"endBinding",e.endBinding,l.element,i.getNonDeletedElementsMap())||e.points[e.points.length-1]}),F.movePoints(e,i,d)}return{start:s,end:l}},wd=(e,{mode:t,element:n,focusPoint:o},i,r,a=!0)=>{t===null?Ze(e,i,r):t!==void 0&&Xt(e,n,t,i,r,o,a)},vd=(e,t,n,o,i)=>{hn(t.size===1,"Bound elbow arrows cannot be moved");let r=t.entries().next().value;hn(r,"There should be a position update for dragging an elbow arrow endpoint");let[a,{point:s}]=r,l=F.getPointGlobalCoordinates(e,s,n),d=ln(l,o,n,Lt(i)),c=d?{element:d,mode:"orbit",focusPoint:F.getPointAtIndexGlobalCoordinates(e,a,n)}:{mode:null},p={mode:void 0};return a===0?{start:c,end:p}:{start:p,end:c}},qh=(e,t,n,o,i,r,a,s,l,d,c)=>{let p={mode:void 0},h={mode:void 0},m=e.points.length>2,g=F.getPointGlobalCoordinates(e,t.get(i?a:s).point,n),f=ln(g,o,n);if(i)return f?p={element:f,mode:"inside",focusPoint:g}:p={mode:null},{start:p,end:h};if(r){let E=l?.selectedLinearElement?.initialState.origin;if(f&&e.startBinding?.elementId===f.id){let x=pe(f.x+f.width/2,f.y+f.height/2);return{start:m?{mode:void 0}:{mode:"inside",element:f,focusPoint:E??x},end:m?{mode:"orbit",element:f,focusPoint:g}:{mode:"inside",element:f,focusPoint:g}}}if(f&&e.startBinding){let x=e.startBinding;if(Xi(g,o,n).find(w=>w.id===x.elementId)){let w=n.get(e.startBinding.elementId);return hn(w,"Other element must be in the elements map"),{start:m?{mode:void 0}:{mode:w.id!==f.id?"orbit":"inside",element:w,focusPoint:E??pe(e.x,e.y)},end:{mode:"orbit",element:f,focusPoint:g}}}}if(e.startBinding&&e.startBinding.elementId!==f?.id){let x=n.get(e.startBinding.elementId);hn(x,"Other element must be in the elements map");let w={mode:!!l.selectedLinearElement?.initialState.arrowStartIsInside?"inside":"orbit",element:x,focusPoint:c?me(x,n):E??pe(e.x,e.y)},M=f&&fa(x,f,n),b;if(f){let S=d==="inside"||d==="skip";b={mode:S&&!M?"inside":"orbit",element:f,focusPoint:g}}else b={mode:null};return{start:m?{mode:void 0}:w,end:b}}if(!e.startBinding)return f?h={mode:d==="inside"||d==="skip"?"inside":"orbit",element:f,focusPoint:g}:h={mode:null},{start:p,end:h}}hn(!1,"New arrow creation should not reach here")},bd=(e,t,n,o,i,r,a,s)=>{let l={mode:void 0},d={mode:void 0},c=a.points.length>2,p=ln(e,i,o),h=n?Xi(e,i,o).some(E=>E.id===n.elementId):!1,m=n?o.get(n.elementId):null,g=h&&m?Yh(m.backgroundColor):!1,f=p&&m&&fa(m,p,o);return r==="inside"||r==="skip"?(l=p?{element:!h||!m||g?p:m,focusPoint:e,mode:"inside"}:{mode:null},d=s&&p&&p.id===n?.elementId?{mode:null}:d,{current:l,other:d}):p?p.id===t?.elementId&&t.mode==="inside"?{current:{mode:"inside",focusPoint:e,element:p},other:d}:n?n.elementId===p.id?n.mode==="orbit"?(l={element:p,mode:"orbit",focusPoint:e},d={mode:s?null:void 0},{current:l,other:c?{mode:void 0}:d}):(l={element:p,mode:"inside",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):(h&&m&&!g?l={element:m,mode:"inside",focusPoint:e}:l={element:p,mode:"orbit",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):(l={element:p,mode:"orbit",focusPoint:e},{current:l,other:c?{mode:void 0}:d}):{current:{mode:null},other:d}},Da=(e,t,n,o,i,r,a,s)=>Uh("COMPLEX_BINDINGS")?Kh(e,t,i,r,a,s):Ad(e,t,n,o,i,r,a,s),Ad=(e,t,n,o,i,r,a,s)=>{let d=e.points.length-1,c=t.has(0),p=t.has(d),h={mode:void 0},m={mode:void 0};if(e.points.length<2)return console.error("Attempting to bind a linear element with less than 2 points"),{start:{mode:void 0},end:{mode:void 0}};if(!c&&!p)return{start:h,end:m};if(c&&p)return{start:{mode:null},end:{mode:null}};if(!Yt(a))return h=c?{mode:null}:h,m=p?{mode:null}:m,{start:h,end:m};if(Z(e))return vd(e,t,i,r,s?.zoom);let g=c?e.endBinding:e.startBinding,f=t.get(c?0:d)?.point;hn(f,`Local point must be defined for ${c?"start":"end"} dragging`);let E=F.getPointGlobalCoordinates(e,f,i),x=ln(E,r,i,Lt(a.zoom)),y=x&&(s?.angleLocked?on(pe(n,o),x,i):on(E,x,i)),w=g?i.get(g.elementId):void 0,M=g&&w&&st(g.fixedPoint,w,i),b=w&&M&&_t({point:M,element:w,elementsMap:i,threshold:0,overrideShouldTestInside:!0});if(g&&g.elementId===x?.id&&(!s?.newArrow||a.selectedLinearElement?.initialState.origin))return{start:{mode:"inside",element:x,focusPoint:c?E:s?.newArrow?a.selectedLinearElement.initialState.origin:F.getPointAtIndexGlobalCoordinates(e,0,i)},end:{mode:"inside",element:x,focusPoint:p?E:F.getPointAtIndexGlobalCoordinates(e,-1,i)}};if(s?.altKey)return{start:c?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:h,end:p?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:m};let S=x?y?{mode:"inside",element:x,focusPoint:E}:{mode:"orbit",element:x,focusPoint:fo(e,E,x,c?"start":"end",i,a.zoom,a.isMidpointSnappingEnabled)||E}:{mode:null},v=F.getPointAtIndexGlobalCoordinates(e,c?-1:0,i),k=M&&w&&_t({point:E,element:w,elementsMap:i,threshold:Lt(a.zoom),overrideShouldTestInside:!0}),O=(s?.newArrow?a.selectedLinearElement?.initialState.arrowStartIsInside:g?.mode==="inside")?{mode:void 0}:w&&!b&&!k&&a.selectedLinearElement?.initialState.altFocusPoint?{mode:"orbit",element:w,focusPoint:a.selectedLinearElement.initialState.altFocusPoint}:s?.angleLocked&&w?{mode:"orbit",element:w,focusPoint:fo(e,v,w,c?"end":"start",i,a.zoom,a.isMidpointSnappingEnabled)||v}:{mode:void 0};return{start:c?S:O,end:p?S:O}},Kh=(e,t,n,o,i,r)=>{let a=i.bindMode||"orbit",s=0,l=e.points.length-1,d=t.has(s),c=t.has(l),p={mode:void 0},h={mode:void 0};if(e.points.length<2)return console.error("Attempting to bind a linear element with less than 2 points"),{start:{mode:void 0},end:{mode:void 0}};if(!d&&!c)return{start:p,end:h};if(d&&c)return{start:{mode:null},end:{mode:null}};if(!Yt(i))return p=d?{mode:null}:p,h=c?{mode:null}:h,{start:p,end:h};if(Z(e))return vd(e,t,n,o);if(r?.newArrow){let{start:m,end:g}=qh(e,t,n,o,d,c,s,l,i,a,r?.shiftKey);return{start:m,end:g}}if(d){let m=t.get(s)?.point;hn(m,"Local point must be defined for start dragging");let g=F.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=bd(g,e.startBinding,e.endBinding,n,o,a,e,r?.finalize);return{start:f,end:E}}if(c){let m=t.get(l)?.point;hn(m,"Local point must be defined for end dragging");let g=F.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=bd(g,e.endBinding,e.startBinding,n,o,a,e,r?.finalize);return{start:E,end:f}}return{start:p,end:h}},X3=(e,t,n)=>{e.forEach(o=>{Zh(o,new Map,1/0,1/0,t,n)})},Xt=(e,t,n,o,i,r,a=!0)=>{let s=i.getNonDeletedElementsMap(),l;Z(e)?l={elementId:t.id,mode:"orbit",...om(e,t,o,s,a)}:l={elementId:t.id,mode:n,...wo(e,t,o,s,r)},i.mutateElement(e,{[o==="start"?"startBinding":"endBinding"]:l}),Id(t.boundElements||[]).has(e.id)||i.mutateElement(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},Ze=(e,t,n)=>{let o=t==="start"?"startBinding":"endBinding",i=e[o];if(i==null)return null;let r=e[t==="start"?"endBinding":"startBinding"];if(!r||r.elementId!==i.elementId){let a=n.getNonDeletedElementsMap().get(i.elementId);n.mutateElement(a,{boundElements:a.boundElements?.filter(s=>s.id!==e.id)})}return n.mutateElement(e,{[o]:null}),i.elementId},qe=(e,t,n)=>{if(!Ae(e))return;let{simultaneouslyUpdated:o}=n??{},i=Jh(o),r=t.getNonDeletedElementsMap();n?.changedElements&&(r=new Map(r),n.changedElements.forEach(s=>{r.set(s.id,s)})),ar(r,e,s=>{if(!Y(s)||s.isDeleted||!Qh(s,e))return;let l=s.startBinding?r.get(s.startBinding.elementId):null,d=s.endBinding?l?.id===s.endBinding.elementId?l:r.get(s.endBinding.elementId):null;if(i.has(s.id))return;let c=sr(r,s,(h,m)=>{if(h&&Ae(h)&&(m==="startBinding"||m==="endBinding")&&(e.id===s[m]?.elementId||e.id===s[m==="startBinding"?"endBinding":"startBinding"]?.elementId)){let g=Bt(s,m,s[m],h,r);if(g)return[m==="startBinding"?0:s.points.length-1,{point:g}]}return null}).filter(h=>h!==null);F.movePoints(s,t,new Map(c),{moveMidPointsWithElement:!!l&&l?.id===d?.id});let p=te(s,r);p&&!p.isDeleted&&eo(s,t,!1)})},Md=(e,t,n,o,i)=>{hn(!Z(e),"Elbow arrows not supported for indirect updates");let r=e[t],a=r&&n.get(r.elementId),s=F.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?0:-1,n),l=a&&_t({element:a,point:s,elementsMap:n,threshold:Lt(i.zoom)}),d=t==="startBinding"?"start":"end";if(Ze(e,d,o),l){let c=t==="startBinding"?0:e.points.length-1,p=e.points[c],h=Ad(e,new Map([[c,{point:p}]]),s[0],s[1],n,o.getNonDeletedElements(),i);h[d]&&h[d].element?.id===a.id&&h[d].mode&&Xt(e,a,h[d].mode,d,o,h[d].focusPoint)}},$3=(e,t,n,o)=>{if(Y(e)){let i=t.getNonDeletedElementsMap();e.startBinding&&Md(e,"startBinding",i,t,n),e.endBinding&&Md(e,"endBinding",i,t,n)}else qe(e,t,{...o,changedElements:new Map([[e.id,e]])})},Qh=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,Jh=e=>new Set((e||[]).map(t=>t.id)),xd=(e,t,n,o,i,r,a)=>{let s=cn(ti(t,e));return!n||!o?s:em(i,n,r,a)?Qo(n,o,e):cn(ti(e,me(n,r)))},em=(e,t,n,o)=>{let i=An(t,n,e),r=Lt(o);return i>r?null:i},Aa=(e,t,n,o,i,r=!0)=>{let a=Z(e),s=F.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o);if(e.points.length<2)return s;let l=vl(t)&&a?tm(e,t,o,s):s,d=i&&!a?i[1]:F.getPointAtIndexGlobalCoordinates(e,n==="start"?1:-2,o),c=Qe(t,e),p=It(t,o),h=kn(p),m=null;if(a){let g=ut(Qo(t,p,s)),E=(r?Ba(t,o,l,.05,e):void 0)||s,x=pe(g?h[0]:E[0],g?E[1]:h[1]),y=i??rr(x,or(ir(La(ti(E,x)),Math.max(t.width,t.height)*2),x));if(m=jt(t,o,y,c).sort(pn)[0],!m){let w=pe(g?E[0]:h[0],g?h[1]:E[1]),M=rr(w,or(ir(La(ti(E,w)),Math.max(t.width,t.height)*2),w));m=jt(t,o,M,to).sort(pn)[0]}}else{let g=i;if(!g){let f=ir(La(ti(l,d)),Dn(l,d)+Math.max(t.width,t.height)+c*2);g=i??rr(or(f,d),or(ir(f,-1),d))}m=Dn(l,d)<1?l:jt(t,o,g,c).sort((f,E)=>pn(f,d)-pn(E,d))[0]}return!m||pn(l,m)<oi?l:m},tm=(e,t,n,o)=>{let i=me(t,n),r=ye(o,i,-t.angle),a=Qe(t,e);return r[0]<t.x&&r[1]<t.y?r[1]-t.y>-a?ye(pe(t.x-a,t.y),i,t.angle):ye(pe(t.x,t.y-a),i,t.angle):r[0]<t.x&&r[1]>t.y+t.height?r[0]-t.x>-a?ye(pe(t.x,t.y+t.height+a),i,t.angle):ye(pe(t.x-a,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]>t.y+t.height?r[0]-t.x<t.width+a?ye(pe(t.x+t.width,t.y+t.height+a),i,t.angle):ye(pe(t.x+t.width+a,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]<t.y?r[0]-t.x<t.width+a?ye(pe(t.x+t.width,t.y-a),i,t.angle):ye(pe(t.x+t.width+a,t.y),i,t.angle):o},Ba=(e,t,n,o=.05,i)=>{let{x:r,y:a,width:s,height:l,angle:d}=e,c=me(e,t,-.1,-.1),p=ye(n,c,-d),h=i?Qe(e,i):0,m=Ca(o*l,5,80),g=Ca(o*s,5,80);if(!(Dn(c,p)<h)){if(p[0]<=r+s/2&&p[1]>c[1]-m&&p[1]<c[1]+m)return ye(pe(r-h,c[1]),c,d);if(p[1]<=a+l/2&&p[0]>c[0]-g&&p[0]<c[0]+g)return ye(pe(c[0],a-h),c,d);if(p[0]>=r+s/2&&p[1]>c[1]-m&&p[1]<c[1]+m)return ye(pe(r+s+h,c[1]),c,d);if(p[1]>=a+l/2&&p[0]>c[0]-g&&p[0]<c[0]+g)return ye(pe(c[0],a+l+h),c,d);if(e.type==="diamond"){let f=h,E=pe(r+s/4-f,a+l/4-f),x=pe(r+3*s/4+f,a+l/4-f),y=pe(r+s/4-f,a+3*l/4+f),w=pe(r+3*s/4+f,a+3*l/4+f);if(Dn(E,p)<Math.max(g,m))return ye(E,c,d);if(Dn(x,p)<Math.max(g,m))return ye(x,c,d);if(Dn(y,p)<Math.max(g,m))return ye(y,c,d);if(Dn(w,p)<Math.max(g,m))return ye(w,c,d)}}},nm=(e,t,n)=>{let o=e[t];if(!o)return{element:null,fixedPoint:null,focusPoint:null,binding:o,mode:null};let i=n.get(o.elementId);return{element:i,fixedPoint:o.fixedPoint,focusPoint:st(Sn(o.fixedPoint),i,n),binding:o,mode:o.mode}},Pd=e=>e.width*e.height,Bt=(e,t,n,o,i,r)=>{if(n==null||n.elementId!==o.id&&e.points.length>2||Xh(e.points[e.points.length-1],pe(0,0)))return null;let a=st(Sn(n.fixedPoint),o,i);if(n.mode==="inside")return F.createPointAt(e,i,a[0],a[1],null);let{element:s,focusPoint:l}=nm(e,t==="startBinding"?"endBinding":"startBinding",i),d=F.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?1:-2,i),c=e.points.length===2&&l||d,p=c&&rr(a,c),h=s&&p&&jt(s,i,p,Qe(s,e)).sort((w,M)=>pn(w,a)-pn(M,a))[0],m=p&&jt(o,i,p,Qe(o,e)).sort((w,M)=>pn(w,c)-pn(M,c))[0],g=e.startArrowhead!==null,f=e.endArrowhead!==null,E=!g&&!f||t==="startBinding"&&g||t==="endBinding"&&f?a:m||a;if(s&&m&&!r&&Pd(s)<Pd(o)*2&&_t({element:s,point:m,elementsMap:i,threshold:Qe(s,e),overrideShouldTestInside:!0}))return F.createPointAt(e,i,E[0],E[1],null);let y=Dn(s&&(h||l)||d,m||a)<=$h;return s?y?F.createPointAt(e,i,E?.[0]||a[0],E?.[1]||a[1],null):F.createPointAt(e,i,m?.[0]||a[0],m?.[1]||a[1],null):F.createPointAt(e,i,y?a[0]:m?.[0]??a[0],y?a[1]:m?.[1]??a[1],null)},om=(e,t,n,o,i=!0,r=!0)=>{let a=[t.x,t.y,t.x+t.width,t.y+t.height],s=i?Aa(e,t,n,o,void 0,r):F.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),l=pe(a[0]+(a[2]-a[0])/2,a[1]+(a[3]-a[1])/2),d=ye(s,l,-t.angle);return{fixedPoint:Sn([(d[0]-t.x)/Math.max(t.width,oi),(d[1]-t.y)/Math.max(t.height,oi)])}},wo=(e,t,n,o,i)=>{let r=i||F.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),a=me(t,o),s=ye(r,a,-t.angle),l=(s[0]-t.x)/Math.max(t.width,oi),d=(s[1]-t.y)/Math.max(t.height,oi);return{fixedPoint:Sn([l,d])}},kd=(e,t,n)=>{for(let o of e){if("boundElements"in o&&o.boundElements&&Object.assign(o,{boundElements:o.boundElements.reduce((i,r)=>{let a=t.get(r.id);return a&&i.push({...r,id:a}),i},[])}),"containerId"in o&&o.containerId&&Object.assign(o,{containerId:t.get(o.containerId)??null}),"endBinding"in o&&o.endBinding){let i=t.get(o.endBinding.elementId);Object.assign(o,{endBinding:i?{...o.endBinding,elementId:i}:null})}if("startBinding"in o&&o.startBinding){let i=t.get(o.startBinding.elementId);Object.assign(o,{startBinding:i?{...o.startBinding,elementId:i}:null})}Z(o)&&Object.assign(o,yo(o,n,{points:[o.points[0],o.points[o.points.length-1]]}))}},Z3=(e,t)=>{let n=Id(e);for(let o of t)Bn.unbindAffected(n,o,(i,r)=>je(i,n,r)),Gn.unbindAffected(n,o,(i,r)=>je(i,n,r))},ni=(e,t,n=[])=>{if(!e)return null;let o=e.filter(i=>!t.has(i.id));return o.push(...n.map(i=>({id:i.id,type:i.type}))),o},Td=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),ar=(e,t,n)=>{Ae(t)&&(t.boundElements?.slice()??[]).forEach(({id:i})=>{n(e.get(i),"boundElements",i)})},sr=(e,t,n)=>{let o=[];if(t.frameId){let i=t.frameId;o.push(n(e.get(i),"frameId",i))}if(ke(t)){let i=t.containerId;o.push(n(e.get(i),"containerId",i))}if(Y(t)){if(t.startBinding){let i=t.startBinding.elementId;o.push(n(e.get(i),"startBinding",i))}if(t.endBinding){let i=t.endBinding.elementId;o.push(n(e.get(i),"endBinding",i))}}return o},Bn=class{static unbindAffected(t,n,o){n&&sr(t,n,i=>{!i||i.isDeleted||ar(t,i,(r,a,s)=>{s===n.id&&o(i,{boundElements:ni(i.boundElements,new Set([s]))})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||sr(t,n,(i,r)=>{if(!i||i.isDeleted){o(n,{[r]:null});return}r!=="frameId"&&(i.boundElements?.find(a=>a.id===n.id)||(Y(n)&&o(i,{boundElements:ni(i.boundElements,new Set,new Array(n))}),re(n)&&(i.boundElements?.find(a=>a.type==="text")?o(n,{[r]:null}):o(i,{boundElements:ni(i.boundElements,new Set,new Array(n))}))))})}},Gn=class{static unbindAffected(t,n,o){n&&ar(t,n,i=>{!i||i.isDeleted||sr(t,i,(r,a,s)=>{s===n.id&&o(i,{[a]:null})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||ar(t,n,(i,r,a)=>{if(!i||i.isDeleted){o(n,{boundElements:ni(n.boundElements,new Set([a]))});return}re(i)&&((n.boundElements?.slice()??[]).reverse().find(l=>l.type==="text")?.id===i.id?i.containerId!==n.id&&o(i,{containerId:n.id}):(i.containerId!==null&&o(i,{containerId:null}),o(n,{boundElements:ni(n.boundElements,new Set([i.id]))})))})}},st=(e,t,n)=>{let[o,i]=Sn(e);return ye(pe(t.x+t.width*o,t.y+t.height*i),me(t,n),t.angle)},im=(e,t)=>{let n=e.startBinding&&t.get(e.startBinding.elementId),o=e.endBinding&&t.get(e.endBinding.elementId),i=n&&e.startBinding?st(e.startBinding.fixedPoint,n,t):pe(e.x+e.points[0][0],e.y+e.points[0][1]),r=o&&e.endBinding?st(e.endBinding.fixedPoint,o,t):pe(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]);return[i,r]},Ld=(e,t)=>{let[n,o]=im(e,t);return[F.pointFromAbsoluteCoords(e,n,t),F.pointFromAbsoluteCoords(e,o,t)]},rm=e=>Array.isArray(e)&&e.length===2&&e.every(t=>Number.isFinite(t)),Sn=e=>{if(!rm(e))return[.5001,.5001];let t=1e-4;return Math.abs(e[0]-.5)<t||Math.abs(e[1]-.5)<t?e.map(n=>Math.abs(n-.5)<t?.5001:n):e},am=e=>e.type==="ellipse"||e.type==="diamond"?e.type:"rectangle",sm={rectangle:[{centerAngle:0,sectorWidth:75,side:"right"},{centerAngle:45,sectorWidth:15,side:"bottom-right"},{centerAngle:90,sectorWidth:75,side:"bottom"},{centerAngle:135,sectorWidth:15,side:"bottom-left"},{centerAngle:180,sectorWidth:75,side:"left"},{centerAngle:225,sectorWidth:15,side:"top-left"},{centerAngle:270,sectorWidth:75,side:"top"},{centerAngle:315,sectorWidth:15,side:"top-right"}],diamond:[{centerAngle:0,sectorWidth:15,side:"right"},{centerAngle:45,sectorWidth:75,side:"bottom-right"},{centerAngle:90,sectorWidth:15,side:"bottom"},{centerAngle:135,sectorWidth:75,side:"bottom-left"},{centerAngle:180,sectorWidth:15,side:"left"},{centerAngle:225,sectorWidth:75,side:"top-left"},{centerAngle:270,sectorWidth:15,side:"top"},{centerAngle:315,sectorWidth:75,side:"top-right"}],ellipse:[{centerAngle:0,sectorWidth:15,side:"right"},{centerAngle:45,sectorWidth:75,side:"bottom-right"},{centerAngle:90,sectorWidth:15,side:"bottom"},{centerAngle:135,sectorWidth:75,side:"bottom-left"},{centerAngle:180,sectorWidth:15,side:"left"},{centerAngle:225,sectorWidth:75,side:"top-left"},{centerAngle:270,sectorWidth:15,side:"top"},{centerAngle:315,sectorWidth:75,side:"top-right"}]},lm=e=>e.map((t,n)=>{let o=t.sectorWidth/2,i=t.centerAngle-o,r=t.centerAngle+o;return i=(i%360+360)%360,r=(r%360+360)%360,{start:i,end:r,side:t.side}}),dm=(e,t)=>{let[n,o]=e,i=n-.5,r=o-.5,a=Math.atan2(r,i);a<0&&(a+=2*Math.PI);let s=a*180/Math.PI,l=sm[t],d=lm(l);for(let h of d)if(h.start<=h.end){if(s>=h.start&&s<=h.end)return h.side}else if(s>=h.start||s<=h.end)return h.side;let c=1/0,p=l[0].side;for(let h of l){let m=Math.abs(s-h.centerAngle);m>180&&(m=360-m),m<c&&(c=m,p=h.side)}return p},q3=(e,t)=>{let n=t.get(e.elementId);if(!n||n.isDeleted||!Ae(n))return null;let o=me(n,t),i=am(n),r=dm(Sn(e.fixedPoint),i),a=.01;if(n.type==="diamond"){let[s,l]=In(n),[d,c,p,h]=s,m,g;switch(r){case"left":{if(l.length>=3){let E=l[2][1];m=E[0]-a,g=E[1]}else{let f=$e(c[1],p[0]);m=f[0]-a,g=f[1]}break}case"right":{if(l.length>=1){let E=l[0][1];m=E[0]+a,g=E[1]}else{let f=$e(h[1],d[0]);m=f[0]+a,g=f[1]}break}case"top":{if(l.length>=4){let E=l[3][1];m=E[0],g=E[1]-a}else{let f=$e(p[1],h[0]);m=f[0],g=f[1]-a}break}case"bottom":{if(l.length>=2){let E=l[1][1];m=E[0],g=E[1]+a}else{let f=$e(d[1],c[0]);m=f[0],g=f[1]+a}break}case"top-right":{let f=$e(h[0],h[1]);m=f[0]+a*.707,g=f[1]-a*.707;break}case"bottom-right":{let f=$e(d[0],d[1]);m=f[0]+a*.707,g=f[1]+a*.707;break}case"bottom-left":{let f=$e(c[0],c[1]);m=f[0]-a*.707,g=f[1]+a*.707;break}case"top-left":{let f=$e(p[0],p[1]);m=f[0]-a*.707,g=f[1]-a*.707;break}default:return null}return ye(pe(m,g),o,n.angle)}if(n.type==="ellipse"){let s=n.x+n.width/2,l=n.y+n.height/2,d=n.width/2,c=n.height/2,p,h;switch(r){case"top":{p=s,h=l-c-a;break}case"right":{p=s+d+a,h=l;break}case"bottom":{p=s,h=l+c+a;break}case"left":{p=s-d-a,h=l;break}case"top-right":{let m=-Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);p=s+g+a*.707,h=l+f-a*.707;break}case"bottom-right":{let m=Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);p=s+g+a*.707,h=l+f+a*.707;break}case"bottom-left":{let m=3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);p=s+g-a*.707,h=l+f+a*.707;break}case"top-left":{let m=-3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);p=s+g-a*.707,h=l+f-a*.707;break}default:return null}return ye(pe(p,h),o,n.angle)}if(Uo(n)){let[s,l]=Pn(n),[d,c,p,h]=s,m,g;switch(r){case"top":{let f=$e(d[0],d[1]);m=f[0],g=f[1]-a;break}case"right":{let f=$e(c[0],c[1]);m=f[0]+a,g=f[1];break}case"bottom":{let f=$e(p[0],p[1]);m=f[0],g=f[1]+a;break}case"left":{let f=$e(h[0],h[1]);m=f[0]-a,g=f[1];break}case"top-left":{if(l.length>=1){let f=l[0],E=f[0],x=f[3],y=$e(E,x);m=y[0]-a*.707,g=y[1]-a*.707}else m=n.x-a,g=n.y-a;break}case"top-right":{if(l.length>=2){let f=l[1],E=f[0],x=f[3],y=$e(E,x);m=y[0]+a*.707,g=y[1]-a*.707}else m=n.x+n.width+a,g=n.y-a;break}case"bottom-right":{if(l.length>=3){let f=l[2],E=f[0],x=f[3],y=$e(E,x);m=y[0]+a*.707,g=y[1]+a*.707}else m=n.x+n.width+a,g=n.y+n.height+a;break}case"bottom-left":{if(l.length>=4){let f=l[3],E=f[0],x=f[3],y=$e(E,x);m=y[0]-a*.707,g=y[1]+a*.707}else m=n.x-a,g=n.y+n.height+a;break}default:return null}return ye(pe(m,g),o,n.angle)}return null},$e=(e,t)=>pe((e[0]+t[0])/2,(e[1]+t[1])/2);I();import{arrayToMap as Zd,findIndex as qd,findLastIndex as Kd}from"@excalidraw/common";import{isFiniteNumber as Fm}from"@excalidraw/math";I();I();import{arrayToMap as vm,isShallowEqual as Am}from"@excalidraw/common";I();import{arrayToMap as Gt}from"@excalidraw/common";import{isPointWithinBounds as mm,pointFrom as Na,segmentsIntersectAt as fm}from"@excalidraw/math";I();import{arrayToMap as lr}from"@excalidraw/common";import{validateOrderKey as cm,generateNKeysBetween as um}from"@excalidraw/fractional-indexing";var Ga=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"},pm=(e,{shouldThrow:t=!1,includeBoundTextValidation:n=!1,ignoreLogs:o,reconciliationContext:i})=>{let r=[],a=l=>`${l?.index}:${l?.id}:${l?.type}:${l?.isDeleted}:${l?.version}:${l?.versionNonce}`,s=e.map(l=>l.index);for(let[l,d]of s.entries()){let c=s[l-1],p=s[l+1];if(Oa(d,c,p)||r.push(`Fractional indices invariant has been compromised: "${a(e[l-1])}", "${a(e[l])}", "${a(e[l+1])}"`),n&&zt(e[l])){let h=e[l],m=te(h,lr(e));m&&m.index<=h.index&&r.push(`Fractional indices invariant for bound elements has been compromised: "${a(m)}", "${a(h)}"`)}}if(r.length){let l=new Ga,d=[];if(i&&(d.push("Additional reconciliation context:"),d.push(i.localElements.map(c=>a(c))),d.push(i.remoteElements.map(c=>a(c)))),o||console.error(r.join(`
11
11
 
12
- `),l.stack,e.map(c=>a(c)),...d),t)throw l}},gd=e=>e.sort((t,n)=>fd(t)&&fd(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),Yn=(e,t)=>{try{let n=Zi(e),o=zh(e,t),i=va(e,o),r=e.map(a=>{let s=i.get(a);return s?{...a,index:s.index}:a});Hh(r,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(let[a,{index:s}]of i)Te(a,n,{index:s})}catch{Sa(e)}return e},Sa=e=>{let t=Zi(e),n=xd(e),o=va(e,n);for(let[i,{index:r}]of o)Te(i,t,{index:r});return e},Ed=e=>{let t=Zi(e),n=xd(e),o=va(e,n);for(let[i,{index:r}]of o)t.set(i.id,He(i,{index:r}));return t},zh=(e,t)=>{let n=[],o=0;for(;o<e.length;)if(t.has(e[o].id)){let i=[o-1,o];for(;++o<e.length&&t.has(e[o].id);)i.push(o);i.push(o),n.push(i)}else o++;return n},xd=e=>{let t=[],n,o,i=-1,r=0,a=d=>{let c=e[i]?e[i].index:void 0,u=e[d-1]?.index;return!c&&u||c&&u&&u>c?[u,d-1]:[c,i]},s=d=>{let c=e[r]?e[r].index:void 0;if(c&&d<r)return[c,r];let u=r;for(;++u<e.length;){let h=e[u]?.index;if(!c&&h||c&&h&&h>c)return[h,u]}return[void 0,u]},l=0;for(;l<e.length;){let d=e[l].index;if([n,i]=a(l),[o,r]=s(l),Ia(d,n,o))l++;else{let c=[i,l];for(;++l<e.length;){let u=e[l].index,[h,m]=a(l),[g,f]=s(l);if(Ia(u,h,g))break;[n,i]=[h,m],[o,r]=[g,f],c.push(l)}c.push(r),t.push(c)}}return t},Ia=(e,t,n)=>{if(!e)return!1;try{Fh(e)}catch{return!1}return t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e},va=(e,t)=>{let n=new Map;for(let o of t){let i=o.shift(),r=o.pop(),a=Nh(e[i]?.index,e[r]?.index,o.length);for(let s=0;s<o.length;s++){let l=e[o[s]];n.set(l,{index:a[s]})}}return n},fd=e=>!!e.index;var yd=(e,t,n)=>{let o=Mt(e);for(let i of t)if(i.frameId){let r=n.get(i.id),a=n.get(i.frameId),s=r&&o.get(r);s&&Te(s,o,{frameId:a??null})}};function ao(e,t,n){let o=ka(t,n),i=ka(e,n);return o.some(a=>i.some(s=>_h(a,s)))}var wd=(e,t,n)=>qi(Pd(e,t,n,!1)).filter(o=>!ee(o)&&!o.frameId||o.frameId===t.id),Ta=(e,t,n)=>La(ue(e,n),ue(t,n)),b3=(e,t)=>{let n=Mt(e);return e.filter(o=>ao(o,t,n))},vn=(e,t,n)=>{let[o,i,r,a]=K(t,n),[s,l,d,c]=We(e);return o<=s&&i<=l&&r>=d&&a>=c},In=(e,t,n)=>vn([e],t,n)||ao(e,t,n)||Ta(e,t,n),M3=(e,t,n)=>{let[o,i,r,a]=K(t,n);return Wh(Aa(o,i),Aa(e.x,e.y),Aa(r,a))},P3=(e,t,n)=>{let o=Mt(e),i=t.flatMap(r=>ze(e,r));return i.length===0?!0:!!i.find(r=>vn([r],n,o)||ao(r,n,o))},I3=(e,t,n)=>{let o=Mt(e),i=t.flatMap(r=>ze(e,r));return i.length===0?!0:i.find(r=>vn([r],n,o)||ao(r,n,o))===void 0},S3=e=>{let t=new Map;for(let n of e){let o=ee(n)?n.id:n.frameId;o&&!t.has(o)&&t.set(o,An(e,o))}return t},An=(e,t)=>{let n=[];for(let o of e.values())o.frameId===t&&n.push(o);return n},jh=e=>e.filter(t=>ee(t)),v3=e=>{let t=Mt(jh(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},A3=(e,t,n,o)=>{let i=An(e,t.id),r=new Set(i),a=new Set([...wd(e,t,o),...i.filter(h=>Ta(h,t,o))]),s=i.filter(h=>!a.has(h)),l=new Set(Array.from(a).flatMap(h=>h.groupIds));for(let h of s)if(!ao(h,t,o))h.groupIds.length===0&&r.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let g of h.groupIds)l.has(g)&&(m=!1);m&&r.delete(h)}let d=Array.from(a).filter(h=>h.groupIds.length===0);for(let h of d)r.add(h);let c=Array.from(a).filter(h=>h.groupIds.length>0),u=Id(c,n);for(let[h,m]of Object.entries(u))if(m){let g=ze(e,h);if(vn(g,t,o))for(let f of g)r.add(f)}return[...r].filter(h=>!(te(h)&&h.containerId))},k3=(e,t,n)=>Vh(qi(e,wd(e,t,n)),t,n),Vh=(e,t,n)=>{let o=[],i=new Map;for(let r of e){let a=!1;if(r.groupIds.length>0){if(r.groupIds.some(s=>i.get(s)))a=!0;else{let s=new Set(r.groupIds.flatMap(l=>ze(n,l)));a=!vn(Array.from(s),t,n)}r.groupIds.forEach(s=>{i.set(s,a)})}a||o.push(r)}return o},Sn=(e,t)=>e.frameId&&t.get(e.frameId)||null,T3=(e,t)=>{let n=new Set,o=Mt(e);e=qi(e);for(let a of e)ee(a)&&a.id!==t.id&&n.add(a.id);let i=new Set,r=[];for(let a of e)if(!(ee(a)||a.frameId&&n.has(a.frameId)))if(a.groupIds.length){let s=a.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=ze(e,s);if(l.some(d=>In(d,t,o)))for(let d of l)r.push(d)}}else In(a,t,o)&&r.push(a);return r},Yh=e=>{let t;for(let n of e){if(ee(n)||!n.frameId)return null;if(t===void 0)t=n.frameId;else if(t!==n.frameId)return null}return t??null},Uh=(e,t)=>{for(let n=e.length-1;n>=0;n--){let o=e[n];if(o.id===t)return n;if(o.frameId===t)return n+1}return null},Xh=(e,t,n)=>{let o=Mt(e),i=Yh(t),r=new Set,a=new Set;for(let c of t)ee(c)&&c.id!==n.id&&a.add(c.id);for(let c of qi(e,t)){if(ee(c)||c.frameId&&a.has(c.frameId)||c.frameId&&c.frameId!==n.id)continue;r.add(c);let u=Q(c,o);u&&!r.has(u)&&r.add(u)}for(let c of r)c.frameId!==n.id&&Te(c,o,{frameId:n.id});if(!r.size||i===n.id)return e;let s=Array.from(e.values()).filter(c=>!r.has(c)),l=Uh(s,n.id);if(l===null)return e;let d=[...s.slice(0,l),...r,...s.slice(l)];return Yn(d,Mt([...r])),Array.isArray(e)?d:new Map(d.map(c=>[c.id,c]))},bd=(e,t)=>{let n=new Map,o=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let r=o.get(i.frameId)||[];r.push(i);let a=Q(i,t);a&&(n.set(a.id,a),r.push(a)),o.set(i.frameId,r)}for(let[,i]of n)Te(i,t,{frameId:null})},$h=(e,t)=>{let n=An(e,t.id);return bd(n,Mt(e)),e},L3=(e,t,n)=>Xh($h(e,n),t,n).slice(),C3=(e,t,n)=>{let o=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(o);if(t.editingGroupId)for(let s of o)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>ze(e,l)).forEach(l=>i.add(l));let r=new Set,a=Mt(e);return i.forEach(s=>{s.frameId&&!ee(s)&&!Md(s,a,t)&&r.add(s)}),r.size>0&&bd(r,a),e},qi=(e,t)=>{let n=new Set,o=t||e;for(let a of o.values()){let s=a.groupIds[a.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let a of n)ze(e,a).some(s=>ee(s))&&i.add(a);let r=[];for(let a of o.values())i.has(a.groupIds[a.groupIds.length-1])||r.push(a);return r},Zh=(e,t,n)=>{let o=te(e)&&De(e,t)||e;return o.frameId&&n.selectedElementIds[o.id]&&n.selectedElementIds[o.frameId]?Sn(o,t):n.selectedElementIds[o.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Sn(o,t)},Md=(e,t,n,o)=>{let i=o?.targetFrame??Zh(e,t,n);if(!i)return!1;let r=te(e)&&De(e,t)||e,a=l=>{o?.checkedGroups&&r.groupIds.forEach(d=>{o.checkedGroups?.set(d,l)})};if(!n.selectedElementIds[r.id]||!n.selectedElementsAreBeingDragged||n.selectedElementIds[r.id]&&n.selectedElementIds[i.id])return!0;if(r.groupIds.length===0)return In(r,i,t);for(let l of r.groupIds)if(o?.checkedGroups?.has(l))return o.checkedGroups.get(l);let s=new Set(r.groupIds.filter(l=>o?.checkedGroups?!o.checkedGroups.has(l):!0).flatMap(l=>ze(t,l)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let l=new Set(Ft(t,n));if(n.frameToHighlight!==null)return!0;l.forEach(c=>{s.delete(c)})}for(let l of s)if(ee(l))return a(!1),!1;for(let l of s)if(In(l,i,t))return a(!0),!0;return!1},B3=(e,t,n,o,i)=>{if(!n.frameRendering||!n.frameRendering.clip)return!1;let r=ao(e,t,o)||Ta(e,t,o);if(r){for(let a of e.groupIds)i?.set(a,!0);return!0}if(!r&&e.groupIds.length>0&&!vn([e],t,o)){let a=!1;if(n.selectedElementsAreBeingDragged)a=Md(e,o,n,{targetFrame:t,checkedGroups:i});else{a=e.frameId===t.id;for(let s of e.groupIds)i?.set(s,a)}for(let s of e.groupIds)i?.set(s,a);return a}return!1},qh="Frame",Kh="AI Frame",Qh=e=>Ii(e)?qh:Kh,D3=e=>e.name===null?Qh(e):e.name,G3=(e,t,n)=>e.filter(o=>(!o.frameId||o.frameId===t.id)&&Qt(ue(o,n),ue(t,n))),O3=e=>{let t=Mt(e);return e.length>1&&e.some(n=>n.frameId&&t.has(n.frameId))};var tm=e=>e.locked||xe(e),nm=(e,t)=>e.filter(n=>!(n.frameId&&t.has(n.frameId))),om=e=>{let t=new Set;return e.forEach(n=>{ee(n)&&t.add(n.id)}),nm(e,t)},Pd=(e,t,n,o=!0,i="contain")=>{let[r,a,s,l]=K(t,n),d=Math.min(r,s),c=Math.min(a,l),u=Math.max(r,s),h=Math.max(a,l);return vd({elements:e,bounds:[d,c,u,h],elementsMap:n,type:i,shouldIgnoreElementFromSelection:tm,excludeElementsInFrames:o})},Y3=(e,t,n,o)=>{let i=new Set(t.map(r=>r.id));return e.filter(r=>{let a=Ad(r,n.width,n.height,n,o);return!i.has(r.id)&&a})},U3=function(){let e=null,t=null,n=null,o=(i,r)=>(n!=null&&i===e&&r.selectedElementIds===t||(n=i.some(a=>r.selectedElementIds[a.id]),e=i,t=r.selectedElementIds),n);return o.clearCache=()=>{e=null,t=null,n=null},o}(),Ft=(e,t,n)=>{let o=new Set,i=[];for(let r of e.values()){if(t.selectedElementIds[r.id]){i.push(r),o.add(r.id);continue}if(n?.includeBoundTextElement&&xe(r)&&t.selectedElementIds[r?.containerId]){i.push(r),o.add(r.id);continue}}if(n?.includeElementsInFrames){let r=[];return i.forEach(a=>{ee(a)&&An(e,a.id).forEach(s=>!o.has(s.id)&&r.push(s)),r.push(a)}),r}return i},X3=(e,t)=>t.editingTextElement?[t.editingTextElement]:t.newElement?[t.newElement]:Ft(e,t,{includeBoundTextElement:!0}),Ca=(e,t)=>em(t.selectedElementIds,e)?t.selectedElementIds:e,im=(e,t)=>{let n=e.filter(ne);if(n.length===1){let o=n[0],i=o.boundElements?.map(a=>a.id)??[];if(e.every(a=>a.id===o.id||i.includes(a.id)))return new D(o,Jh(t))}return null},$3=(e,t,n)=>({selectedLinearElement:im(e,t),...Sd({editingGroupId:n.editingGroupId,selectedElementIds:om(e).reduce((o,i)=>(xe(i)||(o[i.id]=!0),o),{})},t,n,null)}),Z3=(e,t)=>t.editingTextElement||e.length===1&&te(e[0])&&e[0]||null;var rm=(e,t,n)=>{let o=n.reduce((i,r)=>(r.groupIds.includes(e)&&(i[r.id]=!0),i),{});return Object.keys(o).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,...o}}},Sd=function(){let e=null,t=null,n=null,o=(r,a,s,l)=>{if(n!==void 0&&a===t&&r===e&&s.editingGroupId===n?.editingGroupId)return n;let d={};for(let h of r){let m=h.groupIds;if(s.editingGroupId){let g=m.indexOf(s.editingGroupId);g>-1&&(m=m.slice(0,g))}if(m.length>0){let g=m[m.length-1];d[g]=!0}}let c={},u=a.reduce((h,m)=>{if(m.isDeleted)return h;let g=m.groupIds.find(f=>d[f]);return g&&(h[m.id]=!0,Array.isArray(c[g])?c[g].push(m.id):c[g]=[m.id]),h},{});for(let h of Object.keys(c))c[h].length<2&&d[h]&&(d[h]=!1);return t=a,e=r,n={editingGroupId:s.editingGroupId,selectedGroupIds:d,selectedElementIds:Ca({...s.selectedElementIds,...u},l)},n},i=(r,a,s,l)=>{let d=l?l.scene.getSelectedElements({selectedElementIds:r.selectedElementIds,elements:a}):Ft(a,r);return d.length?o(d,a,r,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:Ca(r.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),am=(e,t)=>Ba(e,t)!=null,Ba=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),sm=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),Id=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let o of e){let i=o.groupIds;if(t.editingGroupId){let r=i.indexOf(t.editingGroupId);r>-1&&(i=i.slice(0,r))}if(i.length>0){let r=i[i.length-1];n={...n,...rm(r,n,e)}}}return n.selectedGroupIds},tw=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),lm=(e,t)=>e.groupIds.includes(t),ze=(e,t)=>{let n=[];for(let o of e.values())lm(o,t)&&n.push(o);return n},dm=(e,t)=>e.groupIds.find(n=>t[n]),nw=(e,t,n)=>{let o=[...e],i=n?o.indexOf(n):-1,r=i>-1?i:o.length;return o.splice(r,0,t),o},ow=(e,t)=>e.filter(n=>!t[n]),Ki=(e,t)=>{let n=new Map;return e.forEach(o=>{let i=o.groupIds.length===0?o.id:o.groupIds[o.groupIds.length-1],r=n.get(i)||[],a=Q(o,t);a&&r.push(a),n.set(i,[...r,o])}),Array.from(n.values())},kd=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let o of n.groupIds??[])t.add(o);return t},Td=e=>{let t=e.flatMap(i=>i.groupIds),n=new Map,o=0;for(let i of t)n.set(i,(n.get(i)??0)+1),n.get(i)>o&&(o=n.get(i));return o===e.length},Ld=e=>e.groupIds.length>0,Cd=(e,t,n)=>{let o=[...e],i=t?e.indexOf(t):-1,r=i>-1?i:e.length;for(let a=0;a<r;a++)o[a]=n(o[a]);return o},Qi=(e,t,n)=>{let o=sm(n),i=e.filter(u=>!xe(u)),r=new Map,a=new Map,s=u=>{let h=a.get(u.id)||[],m=Q(u,t);m&&h.push(m),a.set(u.id,[...h,u])},l=(u,h)=>{let m=r.get(h)||[],g=Q(u,t);g&&m.push(g),r.set(h,[...m,u])},d=(u,h)=>{let m=u.groupIds.indexOf(h,0);return u.groupIds.slice(0,m).length>0?l(u,u.groupIds[m-1]):s(u)},c=e.every(u=>am(n,u));return i.forEach(u=>{let h=dm(u,n.selectedGroupIds);h?o.length===1&&c?d(u,h):l(u,h):s(u)}),Array.from(r.values()).concat(Array.from(a.values()))};var Da=(e,t)=>e.frameId===t||e.id===t,Rd=(e,t,n)=>{let o=[],i=[],r=null,a=-1,s=Dd(n||Ft(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++a<e.length;){let l=e[a];s.get(l.id)?(i.length&&(o=o.concat(i),i=[]),o.push(a),r=a+1):l.isDeleted&&r===a?(r=a+1,i.push(a)):i=[]}return o},cm=e=>{let t=0;return e.reduce((n,o,i)=>(i>0&&e[i-1]!==o-1&&(t=++t),(n[t]||(n[t]=[])).push(o),n),[])},Bd=(e,t,n,o)=>{if("containerId"in e&&e.containerId){let i=o.getElement(e.containerId);if(i)return n==="left"?Math.min(t.indexOf(i),t.indexOf(e)):Math.max(t.indexOf(i),t.indexOf(e))}else{let i=e.boundElements?.find(r=>r.type!=="arrow")?.id;if(i){let r=o.getElement(i);if(r)return n==="left"?Math.min(t.indexOf(r),t.indexOf(e)):Math.max(t.indexOf(r),t.indexOf(e))}}},um=(e,t)=>{let n=-1,o=-1;return e.forEach((i,r)=>{Da(i,t)&&(n===-1&&(n=r),o=r)}),n===-1?[]:e.slice(n,o+1)},Yo=(e,t,n,o,i,r)=>{let a=r||Kt(e,n,o);if(!a)return n;let s=Q(a,o),l=te(a)?De(a,o):null,d=[a.id,s?.id,l?.id].filter(h=>!!h),c=n.findIndex(h=>d.includes(h.id)),u=n.findIndex(h=>h.id===t.id);if(u!==-1&&c!==-1&&u<c){let h=Array.from(n),m=h.splice(u,1)[0];h.splice(c,0,m),i.replaceAllElements(h)}return n},pm=(e,t,n,o,i,r)=>{let a=t[n],s=h=>h.isDeleted?!1:i?h.frameId===i:e.editingGroupId?h.groupIds.includes(e.editingGroupId):!0,l=o==="left"?Od(t,h=>s(h),Math.max(0,n-1)):Gd(t,h=>s(h),n+1),d=t[l];if(!d)return-1;if(e.editingGroupId){if(a?.groupIds.join("")===d?.groupIds.join(""))return Bd(d,t,o,r)??l;if(!d?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(d.frameId||ee(d))){let h=um(t,d.frameId||d.id);return o==="left"?t.indexOf(h[0]):t.indexOf(h[h.length-1])}if(!d.groupIds.length)return Bd(d,t,o,r)??l;let c=e.editingGroupId?d.groupIds[d.groupIds.indexOf(e.editingGroupId)-1]:d.groupIds[d.groupIds.length-1],u=ze(t,c);return u.length?o==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1]):l},Fd=(e,t)=>t.reduce((n,o)=>{let i=e[o];return n.set(i.id,i),n},new Map),Nd=(e,t,n,o)=>{let i=Rd(e,t),r=Fd(e,i),a=cm(i);n==="right"&&(a=a.reverse());let s=new Set(i.filter(l=>ee(e[l])).map(l=>e[l].id));return a.forEach((l,d)=>{let c=l[0],u=l[l.length-1],h=n==="left"?c:u,m=l.some(w=>{let M=e[w];return M.frameId&&s.has(M.frameId)})?null:e[h]?.frameId,g=pm(t,e,h,n,m,o);if(g===-1||h===g)return;let f=n==="left"?e.slice(0,g):e.slice(0,c),E=e.slice(c,u+1),x=n==="left"?e.slice(g,c):e.slice(u+1,g+1),y=n==="left"?e.slice(u+1):e.slice(g+1);e=n==="left"?[...f,...E,...x,...y]:[...f,...x,...E,...y]}),Yn(e,r),e},Hd=(e,t,n,o,i)=>{let r=Rd(e,t,i),a=Fd(e,r),s=[],l,d;if(n==="left"){if(o)l=Gd(e,g=>Da(g,o));else if(t.editingGroupId){let g=ze(e,t.editingGroupId);if(!g.length)return e;l=e.indexOf(g[0])}else l=0;d=r[r.length-1]}else{if(o)d=Od(e,g=>Da(g,o));else if(t.editingGroupId){let g=ze(e,t.editingGroupId);if(!g.length)return e;d=e.indexOf(g[g.length-1])}else d=e.length-1;l=r[0]}l===-1&&(l=0);for(let g=l;g<d+1;g++)r.includes(g)||s.push(e[g]);let c=Array.from(a.values()),u=e.slice(0,l),h=e.slice(d+1),m=n==="left"?[...u,...c,...s,...h]:[...u,...s,...c,...h];return Yn(m,a),m};function zd(e,t,n,o){let i=Dd(Ft(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),r={regularElements:[],frameChildren:new Map},a=new Set;for(let d of e)i.has(d.id)&&ee(d)&&a.add(d.id);for(let d of e)if(i.has(d.id))if(ee(d)||d.frameId&&a.has(d.frameId))r.regularElements.push(d);else if(!d.frameId)r.regularElements.push(d);else{let c=r.frameChildren.get(d.frameId)||[];c.push(d),r.frameChildren.set(d.frameId,c)}let s=e,l=Array.from(r.frameChildren.entries());for(let[d,c]of l)s=o(e,t,n,d,c);return o(s,t,n,null,r.regularElements)}var hw=(e,t,n)=>Nd(e,t,"left",n),mw=(e,t,n)=>Nd(e,t,"right",n),fw=(e,t)=>zd(e,t,"left",Hd),gw=(e,t)=>zd(e,t,"right",Hd);var Ga=({points:e})=>{let t=e[0][0],n=e[0][1];return{points:e.map(o=>F(o[0]-t,o[1]-n)),offsetX:t,offsetY:n}},D=class e{elementId;selectedPointsIndices;initialState;isDragging;lastUncommittedPoint;lastCommittedPoint;pointerOffset;hoverPointIndex;segmentMidPointHoveredCoords;hoveredFocusPointBinding;draggedFocusPointBinding;elbowed;customLineAngle;isEditing;pointerDownState;constructor(t,n,o=!1){this.elementId=t.id,_d(t.points[0],F(0,0))||(console.error("Linear element is not normalized",Error().stack),Te(t,n,e.getNormalizeElementPointsAndCoords(t))),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.lastCommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.initialState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1},arrowStartIsInside:!1,altFocusPoint:null},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null,this.hoveredFocusPointBinding=null,this.draggedFocusPointBinding=null,this.elbowed=Y(t)&&t.elbowed,this.customLineAngle=null,this.isEditing=o}static POINT_HANDLE_SIZE=10;static getElement(t,n){let o=n.get(t);return o||null}static handleBoxSelection(t,n,o,i){if(!n.selectedLinearElement?.isEditing||!n.selectionElement)return!1;let{selectedLinearElement:r}=n,{selectedPointsIndices:a,elementId:s}=r,l=e.getElement(s,i);if(!l)return!1;let[d,c,u,h]=K(n.selectionElement,i),g=e.getPointsGlobalCoordinates(l,i).reduce((f,E,x)=>((E[0]>=d&&E[0]<=u&&E[1]>=c&&E[1]<=h||t.shiftKey&&a?.includes(x))&&f.push(x),f),[]).filter(f=>!(Y(l)&&f!==0&&f!==l.points.length-1));o({selectedLinearElement:{...r,selectedPointsIndices:g.length?g:null}})}static handlePointerMove(t,n,o,i,r){let a=n.scene.getNonDeletedElementsMap(),s=n.scene.getNonDeletedElements(),{elementId:l}=r,d=e.getElement(l,a);Ke(d,"Element being dragged must exist in the scene"),Ke(d.points.length>1,"Element must have at least 2 points");let c=d.points.length-1,u=d.points[c],h=d.points[c-1],m=r.customLineAngle??Yd(h,d.points[c]),g=0,f=0;if(Uo(t)){let[b,S]=e._getShiftLockedDelta(d,a,h,F(o,i),t[Un.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),m),v=F(b+h[0],S+h[1]);g=v[0]-u[0],f=v[1]-u[1]}else{let b=e.createPointAt(d,a,o-r.pointerOffset.x,i-r.pointerOffset.y,t[Un.CTRL_OR_CMD]?null:n.getEffectiveGridSize());g=b[0]-u[0],f=b[1]-u[1]}let E=null,{positions:x,updates:y}=Vd([c],g,f,o,i,a,d,s,n,Uo(t),t.altKey,r);if(e.movePoints(d,n.scene,x,{startBinding:y?.startBinding,endBinding:y?.endBinding,moveMidPointsWithElement:y?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled}),Be(d,!1)&&Ot(n.state)&&(E=y?.suggestedBinding??null),Be(d)&&Yo(e.getPointGlobalCoordinates(d,d.points[d.points.length-1],a),d,s,a,n.scene),n.state.selectedLinearElement?.customLineAngle===m&&r.initialState.altFocusPoint&&(!E||Em(n.state.suggestedBinding??[],E)))return null;let w=Be(d)&&d.startBinding&&a.get(d.startBinding.elementId);return{selectedLinearElement:{...r,customLineAngle:m,initialState:{...r.initialState,altFocusPoint:!r.initialState.altFocusPoint&&w&&y?.suggestedBinding?.element.id!==w.id?eo(d,F(d.x,d.y),w,"start",a,n.state.zoom,n.state.isMidpointSnappingEnabled):r.initialState.altFocusPoint}},suggestedBinding:E}}static handlePointDragging(t,n,o,i,r){let a=n.scene.getNonDeletedElementsMap(),s=n.scene.getNonDeletedElements(),{elbowed:l,elementId:d,initialState:c}=r,u=Array.from(r.selectedPointsIndices??[]),{lastClickedPoint:h}=c,m=e.getElement(d,a);Ke(m,"Element being dragged must exist in the scene"),Ke(m.points.length>1,"Element must have at least 2 points"),Ke(u,"There must be selected points in order to drag them"),l&&u.some((A,_)=>A>0&&A!==m.points.length-1?(u[_]=m.points.length-1,h=m.points.length-1,!0):!1),(h<0||!u.includes(h)||!m.points[h])&&(console.error(`There must be a valid lastClickedPoint in order to drag it. selectedPointsIndices(${JSON.stringify(u)}) points(0..${m.points.length-1}) lastClickedPoint(${h}) isElbowArrow: ${l}`),h=m.points.length-1);let g=m.points[h],f=m.points[h===0?1:h-1],E=u.length===1,x=r.customLineAngle??Yd(f,m.points[h]),y=u.includes(0),w=u.includes(m.points.length-1),M=0,b=0;if(Uo(t)&&E){let[A,_]=e._getShiftLockedDelta(m,a,f,F(o,i),t[Un.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),x),X=F(A+f[0],_+f[1]);M=X[0]-g[0],b=X[1]-g[1]}else{let A=e.createPointAt(m,a,o-r.pointerOffset.x,i-r.pointerOffset.y,t[Un.CTRL_OR_CMD]?null:n.getEffectiveGridSize());M=A[0]-g[0],b=A[1]-g[1]}let S=null,{positions:v,updates:k}=Vd(u,M,b,o,i,a,m,s,n,Uo(t)&&E,t.altKey,r);e.movePoints(m,n.scene,v,{startBinding:k?.startBinding,endBinding:k?.endBinding,moveMidPointsWithElement:k?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled}),Be(m,!1)&&Ot(n.state)&&(y||w)&&(S=k?.suggestedBinding??null),Be(m)&&y!==w&&Yo(e.getPointGlobalCoordinates(m,y?m.points[0]:m.points[m.points.length-1],a),m,s,a,n.scene),Q(m,a)&&jn(m,n.scene,!1);let R=l?w?[m.points.length-1]:[0]:u,O=l?R[0]:h,N=!y&&!w?e.getPointGlobalCoordinates(m,g,a):null,G=O,q=Be(m)&&m.startBinding&&a.get(m.startBinding.elementId),U=Be(m)&&m.endBinding&&a.get(m.endBinding.elementId),le=w&&q&&k?.suggestedBinding?.element.id!==q.id?q:y&&U&&k?.suggestedBinding?.element.id!==U.id?U:null;return{selectedLinearElement:{...r,selectedPointsIndices:R,initialState:{...r.initialState,lastClickedPoint:O,altFocusPoint:!r.initialState.altFocusPoint&&Be(m)&&le?eo(m,F(m.x,m.y),le,"start",a,n.state.zoom,n.state.isMidpointSnappingEnabled):r.initialState.altFocusPoint},segmentMidPointHoveredCoords:N,hoverPointIndex:G,isDragging:!0,customLineAngle:x},suggestedBinding:S}}static handlePointerUp(t,n,o,i){let r=i.getNonDeletedElementsMap(),{elementId:a,selectedPointsIndices:s,isDragging:l,initialState:d}=n,c=e.getElement(a,r);if(!c)return n;if(l&&s)for(let u of s)(u===0||u===c.points.length-1)&&Ut(c.points,o.zoom.value)&&(jt(c)&&i.mutateElement(c,{...Ud(c,!0)},{informMutation:!1,isDragging:!1}),e.movePoints(c,i,new Map([[u,{point:u===0?c.points[c.points.length-1]:c.points[0]}]])));return{...n,segmentMidPointHoveredCoords:null,hoverPointIndex:-1,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&d.prevSelectedPointsIndices?.includes(d.lastClickedPoint)?s&&s.filter(u=>u!==d.lastClickedPoint):s:s?.includes(d.lastClickedPoint)?[d.lastClickedPoint]:s,isDragging:!1,customLineAngle:null,initialState:{...n.initialState,origin:null,arrowStartIsInside:!1}}}static getEditorMidPoints=(t,n,o)=>{let i=Q(t,n);if(!Y(t)&&!o.selectedLinearElement?.isEditing&&t.points.length>2&&!i)return[];let r=e.getPointsGlobalCoordinates(t,n),a=0,s=[];for(;a<r.length-1;){if(e.isSegmentTooShort(t,t.points[a],t.points[a+1],a,o.zoom,n)){s.push(null),a++;continue}let l=e.getSegmentMidPoint(t,a+1,n);s.push(l),a++}return s};static getSegmentMidpointHitCoords=(t,n,o,i)=>{let{elementId:r}=t,a=e.getElement(r,i);if(!a)return null;let s=e.getPointIndexUnderCursor(a,i,o.zoom,n.x,n.y);if(!Y(a)&&s>=0||e.getPointsGlobalCoordinates(a,i).length>=3&&!o.selectedLinearElement?.isEditing&&!Y(a))return null;let d=(e.POINT_HANDLE_SIZE+1)/o.zoom.value,c=t.segmentMidPointHoveredCoords;if(c&&Xn(F(c[0],c[1]),F(n.x,n.y))<=d)return c;let u=0,h=e.getEditorMidPoints(a,i,o);for(;u<h.length;){if(h[u]!==null&&Xn(h[u],F(n.x,n.y))<=d)return h[u];u++}return null};static isSegmentTooShort(t,n,o,i,r,a){if(Y(t))return i>=0&&i<t.points.length?Xn(n,o)*r.value<e.POINT_HANDLE_SIZE/2:!1;let s=Xn(n,o);if(t.points.length>2&&t.roundness){let[l,d]=Wn(t,a);Ke(l.length===0&&d.length>0,"Only linears built out of curves are supported"),Ke(l.length+d.length>=i,"Invalid segment index while calculating mid point"),s=mm(d[i])}return s*r.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,o){if(Y(t)){Ke(t.points.length>=n,"Invalid segment index while calculating elbow arrow mid point");let a=Wd(t.points[n-1],t.points[n]);return F(t.x+a[0],t.y+a[1])}let[i,r]=Wn(t,o);if(Ke(i.length===0&&r.length>0||i.length>0&&r.length===0,"Only linears built out of either segments or curves are supported"),Ke(i.length+r.length>=n,"Invalid segment index while calculating mid point"),i.length){let a=i[n-1];return Wd(a[0],a[1])}if(r.length){let a=r[n-1];return fm(a,.5)}Ke(!1,"Invalid segment type while calculating mid point")}static getSegmentMidPointIndex(t,n,o,i){let r=e.getElement(t.elementId,i);if(!r)return-1;let a=e.getEditorMidPoints(r,i,n),s=0;for(;s<a.length;){if(e.arePointsEqual(o,a[s]))return s+1;s++}return-1}static handlePointerDown(t,n,o,i,r,a){let s=n.state,l=a.getNonDeletedElementsMap(),d={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!r)return d;let{elementId:c}=r,u=e.getElement(c,l);if(!u)return d;let h=e.getSegmentMidpointHitCoords(r,i,s,l),m=F(i.x,i.y),g=null;if(h)g=e.getSegmentMidPointIndex(r,s,h,l);else if(t.altKey&&s.selectedLinearElement?.isEditing)return r.lastUncommittedPoint==null&&(a.mutateElement(u,{points:[...u.points,e.createPointAt(u,l,i.x,i.y,t[Un.CTRL_OR_CMD]?null:n.getEffectiveGridSize())]}),d.didAddPoint=!0),o.scheduleCapture(),d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:-1,origin:m,segmentMidpoint:{value:h,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null},selectedPointsIndices:[u.points.length-1],lastUncommittedPoint:null},d.didAddPoint=!0,d;let f=e.getPointIndexUnderCursor(u,l,s.zoom,i.x,i.y);(f>=0||h)&&(d.hitElement=u);let[E,x,y,w]=K(u,l),M=(E+y)/2,b=(x+w)/2,S=f>-1&&_e(F(u.x+u.points[f][0],u.y+u.points[f][1]),F(M,b),u.angle),v=f>-1||t.shiftKey?t.shiftKey||r.selectedPointsIndices?.includes(f)?xm([...r.selectedPointsIndices||[],f]):[f]:null;return d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:f,origin:m,segmentMidpoint:{value:h,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null},selectedPointsIndices:v,pointerOffset:S?{x:i.x-S[0],y:i.y-S[1]}:{x:0,y:0}},d}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:_d(t,n)}static handlePointerMoveInEditMode(t,n,o,i){let r=i.state;if(!r.selectedLinearElement?.isEditing)return null;let{elementId:a,lastUncommittedPoint:s}=r.selectedLinearElement,l=i.scene.getNonDeletedElementsMap(),d=e.getElement(a,l);if(!d)return r.selectedLinearElement;let{points:c}=d,u=c[c.length-1];if(!t.altKey)return u===s&&e.deletePoints(d,i,[c.length-1]),r.selectedLinearElement?.lastUncommittedPoint?{...r.selectedLinearElement,lastUncommittedPoint:null}:r.selectedLinearElement;let h;if(Uo(t)&&c.length>=2){let m=c[c.length-2],[g,f]=e._getShiftLockedDelta(d,l,m,F(n,o),t[Un.CTRL_OR_CMD]?null:i.getEffectiveGridSize());h=F(g+m[0],f+m[1])}else h=e.createPointAt(d,l,n-r.selectedLinearElement.pointerOffset.x,o-r.selectedLinearElement.pointerOffset.y,t[Un.CTRL_OR_CMD]||Y(d)?null:i.getEffectiveGridSize());return u===s?e.movePoints(d,i.scene,new Map([[d.points.length-1,{point:h}]])):e.addPoints(d,i.scene,[h]),{...r.selectedLinearElement,lastUncommittedPoint:d.points[d.points.length-1]}}static getPointGlobalCoordinates(t,n,o){let[i,r,a,s]=K(t,o),l=(i+a)/2,d=(r+s)/2,{x:c,y:u}=t;return _e(F(c+n[0],u+n[1]),F(l,d),t.angle)}static getPointsGlobalCoordinates(t,n){let[o,i,r,a]=K(t,n),s=(o+r)/2,l=(i+a)/2;return t.points.map(d=>{let{x:c,y:u}=t;return _e(F(c+d[0],u+d[1]),F(s,l),t.angle)})}static getPointAtIndexGlobalCoordinates(t,n,o){let i=n<0?t.points.length+n:n,[,,,,r,a]=K(t,o),s=F(r,a),l=t.points[i],{x:d,y:c}=t;return l?_e(F(d+l[0],c+l[1]),s,t.angle):_e(F(d,c),s,t.angle)}static pointFromAbsoluteCoords(t,n,o){if(Y(t))return F(n[0]-t.x,n[1]-t.y);let[i,r,a,s]=K(t,o),l=(i+a)/2,d=(r+s)/2,[c,u]=_e(F(n[0],n[1]),F(l,d),-t.angle);return F(c-t.x,u-t.y)}static getPointIndexUnderCursor(t,n,o,i,r){let a=e.getPointsGlobalCoordinates(t,n),s=a.length;for(;--s>-1;){let l=a[s];if(Xn(F(i,r),F(l[0],l[1]))*o.value<e.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,o,i,r){let a=jd(o,i,r),[s,l,d,c]=K(t,n),u=(s+d)/2,h=(l+c)/2,[m,g]=_e(F(a[0],a[1]),F(u,h),-t.angle);return F(m-t.x,g-t.y)}static getNormalizeElementPointsAndCoords(t){let{points:n,offsetX:o,offsetY:i}=Ga(t);return{points:n,x:t.x+o,y:t.y+i}}static duplicateSelectedPoints(t,n){Ke(t.selectedLinearElement?.isEditing,"Not currently editing a linear element");let o=n.getNonDeletedElementsMap(),{selectedPointsIndices:i,elementId:r}=t.selectedLinearElement,a=e.getElement(r,o);Ke(a,"The linear element does not exist in the provided Scene"),Ke(i!=null,"There are no selected points to duplicate");let{points:s}=a,l=[],d=!1,c=-1,u=s.reduce((h,m,g)=>{if(++c,h.push(m),i.includes(g)){let E=s[g+1];E||(d=!0),h.push(E?F((m[0]+E[0])/2,(m[1]+E[1])/2):F(m[0],m[1])),l.push(c+1),++c}return h},[]);if(n.mutateElement(a,{points:u}),d){let h=a.points[a.points.length-1];e.movePoints(a,n,new Map([[a.points.length-1,{point:F(h[0]+30,h[1]+30)}]]))}return{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:l}}}static deletePoints(t,n,o){let i=n.state.selectedLinearElement?.isEditing&&n.state.selectedLinearElement?.lastUncommittedPoint===t.points[t.points.length-1],r=t.points.filter((c,u)=>!o.includes(u));jt(t)&&t.polygon&&(i||o.includes(0)||o.includes(t.points.length-1))&&(r[0]=F(r[r.length-1][0],r[r.length-1][1]));let{points:s,offsetX:l,offsetY:d}=Ga({points:r});e._updatePoints(t,n.scene,s,l,d)}static addPoints(t,n,o){let i=[...t.points,...o];jt(t)&&t.polygon&&(i[0]=F(i[i.length-1][0],i[i.length-1][1]));let{points:r,offsetX:a,offsetY:s}=Ga({points:i});e._updatePoints(t,n,r,a,s)}static movePoints(t,n,o,i,r){let{points:a}=t;if(jt(t)&&t.polygon){let u=o.get(0),h=o.get(a.length-1);u?o.set(a.length-1,{point:F(u.point[0],u.point[1]),isDragging:u.isDragging}):h&&o.set(0,{point:F(h.point[0],h.point[1]),isDragging:h.isDragging})}let s=o.get(0)?.point??F(0,0),[l,d]=s,c=Y(t)?[o.get(0)?.point??a[0],o.get(a.length-1)?.point??a[a.length-1]]:a.map((u,h)=>{let m=o.get(h)?.point??u;return i?.moveMidPointsWithElement&&h!==0&&h!==a.length-1&&!o.has(h)?m:F(m[0]-l,m[1]-d)});e._updatePoints(t,n,c,l,d,i,{isDragging:Array.from(o.values()).some(u=>u.isDragging),isBindingEnabled:r?.isBindingEnabled,isMidpointSnappingEnabled:r?.isMidpointSnappingEnabled})}static shouldAddMidpoint(t,n,o,i){let r=e.getElement(t.elementId,i);if(r&&Y(r)||!r)return!1;let{segmentMidpoint:a}=t.initialState;if(a.added||a.value===null||a.index===null||t.initialState.origin===null)return!1;let s=t.initialState.origin,l=Xn(s,F(n.x,n.y));return!(!o.selectedLinearElement?.isEditing&&l<gm/o.zoom.value)}static addMidpoint(t,n,o,i,r){let a=r.getNonDeletedElementsMap(),s=e.getElement(t.elementId,a);if(!s)return;let{segmentMidpoint:l}=t.initialState,d={pointerDownState:t.initialState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(s,a,n.x,n.y,i&&!Y(s)?o.getEffectiveGridSize():null),u=[...s.points.slice(0,l.index),c,...s.points.slice(l.index)];return r.mutateElement(s,{points:u}),d.pointerDownState={...t.initialState,segmentMidpoint:{...t.initialState.segmentMidpoint,added:!0},lastClickedPoint:l.index},d.selectedPointsIndices=[l.index],d}static _updatePoints(t,n,o,i,r,a,s){if(Y(t)){let l={};a?.startBinding!==void 0&&(l.startBinding=a.startBinding),a?.endBinding!==void 0&&(l.endBinding=a.endBinding),l.points=Array.from(o),n.mutateElement(t,l,{informMutation:!0,isDragging:s?.isDragging??!1,isBindingEnabled:s?.isBindingEnabled,isMidpointSnappingEnabled:s?.isMidpointSnappingEnabled})}else{let l=Oa(t,o),d=Oa(t,t.points),c=(l[0]+l[2])/2,u=(l[1]+l[3])/2,h=(d[0]+d[2])/2,m=(d[1]+d[3])/2,g=h-c,f=m-u,E=_e(F(i,r),F(g,f),t.angle);n.mutateElement(t,{...a,points:o,x:t.x+E[0],y:t.y+E[1]})}}static _getShiftLockedDelta(t,n,o,i,r,a){let s=e.getPointGlobalCoordinates(t,o,n);if(Y(t))return[i[0]-s[0],i[1]-s[1]];let[l,d]=jd(i[0],i[1],r),{width:c,height:u}=Xd(s[0],s[1],l,d,a);return _e(F(c,u),F(0,0),-t.angle)}static getBoundTextElementPosition=(t,n,o)=>{e.getPointsGlobalCoordinates(t,o).length<2&&Te(n,o,{isDeleted:!0});let r=0,a=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=e.getPointGlobalCoordinates(t,t.points[s],o);r=l[0]-n.width/2,a=l[1]-n.height/2}else{let s=t.points.length/2-1,l=e.getSegmentMidPoint(t,s+1,o);r=l[0]-n.width/2,a=l[1]-n.height/2}return{x:r,y:a}};static getMinMaxXYWithBoundText=(t,n,o,i)=>{let[r,a,s,l]=o,d=(r+s)/2,c=(a+l)/2,{x:u,y:h}=e.getBoundTextElementPosition(t,i,n),m=u+i.width,g=h+i.height,f=F(d,c),E=_e(F(r,a),f,t.angle),x=_e(F(s,a),f,t.angle),y=_e(F(u,h),f,-t.angle),w=_e(F(m,h),f,-t.angle),M=_e(F(u,g),f,-t.angle),b=_e(F(m,g),f,-t.angle);return E[0]<x[0]&&E[1]>=x[1]?(r=Math.min(r,M[0]),s=Math.max(s,Math.max(w[0],b[0])),a=Math.min(a,y[1]),l=Math.max(l,b[1])):E[0]>=x[0]&&E[1]>x[1]?(r=Math.min(r,b[0]),s=Math.max(s,Math.max(y[0],w[0])),a=Math.min(a,M[1]),l=Math.max(l,w[1])):E[0]>=x[0]?(r=Math.min(r,w[0]),s=Math.max(s,M[0]),a=Math.min(a,b[1]),l=Math.max(l,y[1])):E[1]<=x[1]&&(r=Math.min(r,Math.min(w[0],y[0])),s=Math.max(s,b[0]),a=Math.min(a,w[1]),l=Math.max(l,M[1])),[r,a,s,l,d,c]};static getElementAbsoluteCoords=(t,n,o=!1)=>{let i=at.generateElementShape(t,null),r=Wt(i[0]),[a,s,l,d]=Xo(r),c=a+t.x,u=s+t.y,h=l+t.x,m=d+t.y,g=(c+h)/2,f=(u+m)/2,E=o&&Q(t,n);return E?e.getMinMaxXYWithBoundText(t,n,[c,u,h,m],E):[c,u,h,m,g,f]};static moveFixedSegment(t,n,o,i,r){let a=r.getNonDeletedElementsMap(),s=e.getElement(t.elementId,a);if(!s||!Y(s))return t;if(n&&n>0&&n<s.points.length){let l=qe(Jt(hm(s.points[n],s.points[n-1]))),d=(s.fixedSegments??[]).reduce((m,g)=>(m[g.index]=g,m),{});d[n]={index:n,start:F(l?s.points[n-1][0]:o-s.x,l?i-s.y:s.points[n-1][1]),end:F(l?s.points[n][0]:o-s.x,l?i-s.y:s.points[n][1])};let c=Object.values(d).sort((m,g)=>m.index-g.index),u=c.map(m=>m.index).reduce((m,g)=>g<n?m+1:m,0);r.mutateElement(s,{fixedSegments:c});let h=F(s.x+(s.fixedSegments[u].start[0]+s.fixedSegments[u].end[0])/2,s.y+(s.fixedSegments[u].start[1]+s.fixedSegments[u].end[1])/2);return{...t,segmentMidPointHoveredCoords:h,initialState:{...t.initialState,segmentMidpoint:{added:!1,index:s.fixedSegments[u].index,value:h}}}}return t}static deleteFixedSegment(t,n,o){n.mutateElement(t,{fixedSegments:t.fixedSegments?.filter(i=>i.index!==o)})}},xm=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,o)=>n-o),t.length?t:null},Vd=(e,t,n,o,i,r,a,s,l,d,c,u)=>{let h=new Map(e.map(U=>{let le=a.points[U]??a.points.at(-1);return[U,{point:F(le[0]+t,le[1]+n),isDragging:!0}]}));if(!j(a))return{positions:h};let m=e.includes(0),g=e.includes(a.points.length-1),{start:f,end:E}=ba(a,h,o,i,r,s,l.state,{newArrow:!!l.state.newElement,angleLocked:d,altKey:c});if(Y(a)){let U=m?f.element:g?E.element:null;return{positions:h,updates:{suggestedBinding:U?{element:U,midPoint:l.state.isMidpointSnappingEnabled?Ma(U,r,F(o-u.pointerOffset.x,i-u.pointerOffset.y)):void 0}:null}}}if(!m&&!g){let U={...a,points:a.points.map((H,A)=>h.get(A)?.point??H)},le=new Map(h);if(a.startBinding){let H=r.get(a.startBinding.elementId);if(H){let A=bt(U,"startBinding",a.startBinding,H,r)??null;A&&le.set(0,{point:A,isDragging:!0})}}if(a.endBinding){let H=r.get(a.endBinding.elementId);if(H){let A=bt(U,"endBinding",a.endBinding,H,r)??null;A&&le.set(a.points.length-1,{point:A,isDragging:!0})}}return{positions:le}}if(m===g)return{positions:h};let x={suggestedBinding:null};f.mode===null?x.startBinding=null:f.mode?(x.startBinding={elementId:f.element.id,mode:f.mode,...ro(a,f.element,"start",r,f.focusPoint)},m&&(x.startBinding.mode==="orbit"||!so("COMPLEX_BINDINGS"))&&(x.suggestedBinding=f.element?{element:f.element,midPoint:Si(F(o-u.pointerOffset.x,i-u.pointerOffset.y),f.element,r,l.state.zoom)}:null)):m&&(x.suggestedBinding=l.state.suggestedBinding),E.mode===null?x.endBinding=null:E.mode?(x.endBinding={elementId:E.element.id,mode:E.mode,...ro(a,E.element,"end",r,E.focusPoint)},g&&(x.endBinding.mode==="orbit"||!so("COMPLEX_BINDINGS"))&&(x.suggestedBinding=E.element?{element:E.element,midPoint:Si(F(o-u.pointerOffset.x,i-u.pointerOffset.y),E.element,r,l.state.zoom)}:null)):g&&(x.suggestedBinding=l.state.suggestedBinding);let y=m?F(a.points[0][0]+t,a.points[0][1]+n):a.points[0],w=g?F(a.points[a.points.length-1][0]+t,a.points[a.points.length-1][1]+n):a.points[a.points.length-1],M={...a,points:[y,...a.points.slice(1,-1),w],startBinding:x.startBinding===void 0?a.startBinding:x.startBinding===null?null:x.startBinding,endBinding:x.endBinding===void 0?a.endBinding:x.endBinding===null?null:x.endBinding},b=a.endBinding&&M.startBinding&&m&&M.startBinding.elementId===a.endBinding.elementId,S=a.startBinding&&M.endBinding&&g&&a.startBinding.elementId===M.endBinding.elementId,v=M.endBinding?E.element??r.get(M.endBinding.elementId):null,k=b?M.points[M.points.length-1]:S&&l.state.bindMode!=="inside"&&so("COMPLEX_BINDINGS")?M.points[0]:v&&bt(M,"endBinding",M.endBinding,v,r,g)||M.points[M.points.length-1];M.points[M.points.length-1]=k;let T=M.startBinding?f.element??r.get(M.startBinding.elementId):null,R=S&&so("COMPLEX_BINDINGS")?M.points[0]:b&&l.state.bindMode!=="inside"&&so("COMPLEX_BINDINGS")?k:T&&bt(M,"startBinding",M.startBinding,T,r,m)||M.points[0],O=!b&&!(S&&l.state.bindMode!=="inside"&&so("COMPLEX_BINDINGS"))&&!!v,N=Xn(R,M.points[0])!==0,G=new Set(e);T&&N&&G.add(0),v&&O&&G.add(a.points.length-1);let q=Array.from(G);return{updates:x,positions:new Map(q.map(U=>[U,U===0?{point:R,isDragging:!0}:U===a.points.length-1?{point:k,isDragging:!0}:h.get(U)]))}},Yd=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]);var km=(e,t)=>Hn(e)&&!t.imageCache.has(e.fileId),ir=e=>{switch(e.type){case"freedraw":return e.strokeWidth*12;case"text":return e.fontSize/2;case"arrow":return e.endArrowhead||e.endArrowhead?40:20;default:return 20}},Tm=(e,t,n,o,i=1)=>{let r=(t?.opacity??100)*e.opacity/1e4*i;return(n.has(e.id)||o&&o.some(a=>a.id===e.id)||t&&n.has(t.id))&&(r*=bm/100),r},Lm=(e,t,n)=>{let r=ir(e),[a,s,l,d]=K(e,t),c=ne(e)||Se(e)?kn(a,l):e.width,u=ne(e)||Se(e)?kn(s,d):e.height,h=c*window.devicePixelRatio+r*2,m=u*window.devicePixelRatio+r*2,g=n.value;return(h*g>32767||m*g>32767)&&(g=Math.min(32767/h,32767/m)),h*m*g*g>16777216&&(g=Math.sqrt(16777216/(h*m))),h=Math.floor(h*g),m=Math.floor(m*g),{width:h,height:m,scale:g}},qd=(e,t,n,o,i)=>{let r=document.createElement("canvas"),a=r.getContext("2d"),s=ir(e),{width:l,height:d,scale:c}=Lm(e,t,n);if(!l||!d)return null;r.width=l,r.height=d;let u=-100,h=0;if(ne(e)||Se(e)){let[x,y]=K(e,t);u=e.x>x?kn(e.x,x)*window.devicePixelRatio*c:0,h=e.y>y?kn(e.y,y)*window.devicePixelRatio*c:0,a.translate(u,h)}a.save(),a.translate(s*c,s*c),a.scale(window.devicePixelRatio*c,window.devicePixelRatio*c);let m=Nn.canvas(r);nr(e,m,a,o),a.restore();let g=Q(e,t),f=document.createElement("canvas"),E=f.getContext("2d");if(j(e)&&g){let[x,y,w,M]=K(e,t),b=Math.max(kn(x,w),kn(y,M));f.width=b*window.devicePixelRatio*c+s*c*10,f.height=b*window.devicePixelRatio*c+s*c*10,E.translate(f.width/2,f.height/2),E.rotate(e.angle),E.drawImage(r,-r.width/2,-r.height/2,r.width,r.height);let[,,,,S,v]=K(g,t);E.rotate(-e.angle);let k=(f.width-r.width)/2,T=(f.height-r.height)/2,R=f.width/2-(S-x)*window.devicePixelRatio*c-k-s*c,O=f.height/2-(v-y)*window.devicePixelRatio*c-T-s*c;E.translate(-R,-O),E.clearRect(-(g.width/2+er)*window.devicePixelRatio*c,-(g.height/2+er)*window.devicePixelRatio*c,(g.width+er*2)*window.devicePixelRatio*c,(g.height+er*2)*window.devicePixelRatio*c)}return{element:e,canvas:r,theme:i.theme,scale:c,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,boundTextElementVersion:Q(e,t)?.version||null,containingFrameOpacity:Sn(e,t)?.opacity||100,boundTextCanvas:f,angle:e.angle,imageCrop:Ae(e)?e.crop:null}},Xw=14,Kd=typeof document<"u"?document.createElement("img"):{src:""};Kd.src=`data:${Na.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var Qd=typeof document<"u"?document.createElement("img"):{src:""};Qd.src=`data:${Na.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var Cm=(e,t,n)=>{t.fillStyle=n===lo.DARK?"#2E2E2E":"#E7E7E7",t.fillRect(0,0,e.width,e.height);let o=Math.min(e.width,e.height),i=Math.min(o,Math.min(o*.4,100));t.drawImage(e.status==="error"?Qd:Kd,e.width/2-i/2,e.height/2-i/2,i,i)},nr=(e,t,n,o)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(at.generateElementShape(e,o));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",at.generateElementShape(e,o).forEach(i=>{t.draw(i)});break}case"freedraw":{n.save();let i=at.generateElementShape(e,o);for(let r of i)typeof r=="string"?(n.fillStyle=or(e.strokeColor,o.theme===lo.DARK),n.fill(new Path2D(r))):t.draw(r);n.restore();break}case"image":{n.save();let i=e.fileId!==null?o.imageCache.get(e.fileId):null,r=Hn(e)?i?.image:void 0;if(r!=null&&!(r instanceof Promise)){e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,Yt(Math.min(e.width,e.height),e)),n.clip());let{x:a,y:s,width:l,height:d}=e.crop?e.crop:{x:0,y:0,width:r.naturalWidth,height:r.naturalHeight},c=o.theme===lo.DARK&&i?.mimeType===Na.svg;if(c&&Am){let u=window.devicePixelRatio||1,h=document.createElement("canvas");h.width=e.width*u,h.height=e.height*u;let m=h.getContext("2d");if(m){m.scale(u,u),m.drawImage(r,a,s,l,d,0,0,e.width,e.height);let g=m.getImageData(0,0,h.width,h.height),f=g.data;for(let E=0;E<f.length;E+=4)f[E]=255-f[E],f[E+1]=255-f[E+1],f[E+2]=255-f[E+2];m.putImageData(g,0,0),n.drawImage(h,0,0,h.width,h.height,0,0,e.width,e.height)}}else c&&(n.filter=Mm),n.drawImage(r,a,s,l,d,0,0,e.width,e.height)}else Cm(e,n,o.theme);n.restore();break}default:if(te(e)){let i=Im(e.text),r=i&&!n.canvas.isConnected;r&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",i?"rtl":"ltr"),n.save(),n.font=Pm(e),n.fillStyle=or(e.strokeColor,o.theme===lo.DARK),n.textAlign=e.textAlign;let a=e.text.replace(/\r\n?/g,`
12
+ `),l.stack,e.map(c=>a(c)),...d),t)throw l}},Dd=e=>e.sort((t,n)=>Cd(t)&&Cd(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),no=(e,t)=>{try{let n=lr(e),o=hm(e,t),i=Fa(e,o),r=e.map(a=>{let s=i.get(a);return s?{...a,index:s.index}:a});pm(r,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(let[a,{index:s}]of i)je(a,n,{index:s})}catch{Ra(e)}return e},Ra=e=>{let t=lr(e),n=Gd(e),o=Fa(e,n);for(let[i,{index:r}]of o)je(i,t,{index:r});return e},Bd=e=>{let t=lr(e),n=Gd(e),o=Fa(e,n);for(let[i,{index:r}]of o)t.set(i.id,Je(i,{index:r}));return t},hm=(e,t)=>{let n=[],o=0;for(;o<e.length;)if(t.has(e[o].id)){let i=[o-1,o];for(;++o<e.length&&t.has(e[o].id);)i.push(o);i.push(o),n.push(i)}else o++;return n},Gd=e=>{let t=[],n,o,i=-1,r=0,a=d=>{let c=e[i]?e[i].index:void 0,p=e[d-1]?.index;return!c&&p||c&&p&&p>c?[p,d-1]:[c,i]},s=d=>{let c=e[r]?e[r].index:void 0;if(c&&d<r)return[c,r];let p=r;for(;++p<e.length;){let h=e[p]?.index;if(!c&&h||c&&h&&h>c)return[h,p]}return[void 0,p]},l=0;for(;l<e.length;){let d=e[l].index;if([n,i]=a(l),[o,r]=s(l),Oa(d,n,o))l++;else{let c=[i,l];for(;++l<e.length;){let p=e[l].index,[h,m]=a(l),[g,f]=s(l);if(Oa(p,h,g))break;[n,i]=[h,m],[o,r]=[g,f],c.push(l)}c.push(r),t.push(c)}}return t},Oa=(e,t,n)=>{if(!e)return!1;try{cm(e)}catch{return!1}return t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e},Fa=(e,t)=>{let n=new Map;for(let o of t){let i=o.shift(),r=o.pop(),a=um(e[i]?.index,e[r]?.index,o.length);for(let s=0;s<o.length;s++){let l=e[o[s]];n.set(l,{index:a[s]})}}return n},Cd=e=>!!e.index;var Od=(e,t,n)=>{let o=Gt(e);for(let i of t)if(i.frameId){let r=n.get(i.id),a=n.get(i.frameId),s=r&&o.get(r);s&&je(s,o,{frameId:a??null})}};function bo(e,t,n){let o=Ha(t,n),i=Ha(e,n);return o.some(a=>i.some(s=>fm(a,s)))}var Rd=(e,t,n)=>dr(Hd(e,t,n,!1)).filter(o=>!oe(o)&&!o.frameId||o.frameId===t.id),za=(e,t,n)=>_a(Ee(e,n),Ee(t,n)),fw=(e,t)=>{let n=Gt(e);return e.filter(o=>bo(o,t,n))},Fn=(e,t,n)=>{let[o,i,r,a]=ee(t,n),[s,l,d,c]=tt(e);return o<=s&&i<=l&&r>=d&&a>=c},On=(e,t,n)=>Fn([e],t,n)||bo(e,t,n)||za(e,t,n),gw=(e,t,n)=>{let[o,i,r,a]=ee(t,n);return mm(Na(o,i),Na(e.x,e.y),Na(r,a))},Ew=(e,t,n)=>{let o=Gt(e),i=t.flatMap(r=>et(e,r));return i.length===0?!0:!!i.find(r=>Fn([r],n,o)||bo(r,n,o))},xw=(e,t,n)=>{let o=Gt(e),i=t.flatMap(r=>et(e,r));return i.length===0?!0:i.find(r=>Fn([r],n,o)||bo(r,n,o))===void 0},yw=e=>{let t=new Map;for(let n of e){let o=oe(n)?n.id:n.frameId;o&&!t.has(o)&&t.set(o,Nn(e,o))}return t},Nn=(e,t)=>{let n=[];for(let o of e.values())o.frameId===t&&n.push(o);return n},gm=e=>e.filter(t=>oe(t)),ww=e=>{let t=Gt(gm(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},bw=(e,t,n,o)=>{let i=Nn(e,t.id),r=new Set(i),a=new Set([...Rd(e,t,o),...i.filter(h=>za(h,t,o))]),s=i.filter(h=>!a.has(h)),l=new Set(Array.from(a).flatMap(h=>h.groupIds));for(let h of s)if(!bo(h,t,o))h.groupIds.length===0&&r.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let g of h.groupIds)l.has(g)&&(m=!1);m&&r.delete(h)}let d=Array.from(a).filter(h=>h.groupIds.length===0);for(let h of d)r.add(h);let c=Array.from(a).filter(h=>h.groupIds.length>0),p=zd(c,n);for(let[h,m]of Object.entries(p))if(m){let g=et(e,h);if(Fn(g,t,o))for(let f of g)r.add(f)}return[...r].filter(h=>!(re(h)&&h.containerId))},Mw=(e,t,n)=>Em(dr(e,Rd(e,t,n)),t,n),Em=(e,t,n)=>{let o=[],i=new Map;for(let r of e){let a=!1;if(r.groupIds.length>0){if(r.groupIds.some(s=>i.get(s)))a=!0;else{let s=new Set(r.groupIds.flatMap(l=>et(n,l)));a=!Fn(Array.from(s),t,n)}r.groupIds.forEach(s=>{i.set(s,a)})}a||o.push(r)}return o},Rn=(e,t)=>e.frameId&&t.get(e.frameId)||null,Pw=(e,t)=>{let n=new Set,o=Gt(e);e=dr(e);for(let a of e)oe(a)&&a.id!==t.id&&n.add(a.id);let i=new Set,r=[];for(let a of e)if(!(oe(a)||a.frameId&&n.has(a.frameId)))if(a.groupIds.length){let s=a.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=et(e,s);if(l.some(d=>On(d,t,o)))for(let d of l)r.push(d)}}else On(a,t,o)&&r.push(a);return r},xm=e=>{let t;for(let n of e){if(oe(n)||!n.frameId)return null;if(t===void 0)t=n.frameId;else if(t!==n.frameId)return null}return t??null},ym=(e,t)=>{for(let n=e.length-1;n>=0;n--){let o=e[n];if(o.id===t)return n;if(o.frameId===t)return n+1}return null},wm=(e,t,n)=>{let o=Gt(e),i=xm(t),r=new Set,a=new Set;for(let c of t)oe(c)&&c.id!==n.id&&a.add(c.id);for(let c of dr(e,t)){if(oe(c)||c.frameId&&a.has(c.frameId))continue;r.add(c);let p=te(c,o);p&&!r.has(p)&&r.add(p)}for(let c of r)c.frameId!==n.id&&je(c,o,{frameId:n.id});if(!r.size||i===n.id)return e;let s=Array.from(e.values()).filter(c=>!r.has(c)),l=ym(s,n.id);if(l===null)return e;let d=[...s.slice(0,l),...r,...s.slice(l)];return no(d,Gt([...r])),Array.isArray(e)?d:new Map(d.map(c=>[c.id,c]))},Fd=(e,t)=>{let n=new Map,o=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let r=o.get(i.frameId)||[];r.push(i);let a=te(i,t);a&&(n.set(a.id,a),r.push(a)),o.set(i.frameId,r)}for(let[,i]of n)je(i,t,{frameId:null})},bm=(e,t)=>{let n=Nn(e,t.id);return Fd(n,Gt(e)),e},Iw=(e,t,n)=>wm(bm(e,n),t,n).slice(),Sw=(e,t,n)=>{let o=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(o);if(t.editingGroupId)for(let s of o)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>et(e,l)).forEach(l=>i.add(l));let r=new Set,a=Gt(e);return i.forEach(s=>{s.frameId&&!oe(s)&&!Nd(s,a,t)&&r.add(s)}),r.size>0&&Fd(r,a),e},dr=(e,t)=>{let n=new Set,o=t||e;for(let a of o.values()){let s=a.groupIds[a.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let a of n)et(e,a).some(s=>oe(s))&&i.add(a);let r=[];for(let a of o.values())i.has(a.groupIds[a.groupIds.length-1])||r.push(a);return r},Mm=(e,t,n)=>{let o=re(e)&&Xe(e,t)||e;return o.frameId&&n.selectedElementIds[o.id]&&n.selectedElementIds[o.frameId]?Rn(o,t):n.selectedElementIds[o.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Rn(o,t)},Nd=(e,t,n,o)=>{let i=o?.targetFrame??Mm(e,t,n);if(!i)return!1;let r=re(e)&&Xe(e,t)||e,a=l=>{o?.checkedGroups&&r.groupIds.forEach(d=>{o.checkedGroups?.set(d,l)})};if(!n.selectedElementIds[r.id]||!n.selectedElementsAreBeingDragged||n.selectedElementIds[r.id]&&n.selectedElementIds[i.id])return!0;if(r.groupIds.length===0)return On(r,i,t);for(let l of r.groupIds)if(o?.checkedGroups?.has(l))return o.checkedGroups.get(l);let s=new Set(r.groupIds.filter(l=>o?.checkedGroups?!o.checkedGroups.has(l):!0).flatMap(l=>et(t,l)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let l=new Set($t(t,n));if(n.frameToHighlight!==null)return!0;l.forEach(c=>{s.delete(c)})}for(let l of s)if(oe(l))return a(!1),!1;for(let l of s)if(On(l,i,t))return a(!0),!0;return!1},vw=(e,t,n,o,i)=>{if(!n.frameRendering||!n.frameRendering.clip)return!1;let r=bo(e,t,o)||za(e,t,o);if(r){for(let a of e.groupIds)i?.set(a,!0);return!0}if(!r&&e.groupIds.length>0&&!Fn([e],t,o)){let a=!1;if(n.selectedElementsAreBeingDragged)a=Nd(e,o,n,{targetFrame:t,checkedGroups:i});else{a=e.frameId===t.id;for(let s of e.groupIds)i?.set(s,a)}for(let s of e.groupIds)i?.set(s,a);return a}return!1},Pm="Frame",Im="AI Frame",Sm=e=>Fi(e)?Pm:Im,Aw=e=>e.name===null?Sm(e):e.name,kw=(e,t,n)=>e.filter(o=>(!o.frameId||o.frameId===t.id)&&dn(Ee(o,n),Ee(t,n))),Tw=e=>{let t=Gt(e);return e.length>1&&e.some(n=>n.frameId&&t.has(n.frameId))};var km=e=>e.locked||ke(e),Tm=(e,t)=>e.filter(n=>!(n.frameId&&t.has(n.frameId))),Lm=e=>{let t=new Set;return e.forEach(n=>{oe(n)&&t.add(n.id)}),Tm(e,t)},Hd=(e,t,n,o=!0,i="contain")=>{let[r,a,s,l]=ee(t,n),d=Math.min(r,s),c=Math.min(a,l),p=Math.max(r,s),h=Math.max(a,l);return Wd({elements:e,bounds:[d,c,p,h],elementsMap:n,type:i,shouldIgnoreElementFromSelection:km,excludeElementsInFrames:o})},Hw=(e,t,n,o)=>{let i=new Set(t.map(r=>r.id));return e.filter(r=>{let a=jd(r,n.width,n.height,n,o);return!i.has(r.id)&&a})},zw=function(){let e=null,t=null,n=null,o=(i,r)=>(n!=null&&i===e&&r.selectedElementIds===t||(n=i.some(a=>r.selectedElementIds[a.id]),e=i,t=r.selectedElementIds),n);return o.clearCache=()=>{e=null,t=null,n=null},o}(),$t=(e,t,n)=>{let o=new Set,i=[];for(let r of e.values()){if(t.selectedElementIds[r.id]){i.push(r),o.add(r.id);continue}if(n?.includeBoundTextElement&&ke(r)&&t.selectedElementIds[r?.containerId]){i.push(r),o.add(r.id);continue}}if(n?.includeElementsInFrames){let r=[];return i.forEach(a=>{oe(a)&&Nn(e,a.id).forEach(s=>!o.has(s.id)&&r.push(s)),r.push(a)}),r}return i},_w=(e,t)=>t.editingTextElement?[t.editingTextElement]:t.newElement?[t.newElement]:$t(e,t,{includeBoundTextElement:!0}),Wa=(e,t)=>Am(t.selectedElementIds,e)?t.selectedElementIds:e,Cm=(e,t)=>{let n=e.filter(ae);if(n.length===1){let o=n[0],i=o.boundElements?.map(a=>a.id)??[];if(e.every(a=>a.id===o.id||i.includes(a.id)))return new F(o,vm(t))}return null},Ww=(e,t,n)=>({selectedLinearElement:Cm(e,t),..._d({editingGroupId:n.editingGroupId,selectedElementIds:Lm(e).reduce((o,i)=>(ke(i)||(o[i.id]=!0),o),{})},t,n,null)}),jw=(e,t)=>t.editingTextElement||e.length===1&&re(e[0])&&e[0]||null;var Dm=(e,t,n)=>{let o=n.reduce((i,r)=>(r.groupIds.includes(e)&&(i[r.id]=!0),i),{});return Object.keys(o).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,...o}}},_d=function(){let e=null,t=null,n=null,o=(r,a,s,l)=>{if(n!==void 0&&a===t&&r===e&&s.editingGroupId===n?.editingGroupId)return n;let d={};for(let h of r){let m=h.groupIds;if(s.editingGroupId){let g=m.indexOf(s.editingGroupId);g>-1&&(m=m.slice(0,g))}if(m.length>0){let g=m[m.length-1];d[g]=!0}}let c={},p=a.reduce((h,m)=>{if(m.isDeleted)return h;let g=m.groupIds.find(f=>d[f]);return g&&(h[m.id]=!0,Array.isArray(c[g])?c[g].push(m.id):c[g]=[m.id]),h},{});for(let h of Object.keys(c))c[h].length<2&&d[h]&&(d[h]=!1);return t=a,e=r,n={editingGroupId:s.editingGroupId,selectedGroupIds:d,selectedElementIds:Wa({...s.selectedElementIds,...p},l)},n},i=(r,a,s,l)=>{let d=l?l.scene.getSelectedElements({selectedElementIds:r.selectedElementIds,elements:a}):$t(a,r);return d.length?o(d,a,r,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:Wa(r.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),Bm=(e,t)=>ja(e,t)!=null,ja=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Gm=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),zd=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let o of e){let i=o.groupIds;if(t.editingGroupId){let r=i.indexOf(t.editingGroupId);r>-1&&(i=i.slice(0,r))}if(i.length>0){let r=i[i.length-1];n={...n,...Dm(r,n,e)}}}return n.selectedGroupIds},Zw=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),Om=(e,t)=>e.groupIds.includes(t),et=(e,t)=>{let n=[];for(let o of e.values())Om(o,t)&&n.push(o);return n},Rm=(e,t)=>e.groupIds.find(n=>t[n]),qw=(e,t,n)=>{let o=[...e],i=n?o.indexOf(n):-1,r=i>-1?i:o.length;return o.splice(r,0,t),o},Kw=(e,t)=>e.filter(n=>!t[n]),cr=(e,t)=>{let n=new Map;return e.forEach(o=>{let i=o.groupIds.length===0?o.id:o.groupIds[o.groupIds.length-1],r=n.get(i)||[],a=te(o,t);a&&r.push(a),n.set(i,[...r,o])}),Array.from(n.values())},Vd=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let o of n.groupIds??[])t.add(o);return t},Ud=e=>{let t=e.flatMap(i=>i.groupIds),n=new Map,o=0;for(let i of t)n.set(i,(n.get(i)??0)+1),n.get(i)>o&&(o=n.get(i));return o===e.length},Yd=e=>e.groupIds.length>0,Xd=(e,t,n)=>{let o=[...e],i=t?e.indexOf(t):-1,r=i>-1?i:e.length;for(let a=0;a<r;a++)o[a]=n(o[a]);return o},ur=(e,t,n)=>{let o=Gm(n),i=e.filter(p=>!ke(p)),r=new Map,a=new Map,s=p=>{let h=a.get(p.id)||[],m=te(p,t);m&&h.push(m),a.set(p.id,[...h,p])},l=(p,h)=>{let m=r.get(h)||[],g=te(p,t);g&&m.push(g),r.set(h,[...m,p])},d=(p,h)=>{let m=p.groupIds.indexOf(h,0);return p.groupIds.slice(0,m).length>0?l(p,p.groupIds[m-1]):s(p)},c=e.every(p=>Bm(n,p));return i.forEach(p=>{let h=Rm(p,n.selectedGroupIds);h?o.length===1&&c?d(p,h):l(p,h):s(p)}),Array.from(r.values()).concat(Array.from(a.values()))};var Va=(e,t)=>e.frameId===t||e.id===t,Qd=(e,t,n)=>{let o=[],i=[],r=null,a=-1,s=Zd(n||$t(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++a<e.length;){let l=e[a];s.get(l.id)?(i.length&&(o=o.concat(i),i=[]),o.push(a),r=a+1):l.isDeleted&&r===a?(r=a+1,i.push(a)):i=[]}return o},Nm=e=>{let t=0;return e.reduce((n,o,i)=>(i>0&&e[i-1]!==o-1&&(t=++t),(n[t]||(n[t]=[])).push(o),n),[])},$d=(e,t,n,o)=>{if("containerId"in e&&e.containerId){let i=o.getElement(e.containerId);if(i)return n==="left"?Math.min(t.indexOf(i),t.indexOf(e)):Math.max(t.indexOf(i),t.indexOf(e))}else{let i=e.boundElements?.find(r=>r.type!=="arrow")?.id;if(i){let r=o.getElement(i);if(r)return n==="left"?Math.min(t.indexOf(r),t.indexOf(e)):Math.max(t.indexOf(r),t.indexOf(e))}}},Hm=(e,t)=>{let n=-1,o=-1;return e.forEach((i,r)=>{Va(i,t)&&(n===-1&&(n=r),o=r)}),n===-1?[]:e.slice(n,o+1)},ri=(e,t,n,o,i,r)=>{let a=r||ln(e,n,o);if(!a)return n;let s=te(a,o),l=re(a)?Xe(a,o):null,d=[a.id,s?.id,l?.id].filter(h=>!!h),c=n.findIndex(h=>d.includes(h.id)),p=n.findIndex(h=>h.id===t.id);if(p!==-1&&c!==-1&&p<c){let h=Array.from(n),m=h.splice(p,1)[0];h.splice(c,0,m),i.replaceAllElements(h)}return n},zm=(e,t,n,o,i,r)=>{let a=t[n],s=h=>h.isDeleted?!1:i?h.frameId===i:e.editingGroupId?h.groupIds.includes(e.editingGroupId):!0,l=o==="left"?Kd(t,h=>s(h),Math.max(0,n-1)):qd(t,h=>s(h),n+1),d=t[l];if(!d)return-1;if(e.editingGroupId){if(a?.groupIds.join("")===d?.groupIds.join(""))return $d(d,t,o,r)??l;if(!d?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(d.frameId||oe(d))){let h=Hm(t,d.frameId||d.id);return o==="left"?t.indexOf(h[0]):t.indexOf(h[h.length-1])}if(!d.groupIds.length)return $d(d,t,o,r)??l;let c=e.editingGroupId?d.groupIds[d.groupIds.indexOf(e.editingGroupId)-1]:d.groupIds[d.groupIds.length-1],p=et(t,c);return p.length?o==="left"?t.indexOf(p[0]):t.indexOf(p[p.length-1]):l},Jd=(e,t)=>t.reduce((n,o)=>{let i=e[o];return n.set(i.id,i),n},new Map),ec=(e,t)=>{if(e.length!==t.length)return console.error("z-index reordering failed: resulting array have different lengths"),!1;let n=new Map;for(let o of e)n.set(o.id,(n.get(o.id)||0)+1);for(let o of t){let i=n.get(o.id);if(!i)return console.error("z-index reordering failed: element id mismatch / duplicate ids"),!1;n.set(o.id,i-1)}return!0},tc=(e,t,n,o)=>{let i=e,r=Qd(e,t),a=Jd(e,r),s=Nm(r);n==="right"&&(s=s.reverse());let l=new Set(r.filter(d=>oe(e[d])).map(d=>e[d].id));return s.forEach((d,c)=>{let p=d[0],h=d[d.length-1],m=n==="left"?p:h,g=d.some(M=>{let b=e[M];return b.frameId&&l.has(b.frameId)})?null:e[m]?.frameId,f=zm(t,e,m,n,g,o);if(f===-1||m===f)return;let E=n==="left"?e.slice(0,f):e.slice(0,p),x=e.slice(p,h+1),y=n==="left"?e.slice(f,p):e.slice(h+1,f+1),w=n==="left"?e.slice(h+1):e.slice(f+1);e=n==="left"?[...E,...x,...y,...w]:[...E,...y,...x,...w]}),ec(i,e)?(no(e,a),e):i},nc=(e,t,n,o,i)=>{let r=Qd(e,t,i);if(r.length===0)return e;let a=Jd(e,r),s=[],l,d;if(n==="left"){if(o)l=qd(e,f=>Va(f,o));else if(t.editingGroupId){let f=et(e,t.editingGroupId);if(!f.length)return e;l=e.indexOf(f[0])}else l=0;d=r[r.length-1]}else{if(o)d=Kd(e,f=>Va(f,o));else if(t.editingGroupId){let f=et(e,t.editingGroupId);if(!f.length)return e;d=e.indexOf(f[f.length-1])}else d=e.length-1;l=r[0]}l===-1&&(l=0);let c=f=>Fm(f)&&f>=0;if(!c(l)||!c(d)||l>d||r.some(f=>f<l||f>d))return e;for(let f=l;f<d+1;f++)r.includes(f)||s.push(e[f]);let p=Array.from(a.values()),h=e.slice(0,l),m=e.slice(d+1),g=n==="left"?[...h,...p,...s,...m]:[...h,...s,...p,...m];return ec(e,g)?(no(g,a),g):e};function oc(e,t,n,o){let i=Zd($t(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),r={regularElements:[],frameChildren:new Map},a=new Set;for(let d of e)i.has(d.id)&&oe(d)&&a.add(d.id);for(let d of e)if(i.has(d.id))if(oe(d)||d.frameId&&a.has(d.frameId))r.regularElements.push(d);else if(!d.frameId)r.regularElements.push(d);else{let c=r.frameChildren.get(d.frameId)||[];c.push(d),r.frameChildren.set(d.frameId,c)}let s=e,l=Array.from(r.frameChildren.entries());for(let[d,c]of l)s=o(s,t,n,d,c);return o(s,t,n,null,r.regularElements)}var lb=(e,t,n)=>tc(e,t,"left",n),db=(e,t,n)=>tc(e,t,"right",n),cb=(e,t)=>oc(e,t,"left",nc),ub=(e,t)=>oc(e,t,"right",nc);var Ua=({points:e})=>{let t=e[0][0],n=e[0][1];return{points:e.map(o=>H(o[0]-t,o[1]-n)),offsetX:t,offsetY:n}},F=class e{elementId;selectedPointsIndices;initialState;isDragging;lastUncommittedPoint;lastCommittedPoint;pointerOffset;hoverPointIndex;segmentMidPointHoveredCoords;hoveredFocusPointBinding;draggedFocusPointBinding;elbowed;customLineAngle;isEditing;pointerDownState;constructor(t,n,o=!1){this.elementId=t.id,rc(t.points[0],H(0,0))||(console.error("Linear element is not normalized",Error().stack),je(t,n,e.getNormalizeElementPointsAndCoords(t))),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.lastCommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.initialState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1},arrowStartIsInside:!1,altFocusPoint:null},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null,this.hoveredFocusPointBinding=null,this.draggedFocusPointBinding=null,this.elbowed=Z(t)&&t.elbowed,this.customLineAngle=null,this.isEditing=o}static POINT_HANDLE_SIZE=10;static getElement(t,n){let o=n.get(t);return o||null}static handleBoxSelection(t,n,o,i){if(!n.selectedLinearElement?.isEditing||!n.selectionElement)return!1;let{selectedLinearElement:r}=n,{selectedPointsIndices:a,elementId:s}=r,l=e.getElement(s,i);if(!l)return!1;let[d,c,p,h]=ee(n.selectionElement,i),g=e.getPointsGlobalCoordinates(l,i).reduce((f,E,x)=>((E[0]>=d&&E[0]<=p&&E[1]>=c&&E[1]<=h||t.shiftKey&&a?.includes(x))&&f.push(x),f),[]).filter(f=>!(Z(l)&&f!==0&&f!==l.points.length-1));o({selectedLinearElement:{...r,selectedPointsIndices:g.length?g:null}})}static handlePointerMove(t,n,o,i,r){let a=n.scene.getNonDeletedElementsMap(),s=n.scene.getNonDeletedElements(),{elementId:l}=r,d=e.getElement(l,a);pt(d,"Element being dragged must exist in the scene"),pt(d.points.length>1,"Element must have at least 2 points");let c=d.points.length-1,p=d.points[c],h=d.points[c-1],m=r.customLineAngle??lc(h,d.points[c]),g=0,f=0;if(ai(t)){let[b,S]=e._getShiftLockedDelta(d,a,h,H(o,i),t[oo.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),m),v=H(b+h[0],S+h[1]);g=v[0]-p[0],f=v[1]-p[1]}else{let b=e.createPointAt(d,a,o-r.pointerOffset.x,i-r.pointerOffset.y,t[oo.CTRL_OR_CMD]?null:n.getEffectiveGridSize());g=b[0]-p[0],f=b[1]-p[1]}let E=null,{positions:x,updates:y}=sc([c],g,f,o,i,a,d,s,n,ai(t),t.altKey,r);if(e.movePoints(d,n.scene,x,{startBinding:y?.startBinding,endBinding:y?.endBinding,moveMidPointsWithElement:y?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled}),Ye(d,!1)&&Yt(n.state)&&(E=y?.suggestedBinding??null),Ye(d)&&ri(e.getPointGlobalCoordinates(d,d.points[d.points.length-1],a),d,s,a,n.scene),n.state.selectedLinearElement?.customLineAngle===m&&r.initialState.altFocusPoint&&(!E||Um(n.state.suggestedBinding??[],E)))return null;let w=Ye(d)&&d.startBinding&&a.get(d.startBinding.elementId);return{selectedLinearElement:{...r,customLineAngle:m,initialState:{...r.initialState,altFocusPoint:!r.initialState.altFocusPoint&&w&&y?.suggestedBinding?.element.id!==w.id?fo(d,H(d.x,d.y),w,"start",a,n.state.zoom,n.state.isMidpointSnappingEnabled):r.initialState.altFocusPoint}},suggestedBinding:E}}static handlePointDragging(t,n,o,i,r){let a=n.scene.getNonDeletedElementsMap(),s=n.scene.getNonDeletedElements(),{elbowed:l,elementId:d,initialState:c}=r,p=Array.from(r.selectedPointsIndices??[]),{lastClickedPoint:h}=c,m=e.getElement(d,a);pt(m,"Element being dragged must exist in the scene"),pt(m.points.length>1,"Element must have at least 2 points"),pt(p,"There must be selected points in order to drag them"),l&&p.some((T,z)=>T>0&&T!==m.points.length-1?(p[z]=m.points.length-1,h=m.points.length-1,!0):!1),(h<0||!p.includes(h)||!m.points[h])&&(console.error(`There must be a valid lastClickedPoint in order to drag it. selectedPointsIndices(${JSON.stringify(p)}) points(0..${m.points.length-1}) lastClickedPoint(${h}) isElbowArrow: ${l}`),h=m.points.length-1);let g=m.points[h],f=m.points[h===0?1:h-1],E=p.length===1,x=r.customLineAngle??lc(f,m.points[h]),y=p.includes(0),w=p.includes(m.points.length-1),M=0,b=0;if(ai(t)&&E){let[T,z]=e._getShiftLockedDelta(m,a,f,H(o,i),t[oo.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),x),_=H(T+f[0],z+f[1]);M=_[0]-g[0],b=_[1]-g[1]}else{let T=e.createPointAt(m,a,o-r.pointerOffset.x,i-r.pointerOffset.y,t[oo.CTRL_OR_CMD]?null:n.getEffectiveGridSize());M=T[0]-g[0],b=T[1]-g[1]}let S=null,{positions:v,updates:k}=sc(p,M,b,o,i,a,m,s,n,ai(t)&&E,t.altKey,r);e.movePoints(m,n.scene,v,{startBinding:k?.startBinding,endBinding:k?.endBinding,moveMidPointsWithElement:k?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled}),Ye(m,!1)&&Yt(n.state)&&(y||w)&&(S=k?.suggestedBinding??null),Ye(m)&&y!==w&&ri(e.getPointGlobalCoordinates(m,y?m.points[0]:m.points[m.points.length-1],a),m,s,a,n.scene),te(m,a)&&eo(m,n.scene,!1);let O=l?w?[m.points.length-1]:[0]:p,G=l?O[0]:h,R=!y&&!w?e.getPointGlobalCoordinates(m,g,a):null,C=G,j=Ye(m)&&m.startBinding&&a.get(m.startBinding.elementId),W=Ye(m)&&m.endBinding&&a.get(m.endBinding.elementId),q=w&&j&&k?.suggestedBinding?.element.id!==j.id?j:y&&W&&k?.suggestedBinding?.element.id!==W.id?W:null;return{selectedLinearElement:{...r,selectedPointsIndices:O,initialState:{...r.initialState,lastClickedPoint:G,altFocusPoint:!r.initialState.altFocusPoint&&Ye(m)&&q?fo(m,H(m.x,m.y),q,"start",a,n.state.zoom,n.state.isMidpointSnappingEnabled):r.initialState.altFocusPoint},segmentMidPointHoveredCoords:R,hoverPointIndex:C,isDragging:!0,customLineAngle:x},suggestedBinding:S}}static handlePointerUp(t,n,o,i){let r=i.getNonDeletedElementsMap(),{elementId:a,selectedPointsIndices:s,isDragging:l,initialState:d}=n,c=e.getElement(a,r);if(!c)return n;if(l&&s)for(let p of s)(p===0||p===c.points.length-1)&&nn(c.points,o.zoom.value)&&(Jt(c)&&i.mutateElement(c,{...dc(c,!0)},{informMutation:!1,isDragging:!1}),e.movePoints(c,i,new Map([[p,{point:p===0?c.points[c.points.length-1]:c.points[0]}]])));return{...n,segmentMidPointHoveredCoords:null,hoverPointIndex:-1,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&d.prevSelectedPointsIndices?.includes(d.lastClickedPoint)?s&&s.filter(p=>p!==d.lastClickedPoint):s:s?.includes(d.lastClickedPoint)?[d.lastClickedPoint]:s,isDragging:!1,customLineAngle:null,initialState:{...n.initialState,origin:null,arrowStartIsInside:!1}}}static getEditorMidPoints=(t,n,o)=>{let i=te(t,n);if(!Z(t)&&!o.selectedLinearElement?.isEditing&&t.points.length>2&&!i)return[];let r=e.getPointsGlobalCoordinates(t,n),a=0,s=[];for(;a<r.length-1;){if(e.isSegmentTooShort(t,t.points[a],t.points[a+1],a,o.zoom,n)){s.push(null),a++;continue}let l=e.getSegmentMidPoint(t,a+1,n);s.push(l),a++}return s};static getSegmentMidpointHitCoords=(t,n,o,i)=>{let{elementId:r}=t,a=e.getElement(r,i);if(!a)return null;let s=e.getPointIndexUnderCursor(a,i,o.zoom,n.x,n.y);if(!Z(a)&&s>=0||e.getPointsGlobalCoordinates(a,i).length>=3&&!o.selectedLinearElement?.isEditing&&!Z(a))return null;let d=(e.POINT_HANDLE_SIZE+1)/o.zoom.value,c=t.segmentMidPointHoveredCoords;if(c&&io(H(c[0],c[1]),H(n.x,n.y))<=d)return c;let p=0,h=e.getEditorMidPoints(a,i,o);for(;p<h.length;){if(h[p]!==null&&io(h[p],H(n.x,n.y))<=d)return h[p];p++}return null};static isSegmentTooShort(t,n,o,i,r,a){if(Z(t))return i>=0&&i<t.points.length?io(n,o)*r.value<e.POINT_HANDLE_SIZE/2:!1;let s=io(n,o);if(t.points.length>2&&t.roundness){let[l,d]=Qn(t,a);pt(l.length===0&&d.length>0,"Only linears built out of curves are supported"),pt(l.length+d.length>=i,"Invalid segment index while calculating mid point"),s=Wm(d[i])}return s*r.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,o){if(Z(t)){pt(t.points.length>=n,"Invalid segment index while calculating elbow arrow mid point");let a=ic(t.points[n-1],t.points[n]);return H(t.x+a[0],t.y+a[1])}let[i,r]=Qn(t,o);if(pt(i.length===0&&r.length>0||i.length>0&&r.length===0,"Only linears built out of either segments or curves are supported"),pt(i.length+r.length>=n,"Invalid segment index while calculating mid point"),i.length){let a=i[n-1];return ic(a[0],a[1])}if(r.length){let a=r[n-1];return jm(a,.5)}pt(!1,"Invalid segment type while calculating mid point")}static getSegmentMidPointIndex(t,n,o,i){let r=e.getElement(t.elementId,i);if(!r)return-1;let a=e.getEditorMidPoints(r,i,n),s=0;for(;s<a.length;){if(e.arePointsEqual(o,a[s]))return s+1;s++}return-1}static handlePointerDown(t,n,o,i,r,a){let s=n.state,l=a.getNonDeletedElementsMap(),d={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!r)return d;let{elementId:c}=r,p=e.getElement(c,l);if(!p)return d;let h=e.getSegmentMidpointHitCoords(r,i,s,l),m=H(i.x,i.y),g=null;if(h)g=e.getSegmentMidPointIndex(r,s,h,l);else if(t.altKey&&s.selectedLinearElement?.isEditing)return r.lastUncommittedPoint==null&&(a.mutateElement(p,{points:[...p.points,e.createPointAt(p,l,i.x,i.y,t[oo.CTRL_OR_CMD]?null:n.getEffectiveGridSize())]}),d.didAddPoint=!0),o.scheduleCapture(),d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:-1,origin:m,segmentMidpoint:{value:h,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null},selectedPointsIndices:[p.points.length-1],lastUncommittedPoint:null},d.didAddPoint=!0,d;let f=e.getPointIndexUnderCursor(p,l,s.zoom,i.x,i.y);(f>=0||h)&&(d.hitElement=p);let[E,x,y,w]=ee(p,l),M=(E+y)/2,b=(x+w)/2,S=f>-1&&nt(H(p.x+p.points[f][0],p.y+p.points[f][1]),H(M,b),p.angle),v=f>-1||t.shiftKey?t.shiftKey||r.selectedPointsIndices?.includes(f)?Ym([...r.selectedPointsIndices||[],f]):[f]:null;return d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:f,origin:m,segmentMidpoint:{value:h,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null},selectedPointsIndices:v,pointerOffset:S?{x:i.x-S[0],y:i.y-S[1]}:{x:0,y:0}},d}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:rc(t,n)}static handlePointerMoveInEditMode(t,n,o,i){let r=i.state;if(!r.selectedLinearElement?.isEditing)return null;let{elementId:a,lastUncommittedPoint:s}=r.selectedLinearElement,l=i.scene.getNonDeletedElementsMap(),d=e.getElement(a,l);if(!d)return r.selectedLinearElement;let{points:c}=d,p=c[c.length-1];if(!t.altKey)return p===s&&e.deletePoints(d,i,[c.length-1]),r.selectedLinearElement?.lastUncommittedPoint?{...r.selectedLinearElement,lastUncommittedPoint:null}:r.selectedLinearElement;let h;if(ai(t)&&c.length>=2){let m=c[c.length-2],[g,f]=e._getShiftLockedDelta(d,l,m,H(n,o),t[oo.CTRL_OR_CMD]?null:i.getEffectiveGridSize());h=H(g+m[0],f+m[1])}else h=e.createPointAt(d,l,n-r.selectedLinearElement.pointerOffset.x,o-r.selectedLinearElement.pointerOffset.y,t[oo.CTRL_OR_CMD]||Z(d)?null:i.getEffectiveGridSize());return p===s?e.movePoints(d,i.scene,new Map([[d.points.length-1,{point:h}]])):e.addPoints(d,i.scene,[h]),{...r.selectedLinearElement,lastUncommittedPoint:d.points[d.points.length-1]}}static getPointGlobalCoordinates(t,n,o){let[i,r,a,s]=ee(t,o),l=(i+a)/2,d=(r+s)/2,{x:c,y:p}=t;return nt(H(c+n[0],p+n[1]),H(l,d),t.angle)}static getPointsGlobalCoordinates(t,n){let[o,i,r,a]=ee(t,n),s=(o+r)/2,l=(i+a)/2;return t.points.map(d=>{let{x:c,y:p}=t;return nt(H(c+d[0],p+d[1]),H(s,l),t.angle)})}static getPointAtIndexGlobalCoordinates(t,n,o){let i=n<0?t.points.length+n:n,[,,,,r,a]=ee(t,o),s=H(r,a),l=t.points[i],{x:d,y:c}=t;return l?nt(H(d+l[0],c+l[1]),s,t.angle):nt(H(d,c),s,t.angle)}static pointFromAbsoluteCoords(t,n,o){if(Z(t))return H(n[0]-t.x,n[1]-t.y);let[i,r,a,s]=ee(t,o),l=(i+a)/2,d=(r+s)/2,[c,p]=nt(H(n[0],n[1]),H(l,d),-t.angle);return H(c-t.x,p-t.y)}static getPointIndexUnderCursor(t,n,o,i,r){let a=e.getPointsGlobalCoordinates(t,n),s=a.length;for(;--s>-1;){let l=a[s];if(io(H(i,r),H(l[0],l[1]))*o.value<e.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,o,i,r){let a=ac(o,i,r),[s,l,d,c]=ee(t,n),p=(s+d)/2,h=(l+c)/2,[m,g]=nt(H(a[0],a[1]),H(p,h),-t.angle);return H(m-t.x,g-t.y)}static getNormalizeElementPointsAndCoords(t){let{points:n,offsetX:o,offsetY:i}=Ua(t);return{points:n,x:t.x+o,y:t.y+i}}static duplicateSelectedPoints(t,n){pt(t.selectedLinearElement?.isEditing,"Not currently editing a linear element");let o=n.getNonDeletedElementsMap(),{selectedPointsIndices:i,elementId:r}=t.selectedLinearElement,a=e.getElement(r,o);pt(a,"The linear element does not exist in the provided Scene"),pt(i!=null,"There are no selected points to duplicate");let{points:s}=a,l=[],d=!1,c=-1,p=s.reduce((h,m,g)=>{if(++c,h.push(m),i.includes(g)){let E=s[g+1];E||(d=!0),h.push(E?H((m[0]+E[0])/2,(m[1]+E[1])/2):H(m[0],m[1])),l.push(c+1),++c}return h},[]);if(n.mutateElement(a,{points:p}),d){let h=a.points[a.points.length-1];e.movePoints(a,n,new Map([[a.points.length-1,{point:H(h[0]+30,h[1]+30)}]]))}return{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:l}}}static deletePoints(t,n,o){let i=n.state.selectedLinearElement?.isEditing&&n.state.selectedLinearElement?.lastUncommittedPoint===t.points[t.points.length-1],r=t.points.filter((c,p)=>!o.includes(p));Jt(t)&&t.polygon&&(i||o.includes(0)||o.includes(t.points.length-1))&&(r[0]=H(r[r.length-1][0],r[r.length-1][1]));let{points:s,offsetX:l,offsetY:d}=Ua({points:r});e._updatePoints(t,n.scene,s,l,d)}static addPoints(t,n,o){let i=[...t.points,...o];Jt(t)&&t.polygon&&(i[0]=H(i[i.length-1][0],i[i.length-1][1]));let{points:r,offsetX:a,offsetY:s}=Ua({points:i});e._updatePoints(t,n,r,a,s)}static movePoints(t,n,o,i,r){let{points:a}=t;if(Jt(t)&&t.polygon){let p=o.get(0),h=o.get(a.length-1);p?o.set(a.length-1,{point:H(p.point[0],p.point[1]),isDragging:p.isDragging}):h&&o.set(0,{point:H(h.point[0],h.point[1]),isDragging:h.isDragging})}let s=o.get(0)?.point??H(0,0),[l,d]=s,c=Z(t)?[o.get(0)?.point??a[0],o.get(a.length-1)?.point??a[a.length-1]]:a.map((p,h)=>{let m=o.get(h)?.point??p;return i?.moveMidPointsWithElement&&h!==0&&h!==a.length-1&&!o.has(h)?m:H(m[0]-l,m[1]-d)});e._updatePoints(t,n,c,l,d,i,{isDragging:Array.from(o.values()).some(p=>p.isDragging),isBindingEnabled:r?.isBindingEnabled,isMidpointSnappingEnabled:r?.isMidpointSnappingEnabled})}static shouldAddMidpoint(t,n,o,i){let r=e.getElement(t.elementId,i);if(r&&Z(r)||!r)return!1;let{segmentMidpoint:a}=t.initialState;if(a.added||a.value===null||a.index===null||t.initialState.origin===null)return!1;let s=t.initialState.origin,l=io(s,H(n.x,n.y));return!(!o.selectedLinearElement?.isEditing&&l<Vm/o.zoom.value)}static addMidpoint(t,n,o,i,r){let a=r.getNonDeletedElementsMap(),s=e.getElement(t.elementId,a);if(!s)return;let{segmentMidpoint:l}=t.initialState,d={pointerDownState:t.initialState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(s,a,n.x,n.y,i&&!Z(s)?o.getEffectiveGridSize():null),p=[...s.points.slice(0,l.index),c,...s.points.slice(l.index)];return r.mutateElement(s,{points:p}),d.pointerDownState={...t.initialState,segmentMidpoint:{...t.initialState.segmentMidpoint,added:!0},lastClickedPoint:l.index},d.selectedPointsIndices=[l.index],d}static _updatePoints(t,n,o,i,r,a,s){if(Z(t)){let l={};a?.startBinding!==void 0&&(l.startBinding=a.startBinding),a?.endBinding!==void 0&&(l.endBinding=a.endBinding),l.points=Array.from(o),n.mutateElement(t,l,{informMutation:!0,isDragging:s?.isDragging??!1,isBindingEnabled:s?.isBindingEnabled,isMidpointSnappingEnabled:s?.isMidpointSnappingEnabled})}else{let l=Ya(t,o),d=Ya(t,t.points),c=(l[0]+l[2])/2,p=(l[1]+l[3])/2,h=(d[0]+d[2])/2,m=(d[1]+d[3])/2,g=h-c,f=m-p,E=nt(H(i,r),H(g,f),t.angle);n.mutateElement(t,{...a,points:o,x:t.x+E[0],y:t.y+E[1]})}}static _getShiftLockedDelta(t,n,o,i,r,a){let s=e.getPointGlobalCoordinates(t,o,n);if(Z(t))return[i[0]-s[0],i[1]-s[1]];let[l,d]=ac(i[0],i[1],r),{width:c,height:p}=cc(s[0],s[1],l,d,a);return nt(H(c,p),H(0,0),-t.angle)}static getBoundTextElementPosition=(t,n,o)=>{e.getPointsGlobalCoordinates(t,o).length<2&&je(n,o,{isDeleted:!0});let r=0,a=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=e.getPointGlobalCoordinates(t,t.points[s],o);r=l[0]-n.width/2,a=l[1]-n.height/2}else{let s=t.points.length/2-1,l=e.getSegmentMidPoint(t,s+1,o);r=l[0]-n.width/2,a=l[1]-n.height/2}return{x:r,y:a}};static getMinMaxXYWithBoundText=(t,n,o,i)=>{let[r,a,s,l]=o,d=(r+s)/2,c=(a+l)/2,{x:p,y:h}=e.getBoundTextElementPosition(t,i,n),m=p+i.width,g=h+i.height,f=H(d,c),E=nt(H(r,a),f,t.angle),x=nt(H(s,a),f,t.angle),y=nt(H(p,h),f,-t.angle),w=nt(H(m,h),f,-t.angle),M=nt(H(p,g),f,-t.angle),b=nt(H(m,g),f,-t.angle);return E[0]<x[0]&&E[1]>=x[1]?(r=Math.min(r,M[0]),s=Math.max(s,Math.max(w[0],b[0])),a=Math.min(a,y[1]),l=Math.max(l,b[1])):E[0]>=x[0]&&E[1]>x[1]?(r=Math.min(r,b[0]),s=Math.max(s,Math.max(y[0],w[0])),a=Math.min(a,M[1]),l=Math.max(l,w[1])):E[0]>=x[0]?(r=Math.min(r,w[0]),s=Math.max(s,M[0]),a=Math.min(a,b[1]),l=Math.max(l,y[1])):E[1]<=x[1]&&(r=Math.min(r,Math.min(w[0],y[0])),s=Math.max(s,b[0]),a=Math.min(a,w[1]),l=Math.max(l,M[1])),[r,a,s,l,d,c]};static getElementAbsoluteCoords=(t,n,o=!1)=>{let i=wt.generateElementShape(t,null),r=Kt(i[0]),[a,s,l,d]=si(r),c=a+t.x,p=s+t.y,h=l+t.x,m=d+t.y,g=(c+h)/2,f=(p+m)/2,E=o&&te(t,n);return E?e.getMinMaxXYWithBoundText(t,n,[c,p,h,m],E):[c,p,h,m,g,f]};static moveFixedSegment(t,n,o,i,r){let a=r.getNonDeletedElementsMap(),s=e.getElement(t.elementId,a);if(!s||!Z(s))return t;if(n&&n>0&&n<s.points.length){let l=ut(cn(_m(s.points[n],s.points[n-1]))),d=(s.fixedSegments??[]).reduce((m,g)=>(m[g.index]=g,m),{});d[n]={index:n,start:H(l?s.points[n-1][0]:o-s.x,l?i-s.y:s.points[n-1][1]),end:H(l?s.points[n][0]:o-s.x,l?i-s.y:s.points[n][1])};let c=Object.values(d).sort((m,g)=>m.index-g.index),p=c.map(m=>m.index).reduce((m,g)=>g<n?m+1:m,0);r.mutateElement(s,{fixedSegments:c});let h=H(s.x+(s.fixedSegments[p].start[0]+s.fixedSegments[p].end[0])/2,s.y+(s.fixedSegments[p].start[1]+s.fixedSegments[p].end[1])/2);return{...t,segmentMidPointHoveredCoords:h,initialState:{...t.initialState,segmentMidpoint:{added:!1,index:s.fixedSegments[p].index,value:h}}}}return t}static deleteFixedSegment(t,n,o){n.mutateElement(t,{fixedSegments:t.fixedSegments?.filter(i=>i.index!==o)})}},Ym=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,o)=>n-o),t.length?t:null},sc=(e,t,n,o,i,r,a,s,l,d,c,p)=>{let h=new Map(e.map(W=>{let q=a.points[W]??a.points.at(-1);return[W,{point:H(q[0]+t,q[1]+n),isDragging:!0}]}));if(!Y(a))return{positions:h};let m=e.includes(0),g=e.includes(a.points.length-1),{start:f,end:E}=Da(a,h,o,i,r,s,l.state,{newArrow:!!l.state.newElement,angleLocked:d,altKey:c});if(Z(a)){let W=m?f.element:g?E.element:null;return{positions:h,updates:{suggestedBinding:W?{element:W,midPoint:l.state.isMidpointSnappingEnabled?Ba(W,r,H(o-p.pointerOffset.x,i-p.pointerOffset.y)):void 0}:null}}}if(!m&&!g){let W={...a,points:a.points.map((N,T)=>h.get(T)?.point??N)},q=new Map(h);if(a.startBinding){let N=r.get(a.startBinding.elementId);if(N){let T=Bt(W,"startBinding",a.startBinding,N,r)??null;T&&q.set(0,{point:T,isDragging:!0})}}if(a.endBinding){let N=r.get(a.endBinding.elementId);if(N){let T=Bt(W,"endBinding",a.endBinding,N,r)??null;T&&q.set(a.points.length-1,{point:T,isDragging:!0})}}return{positions:q}}if(m===g)return{positions:h};let x={suggestedBinding:null};f.mode===null?x.startBinding=null:f.mode?(x.startBinding={elementId:f.element.id,mode:f.mode,...wo(a,f.element,"start",r,f.focusPoint)},m&&(x.startBinding.mode==="orbit"||!Mo("COMPLEX_BINDINGS"))&&(x.suggestedBinding=f.element?{element:f.element,midPoint:Ni(H(o-p.pointerOffset.x,i-p.pointerOffset.y),f.element,r,l.state.zoom)}:null)):m&&(x.suggestedBinding=l.state.suggestedBinding),E.mode===null?x.endBinding=null:E.mode?(x.endBinding={elementId:E.element.id,mode:E.mode,...wo(a,E.element,"end",r,E.focusPoint)},g&&(x.endBinding.mode==="orbit"||!Mo("COMPLEX_BINDINGS"))&&(x.suggestedBinding=E.element?{element:E.element,midPoint:Ni(H(o-p.pointerOffset.x,i-p.pointerOffset.y),E.element,r,l.state.zoom)}:null)):g&&(x.suggestedBinding=l.state.suggestedBinding);let y=m?H(a.points[0][0]+t,a.points[0][1]+n):a.points[0],w=g?H(a.points[a.points.length-1][0]+t,a.points[a.points.length-1][1]+n):a.points[a.points.length-1],M={...a,points:[y,...a.points.slice(1,-1),w],startBinding:x.startBinding===void 0?a.startBinding:x.startBinding===null?null:x.startBinding,endBinding:x.endBinding===void 0?a.endBinding:x.endBinding===null?null:x.endBinding},b=a.endBinding&&M.startBinding&&m&&M.startBinding.elementId===a.endBinding.elementId,S=a.startBinding&&M.endBinding&&g&&a.startBinding.elementId===M.endBinding.elementId,v=M.endBinding?E.element??r.get(M.endBinding.elementId):null,k=b?M.points[M.points.length-1]:S&&l.state.bindMode!=="inside"&&Mo("COMPLEX_BINDINGS")?M.points[0]:v&&Bt(M,"endBinding",M.endBinding,v,r,g)||M.points[M.points.length-1];M.points[M.points.length-1]=k;let A=M.startBinding?f.element??r.get(M.startBinding.elementId):null,O=S&&Mo("COMPLEX_BINDINGS")?M.points[0]:b&&l.state.bindMode!=="inside"&&Mo("COMPLEX_BINDINGS")?k:A&&Bt(M,"startBinding",M.startBinding,A,r,m)||M.points[0],G=!b&&!(S&&l.state.bindMode!=="inside"&&Mo("COMPLEX_BINDINGS"))&&!!v,R=io(O,M.points[0])!==0,C=new Set(e);A&&R&&C.add(0),v&&G&&C.add(a.points.length-1);let j=Array.from(C);return{updates:x,positions:new Map(j.map(W=>[W,W===0?{point:O,isDragging:!0}:W===a.points.length-1?{point:k,isDragging:!0}:h.get(W)]))}},lc=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]);I();import{MIME_TYPES as fc,SVG_NS as $m}from"@excalidraw/common";I();function uc(e,t,n){if(e>100||t>100)throw new Error(`${e}x${t} doesn't fit in 100x100`);let{PI:o,round:i,max:r,cos:a,abs:s}=Math,l=0,d=0,c=0,p=0;for(let we=0,xe=0;we<e*t;we++,xe+=4){let ge=n[xe+3]/255;l+=ge/255*n[xe],d+=ge/255*n[xe+1],c+=ge/255*n[xe+2],p+=ge}p&&(l/=p,d/=p,c/=p);let h=p<e*t,m=h?5:7,g=r(1,i(m*e/r(e,t))),f=r(1,i(m*t/r(e,t))),E=[],x=[],y=[],w=[];for(let we=0,xe=0;we<e*t;we++,xe+=4){let ge=n[xe+3]/255,Ne=l*(1-ge)+ge/255*n[xe],$=d*(1-ge)+ge/255*n[xe+1],ce=c*(1-ge)+ge/255*n[xe+2];E[we]=(Ne+$+ce)/3,x[we]=(Ne+$)/2-ce,y[we]=Ne-$,w[we]=ge}let M=(we,xe,ge)=>{let Ne=0,$=[],ce=0,Be=[];for(let J=0;J<ge;J++)for(let ie=0;ie*ge<xe*(ge-J);ie++){let rt=0;for(let Re=0;Re<e;Re++)Be[Re]=a(o/e*ie*(Re+.5));for(let Re=0;Re<t;Re++)for(let fi=0,wp=a(o/t*J*(Re+.5));fi<e;fi++)rt+=we[fi+Re*e]*Be[fi]*wp;rt/=e*t,ie||J?($.push(rt),ce=r(ce,s(rt))):Ne=rt}if(ce)for(let J=0;J<$.length;J++)$[J]=.5+.5/ce*$[J];return[Ne,$,ce]},[b,S,v]=M(E,r(3,g),r(3,f)),[k,A,O]=M(x,3,3),[G,R,C]=M(y,3,3),[j,W,q]=h?M(w,5,5):[],N=e>t,T=i(63*b)|i(31.5+31.5*k)<<6|i(31.5+31.5*G)<<12|i(31*v)<<18|h<<23,z=(N?f:g)|i(63*O)<<3|i(63*C)<<9|N<<15,_=[T&255,T>>8&255,T>>16,z&255,z>>8],he=h?6:5,ve=0;h&&_.push(i(15*j)|i(15*q)<<4);for(let we of h?[S,A,R,W]:[S,A,R])for(let xe of we)_[he+(ve>>1)]|=i(15*xe)<<((ve++&1)<<2);return new Uint8Array(_)}function pc(e){let{PI:t,min:n,max:o,cos:i,round:r}=Math,a=e[0]|e[1]<<8|e[2]<<16,s=e[3]|e[4]<<8,l=(a&63)/63,d=(a>>6&63)/31.5-1,c=(a>>12&63)/31.5-1,p=(a>>18&31)/31,h=a>>23,m=(s>>3&63)/63,g=(s>>9&63)/63,f=s>>15,E=o(3,f?h?5:7:s&7),x=o(3,f?s&7:h?5:7),y=h?(e[5]&15)/15:1,w=(e[5]>>4)/15,M=h?6:5,b=0,S=(N,T,z)=>{let _=[];for(let he=0;he<T;he++)for(let ve=he?0:1;ve*T<N*(T-he);ve++)_.push(((e[M+(b>>1)]>>((b++&1)<<2)&15)/7.5-1)*z);return _},v=S(E,x,p),k=S(3,3,m*1.25),A=S(3,3,g*1.25),O=h&&S(5,5,w),G=Xm(e),R=r(G>1?32:32*G),C=r(G>1?32/G:32),j=new Uint8Array(R*C*4),W=[],q=[];for(let N=0,T=0;N<C;N++)for(let z=0;z<R;z++,T+=4){let _=l,he=d,ve=c,we=y;for(let $=0,ce=o(E,h?5:3);$<ce;$++)W[$]=i(t/R*(z+.5)*$);for(let $=0,ce=o(x,h?5:3);$<ce;$++)q[$]=i(t/C*(N+.5)*$);for(let $=0,ce=0;$<x;$++)for(let Be=$?0:1,J=q[$]*2;Be*x<E*(x-$);Be++,ce++)_+=v[ce]*W[Be]*J;for(let $=0,ce=0;$<3;$++)for(let Be=$?0:1,J=q[$]*2;Be<3-$;Be++,ce++){let ie=W[Be]*J;he+=k[ce]*ie,ve+=A[ce]*ie}if(h)for(let $=0,ce=0;$<5;$++)for(let Be=$?0:1,J=q[$]*2;Be<5-$;Be++,ce++)we+=O[ce]*W[Be]*J;let xe=_-2/3*he,ge=(3*_-xe+ve)/2,Ne=ge-ve;j[T]=o(0,255*n(1,ge)),j[T+1]=o(0,255*n(1,Ne)),j[T+2]=o(0,255*n(1,xe)),j[T+3]=o(0,255*n(1,we))}return{w:R,h:C,rgba:j}}function Xm(e){let t=e[3],n=e[2]&128,o=e[4]&128,i=o?n?5:7:t&7,r=o?t&7:n?5:7;return i/r}var Zm=100,hc=new Map,mc=new Set,qm=e=>{let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t)},Km=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n},Ob=e=>{let t=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(!t||!n)return null;let o=Math.min(1,Zm/Math.max(t,n)),i=Math.max(1,Math.round(t*o)),r=Math.max(1,Math.round(n*o)),a=document.createElement("canvas");a.width=i,a.height=r;let s=a.getContext("2d");if(!s)return null;s.drawImage(e,0,0,i,r);let l=s.getImageData(0,0,i,r);return qm(uc(i,r,l.data))},gc=e=>{if(mc.has(e))return null;let t=hc.get(e);if(t)return t;try{let{w:n,h:o,rgba:i}=pc(Km(e)),r=document.createElement("canvas");r.width=n,r.height=o;let a=r.getContext("2d");if(!a)return null;let s=a.createImageData(n,o);return s.data.set(i),a.putImageData(s,0,0),hc.set(e,r),r}catch(n){return mc.add(e),console.warn("Invalid ThumbHash",n),null}},Qm=e=>new Promise((t,n)=>{let o=new Image;o.onload=()=>{t(o)},o.onerror=i=>{n(i)},o.src=e}),Rb=async({fileIds:e,files:t,imageCache:n})=>{let o=new Map,i=new Map;return await Promise.all(e.reduce((r,a)=>{let s=t[a];return s&&!o.has(a)?(o.set(a,!0),r.concat((async()=>{try{if(s.mimeType===fc.binary)throw new Error("Only images can be added to ImageCache");let l=Qm(s.dataURL),d={image:l,mimeType:s.mimeType};n.set(a,d);let c=await l;n.set(a,{...d,image:c})}catch{i.set(a,!0)}})())):r},[])),{imageCache:n,updatedFiles:o,erroredFiles:i}},Fb=e=>e.filter(t=>Mn(t)),Jm=e=>e?.nodeName.toLowerCase()==="svg",Nb=e=>{let t=new DOMParser().parseFromString(e,fc.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!Jm(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",$m);let i=n.getAttribute("width"),r=n.getAttribute("height");(i?.includes("%")||i==="auto")&&(i=null),(r?.includes("%")||r==="auto")&&(r=null);let a=n.getAttribute("viewBox");if(!i||!r){if(i=i||"50",r=r||"50",a){let s=a.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);s&&([,i,r]=s)}n.setAttribute("width",i),n.setAttribute("height",r)}return a||n.setAttribute("viewBox",`0 0 ${i} ${r}`),n.outerHTML}};var d0=(e,t)=>Mn(e)&&!t.imageCache.has(e.fileId),qa=e=>{switch(e.type){case"freedraw":return e.strokeWidth*12;case"text":return e.fontSize/2;case"arrow":return e.endArrowhead||e.endArrowhead?40:20;default:return 20}},c0=(e,t,n,o,i=1)=>{let r=(t?.opacity??100)*e.opacity/1e4*i;return(n.has(e.id)||o&&o.some(a=>a.id===e.id)||t&&n.has(t.id))&&(r*=n0/100),r},u0=(e,t,n)=>{let r=qa(e),[a,s,l,d]=ee(e,t),c=ae(e)||He(e)?Po(a,l):e.width,p=ae(e)||He(e)?Po(s,d):e.height,h=c*window.devicePixelRatio+r*2,m=p*window.devicePixelRatio+r*2,g=n.value;return(h*g>32767||m*g>32767)&&(g=Math.min(32767/h,32767/m)),h*m*g*g>16777216&&(g=Math.sqrt(16777216/(h*m))),h=Math.floor(h*g),m=Math.floor(m*g),{width:h,height:m,scale:g}},wc=(e,t,n,o,i)=>{let r=document.createElement("canvas"),a=r.getContext("2d"),s=qa(e),{width:l,height:d,scale:c}=u0(e,t,n);if(!l||!d)return null;r.width=l,r.height=d;let p=-100,h=0;if(ae(e)||He(e)){let[x,y]=ee(e,t);p=e.x>x?Po(e.x,x)*window.devicePixelRatio*c:0,h=e.y>y?Po(e.y,y)*window.devicePixelRatio*c:0,a.translate(p,h)}a.save(),a.translate(s*c,s*c),a.scale(window.devicePixelRatio*c,window.devicePixelRatio*c);let m=po.canvas(r);mr(e,m,a,o),a.restore();let g=te(e,t),f=document.createElement("canvas"),E=f.getContext("2d");if(Y(e)&&g){let[x,y,w,M]=ee(e,t),b=Math.max(Po(x,w),Po(y,M));f.width=b*window.devicePixelRatio*c+s*c*10,f.height=b*window.devicePixelRatio*c+s*c*10,E.translate(f.width/2,f.height/2),E.rotate(e.angle),E.drawImage(r,-r.width/2,-r.height/2,r.width,r.height);let[,,,,S,v]=ee(g,t);E.rotate(-e.angle);let k=(f.width-r.width)/2,A=(f.height-r.height)/2,O=f.width/2-(S-x)*window.devicePixelRatio*c-k-s*c,G=f.height/2-(v-y)*window.devicePixelRatio*c-A-s*c;E.translate(-O,-G),E.clearRect(-(g.width/2+Hn)*window.devicePixelRatio*c,-(g.height/2+Hn)*window.devicePixelRatio*c,(g.width+Hn*2)*window.devicePixelRatio*c,(g.height+Hn*2)*window.devicePixelRatio*c)}return{element:e,canvas:r,theme:i.theme,scale:c,zoomValue:n.value,canvasOffsetX:p,canvasOffsetY:h,boundTextElementVersion:te(e,t)?.version||null,containingFrameOpacity:Rn(e,t)?.opacity||100,boundTextCanvas:f,angle:e.angle,imageCrop:_e(e)?e.crop:null}},e6=14,bc=typeof document<"u"?document.createElement("img"):{src:""};bc.src=`data:${Za.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var Mc=typeof document<"u"?document.createElement("img"):{src:""};Mc.src=`data:${Za.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var xc=(e,t,n)=>{if(e.status!=="error"&&e.thumbHash){let r=gc(e.thumbHash);if(r){t.drawImage(r,0,0,e.width,e.height);return}}t.fillStyle=n===ro.DARK?"#2E2E2E":"#E7E7E7",t.fillRect(0,0,e.width,e.height);let o=Math.min(e.width,e.height),i=Math.min(o,Math.min(o*.4,100));t.drawImage(e.status==="error"?Mc:bc,e.width/2-i/2,e.height/2-i/2,i,i)},mr=(e,t,n,o)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(wt.generateElementShape(e,o));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",wt.generateElementShape(e,o).forEach(i=>{t.draw(i)});break}case"freedraw":{n.save();let i=wt.generateElementShape(e,o);for(let r of i)typeof r=="string"?(n.fillStyle=li(e.strokeColor,o.theme===ro.DARK),n.fill(new Path2D(r))):t.draw(r);n.restore();break}case"image":{n.save();let i=e.fileId!==null?o.imageCache.get(e.fileId):null,r=Mn(e)?i?.image:void 0;if(r!=null&&!(r instanceof Promise)){e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,tn(Math.min(e.width,e.height),e)),n.clip());let a=o.imageTransitionDuration??0;if(!o.isExporting&&i?.transitionStart!==void 0)if(a>0){let h=Math.min(1,(performance.now()-i.transitionStart)/a);h<1?(i.placeholderImage?n.drawImage(i.placeholderImage,0,0,e.width,e.height):xc(e,n,o.theme),n.globalAlpha*=h):(delete i.placeholderImage,delete i.transitionStart)}else delete i.placeholderImage,delete i.transitionStart;let{x:s,y:l,width:d,height:c}=e.crop?e.crop:{x:0,y:0,width:r.naturalWidth,height:r.naturalHeight},p=o.theme===ro.DARK&&i?.mimeType===Za.svg;if(p&&l0){let h=window.devicePixelRatio||1,m=document.createElement("canvas");m.width=e.width*h,m.height=e.height*h;let g=m.getContext("2d");if(g){g.scale(h,h),g.drawImage(r,s,l,d,c,0,0,e.width,e.height);let f=g.getImageData(0,0,m.width,m.height),E=f.data;for(let x=0;x<E.length;x+=4)E[x]=255-E[x],E[x+1]=255-E[x+1],E[x+2]=255-E[x+2];g.putImageData(f,0,0),n.drawImage(m,0,0,m.width,m.height,0,0,e.width,e.height)}}else p&&(n.filter=o0),n.drawImage(r,s,l,d,c,0,0,e.width,e.height)}else xc(e,n,o.theme);n.restore();break}default:if(re(e)){let i=r0(e.text),r=i&&!n.canvas.isConnected;r&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",i?"rtl":"ltr"),n.save(),n.font=i0(e),n.fillStyle=li(e.strokeColor,o.theme===ro.DARK),n.textAlign=e.textAlign;let a=e.text.replace(/\r\n?/g,`
13
13
  `).split(`
14
- `),s=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,l=Ti(e.fontSize,e.lineHeight),d=Sm(e.fontFamily,e.fontSize,l);for(let c=0;c<a.length;c++)n.fillText(a[c],s,c*l+d);n.restore(),r&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},$o=new WeakMap,Zd=(e,t,n,o)=>{let i=n?o.zoom:{value:1},r=$o.get(e),a=r&&r.zoomValue!==i.value&&!o?.shouldCacheIgnoreZoom,s=Q(e,t),l=s?.version||null,d=Ae(e)?e.crop:null,c=Sn(e,t)?.opacity||100;if(!r||a||r.theme!==o.theme||r.boundTextElementVersion!==l||r.imageCrop!==d||r.containingFrameOpacity!==c||j(e)&&s&&e.angle!==r.angle){let u=qd(e,t,i,n,o);return u?($o.set(e,u),u):null}return r},Fa=(e,t,n,o,i)=>{let r=e.element,a=ir(r),s=e.scale,[l,d,c,u]=K(r,i),h=((l+c)/2+o.scrollX)*window.devicePixelRatio,m=((d+u)/2+o.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let g=Q(r,i);if(j(r)&&g){let f=(e.boundTextCanvas.width-e.canvas.width)/2,E=(e.boundTextCanvas.height-e.canvas.height)/2;t.translate(h,m),t.drawImage(e.boundTextCanvas,-(c-l)/2*window.devicePixelRatio-f/s-a,-(u-d)/2*window.devicePixelRatio-E/s-a,e.boundTextCanvas.width/s,e.boundTextCanvas.height/s)}else if(t.translate(h,m),t.rotate(r.angle),"scale"in e.element&&!km(r,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+o.scrollX)*window.devicePixelRatio-a*e.scale/e.scale,(d+o.scrollY)*window.devicePixelRatio-a*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),C.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&Tt(r)){let f=Q(r,i),E=Kr(r);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((E.x+o.scrollX)*window.devicePixelRatio,(E.y+o.scrollY)*window.devicePixelRatio,xt(r,f)*window.devicePixelRatio,Ro(r,f)*window.devicePixelRatio)}t.restore()},$w=(e,t,n,o)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let i=.5/n.zoom.value;t.fillRect(i,i,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=o,t.strokeRect(i,i,e.width,e.height),t.restore()},Zw=(e,t,n,o,i,r,a)=>{let s=a.openDialog?.name==="elementLinkSelector"&&!a.selectedElementIds[e.id]&&!a.hoveredElementIds[e.id];switch(i.globalAlpha=Tm(e,Sn(e,t),r.elementsPendingErasure,r.pendingFlowchartNodes,s?wm:1),e.type){case"magicframe":case"frame":{a.frameRendering.enabled&&a.frameRendering.outline&&(i.save(),i.translate(e.x+a.scrollX,e.y+a.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=tr.strokeWidth/a.zoom.value,i.strokeStyle=or(tr.strokeColor,a.theme===lo.DARK),dl(e)&&(i.strokeStyle=a.theme===lo.LIGHT?"#7affd7":or("#1d8264")),tr.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,tr.radius/a.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(r.isExporting){let[l,d,c,u]=K(e,t),h=(l+c)/2+a.scrollX,m=(d+u)/2+a.scrollY,g=(c-l)/2-(e.x-l),f=(u-d)/2-(e.y-d);i.save(),i.translate(h,m),i.rotate(e.angle),i.translate(-g,-f),nr(e,o,i,r),i.restore()}else{let l=Zd(e,n,r,a);if(!l)return;Fa(l,i,r,a,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(r.isExporting){let[l,d,c,u]=K(e,t),h=(l+c)/2+a.scrollX,m=(d+u)/2+a.scrollY,g=(c-l)/2-(e.x-l),f=(u-d)/2-(e.y-d);if(te(e)){let x=De(e,t);if(j(x)){let y=D.getBoundTextElementPosition(x,e,t);g=(c-l)/2-(y.x-l),f=(u-d)/2-(y.y-d)}}i.save(),i.translate(h,m);let E=Q(e,t);if(j(e)&&E){let x=document.createElement("canvas"),y=x.getContext("2d"),w=Math.max(kn(l,c),kn(d,u)),M=ir(e);x.width=w*a.exportScale+M*10*a.exportScale,x.height=w*a.exportScale+M*10*a.exportScale,y.translate(x.width/2,x.height/2),y.scale(a.exportScale,a.exportScale),g=e.width/2-(e.x-l),f=e.height/2-(e.y-d),y.rotate(e.angle);let b=Nn.canvas(x);y.translate(-g,-f),nr(e,b,y,r),y.translate(g,f),y.rotate(-e.angle);let[,,,,S,v]=K(E,t),k=(l+c)/2-S,T=(d+u)/2-v;y.translate(-k,-T),y.clearRect(-E.width/2,-E.height/2,E.width,E.height),i.scale(1/a.exportScale,1/a.exportScale),i.drawImage(x,-x.width/2,-x.height/2,x.width,x.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-g,-f),nr(e,o,i,r);i.restore()}else{let l=Zd(e,n,r,a);if(!l)return;let d=i.imageSmoothingEnabled;if(!a?.shouldCacheIgnoreZoom&&(!e.angle||ym(e.angle))&&(i.imageSmoothingEnabled=!1),e.id===a.croppingElementId&&Ae(l.element)&&l.element.crop!==null){i.save(),i.globalAlpha=.1;let c=qd(al(l.element,t),n,a.zoom,r,a);c&&Fa(c,i,r,a,n),i.restore()}Fa(l,i,r,a,n),i.imageSmoothingEnabled=d}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1};function qw(e,t,n){let o=ue({...e,angle:0},n),i=Ji((o[0]+o[2])/2,(o[1]+o[3])/2);return vm(t.length>=2,"Freepath outline must have at least 2 points"),t.slice(2).reduce((r,a)=>(r.push($d(r[r.length-1][1],Ra(Ji(a[0]+e.x,a[1]+e.y),i,e.angle))),r),[$d(Ra(Ji(t[0][0]+e.x,t[0][1]+e.y),i,e.angle),Ra(Ji(t[1][0]+e.x,t[1][1]+e.y),i,e.angle))])}var at=class e{static rg=new lt;static cache=new WeakMap;static get=(t,n)=>{let o=e.cache.get(t);if(o&&(n===null||o.theme===n))return o.shape};static delete=t=>{e.cache.delete(t),$o.delete(t)};static destroy=()=>{e.cache=new WeakMap};static generateElementShape=(t,n)=>{let o=n?.isExporting?void 0:e.get(t,n?n.theme:null);if(o!==void 0)return o;$o.delete(t);let i=Nm(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:Gm.white,embedsValidationStatus:null,theme:za.LIGHT});return n?.isExporting||e.cache.set(t,{shape:i,theme:n?.theme||za.LIGHT}),i}},Rm=e=>[8,8+e],oc=e=>[1.5,6+e];function Fm(e){let t=e.roughness,n=Math.max(e.width,e.height),o=Math.min(e.width,e.height);return o>=20&&n>=50||o>=15&&e.roundness&&Cl(e.type)||ne(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var Qe=(e,t=!1,n=!1)=>{let o={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?Rm(e.strokeWidth):e.strokeStyle==="dotted"?oc(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:Fm(e),stroke:Ko(e.strokeColor,n),preserveVertices:t||e.roughness<Bm.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return o.fillStyle=e.fillStyle,o.fill=qo(e.backgroundColor)?void 0:Ko(e.backgroundColor,n),e.type==="ellipse"&&(o.curveFitting=1),o;case"line":case"freedraw":return Ut(e.points)&&(o.fillStyle=e.fillStyle,o.fill=e.backgroundColor==="transparent"?void 0:Ko(e.backgroundColor,n)),o;case"arrow":return o;default:throw new Error(`Unimplemented type ${e.type}`)}},ec=(e,t,n)=>Pi(e)&&(t||ll(e)&&n?.get(e.id)!==!0)&&qo(e.backgroundColor)&&qo(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Mi(e)?{...e,strokeColor:qo(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:qo(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,Zo=(e,t,n)=>{if(t===null)return[];let[,,o,i,r,a]=t;return[e.line(o,i,r,a,n)]},rr=(e,t,n)=>{if(t===null)return[];let[o,i,r,a,s,l]=t;return[e.line(r,a,o,i,n),e.line(s,l,o,i,n)]},$n=(e,t)=>{let n={...t};if(e.strokeStyle==="dotted"){let o=oc(e.strokeWidth-1);n.strokeLineDash=[o[0],o[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},Ha=(e,t,n,o,i,r=1)=>{if(o===null)return[];let[a,s,l]=o,d={...t,fill:i,fillStyle:"solid",stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete d.strokeLineDash,[e.circle(a,s,l*r,d)]},tc=(e,t,n,o,i,r,a,s)=>{if(o===null)return[];let l=Ko(e.strokeColor,s),d=Ko(a,s),c=-.25,u=.8;switch(o){case"circle":case"circle_outline":return Ha(i,r,l,je(e,t,n,o),o==="circle_outline"?d:l);case"triangle":case"triangle_outline":{let h=je(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y]=h,w={...r,fill:o==="triangle_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete w.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[m,g]],w)]}case"diamond":case"diamond_outline":{let h=je(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y,w,M]=h,b={...r,fill:o==="diamond_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete b.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[w,M],[m,g]],b)]}case"cardinality_one":return Zo(i,je(e,t,n,o),$n(e,r));case"cardinality_many":return rr(i,je(e,t,n,o),$n(e,r));case"cardinality_one_or_many":{let h=$n(e,r);return[...rr(i,je(e,t,n,"cardinality_many"),h),...Zo(i,je(e,t,n,"cardinality_one",c),h)]}case"cardinality_exactly_one":{let h=$n(e,r);return[...Zo(i,je(e,t,n,"cardinality_one",-.5),h),...Zo(i,je(e,t,n,"cardinality_one"),h)]}case"cardinality_zero_or_one":{let h=$n(e,r);return[...Ha(i,r,l,je(e,t,n,"circle_outline",1.5),d,u),...Zo(i,je(e,t,n,"cardinality_one",-.5),h)]}case"cardinality_zero_or_many":{let h=$n(e,r);return[...rr(i,je(e,t,n,"cardinality_many"),h),...Ha(i,r,l,je(e,t,n,"circle_outline",1.5),d,u)]}case"bar":case"arrow":default:return rr(i,je(e,t,n,o),$n(e,r))}},bl=(e,t)=>{let n=new lt,o={seed:e.seed,disableMultiStroke:!0,disableMultiStrokeFill:!0,roughness:0,preserveVertices:!0},i=de(e,t);switch(e.type){case"line":case"arrow":{let r=e.points.length?e.points:[me(0,0)];return Y(e)?n.path(ic(r,16),o).sets[0].ops:e.roundness?n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((a,s)=>{if(s===0){let l=nn(me(e.x+a.data[0],e.y+a.data[1]),i,e.angle);return{op:"move",data:me(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[nn(me(e.x+a.data[0],e.y+a.data[1]),i,e.angle),nn(me(e.x+a.data[2],e.y+a.data[3]),i,e.angle),nn(me(e.x+a.data[4],e.y+a.data[5]),i,e.angle)].map(l=>me(l[0]-e.x,l[1]-e.y)).flat()}}):r.map((a,s)=>{let l=nn(me(e.x+a[0],e.y+a[1]),i,e.angle);return{op:s===0?"move":"lineTo",data:me(l[0]-e.x,l[1]-e.y)}})}case"freedraw":{if(e.points.length<2)return[];let r=So(e.points,.75);return n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((a,s)=>{if(s===0){let l=nn(me(e.x+a.data[0],e.y+a.data[1]),i,e.angle);return{op:"move",data:me(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[nn(me(e.x+a.data[0],e.y+a.data[1]),i,e.angle),nn(me(e.x+a.data[2],e.y+a.data[3]),i,e.angle),nn(me(e.x+a.data[4],e.y+a.data[5]),i,e.angle)].map(l=>me(l[0]-e.x,l[1]-e.y)).flat()}})}}},Nm=(e,t,{isExporting:n,canvasBackgroundColor:o,embedsValidationStatus:i,theme:r})=>{let a=r===za.DARK;switch(e.type){case"rectangle":case"iframe":case"embeddable":{let s;if(e.roundness){let l=e.width,d=e.height,c=Yt(Math.min(l,d),e);s=t.path(`M ${c} 0 L ${l-c} 0 Q ${l} 0, ${l} ${c} L ${l} ${d-c} Q ${l} ${d}, ${l-c} ${d} L ${c} ${d} Q 0 ${d}, 0 ${d-c} L 0 ${c} Q 0 0, ${c} 0`,Qe(ec(e,n,i),!0,a))}else s=t.rectangle(0,0,e.width,e.height,Qe(ec(e,n,i),!1,a));return s}case"diamond":{let s,[l,d,c,u,h,m,g,f]=to(e);if(e.roundness){let E=Yt(Math.abs(l-g),e),x=Yt(Math.abs(u-d),e);s=t.path(`M ${l+E} ${d+x} L ${c-E} ${u-x}
15
- C ${c} ${u}, ${c} ${u}, ${c-E} ${u+x}
14
+ `),s=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,l=Wi(e.fontSize,e.lineHeight),d=a0(e.fontFamily,e.fontSize,l);for(let c=0;c<a.length;c++)n.fillText(a[c],s,c*l+d);n.restore(),r&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},di=new WeakMap,yc=(e,t,n,o)=>{let i=n?o.zoom:{value:1},r=di.get(e),a=r&&r.zoomValue!==i.value&&!o?.shouldCacheIgnoreZoom,s=te(e,t),l=s?.version||null,d=_e(e)?e.crop:null,c=Mn(e)&&n.imageCache.get(e.fileId)?.transitionStart!==void 0,p=Rn(e,t)?.opacity||100;if(!r||a||r.theme!==o.theme||r.boundTextElementVersion!==l||r.imageCrop!==d||c||r.containingFrameOpacity!==p||Y(e)&&s&&e.angle!==r.angle){let h=wc(e,t,i,n,o);return h?(di.set(e,h),h):null}return r},$a=(e,t,n,o,i)=>{let r=e.element,a=qa(r),s=e.scale,[l,d,c,p]=ee(r,i),h=((l+c)/2+o.scrollX)*window.devicePixelRatio,m=((d+p)/2+o.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let g=te(r,i);if(Y(r)&&g){let f=(e.boundTextCanvas.width-e.canvas.width)/2,E=(e.boundTextCanvas.height-e.canvas.height)/2;t.translate(h,m),t.drawImage(e.boundTextCanvas,-(c-l)/2*window.devicePixelRatio-f/s-a,-(p-d)/2*window.devicePixelRatio-E/s-a,e.boundTextCanvas.width/s,e.boundTextCanvas.height/s)}else if(t.translate(h,m),t.rotate(r.angle),"scale"in e.element&&!d0(r,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+o.scrollX)*window.devicePixelRatio-a*e.scale/e.scale,(d+o.scrollY)*window.devicePixelRatio-a*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),D.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&zt(r)){let f=te(r,i),E=la(r);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((E.x+o.scrollX)*window.devicePixelRatio,(E.y+o.scrollY)*window.devicePixelRatio,Ct(r,f)*window.devicePixelRatio,qo(r,f)*window.devicePixelRatio)}t.restore()},t6=(e,t,n,o)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let i=.5/n.zoom.value;t.fillRect(i,i,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=o,t.strokeRect(i,i,e.width,e.height),t.restore()},n6=(e,t,n,o,i,r,a)=>{let s=a.openDialog?.name==="elementLinkSelector"&&!a.selectedElementIds[e.id]&&!a.hoveredElementIds[e.id];switch(i.globalAlpha=c0(e,Rn(e,t),r.elementsPendingErasure,r.pendingFlowchartNodes,s?t0:1),e.type){case"magicframe":case"frame":{a.frameRendering.enabled&&a.frameRendering.outline&&(i.save(),i.translate(e.x+a.scrollX,e.y+a.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=hr.strokeWidth/a.zoom.value,i.strokeStyle=li(hr.strokeColor,a.theme===ro.DARK),Sl(e)&&(i.strokeStyle=a.theme===ro.LIGHT?"#7affd7":li("#1d8264")),hr.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,hr.radius/a.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(r.isExporting){let[l,d,c,p]=ee(e,t),h=(l+c)/2+a.scrollX,m=(d+p)/2+a.scrollY,g=(c-l)/2-(e.x-l),f=(p-d)/2-(e.y-d);i.save(),i.translate(h,m),i.rotate(e.angle),i.translate(-g,-f),mr(e,o,i,r),i.restore()}else{let l=yc(e,n,r,a);if(!l)return;$a(l,i,r,a,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(r.isExporting){let[l,d,c,p]=ee(e,t),h=(l+c)/2,m=(d+p)/2,g=h+a.scrollX,f=m+a.scrollY,E=(c-l)/2-(e.x-l),x=(p-d)/2-(e.y-d);if(re(e)){let w=Xe(e,t);if(Y(w)){let M=F.getBoundTextElementPosition(w,e,t);E=(c-l)/2-(M.x-l),x=(p-d)/2-(M.y-d)}}i.save(),i.translate(g,f);let y=te(e,t);if(Y(e)&&y){E=e.width/2-(e.x-l),x=e.height/2-(e.y-d),i.save(),i.rotate(e.angle),i.translate(-E,-x),mr(e,o,i,r),i.restore();let[,,,,w,M]=ee(y,t),b=w-h-y.width/2-Hn,S=M-m-y.height/2-Hn,v=y.width+Hn*2,k=y.height+Hn*2;"viewBackgroundColor"in a&&(a.viewBackgroundColor==="transparent"||!a.viewBackgroundColor)?i.clearRect(b,S,v,k):(i.save(),i.fillStyle=li(r.canvasBackgroundColor,r.theme===ro.DARK),i.fillRect(b,S,v,k),i.restore())}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-E,-x),mr(e,o,i,r);i.restore()}else{let l=yc(e,n,r,a);if(!l)return;let d=i.imageSmoothingEnabled;if(!a?.shouldCacheIgnoreZoom&&(!e.angle||e0(e.angle))&&(i.imageSmoothingEnabled=!1),e.id===a.croppingElementId&&_e(l.element)&&l.element.crop!==null){i.save(),i.globalAlpha=.1;let c=wc(Ml(l.element,t),n,a.zoom,r,a);c&&$a(c,i,r,a,n),i.restore()}$a(l,i,r,a,n),i.imageSmoothingEnabled=d}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1};function o6(e,t,n){let o=Ee({...e,angle:0},n),i=pr((o[0]+o[2])/2,(o[1]+o[3])/2);return s0(t.length>=2,"Freepath outline must have at least 2 points"),t.slice(2).reduce((r,a)=>(r.push(Ec(r[r.length-1][1],Xa(pr(a[0]+e.x,a[1]+e.y),i,e.angle))),r),[Ec(Xa(pr(t[0][0]+e.x,t[0][1]+e.y),i,e.angle),Xa(pr(t[1][0]+e.x,t[1][1]+e.y),i,e.angle))])}var wt=class e{static rg=new bt;static cache=new WeakMap;static get=(t,n)=>{let o=e.cache.get(t);if(o&&(n===null||o.theme===n))return o.shape};static delete=t=>{e.cache.delete(t),di.delete(t)};static destroy=()=>{e.cache=new WeakMap};static generateElementShape=(t,n)=>{let o=n?.isExporting?void 0:e.get(t,n?n.theme:null);if(o!==void 0)return o;di.delete(t);let i=y0(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:m0.white,embedsValidationStatus:null,theme:Ja.LIGHT});return n?.isExporting||e.cache.set(t,{shape:i,theme:n?.theme||Ja.LIGHT}),i}},E0=e=>[8,8+e],Ac=e=>[1.5,6+e];function x0(e){let t=e.roughness,n=Math.max(e.width,e.height),o=Math.min(e.width,e.height);return o>=20&&n>=50||o>=15&&e.roundness&&Xl(e.type)||ae(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var ht=(e,t=!1,n=!1)=>{let o={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?E0(e.strokeWidth):e.strokeStyle==="dotted"?Ac(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:x0(e),stroke:pi(e.strokeColor,n),preserveVertices:t||e.roughness<p0.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return o.fillStyle=e.fillStyle,o.fill=ui(e.backgroundColor)?void 0:pi(e.backgroundColor,n),e.type==="ellipse"&&(o.curveFitting=1),o;case"line":case"freedraw":return nn(e.points)&&(o.fillStyle=e.fillStyle,o.fill=e.backgroundColor==="transparent"?void 0:pi(e.backgroundColor,n)),o;case"arrow":return o;default:throw new Error(`Unimplemented type ${e.type}`)}},Ic=(e,t,n)=>Ri(e)&&(t||Il(e)&&n?.get(e.id)!==!0)&&ui(e.backgroundColor)&&ui(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Oi(e)?{...e,strokeColor:ui(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:ui(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,ci=(e,t,n)=>{if(t===null)return[];let[,,o,i,r,a]=t;return[e.line(o,i,r,a,n)]},fr=(e,t,n)=>{if(t===null)return[];let[o,i,r,a,s,l]=t;return[e.line(r,a,o,i,n),e.line(s,l,o,i,n)]},ao=(e,t)=>{let n={...t};if(e.strokeStyle==="dotted"){let o=Ac(e.strokeWidth-1);n.strokeLineDash=[o[0],o[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},Ka=(e,t,n,o,i,r=1)=>{if(o===null)return[];let[a,s,l]=o,d={...t,fill:i,fillStyle:"solid",stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete d.strokeLineDash,[e.circle(a,s,l*r,d)]},Sc=(e,t,n,o,i,r,a,s)=>{if(o===null)return[];let l=pi(e.strokeColor,s),d=pi(a,s),c=-.25,p=.8;switch(o){case"circle":case"circle_outline":return Ka(i,r,l,ot(e,t,n,o),o==="circle_outline"?d:l);case"triangle":case"triangle_outline":{let h=ot(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y]=h,w={...r,fill:o==="triangle_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete w.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[m,g]],w)]}case"diamond":case"diamond_outline":{let h=ot(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y,w,M]=h,b={...r,fill:o==="diamond_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete b.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[w,M],[m,g]],b)]}case"cardinality_one":return ci(i,ot(e,t,n,o),ao(e,r));case"cardinality_many":return fr(i,ot(e,t,n,o),ao(e,r));case"cardinality_one_or_many":{let h=ao(e,r);return[...fr(i,ot(e,t,n,"cardinality_many"),h),...ci(i,ot(e,t,n,"cardinality_one",c),h)]}case"cardinality_exactly_one":{let h=ao(e,r);return[...ci(i,ot(e,t,n,"cardinality_one",-.5),h),...ci(i,ot(e,t,n,"cardinality_one"),h)]}case"cardinality_zero_or_one":{let h=ao(e,r);return[...Ka(i,r,l,ot(e,t,n,"circle_outline",1.5),d,p),...ci(i,ot(e,t,n,"cardinality_one",-.5),h)]}case"cardinality_zero_or_many":{let h=ao(e,r);return[...fr(i,ot(e,t,n,"cardinality_many"),h),...Ka(i,r,l,ot(e,t,n,"circle_outline",1.5),d,p)]}case"bar":case"arrow":default:return fr(i,ot(e,t,n,o),ao(e,r))}},Fl=(e,t)=>{let n=new bt,o={seed:e.seed,disableMultiStroke:!0,disableMultiStrokeFill:!0,roughness:0,preserveVertices:!0},i=me(e,t);switch(e.type){case"line":case"arrow":{let r=e.points.length?e.points:[Pe(0,0)];return Z(e)?n.path(kc(r,16),o).sets[0].ops:e.roundness?n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((a,s)=>{if(s===0){let l=mn(Pe(e.x+a.data[0],e.y+a.data[1]),i,e.angle);return{op:"move",data:Pe(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[mn(Pe(e.x+a.data[0],e.y+a.data[1]),i,e.angle),mn(Pe(e.x+a.data[2],e.y+a.data[3]),i,e.angle),mn(Pe(e.x+a.data[4],e.y+a.data[5]),i,e.angle)].map(l=>Pe(l[0]-e.x,l[1]-e.y)).flat()}}):r.map((a,s)=>{let l=mn(Pe(e.x+a[0],e.y+a[1]),i,e.angle);return{op:s===0?"move":"lineTo",data:Pe(l[0]-e.x,l[1]-e.y)}})}case"freedraw":{if(e.points.length<2)return[];let r=No(e.points,.75);return n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((a,s)=>{if(s===0){let l=mn(Pe(e.x+a.data[0],e.y+a.data[1]),i,e.angle);return{op:"move",data:Pe(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[mn(Pe(e.x+a.data[0],e.y+a.data[1]),i,e.angle),mn(Pe(e.x+a.data[2],e.y+a.data[3]),i,e.angle),mn(Pe(e.x+a.data[4],e.y+a.data[5]),i,e.angle)].map(l=>Pe(l[0]-e.x,l[1]-e.y)).flat()}})}}},y0=(e,t,{isExporting:n,canvasBackgroundColor:o,embedsValidationStatus:i,theme:r})=>{let a=r===Ja.DARK;switch(e.type){case"rectangle":case"iframe":case"embeddable":{let s;if(e.roundness){let l=e.width,d=e.height,c=tn(Math.min(l,d),e);s=t.path(`M ${c} 0 L ${l-c} 0 Q ${l} 0, ${l} ${c} L ${l} ${d-c} Q ${l} ${d}, ${l-c} ${d} L ${c} ${d} Q 0 ${d}, 0 ${d-c} L 0 ${c} Q 0 0, ${c} 0`,ht(Ic(e,n,i),!0,a))}else s=t.rectangle(0,0,e.width,e.height,ht(Ic(e,n,i),!1,a));return s}case"diamond":{let s,[l,d,c,p,h,m,g,f]=go(e);if(e.roundness){let E=tn(Math.abs(l-g),e),x=tn(Math.abs(p-d),e);s=t.path(`M ${l+E} ${d+x} L ${c-E} ${p-x}
15
+ C ${c} ${p}, ${c} ${p}, ${c-E} ${p+x}
16
16
  L ${h+E} ${m-x}
17
17
  C ${h} ${m}, ${h} ${m}, ${h-E} ${m-x}
18
18
  L ${g+E} ${f+x}
19
19
  C ${g} ${f}, ${g} ${f}, ${g+E} ${f-x}
20
20
  L ${l-E} ${d+x}
21
- C ${l} ${d}, ${l} ${d}, ${l+E} ${d+x}`,Qe(e,!0,a))}else s=t.polygon([[l,d],[c,u],[h,m],[g,f]],Qe(e,!1,a));return s}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Qe(e,!1,a));case"line":case"arrow":{let s,l=Qe(e,!1,a),d=e.points.length?e.points:[me(0,0)];if(Y(e)?d.every(c=>Math.abs(c[0])<=1e6&&Math.abs(c[1])<=1e6)?s=[t.path(ic(d,16),Qe(e,!0,a))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(d)),s=[]):e.roundness?s=[t.curve(d,l)]:l.fill?s=[t.polygon(d,l)]:s=[t.linearPath(d,l)],e.type==="arrow"){let{startArrowhead:c=null,endArrowhead:u="arrow"}=e;if(c!==null){let h=tc(e,s,"start",c,t,l,o,a);s.push(...h)}if(u!==null){let h=tc(e,s,"end",u,t,l,o,a);s.push(...h)}}return s}case"freedraw":{let s=[];if(Ut(e.points)){let l=So(e.points,.75);s.push(t.curve(l,{...Qe(e,!1,a),stroke:"none"}))}return s.push(Hm(e)),s}case"frame":case"magicframe":case"text":case"image":return null;default:return Dm(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},ic=(e,t)=>{let n=[];for(let i=1;i<e.length-1;i+=1){let r=e[i-1],a=e[i+1],s=e[i],l=yt(s,r),d=yt(a,s),c=Math.min(t,Jd(e[i],a)/2,Jd(e[i],r)/2);l?r[0]<s[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):r[1]<s[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c]),n.push(e[i]),d?a[0]<s[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):a[1]<s[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c])}let o=[`M ${e[0][0]} ${e[0][1]}`];for(let i=0;i<n.length;i+=3)o.push(`L ${n[i][0]} ${n[i][1]}`),o.push(`Q ${n[i+1][0]} ${n[i+1][1]}, ${n[i+2][0]} ${n[i+2][1]}`);return o.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),o.join(" ")},Qo=(e,t)=>{switch(e.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return Vs(e);case"arrow":case"line":{let n=at.generateElementShape(e,null)[0],[,,,,o,i]=K(e,t);return Di(e)?$s(e,n,me(e.x,e.y),e.angle,me(o,i)):Us(n,me(e.x,e.y),e.angle,me(o,i))}case"ellipse":return Ys(e);case"freedraw":{let[,,,,n,o]=K(e,t);return Xs(e,me(n,o),Di(e))}}},Ud=(e,t)=>{let n=[...e.points];if(t){if(!ml(e.points))return null;let i=n[0],r=n[n.length-1];Math.hypot(i[0]-r[0],i[1]-r[1])>Om||n.length<4?n.push(me(i[0],i[1])):n[n.length-1]=me(i[0],i[1])}return{polygon:t,points:n}},Hm=e=>_m(zm(e)),zm=e=>{let t=e.simulatePressure?e.points:e.points.length?e.points.map(([n,o],i)=>[n,o,e.pressures[i]]):[[0,0,.5]];return tl(t,{simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:n=>Math.sin(n*Math.PI/2),last:!0})},nc=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Wm=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,_m=e=>{if(!e.length)return"";let t=e.length-1;return e.reduce((n,o,i,r)=>(i===t?n.push(o,nc(o,r[0]),"L",r[0],"Z"):n.push(o,nc(o,r[i+1])),n),["M",e[0],"Q"]).join(" ").replace(Wm,"$1")};var ja=class e{static boundsCache=new WeakMap;static nonRotatedBoundsCache=new WeakMap;static getBounds(t,n,o=!1){let i=o&&t.angle!==0?e.nonRotatedBoundsCache.get(t):e.boundsCache.get(t);if(i?.version&&i.version===t.version&&!xe(t))return i.bounds;if(o&&t.angle!==0){let a=e.calculateBounds({...t,angle:0},n);return e.nonRotatedBoundsCache.set(t,{version:t.version,bounds:a}),a}let r=e.calculateBounds(t,n);return e.boundsCache.set(t,{version:t.version,bounds:r}),r}static calculateBounds(t,n){let o,[i,r,a,s,l,d]=K(t,n);if(Se(t)){let[c,u,h,m]=Ya(t.points.map(([g,f])=>ie(B(g,f),B(l-t.x,d-t.y),t.angle)));return[c+t.x,u+t.y,h+t.x,m+t.y]}else if(ne(t))o=Jm(t,l,d,n);else if(t.type==="diamond"){let[c,u]=ie(B(l,r),B(l,d),t.angle),[h,m]=ie(B(l,s),B(l,d),t.angle),[g,f]=ie(B(i,d),B(l,d),t.angle),[E,x]=ie(B(a,d),B(l,d),t.angle),y=Math.min(c,h,g,E),w=Math.min(u,m,f,x),M=Math.max(c,h,g,E),b=Math.max(u,m,f,x);o=[y,w,M,b]}else if(t.type==="ellipse"){let c=(a-i)/2,u=(s-r)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),g=Math.hypot(c*h,u*m),f=Math.hypot(u*h,c*m);o=[l-g,d-f,l+g,d+f]}else{let[c,u]=ie(B(i,r),B(l,d),t.angle),[h,m]=ie(B(i,s),B(l,d),t.angle),[g,f]=ie(B(a,s),B(l,d),t.angle),[E,x]=ie(B(a,r),B(l,d),t.angle),y=Math.min(c,h,g,E),w=Math.min(u,m,f,x),M=Math.max(c,h,g,E),b=Math.max(u,m,f,x);o=[y,w,M,b]}return o}},K=(e,t,n=!1)=>{if(Se(e))return Xm(e);if(ne(e))return D.getElementAbsoluteCoords(e,t,n);if(te(e)){let o=t?De(e,t):null;if(j(o)){let{x:i,y:r}=D.getBoundTextElementPosition(o,e,t);return[i,r,i+e.width,r+e.height,i+e.width/2,r+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]},ka=(e,t)=>{let n=Qo(e,t),[o,i,r,a,s,l]=K(e,t),d=B(s,l);if(n.type==="polycurve"){let x=n.data.map(w=>zt(w,10)),y=[];if(jt(e)&&!e.polygon||j(e))for(let w of x){let M=0;for(;M<w.length-1;)y.push(fe(B(w[M][0],w[M][1]),B(w[M+1][0],w[M+1][1]))),M++}else{let w=x.flat(),M=0;for(;M<w.length-1;)y.push(fe(B(w[M][0],w[M][1]),B(w[M+1][0],w[M+1][1]))),M++}return y}else{if(n.type==="polyline")return n.data;if(Ym(e)){let[E,x]=pn(e),y=x.map(M=>sc(M,d,e.angle)).flat();return[...ac(E,d,e.angle),...y]}else if(e.type==="diamond"){let[E,x]=hn(e),y=x.map(M=>sc(M,d,e.angle)).flat();return[...ac(E,d,e.angle),...y]}else if(n.type==="polygon"){if(te(e)){let y=De(e,t);if(y&&ne(y))return[fe(B(o,i),B(r,i)),fe(B(r,i),B(r,a)),fe(B(r,a),B(o,a)),fe(B(o,a),B(o,i))]}let E=n.data,x=[];for(let y=0;y<E.length-1;y++)x.push(fe(E[y],E[y+1]));return x}else if(n.type==="ellipse")return Um(e)}let[c,u,h,m,,,g,f]=[[o,i],[r,i],[o,a],[r,a],[s,i],[s,a],[o,l],[r,l]].map(E=>ie(E,d,e.angle));return[fe(c,u),fe(h,m),fe(c,h),fe(u,m),fe(c,f),fe(h,f),fe(u,g),fe(m,g)]},Ym=e=>e!=null&&(e.type==="rectangle"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),ac=(e,t,n)=>e.map(o=>fe(ie(o[0],t,n),ie(o[1],t,n))),sc=(e,t,n)=>{let o=zt(e,10),i=0,r=[];for(;i<o.length-1;)r.push(fe(ie(B(o[i][0],o[i][1]),t,n),ie(B(o[i+1][0],o[i+1][1]),t,n))),i++;return r},Um=e=>{let t=B(e.x+e.width/2,e.y+e.height/2),n=e.width/2,o=e.height/2,i=[],r=[],a=90,s=Math.PI*2/a;for(let l=0;l<a;l++){let d=l*s,c=t[0]+n*Math.cos(d),u=t[1]+o*Math.sin(d);r.push(ie(B(c,u),t,e.angle))}for(let l=0;l<r.length-1;l++)i.push(fe(r[l],r[l+1]));return i.push(fe(r[r.length-1],r[0])),i},kb=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],to=e=>{let t=Math.floor(e.width/2)+1,n=0,o=e.width,i=Math.floor(e.height/2)+1,r=t,a=e.height;return[t,n,o,i,r,a,0,i]},lc=(e,t,n,o,i)=>{let r=1-e;return Math.pow(r,3)*t+3*Math.pow(r,2)*e*n+3*r*Math.pow(e,2)*o+Math.pow(e,3)*i},dc=(e,t,n,o)=>{let i=t-e,r=n-t,a=o-n,s=3*i-6*r+3*a,l=6*r-6*i,d=3*i,c=l*l-4*s*d;if(!(c>=0))return!1;let h=null,m=null,g=1/0,f=1/0;return s===0?g=f=-d/l:(g=(-l+Math.sqrt(c))/(2*s),f=(-l-Math.sqrt(c))/(2*s)),g>=0&&g<=1&&(h=lc(g,e,t,n,o)),f>=0&&f<=1&&(m=lc(f,e,t,n,o)),[h,m]},Oi=(e,t,n,o)=>{let i=dc(e[0],t[0],n[0],o[0]),r=dc(e[1],t[1],n[1],o[1]),a=Math.min(e[0],o[0]),s=Math.max(e[0],o[0]);if(i){let c=i.filter(u=>u!==null);a=Math.min(a,...c),s=Math.max(s,...c)}let l=Math.min(e[1],o[1]),d=Math.max(e[1],o[1]);if(r){let c=r.filter(u=>u!==null);l=Math.min(l,...c),d=Math.max(d,...c)}return[a,l,s,d]},Xo=(e,t)=>{let n=B(0,0),{minX:o,minY:i,maxX:r,maxY:a}=e.reduce((s,{op:l,data:d})=>{if(l==="move"){let c=cc(d);_a(c!=null,"Op data is not a point"),n=c}else if(l==="bcurveTo"){let c=B(d[0],d[1]),u=B(d[2],d[3]),h=B(d[4],d[5]),m=t?t(c):c,g=t?t(u):u,f=t?t(h):h,E=t?t(n):n;n=h;let[x,y,w,M]=Oi(E,m,g,f);s.minX=Math.min(s.minX,x),s.minY=Math.min(s.minY,y),s.maxX=Math.max(s.maxX,w),s.maxY=Math.max(s.maxY,M)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[o,i,r,a]},Ya=(e,t=0)=>{let n=1/0,o=1/0,i=-1/0,r=-1/0;for(let[a,s]of e)n=Math.min(n,a),o=Math.min(o,s),i=Math.max(i,a),r=Math.max(r,s);return[n-t,o-t,i+t,r+t]},Xm=e=>{let[t,n,o,i]=Ya(e.points),r=t+e.x,a=n+e.y,s=o+e.x,l=i+e.y;return[r,a,s,l,(r+s)/2,(a+l)/2]},$m=20,Zm=15,qm=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;case"cardinality_many":case"cardinality_one_or_many":case"cardinality_zero_or_many":return Zm;case"cardinality_one":case"cardinality_exactly_one":case"cardinality_zero_or_one":return $m;default:return 15}},Km=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},je=(e,t,n,o,i=0)=>{if(o===null||t.length<1)return null;let r=Wt(t[0]);if(r.length<1)return null;let a=n==="start"?1:r.length-1,s=r[a].data;_a(s.length===6,"Op data length is not 6");let l=B(s[4],s[5]),d=B(s[2],s[3]),c=B(s[0],s[1]),u=r[a-1],h=B(0,0);if(u.op==="move"){let A=cc(u.data);_a(A!=null,"Op data is not a point"),h=A}else u.op==="bcurveTo"&&(h=B(u.data[4],u.data[5]));let m=(A,_)=>Math.pow(1-A,3)*l[_]+3*A*Math.pow(1-A,2)*d[_]+3*Math.pow(A,2)*(1-A)*c[_]+h[_]*Math.pow(A,3),[g,f]=n==="start"?h:l,[E,x]=[m(.3,0),m(.3,1)],y=Math.hypot(g-E,f-x),w=(g-E)/y,M=(f-x)/y,b=qm(o),S=0;{let[A,_]=n==="end"?e.points[e.points.length-1]:e.points[0],[X,ve]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];S=Math.hypot(A-X,_-ve)}let k=Math.min(b,S*(o==="diamond"||o==="diamond_outline"?.25:.5)),T=g-w*k*i,R=f-M*k*i,O=T-w*k,N=R-M*k;if(o==="circle"||o==="circle_outline"){let A=Math.hypot(N-R,O-T)+e.strokeWidth-2;return[T,R,A]}let G=Km(o);if(o==="cardinality_many"||o==="cardinality_one_or_many"){let[A,_]=ie(B(T,R),B(O,N),Wa(-G)),[X,ve]=ie(B(T,R),B(O,N),Wa(G));return[O,N,A,_,X,ve]}let[q,U]=ie(B(O,N),B(T,R),-G*Math.PI/180),[le,H]=ie(B(O,N),B(T,R),Wa(G));if(o==="diamond"||o==="diamond_outline"){let A,_;if(n==="start"){let[X,ve]=e.points.length>1?e.points[1]:[0,0];[A,_]=ie(B(T+k*2,R),B(T,R),Math.atan2(ve-R,X-T))}else{let[X,ve]=e.points.length>1?e.points[e.points.length-2]:[0,0];[A,_]=ie(B(T-k*2,R),B(T,R),Math.atan2(R-ve,T-X))}return[T,R,q,U,A,_,le,H]}return[T,R,q,U,le,H]},Qm=e=>{let t=Nn.generator(),n=Qe(e),o=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[o](e.points,n)},Jm=(e,t,n,o)=>{let i=Q(e,o);if(e.points.length<2){let[u,h]=e.points[0],[m,g]=ie(B(e.x+u,e.y+h),B(t,n),e.angle),f=[m,g,m,g];if(i){let E=D.getMinMaxXYWithBoundText(e,o,[m,g,m,g],i);f=[E[0],E[1],E[2],E[3]]}return f}let a=at.get(e,null)?.[0]??Qm(e),s=Wt(a),d=Xo(s,([u,h])=>ie(B(e.x+u,e.y+h),B(t,n),e.angle)),c=[d[0],d[1],d[2],d[3]];if(i){let u=D.getMinMaxXYWithBoundText(e,o,c,i);c=[u[0],u[1],u[2],u[3]]}return c},ue=(e,t,n=!1)=>ja.getBounds(e,t,n),We=(e,t)=>{if(!jm(e))return[0,0,0,0];let n=1/0,o=-1/0,i=1/0,r=-1/0,a=t||Va(e);return e.forEach(s=>{let[l,d,c,u]=ue(s,a);n=Math.min(n,l),i=Math.min(i,d),o=Math.max(o,c),r=Math.max(r,u)}),[n,i,o,r]},Tb=(e,t)=>{let[n,o,i,r]=We(e);return[n+t.x,o+t.y,i+t.x,r+t.y]},un=(e,t,n,o)=>{if(!(ne(e)||Se(e)))return[e.x,e.y,e.x+t,e.y+n];let i=rc(0,t,rc(1,n,e.points,o),o),r;if(Se(e))r=Ya(i);else{let c=Nn.generator(),u=e.roundness?c.curve(i,Qe(e)):c.linearPath(i,Qe(e)),h=Wt(u);r=Xo(h)}let[a,s,l,d]=r;return[a+e.x,s+e.y,l+e.x,d+e.y]},Oa=(e,t)=>{let n=Nn.generator(),o=e.roundness==null?n.linearPath(t,Qe(e)):n.curve(t,Qe(e)),i=Wt(o),[r,a,s,l]=Xo(i);return[r+e.x,a+e.y,s+e.x,l+e.y]},Lb=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,o=e[0],i=Va(e);return e.forEach(r=>{let[a,s,l,d]=ue(r,i),c=Vm(B((a+l)/2,(s+d)/2),B(t.x,t.y));c<n&&(n=c,o=r)}),ue(o,i)},Fe=e=>{let[t,n,o,i]=We(e);return{minX:t,minY:n,maxX:o,maxY:i,width:o-t,height:i-n,midX:(t+o)/2,midY:(n+i)/2}},Cb=({scrollX:e,scrollY:t,width:n,height:o,zoom:i})=>[-e,-t,-e+n/i.value,-t+o/i.value],En=e=>B(e[0]+(e[2]-e[0])/2,e[1]+(e[3]-e[1])/2),ut=(e,t,n)=>{let o={minX:e.x,minY:e.y,maxX:e.x+e.width,maxY:e.y+e.height,midX:e.x+e.width/2,midY:e.y+e.height/2},i=de(e,t),[r,a]=ie(B(o.minX,o.minY),i,e.angle),[s,l]=ie(B(o.maxX,o.minY),i,e.angle),[d,c]=ie(B(o.maxX,o.maxY),i,e.angle),[u,h]=ie(B(o.minX,o.maxY),i,e.angle),m=[Math.min(r,s,d,u),Math.min(a,l,c,h),Math.max(r,s,d,u),Math.max(a,l,c,h)];if(n){let[g,f,E,x]=n;return[m[0]-x,m[1]-g,m[2]+f,m[3]+E]}return m},Dt=(e,t)=>e[0]>t[0]&&e[0]<t[2]&&e[1]>t[1]&&e[1]<t[3],e0=(e,t)=>e[0]>=t[0]&&e[0]<=t[2]&&e[1]>=t[1]&&e[1]<=t[3],Qt=(e,t)=>{if(e==null||t==null)return!1;let[n,o,i,r]=e,[a,s,l,d]=t;return n<l&&i>a&&o<d&&r>s},La=(e,t)=>[B(t[0],t[1]),B(t[0],t[3]),B(t[2],t[1]),B(t[2],t[3])].every(n=>e0(n,e)),vd=({elements:e,elementsMap:t,bounds:n,type:o,excludeElementsInFrames:i,shouldIgnoreElementFromSelection:r})=>{t||(t=Va(e));let a=ul(n)?ue(n,t):n,[s,l,d,c]=a,u=[fe(B(s,l),B(d,l)),fe(B(d,l),B(d,c)),fe(B(d,c),B(s,c)),fe(B(s,c),B(s,l))],h=i?new Set:null,m={},g=new Set;for(let f of e){if(r?.(f))continue;let E=f.groupIds.at(-1);E&&(m[E]||(m[E]=[]),m[E].push(f));let x=f.strokeWidth,y=null,w=ue(f,t);w=[w[0]-x/2,w[1]-x/2,w[2]+x/2,w[3]+x/2];let M=j(f)&&Q(f,t);if(M){let{x:v,y:k}=D.getBoundTextElementPosition(f,M,t);y=[v,k,v+M.width,k+M.height]}let b=Sn(f,t);if(b&&In(f,b,t)){let v=ue(b,t);w=[Math.max(w[0],v[0]),Math.max(w[1],v[1]),Math.min(w[2],v[2]),Math.min(w[3],v[3])],y=y?[Math.max(y[0],v[0]),Math.max(y[1],v[1]),Math.min(y[2],v[2]),Math.min(y[3],v[3])]:null}let S=y?[Math.min(y[0],w[0]),Math.min(y[1],w[1]),Math.max(y[2],w[2]),Math.max(y[3],w[3])]:w;if(La(a,S)){h&&ee(f)&&h.add(f.id),g.add(f);continue}if(o==="overlap"&&y&&Qt(a,y)){g.add(f);continue}if(o==="overlap"&&Qt(a,w)){let v=!1;if(ne(f)||Se(f)){let k=de(f,t);v=f.points.some(T=>{let R=ie(B(f.x+T[0],f.y+T[1]),k,f.angle);return Dt(R,a)})}else{let k=ue(f,t,!0),T=de(f,t);v=[ie(B((k[0]+k[2])/2,k[1]),T,f.angle),ie(B(k[2],(k[1]+k[3])/2),T,f.angle),ie(B((k[0]+k[2])/2,k[3]),T,f.angle),ie(B(k[0],(k[1]+k[3])/2),T,f.angle)].some(R=>Dt(ie(R,T,f.angle),a))}if(v||(v=u.some(k=>Bt(f,t,k,x/2,!0).length>0)),v){h&&ee(f)&&h.add(f.id),g.add(f);continue}}}return h&&g.forEach(f=>{f.frameId&&h.has(f.frameId)&&g.delete(f)}),o==="overlap"?Array.from(g).forEach(f=>{let E=f.groupIds.at(-1);(E?m[E]:null)?.forEach(y=>g.add(y))}):o==="contain"&&g.forEach(f=>{let E=f.groupIds.at(-1),x=E?m[E]:null;x&&!x.every(y=>g.has(y))&&g.delete(f)}),e.filter(f=>g.has(f))},de=(e,t,n=0,o=0)=>{if(ne(e)||Se(e)){let[a,s,l,d]=K(e,t),[c,u]=B((a+l)/2,(s+d)/2);return B(c+n,u+o)}let[i,r]=En(ue(e,t));return B(i+n,r+o)};var i0=.1,pc=e=>ne(e)||Se(e)?e.points.length<2||e.points.length===2&&j(e)&&o0(e.points[0],e.points[e.points.length-1],i0):e.width===0&&e.height===0,Ad=(e,t,n,o,i)=>{let[r,a,s,l]=ue(e,i),d=ar({clientX:o.offsetLeft,clientY:o.offsetTop},o),c=ar({clientX:o.offsetLeft+t,clientY:o.offsetTop+n},o);return d.x<=s&&d.y<=l&&c.x>=r&&c.y>=a},Hb=(e,t,n,o,i,r)=>{let[a,s,l,d]=We(e,i),c=ar({clientX:o.offsetLeft+(r?.left||0),clientY:o.offsetTop+(r?.top||0)},o),u=ar({clientX:o.offsetLeft+t-(r?.right||0),clientY:o.offsetTop+n-(r?.bottom||0)},o);return a>=c.x&&s>=c.y&&l<=u.x&&d<=u.y},Ua=(e,t,n)=>{let o=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let r=Math.round(Math.atan(i/o)/on)*on;r===0?n=0:r===Math.PI/2?t=0:n=o*Math.tan(r)*Math.sign(n)||n}else e!=="selection"&&(n=o*Math.sign(n));return{width:t,height:n}},Xd=(e,t,n,o,i)=>{let r=n-e,a=o-t,s=Math.atan2(a,r),l=Math.round(s/on)*on;if(i){let d=Math.floor(i/on)*on;t0(s,d,d+on)&&(n0(s,i)<on/6?l=i:uc(s)>uc(i)?l=d+on:l=d)}if(l===0)a=0;else if(l===Math.PI/2)r=0;else{let d=Math.tan(l),c=-1,u=t-d*e,h=-1/d,m=-1,g=o-h*n,f=(c*g-m*u)/(d*m-h*c),E=(u*h-g*d)/(d*m-h*c);r=f-e,a=E-t}return{width:r,height:a}},zb=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t};I();var Ub=(e,t,n,o)=>{let i=Qi(e,n.getNonDeletedElementsMap(),o),r=Fe(e);return i.flatMap(a=>{let s=r0(a,r,t);return a.map(l=>{let d=n.mutateElement(l,{x:l.x+s.x,y:l.y+s.y});return Re(l,n,{simultaneouslyUpdated:a}),d})})},r0=(e,t,{axis:n,position:o})=>{let i=Fe(e),[r,a]=n==="x"?["minX","maxX"]:["minY","maxY"],s={x:0,y:0};return o==="start"?{...s,[n]:t[r]-i[r]}:o==="end"?{...s,[n]:t[a]-i[a]}:{...s,[n]:(t[r]+t[a])/2-(i[r]+i[a])/2}};I();I();var sr=class{root;gap;constructor(t=0){this.root=null,this.gap=t}fit(t){let n=t.length,o=n>0?t[0].w:0,i=n>0?t[0].h:0;this.root={x:0,y:0,w:o,h:i};for(let r=0;r<n;r++){let a=t[r],s=this.findNode(this.root,a.w,a.h);s?a.fit=this.splitNode(s,a.w,a.h):a.fit=this.growNode(a.w,a.h)}}findNode(t,n,o){return t?t.used?this.findNode(t.right||null,n,o)||this.findNode(t.down||null,n,o):n<=t.w&&o<=t.h?t:null:null}splitNode(t,n,o){return t.used=!0,t.down={x:t.x,y:t.y+o+this.gap,w:t.w,h:t.h-o-this.gap},t.right={x:t.x+n+this.gap,y:t.y,w:t.w-n-this.gap,h:o},t}growNode(t,n){if(!this.root)return null;let o=t<=this.root.w,i=n<=this.root.h,r=i&&this.root.h>=this.root.w+t+this.gap,a=o&&this.root.w>=this.root.h+n+this.gap;return r?this.growRight(t,n):a?this.growDown(t,n):i?this.growRight(t,n):o?this.growDown(t,n):null}growRight(t,n){if(!this.root)return null;this.root={used:!0,x:0,y:0,w:this.root.w+t+this.gap,h:this.root.h,down:this.root,right:{x:this.root.w+this.gap,y:0,w:t,h:this.root.h}};let o=this.findNode(this.root,t,n);return o?this.splitNode(o,t,n):null}growDown(t,n){if(!this.root)return null;this.root={used:!0,x:0,y:0,w:this.root.w,h:this.root.h+n+this.gap,down:{x:0,y:this.root.h+this.gap,w:this.root.w,h:n},right:this.root};let o=this.findNode(this.root,t,n);return o?this.splitNode(o,t,n):null}};I();var a0=[1,1.08,1.18,1.32,1.5,1.75,2.1,2.6,3.25],s0=[1,4/3,3/4,3/2,2/3,2,1/2],l0=(e,t)=>{let n=Math.max(e.length,t.length);for(let o=0;o<n;o++){let i=(e[o]??0)-(t[o]??0);if(i!==0)return i}return 0},d0=(e,t)=>t.packedW*t.packedH-e.packedW*e.packedH||Math.max(t.packedW,t.packedH)-Math.max(e.packedW,e.packedH)||t.packedH-e.packedH||t.packedW-e.packedW,hc=(e,t,n)=>Math.min(Math.max(e,t),n),c0=(e,t)=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y,u0=(e,t)=>t.x>=e.x&&t.y>=e.y&&t.x+t.w<=e.x+e.w&&t.y+t.h<=e.y+e.h,mc=e=>{let t=e.filter(n=>n.fit);return t.length===0?null:t.reduce((n,o)=>({minX:Math.min(n.minX,o.fit.x),minY:Math.min(n.minY,o.fit.y),maxX:Math.max(n.maxX,o.fit.x+o.actualW),maxY:Math.max(n.maxY,o.fit.y+o.actualH)}),{minX:t[0].fit.x,minY:t[0].fit.y,maxX:t[0].fit.x+t[0].actualW,maxY:t[0].fit.y+t[0].actualH})},p0=(e,t)=>{let n=(t.minX+t.maxX)/2,o=(t.minY+t.maxY)/2;return e.reduce((i,r)=>{if(!r.fit)return i;let a=r.fit.x+r.actualW/2,s=r.fit.y+r.actualH/2;return i+Math.abs(a-n)+Math.abs(s-o)},0)},h0=e=>{let t=[];e:for(let n=0;n<e.length;n++){let o=e[n];if(!(o.w<=0||o.h<=0)){for(let i=0;i<e.length;i++)if(n!==i&&u0(e[i],o))continue e;t.some(i=>i.x===o.x&&i.y===o.y&&i.w===o.w&&i.h===o.h)||t.push(o)}}return t},m0=(e,t)=>{let n=[];for(let o of e){if(!c0(o,t)){n.push(o);continue}t.x>o.x&&n.push({x:o.x,y:o.y,w:t.x-o.x,h:o.h}),t.x+t.w<o.x+o.w&&n.push({x:t.x+t.w,y:o.y,w:o.x+o.w-(t.x+t.w),h:o.h}),t.y>o.y&&n.push({x:o.x,y:o.y,w:o.w,h:t.y-o.y}),t.y+t.h<o.y+o.h&&n.push({x:o.x,y:t.y+t.h,w:o.w,h:o.y+o.h-(t.y+t.h)})}return h0(n)},f0=(e,t,n,o)=>{let i=e.x+e.w-t.packedW,r=e.y+e.h-t.packedH,a=[{x:e.x,y:e.y},{x:i,y:e.y},{x:e.x,y:r},{x:i,y:r}];return n==="center-distance"&&a.push({x:hc(o.x-t.actualW/2,e.x,i),y:hc(o.y-t.actualH/2,e.y,r)}),a.filter((s,l,d)=>d.findIndex(c=>c.x===s.x&&c.y===s.y)===l)},g0=(e,t,n,o,i,r,a)=>{let s=e.w*e.h-t.packedW*t.packedH,l=e.w-t.packedW,d=e.h-t.packedH,c=Math.min(l,d),u=Math.max(l,d);if(o==="best-area-fit")return[s,c,u,n.y,n.x];let h=i?{x:(i.minX+i.maxX)/2,y:(i.minY+i.maxY)/2}:{x:r/2,y:a/2},m=n.x+t.actualW/2,g=n.y+t.actualH/2,f=Math.abs(m-h.x)+Math.abs(g-h.y),E=i?{minX:Math.min(i.minX,n.x),minY:Math.min(i.minY,n.y),maxX:Math.max(i.maxX,n.x+t.actualW),maxY:Math.max(i.maxY,n.y+t.actualH)}:{minX:n.x,minY:n.y,maxX:n.x+t.actualW,maxY:n.y+t.actualH},x=E.maxX-E.minX,y=E.maxY-E.minY,w=x*y;return[f,w,s,c,u]},E0=(e,t,n,o)=>{let i=[{x:0,y:0,w:t,h:n}];for(let l of e){let d=mc(e),c=null;for(let u of i){if(l.packedW>u.w||l.packedH>u.h)continue;let h=d?{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2}:{x:t/2,y:n/2},m=f0(u,l,o,h);for(let g of m){let f=g0(u,l,g,o,d,t,n);(!c||l0(f,c.score)<0)&&(c={x:g.x,y:g.y,score:f})}}if(!c)return null;l.fit={x:c.x,y:c.y},i=m0(i,{x:c.x,y:c.y,w:l.packedW,h:l.packedH})}let r=mc(e);if(!r)return{width:0,height:0,spread:0};let a=r.minX,s=r.minY;return e.forEach(l=>{l.fit&&(l.fit={x:l.fit.x-a,y:l.fit.y-s})}),{width:r.maxX-r.minX,height:r.maxY-r.minY,spread:p0(e,{minX:0,minY:0,maxX:r.maxX-r.minX,maxY:r.maxY-r.minY})}},fc=(e,t={})=>{let n=Math.max(t.gap??0,0),o=t.heuristic??"best-area-fit";if(e.forEach(d=>{d.fit=null}),e.length===0)return{width:0,height:0};let i=e.map(d=>({source:d,actualW:d.w,actualH:d.h,packedW:d.w+n,packedH:d.h+n,fit:null})).sort(d0),r=i.reduce((d,c)=>d+c.packedW*c.packedH,0),a=Math.max(...i.map(d=>d.packedW)),s=Math.max(...i.map(d=>d.packedH)),l=null;for(let d of a0){let c=r*d;for(let u of s0){let h=Math.max(a,Math.ceil(Math.sqrt(c*u))),m=Math.max(s,Math.ceil(c/h)),g=i.map(M=>({...M,fit:null})),f=E0(g,h,m,o);if(!f)continue;let E={width:f.width,height:f.height,spread:f.spread,blocks:g};if(!l){l=E;continue}let x=E.width*E.height-l.width*l.height,y=Math.abs(E.width-E.height),w=Math.abs(l.width-l.height);(x<0||x===0&&(y<w||y===w&&(E.spread<l.spread||E.spread===l.spread&&E.width+E.height<l.width+l.height)))&&(l=E)}if(l)break}return l?(l.blocks.forEach(d=>{d.source.fit=d.fit}),{width:l.width,height:l.height}):null};var x0=(e,t,n)=>{let o=Fe(t),i=n.x-o.minX,r=n.y-o.minY;t.forEach(a=>{e.mutateElement(a,{x:a.x+i,y:a.y+r})})},gc=e=>e.map(t=>({w:t.boundingBox.width,h:t.boundingBox.height,group:t.group})).sort((t,n)=>n.w*n.h-t.w*t.h||Math.max(n.w,n.h)-Math.max(t.w,t.h)||n.h-t.h||n.w-t.w),Ec=(e,t,n)=>{let o=t.filter(i=>i.fit);return o.forEach(i=>{x0(e,i.group,{x:n.x+(i.fit?.x??0),y:n.y+(i.fit?.y??0)})}),o.flatMap(i=>i.group)},xc=(e,t,n)=>{let o=t.flatMap(l=>l.group),i=Fe(o),r={x:i.minX,y:i.minY},a=gc(t);return new sr(n).fit(a),Ec(e,a,r)},Xa=(e,t,n,o)=>{let i=t.flatMap(d=>d.group),r=Fe(i),a={x:r.minX,y:r.minY},s=gc(t);return fc(s,{gap:n,heuristic:o})?Ec(e,s,a):(console.warn(`Packing heuristic [${o}] failed - using binary tree packer`),xc(e,t,n))},o6=(e,t,n,o,i)=>{let a=Ki(t,n).map(s=>({group:s,boundingBox:Fe(s)}));switch(o){case"bin-packing":case"bin-packing-center":return Xa(e,a,i,"center-distance");case"bin-packing-max-rects":return Xa(e,a,i,"best-area-fit");case"bin-packing-binary-tree":return xc(e,a,i);default:return console.warn(`Unimplemented algorithm [${o}] - using bin-packing`),Xa(e,a,i,"center-distance")}};I();import{arrayToMap as pf,arrayToObject as rn,assertNever as Nc,isDevEnv as Bn,isShallowEqual as Hc,isTestEnv as Dn,randomInteger as Fc}from"@excalidraw/common";I();import{assertNever as T0,COLOR_PALETTE as L0,isDevEnv as C0,isTestEnv as B0,randomId as D0,Emitter as bc,toIterable as uo}from"@excalidraw/common";I();import{ORIG_ID as M0,randomId as wc,randomInteger as P0,arrayToMap as I0,castArray as $a,findLastIndex as co,getUpdatedTimestamp as S0,isTestEnv as v0}from"@excalidraw/common";I();import{arrayToMap as y0}from"@excalidraw/common";var w0=e=>{let t=(i,r)=>i.groupIds[i.groupIds.length-r-1],n=(i,r)=>{let a=new Map,s=[];for(let l of i){let d=t(l,r);if(d===void 0){s.push(l);continue}let c=a.get(d);c||(c=[],a.set(d,c),s.push(d)),c.push(l)}return s.flatMap(l=>typeof l=="string"?n(a.get(l),r+1):[l])},o=n(e,0);return o.length!==e.length?(console.error("defragmentGroups: lost some elements... bailing!"),e):o},b0=e=>{let t=y0(e),n=new Set;for(let o of e)if(!n.has(o)){if(o.boundElements?.length){n.add(o);for(let i of o.boundElements){let r=t.get(i.id);r&&i.type==="text"&&n.add(r)}continue}o.type==="text"&&o.containerId&&t.get(o.containerId)?.boundElements?.some(i=>i.id===o.id)||n.add(o)}return n.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...n]},yc=e=>b0(w0(e));var A0=(e,t,n,o)=>{let i=qa(n);return v0()&&k0(i,n.id),i.id=wc(),i.updated=S0(),o&&(i.seed=P0(),od(i)),i.groupIds=Cd(i.groupIds,e,r=>(t.has(r)||t.set(r,wc()),t.get(r))),i},E6=e=>{let{elements:t}=e,n="appState"in e?e.appState:{editingGroupId:null,selectedGroupIds:{}},o=new Map,i=new Map,r=[],a=[],s=new Map,l=new Map,d=new Map,c=I0(t),u=e.type==="in-place"?e.idsOfElementsToDuplicate:new Map(t.map(x=>[x.id,x])),h=e.type==="everything"&&e.preserveFrameChildrenOrder;if(e.type==="in-place")for(let x of Object.keys(e.appState.selectedGroupIds))t.filter(y=>y.groupIds?.includes(x)).forEach(y=>u.set(y.id,y));t=yc(t);let m=t.slice(),g=x=>{let w=$a(x).reduce((M,b)=>{if(o.has(b.id))return M;o.set(b.id,!0);let S=A0(n.editingGroupId,i,b,e.randomizeSeed);return o.set(S.id,!0),d.set(S.id,S),s.set(b.id,S.id),l.set(S.id,b),a.push(b),r.push(S),M.push(S),M},[]);return Array.isArray(x)?w:w[0]||null},f=(x,y)=>{if(y){if(x>m.length-1){m.push(...$a(y));return}m.splice(x+1,0,...$a(y))}},E=new Set(t.filter(x=>u.has(x.id)&&ee(x)).map(x=>x.id));for(let x of t){if(o.has(x.id)||!u.has(x.id))continue;let y=Ba(n,x);if(y){let w=ze(t,y).flatMap(b=>ee(b)&&!h?[...An(t,b.id),b]:[b]),M=co(m,b=>b.groupIds?.includes(y));f(M,g(w));continue}if(!(!h&&x.frameId&&E.has(x.frameId))){if(ee(x)){let w=x.id;if(h){f(co(m,S=>S.id===w),g(x));continue}let M=An(t,w),b=co(m,S=>S.frameId===w||S.id===w);f(b,g([...M,x]));continue}if(Tt(x)){let w=Q(x,c),M=co(m,b=>b.id===x.id||"containerId"in b&&b.containerId===x.id);w?f(M,g([x,w])):f(M,g(x));continue}if(xe(x)){let w=De(x,c),M=co(m,b=>b.id===x.id||b.id===w?.id);w?f(M,g([w,x])):f(M,g(x));continue}f(co(m,w=>w.id===x.id),g(x))}}if(pd(r,s,d),yd(m,a,s),e.overrides)for(let x of r){let y=l.get(x.id);y&&Object.assign(x,e.overrides({duplicateElement:x,origElement:y,origIdToDuplicateId:s}))}return{duplicatedElements:r,duplicateElementsMap:d,elementsWithDuplicates:m,origIdToDuplicateId:s}},Za=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let o=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;o[i]=Za(e[i],t+1)}return o}if(Array.isArray(e)){let o=e.length,i=new Array(o);for(;o--;)i[o]=Za(e[o],t+1);return i}return C.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},qa=e=>Za(e),k0=(e,t)=>{Object.defineProperty(e,M0,{value:t,writable:!1,enumerable:!1})};var Je={IMMEDIATELY:"IMMEDIATELY",NEVER:"NEVER",EVENTUALLY:"EVENTUALLY"},Mc=class{constructor(t){this.app=t}onDurableIncrementEmitter=new bc;onStoreIncrementEmitter=new bc;scheduledMacroActions=new Set;scheduledMicroActions=[];_snapshot=Cn.empty();get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}scheduleAction(t){this.scheduledMacroActions.add(t),this.satisfiesScheduledActionsInvariant()}scheduleCapture(){this.scheduleAction(Je.IMMEDIATELY)}scheduleMicroAction(t){let{action:n}=t,o;if("change"in t)o=t.change;else{let r=Cn.create(this.app.scene.getElementsMapIncludingDeleted(),this.app.state),a=r.maybeClone(n,t.elements?Ed(t.elements):void 0,t.appState);o=Jo.create(r,a)}let i="delta"in t?t.delta:void 0;this.scheduledMicroActions.push(()=>this.processAction({action:n,change:o,delta:i}))}commit(t,n){this.flushMicroActions();try{let o=this.getScheduledMacroAction();this.processAction({action:o,elements:t,appState:n})}finally{this.satisfiesScheduledActionsInvariant(),this.scheduledMacroActions=new Set}}clear(){this.snapshot=Cn.empty(),this.scheduledMacroActions=new Set}emitDurableIncrement(t,n=void 0,o=void 0){let i=this.snapshot,r,a;if(n?r=n:r=Jo.create(i,t),o?a=o:a=Ja.calculate(i,t),!a.isEmpty()){let s=new Ka(r,a);this.onDurableIncrementEmitter.trigger(s),this.onStoreIncrementEmitter.trigger(s)}}emitEphemeralIncrement(t,n=void 0){let o;if(n)o=n;else{let r=this.snapshot;o=Jo.create(r,t)}let i=new Qa(o);this.onStoreIncrementEmitter.trigger(i)}applyChangeToSnapshot(t){let n=this.snapshot,o=this.snapshot.applyChange(t);return n===o?null:o}maybeCloneSnapshot(t,n,o){if(!n&&!o)return null;let i=this.snapshot,r=this.snapshot.maybeClone(t,n,o);return i===r?null:r}flushMicroActions(){for(let t of this.scheduledMicroActions)try{t()}catch(n){console.error("Failed to execute scheduled micro action",n)}this.scheduledMicroActions=[]}processAction(t){let{action:n}=t;if(n===Je.EVENTUALLY&&!this.onStoreIncrementEmitter.subscribers.length)return;let o;if("change"in t?o=this.applyChangeToSnapshot(t.change):o=this.maybeCloneSnapshot(n,t.elements,t.appState),!o)return;let i="change"in t?t.change:void 0,r="delta"in t?t.delta:void 0;try{switch(n){case Je.IMMEDIATELY:this.emitDurableIncrement(o,i,r);break;case Je.NEVER:case Je.EVENTUALLY:this.emitEphemeralIncrement(o,i);break;default:T0(n,"Unknown store action")}}finally{switch(n){case Je.IMMEDIATELY:case Je.NEVER:this.snapshot=o;break}}}getScheduledMacroAction(){let t;return this.scheduledMacroActions.has(Je.IMMEDIATELY)?t=Je.IMMEDIATELY:this.scheduledMacroActions.has(Je.NEVER)?t=Je.NEVER:t=Je.EVENTUALLY,t}satisfiesScheduledActionsInvariant(){if(!(this.scheduledMacroActions.size>=0&&this.scheduledMacroActions.size<=Object.keys(Je).length)){let t=`There can be at most three store actions scheduled at the same time, but there are "${this.scheduledMacroActions.size}".`;if(console.error(t,this.scheduledMacroActions.values()),B0()||C0())throw new Error(t)}}},Jo=class e{constructor(t,n){this.elements=t;this.appState=n}static create(t,n){let o=n.getChangedElements(t),i=n.getChangedAppState(t);return new e(o,i)}},lr=class{constructor(t,n){this.type=t;this.change=n}static isDurable(t){return t.type==="durable"}static isEphemeral(t){return t.type==="ephemeral"}},Ka=class extends lr{constructor(n,o){super("durable",n);this.change=n;this.delta=o}},Qa=class extends lr{constructor(n){super("ephemeral",n);this.change=n}},Ja=class e{constructor(t,n,o){this.id=t;this.elements=n;this.appState=o}static create(t,n,o={id:D0()}){return new this(o.id,t,n)}static calculate(t,n){let o=n.metadata.didElementsChange?Ln.calculate(t.elements,n.elements):Ln.empty(),i=n.metadata.didAppStateChange?Tn.calculate(t.appState,n.appState):Tn.empty();return this.create(o,i)}static restore(t){let{id:n,elements:o,appState:i}=t;return new this(n,Ln.restore(o),Tn.restore(i))}static load({id:t,elements:{added:n,removed:o,updated:i},appState:{delta:r}}){let a=Ln.create(n,o,i),s=Tn.create(r);return new this(t,a,s)}static squash(...t){let n=e.empty();for(let o of t)n.elements.squash(o.elements),n.appState.squash(o.appState);return n}static inverse(t){return this.create(t.elements.inverse(),t.appState.inverse())}static applyTo(t,n,o,i){let[r,a]=t.elements.applyTo(n,Cn.empty().elements,i),[s,l]=t.appState.applyTo(o,r);return[r,s,a||l]}static applyLatestChanges(t,n,o,i){return this.create(t.elements.applyLatestChanges(n,o,i),t.appState,{id:t.id})}static empty(){return e.create(Ln.empty(),Tn.empty())}isEmpty(){return this.elements.isEmpty()&&this.appState.isEmpty()}},Cn=class e{constructor(t,n,o={didElementsChange:!1,didAppStateChange:!1,isEmpty:!1}){this.elements=t;this.appState=n;this.metadata=o}_lastChangedElementsHash=0;_lastChangedAppStateHash=0;static create(t,n,o={didElementsChange:!1,didAppStateChange:!1}){return new e(t,Pc(n)?n:po(n),o)}static empty(){return new e(new Map,G0(),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}getChangedElements(t){let n={};for(let o of uo(t.elements))this.elements.get(o.id)||(n[o.id]=He(o,{isDeleted:!0}));for(let o of uo(this.elements))t.elements.get(o.id)!==o&&(n[o.id]=o);return n}getChangedAppState(t){return $.getRightDifferences(t.appState,this.appState).reduce((n,o)=>Object.assign(n,{[o]:this.appState[o]}),{})}isEmpty(){return this.metadata.isEmpty}applyChange(t){let n=new Map(this.elements);for(let[i,r]of Object.entries(t.elements))n.set(i,r);let o=po({...this.appState,...t.appState});return e.create(n,o,{didElementsChange:Object.keys(t.elements).length>0,didAppStateChange:Object.keys(t.appState).length>0})}maybeClone(t,n,o){let i={shouldCompareHashes:!1};t===Je.EVENTUALLY&&(i.shouldCompareHashes=!0);let r=this.maybeCreateElementsSnapshot(n,i),a=this.maybeCreateAppStateSnapshot(o,i),s=!1,l=!1;return this.elements!==r&&(s=!0),this.appState!==a&&(l=!0),!s&&!l?this:new e(r,a,{didElementsChange:s,didAppStateChange:l})}maybeCreateAppStateSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.appState;let o=Pc(t)?t:po(t);return this.detectChangedAppState(o,n)?o:this.appState}maybeCreateElementsSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.elements;let o=this.detectChangedElements(t,n);return o?.size?this.createElementsSnapshot(o):this.elements}detectChangedAppState(t,n={shouldCompareHashes:!1}){if(this.appState===t)return;let o=$.isRightDifferent(this.appState,t);if(!o)return;let i=vc(JSON.stringify(t));if(!(n.shouldCompareHashes&&this._lastChangedAppStateHash===i))return this._lastChangedAppStateHash=i,o}detectChangedElements(t,n={shouldCompareHashes:!1}){if(this.elements===t)return;let o=new Map;for(let r of uo(this.elements))t.get(r.id)||o.set(r.id,He(r,{isDeleted:!0}));for(let r of uo(t)){let a=this.elements.get(r.id);if(!a||a.version<r.version){if(Ae(r)&&!Hn(r))continue;o.set(r.id,r)}}if(!o.size)return;let i=Sc(o);if(!(n.shouldCompareHashes&&this._lastChangedElementsHash===i))return this._lastChangedElementsHash=i,o}createElementsSnapshot(t){let n=new Map;for(let o of uo(this.elements))n.set(o.id,o);for(let o of uo(t))n.set(o.id,qa(o));return n}},Ic="__observedAppState",G0=()=>({name:null,editingGroupId:null,viewBackgroundColor:L0.white,selectedElementIds:{},selectedGroupIds:{},selectedLinearElement:null,croppingElementId:null,activeLockedId:null,lockedMultiSelections:{}}),po=e=>{let t={name:e.name,editingGroupId:e.editingGroupId,viewBackgroundColor:e.viewBackgroundColor,selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,croppingElementId:e.croppingElementId,activeLockedId:e.activeLockedId,lockedMultiSelections:e.lockedMultiSelections,selectedLinearElement:e.selectedLinearElement?{elementId:e.selectedLinearElement.elementId,isEditing:!!e.selectedLinearElement.isEditing}:null};return Reflect.defineProperty(t,Ic,{value:!0,enumerable:!1}),t},Pc=e=>!!Reflect.get(e,Ic);I();var Rc=ii(Cc(),1);import{randomInteger as Q0,arrayToMap as J0,toBrandedType as Bc,isDevEnv as Dc,isTestEnv as Gc,toArray as ef}from"@excalidraw/common";import{isNonDeletedElement as tf}from"@excalidraw/element";import{isFrameLikeElement as nf}from"@excalidraw/element";import{getElementsInGroup as of}from"@excalidraw/element";import{syncInvalidIndices as rf,syncMovedIndices as af,validateFractionalIndices as sf}from"@excalidraw/element";import{getSelectedElements as lf}from"@excalidraw/element";import{mutateElement as df}from"@excalidraw/element";var Oc=e=>{let t=new Map,n=[];for(let o of e)o.isDeleted||(n.push(o),t.set(o.id,o));return{elementsMap:t,elements:n}},cf=(0,Rc.default)(e=>{(Dc()||Gc()||window?.DEBUG_FRACTIONAL_INDICES)&&sf(e,{shouldThrow:Dc()||Gc(),includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1}),uf=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let o of t)n+=`${o}:${e[o]?"1":"0"}`;return n},ho=class{callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=Bc(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=Bc(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};sceneNonce;getSceneNonce(){return this.sceneNonce}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}constructor(t=null,n){t&&this.replaceAllElements(t,n)}getSelectedElements(t){let n=uf(t),o=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===o&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let r=this.selectedElementsCache.cache.get(n);if(r)return r}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=lf(o,{selectedElementIds:t.selectedElementIds},t);return 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}getNonDeletedElement(t){let n=this.getElement(t);return n&&tf(n)?n:null}mapElements(t){let n=!1,o=this.elements.map(i=>{let r=t(i);return r!==i&&(n=!0),r});return n&&this.replaceAllElements(o),n}replaceAllElements(t,n){let o=ef(t),i=[];n?.skipValidation||cf(o),this.elements=rf(o),this.elementsMap.clear(),this.elements.forEach(a=>{nf(a)&&i.push(a),this.elementsMap.set(a.id,a)});let r=Oc(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=i,this.nonDeletedFramesLikes=Oc(this.frames).elements,this.triggerUpdate()}triggerUpdate(){this.sceneNonce=Q0();for(let t of Array.from(this.callbacks))t()}onUpdate(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.elements=[],this.nonDeletedElements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),this.callbacks.clear()}insertElementsAtIndex(t,n){if(!t.length)return;if(n===null&&(n=this.elements.length),!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let o=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];af(o,J0(t)),this.replaceAllElements(o)}insertElement=t=>{this.insertElementsAtIndex([t],null)};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null;getElementsFromId=t=>{let n=this.getNonDeletedElementsMap(),o=n.get(t);return o?[o]:of(n,t)};mutateElement(t,n,o={informMutation:!0,isDragging:!1}){let i=this.getNonDeletedElementsMap(),{version:r}=t,{version:a}=df(t,i,n,o);return this.elementsMap.has(t.id)&&r!==a&&o.informMutation&&this.triggerUpdate(),t}};var $=class e{constructor(t,n){this.deleted=t;this.inserted=n}static create(t,n,o,i){let r=o&&i!=="inserted"?o(t,"deleted"):t,a=o&&i!=="deleted"?o(n,"inserted"):n;return new e(r,a)}static calculate(t,n,o,i){if(t===n)return e.empty();let r={},a={};for(let d of this.getDifferences(t,n))r[d]=t[d],a[d]=n[d];let[s,l]=i?i(r,a):[r,a];return e.create(s,l,o)}static empty(){return new e({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static merge(t,n,o=e.empty()){return e.create({...t.deleted,...n.deleted,...o.deleted},{...t.inserted,...n.inserted,...o.inserted})}static mergeObjects(t,n,o={}){let i={...t};for(let r of Object.keys(o))delete i[r];return{...i,...n}}static mergeArrays(t,n,o,i){return Object.values(e.mergeObjects(rn(t??[],i),rn(n??[],i),rn(o??[],i)))}static diffObjects(t,n,o,i){if(!t[o]&&!n[o])return;let r=t[o]!==null&&typeof t[o]=="object",a=n[o]!==null&&typeof n[o]=="object";if(r||a){let s=t[o]??{},l=n[o]??{},d=e.getLeftDifferences(s,l).reduce((u,h)=>(u[h]=i(s[h]),u),{}),c=e.getRightDifferences(s,l).reduce((u,h)=>(u[h]=i(l[h]),u),{});Object.keys(d).length||Object.keys(c).length?(Reflect.set(t,o,d),Reflect.set(n,o,c)):(Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o))}else t[o]===n[o]&&(Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o))}static diffArrays(t,n,o,i){if(!(!t[o]&&!n[o])&&(Array.isArray(t[o])||Array.isArray(n[o]))){let r=Array.isArray(t[o])?t[o]:[],a=Array.isArray(n[o])?n[o]:[],s=rn(e.getLeftDifferences(rn(r,i),rn(a,i)),d=>d),l=rn(e.getRightDifferences(rn(r,i),rn(a,i)),d=>d);if(Object.keys(s).length||Object.keys(l).length){let d=r.filter(u=>s[i?i(u):String(u)]),c=a.filter(u=>l[i?i(u):String(u)]);Reflect.set(t,o,d),Reflect.set(n,o,c)}else Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o)}}static isLeftDifferent(t,n,o=!1){return!!this.distinctKeysIterator("left",t,n,o).next().value}static isRightDifferent(t,n,o=!1){return!!this.distinctKeysIterator("right",t,n,o).next().value}static isInnerDifferent(t,n,o=!1){return!!!!this.distinctKeysIterator("inner",t,n,o).next().value}static isDifferent(t,n,o=!1){return!!!!this.distinctKeysIterator("full",t,n,o).next().value}static getLeftDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("left",t,n,o)).sort()}static getRightDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("right",t,n,o)).sort()}static getInnerDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("inner",t,n,o)).sort()}static getDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("full",t,n,o)).sort()}static*distinctKeysIterator(t,n,o,i=!1){if(n===o)return;let r=[];t==="left"?r=Object.keys(n):t==="right"?r=Object.keys(o):t==="inner"?r=Object.keys(n).filter(a=>a in o):t==="full"?r=Array.from(new Set([...Object.keys(n),...Object.keys(o)])):Nc(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let a of r){let s=n[a],l=o[a];if(s!==l){if(!i&&typeof s=="object"&&typeof l=="object"&&s!==null&&l!==null&&Hc(s,l))continue;yield a}}}},Tn=class e{constructor(t){this.delta=t}static create(t){return new e(t)}static calculate(t,n){let o=$.calculate(t,n,e.orderAppStateKeys,e.postProcess);return new e(o)}static restore(t){let{delta:n}=t;return new e(n)}static empty(){return new e($.create({},{}))}inverse(){let t=$.create(this.delta.inserted,this.delta.deleted);return new e(t)}squash(t){if(t.isEmpty())return this;let n=$.mergeObjects(this.delta.deleted.selectedElementIds??{},t.delta.deleted.selectedElementIds??{}),o=$.mergeObjects(this.delta.inserted.selectedElementIds??{},t.delta.inserted.selectedElementIds??{}),i=$.mergeObjects(this.delta.deleted.selectedGroupIds??{},t.delta.deleted.selectedGroupIds??{}),r=$.mergeObjects(this.delta.inserted.selectedGroupIds??{},t.delta.inserted.selectedGroupIds??{}),a=$.mergeObjects(this.delta.deleted.lockedMultiSelections??{},t.delta.deleted.lockedMultiSelections??{}),s=$.mergeObjects(this.delta.inserted.lockedMultiSelections??{},t.delta.inserted.lockedMultiSelections??{}),l={},d={};return(Object.keys(n).length||Object.keys(o).length)&&(d.selectedElementIds=n,l.selectedElementIds=o),(Object.keys(i).length||Object.keys(r).length)&&(d.selectedGroupIds=i,l.selectedGroupIds=r),(Object.keys(a).length||Object.keys(s).length)&&(d.lockedMultiSelections=a,l.lockedMultiSelections=s),this.delta=$.merge(this.delta,t.delta,$.create(d,l)),this}applyTo(t,n){try{let{selectedElementIds:o={},selectedGroupIds:i={},lockedMultiSelections:r={}}=this.delta.deleted,{selectedElementIds:a={},selectedGroupIds:s={},lockedMultiSelections:l={},selectedLinearElement:d,...c}=this.delta.inserted,u=$.mergeObjects(t.selectedElementIds,a,o),h=$.mergeObjects(t.selectedGroupIds,s,i),m=$.mergeObjects(t.lockedMultiSelections,l,r),g=d&&n.has(d.elementId)?new D(n.get(d.elementId),n,d.isEditing):null,f={...t,...c,selectedElementIds:u,selectedGroupIds:h,lockedMultiSelections:m,selectedLinearElement:typeof d<"u"?g:t.selectedLinearElement},E=this.filterInvisibleChanges(t,f,n);return[f,E]}catch(o){if(console.error("Couldn't apply appstate change",o),Dn()||Bn())throw o;return[t,!1]}}isEmpty(){return $.isEmpty(this.delta)}filterInvisibleChanges(t,n,o){let i=po(t),r=po(n),a=$.isRightDifferent(e.stripElementsProps(i),e.stripElementsProps(r)),s=$.isRightDifferent(e.stripStandaloneProps(i),e.stripStandaloneProps(r));if(!a&&!s)return!1;let l={value:a};if(s){let d=$.getRightDifferences(e.stripStandaloneProps(i),e.stripStandaloneProps(r)),c=new Set;(d.includes("editingGroupId")||d.includes("selectedGroupIds"))&&(c=kd(o));for(let u of d)switch(u){case"selectedElementIds":n[u]=e.filterSelectedElements(n[u],o,l);break;case"selectedGroupIds":n[u]=e.filterSelectedGroups(n[u],c,l);break;case"croppingElementId":{let y=n[u];if(!y)l.value=!0;else{let w=o.get(y);w&&!w.isDeleted?l.value=!0:n[u]=null}break}case"editingGroupId":let h=n[u];h?c.has(h)?l.value=!0:n[u]=null:l.value=!0;break;case"selectedLinearElement":let m=n[u];if(!m)l.value=!0;else{let y=o.get(m.elementId);y&&!y.isDeleted?l.value=!0:n[u]=null}break;case"lockedMultiSelections":let g=t[u]||{},f=n[u]||{};Hc(g,f)||(l.value=!0);break;case"activeLockedId":let E=t[u]||null,x=n[u]||null;E!==x&&(l.value=!0);break;default:Nc(u,`Unknown ObservedElementsAppState's key "${u}"`,!0)}}return l.value}static filterSelectedElements(t,n,o){let i=Object.keys(t);if(!i.length)return o.value=!0,t;let r={...t};for(let a of i){let s=n.get(a);s&&!s.isDeleted?o.value=!0:delete r[a]}return r}static filterSelectedGroups(t,n,o){if(!Object.keys(t).length)return o.value=!0,t;let r={...t};for(let a of Object.keys(r))n.has(a)?o.value=!0:delete r[a];return r}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:o,selectedElementIds:i,selectedLinearElement:r,croppingElementId:a,lockedMultiSelections:s,activeLockedId:l,...d}=t;return d}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:o,...i}=t;return i}static postProcess(t,n){try{$.diffObjects(t,n,"selectedElementIds",o=>!0),$.diffObjects(t,n,"selectedGroupIds",o=>o??!1),$.diffObjects(t,n,"lockedMultiSelections",o=>o??{})}catch(o){if(console.error("Couldn't postprocess appstate change deltas."),Dn()||Bn())throw o}finally{return[t,n]}}static orderAppStateKeys(t){let n={};for(let o of Object.keys(t).sort())n[o]=t[o];return n}},Ln=class e{constructor(t,n,o){this.added=t;this.removed=n;this.updated=o}static create(t,n,o,i={shouldRedistribute:!1}){let r;if(i.shouldRedistribute){let a={},s={},l={},d=[...Object.entries(t),...Object.entries(n),...Object.entries(o)];for(let[c,u]of d)this.satisfiesAddition(u)?a[c]=u:this.satisfiesRemoval(u)?s[c]=u:l[c]=u;r=new e(a,s,l)}else r=new e(t,n,o);return(Dn()||Bn())&&(e.validate(r,"added",this.satisfiesAddition),e.validate(r,"removed",this.satisfiesRemoval),e.validate(r,"updated",this.satisfiesUpdate)),r}static restore(t){let{added:n,removed:o,updated:i}=t;return e.create(n,o,i)}static satisfiesAddition=({deleted:t,inserted:n})=>t.isDeleted===!0&&!n.isDeleted;static satisfiesRemoval=({deleted:t,inserted:n})=>!t.isDeleted&&n.isDeleted===!0;static satisfiesUpdate=({deleted:t,inserted:n})=>!!t.isDeleted==!!n.isDeleted;static satisfiesCommmonInvariants=({deleted:t,inserted:n})=>!!(Number.isInteger(t.version)&&Number.isInteger(n.version)&&t.version>=0&&n.version>=0&&t.version!==n.version);static satisfiesUniqueInvariants=(t,n)=>{let{added:o,removed:i,updated:r}=t;return[o[n],i[n],r[n]].filter(Boolean).length===1};static validate(t,n,o){for(let[i,r]of Object.entries(t[n]))if(!this.satisfiesCommmonInvariants(r)||!this.satisfiesUniqueInvariants(t,i)||!o(r))throw console.error(`Broken invariant for "${n}" delta, element "${i}", delta:`,r),new Error(`ElementsDelta invariant broken for element "${i}".`)}static calculate(t,n){if(t===n)return e.empty();let o={},i={},r={};for(let a of t.values())if(!n.get(a.id)){let l={...a},d={isDeleted:!0,version:a.version+1,versionNonce:Fc()},c=$.create(l,d,e.stripIrrelevantProps);a.isDeleted?r[a.id]=c:i[a.id]=c}for(let a of n.values()){let s=t.get(a.id);if(!s){let l={isDeleted:!0,version:a.version-1,versionNonce:Fc()},d={...a},c=$.create(l,d,e.stripIrrelevantProps);a.isDeleted?r[a.id]=c:o[a.id]=c;continue}if(s.versionNonce!==a.versionNonce){let l=$.calculate(s,a,e.stripIrrelevantProps,e.postProcess);if(typeof s.isDeleted=="boolean"&&typeof a.isDeleted=="boolean"&&s.isDeleted!==a.isDeleted){s.isDeleted&&!a.isDeleted?o[a.id]=l:i[a.id]=l;continue}r[a.id]=l}}return e.create(o,i,r)}static empty(){return e.create({},{},{})}inverse(){let t=r=>{let a={};for(let[s,{inserted:l,deleted:d}]of Object.entries(r))a[s]=$.create({...l},{...d});return a},n=t(this.added),o=t(this.removed),i=t(this.updated);return e.create(o,n,i)}isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.removed).length===0&&Object.keys(this.updated).length===0}applyLatestChanges(t,n,o){let i=(d,c)=>(u,h)=>{let m;switch(h){case"deleted":m=d;break;case"inserted":m=c;break}if(!m)return console.error("Element not found when trying to apply latest changes"),u;let g={};for(let f of Object.keys(u))switch(f){case"boundElements":g[f]=u[f];break;default:g[f]=m[f]}return g},r=d=>{let c={};for(let[u,h]of Object.entries(d)){let m=t.get(u),g=n.get(u),f=null;m||g?f=$.create(h.deleted,h.inserted,i(m,g),o):f=h,$.isInnerDifferent(f.deleted,f.inserted)&&(c[u]=f)}return c},a=r(this.added),s=r(this.removed),l=r(this.updated);return e.create(a,s,l,{shouldRedistribute:!0})}applyTo(t,n=Cn.empty().elements,o){let i=new Map(t),r,a={containsVisibleDifference:!1,containsZindexDifference:!1,applyDirection:void 0};try{let s=e.createApplier(t,i,n,a,o),l=s(this.added),d=s(this.removed),c=s(this.updated),u=this.resolveConflicts(t,i,a.applyDirection);r=new Map([...l,...d,...c,...u])}catch(s){if(console.error("Couldn't apply elements delta",s),Dn()||Bn())throw s;return[t,!0]}try{i=e.reorderElements(i,r,a),e.redrawElements(i,r)}catch(s){if(console.error("Couldn't mutate elements after applying elements change",s),Dn()||Bn())throw s}finally{return[i,a.containsVisibleDifference]}}squash(t){if(t.isEmpty())return this;let{added:n,removed:o,updated:i}=t,r=(a,s)=>{let l=$.mergeArrays(a.deleted.boundElements??[],s.deleted.boundElements??[],void 0,c=>c.id)??[],d=$.mergeArrays(a.inserted.boundElements??[],s.inserted.boundElements??[],void 0,c=>c.id)??[];if(!(!l.length&&!d.length))return $.create({boundElements:l},{boundElements:d})};for(let[a,s]of Object.entries(n)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.added[a]=s;else{let d=r(l,s);delete this.removed[a],delete this.updated[a],this.added[a]=$.merge(l,s,d)}}for(let[a,s]of Object.entries(o)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.removed[a]=s;else{let d=r(l,s);delete this.added[a],delete this.updated[a],this.removed[a]=$.merge(l,s,d)}}for(let[a,s]of Object.entries(i)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.updated[a]=s;else{let d=r(l,s),c=$.merge(l,s,d);l===this.added[a]?this.added[a]=c:l===this.removed[a]?this.removed[a]=c:this.updated[a]=c}}return(Dn()||Bn())&&(e.validate(this,"added",e.satisfiesAddition),e.validate(this,"removed",e.satisfiesRemoval),e.validate(this,"updated",e.satisfiesUpdate)),this}static createApplier=(t,n,o,i,r)=>a=>{let s=e.createGetter(n,o,i);return Object.entries(a).reduce((l,[d,c])=>{let u=s(d,c.inserted);if(u){let h=e.applyDelta(u,c,i,r);if(n.set(h.id,h),l.set(h.id,h),!i.applyDirection){let m=t.get(d);m&&(i.applyDirection=m.version>h.version?"backward":"forward")}}return l},new Map)};static createGetter=(t,n,o)=>(i,r)=>{let a=t.get(i);return a||(a=n.get(i),a?(o.containsZindexDifference=!0,(!r.isDeleted||r.isDeleted&&!a.isDeleted)&&(o.containsVisibleDifference=!0)):a=He({id:i,version:1},{...r})),a};static applyDelta(t,n,o,i){let r={};for(let a of Object.keys(n.inserted)){if(a==="boundElements"||i?.excludedProperties?.has(a))continue;let s=n.inserted[a];Reflect.set(r,a,s)}if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let a=$.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,s=>s.id);Object.assign(r,{boundElements:a})}if(!o.containsVisibleDifference){let{index:a,...s}=r,l=e.checkForVisibleDifference(t,s);o.containsVisibleDifference=l}return o.containsZindexDifference||(o.containsZindexDifference=n.deleted.index!==n.inserted.index),He(t,r,!0)}static checkForVisibleDifference(t,n){return t.isDeleted&&n.isDeleted!==!1?!1:t.isDeleted&&n.isDeleted===!1||t.isDeleted===!1&&n.isDeleted?!0:$.isRightDifferent(t,n)}resolveConflicts(t,n,o="forward"){let i=new Map,r=(s,l)=>{let d=n.get(s.id);if(!d)return;let c=t.get(s.id),u=o==="forward"?d.version+1:d.version-1,h=l,m;c===d?m=He(d,{...h,version:u},!0):m=Te(d,n,{...h,version:c?.version!==d.version?d.version:u}),i.set(m.id,m),n.set(m.id,m)};for(let s of Object.keys(this.removed))e.unbindAffected(t,n,s,r);for(let s of Object.keys(this.added))e.rebindAffected(t,n,s,r);for(let[s]of Array.from(Object.entries(this.updated)).filter(([l,d])=>Object.keys({...d.deleted,...d.inserted}).find(c=>hd.has(c)))){let l=n.get(s);!l||l.isDeleted||e.rebindAffected(t,n,s,r)}let a=new Map(Array.from(t).filter(([s])=>i.has(s)));return this.squash(e.calculate(a,i)),i}static unbindAffected(t,n,o,i){let r=()=>t.get(o),a=()=>n.get(o);Mn.unbindAffected(n,r(),i),Mn.unbindAffected(n,a(),i),Pn.unbindAffected(n,r(),i),Pn.unbindAffected(n,a(),i)}static rebindAffected(t,n,o,i){let r=()=>t.get(o),a=()=>n.get(o);Mn.unbindAffected(n,r(),i),Mn.rebindAffected(n,a(),i),Pn.unbindAffected(n,r(),(s,l)=>{te(s)&&i(s,l)}),Pn.rebindAffected(n,a(),i)}static redrawElements(t,n){try{let o=new ho(t,{skipValidation:!0});e.redrawTextBoundingBoxes(o,n),e.redrawBoundArrows(o,n)}catch(o){if(console.error("Couldn't redraw elements",o),Dn()||Bn())throw o}finally{return t}}static redrawTextBoundingBoxes(t,n){let o=t.getNonDeletedElementsMap(),i=new Map;for(let r of n.values()){if(xe(r)){let{containerId:a}=r,s=a?o.get(a):void 0;s&&i.set(s.id,{container:s,boundText:r})}if(Tt(r)){let a=qt(r),s=a?o.get(a):void 0;s&&i.set(r.id,{container:r,boundText:s})}}for(let{container:r,boundText:a}of i.values())r.isDeleted||a.isDeleted||Bi(a,r,t)}static redrawBoundArrows(t,n){for(let o of n.values())!o.isDeleted&&Ee(o)&&Re(o,t,{changedElements:n})}static reorderElements(t,n,o){if(!o.containsZindexDifference)return t;let i=Array.from(t.values()),r=gd([...i]),a=$.getRightDifferences(i,r,!0).reduce((s,l)=>{let d=i[Number(l)];return d&&n.has(d.id)&&s.set(d.id,d),s},new Map);return!o.containsVisibleDifference&&a.size&&(o.containsVisibleDifference=!0),pf(Yn(r,a))}static postProcess(t,n){try{$.diffArrays(t,n,"boundElements",r=>r.id);let o=t.points??[],i=n.points??[];$.isDifferent(o,i)||(Reflect.deleteProperty(t,"points"),Reflect.deleteProperty(n,"points"))}catch(o){if(console.error("Couldn't postprocess elements delta."),Dn()||Bn())throw o}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:o,...i}=t;return i}};I();var e4=(e,t,n,o,i)=>{let[r,a,s,l]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],d=Fe(e),c=Qi(e,t,o).map(g=>[g,Fe(g)]).sort((g,f)=>g[1][a]-f[1][a]),u=0;for(let g of c)u+=g[1][l];let h=(d[l]-u)/(c.length-1);if(h<0){let g=c.findIndex(y=>y[1][r]===d[r]),f=c.findIndex(y=>y[1][s]===d[s]),E=(c[f][1][a]-c[g][1][a])/(c.length-1),x=c[g][1][a];return c.flatMap(([y,w],M)=>{let b={x:0,y:0};return M!==g&&M!==f&&(x+=E,b[n.axis]=x-w[a]),y.map(S=>{let v=i.mutateElement(S,{x:S.x+b.x,y:S.y+b.y});return Re(S,i,{simultaneouslyUpdated:y}),v})})}let m=d[r];return c.flatMap(([g,f])=>{let E={x:0,y:0};return E[n.axis]=m-f[r],m+=h,m+=f[l],g.map(x=>{let y=i.mutateElement(x,{x:x.x+E.x,y:x.y+E.y});return Re(x,i,{simultaneouslyUpdated:g}),y})})};I();import{TEXT_AUTOWRAP_THRESHOLD as hf,getGridPoint as mf,getFontString as ff,DRAGGING_THRESHOLD as gf}from"@excalidraw/common";var c4=(e,t,n,o,i,r)=>{if(t.length===1&&Y(t[0])&&(t[0].startBinding||t[0].endBinding))return;let a=t.filter(h=>{if(Y(h)&&h.startBinding&&h.endBinding){let m=t.find(f=>f.id===h.startBinding?.elementId),g=t.find(f=>f.id===h.endBinding?.elementId);return m&&g}return!0}),s=new Set(a),l=a.filter(h=>ee(h)).map(h=>h.id);if(l.length>0)for(let h of o.getNonDeletedElements())h.frameId!==null&&l.includes(h.frameId)&&s.add(h);let d=[];for(let h of s){let m=e.originalElements.get(h.id);if(!m)return;d.push(m)}let c=Ef(We(d),n,i,r),u=new Set(Array.from(s,h=>h.id));s.forEach(h=>{let m=!j(h),g=m||(h.startBinding?u.has(h.startBinding.elementId):!1),f=m||(h.endBinding?u.has(h.endBinding.elementId):!1);if(j(h)){if(s.size>1||Math.max(Math.abs(c.x),Math.abs(c.y))>gf||!h.startBinding&&!h.endBinding){ts(e,h,o,c);let E=h.startBinding&&!g,x=h.endBinding&&!f;(E||x)&&(E&&Oe(h,"start",o),x&&Oe(h,"end",o))}}else{ts(e,h,o,c);let E=Q(h,o.getNonDeletedElementsMap());E&&ts(e,E,o,c),Re(h,o,{simultaneouslyUpdated:Array.from(s)})}})},Ef=(e,t,n,o)=>{let[i,r]=e,a=i+t.x+n.x,s=r+t.y+n.y;if(n.x===0||n.y===0){let[l,d]=mf(i+t.x,r+t.y,o);n.x===0&&(a=l),n.y===0&&(s=d)}return{x:a-i,y:s-r}},ts=(e,t,n,o)=>{let i=e.originalElements.get(t.id)??t,r=i.x+o.x,a=i.y+o.y;n.mutateElement(t,{x:r,y:a})},u4=(e,t,n)=>{let[o,i]=We(e);return[t-o,n-i]},p4=({newElement:e,elementType:t,originX:n,originY:o,x:i,y:r,width:a,height:s,shouldMaintainAspectRatio:l,shouldResizeFromCenter:d,zoom:c,scene:u,widthAspectRatio:h=null,originOffset:m=null,informMutation:g=!0})=>{l&&e.type!=="selection"&&(h?s=a/h:(Math.abs(r-o)>Math.abs(i-n)?{width:a,height:s}=Ua(t,s,i<n?-a:a):{width:a,height:s}=Ua(t,a,r<o?-s:s),s<0&&(s=-s)));let f=i<n?n-a:n,E=r<o?o-s:o;d&&(a+=a,s+=s,f=n-a/2,E=o-s/2);let x=null;if(te(e)){s=e.height;let y=ki(ff({fontSize:e.fontSize,fontFamily:e.fontFamily}),e.lineHeight);a=Math.max(a,y),Math.abs(i-n)>hf/c&&(x={autoResize:!1}),E=o,d&&(f=n-a/2)}if(a!==0&&s!==0){let y=null;Ae(e)&&(y={initialWidth:a,initialHeight:s}),u.mutateElement(e,{x:f+(m?.x??0),y:E+(m?.y??0),width:a,height:s,...x,...y},{informMutation:g,isDragging:!1})}};I();import{ELEMENT_LINK_KEY as cr,normalizeLink as zc}from"@excalidraw/common";var E4=(e,t)=>{let n=window.location.href;try{let o=new URL(n);return o.searchParams.set(cr,e),zc(o.toString())}catch(o){console.error(o)}return zc(n)},x4=(e,t)=>{if(e.length>0&&xf(e)){if(e.length===1)return{id:e[0].id,type:"element"};if(e.length>1){let n=Object.keys(t.selectedGroupIds)[0];return n?{id:n,type:"group"}:{id:e[0].groupIds[0],type:"group"}}}return null},xf=e=>!!(e.length===1||e.length>1&&Td(e)),y4=e=>{try{let t=new URL(e);return t.searchParams.has(cr)&&t.host===window.location.host}catch{return!1}},w4=e=>{try{let{searchParams:t}=new URL(e);if(t.has(cr))return t.get(cr)}catch{}return null};I();import{FONT_FAMILY as Lf,VERTICAL_ALIGN as Cf,escapeDoubleQuotes as ns,getFontString as Bf}from"@excalidraw/common";I();import{DEFAULT_ELEMENT_PROPS as Gn,DEFAULT_FONT_FAMILY as yf,DEFAULT_FONT_SIZE as wf,DEFAULT_TEXT_ALIGN as bf,DEFAULT_VERTICAL_ALIGN as Mf,VERTICAL_ALIGN as Pf,randomInteger as If,randomId as Sf,getFontString as ur,getUpdatedTimestamp as vf,getLineHeight as Af}from"@excalidraw/common";var Pt=(e,{x:t,y:n,strokeColor:o=Gn.strokeColor,backgroundColor:i=Gn.backgroundColor,fillStyle:r=Gn.fillStyle,strokeWidth:a=Gn.strokeWidth,strokeStyle:s=Gn.strokeStyle,roughness:l=Gn.roughness,opacity:d=Gn.opacity,width:c=0,height:u=0,angle:h=0,groupIds:m=[],frameId:g=null,index:f=null,roundness:E=null,boundElements:x=null,link:y=null,locked:w=Gn.locked,...M})=>((t<-1e6||t>1e6||n<-1e6||n>1e6||c<-1e6||c>1e6||u<-1e6||u>1e6)&&console.error("New element size or position is too large",{x:t,y:n,width:c,height:u,points:M.points}),{id:M.id||Sf(),type:e,x:t,y:n,width:c,height:u,angle:h,strokeColor:o,backgroundColor:i,fillStyle:r,strokeWidth:a,strokeStyle:s,roughness:l,opacity:d,groupIds:m,frameId:g,index:f,roundness:E,seed:M.seed??If(),version:M.version||1,versionNonce:M.versionNonce??0,isDeleted:!1,boundElements:x,updated:vf(),link:y,locked:w,customData:M.customData}),Zn=e=>Pt(e.type,e),L4=e=>Pt("embeddable",e),C4=e=>({...Pt("iframe",e)}),Wc=e=>He({...Pt("frame",e),type:"frame",name:e?.name||null},{}),_c=e=>He({...Pt("magicframe",e),type:"magicframe",name:e?.name||null},{}),jc=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),qn=e=>{let t=e.fontFamily||yf,n=e.fontSize||wf,o=e.lineHeight||Af(t),i=Go(e.text),r=ot(i,ur({fontFamily:t,fontSize:n}),o),a=e.textAlign||bf,s=e.verticalAlign||Mf,l=jc({textAlign:a,verticalAlign:s},r),d={...Pt("text",e),text:i,fontSize:n,fontFamily:t,textAlign:a,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:r.width,height:r.height,containerId:e.containerId||null,originalText:e.originalText??i,autoResize:e.autoResize??!0,lineHeight:o};return He(d,{})},kf=(e,t,n)=>{let{width:o,height:i}=ot(n,ur(e),e.lineHeight);e.autoResize||(o=e.width);let{textAlign:r,verticalAlign:a}=e,s,l;if(r==="center"&&a===Pf.MIDDLE&&!e.containerId&&e.autoResize){let d=ot(e.text,ur(e),e.lineHeight),c=jc(e,{width:o-d.width,height:i-d.height});s=e.x-c.x,l=e.y-c.y}else{let[d,c,u,h]=K(e,t),[m,g,f,E]=un(e,o,i,!1),x=(d-m)/2,y=(c-g)/2,w=(u-f)/2,M=(h-E)/2;[s,l]=Tf({s:!0,e:r==="center"||r==="left",w:r==="center"||r==="right"},e.x,e.y,e.angle,x,y,w,M)}return{width:o,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},Tf=(e,t,n,o,i,r,a,s)=>{let l=Math.cos(o),d=Math.sin(o);return e.e&&e.w?t+=i+a:e.e?(t+=i*(1+l),n+=i*d,t+=a*(1-l),n+=a*-d):e.w&&(t+=i*(1-l),n+=i*-d,t+=a*(1+l),n+=a*d),e.n&&e.s?n+=r+s:e.n?(t+=r*d,n+=r*(1-l),t+=s*-d,n+=s*(1+l)):e.s&&(t+=r*-d,n+=r*(1+l),t+=s*d,n+=s*(1-l)),[t,n]},B4=(e,t,n,o=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(o=Zt(o,ur(e),t?xt(t,e):e.width));let i=kf(e,n,o);return{text:o,...i}},D4=e=>({...Pt(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure}),Vc=e=>{let t={...Pt(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null};return jt(t)?{...t,polygon:e.polygon??!1}:t},pr=e=>e.elbowed?{...Pt(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!0,fixedSegments:e.fixedSegments||[],startIsSpecial:!1,endIsSpecial:!1}:{...Pt(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!1},Yc=e=>({...Pt("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,fileName:e.fileName??null,scale:e.scale??[1,1],crop:e.crop??null});var It=new Map,Df=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)/,Gf=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,Of=/^https:\/\/(?:www\.)?figma\.com/,Uc=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,Rf=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,Ff=/^(?:https?:\/\/)?forms\.microsoft\.com\//,Xc=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,Nf=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,Hf=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,zf=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,$c=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Zc=/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/,Wf=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i,Kc=e=>{let t;try{let a=new URL(e.startsWith("http")?e:`https://${e}`);t=a.searchParams.get("t")||a.searchParams.get("start")}catch{t=e.match(/[?&#](?:t|start)=([^&#\s]+)/)?.[1]}if(!t)return 0;if(/^\d+$/.test(t))return parseInt(t,10);let n=t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(!n)return 0;let[,o="0",i="0",r="0"]=n;return parseInt(o)*3600+parseInt(i)*60+parseInt(r)},_f=e=>{try{let t=new URL(e.startsWith("http")?e:`https://${e}`);if(t.hostname.replace(/^www\./,"")!=="drive.google.com")return null;let o=null,i=t.pathname.match(/^\/file\/d\/([^/]+)(?:\/|$)/);if(i?.[1]?o=i[1]:(t.pathname==="/open"||t.pathname==="/uc")&&(o=t.searchParams.get("id")),!o||!/^[a-zA-Z0-9_-]+$/.test(o))return null;let r=t.searchParams.get("resourcekey"),a=Kc(t.toString());return{fileId:o,resourceKey:r&&/^[a-zA-Z0-9_-]+$/.test(r)?r:void 0,timestamp:a>0?a:void 0}}catch{return null}},is=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","drive.google.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","reddit.com","forms.microsoft.com"]),qc=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","drive.google.com","figma.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","reddit.com","forms.microsoft.com"]),os=e=>`<html><body>${e}</body></html>`,z4=e=>{if(!e)return null;if(It.has(e))return It.get(e);let t=e,n=qc.has(rs(e,qc)||""),o="generic",i={w:560,h:840},r=e.match(Df);if(r?.[2]){let c=Kc(t),u=c>0?`&start=${c}`:"",h=e.includes("shorts");switch(o="video",r[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${r[2]}?enablejsapi=1${u}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${r[2]}&enablejsapi=1${u}`;break;default:e=`https://www.youtube.com/embed/${r[2]}?enablejsapi=1${u}`;break}return i=h?{w:315,h:560}:{w:560,h:315},It.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}let a=e.match(Gf);if(a?.[1]){let c=a?.[1],u=/^\d+$/.test(c)?void 0:new URIError("Invalid embed link format");return o="video",e=`https://player.vimeo.com/video/${c}?api=1`,i={w:560,h:315},It.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,error:u,sandbox:{allowSameOrigin:n}}}let s=_f(e);if(s){o="video";let c=new URLSearchParams;s.resourceKey&&c.set("resourcekey",s.resourceKey),s.timestamp&&c.set("t",`${s.timestamp}`);let u=c.toString();return e=`https://drive.google.com/file/d/${s.fileId}/preview${u?`?${u}`:""}`,i={w:560,h:315},It.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}if(e.match(Of))return o="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},It.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};let d=e.match(Hf);if(d)return e=d[1]==="embed"?d[0]:d[0].replace("/v","/embed"),It.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};if(Ff.test(e)&&!e.includes("embed=true")&&(e+=e.includes("?")?"&embed=true":"?embed=true"),Xc.test(e)){let c=e.match(Xc)[1],u=ns(`https://twitter.com/x/status/${c}`),h={type:"document",srcdoc:m=>os(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${m}"><a href="${u}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return It.set(t,h),h}if(Zc.test(e)){let[,c,u,h]=e.match(Zc),m=ns(`https://reddit.com/r/${c}/comments/${u}/${h}`),g={type:"document",srcdoc:f=>os(`<blockquote class="reddit-embed-bq" data-embed-theme="${f}"><a href="${m}"></a><br></blockquote><script async="" src="https://embed.reddit.com/widgets.js" charset="UTF-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return It.set(t,g),g}if(Uc.test(e)){let[,c,u]=e.match(Uc),h=ns(`https://gist.github.com/${c}/${u}`),m={type:"document",srcdoc:()=>os(`
21
+ C ${l} ${d}, ${l} ${d}, ${l+E} ${d+x}`,ht(e,!0,a))}else s=t.polygon([[l,d],[c,p],[h,m],[g,f]],ht(e,!1,a));return s}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,ht(e,!1,a));case"line":case"arrow":{let s,l=ht(e,!1,a),d=e.points.length?e.points:[Pe(0,0)];if(Z(e)?d.every(c=>Math.abs(c[0])<=1e6&&Math.abs(c[1])<=1e6)?s=[t.path(kc(d,16),ht(e,!0,a))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(d)),s=[]):e.roundness?s=[t.curve(d,l)]:l.fill?s=[t.polygon(d,l)]:s=[t.linearPath(d,l)],e.type==="arrow"){let{startArrowhead:c=null,endArrowhead:p="arrow"}=e;if(c!==null){let h=Sc(e,s,"start",c,t,l,o,a);s.push(...h)}if(p!==null){let h=Sc(e,s,"end",p,t,l,o,a);s.push(...h)}}return s}case"freedraw":{let s=[];if(nn(e.points)){let l=No(e.points,.75);s.push(t.curve(l,{...ht(e,!1,a),stroke:"none"}))}return s.push(w0(e)),s}case"frame":case"magicframe":case"text":case"image":return null;default:return h0(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},kc=(e,t)=>{let n=[];for(let i=1;i<e.length-1;i+=1){let r=e[i-1],a=e[i+1],s=e[i],l=Dt(s,r),d=Dt(a,s),c=Math.min(t,Pc(e[i],a)/2,Pc(e[i],r)/2);l?r[0]<s[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):r[1]<s[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c]),n.push(e[i]),d?a[0]<s[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):a[1]<s[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c])}let o=[`M ${e[0][0]} ${e[0][1]}`];for(let i=0;i<n.length;i+=3)o.push(`L ${n[i][0]} ${n[i][1]}`),o.push(`Q ${n[i+1][0]} ${n[i+1][1]}, ${n[i+2][0]} ${n[i+2][1]}`);return o.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),o.join(" ")},hi=(e,t)=>{switch(e.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return ol(e);case"arrow":case"line":{let n=wt.generateElementShape(e,null)[0],[,,,,o,i]=ee(e,t);return Yi(e)?sl(e,n,Pe(e.x,e.y),e.angle,Pe(o,i)):rl(n,Pe(e.x,e.y),e.angle,Pe(o,i))}case"ellipse":return il(e);case"freedraw":{let[,,,,n,o]=ee(e,t);return al(e,Pe(n,o),Yi(e))}}},dc=(e,t)=>{let n=[...e.points];if(t){if(!Ll(e.points))return null;let i=n[0],r=n[n.length-1];Math.hypot(i[0]-r[0],i[1]-r[1])>f0||n.length<4?n.push(Pe(i[0],i[1])):n[n.length-1]=Pe(i[0],i[1])}return{polygon:t,points:n}},w0=e=>A0(S0(e)),Qa={SIZE_FACTOR:4.25,THINNING:.6,SMOOTHING:.5},b0={SIZE_FACTOR:1.4},Tc=e=>e.strokeOptions?.streamline??g0,M0=e=>{let t=e.simulatePressure?e.points:e.points.length?e.points.map(([n,o],i)=>[n,o,e.pressures[i]]):[[0,0,.5]];return ml(t,{simulatePressure:e.simulatePressure,size:e.strokeWidth*Qa.SIZE_FACTOR,thinning:Qa.THINNING,smoothing:Qa.SMOOTHING,streamline:Tc(e),easing:n=>Math.sin(n*Math.PI/2),last:!0})},P0=e=>new Di({size:e.strokeWidth*b0.SIZE_FACTOR,streamline:Tc(e),simplify:0,sizeMapping:t=>Math.max(.1,t.pressure)}),I0=e=>{let t=P0(e);return e.points.map(([n,o])=>t.addPoint([n,o,1])),t.getStrokeOutline().map(([n,o])=>[n,o])},S0=e=>e.strokeOptions?.variability==="constant"?I0(e):M0(e),vc=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],v0=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,A0=e=>{if(!e.length)return"";let t=e.length-1;return e.reduce((n,o,i,r)=>(i===t?n.push(o,vc(o,r[0]),"L",r[0],"Z"):n.push(o,vc(o,r[i+1])),n),["M",e[0],"Q"]).join(" ").replace(v0,"$1")};var ns=class e{static boundsCache=new WeakMap;static nonRotatedBoundsCache=new WeakMap;static getBounds(t,n,o=!1){let i=o&&t.angle!==0?e.nonRotatedBoundsCache.get(t):e.boundsCache.get(t);if(i?.version&&i.version===t.version&&!ke(t))return i.bounds;if(o&&t.angle!==0){let a=e.calculateBounds({...t,angle:0},n);return e.nonRotatedBoundsCache.set(t,{version:t.version,bounds:a}),a}let r=e.calculateBounds(t,n);return e.boundsCache.set(t,{version:t.version,bounds:r}),r}static calculateBounds(t,n){let o,[i,r,a,s,l,d]=ee(t,n);if(He(t)){let[c,p,h,m]=is(t.points.map(([g,f])=>le(B(g,f),B(l-t.x,d-t.y),t.angle)));return[c+t.x,p+t.y,h+t.x,m+t.y]}else if(ae(t))o=N0(t,l,d,n);else if(t.type==="diamond"){let[c,p]=le(B(l,r),B(l,d),t.angle),[h,m]=le(B(l,s),B(l,d),t.angle),[g,f]=le(B(i,d),B(l,d),t.angle),[E,x]=le(B(a,d),B(l,d),t.angle),y=Math.min(c,h,g,E),w=Math.min(p,m,f,x),M=Math.max(c,h,g,E),b=Math.max(p,m,f,x);o=[y,w,M,b]}else if(t.type==="ellipse"){let c=(a-i)/2,p=(s-r)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),g=Math.hypot(c*h,p*m),f=Math.hypot(p*h,c*m);o=[l-g,d-f,l+g,d+f]}else{let[c,p]=le(B(i,r),B(l,d),t.angle),[h,m]=le(B(i,s),B(l,d),t.angle),[g,f]=le(B(a,s),B(l,d),t.angle),[E,x]=le(B(a,r),B(l,d),t.angle),y=Math.min(c,h,g,E),w=Math.min(p,m,f,x),M=Math.max(c,h,g,E),b=Math.max(p,m,f,x);o=[y,w,M,b]}return o}},ee=(e,t,n=!1)=>{if(He(e))return D0(e);if(ae(e))return F.getElementAbsoluteCoords(e,t,n);if(re(e)){let o=t?Xe(e,t):null;if(Y(o)){let{x:i,y:r}=F.getBoundTextElementPosition(o,e,t);return[i,r,i+e.width,r+e.height,i+e.width/2,r+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]},Ha=(e,t)=>{let n=hi(e,t),[o,i,r,a,s,l]=ee(e,t),d=B(s,l);if(n.type==="polycurve"){let x=n.data.map(w=>qt(w,10)),y=[];if(Jt(e)&&!e.polygon||Y(e))for(let w of x){let M=0;for(;M<w.length-1;)y.push(Ie(B(w[M][0],w[M][1]),B(w[M+1][0],w[M+1][1]))),M++}else{let w=x.flat(),M=0;for(;M<w.length-1;)y.push(Ie(B(w[M][0],w[M][1]),B(w[M+1][0],w[M+1][1]))),M++}return y}else{if(n.type==="polyline")return n.data;if(L0(e)){let[E,x]=Pn(e),y=x.map(M=>Dc(M,d,e.angle)).flat();return[...Cc(E,d,e.angle),...y]}else if(e.type==="diamond"){let[E,x]=In(e),y=x.map(M=>Dc(M,d,e.angle)).flat();return[...Cc(E,d,e.angle),...y]}else if(n.type==="polygon"){if(re(e)){let y=Xe(e,t);if(y&&ae(y))return[Ie(B(o,i),B(r,i)),Ie(B(r,i),B(r,a)),Ie(B(r,a),B(o,a)),Ie(B(o,a),B(o,i))]}let E=n.data,x=[];for(let y=0;y<E.length-1;y++)x.push(Ie(E[y],E[y+1]));return x}else if(n.type==="ellipse")return C0(e)}let[c,p,h,m,,,g,f]=[[o,i],[r,i],[o,a],[r,a],[s,i],[s,a],[o,l],[r,l]].map(E=>le(E,d,e.angle));return[Ie(c,p),Ie(h,m),Ie(c,h),Ie(p,m),Ie(c,f),Ie(h,f),Ie(p,g),Ie(m,g)]},L0=e=>e!=null&&(e.type==="rectangle"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Cc=(e,t,n)=>e.map(o=>Ie(le(o[0],t,n),le(o[1],t,n))),Dc=(e,t,n)=>{let o=qt(e,10),i=0,r=[];for(;i<o.length-1;)r.push(Ie(le(B(o[i][0],o[i][1]),t,n),le(B(o[i+1][0],o[i+1][1]),t,n))),i++;return r},C0=e=>{let t=B(e.x+e.width/2,e.y+e.height/2),n=e.width/2,o=e.height/2,i=[],r=[],a=90,s=Math.PI*2/a;for(let l=0;l<a;l++){let d=l*s,c=t[0]+n*Math.cos(d),p=t[1]+o*Math.sin(d);r.push(le(B(c,p),t,e.angle))}for(let l=0;l<r.length-1;l++)i.push(Ie(r[l],r[l+1]));return i.push(Ie(r[r.length-1],r[0])),i},R6=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],go=e=>{let t=Math.floor(e.width/2)+1,n=0,o=e.width,i=Math.floor(e.height/2)+1,r=t,a=e.height;return[t,n,o,i,r,a,0,i]},Bc=(e,t,n,o,i)=>{let r=1-e;return Math.pow(r,3)*t+3*Math.pow(r,2)*e*n+3*r*Math.pow(e,2)*o+Math.pow(e,3)*i},Gc=(e,t,n,o)=>{let i=t-e,r=n-t,a=o-n,s=3*i-6*r+3*a,l=6*r-6*i,d=3*i,c=l*l-4*s*d;if(!(c>=0))return!1;let h=null,m=null,g=1/0,f=1/0;return s===0?g=f=-d/l:(g=(-l+Math.sqrt(c))/(2*s),f=(-l-Math.sqrt(c))/(2*s)),g>=0&&g<=1&&(h=Bc(g,e,t,n,o)),f>=0&&f<=1&&(m=Bc(f,e,t,n,o)),[h,m]},$i=(e,t,n,o)=>{let i=Gc(e[0],t[0],n[0],o[0]),r=Gc(e[1],t[1],n[1],o[1]),a=Math.min(e[0],o[0]),s=Math.max(e[0],o[0]);if(i){let c=i.filter(p=>p!==null);a=Math.min(a,...c),s=Math.max(s,...c)}let l=Math.min(e[1],o[1]),d=Math.max(e[1],o[1]);if(r){let c=r.filter(p=>p!==null);l=Math.min(l,...c),d=Math.max(d,...c)}return[a,l,s,d]},si=(e,t)=>{let n=B(0,0),{minX:o,minY:i,maxX:r,maxY:a}=e.reduce((s,{op:l,data:d})=>{if(l==="move"){let c=Oc(d);ts(c!=null,"Op data is not a point"),n=c}else if(l==="bcurveTo"){let c=B(d[0],d[1]),p=B(d[2],d[3]),h=B(d[4],d[5]),m=t?t(c):c,g=t?t(p):p,f=t?t(h):h,E=t?t(n):n;n=h;let[x,y,w,M]=$i(E,m,g,f);s.minX=Math.min(s.minX,x),s.minY=Math.min(s.minY,y),s.maxX=Math.max(s.maxX,w),s.maxY=Math.max(s.maxY,M)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[o,i,r,a]},is=(e,t=0)=>{let n=1/0,o=1/0,i=-1/0,r=-1/0;for(let[a,s]of e)n=Math.min(n,a),o=Math.min(o,s),i=Math.max(i,a),r=Math.max(r,s);return[n-t,o-t,i+t,r+t]},D0=e=>{let[t,n,o,i]=is(e.points),r=t+e.x,a=n+e.y,s=o+e.x,l=i+e.y;return[r,a,s,l,(r+s)/2,(a+l)/2]},B0=20,G0=15,O0=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;case"cardinality_many":case"cardinality_one_or_many":case"cardinality_zero_or_many":return G0;case"cardinality_one":case"cardinality_exactly_one":case"cardinality_zero_or_one":return B0;default:return 15}},R0=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},ot=(e,t,n,o,i=0)=>{if(o===null||t.length<1)return null;let r=Kt(t[0]);if(r.length<1)return null;let a=n==="start"?1:r.length-1,s=r[a].data;ts(s.length===6,"Op data length is not 6");let l=B(s[4],s[5]),d=B(s[2],s[3]),c=B(s[0],s[1]),p=r[a-1],h=B(0,0);if(p.op==="move"){let T=Oc(p.data);ts(T!=null,"Op data is not a point"),h=T}else p.op==="bcurveTo"&&(h=B(p.data[4],p.data[5]));let m=(T,z)=>Math.pow(1-T,3)*l[z]+3*T*Math.pow(1-T,2)*d[z]+3*Math.pow(T,2)*(1-T)*c[z]+h[z]*Math.pow(T,3),[g,f]=n==="start"?h:l,[E,x]=[m(.3,0),m(.3,1)],y=Math.hypot(g-E,f-x),w=(g-E)/y,M=(f-x)/y,b=O0(o),S=0;{let[T,z]=n==="end"?e.points[e.points.length-1]:e.points[0],[_,he]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];S=Math.hypot(T-_,z-he)}let k=Math.min(b,S*(o==="diamond"||o==="diamond_outline"?.25:.5)),A=g-w*k*i,O=f-M*k*i,G=A-w*k,R=O-M*k;if(o==="circle"||o==="circle_outline"){let T=Math.hypot(R-O,G-A)+e.strokeWidth-2;return[A,O,T]}let C=R0(o);if(o==="cardinality_many"||o==="cardinality_one_or_many"){let[T,z]=le(B(A,O),B(G,R),es(-C)),[_,he]=le(B(A,O),B(G,R),es(C));return[G,R,T,z,_,he]}let[j,W]=le(B(G,R),B(A,O),-C*Math.PI/180),[q,N]=le(B(G,R),B(A,O),es(C));if(o==="diamond"||o==="diamond_outline"){let T,z;if(n==="start"){let[_,he]=e.points.length>1?e.points[1]:[0,0];[T,z]=le(B(A+k*2,O),B(A,O),Math.atan2(he-O,_-A))}else{let[_,he]=e.points.length>1?e.points[e.points.length-2]:[0,0];[T,z]=le(B(A-k*2,O),B(A,O),Math.atan2(O-he,A-_))}return[A,O,j,W,T,z,q,N]}return[A,O,j,W,q,N]},F0=e=>{let t=po.generator(),n=ht(e),o=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[o](e.points,n)},N0=(e,t,n,o)=>{let i=te(e,o);if(e.points.length<2){let[p,h]=e.points[0],[m,g]=le(B(e.x+p,e.y+h),B(t,n),e.angle),f=[m,g,m,g];if(i){let E=F.getMinMaxXYWithBoundText(e,o,[m,g,m,g],i);f=[E[0],E[1],E[2],E[3]]}return f}let a=wt.get(e,null)?.[0]??F0(e),s=Kt(a),d=si(s,([p,h])=>le(B(e.x+p,e.y+h),B(t,n),e.angle)),c=[d[0],d[1],d[2],d[3]];if(i){let p=F.getMinMaxXYWithBoundText(e,o,c,i);c=[p[0],p[1],p[2],p[3]]}return c},Ee=(e,t,n=!1)=>ns.getBounds(e,t,n),tt=(e,t)=>{if(!k0(e))return[0,0,0,0];let n=1/0,o=-1/0,i=1/0,r=-1/0,a=t||os(e);return e.forEach(s=>{let[l,d,c,p]=Ee(s,a);n=Math.min(n,l),i=Math.min(i,d),o=Math.max(o,c),r=Math.max(r,p)}),[n,i,o,r]},F6=(e,t)=>{let[n,o,i,r]=tt(e);return[n+t.x,o+t.y,i+t.x,r+t.y]},bn=(e,t,n,o)=>{if(!(ae(e)||He(e)))return[e.x,e.y,e.x+t,e.y+n];let i=Lc(0,t,Lc(1,n,e.points,o),o),r;if(He(e))r=is(i);else{let c=po.generator(),p=e.roundness?c.curve(i,ht(e)):c.linearPath(i,ht(e)),h=Kt(p);r=si(h)}let[a,s,l,d]=r;return[a+e.x,s+e.y,l+e.x,d+e.y]},Ya=(e,t)=>{let n=po.generator(),o=e.roundness==null?n.linearPath(t,ht(e)):n.curve(t,ht(e)),i=Kt(o),[r,a,s,l]=si(i);return[r+e.x,a+e.y,s+e.x,l+e.y]},N6=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,o=e[0],i=os(e);return e.forEach(r=>{let[a,s,l,d]=Ee(r,i),c=T0(B((a+l)/2,(s+d)/2),B(t.x,t.y));c<n&&(n=c,o=r)}),Ee(o,i)},Ke=e=>{let[t,n,o,i]=tt(e);return{minX:t,minY:n,maxX:o,maxY:i,width:o-t,height:i-n,midX:(t+o)/2,midY:(n+i)/2}},H6=({scrollX:e,scrollY:t,width:n,height:o,zoom:i})=>[-e,-t,-e+n/i.value,-t+o/i.value],kn=e=>B(e[0]+(e[2]-e[0])/2,e[1]+(e[3]-e[1])/2),It=(e,t,n)=>{let o={minX:e.x,minY:e.y,maxX:e.x+e.width,maxY:e.y+e.height,midX:e.x+e.width/2,midY:e.y+e.height/2},i=me(e,t),[r,a]=le(B(o.minX,o.minY),i,e.angle),[s,l]=le(B(o.maxX,o.minY),i,e.angle),[d,c]=le(B(o.maxX,o.maxY),i,e.angle),[p,h]=le(B(o.minX,o.maxY),i,e.angle),m=[Math.min(r,s,d,p),Math.min(a,l,c,h),Math.max(r,s,d,p),Math.max(a,l,c,h)];if(n){let[g,f,E,x]=n;return[m[0]-x,m[1]-g,m[2]+f,m[3]+E]}return m},Vt=(e,t)=>e[0]>t[0]&&e[0]<t[2]&&e[1]>t[1]&&e[1]<t[3],H0=(e,t)=>e[0]>=t[0]&&e[0]<=t[2]&&e[1]>=t[1]&&e[1]<=t[3],dn=(e,t)=>{if(e==null||t==null)return!1;let[n,o,i,r]=e,[a,s,l,d]=t;return n<l&&i>a&&o<d&&r>s},_a=(e,t)=>[B(t[0],t[1]),B(t[0],t[3]),B(t[2],t[1]),B(t[2],t[3])].every(n=>H0(n,e)),Wd=({elements:e,elementsMap:t,bounds:n,type:o,excludeElementsInFrames:i,shouldIgnoreElementFromSelection:r})=>{t||(t=os(e));let a=Al(n)?Ee(n,t):n,[s,l,d,c]=a,p=[Ie(B(s,l),B(d,l)),Ie(B(d,l),B(d,c)),Ie(B(d,c),B(s,c)),Ie(B(s,c),B(s,l))],h=i?new Set:null,m={},g=new Set;for(let f of e){if(r?.(f))continue;let E=f.groupIds.at(-1);E&&(m[E]||(m[E]=[]),m[E].push(f));let x=f.strokeWidth,y=null,w=Ee(f,t);w=[w[0]-x/2,w[1]-x/2,w[2]+x/2,w[3]+x/2];let M=Y(f)&&te(f,t);if(M){let{x:v,y:k}=F.getBoundTextElementPosition(f,M,t);y=[v,k,v+M.width,k+M.height]}let b=Rn(f,t);if(b&&On(f,b,t)){let v=Ee(b,t);w=[Math.max(w[0],v[0]),Math.max(w[1],v[1]),Math.min(w[2],v[2]),Math.min(w[3],v[3])],y=y?[Math.max(y[0],v[0]),Math.max(y[1],v[1]),Math.min(y[2],v[2]),Math.min(y[3],v[3])]:null}let S=y?[Math.min(y[0],w[0]),Math.min(y[1],w[1]),Math.max(y[2],w[2]),Math.max(y[3],w[3])]:w;if(_a(a,S)){h&&oe(f)&&h.add(f.id),g.add(f);continue}if(o==="overlap"&&y&&dn(a,y)){g.add(f);continue}if(o==="overlap"&&dn(a,w)){let v=!1;if(ae(f)||He(f)){let k=me(f,t);v=f.points.some(A=>{let O=le(B(f.x+A[0],f.y+A[1]),k,f.angle);return Vt(O,a)})}else{let k=Ee(f,t,!0),A=me(f,t);v=[le(B((k[0]+k[2])/2,k[1]),A,f.angle),le(B(k[2],(k[1]+k[3])/2),A,f.angle),le(B((k[0]+k[2])/2,k[3]),A,f.angle),le(B(k[0],(k[1]+k[3])/2),A,f.angle)].some(O=>Vt(le(O,A,f.angle),a))}if(v||(v=p.some(k=>jt(f,t,k,x/2,!0).length>0)),v){h&&oe(f)&&h.add(f.id),g.add(f);continue}}}return h&&g.forEach(f=>{f.frameId&&h.has(f.frameId)&&g.delete(f)}),o==="overlap"?Array.from(g).forEach(f=>{let E=f.groupIds.at(-1);(E?m[E]:null)?.forEach(y=>g.add(y))}):o==="contain"&&g.forEach(f=>{let E=f.groupIds.at(-1),x=E?m[E]:null;x&&!x.every(y=>g.has(y))&&g.delete(f)}),e.filter(f=>g.has(f))},me=(e,t,n=0,o=0)=>{if(ae(e)||He(e)){let[a,s,l,d]=ee(e,t),[c,p]=B((a+l)/2,(s+d)/2);return B(c+n,p+o)}let[i,r]=kn(Ee(e,t));return B(i+n,r+o)};var j0=.1,Fc=e=>ae(e)||He(e)?e.points.length<2||e.points.length===2&&Y(e)&&W0(e.points[0],e.points[e.points.length-1],j0):e.width===0&&e.height===0,jd=(e,t,n,o,i)=>{let[r,a,s,l]=Ee(e,i),d=gr({clientX:o.offsetLeft,clientY:o.offsetTop},o),c=gr({clientX:o.offsetLeft+t,clientY:o.offsetTop+n},o);return d.x<=s&&d.y<=l&&c.x>=r&&c.y>=a},X6=(e,t,n,o,i,r)=>{let[a,s,l,d]=tt(e,i),c=gr({clientX:o.offsetLeft+(r?.left||0),clientY:o.offsetTop+(r?.top||0)},o),p=gr({clientX:o.offsetLeft+t-(r?.right||0),clientY:o.offsetTop+n-(r?.bottom||0)},o);return a>=c.x&&s>=c.y&&l<=p.x&&d<=p.y},rs=(e,t,n)=>{let o=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let r=Math.round(Math.atan(i/o)/fn)*fn;r===0?n=0:r===Math.PI/2?t=0:n=o*Math.tan(r)*Math.sign(n)||n}else e!=="selection"&&(n=o*Math.sign(n));return{width:t,height:n}},cc=(e,t,n,o,i)=>{let r=n-e,a=o-t,s=Math.atan2(a,r),l=Math.round(s/fn)*fn;if(i){let d=Math.floor(i/fn)*fn;z0(s,d,d+fn)&&(_0(s,i)<fn/6?l=i:Rc(s)>Rc(i)?l=d+fn:l=d)}if(l===0)a=0;else if(l===Math.PI/2)r=0;else{let d=Math.tan(l),c=-1,p=t-d*e,h=-1/d,m=-1,g=o-h*n,f=(c*g-m*p)/(d*m-h*c),E=(p*h-g*d)/(d*m-h*c);r=f-e,a=E-t}return{width:r,height:a}},$6=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t};I();var e4=(e,t,n,o)=>{let i=ur(e,n.getNonDeletedElementsMap(),o),r=Ke(e);return i.flatMap(a=>{let s=V0(a,r,t);return a.map(l=>{let d=n.mutateElement(l,{x:l.x+s.x,y:l.y+s.y});return qe(l,n,{simultaneouslyUpdated:a}),d})})},V0=(e,t,{axis:n,position:o})=>{let i=Ke(e),[r,a]=n==="x"?["minX","maxX"]:["minY","maxY"],s={x:0,y:0};return o==="start"?{...s,[n]:t[r]-i[r]}:o==="end"?{...s,[n]:t[a]-i[a]}:{...s,[n]:(t[r]+t[a])/2-(i[r]+i[a])/2}};I();I();var Er=class{root;gap;constructor(t=0){this.root=null,this.gap=t}fit(t){let n=t.length,o=n>0?t[0].w:0,i=n>0?t[0].h:0;this.root={x:0,y:0,w:o,h:i};for(let r=0;r<n;r++){let a=t[r],s=this.findNode(this.root,a.w,a.h);s?a.fit=this.splitNode(s,a.w,a.h):a.fit=this.growNode(a.w,a.h)}}findNode(t,n,o){return t?t.used?this.findNode(t.right||null,n,o)||this.findNode(t.down||null,n,o):n<=t.w&&o<=t.h?t:null:null}splitNode(t,n,o){return t.used=!0,t.down={x:t.x,y:t.y+o+this.gap,w:t.w,h:t.h-o-this.gap},t.right={x:t.x+n+this.gap,y:t.y,w:t.w-n-this.gap,h:o},t}growNode(t,n){if(!this.root)return null;let o=t<=this.root.w,i=n<=this.root.h,r=i&&this.root.h>=this.root.w+t+this.gap,a=o&&this.root.w>=this.root.h+n+this.gap;return r?this.growRight(t,n):a?this.growDown(t,n):i?this.growRight(t,n):o?this.growDown(t,n):null}growRight(t,n){if(!this.root)return null;this.root={used:!0,x:0,y:0,w:this.root.w+t+this.gap,h:this.root.h,down:this.root,right:{x:this.root.w+this.gap,y:0,w:t,h:this.root.h}};let o=this.findNode(this.root,t,n);return o?this.splitNode(o,t,n):null}growDown(t,n){if(!this.root)return null;this.root={used:!0,x:0,y:0,w:this.root.w,h:this.root.h+n+this.gap,down:{x:0,y:this.root.h+this.gap,w:this.root.w,h:n},right:this.root};let o=this.findNode(this.root,t,n);return o?this.splitNode(o,t,n):null}};I();var U0=[1,1.08,1.18,1.32,1.5,1.75,2.1,2.6,3.25],Y0=[1,4/3,3/4,3/2,2/3,2,1/2],X0=(e,t)=>{let n=Math.max(e.length,t.length);for(let o=0;o<n;o++){let i=(e[o]??0)-(t[o]??0);if(i!==0)return i}return 0},$0=(e,t)=>t.packedW*t.packedH-e.packedW*e.packedH||Math.max(t.packedW,t.packedH)-Math.max(e.packedW,e.packedH)||t.packedH-e.packedH||t.packedW-e.packedW,Nc=(e,t,n)=>Math.min(Math.max(e,t),n),Z0=(e,t)=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y,q0=(e,t)=>t.x>=e.x&&t.y>=e.y&&t.x+t.w<=e.x+e.w&&t.y+t.h<=e.y+e.h,Hc=e=>{let t=e.filter(n=>n.fit);return t.length===0?null:t.reduce((n,o)=>({minX:Math.min(n.minX,o.fit.x),minY:Math.min(n.minY,o.fit.y),maxX:Math.max(n.maxX,o.fit.x+o.actualW),maxY:Math.max(n.maxY,o.fit.y+o.actualH)}),{minX:t[0].fit.x,minY:t[0].fit.y,maxX:t[0].fit.x+t[0].actualW,maxY:t[0].fit.y+t[0].actualH})},K0=(e,t)=>{let n=(t.minX+t.maxX)/2,o=(t.minY+t.maxY)/2;return e.reduce((i,r)=>{if(!r.fit)return i;let a=r.fit.x+r.actualW/2,s=r.fit.y+r.actualH/2;return i+Math.abs(a-n)+Math.abs(s-o)},0)},Q0=e=>{let t=[];e:for(let n=0;n<e.length;n++){let o=e[n];if(!(o.w<=0||o.h<=0)){for(let i=0;i<e.length;i++)if(n!==i&&q0(e[i],o))continue e;t.some(i=>i.x===o.x&&i.y===o.y&&i.w===o.w&&i.h===o.h)||t.push(o)}}return t},J0=(e,t)=>{let n=[];for(let o of e){if(!Z0(o,t)){n.push(o);continue}t.x>o.x&&n.push({x:o.x,y:o.y,w:t.x-o.x,h:o.h}),t.x+t.w<o.x+o.w&&n.push({x:t.x+t.w,y:o.y,w:o.x+o.w-(t.x+t.w),h:o.h}),t.y>o.y&&n.push({x:o.x,y:o.y,w:o.w,h:t.y-o.y}),t.y+t.h<o.y+o.h&&n.push({x:o.x,y:t.y+t.h,w:o.w,h:o.y+o.h-(t.y+t.h)})}return Q0(n)},ef=(e,t,n,o)=>{let i=e.x+e.w-t.packedW,r=e.y+e.h-t.packedH,a=[{x:e.x,y:e.y},{x:i,y:e.y},{x:e.x,y:r},{x:i,y:r}];return n==="center-distance"&&a.push({x:Nc(o.x-t.actualW/2,e.x,i),y:Nc(o.y-t.actualH/2,e.y,r)}),a.filter((s,l,d)=>d.findIndex(c=>c.x===s.x&&c.y===s.y)===l)},tf=(e,t,n,o,i,r,a)=>{let s=e.w*e.h-t.packedW*t.packedH,l=e.w-t.packedW,d=e.h-t.packedH,c=Math.min(l,d),p=Math.max(l,d);if(o==="best-area-fit")return[s,c,p,n.y,n.x];let h=i?{x:(i.minX+i.maxX)/2,y:(i.minY+i.maxY)/2}:{x:r/2,y:a/2},m=n.x+t.actualW/2,g=n.y+t.actualH/2,f=Math.abs(m-h.x)+Math.abs(g-h.y),E=i?{minX:Math.min(i.minX,n.x),minY:Math.min(i.minY,n.y),maxX:Math.max(i.maxX,n.x+t.actualW),maxY:Math.max(i.maxY,n.y+t.actualH)}:{minX:n.x,minY:n.y,maxX:n.x+t.actualW,maxY:n.y+t.actualH},x=E.maxX-E.minX,y=E.maxY-E.minY,w=x*y;return[f,w,s,c,p]},nf=(e,t,n,o)=>{let i=[{x:0,y:0,w:t,h:n}];for(let l of e){let d=Hc(e),c=null;for(let p of i){if(l.packedW>p.w||l.packedH>p.h)continue;let h=d?{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2}:{x:t/2,y:n/2},m=ef(p,l,o,h);for(let g of m){let f=tf(p,l,g,o,d,t,n);(!c||X0(f,c.score)<0)&&(c={x:g.x,y:g.y,score:f})}}if(!c)return null;l.fit={x:c.x,y:c.y},i=J0(i,{x:c.x,y:c.y,w:l.packedW,h:l.packedH})}let r=Hc(e);if(!r)return{width:0,height:0,spread:0};let a=r.minX,s=r.minY;return e.forEach(l=>{l.fit&&(l.fit={x:l.fit.x-a,y:l.fit.y-s})}),{width:r.maxX-r.minX,height:r.maxY-r.minY,spread:K0(e,{minX:0,minY:0,maxX:r.maxX-r.minX,maxY:r.maxY-r.minY})}},zc=(e,t={})=>{let n=Math.max(t.gap??0,0),o=t.heuristic??"best-area-fit";if(e.forEach(d=>{d.fit=null}),e.length===0)return{width:0,height:0};let i=e.map(d=>({source:d,actualW:d.w,actualH:d.h,packedW:d.w+n,packedH:d.h+n,fit:null})).sort($0),r=i.reduce((d,c)=>d+c.packedW*c.packedH,0),a=Math.max(...i.map(d=>d.packedW)),s=Math.max(...i.map(d=>d.packedH)),l=null;for(let d of U0){let c=r*d;for(let p of Y0){let h=Math.max(a,Math.ceil(Math.sqrt(c*p))),m=Math.max(s,Math.ceil(c/h)),g=i.map(M=>({...M,fit:null})),f=nf(g,h,m,o);if(!f)continue;let E={width:f.width,height:f.height,spread:f.spread,blocks:g};if(!l){l=E;continue}let x=E.width*E.height-l.width*l.height,y=Math.abs(E.width-E.height),w=Math.abs(l.width-l.height);(x<0||x===0&&(y<w||y===w&&(E.spread<l.spread||E.spread===l.spread&&E.width+E.height<l.width+l.height)))&&(l=E)}if(l)break}return l?(l.blocks.forEach(d=>{d.source.fit=d.fit}),{width:l.width,height:l.height}):null};var of=(e,t,n)=>{let o=Ke(t),i=n.x-o.minX,r=n.y-o.minY;t.forEach(a=>{e.mutateElement(a,{x:a.x+i,y:a.y+r})})},_c=e=>e.map(t=>({w:t.boundingBox.width,h:t.boundingBox.height,group:t.group})).sort((t,n)=>n.w*n.h-t.w*t.h||Math.max(n.w,n.h)-Math.max(t.w,t.h)||n.h-t.h||n.w-t.w),Wc=(e,t,n)=>{let o=t.filter(i=>i.fit);return o.forEach(i=>{of(e,i.group,{x:n.x+(i.fit?.x??0),y:n.y+(i.fit?.y??0)})}),o.flatMap(i=>i.group)},jc=(e,t,n)=>{let o=t.flatMap(l=>l.group),i=Ke(o),r={x:i.minX,y:i.minY},a=_c(t);return new Er(n).fit(a),Wc(e,a,r)},as=(e,t,n,o)=>{let i=t.flatMap(d=>d.group),r=Ke(i),a={x:r.minX,y:r.minY},s=_c(t);return zc(s,{gap:n,heuristic:o})?Wc(e,s,a):(console.warn(`Packing heuristic [${o}] failed - using binary tree packer`),jc(e,t,n))},u4=(e,t,n,o,i)=>{let a=cr(t,n).map(s=>({group:s,boundingBox:Ke(s)}));switch(o){case"bin-packing":case"bin-packing-center":return as(e,a,i,"center-distance");case"bin-packing-max-rects":return as(e,a,i,"best-area-fit");case"bin-packing-binary-tree":return jc(e,a,i);default:return console.warn(`Unimplemented algorithm [${o}] - using bin-packing`),as(e,a,i,"center-distance")}};I();import{arrayToMap as Kf,arrayToObject as gn,assertNever as du,isDevEnv as jn,isShallowEqual as cu,isTestEnv as Vn,randomInteger as lu}from"@excalidraw/common";I();import{assertNever as ff,COLOR_PALETTE as gf,isDevEnv as Ef,isTestEnv as xf,randomId as yf,Emitter as Yc,toIterable as So}from"@excalidraw/common";I();import{ORIG_ID as lf,randomId as Uc,randomInteger as df,arrayToMap as cf,castArray as ss,findLastIndex as Io,getUpdatedTimestamp as uf,isTestEnv as pf}from"@excalidraw/common";I();import{arrayToMap as rf}from"@excalidraw/common";var af=e=>{let t=(i,r)=>i.groupIds[i.groupIds.length-r-1],n=(i,r)=>{let a=new Map,s=[];for(let l of i){let d=t(l,r);if(d===void 0){s.push(l);continue}let c=a.get(d);c||(c=[],a.set(d,c),s.push(d)),c.push(l)}return s.flatMap(l=>typeof l=="string"?n(a.get(l),r+1):[l])},o=n(e,0);return o.length!==e.length?(console.error("defragmentGroups: lost some elements... bailing!"),e):o},sf=e=>{let t=rf(e),n=new Set;for(let o of e)if(!n.has(o)){if(o.boundElements?.length){n.add(o);for(let i of o.boundElements){let r=t.get(i.id);r&&i.type==="text"&&n.add(r)}continue}o.type==="text"&&o.containerId&&t.get(o.containerId)?.boundElements?.some(i=>i.id===o.id)||n.add(o)}return n.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...n]},Vc=e=>sf(af(e));var hf=(e,t,n,o)=>{let i=ds(n);return pf()&&mf(i,n.id),i.id=Uc(),i.updated=uf(),o&&(i.seed=df(),yd(i)),i.groupIds=Xd(i.groupIds,e,r=>(t.has(r)||t.set(r,Uc()),t.get(r))),i},S4=e=>{let{elements:t}=e,n="appState"in e?e.appState:{editingGroupId:null,selectedGroupIds:{}},o=new Map,i=new Map,r=[],a=[],s=new Map,l=new Map,d=new Map,c=cf(t),p=e.type==="in-place"?e.idsOfElementsToDuplicate:new Map(t.map(x=>[x.id,x])),h=e.type==="everything"&&e.preserveFrameChildrenOrder;if(e.type==="in-place")for(let x of Object.keys(e.appState.selectedGroupIds))t.filter(y=>y.groupIds?.includes(x)).forEach(y=>p.set(y.id,y));t=Vc(t);let m=t.slice(),g=x=>{let w=ss(x).reduce((M,b)=>{if(o.has(b.id))return M;o.set(b.id,!0);let S=hf(n.editingGroupId,i,b,e.randomizeSeed);return o.set(S.id,!0),d.set(S.id,S),s.set(b.id,S.id),l.set(S.id,b),a.push(b),r.push(S),M.push(S),M},[]);return Array.isArray(x)?w:w[0]||null},f=(x,y)=>{if(y){if(x>m.length-1){m.push(...ss(y));return}m.splice(x+1,0,...ss(y))}},E=new Set(t.filter(x=>p.has(x.id)&&oe(x)).map(x=>x.id));for(let x of t){if(o.has(x.id)||!p.has(x.id))continue;let y=ja(n,x);if(y){let w=et(t,y).flatMap(b=>oe(b)&&!h?[...Nn(t,b.id),b]:[b]),M=Io(m,b=>b.groupIds?.includes(y));f(M,g(w));continue}if(!(!h&&x.frameId&&E.has(x.frameId))){if(oe(x)){let w=x.id;if(h){f(Io(m,S=>S.id===w),g(x));continue}let M=Nn(t,w),b=Io(m,S=>S.frameId===w||S.id===w);f(b,g([...M,x]));continue}if(zt(x)){let w=te(x,c),M=Io(m,b=>b.id===x.id||"containerId"in b&&b.containerId===x.id);w?f(M,g([x,w])):f(M,g(x));continue}if(ke(x)){let w=Xe(x,c),M=Io(m,b=>b.id===x.id||b.id===w?.id);w?f(M,g([w,x])):f(M,g(x));continue}f(Io(m,w=>w.id===x.id),g(x))}}if(kd(r,s,d),Od(m,a,s),e.overrides)for(let x of r){let y=l.get(x.id);y&&Object.assign(x,e.overrides({duplicateElement:x,origElement:y,origIdToDuplicateId:s}))}return{duplicatedElements:r,duplicateElementsMap:d,elementsWithDuplicates:m,origIdToDuplicateId:s}},ls=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let o=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;o[i]=ls(e[i],t+1)}return o}if(Array.isArray(e)){let o=e.length,i=new Array(o);for(;o--;)i[o]=ls(e[o],t+1);return i}return D.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},ds=e=>ls(e),mf=(e,t)=>{Object.defineProperty(e,lf,{value:t,writable:!1,enumerable:!1})};var mt={IMMEDIATELY:"IMMEDIATELY",NEVER:"NEVER",EVENTUALLY:"EVENTUALLY"},Xc=class{constructor(t){this.app=t}onDurableIncrementEmitter=new Yc;onStoreIncrementEmitter=new Yc;scheduledMacroActions=new Set;scheduledMicroActions=[];_snapshot=Wn.empty();get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}scheduleAction(t){this.scheduledMacroActions.add(t),this.satisfiesScheduledActionsInvariant()}scheduleCapture(){this.scheduleAction(mt.IMMEDIATELY)}scheduleMicroAction(t){let{action:n}=t,o;if("change"in t)o=t.change;else{let r=Wn.create(this.app.scene.getElementsMapIncludingDeleted(),this.app.state),a=r.maybeClone(n,t.elements?Bd(t.elements):void 0,t.appState);o=mi.create(r,a)}let i="delta"in t?t.delta:void 0;this.scheduledMicroActions.push(()=>this.processAction({action:n,change:o,delta:i}))}commit(t,n){this.flushMicroActions();try{let o=this.getScheduledMacroAction();this.processAction({action:o,elements:t,appState:n})}finally{this.satisfiesScheduledActionsInvariant(),this.scheduledMacroActions=new Set}}clear(){this.snapshot=Wn.empty(),this.scheduledMacroActions=new Set}emitDurableIncrement(t,n=void 0,o=void 0){let i=this.snapshot,r,a;if(n?r=n:r=mi.create(i,t),o?a=o:a=ps.calculate(i,t),!a.isEmpty()){let s=new cs(r,a);this.onDurableIncrementEmitter.trigger(s),this.onStoreIncrementEmitter.trigger(s)}}emitEphemeralIncrement(t,n=void 0){let o;if(n)o=n;else{let r=this.snapshot;o=mi.create(r,t)}let i=new us(o);this.onStoreIncrementEmitter.trigger(i)}applyChangeToSnapshot(t){let n=this.snapshot,o=this.snapshot.applyChange(t);return n===o?null:o}maybeCloneSnapshot(t,n,o){if(!n&&!o)return null;let i=this.snapshot,r=this.snapshot.maybeClone(t,n,o);return i===r?null:r}flushMicroActions(){for(let t of this.scheduledMicroActions)try{t()}catch(n){console.error("Failed to execute scheduled micro action",n)}this.scheduledMicroActions=[]}processAction(t){let{action:n}=t;if(n===mt.EVENTUALLY&&!this.onStoreIncrementEmitter.subscribers.length)return;let o;if("change"in t?o=this.applyChangeToSnapshot(t.change):o=this.maybeCloneSnapshot(n,t.elements,t.appState),!o)return;let i="change"in t?t.change:void 0,r="delta"in t?t.delta:void 0;try{switch(n){case mt.IMMEDIATELY:this.emitDurableIncrement(o,i,r);break;case mt.NEVER:case mt.EVENTUALLY:this.emitEphemeralIncrement(o,i);break;default:ff(n,"Unknown store action")}}finally{switch(n){case mt.IMMEDIATELY:case mt.NEVER:this.snapshot=o;break}}}getScheduledMacroAction(){let t;return this.scheduledMacroActions.has(mt.IMMEDIATELY)?t=mt.IMMEDIATELY:this.scheduledMacroActions.has(mt.NEVER)?t=mt.NEVER:t=mt.EVENTUALLY,t}satisfiesScheduledActionsInvariant(){if(!(this.scheduledMacroActions.size>=0&&this.scheduledMacroActions.size<=Object.keys(mt).length)){let t=`There can be at most three store actions scheduled at the same time, but there are "${this.scheduledMacroActions.size}".`;if(console.error(t,this.scheduledMacroActions.values()),xf()||Ef())throw new Error(t)}}},mi=class e{constructor(t,n){this.elements=t;this.appState=n}static create(t,n){let o=n.getChangedElements(t),i=n.getChangedAppState(t);return new e(o,i)}},xr=class{constructor(t,n){this.type=t;this.change=n}static isDurable(t){return t.type==="durable"}static isEphemeral(t){return t.type==="ephemeral"}},cs=class extends xr{constructor(n,o){super("durable",n);this.change=n;this.delta=o}},us=class extends xr{constructor(n){super("ephemeral",n);this.change=n}},ps=class e{constructor(t,n,o){this.id=t;this.elements=n;this.appState=o}static create(t,n,o={id:yf()}){return new this(o.id,t,n)}static calculate(t,n){let o=n.metadata.didElementsChange?_n.calculate(t.elements,n.elements):_n.empty(),i=n.metadata.didAppStateChange?zn.calculate(t.appState,n.appState):zn.empty();return this.create(o,i)}static restore(t){let{id:n,elements:o,appState:i}=t;return new this(n,_n.restore(o),zn.restore(i))}static load({id:t,elements:{added:n,removed:o,updated:i},appState:{delta:r}}){let a=_n.create(n,o,i),s=zn.create(r);return new this(t,a,s)}static squash(...t){let n=e.empty();for(let o of t)n.elements.squash(o.elements),n.appState.squash(o.appState);return n}static inverse(t){return this.create(t.elements.inverse(),t.appState.inverse())}static applyTo(t,n,o,i){let[r,a]=t.elements.applyTo(n,Wn.empty().elements,i),[s,l]=t.appState.applyTo(o,r);return[r,s,a||l]}static applyLatestChanges(t,n,o,i){return this.create(t.elements.applyLatestChanges(n,o,i),t.appState,{id:t.id})}static empty(){return e.create(_n.empty(),zn.empty())}isEmpty(){return this.elements.isEmpty()&&this.appState.isEmpty()}},Wn=class e{constructor(t,n,o={didElementsChange:!1,didAppStateChange:!1,isEmpty:!1}){this.elements=t;this.appState=n;this.metadata=o}_lastChangedElementsHash=0;_lastChangedAppStateHash=0;static create(t,n,o={didElementsChange:!1,didAppStateChange:!1}){return new e(t,$c(n)?n:vo(n),o)}static empty(){return new e(new Map,wf(),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}getChangedElements(t){let n={};for(let o of So(t.elements))this.elements.get(o.id)||(n[o.id]=Je(o,{isDeleted:!0}));for(let o of So(this.elements))t.elements.get(o.id)!==o&&(n[o.id]=o);return n}getChangedAppState(t){return K.getRightDifferences(t.appState,this.appState).reduce((n,o)=>Object.assign(n,{[o]:this.appState[o]}),{})}isEmpty(){return this.metadata.isEmpty}applyChange(t){let n=new Map(this.elements);for(let[i,r]of Object.entries(t.elements))n.set(i,r);let o=vo({...this.appState,...t.appState});return e.create(n,o,{didElementsChange:Object.keys(t.elements).length>0,didAppStateChange:Object.keys(t.appState).length>0})}maybeClone(t,n,o){let i={shouldCompareHashes:!1};t===mt.EVENTUALLY&&(i.shouldCompareHashes=!0);let r=this.maybeCreateElementsSnapshot(n,i),a=this.maybeCreateAppStateSnapshot(o,i),s=!1,l=!1;return this.elements!==r&&(s=!0),this.appState!==a&&(l=!0),!s&&!l?this:new e(r,a,{didElementsChange:s,didAppStateChange:l})}maybeCreateAppStateSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.appState;let o=$c(t)?t:vo(t);return this.detectChangedAppState(o,n)?o:this.appState}maybeCreateElementsSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.elements;let o=this.detectChangedElements(t,n);return o?.size?this.createElementsSnapshot(o):this.elements}detectChangedAppState(t,n={shouldCompareHashes:!1}){if(this.appState===t)return;let o=K.isRightDifferent(this.appState,t);if(!o)return;let i=Kc(JSON.stringify(t));if(!(n.shouldCompareHashes&&this._lastChangedAppStateHash===i))return this._lastChangedAppStateHash=i,o}detectChangedElements(t,n={shouldCompareHashes:!1}){if(this.elements===t)return;let o=new Map;for(let r of So(this.elements))t.get(r.id)||o.set(r.id,Je(r,{isDeleted:!0}));for(let r of So(t)){let a=this.elements.get(r.id);if(!a||a.version<r.version){if(_e(r)&&!Mn(r))continue;o.set(r.id,r)}}if(!o.size)return;let i=qc(o);if(!(n.shouldCompareHashes&&this._lastChangedElementsHash===i))return this._lastChangedElementsHash=i,o}createElementsSnapshot(t){let n=new Map;for(let o of So(this.elements))n.set(o.id,o);for(let o of So(t))n.set(o.id,ds(o));return n}},Zc="__observedAppState",wf=()=>({name:null,editingGroupId:null,viewBackgroundColor:gf.white,selectedElementIds:{},selectedGroupIds:{},selectedLinearElement:null,croppingElementId:null,activeLockedId:null,lockedMultiSelections:{}}),vo=e=>{let t={name:e.name,editingGroupId:e.editingGroupId,viewBackgroundColor:e.viewBackgroundColor,selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,croppingElementId:e.croppingElementId,activeLockedId:e.activeLockedId,lockedMultiSelections:e.lockedMultiSelections,selectedLinearElement:e.selectedLinearElement?{elementId:e.selectedLinearElement.elementId,isEditing:!!e.selectedLinearElement.isEditing}:null};return Reflect.defineProperty(t,Zc,{value:!0,enumerable:!1}),t},$c=e=>!!Reflect.get(e,Zc);I();var su=gi(nu(),1);import{randomInteger as Nf,arrayToMap as Hf,toBrandedType as ou,isDevEnv as iu,isTestEnv as ru,toArray as zf}from"@excalidraw/common";import{isNonDeletedElement as _f}from"@excalidraw/element";import{isFrameLikeElement as Wf}from"@excalidraw/element";import{getElementsInGroup as jf}from"@excalidraw/element";import{syncInvalidIndices as Vf,syncMovedIndices as Uf,validateFractionalIndices as Yf}from"@excalidraw/element";import{getSelectedElements as Xf}from"@excalidraw/element";import{mutateElement as $f}from"@excalidraw/element";var au=e=>{let t=new Map,n=[];for(let o of e)o.isDeleted||(n.push(o),t.set(o.id,o));return{elementsMap:t,elements:n}},Zf=(0,su.default)(e=>{(iu()||ru()||window?.DEBUG_FRACTIONAL_INDICES)&&Yf(e,{shouldThrow:iu()||ru(),includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1}),qf=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let o of t)n+=`${o}:${e[o]?"1":"0"}`;return n},Ao=class{callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=ou(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=ou(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};sceneNonce;getSceneNonce(){return this.sceneNonce}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}constructor(t=null,n){t&&this.replaceAllElements(t,n)}getSelectedElements(t){let n=qf(t),o=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===o&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let r=this.selectedElementsCache.cache.get(n);if(r)return r}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=Xf(o,{selectedElementIds:t.selectedElementIds},t);return 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}getNonDeletedElement(t){let n=this.getElement(t);return n&&_f(n)?n:null}mapElements(t){let n=!1,o=this.elements.map(i=>{let r=t(i);return r!==i&&(n=!0),r});return n&&this.replaceAllElements(o),n}replaceAllElements(t,n){let o=zf(t),i=[];n?.skipValidation||Zf(o),this.elements=Vf(o),this.elementsMap.clear(),this.elements.forEach(a=>{Wf(a)&&i.push(a),this.elementsMap.set(a.id,a)});let r=au(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=i,this.nonDeletedFramesLikes=au(this.frames).elements,this.triggerUpdate()}triggerUpdate(){this.sceneNonce=Nf();for(let t of Array.from(this.callbacks))t()}onUpdate(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.elements=[],this.nonDeletedElements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),this.callbacks.clear()}insertElementsAtIndex(t,n){if(!t.length)return;if(n===null&&(n=this.elements.length),!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let o=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];Uf(o,Hf(t)),this.replaceAllElements(o)}insertElement=t=>{this.insertElementsAtIndex([t],null)};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null;getElementsFromId=t=>{let n=this.getNonDeletedElementsMap(),o=n.get(t);return o?[o]:jf(n,t)};mutateElement(t,n,o={informMutation:!0,isDragging:!1}){let i=this.getNonDeletedElementsMap(),{version:r}=t,{version:a}=$f(t,i,n,o);return this.elementsMap.has(t.id)&&r!==a&&o.informMutation&&this.triggerUpdate(),t}};var K=class e{constructor(t,n){this.deleted=t;this.inserted=n}static create(t,n,o,i){let r=o&&i!=="inserted"?o(t,"deleted"):t,a=o&&i!=="deleted"?o(n,"inserted"):n;return new e(r,a)}static calculate(t,n,o,i){if(t===n)return e.empty();let r={},a={};for(let d of this.getDifferences(t,n))r[d]=t[d],a[d]=n[d];let[s,l]=i?i(r,a):[r,a];return e.create(s,l,o)}static empty(){return new e({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static merge(t,n,o=e.empty()){return e.create({...t.deleted,...n.deleted,...o.deleted},{...t.inserted,...n.inserted,...o.inserted})}static mergeObjects(t,n,o={}){let i={...t};for(let r of Object.keys(o))delete i[r];return{...i,...n}}static mergeArrays(t,n,o,i){return Object.values(e.mergeObjects(gn(t??[],i),gn(n??[],i),gn(o??[],i)))}static diffObjects(t,n,o,i){if(!t[o]&&!n[o])return;let r=t[o]!==null&&typeof t[o]=="object",a=n[o]!==null&&typeof n[o]=="object";if(r||a){let s=t[o]??{},l=n[o]??{},d=e.getLeftDifferences(s,l).reduce((p,h)=>(p[h]=i(s[h]),p),{}),c=e.getRightDifferences(s,l).reduce((p,h)=>(p[h]=i(l[h]),p),{});Object.keys(d).length||Object.keys(c).length?(Reflect.set(t,o,d),Reflect.set(n,o,c)):(Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o))}else t[o]===n[o]&&(Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o))}static diffArrays(t,n,o,i){if(!(!t[o]&&!n[o])&&(Array.isArray(t[o])||Array.isArray(n[o]))){let r=Array.isArray(t[o])?t[o]:[],a=Array.isArray(n[o])?n[o]:[],s=gn(e.getLeftDifferences(gn(r,i),gn(a,i)),d=>d),l=gn(e.getRightDifferences(gn(r,i),gn(a,i)),d=>d);if(Object.keys(s).length||Object.keys(l).length){let d=r.filter(p=>s[i?i(p):String(p)]),c=a.filter(p=>l[i?i(p):String(p)]);Reflect.set(t,o,d),Reflect.set(n,o,c)}else Reflect.deleteProperty(t,o),Reflect.deleteProperty(n,o)}}static isLeftDifferent(t,n,o=!1){return!!this.distinctKeysIterator("left",t,n,o).next().value}static isRightDifferent(t,n,o=!1){return!!this.distinctKeysIterator("right",t,n,o).next().value}static isInnerDifferent(t,n,o=!1){return!!!!this.distinctKeysIterator("inner",t,n,o).next().value}static isDifferent(t,n,o=!1){return!!!!this.distinctKeysIterator("full",t,n,o).next().value}static getLeftDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("left",t,n,o)).sort()}static getRightDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("right",t,n,o)).sort()}static getInnerDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("inner",t,n,o)).sort()}static getDifferences(t,n,o=!1){return Array.from(this.distinctKeysIterator("full",t,n,o)).sort()}static*distinctKeysIterator(t,n,o,i=!1){if(n===o)return;let r=[];t==="left"?r=Object.keys(n):t==="right"?r=Object.keys(o):t==="inner"?r=Object.keys(n).filter(a=>a in o):t==="full"?r=Array.from(new Set([...Object.keys(n),...Object.keys(o)])):du(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let a of r){let s=n[a],l=o[a];if(s!==l){if(!i&&typeof s=="object"&&typeof l=="object"&&s!==null&&l!==null&&cu(s,l))continue;yield a}}}},zn=class e{constructor(t){this.delta=t}static create(t){return new e(t)}static calculate(t,n){let o=K.calculate(t,n,e.orderAppStateKeys,e.postProcess);return new e(o)}static restore(t){let{delta:n}=t;return new e(n)}static empty(){return new e(K.create({},{}))}inverse(){let t=K.create(this.delta.inserted,this.delta.deleted);return new e(t)}squash(t){if(t.isEmpty())return this;let n=K.mergeObjects(this.delta.deleted.selectedElementIds??{},t.delta.deleted.selectedElementIds??{}),o=K.mergeObjects(this.delta.inserted.selectedElementIds??{},t.delta.inserted.selectedElementIds??{}),i=K.mergeObjects(this.delta.deleted.selectedGroupIds??{},t.delta.deleted.selectedGroupIds??{}),r=K.mergeObjects(this.delta.inserted.selectedGroupIds??{},t.delta.inserted.selectedGroupIds??{}),a=K.mergeObjects(this.delta.deleted.lockedMultiSelections??{},t.delta.deleted.lockedMultiSelections??{}),s=K.mergeObjects(this.delta.inserted.lockedMultiSelections??{},t.delta.inserted.lockedMultiSelections??{}),l={},d={};return(Object.keys(n).length||Object.keys(o).length)&&(d.selectedElementIds=n,l.selectedElementIds=o),(Object.keys(i).length||Object.keys(r).length)&&(d.selectedGroupIds=i,l.selectedGroupIds=r),(Object.keys(a).length||Object.keys(s).length)&&(d.lockedMultiSelections=a,l.lockedMultiSelections=s),this.delta=K.merge(this.delta,t.delta,K.create(d,l)),this}applyTo(t,n){try{let{selectedElementIds:o={},selectedGroupIds:i={},lockedMultiSelections:r={}}=this.delta.deleted,{selectedElementIds:a={},selectedGroupIds:s={},lockedMultiSelections:l={},selectedLinearElement:d,...c}=this.delta.inserted,p=K.mergeObjects(t.selectedElementIds,a,o),h=K.mergeObjects(t.selectedGroupIds,s,i),m=K.mergeObjects(t.lockedMultiSelections,l,r),g=d&&n.has(d.elementId)?new F(n.get(d.elementId),n,d.isEditing):null,f={...t,...c,selectedElementIds:p,selectedGroupIds:h,lockedMultiSelections:m,selectedLinearElement:typeof d<"u"?g:t.selectedLinearElement},E=this.filterInvisibleChanges(t,f,n);return[f,E]}catch(o){if(console.error("Couldn't apply appstate change",o),Vn()||jn())throw o;return[t,!1]}}isEmpty(){return K.isEmpty(this.delta)}filterInvisibleChanges(t,n,o){let i=vo(t),r=vo(n),a=K.isRightDifferent(e.stripElementsProps(i),e.stripElementsProps(r)),s=K.isRightDifferent(e.stripStandaloneProps(i),e.stripStandaloneProps(r));if(!a&&!s)return!1;let l={value:a};if(s){let d=K.getRightDifferences(e.stripStandaloneProps(i),e.stripStandaloneProps(r)),c=new Set;(d.includes("editingGroupId")||d.includes("selectedGroupIds"))&&(c=Vd(o));for(let p of d)switch(p){case"selectedElementIds":n[p]=e.filterSelectedElements(n[p],o,l);break;case"selectedGroupIds":n[p]=e.filterSelectedGroups(n[p],c,l);break;case"croppingElementId":{let y=n[p];if(!y)l.value=!0;else{let w=o.get(y);w&&!w.isDeleted?l.value=!0:n[p]=null}break}case"editingGroupId":let h=n[p];h?c.has(h)?l.value=!0:n[p]=null:l.value=!0;break;case"selectedLinearElement":let m=n[p];if(!m)l.value=!0;else{let y=o.get(m.elementId);y&&!y.isDeleted?l.value=!0:n[p]=null}break;case"lockedMultiSelections":let g=t[p]||{},f=n[p]||{};cu(g,f)||(l.value=!0);break;case"activeLockedId":let E=t[p]||null,x=n[p]||null;E!==x&&(l.value=!0);break;default:du(p,`Unknown ObservedElementsAppState's key "${p}"`,!0)}}return l.value}static filterSelectedElements(t,n,o){let i=Object.keys(t);if(!i.length)return o.value=!0,t;let r={...t};for(let a of i){let s=n.get(a);s&&!s.isDeleted?o.value=!0:delete r[a]}return r}static filterSelectedGroups(t,n,o){if(!Object.keys(t).length)return o.value=!0,t;let r={...t};for(let a of Object.keys(r))n.has(a)?o.value=!0:delete r[a];return r}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:o,selectedElementIds:i,selectedLinearElement:r,croppingElementId:a,lockedMultiSelections:s,activeLockedId:l,...d}=t;return d}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:o,...i}=t;return i}static postProcess(t,n){try{K.diffObjects(t,n,"selectedElementIds",o=>!0),K.diffObjects(t,n,"selectedGroupIds",o=>o??!1),K.diffObjects(t,n,"lockedMultiSelections",o=>o??{})}catch(o){if(console.error("Couldn't postprocess appstate change deltas."),Vn()||jn())throw o}finally{return[t,n]}}static orderAppStateKeys(t){let n={};for(let o of Object.keys(t).sort())n[o]=t[o];return n}},_n=class e{constructor(t,n,o){this.added=t;this.removed=n;this.updated=o}static create(t,n,o,i={shouldRedistribute:!1}){let r;if(i.shouldRedistribute){let a={},s={},l={},d=[...Object.entries(t),...Object.entries(n),...Object.entries(o)];for(let[c,p]of d)this.satisfiesAddition(p)?a[c]=p:this.satisfiesRemoval(p)?s[c]=p:l[c]=p;r=new e(a,s,l)}else r=new e(t,n,o);return(Vn()||jn())&&(e.validate(r,"added",this.satisfiesAddition),e.validate(r,"removed",this.satisfiesRemoval),e.validate(r,"updated",this.satisfiesUpdate)),r}static restore(t){let{added:n,removed:o,updated:i}=t;return e.create(n,o,i)}static satisfiesAddition=({deleted:t,inserted:n})=>t.isDeleted===!0&&!n.isDeleted;static satisfiesRemoval=({deleted:t,inserted:n})=>!t.isDeleted&&n.isDeleted===!0;static satisfiesUpdate=({deleted:t,inserted:n})=>!!t.isDeleted==!!n.isDeleted;static satisfiesCommmonInvariants=({deleted:t,inserted:n})=>!!(Number.isInteger(t.version)&&Number.isInteger(n.version)&&t.version>=0&&n.version>=0&&t.version!==n.version);static satisfiesUniqueInvariants=(t,n)=>{let{added:o,removed:i,updated:r}=t;return[o[n],i[n],r[n]].filter(Boolean).length===1};static validate(t,n,o){for(let[i,r]of Object.entries(t[n]))if(!this.satisfiesCommmonInvariants(r)||!this.satisfiesUniqueInvariants(t,i)||!o(r))throw console.error(`Broken invariant for "${n}" delta, element "${i}", delta:`,r),new Error(`ElementsDelta invariant broken for element "${i}".`)}static calculate(t,n){if(t===n)return e.empty();let o={},i={},r={};for(let a of t.values())if(!n.get(a.id)){let l={...a},d={isDeleted:!0,version:a.version+1,versionNonce:lu()},c=K.create(l,d,e.stripIrrelevantProps);a.isDeleted?r[a.id]=c:i[a.id]=c}for(let a of n.values()){let s=t.get(a.id);if(!s){let l={isDeleted:!0,version:a.version-1,versionNonce:lu()},d={...a},c=K.create(l,d,e.stripIrrelevantProps);a.isDeleted?r[a.id]=c:o[a.id]=c;continue}if(s.versionNonce!==a.versionNonce){let l=K.calculate(s,a,e.stripIrrelevantProps,e.postProcess);if(typeof s.isDeleted=="boolean"&&typeof a.isDeleted=="boolean"&&s.isDeleted!==a.isDeleted){s.isDeleted&&!a.isDeleted?o[a.id]=l:i[a.id]=l;continue}r[a.id]=l}}return e.create(o,i,r)}static empty(){return e.create({},{},{})}inverse(){let t=r=>{let a={};for(let[s,{inserted:l,deleted:d}]of Object.entries(r))a[s]=K.create({...l},{...d});return a},n=t(this.added),o=t(this.removed),i=t(this.updated);return e.create(o,n,i)}isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.removed).length===0&&Object.keys(this.updated).length===0}applyLatestChanges(t,n,o){let i=(d,c)=>(p,h)=>{let m;switch(h){case"deleted":m=d;break;case"inserted":m=c;break}if(!m)return console.error("Element not found when trying to apply latest changes"),p;let g={};for(let f of Object.keys(p))switch(f){case"boundElements":g[f]=p[f];break;default:g[f]=m[f]}return g},r=d=>{let c={};for(let[p,h]of Object.entries(d)){let m=t.get(p),g=n.get(p),f=null;m||g?f=K.create(h.deleted,h.inserted,i(m,g),o):f=h,K.isInnerDifferent(f.deleted,f.inserted)&&(c[p]=f)}return c},a=r(this.added),s=r(this.removed),l=r(this.updated);return e.create(a,s,l,{shouldRedistribute:!0})}applyTo(t,n=Wn.empty().elements,o){let i=new Map(t),r,a={containsVisibleDifference:!1,containsZindexDifference:!1,applyDirection:void 0};try{let s=e.createApplier(t,i,n,a,o),l=s(this.added),d=s(this.removed),c=s(this.updated),p=this.resolveConflicts(t,i,a.applyDirection);r=new Map([...l,...d,...c,...p])}catch(s){if(console.error("Couldn't apply elements delta",s),Vn()||jn())throw s;return[t,!0]}try{i=e.reorderElements(i,r,a),e.redrawElements(i,r)}catch(s){if(console.error("Couldn't mutate elements after applying elements change",s),Vn()||jn())throw s}finally{return[i,a.containsVisibleDifference]}}squash(t){if(t.isEmpty())return this;let{added:n,removed:o,updated:i}=t,r=(a,s)=>{let l=K.mergeArrays(a.deleted.boundElements??[],s.deleted.boundElements??[],void 0,c=>c.id)??[],d=K.mergeArrays(a.inserted.boundElements??[],s.inserted.boundElements??[],void 0,c=>c.id)??[];if(!(!l.length&&!d.length))return K.create({boundElements:l},{boundElements:d})};for(let[a,s]of Object.entries(n)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.added[a]=s;else{let d=r(l,s);delete this.removed[a],delete this.updated[a],this.added[a]=K.merge(l,s,d)}}for(let[a,s]of Object.entries(o)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.removed[a]=s;else{let d=r(l,s);delete this.added[a],delete this.updated[a],this.removed[a]=K.merge(l,s,d)}}for(let[a,s]of Object.entries(i)){let l=this.added[a]??this.removed[a]??this.updated[a];if(!l)this.updated[a]=s;else{let d=r(l,s),c=K.merge(l,s,d);l===this.added[a]?this.added[a]=c:l===this.removed[a]?this.removed[a]=c:this.updated[a]=c}}return(Vn()||jn())&&(e.validate(this,"added",e.satisfiesAddition),e.validate(this,"removed",e.satisfiesRemoval),e.validate(this,"updated",e.satisfiesUpdate)),this}static createApplier=(t,n,o,i,r)=>a=>{let s=e.createGetter(n,o,i);return Object.entries(a).reduce((l,[d,c])=>{let p=s(d,c.inserted);if(p){let h=e.applyDelta(p,c,i,r);if(n.set(h.id,h),l.set(h.id,h),!i.applyDirection){let m=t.get(d);m&&(i.applyDirection=m.version>h.version?"backward":"forward")}}return l},new Map)};static createGetter=(t,n,o)=>(i,r)=>{let a=t.get(i);return a||(a=n.get(i),a?(o.containsZindexDifference=!0,(!r.isDeleted||r.isDeleted&&!a.isDeleted)&&(o.containsVisibleDifference=!0)):a=Je({id:i,version:1},{...r})),a};static applyDelta(t,n,o,i){let r={};for(let a of Object.keys(n.inserted)){if(a==="boundElements"||i?.excludedProperties?.has(a))continue;let s=n.inserted[a];Reflect.set(r,a,s)}if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let a=K.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,s=>s.id);Object.assign(r,{boundElements:a})}if(!o.containsVisibleDifference){let{index:a,...s}=r,l=e.checkForVisibleDifference(t,s);o.containsVisibleDifference=l}return o.containsZindexDifference||(o.containsZindexDifference=n.deleted.index!==n.inserted.index),Je(t,r,!0)}static checkForVisibleDifference(t,n){return t.isDeleted&&n.isDeleted!==!1?!1:t.isDeleted&&n.isDeleted===!1||t.isDeleted===!1&&n.isDeleted?!0:K.isRightDifferent(t,n)}resolveConflicts(t,n,o="forward"){let i=new Map,r=(s,l)=>{let d=n.get(s.id);if(!d)return;let c=t.get(s.id),p=o==="forward"?d.version+1:d.version-1,h=l,m;c===d?m=Je(d,{...h,version:p},!0):m=je(d,n,{...h,version:c?.version!==d.version?d.version:p}),i.set(m.id,m),n.set(m.id,m)};for(let s of Object.keys(this.removed))e.unbindAffected(t,n,s,r);for(let s of Object.keys(this.added))e.rebindAffected(t,n,s,r);for(let[s]of Array.from(Object.entries(this.updated)).filter(([l,d])=>Object.keys({...d.deleted,...d.inserted}).find(c=>Td.has(c)))){let l=n.get(s);!l||l.isDeleted||e.rebindAffected(t,n,s,r)}let a=new Map(Array.from(t).filter(([s])=>i.has(s)));return this.squash(e.calculate(a,i)),i}static unbindAffected(t,n,o,i){let r=()=>t.get(o),a=()=>n.get(o);Bn.unbindAffected(n,r(),i),Bn.unbindAffected(n,a(),i),Gn.unbindAffected(n,r(),i),Gn.unbindAffected(n,a(),i)}static rebindAffected(t,n,o,i){let r=()=>t.get(o),a=()=>n.get(o);Bn.unbindAffected(n,r(),i),Bn.rebindAffected(n,a(),i),Gn.unbindAffected(n,r(),(s,l)=>{re(s)&&i(s,l)}),Gn.rebindAffected(n,a(),i)}static redrawElements(t,n){try{let o=new Ao(t,{skipValidation:!0});e.redrawTextBoundingBoxes(o,n),e.redrawBoundArrows(o,n)}catch(o){if(console.error("Couldn't redraw elements",o),Vn()||jn())throw o}finally{return t}}static redrawTextBoundingBoxes(t,n){let o=t.getNonDeletedElementsMap(),i=new Map;for(let r of n.values()){if(ke(r)){let{containerId:a}=r,s=a?o.get(a):void 0;s&&i.set(s.id,{container:s,boundText:r})}if(zt(r)){let a=sn(r),s=a?o.get(a):void 0;s&&i.set(r.id,{container:r,boundText:s})}}for(let{container:r,boundText:a}of i.values())r.isDeleted||a.isDeleted||Ui(a,r,t)}static redrawBoundArrows(t,n){for(let o of n.values())!o.isDeleted&&Ae(o)&&qe(o,t,{changedElements:n})}static reorderElements(t,n,o){if(!o.containsZindexDifference)return t;let i=Array.from(t.values()),r=Dd([...i]),a=K.getRightDifferences(i,r,!0).reduce((s,l)=>{let d=i[Number(l)];return d&&n.has(d.id)&&s.set(d.id,d),s},new Map);return!o.containsVisibleDifference&&a.size&&(o.containsVisibleDifference=!0),Kf(no(r,a))}static postProcess(t,n){try{K.diffArrays(t,n,"boundElements",r=>r.id);let o=t.points??[],i=n.points??[];K.isDifferent(o,i)||(Reflect.deleteProperty(t,"points"),Reflect.deleteProperty(n,"points"))}catch(o){if(console.error("Couldn't postprocess elements delta."),Vn()||jn())throw o}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:o,...i}=t;return i}};I();var l5=(e,t,n,o,i)=>{let[r,a,s,l]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],d=Ke(e),c=ur(e,t,o).map(g=>[g,Ke(g)]).sort((g,f)=>g[1][a]-f[1][a]),p=0;for(let g of c)p+=g[1][l];let h=(d[l]-p)/(c.length-1);if(h<0){let g=c.findIndex(y=>y[1][r]===d[r]),f=c.findIndex(y=>y[1][s]===d[s]),E=(c[f][1][a]-c[g][1][a])/(c.length-1),x=c[g][1][a];return c.flatMap(([y,w],M)=>{let b={x:0,y:0};return M!==g&&M!==f&&(x+=E,b[n.axis]=x-w[a]),y.map(S=>{let v=i.mutateElement(S,{x:S.x+b.x,y:S.y+b.y});return qe(S,i,{simultaneouslyUpdated:y}),v})})}let m=d[r];return c.flatMap(([g,f])=>{let E={x:0,y:0};return E[n.axis]=m-f[r],m+=h,m+=f[l],g.map(x=>{let y=i.mutateElement(x,{x:x.x+E.x,y:x.y+E.y});return qe(x,i,{simultaneouslyUpdated:g}),y})})};I();import{TEXT_AUTOWRAP_THRESHOLD as Qf,getGridPoint as Jf,getFontString as eg,DRAGGING_THRESHOLD as tg}from"@excalidraw/common";var x5=(e,t,n,o,i,r)=>{if(t.length===1&&Z(t[0])&&(t[0].startBinding||t[0].endBinding))return;let a=t.filter(h=>{if(Z(h)&&h.startBinding&&h.endBinding){let m=t.find(f=>f.id===h.startBinding?.elementId),g=t.find(f=>f.id===h.endBinding?.elementId);return m&&g}return!0}),s=new Set(a),l=a.filter(h=>oe(h)).map(h=>h.id);if(l.length>0)for(let h of o.getNonDeletedElements())h.frameId!==null&&l.includes(h.frameId)&&s.add(h);let d=[];for(let h of s){let m=e.originalElements.get(h.id);if(!m)return;d.push(m)}let c=ng(tt(d),n,i,r),p=new Set(Array.from(s,h=>h.id));s.forEach(h=>{let m=!Y(h),g=m||(h.startBinding?p.has(h.startBinding.elementId):!1),f=m||(h.endBinding?p.has(h.endBinding.elementId):!1);if(Y(h)){if(s.size>1||Math.max(Math.abs(c.x),Math.abs(c.y))>tg||!h.startBinding&&!h.endBinding){ms(e,h,o,c);let E=h.startBinding&&!g,x=h.endBinding&&!f;(E||x)&&(E&&Ze(h,"start",o),x&&Ze(h,"end",o))}}else{ms(e,h,o,c);let E=te(h,o.getNonDeletedElementsMap());E&&ms(e,E,o,c),qe(h,o,{simultaneouslyUpdated:Array.from(s)})}})},ng=(e,t,n,o)=>{let[i,r]=e,a=i+t.x+n.x,s=r+t.y+n.y;if(n.x===0||n.y===0){let[l,d]=Jf(i+t.x,r+t.y,o);n.x===0&&(a=l),n.y===0&&(s=d)}return{x:a-i,y:s-r}},ms=(e,t,n,o)=>{let i=e.originalElements.get(t.id)??t,r=i.x+o.x,a=i.y+o.y;n.mutateElement(t,{x:r,y:a})},y5=(e,t,n)=>{let[o,i]=tt(e);return[t-o,n-i]},w5=({newElement:e,elementType:t,originX:n,originY:o,x:i,y:r,width:a,height:s,shouldMaintainAspectRatio:l,shouldResizeFromCenter:d,zoom:c,scene:p,widthAspectRatio:h=null,originOffset:m=null,informMutation:g=!0})=>{l&&e.type!=="selection"&&(h?s=a/h:(Math.abs(r-o)>Math.abs(i-n)?{width:a,height:s}=rs(t,s,i<n?-a:a):{width:a,height:s}=rs(t,a,r<o?-s:s),s<0&&(s=-s)));let f=i<n?n-a:n,E=r<o?o-s:o;d&&(a+=a,s+=s,f=n-a/2,E=o-s/2);let x=null;if(re(e)){s=e.height;let y=_i(eg({fontSize:e.fontSize,fontFamily:e.fontFamily}),e.lineHeight);a=Math.max(a,y),Math.abs(i-n)>Qf/c&&(x={autoResize:!1}),E=o,d&&(f=n-a/2)}if(a!==0&&s!==0){let y=null;_e(e)&&(y={initialWidth:a,initialHeight:s}),p.mutateElement(e,{x:f+(m?.x??0),y:E+(m?.y??0),width:a,height:s,...x,...y},{informMutation:g,isDragging:!1})}};I();import{ELEMENT_LINK_KEY as wr,normalizeLink as uu}from"@excalidraw/common";var S5=(e,t)=>{let n=window.location.href;try{let o=new URL(n);return o.searchParams.set(wr,e),uu(o.toString())}catch(o){console.error(o)}return uu(n)},v5=(e,t)=>{if(e.length>0&&og(e)){if(e.length===1)return{id:e[0].id,type:"element"};if(e.length>1){let n=Object.keys(t.selectedGroupIds)[0];return n?{id:n,type:"group"}:{id:e[0].groupIds[0],type:"group"}}}return null},og=e=>!!(e.length===1||e.length>1&&Ud(e)),A5=e=>{try{let t=new URL(e);return t.searchParams.has(wr)&&t.host===window.location.host}catch{return!1}},k5=e=>{try{let{searchParams:t}=new URL(e);if(t.has(wr))return t.get(wr)}catch{}return null};I();import{FONT_FAMILY as gg,VERTICAL_ALIGN as Eg,escapeDoubleQuotes as fs,getFontString as xg}from"@excalidraw/common";I();import{DEFAULT_ELEMENT_PROPS as Un,DEFAULT_FONT_FAMILY as ig,DEFAULT_FONT_SIZE as rg,DEFAULT_TEXT_ALIGN as ag,DEFAULT_VERTICAL_ALIGN as sg,DEFAULT_STROKE_STREAMLINE as lg,VERTICAL_ALIGN as dg,randomInteger as cg,randomId as ug,getFontString as br,getUpdatedTimestamp as pg,getLineHeight as hg}from"@excalidraw/common";var Ot=(e,{x:t,y:n,strokeColor:o=Un.strokeColor,backgroundColor:i=Un.backgroundColor,fillStyle:r=Un.fillStyle,strokeWidth:a=Un.strokeWidth,strokeStyle:s=Un.strokeStyle,roughness:l=Un.roughness,opacity:d=Un.opacity,width:c=0,height:p=0,angle:h=0,groupIds:m=[],frameId:g=null,index:f=null,roundness:E=null,boundElements:x=null,link:y=null,locked:w=Un.locked,...M})=>((t<-1e6||t>1e6||n<-1e6||n>1e6||c<-1e6||c>1e6||p<-1e6||p>1e6)&&console.error("New element size or position is too large",{x:t,y:n,width:c,height:p,points:M.points}),{id:M.id||ug(),type:e,x:t,y:n,width:c,height:p,angle:h,strokeColor:o,backgroundColor:i,fillStyle:r,strokeWidth:a,strokeStyle:s,roughness:l,opacity:d,groupIds:m,frameId:g,index:f,roundness:E,seed:M.seed??cg(),version:M.version||1,versionNonce:M.versionNonce??0,isDeleted:!1,boundElements:x,updated:pg(),link:y,locked:w,customData:M.customData}),so=e=>Ot(e.type,e),N5=e=>Ot("embeddable",e),H5=e=>({...Ot("iframe",e)}),pu=e=>Je({...Ot("frame",e),type:"frame",name:e?.name||null},{}),hu=e=>Je({...Ot("magicframe",e),type:"magicframe",name:e?.name||null},{}),mu=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),lo=e=>{let t=e.fontFamily||ig,n=e.fontSize||rg,o=e.lineHeight||hg(t),i=$o(e.text),r=Et(i,br({fontFamily:t,fontSize:n}),o),a=e.textAlign||ag,s=e.verticalAlign||sg,l=mu({textAlign:a,verticalAlign:s},r),d={...Ot("text",e),text:i,fontSize:n,fontFamily:t,textAlign:a,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:r.width,height:r.height,containerId:e.containerId||null,originalText:e.originalText??i,autoResize:e.autoResize??!0,lineHeight:o};return Je(d,{})},mg=(e,t,n)=>{let{width:o,height:i}=Et(n,br(e),e.lineHeight);e.autoResize||(o=e.width);let{textAlign:r,verticalAlign:a}=e,s,l;if(r==="center"&&a===dg.MIDDLE&&!e.containerId&&e.autoResize){let d=Et(e.text,br(e),e.lineHeight),c=mu(e,{width:o-d.width,height:i-d.height});s=e.x-c.x,l=e.y-c.y}else{let[d,c,p,h]=ee(e,t),[m,g,f,E]=bn(e,o,i,!1),x=(d-m)/2,y=(c-g)/2,w=(p-f)/2,M=(h-E)/2;[s,l]=fg({s:!0,e:r==="center"||r==="left",w:r==="center"||r==="right"},e.x,e.y,e.angle,x,y,w,M)}return{width:o,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},fg=(e,t,n,o,i,r,a,s)=>{let l=Math.cos(o),d=Math.sin(o);return e.e&&e.w?t+=i+a:e.e?(t+=i*(1+l),n+=i*d,t+=a*(1-l),n+=a*-d):e.w&&(t+=i*(1-l),n+=i*-d,t+=a*(1+l),n+=a*d),e.n&&e.s?n+=r+s:e.n?(t+=r*d,n+=r*(1-l),t+=s*-d,n+=s*(1+l)):e.s&&(t+=r*-d,n+=r*(1+l),t+=s*d,n+=s*(1-l)),[t,n]},z5=(e,t,n,o=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(o=an(o,br(e),t?Ct(t,e):e.width));let i=mg(e,n,o);return{text:o,...i}},_5=e=>({...Ot(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure,strokeOptions:e.strokeOptions??{variability:"variable",streamline:lg}}),fu=e=>{let t={...Ot(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null};return Jt(t)?{...t,polygon:e.polygon??!1}:t},Mr=e=>e.elbowed?{...Ot(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!0,fixedSegments:e.fixedSegments||[],startIsSpecial:!1,endIsSpecial:!1}:{...Ot(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!1},gu=e=>({...Ot("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,fileName:e.fileName??null,thumbHash:e.thumbHash??null,scale:e.scale??[1,1],crop:e.crop??null});var Rt=new Map,yg=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)/,wg=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,bg=/^https:\/\/(?:www\.)?figma\.com/,Eu=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,Mg=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,Pg=/^(?:https?:\/\/)?forms\.microsoft\.com\//,xu=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,Ig=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,Sg=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,vg=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,yu=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,wu=/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/,Ag=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i,Mu=e=>{let t;try{let a=new URL(e.startsWith("http")?e:`https://${e}`);t=a.searchParams.get("t")||a.searchParams.get("start")}catch{t=e.match(/[?&#](?:t|start)=([^&#\s]+)/)?.[1]}if(!t)return 0;if(/^\d+$/.test(t))return parseInt(t,10);let n=t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(!n)return 0;let[,o="0",i="0",r="0"]=n;return parseInt(o)*3600+parseInt(i)*60+parseInt(r)},kg=e=>{try{let t=new URL(e.startsWith("http")?e:`https://${e}`);if(t.hostname.replace(/^www\./,"")!=="drive.google.com")return null;let o=null,i=t.pathname.match(/^\/file\/d\/([^/]+)(?:\/|$)/);if(i?.[1]?o=i[1]:(t.pathname==="/open"||t.pathname==="/uc")&&(o=t.searchParams.get("id")),!o||!/^[a-zA-Z0-9_-]+$/.test(o))return null;let r=t.searchParams.get("resourcekey"),a=Mu(t.toString());return{fileId:o,resourceKey:r&&/^[a-zA-Z0-9_-]+$/.test(r)?r:void 0,timestamp:a>0?a:void 0}}catch{return null}},Es=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","drive.google.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","reddit.com","forms.microsoft.com"]),bu=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","drive.google.com","figma.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","reddit.com","forms.microsoft.com"]),gs=e=>`<html><body>${e}</body></html>`,$5=e=>{if(!e)return null;if(Rt.has(e))return Rt.get(e);let t=e,n=bu.has(xs(e,bu)||""),o="generic",i={w:560,h:840},r=e.match(yg);if(r?.[2]){let c=Mu(t),p=c>0?`&start=${c}`:"",h=e.includes("shorts");switch(o="video",r[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${r[2]}?enablejsapi=1${p}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${r[2]}&enablejsapi=1${p}`;break;default:e=`https://www.youtube.com/embed/${r[2]}?enablejsapi=1${p}`;break}return i=h?{w:315,h:560}:{w:560,h:315},Rt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}let a=e.match(wg);if(a?.[1]){let c=a?.[1],p=/^\d+$/.test(c)?void 0:new URIError("Invalid embed link format");return o="video",e=`https://player.vimeo.com/video/${c}?api=1`,i={w:560,h:315},Rt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,error:p,sandbox:{allowSameOrigin:n}}}let s=kg(e);if(s){o="video";let c=new URLSearchParams;s.resourceKey&&c.set("resourcekey",s.resourceKey),s.timestamp&&c.set("t",`${s.timestamp}`);let p=c.toString();return e=`https://drive.google.com/file/d/${s.fileId}/preview${p?`?${p}`:""}`,i={w:560,h:315},Rt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}if(e.match(bg))return o="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},Rt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};let d=e.match(Sg);if(d)return e=d[1]==="embed"?d[0]:d[0].replace("/v","/embed"),Rt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};if(Pg.test(e)&&!e.includes("embed=true")&&(e+=e.includes("?")?"&embed=true":"?embed=true"),xu.test(e)){let c=e.match(xu)[1],p=fs(`https://twitter.com/x/status/${c}`),h={type:"document",srcdoc:m=>gs(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${m}"><a href="${p}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return Rt.set(t,h),h}if(wu.test(e)){let[,c,p,h]=e.match(wu),m=fs(`https://reddit.com/r/${c}/comments/${p}/${h}`),g={type:"document",srcdoc:f=>gs(`<blockquote class="reddit-embed-bq" data-embed-theme="${f}"><a href="${m}"></a><br></blockquote><script async="" src="https://embed.reddit.com/widgets.js" charset="UTF-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return Rt.set(t,g),g}if(Eu.test(e)){let[,c,p]=e.match(Eu),h=fs(`https://gist.github.com/${c}/${p}`),m={type:"document",srcdoc:()=>gs(`
22
22
  <script src="${h}.js"><\/script>
23
23
  <style type="text/css">
24
24
  * { margin: 0px; }
25
25
  table, .gist { height: 100%; }
26
26
  .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
27
27
  </style>
28
- `),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return It.set(e,m),m}return It.set(e,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}},W4=e=>{let t;Mi(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),o=Lf.Helvetica,i=Bf({fontSize:n,fontFamily:o});return qn({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:o,fontSize:n,text:Zt(t,i,e.width-20),textAlign:"center",verticalAlign:Cf.MIDDLE,angle:e.angle??0})},rs=(e,t)=>{try{let{hostname:n}=new URL(e),o=n.replace(/^www\./,"");if(t instanceof Set){if(is.has(o))return o;let r=o.replace(/^([^.]+)/,"*");return is.has(r)?r:null}let i=t.replace(/^www\./,"");if(o===i)return i}catch{}return null},_4=e=>{let t=e.match(Nf);if(t&&t.length===2)return t[1];let n=e.match(Wf);if(n&&n.length===2)return n[1];let o=e.match(Rf);if(o&&o.length===2)return o[1];if($c.test(e))return`https://giphy.com/embed/${$c.exec(e)[1]}`;let i=e.match(zf);return i&&i.length===2?i[1]:e},j4=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(rs(e,n))return!0;return!1}}return!!rs(e,is)};I();import{KEYS as hr,invariant as mr,toBrandedType as jf}from"@excalidraw/common";import{pointFrom as Qc}from"@excalidraw/math";var mo=100,Kn=100,o5=e=>{switch(e){case hr.ARROW_UP:return"up";case hr.ARROW_DOWN:return"down";case hr.ARROW_RIGHT:return"right";case hr.ARROW_LEFT:return"left";default:return"right"}},tu=(e,t,n,o)=>{let i=[...n.values()].reduce((r,a)=>{let s;if(Y(a)&&(s=a[e==="predecessors"?"startBinding":"endBinding"])&&a[e==="predecessors"?"endBinding":"startBinding"]?.elementId===t.id){let l=n.get(s.elementId);if(!l)return r;mr(Ee(l),"not an ExcalidrawBindableElement");let d=e==="predecessors"?a.points[a.points.length-1]:[0,0],c=No(t,ut(t,n),[d[0]+a.x,d[1]+a.y]);r.push({relative:l,heading:c})}return r},[]);switch(o){case"up":return i.filter(r=>we(r.heading,rt)).map(r=>r.relative);case"down":return i.filter(r=>we(r.heading,ke)).map(r=>r.relative);case"right":return i.filter(r=>we(r.heading,be)).map(r=>r.relative);case"left":return i.filter(r=>we(r.heading,Ze)).map(r=>r.relative)}},as=(e,t,n)=>tu("successors",e,t,n),ss=(e,t,n)=>tu("predecessors",e,t,n),Vf=(e,t,n)=>{let o=Kn+e.width;if(n==="up"||n==="down"){let s=mo+e.height,l=e.x,d=e.x+e.width;if(t.every(c=>c.x+c.width<l||c.x>d))return{x:0,y:s*(n==="up"?-1:1)}}else if(n==="right"||n==="left"){let s=e.y,l=e.y+e.height;if(t.every(d=>d.y+d.height<s||d.y>l))return{x:(Kn+e.width)*(n==="left"?-1:1),y:0}}if(n==="up"||n==="down"){let s=mo+e.height,l=(t.length===0,s),d=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*o:t.length/2*o*-1;return n==="up"?{x:d,y:l*-1}:{x:d,y:l}}let i=mo+e.height,r=(t.length===0,Kn+e.width),a=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*i:t.length/2*i*-1;return n==="left"?{x:r*-1,y:a}:{x:r,y:a}},Yf=(e,t,n,o)=>{let i=o.getNonDeletedElementsMap(),r=as(e,i,n),a=ss(e,i,n),s=Vf(e,[...r,...a],n),l=Zn({type:e.type,x:e.x+s.x,y:e.y+s.y,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});mr(Hr(l),"not an ExcalidrawFlowchartNodeElement");let d=nu(e,l,n,t,o);return{nextNode:l,bindingArrow:d}},Uf=(e,t,n,o,i)=>{let r=[];for(let a=0;a<i;a++){let s,l;if(n==="left"||n==="right"){let u=mo*(i-1)+i*e.height,h=e.y+e.height/2-u/2,m=Kn+e.width;n==="left"&&(m*=-1),s=e.x+m;let g=(mo+e.height)*a;l=h+g}else{let u=Kn*(i-1)+i*e.width,h=e.x+e.width/2-u/2,m=mo+e.height;n==="up"&&(m*=-1),l=e.y+m;let g=(Kn+e.width)*a;s=h+g}let d=Zn({type:e.type,x:s,y:l,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});mr(Hr(d),"not an ExcalidrawFlowchartNodeElement");let c=nu(e,d,n,t,o);r.push(d),r.push(c)}return r},nu=(e,t,n,o,i)=>{let r,a;switch(n){case"up":{r=e.x+e.width/2,a=e.y-6;break}case"down":{r=e.x+e.width/2,a=e.y+e.height+6;break}case"right":{r=e.x+e.width+6,a=e.y+e.height/2;break}case"left":{r=e.x-6,a=e.y+e.height/2;break}}let l,d;switch(n){case"up":{l=t.x+t.width/2-r,d=t.y+t.height-a+6;break}case"down":{l=t.x+t.width/2-r,d=t.y-a-6;break}case"right":{l=t.x-r-6,d=t.y-a+t.height/2;break}case"left":{l=t.x+t.width-r+6,d=t.y-a+t.height/2;break}}let c=pr({type:"arrow",x:r,y:a,startArrowhead:null,endArrowhead:o.currentItemEndArrowhead,strokeColor:e.strokeColor,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,opacity:e.opacity,roughness:e.roughness,points:[Qc(0,0),Qc(l,d)],elbowed:!0}),u=i.getNonDeletedElementsMap();Rt(c,e,"orbit","start",i),Rt(c,t,"orbit","end",i);let h=new Map;h.set(e.id,e),h.set(t.id,t),h.set(c.id,c),D.movePoints(c,i,new Map([[1,{point:c.points[1]}]]));let m=io(c,jf(new Map([...u.entries(),[e.id,e],[t.id,t],[c.id,c]])),{points:c.points});return{...c,...m}},Jc=class{isExploring=!1;sameLevelNodes=[];sameLevelIndex=0;direction=null;visitedNodes=new Set;clear(){this.isExploring=!1,this.sameLevelNodes=[],this.sameLevelIndex=0,this.direction=null,this.visitedNodes.clear()}exploreByDirection(t,n,o){if(!Ee(t))return null;if(o!==this.direction&&this.clear(),this.visitedNodes.has(t.id)||this.visitedNodes.add(t.id),this.isExploring&&o===this.direction&&this.sameLevelNodes.length>1)return this.sameLevelIndex=(this.sameLevelIndex+1)%this.sameLevelNodes.length,this.sameLevelNodes[this.sameLevelIndex].id;let i=[...as(t,n,o),...ss(t,n,o)];if(i.length>0)return this.sameLevelIndex=0,this.isExploring=!0,this.sameLevelNodes=i,this.direction=o,this.visitedNodes.add(i[0].id),i[0].id;if(o===this.direction||!this.isExploring){this.isExploring||this.visitedNodes.add(t.id);let a=["up","right","down","left"].filter(s=>s!==o).map(s=>[...as(t,n,s),...ss(t,n,s)]).flat().filter(s=>!this.visitedNodes.has(s.id));for(let s of a)if(!this.visitedNodes.has(s.id))return this.visitedNodes.add(s.id),this.isExploring=!0,this.direction=o,s.id}return null}},eu=class{isCreatingChart=!1;numberOfNodes=0;direction="right";pendingNodes=null;createNodes(t,n,o,i){let r=i.getNonDeletedElementsMap();if(o!==this.direction){let{nextNode:a,bindingArrow:s}=Yf(t,n,o,i);this.numberOfNodes=1,this.isCreatingChart=!0,this.direction=o,this.pendingNodes=[a,s]}else{this.numberOfNodes+=1;let a=Uf(t,n,o,i,this.numberOfNodes);this.isCreatingChart=!0,this.direction=o,this.pendingNodes=a}if(t.frameId){let a=r.get(t.frameId);mr(a&&Ii(a),"not an ExcalidrawFrameElement"),a&&this.pendingNodes.every(s=>vn([s],a,r)||In(s,a,r))&&(this.pendingNodes=this.pendingNodes.map(s=>Te(s,r,{frameId:t.frameId})))}}clear(){this.isCreatingChart=!1,this.pendingNodes=null,this.direction=null,this.numberOfNodes=0}},i5=(e,t)=>{for(let[,n]of t)if(n.type==="arrow"&&(n.startBinding?.elementId===e.id||n.endBinding?.elementId===e.id))return!0;return!1};I();import{pointDistance as fo,pointFrom as ls}from"@excalidraw/math";import{invariant as ou}from"@excalidraw/common";var fr=(e,t,n,o,i,r,a=!1)=>{if(Y(t)||!Ot(i)||t.points.length!==2)return!1;if(!a){let l=t.startBinding?.elementId===n.id?0:t.points.length-1,d=D.getPointAtIndexGlobalCoordinates(t,l,o);if(fo(e,d)<Vo*1.5/i.zoom.value)return!1}let s=D.getPointAtIndexGlobalCoordinates(t,r==="end"?t.points.length-1:0,o);return fo(e,s)>=Vo*1.5/i.zoom.value&&Lt({element:n,elementsMap:o,point:e,threshold:Ne(n,t),overrideShouldTestInside:!0})},Xf=(e,t,n,o,i,r,a)=>{let s=new Map,l=n?"startBinding":"endBinding",d=n?"endBinding":"startBinding",c=e[l],u=e[d];if(c&&t){let h=t&&u&&c.elementId===u.elementId;a||h?c={...c,mode:"inside"}:c={...c,mode:"orbit"};let m=n?0:e.points.length-1,g=bt(e,l,c,t,o,!0);g&&s.set(m,{point:g})}if(u&&u.mode==="orbit"){let h=o.get(u.elementId);if(h&&Ee(h)&&Ot(r)){let m=t&&u.elementId===t.id;a||m?u={...u,mode:"inside"}:u={...u,mode:"orbit"};let g=n?e.points.length-1:0,f=bt(e,d,u,h,o);f&&s.set(g,{point:f})}}s.size>0&&D.movePoints(e,i,s,{[l]:c,[d]:u})},iu=(e,t,n,o,i,r,a)=>{let s=D.getElement(e.elementId,t);if(!s||!Be(s)||Y(s)||!e.hoveredFocusPointBinding||!e.draggedFocusPointBinding)return;let l=e.draggedFocusPointBinding==="start",d=l?s.startBinding:s.endBinding,{x:c,y:u}=e.pointerOffset,h=ls(n.x-c,n.y-u),m=l?"startBinding":"endBinding",g=Vl(h,s,o.getNonDeletedElements(),t,Et(i.zoom));if(g&&Ot(i)){s[m]&&g.id!==d?.elementId&&Oe(s,e.draggedFocusPointBinding,o);let f=a&&s[m]?.mode==="orbit"?"inside":!a&&s[m]?.mode==="inside"?"orbit":null;(!s[m]||f)&&Rt(s,g,f||"orbit",e.draggedFocusPointBinding,o,h),o.mutateElement(s,{[m]:{...s[m],elementId:g.id,mode:f||s[m]?.mode||"orbit",...ro(s,g,e.draggedFocusPointBinding,t,h)}})}else{let f=new Map,E=l?0:s.points.length-1;f.set(E,{point:D.createPointAt(s,t,h[0],h[1],r)}),D.movePoints(s,o,f),s[m]&&Oe(s,l?"start":"end",o)}Xf(s,g,l,t,o,i,a),g&&Ot(i)&&Yo(h,s,o.getElementsIncludingDeleted(),t,o,g)},m5=(e,t,n,o)=>{let i=ls(t.origin.x,t.origin.y),r=Vo*1.5/o.zoom.value;if(e.startBinding?.elementId){let a=n.get(e.startBinding.elementId);if(a&&Ee(a)&&!a.isDeleted){let s=Ue(e.startBinding.fixedPoint,a,n);if(fr(s,e,a,n,o,"start")&&fo(i,s)<=r)return{hitFocusPoint:"start",pointerOffset:{x:i[0]-s[0],y:i[1]-s[1]}}}}if(e.endBinding?.elementId){let a=n.get(e.endBinding.elementId);if(a&&Ee(a)&&!a.isDeleted){let s=Ue(e.endBinding.fixedPoint,a,n);if(fr(s,e,a,n,o,"end")&&fo(i,s)<=r)return{hitFocusPoint:"end",pointerOffset:{x:i[0]-s[0],y:i[1]-s[1]}}}}return{hitFocusPoint:null,pointerOffset:{x:0,y:0}}},f5=(e,t)=>{ou(e.draggedFocusPointBinding,"Must have a dragged focus point at pointer release");let n=D.getElement(e.elementId,t.getNonDeletedElementsMap());ou(n,"Arrow must be in the scene");let o=e.draggedFocusPointBinding==="start"?"startBinding":"endBinding",i=e.draggedFocusPointBinding==="start"?"endBinding":"startBinding",r=n[o]?.elementId,a=n[i]?.elementId,s=r&&t.getNonDeletedElements().find(d=>d.id!==r&&d.id!==a&&Ee(d)&&d.boundElements?.find(({id:c})=>c===n.id));s&&t.mutateElement(s,{boundElements:s.boundElements?.filter(({id:d})=>d!==n.id)});let l=r&&t.getNonDeletedElementsMap().get(r);l&&t.mutateElement(l,{boundElements:[...(l.boundElements||[])?.filter(({id:d})=>d!==n.id),{id:n.id,type:"arrow"}]})},g5=(e,t,n,o,i)=>{let r=o.getNonDeletedElementsMap(),a=ls(t,n),s=Vo*1.5/i.zoom.value;if(e.startBinding?.elementId){let l=r.get(e.startBinding.elementId);if(l&&Ee(l)&&!l.isDeleted){let d=Ue(e.startBinding.fixedPoint,l,r);if(fr(d,e,l,r,i,"start")&&fo(a,d)<=s)return"start"}}if(e.endBinding?.elementId){let l=r.get(e.endBinding.elementId);if(l&&Ee(l)&&!l.isDeleted){let d=Ue(e.endBinding.fixedPoint,l,r);if(fr(d,e,l,r,i,"end")&&fo(a,d)<=s)return"end"}}return null};I();import{MIME_TYPES as ru,SVG_NS as $f}from"@excalidraw/common";var Zf=e=>new Promise((t,n)=>{let o=new Image;o.onload=()=>{t(o)},o.onerror=i=>{n(i)},o.src=e}),b5=async({fileIds:e,files:t,imageCache:n})=>{let o=new Map,i=new Map;return await Promise.all(e.reduce((r,a)=>{let s=t[a];return s&&!o.has(a)?(o.set(a,!0),r.concat((async()=>{try{if(s.mimeType===ru.binary)throw new Error("Only images can be added to ImageCache");let l=Zf(s.dataURL),d={image:l,mimeType:s.mimeType};n.set(a,d);let c=await l;n.set(a,{...d,image:c})}catch{i.set(a,!0)}})())):r},[])),{imageCache:n,updatedFiles:o,erroredFiles:i}},M5=e=>e.filter(t=>Hn(t)),qf=e=>e?.nodeName.toLowerCase()==="svg",P5=e=>{let t=new DOMParser().parseFromString(e,ru.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!qf(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",$f);let i=n.getAttribute("width"),r=n.getAttribute("height");(i?.includes("%")||i==="auto")&&(i=null),(r?.includes("%")||r==="auto")&&(r=null);let a=n.getAttribute("viewBox");if(!i||!r){if(i=i||"50",r=r||"50",a){let s=a.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);s&&([,i,r]=s)}n.setAttribute("width",i),n.setAttribute("height",r)}return a||n.setAttribute("viewBox",`0 0 ${i} ${r}`),n.outerHTML}};I();var Kf=e=>({x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}),au=(e,t)=>{switch(e){case"height":return t.height;case"width":return t.width;case"size":return t.width*t.height;case"scale":return(t.width+t.height)/2}},Qf=(e,t,n)=>n==="first"?au(e,t[0].boundingBox):t.reduce((i,r)=>i+au(e,r.boundingBox),0)/t.length,Jf=(e,t,n)=>{switch(e){case"height":return t/n.height;case"width":return t/n.width;case"size":return Math.sqrt(t/(n.width*n.height));case"scale":return t/((n.width+n.height)/2)}},k5=(e,t,n,o="average",i="size")=>{let a=Ki(t,n).map(d=>({group:d,boundingBox:Fe(d)}));if(a.length===0)return t;let s=Qf(i,a,o),l=[];return a.forEach(d=>{let c=Jf(i,s,d.boundingBox);if(!Number.isFinite(c)||c<=0)return;let u=Kf(d.boundingBox);d.group.forEach(h=>{let m={x:h.x+h.width/2,y:h.y+h.height/2},g={x:u.x+(m.x-u.x)*c,y:u.y+(m.y-u.y)*c},f=h.width*c,E=h.height*c;e.mutateElement(h,{x:g.x-f/2,y:g.y-E/2,width:f,height:E}),l.push(h)})}),l};I();var D5=(e,t,n,o=50)=>{if(!e||e.length===0)return[];let i=[],r=Array.isArray(e[0])?e:e.map(m=>[m]),a=r.length,s=Math.max(1,Math.ceil(Math.sqrt(a))),l=[];for(let m=0;m<a;m+=s)l.push(r.slice(m,m+s));let d=0,c=l.map(m=>{let g=0,f=0,E=m.map(x=>{let[y,w,M,b]=We(x);return{elements:x,bounds:[y,w,M,b],width:M-y,height:b-w}});return E.forEach((x,y)=>{g+=x.width,y<E.length-1&&(g+=o),x.height>f&&(f=x.height)}),d+=f,{unitBounds:E,width:g,maxHeight:f}}),u=d+Math.max(0,l.length-1)*o,h=n-u/2;return c.forEach(m=>{let{unitBounds:g,width:f,maxHeight:E}=m,x=t-f/2;g.forEach(y=>{let[w,M]=y.bounds,b=x-w,S=h-M;y.elements.forEach(v=>{i.push(He(v,{x:v.x+b,y:v.y+S}))}),x+=y.width+o}),h+=E+o}),i};I();import{pointCenter as eg,normalizeRadians as Er,pointFrom as ce,pointRotateRads as St}from"@excalidraw/math";import{MIN_FONT_SIZE as cs,SHIFT_LOCKING_ANGLE as xr,rescalePoints as su,getFontString as gr}from"@excalidraw/common";var U5=(e,t,n,o,i,r,a,s,l,d,c)=>{let u=o.getNonDeletedElementsMap();if(n.length===1){let[h]=n;if(t==="rotation")Y(h)||(tg(h,o,s,l,i),Re(h,o));else if(t){let m=n[0].id,g=u.get(m),f=e.get(m);if(g&&f){let{nextWidth:E,nextHeight:x}=ag(g,f,t,s,l,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r});rg(E,x,g,f,e,o,t,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r})}}return te(h)&&Re(h,o),!0}else if(n.length>1){if(t==="rotation")return og(e,n,o,s,l,i,d,c),!0;if(t){let{nextWidth:h,nextHeight:m,flipByX:g,flipByY:f,originalBoundingBox:E}=sg(n,e,u,t,s,l,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r});return lg(n,u,t,o,e,{shouldResizeFromCenter:r,shouldMaintainAspectRatio:a,flipByX:g,flipByY:f,nextWidth:h,nextHeight:m,originalBoundingBox:E}),!0}}return!1},tg=(e,t,n,o,i)=>{let[r,a,s,l]=K(e,t.getNonDeletedElementsMap()),d=(r+s)/2,c=(a+l)/2,u;ee(e)?u=0:(u=5*Math.PI/2+Math.atan2(o-c,n-d),i&&(u=u+xr/2,u=u-u%xr),u=Er(u));let h=qt(e),m={angle:u};if(Be(e)&&(m={...m},e.startBinding&&Oe(e,"start",t),e.endBinding&&Oe(e,"end",t)),t.mutateElement(e,m),h){let g=t.getElement(h);if(g&&!j(e)){let{x:f,y:E}=Oo(e,g,t.getNonDeletedElementsMap());t.mutateElement(g,{angle:u,x:f,y:E})}}},lu=(e,t,n,o)=>ne(e)||Se(e)?{points:su(0,t,su(1,n,e.points,o),o)}:{},us=(e,t,n)=>{let o=e.width;if(xe(e)){let a=De(e,t);a&&(o=xt(a,e))}let r=e.fontSize*(n/o);return r<cs?null:{size:r}},ng=(e,t,n,o,i,r,a)=>{let s=n.getNonDeletedElementsMap(),l=t.width*(a/t.height),d=us(t,s,l);if(d!==null){if(o.includes("n")||o.includes("s")){let c=ce(e.x,e.y),u=ds(c,e.width,e.height,l,a,e.angle,o,!1,i);n.mutateElement(t,{fontSize:d.size,width:l,height:a,x:u.x,y:u.y});return}if(o==="e"||o==="w"){let c=ki(gr({fontSize:t.fontSize,fontFamily:t.fontFamily}),t.lineHeight),u=Math.max(c,r),h=Zt(t.originalText,gr(t),Math.abs(u)),m=ot(h,gr(t),t.lineHeight),g=m.height,f=ce(e.x,e.y),E=ds(f,e.width,e.height,u,g,t.angle,o,!1,i),x={width:Math.abs(u),height:Math.abs(m.height),x:E.x,y:E.y,text:h,autoResize:!1};n.mutateElement(t,x)}}},og=(e,t,n,o,i,r,a,s)=>{let l=n.getNonDeletedElementsMap(),d=5*Math.PI/2+Math.atan2(i-s,o-a);r&&(d+=xr/2,d-=d%xr);let c=new Map(t.map(u=>[u.id,u]));for(let u of t)if(!ee(u)){let[h,m,g,f]=K(u,l),E=(h+g)/2,x=(m+f)/2,y=e.get(u.id)?.angle??u.angle,[w,M]=St(ce(E,x),ce(a,s),d+y-u.angle),b=Y(u)?{points:md(u,l)}:{x:u.x+(w-E),y:u.y+(M-x),angle:Er(d+y)};n.mutateElement(u,b),Re(u,n,{simultaneouslyUpdated:t}),Be(u)&&(u.startBinding&&(c.has(u.startBinding.elementId)||Oe(u,"start",n)),u.endBinding&&(c.has(u.endBinding.elementId)||Oe(u,"end",n)));let S=Q(u,l);if(S&&!j(u)){let{x:v,y:k}=Oo(u,S,l);n.mutateElement(S,{x:v,y:k,angle:Er(d+y)})}}n.triggerUpdate()},X5=(e,t,n,o,i)=>{let[r,a,s,l]=t.length===1?K(t[0],n):We(t),d=(r+s)/2,c=(a+l)/2,u=t.length===1?t[0].angle:0;switch([o,i]=St(ce(o,i),ce(d,c),-u),e){case"n":return St(ce(o-(r+s)/2,i-a),ce(0,0),u);case"s":return St(ce(o-(r+s)/2,i-l),ce(0,0),u);case"w":return St(ce(o-r,i-(a+l)/2),ce(0,0),u);case"e":return St(ce(o-s,i-(a+l)/2),ce(0,0),u);case"nw":return St(ce(o-r,i-a),ce(0,0),u);case"ne":return St(ce(o-s,i-a),ce(0,0),u);case"sw":return St(ce(o-r,i-l),ce(0,0),u);case"se":return St(ce(o-s,i-l),ce(0,0),u);default:return[0,0]}},$5=(e,t)=>{let[,[n,o]]=t.points;return e==="nw"&&(n<0||o<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||o>0)?"end":"origin"},ig=(e,t,n)=>{if(n)return"center";if(t)switch(e){case"n":return"south-side";case"e":return"west-side";case"s":return"north-side";case"w":return"east-side";case"ne":return"bottom-left";case"nw":return"bottom-right";case"se":return"top-left";case"sw":return"top-right"}return["e","se","s"].includes(e)?"top-left":["n","nw","w"].includes(e)?"bottom-right":e==="ne"?"bottom-left":"top-right"},ds=(e,t,n,o,i,r,a,s,l)=>{let d=ig(a,s,l),[c,u]=e;switch(d){case"top-left":return{x:c+(t-o)/2+(o-t)/2*Math.cos(r)+(n-i)/2*Math.sin(r),y:u+(n-i)/2+(o-t)/2*Math.sin(r)+(i-n)/2*Math.cos(r)};case"top-right":return{x:c+(t-o)/2*(Math.cos(r)+1)+(n-i)/2*Math.sin(r),y:u+(n-i)/2+(t-o)/2*Math.sin(r)+(i-n)/2*Math.cos(r)};case"bottom-left":return{x:c+(t-o)/2*(1-Math.cos(r))+(i-n)/2*Math.sin(r),y:u+(n-i)/2*(Math.cos(r)+1)+(o-t)/2*Math.sin(r)};case"bottom-right":return{x:c+(t-o)/2*(Math.cos(r)+1)+(i-n)/2*Math.sin(r),y:u+(n-i)/2*(Math.cos(r)+1)+(t-o)/2*Math.sin(r)};case"center":return{x:c-(o-t)/2,y:u-(i-n)/2};case"east-side":return{x:c+(t-o)/2*(Math.cos(r)+1),y:u+(t-o)/2*Math.sin(r)+(n-i)/2};case"west-side":return{x:c+(t-o)/2*(1-Math.cos(r)),y:u+(o-t)/2*Math.sin(r)+(n-i)/2};case"north-side":return{x:c+(t-o)/2+(n-i)/2*Math.sin(r),y:u+(i-n)/2*(Math.cos(r)-1)};case"south-side":return{x:c+(t-o)/2+(i-n)/2*Math.sin(r),y:u+(n-i)/2*(Math.cos(r)+1)}}},rg=(e,t,n,o,i,r,a,{shouldInformMutation:s=!0,shouldMaintainAspectRatio:l=!1,shouldResizeFromCenter:d=!1}={})=>{if(te(n)&&te(o))return ng(o,n,r,a,d,e,t);let c={},u=r.getNonDeletedElementsMap(),h=Q(n,u);if(h){let E=i.get(h.id);if(E&&(c={fontSize:E.fontSize}),l){let x={...n,width:e,height:t},y=us(h,u,xt(x,h));if(y===null)return;c={fontSize:y.size}}else{let x=Sl(gr(h),h.lineHeight),y=vl(h.fontSize,h.lineHeight);e=Math.max(e,x),t=Math.max(t,y)}}let m=lu(o,e,t,!0),g=ce(o.x,o.y);if(ne(o)){let[E,x]=ue(o,i);g=ce(E,x)}let f=ds(g,o.width,o.height,e,t,o.angle,a,l,d);if(ne(o)&&m.points){let E=o.x-g[0],x=o.y-g[1];f.x+=E,f.y+=x;let y=m.points[0][0],w=m.points[0][1];f.x+=y,f.y+=w,m.points=m.points.map(M=>ce(M[0]-y,M[1]-w))}if(e<0&&(f.x=f.x+e),t<0&&(f.y=f.y+t),"scale"in n&&"scale"in o&&r.mutateElement(n,{scale:[(Math.sign(e)||o.scale[0])*o.scale[0],(Math.sign(t)||o.scale[1])*o.scale[1]]}),j(n)&&h&&l){let E=e/n.width*h.fontSize;if(E<cs)return;c.fontSize=E}if(e!==0&&t!==0&&Number.isFinite(f.x)&&Number.isFinite(f.y)){let E={...f,width:Math.abs(e),height:Math.abs(t),...m};Be(n)&&(n.startBinding&&(E={...E},n.startBinding&&Oe(n,"start",r)),n.endBinding&&(E={...E,endBinding:null})),r.mutateElement(n,E,{informMutation:s,isDragging:!1}),h&&c!=null&&r.mutateElement(h,{fontSize:c.fontSize}),jn(n,r,a,l),Re(n,r)}},ag=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:a=!1}={})=>{let[s,l,d,c]=un(t,t.width,t.height,!0),u=ce(s,l),h=ce(d,c),m=eg(u,h),g=St(ce(o,i),m,-t.angle),[f,E,x,y]=un(e,e.width,e.height,!0),w=x-f,M=y-E,b=h[0]-u[0],S=h[1]-u[1],v=b/w,k=S/M;n.includes("e")&&(v=(g[0]-u[0])/w),n.includes("s")&&(k=(g[1]-u[1])/M),n.includes("w")&&(v=(h[0]-g[0])/w),n.includes("n")&&(k=(h[1]-g[1])/M);let T=e.width*v,R=e.height*k;if(a&&(T=2*T-t.width,R=2*R-t.height),r){let O=Math.abs(T)/t.width,N=Math.abs(R)/t.height;if(n.length===1&&(R*=O,T*=N),n.length===2){let G=Math.max(O,N);T=t.width*G*Math.sign(T),R=t.height*G*Math.sign(R)}}return{nextWidth:T,nextHeight:R}},sg=(e,t,n,o,i,r,{shouldMaintainAspectRatio:a=!1,shouldResizeFromCenter:s=!1}={})=>{let l=e.map(G=>t.get(G.id)),d=l.reduce((G,q)=>{if(!ne(q))return G;let U=qt(q);if(!U)return G;let le=t.get(U)??null;return xe(le)?[...G,{...le,...D.getBoundTextElementPosition(q,le,n)}]:G},[]),c=Fe(l.map(G=>G).concat(d)),{minX:u,minY:h,maxX:m,maxY:g,midX:f,midY:E}=c,x=m-u,y=g-h,w={ne:[u,g],se:[u,h],sw:[m,h],nw:[m,g],e:[u,h+y/2],w:[m,h+y/2],n:[u+x/2,g],s:[u+x/2,h]},[M,b]=s?[f,E]:w[o],S=s?2:1,v=Math.max(Math.abs(i-M)/x||0,Math.abs(r-b)/y||0)*S,k=o.includes("e")||o.includes("w")?Math.abs(i-M)*S:x,T=o.includes("n")||o.includes("s")?Math.abs(r-b)*S:y;a&&(k=x*v*Math.sign(i-M),T=y*v*Math.sign(r-b));let R={ne:[i<M,r>b],se:[i<M,r<b],sw:[i>M,r<b],nw:[i>M,r>b],e:[i<M,!1],w:[i>M,!1],n:[!1,r>b],s:[!1,r<b]},[O,N]=R[o].map(G=>G);return{originalBoundingBox:c,nextWidth:k,nextHeight:T,flipByX:O,flipByY:N}},lg=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:a=!1,flipByX:s=!1,flipByY:l=!1,nextHeight:d,nextWidth:c,originalBoundingBox:u}={})=>{if(c===void 0&&d===void 0&&s===void 0&&l===void 0||d===0||c===0)return;i||(i=t);let h=e.reduce((S,v)=>{let k=i.get(v.id);return k&&S.push({orig:k,latest:v}),S},[]),m;if(u)m=u;else{let S=h.reduce((v,{orig:k})=>{if(!ne(k))return v;let T=qt(k);if(!T)return v;let R=i.get(T)??null;return xe(R)?[...v,{...R,...D.getBoundTextElementPosition(k,R,t)}]:v},[]);m=Fe(h.map(({orig:v})=>v).concat(S))}let{minX:g,minY:f,maxX:E,maxY:x,midX:y,midY:w}=m,M=E-g,b=x-f;if(c===void 0&&d===void 0&&(c=M,d=b),r&&(c===void 0?c=d*(M/b):d===void 0?d=c*(b/M):Math.abs(c/d-M/b)>.001&&(c=d*(M/b))),c&&d){let S=n.includes("e")||n.includes("w")?Math.abs(c)/M:1,v=n.includes("n")||n.includes("s")?Math.abs(d)/b:1,k;n.length===1?k=n.includes("e")||n.includes("w")?S:v:k=Math.max(Math.abs(c)/M||0,Math.abs(d)/b||0);let T={ne:[g,x],se:[g,f],sw:[E,f],nw:[E,x],e:[g,f+b/2],w:[E,f+b/2],n:[g+M/2,x],s:[g+M/2,f]},[R,O]=a?[y,w]:T[n],N=r||h.some(A=>A.latest.angle!==0||te(A.latest)||Ld(A.latest));N&&(S=k,v=k);let[G,q]=[s?-1:1,l?-1:1],U=[];for(let{orig:A,latest:_}of h){if(te(A)&&xe(A))continue;let X=A.width*S,ve=A.height*v,At=Er(A.angle*G*q),ei=ne(A)||Se(A),Sr=A.x-R,ti=A.y-O,xo=s&&!ei?X:0,vr=l&&!ei?ve:0,ni=R+G*(Sr*S+xo),oi=O+q*(ti*v+vr),et=lu(A,X*G,ve*q,!1),st={x:ni,y:oi,width:X,height:ve,angle:At,...et};if(Y(A)&&(A.startBinding&&(st.startBinding={...A.startBinding,fixedPoint:[s?-A.startBinding.fixedPoint[0]+1:A.startBinding.fixedPoint[0],l?-A.startBinding.fixedPoint[1]+1:A.startBinding.fixedPoint[1]]}),A.endBinding&&(st.endBinding={...A.endBinding,fixedPoint:[s?-A.endBinding.fixedPoint[0]+1:A.endBinding.fixedPoint[0],l?-A.endBinding.fixedPoint[1]+1:A.endBinding.fixedPoint[1]]}),A.fixedSegments&&et.points&&(st.fixedSegments=A.fixedSegments.map(Nt=>({...Nt,start:et.points[Nt.index-1],end:et.points[Nt.index]})))),Ae(A)&&(st.scale=[A.scale[0]*G,A.scale[1]*q]),te(A)){let Nt=us(A,t,X);if(!Nt)return;st.fontSize=Nt.size}let sn=i.get(qt(A)??"");if(sn)if(N){let Nt=sn.fontSize*k;if(Nt<cs)return;st.boundTextFontSize=Nt}else st.boundTextFontSize=sn.fontSize;U.push({element:_,update:st})}let le=U.map(({element:A})=>A),H=new Map(U.map(({element:A})=>[A.id,A]));for(let{element:A,update:{boundTextFontSize:_,...X}}of U){let{angle:ve}=X;o.mutateElement(A,X),Re(A,o,{simultaneouslyUpdated:le}),Be(A)&&(A.startBinding&&(H.has(A.startBinding.elementId)||Oe(A,"start",o)),A.endBinding&&(H.has(A.endBinding.elementId)||Oe(A,"end",o)));let At=Q(A,t);At&&_&&(o.mutateElement(At,{fontSize:_,angle:ne(A)?void 0:ve}),jn(A,o,n,!0))}o.triggerUpdate()}};I();import{pointFrom as pt,pointOnLineSegment as mu,pointRotateRads as wr}from"@excalidraw/math";import{SIDE_RESIZING_THRESHOLD as Es}from"@excalidraw/common";I();import{DEFAULT_TRANSFORM_HANDLE_SPACING as hs}from"@excalidraw/common";import{pointFrom as du,pointRotateRads as dg}from"@excalidraw/math";var cu={mouse:8,pen:16,touch:28},cg=16,pu={e:!0,s:!0,n:!0,w:!0},tM={e:!0,s:!0,n:!0,w:!0},nM={e:!0,s:!0,n:!0,w:!0,rotation:!0},uu={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},ps={e:!0,s:!0,n:!0,w:!0},an=(e,t,n,o,i,r,a)=>{let[s,l]=dg(du(e+n/2,t+o/2),du(i,r),a);return[s-n/2,l-o/2,n,o]},yr=e=>!(e.formFactor==="phone"&&e.userAgent.isMobileDevice),ms=e=>yr(e)?pu:{},fs=([e,t,n,o,i,r],a,s,l,d={},c=4,u=hs)=>{let h=cu[l],m=h/s.value,g=h/s.value,f=h/s.value,E=h/s.value,x=n-e,y=o-t,w=c/s.value,M=(h-u*2)/(2*s.value),b={nw:d.nw?void 0:an(e-w-f+M,t-w-E+M,m,g,i,r,a),ne:d.ne?void 0:an(n+w-M,t-w-E+M,m,g,i,r,a),sw:d.sw?void 0:an(e-w-f+M,o+w-M,m,g,i,r,a),se:d.se?void 0:an(n+w-M,o+w-M,m,g,i,r,a),rotation:d.rotation?void 0:an(e+x/2-m/2,t-w-E+M-cg/s.value,m,g,i,r,a)},S=5*cu.mouse/s.value;return Math.abs(x)>S&&(d.n||(b.n=an(e+x/2-m/2,t-w-E+M,m,g,i,r,a)),d.s||(b.s=an(e+x/2-m/2,o+w-M,m,g,i,r,a))),Math.abs(y)>S&&(d.w||(b.w=an(e-w-f+M,t+y/2-g/2,m,g,i,r,a)),d.e||(b.e=an(n+w-M,t+y/2-g/2,m,g,i,r,a))),b},hu=(e,t,n,o="mouse",i=pu)=>{if(e.locked||Y(e))return{};if(e.type==="freedraw"||ne(e)){if(e.points.length===2){let[,a]=e.points;a[0]===0||a[1]===0?i=ps:a[0]>0&&a[1]<0?i=uu:a[0]>0&&a[1]>0?i=ps:a[0]<0&&a[1]>0?i=uu:a[0]<0&&a[1]<0&&(i=ps)}}else ee(e)&&(i={...i,rotation:!0});let r=ne(e)?hs+8:Ae(e)?0:hs;return fs(K(e,n,!0),e.angle,t,o,i,r,Ae(e)?0:void 0)},oM=(e,t,n)=>{if(t.selectedLinearElement?.isEditing||t.selectedLinearElement?.isDragging)return!1;if(e.length>1)return!0;let o=e[0];return Y(o)?!1:ne(o)?o.points.length>2&&!n.userAgent.isMobileDevice:!0};var xs=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],ug=(e,t,n,o,i,r,a,s)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...d}=hu(e,r,t,a,ms(s));if(l&&xs(l,o,i))return"rotation";let c=Object.keys(d).filter(u=>{let h=d[u];return h?xs(h,o,i):!1});if(c.length>0)return c[0];if(yr(s)){let[u,h,m,g,f,E]=K(e,t);if(!(ne(e)&&e.points.length<=2)){let x=Ae(e)?0:Es/r.value,y=Es/r.value,w=fu(pt(u-x,h-x),pt(m+x,g+x),pt(f,E),e.angle);for(let[M,b]of Object.entries(w))if(mu(pt(o,i),b,y))return M}}return!1},uM=(e,t,n,o,i,r,a,s)=>e.reduce((l,d)=>{if(l)return l;let c=ug(d,a,t,n,o,i,r,s);return c?{element:d,transformHandleType:c}:null},null),pM=([e,t,n,o],i,r,a,s,l)=>{let d=fs([e,t,n,o,(e+n)/2,(t+o)/2],0,a,s,ms(l)),c=Object.keys(d).find(u=>{let h=d[u];return h&&xs(h,i,r)});if(c)return c;if(yr(l)){let u=(e+n)/2,h=(t+o)/2,m=Es/a.value,g=fu(pt(e-m,t-m),pt(n+m,o+m),pt(u,h),0);for(let[f,E]of Object.entries(g))if(mu(pt(i,r),E,m))return f}return!1},gs=["ns","nesw","ew","nwse"],pg=(e,t)=>{let n=gs.indexOf(e);if(n>=0){let o=Math.round(t/(Math.PI/4));e=gs[(n+o)%gs.length]}return e},hM=e=>{let{element:t,transformHandleType:n}=e,o=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":o?i="nesw":i="nwse";break;case"ne":case"sw":o?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=pg(i,t.angle)),i?`${i}-resize`:""},fu=([e,t],[n,o],i,r)=>{let a=wr(pt(e,t),i,r),s=wr(pt(n,t),i,r),l=wr(pt(e,o),i,r),d=wr(pt(n,o),i,r);return{n:[a,s],e:[s,d],s:[d,l],w:[l,a]}};I();import{KEYS as ht}from"@excalidraw/common";I();I();function gu(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=gu(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function Eu(){for(var e=0,t,n,o="";e<arguments.length;)(t=arguments[e++])&&(n=gu(t))&&(o&&(o+=" "),o+=n);return o}var Me=ii(Cu(),1),p=ii(Ss(),1);import{THEME as Lg}from"@excalidraw/common";var vt=e=>"var(--icon-fill-color)",Ou=e=>e===Lg.LIGHT?"#fff":"#1e1e1e",P=(e,t=512)=>{let{width:n=512,height:o=n,mirror:i,style:r,...a}=typeof t=="number"?{width:t}:t;return(0,p.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${o}`,className:Eu({"rtl-mirror":i}),style:r,...a,children:typeof e=="string"?(0,p.jsx)("path",{fill:"currentColor",d:e}):e})},L={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},V={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},Ve={width:40,height:20},kM=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("rect",{x:3,y:8,width:18,height:4,rx:1}),(0,p.jsx)("line",{x1:12,y1:8,x2:12,y2:21}),(0,p.jsx)("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),(0,p.jsx)("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),L),TM=P((0,p.jsxs)("svg",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,p.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),L),LM=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,p.jsx)("circle",{cx:"12",cy:"19",r:"1"}),(0,p.jsx)("circle",{cx:"12",cy:"5",r:"1"})]}),L),CM=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,p.jsx)("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,p.jsx)("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]}),L),BM=P((0,p.jsxs)("svg",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),(0,p.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),(0,p.jsx)("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),L),DM=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M6.5 9.5l3.5 -3"}),(0,p.jsx)("path",{d:"M14 5.5l3 1.5"}),(0,p.jsx)("path",{d:"M18.5 10l-2.5 7"}),(0,p.jsx)("path",{d:"M13.5 17.5l-7 -5"})]}),L),GM=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,p.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,p.jsx)("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:(0,p.jsx)("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),(0,p.jsx)("g",{mask:"url(#UnlockedIcon)",children:(0,p.jsx)("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),V),OM=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,p.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),(0,p.jsx)("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),V),RM=P((0,p.jsx)("g",{fill:"currentColor",children:(0,p.jsx)("path",{d:"M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3"})}),{width:24,height:24}),FM=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),(0,p.jsx)("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),NM=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),(0,p.jsx)("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),HM=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),(0,p.jsx)("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),zM=P((0,p.jsx)("g",{fill:"currentColor",children:(0,p.jsx)("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),vs=P((0,p.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),(0,p.jsx)("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),WM=P((0,p.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,children:[(0,p.jsx)("path",{d:"M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255"}),(0,p.jsx)("path",{d:"M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M5 17c0 1.42 .316 2.805 1 4"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),Ru=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),L),Fu=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),L),Nu=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("circle",{cx:"12",cy:"12",r:"9"})]}),L),Hu=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,p.jsx)("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),(0,p.jsx)("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),L),zu=P((0,p.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),V),_M=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),(0,p.jsx)("path",{d:"M16 7h4"}),(0,p.jsx)("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),L),Wu=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),(0,p.jsx)("path",{d:"m11.25 5.417 3.333 3.333"})]}),V),_u=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),(0,p.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),(0,p.jsx)("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,p.jsx)("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,p.jsx)("polyline",{points:"5 20 11 4 13 4 20 20"})]}),L),jM=P((0,p.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 7v-2h13v2"}),(0,p.jsx)("path",{d:"M10 5v14"}),(0,p.jsx)("path",{d:"M12 19h-4"}),(0,p.jsx)("path",{d:"M15 13v-1h6v1"}),(0,p.jsx)("path",{d:"M18 12v7"}),(0,p.jsx)("path",{d:"M17 19h2"})]}),L),ju=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M12.5 6.667h.01"}),(0,p.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),(0,p.jsx)("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),(0,p.jsx)("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),V),Vu=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),(0,p.jsx)("path",{d:"M18 13.3l-6.3 -6.3"})]}),L),VM=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),V),YM=P((0,p.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),V),UM=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M21 21l-6 -6"}),(0,p.jsx)("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),(0,p.jsx)("path",{d:"M3 4v4h4"})]}),L),XM=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),V),$M=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("polyline",{points:"12 16 18 10 12 4"}),(0,p.jsx)("polyline",{points:"8 4 2 10 8 16"})]}),V),ZM=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,p.jsx)("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),V),qM=P((0,p.jsx)("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),V),KM=P((0,p.jsx)("g",{stroke:"currentColor",strokeLinejoin:"round",children:(0,p.jsx)("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...V,strokeWidth:1.5}),QM=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,p.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,p.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),L),JM=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),V),eP=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,p.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,p.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),tP=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,p.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,p.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),nP=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),V),oP=P((0,p.jsx)("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),V),iP=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),(0,p.jsx)("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),V),rP=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),(0,p.jsx)("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),L),aP=P((0,p.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),sP=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),(0,p.jsx)("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),V),lP=P("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),dP=P("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),cP=P((0,p.jsx)("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),V),uP=P("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),pP=P("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),hP=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),(0,p.jsx)("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),(0,p.jsx)("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),L),mP=P((0,p.jsx)("g",{strokeWidth:1.5,children:(0,p.jsx)("path",{d:"M6 18l12 -12"})}),L),fP=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M15 8h.01"}),(0,p.jsx)("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),(0,p.jsx)("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),(0,p.jsx)("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),(0,p.jsx)("path",{d:"M19 16v6"}),(0,p.jsx)("path",{d:"M22 19l-3 3l-3 -3"})]}),L),gP=P("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),EP=P("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),xP=P("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),yP=P("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),wP=P("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),bP=P((0,p.jsx)("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),V),MP=P((0,p.jsx)("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),V),PP=P("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),IP=P((0,p.jsx)("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),V),SP=P("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),vP=P("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),AP=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),(0,p.jsx)("path",{d:"M12 14v-11"}),(0,p.jsx)("path",{d:"M9 6l3 -3l3 3"})]}),L),kP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),(0,p.jsx)("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64}),TP=P((0,p.jsx)("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024}),Yu=(0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 10l0 10"}),(0,p.jsx)("path",{d:"M12 10l4 4"}),(0,p.jsx)("path",{d:"M12 10l-4 4"}),(0,p.jsx)("path",{d:"M4 4l16 0"})]}),Uu=(0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 5l0 14"}),(0,p.jsx)("path",{d:"M16 9l-4 -4"}),(0,p.jsx)("path",{d:"M8 9l4 -4"})]}),LP=P(Uu,L),CP=P(Uu,{...L,style:{transform:"rotate(180deg)"}}),BP=P(Yu,L),DP=P(Yu,{...L,style:{transform:"rotate(180deg)"}}),GP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),OP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),RP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),FP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),NP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),HP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),zP=P((0,p.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),V),WP=P((0,p.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),V),_P=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,p.jsx)("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),(0,p.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),(0,p.jsx)("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),L),jP=P("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),VP=P("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),YP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,p.jsx)("path",{d:"M15 5 5 15M5 5l10 10"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),UP=P("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),XP=P("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),$P=P("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),ZP=Me.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:vt(e)}),(0,p.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:vt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:vt(e)}),(0,p.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:vt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:Ou(e),stroke:vt(e),strokeWidth:"6",children:[(0,p.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),qP=Me.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:vt(e)}),(0,p.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:vt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:vt(e)}),(0,p.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:vt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:Ou(e),stroke:vt(e),strokeWidth:"6",children:[(0,p.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),(0,p.jsx)("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),KP=P((0,p.jsx)("g",{strokeWidth:1.25,children:(0,p.jsx)("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),V),QP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,p.jsx)("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:(0,p.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),(0,p.jsx)("g",{mask:"url(#FillHachureIcon)",children:(0,p.jsx)("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),V),JP=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("g",{clipPath:"url(#a)",children:[(0,p.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,p.jsx)("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:(0,p.jsx)("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,p.jsx)("g",{mask:"url(#FillCrossHatchIcon)",children:(0,p.jsx)("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),eI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("g",{clipPath:"url(#a)",children:(0,p.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...V,fill:"currentColor"}),tI=P((0,p.jsx)(p.Fragment,{children:(0,p.jsx)("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),V),nI=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),V),oI=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),V),iI=Me.default.memo(({theme:e})=>P((0,p.jsx)("path",{d:"M6 10H34",stroke:vt(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),rI=P((0,p.jsxs)("g",{strokeWidth:"2",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 12h2"}),(0,p.jsx)("path",{d:"M17 12h2"}),(0,p.jsx)("path",{d:"M11 12h2"})]}),L),aI=P((0,p.jsxs)("g",{strokeWidth:"2",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 12v.01"}),(0,p.jsx)("path",{d:"M8 12v.01"}),(0,p.jsx)("path",{d:"M12 12v.01"}),(0,p.jsx)("path",{d:"M16 12v.01"}),(0,p.jsx)("path",{d:"M20 12v.01"})]}),L),sI=P((0,p.jsx)("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),V),lI=P((0,p.jsx)("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),V),dI=P((0,p.jsx)("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),V),cI=P((0,p.jsxs)("svg",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),(0,p.jsx)("path",{d:"M13.3333 3.33331V3.34331"}),(0,p.jsx)("path",{d:"M16.6667 3.33331V3.34331"}),(0,p.jsx)("path",{d:"M16.6667 6.66669V6.67669"}),(0,p.jsx)("path",{d:"M16.6667 10V10.01"}),(0,p.jsx)("path",{d:"M3.33334 13.3333V13.3433"}),(0,p.jsx)("path",{d:"M16.6667 13.3333V13.3433"}),(0,p.jsx)("path",{d:"M3.33334 16.6667V16.6767"}),(0,p.jsx)("path",{d:"M6.66666 16.6667V16.6767"}),(0,p.jsx)("path",{d:"M10 16.6667V16.6767"}),(0,p.jsx)("path",{d:"M13.3333 16.6667V16.6767"}),(0,p.jsx)("path",{d:"M16.6667 16.6667V16.6767"})]}),V),uI=P((0,p.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),(0,p.jsx)("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),(0,p.jsx)("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),(0,p.jsx)("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),(0,p.jsx)("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),(0,p.jsx)("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),(0,p.jsx)("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),(0,p.jsx)("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),(0,p.jsx)("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),(0,p.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),(0,p.jsx)("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),(0,p.jsx)("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),L),pI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",opacity:.3,strokeWidth:2,fill:"none",strokeLinecap:"round",children:[(0,p.jsx)("path",{d:"M7,11 H19"}),(0,p.jsx)("path",{d:"M25,6 L33,16 M33,6 L25,16"})]}),Ve)),hI=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:(0,p.jsx)("path",{d:"M7,11 H33 M23,5 L33,11 L23,17"})}),Ve)),mI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[(0,p.jsx)("path",{d:"M7,11 H23",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("path",{d:"M23,5 L35,11 L23,17 Z"})]}),Ve)),fI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",children:[(0,p.jsx)("path",{d:"M7,11 H23"}),(0,p.jsx)("path",{d:"M23,5 L35,11 L23,17 Z"})]}),Ve)),gI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,p.jsx)("path",{d:"M7,11 H25",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("circle",{cx:"29",cy:"11",r:"4"})]}),Ve)),EI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[(0,p.jsx)("path",{d:"M7,11 H25",strokeLinecap:"round"}),(0,p.jsx)("circle",{cx:"29",cy:"11",r:"4"})]}),Ve)),xI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[(0,p.jsx)("path",{d:"M7,11 H21",strokeWidth:2,strokeLinecap:"round"}),(0,p.jsx)("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),Ve)),yI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,strokeLinecap:"round",children:[(0,p.jsx)("path",{d:"M7,11 H21"}),(0,p.jsx)("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),Ve)),wI=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",children:(0,p.jsx)("path",{d:"M11,11 H31 M31,5 V17"})}),Ve)),bI=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,p.jsx)("path",{d:"M35,11 H7 M15,5 V17"})}),Ve)),MI=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,p.jsx)("path",{d:"M35,11 H7 M15,11 L7,5 M15,11 L7,17"})}),Ve)),PI=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,p.jsx)("path",{d:"M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17"})}),Ve)),II=Me.default.memo(({flip:e=!1})=>P((0,p.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,p.jsx)("path",{d:"M35,11 H7 M15,5 V17 M7,5 V17"})}),Ve)),SI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[(0,p.jsx)("path",{d:"M35,11 H19 M11,11 H7 M7,5 V17"}),(0,p.jsx)("circle",{cx:"15",cy:"11",r:"4"})]}),Ve)),vI=Me.default.memo(({flip:e=!1})=>P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[(0,p.jsx)("path",{d:"M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17"}),(0,p.jsx)("circle",{cx:"23",cy:"11",r:"4"})]}),Ve)),AI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("g",{clipPath:"url(#a)",children:(0,p.jsx)("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),kI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("g",{clipPath:"url(#a)",children:(0,p.jsx)("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),TI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("g",{clipPath:"url(#a)",children:(0,p.jsx)("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:"a",children:(0,p.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),V),LI=P((0,p.jsx)(p.Fragment,{children:(0,p.jsx)("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),V),CI=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 7v-2h13v2"}),(0,p.jsx)("path",{d:"M10 5v14"}),(0,p.jsx)("path",{d:"M12 19h-4"}),(0,p.jsx)("path",{d:"M15 13v-1h6v1"}),(0,p.jsx)("path",{d:"M18 12v7"}),(0,p.jsx)("path",{d:"M17 19h2"})]}),L),BI=P((0,p.jsx)(p.Fragment,{children:(0,p.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M7 12h10"}),(0,p.jsx)("path",{d:"M7 5v14"}),(0,p.jsx)("path",{d:"M17 5v14"}),(0,p.jsx)("path",{d:"M15 19h4"}),(0,p.jsx)("path",{d:"M15 5h4"}),(0,p.jsx)("path",{d:"M5 19h4"}),(0,p.jsx)("path",{d:"M5 5h4"})]})}),L),DI=P((0,p.jsx)(p.Fragment,{children:(0,p.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,p.jsx)("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),V),GI=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M7 8l-4 4l4 4"}),(0,p.jsx)("path",{d:"M17 8l4 4l-4 4"}),(0,p.jsx)("path",{d:"M14 4l-4 16"})]}),L);var OI=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,p.jsx)("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),(0,p.jsx)("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),L),RI=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,p.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),(0,p.jsx)("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),L),FI=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,p.jsx)("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),(0,p.jsx)("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),L),NI=Me.default.memo(({theme:e})=>P((0,p.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),(0,p.jsx)("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),L)),HI=Me.default.memo(({theme:e})=>P((0,p.jsxs)("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),(0,p.jsx)("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),L)),zI=Me.default.memo(({theme:e})=>P((0,p.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),(0,p.jsx)("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),(0,p.jsx)("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),L)),WI=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M21 19h-18l9 -15"}),(0,p.jsx)("path",{d:"M20.615 15.171h.015"}),(0,p.jsx)("path",{d:"M19.515 11.771h.015"}),(0,p.jsx)("path",{d:"M17.715 8.671h.015"}),(0,p.jsx)("path",{d:"M15.415 5.971h.015"})]}),L),_I=P((0,p.jsx)("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512}),jI=P((0,p.jsx)("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"})),VI=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,p.jsx)("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),(0,p.jsx)("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,p.jsx)("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),L),YI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),(0,p.jsx)("path",{d:"M7 11l5 5l5 -5"}),(0,p.jsx)("path",{d:"M12 4l0 12"})]}),L),UI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),(0,p.jsx)("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),L),XI=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,p.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,p.jsx)("path",{d:"M9.15 14.85l8.85 -10.85"}),(0,p.jsx)("path",{d:"M6 4l8.85 10.85"})]}),L),$I=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),(0,p.jsx)("path",{d:"M12 17l0 .01"}),(0,p.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),ZI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M7 4v16l13 -8z"})]}),L),qI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),L),KI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 12l5 5l10 -10"})]}),L),QI=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),(0,p.jsx)("path",{d:"M12 9v4"}),(0,p.jsx)("path",{d:"M12 17h.01"})]}),L),JI=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M11 7l6 6"}),(0,p.jsx)("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),L),eS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 3l-4 7h8z"}),(0,p.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,p.jsx)("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),L),tS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 7l16 0"}),(0,p.jsx)("path",{d:"M4 17l16 0"}),(0,p.jsx)("path",{d:"M7 4l0 16"}),(0,p.jsx)("path",{d:"M17 4l0 16"})]}),L),nS=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"}),(0,p.jsx)("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})]}),L),oS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 10l-2 1l8 4l8 -4l-2 -1"}),(0,p.jsx)("path",{d:"M4 15l8 4l8 -4"}),(0,p.jsx)("path",{d:"M12 4v7"}),(0,p.jsx)("path",{d:"M15 8l-3 3l-3 -3"})]}),L),iS=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{d:"M4.16602 10H15.8327"}),(0,p.jsx)("path",{d:"M12.5 13.3333L15.8333 10"}),(0,p.jsx)("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),V),rS=P((0,p.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[(0,p.jsx)("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),(0,p.jsx)("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),aS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,p.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,p.jsx)("path",{d:"M15 6l3 3"}),(0,p.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,p.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),L),sS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,p.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,p.jsx)("path",{d:"M15 6l3 3"}),(0,p.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,p.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),L),lS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),(0,p.jsx)("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),(0,p.jsx)("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),(0,p.jsx)("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),(0,p.jsx)("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),(0,p.jsx)("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),L),dS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),(0,p.jsx)("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),(0,p.jsx)("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),(0,p.jsx)("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),L),cS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),(0,p.jsx)("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),L),uS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),(0,p.jsx)("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),(0,p.jsx)("path",{d:"M3 3l18 18"})]}),L),pS=P((0,p.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,p.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,p.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,p.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,p.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,p.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),L),hS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,p.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,p.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,p.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,p.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,p.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),L),mS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),(0,p.jsx)("path",{d:"M21 21l-6 -6"})]}),L),fS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),(0,p.jsx)("path",{d:"M12 7v5l3 3"}),(0,p.jsx)("path",{d:"M19 16l-2 3h4l-2 3"})]}),L),gS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 8l0 4l2 2"}),(0,p.jsx)("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]}),L),ES=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),(0,p.jsx)("path",{d:"M5 10a7 7 0 0 0 14 0"}),(0,p.jsx)("path",{d:"M8 21l8 0"}),(0,p.jsx)("path",{d:"M12 17l0 4"})]}),L),xS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 3l18 18"}),(0,p.jsx)("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),(0,p.jsx)("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),(0,p.jsx)("path",{d:"M8 21l8 0"}),(0,p.jsx)("path",{d:"M12 17l0 4"})]}),L),yS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),L),wS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),(0,p.jsx)("path",{d:"M12 20v.01"}),(0,p.jsx)("path",{d:"M16 20v.01"}),(0,p.jsx)("path",{d:"M8 20v.01"}),(0,p.jsx)("path",{d:"M4 20v.01"}),(0,p.jsx)("path",{d:"M4 16v.01"}),(0,p.jsx)("path",{d:"M4 12v.01"}),(0,p.jsx)("path",{d:"M4 8v.01"}),(0,p.jsx)("path",{d:"M4 4v.01"}),(0,p.jsx)("path",{d:"M8 4v.01"}),(0,p.jsx)("path",{d:"M12 4v.01"}),(0,p.jsx)("path",{d:"M16 4v.01"}),(0,p.jsx)("path",{d:"M20 4v.01"}),(0,p.jsx)("path",{d:"M20 8v.01"}),(0,p.jsx)("path",{d:"M20 12v.01"}),(0,p.jsx)("path",{d:"M20 16v.01"}),(0,p.jsx)("path",{d:"M20 20v.01"})]}),L),bS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 3v18"}),(0,p.jsx)("path",{d:"M19 21v-18"}),(0,p.jsx)("path",{d:"M5 7h14"}),(0,p.jsx)("path",{d:"M5 15h14"}),(0,p.jsx)("path",{d:"M8 13v4"}),(0,p.jsx)("path",{d:"M11 13v4"}),(0,p.jsx)("path",{d:"M16 13v4"}),(0,p.jsx)("path",{d:"M14 5v4"}),(0,p.jsx)("path",{d:"M11 5v4"}),(0,p.jsx)("path",{d:"M8 5v4"}),(0,p.jsx)("path",{d:"M3 21h18"})]}),L),MS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 12l18 0"}),(0,p.jsx)("path",{d:"M7 16l10 0l-10 5l0 -5"}),(0,p.jsx)("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),L),PS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M12 3l0 18"}),(0,p.jsx)("path",{d:"M16 7l0 10l5 0l-5 -10"}),(0,p.jsx)("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),L),IS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),(0,p.jsx)("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),(0,p.jsx)("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),L),SS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),(0,p.jsx)("path",{d:"M22 22l-3 -3"}),(0,p.jsx)("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),(0,p.jsx)("path",{d:"M3 11v-1"}),(0,p.jsx)("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),(0,p.jsx)("path",{d:"M10 3h1"}),(0,p.jsx)("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),L),vS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,p.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,p.jsx)("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),(0,p.jsx)("path",{d:"M10 15l2 6l2 -6"}),(0,p.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),L),AS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,p.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,p.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),(0,p.jsx)("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),(0,p.jsx)("path",{d:"M11 21v-6l3 6v-6"})]}),L),kS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),(0,p.jsx)("path",{d:"M4 8l5 0"}),(0,p.jsx)("path",{d:"M15 8l4 0"})]}),L),TS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),(0,p.jsx)("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,p.jsx)("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,p.jsx)("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),(0,p.jsx)("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),L),LS=P((0,p.jsxs)("g",{stroke:"currentColor",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...L,strokeWidth:1.5}),CS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"}),(0,p.jsx)("path",{d:"M21 12h-13l3 -3"}),(0,p.jsx)("path",{d:"M11 15l-3 -3"})]}),L),BS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),(0,p.jsx)("path",{d:"M10 9l5 3l-5 3z"})]}),L),DS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 6h18"}),(0,p.jsx)("path",{d:"M3 12h18"}),(0,p.jsx)("path",{d:"M3 18h18"}),(0,p.jsx)("path",{d:"M6 3v18"}),(0,p.jsx)("path",{d:"M12 3v18"}),(0,p.jsx)("path",{d:"M18 3v18"})]}),L),GS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),(0,p.jsx)("path",{d:"M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),(0,p.jsx)("path",{d:"M17 5c-6.627 0 -12 5.373 -12 12"})]}),L),OS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 18l12 -12"}),(0,p.jsx)("path",{d:"M18 10v-4h-4"})]}),L),RS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7"}),(0,p.jsx)("path",{d:"M18 4l3 3l-3 3"})]}),L),FS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M16,12L20,9L16,6"}),(0,p.jsx)("path",{d:"M6 20c0 -6.075 4.925 -11 11 -11h3"})]}),L),NS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 9l6 6l6 -6"})]}),L),HS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 15l6 -6l6 6"})]}),L),zS=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 15l6 -6l6 6"})]}),L),WS=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),(0,p.jsx)("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]}),L),_S=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M5 7l0 10"}),(0,p.jsx)("path",{d:"M7 5l10 0"}),(0,p.jsx)("path",{d:"M7 19l10 0"}),(0,p.jsx)("path",{d:"M19 7l0 10"})]}),L),jS=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"10",y:"4",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"16",y:"4",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"4",y:"10",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"10",y:"10",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"16",y:"10",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"4",y:"16",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"10",y:"16",width:"4",height:"4",rx:"1"}),(0,p.jsx)("rect",{x:"16",y:"16",width:"4",height:"4",rx:"1"})]}),L),VS=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("rect",{x:"7",y:"6",width:"10",height:"8",rx:"1",strokeDasharray:"2 2"}),(0,p.jsx)("line",{x1:"3",y1:"6",x2:"3",y2:"14"}),(0,p.jsx)("polyline",{points:"2 8 3 6 4 8"}),(0,p.jsx)("polyline",{points:"2 12 3 14 4 12"}),(0,p.jsx)("line",{x1:"7",y1:"18",x2:"17",y2:"18"}),(0,p.jsx)("polyline",{points:"9 17 7 18 9 19"}),(0,p.jsx)("polyline",{points:"15 17 17 18 15 19"})]}),L),YS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1"}),(0,p.jsx)("path",{d:"M4 12h7a1 1 0 0 1 1 1v7"})]}),L),US=P((0,p.jsx)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:.5,viewBox:"0 0 640 512",children:(0,p.jsx)("path",{d:"M15 15C24.4 5.7 39.6 5.7 49 15l63 63L112 40c0-13.3 10.7-24 24-24s24 10.7 24 24l0 96c0 13.3-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l38.1 0L15 49C5.7 39.6 5.7 24.4 15 15zM133.5 243.9C158.6 193.6 222.7 112 320 112s161.4 81.6 186.5 131.9c3.8 7.6 3.8 16.5 0 24.2C481.4 318.4 417.3 400 320 400s-161.4-81.6-186.5-131.9c-3.8-7.6-3.8-16.5 0-24.2zM320 320a64 64 0 1 0 0-128 64 64 0 1 0 0 128zM591 15c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-63 63 38.1 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24s24 10.7 24 24l0 38.1 63-63zM15 497c-9.4-9.4-9.4-24.6 0-33.9l63-63L40 400c-13.3 0-24-10.7-24-24s10.7-24 24-24l96 0c13.3 0 24 10.7 24 24l0 96c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-38.1L49 497c-9.4 9.4-24.6 9.4-33.9 0zm576 0l-63-63 0 38.1c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24l96 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-38.1 0 63 63c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0z"})})),XS=P((0,p.jsxs)("g",{strokeWidth:1.5,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 6l8 0"}),(0,p.jsx)("path",{d:"M16 6l4 0"}),(0,p.jsx)("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 12l2 0"}),(0,p.jsx)("path",{d:"M10 12l10 0"}),(0,p.jsx)("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 18l11 0"}),(0,p.jsx)("path",{d:"M19 18l1 0"})]}),L),$S=P((0,p.jsxs)("g",{strokeWidth:1,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4"})]}),L),ZS=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),(0,p.jsx)("path",{d:"M13.5 6.5l4 4"})]}),L),qS=P((0,p.jsxs)("g",{strokeWidth:1,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M11 7l-5 5l5 5"}),(0,p.jsx)("path",{d:"M17 7l-5 5l5 5"})]}),L),KS=P((0,p.jsxs)("g",{strokeWidth:"1.75",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),(0,p.jsx)("path",{d:"M15 4l0 16"})]}),L),QS=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1"})]}),L),JS=P((0,p.jsxs)("g",{strokeWidth:"1.25",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M3 4l18 0"}),(0,p.jsx)("path",{d:"M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10"}),(0,p.jsx)("path",{d:"M12 16l0 4"}),(0,p.jsx)("path",{d:"M9 20l6 0"}),(0,p.jsx)("path",{d:"M8 12l3 -3l2 2l3 -3"})]}),L);var ev=P((0,p.jsxs)("g",{strokeWidth:"1.5",children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("polyline",{points:"9 6 15 12 9 18"})]}),L),tv=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,p.jsx)("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 6l8 0"}),(0,p.jsx)("path",{d:"M16 6l4 0"}),(0,p.jsx)("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 12l2 0"}),(0,p.jsx)("path",{d:"M10 12l10 0"}),(0,p.jsx)("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,p.jsx)("path",{d:"M4 18l11 0"}),(0,p.jsx)("path",{d:"M19 18l1 0"})]}),L);var Xu=[{icon:vs,value:"selection",key:ht.V,numericKey:void 0,fillable:!0,myocSimplifiedMode:!0},{icon:Ru,value:"rectangle",key:ht.R,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Fu,value:"diamond",key:ht.D,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Nu,value:"ellipse",key:ht.O,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Hu,value:"arrow",key:ht.A,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:zu,value:"line",key:ht.L,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Wu,value:"freedraw",key:[ht.P,ht.X],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:_u,value:"text",key:ht.T,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:ju,value:"image",key:[ht.I],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:Vu,value:"eraser",key:ht.E,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0}],Cg=e=>e.state.preferredSelectionTool.type==="lasso"?[{value:"lasso",icon:vs,key:ht.V,fillable:!0,myocSimplifiedMode:!0},...Xu.slice(1)]:Xu,dv=(e,t)=>Cg(t).find((o,i)=>o.numericKey!=null&&e===o.numericKey?.toString()||o.key&&(typeof o.key=="string"?o.key===e:o.key.includes(e)))?.value||null,cv=(e,t)=>{let n=Q(e,t);return n?e.type==="arrow"?Qo({...n,...D.getBoundTextElementPosition(e,n,t)},t):Qo(n,t):null};I();var mv=(e,t)=>!!(!e.viewModeEnabled&&e.openDialog?.name!=="elementLinkSelector"&&(e.activeTool.type!=="custom"&&(e.editingTextElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="lasso"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||Ft(t,e).length));I();import{pointFrom as Pr}from"@excalidraw/math";import{DEFAULT_FONT_FAMILY as Bg,DEFAULT_FONT_SIZE as Dg,TEXT_ALIGN as Gg,VERTICAL_ALIGN as Og,getSizeFromPoints as Rg,randomId as Fg,arrayToMap as Ng,assertNever as As,cloneJSON as Zu,getFontString as Hg,isDevEnv as zg,toBrandedType as Wg,getLineHeight as _g}from"@excalidraw/common";var Ir={width:100,height:0},On=100,jg=(e,t,n)=>{let o=qn({x:0,y:0,textAlign:Gg.CENTER,verticalAlign:Og.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:o.id})}),Bi(o,e,n),[e,o]},$u=(e,t,n,o,i)=>{let r,a;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let c=t?.width??On,u=t?.height??On,h;t.id&&(h=o.getElement(t.id),h||console.error(`No element for start binding with id ${t.id} found`));let m=t.x||e.x-c,g=t.y||e.y-u/2,f=h?h.type:t.type;if(f){if(f==="text"){let E="";h&&h.type==="text"?E=h.text:t.type==="text"&&(E=t.text),E||console.error(`No text found for start binding text element for ${e.id}`),r=qn({x:m,y:g,type:"text",...h,...t,text:E}),Object.assign(r,{x:t.x||e.x-r.width,y:t.y||e.y-r.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{r=Zn({x:m,y:g,width:c,height:u,...h,...t,type:f});break}default:As(e,`Unhandled element start type "${t.type}"`,!0)}Rt(e,r,"orbit","start",i)}}if(n){let c=n?.height??On,u=n?.width??On,h;n.id&&(h=o.getElement(n.id),h||console.error(`No element for end binding with id ${n.id} found`));let m=n.x||e.x+e.width,g=n.y||e.y-c/2,f=h?h.type:n.type;if(f){if(f==="text"){let E="";h&&h.type==="text"?E=h.text:n.type==="text"&&(E=n.text),E||console.error(`No text found for end binding text element for ${e.id}`),a=qn({x:m,y:g,type:"text",...h,...n,text:E}),Object.assign(a,{y:n.y||e.y-a.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{a=Zn({x:m,y:g,width:u,height:c,...h,...n,type:f});break}default:As(e,`Unhandled element end type "${f}"`,!0)}Rt(e,a,"orbit","end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:r,endBoundElement:a};let s=e.points.length-1,l=.5,d=Zu(e.points);return e.points[s][0]>e.points[s-1][0]&&(d[0][0]=l,d[s][0]-=l),e.points[s][0]<e.points[s-1][0]&&(d[0][0]=-l,d[s][0]+=l),e.points[s][1]>e.points[s-1][1]&&(d[0][1]=l,d[s][1]-=l),e.points[s][1]<e.points[s-1][1]&&(d[0][1]=-l,d[s][1]+=l),Object.assign(e,D.getNormalizeElementPointsAndCoords({...e,points:d})),{linearElement:e,startBoundElement:r,endBoundElement:a}},ks=class{excalidrawElements=new Map;add=t=>{t&&this.excalidrawElements.set(t.id,t)};getElements=()=>Sa(Array.from(this.excalidrawElements.values()));getElementsMap=()=>Wg(Ng(this.getElements()));getElement=t=>this.excalidrawElements.get(t)},kv=(e,t)=>{if(!e)return[];let n=Zu(e),o=new ks,i=new Map,r=new Map;for(let l of n){let d,c=l.id;switch(t?.regenerateIds!==!1&&Object.assign(l,{id:Fg()}),l.type){case"rectangle":case"ellipse":case"diamond":{let h=l?.label?.text&&l.width===void 0?0:l?.width||On,m=l?.label?.text&&l.height===void 0?0:l?.height||On;d=Zn({...l,width:h,height:m});break}case"line":{let h=l.width||Ir.width,m=l.height||Ir.height;d=Vc({width:h,height:m,points:[Pr(0,0),Pr(h,m)],...l});break}case"arrow":{let h=l.width||Ir.width,m=l.height||Ir.height;d=pr({width:h,height:m,endArrowhead:"arrow",points:[Pr(0,0),Pr(h,m)],...l,type:"arrow"}),Object.assign(d,Rg(d.points));break}case"text":{let h=l?.fontFamily||Bg,m=l?.fontSize||Dg,g=l?.lineHeight||_g(h),f=l.text??"",E=Go(f),x=ot(E,Hg({fontFamily:h,fontSize:m}),g);d=qn({width:x.width,height:x.height,fontFamily:h,fontSize:m,...l});break}case"image":{d=Yc({width:l?.width||On,height:l?.height||On,...l});break}case"frame":{d=Wc({x:0,y:0,...l});break}case"magicframe":{d=_c({x:0,y:0,...l});break}case"freedraw":case"iframe":case"embeddable":{d=l;break}default:d=l,As(l,`Unhandled element type "${l.type}"`,!0)}o.getElement(d.id)?console.error(`Duplicate id found for ${d.id}`):(o.add(d),i.set(d.id,l),c&&r.set(c,d.id))}let a=o.getElementsMap(),s=new ho(a);for(let[l,d]of i){let c=o.getElement(l);switch(d.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if(d.label?.text){let[u,h]=jg(c,d?.label,s);if(o.add(u),o.add(h),j(u)){let m=d.type==="arrow"?d?.start:void 0,g=d.type==="arrow"?d?.end:void 0;if(m&&m.id){let y=r.get(m.id);y&&Object.assign(m,{id:y})}if(g&&g.id){let y=r.get(g.id);y&&Object.assign(g,{id:y})}let{linearElement:f,startBoundElement:E,endBoundElement:x}=$u(u,m,g,o,s);u=f,o.add(f),o.add(E),o.add(x)}}else switch(d.type){case"arrow":{let{start:u,end:h}=d;if(u&&u.id){let E=r.get(u.id);Object.assign(u,{id:E})}if(h&&h.id){let E=r.get(h.id);Object.assign(h,{id:E})}let{linearElement:m,startBoundElement:g,endBoundElement:f}=$u(c,u,h,o,s);o.add(m),o.add(g),o.add(f);break}}break}}}for(let[l,d]of i){if(d.type!=="frame"&&d.type!=="magicframe")continue;let c=o.getElement(l);if(!c)throw new Error(`Excalidraw element with id ${l} doesn't exist`);let u=[];d.children.forEach(b=>{let S=r.get(b);if(!S)throw new Error(`Element with ${b} wasn't mapped correctly`);let v=o.getElement(S);if(!v)throw new Error(`Frame element with id ${S} doesn't exist`);Object.assign(v,{frameId:c.id}),v?.boundElements?.forEach(k=>{let T=o.getElement(k.id);if(!T)throw new Error(`Bound element with id ${k.id} doesn't exist`);Object.assign(T,{frameId:c.id}),u.push(T)}),u.push(v)});let[h,m,g,f]=We(u),E=10;h=h-E,m=m-E,g=g+E,f=f+E;let x=c?.x||h,y=c?.y||m,w=c?.width||g-h,M=c?.height||f-m;Object.assign(c,{x,y,width:w,height:M}),zg()&&d.children.length&&(c?.x||c?.y||c?.width||c?.height)&&console.info("User provided frame attributes are being considered, if you find this inaccurate, please remove any of the attributes - x, y, width and height so frame coordinates and dimensions are calculated automatically")}return o.getElements()};I();var Dv=({app:e,event:t})=>{let n=e.state;if(n.selectedLinearElement&&e.lastPointerMoveCoords){if(n.selectedLinearElement.draggedFocusPointBinding)return iu(n.selectedLinearElement,e.scene.getNonDeletedElementsMap(),e.lastPointerMoveCoords,e.scene,n,e.getEffectiveGridSize(),t.altKey),!0;if(n.selectedLinearElement.hoverPointIndex!==null&&e.lastPointerMoveEvent&&n.selectedLinearElement.initialState.lastClickedPoint>=0&&n.selectedLinearElement.isDragging)return D.handlePointDragging(e.lastPointerMoveEvent,e,e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y,n.selectedLinearElement),!0}return!1};I();var Vg=e=>{switch(e){case void 0:case null:return null;case"dot":return"circle";case"crowfoot_one":return"cardinality_one";case"crowfoot_many":return"cardinality_many";case"crowfoot_one_or_many":return"cardinality_one_or_many";default:return e}},Rv=e=>{let t=Vg(e);return t===null?null:t};var Wv=e=>e.reduce((t,n)=>t+n.version,0),Sc=e=>{let t=5381;for(let n of Yg(e))t=(t<<5)+t+n.versionNonce;return t>>>0},vc=e=>{let t=5381;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);t=(t<<5)+t+o}return t>>>0},_v=e=>e.filter(t=>!t.isDeleted&&!pc(t)),jv=e=>e.filter(t=>!t.isDeleted),Vv=e=>!e.isDeleted;export{Tn as AppStateDelta,bh as BASE_ARROW_MIN_LENGTH,dd as BASE_BINDING_GAP,Vn as BASE_BINDING_GAP_ELBOW,ae as BASE_PADDING,Pn as BindableElement,Mn as BoundElement,Je as CaptureUpdateAction,Xw as DEFAULT_LINK_SIZE,pu as DEFAULT_OMIT_SIDES,$ as Delta,Ka as DurableIncrement,ja as ElementBounds,Ln as ElementsDelta,Qa as EphemeralIncrement,Vo as FOCUS_POINT_SIZE,eu as FlowChartCreator,Jc as FlowChartNavigator,ke as HEADING_DOWN,Ze as HEADING_LEFT,be as HEADING_RIGHT,rt as HEADING_UP,i0 as INVISIBLY_SMALL_ELEMENT_SIZE,Pa as InvalidFractionalIndexError,D as LinearElementEditor,Ce as MINIMAL_CROP_SIZE,nM as OMIT_SIDES_FOR_FRAME,tM as OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,Xu as SHAPES,ho as Scene,at as ShapeCache,Mc as Store,Jo as StoreChange,Ja as StoreDelta,lr as StoreIncrement,Cn as StoreSnapshot,ut as aabbForElement,Xh as addElementsToFrame,Uf as addNewNodes,nw as addToGroup,Ub as alignElements,o6 as arrangeElements,kh as avoidRectangularCorner,Rt as bindBindingElement,yd as bindElementsToFramesAfterDuplication,Mh as bindOrUnbindBindingElement,Jy as bindOrUnbindBindingElements,ga as bindPointToSnapToElementOutline,hd as bindingProperties,La as boundsContainBounds,od as bumpVersion,Lh as calculateFixedPointForElbowArrowBinding,ro as calculateFixedPointForNonElbowArrowBinding,Z2 as canApplyRoundnessTypeToElement,ml as canBecomePolygon,Cl as canChangeRoundness,xf as canCreateLinkFromElements,ey as canHaveArrowheads,yr as canResizeFromSides,no as charWidth,we as compareHeading,Oo as computeBoundTextPosition,qr as computeContainerDimensionForBoundText,Sx as containsCJK,kv as convertToExcalidrawElements,W4 as createPlaceholderEmbeddableLabel,os as createSrcDoc,W2 as cropElement,hn as deconstructDiamondElement,Wn as deconstructLinearOrFreeDrawElement,pn as deconstructRectanguloidElement,qa as deepCopyElement,E4 as defaultGetElementLinkFromSelection,xx as detectLineHeight,gn as distanceToElement,e4 as distributeElements,Qt as doBoundsIntersect,p4 as dragNewElement,c4 as dragSelectedElements,A0 as duplicateElement,E6 as duplicateElements,tw as editGroupForSelectedElement,de as elementCenterPoint,In as elementOverlapsWithFrame,$o as elementWithCanvasCache,vn as elementsAreInFrameBounds,Td as elementsAreInSameGroup,vd as elementsOverlappingBBox,j4 as embeddableURLValidator,om as excludeElementsInFramesFromSelection,T3 as filterElementsEligibleAsFrameChildren,dv as findShapeByKey,t3 as fixBindingsAfterDeletion,pd as fixDuplicatedBindingsAfterDuplication,aa as flipHeading,O3 as frameAndChildrenSelectedTogether,bl as generateLinearCollisionShape,Qe as generateRoughOptions,Z3 as getActiveTextElement,Gi as getAllHoveredElementAtPoint,vl as getApproxMinLineHeight,Sl as getApproxMinLineWidth,md as getArrowLocalFixedPoints,Km as getArrowheadAngle,Rv as getArrowheadForPicker,je as getArrowheadPoints,qm as getArrowheadSize,Ne as getBindingGap,n3 as getBindingSideMidPoint,ba as getBindingStrategyForDraggingBindingElementEndpoints,Q as getBoundTextElement,qt as getBoundTextElementId,Fx as getBoundTextElementPosition,Ro as getBoundTextMaxHeight,xt as getBoundTextMaxWidth,cv as getBoundTextShape,Ya as getBoundsFromPoints,En as getCenterForBounds,Lb as getClosestElementBounds,Fe as getCommonBoundingBox,We as getCommonBounds,Yh as getCommonFrameId,Ox as getContainerCenter,Kr as getContainerCoords,De as getContainerElement,Sn as getContainingFrame,Yt as getCornerRadius,Oi as getCubicBezierCurveBound,hM as getCursorForResizingElement,Qh as getDefaultFrameName,q2 as getDefaultRoundnessTypeForElement,wl as getDiamondBaseCorners,to as getDiamondPoints,u4 as getDragOffsetXY,Tb as getDraggedElementsBounds,K as getElementAbsoluteCoords,ue as getElementBounds,ka as getElementLineSegments,Oa as getElementPointsCoords,Qo as getElementShape,uM as getElementWithTransformHandleType,wd as getElementsCompletelyInFrame,ze as getElementsInGroup,k3 as getElementsInNewFrame,A3 as getElementsInResizingFrame,b3 as getElementsIntersectingFrame,G3 as getElementsOverlappingFrame,Pd as getElementsWithinSelection,z4 as getEmbedLink,_2 as getFlipAdjustedCropPosition,An as getFrameChildren,Uh as getFrameChildrenInsertionIndex,jh as getFrameLikeElements,D3 as getFrameLikeTitle,qw as getFreedrawOutlineAsSegments,zm as getFreedrawOutlinePoints,Ue as getGlobalFixedPointForBindableElement,Ch as getGlobalFixedPoints,nd as getHeadingForElbowArrowSnap,Kt as getHoveredElementForBinding,Vl as getHoveredElementForFocusPoint,M5 as getInitializedImageElements,Ti as getLineHeightInPx,fn as getLineWidth,K2 as getLinearElementSubType,o5 as getLinkDirectionFromKey,x4 as getLinkIdAndTypeFromSelection,Xd as getLockedLinearCursorAlignSize,d1 as getMaxCharWidth,Ki as getMaximumGroups,wx as getMinCharWidth,Xo as getMinMaxXYFromCurvePathOps,ki as getMinTextElementWidth,Cd as getNewGroupIdsForDuplication,jv as getNonDeletedElements,kd as getNonDeletedGroupIds,zb as getNormalizedDimensions,po as getObservedAppState,ms as getOmitSidesForEditorInterface,hx as getOriginalContainerHeightFromCache,Ua as getPerfectElementSize,ss as getPredecessors,kb as getRectangleBoxAbsoluteCoords,Tm as getRenderOpacity,$5 as getResizeArrowDirection,X5 as getResizeOffsetXY,un as getResizedElementAbsoluteCoords,v3 as getRootElements,Wv as getSceneVersion,Ft as getSelectedElements,Qi as getSelectedElementsByGroup,Ba as getSelectedGroupForElement,dm as getSelectedGroupIdForElement,sm as getSelectedGroupIds,$3 as getSelectionStateForElements,Si as getSnapOutlineMidPoint,X3 as getTargetElements,Zh as getTargetFrame,Rx as getTextElementAngle,Wx as getTextFromElements,l1 as getTextHeight,Al as getTextWidth,Cg as getToolbarTools,pM as getTransformHandleTypeFromCoords,hu as getTransformHandles,fs as getTransformHandlesFromCoords,al as getUncroppedImageElement,Nr as getUncroppedWidthAndHeight,Y3 as getVisibleAndNonSelectedElements,_v as getVisibleElements,Cb as getVisibleSceneBounds,x1 as getWrappedTextLines,S3 as groupByFrameLikes,P3 as groupsAreAtLeastIntersectingTheFrame,I3 as groupsAreCompletelyOutOfFrame,jn as handleBindTextResize,iu as handleFocusPointDrag,g5 as handleFocusPointHover,m5 as handleFocusPointPointerDown,f5 as handleFocusPointPointerUp,ta as hasBackground,Tt as hasBoundTextElement,oM as hasBoundingBox,qx as hasStrokeColor,Qx as hasStrokeStyle,Kx as hasStrokeWidth,Sc as hashElementsVersion,vc as hashString,$e as headingForPoint,No as headingForPointFromElement,yt as headingForPointIsHorizontal,qe as headingIsHorizontal,by as headingIsVertical,Y1 as hitElementBoundText,V1 as hitElementBoundingBox,fy as hitElementBoundingBoxOnly,Lt as hitElementItself,Bt as intersectElementWithLineSegment,$2 as isArrowBoundToElement,j as isArrowElement,Ee as isBindableElement,ia as isBindableElementInsideOtherBindable,Be as isBindingElement,Up as isBindingElementType,Ot as isBindingEnabled,xe as isBoundToContainer,M3 as isCursorInFrame,Vp as isCurvedArrow,Y as isElbowArrow,Hb as isElementCompletelyInViewport,Ta as isElementContainingFrame,Md as isElementInFrame,lm as isElementInGroup,Ad as isElementInViewport,ao as isElementIntersectingFrame,y4 as isElementLink,J2 as isEligibleFrameChildType,ll as isEmbeddableElement,ul as isExcalidrawElement,Bh as isFixedPoint,Hr as isFlowchartNodeElement,fr as isFocusPointVisible,Ii as isFrameElement,ee as isFrameLikeElement,Se as isFreeDrawElement,_p as isFreeDrawElementType,qf as isHTMLSVGElement,Mi as isIframeElement,Pi as isIframeLikeElement,Ae as isImageElement,Ld as isInGroup,Hn as isInitializedImageElement,pc as isInvisiblySmallElement,jt as isLineElement,ne as isLinearElement,Yp as isLinearElementType,dl as isMagicFrameElement,Ex as isMeasureTextSupported,i5 as isNodeInFlowchart,Vv as isNonDeletedElement,Ut as isPathALoop,Xt as isPointInElement,Co as isRectangularElement,cl as isRectanguloidElement,am as isSelectedViaGroup,jp as isSharpArrow,X2 as isSimpleArrow,U3 as isSomeElementSelected,Xp as isTextBindableContainer,te as isTextElement,pl as isUsingAdaptiveRadius,hl as isUsingProportionalRadius,Q2 as isValidPolygon,zx as isValidTextContainer,Zf as loadHTMLImageElement,Ca as makeNextSelectedElementIds,Et as maxBindingDistance_simple,Dv as maybeHandleArrowPointlikeDrag,_4 as maybeParseEmbedSrc,us as measureFontSizeFromWidth,ot as measureText,fw as moveAllLeft,gw as moveAllRight,Yo as moveArrowAboveBindable,hw as moveOneLeft,mw as moveOneRight,Te as mutateElement,pr as newArrowElement,Zn as newElement,He as newElementWith,L4 as newEmbeddableElement,Wc as newFrameElement,D4 as newFreeDrawElement,C4 as newIframeElement,Yc as newImageElement,Vc as newLinearElement,_c as newMagicFrameElement,qn as newTextElement,k5 as normaliseElements,Vg as normalizeArrowhead,yc as normalizeElementOrder,mn as normalizeFixedPoint,P5 as normalizeSVG,Go as normalizeText,qi as omitGroupsContainingFrameLikes,Vh as omitPartialGroups,gd as orderByFractionalIndex,Do as originalContainerCache,w4 as parseElementLinkFromURL,g1 as parseTokens,Dt as pointInsideBounds,e0 as pointInsideBoundsInclusive,D5 as positionElementsOnGrid,eo as projectFixedPointOntoDiagonal,Bi as redrawTextBoundingBox,B4 as refreshTextDimensions,$h as removeAllElementsFromFrame,bd as removeElementsFromFrame,ow as removeFromSelectedGroups,Zw as renderElement,$w as renderSelectionElement,L3 as replaceAllElementsInFrame,lu as rescalePointsInElement,Pl as resetOriginalContainerCache,lg as resizeMultipleElements,rg as resizeSingleElement,ng as resizeSingleTextElement,ug as resizeTest,rm as selectGroup,Sd as selectGroupsForSelectedElements,Id as selectGroupsFromGivenElements,yx as setCustomTextMetricsProvider,Nx as shouldAllowVerticalAlign,B3 as shouldApplyFrameClip,Di as shouldTestInside,mv as showSelectedShapeActions,Ma as snapToMid,Hx as suppportsHorizontalAlign,Sa as syncInvalidIndices,Ed as syncInvalidIndicesImmutable,Yn as syncMovedIndices,Ud as toggleLinePolygonState,Jx as toolIsArrow,U5 as transformElements,Oe as unbindBindingElement,e3 as updateBindings,Re as updateBoundElements,bt as updateBoundPoint,io as updateElbowArrowPoints,C3 as updateFrameMembershipOfSelectedElements,b5 as updateImageCache,Ml as updateOriginalContainerCache,td as validateElbowPoints,Hh as validateFractionalIndices,Jt as vectorToHeading,Zt as wrapText};
28
+ `),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return Rt.set(e,m),m}return Rt.set(e,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}},Z5=e=>{let t;Oi(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),o=gg.Helvetica,i=xg({fontSize:n,fontFamily:o});return lo({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:o,fontSize:n,text:an(t,i,e.width-20),textAlign:"center",verticalAlign:Eg.MIDDLE,angle:e.angle??0})},xs=(e,t)=>{try{let{hostname:n}=new URL(e),o=n.replace(/^www\./,"");if(t instanceof Set){if(Es.has(o))return o;let r=o.replace(/^([^.]+)/,"*");return Es.has(r)?r:null}let i=t.replace(/^www\./,"");if(o===i)return i}catch{}return null},q5=e=>{let t=e.match(Ig);if(t&&t.length===2)return t[1];let n=e.match(Ag);if(n&&n.length===2)return n[1];let o=e.match(Mg);if(o&&o.length===2)return o[1];if(yu.test(e))return`https://giphy.com/embed/${yu.exec(e)[1]}`;let i=e.match(vg);return i&&i.length===2?i[1]:e},K5=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(xs(e,n))return!0;return!1}}return!!xs(e,Es)};I();import{KEYS as Pr,invariant as Ir,toBrandedType as Tg}from"@excalidraw/common";import{pointFrom as Pu}from"@excalidraw/math";var ko=100,co=100,uM=e=>{switch(e){case Pr.ARROW_UP:return"up";case Pr.ARROW_DOWN:return"down";case Pr.ARROW_RIGHT:return"right";case Pr.ARROW_LEFT:return"left";default:return"right"}},vu=(e,t,n,o)=>{let i=[...n.values()].reduce((r,a)=>{let s;if(Z(a)&&(s=a[e==="predecessors"?"startBinding":"endBinding"])&&a[e==="predecessors"?"endBinding":"startBinding"]?.elementId===t.id){let l=n.get(s.elementId);if(!l)return r;Ir(Ae(l),"not an ExcalidrawBindableElement");let d=e==="predecessors"?a.points[a.points.length-1]:[0,0],c=Qo(t,It(t,n),[d[0]+a.x,d[1]+a.y]);r.push({relative:l,heading:c})}return r},[]);switch(o){case"up":return i.filter(r=>Le(r.heading,yt)).map(r=>r.relative);case"down":return i.filter(r=>Le(r.heading,We)).map(r=>r.relative);case"right":return i.filter(r=>Le(r.heading,Ce)).map(r=>r.relative);case"left":return i.filter(r=>Le(r.heading,ct)).map(r=>r.relative)}},ys=(e,t,n)=>vu("successors",e,t,n),ws=(e,t,n)=>vu("predecessors",e,t,n),Lg=(e,t,n)=>{let o=co+e.width;if(n==="up"||n==="down"){let s=ko+e.height,l=e.x,d=e.x+e.width;if(t.every(c=>c.x+c.width<l||c.x>d))return{x:0,y:s*(n==="up"?-1:1)}}else if(n==="right"||n==="left"){let s=e.y,l=e.y+e.height;if(t.every(d=>d.y+d.height<s||d.y>l))return{x:(co+e.width)*(n==="left"?-1:1),y:0}}if(n==="up"||n==="down"){let s=ko+e.height,l=(t.length===0,s),d=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*o:t.length/2*o*-1;return n==="up"?{x:d,y:l*-1}:{x:d,y:l}}let i=ko+e.height,r=(t.length===0,co+e.width),a=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*i:t.length/2*i*-1;return n==="left"?{x:r*-1,y:a}:{x:r,y:a}},Cg=(e,t,n,o)=>{let i=o.getNonDeletedElementsMap(),r=ys(e,i,n),a=ws(e,i,n),s=Lg(e,[...r,...a],n),l=so({type:e.type,x:e.x+s.x,y:e.y+s.y,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});Ir(qr(l),"not an ExcalidrawFlowchartNodeElement");let d=Au(e,l,n,t,o);return{nextNode:l,bindingArrow:d}},Dg=(e,t,n,o,i)=>{let r=[];for(let a=0;a<i;a++){let s,l;if(n==="left"||n==="right"){let p=ko*(i-1)+i*e.height,h=e.y+e.height/2-p/2,m=co+e.width;n==="left"&&(m*=-1),s=e.x+m;let g=(ko+e.height)*a;l=h+g}else{let p=co*(i-1)+i*e.width,h=e.x+e.width/2-p/2,m=ko+e.height;n==="up"&&(m*=-1),l=e.y+m;let g=(co+e.width)*a;s=h+g}let d=so({type:e.type,x:s,y:l,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});Ir(qr(d),"not an ExcalidrawFlowchartNodeElement");let c=Au(e,d,n,t,o);r.push(d),r.push(c)}return r},Au=(e,t,n,o,i)=>{let r,a;switch(n){case"up":{r=e.x+e.width/2,a=e.y-6;break}case"down":{r=e.x+e.width/2,a=e.y+e.height+6;break}case"right":{r=e.x+e.width+6,a=e.y+e.height/2;break}case"left":{r=e.x-6,a=e.y+e.height/2;break}}let l,d;switch(n){case"up":{l=t.x+t.width/2-r,d=t.y+t.height-a+6;break}case"down":{l=t.x+t.width/2-r,d=t.y-a-6;break}case"right":{l=t.x-r-6,d=t.y-a+t.height/2;break}case"left":{l=t.x+t.width-r+6,d=t.y-a+t.height/2;break}}let c=Mr({type:"arrow",x:r,y:a,startArrowhead:null,endArrowhead:o.currentItemEndArrowhead,strokeColor:e.strokeColor,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,opacity:e.opacity,roughness:e.roughness,points:[Pu(0,0),Pu(l,d)],elbowed:!0}),p=i.getNonDeletedElementsMap();Xt(c,e,"orbit","start",i),Xt(c,t,"orbit","end",i);let h=new Map;h.set(e.id,e),h.set(t.id,t),h.set(c.id,c),F.movePoints(c,i,new Map([[1,{point:c.points[1]}]]));let m=yo(c,Tg(new Map([...p.entries(),[e.id,e],[t.id,t],[c.id,c]])),{points:c.points});return{...c,...m}},Iu=class{isExploring=!1;sameLevelNodes=[];sameLevelIndex=0;direction=null;visitedNodes=new Set;clear(){this.isExploring=!1,this.sameLevelNodes=[],this.sameLevelIndex=0,this.direction=null,this.visitedNodes.clear()}exploreByDirection(t,n,o){if(!Ae(t))return null;if(o!==this.direction&&this.clear(),this.visitedNodes.has(t.id)||this.visitedNodes.add(t.id),this.isExploring&&o===this.direction&&this.sameLevelNodes.length>1)return this.sameLevelIndex=(this.sameLevelIndex+1)%this.sameLevelNodes.length,this.sameLevelNodes[this.sameLevelIndex].id;let i=[...ys(t,n,o),...ws(t,n,o)];if(i.length>0)return this.sameLevelIndex=0,this.isExploring=!0,this.sameLevelNodes=i,this.direction=o,this.visitedNodes.add(i[0].id),i[0].id;if(o===this.direction||!this.isExploring){this.isExploring||this.visitedNodes.add(t.id);let a=["up","right","down","left"].filter(s=>s!==o).map(s=>[...ys(t,n,s),...ws(t,n,s)]).flat().filter(s=>!this.visitedNodes.has(s.id));for(let s of a)if(!this.visitedNodes.has(s.id))return this.visitedNodes.add(s.id),this.isExploring=!0,this.direction=o,s.id}return null}},Su=class{isCreatingChart=!1;numberOfNodes=0;direction="right";pendingNodes=null;createNodes(t,n,o,i){let r=i.getNonDeletedElementsMap();if(o!==this.direction){let{nextNode:a,bindingArrow:s}=Cg(t,n,o,i);this.numberOfNodes=1,this.isCreatingChart=!0,this.direction=o,this.pendingNodes=[a,s]}else{this.numberOfNodes+=1;let a=Dg(t,n,o,i,this.numberOfNodes);this.isCreatingChart=!0,this.direction=o,this.pendingNodes=a}if(t.frameId){let a=r.get(t.frameId);Ir(a&&Fi(a),"not an ExcalidrawFrameElement"),a&&this.pendingNodes.every(s=>Fn([s],a,r)||On(s,a,r))&&(this.pendingNodes=this.pendingNodes.map(s=>je(s,r,{frameId:t.frameId})))}}clear(){this.isCreatingChart=!1,this.pendingNodes=null,this.direction=null,this.numberOfNodes=0}},pM=(e,t)=>{for(let[,n]of t)if(n.type==="arrow"&&(n.startBinding?.elementId===e.id||n.endBinding?.elementId===e.id))return!0;return!1};I();import{pointDistance as To,pointFrom as bs}from"@excalidraw/math";import{invariant as ku}from"@excalidraw/common";var Sr=(e,t,n,o,i,r,a=!1)=>{if(Z(t)||!Yt(i)||t.points.length!==2)return!1;if(!a){let l=t.startBinding?.elementId===n.id?0:t.points.length-1,d=F.getPointAtIndexGlobalCoordinates(t,l,o);if(To(e,d)<ii*1.5/i.zoom.value)return!1}let s=F.getPointAtIndexGlobalCoordinates(t,r==="end"?t.points.length-1:0,o);return To(e,s)>=ii*1.5/i.zoom.value&&_t({element:n,elementsMap:o,point:e,threshold:Qe(n,t),overrideShouldTestInside:!0})},Bg=(e,t,n,o,i,r,a)=>{let s=new Map,l=n?"startBinding":"endBinding",d=n?"endBinding":"startBinding",c=e[l],p=e[d];if(c&&t){let h=t&&p&&c.elementId===p.elementId;a||h?c={...c,mode:"inside"}:c={...c,mode:"orbit"};let m=n?0:e.points.length-1,g=Bt(e,l,c,t,o,!0);g&&s.set(m,{point:g})}if(p&&p.mode==="orbit"){let h=o.get(p.elementId);if(h&&Ae(h)&&Yt(r)){let m=t&&p.elementId===t.id;a||m?p={...p,mode:"inside"}:p={...p,mode:"orbit"};let g=n?e.points.length-1:0,f=Bt(e,d,p,h,o);f&&s.set(g,{point:f})}}s.size>0&&F.movePoints(e,i,s,{[l]:c,[d]:p})},Tu=(e,t,n,o,i,r,a)=>{let s=F.getElement(e.elementId,t);if(!s||!Ye(s)||Z(s)||!e.hoveredFocusPointBinding||!e.draggedFocusPointBinding)return;let l=e.draggedFocusPointBinding==="start",d=l?s.startBinding:s.endBinding,{x:c,y:p}=e.pointerOffset,h=bs(n.x-c,n.y-p),m=l?"startBinding":"endBinding",g=ad(h,s,o.getNonDeletedElements(),t,Lt(i.zoom));if(g&&Yt(i)){s[m]&&g.id!==d?.elementId&&Ze(s,e.draggedFocusPointBinding,o);let f=a&&s[m]?.mode==="orbit"?"inside":!a&&s[m]?.mode==="inside"?"orbit":null;(!s[m]||f)&&Xt(s,g,f||"orbit",e.draggedFocusPointBinding,o,h),o.mutateElement(s,{[m]:{...s[m],elementId:g.id,mode:f||s[m]?.mode||"orbit",...wo(s,g,e.draggedFocusPointBinding,t,h)}})}else{let f=new Map,E=l?0:s.points.length-1;f.set(E,{point:F.createPointAt(s,t,h[0],h[1],r)}),F.movePoints(s,o,f),s[m]&&Ze(s,l?"start":"end",o)}Bg(s,g,l,t,o,i,a),g&&Yt(i)&&ri(h,s,o.getElementsIncludingDeleted(),t,o,g)},MM=(e,t,n,o)=>{let i=bs(t.origin.x,t.origin.y),r=ii*1.5/o.zoom.value;if(e.startBinding?.elementId){let a=n.get(e.startBinding.elementId);if(a&&Ae(a)&&!a.isDeleted){let s=st(e.startBinding.fixedPoint,a,n);if(Sr(s,e,a,n,o,"start")&&To(i,s)<=r)return{hitFocusPoint:"start",pointerOffset:{x:i[0]-s[0],y:i[1]-s[1]}}}}if(e.endBinding?.elementId){let a=n.get(e.endBinding.elementId);if(a&&Ae(a)&&!a.isDeleted){let s=st(e.endBinding.fixedPoint,a,n);if(Sr(s,e,a,n,o,"end")&&To(i,s)<=r)return{hitFocusPoint:"end",pointerOffset:{x:i[0]-s[0],y:i[1]-s[1]}}}}return{hitFocusPoint:null,pointerOffset:{x:0,y:0}}},PM=(e,t)=>{ku(e.draggedFocusPointBinding,"Must have a dragged focus point at pointer release");let n=F.getElement(e.elementId,t.getNonDeletedElementsMap());ku(n,"Arrow must be in the scene");let o=e.draggedFocusPointBinding==="start"?"startBinding":"endBinding",i=e.draggedFocusPointBinding==="start"?"endBinding":"startBinding",r=n[o]?.elementId,a=n[i]?.elementId,s=r&&t.getNonDeletedElements().find(d=>d.id!==r&&d.id!==a&&Ae(d)&&d.boundElements?.find(({id:c})=>c===n.id));s&&t.mutateElement(s,{boundElements:s.boundElements?.filter(({id:d})=>d!==n.id)});let l=r&&t.getNonDeletedElementsMap().get(r);l&&t.mutateElement(l,{boundElements:[...(l.boundElements||[])?.filter(({id:d})=>d!==n.id),{id:n.id,type:"arrow"}]})},IM=(e,t,n,o,i)=>{let r=o.getNonDeletedElementsMap(),a=bs(t,n),s=ii*1.5/i.zoom.value;if(e.startBinding?.elementId){let l=r.get(e.startBinding.elementId);if(l&&Ae(l)&&!l.isDeleted){let d=st(e.startBinding.fixedPoint,l,r);if(Sr(d,e,l,r,i,"start")&&To(a,d)<=s)return"start"}}if(e.endBinding?.elementId){let l=r.get(e.endBinding.elementId);if(l&&Ae(l)&&!l.isDeleted){let d=st(e.endBinding.fixedPoint,l,r);if(Sr(d,e,l,r,i,"end")&&To(a,d)<=s)return"end"}}return null};I();var Gg=e=>({x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}),Lu=(e,t)=>{switch(e){case"height":return t.height;case"width":return t.width;case"size":return t.width*t.height;case"scale":return(t.width+t.height)/2}},Og=(e,t,n)=>n==="first"?Lu(e,t[0].boundingBox):t.reduce((i,r)=>i+Lu(e,r.boundingBox),0)/t.length,Rg=(e,t,n)=>{switch(e){case"height":return t/n.height;case"width":return t/n.width;case"size":return Math.sqrt(t/(n.width*n.height));case"scale":return t/((n.width+n.height)/2)}},TM=(e,t,n,o="average",i="size")=>{let a=cr(t,n).map(d=>({group:d,boundingBox:Ke(d)}));if(a.length===0)return t;let s=Og(i,a,o),l=[];return a.forEach(d=>{let c=Rg(i,s,d.boundingBox);if(!Number.isFinite(c)||c<=0)return;let p=Gg(d.boundingBox);d.group.forEach(h=>{let m={x:h.x+h.width/2,y:h.y+h.height/2},g={x:p.x+(m.x-p.x)*c,y:p.y+(m.y-p.y)*c},f=h.width*c,E=h.height*c;e.mutateElement(h,{x:g.x-f/2,y:g.y-E/2,width:f,height:E}),l.push(h)})}),l};I();var GM=(e,t,n,o=50)=>{if(!e||e.length===0)return[];let i=[],r=Array.isArray(e[0])?e:e.map(m=>[m]),a=r.length,s=Math.max(1,Math.ceil(Math.sqrt(a))),l=[];for(let m=0;m<a;m+=s)l.push(r.slice(m,m+s));let d=0,c=l.map(m=>{let g=0,f=0,E=m.map(x=>{let[y,w,M,b]=tt(x);return{elements:x,bounds:[y,w,M,b],width:M-y,height:b-w}});return E.forEach((x,y)=>{g+=x.width,y<E.length-1&&(g+=o),x.height>f&&(f=x.height)}),d+=f,{unitBounds:E,width:g,maxHeight:f}}),p=d+Math.max(0,l.length-1)*o,h=n-p/2;return c.forEach(m=>{let{unitBounds:g,width:f,maxHeight:E}=m,x=t-f/2;g.forEach(y=>{let[w,M]=y.bounds,b=x-w,S=h-M;y.elements.forEach(v=>{i.push(Je(v,{x:v.x+b,y:v.y+S}))}),x+=y.width+o}),h+=E+o}),i};I();import{pointCenter as Fg,normalizeRadians as Ar,pointFrom as fe,pointRotateRads as Ft}from"@excalidraw/math";import{MIN_FONT_SIZE as Ps,SHIFT_LOCKING_ANGLE as kr,rescalePoints as Cu,getFontString as vr}from"@excalidraw/common";var XM=(e,t,n,o,i,r,a,s,l,d,c)=>{let p=o.getNonDeletedElementsMap();if(n.length===1){let[h]=n;if(t==="rotation")Z(h)||(Ng(h,o,s,l,i),qe(h,o));else if(t){let m=n[0].id,g=p.get(m),f=e.get(m);if(g&&f){let{nextWidth:E,nextHeight:x}=jg(g,f,t,s,l,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r});Wg(E,x,g,f,e,o,t,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r})}}return re(h)&&qe(h,o),!0}else if(n.length>1){if(t==="rotation")return zg(e,n,o,s,l,i,d,c),!0;if(t){let{nextWidth:h,nextHeight:m,flipByX:g,flipByY:f,originalBoundingBox:E}=Vg(n,e,p,t,s,l,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:r});return Ug(n,p,t,o,e,{shouldResizeFromCenter:r,shouldMaintainAspectRatio:a,flipByX:g,flipByY:f,nextWidth:h,nextHeight:m,originalBoundingBox:E}),!0}}return!1},Ng=(e,t,n,o,i)=>{let[r,a,s,l]=ee(e,t.getNonDeletedElementsMap()),d=(r+s)/2,c=(a+l)/2,p;oe(e)?p=0:(p=5*Math.PI/2+Math.atan2(o-c,n-d),i&&(p=p+kr/2,p=p-p%kr),p=Ar(p));let h=sn(e),m={angle:p};if(Ye(e)&&(m={...m},e.startBinding&&Ze(e,"start",t),e.endBinding&&Ze(e,"end",t)),t.mutateElement(e,m),h){let g=t.getElement(h);if(g&&!Y(e)){let{x:f,y:E}=Zo(e,g,t.getNonDeletedElementsMap());t.mutateElement(g,{angle:p,x:f,y:E})}}},Du=(e,t,n,o)=>ae(e)||He(e)?{points:Cu(0,t,Cu(1,n,e.points,o),o)}:{},Is=(e,t,n)=>{let o=e.width;if(ke(e)){let a=Xe(e,t);a&&(o=Ct(a,e))}let r=e.fontSize*(n/o);return r<Ps?null:{size:r}},Hg=(e,t,n,o,i,r,a)=>{let s=n.getNonDeletedElementsMap(),l=t.width*(a/t.height),d=Is(t,s,l);if(d!==null){if(o.includes("n")||o.includes("s")){let c=fe(e.x,e.y),p=Ms(c,e.width,e.height,l,a,e.angle,o,!1,i);n.mutateElement(t,{fontSize:d.size,width:l,height:a,x:p.x,y:p.y});return}if(o==="e"||o==="w"){let c=_i(vr({fontSize:t.fontSize,fontFamily:t.fontFamily}),t.lineHeight),p=Math.max(c,r),h=an(t.originalText,vr(t),Math.abs(p)),m=Et(h,vr(t),t.lineHeight),g=m.height,f=fe(e.x,e.y),E=Ms(f,e.width,e.height,p,g,t.angle,o,!1,i),x={width:Math.abs(p),height:Math.abs(m.height),x:E.x,y:E.y,text:h,autoResize:!1};n.mutateElement(t,x)}}},zg=(e,t,n,o,i,r,a,s)=>{let l=n.getNonDeletedElementsMap(),d=5*Math.PI/2+Math.atan2(i-s,o-a);r&&(d+=kr/2,d-=d%kr);let c=new Map(t.map(p=>[p.id,p]));for(let p of t)if(!oe(p)){let[h,m,g,f]=ee(p,l),E=(h+g)/2,x=(m+f)/2,y=e.get(p.id)?.angle??p.angle,[w,M]=Ft(fe(E,x),fe(a,s),d+y-p.angle),b=Z(p)?{points:Ld(p,l)}:{x:p.x+(w-E),y:p.y+(M-x),angle:Ar(d+y)};n.mutateElement(p,b),qe(p,n,{simultaneouslyUpdated:t}),Ye(p)&&(p.startBinding&&(c.has(p.startBinding.elementId)||Ze(p,"start",n)),p.endBinding&&(c.has(p.endBinding.elementId)||Ze(p,"end",n)));let S=te(p,l);if(S&&!Y(p)){let{x:v,y:k}=Zo(p,S,l);n.mutateElement(S,{x:v,y:k,angle:Ar(d+y)})}}n.triggerUpdate()},$M=(e,t,n,o,i)=>{let[r,a,s,l]=t.length===1?ee(t[0],n):tt(t),d=(r+s)/2,c=(a+l)/2,p=t.length===1?t[0].angle:0;switch([o,i]=Ft(fe(o,i),fe(d,c),-p),e){case"n":return Ft(fe(o-(r+s)/2,i-a),fe(0,0),p);case"s":return Ft(fe(o-(r+s)/2,i-l),fe(0,0),p);case"w":return Ft(fe(o-r,i-(a+l)/2),fe(0,0),p);case"e":return Ft(fe(o-s,i-(a+l)/2),fe(0,0),p);case"nw":return Ft(fe(o-r,i-a),fe(0,0),p);case"ne":return Ft(fe(o-s,i-a),fe(0,0),p);case"sw":return Ft(fe(o-r,i-l),fe(0,0),p);case"se":return Ft(fe(o-s,i-l),fe(0,0),p);default:return[0,0]}},ZM=(e,t)=>{let[,[n,o]]=t.points;return e==="nw"&&(n<0||o<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||o>0)?"end":"origin"},_g=(e,t,n)=>{if(n)return"center";if(t)switch(e){case"n":return"south-side";case"e":return"west-side";case"s":return"north-side";case"w":return"east-side";case"ne":return"bottom-left";case"nw":return"bottom-right";case"se":return"top-left";case"sw":return"top-right"}return["e","se","s"].includes(e)?"top-left":["n","nw","w"].includes(e)?"bottom-right":e==="ne"?"bottom-left":"top-right"},Ms=(e,t,n,o,i,r,a,s,l)=>{let d=_g(a,s,l),[c,p]=e;switch(d){case"top-left":return{x:c+(t-o)/2+(o-t)/2*Math.cos(r)+(n-i)/2*Math.sin(r),y:p+(n-i)/2+(o-t)/2*Math.sin(r)+(i-n)/2*Math.cos(r)};case"top-right":return{x:c+(t-o)/2*(Math.cos(r)+1)+(n-i)/2*Math.sin(r),y:p+(n-i)/2+(t-o)/2*Math.sin(r)+(i-n)/2*Math.cos(r)};case"bottom-left":return{x:c+(t-o)/2*(1-Math.cos(r))+(i-n)/2*Math.sin(r),y:p+(n-i)/2*(Math.cos(r)+1)+(o-t)/2*Math.sin(r)};case"bottom-right":return{x:c+(t-o)/2*(Math.cos(r)+1)+(i-n)/2*Math.sin(r),y:p+(n-i)/2*(Math.cos(r)+1)+(t-o)/2*Math.sin(r)};case"center":return{x:c-(o-t)/2,y:p-(i-n)/2};case"east-side":return{x:c+(t-o)/2*(Math.cos(r)+1),y:p+(t-o)/2*Math.sin(r)+(n-i)/2};case"west-side":return{x:c+(t-o)/2*(1-Math.cos(r)),y:p+(o-t)/2*Math.sin(r)+(n-i)/2};case"north-side":return{x:c+(t-o)/2+(n-i)/2*Math.sin(r),y:p+(i-n)/2*(Math.cos(r)-1)};case"south-side":return{x:c+(t-o)/2+(i-n)/2*Math.sin(r),y:p+(n-i)/2*(Math.cos(r)+1)}}},Wg=(e,t,n,o,i,r,a,{shouldInformMutation:s=!0,shouldMaintainAspectRatio:l=!1,shouldResizeFromCenter:d=!1}={})=>{if(re(n)&&re(o))return Hg(o,n,r,a,d,e,t);let c={},p=r.getNonDeletedElementsMap(),h=te(n,p);if(h){let E=i.get(h.id);if(E&&(c={fontSize:E.fontSize}),l){let x={...n,width:e,height:t},y=Is(h,p,Ct(x,h));if(y===null)return;c={fontSize:y.size}}else{let x=_l(vr(h),h.lineHeight),y=Wl(h.fontSize,h.lineHeight);e=Math.max(e,x),t=Math.max(t,y)}}let m=Du(o,e,t,!0),g=fe(o.x,o.y);if(ae(o)){let[E,x]=Ee(o,i);g=fe(E,x)}let f=Ms(g,o.width,o.height,e,t,o.angle,a,l,d);if(ae(o)&&m.points){let E=o.x-g[0],x=o.y-g[1];f.x+=E,f.y+=x;let y=m.points[0][0],w=m.points[0][1];f.x+=y,f.y+=w,m.points=m.points.map(M=>fe(M[0]-y,M[1]-w))}if(e<0&&(f.x=f.x+e),t<0&&(f.y=f.y+t),"scale"in n&&"scale"in o&&r.mutateElement(n,{scale:[(Math.sign(e)||o.scale[0])*o.scale[0],(Math.sign(t)||o.scale[1])*o.scale[1]]}),Y(n)&&h&&l){let E=e/n.width*h.fontSize;if(E<Ps)return;c.fontSize=E}if(e!==0&&t!==0&&Number.isFinite(f.x)&&Number.isFinite(f.y)){let E={...f,width:Math.abs(e),height:Math.abs(t),...m};Ye(n)&&(n.startBinding&&(E={...E},n.startBinding&&Ze(n,"start",r)),n.endBinding&&(E={...E,endBinding:null})),r.mutateElement(n,E,{informMutation:s,isDragging:!1}),h&&c!=null&&r.mutateElement(h,{fontSize:c.fontSize}),eo(n,r,a,l),qe(n,r)}},jg=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:a=!1}={})=>{let[s,l,d,c]=bn(t,t.width,t.height,!0),p=fe(s,l),h=fe(d,c),m=Fg(p,h),g=Ft(fe(o,i),m,-t.angle),[f,E,x,y]=bn(e,e.width,e.height,!0),w=x-f,M=y-E,b=h[0]-p[0],S=h[1]-p[1],v=b/w,k=S/M;n.includes("e")&&(v=(g[0]-p[0])/w),n.includes("s")&&(k=(g[1]-p[1])/M),n.includes("w")&&(v=(h[0]-g[0])/w),n.includes("n")&&(k=(h[1]-g[1])/M);let A=e.width*v,O=e.height*k;if(a&&(A=2*A-t.width,O=2*O-t.height),r){let G=Math.abs(A)/t.width,R=Math.abs(O)/t.height;if(n.length===1&&(O*=G,A*=R),n.length===2){let C=Math.max(G,R);A=t.width*C*Math.sign(A),O=t.height*C*Math.sign(O)}}return{nextWidth:A,nextHeight:O}},Vg=(e,t,n,o,i,r,{shouldMaintainAspectRatio:a=!1,shouldResizeFromCenter:s=!1}={})=>{let l=e.map(C=>t.get(C.id)),d=l.reduce((C,j)=>{if(!ae(j))return C;let W=sn(j);if(!W)return C;let q=t.get(W)??null;return ke(q)?[...C,{...q,...F.getBoundTextElementPosition(j,q,n)}]:C},[]),c=Ke(l.map(C=>C).concat(d)),{minX:p,minY:h,maxX:m,maxY:g,midX:f,midY:E}=c,x=m-p,y=g-h,w={ne:[p,g],se:[p,h],sw:[m,h],nw:[m,g],e:[p,h+y/2],w:[m,h+y/2],n:[p+x/2,g],s:[p+x/2,h]},[M,b]=s?[f,E]:w[o],S=s?2:1,v=Math.max(Math.abs(i-M)/x||0,Math.abs(r-b)/y||0)*S,k=o.includes("e")||o.includes("w")?Math.abs(i-M)*S:x,A=o.includes("n")||o.includes("s")?Math.abs(r-b)*S:y;a&&(k=x*v*Math.sign(i-M),A=y*v*Math.sign(r-b));let O={ne:[i<M,r>b],se:[i<M,r<b],sw:[i>M,r<b],nw:[i>M,r>b],e:[i<M,!1],w:[i>M,!1],n:[!1,r>b],s:[!1,r<b]},[G,R]=O[o].map(C=>C);return{originalBoundingBox:c,nextWidth:k,nextHeight:A,flipByX:G,flipByY:R}},Ug=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:a=!1,flipByX:s=!1,flipByY:l=!1,nextHeight:d,nextWidth:c,originalBoundingBox:p}={})=>{if(c===void 0&&d===void 0&&s===void 0&&l===void 0||d===0||c===0)return;i||(i=t);let h=e.reduce((S,v)=>{let k=i.get(v.id);return k&&S.push({orig:k,latest:v}),S},[]),m;if(p)m=p;else{let S=h.reduce((v,{orig:k})=>{if(!ae(k))return v;let A=sn(k);if(!A)return v;let O=i.get(A)??null;return ke(O)?[...v,{...O,...F.getBoundTextElementPosition(k,O,t)}]:v},[]);m=Ke(h.map(({orig:v})=>v).concat(S))}let{minX:g,minY:f,maxX:E,maxY:x,midX:y,midY:w}=m,M=E-g,b=x-f;if(c===void 0&&d===void 0&&(c=M,d=b),r&&(c===void 0?c=d*(M/b):d===void 0?d=c*(b/M):Math.abs(c/d-M/b)>.001&&(c=d*(M/b))),c&&d){let S=n.includes("e")||n.includes("w")?Math.abs(c)/M:1,v=n.includes("n")||n.includes("s")?Math.abs(d)/b:1,k;n.length===1?k=n.includes("e")||n.includes("w")?S:v:k=Math.max(Math.abs(c)/M||0,Math.abs(d)/b||0);let A={ne:[g,x],se:[g,f],sw:[E,f],nw:[E,x],e:[g,f+b/2],w:[E,f+b/2],n:[g+M/2,x],s:[g+M/2,f]},[O,G]=a?[y,w]:A[n],R=r||h.some(T=>T.latest.angle!==0||re(T.latest)||Yd(T.latest));R&&(S=k,v=k);let[C,j]=[s?-1:1,l?-1:1],W=[];for(let{orig:T,latest:z}of h){if(re(T)&&ke(T))continue;let _=T.width*S,he=T.height*v,ve=Ar(T.angle*C*j),we=ae(T)||He(T),xe=T.x-O,ge=T.y-G,Ne=s&&!we?_:0,$=l&&!we?he:0,ce=O+C*(xe*S+Ne),Be=G+j*(ge*v+$),J=Du(T,_*C,he*j,!1),ie={x:ce,y:Be,width:_,height:he,angle:ve,...J};if(Z(T)&&(T.startBinding&&(ie.startBinding={...T.startBinding,fixedPoint:[s?-T.startBinding.fixedPoint[0]+1:T.startBinding.fixedPoint[0],l?-T.startBinding.fixedPoint[1]+1:T.startBinding.fixedPoint[1]]}),T.endBinding&&(ie.endBinding={...T.endBinding,fixedPoint:[s?-T.endBinding.fixedPoint[0]+1:T.endBinding.fixedPoint[0],l?-T.endBinding.fixedPoint[1]+1:T.endBinding.fixedPoint[1]]}),T.fixedSegments&&J.points&&(ie.fixedSegments=T.fixedSegments.map(Re=>({...Re,start:J.points[Re.index-1],end:J.points[Re.index]})))),_e(T)&&(ie.scale=[T.scale[0]*C,T.scale[1]*j]),re(T)){let Re=Is(T,t,_);if(!Re)return;ie.fontSize=Re.size}let rt=i.get(sn(T)??"");if(rt)if(R){let Re=rt.fontSize*k;if(Re<Ps)return;ie.boundTextFontSize=Re}else ie.boundTextFontSize=rt.fontSize;W.push({element:z,update:ie})}let q=W.map(({element:T})=>T),N=new Map(W.map(({element:T})=>[T.id,T]));for(let{element:T,update:{boundTextFontSize:z,..._}}of W){let{angle:he}=_;o.mutateElement(T,_),qe(T,o,{simultaneouslyUpdated:q}),Ye(T)&&(T.startBinding&&(N.has(T.startBinding.elementId)||Ze(T,"start",o)),T.endBinding&&(N.has(T.endBinding.elementId)||Ze(T,"end",o)));let ve=te(T,t);ve&&z&&(o.mutateElement(ve,{fontSize:z,angle:ae(T)?void 0:he}),eo(T,o,n,!0))}o.triggerUpdate()}};I();import{pointFrom as St,pointOnLineSegment as Nu,pointRotateRads as Lr}from"@excalidraw/math";import{SIDE_RESIZING_THRESHOLD as Ls}from"@excalidraw/common";I();import{DEFAULT_TRANSFORM_HANDLE_SPACING as vs}from"@excalidraw/common";import{pointFrom as Bu,pointRotateRads as Yg}from"@excalidraw/math";var Gu={mouse:8,pen:16,touch:28},Xg=16,Ru={e:!0,s:!0,n:!0,w:!0},nP={e:!0,s:!0,n:!0,w:!0},oP={e:!0,s:!0,n:!0,w:!0,rotation:!0},Ou={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},Ss={e:!0,s:!0,n:!0,w:!0},En=(e,t,n,o,i,r,a)=>{let[s,l]=Yg(Bu(e+n/2,t+o/2),Bu(i,r),a);return[s-n/2,l-o/2,n,o]},Tr=e=>!(e.formFactor==="phone"&&e.userAgent.isMobileDevice),As=e=>Tr(e)?Ru:{},ks=([e,t,n,o,i,r],a,s,l,d={},c=4,p=vs)=>{let h=Gu[l],m=h/s.value,g=h/s.value,f=h/s.value,E=h/s.value,x=n-e,y=o-t,w=c/s.value,M=(h-p*2)/(2*s.value),b={nw:d.nw?void 0:En(e-w-f+M,t-w-E+M,m,g,i,r,a),ne:d.ne?void 0:En(n+w-M,t-w-E+M,m,g,i,r,a),sw:d.sw?void 0:En(e-w-f+M,o+w-M,m,g,i,r,a),se:d.se?void 0:En(n+w-M,o+w-M,m,g,i,r,a),rotation:d.rotation?void 0:En(e+x/2-m/2,t-w-E+M-Xg/s.value,m,g,i,r,a)},S=5*Gu.mouse/s.value;return Math.abs(x)>S&&(d.n||(b.n=En(e+x/2-m/2,t-w-E+M,m,g,i,r,a)),d.s||(b.s=En(e+x/2-m/2,o+w-M,m,g,i,r,a))),Math.abs(y)>S&&(d.w||(b.w=En(e-w-f+M,t+y/2-g/2,m,g,i,r,a)),d.e||(b.e=En(n+w-M,t+y/2-g/2,m,g,i,r,a))),b},Fu=(e,t,n,o="mouse",i=Ru)=>{if(e.locked||Z(e))return{};if(e.type==="freedraw"||ae(e)){if(e.points.length===2){let[,a]=e.points;a[0]===0||a[1]===0?i=Ss:a[0]>0&&a[1]<0?i=Ou:a[0]>0&&a[1]>0?i=Ss:a[0]<0&&a[1]>0?i=Ou:a[0]<0&&a[1]<0&&(i=Ss)}}else oe(e)&&(i={...i,rotation:!0});let r=ae(e)?vs+8:_e(e)?0:vs;return ks(ee(e,n,!0),e.angle,t,o,i,r,_e(e)?0:void 0)},iP=(e,t,n)=>{if(t.selectedLinearElement?.isEditing||t.selectedLinearElement?.isDragging)return!1;if(e.length>1)return!0;let o=e[0];return Z(o)?!1:ae(o)?o.points.length>2&&!n.userAgent.isMobileDevice:!0};var Cs=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],$g=(e,t,n,o,i,r,a,s)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...d}=Fu(e,r,t,a,As(s));if(l&&Cs(l,o,i))return"rotation";let c=Object.keys(d).filter(p=>{let h=d[p];return h?Cs(h,o,i):!1});if(c.length>0)return c[0];if(Tr(s)){let[p,h,m,g,f,E]=ee(e,t);if(!(ae(e)&&e.points.length<=2)){let x=_e(e)?0:Ls/r.value,y=Ls/r.value,w=Hu(St(p-x,h-x),St(m+x,g+x),St(f,E),e.angle);for(let[M,b]of Object.entries(w))if(Nu(St(o,i),b,y))return M}}return!1},pP=(e,t,n,o,i,r,a,s)=>e.reduce((l,d)=>{if(l)return l;let c=$g(d,a,t,n,o,i,r,s);return c?{element:d,transformHandleType:c}:null},null),hP=([e,t,n,o],i,r,a,s,l)=>{let d=ks([e,t,n,o,(e+n)/2,(t+o)/2],0,a,s,As(l)),c=Object.keys(d).find(p=>{let h=d[p];return h&&Cs(h,i,r)});if(c)return c;if(Tr(l)){let p=(e+n)/2,h=(t+o)/2,m=Ls/a.value,g=Hu(St(e-m,t-m),St(n+m,o+m),St(p,h),0);for(let[f,E]of Object.entries(g))if(Nu(St(i,r),E,m))return f}return!1},Ts=["ns","nesw","ew","nwse"],Zg=(e,t)=>{let n=Ts.indexOf(e);if(n>=0){let o=Math.round(t/(Math.PI/4));e=Ts[(n+o)%Ts.length]}return e},mP=e=>{let{element:t,transformHandleType:n}=e,o=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":o?i="nesw":i="nwse";break;case"ne":case"sw":o?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=Zg(i,t.angle)),i?`${i}-resize`:""},Hu=([e,t],[n,o],i,r)=>{let a=Lr(St(e,t),i,r),s=Lr(St(n,t),i,r),l=Lr(St(e,o),i,r),d=Lr(St(n,o),i,r);return{n:[a,s],e:[s,d],s:[d,l],w:[l,a]}};I();import{KEYS as vt}from"@excalidraw/common";I();I();function zu(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=zu(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function _u(){for(var e=0,t,n,o="";e<arguments.length;)(t=arguments[e++])&&(n=zu(t))&&(o&&(o+=" "),o+=n);return o}var De=gi(tp(),1),u=gi(Ns(),1);import{THEME as h2}from"@excalidraw/common";var Nt=e=>"var(--icon-fill-color)",rp=e=>e===h2.LIGHT?"#fff":"#1e1e1e",P=(e,t=512)=>{let{width:n=512,height:o=n,mirror:i,style:r,...a}=typeof t=="number"?{width:t}:t;return(0,u.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${o}`,className:_u({"rtl-mirror":i}),style:r,...a,children:typeof e=="string"?(0,u.jsx)("path",{fill:"currentColor",d:e}):e})},L={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},X={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},it={width:40,height:20},TP=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("rect",{x:3,y:8,width:18,height:4,rx:1}),(0,u.jsx)("line",{x1:12,y1:8,x2:12,y2:21}),(0,u.jsx)("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),(0,u.jsx)("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),L),LP=P((0,u.jsxs)("svg",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,u.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),L),CP=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,u.jsx)("circle",{cx:"12",cy:"19",r:"1"}),(0,u.jsx)("circle",{cx:"12",cy:"5",r:"1"})]}),L),DP=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,u.jsx)("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),(0,u.jsx)("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]}),L),BP=P((0,u.jsxs)("svg",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),(0,u.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),(0,u.jsx)("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),L),GP=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M6.5 9.5l3.5 -3"}),(0,u.jsx)("path",{d:"M14 5.5l3 1.5"}),(0,u.jsx)("path",{d:"M18.5 10l-2.5 7"}),(0,u.jsx)("path",{d:"M13.5 17.5l-7 -5"})]}),L),OP=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:(0,u.jsx)("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),(0,u.jsx)("g",{mask:"url(#UnlockedIcon)",children:(0,u.jsx)("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),X),RP=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,u.jsx)("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),(0,u.jsx)("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),X),FP=P((0,u.jsx)("g",{fill:"currentColor",children:(0,u.jsx)("path",{d:"M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3"})}),{width:24,height:24}),NP=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),(0,u.jsx)("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),HP=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),(0,u.jsx)("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),zP=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),(0,u.jsx)("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),_P=P((0,u.jsx)("g",{fill:"currentColor",children:(0,u.jsx)("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),Hs=P((0,u.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),(0,u.jsx)("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),WP=P((0,u.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,children:[(0,u.jsx)("path",{d:"M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255"}),(0,u.jsx)("path",{d:"M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M5 17c0 1.42 .316 2.805 1 4"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),ap=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),L),sp=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),L),lp=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("circle",{cx:"12",cy:"12",r:"9"})]}),L),dp=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,u.jsx)("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),(0,u.jsx)("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),L),cp=P((0,u.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),X),jP=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),(0,u.jsx)("path",{d:"M16 7h4"}),(0,u.jsx)("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),L),up=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),(0,u.jsx)("path",{d:"m11.25 5.417 3.333 3.333"})]}),X),pp=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),(0,u.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),(0,u.jsx)("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,u.jsx)("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,u.jsx)("polyline",{points:"5 20 11 4 13 4 20 20"})]}),L),VP=P((0,u.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 7v-2h13v2"}),(0,u.jsx)("path",{d:"M10 5v14"}),(0,u.jsx)("path",{d:"M12 19h-4"}),(0,u.jsx)("path",{d:"M15 13v-1h6v1"}),(0,u.jsx)("path",{d:"M18 12v7"}),(0,u.jsx)("path",{d:"M17 19h2"})]}),L),hp=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M12.5 6.667h.01"}),(0,u.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),(0,u.jsx)("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),(0,u.jsx)("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),X),mp=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),(0,u.jsx)("path",{d:"M18 13.3l-6.3 -6.3"})]}),L),UP=P((0,u.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),X),YP=P((0,u.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),X),XP=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M21 21l-6 -6"}),(0,u.jsx)("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),(0,u.jsx)("path",{d:"M3 4v4h4"})]}),L),$P=P((0,u.jsx)("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),X),ZP=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("polyline",{points:"12 16 18 10 12 4"}),(0,u.jsx)("polyline",{points:"8 4 2 10 8 16"})]}),X),qP=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),(0,u.jsx)("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),X),KP=P((0,u.jsx)("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),X),QP=P((0,u.jsx)("g",{stroke:"currentColor",strokeLinejoin:"round",children:(0,u.jsx)("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...X,strokeWidth:1.5}),JP=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,u.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,u.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),L),eI=P((0,u.jsx)("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),X),tI=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,u.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,u.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),nI=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,u.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,u.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),oI=P((0,u.jsx)("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),X),iI=P((0,u.jsx)("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),X),rI=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),(0,u.jsx)("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),X),aI=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),(0,u.jsx)("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),L),sI=P((0,u.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),lI=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),(0,u.jsx)("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),X),dI=P("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),cI=P("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),uI=P((0,u.jsx)("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),X),pI=P("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),hI=P("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),mI=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),(0,u.jsx)("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),(0,u.jsx)("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),L),fI=P((0,u.jsx)("g",{strokeWidth:1.5,children:(0,u.jsx)("path",{d:"M6 18l12 -12"})}),L),gI=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M15 8h.01"}),(0,u.jsx)("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),(0,u.jsx)("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),(0,u.jsx)("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),(0,u.jsx)("path",{d:"M19 16v6"}),(0,u.jsx)("path",{d:"M22 19l-3 3l-3 -3"})]}),L),EI=P("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),xI=P("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),yI=P("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),wI=P("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),bI=P("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),MI=P((0,u.jsx)("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),X),PI=P((0,u.jsx)("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),X),II=P("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),SI=P((0,u.jsx)("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),X),vI=P("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),AI=P("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),kI=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),(0,u.jsx)("path",{d:"M12 14v-11"}),(0,u.jsx)("path",{d:"M9 6l3 -3l3 3"})]}),L),TI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),(0,u.jsx)("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64}),LI=P((0,u.jsx)("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024}),fp=(0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 10l0 10"}),(0,u.jsx)("path",{d:"M12 10l4 4"}),(0,u.jsx)("path",{d:"M12 10l-4 4"}),(0,u.jsx)("path",{d:"M4 4l16 0"})]}),gp=(0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 5l0 14"}),(0,u.jsx)("path",{d:"M16 9l-4 -4"}),(0,u.jsx)("path",{d:"M8 9l4 -4"})]}),CI=P(gp,L),DI=P(gp,{...L,style:{transform:"rotate(180deg)"}}),BI=P(fp,L),GI=P(fp,{...L,style:{transform:"rotate(180deg)"}}),OI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),RI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),FI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),NI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),HI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),zI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),_I=P((0,u.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),X),WI=P((0,u.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),X),jI=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,u.jsx)("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),(0,u.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),(0,u.jsx)("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),L),VI=P("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),UI=P("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),YI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,u.jsx)("path",{d:"M15 5 5 15M5 5l10 10"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),XI=P("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),$I=P("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),ZI=P("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),qI=De.default.memo(({theme:e})=>P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M25 26H111V111H25",fill:Nt(e)}),(0,u.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:Nt(e),strokeWidth:"2"}),(0,u.jsx)("path",{d:"M100 100H160V160H100",fill:Nt(e)}),(0,u.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:Nt(e),strokeWidth:"2"}),(0,u.jsxs)("g",{fill:rp(e),stroke:Nt(e),strokeWidth:"6",children:[(0,u.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),KI=De.default.memo(({theme:e})=>P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M25 26H111V111H25",fill:Nt(e)}),(0,u.jsx)("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:Nt(e),strokeWidth:"2"}),(0,u.jsx)("path",{d:"M100 100H160V160H100",fill:Nt(e)}),(0,u.jsx)("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:Nt(e),strokeWidth:"2"}),(0,u.jsxs)("g",{fill:rp(e),stroke:Nt(e),strokeWidth:"6",children:[(0,u.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),(0,u.jsx)("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),QI=P((0,u.jsx)("g",{strokeWidth:1.25,children:(0,u.jsx)("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),X),JI=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:(0,u.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),(0,u.jsx)("g",{mask:"url(#FillHachureIcon)",children:(0,u.jsx)("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),X),eS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("g",{clipPath:"url(#a)",children:[(0,u.jsx)("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:(0,u.jsx)("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,u.jsx)("g",{mask:"url(#FillCrossHatchIcon)",children:(0,u.jsx)("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),tS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("g",{clipPath:"url(#a)",children:(0,u.jsx)("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...X,fill:"currentColor"}),nS=P((0,u.jsx)(u.Fragment,{children:(0,u.jsx)("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),X),oS=P((0,u.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),X),iS=P((0,u.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),X),rS=De.default.memo(({theme:e})=>P((0,u.jsx)("path",{d:"M6 10H34",stroke:Nt(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),aS=P((0,u.jsxs)("g",{strokeWidth:"2",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 12h2"}),(0,u.jsx)("path",{d:"M17 12h2"}),(0,u.jsx)("path",{d:"M11 12h2"})]}),L),sS=P((0,u.jsxs)("g",{strokeWidth:"2",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 12v.01"}),(0,u.jsx)("path",{d:"M8 12v.01"}),(0,u.jsx)("path",{d:"M12 12v.01"}),(0,u.jsx)("path",{d:"M16 12v.01"}),(0,u.jsx)("path",{d:"M20 12v.01"})]}),L),lS=P((0,u.jsx)("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),X),dS=P((0,u.jsx)("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),X),cS=P((0,u.jsx)("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),X),uS=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]}),L),pS=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"2.75",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"3.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),L),hS=P((0,u.jsxs)("svg",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),(0,u.jsx)("path",{d:"M13.3333 3.33331V3.34331"}),(0,u.jsx)("path",{d:"M16.6667 3.33331V3.34331"}),(0,u.jsx)("path",{d:"M16.6667 6.66669V6.67669"}),(0,u.jsx)("path",{d:"M16.6667 10V10.01"}),(0,u.jsx)("path",{d:"M3.33334 13.3333V13.3433"}),(0,u.jsx)("path",{d:"M16.6667 13.3333V13.3433"}),(0,u.jsx)("path",{d:"M3.33334 16.6667V16.6767"}),(0,u.jsx)("path",{d:"M6.66666 16.6667V16.6767"}),(0,u.jsx)("path",{d:"M10 16.6667V16.6767"}),(0,u.jsx)("path",{d:"M13.3333 16.6667V16.6767"}),(0,u.jsx)("path",{d:"M16.6667 16.6667V16.6767"})]}),X),mS=P((0,u.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),(0,u.jsx)("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),(0,u.jsx)("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),(0,u.jsx)("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),(0,u.jsx)("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),(0,u.jsx)("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),(0,u.jsx)("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),(0,u.jsx)("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),(0,u.jsx)("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),(0,u.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),(0,u.jsx)("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),(0,u.jsx)("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),L),fS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",opacity:.3,strokeWidth:2,fill:"none",strokeLinecap:"round",children:[(0,u.jsx)("path",{d:"M7,11 H19"}),(0,u.jsx)("path",{d:"M25,6 L33,16 M33,6 L25,16"})]}),it)),gS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:(0,u.jsx)("path",{d:"M7,11 H33 M23,5 L33,11 L23,17"})}),it)),ES=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[(0,u.jsx)("path",{d:"M7,11 H23",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M23,5 L35,11 L23,17 Z"})]}),it)),xS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",children:[(0,u.jsx)("path",{d:"M7,11 H23"}),(0,u.jsx)("path",{d:"M23,5 L35,11 L23,17 Z"})]}),it)),yS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,u.jsx)("path",{d:"M7,11 H25",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("circle",{cx:"29",cy:"11",r:"4"})]}),it)),wS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[(0,u.jsx)("path",{d:"M7,11 H25",strokeLinecap:"round"}),(0,u.jsx)("circle",{cx:"29",cy:"11",r:"4"})]}),it)),bS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[(0,u.jsx)("path",{d:"M7,11 H21",strokeWidth:2,strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),it)),MS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,strokeLinecap:"round",children:[(0,u.jsx)("path",{d:"M7,11 H21"}),(0,u.jsx)("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),it)),PS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",children:(0,u.jsx)("path",{d:"M11,11 H31 M31,5 V17"})}),it)),IS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,u.jsx)("path",{d:"M35,11 H7 M15,5 V17"})}),it)),SS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,u.jsx)("path",{d:"M35,11 H7 M15,11 L7,5 M15,11 L7,17"})}),it)),vS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,u.jsx)("path",{d:"M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17"})}),it)),AS=De.default.memo(({flip:e=!1})=>P((0,u.jsx)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:(0,u.jsx)("path",{d:"M35,11 H7 M15,5 V17 M7,5 V17"})}),it)),kS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[(0,u.jsx)("path",{d:"M35,11 H19 M11,11 H7 M7,5 V17"}),(0,u.jsx)("circle",{cx:"15",cy:"11",r:"4"})]}),it)),TS=De.default.memo(({flip:e=!1})=>P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[(0,u.jsx)("path",{d:"M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17"}),(0,u.jsx)("circle",{cx:"23",cy:"11",r:"4"})]}),it)),LS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("g",{clipPath:"url(#a)",children:(0,u.jsx)("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),CS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("g",{clipPath:"url(#a)",children:(0,u.jsx)("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),DS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("g",{clipPath:"url(#a)",children:(0,u.jsx)("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"a",children:(0,u.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),X),BS=P((0,u.jsx)(u.Fragment,{children:(0,u.jsx)("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),X),GS=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 7v-2h13v2"}),(0,u.jsx)("path",{d:"M10 5v14"}),(0,u.jsx)("path",{d:"M12 19h-4"}),(0,u.jsx)("path",{d:"M15 13v-1h6v1"}),(0,u.jsx)("path",{d:"M18 12v7"}),(0,u.jsx)("path",{d:"M17 19h2"})]}),L),OS=P((0,u.jsx)(u.Fragment,{children:(0,u.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M7 12h10"}),(0,u.jsx)("path",{d:"M7 5v14"}),(0,u.jsx)("path",{d:"M17 5v14"}),(0,u.jsx)("path",{d:"M15 19h4"}),(0,u.jsx)("path",{d:"M15 5h4"}),(0,u.jsx)("path",{d:"M5 19h4"}),(0,u.jsx)("path",{d:"M5 5h4"})]})}),L),RS=P((0,u.jsx)(u.Fragment,{children:(0,u.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,u.jsx)("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),X),FS=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M7 8l-4 4l4 4"}),(0,u.jsx)("path",{d:"M17 8l4 4l-4 4"}),(0,u.jsx)("path",{d:"M14 4l-4 16"})]}),L);var NS=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,u.jsx)("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),(0,u.jsx)("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),L),HS=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,u.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),(0,u.jsx)("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),L),zS=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,u.jsx)("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),(0,u.jsx)("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),L),_S=De.default.memo(({theme:e})=>P((0,u.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),(0,u.jsx)("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),L)),WS=De.default.memo(({theme:e})=>P((0,u.jsxs)("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),(0,u.jsx)("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),L)),jS=De.default.memo(({theme:e})=>P((0,u.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),(0,u.jsx)("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),(0,u.jsx)("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),L)),VS=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M21 19h-18l9 -15"}),(0,u.jsx)("path",{d:"M20.615 15.171h.015"}),(0,u.jsx)("path",{d:"M19.515 11.771h.015"}),(0,u.jsx)("path",{d:"M17.715 8.671h.015"}),(0,u.jsx)("path",{d:"M15.415 5.971h.015"})]}),L),US=P((0,u.jsx)("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512}),YS=P((0,u.jsx)("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"})),XS=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,u.jsx)("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),(0,u.jsx)("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,u.jsx)("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),L),$S=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),(0,u.jsx)("path",{d:"M7 11l5 5l5 -5"}),(0,u.jsx)("path",{d:"M12 4l0 12"})]}),L),ZS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),(0,u.jsx)("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),L),qS=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,u.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,u.jsx)("path",{d:"M9.15 14.85l8.85 -10.85"}),(0,u.jsx)("path",{d:"M6 4l8.85 10.85"})]}),L),KS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),(0,u.jsx)("path",{d:"M12 17l0 .01"}),(0,u.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),L),QS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M7 4v16l13 -8z"})]}),L),JS=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),L),ev=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 12l5 5l10 -10"})]}),L),tv=P((0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),(0,u.jsx)("path",{d:"M12 9v4"}),(0,u.jsx)("path",{d:"M12 17h.01"})]}),L),nv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M11 7l6 6"}),(0,u.jsx)("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),L),ov=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 3l-4 7h8z"}),(0,u.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,u.jsx)("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),L),iv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 7l16 0"}),(0,u.jsx)("path",{d:"M4 17l16 0"}),(0,u.jsx)("path",{d:"M7 4l0 16"}),(0,u.jsx)("path",{d:"M17 4l0 16"})]}),L),rv=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"}),(0,u.jsx)("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})]}),L),av=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 10l-2 1l8 4l8 -4l-2 -1"}),(0,u.jsx)("path",{d:"M4 15l8 4l8 -4"}),(0,u.jsx)("path",{d:"M12 4v7"}),(0,u.jsx)("path",{d:"M15 8l-3 3l-3 -3"})]}),L),sv=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{d:"M4.16602 10H15.8327"}),(0,u.jsx)("path",{d:"M12.5 13.3333L15.8333 10"}),(0,u.jsx)("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),X),lv=P((0,u.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[(0,u.jsx)("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),(0,u.jsx)("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),dv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,u.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,u.jsx)("path",{d:"M15 6l3 3"}),(0,u.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,u.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),L),cv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,u.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,u.jsx)("path",{d:"M15 6l3 3"}),(0,u.jsx)("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),(0,u.jsx)("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),L),uv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),(0,u.jsx)("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),(0,u.jsx)("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),(0,u.jsx)("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),(0,u.jsx)("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),(0,u.jsx)("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),L),pv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),(0,u.jsx)("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),(0,u.jsx)("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),(0,u.jsx)("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),L),hv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),(0,u.jsx)("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),L),mv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),(0,u.jsx)("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),(0,u.jsx)("path",{d:"M3 3l18 18"})]}),L),fv=P((0,u.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,u.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,u.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,u.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,u.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,u.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),L),gv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),(0,u.jsx)("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),(0,u.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,u.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,u.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,u.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),L),Ev=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),(0,u.jsx)("path",{d:"M21 21l-6 -6"})]}),L),xv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),(0,u.jsx)("path",{d:"M12 7v5l3 3"}),(0,u.jsx)("path",{d:"M19 16l-2 3h4l-2 3"})]}),L),yv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 8l0 4l2 2"}),(0,u.jsx)("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]}),L),wv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),(0,u.jsx)("path",{d:"M5 10a7 7 0 0 0 14 0"}),(0,u.jsx)("path",{d:"M8 21l8 0"}),(0,u.jsx)("path",{d:"M12 17l0 4"})]}),L),bv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 3l18 18"}),(0,u.jsx)("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),(0,u.jsx)("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),(0,u.jsx)("path",{d:"M8 21l8 0"}),(0,u.jsx)("path",{d:"M12 17l0 4"})]}),L),Mv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),L),Pv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),(0,u.jsx)("path",{d:"M12 20v.01"}),(0,u.jsx)("path",{d:"M16 20v.01"}),(0,u.jsx)("path",{d:"M8 20v.01"}),(0,u.jsx)("path",{d:"M4 20v.01"}),(0,u.jsx)("path",{d:"M4 16v.01"}),(0,u.jsx)("path",{d:"M4 12v.01"}),(0,u.jsx)("path",{d:"M4 8v.01"}),(0,u.jsx)("path",{d:"M4 4v.01"}),(0,u.jsx)("path",{d:"M8 4v.01"}),(0,u.jsx)("path",{d:"M12 4v.01"}),(0,u.jsx)("path",{d:"M16 4v.01"}),(0,u.jsx)("path",{d:"M20 4v.01"}),(0,u.jsx)("path",{d:"M20 8v.01"}),(0,u.jsx)("path",{d:"M20 12v.01"}),(0,u.jsx)("path",{d:"M20 16v.01"}),(0,u.jsx)("path",{d:"M20 20v.01"})]}),L),Iv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 3v18"}),(0,u.jsx)("path",{d:"M19 21v-18"}),(0,u.jsx)("path",{d:"M5 7h14"}),(0,u.jsx)("path",{d:"M5 15h14"}),(0,u.jsx)("path",{d:"M8 13v4"}),(0,u.jsx)("path",{d:"M11 13v4"}),(0,u.jsx)("path",{d:"M16 13v4"}),(0,u.jsx)("path",{d:"M14 5v4"}),(0,u.jsx)("path",{d:"M11 5v4"}),(0,u.jsx)("path",{d:"M8 5v4"}),(0,u.jsx)("path",{d:"M3 21h18"})]}),L),Sv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 12l18 0"}),(0,u.jsx)("path",{d:"M7 16l10 0l-10 5l0 -5"}),(0,u.jsx)("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),L),vv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M12 3l0 18"}),(0,u.jsx)("path",{d:"M16 7l0 10l5 0l-5 -10"}),(0,u.jsx)("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),L),Av=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),(0,u.jsx)("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),(0,u.jsx)("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),L),kv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),(0,u.jsx)("path",{d:"M22 22l-3 -3"}),(0,u.jsx)("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),(0,u.jsx)("path",{d:"M3 11v-1"}),(0,u.jsx)("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),(0,u.jsx)("path",{d:"M10 3h1"}),(0,u.jsx)("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),L),Tv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,u.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,u.jsx)("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),(0,u.jsx)("path",{d:"M10 15l2 6l2 -6"}),(0,u.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),L),Lv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,u.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,u.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),(0,u.jsx)("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),(0,u.jsx)("path",{d:"M11 21v-6l3 6v-6"})]}),L),Cv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),(0,u.jsx)("path",{d:"M4 8l5 0"}),(0,u.jsx)("path",{d:"M15 8l4 0"})]}),L),Dv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),(0,u.jsx)("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,u.jsx)("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,u.jsx)("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),(0,u.jsx)("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),L),Bv=P((0,u.jsxs)("g",{stroke:"currentColor",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...L,strokeWidth:1.5}),Gv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"}),(0,u.jsx)("path",{d:"M21 12h-13l3 -3"}),(0,u.jsx)("path",{d:"M11 15l-3 -3"})]}),L),Ov=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),(0,u.jsx)("path",{d:"M10 9l5 3l-5 3z"})]}),L),Rv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 6h18"}),(0,u.jsx)("path",{d:"M3 12h18"}),(0,u.jsx)("path",{d:"M3 18h18"}),(0,u.jsx)("path",{d:"M6 3v18"}),(0,u.jsx)("path",{d:"M12 3v18"}),(0,u.jsx)("path",{d:"M18 3v18"})]}),L),Fv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),(0,u.jsx)("path",{d:"M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),(0,u.jsx)("path",{d:"M17 5c-6.627 0 -12 5.373 -12 12"})]}),L),Nv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 18l12 -12"}),(0,u.jsx)("path",{d:"M18 10v-4h-4"})]}),L),Hv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7"}),(0,u.jsx)("path",{d:"M18 4l3 3l-3 3"})]}),L),zv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{d:"M16,12L20,9L16,6"}),(0,u.jsx)("path",{d:"M6 20c0 -6.075 4.925 -11 11 -11h3"})]}),L),_v=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 9l6 6l6 -6"})]}),L),Wv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 15l6 -6l6 6"})]}),L),jv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 15l6 -6l6 6"})]}),L),Vv=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),(0,u.jsx)("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]}),L),Uv=P((0,u.jsxs)("g",{children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M5 7l0 10"}),(0,u.jsx)("path",{d:"M7 5l10 0"}),(0,u.jsx)("path",{d:"M7 19l10 0"}),(0,u.jsx)("path",{d:"M19 7l0 10"})]}),L),Yv=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"10",y:"4",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"16",y:"4",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"4",y:"10",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"10",y:"10",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"16",y:"10",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"4",y:"16",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"10",y:"16",width:"4",height:"4",rx:"1"}),(0,u.jsx)("rect",{x:"16",y:"16",width:"4",height:"4",rx:"1"})]}),L),Xv=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("rect",{x:"7",y:"6",width:"10",height:"8",rx:"1",strokeDasharray:"2 2"}),(0,u.jsx)("line",{x1:"3",y1:"6",x2:"3",y2:"14"}),(0,u.jsx)("polyline",{points:"2 8 3 6 4 8"}),(0,u.jsx)("polyline",{points:"2 12 3 14 4 12"}),(0,u.jsx)("line",{x1:"7",y1:"18",x2:"17",y2:"18"}),(0,u.jsx)("polyline",{points:"9 17 7 18 9 19"}),(0,u.jsx)("polyline",{points:"15 17 17 18 15 19"})]}),L),$v=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1"}),(0,u.jsx)("path",{d:"M4 12h7a1 1 0 0 1 1 1v7"})]}),L),Zv=P((0,u.jsx)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:.5,viewBox:"0 0 640 512",children:(0,u.jsx)("path",{d:"M15 15C24.4 5.7 39.6 5.7 49 15l63 63L112 40c0-13.3 10.7-24 24-24s24 10.7 24 24l0 96c0 13.3-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l38.1 0L15 49C5.7 39.6 5.7 24.4 15 15zM133.5 243.9C158.6 193.6 222.7 112 320 112s161.4 81.6 186.5 131.9c3.8 7.6 3.8 16.5 0 24.2C481.4 318.4 417.3 400 320 400s-161.4-81.6-186.5-131.9c-3.8-7.6-3.8-16.5 0-24.2zM320 320a64 64 0 1 0 0-128 64 64 0 1 0 0 128zM591 15c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-63 63 38.1 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24s24 10.7 24 24l0 38.1 63-63zM15 497c-9.4-9.4-9.4-24.6 0-33.9l63-63L40 400c-13.3 0-24-10.7-24-24s10.7-24 24-24l96 0c13.3 0 24 10.7 24 24l0 96c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-38.1L49 497c-9.4 9.4-24.6 9.4-33.9 0zm576 0l-63-63 0 38.1c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24l96 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-38.1 0 63 63c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0z"})})),qv=P((0,u.jsxs)("g",{strokeWidth:1.5,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 6l8 0"}),(0,u.jsx)("path",{d:"M16 6l4 0"}),(0,u.jsx)("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 12l2 0"}),(0,u.jsx)("path",{d:"M10 12l10 0"}),(0,u.jsx)("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 18l11 0"}),(0,u.jsx)("path",{d:"M19 18l1 0"})]}),L),Kv=P((0,u.jsxs)("g",{strokeWidth:1,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4"})]}),L),Qv=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),(0,u.jsx)("path",{d:"M13.5 6.5l4 4"})]}),L),Jv=P((0,u.jsxs)("g",{strokeWidth:1,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M11 7l-5 5l5 5"}),(0,u.jsx)("path",{d:"M17 7l-5 5l5 5"})]}),L),e7=P((0,u.jsxs)("g",{strokeWidth:"1.75",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),(0,u.jsx)("path",{d:"M15 4l0 16"})]}),L),t7=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1"})]}),L),n7=P((0,u.jsxs)("g",{strokeWidth:"1.25",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M3 4l18 0"}),(0,u.jsx)("path",{d:"M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10"}),(0,u.jsx)("path",{d:"M12 16l0 4"}),(0,u.jsx)("path",{d:"M9 20l6 0"}),(0,u.jsx)("path",{d:"M8 12l3 -3l2 2l3 -3"})]}),L);var o7=P((0,u.jsxs)("g",{strokeWidth:"1.5",children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("polyline",{points:"9 6 15 12 9 18"})]}),L),i7=P((0,u.jsxs)("g",{strokeWidth:1.25,children:[(0,u.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,u.jsx)("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 6l8 0"}),(0,u.jsx)("path",{d:"M16 6l4 0"}),(0,u.jsx)("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 12l2 0"}),(0,u.jsx)("path",{d:"M10 12l10 0"}),(0,u.jsx)("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),(0,u.jsx)("path",{d:"M4 18l11 0"}),(0,u.jsx)("path",{d:"M19 18l1 0"})]}),L);var Ep=[{icon:Hs,value:"selection",key:vt.V,numericKey:void 0,fillable:!0,myocSimplifiedMode:!0},{icon:ap,value:"rectangle",key:vt.R,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:sp,value:"diamond",key:vt.D,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:lp,value:"ellipse",key:vt.O,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:dp,value:"arrow",key:vt.A,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:cp,value:"line",key:vt.L,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:up,value:"freedraw",key:[vt.P,vt.X],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:pp,value:"text",key:vt.T,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:hp,value:"image",key:[vt.I],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:mp,value:"eraser",key:vt.E,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0}],m2=e=>e.state.preferredSelectionTool.type==="lasso"?[{value:"lasso",icon:Hs,key:vt.V,fillable:!0,myocSimplifiedMode:!0},...Ep.slice(1)]:Ep,p7=(e,t)=>m2(t).find((o,i)=>o.numericKey!=null&&e===o.numericKey?.toString()||o.key&&(typeof o.key=="string"?o.key===e:o.key.includes(e)))?.value||null,h7=(e,t)=>{let n=te(e,t);return n?e.type==="arrow"?hi({...n,...F.getBoundTextElementPosition(e,n,t)},t):hi(n,t):null};I();var E7=(e,t)=>!!(!e.viewModeEnabled&&e.openDialog?.name!=="elementLinkSelector"&&(e.activeTool.type!=="custom"&&(e.editingTextElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="lasso"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||$t(t,e).length));I();import{pointFrom as Br}from"@excalidraw/math";import{DEFAULT_FONT_FAMILY as f2,DEFAULT_FONT_SIZE as g2,TEXT_ALIGN as E2,VERTICAL_ALIGN as x2,getSizeFromPoints as y2,randomId as w2,arrayToMap as b2,assertNever as zs,cloneJSON as yp,getFontString as M2,isDevEnv as P2,toBrandedType as I2,getLineHeight as S2}from"@excalidraw/common";var Gr={width:100,height:0},Yn=100,v2=(e,t,n)=>{let o=lo({x:0,y:0,textAlign:E2.CENTER,verticalAlign:x2.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:o.id})}),Ui(o,e,n),[e,o]},xp=(e,t,n,o,i)=>{let r,a;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let c=t?.width??Yn,p=t?.height??Yn,h;t.id&&(h=o.getElement(t.id),h||console.error(`No element for start binding with id ${t.id} found`));let m=t.x||e.x-c,g=t.y||e.y-p/2,f=h?h.type:t.type;if(f){if(f==="text"){let E="";h&&h.type==="text"?E=h.text:t.type==="text"&&(E=t.text),E||console.error(`No text found for start binding text element for ${e.id}`),r=lo({x:m,y:g,type:"text",...h,...t,text:E}),Object.assign(r,{x:t.x||e.x-r.width,y:t.y||e.y-r.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{r=so({x:m,y:g,width:c,height:p,...h,...t,type:f});break}default:zs(e,`Unhandled element start type "${t.type}"`,!0)}Xt(e,r,"orbit","start",i)}}if(n){let c=n?.height??Yn,p=n?.width??Yn,h;n.id&&(h=o.getElement(n.id),h||console.error(`No element for end binding with id ${n.id} found`));let m=n.x||e.x+e.width,g=n.y||e.y-c/2,f=h?h.type:n.type;if(f){if(f==="text"){let E="";h&&h.type==="text"?E=h.text:n.type==="text"&&(E=n.text),E||console.error(`No text found for end binding text element for ${e.id}`),a=lo({x:m,y:g,type:"text",...h,...n,text:E}),Object.assign(a,{y:n.y||e.y-a.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{a=so({x:m,y:g,width:p,height:c,...h,...n,type:f});break}default:zs(e,`Unhandled element end type "${f}"`,!0)}Xt(e,a,"orbit","end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:r,endBoundElement:a};let s=e.points.length-1,l=.5,d=yp(e.points);return e.points[s][0]>e.points[s-1][0]&&(d[0][0]=l,d[s][0]-=l),e.points[s][0]<e.points[s-1][0]&&(d[0][0]=-l,d[s][0]+=l),e.points[s][1]>e.points[s-1][1]&&(d[0][1]=l,d[s][1]-=l),e.points[s][1]<e.points[s-1][1]&&(d[0][1]=-l,d[s][1]+=l),Object.assign(e,F.getNormalizeElementPointsAndCoords({...e,points:d})),{linearElement:e,startBoundElement:r,endBoundElement:a}},_s=class{excalidrawElements=new Map;add=t=>{t&&this.excalidrawElements.set(t.id,t)};getElements=()=>Ra(Array.from(this.excalidrawElements.values()));getElementsMap=()=>I2(b2(this.getElements()));getElement=t=>this.excalidrawElements.get(t)},C7=(e,t)=>{if(!e)return[];let n=yp(e),o=new _s,i=new Map,r=new Map;for(let l of n){let d,c=l.id;switch(t?.regenerateIds!==!1&&Object.assign(l,{id:w2()}),l.type){case"rectangle":case"ellipse":case"diamond":{let h=l?.label?.text&&l.width===void 0?0:l?.width||Yn,m=l?.label?.text&&l.height===void 0?0:l?.height||Yn;d=so({...l,width:h,height:m});break}case"line":{let h=l.width||Gr.width,m=l.height||Gr.height;d=fu({width:h,height:m,points:[Br(0,0),Br(h,m)],...l});break}case"arrow":{let h=l.width||Gr.width,m=l.height||Gr.height;d=Mr({width:h,height:m,endArrowhead:"arrow",points:[Br(0,0),Br(h,m)],...l,type:"arrow"}),Object.assign(d,y2(d.points));break}case"text":{let h=l?.fontFamily||f2,m=l?.fontSize||g2,g=l?.lineHeight||S2(h),f=l.text??"",E=$o(f),x=Et(E,M2({fontFamily:h,fontSize:m}),g);d=lo({width:x.width,height:x.height,fontFamily:h,fontSize:m,...l});break}case"image":{d=gu({width:l?.width||Yn,height:l?.height||Yn,...l});break}case"frame":{d=pu({x:0,y:0,...l});break}case"magicframe":{d=hu({x:0,y:0,...l});break}case"freedraw":case"iframe":case"embeddable":{d=l;break}default:d=l,zs(l,`Unhandled element type "${l.type}"`,!0)}o.getElement(d.id)?console.error(`Duplicate id found for ${d.id}`):(o.add(d),i.set(d.id,l),c&&r.set(c,d.id))}let a=o.getElementsMap(),s=new Ao(a);for(let[l,d]of i){let c=o.getElement(l);switch(d.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if(d.label?.text){let[p,h]=v2(c,d?.label,s);if(o.add(p),o.add(h),Y(p)){let m=d.type==="arrow"?d?.start:void 0,g=d.type==="arrow"?d?.end:void 0;if(m&&m.id){let y=r.get(m.id);y&&Object.assign(m,{id:y})}if(g&&g.id){let y=r.get(g.id);y&&Object.assign(g,{id:y})}let{linearElement:f,startBoundElement:E,endBoundElement:x}=xp(p,m,g,o,s);p=f,o.add(f),o.add(E),o.add(x)}}else switch(d.type){case"arrow":{let{start:p,end:h}=d;if(p&&p.id){let E=r.get(p.id);Object.assign(p,{id:E})}if(h&&h.id){let E=r.get(h.id);Object.assign(h,{id:E})}let{linearElement:m,startBoundElement:g,endBoundElement:f}=xp(c,p,h,o,s);o.add(m),o.add(g),o.add(f);break}}break}}}for(let[l,d]of i){if(d.type!=="frame"&&d.type!=="magicframe")continue;let c=o.getElement(l);if(!c)throw new Error(`Excalidraw element with id ${l} doesn't exist`);let p=[];d.children.forEach(b=>{let S=r.get(b);if(!S)throw new Error(`Element with ${b} wasn't mapped correctly`);let v=o.getElement(S);if(!v)throw new Error(`Frame element with id ${S} doesn't exist`);Object.assign(v,{frameId:c.id}),v?.boundElements?.forEach(k=>{let A=o.getElement(k.id);if(!A)throw new Error(`Bound element with id ${k.id} doesn't exist`);Object.assign(A,{frameId:c.id}),p.push(A)}),p.push(v)});let[h,m,g,f]=tt(p),E=10;h=h-E,m=m-E,g=g+E,f=f+E;let x=c?.x||h,y=c?.y||m,w=c?.width||g-h,M=c?.height||f-m;Object.assign(c,{x,y,width:w,height:M}),P2()&&d.children.length&&(c?.x||c?.y||c?.width||c?.height)&&console.info("User provided frame attributes are being considered, if you find this inaccurate, please remove any of the attributes - x, y, width and height so frame coordinates and dimensions are calculated automatically")}return o.getElements()};I();var R7=({app:e,event:t})=>{let n=e.state;if(n.selectedLinearElement&&e.lastPointerMoveCoords){if(n.selectedLinearElement.draggedFocusPointBinding)return Tu(n.selectedLinearElement,e.scene.getNonDeletedElementsMap(),e.lastPointerMoveCoords,e.scene,n,e.getEffectiveGridSize(),t.altKey),!0;if(n.selectedLinearElement.hoverPointIndex!==null&&e.lastPointerMoveEvent&&n.selectedLinearElement.initialState.lastClickedPoint>=0&&n.selectedLinearElement.isDragging)return F.handlePointDragging(e.lastPointerMoveEvent,e,e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y,n.selectedLinearElement),!0}return!1};I();var A2=e=>{switch(e){case void 0:case null:return null;case"dot":return"circle";case"crowfoot_one":return"cardinality_one";case"crowfoot_many":return"cardinality_many";case"crowfoot_one_or_many":return"cardinality_one_or_many";default:return e}},H7=e=>{let t=A2(e);return t===null?null:t};var V7=e=>e.reduce((t,n)=>t+n.version,0),qc=e=>{let t=5381;for(let n of k2(e))t=(t<<5)+t+n.versionNonce;return t>>>0},Kc=e=>{let t=5381;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);t=(t<<5)+t+o}return t>>>0},U7=e=>e.filter(t=>!t.isDeleted&&!Fc(t)),Y7=e=>e.filter(t=>!t.isDeleted),X7=e=>!e.isDeleted;export{zn as AppStateDelta,$h as BASE_ARROW_MIN_LENGTH,Sd as BASE_BINDING_GAP,to as BASE_BINDING_GAP_ELBOW,ue as BASE_PADDING,Gn as BindableElement,Bn as BoundElement,mt as CaptureUpdateAction,e6 as DEFAULT_LINK_SIZE,Ru as DEFAULT_OMIT_SIDES,K as Delta,cs as DurableIncrement,ns as ElementBounds,_n as ElementsDelta,us as EphemeralIncrement,ii as FOCUS_POINT_SIZE,Su as FlowChartCreator,Iu as FlowChartNavigator,We as HEADING_DOWN,ct as HEADING_LEFT,Ce as HEADING_RIGHT,yt as HEADING_UP,j0 as INVISIBLY_SMALL_ELEMENT_SIZE,Ga as InvalidFractionalIndexError,F as LinearElementEditor,Ue as MINIMAL_CROP_SIZE,oP as OMIT_SIDES_FOR_FRAME,nP as OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,Ep as SHAPES,Ao as Scene,wt as ShapeCache,Xc as Store,mi as StoreChange,ps as StoreDelta,xr as StoreIncrement,Wn as StoreSnapshot,It as aabbForElement,wm as addElementsToFrame,Dg as addNewNodes,qw as addToGroup,e4 as alignElements,u4 as arrangeElements,tm as avoidRectangularCorner,Xt as bindBindingElement,Od as bindElementsToFramesAfterDuplication,Zh as bindOrUnbindBindingElement,X3 as bindOrUnbindBindingElements,Aa as bindPointToSnapToElementOutline,Td as bindingProperties,_a as boundsContainBounds,yd as bumpVersion,om as calculateFixedPointForElbowArrowBinding,wo as calculateFixedPointForNonElbowArrowBinding,Wx as canApplyRoundnessTypeToElement,Ll as canBecomePolygon,Xl as canChangeRoundness,og as canCreateLinkFromElements,$y as canHaveArrowheads,Tr as canResizeFromSides,Eo as charWidth,Le as compareHeading,Zo as computeBoundTextPosition,sa as computeContainerDimensionForBoundText,xy as containsCJK,C7 as convertToExcalidrawElements,Z5 as createPlaceholderEmbeddableLabel,gs as createSrcDoc,Gx as cropElement,In as deconstructDiamondElement,Qn as deconstructLinearOrFreeDrawElement,Pn as deconstructRectanguloidElement,ds as deepCopyElement,S5 as defaultGetElementLinkFromSelection,uy as detectLineHeight,An as distanceToElement,l5 as distributeElements,dn as doBoundsIntersect,w5 as dragNewElement,x5 as dragSelectedElements,hf as duplicateElement,S4 as duplicateElements,Zw as editGroupForSelectedElement,me as elementCenterPoint,On as elementOverlapsWithFrame,di as elementWithCanvasCache,Fn as elementsAreInFrameBounds,Ud as elementsAreInSameGroup,Wd as elementsOverlappingBBox,K5 as embeddableURLValidator,Lm as excludeElementsInFramesFromSelection,Pw as filterElementsEligibleAsFrameChildren,p7 as findShapeByKey,Z3 as fixBindingsAfterDeletion,kd as fixDuplicatedBindingsAfterDuplication,Ea as flipHeading,Tw as frameAndChildrenSelectedTogether,Fl as generateLinearCollisionShape,ht as generateRoughOptions,Ob as generateThumbHash,jw as getActiveTextElement,Xi as getAllHoveredElementAtPoint,Wl as getApproxMinLineHeight,_l as getApproxMinLineWidth,Ld as getArrowLocalFixedPoints,R0 as getArrowheadAngle,H7 as getArrowheadForPicker,ot as getArrowheadPoints,O0 as getArrowheadSize,Qe as getBindingGap,q3 as getBindingSideMidPoint,Da as getBindingStrategyForDraggingBindingElementEndpoints,te as getBoundTextElement,sn as getBoundTextElementId,Ly as getBoundTextElementPosition,qo as getBoundTextMaxHeight,Ct as getBoundTextMaxWidth,h7 as getBoundTextShape,is as getBoundsFromPoints,kn as getCenterForBounds,N6 as getClosestElementBounds,Ke as getCommonBoundingBox,tt as getCommonBounds,xm as getCommonFrameId,ky as getContainerCenter,la as getContainerCoords,Xe as getContainerElement,Rn as getContainingFrame,tn as getCornerRadius,$i as getCubicBezierCurveBound,mP as getCursorForResizingElement,Sm as getDefaultFrameName,jx as getDefaultRoundnessTypeForElement,Rl as getDiamondBaseCorners,go as getDiamondPoints,y5 as getDragOffsetXY,F6 as getDraggedElementsBounds,ee as getElementAbsoluteCoords,Ee as getElementBounds,Ha as getElementLineSegments,Ya as getElementPointsCoords,hi as getElementShape,pP as getElementWithTransformHandleType,Rd as getElementsCompletelyInFrame,et as getElementsInGroup,Mw as getElementsInNewFrame,bw as getElementsInResizingFrame,fw as getElementsIntersectingFrame,kw as getElementsOverlappingFrame,Hd as getElementsWithinSelection,$5 as getEmbedLink,Ox as getFlipAdjustedCropPosition,Nn as getFrameChildren,ym as getFrameChildrenInsertionIndex,gm as getFrameLikeElements,Aw as getFrameLikeTitle,o6 as getFreedrawOutlineAsSegments,S0 as getFreedrawOutlinePoints,st as getGlobalFixedPointForBindableElement,im as getGlobalFixedPoints,xd as getHeadingForElbowArrowSnap,ln as getHoveredElementForBinding,ad as getHoveredElementForFocusPoint,Fb as getInitializedImageElements,Wi as getLineHeightInPx,vn as getLineWidth,Vx as getLinearElementSubType,uM as getLinkDirectionFromKey,v5 as getLinkIdAndTypeFromSelection,cc as getLockedLinearCursorAlignSize,R1 as getMaxCharWidth,cr as getMaximumGroups,hy as getMinCharWidth,si as getMinMaxXYFromCurvePathOps,_i as getMinTextElementWidth,Xd as getNewGroupIdsForDuplication,Y7 as getNonDeletedElements,Vd as getNonDeletedGroupIds,$6 as getNormalizedDimensions,vo as getObservedAppState,As as getOmitSidesForEditorInterface,ay as getOriginalContainerHeightFromCache,rs as getPerfectElementSize,ws as getPredecessors,R6 as getRectangleBoxAbsoluteCoords,c0 as getRenderOpacity,ZM as getResizeArrowDirection,$M as getResizeOffsetXY,bn as getResizedElementAbsoluteCoords,ww as getRootElements,V7 as getSceneVersion,$t as getSelectedElements,ur as getSelectedElementsByGroup,ja as getSelectedGroupForElement,Rm as getSelectedGroupIdForElement,Gm as getSelectedGroupIds,Ww as getSelectionStateForElements,Ni as getSnapOutlineMidPoint,_w as getTargetElements,Mm as getTargetFrame,Ty as getTextElementAngle,Gy as getTextFromElements,O1 as getTextHeight,jl as getTextWidth,gc as getThumbHashPlaceholder,m2 as getToolbarTools,hP as getTransformHandleTypeFromCoords,Fu as getTransformHandles,ks as getTransformHandlesFromCoords,Ml as getUncroppedImageElement,Zr as getUncroppedWidthAndHeight,Hw as getVisibleAndNonSelectedElements,U7 as getVisibleElements,H6 as getVisibleSceneBounds,U1 as getWrappedTextLines,yw as groupByFrameLikes,Ew as groupsAreAtLeastIntersectingTheFrame,xw as groupsAreCompletelyOutOfFrame,eo as handleBindTextResize,Tu as handleFocusPointDrag,IM as handleFocusPointHover,MM as handleFocusPointPointerDown,PM as handleFocusPointPointerUp,pa as hasBackground,zt as hasBoundTextElement,iP as hasBoundingBox,Yy as hasFreedrawMode,jy as hasStrokeColor,Uy as hasStrokeStyle,Vy as hasStrokeWidth,qc as hashElementsVersion,Kc as hashString,dt as headingForPoint,Qo as headingForPointFromElement,Dt as headingForPointIsHorizontal,ut as headingIsHorizontal,f3 as headingIsVertical,xh as hitElementBoundText,Eh as hitElementBoundingBox,d3 as hitElementBoundingBoxOnly,_t as hitElementItself,jt as intersectElementWithLineSegment,_x as isArrowBoundToElement,Y as isArrowElement,Ae as isBindableElement,fa as isBindableElementInsideOtherBindable,Ye as isBindingElement,y1 as isBindingElementType,Yt as isBindingEnabled,ke as isBoundToContainer,gw as isCursorInFrame,E1 as isCurvedArrow,Z as isElbowArrow,X6 as isElementCompletelyInViewport,za as isElementContainingFrame,Nd as isElementInFrame,Om as isElementInGroup,jd as isElementInViewport,bo as isElementIntersectingFrame,A5 as isElementLink,Yx as isEligibleFrameChildType,Il as isEmbeddableElement,Al as isExcalidrawElement,rm as isFixedPoint,qr as isFlowchartNodeElement,Sr as isFocusPointVisible,Fi as isFrameElement,oe as isFrameLikeElement,He as isFreeDrawElement,f1 as isFreeDrawElementType,Jm as isHTMLSVGElement,Oi as isIframeElement,Ri as isIframeLikeElement,_e as isImageElement,Yd as isInGroup,Mn as isInitializedImageElement,Fc as isInvisiblySmallElement,Jt as isLineElement,ae as isLinearElement,x1 as isLinearElementType,Sl as isMagicFrameElement,cy as isMeasureTextSupported,pM as isNodeInFlowchart,X7 as isNonDeletedElement,nn as isPathALoop,on as isPointInElement,Uo as isRectangularElement,vl as isRectanguloidElement,Bm as isSelectedViaGroup,g1 as isSharpArrow,zx as isSimpleArrow,zw as isSomeElementSelected,w1 as isTextBindableContainer,re as isTextElement,kl as isUsingAdaptiveRadius,Tl as isUsingProportionalRadius,Ux as isValidPolygon,By as isValidTextContainer,Qm as loadHTMLImageElement,Wa as makeNextSelectedElementIds,Lt as maxBindingDistance_simple,R7 as maybeHandleArrowPointlikeDrag,q5 as maybeParseEmbedSrc,Is as measureFontSizeFromWidth,Et as measureText,cb as moveAllLeft,ub as moveAllRight,ri as moveArrowAboveBindable,lb as moveOneLeft,db as moveOneRight,je as mutateElement,Mr as newArrowElement,so as newElement,Je as newElementWith,N5 as newEmbeddableElement,pu as newFrameElement,_5 as newFreeDrawElement,H5 as newIframeElement,gu as newImageElement,fu as newLinearElement,hu as newMagicFrameElement,lo as newTextElement,TM as normaliseElements,A2 as normalizeArrowhead,Vc as normalizeElementOrder,Sn as normalizeFixedPoint,Nb as normalizeSVG,$o as normalizeText,dr as omitGroupsContainingFrameLikes,Em as omitPartialGroups,Dd as orderByFractionalIndex,Xo as originalContainerCache,k5 as parseElementLinkFromURL,j1 as parseTokens,Vt as pointInsideBounds,H0 as pointInsideBoundsInclusive,GM as positionElementsOnGrid,fo as projectFixedPointOntoDiagonal,Ui as redrawTextBoundingBox,z5 as refreshTextDimensions,bm as removeAllElementsFromFrame,Fd as removeElementsFromFrame,Kw as removeFromSelectedGroups,n6 as renderElement,t6 as renderSelectionElement,Iw as replaceAllElementsInFrame,Du as rescalePointsInElement,Hl as resetOriginalContainerCache,Ug as resizeMultipleElements,Wg as resizeSingleElement,Hg as resizeSingleTextElement,$g as resizeTest,Dm as selectGroup,_d as selectGroupsForSelectedElements,zd as selectGroupsFromGivenElements,py as setCustomTextMetricsProvider,Cy as shouldAllowVerticalAlign,vw as shouldApplyFrameClip,Yi as shouldTestInside,E7 as showSelectedShapeActions,Ba as snapToMid,Dy as suppportsHorizontalAlign,Ra as syncInvalidIndices,Bd as syncInvalidIndicesImmutable,no as syncMovedIndices,dc as toggleLinePolygonState,Xy as toolIsArrow,XM as transformElements,Ze as unbindBindingElement,$3 as updateBindings,qe as updateBoundElements,Bt as updateBoundPoint,yo as updateElbowArrowPoints,Sw as updateFrameMembershipOfSelectedElements,Rb as updateImageCache,Nl as updateOriginalContainerCache,Ed as validateElbowPoints,pm as validateFractionalIndices,cn as vectorToHeading,an as wrapText};
29
29
  /*! Bundled license information:
30
30
 
31
31
  react/cjs/react.production.js: