@myoc/element 0.19.532 → 0.19.534
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +816 -16
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +15 -15
- package/dist/types/common/src/constants.d.ts +1 -0
- package/dist/types/element/src/gif.d.ts +29 -0
- package/dist/types/element/src/image.d.ts +6 -1
- package/dist/types/element/src/index.d.ts +2 -0
- package/dist/types/element/src/newElement.d.ts +1 -0
- package/dist/types/element/src/renderGif.d.ts +5 -0
- package/dist/types/element/src/types.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionFrame.d.ts +4 -3
- package/dist/types/excalidraw/actions/actionGroup.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +2 -1
- package/dist/types/excalidraw/actions/actionLink.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +8 -1
- package/dist/types/excalidraw/components/App.gif.d.ts +18 -0
- package/dist/types/excalidraw/components/GifPlaybackControls.d.ts +10 -0
- package/dist/types/excalidraw/components/icons.d.ts +4 -0
- package/dist/types/excalidraw/data/blob.d.ts +2 -2
- package/dist/types/excalidraw/data/json.d.ts +1 -1
- package/dist/types/excalidraw/data/restoreGif.d.ts +4 -0
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -0
- package/dist/types/excalidraw/scene/types.d.ts +2 -1
- package/dist/types/excalidraw/types.d.ts +12 -2
- package/dist/types/excalidraw/viewport.d.ts +1 -1
- package/package.json +5 -4
package/dist/prod/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var hm=Object.create;var yl=Object.defineProperty;var fm=Object.getOwnPropertyDescriptor;var gm=Object.getOwnPropertyNames;var Em=Object.getPrototypeOf,xm=Object.prototype.hasOwnProperty;var ym=(e,t)=>()=>(e&&(t=e(e=0)),t);var qo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bm=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gm(t))!xm.call(e,i)&&i!==n&&yl(e,i,{get:()=>t[i],enumerable:!(o=fm(t,i))||o.enumerable});return e};var Li=(e,t,n)=>(n=e!=null?hm(Em(e)):{},bm(t||!e||!e.__esModule?yl(n,"default",{value:e,enumerable:!0}):n,e));var F,S=ym(()=>{F={PROD:!0}});var qu=qo((HP,Zu)=>{S();var $u="Expected a function",Yu=NaN,Jg="[object Symbol]",eE=/^\s+|\s+$/g,tE=/^[-+]0x[0-9a-f]+$/i,nE=/^0b[01]+$/i,oE=/^0o[0-7]+$/i,iE=parseInt,rE=typeof global=="object"&&global&&global.Object===Object&&global,sE=typeof self=="object"&&self&&self.Object===Object&&self,aE=rE||sE||Function("return this")(),lE=Object.prototype,dE=lE.toString,cE=Math.max,uE=Math.min,ja=function(){return aE.Date.now()};function pE(e,t,n){var o,i,r,s,a,l,d=0,c=!1,u=!1,m=!0;if(typeof e!="function")throw new TypeError($u);t=Xu(t)||0,Ur(n)&&(c=!!n.leading,u="maxWait"in n,r=u?cE(Xu(n.maxWait)||0,t):r,m="trailing"in n?!!n.trailing:m);function h(v){var A=o,k=i;return o=i=void 0,d=v,s=e.apply(k,A),s}function g(v){return d=v,a=setTimeout(x,t),c?h(v):s}function f(v){var A=v-l,k=v-d,T=t-A;return u?uE(T,r-k):T}function E(v){var A=v-l,k=v-d;return l===void 0||A>=t||A<0||u&&k>=r}function x(){var v=ja();if(E(v))return y(v);a=setTimeout(x,f(v))}function y(v){return a=void 0,m&&o?h(v):(o=i=void 0,s)}function b(){a!==void 0&&clearTimeout(a),d=0,o=l=i=a=void 0}function M(){return a===void 0?s:y(ja())}function w(){var v=ja(),A=E(v);if(o=arguments,i=this,l=v,A){if(a===void 0)return g(l);if(u)return a=setTimeout(x,t),h(l)}return a===void 0&&(a=setTimeout(x,t)),s}return w.cancel=b,w.flush=M,w}function mE(e,t,n){var o=!0,i=!0;if(typeof e!="function")throw new TypeError($u);return Ur(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),pE(e,t,{leading:o,maxWait:t,trailing:i})}function Ur(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function hE(e){return!!e&&typeof e=="object"}function fE(e){return typeof e=="symbol"||hE(e)&&dE.call(e)==Jg}function Xu(e){if(typeof e=="number")return e;if(fE(e))return Yu;if(Ur(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ur(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(eE,"");var n=nE.test(e);return n||oE.test(e)?iE(e.slice(2),n?2:8):tE.test(e)?Yu:+e}Zu.exports=mE});var jp=qo(se=>{"use strict";S();var ll=Symbol.for("react.transitional.element"),M2=Symbol.for("react.portal"),P2=Symbol.for("react.fragment"),I2=Symbol.for("react.strict_mode"),S2=Symbol.for("react.profiler"),v2=Symbol.for("react.consumer"),A2=Symbol.for("react.context"),T2=Symbol.for("react.forward_ref"),k2=Symbol.for("react.suspense"),L2=Symbol.for("react.memo"),Rp=Symbol.for("react.lazy"),Cp=Symbol.iterator;function D2(e){return e===null||typeof e!="object"?null:(e=Cp&&e[Cp]||e["@@iterator"],typeof e=="function"?e:null)}var Fp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Hp=Object.assign,zp={};function $o(e,t,n){this.props=e,this.context=t,this.refs=zp,this.updater=n||Fp}$o.prototype.isReactComponent={};$o.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")};$o.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _p(){}_p.prototype=$o.prototype;function dl(e,t,n){this.props=e,this.context=t,this.refs=zp,this.updater=n||Fp}var cl=dl.prototype=new _p;cl.constructor=dl;Hp(cl,$o.prototype);cl.isPureReactComponent=!0;var Bp=Array.isArray,Ge={H:null,A:null,T:null,S:null},Wp=Object.prototype.hasOwnProperty;function ul(e,t,n,o,i,r){return n=r.ref,{$$typeof:ll,type:e,key:t,ref:n!==void 0?n:null,props:r}}function C2(e,t){return ul(e.type,t,void 0,void 0,void 0,e.props)}function pl(e){return typeof e=="object"&&e!==null&&e.$$typeof===ll}function B2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Gp=/\/+/g;function al(e,t){return typeof e=="object"&&e!==null&&e.key!=null?B2(""+e.key):t.toString(36)}function Np(){}function G2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Np,Np):(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 Xo(e,t,n,o,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(r){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case ll:case M2:s=!0;break;case Rp:return s=e._init,Xo(s(e._payload),t,n,o,i)}}if(s)return i=i(e),s=o===""?"."+al(e,0):o,Bp(i)?(n="",s!=null&&(n=s.replace(Gp,"$&/")+"/"),Xo(i,t,n,"",function(d){return d})):i!=null&&(pl(i)&&(i=C2(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(Gp,"$&/")+"/")+s)),t.push(i)),1;s=0;var a=o===""?".":o+":";if(Bp(e))for(var l=0;l<e.length;l++)o=e[l],r=a+al(o,l),s+=Xo(o,t,n,r,i);else if(l=D2(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,r=a+al(o,l++),s+=Xo(o,t,n,r,i);else if(r==="object"){if(typeof e.then=="function")return Xo(G2(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 s}function Jr(e,t,n){if(e==null)return e;var o=[],i=0;return Xo(e,o,"","",function(r){return t.call(n,r,i++)}),o}function N2(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 Op=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 O2(){}se.Children={map:Jr,forEach:function(e,t,n){Jr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Jr(e,function(){t++}),t},toArray:function(e){return Jr(e,function(t){return t})||[]},only:function(e){if(!pl(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};se.Component=$o;se.Fragment=P2;se.Profiler=S2;se.PureComponent=dl;se.StrictMode=I2;se.Suspense=k2;se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ge;se.act=function(){throw Error("act(...) is not supported in production builds of React.")};se.cache=function(e){return function(){return e.apply(null,arguments)}};se.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Hp({},e.props),i=e.key,r=void 0;if(t!=null)for(s in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(i=""+t.key),t)!Wp.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(o[s]=t[s]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var a=Array(s),l=0;l<s;l++)a[l]=arguments[l+2];o.children=a}return ul(e.type,i,void 0,void 0,r,o)};se.createContext=function(e){return e={$$typeof:A2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:v2,_context:e},e};se.createElement=function(e,t,n){var o,i={},r=null;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)Wp.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(i[o]=t[o]);var s=arguments.length-2;if(s===1)i.children=n;else if(1<s){for(var a=Array(s),l=0;l<s;l++)a[l]=arguments[l+2];i.children=a}if(e&&e.defaultProps)for(o in s=e.defaultProps,s)i[o]===void 0&&(i[o]=s[o]);return ul(e,r,void 0,void 0,null,i)};se.createRef=function(){return{current:null}};se.forwardRef=function(e){return{$$typeof:T2,render:e}};se.isValidElement=pl;se.lazy=function(e){return{$$typeof:Rp,_payload:{_status:-1,_result:e},_init:N2}};se.memo=function(e,t){return{$$typeof:L2,type:e,compare:t===void 0?null:t}};se.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(O2,Op)}catch(r){Op(r)}finally{Ge.T=t}};se.unstable_useCacheRefresh=function(){return Ge.H.useCacheRefresh()};se.use=function(e){return Ge.H.use(e)};se.useActionState=function(e,t,n){return Ge.H.useActionState(e,t,n)};se.useCallback=function(e,t){return Ge.H.useCallback(e,t)};se.useContext=function(e){return Ge.H.useContext(e)};se.useDebugValue=function(){};se.useDeferredValue=function(e,t){return Ge.H.useDeferredValue(e,t)};se.useEffect=function(e,t){return Ge.H.useEffect(e,t)};se.useId=function(){return Ge.H.useId()};se.useImperativeHandle=function(e,t,n){return Ge.H.useImperativeHandle(e,t,n)};se.useInsertionEffect=function(e,t){return Ge.H.useInsertionEffect(e,t)};se.useLayoutEffect=function(e,t){return Ge.H.useLayoutEffect(e,t)};se.useMemo=function(e,t){return Ge.H.useMemo(e,t)};se.useOptimistic=function(e,t){return Ge.H.useOptimistic(e,t)};se.useReducer=function(e,t,n){return Ge.H.useReducer(e,t,n)};se.useRef=function(e){return Ge.H.useRef(e)};se.useState=function(e){return Ge.H.useState(e)};se.useSyncExternalStore=function(e,t,n){return Ge.H.useSyncExternalStore(e,t,n)};se.useTransition=function(){return Ge.H.useTransition()};se.version="19.0.0"});var Up=qo((pv,Vp)=>{"use strict";S();Vp.exports=jp()});var Xp=qo(es=>{"use strict";S();var R2=Symbol.for("react.transitional.element"),F2=Symbol.for("react.fragment");function Yp(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:R2,type:e,key:o,ref:t!==void 0?t:null,props:n}}es.Fragment=F2;es.jsx=Yp;es.jsxs=Yp});var ml=qo((gv,$p)=>{"use strict";S();$p.exports=Xp()});S();import{toIterable as Fx}from"@excalidraw/common";S();import{SHIFT_LOCKING_ANGLE as Pn,viewportCoordsToSceneCoords as Or}from"@excalidraw/common";import{normalizeRadians as hu,radiansBetweenAngles as N0,radiansDifference as O0}from"@excalidraw/math";import{pointsEqual as R0}from"@excalidraw/math";S();S();S();S();S();S();S();S();S();function as(e,t,n){if(e&&e.length){let[o,i]=t,r=Math.PI/180*n,s=Math.cos(r),a=Math.sin(r);for(let l of e){let[d,c]=l;l[0]=(d-o)*s-(c-i)*a+o,l[1]=(d-o)*a+(c-i)*s+i}}}function Mm(e,t,n){let o=[];e.forEach(i=>o.push(...i)),as(o,t,n)}function Pm(e,t){return e[0]===t[0]&&e[1]===t[1]}function bl(e,t,n,o=1){let i=n,r=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,a=[0,0];if(i)for(let d of s)as(d,a,i);let l=Im(s,r,o);if(i){for(let d of s)as(d,a,-i);Mm(l,a,-i)}return l}function Im(e,t,n){let o=[];for(let d of e){let c=[...d];Pm(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],m=d[c+1];if(u[1]!==m[1]){let h=Math.min(u[1],m[1]);r.push({ymin:h,ymax:Math.max(u[1],m[1]),x:h===u[1]?u[0]:m[0],islope:(m[0]-u[0])/(m[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 s=[],a=r[0].ymin,l=0;for(;s.length||r.length;){if(r.length){let d=-1;for(let u=0;u<r.length&&!(r[u].ymin>a);u++)d=u;r.splice(0,d+1).forEach(u=>{s.push({s:a,edge:u})})}if(s=s.filter(d=>!(d.edge.ymax<=a)),s.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)&&s.length>1)for(let d=0;d<s.length;d=d+2){let c=d+1;if(c>=s.length)break;let u=s[d].edge,m=s[c].edge;i.push([[Math.round(u.x),a],[Math.round(m.x),a]])}a+=n,s.forEach(d=>{d.edge.x=d.edge.x+n*d.edge.islope}),l++}return i}function Qt(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),bl(e,i,o,r||1)}var vn=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let o=Qt(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}};S();S();function An(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 Di=class extends vn{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=Qt(t,i),s=Math.PI/180*n.hachureAngle,a=[],l=o*.5*Math.cos(s),d=o*.5*Math.sin(s);for(let[u,m]of r)An([u,m])&&a.push([[u[0]-l,u[1]+d],[...m]],[[u[0]+l,u[1]-d],[...m]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}};S();var Ci=class extends vn{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}};S();var Bi=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let o=Qt(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 s=i/4;for(let a of t){let l=An(a),d=l/i,c=Math.ceil(d)-1,u=l-c*i,m=(a[0][0]+a[1][0])/2-i/4,h=Math.min(a[0][1],a[1][1]);for(let g=0;g<c;g++){let f=h+u+g*i,E=m-s+Math.random()*2*s,x=f-s+Math.random()*2*s,y=this.helper.ellipse(E,x,r,r,n);o.push(...y.ops)}}return{type:"fillSketch",ops:o}}};S();var Gi=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=Qt(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(s=>{let a=An(s),l=Math.floor(a/(o+i)),d=(a+i-l*(o+i))/2,c=s[0],u=s[1];c[0]>u[0]&&(c=s[1],u=s[0]);let m=Math.atan((u[1]-c[1])/(u[0]-c[0]));for(let h=0;h<l;h++){let g=h*(o+i),f=g+o,E=[c[0]+g*Math.cos(m)+d*Math.cos(m),c[1]+g*Math.sin(m)+d*Math.sin(m)],x=[c[0]+f*Math.cos(m)+d*Math.cos(m),c[1]+f*Math.sin(m)+d*Math.sin(m)];r.push(...this.helper.doubleLineOps(E[0],E[1],x[0],x[1],n))}}),r}};S();var Ni=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=Qt(t,n);return{type:"fillSketch",ops:this.zigzagLines(r,i,n)}}zigzagLines(t,n,o){let i=[];return t.forEach(r=>{let s=An(r),a=Math.round(s/(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<a;u++){let m=u*2*n,h=(u+1)*2*n,g=Math.sqrt(2*Math.pow(n,2)),f=[l[0]+m*Math.cos(c),l[1]+m*Math.sin(c)],E=[l[0]+h*Math.cos(c),l[1]+h*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 ht={};function wl(e,t){let n=e.fillStyle||"hachure";if(!ht[n])switch(n){case"zigzag":ht[n]||(ht[n]=new Di(t));break;case"cross-hatch":ht[n]||(ht[n]=new Ci(t));break;case"dots":ht[n]||(ht[n]=new Bi(t));break;case"dashed":ht[n]||(ht[n]=new Gi(t));break;case"zigzag-line":ht[n]||(ht[n]=new Ni(t));break;case"hachure":default:n="hachure",ht[n]||(ht[n]=new vn(t));break}return ht[n]}S();function Ml(){return Math.floor(Math.random()*2**31)}var Oi=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};S();S();var Ri={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 Sm(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 ls(e,t){return e.type===t}function wo(e){let t=[],n=Sm(e),o="BOD",i=0,r=n[i];for(;!ls(r,2);){let s=0,a=[];if(o==="BOD")if(r.text==="M"||r.text==="m")i++,s=Ri[r.text],o=r.text;else return wo("M0,0"+e);else ls(r,1)?s=Ri[o]:(i++,s=Ri[r.text],o=r.text);if(i+s<n.length){for(let l=i;l<i+s;l++){let d=n[l];if(ls(d,1))a[a.length]=+d.text;else throw new Error("Param not a number: "+o+","+d.text)}if(typeof Ri[o]=="number"){let l={key:o,data:a};t.push(l),i+=s,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}S();function Ko(e){let t=0,n=0,o=0,i=0,r=[];for(let{key:s,data:a}of e)switch(s){case"M":r.push({key:"M",data:[...a]}),[t,n]=a,[o,i]=a;break;case"m":t+=a[0],n+=a[1],r.push({key:"M",data:[t,n]}),o=t,i=n;break;case"L":r.push({key:"L",data:[...a]}),[t,n]=a;break;case"l":t+=a[0],n+=a[1],r.push({key:"L",data:[t,n]});break;case"C":r.push({key:"C",data:[...a]}),t=a[4],n=a[5];break;case"c":{let l=a.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:[...a]}),t=a[2],n=a[3];break;case"q":{let l=a.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:[...a]}),t=a[5],n=a[6];break;case"a":t+=a[5],n+=a[6],r.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,n]});break;case"H":r.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],r.push({key:"V",data:[n]});break;case"S":r.push({key:"S",data:[...a]}),t=a[2],n=a[3];break;case"s":{let l=a.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:[...a]}),t=a[0],n=a[1];break;case"t":t+=a[0],n+=a[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}S();function Jo(e){let t=[],n="",o=0,i=0,r=0,s=0,a=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,s]=c;break;case"C":t.push({key:"C",data:[...c]}),o=c[4],i=c[5],a=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,m=0;n==="C"||n==="S"?(u=o+(o-a),m=i+(i-l)):(u=o,m=i),t.push({key:"C",data:[u,m,...c]}),a=c[0],l=c[1],o=c[2],i=c[3];break}case"T":{let[u,m]=c,h=0,g=0;n==="Q"||n==="T"?(h=o+(o-a),g=i+(i-l)):(h=o,g=i);let f=o+2*(h-o)/3,E=i+2*(g-i)/3,x=u+2*(h-u)/3,y=m+2*(g-m)/3;t.push({key:"C",data:[f,E,x,y,u,m]}),a=h,l=g,o=u,i=m;break}case"Q":{let[u,m,h,g]=c,f=o+2*(u-o)/3,E=i+2*(m-i)/3,x=h+2*(u-h)/3,y=g+2*(m-g)/3;t.push({key:"C",data:[f,E,x,y,h,g]}),a=u,l=m,o=h,i=g;break}case"A":{let u=Math.abs(c[0]),m=Math.abs(c[1]),h=c[2],g=c[3],f=c[4],E=c[5],x=c[6];u===0||m===0?(t.push({key:"C",data:[o,i,E,x,E,x]}),o=E,i=x):(o!==E||i!==x)&&(Pl(o,i,E,x,u,m,h,g,f).forEach(function(b){t.push({key:"C",data:b})}),o=E,i=x);break}case"Z":t.push({key:"Z",data:[]}),o=r,i=s;break}n=d}return t}function vm(e){return Math.PI*e/180}function Qo(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 Pl(e,t,n,o,i,r,s,a,l,d){let c=vm(s),u=[],m=0,h=0,g=0,f=0;if(d)[m,h,g,f]=d;else{[e,t]=Qo(e,t,-c),[n,o]=Qo(n,o,-c);let O=(e-n)/2,N=(t-o)/2,j=O*O/(i*i)+N*N/(r*r);j>1&&(j=Math.sqrt(j),i=j*i,r=j*r);let V=a===l?-1:1,D=i*i,B=r*r,I=D*B-D*N*N-B*O*O,L=D*N*N+B*O*O,G=V*Math.sqrt(Math.abs(I/L));g=G*i*N/r+(e+n)/2,f=G*-r*O/i+(t+o)/2,m=Math.asin(parseFloat(((t-f)/r).toFixed(9))),h=Math.asin(parseFloat(((o-f)/r).toFixed(9))),e<g&&(m=Math.PI-m),n<g&&(h=Math.PI-h),m<0&&(m=Math.PI*2+m),h<0&&(h=Math.PI*2+h),l&&m>h&&(m=m-Math.PI*2),!l&&h>m&&(h=h-Math.PI*2)}let E=h-m;if(Math.abs(E)>Math.PI*120/180){let O=h,N=n,j=o;l&&h>m?h=m+Math.PI*120/180*1:h=m+Math.PI*120/180*-1,n=g+i*Math.cos(h),o=f+r*Math.sin(h),u=Pl(n,o,N,j,i,r,s,0,l,[h,O,g,f])}E=h-m;let x=Math.cos(m),y=Math.sin(m),b=Math.cos(h),M=Math.sin(h),w=Math.tan(E/4),v=4/3*i*w,A=4/3*r*w,k=[e,t],T=[e+v*y,t-A*x],z=[n+v*M,o-A*b],C=[n,o];if(T[0]=2*k[0]-T[0],T[1]=2*k[1]-T[1],d)return[T,z,C].concat(u);{u=[T,z,C].concat(u);let O=[];for(let N=0;N<u.length;N+=3){let j=Qo(u[N][0],u[N][1],c),V=Qo(u[N+1][0],u[N+1][1],c),D=Qo(u[N+2][0],u[N+2][1],c);O.push([j[0],j[1],V[0],V[1],D[0],D[1]])}return O}}var Am={randOffset:Lm,randOffsetWithRange:Dm,ellipse:km,doubleLineOps:Cm};function ds(e,t,n,o,i){return{type:"path",ops:un(e,t,n,o,i)}}function ei(e,t,n){let o=(e||[]).length;if(o>2){let i=[];for(let r=0;r<o-1;r++)i.push(...un(e[r][0],e[r][1],e[r+1][0],e[r+1][1],n));return t&&i.push(...un(e[o-1][0],e[o-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(o===2)return ds(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function Tm(e,t){return ei(e,!0,t)}function Tl(e,t,n,o,i){let r=[[e,t],[e+n,t],[e+n,t+o],[e,t+o]];return Tm(r,i)}function cs(e,t){let n=Sl(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let o=Sl(e,1.5*(1+t.roughness*.22),Bm(t));n=n.concat(o)}return{type:"path",ops:n}}function km(e,t,n,o,i){let r=us(n,o,i);return zi(e,t,i,r).opset}function us(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,s=Math.abs(e/2),a=Math.abs(t/2),l=1-n.curveFitting;return s+=Z(s*l,n),a+=Z(a*l,n),{increment:r,rx:s,ry:a}}function zi(e,t,n,o){let[i,r]=vl(o.increment,e,t,o.rx,o.ry,1,o.increment*Fi(.1,Fi(.4,1,n),n),n),s=Hi(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[a]=vl(o.increment,e,t,o.rx,o.ry,1.5,0,n),l=Hi(a,null,n);s=s.concat(l)}return{estimatedPoints:r,opset:{type:"path",ops:s}}}function ps(e,t,n,o,i,r,s,a,l){let d=e,c=t,u=Math.abs(n/2),m=Math.abs(o/2);u+=Z(u*.01,l),m+=Z(m*.01,l);let h=i,g=r;for(;h<0;)h+=Math.PI*2,g+=Math.PI*2;g-h>Math.PI*2&&(h=0,g=Math.PI*2);let f=Math.PI*2/l.curveStepCount,E=Math.min(f/2,(g-h)/2),x=Al(E,d,c,u,m,h,g,1,l);if(!l.disableMultiStroke){let y=Al(E,d,c,u,m,h,g,1.5,l);x.push(...y)}return s&&(a?x.push(...un(d,c,d+u*Math.cos(h),c+m*Math.sin(h),l),...un(d,c,d+u*Math.cos(g),c+m*Math.sin(g),l)):x.push({op:"lineTo",data:[d,c]},{op:"lineTo",data:[d+u*Math.cos(h),c+m*Math.sin(h)]})),{type:"path",ops:x}}function ms(e,t){let n=Jo(Ko(wo(e))),o=[],i=[0,0],r=[0,0];for(let{key:s,data:a}of n)switch(s){case"M":{r=[a[0],a[1]],i=[a[0],a[1]];break}case"L":o.push(...un(r[0],r[1],a[0],a[1],t)),r=[a[0],a[1]];break;case"C":{let[l,d,c,u,m,h]=a;o.push(...Gm(l,d,c,u,m,h,r,t)),r=[m,h];break}case"Z":o.push(...un(r[0],r[1],i[0],i[1],t)),r=[i[0],i[1]];break}return{type:"path",ops:o}}function _i(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 s=1;s<r;s++)n.push({op:"lineTo",data:[o[s][0]+Z(i,t),o[s][1]+Z(i,t)]})}}return{type:"fillPath",ops:n}}function to(e,t){return wl(t,Am).fillPolygons(e,t)}function kl(e,t,n,o,i,r,s){let a=e,l=t,d=Math.abs(n/2),c=Math.abs(o/2);d+=Z(d*.01,s),c+=Z(c*.01,s);let u=i,m=r;for(;u<0;)u+=Math.PI*2,m+=Math.PI*2;m-u>Math.PI*2&&(u=0,m=Math.PI*2);let h=(m-u)/s.curveStepCount,g=[];for(let f=u;f<=m;f=f+h)g.push([a+d*Math.cos(f),l+c*Math.sin(f)]);return g.push([a+d*Math.cos(m),l+c*Math.sin(m)]),g.push([a,l]),to([g],s)}function Lm(e,t){return Z(e,t)}function Dm(e,t,n){return Fi(e,t,n)}function Cm(e,t,n,o,i){return un(e,t,n,o,i,!0)}function Bm(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function Ll(e){return e.randomizer||(e.randomizer=new Oi(e.seed||0)),e.randomizer.next()}function Fi(e,t,n,o=1){return n.roughness*o*(Ll(n)*(t-e)+e)}function Z(e,t,n=1){return Fi(-e,e,t,n)}function un(e,t,n,o,i,r=!1){let s=r?i.disableMultiStrokeFill:i.disableMultiStroke,a=Il(e,t,n,o,i,!0,!1);if(s)return a;let l=Il(e,t,n,o,i,!0,!0);return a.concat(l)}function Il(e,t,n,o,i,r,s){let a=Math.pow(e-n,2)+Math.pow(t-o,2),l=Math.sqrt(a),d=1;l<200?d=1:l>500?d=.4:d=-.0016668*l+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>a&&(c=l/10);let u=c/2,m=.2+Ll(i)*.2,h=i.bowing*i.maxRandomnessOffset*(o-t)/200,g=i.bowing*i.maxRandomnessOffset*(e-n)/200;h=Z(h,i,d),g=Z(g,i,d);let f=[],E=()=>Z(u,i,d),x=()=>Z(c,i,d),y=i.preserveVertices;return r&&(s?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))]})),s?f.push({op:"bcurveTo",data:[h+e+(n-e)*m+E(),g+t+(o-t)*m+E(),h+e+2*(n-e)*m+E(),g+t+2*(o-t)*m+E(),n+(y?0:E()),o+(y?0:E())]}):f.push({op:"bcurveTo",data:[h+e+(n-e)*m+x(),g+t+(o-t)*m+x(),h+e+2*(n-e)*m+x(),g+t+2*(o-t)*m+x(),n+(y?0:x()),o+(y?0:x())]}),f}function Sl(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=[],s=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let a=1;a+2<o;a++){let l=e[a];r[0]=[l[0],l[1]],r[1]=[l[0]+(s*e[a+1][0]-s*e[a-1][0])/6,l[1]+(s*e[a+1][1]-s*e[a-1][1])/6],r[2]=[e[a+1][0]+(s*e[a][0]-s*e[a+2][0])/6,e[a+1][1]+(s*e[a][1]-s*e[a+2][1])/6],r[3]=[e[a+1][0],e[a+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 a=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+Z(a,n),t[1]+Z(a,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(...un(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function vl(e,t,n,o,i,r,s,a){let l=a.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 m=[t+o*Math.cos(u),n+i*Math.sin(u)];d.push(m),c.push(m)}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,a)-Math.PI/2;c.push([Z(r,a)+t+.9*o*Math.cos(u-e),Z(r,a)+n+.9*i*Math.sin(u-e)]);let m=Math.PI*2+u-.01;for(let h=u;h<m;h=h+e){let g=[Z(r,a)+t+o*Math.cos(h),Z(r,a)+n+i*Math.sin(h)];d.push(g),c.push(g)}c.push([Z(r,a)+t+o*Math.cos(u+Math.PI*2+s*.5),Z(r,a)+n+i*Math.sin(u+Math.PI*2+s*.5)]),c.push([Z(r,a)+t+.98*o*Math.cos(u+s),Z(r,a)+n+.98*i*Math.sin(u+s)]),c.push([Z(r,a)+t+.9*o*Math.cos(u+s*.5),Z(r,a)+n+.9*i*Math.sin(u+s*.5)])}return[c,d]}function Al(e,t,n,o,i,r,s,a,l){let d=r+Z(.1,l),c=[];c.push([Z(a,l)+t+.9*o*Math.cos(d-e),Z(a,l)+n+.9*i*Math.sin(d-e)]);for(let u=d;u<=s;u=u+e)c.push([Z(a,l)+t+o*Math.cos(u),Z(a,l)+n+i*Math.sin(u)]);return c.push([t+o*Math.cos(s),n+i*Math.sin(s)]),c.push([t+o*Math.cos(s),n+i*Math.sin(s)]),Hi(c,null,l)}function Gm(e,t,n,o,i,r,s,a){let l=[],d=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3],c=[0,0],u=a.disableMultiStroke?1:2,m=a.preserveVertices;for(let h=0;h<u;h++)h===0?l.push({op:"move",data:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(m?0:Z(d[0],a)),s[1]+(m?0:Z(d[0],a))]}),c=m?[i,r]:[i+Z(d[h],a),r+Z(d[h],a)],l.push({op:"bcurveTo",data:[e+Z(d[h],a),t+Z(d[h],a),n+Z(d[h],a),o+Z(d[h],a),c[0],c[1]]});return l}S();function ti(e){return[...e]}function Wi(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(ti(e[0]),ti(e[1]),ti(e[2]),ti(e[2]));else{let i=[];i.push(e[0],e[0]);for(let a=1;a<e.length;a++)i.push(e[a]),a===e.length-1&&i.push(e[a]);let r=[],s=1-t;o.push(ti(i[0]));for(let a=1;a+2<i.length;a++){let l=i[a];r[0]=[l[0],l[1]],r[1]=[l[0]+(s*i[a+1][0]-s*i[a-1][0])/6,l[1]+(s*i[a+1][1]-s*i[a-1][1])/6],r[2]=[i[a+1][0]+(s*i[a][0]-s*i[a+2][0])/6,i[a+1][1]+(s*i[a][1]-s*i[a+2][1])/6],r[3]=[i[a+1][0],i[a+1][1]],o.push(r[1],r[2],r[3])}}return o}S();function Nm(e,t){return Math.sqrt(ji(e,t))}function ji(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function Om(e,t,n){let o=ji(t,n);if(o===0)return ji(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)),ji(e,no(t,n,i))}function no(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Rm(e,t){let n=e[t+0],o=e[t+1],i=e[t+2],r=e[t+3],s=3*o[0]-2*n[0]-r[0];s*=s;let a=3*o[1]-2*n[1]-r[1];a*=a;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,s<l&&(s=l),a<d&&(a=d),s+a}function hs(e,t,n,o){let i=o||[];if(Rm(e,t)<n){let r=e[t+0];i.length?Nm(i[i.length-1],r)>1&&i.push(r):i.push(r),i.push(e[t+3])}else{let s=e[t+0],a=e[t+1],l=e[t+2],d=e[t+3],c=no(s,a,.5),u=no(a,l,.5),m=no(l,d,.5),h=no(c,u,.5),g=no(u,m,.5),f=no(h,g,.5);hs([s,c,h,f],0,n,i),hs([f,g,m,d],0,n,i)}return i}function Tn(e,t){return Vi(e,0,e.length,t)}function Vi(e,t,n,o,i){let r=i||[],s=e[t],a=e[n-1],l=0,d=1;for(let c=t+1;c<n-1;++c){let u=Om(e[c],s,a);u>l&&(l=u,d=c)}return Math.sqrt(l)>o?(Vi(e,t,d+1,o,r),Vi(e,d,n,o,r)):(r.length||r.push(s),r.push(a)),r}function Ft(e,t=.15,n){let o=[],i=(e.length-1)/3;for(let r=0;r<i;r++){let s=r*3;hs(e,s,t,o)}return n&&n>0?Vi(o,0,o.length,n):o}S();function Dl(e,t,n){let o=wo(e),i=Jo(Ko(o)),r=[],s=[],a=[0,0],l=[],d=()=>{l.length>=4&&s.push(...Ft(l,t)),l=[]},c=()=>{d(),s.length&&(r.push(s),s=[])};for(let{key:m,data:h}of i)switch(m){case"M":c(),a=[h[0],h[1]],s.push(a);break;case"L":d(),s.push([h[0],h[1]]);break;case"C":if(!l.length){let g=s.length?s[s.length-1]:a;l.push([g[0],g[1]])}l.push([h[0],h[1]]),l.push([h[2],h[3]]),l.push([h[4],h[5]]);break;case"Z":d(),s.push([a[0],a[1]]);break}if(c(),!n)return r;let u=[];for(let m of r){let h=Tn(m,n);h.length&&u.push(h)}return u}var It="none",Ct=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 Ml()}_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 s=this._o(r);return this._d("line",[ds(t,n,o,i,s)],s)}rectangle(t,n,o,i,r){let s=this._o(r),a=[],l=Tl(t,n,o,i,s);if(s.fill){let d=[[t,n],[t+o,n],[t+o,n+i],[t,n+i]];s.fillStyle==="solid"?a.push(_i([d],s)):a.push(to([d],s))}return s.stroke!==It&&a.push(l),this._d("rectangle",a,s)}ellipse(t,n,o,i,r){let s=this._o(r),a=[],l=us(o,i,s),d=zi(t,n,s,l);if(s.fill)if(s.fillStyle==="solid"){let c=zi(t,n,s,l).opset;c.type="fillPath",a.push(c)}else a.push(to([d.estimatedPoints],s));return s.stroke!==It&&a.push(d.opset),this._d("ellipse",a,s)}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",[ei(t,!1,o)],o)}arc(t,n,o,i,r,s,a=!1,l){let d=this._o(l),c=[],u=ps(t,n,o,i,r,s,a,!0,d);if(a&&d.fill)if(d.fillStyle==="solid"){let m=Object.assign({},d);m.disableMultiStroke=!0;let h=ps(t,n,o,i,r,s,!0,!1,m);h.type="fillPath",c.push(h)}else c.push(kl(t,n,o,i,r,s,d));return d.stroke!==It&&c.push(u),this._d("arc",c,d)}curve(t,n){let o=this._o(n),i=[],r=cs(t,o);if(o.fill&&o.fill!==It&&t.length>=3)if(o.fillStyle==="solid"){let s=cs(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=Wi(t),a=Ft(s,10,(1+o.roughness)/2);i.push(to([a],o))}return o.stroke!==It&&i.push(r),this._d("curve",i,o)}polygon(t,n){let o=this._o(n),i=[],r=ei(t,!0,o);return o.fill&&(o.fillStyle==="solid"?i.push(_i([t],o)):i.push(to([t],o))),o.stroke!==It&&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!==It,s=o.stroke!==It,a=!!(o.simplification&&o.simplification<1),l=a?4-4*(o.simplification||1):(1+o.roughness)/2,d=Dl(t,1,l),c=ms(t,o);if(r)if(o.fillStyle==="solid")if(d.length===1){let u=ms(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(_i(d,o));else i.push(to(d,o));return s&&(a?d.forEach(u=>{i.push(ei(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(s=>+s.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 s=null;switch(r.type){case"path":s={d:this.opsToPath(r),stroke:o.stroke,strokeWidth:o.strokeWidth,fill:It};break;case"fillPath":s={d:this.opsToPath(r),stroke:It,strokeWidth:0,fill:o.fill||It};break;case"fillSketch":s=this.fillSketch(r,o);break}s&&i.push(s)}return i}fillSketch(t,n){let o=n.fillWeight;return o<0&&(o=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||It,strokeWidth:o,fill:It}}_mergedShape(t){return t.filter((n,o)=>o===0?!0:n.op!=="move")}};var Ui=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Ct(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(let s of n)switch(s.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,s,r),i.restore();break;case"fillPath":{i.save(),i.fillStyle=o.fill||"";let a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,r,a),i.restore();break}case"fillSketch":this.fillSketch(i,s,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 s=typeof o=="number"&&o>=0?r.data.map(a=>+a.toFixed(o)):r.data;switch(r.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,o,i,r){let s=this.gen.line(t,n,o,i,r);return this.draw(s),s}rectangle(t,n,o,i,r){let s=this.gen.rectangle(t,n,o,i,r);return this.draw(s),s}ellipse(t,n,o,i,r){let s=this.gen.ellipse(t,n,o,i,r);return this.draw(s),s}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,s,a=!1,l){let d=this.gen.arc(t,n,o,i,r,s,a,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}};S();S();var ni="http://www.w3.org/2000/svg";var Yi=class{constructor(t,n){this.svg=t,this.gen=new Ct(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,r=i.createElementNS(ni,"g"),s=t.options.fixedDecimalPlaceDigits;for(let a of n){let l=null;switch(a.type){case"path":{l=i.createElementNS(ni,"path"),l.setAttribute("d",this.opsToPath(a,s)),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(ni,"path"),l.setAttribute("d",this.opsToPath(a,s)),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,a,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(ni,"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 s=this.gen.line(t,n,o,i,r);return this.draw(s)}rectangle(t,n,o,i,r){let s=this.gen.rectangle(t,n,o,i,r);return this.draw(s)}ellipse(t,n,o,i,r){let s=this.gen.ellipse(t,n,o,i,r);return this.draw(s)}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,s,a=!1,l){let d=this.gen.arc(t,n,o,i,r,s,a,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 Mo={canvas(e,t){return new Ui(e,t)},svg(e,t){return new Yi(e,t)},generator(e){return new Ct(e)},newSeed(){return Ct.newSeed()}};import{arrayToMap as pu,invariant as Ta,rescalePoints as au,sizeOf as I0}from"@excalidraw/common";import{degreesToRadians as Aa,lineSegment as Be,pointFrom as H,pointFromArray as mu,pointRotateRads as ge}from"@excalidraw/math";S();import{invariant as Fm}from"@excalidraw/common";import{curve as Hm,lineSegment as zm,pointFrom as Te,pointDistance as Mb,pointFromArray as _m,pointFromVector as Wm,pointRotateRads as Ht,polygon as Cl,polygonFromPoints as fs,PRECISION as Pb,segmentsIntersectAt as Ib,vector as jm,vectorAdd as Vm,vectorFromPoint as Um,vectorScale as Sb}from"@excalidraw/math";import{getElementAbsoluteCoords as Ab}from"@excalidraw/element";var Bl=e=>{let{angle:t,width:n,height:o,x:i,y:r}=e,s=i+n/2,a=r+o/2,l=Te(s,a),d;return e.type==="diamond"?d=Cl(Ht(Te(s,r),l,t),Ht(Te(i+n,a),l,t),Ht(Te(s,r+o),l,t),Ht(Te(i,a),l,t)):d=Cl(Ht(Te(i,r),l,t),Ht(Te(i+n,r),l,t),Ht(Te(i+n,r+o),l,t),Ht(Te(i,r+o),l,t)),{type:"polygon",data:d}};var Gl=e=>{let{width:t,height:n,angle:o,x:i,y:r}=e;return{type:"ellipse",data:{center:Te(i+t/2,r+n/2),angle:o,halfWidth:t/2,halfHeight:n/2}}},pn=e=>{if(!e)return[];for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},Nl=(e,t=Te(0,0),n,o)=>{let i=l=>Ht(Te(l[0]+t[0],l[1]+t[1]),o,n),r=pn(e),s=[],a=Te(0,0);for(let l of r){if(l.op==="move"){let d=_m(l.data);Fm(d!=null,"Ops data is not a point"),a=i(d)}if(l.op==="bcurveTo"){let d=i(Te(l.data[0],l.data[1])),c=i(Te(l.data[2],l.data[3])),u=i(Te(l.data[4],l.data[5]));s.push(Hm(a,d,c,u)),a=u}}return{type:"polycurve",data:s}},Ym=e=>{let t=e[0],n=[];for(let o=1;o<e.length;o++){let i=e[o];n.push(zm(t,i)),t=i}return n},Ol=(e,t,n=!1)=>{let o=r=>Ht(Wm(Vm(Um(r),jm(e.x,e.y))),t,e.angle),i=Ym(e.points.map(r=>o(r)));return n?{type:"polygon",data:fs(i.flat())}:{type:"polyline",data:i}},Rl=(e,t,n=Te(0,0),o,i)=>{let r=c=>Ht(Te(c[0]+n[0],c[1]+n[1]),i,o);if(e.roundness===null)return{type:"polygon",data:fs(e.points.map(c=>r(c)))};let s=pn(t),a=[],l=!1;for(let c of s)c.op==="move"?(l=!l,l&&a.push(Te(c.data[0],c.data[1]))):c.op==="bcurveTo"?l&&(a.push(Te(c.data[0],c.data[1])),a.push(Te(c.data[2],c.data[3])),a.push(Te(c.data[4],c.data[5]))):c.op==="lineTo"&&l&&a.push(Te(c.data[0],c.data[1]));let d=Ft(a,10,5).map(c=>r(c));return{type:"polygon",data:fs(d)}};S();S();function Fl(e,t,n,o=i=>i){return e*o(.5-t*(.5-n))}function Xm(e){return[-e[0],-e[1]]}function _t(e,t){return[e[0]+t[0],e[1]+t[1]]}function Bt(e,t){return[e[0]-t[0],e[1]-t[1]]}function zt(e,t){return[e[0]*t,e[1]*t]}function $m(e,t){return[e[0]/t,e[1]/t]}function oi(e){return[e[1],-e[0]]}function Hl(e,t){return e[0]*t[0]+e[1]*t[1]}function Zm(e,t){return e[0]===t[0]&&e[1]===t[1]}function qm(e){return Math.hypot(e[0],e[1])}function Km(e){return e[0]*e[0]+e[1]*e[1]}function zl(e,t){return Km(Bt(e,t))}function jl(e){return $m(e,qm(e))}function Qm(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ii(e,t,n){let o=Math.sin(n),i=Math.cos(n),r=e[0]-t[0],s=e[1]-t[1],a=r*i-s*o,l=r*o+s*i;return[a+t[0],l+t[1]]}function gs(e,t,n){return _t(e,zt(Bt(t,e),n))}function _l(e,t,n){return _t(e,zt(t,n))}var{min:Po,PI:Jm}=Math,Wl=.275,ri=Jm+1e-4;function eh(e,t={}){let{size:n=16,smoothing:o=.5,thinning:i=.5,simulatePressure:r=!0,easing:s=B=>B,start:a={},end:l={},last:d=!1}=t,{cap:c=!0,easing:u=B=>B*(2-B)}=a,{cap:m=!0,easing:h=B=>--B*B*B+1}=l;if(e.length===0||n<=0)return[];let g=e[e.length-1].runningLength,f=a.taper===!1?0:a.taper===!0?Math.max(n,g):a.taper,E=l.taper===!1?0:l.taper===!0?Math.max(n,g):l.taper,x=Math.pow(n*o,2),y=[],b=[],M=e.slice(0,10).reduce((B,I)=>{let L=I.pressure;if(r){let G=Po(1,I.distance/n),_=Po(1,1-G);L=Po(1,B+(_-B)*(G*Wl))}return(B+L)/2},e[0].pressure),w=Fl(n,i,e[e.length-1].pressure,s),v,A=e[0].vector,k=e[0].point,T=k,z=k,C=T,O=!1;for(let B=0;B<e.length;B++){let{pressure:I}=e[B],{point:L,vector:G,distance:_,runningLength:K}=e[B];if(B<e.length-1&&g-K<3)continue;if(i){if(r){let ne=Po(1,_/n),ie=Po(1,1-ne);I=Po(1,M+(ie-M)*(ne*Wl))}w=Fl(n,i,I,s)}else w=n/2;v===void 0&&(v=w);let $=K<f?u(K/f):1,X=g-K<E?h((g-K)/E):1;w=Math.max(.01,w*Math.min($,X));let Y=(B<e.length-1?e[B+1]:e[B]).vector,we=B<e.length-1?Hl(G,Y):1,Q=Hl(G,A)<0&&!O,me=we!==null&&we<0;if(Q||me){let ne=zt(oi(A),w);for(let ie=1/13,Ie=0;Ie<=1;Ie+=ie)z=ii(Bt(L,ne),L,ri*Ie),y.push(z),C=ii(_t(L,ne),L,ri*-Ie),b.push(C);k=z,T=C,me&&(O=!0);continue}if(O=!1,B===e.length-1){let ne=zt(oi(G),w);y.push(Bt(L,ne)),b.push(_t(L,ne));continue}let Ae=zt(oi(gs(Y,G,we)),w);z=Bt(L,Ae),(B<=1||zl(k,z)>x)&&(y.push(z),k=z),C=_t(L,Ae),(B<=1||zl(T,C)>x)&&(b.push(C),T=C),M=I,A=G}let N=e[0].point.slice(0,2),j=e.length>1?e[e.length-1].point.slice(0,2):_t(e[0].point,[1,1]),V=[],D=[];if(e.length===1){if(!(f||E)||d){let B=_l(N,jl(oi(Bt(N,j))),-(v||w)),I=[];for(let L=1/13,G=L;G<=1;G+=L)I.push(ii(B,N,ri*2*G));return I}}else{if(!(f||E&&e.length===1))if(c)for(let I=1/13,L=I;L<=1;L+=I){let G=ii(b[0],N,ri*L);V.push(G)}else{let I=Bt(y[0],b[0]),L=zt(I,.5),G=zt(I,.51);V.push(Bt(N,L),Bt(N,G),_t(N,G),_t(N,L))}let B=oi(Xm(e[e.length-1].vector));if(E||f&&e.length===1)D.push(j);else if(m){let I=_l(j,B,w);for(let L=1/29,G=L;G<1;G+=L)D.push(ii(I,j,ri*3*G))}else D.push(_t(j,zt(B,w)),_t(j,zt(B,w*.99)),Bt(j,zt(B,w*.99)),Bt(j,zt(B,w)))}return y.concat(D,b.reverse(),V)}function Es(e,t={}){var n;let{streamline:o=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let s=.15+(1-o)*.85,a=Array.isArray(e[0])?e:e.map(({x:h,y:g,pressure:f=.5})=>[h,g,f]);if(a.length===2){let h=a[1];a=a.slice(0,-1);for(let g=1;g<5;g++)a.push(gs(a[0],h,g/4))}a.length===1&&(a=[...a,[..._t(a[0],[1,1]),...a[0].slice(2)]]);let l=[{point:[a[0][0],a[0][1]],pressure:a[0][2]>=0?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,c=0,u=l[0],m=a.length-1;for(let h=1;h<a.length;h++){let g=r&&h===m?a[h].slice(0,2):gs(u.point,a[h],s);if(Zm(u.point,g))continue;let f=Qm(g,u.point);if(c+=f,h<m&&!d){if(c<i)continue;d=!0}u={point:g,pressure:a[h][2]>=0?a[h][2]:.5,vector:jl(Bt(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 Vl(e,t={}){return eh(Es(e,t),t)}S();S();S();function ke([e,t,n],[o,i,r]){return[e+o,t+i,n+r]}function Io([e,t,n],[o,i,r]){return[e-o,t-i,n-r]}function Fe([e,t,n],o){return[e*o,t*o,n*o]}function io([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function Ve([e,t,n],o){return[Math.cos(o)*e-Math.sin(o)*t,Math.sin(o)*e+Math.cos(o)*t,n]}function Ul(e,t,n){return ke(e,Fe(Io(t,e),n))}function xs(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 ys(e){return Math.atan2(Math.sin(e),Math.cos(e))}function bs([e,t]){return Math.sqrt(e**2+t**2)}function oo([e,t],[n,o]){return Math.sqrt((n-e)**2+(o-t)**2)}function Yl(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=oo(e[n-1],e[n]);return t+=oo(e[e.length-2],e[e.length-1]),t}var th=(e,t,n)=>Math.max(t,Math.min(n,e));function Xl(e,t,n){let o=oo(t,n);if(o===0)return oo(e,t);let i=th(((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 oo(r,e)}S();function si(e,t){if(t===0||e.length<=2)return e;let n=e[0],o=e[e.length-1],[i,r]=e.reduce(([s,a],l,d)=>{let c=Xl(l,n,o);return c>s?[c,d]:[s,a]},[0,-1]);if(i>=t){let s=e[r];return[...si([n,...e.slice(1,r),s],t).slice(0,-1),s,...si([s,...e.slice(r,-1),o],t).slice(1)]}return[n,o]}var Xi=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=Ul(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),Yl(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=si(n,this.options.simplify));let o=n.length;if(o===0)return[];if(o===1){let A=n[0],k=this.getSize(t,A[2],0,o,0);if(k<.5)return[];let T=[];for(let z=0;z<=Math.PI*2;z+=Math.PI/16)T.push(ke(A,Fe(Ve([1,0,0],z),k)));return T.push(ke(A,Fe([1,0,0],this.getSize(t,A[2],0,o,0)))),T}if(o===2){let A=n[0],k=n[1],T=this.getSize(t,A[2],0,o,0),z=this.getSize(t,k[2],0,o,0);if(T<.5||z<.5)return[];let C=[],O=xs(A,[A[0],A[1]-100,A[2]],k);for(let N=O;N<=Math.PI+O;N+=Math.PI/16)C.push(ke(A,Fe(Ve([1,0,0],N),T)));for(let N=Math.PI+O;N<=Math.PI*2+O;N+=Math.PI/16)C.push(ke(k,Fe(Ve([1,0,0],N),z)));return C.push(C[0]),C}let i=[],r=[],s=0,a=0,l=0,d=0;for(let A=1;A<o-1;A++){let k=n[A-1],T=n[A],z=n[A+1],C=T[2],O=oo(k,T);d+=O,s=a+(O-a)*.2;let N=this.getSize(t,C,A,o,d);if(N===0){l=A+1;continue}let j=io(Io(k,T)),V=io(Io(z,T)),D=Ve(j,Math.PI/2),B=Ve(j,-Math.PI/2),I=Ve(V,Math.PI/2),L=Ve(V,-Math.PI/2),G=ke(T,Fe(D,N)),_=ke(T,Fe(B,N)),K=ke(T,Fe(I,N)),$=ke(T,Fe(L,N)),X=ke(D,L),Y=ke(B,I),we=ke(T,Fe(bs(X)===0?j:io(X),N)),Q=ke(T,Fe(bs(Y)===0?V:io(Y),N)),me=ys(xs(T,k,z)),Ae=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(s);if(Math.abs(me)<Ae){let ne=Math.abs(ys(Math.PI-me));if(ne===0)continue;if(me<0){r.push(_,Q);for(let ie=0;ie<=ne;ie+=ne/4)i.push(ke(T,Ve(Fe(D,N),ie)));for(let ie=ne;ie>=0;ie-=ne/4)r.push(ke(T,Ve(Fe(D,N),ie)));r.push(Q,K)}else{i.push(G,we);for(let ie=0;ie<=ne;ie+=ne/4)r.push(ke(T,Ve(Fe(D,-N),-ie)));for(let ie=ne;ie>=0;ie-=ne/4)i.push(ke(T,Ve(Fe(D,-N),-ie)));i.push(we,$)}}else i.push(we),r.push(Q);a=s}if(l>=o-2){if(this.options.keepHead){let A=n[o-1],k=[];for(let T=0;T<=Math.PI*2;T+=Math.PI/16)k.push(ke(A,Fe(Ve([1,0,0],T),this.options.size)));return k.push(ke(A,Fe([1,0,0],this.options.size))),k}return[]}let c=n[l],u=n[l+1],m=n[o-2],h=n[o-1],g=io(Io(u,c)),f=io(Io(m,h)),E=Ve(g,-Math.PI/2),x=Ve(f,Math.PI/2),y=this.getSize(t,c[2],0,o,0),b=[],M=this.options.keepHead?this.options.size:this.getSize(t,m[2],o-2,o,d),w=[];if(y>.1){for(let A=0;A<=Math.PI;A+=Math.PI/16)b.unshift(ke(c,Ve(Fe(E,y),-A)));b.unshift(ke(c,Fe(E,-y)))}else b.push(c);for(let A=0;A<=Math.PI*3;A+=Math.PI/16)w.push(ke(h,Ve(Fe(x,-M),-A)));let v=[...b,...i,...w.reverse(),...r.reverse()];return b.length>0&&v.push(b[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?si(v,this.options.simplify):v}};import{pointFrom as Ce,pointDistance as eu,pointRotateRads as Mn}from"@excalidraw/math";import{ROUGHNESS as l0,THEME as Sa,isTransparent as Pi,assertNever as d0,COLOR_PALETTE as c0,LINE_POLYGON_POINT_MERGE_DISTANCE as u0,applyDarkModeFilter as Ii,DEFAULT_STROKE_STREAMLINE as p0}from"@excalidraw/common";S();import{isRightAngleRads as qf,lineSegment as $c,pointFrom as kr,pointRotateRads as wa}from"@excalidraw/math";import{BOUND_TEXT_PADDING as Yn,DEFAULT_REDUCED_GLOBAL_ALPHA as Kf,ELEMENT_READY_TO_ERASE_OPACITY as Qf,FRAME_STYLE as Lr,DARK_THEME_FILTER as Jf,MIME_TYPES as Pa,THEME as Fo,distance as Xn,getFontString as e0,isRTL as t0,getVerticalOffset as n0,invariant as o0,applyDarkModeFilter as Cr,isSafari as i0}from"@excalidraw/common";S();import{pointFrom as mn,pointCenter as oh,pointRotateRads as kn,vectorFromPoint as ws,vectorNormalize as $l,vectorSubtract as Zl,vectorAdd as $i,vectorScale as Zi,pointFromVector as ql,clamp as Ze,isCloseTo as Kl}from"@excalidraw/math";var qe=10,Vb=(e,t,n,o,i,r,s,a)=>{let{width:l,height:d}=Ms(e),c=o/l,u=i/d,m=(e.crop?.x??0)/c,h=(e.crop?.y??0)/u,g=kn(mn(r,s),he(e,t),-e.angle);r=g[0],s=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,b=x.width,M=e.scale[0]===-1,w=e.scale[1]===-1,v=s-e.y,A=r-e.x;n.includes("n")&&(E=Ze(e.height-v,qe,w?d-h:e.height+h)),n.includes("s")&&(v=s-e.y-e.height,E=Ze(e.height+v,qe,w?e.height+h:d-h)),n.includes("e")&&(A=r-e.x-e.width,f=Ze(e.width+A,qe,M?e.width+m:l-m)),n.includes("w")&&(f=Ze(e.width-A,qe,M?l-m:e.width+m));let k=C=>{C.height=E*u,C.width=f*c};k(x);let T=(C,O)=>{k(O),C.includes("n")&&(w||(O.y+=y-O.height)),C.includes("s")&&w&&(O.y+=y-O.height),C.includes("e")&&M&&(O.x+=b-O.width),C.includes("w")&&(M||(O.x+=b-O.width))};switch(n){case"n":{if(a){let C=m+e.width/2,O=l-m-e.width/2,N=Math.min(C,O)*2;f=Ze(E*a,qe,N),E=f/a}T(n,x),a&&(x.x+=(b-x.width)/2);break}case"s":{if(a){let C=m+e.width/2,O=l-m-e.width/2,N=Math.min(C,O)*2;f=Ze(E*a,qe,N),E=f/a}T(n,x),a&&(x.x+=(b-x.width)/2);break}case"w":{if(a){let C=h+e.height/2,O=d-h-e.height/2,N=Math.min(C,O)*2;E=Ze(f/a,qe,N),f=E*a}T(n,x),a&&(x.y+=(y-x.height)/2);break}case"e":{if(a){let C=h+e.height/2,O=d-h-e.height/2,N=Math.min(C,O)*2;E=Ze(f/a,qe,N),f=E*a}T(n,x),a&&(x.y+=(y-x.height)/2);break}case"ne":{if(a)if(A>-v){let C=w?d-h:h+e.height;E=Ze(f/a,qe,C),f=E*a}else{let C=M?m+e.width:l-m;f=Ze(E*a,qe,C),E=f/a}T(n,x);break}case"nw":{if(a)if(A<v){let C=w?d-h:h+e.height;E=Ze(f/a,qe,C),f=E*a}else{let C=M?l-m:m+e.width;f=Ze(E*a,qe,C),E=f/a}T(n,x);break}case"se":{if(a)if(A>v){let C=w?h+e.height:d-h;E=Ze(f/a,qe,C),f=E*a}else{let C=M?m+e.width:l-m;f=Ze(E*a,qe,C),E=f/a}T(n,x);break}case"sw":{if(a)if(-A>v){let C=w?h+e.height:d-h;E=Ze(f/a,qe,C),f=E*a}else{let C=M?l-m:m+e.width;f=Ze(E*a,qe,C),E=f/a}T(n,x);break}default:break}let z=ih(e,n,f,E,!!a);return Kl(x.width,x.naturalWidth)&&Kl(x.height,x.naturalHeight)&&(x=null),{x:z[0],y:z[1],width:f,height:E,crop:x}},ih=(e,t,n,o,i)=>{let[r,s,a,l]=Ln(e,e.width,e.height,!0),d=mn(r,s),c=mn(a,l),u=oh(d,c),[m,h,g,f]=Ln(e,n,o,!0),E=g-m,x=f-h,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 b=e.angle,M=kn(y,u,b),w=[y[0]+Math.abs(E)/2,y[1]+Math.abs(x)/2],v=kn(w,u,b);y=kn(M,v,-b);let A=[...y];return A[0]+=e.x-m,A[1]+=e.y-h,A},Ql=(e,t)=>{if(e.crop){let{width:n,height:o}=Ms(e),[i,r,s,a,l,d]=ae(e,t),c=ws(kn(mn(i,r),mn(l,d),e.angle)),u=ws(kn(mn(s,r),mn(l,d),e.angle)),m=$l(Zl(u,c)),h=ws(kn(mn(i,a),mn(l,d),e.angle)),g=Zl(h,c),f=$l(g),{cropX:E,cropY:x}=rh(e.crop,e.scale),y=$i($i(c,Zi(m,-E*n/e.crop.naturalWidth)),Zi(f,-x*o/e.crop.naturalHeight)),b=ql($i($i(y,Zi(m,n/2)),Zi(f,o/2))),M=kn(ql(y),b,-e.angle);return{...e,x:M[0],y:M[1],width:n,height:o,crop:null}}return e},Ms=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}},rh=(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}},Ub=(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,s=n.y;if(o&&(r=n.naturalWidth-n.width-n.x),i&&(s=n.naturalHeight-n.height-n.y),t)return{x:r,y:s};let{width:a,height:l}=Ms(e);return{x:r/(n.naturalWidth/a),y:s/(n.naturalHeight/l)}};S();import{pointCenter as Nc,pointFrom as U,pointRotateRads as ct,pointsEqual as Oc,pointDistance as ho,vectorFromPoint as Rf,curveLength as Ff,curvePointAtLength as Hf}from"@excalidraw/math";import{DRAGGING_THRESHOLD as zf,KEYS as po,shouldRotateWithDiscreteAngle as mo,getGridPoint as Rc,invariant as wt,isShallowEqual as _f,getFeatureFlag as Ro}from"@excalidraw/common";S();import{arrayToMap as ec,getFeatureFlag as F1,getGridPoint as ra,invariant as wn,isTransparent as H1}from"@excalidraw/common";import{PRECISION as z1,clamp as wr,lineSegment as Co,pointDistance as Fn,pointDistanceSq as Dt,pointFrom as de,pointFromArray as _1,pointFromVector as yr,pointRotateRads as ve,pointsEqual as W1,vectorFromPoint as Bo,vectorNormalize as ia,vectorScale as br}from"@excalidraw/math";S();import{invariant as Td,isTransparent as kd}from"@excalidraw/common";import{curveIntersectLineSegment as Ld,isPointWithinBounds as Ws,lineSegment as hi,lineSegmentIntersectionPoints as Dd,pointFrom as ze,pointFromVector as o1,pointRotateRads as Tt,pointsEqual as Cd,vectorFromPoint as i1,vectorNormalize as r1,vectorScale as s1}from"@excalidraw/math";import{ellipse as a1,ellipseSegmentInterceptPoints as l1}from"@excalidraw/math/ellipse";S();import{DEFAULT_ADAPTIVE_RADIUS as mh,DEFAULT_PROPORTIONAL_RADIUS as Is,invariant as hh,LINE_CONFIRM_THRESHOLD as fh,ROUNDNESS as Ss}from"@excalidraw/common";import{bezierEquation as gh,curve as hn,curveCatmullRomCubicApproxPoints as dd,curveOffsetPoints as cd,lineSegment as je,lineSegmentIntersectionPoints as ad,pointDistance as ro,pointFrom as q,pointFromArray as Eh,pointFromVector as xh,pointRotateRads as St,pointTranslate as ld,rectangle as yh,vectorFromPoint as ud,vectorNormalize as bh,vectorScale as vs}from"@excalidraw/math";S();import{ROUNDNESS as ai,assertNever as sh}from"@excalidraw/common";import{pointsEqual as Jl}from"@excalidraw/math";var Dn=e=>!!e&&e.type==="image"&&!!e.fileId,Ue=e=>!!e&&e.type==="image",ed=e=>!!e&&e.type==="embeddable",qi=e=>!!e&&e.type==="iframe",Ki=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),ue=e=>e!=null&&e.type==="text",Qi=e=>e!=null&&e.type==="frame",td=e=>e!=null&&e.type==="magicframe",ce=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Le=e=>e!=null&&ah(e.type),ah=e=>e==="freedraw",le=e=>e!=null&&ch(e.type),Ye=e=>e!=null&&e.type==="line",J=e=>e!=null&&e.type==="arrow",ee=e=>J(e)&&e.elbowed,qb=e=>J(e)&&!e.elbowed,lh=e=>J(e)&&!e.elbowed&&!e.roundness,dh=e=>J(e)&&!e.elbowed&&e.roundness!==null,ch=e=>e==="arrow"||e==="line",Ke=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&uh(e.type),uh=e=>e==="arrow",De=(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),nd=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),li=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"),ph=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||J(e)),od=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 sh(t,null),!1}},id=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",Jt=e=>ph(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),Ne=e=>e!==null&&"containerId"in e&&e.containerId!==null&&ue(e),Kb=e=>!!e.startBinding||!!e.endBinding,Ji=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",rd=e=>e==="line"||e==="arrow"||e==="diamond",Qb=(e,t)=>!!((e===ai.ADAPTIVE_RADIUS||e===ai.LEGACY)&&Ji(t.type)||e===ai.PROPORTIONAL_RADIUS&&rd(t.type)),Jb=e=>rd(e.type)?{type:ai.PROPORTIONAL_RADIUS}:Ji(e.type)?{type:ai.ADAPTIVE_RADIUS}:null,ew=e=>lh(e)?"sharpArrow":dh(e)?"curvedArrow":ee(e)?"elbowArrow":"line",Ps=e=>e.length>3&&Jl(e[0],e[e.length-1]),sd=e=>e.length>3||e.length===3&&!Jl(e[0],e[e.length-1]),tw=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 di=new WeakMap,As=(e,t)=>{let n=di.get(e);if(!n)return;let{version:o,shapes:i}=n;if(o!==e.version){di.delete(e);return}return i.get(t)},Ts=(e,t,n)=>{let o=di.get(e);if(!o){di.set(e,{version:e.version,shapes:new Map([[n,t]])});return}let{version:i,shapes:r}=o;if(i!==e.version){di.set(e,{version:e.version,shapes:new Map([[n,t]])});return}r.set(n,t)};function so(e,t){let n=As(e,0);if(n)return n;let o=md(e,t),i=[],r=[];for(let a=0;a<o.length;a+=1){let l=o[a],d=o[a-1]&&Eh(o[a-1].data.slice(-2));switch(l.op){case"move":continue;case"lineTo":if(!d)throw new Error("prevPoint is undefined");i.push(je(q(e.x+d[0],e.y+d[1]),q(e.x+l.data[0],e.y+l.data[1])));continue;case"bcurveTo":if(!d)throw new Error("prevPoint is undefined");r.push(hn(q(e.x+d[0],e.y+d[1]),q(e.x+l.data[0],e.y+l.data[1]),q(e.x+l.data[2],e.y+l.data[3]),q(e.x+l.data[4],e.y+l.data[5])));continue;default:console.error("Unknown op type",l.op)}}let s=[i,r];return Ts(e,s,0),s}function Cn(e,t=0){let n=As(e,t);if(n)return n;let o=fn(Math.min(e.width,e.height),e);o===0&&(o=.01);let i=yh(q(e.x,e.y),q(e.x+e.width,e.y+e.height)),r=je(q(i[0][0]+o,i[0][1]),q(i[1][0]-o,i[0][1])),s=je(q(i[1][0],i[0][1]+o),q(i[1][0],i[1][1]-o)),a=je(q(i[0][0]+o,i[1][1]),q(i[1][0]-o,i[1][1])),l=je(q(i[0][0],i[1][1]-o),q(i[0][0],i[0][1]+o)),d=[hn(l[1],q(l[1][0]+2/3*(i[0][0]-l[1][0]),l[1][1]+2/3*(i[0][1]-l[1][1])),q(r[0][0]+2/3*(i[0][0]-r[0][0]),r[0][1]+2/3*(i[0][1]-r[0][1])),r[0]),hn(r[1],q(r[1][0]+2/3*(i[1][0]-r[1][0]),r[1][1]+2/3*(i[0][1]-r[1][1])),q(s[0][0]+2/3*(i[1][0]-s[0][0]),s[0][1]+2/3*(i[0][1]-s[0][1])),s[0]),hn(s[1],q(s[1][0]+2/3*(i[1][0]-s[1][0]),s[1][1]+2/3*(i[1][1]-s[1][1])),q(a[1][0]+2/3*(i[1][0]-a[1][0]),a[1][1]+2/3*(i[1][1]-a[1][1])),a[1]),hn(a[0],q(a[0][0]+2/3*(i[0][0]-a[0][0]),a[0][1]+2/3*(i[1][1]-a[0][1])),q(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(h=>dd(cd(h,t))):[[d[0]],[d[1]],[d[2]],[d[3]]],m=[[je(c[0][c[0].length-1][3],c[1][0][0]),je(c[1][c[1].length-1][3],c[2][0][0]),je(c[2][c[2].length-1][3],c[3][0][0]),je(c[3][c[3].length-1][3],c[0][0][0])],c.flat()];return Ts(e,m,t),m}function pd(e,t=0){let[n,o,i,r,s,a,l,d]=vo(e),c=e.roundness?fn(Math.abs(n-l),e):(n-l)*.01,u=e.roundness?fn(Math.abs(r-o),e):(r-o)*.01,[m,h,g,f]=[q(e.x+n,e.y+o),q(e.x+i,e.y+r),q(e.x+s,e.y+a),q(e.x+l,e.y+d)];return[hn(q(h[0]-c,h[1]-u),h,h,q(h[0]-c,h[1]+u)),hn(q(g[0]+c,g[1]-u),g,g,q(g[0]-c,g[1]-u)),hn(q(f[0]+c,f[1]+u),f,f,q(f[0]+c,f[1]-u)),hn(q(m[0]-c,m[1]+u),m,m,q(m[0]+c,m[1]+u))]}function Bn(e,t=0){let n=As(e,t);if(n)return n;let o=pd(e,t),i=t>0?o.map(a=>dd(cd(a,t))):[[o[0]],[o[1]],[o[2]],[o[3]]],s=[[je(i[0][i[0].length-1][3],i[1][0][0]),je(i[1][i[1].length-1][3],i[2][0][0]),je(i[2][i[2].length-1][3],i[3][0][0]),je(i[3][i[3].length-1][3],i[0][0][0])],i.flat()];return Ts(e,s,t),s}var vt=(e,t=1)=>{if(e.length>=3){let[n,o]=[e[0],e[e.length-1]];return ro(n,o)<=fh/t}return!1},fn=(e,t)=>{if(t.roundness?.type===Ss.PROPORTIONAL_RADIUS||t.roundness?.type===Ss.LEGACY)return e*Is;if(t.roundness?.type===Ss.ADAPTIVE_RADIUS){let n=t.roundness?.value??mh,o=n/Is;return e<=o?e*Is:n}return 0},wh=(e,t)=>{let n=e.type==="rectangle"?15:0,o=a=>{let l=bh(ud(a[1],a[0])),d=vs(l,n);return je(ld(a[0],d),ld(a[1],vs(d,-1)))},i=he(e,t),r=o(li(e)?je(St(q(e.x,e.y),i,e.angle),St(q(e.x+e.width,e.y+e.height),i,e.angle)):je(St(q(e.x+e.width/2,e.y),i,e.angle),St(q(e.x+e.width/2,e.y+e.height),i,e.angle))),s=o(li(e)?je(St(q(e.x+e.width,e.y),i,e.angle),St(q(e.x,e.y+e.height),i,e.angle)):je(St(q(e.x,e.y+e.height/2),i,e.angle),St(q(e.x+e.width,e.y+e.height/2),i,e.angle)));return[r,s]},er=(e,t,n,o)=>{let i=he(t,n);return(t.type==="diamond"?pd(t).map(a=>{let l=gh(a,.5),d=St(l,i,t.angle);return q(d[0],d[1])}):[St(q(t.x+t.width,t.y+t.height/2),i,t.angle),St(q(t.x+t.width/2,t.y+t.height),i,t.angle),St(q(t.x,t.y+t.height/2),i,t.angle),St(q(t.x+t.width/2,t.y),i,t.angle)]).find(a=>ro(e,a)<=Wt(o)+t.strokeWidth/2&&!en({point:e,element:t,threshold:0,elementsMap:n,overrideShouldTestInside:!0}))},So=(e,t,n,o,i,r,s=!0)=>{if(hh(e.points.length>=2,"Arrow must have at least two points"),e.width<3&&e.height<3)return null;if(s){let x=er(t,n,i,r);if(x)return x}let[a,l]=wh(n,i),d=W.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),b=x&&y&&Qe(Je(x.fixedPoint),y,i);b&&(d=b)}let c=xh(vs(ud(t,d),2*ro(d,t)+Math.max(ro(a[0],a[1]),ro(l[0],l[1]))),d),u=je(c,d),m=ad(a,u),h=ad(l,u),g=m&&ro(d,m),f=h&&ro(d,h),E=null;return g!=null&&f!=null?E=g<f?m:h:E=m||h||null,E&&ft(E,n,i)?E:null};S();import{ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO as Vh,ARROW_LABEL_WIDTH_FRACTION as Uh,BOUND_TEXT_PADDING as tn,DEFAULT_FONT_SIZE as Yh,TEXT_ALIGN as bd,VERTICAL_ALIGN as wd,getFontString as sr,isProdEnv as Xh,invariant as $h}from"@excalidraw/common";import{pointFrom as Md,pointRotateRads as Zh}from"@excalidraw/math";S();var ci={},hd=(e,t)=>{let n=ci[e]||(ci[e]={height:t});return n.height=t,n},fd=e=>{ci[e]&&delete ci[e]},fw=e=>ci[e]?.height??null;S();import{BOUND_TEXT_PADDING as nr,DEFAULT_FONT_SIZE as Mh,DEFAULT_FONT_FAMILY as Ph,getFontString as Ih,isTestEnv as Sh,normalizeEOL as vh}from"@excalidraw/common";var At=(e,t,n)=>{let o=e.split(`
|
|
1
|
+
var kh=Object.create;var Tl=Object.defineProperty;var Ah=Object.getOwnPropertyDescriptor;var Th=Object.getOwnPropertyNames;var Ch=Object.getPrototypeOf,Lh=Object.prototype.hasOwnProperty;var Dh=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ko=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Bh=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Th(t))!Lh.call(e,i)&&i!==n&&Tl(e,i,{get:()=>t[i],enumerable:!(o=Ah(t,i))||o.enumerable});return e};var Bi=(e,t,n)=>(n=e!=null?kh(Ch(e)):{},Bh(t||!e||!e.__esModule?Tl(n,"default",{value:e,enumerable:!0}):n,e));var F,S=Dh(()=>{F={PROD:!0}});var dp=Ko((_I,lp)=>{S();var ap="Expected a function",rp=NaN,FE="[object Symbol]",HE=/^\s+|\s+$/g,_E=/^[-+]0x[0-9a-f]+$/i,zE=/^0b[01]+$/i,WE=/^0o[0-7]+$/i,UE=parseInt,jE=typeof global=="object"&&global&&global.Object===Object&&global,VE=typeof self=="object"&&self&&self.Object===Object&&self,XE=jE||VE||Function("return this")(),YE=Object.prototype,$E=YE.toString,ZE=Math.max,qE=Math.min,Ja=function(){return XE.Date.now()};function KE(e,t,n){var o,i,r,s,a,l,d=0,c=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(ap);t=sp(t)||0,$r(n)&&(c=!!n.leading,u="maxWait"in n,r=u?ZE(sp(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h);function m(v){var k=o,T=i;return o=i=void 0,d=v,s=e.apply(T,k),s}function g(v){return d=v,a=setTimeout(x,t),c?m(v):s}function f(v){var k=v-l,T=v-d,A=t-k;return u?qE(A,r-T):A}function E(v){var k=v-l,T=v-d;return l===void 0||k>=t||k<0||u&&T>=r}function x(){var v=Ja();if(E(v))return y(v);a=setTimeout(x,f(v))}function y(v){return a=void 0,h&&o?m(v):(o=i=void 0,s)}function b(){a!==void 0&&clearTimeout(a),d=0,o=l=i=a=void 0}function M(){return a===void 0?s:y(Ja())}function w(){var v=Ja(),k=E(v);if(o=arguments,i=this,l=v,k){if(a===void 0)return g(l);if(u)return a=setTimeout(x,t),m(l)}return a===void 0&&(a=setTimeout(x,t)),s}return w.cancel=b,w.flush=M,w}function QE(e,t,n){var o=!0,i=!0;if(typeof e!="function")throw new TypeError(ap);return $r(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),KE(e,t,{leading:o,maxWait:t,trailing:i})}function $r(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function JE(e){return!!e&&typeof e=="object"}function e2(e){return typeof e=="symbol"||JE(e)&&$E.call(e)==FE}function sp(e){if(typeof e=="number")return e;if(e2(e))return rp;if($r(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$r(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(HE,"");var n=zE.test(e);return n||WE.test(e)?UE(e.slice(2),n?2:8):_E.test(e)?rp:+e}lp.exports=QE});var nh=Ko(se=>{"use strict";S();var xl=Symbol.for("react.transitional.element"),ax=Symbol.for("react.portal"),lx=Symbol.for("react.fragment"),dx=Symbol.for("react.strict_mode"),cx=Symbol.for("react.profiler"),ux=Symbol.for("react.consumer"),px=Symbol.for("react.context"),hx=Symbol.for("react.forward_ref"),mx=Symbol.for("react.suspense"),fx=Symbol.for("react.memo"),qp=Symbol.for("react.lazy"),Vp=Symbol.iterator;function gx(e){return e===null||typeof e!="object"?null:(e=Vp&&e[Vp]||e["@@iterator"],typeof e=="function"?e:null)}var Kp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Qp=Object.assign,Jp={};function Zo(e,t,n){this.props=e,this.context=t,this.refs=Jp,this.updater=n||Kp}Zo.prototype.isReactComponent={};Zo.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")};Zo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function eh(){}eh.prototype=Zo.prototype;function yl(e,t,n){this.props=e,this.context=t,this.refs=Jp,this.updater=n||Kp}var bl=yl.prototype=new eh;bl.constructor=yl;Qp(bl,Zo.prototype);bl.isPureReactComponent=!0;var Xp=Array.isArray,Ge={H:null,A:null,T:null,S:null},th=Object.prototype.hasOwnProperty;function wl(e,t,n,o,i,r){return n=r.ref,{$$typeof:xl,type:e,key:t,ref:n!==void 0?n:null,props:r}}function Ex(e,t){return wl(e.type,t,void 0,void 0,void 0,e.props)}function Ml(e){return typeof e=="object"&&e!==null&&e.$$typeof===xl}function xx(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Yp=/\/+/g;function El(e,t){return typeof e=="object"&&e!==null&&e.key!=null?xx(""+e.key):t.toString(36)}function $p(){}function yx(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then($p,$p):(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 $o(e,t,n,o,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(r){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case xl:case ax:s=!0;break;case qp:return s=e._init,$o(s(e._payload),t,n,o,i)}}if(s)return i=i(e),s=o===""?"."+El(e,0):o,Xp(i)?(n="",s!=null&&(n=s.replace(Yp,"$&/")+"/"),$o(i,t,n,"",function(d){return d})):i!=null&&(Ml(i)&&(i=Ex(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(Yp,"$&/")+"/")+s)),t.push(i)),1;s=0;var a=o===""?".":o+":";if(Xp(e))for(var l=0;l<e.length;l++)o=e[l],r=a+El(o,l),s+=$o(o,t,n,r,i);else if(l=gx(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,r=a+El(o,l++),s+=$o(o,t,n,r,i);else if(r==="object"){if(typeof e.then=="function")return $o(yx(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 s}function ns(e,t,n){if(e==null)return e;var o=[],i=0;return $o(e,o,"","",function(r){return t.call(n,r,i++)}),o}function bx(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 Zp=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 wx(){}se.Children={map:ns,forEach:function(e,t,n){ns(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ns(e,function(){t++}),t},toArray:function(e){return ns(e,function(t){return t})||[]},only:function(e){if(!Ml(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};se.Component=Zo;se.Fragment=lx;se.Profiler=cx;se.PureComponent=yl;se.StrictMode=dx;se.Suspense=mx;se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ge;se.act=function(){throw Error("act(...) is not supported in production builds of React.")};se.cache=function(e){return function(){return e.apply(null,arguments)}};se.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Qp({},e.props),i=e.key,r=void 0;if(t!=null)for(s in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(i=""+t.key),t)!th.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(o[s]=t[s]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var a=Array(s),l=0;l<s;l++)a[l]=arguments[l+2];o.children=a}return wl(e.type,i,void 0,void 0,r,o)};se.createContext=function(e){return e={$$typeof:px,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:ux,_context:e},e};se.createElement=function(e,t,n){var o,i={},r=null;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)th.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(i[o]=t[o]);var s=arguments.length-2;if(s===1)i.children=n;else if(1<s){for(var a=Array(s),l=0;l<s;l++)a[l]=arguments[l+2];i.children=a}if(e&&e.defaultProps)for(o in s=e.defaultProps,s)i[o]===void 0&&(i[o]=s[o]);return wl(e,r,void 0,void 0,null,i)};se.createRef=function(){return{current:null}};se.forwardRef=function(e){return{$$typeof:hx,render:e}};se.isValidElement=Ml;se.lazy=function(e){return{$$typeof:qp,_payload:{_status:-1,_result:e},_init:bx}};se.memo=function(e,t){return{$$typeof:fx,type:e,compare:t===void 0?null:t}};se.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(wx,Zp)}catch(r){Zp(r)}finally{Ge.T=t}};se.unstable_useCacheRefresh=function(){return Ge.H.useCacheRefresh()};se.use=function(e){return Ge.H.use(e)};se.useActionState=function(e,t,n){return Ge.H.useActionState(e,t,n)};se.useCallback=function(e,t){return Ge.H.useCallback(e,t)};se.useContext=function(e){return Ge.H.useContext(e)};se.useDebugValue=function(){};se.useDeferredValue=function(e,t){return Ge.H.useDeferredValue(e,t)};se.useEffect=function(e,t){return Ge.H.useEffect(e,t)};se.useId=function(){return Ge.H.useId()};se.useImperativeHandle=function(e,t,n){return Ge.H.useImperativeHandle(e,t,n)};se.useInsertionEffect=function(e,t){return Ge.H.useInsertionEffect(e,t)};se.useLayoutEffect=function(e,t){return Ge.H.useLayoutEffect(e,t)};se.useMemo=function(e,t){return Ge.H.useMemo(e,t)};se.useOptimistic=function(e,t){return Ge.H.useOptimistic(e,t)};se.useReducer=function(e,t,n){return Ge.H.useReducer(e,t,n)};se.useRef=function(e){return Ge.H.useRef(e)};se.useState=function(e){return Ge.H.useState(e)};se.useSyncExternalStore=function(e,t,n){return Ge.H.useSyncExternalStore(e,t,n)};se.useTransition=function(){return Ge.H.useTransition()};se.version="19.0.0"});var ih=Ko((h8,oh)=>{"use strict";S();oh.exports=nh()});var sh=Ko(os=>{"use strict";S();var Mx=Symbol.for("react.transitional.element"),Px=Symbol.for("react.fragment");function rh(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:Mx,type:e,key:o,ref:t!==void 0?t:null,props:n}}os.Fragment=Px;os.jsx=rh;os.jsxs=rh});var Pl=Ko((E8,ah)=>{"use strict";S();ah.exports=sh()});S();import{toIterable as Py}from"@excalidraw/common";S();import{SHIFT_LOCKING_ANGLE as Sn,viewportCoordsToSceneCoords as Hr}from"@excalidraw/common";import{normalizeRadians as ku,radiansBetweenAngles as bg,radiansDifference as wg}from"@excalidraw/math";import{pointsEqual as Mg}from"@excalidraw/math";S();S();S();S();S();S();S();S();S();function cs(e,t,n){if(e&&e.length){let[o,i]=t,r=Math.PI/180*n,s=Math.cos(r),a=Math.sin(r);for(let l of e){let[d,c]=l;l[0]=(d-o)*s-(c-i)*a+o,l[1]=(d-o)*a+(c-i)*s+i}}}function Nh(e,t,n){let o=[];e.forEach(i=>o.push(...i)),cs(o,t,n)}function Oh(e,t){return e[0]===t[0]&&e[1]===t[1]}function Cl(e,t,n,o=1){let i=n,r=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,a=[0,0];if(i)for(let d of s)cs(d,a,i);let l=Rh(s,r,o);if(i){for(let d of s)cs(d,a,-i);Nh(l,a,-i)}return l}function Rh(e,t,n){let o=[];for(let d of e){let c=[...d];Oh(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 s=[],a=r[0].ymin,l=0;for(;s.length||r.length;){if(r.length){let d=-1;for(let u=0;u<r.length&&!(r[u].ymin>a);u++)d=u;r.splice(0,d+1).forEach(u=>{s.push({s:a,edge:u})})}if(s=s.filter(d=>!(d.edge.ymax<=a)),s.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)&&s.length>1)for(let d=0;d<s.length;d=d+2){let c=d+1;if(c>=s.length)break;let u=s[d].edge,h=s[c].edge;i.push([[Math.round(u.x),a],[Math.round(h.x),a]])}a+=n,s.forEach(d=>{d.edge.x=d.edge.x+n*d.edge.islope}),l++}return i}function en(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),Cl(e,i,o,r||1)}var An=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let o=en(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}};S();S();function Tn(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 Gi=class extends An{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=en(t,i),s=Math.PI/180*n.hachureAngle,a=[],l=o*.5*Math.cos(s),d=o*.5*Math.sin(s);for(let[u,h]of r)Tn([u,h])&&a.push([[u[0]-l,u[1]+d],[...h]],[[u[0]+l,u[1]-d],[...h]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}};S();var Ni=class extends An{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}};S();var Oi=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let o=en(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 s=i/4;for(let a of t){let l=Tn(a),d=l/i,c=Math.ceil(d)-1,u=l-c*i,h=(a[0][0]+a[1][0])/2-i/4,m=Math.min(a[0][1],a[1][1]);for(let g=0;g<c;g++){let f=m+u+g*i,E=h-s+Math.random()*2*s,x=f-s+Math.random()*2*s,y=this.helper.ellipse(E,x,r,r,n);o.push(...y.ops)}}return{type:"fillSketch",ops:o}}};S();var Ri=class{constructor(t){this.helper=t}fillPolygons(t,n){let o=en(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(s=>{let a=Tn(s),l=Math.floor(a/(o+i)),d=(a+i-l*(o+i))/2,c=s[0],u=s[1];c[0]>u[0]&&(c=s[1],u=s[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}};S();var Fi=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=en(t,n);return{type:"fillSketch",ops:this.zigzagLines(r,i,n)}}zigzagLines(t,n,o){let i=[];return t.forEach(r=>{let s=Tn(r),a=Math.round(s/(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<a;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 mt={};function Ll(e,t){let n=e.fillStyle||"hachure";if(!mt[n])switch(n){case"zigzag":mt[n]||(mt[n]=new Gi(t));break;case"cross-hatch":mt[n]||(mt[n]=new Ni(t));break;case"dots":mt[n]||(mt[n]=new Oi(t));break;case"dashed":mt[n]||(mt[n]=new Ri(t));break;case"zigzag-line":mt[n]||(mt[n]=new Fi(t));break;case"hachure":default:n="hachure",mt[n]||(mt[n]=new An(t));break}return mt[n]}S();function Dl(){return Math.floor(Math.random()*2**31)}var Hi=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};S();S();var _i={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 Fh(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 us(e,t){return e.type===t}function Mo(e){let t=[],n=Fh(e),o="BOD",i=0,r=n[i];for(;!us(r,2);){let s=0,a=[];if(o==="BOD")if(r.text==="M"||r.text==="m")i++,s=_i[r.text],o=r.text;else return Mo("M0,0"+e);else us(r,1)?s=_i[o]:(i++,s=_i[r.text],o=r.text);if(i+s<n.length){for(let l=i;l<i+s;l++){let d=n[l];if(us(d,1))a[a.length]=+d.text;else throw new Error("Param not a number: "+o+","+d.text)}if(typeof _i[o]=="number"){let l={key:o,data:a};t.push(l),i+=s,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}S();function Qo(e){let t=0,n=0,o=0,i=0,r=[];for(let{key:s,data:a}of e)switch(s){case"M":r.push({key:"M",data:[...a]}),[t,n]=a,[o,i]=a;break;case"m":t+=a[0],n+=a[1],r.push({key:"M",data:[t,n]}),o=t,i=n;break;case"L":r.push({key:"L",data:[...a]}),[t,n]=a;break;case"l":t+=a[0],n+=a[1],r.push({key:"L",data:[t,n]});break;case"C":r.push({key:"C",data:[...a]}),t=a[4],n=a[5];break;case"c":{let l=a.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:[...a]}),t=a[2],n=a[3];break;case"q":{let l=a.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:[...a]}),t=a[5],n=a[6];break;case"a":t+=a[5],n+=a[6],r.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,n]});break;case"H":r.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],r.push({key:"V",data:[n]});break;case"S":r.push({key:"S",data:[...a]}),t=a[2],n=a[3];break;case"s":{let l=a.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:[...a]}),t=a[0],n=a[1];break;case"t":t+=a[0],n+=a[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}S();function ei(e){let t=[],n="",o=0,i=0,r=0,s=0,a=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,s]=c;break;case"C":t.push({key:"C",data:[...c]}),o=c[4],i=c[5],a=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-a),h=i+(i-l)):(u=o,h=i),t.push({key:"C",data:[u,h,...c]}),a=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-a),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]}),a=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]}),a=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)&&(Bl(o,i,E,x,u,h,m,g,f).forEach(function(b){t.push({key:"C",data:b})}),o=E,i=x);break}case"Z":t.push({key:"Z",data:[]}),o=r,i=s;break}n=d}return t}function Hh(e){return Math.PI*e/180}function Jo(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 Bl(e,t,n,o,i,r,s,a,l,d){let c=Hh(s),u=[],h=0,m=0,g=0,f=0;if(d)[h,m,g,f]=d;else{[e,t]=Jo(e,t,-c),[n,o]=Jo(n,o,-c);let O=(e-n)/2,N=(t-o)/2,W=O*O/(i*i)+N*N/(r*r);W>1&&(W=Math.sqrt(W),i=W*i,r=W*r);let j=a===l?-1:1,L=i*i,B=r*r,I=L*B-L*N*N-B*O*O,C=L*N*N+B*O*O,G=j*Math.sqrt(Math.abs(I/C));g=G*i*N/r+(e+n)/2,f=G*-r*O/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 O=m,N=n,W=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=Bl(n,o,N,W,i,r,s,0,l,[m,O,g,f])}E=m-h;let x=Math.cos(h),y=Math.sin(h),b=Math.cos(m),M=Math.sin(m),w=Math.tan(E/4),v=4/3*i*w,k=4/3*r*w,T=[e,t],A=[e+v*y,t-k*x],_=[n+v*M,o-k*b],D=[n,o];if(A[0]=2*T[0]-A[0],A[1]=2*T[1]-A[1],d)return[A,_,D].concat(u);{u=[A,_,D].concat(u);let O=[];for(let N=0;N<u.length;N+=3){let W=Jo(u[N][0],u[N][1],c),j=Jo(u[N+1][0],u[N+1][1],c),L=Jo(u[N+2][0],u[N+2][1],c);O.push([W[0],W[1],j[0],j[1],L[0],L[1]])}return O}}var _h={randOffset:Uh,randOffsetWithRange:jh,ellipse:Wh,doubleLineOps:Vh};function ps(e,t,n,o,i){return{type:"path",ops:hn(e,t,n,o,i)}}function ti(e,t,n){let o=(e||[]).length;if(o>2){let i=[];for(let r=0;r<o-1;r++)i.push(...hn(e[r][0],e[r][1],e[r+1][0],e[r+1][1],n));return t&&i.push(...hn(e[o-1][0],e[o-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(o===2)return ps(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function zh(e,t){return ti(e,!0,t)}function Fl(e,t,n,o,i){let r=[[e,t],[e+n,t],[e+n,t+o],[e,t+o]];return zh(r,i)}function hs(e,t){let n=Nl(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let o=Nl(e,1.5*(1+t.roughness*.22),Xh(t));n=n.concat(o)}return{type:"path",ops:n}}function Wh(e,t,n,o,i){let r=ms(n,o,i);return Ui(e,t,i,r).opset}function ms(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,s=Math.abs(e/2),a=Math.abs(t/2),l=1-n.curveFitting;return s+=K(s*l,n),a+=K(a*l,n),{increment:r,rx:s,ry:a}}function Ui(e,t,n,o){let[i,r]=Ol(o.increment,e,t,o.rx,o.ry,1,o.increment*zi(.1,zi(.4,1,n),n),n),s=Wi(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[a]=Ol(o.increment,e,t,o.rx,o.ry,1.5,0,n),l=Wi(a,null,n);s=s.concat(l)}return{estimatedPoints:r,opset:{type:"path",ops:s}}}function fs(e,t,n,o,i,r,s,a,l){let d=e,c=t,u=Math.abs(n/2),h=Math.abs(o/2);u+=K(u*.01,l),h+=K(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=Rl(E,d,c,u,h,m,g,1,l);if(!l.disableMultiStroke){let y=Rl(E,d,c,u,h,m,g,1.5,l);x.push(...y)}return s&&(a?x.push(...hn(d,c,d+u*Math.cos(m),c+h*Math.sin(m),l),...hn(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 gs(e,t){let n=ei(Qo(Mo(e))),o=[],i=[0,0],r=[0,0];for(let{key:s,data:a}of n)switch(s){case"M":{r=[a[0],a[1]],i=[a[0],a[1]];break}case"L":o.push(...hn(r[0],r[1],a[0],a[1],t)),r=[a[0],a[1]];break;case"C":{let[l,d,c,u,h,m]=a;o.push(...Yh(l,d,c,u,h,m,r,t)),r=[h,m];break}case"Z":o.push(...hn(r[0],r[1],i[0],i[1],t)),r=[i[0],i[1]];break}return{type:"path",ops:o}}function ji(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]+K(i,t),o[0][1]+K(i,t)]});for(let s=1;s<r;s++)n.push({op:"lineTo",data:[o[s][0]+K(i,t),o[s][1]+K(i,t)]})}}return{type:"fillPath",ops:n}}function no(e,t){return Ll(t,_h).fillPolygons(e,t)}function Hl(e,t,n,o,i,r,s){let a=e,l=t,d=Math.abs(n/2),c=Math.abs(o/2);d+=K(d*.01,s),c+=K(c*.01,s);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)/s.curveStepCount,g=[];for(let f=u;f<=h;f=f+m)g.push([a+d*Math.cos(f),l+c*Math.sin(f)]);return g.push([a+d*Math.cos(h),l+c*Math.sin(h)]),g.push([a,l]),no([g],s)}function Uh(e,t){return K(e,t)}function jh(e,t,n){return zi(e,t,n)}function Vh(e,t,n,o,i){return hn(e,t,n,o,i,!0)}function Xh(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function _l(e){return e.randomizer||(e.randomizer=new Hi(e.seed||0)),e.randomizer.next()}function zi(e,t,n,o=1){return n.roughness*o*(_l(n)*(t-e)+e)}function K(e,t,n=1){return zi(-e,e,t,n)}function hn(e,t,n,o,i,r=!1){let s=r?i.disableMultiStrokeFill:i.disableMultiStroke,a=Gl(e,t,n,o,i,!0,!1);if(s)return a;let l=Gl(e,t,n,o,i,!0,!0);return a.concat(l)}function Gl(e,t,n,o,i,r,s){let a=Math.pow(e-n,2)+Math.pow(t-o,2),l=Math.sqrt(a),d=1;l<200?d=1:l>500?d=.4:d=-.0016668*l+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>a&&(c=l/10);let u=c/2,h=.2+_l(i)*.2,m=i.bowing*i.maxRandomnessOffset*(o-t)/200,g=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=K(m,i,d),g=K(g,i,d);let f=[],E=()=>K(u,i,d),x=()=>K(c,i,d),y=i.preserveVertices;return r&&(s?f.push({op:"move",data:[e+(y?0:E()),t+(y?0:E())]}):f.push({op:"move",data:[e+(y?0:K(c,i,d)),t+(y?0:K(c,i,d))]})),s?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 Nl(e,t,n){let o=[];o.push([e[0][0]+K(t,n),e[0][1]+K(t,n)]),o.push([e[0][0]+K(t,n),e[0][1]+K(t,n)]);for(let i=1;i<e.length;i++)o.push([e[i][0]+K(t,n),e[i][1]+K(t,n)]),i===e.length-1&&o.push([e[i][0]+K(t,n),e[i][1]+K(t,n)]);return Wi(o,null,n)}function Wi(e,t,n){let o=e.length,i=[];if(o>3){let r=[],s=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let a=1;a+2<o;a++){let l=e[a];r[0]=[l[0],l[1]],r[1]=[l[0]+(s*e[a+1][0]-s*e[a-1][0])/6,l[1]+(s*e[a+1][1]-s*e[a-1][1])/6],r[2]=[e[a+1][0]+(s*e[a][0]-s*e[a+2][0])/6,e[a+1][1]+(s*e[a][1]-s*e[a+2][1])/6],r[3]=[e[a+1][0],e[a+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 a=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+K(a,n),t[1]+K(a,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(...hn(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function Ol(e,t,n,o,i,r,s,a){let l=a.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=K(.5,a)-Math.PI/2;c.push([K(r,a)+t+.9*o*Math.cos(u-e),K(r,a)+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=[K(r,a)+t+o*Math.cos(m),K(r,a)+n+i*Math.sin(m)];d.push(g),c.push(g)}c.push([K(r,a)+t+o*Math.cos(u+Math.PI*2+s*.5),K(r,a)+n+i*Math.sin(u+Math.PI*2+s*.5)]),c.push([K(r,a)+t+.98*o*Math.cos(u+s),K(r,a)+n+.98*i*Math.sin(u+s)]),c.push([K(r,a)+t+.9*o*Math.cos(u+s*.5),K(r,a)+n+.9*i*Math.sin(u+s*.5)])}return[c,d]}function Rl(e,t,n,o,i,r,s,a,l){let d=r+K(.1,l),c=[];c.push([K(a,l)+t+.9*o*Math.cos(d-e),K(a,l)+n+.9*i*Math.sin(d-e)]);for(let u=d;u<=s;u=u+e)c.push([K(a,l)+t+o*Math.cos(u),K(a,l)+n+i*Math.sin(u)]);return c.push([t+o*Math.cos(s),n+i*Math.sin(s)]),c.push([t+o*Math.cos(s),n+i*Math.sin(s)]),Wi(c,null,l)}function Yh(e,t,n,o,i,r,s,a){let l=[],d=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3],c=[0,0],u=a.disableMultiStroke?1:2,h=a.preserveVertices;for(let m=0;m<u;m++)m===0?l.push({op:"move",data:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(h?0:K(d[0],a)),s[1]+(h?0:K(d[0],a))]}),c=h?[i,r]:[i+K(d[m],a),r+K(d[m],a)],l.push({op:"bcurveTo",data:[e+K(d[m],a),t+K(d[m],a),n+K(d[m],a),o+K(d[m],a),c[0],c[1]]});return l}S();function ni(e){return[...e]}function Vi(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(ni(e[0]),ni(e[1]),ni(e[2]),ni(e[2]));else{let i=[];i.push(e[0],e[0]);for(let a=1;a<e.length;a++)i.push(e[a]),a===e.length-1&&i.push(e[a]);let r=[],s=1-t;o.push(ni(i[0]));for(let a=1;a+2<i.length;a++){let l=i[a];r[0]=[l[0],l[1]],r[1]=[l[0]+(s*i[a+1][0]-s*i[a-1][0])/6,l[1]+(s*i[a+1][1]-s*i[a-1][1])/6],r[2]=[i[a+1][0]+(s*i[a][0]-s*i[a+2][0])/6,i[a+1][1]+(s*i[a][1]-s*i[a+2][1])/6],r[3]=[i[a+1][0],i[a+1][1]],o.push(r[1],r[2],r[3])}}return o}S();function $h(e,t){return Math.sqrt(Xi(e,t))}function Xi(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function Zh(e,t,n){let o=Xi(t,n);if(o===0)return Xi(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)),Xi(e,oo(t,n,i))}function oo(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function qh(e,t){let n=e[t+0],o=e[t+1],i=e[t+2],r=e[t+3],s=3*o[0]-2*n[0]-r[0];s*=s;let a=3*o[1]-2*n[1]-r[1];a*=a;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,s<l&&(s=l),a<d&&(a=d),s+a}function Es(e,t,n,o){let i=o||[];if(qh(e,t)<n){let r=e[t+0];i.length?$h(i[i.length-1],r)>1&&i.push(r):i.push(r),i.push(e[t+3])}else{let s=e[t+0],a=e[t+1],l=e[t+2],d=e[t+3],c=oo(s,a,.5),u=oo(a,l,.5),h=oo(l,d,.5),m=oo(c,u,.5),g=oo(u,h,.5),f=oo(m,g,.5);Es([s,c,m,f],0,n,i),Es([f,g,h,d],0,n,i)}return i}function Cn(e,t){return Yi(e,0,e.length,t)}function Yi(e,t,n,o,i){let r=i||[],s=e[t],a=e[n-1],l=0,d=1;for(let c=t+1;c<n-1;++c){let u=Zh(e[c],s,a);u>l&&(l=u,d=c)}return Math.sqrt(l)>o?(Yi(e,t,d+1,o,r),Yi(e,d,n,o,r)):(r.length||r.push(s),r.push(a)),r}function Ft(e,t=.15,n){let o=[],i=(e.length-1)/3;for(let r=0;r<i;r++){let s=r*3;Es(e,s,t,o)}return n&&n>0?Yi(o,0,o.length,n):o}S();function zl(e,t,n){let o=Mo(e),i=ei(Qo(o)),r=[],s=[],a=[0,0],l=[],d=()=>{l.length>=4&&s.push(...Ft(l,t)),l=[]},c=()=>{d(),s.length&&(r.push(s),s=[])};for(let{key:h,data:m}of i)switch(h){case"M":c(),a=[m[0],m[1]],s.push(a);break;case"L":d(),s.push([m[0],m[1]]);break;case"C":if(!l.length){let g=s.length?s[s.length-1]:a;l.push([g[0],g[1]])}l.push([m[0],m[1]]),l.push([m[2],m[3]]),l.push([m[4],m[5]]);break;case"Z":d(),s.push([a[0],a[1]]);break}if(c(),!n)return r;let u=[];for(let h of r){let m=Cn(h,n);m.length&&u.push(m)}return u}var It="none",Dt=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 Dl()}_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 s=this._o(r);return this._d("line",[ps(t,n,o,i,s)],s)}rectangle(t,n,o,i,r){let s=this._o(r),a=[],l=Fl(t,n,o,i,s);if(s.fill){let d=[[t,n],[t+o,n],[t+o,n+i],[t,n+i]];s.fillStyle==="solid"?a.push(ji([d],s)):a.push(no([d],s))}return s.stroke!==It&&a.push(l),this._d("rectangle",a,s)}ellipse(t,n,o,i,r){let s=this._o(r),a=[],l=ms(o,i,s),d=Ui(t,n,s,l);if(s.fill)if(s.fillStyle==="solid"){let c=Ui(t,n,s,l).opset;c.type="fillPath",a.push(c)}else a.push(no([d.estimatedPoints],s));return s.stroke!==It&&a.push(d.opset),this._d("ellipse",a,s)}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",[ti(t,!1,o)],o)}arc(t,n,o,i,r,s,a=!1,l){let d=this._o(l),c=[],u=fs(t,n,o,i,r,s,a,!0,d);if(a&&d.fill)if(d.fillStyle==="solid"){let h=Object.assign({},d);h.disableMultiStroke=!0;let m=fs(t,n,o,i,r,s,!0,!1,h);m.type="fillPath",c.push(m)}else c.push(Hl(t,n,o,i,r,s,d));return d.stroke!==It&&c.push(u),this._d("arc",c,d)}curve(t,n){let o=this._o(n),i=[],r=hs(t,o);if(o.fill&&o.fill!==It&&t.length>=3)if(o.fillStyle==="solid"){let s=hs(t,Object.assign(Object.assign({},o),{disableMultiStroke:!0,roughness:o.roughness?o.roughness+o.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=Vi(t),a=Ft(s,10,(1+o.roughness)/2);i.push(no([a],o))}return o.stroke!==It&&i.push(r),this._d("curve",i,o)}polygon(t,n){let o=this._o(n),i=[],r=ti(t,!0,o);return o.fill&&(o.fillStyle==="solid"?i.push(ji([t],o)):i.push(no([t],o))),o.stroke!==It&&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!==It,s=o.stroke!==It,a=!!(o.simplification&&o.simplification<1),l=a?4-4*(o.simplification||1):(1+o.roughness)/2,d=zl(t,1,l),c=gs(t,o);if(r)if(o.fillStyle==="solid")if(d.length===1){let u=gs(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(ji(d,o));else i.push(no(d,o));return s&&(a?d.forEach(u=>{i.push(ti(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(s=>+s.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 s=null;switch(r.type){case"path":s={d:this.opsToPath(r),stroke:o.stroke,strokeWidth:o.strokeWidth,fill:It};break;case"fillPath":s={d:this.opsToPath(r),stroke:It,strokeWidth:0,fill:o.fill||It};break;case"fillSketch":s=this.fillSketch(r,o);break}s&&i.push(s)}return i}fillSketch(t,n){let o=n.fillWeight;return o<0&&(o=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||It,strokeWidth:o,fill:It}}_mergedShape(t){return t.filter((n,o)=>o===0?!0:n.op!=="move")}};var $i=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Dt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(let s of n)switch(s.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,s,r),i.restore();break;case"fillPath":{i.save(),i.fillStyle=o.fill||"";let a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,r,a),i.restore();break}case"fillSketch":this.fillSketch(i,s,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 s=typeof o=="number"&&o>=0?r.data.map(a=>+a.toFixed(o)):r.data;switch(r.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,o,i,r){let s=this.gen.line(t,n,o,i,r);return this.draw(s),s}rectangle(t,n,o,i,r){let s=this.gen.rectangle(t,n,o,i,r);return this.draw(s),s}ellipse(t,n,o,i,r){let s=this.gen.ellipse(t,n,o,i,r);return this.draw(s),s}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,s,a=!1,l){let d=this.gen.arc(t,n,o,i,r,s,a,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}};S();S();var oi="http://www.w3.org/2000/svg";var Zi=class{constructor(t,n){this.svg=t,this.gen=new Dt(n)}draw(t){let n=t.sets||[],o=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,r=i.createElementNS(oi,"g"),s=t.options.fixedDecimalPlaceDigits;for(let a of n){let l=null;switch(a.type){case"path":{l=i.createElementNS(oi,"path"),l.setAttribute("d",this.opsToPath(a,s)),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(oi,"path"),l.setAttribute("d",this.opsToPath(a,s)),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,a,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(oi,"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 s=this.gen.line(t,n,o,i,r);return this.draw(s)}rectangle(t,n,o,i,r){let s=this.gen.rectangle(t,n,o,i,r);return this.draw(s)}ellipse(t,n,o,i,r){let s=this.gen.ellipse(t,n,o,i,r);return this.draw(s)}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,s,a=!1,l){let d=this.gen.arc(t,n,o,i,r,s,a,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 $i(e,t)},svg(e,t){return new Zi(e,t)},generator(e){return new Dt(e)},newSeed(){return Dt.newSeed()}};import{arrayToMap as Su,invariant as Fa,rescalePoints as bu,sizeOf as dg}from"@excalidraw/common";import{degreesToRadians as Ra,lineSegment as Be,pointFrom as H,pointFromArray as vu,pointRotateRads as Ee}from"@excalidraw/math";S();import{invariant as Kh}from"@excalidraw/common";import{curve as Qh,lineSegment as Jh,pointFrom as Ae,pointDistance as aw,pointFromArray as em,pointFromVector as tm,pointRotateRads as Ht,polygon as Wl,polygonFromPoints as xs,PRECISION as lw,segmentsIntersectAt as dw,vector as nm,vectorAdd as om,vectorFromPoint as im,vectorScale as cw}from"@excalidraw/math";import{getElementAbsoluteCoords as pw}from"@excalidraw/element";var Ul=e=>{let{angle:t,width:n,height:o,x:i,y:r}=e,s=i+n/2,a=r+o/2,l=Ae(s,a),d;return e.type==="diamond"?d=Wl(Ht(Ae(s,r),l,t),Ht(Ae(i+n,a),l,t),Ht(Ae(s,r+o),l,t),Ht(Ae(i,a),l,t)):d=Wl(Ht(Ae(i,r),l,t),Ht(Ae(i+n,r),l,t),Ht(Ae(i+n,r+o),l,t),Ht(Ae(i,r+o),l,t)),{type:"polygon",data:d}};var jl=e=>{let{width:t,height:n,angle:o,x:i,y:r}=e;return{type:"ellipse",data:{center:Ae(i+t/2,r+n/2),angle:o,halfWidth:t/2,halfHeight:n/2}}},mn=e=>{if(!e)return[];for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},Vl=(e,t=Ae(0,0),n,o)=>{let i=l=>Ht(Ae(l[0]+t[0],l[1]+t[1]),o,n),r=mn(e),s=[],a=Ae(0,0);for(let l of r){if(l.op==="move"){let d=em(l.data);Kh(d!=null,"Ops data is not a point"),a=i(d)}if(l.op==="bcurveTo"){let d=i(Ae(l.data[0],l.data[1])),c=i(Ae(l.data[2],l.data[3])),u=i(Ae(l.data[4],l.data[5]));s.push(Qh(a,d,c,u)),a=u}}return{type:"polycurve",data:s}},rm=e=>{let t=e[0],n=[];for(let o=1;o<e.length;o++){let i=e[o];n.push(Jh(t,i)),t=i}return n},Xl=(e,t,n=!1)=>{let o=r=>Ht(tm(om(im(r),nm(e.x,e.y))),t,e.angle),i=rm(e.points.map(r=>o(r)));return n?{type:"polygon",data:xs(i.flat())}:{type:"polyline",data:i}},Yl=(e,t,n=Ae(0,0),o,i)=>{let r=c=>Ht(Ae(c[0]+n[0],c[1]+n[1]),i,o);if(e.roundness===null)return{type:"polygon",data:xs(e.points.map(c=>r(c)))};let s=mn(t),a=[],l=!1;for(let c of s)c.op==="move"?(l=!l,l&&a.push(Ae(c.data[0],c.data[1]))):c.op==="bcurveTo"?l&&(a.push(Ae(c.data[0],c.data[1])),a.push(Ae(c.data[2],c.data[3])),a.push(Ae(c.data[4],c.data[5]))):c.op==="lineTo"&&l&&a.push(Ae(c.data[0],c.data[1]));let d=Ft(a,10,5).map(c=>r(c));return{type:"polygon",data:xs(d)}};S();S();function $l(e,t,n,o=i=>i){return e*o(.5-t*(.5-n))}function sm(e){return[-e[0],-e[1]]}function zt(e,t){return[e[0]+t[0],e[1]+t[1]]}function Bt(e,t){return[e[0]-t[0],e[1]-t[1]]}function _t(e,t){return[e[0]*t,e[1]*t]}function am(e,t){return[e[0]/t,e[1]/t]}function ii(e){return[e[1],-e[0]]}function Zl(e,t){return e[0]*t[0]+e[1]*t[1]}function lm(e,t){return e[0]===t[0]&&e[1]===t[1]}function dm(e){return Math.hypot(e[0],e[1])}function cm(e){return e[0]*e[0]+e[1]*e[1]}function ql(e,t){return cm(Bt(e,t))}function Jl(e){return am(e,dm(e))}function um(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ri(e,t,n){let o=Math.sin(n),i=Math.cos(n),r=e[0]-t[0],s=e[1]-t[1],a=r*i-s*o,l=r*o+s*i;return[a+t[0],l+t[1]]}function ys(e,t,n){return zt(e,_t(Bt(t,e),n))}function Kl(e,t,n){return zt(e,_t(t,n))}var{min:Io,PI:pm}=Math,Ql=.275,si=pm+1e-4;function hm(e,t={}){let{size:n=16,smoothing:o=.5,thinning:i=.5,simulatePressure:r=!0,easing:s=B=>B,start:a={},end:l={},last:d=!1}=t,{cap:c=!0,easing:u=B=>B*(2-B)}=a,{cap:h=!0,easing:m=B=>--B*B*B+1}=l;if(e.length===0||n<=0)return[];let g=e[e.length-1].runningLength,f=a.taper===!1?0:a.taper===!0?Math.max(n,g):a.taper,E=l.taper===!1?0:l.taper===!0?Math.max(n,g):l.taper,x=Math.pow(n*o,2),y=[],b=[],M=e.slice(0,10).reduce((B,I)=>{let C=I.pressure;if(r){let G=Io(1,I.distance/n),z=Io(1,1-G);C=Io(1,B+(z-B)*(G*Ql))}return(B+C)/2},e[0].pressure),w=$l(n,i,e[e.length-1].pressure,s),v,k=e[0].vector,T=e[0].point,A=T,_=T,D=A,O=!1;for(let B=0;B<e.length;B++){let{pressure:I}=e[B],{point:C,vector:G,distance:z,runningLength:Z}=e[B];if(B<e.length-1&&g-Z<3)continue;if(i){if(r){let ne=Io(1,z/n),ie=Io(1,1-ne);I=Io(1,M+(ie-M)*(ne*Ql))}w=$l(n,i,I,s)}else w=n/2;v===void 0&&(v=w);let $=Z<f?u(Z/f):1,V=g-Z<E?m((g-Z)/E):1;w=Math.max(.01,w*Math.min($,V));let Y=(B<e.length-1?e[B+1]:e[B]).vector,ue=B<e.length-1?Zl(G,Y):1,q=Zl(G,k)<0&&!O,me=ue!==null&&ue<0;if(q||me){let ne=_t(ii(k),w);for(let ie=1/13,Ie=0;Ie<=1;Ie+=ie)_=ri(Bt(C,ne),C,si*Ie),y.push(_),D=ri(zt(C,ne),C,si*-Ie),b.push(D);T=_,A=D,me&&(O=!0);continue}if(O=!1,B===e.length-1){let ne=_t(ii(G),w);y.push(Bt(C,ne)),b.push(zt(C,ne));continue}let ke=_t(ii(ys(Y,G,ue)),w);_=Bt(C,ke),(B<=1||ql(T,_)>x)&&(y.push(_),T=_),D=zt(C,ke),(B<=1||ql(A,D)>x)&&(b.push(D),A=D),M=I,k=G}let N=e[0].point.slice(0,2),W=e.length>1?e[e.length-1].point.slice(0,2):zt(e[0].point,[1,1]),j=[],L=[];if(e.length===1){if(!(f||E)||d){let B=Kl(N,Jl(ii(Bt(N,W))),-(v||w)),I=[];for(let C=1/13,G=C;G<=1;G+=C)I.push(ri(B,N,si*2*G));return I}}else{if(!(f||E&&e.length===1))if(c)for(let I=1/13,C=I;C<=1;C+=I){let G=ri(b[0],N,si*C);j.push(G)}else{let I=Bt(y[0],b[0]),C=_t(I,.5),G=_t(I,.51);j.push(Bt(N,C),Bt(N,G),zt(N,G),zt(N,C))}let B=ii(sm(e[e.length-1].vector));if(E||f&&e.length===1)L.push(W);else if(h){let I=Kl(W,B,w);for(let C=1/29,G=C;G<1;G+=C)L.push(ri(I,W,si*3*G))}else L.push(zt(W,_t(B,w)),zt(W,_t(B,w*.99)),Bt(W,_t(B,w*.99)),Bt(W,_t(B,w)))}return y.concat(L,b.reverse(),j)}function bs(e,t={}){var n;let{streamline:o=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let s=.15+(1-o)*.85,a=Array.isArray(e[0])?e:e.map(({x:m,y:g,pressure:f=.5})=>[m,g,f]);if(a.length===2){let m=a[1];a=a.slice(0,-1);for(let g=1;g<5;g++)a.push(ys(a[0],m,g/4))}a.length===1&&(a=[...a,[...zt(a[0],[1,1]),...a[0].slice(2)]]);let l=[{point:[a[0][0],a[0][1]],pressure:a[0][2]>=0?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,c=0,u=l[0],h=a.length-1;for(let m=1;m<a.length;m++){let g=r&&m===h?a[m].slice(0,2):ys(u.point,a[m],s);if(lm(u.point,g))continue;let f=um(g,u.point);if(c+=f,m<h&&!d){if(c<i)continue;d=!0}u={point:g,pressure:a[m][2]>=0?a[m][2]:.5,vector:Jl(Bt(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 ed(e,t={}){return hm(bs(e,t),t)}S();S();S();function Te([e,t,n],[o,i,r]){return[e+o,t+i,n+r]}function So([e,t,n],[o,i,r]){return[e-o,t-i,n-r]}function Fe([e,t,n],o){return[e*o,t*o,n*o]}function ro([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function je([e,t,n],o){return[Math.cos(o)*e-Math.sin(o)*t,Math.sin(o)*e+Math.cos(o)*t,n]}function td(e,t,n){return Te(e,Fe(So(t,e),n))}function ws(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 Ms(e){return Math.atan2(Math.sin(e),Math.cos(e))}function Ps([e,t]){return Math.sqrt(e**2+t**2)}function io([e,t],[n,o]){return Math.sqrt((n-e)**2+(o-t)**2)}function nd(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=io(e[n-1],e[n]);return t+=io(e[e.length-2],e[e.length-1]),t}var mm=(e,t,n)=>Math.max(t,Math.min(n,e));function od(e,t,n){let o=io(t,n);if(o===0)return io(e,t);let i=mm(((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 io(r,e)}S();function ai(e,t){if(t===0||e.length<=2)return e;let n=e[0],o=e[e.length-1],[i,r]=e.reduce(([s,a],l,d)=>{let c=od(l,n,o);return c>s?[c,d]:[s,a]},[0,-1]);if(i>=t){let s=e[r];return[...ai([n,...e.slice(1,r),s],t).slice(0,-1),s,...ai([s,...e.slice(r,-1),o],t).slice(1)]}return[n,o]}var qi=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=td(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),nd(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=ai(n,this.options.simplify));let o=n.length;if(o===0)return[];if(o===1){let k=n[0],T=this.getSize(t,k[2],0,o,0);if(T<.5)return[];let A=[];for(let _=0;_<=Math.PI*2;_+=Math.PI/16)A.push(Te(k,Fe(je([1,0,0],_),T)));return A.push(Te(k,Fe([1,0,0],this.getSize(t,k[2],0,o,0)))),A}if(o===2){let k=n[0],T=n[1],A=this.getSize(t,k[2],0,o,0),_=this.getSize(t,T[2],0,o,0);if(A<.5||_<.5)return[];let D=[],O=ws(k,[k[0],k[1]-100,k[2]],T);for(let N=O;N<=Math.PI+O;N+=Math.PI/16)D.push(Te(k,Fe(je([1,0,0],N),A)));for(let N=Math.PI+O;N<=Math.PI*2+O;N+=Math.PI/16)D.push(Te(T,Fe(je([1,0,0],N),_)));return D.push(D[0]),D}let i=[],r=[],s=0,a=0,l=0,d=0;for(let k=1;k<o-1;k++){let T=n[k-1],A=n[k],_=n[k+1],D=A[2],O=io(T,A);d+=O,s=a+(O-a)*.2;let N=this.getSize(t,D,k,o,d);if(N===0){l=k+1;continue}let W=ro(So(T,A)),j=ro(So(_,A)),L=je(W,Math.PI/2),B=je(W,-Math.PI/2),I=je(j,Math.PI/2),C=je(j,-Math.PI/2),G=Te(A,Fe(L,N)),z=Te(A,Fe(B,N)),Z=Te(A,Fe(I,N)),$=Te(A,Fe(C,N)),V=Te(L,C),Y=Te(B,I),ue=Te(A,Fe(Ps(V)===0?W:ro(V),N)),q=Te(A,Fe(Ps(Y)===0?j:ro(Y),N)),me=Ms(ws(A,T,_)),ke=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(s);if(Math.abs(me)<ke){let ne=Math.abs(Ms(Math.PI-me));if(ne===0)continue;if(me<0){r.push(z,q);for(let ie=0;ie<=ne;ie+=ne/4)i.push(Te(A,je(Fe(L,N),ie)));for(let ie=ne;ie>=0;ie-=ne/4)r.push(Te(A,je(Fe(L,N),ie)));r.push(q,Z)}else{i.push(G,ue);for(let ie=0;ie<=ne;ie+=ne/4)r.push(Te(A,je(Fe(L,-N),-ie)));for(let ie=ne;ie>=0;ie-=ne/4)i.push(Te(A,je(Fe(L,-N),-ie)));i.push(ue,$)}}else i.push(ue),r.push(q);a=s}if(l>=o-2){if(this.options.keepHead){let k=n[o-1],T=[];for(let A=0;A<=Math.PI*2;A+=Math.PI/16)T.push(Te(k,Fe(je([1,0,0],A),this.options.size)));return T.push(Te(k,Fe([1,0,0],this.options.size))),T}return[]}let c=n[l],u=n[l+1],h=n[o-2],m=n[o-1],g=ro(So(u,c)),f=ro(So(h,m)),E=je(g,-Math.PI/2),x=je(f,Math.PI/2),y=this.getSize(t,c[2],0,o,0),b=[],M=this.options.keepHead?this.options.size:this.getSize(t,h[2],o-2,o,d),w=[];if(y>.1){for(let k=0;k<=Math.PI;k+=Math.PI/16)b.unshift(Te(c,je(Fe(E,y),-k)));b.unshift(Te(c,Fe(E,-y)))}else b.push(c);for(let k=0;k<=Math.PI*3;k+=Math.PI/16)w.push(Te(m,je(Fe(x,-M),-k)));let v=[...b,...i,...w.reverse(),...r.reverse()];return b.length>0&&v.push(b[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?ai(v,this.options.simplify):v}};import{pointFrom as De,pointDistance as hu,pointRotateRads as In}from"@excalidraw/math";import{ROUGHNESS as Y0,THEME as Na,isTransparent as vi,assertNever as $0,COLOR_PALETTE as Z0,LINE_POLYGON_POINT_MERGE_DISTANCE as q0,applyDarkModeFilter as ki,DEFAULT_STROKE_STREAMLINE as K0}from"@excalidraw/common";S();import{isRightAngleRads as N0,lineSegment as lu,pointFrom as Dr,pointRotateRads as Ca}from"@excalidraw/math";import{BOUND_TEXT_PADDING as Yn,DEFAULT_REDUCED_GLOBAL_ALPHA as O0,ELEMENT_READY_TO_ERASE_OPACITY as R0,FRAME_STYLE as Br,DARK_THEME_FILTER as F0,MIME_TYPES as Ba,THEME as Ho,distance as $n,getFontString as H0,isRTL as _0,getVerticalOffset as z0,invariant as W0,applyDarkModeFilter as Nr,isSafari as U0}from"@excalidraw/common";S();import{pointFrom as fn,pointCenter as gm,pointRotateRads as Ln,vectorFromPoint as Is,vectorNormalize as id,vectorSubtract as rd,vectorAdd as Ki,vectorScale as Qi,pointFromVector as sd,clamp as Ze,isCloseTo as ad}from"@excalidraw/math";var qe=10,Tw=(e,t,n,o,i,r,s,a)=>{let{width:l,height:d}=Ss(e),c=o/l,u=i/d,h=(e.crop?.x??0)/c,m=(e.crop?.y??0)/u,g=Ln(fn(r,s),fe(e,t),-e.angle);r=g[0],s=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,b=x.width,M=e.scale[0]===-1,w=e.scale[1]===-1,v=s-e.y,k=r-e.x;n.includes("n")&&(E=Ze(e.height-v,qe,w?d-m:e.height+m)),n.includes("s")&&(v=s-e.y-e.height,E=Ze(e.height+v,qe,w?e.height+m:d-m)),n.includes("e")&&(k=r-e.x-e.width,f=Ze(e.width+k,qe,M?e.width+h:l-h)),n.includes("w")&&(f=Ze(e.width-k,qe,M?l-h:e.width+h));let T=D=>{D.height=E*u,D.width=f*c};T(x);let A=(D,O)=>{T(O),D.includes("n")&&(w||(O.y+=y-O.height)),D.includes("s")&&w&&(O.y+=y-O.height),D.includes("e")&&M&&(O.x+=b-O.width),D.includes("w")&&(M||(O.x+=b-O.width))};switch(n){case"n":{if(a){let D=h+e.width/2,O=l-h-e.width/2,N=Math.min(D,O)*2;f=Ze(E*a,qe,N),E=f/a}A(n,x),a&&(x.x+=(b-x.width)/2);break}case"s":{if(a){let D=h+e.width/2,O=l-h-e.width/2,N=Math.min(D,O)*2;f=Ze(E*a,qe,N),E=f/a}A(n,x),a&&(x.x+=(b-x.width)/2);break}case"w":{if(a){let D=m+e.height/2,O=d-m-e.height/2,N=Math.min(D,O)*2;E=Ze(f/a,qe,N),f=E*a}A(n,x),a&&(x.y+=(y-x.height)/2);break}case"e":{if(a){let D=m+e.height/2,O=d-m-e.height/2,N=Math.min(D,O)*2;E=Ze(f/a,qe,N),f=E*a}A(n,x),a&&(x.y+=(y-x.height)/2);break}case"ne":{if(a)if(k>-v){let D=w?d-m:m+e.height;E=Ze(f/a,qe,D),f=E*a}else{let D=M?h+e.width:l-h;f=Ze(E*a,qe,D),E=f/a}A(n,x);break}case"nw":{if(a)if(k<v){let D=w?d-m:m+e.height;E=Ze(f/a,qe,D),f=E*a}else{let D=M?l-h:h+e.width;f=Ze(E*a,qe,D),E=f/a}A(n,x);break}case"se":{if(a)if(k>v){let D=w?m+e.height:d-m;E=Ze(f/a,qe,D),f=E*a}else{let D=M?h+e.width:l-h;f=Ze(E*a,qe,D),E=f/a}A(n,x);break}case"sw":{if(a)if(-k>v){let D=w?m+e.height:d-m;E=Ze(f/a,qe,D),f=E*a}else{let D=M?l-h:h+e.width;f=Ze(E*a,qe,D),E=f/a}A(n,x);break}default:break}let _=Em(e,n,f,E,!!a);return ad(x.width,x.naturalWidth)&&ad(x.height,x.naturalHeight)&&(x=null),{x:_[0],y:_[1],width:f,height:E,crop:x}},Em=(e,t,n,o,i)=>{let[r,s,a,l]=Dn(e,e.width,e.height,!0),d=fn(r,s),c=fn(a,l),u=gm(d,c),[h,m,g,f]=Dn(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 T=[d[0],c[1]];y=[T[0],T[1]-Math.abs(x)]}if(t==="sw"){let T=[c[0],d[1]];y=[T[0]-Math.abs(E),T[1]]}i&&(["s","n"].includes(t)&&(y[0]=u[0]-E/2),["e","w"].includes(t)&&(y[1]=u[1]-x/2));let b=e.angle,M=Ln(y,u,b),w=[y[0]+Math.abs(E)/2,y[1]+Math.abs(x)/2],v=Ln(w,u,b);y=Ln(M,v,-b);let k=[...y];return k[0]+=e.x-h,k[1]+=e.y-m,k},ld=(e,t)=>{if(e.crop){let{width:n,height:o}=Ss(e),[i,r,s,a,l,d]=ae(e,t),c=Is(Ln(fn(i,r),fn(l,d),e.angle)),u=Is(Ln(fn(s,r),fn(l,d),e.angle)),h=id(rd(u,c)),m=Is(Ln(fn(i,a),fn(l,d),e.angle)),g=rd(m,c),f=id(g),{cropX:E,cropY:x}=xm(e.crop,e.scale),y=Ki(Ki(c,Qi(h,-E*n/e.crop.naturalWidth)),Qi(f,-x*o/e.crop.naturalHeight)),b=sd(Ki(Ki(y,Qi(h,n/2)),Qi(f,o/2))),M=Ln(sd(y),b,-e.angle);return{...e,x:M[0],y:M[1],width:n,height:o,crop:null}}return e},Ss=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}},xm=(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}},Cw=(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,s=n.y;if(o&&(r=n.naturalWidth-n.width-n.x),i&&(s=n.naturalHeight-n.height-n.y),t)return{x:r,y:s};let{width:a,height:l}=Ss(e);return{x:r/(n.naturalWidth/a),y:s/(n.naturalHeight/l)}};S();import{pointCenter as Vc,pointFrom as X,pointRotateRads as ct,pointsEqual as Xc,pointDistance as fo,vectorFromPoint as qf,curveLength as Kf,curvePointAtLength as Qf}from"@excalidraw/math";import{DRAGGING_THRESHOLD as Jf,KEYS as ho,shouldRotateWithDiscreteAngle as mo,getGridPoint as Yc,invariant as wt,isShallowEqual as e0,getFeatureFlag as Fo}from"@excalidraw/common";S();import{arrayToMap as cc,getFeatureFlag as K1,getGridPoint as la,invariant as Pn,isTransparent as Q1}from"@excalidraw/common";import{PRECISION as J1,clamp as Ir,lineSegment as Bo,pointDistance as Hn,pointDistanceSq as Lt,pointFrom as de,pointFromArray as ef,pointFromVector as Mr,pointRotateRads as ve,pointsEqual as tf,vectorFromPoint as Go,vectorNormalize as aa,vectorScale as Pr}from"@excalidraw/math";S();import{invariant as Fd,isTransparent as Hd}from"@excalidraw/common";import{curveIntersectLineSegment as _d,isPointWithinBounds as Vs,lineSegment as fi,lineSegmentIntersectionPoints as zd,pointFrom as _e,pointFromVector as g1,pointRotateRads as At,pointsEqual as Wd,vectorFromPoint as E1,vectorNormalize as x1,vectorScale as y1}from"@excalidraw/math";import{ellipse as b1,ellipseSegmentInterceptPoints as w1}from"@excalidraw/math/ellipse";S();import{DEFAULT_ADAPTIVE_RADIUS as vm,DEFAULT_PROPORTIONAL_RADIUS as ks,invariant as km,LINE_CONFIRM_THRESHOLD as Am,ROUNDNESS as As}from"@excalidraw/common";import{bezierEquation as Tm,curve as gn,curveCatmullRomCubicApproxPoints as yd,curveOffsetPoints as bd,lineSegment as Ue,lineSegmentIntersectionPoints as Ed,pointDistance as so,pointFrom as Q,pointFromArray as Cm,pointFromVector as Lm,pointRotateRads as St,pointTranslate as xd,rectangle as Dm,vectorFromPoint as wd,vectorNormalize as Bm,vectorScale as Ts}from"@excalidraw/math";S();import{ROUNDNESS as li,assertNever as ym}from"@excalidraw/common";import{pointsEqual as dd}from"@excalidraw/math";var Wt=e=>!!e&&e.type==="image"&&!!e.fileId,Ve=e=>!!e&&e.type==="image",cd=e=>!!e&&e.type==="embeddable",Ji=e=>!!e&&e.type==="iframe",er=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),pe=e=>e!=null&&e.type==="text",tr=e=>e!=null&&e.type==="frame",ud=e=>e!=null&&e.type==="magicframe",ce=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Ce=e=>e!=null&&bm(e.type),bm=e=>e==="freedraw",le=e=>e!=null&&Pm(e.type),Xe=e=>e!=null&&e.type==="line",J=e=>e!=null&&e.type==="arrow",ee=e=>J(e)&&e.elbowed,Nw=e=>J(e)&&!e.elbowed,wm=e=>J(e)&&!e.elbowed&&!e.roundness,Mm=e=>J(e)&&!e.elbowed&&e.roundness!==null,Pm=e=>e==="arrow"||e==="line",Ke=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&Im(e.type),Im=e=>e==="arrow",Le=(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),pd=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),di=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"),Sm=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||J(e)),hd=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 ym(t,null),!1}},md=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",tn=e=>Sm(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),Ne=e=>e!==null&&"containerId"in e&&e.containerId!==null&&pe(e),Ow=e=>!!e.startBinding||!!e.endBinding,nr=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",fd=e=>e==="line"||e==="arrow"||e==="diamond",Rw=(e,t)=>!!((e===li.ADAPTIVE_RADIUS||e===li.LEGACY)&&nr(t.type)||e===li.PROPORTIONAL_RADIUS&&fd(t.type)),Fw=e=>fd(e.type)?{type:li.PROPORTIONAL_RADIUS}:nr(e.type)?{type:li.ADAPTIVE_RADIUS}:null,Hw=e=>wm(e)?"sharpArrow":Mm(e)?"curvedArrow":ee(e)?"elbowArrow":"line",vs=e=>e.length>3&&dd(e[0],e[e.length-1]),gd=e=>e.length>3||e.length===3&&!dd(e[0],e[e.length-1]),_w=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 ci=new WeakMap,Cs=(e,t)=>{let n=ci.get(e);if(!n)return;let{version:o,shapes:i}=n;if(o!==e.version){ci.delete(e);return}return i.get(t)},Ls=(e,t,n)=>{let o=ci.get(e);if(!o){ci.set(e,{version:e.version,shapes:new Map([[n,t]])});return}let{version:i,shapes:r}=o;if(i!==e.version){ci.set(e,{version:e.version,shapes:new Map([[n,t]])});return}r.set(n,t)};function ao(e,t){let n=Cs(e,0);if(n)return n;let o=Pd(e,t),i=[],r=[];for(let a=0;a<o.length;a+=1){let l=o[a],d=o[a-1]&&Cm(o[a-1].data.slice(-2));switch(l.op){case"move":continue;case"lineTo":if(!d)throw new Error("prevPoint is undefined");i.push(Ue(Q(e.x+d[0],e.y+d[1]),Q(e.x+l.data[0],e.y+l.data[1])));continue;case"bcurveTo":if(!d)throw new Error("prevPoint is undefined");r.push(gn(Q(e.x+d[0],e.y+d[1]),Q(e.x+l.data[0],e.y+l.data[1]),Q(e.x+l.data[2],e.y+l.data[3]),Q(e.x+l.data[4],e.y+l.data[5])));continue;default:console.error("Unknown op type",l.op)}}let s=[i,r];return Ls(e,s,0),s}function Bn(e,t=0){let n=Cs(e,t);if(n)return n;let o=En(Math.min(e.width,e.height),e);o===0&&(o=.01);let i=Dm(Q(e.x,e.y),Q(e.x+e.width,e.y+e.height)),r=Ue(Q(i[0][0]+o,i[0][1]),Q(i[1][0]-o,i[0][1])),s=Ue(Q(i[1][0],i[0][1]+o),Q(i[1][0],i[1][1]-o)),a=Ue(Q(i[0][0]+o,i[1][1]),Q(i[1][0]-o,i[1][1])),l=Ue(Q(i[0][0],i[1][1]-o),Q(i[0][0],i[0][1]+o)),d=[gn(l[1],Q(l[1][0]+2/3*(i[0][0]-l[1][0]),l[1][1]+2/3*(i[0][1]-l[1][1])),Q(r[0][0]+2/3*(i[0][0]-r[0][0]),r[0][1]+2/3*(i[0][1]-r[0][1])),r[0]),gn(r[1],Q(r[1][0]+2/3*(i[1][0]-r[1][0]),r[1][1]+2/3*(i[0][1]-r[1][1])),Q(s[0][0]+2/3*(i[1][0]-s[0][0]),s[0][1]+2/3*(i[0][1]-s[0][1])),s[0]),gn(s[1],Q(s[1][0]+2/3*(i[1][0]-s[1][0]),s[1][1]+2/3*(i[1][1]-s[1][1])),Q(a[1][0]+2/3*(i[1][0]-a[1][0]),a[1][1]+2/3*(i[1][1]-a[1][1])),a[1]),gn(a[0],Q(a[0][0]+2/3*(i[0][0]-a[0][0]),a[0][1]+2/3*(i[1][1]-a[0][1])),Q(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=>yd(bd(m,t))):[[d[0]],[d[1]],[d[2]],[d[3]]],h=[[Ue(c[0][c[0].length-1][3],c[1][0][0]),Ue(c[1][c[1].length-1][3],c[2][0][0]),Ue(c[2][c[2].length-1][3],c[3][0][0]),Ue(c[3][c[3].length-1][3],c[0][0][0])],c.flat()];return Ls(e,h,t),h}function Md(e,t=0){let[n,o,i,r,s,a,l,d]=ko(e),c=e.roundness?En(Math.abs(n-l),e):(n-l)*.01,u=e.roundness?En(Math.abs(r-o),e):(r-o)*.01,[h,m,g,f]=[Q(e.x+n,e.y+o),Q(e.x+i,e.y+r),Q(e.x+s,e.y+a),Q(e.x+l,e.y+d)];return[gn(Q(m[0]-c,m[1]-u),m,m,Q(m[0]-c,m[1]+u)),gn(Q(g[0]+c,g[1]-u),g,g,Q(g[0]-c,g[1]-u)),gn(Q(f[0]+c,f[1]+u),f,f,Q(f[0]+c,f[1]-u)),gn(Q(h[0]-c,h[1]+u),h,h,Q(h[0]+c,h[1]+u))]}function Gn(e,t=0){let n=Cs(e,t);if(n)return n;let o=Md(e,t),i=t>0?o.map(a=>yd(bd(a,t))):[[o[0]],[o[1]],[o[2]],[o[3]]],s=[[Ue(i[0][i[0].length-1][3],i[1][0][0]),Ue(i[1][i[1].length-1][3],i[2][0][0]),Ue(i[2][i[2].length-1][3],i[3][0][0]),Ue(i[3][i[3].length-1][3],i[0][0][0])],i.flat()];return Ls(e,s,t),s}var vt=(e,t=1)=>{if(e.length>=3){let[n,o]=[e[0],e[e.length-1]];return so(n,o)<=Am/t}return!1},En=(e,t)=>{if(t.roundness?.type===As.PROPORTIONAL_RADIUS||t.roundness?.type===As.LEGACY)return e*ks;if(t.roundness?.type===As.ADAPTIVE_RADIUS){let n=t.roundness?.value??vm,o=n/ks;return e<=o?e*ks:n}return 0},Gm=(e,t)=>{let n=e.type==="rectangle"?15:0,o=a=>{let l=Bm(wd(a[1],a[0])),d=Ts(l,n);return Ue(xd(a[0],d),xd(a[1],Ts(d,-1)))},i=fe(e,t),r=o(di(e)?Ue(St(Q(e.x,e.y),i,e.angle),St(Q(e.x+e.width,e.y+e.height),i,e.angle)):Ue(St(Q(e.x+e.width/2,e.y),i,e.angle),St(Q(e.x+e.width/2,e.y+e.height),i,e.angle))),s=o(di(e)?Ue(St(Q(e.x+e.width,e.y),i,e.angle),St(Q(e.x,e.y+e.height),i,e.angle)):Ue(St(Q(e.x,e.y+e.height/2),i,e.angle),St(Q(e.x+e.width,e.y+e.height/2),i,e.angle)));return[r,s]},or=(e,t,n,o)=>{let i=fe(t,n);return(t.type==="diamond"?Md(t).map(a=>{let l=Tm(a,.5),d=St(l,i,t.angle);return Q(d[0],d[1])}):[St(Q(t.x+t.width,t.y+t.height/2),i,t.angle),St(Q(t.x+t.width/2,t.y+t.height),i,t.angle),St(Q(t.x,t.y+t.height/2),i,t.angle),St(Q(t.x+t.width/2,t.y),i,t.angle)]).find(a=>so(e,a)<=Ut(o)+t.strokeWidth/2&&!nn({point:e,element:t,threshold:0,elementsMap:n,overrideShouldTestInside:!0}))},vo=(e,t,n,o,i,r,s=!0)=>{if(km(e.points.length>=2,"Arrow must have at least two points"),e.width<3&&e.height<3)return null;if(s){let x=or(t,n,i,r);if(x)return x}let[a,l]=Gm(n,i),d=U.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),b=x&&y&&Qe(Je(x.fixedPoint),y,i);b&&(d=b)}let c=Lm(Ts(wd(t,d),2*so(d,t)+Math.max(so(a[0],a[1]),so(l[0],l[1]))),d),u=Ue(c,d),h=Ed(a,u),m=Ed(l,u),g=h&&so(d,h),f=m&&so(d,m),E=null;return g!=null&&f!=null?E=g<f?h:m:E=h||m||null,E&&ft(E,n,i)?E:null};S();import{ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO as o1,ARROW_LABEL_WIDTH_FRACTION as i1,BOUND_TEXT_PADDING as on,DEFAULT_FONT_SIZE as r1,TEXT_ALIGN as Cd,VERTICAL_ALIGN as Ld,getFontString as dr,isProdEnv as s1,invariant as a1}from"@excalidraw/common";import{pointFrom as Dd,pointRotateRads as l1}from"@excalidraw/math";S();var ui={},Id=(e,t)=>{let n=ui[e]||(ui[e]={height:t});return n.height=t,n},Sd=e=>{ui[e]&&delete ui[e]},e3=e=>ui[e]?.height??null;S();import{BOUND_TEXT_PADDING as rr,DEFAULT_FONT_SIZE as Nm,DEFAULT_FONT_FAMILY as Om,getFontString as Rm,isTestEnv as Fm,normalizeEOL as Hm}from"@excalidraw/common";var kt=(e,t,n)=>{let o=e.split(`
|
|
2
2
|
`).map(a=>a||" ").join(`
|
|
3
|
-
`),i=parseFloat(t),r=
|
|
4
|
-
`),e,t).width+
|
|
5
|
-
`),
|
|
6
|
-
`),
|
|
7
|
-
`).map(n=>{let o=t,i=o+n.length;return t=i+1,{text:n,start:o,end:i}})},
|
|
8
|
-
`))
|
|
3
|
+
`),i=parseFloat(t),r=_m(o,i,n);return{width:Td(o,t),height:r}},vd="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),kd=(e,t)=>{let n=zm(e);return n===0?kt(vd.split("").join(`
|
|
4
|
+
`),e,t).width+rr*2:n+rr*2},sr=(e,t)=>kt("",e,t).width+rr*2,i3=()=>Td(vd,Rm({fontSize:Nm,fontFamily:Om}))>0,pi=e=>Hm(e).replace(/\t/g," "),Bs=e=>pi(e).split(`
|
|
5
|
+
`),r3=e=>{let t=Bs(e.text).length;return e.height/t/e.fontSize},ar=(e,t)=>e*t,Ad=(e,t)=>ar(e,t)+rr*2,ir,s3=e=>{ir=e},Ds=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 Fm()?r*10:r}},Nn=(e,t)=>(ir||(ir=new Ds),ir.getLineWidth(e,t)),Td=(e,t)=>{let n=Bs(e),o=0;return n.forEach(i=>{o=Math.max(o,Nn(i,t))}),o},_m=(e,t,n)=>{let o=Bs(e).length;return ar(t,n)*o},Ao=(()=>{let e={};return{calculate:(i,r)=>{let s=i.charCodeAt(0);if(e[r]||(e[r]=[]),!e[r][s]){let a=Nn(i,r);e[r][s]=a}return e[r][s]},getCache:i=>e[i],clearCache:i=>{e[i]=[]}}})(),a3=e=>{let t=Ao.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.min(...n)},zm=e=>{let t=Ao.getCache(e);if(!t)return 0;let n=t.filter(o=>o!==void 0);return Math.max(...n)};S();import{isDevEnv as Wm,isTestEnv as Um}from"@excalidraw/common";var Gs,lr,Ns,p3=e=>(Gs||(Gs=xe.class(...Object.values(xn))),Gs.test(e)),jm=()=>{if(!lr)try{lr=Xm()}catch{lr=Vm()}return lr},Os=()=>(Ns||(Ns=Ym()),Ns),Gt={WHITESPACE:/\s/u,HYPHEN:/-/u,OPENING:/<\(\[\{/u,CLOSING:/>\)\]\}.,:;!\?…\//u},xn={CHAR:/\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}`'^〃〰〆#&*+-ー/\=|¦〒¬ ̄/u,OPENING:/([{〈《⦅「「『【〖〔〘〚<〝/u,CLOSING:/)]}〉》⦆」」』】〗〕〙〛>。.,、〟‥?!:;・〜〞/u,CURRENCY:/¥₩£¢$/u},lo={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},Vm=()=>xe.or(Os(),Oe.On(Gt.HYPHEN,Gt.WHITESPACE,xn.CHAR)),Xm=()=>xe.or(Os(),Oe.Before(Gt.WHITESPACE).Build(),Oe.After(Gt.WHITESPACE,Gt.HYPHEN).Build(),Oe.Before(xn.CHAR,xn.CURRENCY).NotPrecededBy(Gt.OPENING,xn.OPENING).Build(),Oe.After(xn.CHAR).NotFollowedBy(Gt.HYPHEN,Gt.CLOSING,xn.CLOSING).Build(),Oe.BeforeMany(xn.OPENING).NotPrecededBy(Gt.OPENING).Build(),Oe.AfterMany(xn.CLOSING).NotFollowedBy(Gt.CLOSING).Build(),Oe.AfterMany(Gt.CLOSING).FollowedBy(Gt.OPENING).Build()),Ym=()=>xe.group(xe.or(lo.FLAG,xe.and(lo.MOST,lo.JOINER,xe.build(`(?:${lo.ZWJ.source}(?:${lo.FLAG.source}|${lo.ANY.source}${lo.JOINER.source}))*`)))),xe={build:e=>new RegExp(e,"u"),join:(...e)=>e.map(t=>t.source).join(""),and:(...e)=>xe.build(xe.join(...e)),or:(...e)=>xe.build(e.map(t=>t.source).join("|")),group:(...e)=>xe.build(`(${xe.join(...e)})`),class:(...e)=>xe.build(`[${xe.join(...e)}]`)},Oe={On:(...e)=>{let t=xe.join(...e);return xe.build(`([${t}])`)},Before:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?=[${t}])`);return Oe.Chain(n)},After:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?<=[${t}])`);return Oe.Chain(n)},BeforeMany:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?<![${t}])(?=[${t}])`);return Oe.Chain(n)},AfterMany:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?<=[${t}])(?![${t}])`);return Oe.Chain(n)},NotBefore:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?![${t}])`);return Oe.Chain(n)},NotAfter:(...e)=>{let t=xe.join(...e),n=()=>xe.build(`(?<![${t}])`);return Oe.Chain(n)},Chain:e=>({Build:e,PreceededBy:(...t)=>{let n=e(),o=Oe.After(...t).Build(),i=()=>xe.and(o,n);return Oe.Chain(i)},FollowedBy:(...t)=>{let n=e(),o=Oe.Before(...t).Build(),i=()=>xe.and(n,o);return Oe.Chain(i)},NotPrecededBy:(...t)=>{let n=e(),o=Oe.NotAfter(...t).Build(),i=()=>xe.and(o,n);return Oe.Chain(i)},NotFollowedBy:(...t)=>{let n=e(),o=Oe.NotBefore(...t).Build(),i=()=>xe.and(n,o);return Oe.Chain(i)}})},$m=e=>{let t=jm();return e.normalize("NFC").split(t).filter(Boolean)},yn=(e,t,n)=>qm(e,t,n).map(o=>o.text).join(`
|
|
6
|
+
`),Zm=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}})},qm=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return Zm(e);let o=[],i=0;for(let r of e.split(`
|
|
8
|
+
`))Nn(r,t)<=n?o.push({text:r,start:i,end:i+r.length}):o.push(...Km(r,t,n,i)),i+=r.length+1;return o},Km=(e,t,n,o)=>{let i=[],r=$m(e),s="",a=o,l=o,d=0,c=o,u=0;for(;u<r.length;){let h=r[u],m=c,g=m+h.length,f=s+h,E=t1(h)?d+Ao.calculate(h,t):Nn(f,t);if(/\s/.test(h)||E<=n){s||(a=m),s=f,l=g,d=E,c=g,u++;continue}if(s)i.push(e1(s,a,l)),s="",a=m,l=m,d=0;else{let x=Qm(h,t,n,m),y=x[x.length-1]??{text:"",start:m,end:m},b=x.slice(0,-1);i.push(...b),s=y.text,a=y.start,l=y.end,d=Nn(y.text,t),c=g,u++}}if(s){let h=Jm(s,a,l,t,n);i.push(h)}return i},Qm=(e,t,n,o)=>{if(Os().test(e))return[{text:e,start:o,end:o+e.length}];n1(e);let i=[],r=Array.from(e),s="",a=o,l=o,d=0,c=o;for(let u of r){let h=c,m=h+u.length,g=Ao.calculate(u,t),f=d+g;if(f<=n){s||(a=h),s=s+u,l=m,d=f,c=m;continue}s&&i.push({text:s,start:a,end:l}),s=u,a=h,l=m,d=g,c=m}return s&&i.push({text:s,start:a,end:l}),i},Jm=(e,t,n,o,i)=>{if(!(Nn(e,o)>i))return{text:e,start:t,end:n};let[,s,a]=e.match(/^(.+?)(\s+)$/)??[e,e.trimEnd(),""],l=Nn(s,o);for(let d of Array.from(a)){let c=Ao.calculate(d,o),u=l+c;if(u>i)break;s=s+d,l=u}return{text:s,start:t,end:n-(e.length-s.length)}},e1=(e,t,n)=>{let o=e.trimEnd();return{text:o,start:t,end:n-(e.length-o.length)}},t1=e=>e.codePointAt(0)!==void 0&&e.codePointAt(1)===void 0,n1=e=>{if((Um()||Wm())&&/\s/.test(e))throw new Error("Word should not contain any whitespaces!")};var cr=(e,t,n)=>{let o=n.getNonDeletedElementsMap(),i;s1()||a1(!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?jt(t,e):e.width,r.text=yn(e.originalText,dr(e),i));let s=kt(r.text,dr(e),e.lineHeight);if(e.autoResize&&(r.width=s.width),r.height=s.height,t){let a=mi(t,e),l=jt(t,e);if(!J(t)&&s.height>a){let h=Rs(s.height,t.type);n.mutateElement(t,{height:h}),Id(t.id,h)}if(s.width>l){let h=Rs(s.width,t.type);n.mutateElement(t,{width:h})}let d={...e,...r},{x:c,y:u}=hi(t,d,o);r.x=c,r.y=u}n.mutateElement(e,r)},co=(e,t,n,o=!1,i=!1)=>{let r=t.getNonDeletedElementsMap();if(!Vt(e))return;Sd(e.id);let a=he(e,r);if(a&&a.text){if(!e)return;let l=a.text,d=a.height,c=a.width,u=jt(e,a),h=mi(e,a),m=e.height;if(o||n!=="n"&&n!=="s"){l&&(l=yn(a.originalText,dr(a),u));let g=kt(l,dr(a),a.lineHeight);d=g.height,c=g.width}if(d>h){m=Rs(d,e.type);let g=m-e.height,f=n==="n"||n==="ne"||n==="nw",E=0;J(e)||(i?E=g/2:f&&(E=g)),t.mutateElement(e,{height:m,y:e.y-E})}t.mutateElement(a,{text:l,width:c,height:d}),J(e)||t.mutateElement(a,hi(e,a,r))}},hi=(e,t,n)=>{if(J(e))return U.getBoundTextElementPosition(e,t,n);let o=Fs(e),i=mi(e,t),r=jt(e,t),s,a;t.verticalAlign===Ld.TOP?a=o.y:t.verticalAlign===Ld.BOTTOM?a=o.y+(i-t.height):a=o.y+(i/2-t.height/2),t.textAlign===Cd.LEFT?s=o.x:t.textAlign===Cd.RIGHT?s=o.x+(r-t.width):s=o.x+(r/2-t.width/2);let l=e.angle??0;if(l!==0){let d=Dd(o.x+r/2,o.y+i/2),c=Dd(s+t.width/2,a+t.height/2),[u,h]=l1(c,d,l);return{x:u-t.width/2,y:h-t.height/2}}return{x:s,y:a}},Vt=e=>e?.boundElements?.length&&e?.boundElements?.find(t=>t.type==="text")?.id||null,he=(e,t)=>{if(!e)return null;let n=Vt(e);if(n){let o=t.get(n)||null;return o&&!rt(o)&&console.error("[NONDELETED][INVARIANT] Bound text element `isDeleted: true` which is not expected."),o}return null},et=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,P3=(e,t)=>{if(!J(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let n=U.getBoundTextElementCenter(e,t);return{x:n[0],y:n[1]}},Fs=e=>{let t=on,n=on;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}},I3=(e,t)=>J(t)?0:t?t.angle:e.angle,S3=(e,t,n)=>{if(J(e))return U.getBoundTextElementPosition(e,t,n)},v3=(e,t)=>e.some(n=>{if(Ne(n)){let o=et(n,t);return!J(o)}return!1}),k3=(e,t)=>e.some(n=>{if(Ne(n)){let o=et(n,t);return!J(o)}return pe(n)}),d1=new Set(["rectangle","ellipse","diamond","arrow"]),A3=e=>d1.has(e.type),Rs=(e,t)=>{e=Math.ceil(e);let n=on*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},jt=(e,t)=>{let{width:n}=e;if(J(e)){let o=(t?.fontSize??r1)*o1;return Math.max(i1*n,o)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-on*2:e.type==="diamond"?Math.round(n/2)-on*2:n-on*2},mi=(e,t)=>{let{height:n}=e;return J(e)?n-on*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-on*2:e.type==="diamond"?Math.round(n/2)-on*2:n-on*2},T3=(e,t=`
|
|
9
9
|
|
|
10
|
-
`)=>e.reduce((o,i)=>(ue(i)&&o.push(i.text),o),[]).join(t);S();import{curvePointDistance as Os,distanceToLineSegment as Rs,pointRotateRads as Fs}from"@excalidraw/math";import{ellipse as Kh,ellipseDistanceFromPoint as Qh}from"@excalidraw/math/ellipse";var nn=(e,t,n)=>{switch(e.type){case"selection":case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return Jh(e,t,n);case"diamond":return e1(e,t,n);case"ellipse":return t1(e,t,n);case"line":case"arrow":case"freedraw":return n1(e,t,n)}},Jh=(e,t,n)=>{let o=he(e,t),i=Fs(n,o,-e.angle),[r,s]=Cn(e);return Math.min(...r.map(a=>Rs(i,a)),...s.map(a=>Os(a,i)))},e1=(e,t,n)=>{let o=he(e,t),i=Fs(n,o,-e.angle),[r,s]=Bn(e);return Math.min(...r.map(a=>Rs(i,a)),...s.map(a=>Os(a,i)))},t1=(e,t,n)=>{let o=he(e,t);return Qh(Fs(n,o,-e.angle),Kh(o,e.width/2,e.height/2))},n1=(e,t,n)=>{let[o,i]=so(e,t);return Math.min(...o.map(r=>Rs(n,r)),...i.map(r=>Os(r,n)))};S();var To=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw"||e==="autoshape"||e==="bucketfill",Jw=e=>e==="rectangle"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="text"||e==="embeddable"||e==="autoshape",e3=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="autoshape",t3=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line"||e==="autoshape",n3=e=>e==="freedraw",Pd=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image",o3=e=>e==="arrow",i3=e=>e==="arrow";var lr=e=>{if(e.type==="arrow")return!1;let t=To(e.type)&&!kd(e.backgroundColor)||Jt(e)||Ki(e)||ue(e);return e.type==="line"?t&&vt(e.points):e.type==="freedraw"?t&&vt(e.points):t||Ue(e)},Hs=null,Id=null,zs=1/0,_s=!1,Sd=!1,vd=null,d1=(e,t)=>e===t||!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,en=({point:e,element:t,threshold:n,elementsMap:o,frameNameBound:i=null,overrideShouldTestInside:r=!1})=>{if(Hs&&Cd(e,Hs)&&(_s?zs<=n:zs>=n)&&r===Sd&&d1(i,vd)){let u=Id?.deref();if(u&&u.id===t.id&&u.version===t.version&&u.versionNonce===t.versionNonce)return _s}let s=i?Ws(ze(i.x-n,i.y-n),e,ze(i.x+i.width+n,i.y+i.height+n)):!1,a=be(t,o,!0);if(!Bd(e,a,t.angle,n)&&!s)return!1;let c=(r||lr(t))&&ft(e,t,o)||Ad(e,t,o,n)||s;return Hs=e,Id=new WeakRef(t),zs=n,Sd=r,vd=i,_s=c,c},Bd=(e,t,n,o=0)=>{let i=n===0?e:Tt(e,yn(t),-n);return Ws(ze(t[0]-o,t[1]-o),i,ze(t[2]+o,t[3]+o))},c1=(e,t,n,o=0)=>{let i=be(t,n,!0);return Bd(e,i,t.angle,o)},y3=(e,t)=>!en(e)&&!u1(e.point,e.element,t)&&c1(e.point,e.element,t),u1=(e,t,n)=>{let o=pe(t,n);if(!o)return!1;let i=le(t)?{...o,...W.getBoundTextElementPosition(t,o,n)}:o;return ft(e,i,n)},Gd=(e,[t,n],o,i=0)=>{let r=ze(t,n),s=!ce(e),a=Math.max(1,i),l=[t-a,n-a,t+a,n+a],d=be(e,o);if(!kt(l,d))return!1;if(e.frameId){let m=o.get(e.frameId);if(m&&ce(m)){let h=be(m,o);if(!on(r,h))return!1}}let c=gt(e,o,hi(he(e,o),r)),u=nn(e,o,r);return s?c.length===0||u<=i:c.length>0&&u<=a},dr=(e,t,n,o)=>{let i=[];for(let r=t.length-1;r>=0;--r){let s=t[r];if(Td(!s.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),De(s,!1)&&Gd(s,e,n,o)&&(i.push(s),To(s.type)&&!kd(s.backgroundColor)))break}return i},xn=(e,t,n,o)=>{let i=dr(e,t,n,o);return!i||i.length===0?null:i.length===1?i[0]:i.sort((r,s)=>s.width**2+s.height**2-(r.width**2+r.height**2)).pop()},Nd=(e,t,n,o,i)=>{let r=[];for(let a=n.length-1;a>=0;--a){let l=n[a];Td(!l.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),De(l,!1)&&Gd(l,e,o,i)&&r.push(l)}if(!r||r.length===0)return null;if(r.length===1)return r[0];let s=r.filter(a=>nn(a,o,e)<=_e(a,t)||ft(e,a,o));return s.length===0?null:s[0]},gt=(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)],s=be(e,t);if(!kt(r,s))return[];switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"selection":case"magicframe":return m1(e,t,n,o,i);case"diamond":return h1(e,t,n,o,i);case"ellipse":return f1(e,t,n,o);case"line":case"freedraw":case"arrow":return p1(e,n,t,i)}},Od=(e,t,n,o,i,r=!1)=>{for(let s of e){let a=cr(s[0],s[1],s[2],s[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(!kt(a,l))continue;let d=Ld(s,t);if(d.length>0){for(let c of d)n.push(Tt(c,o,i));if(r)return n}}return n},Rd=(e,t,n,o,i,r=!1)=>{for(let s of e){let a=Dd(s,t);if(a&&(n.push(Tt(a,o,i)),r))return n}return n},p1=(e,t,n,o=!1)=>{let[i,r]=so(e,n),s=[];for(let a of i){let l=Dd(a,t);if(l&&(s.push(l),o))return s}for(let a of r){let l=cr(a[0],a[1],a[2],a[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(!kt(l,d))continue;let c=Ld(a,t,{iterLimit:10});if(c.length>0&&(s.push(...c),o))return s}return s},m1=(e,t,n,o=0,i=!1)=>{let r=he(e,t),s=Tt(n[0],r,-e.angle),a=Tt(n[1],r,-e.angle),l=hi(s,a),[d,c]=Cn(e,o),u=[];return Rd(d,l,u,r,e.angle,i),i&&u.length>0||Od(c,l,u,r,e.angle,i),u},h1=(e,t,n,o=0,i=!1)=>{let r=he(e,t),s=Tt(n[0],r,-e.angle),a=Tt(n[1],r,-e.angle),l=hi(s,a),[d,c]=Bn(e,o),u=[];return Rd(d,l,u,r,e.angle,i),i&&u.length>0||Od(c,l,u,r,e.angle,i),u},f1=(e,t,n,o=0)=>{let i=he(e,t),r=Tt(n[0],i,-e.angle),s=Tt(n[1],i,-e.angle);return l1(a1(i,e.width/2+o,e.height/2+o),hi(r,s)).map(a=>Tt(a,i,e.angle))},Ad=(e,t,n,o=1)=>nn(t,n,e)<=o,ft=(e,t,n)=>{if((le(t)||Le(t))&&!vt(t.points))return!1;let[o,i,r,s]=be(t,n);if(!Ws(ze(o,i),e,ze(r,s)))return!1;let a=ze((o+r)/2,(i+s)/2),l=o1(s1(r1(i1(e,a,.1)),Math.max(t.width,t.height)*2),a),d=hi(e,l);return gt(t,n,d).filter((u,m,h)=>h.findIndex(g=>Cd(g,u))===m).length%2===1},js=(e,t,n)=>{let o=(s,a)=>{let{x:l,y:d,width:c,height:u,angle:m}=s,h=he(s,n);if(s.type==="diamond"){let[f,E,x,y,b,M,w,v]=vo(s);return[ze(l+f,d+E-a),ze(l+x+a,d+y),ze(l+b,d+M+a),ze(l+w-a,d+v)].map(k=>Tt(k,h,m))}if(s.type==="ellipse"){let f=l+c/2,E=d+u/2,x=c/2,y=u/2;return[ze(f,E-y-a),ze(f+x+a,E),ze(f,E+y+a),ze(f-x-a,E)].map(M=>Tt(M,h,m))}return[ze(l-a,d-a),ze(l+c+a,d-a),ze(l+c+a,d+u+a),ze(l-a,d+u+a)].map(f=>Tt(f,h,m))},i=-1*Math.max(e.width,e.height)/20;return o(e,i).every(s=>ft(s,t,n))};S();import{invariant as Fd,isDevEnv as g1,isTestEnv as E1}from"@excalidraw/common";import{pointFrom as Nn,pointFromVector as ur,pointRotateRads as pr,pointScaleFromOrigin as mr,pointsEqual as x1,triangleIncludesPoint as Vs,vectorCross as Et,vectorFromPoint as fe,vectorScale as hr}from"@excalidraw/math";var Se=[1,0],We=[0,1],Xe=[-1,0],st=[0,-1],rn=e=>{let[t,n]=e,o=Math.abs(t),i=Math.abs(n);return t>i?Se:t<=-i?Xe:n>o?We:st},xt=(e,t)=>rn(fe(e,t)),Ut=(e,t)=>yt(xt(e,t)),Pe=(e,t)=>e[0]===t[0]&&e[1]===t[1],yt=e=>Pe(e,Se)||Pe(e,Xe),S3=e=>!yt(e),y1=(e,t,n)=>{let o=yn(t);(g1()||E1())&&(Fd(e.width>0&&e.height>0,"Diamond element has no width or height"),Fd(!x1(o,n),"The point is too close to the element mid point to determine heading"));let i=.95,r=ur(hr(fe(pr(Nn(e.x+e.width/2,e.y),o,e.angle),o),i),o),s=ur(hr(fe(pr(Nn(e.x+e.width,e.y+e.height/2),o,e.angle),o),i),o),a=ur(hr(fe(pr(Nn(e.x+e.width/2,e.y+e.height),o,e.angle),o),i),o),l=ur(hr(fe(pr(Nn(e.x,e.y+e.height/2),o,e.angle),o),i),o);if(Et(fe(n,r),fe(r,s))<=0&&Et(fe(n,r),fe(r,l))>0)return xt(r,o);if(Et(fe(n,s),fe(s,a))<=0&&Et(fe(n,s),fe(s,r))>0)return xt(s,o);if(Et(fe(n,a),fe(a,l))<=0&&Et(fe(n,a),fe(a,s))>0)return xt(a,o);if(Et(fe(n,l),fe(l,r))<=0&&Et(fe(n,l),fe(l,a))>0)return xt(l,o);if(Et(fe(n,o),fe(r,o))<=0&&Et(fe(n,o),fe(s,o))>0){let c=e.width>e.height?r:s;return xt(c,o)}else if(Et(fe(n,o),fe(s,o))<=0&&Et(fe(n,o),fe(a,o))>0){let c=e.width>e.height?a:s;return xt(c,o)}else if(Et(fe(n,o),fe(a,o))<=0&&Et(fe(n,o),fe(l,o))>0){let c=e.width>e.height?a:l;return xt(c,o)}let d=e.width>e.height?r:l;return xt(d,o)},ko=(e,t,n)=>{let i=yn(t);if(e.type==="diamond")return y1(e,t,n);let r=mr(Nn(t[0],t[1]),i,2),s=mr(Nn(t[2],t[1]),i,2),a=mr(Nn(t[0],t[3]),i,2),l=mr(Nn(t[2],t[3]),i,2);return Vs([r,s,i],n)?st:Vs([s,l,i],n)?Se:Vs([l,a,i],n)?We:Xe},Us=e=>[e[0]===0?0:e[0]>0?-1:1,e[1]===0?0:e[1]>0?-1:1];S();import{getSizeFromPoints as R1,randomInteger as na,getUpdatedTimestamp as oa}from"@excalidraw/common";S();import{clamp as fr,pointDistance as $s,pointFrom as re,pointScaleFromOrigin as b1,pointsEqual as gi,pointTranslate as Xs,vector as sn,vectorCross as gr,vectorFromPoint as Zs,vectorScale as w1}from"@excalidraw/math";import{BinaryHeap as M1,invariant as Lo,isAnyTrue as P1,getSizeFromPoints as Hd,isDevEnv as I1,arrayToMap as S1}from"@excalidraw/common";var qs=1,xe=40,v1=(e,t)=>{let n=e.fixedSegments?e.fixedSegments.slice():null;if(n){let o=[];e.points.map(s=>re(e.x+s[0],e.y+s[1])).forEach((s,a,l)=>{if(a<2)return o.push(s);let d=xt(s,l[a-1]),c=xt(l[a-1],l[a-2]);if(Pe(d,c)){let u=n?.findIndex(h=>h.index===a-1)??-1,m=n?.findIndex(h=>h.index===a)??-1;m!==-1&&(n[m].start=re(l[a-2][0]-e.x,l[a-2][1]-e.y)),u!==-1&&n.splice(u,1),o.splice(-1,1),n.forEach(h=>{h.index>a-1&&(h.index-=1)})}return o.push(s)});let i=[];o.forEach((s,a,l)=>{if(a<3)return i.push(s);if($s(l[a-2],l[a-1])<qs){let d=n?.findIndex(m=>m.index===a-2)??-1,c=n?.findIndex(m=>m.index===a-1)??-1;c!==-1&&n.splice(c,1),d!==-1&&n.splice(d,1),i.splice(-2,2),n.forEach(m=>{m.index>a-2&&(m.index-=2)});let u=Ut(s,l[a-1]);return i.push(re(u?s[0]:l[a-2][0],u?l[a-2][1]:s[1]))}i.push(s)});let r=n.filter(s=>s.index!==1&&s.index!==i.length-1);return r.length===0?bn(Js(ea(Qs(e,Ks(e,t,i.map(s=>re(s[0]-e.x,s[1]-e.y))))??[])),r,null,null):(I1()&&Lo(Yd(i),"Invalid elbow points with fixed segments"),bn(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}},A1=(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 s=e.fixedSegments[r].index,a=e.fixedSegments[r-1],l=e.fixedSegments[r+1],d=e.x+(a?a.end[0]:0),c=e.y+(a?a.end[1]:0),u=a?null:e.startBinding,m=l?null:e.endBinding,{startHeading:h,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...b}=Ks({x:d,y:c,startBinding:u,endBinding:m,startArrowhead:null,endArrowhead:null,points:e.points},n,[re(0,0),re(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}=bn(Js(ea(Qs(e,{startHeading:h,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...b})??[])),t,null,null);if(!M||M.length<2)throw new Error("Property 'points' is required in the update returned by normalizeArrowElementUpdate()");let w=[];if(a)for(let T=0;T<a.index;T++)w.push(re(e.x+e.points[T][0],e.y+e.points[T][1]));if(M.forEach(T=>{w.push(re(e.x+(a?a.end[0]:0)+T[0],e.y+(a?a.end[1]:0)+T[1]))}),l)for(let T=l.index;T<e.points.length;T++)w.push(re(e.x+e.points[T][0],e.y+e.points[T][1]));let v=(l?.index??e.points.length)-(a?.index??0)-1,A=t.map(T=>T.index>s?{...T,index:T.index-v+(M.length-1)}:T),k=w.flatMap((T,z)=>{let C=w[z-1],O=w[z+1];if(C&&O){let N=xt(T,C),j=xt(O,T);if(Pe(N,j))return A.forEach(V=>{V.index>z&&(V.index-=1)}),[];if(Pe(N,Us(j)))return A.forEach(V=>{V.index>z&&(V.index+=1)}),[T,T]}return[T]});return bn(k,A,!1,!1)},T1=(e,t,n,o,i,r)=>{let s=t.map((w,v)=>e.fixedSegments==null||e.fixedSegments[v]===void 0||e.fixedSegments[v].index!==w.index||(w.start[0]!==e.fixedSegments[v].start[0]&&w.end[0]!==e.fixedSegments[v].end[0])!=(w.start[1]!==e.fixedSegments[v].start[1]&&w.end[1]!==e.fixedSegments[v].end[1])?v:null).filter(w=>w!==null).shift();if(s==null)return{points:e.points};let a=e.fixedSegments?.findIndex(w=>w.index===1)??-1,l=e.fixedSegments?.findIndex(w=>w.index===e.points.length-1)??-1,d=$s(t[s].start,t[s].end),c=d<xe+5;if(a===-1&&t[s].index===1&&i){let w=yt(n),A=(w?Pe(n,Se):Pe(n,We))?c?d/2:xe:c?-d/2:-xe;t[s].start=re(t[s].start[0]+(w?A:0),t[s].start[1]+(w?0:A))}if(l===-1&&t[s].index===e.points.length-1&&r){let w=yt(o),A=(w?Pe(o,Se):Pe(o,We))?c?d/2:xe:c?-d/2:-xe;t[s].end=re(t[s].end[0]+(w?A:0),t[s].end[1]+(w?0:A))}let u=t.map(w=>({...w,start:re(e.x+w.start[0],e.y+w.start[1]),end:re(e.x+w.end[0],e.y+w.end[1])})),m=e.points.map((w,v)=>re(e.x+w[0],e.y+w[1])),h=u[s].index-1,g=u[s].index,f=u[s].start,E=u[s].end,x=m[h-1]&&!gi(m[h],m[h-1])?Ut(m[h-1],m[h]):void 0,y=m[g+1]&&!gi(m[g],m[g+1])?Ut(m[g+1],m[g]):void 0;if(x!==void 0){let w=x?1:0;m[h-1][w]=f[w]}if(m[h]=f,m[g]=E,y!==void 0){let w=y?1:0;m[g+1][w]=E[w]}let b=u.findIndex(w=>w.index===h);if(b!==-1){let w=Ut(u[b].end,u[b].start)?1:0;u[b].start[w]=f[w],u[b].end=f}let M=u.findIndex(w=>w.index===g+1);if(M!==-1){let w=Ut(u[M].end,u[M].start)?1:0;u[M].end[w]=E[w],u[M].start=E}if(a===-1&&h===0){let w=i?yt(n):Ut(m[1],m[0]);m.unshift(re(w?f[0]:e.x+e.points[0][0],w?e.y+e.points[0][1]:f[1])),i&&m.unshift(re(e.x+e.points[0][0],e.y+e.points[0][1]));for(let v of u)v.index+=i?2:1}if(l===-1&&g===e.points.length-1){let w=yt(o);m.push(re(w?E[0]:e.x+e.points[e.points.length-1][0],w?e.y+e.points[e.points.length-1][1]:E[1])),r&&m.push(re(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]))}return bn(m,u.map(w=>({...w,start:re(w.start[0]-e.x,w.start[1]-e.y),end:re(w.end[0]-e.x,w.end[1]-e.y)})),!1,!1)},k1=(e,t,n,o,i,r,s,a,l)=>{let d=e.startIsSpecial??null,c=e.endIsSpecial??null,u=t.map((E,x)=>x===0?re(e.x+E[0],e.y+E[1]):x===t.length-1?re(e.x+E[0],e.y+E[1]):re(e.x+e.points[x][0],e.y+e.points[x][1])),m=n.map(E=>({...E,start:re(e.x+(E.start[0]-t[0][0]),e.y+(E.start[1]-t[0][1])),end:re(e.x+(E.end[0]-t[0][0]),e.y+(E.end[1]-t[0][1]))})),h=[],g=2+(d?1:0),f=2+(c?1:0);for(;h.length+g<u.length-f;)h.push(u[h.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=yt(o),b=yt(rn(Zs(E,x)));if(a&&y===b){let M=y?Pe(o,Se):Pe(o,We);if(h.unshift(re(b?r[0]+(M?xe:-xe):x[0],b?x[1]:r[1]+(M?xe:-xe))),h.unshift(re(y?r[0]+(M?xe:-xe):r[0],y?r[1]:r[1]+(M?xe:-xe))),!d){d=!0;for(let w of m)w.index>1&&(w.index+=1)}}else if(h.unshift(re(b?r[0]:E[0],b?E[1]:r[1])),d){d=!1;for(let M of m)M.index>1&&(M.index-=1)}h.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=yt(i),b=Ut(x,E);if(l&&y===b){let M=y?Pe(i,Se):Pe(i,We);h.push(re(b?s[0]+(M?xe:-xe):x[0],b?x[1]:s[1]+(M?xe:-xe))),h.push(re(y?s[0]+(M?xe:-xe):s[0],y?s[1]:s[1]+(M?xe:-xe))),c||(c=!0)}else h.push(re(b?s[0]:E[0],b?E[1]:s[1])),c&&(c=!1)}return h.push(s),bn(h,m.map(({index:E})=>({index:E,start:h[E-1],end:h[E]})).map(E=>({...E,start:re(E.start[0]-r[0],E.start[1]-r[1]),end:re(E.end[0]-r[0],E.end[1]-r[1])})),d,c)},On=1e6,Do=(e,t,n,o)=>{if(e.points.length<2)return{points:n.points??e.points};F.PROD||(Lo(!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)"),Lo(!e.fixedSegments||e.fixedSegments.map(w=>w.start[0]===w.end[0]||w.start[1]===w.end[1]).every(Boolean),"Fixed segments must be either horizontal or vertical"),Lo(!n.fixedSegments||n.fixedSegments.map(w=>w.start[0]===w.end[0]||w.start[1]===w.end[1]).every(Boolean),"Updates to fixed segments must be either horizontal or vertical"),Lo(e.points.slice(1).map((w,v)=>w[0]===e.points[v][0]||w[1]===e.points[v][1]),"Elbow arrow segments must be either horizontal or vertical"),Lo(n.fixedSegments?.find(w=>w.index===1&&gi(w.start,(n.points??e.points)[0]))==null&&n.fixedSegments?.find(w=>w.index===(n.points??e.points).length-1&&gi(w.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((w,v)=>v===0?n.points[0]:v===e.points.length-1?n.points[1]:w):n.points.slice():e.points.slice(),{startBinding:s,endBinding:a,...l}=n,d=typeof s<"u"?s:e.startBinding,c=typeof a<"u"?a:e.endBinding,u=d&&xr(d.elementId,t),m=c&&xr(c.elementId,t),h=Yd(r);if(d&&!u&&h||c&&!m&&h||t.size===0&&h||Object.keys(l).length===0&&(u?.id!==d?.elementId||m?.id!==c?.elementId))return bn(r.map(w=>re(e.x+w[0],e.y+w[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial);let{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:b,...M}=Ks({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&&h?bn(r.map(w=>re(e.x+w[0],e.y+w[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial):!n.points&&!n.fixedSegments&&!n.startBinding&&!n.endBinding?v1(e,t):n.startBinding===e.startBinding&&n.endBinding===e.endBinding&&(n.points??[]).every((w,v)=>gi(w,e.points[v]??re(1/0,1/0)))&&h?{}:i.length===0?bn(Js(ea(Qs(e,{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:b,...M})??[])),i,null,null):(e.fixedSegments?.length??0)>i.length?A1(e,i,t):n.points?n.points&&n.fixedSegments?n:k1(e,r,i,g,f,E,x,y,b):T1(e,i,g,f,y,b)},Ks=(e,t,n,o)=>{let i=Xs(n[0],sn(e.x,e.y)),r=Xs(n[n.length-1],sn(e.x,e.y)),s=null,a=null;if(o?.isDragging&&o?.isBindingEnabled!==!1){let w=Array.from(t.values());s=jd(i,t,w,o?.zoom)||null,a=jd(r,t,w,o?.zoom)||null}else s=e.startBinding&&xr(e.startBinding.elementId,t)||null,a=e.endBinding&&xr(e.endBinding.elementId,t)||null;let l=_d({...e,angle:0,type:"arrow",elbowed:!0,points:n},"start",e.startBinding?.fixedPoint,i,s,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),d=_d({...e,angle:0,type:"arrow",elbowed:!0,points:n},"end",e.endBinding?.fixedPoint,r,a,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),c=Wd(l,d,s,i,t,o?.zoom),u=Wd(d,l,a,r,t,o?.zoom),m=[l[0]-2,l[1]-2,l[0]+2,l[1]+2],h=[d[0]-2,d[1]-2,d[0]+2,d[1]+2],g=s?bt(s,t,Rn(c,e.startArrowhead?_e(s,{elbowed:!0})*6:_e(s,{elbowed:!0})*2,1)):m,f=a?bt(a,t,Rn(u,e.endArrowhead?_e(a,{elbowed:!0})*6:_e(a,{elbowed:!0})*2,1)):h,E=on(l,a?bt(a,t,Rn(u,xe,xe)):h)||on(d,s?bt(s,t,Rn(c,xe,xe)):m),x=Ud(E?[m,h]:[g,f]),y=C1(E?m:g,E?h:f,x,E?Rn(c,!s&&!a?0:xe,0):Rn(c,!s&&!a?0:xe-(e.startArrowhead?co*6:co*2),xe),E?Rn(u,!s&&!a?0:xe,0):Rn(u,!s&&!a?0:xe-(e.endArrowhead?co*6:co*2),xe),E,s&&bt(s,t),a&&bt(a,t)),b=zd(y[0],c,l),M=zd(y[1],u,d);return{dynamicAABBs:y,startDonglePosition:b,startGlobalPoint:l,startHeading:c,endDonglePosition:M,endGlobalPoint:d,endHeading:u,commonBounds:x,hoveredStartElement:s,hoveredEndElement:a,boundsOverlap:E,startElementBounds:g,endElementBounds:f}},Qs=(e,t)=>{let{dynamicAABBs:n,startDonglePosition:o,startGlobalPoint:i,startHeading:r,endDonglePosition:s,endGlobalPoint:a,endHeading:l,commonBounds:d,hoveredEndElement:c}=t,u=B1(n,o||i,r,s||a,l,d),m=o&&Er(o,u),h=s&&Er(s,u),g=Er(a,u);g&&c&&(g.closed=!0);let f=Er(i,u);f&&e.startBinding&&(f.closed=!0);let E=m&&h&&(on(m.pos,n[1])||on(h.pos,n[0])),x=L1(m||f,h||g,u,r||Se,l||Se,E?[]:n);if(x){let y=x.map(b=>[b.pos[0],b.pos[1]]);return m&&y.unshift(i),h&&y.push(a),y}return null},Rn=(e,t,n)=>{switch(e){case st:return[t,n,n,n];case Se:return[n,t,n,n];case We:return[n,n,t,n]}return[n,n,n,t]},L1=(e,t,n,o,i,r)=>{let s=Ys(e.pos,t.pos),a=new M1(l=>l.f);for(a.push(e);a.size()>0;){let l=a.pop();if(!l||l.closed)continue;if(l===t)return D1(e,l);l.closed=!0;let d=N1(l.addr,n);for(let c=0;c<4;c++){let u=d[c];if(!u||u.closed)continue;let m=b1(u.pos,l.pos,.5);if(P1(...r.map(M=>on(m,M))))continue;let h=O1(c),g=l.parent?rn(Zs(l.pos,l.parent.pos)):o,f=Us(g);if(Pe(f,h)||Vd(e.addr,u.addr)&&Pe(h,o)||Vd(t.addr,u.addr)&&Pe(h,i))continue;let x=g!==h,y=l.g+Ys(u.pos,l.pos)+(x?Math.pow(s,3):0),b=u.visited;if(!b||y<u.g){let M=G1(u,t,h,i);u.visited=!0,u.parent=l,u.h=Ys(t.pos,u.pos)+M*Math.pow(s,2),u.g=y,u.f=u.g+u.h,b?a.rescoreElement(u):a.push(u)}}}return null},D1=(e,t)=>{let n=t,o=[];for(;n.parent;)o.unshift(n),n=n.parent;return o.unshift(e),o},Ys=(e,t)=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),C1=(e,t,n,o,i,r,s,a)=>{let l=s??e,d=a??t,[c,u,m,h]=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]-h):(l[0]+d[2])/2:e[0]>t[0]?e[0]-h:n[0]-h,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]+m):(l[3]+d[1])/2:e[3]<t[3]?e[3]+m:n[3]+m],b=[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=Ud([y,b]);if(!r&&y[2]-y[0]+b[2]-b[0]>M[2]-M[0]+1e-11&&y[3]-y[1]+b[3]-b[1]>M[3]-M[1]+1e-11){let[w,v]=[(b[0]+b[2])/2,(b[1]+b[3])/2];if(t[0]>e[2]&&e[1]>t[3]){let A=y[2]+(b[0]-y[2])/2,k=b[3]+(y[1]-b[3])/2;return gr(sn(e[2]-w,e[1]-v),sn(e[0]-w,e[3]-v))>0?[[y[0],y[1],A,y[3]],[A,b[1],b[2],b[3]]]:[[y[0],k,y[2],y[3]],[b[0],b[1],b[2],k]]}else if(e[2]<t[0]&&e[3]<t[1]){let A=y[2]+(b[0]-y[2])/2,k=y[3]+(b[1]-y[3])/2;return gr(sn(e[0]-w,e[1]-v),sn(e[2]-w,e[3]-v))>0?[[y[0],y[1],y[2],k],[b[0],k,b[2],b[3]]]:[[y[0],y[1],A,y[3]],[A,b[1],b[2],b[3]]]}else if(e[0]>t[2]&&e[3]<t[1]){let A=b[2]+(y[0]-b[2])/2,k=y[3]+(b[1]-y[3])/2;return gr(sn(e[2]-w,e[1]-v),sn(e[0]-w,e[3]-v))>0?[[A,y[1],y[2],y[3]],[b[0],b[1],A,b[3]]]:[[y[0],y[1],y[2],k],[b[0],k,b[2],b[3]]]}else if(e[0]>t[2]&&e[1]>t[3]){let A=b[2]+(y[0]-b[2])/2,k=b[3]+(y[1]-b[3])/2;return gr(sn(e[0]-w,e[1]-v),sn(e[2]-w,e[3]-v))>0?[[A,y[1],y[2],y[3]],[b[0],b[1],A,b[3]]]:[[y[0],k,y[2],y[3]],[b[0],b[1],b[2],k]]}}return[y,b]},B1=(e,t,n,o,i,r)=>{let s=new Set,a=new Set;n===Xe||n===Se?a.add(t[1]):s.add(t[0]),i===Xe||i===Se?a.add(o[1]):s.add(o[0]),e.forEach(c=>{s.add(c[0]),s.add(c[2]),a.add(c[1]),a.add(c[3])}),s.add(r[0]),s.add(r[2]),a.add(r[1]),a.add(r[3]);let l=Array.from(a).sort((c,u)=>c-u),d=Array.from(s).sort((c,u)=>c-u);return{row:l.length,col:d.length,data:l.flatMap((c,u)=>d.map((m,h)=>({f:0,g:0,h:0,closed:!1,visited:!1,parent:null,addr:[h,u],pos:[m,c]})))}},zd=(e,t,n)=>{switch(t){case st:return re(n[0],e[1]);case Se:return re(e[2],n[1]);case We:return re(n[0],e[3])}return re(e[0],n[1])},G1=(e,t,n,o)=>{if(o===Se)switch(n){case Se:return e.pos[0]>=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2;case st: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 Xe:return e.pos[1]===t.pos[1]?4:2}else if(o===Xe)switch(n){case Se:return e.pos[1]===t.pos[1]?4:2;case st: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 Xe:return e.pos[0]<=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2}else if(o===st)switch(n){case Se:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case st: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 Xe:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3}else if(o===We)switch(n){case Se:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case st: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 Xe:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3}return 0},N1=([e,t],n)=>[fi([e,t-1],n),fi([e+1,t],n),fi([e,t+1],n),fi([e-1,t],n)],fi=([e,t],n)=>e<0||e>=n.col||t<0||t>=n.row?null:n.data[t*n.col+e]??null,Er=(e,t)=>{for(let n=0;n<t.col;n++)for(let o=0;o<t.row;o++){let i=fi([n,o],t);if(i&&e[0]===i.pos[0]&&e[1]===i.pos[1])return i}return null},Ud=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]))],xr=(e,t)=>{let n=t.get(e);return n&&De(n)?n:null},bn=(e,t,n,o)=>{let i=e[0][0],r=e[0][1],s=e.map(a=>Xs(a,w1(Zs(e[0]),-1)));return(i<-On||i>On||r<-On||r>On||i+s[s.length-1][0]<-On||i+s[s.length-1][0]>On||r+s[s.length-1][1]<-On||r+s[s.length-1][1]>On)&&console.error("Elbow arrow normalization is outside reasonable bounds (> 1e6)",{x:i,y:r,points:s,...Hd(s)}),s=s.map(([a,l])=>re(fr(a,-1e6,1e6),fr(l,-1e6,1e6))),{points:s,x:fr(i,-1e6,1e6),y:fr(r,-1e6,1e6),fixedSegments:(t?.length??0)>0?t:null,...Hd(s),startIsSpecial:n,endIsSpecial:o}},Js=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},ea=e=>e.length>=4?e.filter((t,n)=>{if(n===0||n===e.length-1)return!0;let o=e[n-1];return $s(o,t)>qs}):e,O1=e=>{switch(e){case 0:return st;case 1:return Se;case 2:return We}return Xe},_d=(e,t,n,o,i,r,s,a=!0,l=!0)=>s?a&&i&&r?ta(e,i,t,r,void 0,l):o:i?Qe(n||[0,0],i,r??S1([i])):o,Wd=(e,t,n,o,i,r)=>Xd(e,t,n,n&&bt(n,i,Array(4).fill(nn(n,i,e))),o,i,r),jd=(e,t,n,o)=>xn(e,n,t,Wt(o)),Vd=(e,t)=>e[0]===t[0]&&e[1]===t[1],Yd=(e,t=qs)=>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 $e=(e,t,n,o)=>{let i=!1,{points:r,fixedSegments:s,fileId:a}=n;ee(e)&&(Object.keys(n).length===0||typeof r<"u"||typeof s<"u")?n={...n,angle:0,...Do({...e,x:n.x||e.x,y:n.y||e.y},t,n,o)}:typeof r<"u"&&(n={...R1(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 m=!1,h=c.length;for(;--h;){let g=c[h],f=u[h];if(g[0]!==f[0]||g[1]!==f[1]){m=!0;break}}if(!m)continue}}e[l]=d,i=!0}}return i&&((typeof n.height<"u"||typeof n.width<"u"||typeof a<"u"||typeof r<"u")&&Lt.delete(e),e.version=n.version??e.version+1,e.versionNonce=n.versionNonce??na(),e.updated=oa()),e},at=(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??na(),updated:oa()}},$d=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=na(),e.updated=oa(),e);var tc=5,co=5,j1=10,xi=10/1.5,Mr=1,_e=(e,t)=>(t.elbowed?co:tc)+e.strokeWidth/2,Wt=e=>{let t=Math.max(tc,15),n=e?.value&&e.value<1?e.value:1;return wr(t/(n*1.5),t,t*2)},an=e=>e.isBindingEnabled,V1=(e,t,n,o,i,r,s)=>{let{start:a,end:l}=sa(e,t,n,o,i.getNonDeletedElementsMap(),i.getNonDeletedElements(),r,{...s,finalize:!0}),d=r.isMidpointSnappingEnabled&&!s?.angleLocked&&!r.gridModeEnabled;if(Zd(e,a,"start",i,r.isBindingEnabled,d),Zd(e,l,"end",i,r.isBindingEnabled,d),a.focusPoint||l.focusPoint){let c=new Map;a.focusPoint&&c.set(0,{point:Yt(e,"startBinding",e.startBinding,a.element,i.getNonDeletedElementsMap())||e.points[0]}),l.focusPoint&&c.set(e.points.length-1,{point:Yt(e,"endBinding",e.endBinding,l.element,i.getNonDeletedElementsMap())||e.points[e.points.length-1]}),W.movePoints(e,i,c)}return{start:a,end:l}},Zd=(e,{mode:t,element:n,focusPoint:o},i,r,s=!0,a=!0)=>{t===null?nt(e,i,r):t!==void 0&&ln(e,n,t,i,r,o,s,a)},nc=(e,t,n,o,i)=>{wn(t.size===1,"Bound elbow arrows cannot be moved");let r=t.entries().next().value;wn(r,"There should be a position update for dragging an elbow arrow endpoint");let[s,{point:a}]=r,l=W.getPointGlobalCoordinates(e,a,n),d=xn(l,o,n,Wt(i)),c=d?{element:d,mode:"orbit",focusPoint:W.getPointAtIndexGlobalCoordinates(e,s,n)}:{mode:null},u={mode:void 0};return s===0?{start:c,end:u}:{start:u,end:c}},U1=(e,t,n,o,i,r,s,a,l,d,c)=>{let u={mode:void 0},m={mode:void 0},h=e.points.length>2,g=W.getPointGlobalCoordinates(e,t.get(i?s:a).point,n),f=xn(g,o,n);if(i)return f?u={element:f,mode:"inside",focusPoint:g}:u={mode:null},{start:u,end:m};if(r){let E=l?.selectedLinearElement?.initialState.origin;if(f&&e.startBinding?.elementId===f.id){let x=de(f.x+f.width/2,f.y+f.height/2);return{start:h?{mode:void 0}:{mode:"inside",element:f,focusPoint:E??x},end:h?{mode:"orbit",element:f,focusPoint:g}:{mode:"inside",element:f,focusPoint:g}}}if(f&&e.startBinding){let x=e.startBinding;if(dr(g,o,n).find(b=>b.id===x.elementId)){let b=n.get(e.startBinding.elementId);return wn(b,"Other element must be in the elements map"),{start:h?{mode:void 0}:{mode:b.id!==f.id?"orbit":"inside",element:b,focusPoint:E??de(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);wn(x,"Other element must be in the elements map");let b={mode:!!l.selectedLinearElement?.initialState.arrowStartIsInside?"inside":"orbit",element:x,focusPoint:c?he(x,n):E??de(e.x,e.y)},M=f&&js(x,f,n),w;if(f){let v=d==="inside"||d==="skip";w={mode:v&&!M?"inside":"orbit",element:f,focusPoint:g}}else w={mode:null};return{start:h?{mode:void 0}:b,end:w}}if(!e.startBinding)return f?m={mode:d==="inside"||d==="skip"?"inside":"orbit",element:f,focusPoint:g}:m={mode:null},{start:u,end:m}}wn(!1,"New arrow creation should not reach here")},qd=(e,t,n,o,i,r,s,a)=>{let l={mode:void 0},d={mode:void 0},c=s.points.length>2,u=xn(e,i,o),m=n?dr(e,i,o).some(E=>E.id===n.elementId):!1,h=n?o.get(n.elementId):null,g=m&&h?H1(h.backgroundColor):!1,f=u&&h&&js(h,u,o);return r==="inside"||r==="skip"?(l=u?{element:!m||!h||g?u:h,focusPoint:e,mode:"inside"}:{mode:null},d=a&&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:a?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}):(m&&h&&!g?l={element:h,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}},sa=(e,t,n,o,i,r,s,a)=>F1("COMPLEX_BINDINGS")?Y1(e,t,i,r,s,a):oc(e,t,n,o,i,r,s,a),oc=(e,t,n,o,i,r,s,a)=>{let d=e.points.length-1,c=t.has(0),u=t.has(d),m={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(!c&&!u)return{start:m,end:h};if(c&&u)return{start:{mode:null},end:{mode:null}};if(!an(s))return m=c?{mode:null}:m,h=u?{mode:null}:h,{start:m,end:h};if(ee(e))return nc(e,t,i,r,a?.zoom);let g=c?e.endBinding:e.startBinding,f=t.get(c?0:d)?.point;wn(f,`Local point must be defined for ${c?"start":"end"} dragging`);let E=W.getPointGlobalCoordinates(e,f,i),x=xn(a?.angleLocked||s.gridModeEnabled?de(n,o):E,r,i,Wt(s.zoom)),y=x&&(a?.angleLocked?ft(de(n,o),x,i):ft(E,x,i)),b=g?i.get(g.elementId):void 0,M=g&&b&&Qe(g.fixedPoint,b,i),w=b&&M&&en({point:M,element:b,elementsMap:i,threshold:0,overrideShouldTestInside:!0}),v=s.selectedLinearElement?.initialState.arrowOtherEndpointInitialBinding;if(g&&g.elementId===x?.id&&(!a?.newArrow||s.selectedLinearElement?.initialState.origin))return{start:{mode:"inside",element:x,focusPoint:c?E:a?.newArrow?_1(ra(s.selectedLinearElement.initialState.origin[0],s.selectedLinearElement.initialState.origin[1],a.gridSize)):b?Qe(g.fixedPoint,b,i):W.getPointAtIndexGlobalCoordinates(e,0,i)},end:{mode:"inside",element:x,focusPoint:u?E:b?Qe(g.fixedPoint,b,i):W.getPointAtIndexGlobalCoordinates(e,-1,i)}};if(a?.altKey)return{start:c?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:m,end:u?x?{mode:"inside",element:x,focusPoint:E}:{mode:null}:h};let A=x?y?{mode:"inside",element:x,focusPoint:E}:{mode:"orbit",element:x,focusPoint:So(e,a?.angleLocked?E:s.gridModeEnabled?Q1(de(n,o),x,i,s.gridSize,e,W.getPointAtIndexGlobalCoordinates(e,c?1:-2,i)):E,x,c?"start":"end",i,s.zoom,s.isMidpointSnappingEnabled&&!a?.angleLocked&&!s.gridModeEnabled)||E}:{mode:null},k=W.getPointAtIndexGlobalCoordinates(e,c?-1:0,i),T=M&&b&&en({point:E,element:b,elementsMap:i,threshold:Wt(s.zoom),overrideShouldTestInside:!0}),z=v?.mode==="inside",C=a?.newArrow?s.selectedLinearElement?.initialState.arrowStartIsInside:g?.mode==="inside"&&z,O={mode:void 0};return C||(g?.mode==="inside"&&!z&&b&&!a?.newArrow?O={mode:"orbit",element:b,focusPoint:M||k}:b&&!w&&!T&&s.selectedLinearElement?.initialState.altFocusPoint?O={mode:"orbit",element:b,focusPoint:s.selectedLinearElement.initialState.altFocusPoint}:a?.angleLocked&&b&&(O={mode:"orbit",element:b,focusPoint:So(e,k,b,c?"end":"start",i,s.zoom,s.isMidpointSnappingEnabled)||k})),{start:c?A:O,end:u?A:O}},Y1=(e,t,n,o,i,r)=>{let s=i.bindMode||"orbit",a=0,l=e.points.length-1,d=t.has(a),c=t.has(l),u={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(!d&&!c)return{start:u,end:m};if(d&&c)return{start:{mode:null},end:{mode:null}};if(!an(i))return u=d?{mode:null}:u,m=c?{mode:null}:m,{start:u,end:m};if(ee(e))return nc(e,t,n,o);if(r?.newArrow){let{start:h,end:g}=U1(e,t,n,o,d,c,a,l,i,s,r?.shiftKey);return{start:h,end:g}}if(d){let h=t.get(a)?.point;wn(h,"Local point must be defined for start dragging");let g=W.getPointGlobalCoordinates(e,h,n),{current:f,other:E}=qd(g,e.startBinding,e.endBinding,n,o,s,e,r?.finalize);return{start:f,end:E}}if(c){let h=t.get(l)?.point;wn(h,"Local point must be defined for end dragging");let g=W.getPointGlobalCoordinates(e,h,n),{current:f,other:E}=qd(g,e.endBinding,e.startBinding,n,o,s,e,r?.finalize);return{start:E,end:f}}return{start:u,end:m}},i6=(e,t,n)=>{e.forEach(o=>{V1(o,new Map,1/0,1/0,t,n)})},ic=(e,t,n,o,i)=>{i.mutateElement(e,{[o==="start"?"startBinding":"endBinding"]:n}),ec(t.boundElements||[]).has(e.id)||i.mutateElement(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},ln=(e,t,n,o,i,r,s=!0,a=!0)=>{let l=i.getNonDeletedElementsMap(),d;ee(e)?d={elementId:t.id,mode:"orbit",...J1(e,t,o,l,s,a)}:d={elementId:t.id,mode:n,...Go(e,t,o,l,r)},ic(e,t,d,o,i)},nt=(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 s=n.getNonDeletedElementsMap().get(i.elementId);n.mutateElement(s,{boundElements:s.boundElements?.filter(a=>a.id!==e.id)})}return n.mutateElement(e,{[o]:null}),i.elementId},ot=(e,t,n)=>{if(!De(e))return;let{simultaneouslyUpdated:o}=n??{},i=$1(o),r=t.getNonDeletedElementsMap();n?.changedElements&&(r=new Map(r),n.changedElements.forEach(a=>{r.set(a.id,a)})),Pr(r,e,a=>{if(a&&!rt(a)&&console.error("[NONDELETED][INVARIANT] updateBoundElements(): `isDeleted: true` in visitor"),!J(a)||!rt(a)||!X1(a,e))return;let l=a.startBinding?r.get(a.startBinding.elementId):null,d=a.endBinding?l?.id===a.endBinding.elementId?l:r.get(a.endBinding.elementId):null;if(i.has(a.id))return;let c=Ir(r,a,(m,h)=>{if(m&&De(m)&&(h==="startBinding"||h==="endBinding")&&(e.id===a[h]?.elementId||e.id===a[h==="startBinding"?"endBinding":"startBinding"]?.elementId)){let g=Yt(a,h,a[h],m,r);if(g)return[h==="startBinding"?0:a.points.length-1,{point:g}]}return null}).filter(m=>m!==null);W.movePoints(a,t,new Map(c),{moveMidPointsWithElement:!!l&&l?.id===d?.id});let u=pe(a,r);u&&!u.isDeleted&&lo(a,t,!1)})},Kd=(e,t,n,o,i)=>{wn(!ee(e),"Elbow arrows not supported for indirect updates");let r=e[t],s=r&&n.get(r.elementId),a=W.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?0:-1,n),l=s&&en({element:s,point:a,elementsMap:n,threshold:Wt(i.zoom)}),d=t==="startBinding"?"start":"end";if(nt(e,d,o),l){let c=t==="startBinding"?0:e.points.length-1,u=e.points[c],m=oc(e,new Map([[c,{point:u}]]),a[0],a[1],n,o.getNonDeletedElements(),i);m[d]&&m[d].element?.id===s.id&&m[d].mode&&ln(e,s,m[d].mode,d,o,m[d].focusPoint)}},r6=(e,t,n,o)=>{if(J(e)){let i=t.getNonDeletedElementsMap();e.startBinding&&Kd(e,"startBinding",i,t,n),e.endBinding&&Kd(e,"endBinding",i,t,n)}else ot(e,t,{...o,changedElements:new Map([[e.id,e]])})},X1=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,$1=e=>new Set((e||[]).map(t=>t.id)),Xd=(e,t,n,o,i,r,s)=>{let a=rn(Bo(t,e));return!n||!o?a:Z1(i,n,r,s)?ko(n,o,e):rn(Bo(e,he(n,r)))},Z1=(e,t,n,o)=>{let i=nn(t,n,e),r=Wt(o);return i>r?null:i},ta=(e,t,n,o,i,r=!0)=>{let s=ee(e),a=W.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o);if(e.points.length<2)return a;let l=nd(t)&&s?q1(e,t,o,a):a,d=i&&!s?i[1]:W.getPointAtIndexGlobalCoordinates(e,n==="start"?1:-2,o),c=_e(t,e),u=bt(t,o),m=yn(u),h=null;if(s){let g=yt(ko(t,u,a)),E=(r?aa(t,o,l,.05,e):void 0)||a,x=de(g?m[0]:E[0],g?E[1]:m[1]),y=i??Co(x,yr(br(ia(Bo(E,x)),Math.max(t.width,t.height)*2),x));if(h=gt(t,o,y,c).sort(Dt)[0],!h){let b=de(g?E[0]:m[0],g?m[1]:E[1]),M=Co(b,yr(br(ia(Bo(E,b)),Math.max(t.width,t.height)*2),b));h=gt(t,o,M,co).sort(Dt)[0]}}else{let g=i;if(!g){let f=br(ia(Bo(l,d)),Fn(l,d)+Math.max(t.width,t.height)+c*2);g=i??Co(yr(f,d),yr(br(f,-1),d))}h=Fn(l,d)<1?l:gt(t,o,g,c).sort((f,E)=>Dt(f,d)-Dt(E,d))[0]}return!h||Dt(l,h)<z1?l:h},q1=(e,t,n,o)=>{let i=he(t,n),r=ve(o,i,-t.angle),s=_e(t,e);return r[0]<t.x&&r[1]<t.y?r[1]-t.y>-s?ve(de(t.x-s,t.y),i,t.angle):ve(de(t.x,t.y-s),i,t.angle):r[0]<t.x&&r[1]>t.y+t.height?r[0]-t.x>-s?ve(de(t.x,t.y+t.height+s),i,t.angle):ve(de(t.x-s,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+s?ve(de(t.x+t.width,t.y+t.height+s),i,t.angle):ve(de(t.x+t.width+s,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]<t.y?r[0]-t.x<t.width+s?ve(de(t.x+t.width,t.y-s),i,t.angle):ve(de(t.x+t.width+s,t.y),i,t.angle):o},aa=(e,t,n,o=.05,i)=>{let{x:r,y:s,width:a,height:l,angle:d}=e,c=he(e,t,-.1,-.1),u=ve(n,c,-d),m=i?_e(e,i):0,h=wr(o*l,5,80),g=wr(o*a,5,80);if(!(Fn(c,u)<m)){if(u[0]<=r+a/2&&u[1]>c[1]-h&&u[1]<c[1]+h)return ve(de(r-m,c[1]),c,d);if(u[1]<=s+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return ve(de(c[0],s-m),c,d);if(u[0]>=r+a/2&&u[1]>c[1]-h&&u[1]<c[1]+h)return ve(de(r+a+m,c[1]),c,d);if(u[1]>=s+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return ve(de(c[0],s+l+m),c,d);if(e.type==="diamond"){let f=m,E=de(r+a/4-f,s+l/4-f),x=de(r+3*a/4+f,s+l/4-f),y=de(r+a/4-f,s+3*l/4+f),b=de(r+3*a/4+f,s+3*l/4+f);if(Fn(E,u)<Math.max(g,h))return ve(E,c,d);if(Fn(x,u)<Math.max(g,h))return ve(x,c,d);if(Fn(y,u)<Math.max(g,h))return ve(y,c,d);if(Fn(b,u)<Math.max(g,h))return ve(b,c,d)}}},K1=(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:Qe(Je(o.fixedPoint),i,n),binding:o,mode:o.mode}},Q1=(e,t,n,o,i,r)=>{if(!o)return e;let s=bt(t,n),a=r&&(t.type==="ellipse"||t.type==="diamond")?rn(Bo(r,e)):ko(t,s,e),l=_e(t,i),d=Math.max(t.width,t.height)+l*2,c=yn(s),u=Math.abs(a[0]),m=Math.abs(a[1]);if(u>=m){let[,E]=ra(e[0],e[1],o),x=Co(de(c[0]-d,E),de(c[0]+d,E));return gt(t,n,x,l).sort((b,M)=>Dt(b,e)-Dt(M,e))[0]??de(e[0],E)}let[h]=ra(e[0],e[1],o),g=Co(de(h,c[1]-d),de(h,c[1]+d));return gt(t,n,g,l).sort((E,x)=>Dt(E,e)-Dt(x,e))[0]??de(h,e[1])},Qd=e=>e.width*e.height,Yt=(e,t,n,o,i,r)=>{if(n==null||n.elementId!==o.id&&e.points.length>2||W1(e.points[e.points.length-1],de(0,0)))return null;let s=Qe(Je(n.fixedPoint),o,i);if(n.mode==="inside")return W.createPointAt(e,i,s[0],s[1],null);let{element:a,focusPoint:l}=K1(e,t==="startBinding"?"endBinding":"startBinding",i),d=W.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?1:-2,i),c=e.points.length===2&&l||d,u=c&&Co(s,c),m=a&&u&>(a,i,u,_e(a,e)).sort((b,M)=>Dt(b,s)-Dt(M,s))[0],h=u&>(o,i,u,_e(o,e)).sort((b,M)=>Dt(b,c)-Dt(M,c))[0],g=e.startArrowhead!==null,f=e.endArrowhead!==null,E=!g&&!f||t==="startBinding"&&g||t==="endBinding"&&f?s:h||s;if(a&&h&&!r&&Qd(a)<Qd(o)*2&&en({element:a,point:h,elementsMap:i,threshold:_e(a,e),overrideShouldTestInside:!0}))return W.createPointAt(e,i,E[0],E[1],null);let y=Fn(a&&(m||l)||d,h||s)<=j1;return a?y?W.createPointAt(e,i,E?.[0]||s[0],E?.[1]||s[1],null):W.createPointAt(e,i,h?.[0]||s[0],h?.[1]||s[1],null):W.createPointAt(e,i,y?s[0]:h?.[0]??s[0],y?s[1]:h?.[1]??s[1],null)},J1=(e,t,n,o,i=!0,r=!0)=>{let s=[t.x,t.y,t.x+t.width,t.y+t.height],a=i?ta(e,t,n,o,void 0,r):W.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),l=de(s[0]+(s[2]-s[0])/2,s[1]+(s[3]-s[1])/2),d=ve(a,l,-t.angle);if(t.width<Mr||t.height<Mr)return{fixedPoint:Je([.5,.5])};let c=_e(t,e);return{fixedPoint:Je([(d[0]-t.x)/Math.max(t.width,c),(d[1]-t.y)/Math.max(t.height,c)])}},Go=(e,t,n,o,i)=>{let r=i||W.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),s=he(t,o),a=ve(r,s,-t.angle);if(t.width<Mr||t.height<Mr)return{fixedPoint:Je([.5,.5])};let l=_e(t,e),d=(a[0]-t.x)/Math.max(t.width,l),c=(a[1]-t.y)/Math.max(t.height,l);return{fixedPoint:Je([d,c])}},rc=(e,t,n)=>{for(let o of e){if("boundElements"in o&&o.boundElements&&Object.assign(o,{boundElements:o.boundElements.reduce((i,r)=>{let s=t.get(r.id);return s&&i.push({...r,id:s}),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})}ee(o)&&Object.assign(o,Do(o,n,{points:[o.points[0],o.points[o.points.length-1]]}))}},s6=(e,t)=>{let n=ec(e);for(let o of t)Hn.unbindAffected(n,o,(i,r)=>$e(i,n,r)),zn.unbindAffected(n,o,(i,r)=>$e(i,n,r))},Ei=(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},sc=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),Pr=(e,t,n)=>{De(t)&&(t.boundElements?.slice()??[]).forEach(({id:i})=>{n(e.get(i),"boundElements",i)})},Ir=(e,t,n)=>{let o=[];if(t.frameId){let i=t.frameId;o.push(n(e.get(i),"frameId",i))}if(Ne(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},Hn=class{static unbindAffected(t,n,o){n&&Ir(t,n,i=>{!i||i.isDeleted||Pr(t,i,(r,s,a)=>{a===n.id&&o(i,{boundElements:Ei(i.boundElements,new Set([a]))})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||Ir(t,n,(i,r)=>{if(!i||i.isDeleted){o(n,{[r]:null});return}r!=="frameId"&&(i.boundElements?.find(s=>s.id===n.id)||(J(n)&&o(i,{boundElements:Ei(i.boundElements,new Set,new Array(n))}),ue(n)&&(i.boundElements?.find(s=>s.type==="text")?o(n,{[r]:null}):o(i,{boundElements:Ei(i.boundElements,new Set,new Array(n))}))))})}},zn=class{static unbindAffected(t,n,o){n&&Pr(t,n,i=>{!i||i.isDeleted||Ir(t,i,(r,s,a)=>{a===n.id&&o(i,{[s]:null})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||Pr(t,n,(i,r,s)=>{if(!i||i.isDeleted){o(n,{boundElements:Ei(n.boundElements,new Set([s]))});return}ue(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:Ei(n.boundElements,new Set([i.id]))})))})}},Qe=(e,t,n)=>{let[o,i]=Je(e);return ve(de(t.x+t.width*o,t.y+t.height*i),he(t,n),t.angle)},ef=(e,t)=>{let n=e.startBinding&&t.get(e.startBinding.elementId),o=e.endBinding&&t.get(e.endBinding.elementId),i=n&&e.startBinding?Qe(e.startBinding.fixedPoint,n,t):de(e.x+e.points[0][0],e.y+e.points[0][1]),r=o&&e.endBinding?Qe(e.endBinding.fixedPoint,o,t):de(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]);return[i,r]},ac=(e,t)=>{let[n,o]=ef(e,t);return[W.pointFromAbsoluteCoords(e,n,t),W.pointFromAbsoluteCoords(e,o,t)]},tf=e=>Array.isArray(e)&&e.length===2&&e.every(t=>Number.isFinite(t)),Jd=10,Je=e=>{if(!tf(e))return[.5001,.5001];let t=1e-4,n=e.map(o=>wr(o,-Jd,Jd));return Math.abs(n[0]-.5)<t||Math.abs(n[1]-.5)<t?n.map(o=>Math.abs(o-.5)<t?.5001:o):n},nf=e=>e.type==="ellipse"||e.type==="diamond"?e.type:"rectangle",of={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"}]},rf=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}}),sf=(e,t)=>{let[n,o]=e,i=n-.5,r=o-.5,s=Math.atan2(r,i);s<0&&(s+=2*Math.PI);let a=s*180/Math.PI,l=of[t],d=rf(l);for(let m of d)if(m.start<=m.end){if(a>=m.start&&a<=m.end)return m.side}else if(a>=m.start||a<=m.end)return m.side;let c=1/0,u=l[0].side;for(let m of l){let h=Math.abs(a-m.centerAngle);h>180&&(h=360-h),h<c&&(c=h,u=m.side)}return u},a6=(e,t)=>{let n=t.get(e.elementId);if(!n||n.isDeleted||!De(n))return null;let o=he(n,t),i=nf(n),r=sf(Je(e.fixedPoint),i),s=.01;if(n.type==="diamond"){let[a,l]=Bn(n),[d,c,u,m]=a,h,g;switch(r){case"left":{if(l.length>=3){let E=l[2][1];h=E[0]-s,g=E[1]}else{let f=tt(c[1],u[0]);h=f[0]-s,g=f[1]}break}case"right":{if(l.length>=1){let E=l[0][1];h=E[0]+s,g=E[1]}else{let f=tt(m[1],d[0]);h=f[0]+s,g=f[1]}break}case"top":{if(l.length>=4){let E=l[3][1];h=E[0],g=E[1]-s}else{let f=tt(u[1],m[0]);h=f[0],g=f[1]-s}break}case"bottom":{if(l.length>=2){let E=l[1][1];h=E[0],g=E[1]+s}else{let f=tt(d[1],c[0]);h=f[0],g=f[1]+s}break}case"top-right":{let f=tt(m[0],m[1]);h=f[0]+s*.707,g=f[1]-s*.707;break}case"bottom-right":{let f=tt(d[0],d[1]);h=f[0]+s*.707,g=f[1]+s*.707;break}case"bottom-left":{let f=tt(c[0],c[1]);h=f[0]-s*.707,g=f[1]+s*.707;break}case"top-left":{let f=tt(u[0],u[1]);h=f[0]-s*.707,g=f[1]-s*.707;break}default:return null}return ve(de(h,g),o,n.angle)}if(n.type==="ellipse"){let a=n.x+n.width/2,l=n.y+n.height/2,d=n.width/2,c=n.height/2,u,m;switch(r){case"top":{u=a,m=l-c-s;break}case"right":{u=a+d+s,m=l;break}case"bottom":{u=a,m=l+c+s;break}case"left":{u=a-d-s,m=l;break}case"top-right":{let h=-Math.PI/4,g=d*Math.cos(h),f=c*Math.sin(h);u=a+g+s*.707,m=l+f-s*.707;break}case"bottom-right":{let h=Math.PI/4,g=d*Math.cos(h),f=c*Math.sin(h);u=a+g+s*.707,m=l+f+s*.707;break}case"bottom-left":{let h=3*Math.PI/4,g=d*Math.cos(h),f=c*Math.sin(h);u=a+g-s*.707,m=l+f+s*.707;break}case"top-left":{let h=-3*Math.PI/4,g=d*Math.cos(h),f=c*Math.sin(h);u=a+g-s*.707,m=l+f-s*.707;break}default:return null}return ve(de(u,m),o,n.angle)}if(li(n)){let[a,l]=Cn(n),[d,c,u,m]=a,h,g;switch(r){case"top":{let f=tt(d[0],d[1]);h=f[0],g=f[1]-s;break}case"right":{let f=tt(c[0],c[1]);h=f[0]+s,g=f[1];break}case"bottom":{let f=tt(u[0],u[1]);h=f[0],g=f[1]+s;break}case"left":{let f=tt(m[0],m[1]);h=f[0]-s,g=f[1];break}case"top-left":{if(l.length>=1){let f=l[0],E=f[0],x=f[3],y=tt(E,x);h=y[0]-s*.707,g=y[1]-s*.707}else h=n.x-s,g=n.y-s;break}case"top-right":{if(l.length>=2){let f=l[1],E=f[0],x=f[3],y=tt(E,x);h=y[0]+s*.707,g=y[1]-s*.707}else h=n.x+n.width+s,g=n.y-s;break}case"bottom-right":{if(l.length>=3){let f=l[2],E=f[0],x=f[3],y=tt(E,x);h=y[0]+s*.707,g=y[1]+s*.707}else h=n.x+n.width+s,g=n.y+n.height+s;break}case"bottom-left":{if(l.length>=4){let f=l[3],E=f[0],x=f[3],y=tt(E,x);h=y[0]-s*.707,g=y[1]+s*.707}else h=n.x-s,g=n.y+n.height+s;break}default:return null}return ve(de(h,g),o,n.angle)}return null},tt=(e,t)=>de((e[0]+t[0])/2,(e[1]+t[1])/2),l6=(e,t,n,o,i)=>{ic(e,t,{elementId:t.id,fixedPoint:Je(o),mode:"orbit"},n,i)};S();import{arrayToMap as vc,findIndex as Ac,findLastIndex as Tc}from"@excalidraw/common";import{isFiniteNumber as Bf}from"@excalidraw/math";S();S();import{arrayToMap as Mf,isShallowEqual as Pf}from"@excalidraw/common";S();import{arrayToMap as Xt}from"@excalidraw/common";import{isPointWithinBounds as uf,pointFrom as pa,segmentsIntersectAt as pf}from"@excalidraw/math";S();import{arrayToMap as Sr}from"@excalidraw/common";import{validateOrderKey as af,generateNKeysBetween as lf}from"@excalidraw/fractional-indexing";var la=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"},df=(e,{shouldThrow:t=!1,includeBoundTextValidation:n=!1,ignoreLogs:o,reconciliationContext:i})=>{let r=[],s=d=>`${d?.index}:${d?.id}:${d?.type}:${d?.isDeleted}:${d?.version}:${d?.versionNonce}`,a=n?Sr(e):null,l=e.map(d=>d.index);for(let[d,c]of l.entries()){let u=l[d-1],m=l[d+1];if(da(c,u,m)||r.push(`Fractional indices invariant has been compromised: "${s(e[d-1])}", "${s(e[d])}", "${s(e[d+1])}"`),n&&a&&Jt(e[d])&&rt(e[d])){let h=e[d],g=Vt(h),f=g?a.get(g):null;f&&rt(f)&&f.index<=h.index&&r.push(`Fractional indices invariant for bound elements has been compromised: "${s(f)}", "${s(h)}"`)}}if(r.length){let d=new la,c=[];if(i&&(c.push("Additional reconciliation context:"),c.push(i.localElements.map(u=>s(u))),c.push(i.remoteElements.map(u=>s(u)))),o||console.error(r.join(`
|
|
10
|
+
`)=>e.reduce((o,i)=>(pe(i)&&o.push(i.text),o),[]).join(t);S();import{curvePointDistance as Hs,distanceToLineSegment as _s,pointRotateRads as zs}from"@excalidraw/math";import{ellipse as c1,ellipseDistanceFromPoint as u1}from"@excalidraw/math/ellipse";var rn=(e,t,n)=>{switch(e.type){case"selection":case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return p1(e,t,n);case"diamond":return h1(e,t,n);case"ellipse":return m1(e,t,n);case"line":case"arrow":case"freedraw":return f1(e,t,n)}},p1=(e,t,n)=>{let o=fe(e,t),i=zs(n,o,-e.angle),[r,s]=Bn(e);return Math.min(...r.map(a=>_s(i,a)),...s.map(a=>Hs(a,i)))},h1=(e,t,n)=>{let o=fe(e,t),i=zs(n,o,-e.angle),[r,s]=Gn(e);return Math.min(...r.map(a=>_s(i,a)),...s.map(a=>Hs(a,i)))},m1=(e,t,n)=>{let o=fe(e,t);return u1(zs(n,o,-e.angle),c1(o,e.width/2,e.height/2))},f1=(e,t,n)=>{let[o,i]=ao(e,t);return Math.min(...o.map(r=>_s(n,r)),...i.map(r=>Hs(r,n)))};S();var To=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw"||e==="autoshape"||e==="bucketfill",F3=e=>e==="rectangle"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="text"||e==="embeddable"||e==="autoshape",H3=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line"||e==="autoshape",_3=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line"||e==="autoshape",z3=e=>e==="freedraw",Bd=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image",W3=e=>e==="arrow",U3=e=>e==="arrow";var ur=e=>{if(e.type==="arrow")return!1;let t=To(e.type)&&!Hd(e.backgroundColor)||tn(e)||er(e)||pe(e);return e.type==="line"?t&&vt(e.points):e.type==="freedraw"?t&&vt(e.points):t||Ve(e)},Ws=null,Gd=null,Us=1/0,js=!1,Nd=!1,Od=null,M1=(e,t)=>e===t||!!e&&!!t&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,nn=({point:e,element:t,threshold:n,elementsMap:o,frameNameBound:i=null,overrideShouldTestInside:r=!1})=>{if(Ws&&Wd(e,Ws)&&(js?Us<=n:Us>=n)&&r===Nd&&M1(i,Od)){let u=Gd?.deref();if(u&&u.id===t.id&&u.version===t.version&&u.versionNonce===t.versionNonce)return js}let s=i?Vs(_e(i.x-n,i.y-n),e,_e(i.x+i.width+n,i.y+i.height+n)):!1,a=we(t,o,!0);if(!Ud(e,a,t.angle,n)&&!s)return!1;let c=(r||ur(t))&&ft(e,t,o)||Rd(e,t,o,n)||s;return Ws=e,Gd=new WeakRef(t),Us=n,Nd=r,Od=i,js=c,c},Ud=(e,t,n,o=0)=>{let i=n===0?e:At(e,wn(t),-n);return Vs(_e(t[0]-o,t[1]-o),i,_e(t[2]+o,t[3]+o))},P1=(e,t,n,o=0)=>{let i=we(t,n,!0);return Ud(e,i,t.angle,o)},i6=(e,t)=>!nn(e)&&!I1(e.point,e.element,t)&&P1(e.point,e.element,t),I1=(e,t,n)=>{let o=he(t,n);if(!o)return!1;let i=le(t)?{...o,...U.getBoundTextElementPosition(t,o,n)}:o;return ft(e,i,n)},jd=(e,[t,n],o,i=0)=>{let r=_e(t,n),s=!ce(e),a=Math.max(1,i),l=[t-a,n-a,t+a,n+a],d=we(e,o);if(!Tt(l,d))return!1;if(e.frameId){let h=o.get(e.frameId);if(h&&ce(h)){let m=we(h,o);if(!sn(r,m))return!1}}let c=gt(e,o,fi(fe(e,o),r)),u=rn(e,o,r);return s?c.length===0||u<=i:c.length>0&&u<=a},pr=(e,t,n,o)=>{let i=[];for(let r=t.length-1;r>=0;--r){let s=t[r];if(Fd(!s.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Le(s,!1)&&jd(s,e,n,o)&&(i.push(s),To(s.type)&&!Hd(s.backgroundColor)))break}return i},bn=(e,t,n,o)=>{let i=pr(e,t,n,o);return!i||i.length===0?null:i.length===1?i[0]:i.sort((r,s)=>s.width**2+s.height**2-(r.width**2+r.height**2)).pop()},Vd=(e,t,n,o,i)=>{let r=[];for(let a=n.length-1;a>=0;--a){let l=n[a];Fd(!l.isDeleted,"Elements in the function parameter for getAllElementsAtPositionForBinding() should not contain deleted elements"),Le(l,!1)&&jd(l,e,o,i)&&r.push(l)}if(!r||r.length===0)return null;if(r.length===1)return r[0];let s=r.filter(a=>rn(a,o,e)<=ze(a,t)||ft(e,a,o));return s.length===0?null:s[0]},gt=(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)],s=we(e,t);if(!Tt(r,s))return[];switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"selection":case"magicframe":return v1(e,t,n,o,i);case"diamond":return k1(e,t,n,o,i);case"ellipse":return A1(e,t,n,o);case"line":case"freedraw":case"arrow":return S1(e,n,t,i)}},Xd=(e,t,n,o,i,r=!1)=>{for(let s of e){let a=hr(s[0],s[1],s[2],s[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(!Tt(a,l))continue;let d=_d(s,t);if(d.length>0){for(let c of d)n.push(At(c,o,i));if(r)return n}}return n},Yd=(e,t,n,o,i,r=!1)=>{for(let s of e){let a=zd(s,t);if(a&&(n.push(At(a,o,i)),r))return n}return n},S1=(e,t,n,o=!1)=>{let[i,r]=ao(e,n),s=[];for(let a of i){let l=zd(a,t);if(l&&(s.push(l),o))return s}for(let a of r){let l=hr(a[0],a[1],a[2],a[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(!Tt(l,d))continue;let c=_d(a,t,{iterLimit:10});if(c.length>0&&(s.push(...c),o))return s}return s},v1=(e,t,n,o=0,i=!1)=>{let r=fe(e,t),s=At(n[0],r,-e.angle),a=At(n[1],r,-e.angle),l=fi(s,a),[d,c]=Bn(e,o),u=[];return Yd(d,l,u,r,e.angle,i),i&&u.length>0||Xd(c,l,u,r,e.angle,i),u},k1=(e,t,n,o=0,i=!1)=>{let r=fe(e,t),s=At(n[0],r,-e.angle),a=At(n[1],r,-e.angle),l=fi(s,a),[d,c]=Gn(e,o),u=[];return Yd(d,l,u,r,e.angle,i),i&&u.length>0||Xd(c,l,u,r,e.angle,i),u},A1=(e,t,n,o=0)=>{let i=fe(e,t),r=At(n[0],i,-e.angle),s=At(n[1],i,-e.angle);return w1(b1(i,e.width/2+o,e.height/2+o),fi(r,s)).map(a=>At(a,i,e.angle))},Rd=(e,t,n,o=1)=>rn(t,n,e)<=o,ft=(e,t,n)=>{if((le(t)||Ce(t))&&!vt(t.points))return!1;let[o,i,r,s]=we(t,n);if(!Vs(_e(o,i),e,_e(r,s)))return!1;let a=_e((o+r)/2,(i+s)/2),l=g1(y1(x1(E1(e,a,.1)),Math.max(t.width,t.height)*2),a),d=fi(e,l);return gt(t,n,d).filter((u,h,m)=>m.findIndex(g=>Wd(g,u))===h).length%2===1},Xs=(e,t,n)=>{let o=(s,a)=>{let{x:l,y:d,width:c,height:u,angle:h}=s,m=fe(s,n);if(s.type==="diamond"){let[f,E,x,y,b,M,w,v]=ko(s);return[_e(l+f,d+E-a),_e(l+x+a,d+y),_e(l+b,d+M+a),_e(l+w-a,d+v)].map(T=>At(T,m,h))}if(s.type==="ellipse"){let f=l+c/2,E=d+u/2,x=c/2,y=u/2;return[_e(f,E-y-a),_e(f+x+a,E),_e(f,E+y+a),_e(f-x-a,E)].map(M=>At(M,m,h))}return[_e(l-a,d-a),_e(l+c+a,d-a),_e(l+c+a,d+u+a),_e(l-a,d+u+a)].map(f=>At(f,m,h))},i=-1*Math.max(e.width,e.height)/20;return o(e,i).every(s=>ft(s,t,n))};S();import{invariant as $d,isDevEnv as T1,isTestEnv as C1}from"@excalidraw/common";import{pointFrom as On,pointFromVector as mr,pointRotateRads as fr,pointScaleFromOrigin as gr,pointsEqual as L1,triangleIncludesPoint as Ys,vectorCross as Et,vectorFromPoint as ge,vectorScale as Er}from"@excalidraw/math";var Se=[1,0],We=[0,1],Ye=[-1,0],st=[0,-1],an=e=>{let[t,n]=e,o=Math.abs(t),i=Math.abs(n);return t>i?Se:t<=-i?Ye:n>o?We:st},xt=(e,t)=>an(ge(e,t)),Xt=(e,t)=>yt(xt(e,t)),Pe=(e,t)=>e[0]===t[0]&&e[1]===t[1],yt=e=>Pe(e,Se)||Pe(e,Ye),c6=e=>!yt(e),D1=(e,t,n)=>{let o=wn(t);(T1()||C1())&&($d(e.width>0&&e.height>0,"Diamond element has no width or height"),$d(!L1(o,n),"The point is too close to the element mid point to determine heading"));let i=.95,r=mr(Er(ge(fr(On(e.x+e.width/2,e.y),o,e.angle),o),i),o),s=mr(Er(ge(fr(On(e.x+e.width,e.y+e.height/2),o,e.angle),o),i),o),a=mr(Er(ge(fr(On(e.x+e.width/2,e.y+e.height),o,e.angle),o),i),o),l=mr(Er(ge(fr(On(e.x,e.y+e.height/2),o,e.angle),o),i),o);if(Et(ge(n,r),ge(r,s))<=0&&Et(ge(n,r),ge(r,l))>0)return xt(r,o);if(Et(ge(n,s),ge(s,a))<=0&&Et(ge(n,s),ge(s,r))>0)return xt(s,o);if(Et(ge(n,a),ge(a,l))<=0&&Et(ge(n,a),ge(a,s))>0)return xt(a,o);if(Et(ge(n,l),ge(l,r))<=0&&Et(ge(n,l),ge(l,a))>0)return xt(l,o);if(Et(ge(n,o),ge(r,o))<=0&&Et(ge(n,o),ge(s,o))>0){let c=e.width>e.height?r:s;return xt(c,o)}else if(Et(ge(n,o),ge(s,o))<=0&&Et(ge(n,o),ge(a,o))>0){let c=e.width>e.height?a:s;return xt(c,o)}else if(Et(ge(n,o),ge(a,o))<=0&&Et(ge(n,o),ge(l,o))>0){let c=e.width>e.height?a:l;return xt(c,o)}let d=e.width>e.height?r:l;return xt(d,o)},Co=(e,t,n)=>{let i=wn(t);if(e.type==="diamond")return D1(e,t,n);let r=gr(On(t[0],t[1]),i,2),s=gr(On(t[2],t[1]),i,2),a=gr(On(t[0],t[3]),i,2),l=gr(On(t[2],t[3]),i,2);return Ys([r,s,i],n)?st:Ys([s,l,i],n)?Se:Ys([l,a,i],n)?We:Ye},$s=e=>[e[0]===0?0:e[0]>0?-1:1,e[1]===0?0:e[1]>0?-1:1];S();import{getSizeFromPoints as q1,randomInteger as ra,getUpdatedTimestamp as sa}from"@excalidraw/common";S();import{clamp as xr,pointDistance as Ks,pointFrom as re,pointScaleFromOrigin as B1,pointsEqual as Ei,pointTranslate as qs,vector as ln,vectorCross as yr,vectorFromPoint as Qs,vectorScale as G1}from"@excalidraw/math";import{BinaryHeap as N1,invariant as Lo,isAnyTrue as O1,getSizeFromPoints as Zd,isDevEnv as R1,arrayToMap as F1}from"@excalidraw/common";var Js=1,ye=40,H1=(e,t)=>{let n=e.fixedSegments?e.fixedSegments.slice():null;if(n){let o=[];e.points.map(s=>re(e.x+s[0],e.y+s[1])).forEach((s,a,l)=>{if(a<2)return o.push(s);let d=xt(s,l[a-1]),c=xt(l[a-1],l[a-2]);if(Pe(d,c)){let u=n?.findIndex(m=>m.index===a-1)??-1,h=n?.findIndex(m=>m.index===a)??-1;h!==-1&&(n[h].start=re(l[a-2][0]-e.x,l[a-2][1]-e.y)),u!==-1&&n.splice(u,1),o.splice(-1,1),n.forEach(m=>{m.index>a-1&&(m.index-=1)})}return o.push(s)});let i=[];o.forEach((s,a,l)=>{if(a<3)return i.push(s);if(Ks(l[a-2],l[a-1])<Js){let d=n?.findIndex(h=>h.index===a-2)??-1,c=n?.findIndex(h=>h.index===a-1)??-1;c!==-1&&n.splice(c,1),d!==-1&&n.splice(d,1),i.splice(-2,2),n.forEach(h=>{h.index>a-2&&(h.index-=2)});let u=Xt(s,l[a-1]);return i.push(re(u?s[0]:l[a-2][0],u?l[a-2][1]:s[1]))}i.push(s)});let r=n.filter(s=>s.index!==1&&s.index!==i.length-1);return r.length===0?Mn(na(oa(ta(e,ea(e,t,i.map(s=>re(s[0]-e.x,s[1]-e.y))))??[])),r,null,null):(R1()&&Lo(nc(i),"Invalid elbow points with fixed segments"),Mn(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}},_1=(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 s=e.fixedSegments[r].index,a=e.fixedSegments[r-1],l=e.fixedSegments[r+1],d=e.x+(a?a.end[0]:0),c=e.y+(a?a.end[1]:0),u=a?null:e.startBinding,h=l?null:e.endBinding,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...b}=ea({x:d,y:c,startBinding:u,endBinding:h,startArrowhead:null,endArrowhead:null,points:e.points},n,[re(0,0),re(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}=Mn(na(oa(ta(e,{startHeading:m,endHeading:g,startGlobalPoint:f,endGlobalPoint:E,hoveredStartElement:x,hoveredEndElement:y,...b})??[])),t,null,null);if(!M||M.length<2)throw new Error("Property 'points' is required in the update returned by normalizeArrowElementUpdate()");let w=[];if(a)for(let A=0;A<a.index;A++)w.push(re(e.x+e.points[A][0],e.y+e.points[A][1]));if(M.forEach(A=>{w.push(re(e.x+(a?a.end[0]:0)+A[0],e.y+(a?a.end[1]:0)+A[1]))}),l)for(let A=l.index;A<e.points.length;A++)w.push(re(e.x+e.points[A][0],e.y+e.points[A][1]));let v=(l?.index??e.points.length)-(a?.index??0)-1,k=t.map(A=>A.index>s?{...A,index:A.index-v+(M.length-1)}:A),T=w.flatMap((A,_)=>{let D=w[_-1],O=w[_+1];if(D&&O){let N=xt(A,D),W=xt(O,A);if(Pe(N,W))return k.forEach(j=>{j.index>_&&(j.index-=1)}),[];if(Pe(N,$s(W)))return k.forEach(j=>{j.index>_&&(j.index+=1)}),[A,A]}return[A]});return Mn(T,k,!1,!1)},z1=(e,t,n,o,i,r)=>{let s=t.map((w,v)=>e.fixedSegments==null||e.fixedSegments[v]===void 0||e.fixedSegments[v].index!==w.index||(w.start[0]!==e.fixedSegments[v].start[0]&&w.end[0]!==e.fixedSegments[v].end[0])!=(w.start[1]!==e.fixedSegments[v].start[1]&&w.end[1]!==e.fixedSegments[v].end[1])?v:null).filter(w=>w!==null).shift();if(s==null)return{points:e.points};let a=e.fixedSegments?.findIndex(w=>w.index===1)??-1,l=e.fixedSegments?.findIndex(w=>w.index===e.points.length-1)??-1,d=Ks(t[s].start,t[s].end),c=d<ye+5;if(a===-1&&t[s].index===1&&i){let w=yt(n),k=(w?Pe(n,Se):Pe(n,We))?c?d/2:ye:c?-d/2:-ye;t[s].start=re(t[s].start[0]+(w?k:0),t[s].start[1]+(w?0:k))}if(l===-1&&t[s].index===e.points.length-1&&r){let w=yt(o),k=(w?Pe(o,Se):Pe(o,We))?c?d/2:ye:c?-d/2:-ye;t[s].end=re(t[s].end[0]+(w?k:0),t[s].end[1]+(w?0:k))}let u=t.map(w=>({...w,start:re(e.x+w.start[0],e.y+w.start[1]),end:re(e.x+w.end[0],e.y+w.end[1])})),h=e.points.map((w,v)=>re(e.x+w[0],e.y+w[1])),m=u[s].index-1,g=u[s].index,f=u[s].start,E=u[s].end,x=h[m-1]&&!Ei(h[m],h[m-1])?Xt(h[m-1],h[m]):void 0,y=h[g+1]&&!Ei(h[g],h[g+1])?Xt(h[g+1],h[g]):void 0;if(x!==void 0){let w=x?1:0;h[m-1][w]=f[w]}if(h[m]=f,h[g]=E,y!==void 0){let w=y?1:0;h[g+1][w]=E[w]}let b=u.findIndex(w=>w.index===m);if(b!==-1){let w=Xt(u[b].end,u[b].start)?1:0;u[b].start[w]=f[w],u[b].end=f}let M=u.findIndex(w=>w.index===g+1);if(M!==-1){let w=Xt(u[M].end,u[M].start)?1:0;u[M].end[w]=E[w],u[M].start=E}if(a===-1&&m===0){let w=i?yt(n):Xt(h[1],h[0]);h.unshift(re(w?f[0]:e.x+e.points[0][0],w?e.y+e.points[0][1]:f[1])),i&&h.unshift(re(e.x+e.points[0][0],e.y+e.points[0][1]));for(let v of u)v.index+=i?2:1}if(l===-1&&g===e.points.length-1){let w=yt(o);h.push(re(w?E[0]:e.x+e.points[e.points.length-1][0],w?e.y+e.points[e.points.length-1][1]:E[1])),r&&h.push(re(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]))}return Mn(h,u.map(w=>({...w,start:re(w.start[0]-e.x,w.start[1]-e.y),end:re(w.end[0]-e.x,w.end[1]-e.y)})),!1,!1)},W1=(e,t,n,o,i,r,s,a,l)=>{let d=e.startIsSpecial??null,c=e.endIsSpecial??null,u=t.map((E,x)=>x===0?re(e.x+E[0],e.y+E[1]):x===t.length-1?re(e.x+E[0],e.y+E[1]):re(e.x+e.points[x][0],e.y+e.points[x][1])),h=n.map(E=>({...E,start:re(e.x+(E.start[0]-t[0][0]),e.y+(E.start[1]-t[0][1])),end:re(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=yt(o),b=yt(an(Qs(E,x)));if(a&&y===b){let M=y?Pe(o,Se):Pe(o,We);if(m.unshift(re(b?r[0]+(M?ye:-ye):x[0],b?x[1]:r[1]+(M?ye:-ye))),m.unshift(re(y?r[0]+(M?ye:-ye):r[0],y?r[1]:r[1]+(M?ye:-ye))),!d){d=!0;for(let w of h)w.index>1&&(w.index+=1)}}else if(m.unshift(re(b?r[0]:E[0],b?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=yt(i),b=Xt(x,E);if(l&&y===b){let M=y?Pe(i,Se):Pe(i,We);m.push(re(b?s[0]+(M?ye:-ye):x[0],b?x[1]:s[1]+(M?ye:-ye))),m.push(re(y?s[0]+(M?ye:-ye):s[0],y?s[1]:s[1]+(M?ye:-ye))),c||(c=!0)}else m.push(re(b?s[0]:E[0],b?E[1]:s[1])),c&&(c=!1)}return m.push(s),Mn(m,h.map(({index:E})=>({index:E,start:m[E-1],end:m[E]})).map(E=>({...E,start:re(E.start[0]-r[0],E.start[1]-r[1]),end:re(E.end[0]-r[0],E.end[1]-r[1])})),d,c)},Rn=1e6,Do=(e,t,n,o)=>{if(e.points.length<2)return{points:n.points??e.points};F.PROD||(Lo(!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)"),Lo(!e.fixedSegments||e.fixedSegments.map(w=>w.start[0]===w.end[0]||w.start[1]===w.end[1]).every(Boolean),"Fixed segments must be either horizontal or vertical"),Lo(!n.fixedSegments||n.fixedSegments.map(w=>w.start[0]===w.end[0]||w.start[1]===w.end[1]).every(Boolean),"Updates to fixed segments must be either horizontal or vertical"),Lo(e.points.slice(1).map((w,v)=>w[0]===e.points[v][0]||w[1]===e.points[v][1]),"Elbow arrow segments must be either horizontal or vertical"),Lo(n.fixedSegments?.find(w=>w.index===1&&Ei(w.start,(n.points??e.points)[0]))==null&&n.fixedSegments?.find(w=>w.index===(n.points??e.points).length-1&&Ei(w.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((w,v)=>v===0?n.points[0]:v===e.points.length-1?n.points[1]:w):n.points.slice():e.points.slice(),{startBinding:s,endBinding:a,...l}=n,d=typeof s<"u"?s:e.startBinding,c=typeof a<"u"?a:e.endBinding,u=d&&wr(d.elementId,t),h=c&&wr(c.elementId,t),m=nc(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 Mn(r.map(w=>re(e.x+w[0],e.y+w[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial);let{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:b,...M}=ea({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?Mn(r.map(w=>re(e.x+w[0],e.y+w[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial):!n.points&&!n.fixedSegments&&!n.startBinding&&!n.endBinding?H1(e,t):n.startBinding===e.startBinding&&n.endBinding===e.endBinding&&(n.points??[]).every((w,v)=>Ei(w,e.points[v]??re(1/0,1/0)))&&m?{}:i.length===0?Mn(na(oa(ta(e,{startHeading:g,endHeading:f,startGlobalPoint:E,endGlobalPoint:x,hoveredStartElement:y,hoveredEndElement:b,...M})??[])),i,null,null):(e.fixedSegments?.length??0)>i.length?_1(e,i,t):n.points?n.points&&n.fixedSegments?n:W1(e,r,i,g,f,E,x,y,b):z1(e,i,g,f,y,b)},ea=(e,t,n,o)=>{let i=qs(n[0],ln(e.x,e.y)),r=qs(n[n.length-1],ln(e.x,e.y)),s=null,a=null;if(o?.isDragging&&o?.isBindingEnabled!==!1){let w=Array.from(t.values());s=Jd(i,t,w,o?.zoom)||null,a=Jd(r,t,w,o?.zoom)||null}else s=e.startBinding&&wr(e.startBinding.elementId,t)||null,a=e.endBinding&&wr(e.endBinding.elementId,t)||null;let l=Kd({...e,angle:0,type:"arrow",elbowed:!0,points:n},"start",e.startBinding?.fixedPoint,i,s,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),d=Kd({...e,angle:0,type:"arrow",elbowed:!0,points:n},"end",e.endBinding?.fixedPoint,r,a,t,o?.isDragging,o?.isBindingEnabled,o?.isMidpointSnappingEnabled),c=Qd(l,d,s,i,t,o?.zoom),u=Qd(d,l,a,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=s?bt(s,t,Fn(c,e.startArrowhead?ze(s,{elbowed:!0})*6:ze(s,{elbowed:!0})*2,1)):h,f=a?bt(a,t,Fn(u,e.endArrowhead?ze(a,{elbowed:!0})*6:ze(a,{elbowed:!0})*2,1)):m,E=sn(l,a?bt(a,t,Fn(u,ye,ye)):m)||sn(d,s?bt(s,t,Fn(c,ye,ye)):h),x=tc(E?[h,m]:[g,f]),y=V1(E?h:g,E?m:f,x,E?Fn(c,!s&&!a?0:ye,0):Fn(c,!s&&!a?0:ye-(e.startArrowhead?uo*6:uo*2),ye),E?Fn(u,!s&&!a?0:ye,0):Fn(u,!s&&!a?0:ye-(e.endArrowhead?uo*6:uo*2),ye),E,s&&bt(s,t),a&&bt(a,t)),b=qd(y[0],c,l),M=qd(y[1],u,d);return{dynamicAABBs:y,startDonglePosition:b,startGlobalPoint:l,startHeading:c,endDonglePosition:M,endGlobalPoint:d,endHeading:u,commonBounds:x,hoveredStartElement:s,hoveredEndElement:a,boundsOverlap:E,startElementBounds:g,endElementBounds:f}},ta=(e,t)=>{let{dynamicAABBs:n,startDonglePosition:o,startGlobalPoint:i,startHeading:r,endDonglePosition:s,endGlobalPoint:a,endHeading:l,commonBounds:d,hoveredEndElement:c}=t,u=X1(n,o||i,r,s||a,l,d),h=o&&br(o,u),m=s&&br(s,u),g=br(a,u);g&&c&&(g.closed=!0);let f=br(i,u);f&&e.startBinding&&(f.closed=!0);let E=h&&m&&(sn(h.pos,n[1])||sn(m.pos,n[0])),x=U1(h||f,m||g,u,r||Se,l||Se,E?[]:n);if(x){let y=x.map(b=>[b.pos[0],b.pos[1]]);return h&&y.unshift(i),m&&y.push(a),y}return null},Fn=(e,t,n)=>{switch(e){case st:return[t,n,n,n];case Se:return[n,t,n,n];case We:return[n,n,t,n]}return[n,n,n,t]},U1=(e,t,n,o,i,r)=>{let s=Zs(e.pos,t.pos),a=new N1(l=>l.f);for(a.push(e);a.size()>0;){let l=a.pop();if(!l||l.closed)continue;if(l===t)return j1(e,l);l.closed=!0;let d=$1(l.addr,n);for(let c=0;c<4;c++){let u=d[c];if(!u||u.closed)continue;let h=B1(u.pos,l.pos,.5);if(O1(...r.map(M=>sn(h,M))))continue;let m=Z1(c),g=l.parent?an(Qs(l.pos,l.parent.pos)):o,f=$s(g);if(Pe(f,m)||ec(e.addr,u.addr)&&Pe(m,o)||ec(t.addr,u.addr)&&Pe(m,i))continue;let x=g!==m,y=l.g+Zs(u.pos,l.pos)+(x?Math.pow(s,3):0),b=u.visited;if(!b||y<u.g){let M=Y1(u,t,m,i);u.visited=!0,u.parent=l,u.h=Zs(t.pos,u.pos)+M*Math.pow(s,2),u.g=y,u.f=u.g+u.h,b?a.rescoreElement(u):a.push(u)}}}return null},j1=(e,t)=>{let n=t,o=[];for(;n.parent;)o.unshift(n),n=n.parent;return o.unshift(e),o},Zs=(e,t)=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),V1=(e,t,n,o,i,r,s,a)=>{let l=s??e,d=a??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],b=[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=tc([y,b]);if(!r&&y[2]-y[0]+b[2]-b[0]>M[2]-M[0]+1e-11&&y[3]-y[1]+b[3]-b[1]>M[3]-M[1]+1e-11){let[w,v]=[(b[0]+b[2])/2,(b[1]+b[3])/2];if(t[0]>e[2]&&e[1]>t[3]){let k=y[2]+(b[0]-y[2])/2,T=b[3]+(y[1]-b[3])/2;return yr(ln(e[2]-w,e[1]-v),ln(e[0]-w,e[3]-v))>0?[[y[0],y[1],k,y[3]],[k,b[1],b[2],b[3]]]:[[y[0],T,y[2],y[3]],[b[0],b[1],b[2],T]]}else if(e[2]<t[0]&&e[3]<t[1]){let k=y[2]+(b[0]-y[2])/2,T=y[3]+(b[1]-y[3])/2;return yr(ln(e[0]-w,e[1]-v),ln(e[2]-w,e[3]-v))>0?[[y[0],y[1],y[2],T],[b[0],T,b[2],b[3]]]:[[y[0],y[1],k,y[3]],[k,b[1],b[2],b[3]]]}else if(e[0]>t[2]&&e[3]<t[1]){let k=b[2]+(y[0]-b[2])/2,T=y[3]+(b[1]-y[3])/2;return yr(ln(e[2]-w,e[1]-v),ln(e[0]-w,e[3]-v))>0?[[k,y[1],y[2],y[3]],[b[0],b[1],k,b[3]]]:[[y[0],y[1],y[2],T],[b[0],T,b[2],b[3]]]}else if(e[0]>t[2]&&e[1]>t[3]){let k=b[2]+(y[0]-b[2])/2,T=b[3]+(y[1]-b[3])/2;return yr(ln(e[0]-w,e[1]-v),ln(e[2]-w,e[3]-v))>0?[[k,y[1],y[2],y[3]],[b[0],b[1],k,b[3]]]:[[y[0],T,y[2],y[3]],[b[0],b[1],b[2],T]]}}return[y,b]},X1=(e,t,n,o,i,r)=>{let s=new Set,a=new Set;n===Ye||n===Se?a.add(t[1]):s.add(t[0]),i===Ye||i===Se?a.add(o[1]):s.add(o[0]),e.forEach(c=>{s.add(c[0]),s.add(c[2]),a.add(c[1]),a.add(c[3])}),s.add(r[0]),s.add(r[2]),a.add(r[1]),a.add(r[3]);let l=Array.from(a).sort((c,u)=>c-u),d=Array.from(s).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]})))}},qd=(e,t,n)=>{switch(t){case st:return re(n[0],e[1]);case Se:return re(e[2],n[1]);case We:return re(n[0],e[3])}return re(e[0],n[1])},Y1=(e,t,n,o)=>{if(o===Se)switch(n){case Se:return e.pos[0]>=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2;case st: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 Ye:return e.pos[1]===t.pos[1]?4:2}else if(o===Ye)switch(n){case Se:return e.pos[1]===t.pos[1]?4:2;case st: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 Ye:return e.pos[0]<=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2}else if(o===st)switch(n){case Se:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case st: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 Ye:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3}else if(o===We)switch(n){case Se:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case st: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 Ye:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3}return 0},$1=([e,t],n)=>[gi([e,t-1],n),gi([e+1,t],n),gi([e,t+1],n),gi([e-1,t],n)],gi=([e,t],n)=>e<0||e>=n.col||t<0||t>=n.row?null:n.data[t*n.col+e]??null,br=(e,t)=>{for(let n=0;n<t.col;n++)for(let o=0;o<t.row;o++){let i=gi([n,o],t);if(i&&e[0]===i.pos[0]&&e[1]===i.pos[1])return i}return null},tc=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]))],wr=(e,t)=>{let n=t.get(e);return n&&Le(n)?n:null},Mn=(e,t,n,o)=>{let i=e[0][0],r=e[0][1],s=e.map(a=>qs(a,G1(Qs(e[0]),-1)));return(i<-Rn||i>Rn||r<-Rn||r>Rn||i+s[s.length-1][0]<-Rn||i+s[s.length-1][0]>Rn||r+s[s.length-1][1]<-Rn||r+s[s.length-1][1]>Rn)&&console.error("Elbow arrow normalization is outside reasonable bounds (> 1e6)",{x:i,y:r,points:s,...Zd(s)}),s=s.map(([a,l])=>re(xr(a,-1e6,1e6),xr(l,-1e6,1e6))),{points:s,x:xr(i,-1e6,1e6),y:xr(r,-1e6,1e6),fixedSegments:(t?.length??0)>0?t:null,...Zd(s),startIsSpecial:n,endIsSpecial:o}},na=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},oa=e=>e.length>=4?e.filter((t,n)=>{if(n===0||n===e.length-1)return!0;let o=e[n-1];return Ks(o,t)>Js}):e,Z1=e=>{switch(e){case 0:return st;case 1:return Se;case 2:return We}return Ye},Kd=(e,t,n,o,i,r,s,a=!0,l=!0)=>s?a&&i&&r?ia(e,i,t,r,void 0,l):o:i?Qe(n||[0,0],i,r??F1([i])):o,Qd=(e,t,n,o,i,r)=>oc(e,t,n,n&&bt(n,i,Array(4).fill(rn(n,i,e))),o,i,r),Jd=(e,t,n,o)=>bn(e,n,t,Ut(o)),ec=(e,t)=>e[0]===t[0]&&e[1]===t[1],nc=(e,t=Js)=>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 $e=(e,t,n,o)=>{let i=!1,{points:r,fixedSegments:s,fileId:a}=n;ee(e)&&(Object.keys(n).length===0||typeof r<"u"||typeof s<"u")?n={...n,angle:0,...Do({...e,x:n.x||e.x,y:n.y||e.y},t,n,o)}:typeof r<"u"&&(n={...q1(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 a<"u"||typeof r<"u")&&Ct.delete(e),e.version=n.version??e.version+1,e.versionNonce=n.versionNonce??ra(),e.updated=sa()),e},at=(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??ra(),updated:sa()}},ic=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=ra(),e.updated=sa(),e);var uc=5,uo=5,nf=10,yi=10/1.5,Sr=1,ze=(e,t)=>(t.elbowed?uo:uc)+e.strokeWidth/2,Ut=e=>{let t=Math.max(uc,15),n=e?.value&&e.value<1?e.value:1;return Ir(t/(n*1.5),t,t*2)},dn=e=>e.isBindingEnabled,of=(e,t,n,o,i,r,s)=>{let{start:a,end:l}=da(e,t,n,o,i.getNonDeletedElementsMap(),i.getNonDeletedElements(),r,{...s,finalize:!0}),d=r.isMidpointSnappingEnabled&&!s?.angleLocked&&!r.gridModeEnabled;if(rc(e,a,"start",i,r.isBindingEnabled,d),rc(e,l,"end",i,r.isBindingEnabled,d),a.focusPoint||l.focusPoint){let c=new Map;a.focusPoint&&c.set(0,{point:Yt(e,"startBinding",e.startBinding,a.element,i.getNonDeletedElementsMap())||e.points[0]}),l.focusPoint&&c.set(e.points.length-1,{point:Yt(e,"endBinding",e.endBinding,l.element,i.getNonDeletedElementsMap())||e.points[e.points.length-1]}),U.movePoints(e,i,c)}return{start:a,end:l}},rc=(e,{mode:t,element:n,focusPoint:o},i,r,s=!0,a=!0)=>{t===null?nt(e,i,r):t!==void 0&&cn(e,n,t,i,r,o,s,a)},pc=(e,t,n,o,i)=>{Pn(t.size===1,"Bound elbow arrows cannot be moved");let r=t.entries().next().value;Pn(r,"There should be a position update for dragging an elbow arrow endpoint");let[s,{point:a}]=r,l=U.getPointGlobalCoordinates(e,a,n),d=bn(l,o,n,Ut(i)),c=d?{element:d,mode:"orbit",focusPoint:U.getPointAtIndexGlobalCoordinates(e,s,n)}:{mode:null},u={mode:void 0};return s===0?{start:c,end:u}:{start:u,end:c}},rf=(e,t,n,o,i,r,s,a,l,d,c)=>{let u={mode:void 0},h={mode:void 0},m=e.points.length>2,g=U.getPointGlobalCoordinates(e,t.get(i?s:a).point,n),f=bn(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=de(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(pr(g,o,n).find(b=>b.id===x.elementId)){let b=n.get(e.startBinding.elementId);return Pn(b,"Other element must be in the elements map"),{start:m?{mode:void 0}:{mode:b.id!==f.id?"orbit":"inside",element:b,focusPoint:E??de(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);Pn(x,"Other element must be in the elements map");let b={mode:!!l.selectedLinearElement?.initialState.arrowStartIsInside?"inside":"orbit",element:x,focusPoint:c?fe(x,n):E??de(e.x,e.y)},M=f&&Xs(x,f,n),w;if(f){let v=d==="inside"||d==="skip";w={mode:v&&!M?"inside":"orbit",element:f,focusPoint:g}}else w={mode:null};return{start:m?{mode:void 0}:b,end:w}}if(!e.startBinding)return f?h={mode:d==="inside"||d==="skip"?"inside":"orbit",element:f,focusPoint:g}:h={mode:null},{start:u,end:h}}Pn(!1,"New arrow creation should not reach here")},sc=(e,t,n,o,i,r,s,a)=>{let l={mode:void 0},d={mode:void 0},c=s.points.length>2,u=bn(e,i,o),h=n?pr(e,i,o).some(E=>E.id===n.elementId):!1,m=n?o.get(n.elementId):null,g=h&&m?Q1(m.backgroundColor):!1,f=u&&m&&Xs(m,u,o);return r==="inside"||r==="skip"?(l=u?{element:!h||!m||g?u:m,focusPoint:e,mode:"inside"}:{mode:null},d=a&&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:a?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}},da=(e,t,n,o,i,r,s,a)=>K1("COMPLEX_BINDINGS")?sf(e,t,i,r,s,a):hc(e,t,n,o,i,r,s,a),hc=(e,t,n,o,i,r,s,a)=>{let d=e.points.length-1,c=t.has(0),u=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&&!u)return{start:h,end:m};if(c&&u)return{start:{mode:null},end:{mode:null}};if(!dn(s))return h=c?{mode:null}:h,m=u?{mode:null}:m,{start:h,end:m};if(ee(e))return pc(e,t,i,r,a?.zoom);let g=c?e.endBinding:e.startBinding,f=t.get(c?0:d)?.point;Pn(f,`Local point must be defined for ${c?"start":"end"} dragging`);let E=U.getPointGlobalCoordinates(e,f,i),x=bn(a?.angleLocked||s.gridModeEnabled?de(n,o):E,r,i,Ut(s.zoom)),y=x&&(a?.angleLocked?ft(de(n,o),x,i):ft(E,x,i)),b=g?i.get(g.elementId):void 0,M=g&&b&&Qe(g.fixedPoint,b,i),w=b&&M&&nn({point:M,element:b,elementsMap:i,threshold:0,overrideShouldTestInside:!0}),v=s.selectedLinearElement?.initialState.arrowOtherEndpointInitialBinding;if(g&&g.elementId===x?.id&&(!a?.newArrow||s.selectedLinearElement?.initialState.origin))return{start:{mode:"inside",element:x,focusPoint:c?E:a?.newArrow?ef(la(s.selectedLinearElement.initialState.origin[0],s.selectedLinearElement.initialState.origin[1],a.gridSize)):b?Qe(g.fixedPoint,b,i):U.getPointAtIndexGlobalCoordinates(e,0,i)},end:{mode:"inside",element:x,focusPoint:u?E:b?Qe(g.fixedPoint,b,i):U.getPointAtIndexGlobalCoordinates(e,-1,i)}};if(a?.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 k=x?y?{mode:"inside",element:x,focusPoint:E}:{mode:"orbit",element:x,focusPoint:vo(e,a?.angleLocked?E:s.gridModeEnabled?pf(de(n,o),x,i,s.gridSize,e,U.getPointAtIndexGlobalCoordinates(e,c?1:-2,i)):E,x,c?"start":"end",i,s.zoom,s.isMidpointSnappingEnabled&&!a?.angleLocked&&!s.gridModeEnabled)||E}:{mode:null},T=U.getPointAtIndexGlobalCoordinates(e,c?-1:0,i),A=M&&b&&nn({point:E,element:b,elementsMap:i,threshold:Ut(s.zoom),overrideShouldTestInside:!0}),_=v?.mode==="inside",D=a?.newArrow?s.selectedLinearElement?.initialState.arrowStartIsInside:g?.mode==="inside"&&_,O={mode:void 0};return D||(g?.mode==="inside"&&!_&&b&&!a?.newArrow?O={mode:"orbit",element:b,focusPoint:M||T}:b&&!w&&!A&&s.selectedLinearElement?.initialState.altFocusPoint?O={mode:"orbit",element:b,focusPoint:s.selectedLinearElement.initialState.altFocusPoint}:a?.angleLocked&&b&&(O={mode:"orbit",element:b,focusPoint:vo(e,T,b,c?"end":"start",i,s.zoom,s.isMidpointSnappingEnabled)||T})),{start:c?k:O,end:u?k:O}},sf=(e,t,n,o,i,r)=>{let s=i.bindMode||"orbit",a=0,l=e.points.length-1,d=t.has(a),c=t.has(l),u={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:u,end:h};if(d&&c)return{start:{mode:null},end:{mode:null}};if(!dn(i))return u=d?{mode:null}:u,h=c?{mode:null}:h,{start:u,end:h};if(ee(e))return pc(e,t,n,o);if(r?.newArrow){let{start:m,end:g}=rf(e,t,n,o,d,c,a,l,i,s,r?.shiftKey);return{start:m,end:g}}if(d){let m=t.get(a)?.point;Pn(m,"Local point must be defined for start dragging");let g=U.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=sc(g,e.startBinding,e.endBinding,n,o,s,e,r?.finalize);return{start:f,end:E}}if(c){let m=t.get(l)?.point;Pn(m,"Local point must be defined for end dragging");let g=U.getPointGlobalCoordinates(e,m,n),{current:f,other:E}=sc(g,e.endBinding,e.startBinding,n,o,s,e,r?.finalize);return{start:E,end:f}}return{start:u,end:h}},U6=(e,t,n)=>{e.forEach(o=>{of(o,new Map,1/0,1/0,t,n)})},mc=(e,t,n,o,i)=>{i.mutateElement(e,{[o==="start"?"startBinding":"endBinding"]:n}),cc(t.boundElements||[]).has(e.id)||i.mutateElement(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},cn=(e,t,n,o,i,r,s=!0,a=!0)=>{let l=i.getNonDeletedElementsMap(),d;ee(e)?d={elementId:t.id,mode:"orbit",...hf(e,t,o,l,s,a)}:d={elementId:t.id,mode:n,...No(e,t,o,l,r)},mc(e,t,d,o,i)},nt=(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 s=n.getNonDeletedElementsMap().get(i.elementId);n.mutateElement(s,{boundElements:s.boundElements?.filter(a=>a.id!==e.id)})}return n.mutateElement(e,{[o]:null}),i.elementId},ot=(e,t,n)=>{if(!Le(e))return;let{simultaneouslyUpdated:o}=n??{},i=lf(o),r=t.getNonDeletedElementsMap();n?.changedElements&&(r=new Map(r),n.changedElements.forEach(a=>{r.set(a.id,a)})),vr(r,e,a=>{if(a&&!rt(a)&&console.error("[NONDELETED][INVARIANT] updateBoundElements(): `isDeleted: true` in visitor"),!J(a)||!rt(a)||!af(a,e))return;let l=a.startBinding?r.get(a.startBinding.elementId):null,d=a.endBinding?l?.id===a.endBinding.elementId?l:r.get(a.endBinding.elementId):null;if(i.has(a.id))return;let c=kr(r,a,(h,m)=>{if(h&&Le(h)&&(m==="startBinding"||m==="endBinding")&&(e.id===a[m]?.elementId||e.id===a[m==="startBinding"?"endBinding":"startBinding"]?.elementId)){let g=Yt(a,m,a[m],h,r);if(g)return[m==="startBinding"?0:a.points.length-1,{point:g}]}return null}).filter(h=>h!==null);U.movePoints(a,t,new Map(c),{moveMidPointsWithElement:!!l&&l?.id===d?.id});let u=he(a,r);u&&!u.isDeleted&&co(a,t,!1)})},ac=(e,t,n,o,i)=>{Pn(!ee(e),"Elbow arrows not supported for indirect updates");let r=e[t],s=r&&n.get(r.elementId),a=U.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?0:-1,n),l=s&&nn({element:s,point:a,elementsMap:n,threshold:Ut(i.zoom)}),d=t==="startBinding"?"start":"end";if(nt(e,d,o),l){let c=t==="startBinding"?0:e.points.length-1,u=e.points[c],h=hc(e,new Map([[c,{point:u}]]),a[0],a[1],n,o.getNonDeletedElements(),i);h[d]&&h[d].element?.id===s.id&&h[d].mode&&cn(e,s,h[d].mode,d,o,h[d].focusPoint)}},j6=(e,t,n,o)=>{if(J(e)){let i=t.getNonDeletedElementsMap();e.startBinding&&ac(e,"startBinding",i,t,n),e.endBinding&&ac(e,"endBinding",i,t,n)}else ot(e,t,{...o,changedElements:new Map([[e.id,e]])})},af=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,lf=e=>new Set((e||[]).map(t=>t.id)),oc=(e,t,n,o,i,r,s)=>{let a=an(Go(t,e));return!n||!o?a:df(i,n,r,s)?Co(n,o,e):an(Go(e,fe(n,r)))},df=(e,t,n,o)=>{let i=rn(t,n,e),r=Ut(o);return i>r?null:i},ia=(e,t,n,o,i,r=!0)=>{let s=ee(e),a=U.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o);if(e.points.length<2)return a;let l=pd(t)&&s?cf(e,t,o,a):a,d=i&&!s?i[1]:U.getPointAtIndexGlobalCoordinates(e,n==="start"?1:-2,o),c=ze(t,e),u=bt(t,o),h=wn(u),m=null;if(s){let g=yt(Co(t,u,a)),E=(r?ca(t,o,l,.05,e):void 0)||a,x=de(g?h[0]:E[0],g?E[1]:h[1]),y=i??Bo(x,Mr(Pr(aa(Go(E,x)),Math.max(t.width,t.height)*2),x));if(m=gt(t,o,y,c).sort(Lt)[0],!m){let b=de(g?E[0]:h[0],g?h[1]:E[1]),M=Bo(b,Mr(Pr(aa(Go(E,b)),Math.max(t.width,t.height)*2),b));m=gt(t,o,M,uo).sort(Lt)[0]}}else{let g=i;if(!g){let f=Pr(aa(Go(l,d)),Hn(l,d)+Math.max(t.width,t.height)+c*2);g=i??Bo(Mr(f,d),Mr(Pr(f,-1),d))}m=Hn(l,d)<1?l:gt(t,o,g,c).sort((f,E)=>Lt(f,d)-Lt(E,d))[0]}return!m||Lt(l,m)<J1?l:m},cf=(e,t,n,o)=>{let i=fe(t,n),r=ve(o,i,-t.angle),s=ze(t,e);return r[0]<t.x&&r[1]<t.y?r[1]-t.y>-s?ve(de(t.x-s,t.y),i,t.angle):ve(de(t.x,t.y-s),i,t.angle):r[0]<t.x&&r[1]>t.y+t.height?r[0]-t.x>-s?ve(de(t.x,t.y+t.height+s),i,t.angle):ve(de(t.x-s,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+s?ve(de(t.x+t.width,t.y+t.height+s),i,t.angle):ve(de(t.x+t.width+s,t.y+t.height),i,t.angle):r[0]>t.x+t.width&&r[1]<t.y?r[0]-t.x<t.width+s?ve(de(t.x+t.width,t.y-s),i,t.angle):ve(de(t.x+t.width+s,t.y),i,t.angle):o},ca=(e,t,n,o=.05,i)=>{let{x:r,y:s,width:a,height:l,angle:d}=e,c=fe(e,t,-.1,-.1),u=ve(n,c,-d),h=i?ze(e,i):0,m=Ir(o*l,5,80),g=Ir(o*a,5,80);if(!(Hn(c,u)<h)){if(u[0]<=r+a/2&&u[1]>c[1]-m&&u[1]<c[1]+m)return ve(de(r-h,c[1]),c,d);if(u[1]<=s+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return ve(de(c[0],s-h),c,d);if(u[0]>=r+a/2&&u[1]>c[1]-m&&u[1]<c[1]+m)return ve(de(r+a+h,c[1]),c,d);if(u[1]>=s+l/2&&u[0]>c[0]-g&&u[0]<c[0]+g)return ve(de(c[0],s+l+h),c,d);if(e.type==="diamond"){let f=h,E=de(r+a/4-f,s+l/4-f),x=de(r+3*a/4+f,s+l/4-f),y=de(r+a/4-f,s+3*l/4+f),b=de(r+3*a/4+f,s+3*l/4+f);if(Hn(E,u)<Math.max(g,m))return ve(E,c,d);if(Hn(x,u)<Math.max(g,m))return ve(x,c,d);if(Hn(y,u)<Math.max(g,m))return ve(y,c,d);if(Hn(b,u)<Math.max(g,m))return ve(b,c,d)}}},uf=(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:Qe(Je(o.fixedPoint),i,n),binding:o,mode:o.mode}},pf=(e,t,n,o,i,r)=>{if(!o)return e;let s=bt(t,n),a=r&&(t.type==="ellipse"||t.type==="diamond")?an(Go(r,e)):Co(t,s,e),l=ze(t,i),d=Math.max(t.width,t.height)+l*2,c=wn(s),u=Math.abs(a[0]),h=Math.abs(a[1]);if(u>=h){let[,E]=la(e[0],e[1],o),x=Bo(de(c[0]-d,E),de(c[0]+d,E));return gt(t,n,x,l).sort((b,M)=>Lt(b,e)-Lt(M,e))[0]??de(e[0],E)}let[m]=la(e[0],e[1],o),g=Bo(de(m,c[1]-d),de(m,c[1]+d));return gt(t,n,g,l).sort((E,x)=>Lt(E,e)-Lt(x,e))[0]??de(m,e[1])},lc=e=>e.width*e.height,Yt=(e,t,n,o,i,r)=>{if(n==null||n.elementId!==o.id&&e.points.length>2||tf(e.points[e.points.length-1],de(0,0)))return null;let s=Qe(Je(n.fixedPoint),o,i);if(n.mode==="inside")return U.createPointAt(e,i,s[0],s[1],null);let{element:a,focusPoint:l}=uf(e,t==="startBinding"?"endBinding":"startBinding",i),d=U.getPointAtIndexGlobalCoordinates(e,t==="startBinding"?1:-2,i),c=e.points.length===2&&l||d,u=c&&Bo(s,c),h=a&&u&>(a,i,u,ze(a,e)).sort((b,M)=>Lt(b,s)-Lt(M,s))[0],m=u&>(o,i,u,ze(o,e)).sort((b,M)=>Lt(b,c)-Lt(M,c))[0],g=e.startArrowhead!==null,f=e.endArrowhead!==null,E=!g&&!f||t==="startBinding"&&g||t==="endBinding"&&f?s:m||s;if(a&&m&&!r&&lc(a)<lc(o)*2&&nn({element:a,point:m,elementsMap:i,threshold:ze(a,e),overrideShouldTestInside:!0}))return U.createPointAt(e,i,E[0],E[1],null);let y=Hn(a&&(h||l)||d,m||s)<=nf;return a?y?U.createPointAt(e,i,E?.[0]||s[0],E?.[1]||s[1],null):U.createPointAt(e,i,m?.[0]||s[0],m?.[1]||s[1],null):U.createPointAt(e,i,y?s[0]:m?.[0]??s[0],y?s[1]:m?.[1]??s[1],null)},hf=(e,t,n,o,i=!0,r=!0)=>{let s=[t.x,t.y,t.x+t.width,t.y+t.height],a=i?ia(e,t,n,o,void 0,r):U.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),l=de(s[0]+(s[2]-s[0])/2,s[1]+(s[3]-s[1])/2),d=ve(a,l,-t.angle);if(t.width<Sr||t.height<Sr)return{fixedPoint:Je([.5,.5])};let c=ze(t,e);return{fixedPoint:Je([(d[0]-t.x)/Math.max(t.width,c),(d[1]-t.y)/Math.max(t.height,c)])}},No=(e,t,n,o,i)=>{let r=i||U.getPointAtIndexGlobalCoordinates(e,n==="start"?0:-1,o),s=fe(t,o),a=ve(r,s,-t.angle);if(t.width<Sr||t.height<Sr)return{fixedPoint:Je([.5,.5])};let l=ze(t,e),d=(a[0]-t.x)/Math.max(t.width,l),c=(a[1]-t.y)/Math.max(t.height,l);return{fixedPoint:Je([d,c])}},fc=(e,t,n)=>{for(let o of e){if("boundElements"in o&&o.boundElements&&Object.assign(o,{boundElements:o.boundElements.reduce((i,r)=>{let s=t.get(r.id);return s&&i.push({...r,id:s}),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})}ee(o)&&Object.assign(o,Do(o,n,{points:[o.points[0],o.points[o.points.length-1]]}))}},V6=(e,t)=>{let n=cc(e);for(let o of t)_n.unbindAffected(n,o,(i,r)=>$e(i,n,r)),zn.unbindAffected(n,o,(i,r)=>$e(i,n,r))},xi=(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},gc=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),vr=(e,t,n)=>{Le(t)&&(t.boundElements?.slice()??[]).forEach(({id:i})=>{n(e.get(i),"boundElements",i)})},kr=(e,t,n)=>{let o=[];if(t.frameId){let i=t.frameId;o.push(n(e.get(i),"frameId",i))}if(Ne(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},_n=class{static unbindAffected(t,n,o){n&&kr(t,n,i=>{!i||i.isDeleted||vr(t,i,(r,s,a)=>{a===n.id&&o(i,{boundElements:xi(i.boundElements,new Set([a]))})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||kr(t,n,(i,r)=>{if(!i||i.isDeleted){o(n,{[r]:null});return}r!=="frameId"&&(i.boundElements?.find(s=>s.id===n.id)||(J(n)&&o(i,{boundElements:xi(i.boundElements,new Set,new Array(n))}),pe(n)&&(i.boundElements?.find(s=>s.type==="text")?o(n,{[r]:null}):o(i,{boundElements:xi(i.boundElements,new Set,new Array(n))}))))})}},zn=class{static unbindAffected(t,n,o){n&&vr(t,n,i=>{!i||i.isDeleted||kr(t,i,(r,s,a)=>{a===n.id&&o(i,{[s]:null})})})}static rebindAffected=(t,n,o)=>{!n||n.isDeleted||vr(t,n,(i,r,s)=>{if(!i||i.isDeleted){o(n,{boundElements:xi(n.boundElements,new Set([s]))});return}pe(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:xi(n.boundElements,new Set([i.id]))})))})}},Qe=(e,t,n)=>{let[o,i]=Je(e);return ve(de(t.x+t.width*o,t.y+t.height*i),fe(t,n),t.angle)},mf=(e,t)=>{let n=e.startBinding&&t.get(e.startBinding.elementId),o=e.endBinding&&t.get(e.endBinding.elementId),i=n&&e.startBinding?Qe(e.startBinding.fixedPoint,n,t):de(e.x+e.points[0][0],e.y+e.points[0][1]),r=o&&e.endBinding?Qe(e.endBinding.fixedPoint,o,t):de(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]);return[i,r]},Ec=(e,t)=>{let[n,o]=mf(e,t);return[U.pointFromAbsoluteCoords(e,n,t),U.pointFromAbsoluteCoords(e,o,t)]},ff=e=>Array.isArray(e)&&e.length===2&&e.every(t=>Number.isFinite(t)),dc=10,Je=e=>{if(!ff(e))return[.5001,.5001];let t=1e-4,n=e.map(o=>Ir(o,-dc,dc));return Math.abs(n[0]-.5)<t||Math.abs(n[1]-.5)<t?n.map(o=>Math.abs(o-.5)<t?.5001:o):n},gf=e=>e.type==="ellipse"||e.type==="diamond"?e.type:"rectangle",Ef={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"}]},xf=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}}),yf=(e,t)=>{let[n,o]=e,i=n-.5,r=o-.5,s=Math.atan2(r,i);s<0&&(s+=2*Math.PI);let a=s*180/Math.PI,l=Ef[t],d=xf(l);for(let h of d)if(h.start<=h.end){if(a>=h.start&&a<=h.end)return h.side}else if(a>=h.start||a<=h.end)return h.side;let c=1/0,u=l[0].side;for(let h of l){let m=Math.abs(a-h.centerAngle);m>180&&(m=360-m),m<c&&(c=m,u=h.side)}return u},X6=(e,t)=>{let n=t.get(e.elementId);if(!n||n.isDeleted||!Le(n))return null;let o=fe(n,t),i=gf(n),r=yf(Je(e.fixedPoint),i),s=.01;if(n.type==="diamond"){let[a,l]=Gn(n),[d,c,u,h]=a,m,g;switch(r){case"left":{if(l.length>=3){let E=l[2][1];m=E[0]-s,g=E[1]}else{let f=tt(c[1],u[0]);m=f[0]-s,g=f[1]}break}case"right":{if(l.length>=1){let E=l[0][1];m=E[0]+s,g=E[1]}else{let f=tt(h[1],d[0]);m=f[0]+s,g=f[1]}break}case"top":{if(l.length>=4){let E=l[3][1];m=E[0],g=E[1]-s}else{let f=tt(u[1],h[0]);m=f[0],g=f[1]-s}break}case"bottom":{if(l.length>=2){let E=l[1][1];m=E[0],g=E[1]+s}else{let f=tt(d[1],c[0]);m=f[0],g=f[1]+s}break}case"top-right":{let f=tt(h[0],h[1]);m=f[0]+s*.707,g=f[1]-s*.707;break}case"bottom-right":{let f=tt(d[0],d[1]);m=f[0]+s*.707,g=f[1]+s*.707;break}case"bottom-left":{let f=tt(c[0],c[1]);m=f[0]-s*.707,g=f[1]+s*.707;break}case"top-left":{let f=tt(u[0],u[1]);m=f[0]-s*.707,g=f[1]-s*.707;break}default:return null}return ve(de(m,g),o,n.angle)}if(n.type==="ellipse"){let a=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=a,h=l-c-s;break}case"right":{u=a+d+s,h=l;break}case"bottom":{u=a,h=l+c+s;break}case"left":{u=a-d-s,h=l;break}case"top-right":{let m=-Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=a+g+s*.707,h=l+f-s*.707;break}case"bottom-right":{let m=Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=a+g+s*.707,h=l+f+s*.707;break}case"bottom-left":{let m=3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=a+g-s*.707,h=l+f+s*.707;break}case"top-left":{let m=-3*Math.PI/4,g=d*Math.cos(m),f=c*Math.sin(m);u=a+g-s*.707,h=l+f-s*.707;break}default:return null}return ve(de(u,h),o,n.angle)}if(di(n)){let[a,l]=Bn(n),[d,c,u,h]=a,m,g;switch(r){case"top":{let f=tt(d[0],d[1]);m=f[0],g=f[1]-s;break}case"right":{let f=tt(c[0],c[1]);m=f[0]+s,g=f[1];break}case"bottom":{let f=tt(u[0],u[1]);m=f[0],g=f[1]+s;break}case"left":{let f=tt(h[0],h[1]);m=f[0]-s,g=f[1];break}case"top-left":{if(l.length>=1){let f=l[0],E=f[0],x=f[3],y=tt(E,x);m=y[0]-s*.707,g=y[1]-s*.707}else m=n.x-s,g=n.y-s;break}case"top-right":{if(l.length>=2){let f=l[1],E=f[0],x=f[3],y=tt(E,x);m=y[0]+s*.707,g=y[1]-s*.707}else m=n.x+n.width+s,g=n.y-s;break}case"bottom-right":{if(l.length>=3){let f=l[2],E=f[0],x=f[3],y=tt(E,x);m=y[0]+s*.707,g=y[1]+s*.707}else m=n.x+n.width+s,g=n.y+n.height+s;break}case"bottom-left":{if(l.length>=4){let f=l[3],E=f[0],x=f[3],y=tt(E,x);m=y[0]-s*.707,g=y[1]+s*.707}else m=n.x-s,g=n.y+n.height+s;break}default:return null}return ve(de(m,g),o,n.angle)}return null},tt=(e,t)=>de((e[0]+t[0])/2,(e[1]+t[1])/2),Y6=(e,t,n,o,i)=>{mc(e,t,{elementId:t.id,fixedPoint:Je(o),mode:"orbit"},n,i)};S();import{arrayToMap as Oc,findIndex as Rc,findLastIndex as Fc}from"@excalidraw/common";import{isFiniteNumber as Xf}from"@excalidraw/math";S();S();import{arrayToMap as Nf,isShallowEqual as Of}from"@excalidraw/common";S();import{arrayToMap as $t}from"@excalidraw/common";import{isPointWithinBounds as If,pointFrom as fa,segmentsIntersectAt as Sf}from"@excalidraw/math";S();import{arrayToMap as Ar}from"@excalidraw/common";import{validateOrderKey as bf,generateNKeysBetween as wf}from"@excalidraw/fractional-indexing";var ua=class extends Error{code="ELEMENT_HAS_INVALID_INDEX"},Mf=(e,{shouldThrow:t=!1,includeBoundTextValidation:n=!1,ignoreLogs:o,reconciliationContext:i})=>{let r=[],s=d=>`${d?.index}:${d?.id}:${d?.type}:${d?.isDeleted}:${d?.version}:${d?.versionNonce}`,a=n?Ar(e):null,l=e.map(d=>d.index);for(let[d,c]of l.entries()){let u=l[d-1],h=l[d+1];if(pa(c,u,h)||r.push(`Fractional indices invariant has been compromised: "${s(e[d-1])}", "${s(e[d])}", "${s(e[d+1])}"`),n&&a&&tn(e[d])&&rt(e[d])){let m=e[d],g=Vt(m),f=g?a.get(g):null;f&&rt(f)&&f.index<=m.index&&r.push(`Fractional indices invariant for bound elements has been compromised: "${s(f)}", "${s(m)}"`)}}if(r.length){let d=new ua,c=[];if(i&&(c.push("Additional reconciliation context:"),c.push(i.localElements.map(u=>s(u))),c.push(i.remoteElements.map(u=>s(u)))),o||console.error(r.join(`
|
|
11
11
|
|
|
12
|
-
`),d.stack,e.map(u=>s(u)),...c),t)throw d}},dc=e=>e.sort((t,n)=>lc(t)&&lc(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),uo=(e,t)=>{try{let n=Sr(e),o=cf(e,t),i=ua(e,o),r=e.map(s=>{let a=i.get(s);return a?{...s,index:a.index}:s});df(r,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(let[s,{index:a}]of i)$e(s,n,{index:a})}catch{ca(e)}return e},ca=e=>{let t=Sr(e),n=uc(e),o=ua(e,n);for(let[i,{index:r}]of o)$e(i,t,{index:r});return e},cc=e=>{let t=Sr(e),n=uc(e),o=ua(e,n);for(let[i,{index:r}]of o)t.set(i.id,at(i,{index:r}));return t},cf=(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},uc=e=>{let t=[],n,o,i=-1,r=0,s=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]},a=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 m=e[u]?.index;if(!c&&m||c&&m&&m>c)return[m,u]}return[void 0,u]},l=0;for(;l<e.length;){let d=e[l].index;if([n,i]=s(l),[o,r]=a(l),da(d,n,o))l++;else{let c=[i,l];for(;++l<e.length;){let u=e[l].index,[m,h]=s(l),[g,f]=a(l);if(da(u,m,g))break;[n,i]=[m,h],[o,r]=[g,f],c.push(l)}c.push(r),t.push(c)}}return t},da=(e,t,n)=>{if(!e)return!1;try{af(e)}catch{return!1}return t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e},ua=(e,t)=>{let n=new Map;for(let o of t){let i=o.shift(),r=o.pop(),s=lf(e[i]?.index,e[r]?.index,o.length);for(let a=0;a<o.length;a++){let l=e[o[a]];n.set(l,{index:s[a]})}}return n},lc=e=>!!e.index;var pc=(e,t,n)=>{let o=Xt(e);for(let i of t)if(i.frameId){let r=n.get(i.id),s=n.get(i.frameId),a=r&&o.get(r);a&&$e(a,o,{frameId:s??null})}};function Oo(e,t,n){let o=No(t,n),i=No(e,n);return o.some(s=>i.some(a=>pf(s,a)))}var mc=(e,t,n)=>vr(gc(e,t,n,!1)).filter(o=>!ce(o)&&!o.frameId||o.frameId===t.id),ma=(e,t,n)=>fa(be(e,n),be(t,n)),k6=(e,t)=>{let n=Xt(e);return e.filter(o=>Oo(o,t,n))},jn=(e,t,n)=>{let[o,i,r,s]=ae(t,n),[a,l,d,c]=dt(e);return o<=a&&i<=l&&r>=d&&s>=c},_n=(e,t,n)=>jn([e],t,n)||Oo(e,t,n)||ma(e,t,n),L6=(e,t,n)=>{let[o,i,r,s]=ae(t,n);return uf(pa(o,i),pa(e.x,e.y),pa(r,s))},D6=(e,t,n)=>{let o=Xt(e),i=t.flatMap(r=>lt(e,r));return i.length===0?!0:!!i.find(r=>jn([r],n,o)||Oo(r,n,o))},C6=(e,t,n)=>{let o=Xt(e),i=t.flatMap(r=>lt(e,r));return i.length===0?!0:i.find(r=>jn([r],n,o)||Oo(r,n,o))===void 0},B6=e=>{let t=new Map;for(let n of e){let o=ce(n)?n.id:n.frameId;o&&!t.has(o)&&t.set(o,Vn(e,o))}return t},Vn=(e,t)=>{let n=[];for(let o of e.values())o.frameId===t&&n.push(o);return n},ha=e=>e.filter(t=>ce(t)),G6=e=>{let t=Xt(ha(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},N6=(e,t,n,o)=>{let i=Vn(e,t.id),r=new Set(i),s=new Set([...mc(e,t,o),...i.filter(h=>ma(h,t,o))]),a=i.filter(h=>!s.has(h)),l=new Set(Array.from(s).flatMap(h=>h.groupIds));for(let h of a)if(!Oo(h,t,o))h.groupIds.length===0&&r.delete(h);else if(h.groupIds.length>0)for(let g of h.groupIds)l.add(g);for(let h of a)if(h.groupIds.length>0){let g=!0;for(let f of h.groupIds)l.has(f)&&(g=!1);g&&r.delete(h)}let d=Array.from(s).filter(h=>h.groupIds.length===0);for(let h of d)r.add(h);let c=Array.from(s).filter(h=>h.groupIds.length>0),u=Un(c),m=Ec(u,n);for(let[h,g]of Object.entries(m))if(g){let f=lt(e,h);if(jn(f,t,o))for(let E of f)r.add(E)}return[...r].filter(h=>!(ue(h)&&h.containerId))},O6=(e,t,n)=>mf(vr(e,mc(e,t,n)),t,n),mf=(e,t,n)=>{let o=[],i=new Map;for(let r of e){let s=!1;if(r.groupIds.length>0){if(r.groupIds.some(a=>i.get(a)))s=!0;else{let a=new Set(r.groupIds.flatMap(l=>lt(n,l)));s=!jn(Array.from(a),t,n)}r.groupIds.forEach(a=>{i.set(a,s)})}s||o.push(r)}return o},Wn=(e,t)=>e.frameId&&t.get(e.frameId)||null,R6=(e,t)=>{let n=new Set,o=Xt(e);e=vr(e);for(let s of e)ce(s)&&s.id!==t.id&&n.add(s.id);let i=new Set,r=[];for(let s of e)if(!(ce(s)||s.frameId&&n.has(s.frameId)))if(s.groupIds.length){let a=s.groupIds.at(-1);if(!i.has(a)){i.add(a);let l=lt(e,a);if(l.some(d=>_n(d,t,o)))for(let d of l)r.push(d)}}else _n(s,t,o)&&r.push(s);return r},hf=e=>{let t;for(let n of e){if(ce(n)||!n.frameId)return null;if(t===void 0)t=n.frameId;else if(t!==n.frameId)return null}return t??null},ff=(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},gf=(e,t,n)=>{let o=Xt(e),i=hf(t),r=new Set,s=new Set;for(let c of t)ce(c)&&c.id!==n.id&&s.add(c.id);for(let c of vr(e,t)){if(ce(c)||c.frameId&&s.has(c.frameId))continue;r.add(c);let u=pe(c,o);u&&!r.has(u)&&r.add(u)}for(let c of r)c.frameId!==n.id&&$e(c,o,{frameId:n.id});if(!r.size||i===n.id)return e;let a=Array.from(e.values()).filter(c=>!r.has(c)),l=ff(a,n.id);if(l===null)return e;let d=[...a.slice(0,l),...r,...a.slice(l)];return uo(d,Xt([...r])),Array.isArray(e)?d:new Map(d.map(c=>[c.id,c]))},hc=(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 s=pe(i,t);s&&(n.set(s.id,s),r.push(s)),o.set(i.frameId,r)}for(let[,i]of n)$e(i,t,{frameId:null})},Ef=(e,t)=>{let n=Vn(e,t.id);return hc(n,Xt(e)),e},F6=(e,t,n)=>gf(Ef(e,n),t,n).slice(),H6=(e,t,n)=>{let o=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(o);if(t.editingGroupId)for(let a of o)a.groupIds.length===0?i.add(a):a.groupIds.flatMap(l=>lt(e,l)).forEach(l=>i.add(l));let r=new Set,s=Xt(e);return i.forEach(a=>{a.frameId&&!ce(a)&&!fc(a,s,t)&&r.add(a)}),r.size>0&&hc(r,s),e},vr=(e,t)=>{let n=new Set,o=t||e;for(let s of o.values()){let a=s.groupIds[s.groupIds.length-1];a&&n.add(a)}let i=new Set;for(let s of n)lt(e,s).some(a=>ce(a))&&i.add(s);let r=[];for(let s of o.values())i.has(s.groupIds[s.groupIds.length-1])||r.push(s);return r},xf=(e,t,n)=>{let o=ue(e)&&et(e,t)||e;return o.frameId&&n.selectedElementIds[o.id]&&n.selectedElementIds[o.frameId]?Wn(o,t):n.selectedElementIds[o.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Wn(o,t)},fc=(e,t,n,o)=>{let i=o?.targetFrame??xf(e,t,n);if(!i)return!1;let r=ue(e)&&et(e,t)||e,s=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 _n(r,i,t);for(let l of r.groupIds)if(o?.checkedGroups?.has(l))return o.checkedGroups.get(l);let a=new Set(r.groupIds.filter(l=>o?.checkedGroups?!o.checkedGroups.has(l):!0).flatMap(l=>lt(t,l)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let l=new Set(dn(t,n));if(n.frameToHighlight!==null)return!0;l.forEach(c=>{a.delete(c)})}for(let l of a)if(ce(l))return s(!1),!1;for(let l of a)if(_n(l,i,t))return s(!0),!0;return!1},z6=(e,t,n,o,i)=>{if(!n.frameRendering||!n.frameRendering.clip)return!1;let r=Oo(e,t,o)||ma(e,t,o);if(r){for(let s of e.groupIds)i?.set(s,!0);return!0}if(!r&&e.groupIds.length>0&&!jn([e],t,o)){let s=!1;if(n.selectedElementsAreBeingDragged)s=fc(e,o,n,{targetFrame:t,checkedGroups:i});else{s=e.frameId===t.id;for(let a of e.groupIds)i?.set(a,s)}for(let a of e.groupIds)i?.set(a,s);return s}return!1},yf="Frame",bf="AI Frame",wf=e=>Qi(e)?yf:bf,_6=e=>e.name===null?wf(e):e.name,W6=(e,t,n)=>e.filter(o=>(!o.frameId||o.frameId===t.id)&&kt(be(o,n),be(t,n))),j6=e=>{let t=Xt(e);return e.length>1&&e.some(n=>n.frameId&&t.has(n.frameId))};var If=e=>e.locked||Ne(e),Sf=(e,t)=>e.filter(n=>!(n.frameId&&t.has(n.frameId))),vf=e=>{let t=new Set;return e.forEach(n=>{ce(n)&&t.add(n.id)}),Sf(e,t)},gc=(e,t,n,o=!0,i="contain")=>{let[r,s,a,l]=ae(t,n),d=Math.min(r,a),c=Math.min(s,l),u=Math.max(r,a),m=Math.max(s,l);return yc({elements:e,bounds:[d,c,u,m],elementsMap:n,type:i,shouldIgnoreElementFromSelection:If,excludeElementsInFrames:o})},e4=(e,t,n,o)=>{let i=new Set(t.map(r=>r.id));return e.filter(r=>{let s=bc(r,n.width,n.height,n,o);return!i.has(r.id)&&s})},t4=function(){let e=null,t=null,n=null,o=(i,r)=>(n!=null&&i===e&&r.selectedElementIds===t||(n=i.some(s=>r.selectedElementIds[s.id]),e=i,t=r.selectedElementIds),n);return o.clearCache=()=>{e=null,t=null,n=null},o}(),dn=(e,t,n)=>{let o=new Set,i=[];for(let r of e.values()){if(t.selectedElementIds[r.id]){rt(r)?(i.push(r),o.add(r.id)):console.error("[NONDELETED][INVARIANT] getSelectedElements skipping deleted selected element which should not be in the selection");continue}if(n?.includeBoundTextElement&&Ne(r)&&rt(r)&&t.selectedElementIds[r?.containerId]){i.push(r),o.add(r.id);continue}}if(n?.includeElementsInFrames){let r=[];return i.forEach(s=>{ce(s)&&Vn(e,s.id).forEach(a=>!o.has(a.id)&&r.push(a)),r.push(s)}),r}return i},n4=(e,t)=>t.editingTextElement?[t.editingTextElement]:t.newElement&&t.activeTool.type!=="autoshape"?[t.newElement]:dn(e,t,{includeBoundTextElement:!0}),ga=(e,t)=>Pf(t.selectedElementIds,e)?t.selectedElementIds:e,Af=(e,t)=>{let n=e.filter(le);if(n.length===1){let o=n[0],i=o.boundElements?.map(s=>s.id)??[];if(e.every(s=>s.id===o.id||i.includes(s.id)))return new W(o,Mf(t))}return null},o4=(e,t,n)=>({selectedLinearElement:Af(e,t),...xc({editingGroupId:n.editingGroupId,selectedElementIds:vf(e).reduce((o,i)=>(Ne(i)||(o[i.id]=!0),o),{})},t,n,null)}),i4=(e,t)=>t.editingTextElement||e.length===1&&ue(e[0])&&e[0]||null;var Tf=(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}}},xc=function(){let e=null,t=null,n=null,o=(r,s,a,l)=>{if(n!==void 0&&s===t&&r===e&&a.editingGroupId===n?.editingGroupId)return n;let d={};for(let m of r){let h=m.groupIds;if(a.editingGroupId){let g=h.indexOf(a.editingGroupId);g>-1&&(h=h.slice(0,g))}if(h.length>0){let g=h[h.length-1];d[g]=!0}}let c={},u=s.reduce((m,h)=>{if(h.isDeleted)return m;let g=h.groupIds.find(f=>d[f]);return g&&(m[h.id]=!0,Array.isArray(c[g])?c[g].push(h.id):c[g]=[h.id]),m},{});for(let m of Object.keys(c))c[m].length<2&&d[m]&&(d[m]=!1);return t=s,e=r,n={editingGroupId:a.editingGroupId,selectedGroupIds:d,selectedElementIds:ga({...a.selectedElementIds,...u},l)},n},i=(r,s,a,l)=>{let d=l?l.scene.getSelectedElements({selectedElementIds:r.selectedElementIds,elements:s}):dn(s,r);return d.length?o(d,s,r,a):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:ga(r.selectedElementIds,a)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),kf=(e,t)=>Ea(e,t)!=null,Ea=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Lf=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),Ec=(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,...Tf(r,n,e)}}}return n.selectedGroupIds},c4=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),Df=(e,t)=>e.groupIds.includes(t),lt=(e,t)=>{let n=[];for(let o of e.values())Df(o,t)&&n.push(o);return n},Cf=(e,t)=>e.groupIds.find(n=>t[n]),u4=(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},p4=(e,t)=>e.filter(n=>!t[n]),Ar=(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)||[],s=pe(o,t);s&&r.push(s),n.set(i,[...r,o])}),Array.from(n.values())},wc=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let o of n.groupIds??[])t.add(o);return t},Mc=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},Pc=e=>e.groupIds.length>0,Ic=(e,t,n)=>{let o=[...e],i=t?e.indexOf(t):-1,r=i>-1?i:e.length;for(let s=0;s<r;s++)o[s]=n(o[s]);return o},Tr=(e,t,n)=>{let o=new Map,r=Lf(n).length===1&&e.every(s=>kf(n,s));return e.forEach(s=>{if(Ne(s))return;let a,l=Cf(s,n.selectedGroupIds);if(!l)a=`${s.id}_element`;else{let u=r?s.groupIds.indexOf(l)-1:s.groupIds.indexOf(l);a=u<0?`${s.id}_element`:`${s.groupIds[u]}_group`}let d=o.get(a)??[],c=pe(s,t);o.set(a,[...d,s,...c?[c]:[]])}),[...o.values()]};var xa=(e,t)=>e.frameId===t||e.id===t,kc=(e,t,n)=>{let o=[],i=[],r=null,s=-1,a=vc(n||dn(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++s<e.length;){let l=e[s];a.get(l.id)?(i.length&&(o=o.concat(i),i=[]),o.push(s),r=s+1):l.isDeleted&&r===s?(r=s+1,i.push(s)):i=[]}return o},Gf=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),[])},Sc=(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))}}},Nf=(e,t)=>{let n=-1,o=-1;return e.forEach((i,r)=>{xa(i,t)&&(n===-1&&(n=r),o=r)}),n===-1?[]:e.slice(n,o+1)},yi=(e,t,n,o,i,r)=>{let s=r||xn(e,Un(n),o);if(!s)return n;let a=pe(s,o),l=ue(s)?et(s,o):null,d=[s.id,a?.id,l?.id].filter(m=>!!m),c=n.findIndex(m=>d.includes(m.id)),u=n.findIndex(m=>m.id===t.id);if(u!==-1&&c!==-1&&u<c){let m=Array.from(n),h=m.splice(u,1)[0];m.splice(c,0,h),i.replaceAllElements(m)}return n},Of=(e,t,n,o,i,r)=>{let s=t[n],a=m=>m.isDeleted?!1:i?m.frameId===i:e.editingGroupId?m.groupIds.includes(e.editingGroupId):!0,l=o==="left"?Tc(t,m=>a(m),Math.max(0,n-1)):Ac(t,m=>a(m),n+1),d=t[l];if(!d)return-1;if(e.editingGroupId){if(s?.groupIds.join("")===d?.groupIds.join(""))return Sc(d,t,o,r)??l;if(!d?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(d.frameId||ce(d))){let m=Nf(t,d.frameId||d.id);return o==="left"?t.indexOf(m[0]):t.indexOf(m[m.length-1])}if(!d.groupIds.length)return Sc(d,t,o,r)??l;let c=e.editingGroupId?d.groupIds[d.groupIds.indexOf(e.editingGroupId)-1]:d.groupIds[d.groupIds.length-1],u=lt(t,c);return u.length?o==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1]):l},Lc=(e,t)=>t.reduce((n,o)=>{let i=e[o];return n.set(i.id,i),n},new Map),Dc=(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},Cc=(e,t,n,o)=>{let i=e,r=kc(e,t),s=Lc(e,r),a=Gf(r);n==="right"&&(a=a.reverse());let l=new Set(r.filter(d=>ce(e[d])).map(d=>e[d].id));return a.forEach((d,c)=>{let u=d[0],m=d[d.length-1],h=n==="left"?u:m,g=d.some(M=>{let w=e[M];return w.frameId&&l.has(w.frameId)})?null:e[h]?.frameId,f=Of(t,e,h,n,g,o);if(f===-1||h===f)return;let E=n==="left"?e.slice(0,f):e.slice(0,u),x=e.slice(u,m+1),y=n==="left"?e.slice(f,u):e.slice(m+1,f+1),b=n==="left"?e.slice(m+1):e.slice(f+1);e=n==="left"?[...E,...x,...y,...b]:[...E,...y,...x,...b]}),Dc(i,e)?(uo(e,s),e):i},Bc=(e,t,n,o,i)=>{let r=kc(e,t,i);if(r.length===0)return e;let s=Lc(e,r),a=[],l,d;if(n==="left"){if(o)l=Ac(e,f=>xa(f,o));else if(t.editingGroupId){let f=lt(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=Tc(e,f=>xa(f,o));else if(t.editingGroupId){let f=lt(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=>Bf(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)||a.push(e[f]);let u=Array.from(s.values()),m=e.slice(0,l),h=e.slice(d+1),g=n==="left"?[...m,...u,...a,...h]:[...m,...a,...u,...h];return Dc(e,g)?(uo(g,s),g):e};function Gc(e,t,n,o){let i=vc(dn(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),r={regularElements:[],frameChildren:new Map},s=new Set;for(let d of e)i.has(d.id)&&ce(d)&&s.add(d.id);for(let d of e)if(i.has(d.id))if(ce(d)||d.frameId&&s.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 a=e,l=Array.from(r.frameChildren.entries());for(let[d,c]of l)a=o(a,t,n,d,c);return o(a,t,n,null,r.regularElements)}var I4=(e,t,n)=>Cc(e,t,"left",n),S4=(e,t,n)=>Cc(e,t,"right",n),v4=(e,t)=>Gc(e,t,"left",Bc),A4=(e,t)=>Gc(e,t,"right",Bc);var ya=({points:e})=>{let t=e[0][0],n=e[0][1];return{points:e.map(o=>U(o[0]-t,o[1]-n)),offsetX:t,offsetY:n}},W=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,Oc(t.points[0],U(0,0))||(console.error("Linear element is not normalized",Error().stack),$e(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,arrowOtherEndpointInitialBinding:null,altFocusPoint:null},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null,this.hoveredFocusPointBinding=null,this.draggedFocusPointBinding=null,this.elbowed=ee(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:s,elementId:a}=r,l=e.getElement(a,i);if(!l)return!1;let[d,c,u,m]=ae(n.selectionElement,i),g=e.getPointsGlobalCoordinates(l,i).reduce((f,E,x)=>((E[0]>=d&&E[0]<=u&&E[1]>=c&&E[1]<=m||t.shiftKey&&s?.includes(x))&&f.push(x),f),[]).filter(f=>!(ee(l)&&f!==0&&f!==l.points.length-1));o({selectedLinearElement:{...r,selectedPointsIndices:g.length?g:null}})}static handlePointerMove(t,n,o,i,r){let s=n.scene.getNonDeletedElementsMap(),a=n.scene.getNonDeletedElements(),{elementId:l}=r,d=e.getElement(l,s);wt(d,"Element being dragged must exist in the scene"),wt(d.points.length>1,"Element must have at least 2 points");let c=d.points.length-1,u=d.points[c],m=d.points[c-1],h=r.customLineAngle??Hc(m,d.points[c]),g=0,f=0;if(mo(t)){let[v,A]=e._getShiftLockedDelta(d,s,m,U(o,i),t[po.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),h),k=U(v+m[0],A+m[1]);g=k[0]-u[0],f=k[1]-u[1]}else{let v=e.createPointAt(d,s,o-r.pointerOffset.x,i-r.pointerOffset.y,t[po.CTRL_OR_CMD]?null:n.getEffectiveGridSize());g=v[0]-u[0],f=v[1]-u[1]}let E=null,{positions:x,updates:y}=Fc([c],g,f,o,i,s,d,a,n,mo(t),t.altKey,r),b=mo(t);if(e.movePoints(d,n.scene,x,{startBinding:y?.startBinding,endBinding:y?.endBinding,moveMidPointsWithElement:y?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled&&!b&&!n.state.gridModeEnabled}),Ke(d,!1)&&an(n.state)&&(E=y?.suggestedBinding??null),Ke(d)&&yi(e.getPointGlobalCoordinates(d,d.points[d.points.length-1],s),d,a,s,n.scene),n.state.selectedLinearElement?.customLineAngle===h&&r.initialState.altFocusPoint&&(!E||_f(n.state.suggestedBinding??[],E)))return null;let M=Ke(d)&&d.startBinding&&s.get(d.startBinding.elementId);return{selectedLinearElement:{...r,customLineAngle:h,initialState:{...r.initialState,altFocusPoint:!r.initialState.altFocusPoint&&M&&y?.suggestedBinding?.element.id!==M.id?So(d,U(d.x,d.y),M,"start",s,n.state.zoom,n.state.isMidpointSnappingEnabled&&!b&&!n.state.gridModeEnabled):r.initialState.altFocusPoint}},suggestedBinding:E}}static handlePointDragging(t,n,o,i,r){let s=n.scene.getNonDeletedElementsMap(),a=n.scene.getNonDeletedElements(),{elbowed:l,elementId:d,initialState:c}=r,u=Array.from(r.selectedPointsIndices??[]),{lastClickedPoint:m}=c,h=e.getElement(d,s);wt(h,"Element being dragged must exist in the scene"),wt(h.points.length>1,"Element must have at least 2 points"),wt(u,"There must be selected points in order to drag them"),l&&u.some((L,G)=>L>0&&L!==h.points.length-1?(u[G]=h.points.length-1,m=h.points.length-1,!0):!1),(m<0||!u.includes(m)||!h.points[m])&&(console.error(`There must be a valid lastClickedPoint in order to drag it. selectedPointsIndices(${JSON.stringify(u)}) points(0..${h.points.length-1}) lastClickedPoint(${m}) isElbowArrow: ${l}`),m=h.points.length-1);let g=h.points[m],f=h.points[m===0?1:m-1],E=u.length===1,x=r.customLineAngle??Hc(f,h.points[m]),y=u.includes(0),b=u.includes(h.points.length-1),M=0,w=0;if(mo(t)&&E){let[L,G]=e._getShiftLockedDelta(h,s,f,U(o,i),t[po.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),x),_=U(L+f[0],G+f[1]);M=_[0]-g[0],w=_[1]-g[1]}else{let L=e.createPointAt(h,s,o-r.pointerOffset.x,i-r.pointerOffset.y,t[po.CTRL_OR_CMD]?null:n.getEffectiveGridSize());M=L[0]-g[0],w=L[1]-g[1]}let v=null,{positions:A,updates:k}=Fc(u,M,w,o,i,s,h,a,n,mo(t)&&E,t.altKey,r),T=mo(t)&&E;e.movePoints(h,n.scene,A,{startBinding:k?.startBinding,endBinding:k?.endBinding,moveMidPointsWithElement:k?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled&&!T&&!n.state.gridModeEnabled}),Ke(h,!1)&&an(n.state)&&(y||b)&&(v=k?.suggestedBinding??null),Ke(h)&&y!==b&&yi(e.getPointGlobalCoordinates(h,y?h.points[0]:h.points[h.points.length-1],s),h,a,s,n.scene),pe(h,s)&&lo(h,n.scene,!1);let C=l?b?[h.points.length-1]:[0]:u,O=l?C[0]:m,N=!y&&!b?e.getPointGlobalCoordinates(h,g,s):null,j=O,V=Ke(h)&&h.startBinding&&s.get(h.startBinding.elementId),D=Ke(h)&&h.endBinding&&s.get(h.endBinding.elementId),B=b&&V&&k?.suggestedBinding?.element.id!==V.id?V:y&&D&&k?.suggestedBinding?.element.id!==D.id?D:null;return{selectedLinearElement:{...r,selectedPointsIndices:C,initialState:{...r.initialState,lastClickedPoint:O,altFocusPoint:!r.initialState.altFocusPoint&&Ke(h)&&B?So(h,U(h.x,h.y),B,"start",s,n.state.zoom,n.state.isMidpointSnappingEnabled&&!T&&!n.state.gridModeEnabled):r.initialState.altFocusPoint},segmentMidPointHoveredCoords:N,hoverPointIndex:j,isDragging:!0,customLineAngle:x},suggestedBinding:v}}static handlePointerUp(t,n,o,i){let r=i.getNonDeletedElementsMap(),{elementId:s,selectedPointsIndices:a,isDragging:l,initialState:d}=n,c=e.getElement(s,r);if(!c)return n;if(l&&a)for(let u of a)(u===0||u===c.points.length-1)&&vt(c.points,o.zoom.value)&&(Ye(c)&&i.mutateElement(c,{...zc(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)?a&&a.filter(u=>u!==d.lastClickedPoint):a:a?.includes(d.lastClickedPoint)?[d.lastClickedPoint]:a,isDragging:!1,customLineAngle:null,initialState:{...n.initialState,origin:null,arrowStartIsInside:!1,arrowOtherEndpointInitialBinding:null}}}static getEditorMidPoints=(t,n,o)=>{let i=pe(t,n);if(!ee(t)&&!o.selectedLinearElement?.isEditing&&t.points.length>2&&!i)return[];let r=e.getPointsGlobalCoordinates(t,n),s=0,a=[];for(;s<r.length-1;){if(e.isSegmentTooShort(t,t.points[s],t.points[s+1],s,o.zoom,n)){a.push(null),s++;continue}let l=e.getSegmentMidPoint(t,s+1,n);a.push(l),s++}return a};static getSegmentMidpointHitCoords=(t,n,o,i)=>{let{elementId:r}=t,s=e.getElement(r,i);if(!s)return null;let a=e.getPointIndexUnderCursor(s,i,o.zoom,n.x,n.y);if(!ee(s)&&a>=0||e.getPointsGlobalCoordinates(s,i).length>=3&&!o.selectedLinearElement?.isEditing&&!ee(s))return null;let d=(e.POINT_HANDLE_SIZE+1)/o.zoom.value,c=t.segmentMidPointHoveredCoords;if(c&&ho(U(c[0],c[1]),U(n.x,n.y))<=d)return c;let u=0,m=e.getEditorMidPoints(s,i,o);for(;u<m.length;){if(m[u]!==null&&ho(m[u],U(n.x,n.y))<=d)return m[u];u++}return null};static isSegmentTooShort(t,n,o,i,r,s){if(ee(t))return i>=0&&i<t.points.length?ho(n,o)*r.value<e.POINT_HANDLE_SIZE/2:!1;let a=ho(n,o);if(t.points.length>2&&t.roundness){let[l,d]=so(t,s);wt(l.length===0&&d.length>0,"Only linears built out of curves are supported"),wt(l.length+d.length>=i,"Invalid segment index while calculating mid point"),a=Ff(d[i])}return a*r.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,o){if(ee(t)){wt(t.points.length>=n,"Invalid segment index while calculating elbow arrow mid point");let s=Nc(t.points[n-1],t.points[n]);return U(t.x+s[0],t.y+s[1])}let[i,r]=so(t,o);if(wt(i.length===0&&r.length>0||i.length>0&&r.length===0,"Only linears built out of either segments or curves are supported"),wt(i.length+r.length>=n,"Invalid segment index while calculating mid point"),i.length){let s=i[n-1];return Nc(s[0],s[1])}if(r.length){let s=r[n-1];return Hf(s,.5)}wt(!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 s=e.getEditorMidPoints(r,i,n),a=0;for(;a<s.length;){if(e.arePointsEqual(o,s[a]))return a+1;a++}return-1}static handlePointerDown(t,n,o,i,r,s){let a=n.state,l=s.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 m=e.getSegmentMidpointHitCoords(r,i,a,l),h=U(i.x,i.y),g=null;if(m)g=e.getSegmentMidPointIndex(r,a,m,l);else if(t.altKey&&a.selectedLinearElement?.isEditing)return r.lastUncommittedPoint==null&&(s.mutateElement(u,{points:[...u.points,e.createPointAt(u,l,i.x,i.y,t[po.CTRL_OR_CMD]?null:n.getEffectiveGridSize())]}),d.didAddPoint=!0),o.scheduleCapture(),d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:-1,origin:h,segmentMidpoint:{value:m,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null,arrowOtherEndpointInitialBinding:u.startBinding},selectedPointsIndices:[u.points.length-1],lastUncommittedPoint:null},d.didAddPoint=!0,d;let f=e.getPointIndexUnderCursor(u,l,a.zoom,i.x,i.y);(f>=0||m)&&(d.hitElement=u);let[E,x,y,b]=ae(u,l),M=(E+y)/2,w=(x+b)/2,v=f>-1&&ct(U(u.x+u.points[f][0],u.y+u.points[f][1]),U(M,w),u.angle),A=f>-1||t.shiftKey?t.shiftKey||r.selectedPointsIndices?.includes(f)?Wf([...r.selectedPointsIndices||[],f]):[f]:null;return d.linearElementEditor={...r,initialState:{prevSelectedPointsIndices:r.selectedPointsIndices,lastClickedPoint:f,origin:h,segmentMidpoint:{value:m,index:g,added:!1},arrowStartIsInside:!!n.state.newElement&&(n.state.bindMode==="inside"||n.state.bindMode==="skip"),altFocusPoint:null,arrowOtherEndpointInitialBinding:A?.includes(0)?u.endBinding:u.startBinding},selectedPointsIndices:A,pointerOffset:v?{x:i.x-v[0],y:i.y-v[1]}:{x:0,y:0}},d}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:Oc(t,n)}static handlePointerMoveInEditMode(t,n,o,i){let r=i.state;if(!r.selectedLinearElement?.isEditing)return null;let{elementId:s,lastUncommittedPoint:a}=r.selectedLinearElement,l=i.scene.getNonDeletedElementsMap(),d=e.getElement(s,l);if(!d)return r.selectedLinearElement;let{points:c}=d,u=c[c.length-1];if(!t.altKey)return u===a&&e.deletePoints(d,i,[c.length-1]),r.selectedLinearElement?.lastUncommittedPoint?{...r.selectedLinearElement,lastUncommittedPoint:null}:r.selectedLinearElement;let m;if(mo(t)&&c.length>=2){let h=c[c.length-2],[g,f]=e._getShiftLockedDelta(d,l,h,U(n,o),t[po.CTRL_OR_CMD]?null:i.getEffectiveGridSize());m=U(g+h[0],f+h[1])}else m=e.createPointAt(d,l,n-r.selectedLinearElement.pointerOffset.x,o-r.selectedLinearElement.pointerOffset.y,t[po.CTRL_OR_CMD]||ee(d)?null:i.getEffectiveGridSize());return u===a?e.movePoints(d,i.scene,new Map([[d.points.length-1,{point:m}]])):e.addPoints(d,i.scene,[m]),{...r.selectedLinearElement,lastUncommittedPoint:d.points[d.points.length-1]}}static getPointGlobalCoordinates(t,n,o){let[i,r,s,a]=ae(t,o),l=(i+s)/2,d=(r+a)/2,{x:c,y:u}=t;return ct(U(c+n[0],u+n[1]),U(l,d),t.angle)}static getPointsGlobalCoordinates(t,n){let[o,i,r,s]=ae(t,n),a=(o+r)/2,l=(i+s)/2;return t.points.map(d=>{let{x:c,y:u}=t;return ct(U(c+d[0],u+d[1]),U(a,l),t.angle)})}static getPointAtIndexGlobalCoordinates(t,n,o){let i=n<0?t.points.length+n:n,[,,,,r,s]=ae(t,o),a=U(r,s),l=t.points[i],{x:d,y:c}=t;return l?ct(U(d+l[0],c+l[1]),a,t.angle):ct(U(d,c),a,t.angle)}static pointFromAbsoluteCoords(t,n,o){if(ee(t))return U(n[0]-t.x,n[1]-t.y);let[i,r,s,a]=ae(t,o),l=(i+s)/2,d=(r+a)/2,[c,u]=ct(U(n[0],n[1]),U(l,d),-t.angle);return U(c-t.x,u-t.y)}static getPointIndexUnderCursor(t,n,o,i,r){let s=e.getPointsGlobalCoordinates(t,n),a=s.length;for(;--a>-1;){let l=s[a];if(ho(U(i,r),U(l[0],l[1]))*o.value<e.POINT_HANDLE_SIZE+1)return a}return-1}static createPointAt(t,n,o,i,r){let s=Rc(o,i,r),[a,l,d,c]=ae(t,n),u=(a+d)/2,m=(l+c)/2,[h,g]=ct(U(s[0],s[1]),U(u,m),-t.angle);return U(h-t.x,g-t.y)}static getNormalizeElementPointsAndCoords(t){let{points:n,offsetX:o,offsetY:i}=ya(t);return{points:n,x:t.x+o,y:t.y+i}}static duplicateSelectedPoints(t,n){wt(t.selectedLinearElement?.isEditing,"Not currently editing a linear element");let o=n.getNonDeletedElementsMap(),{selectedPointsIndices:i,elementId:r}=t.selectedLinearElement,s=e.getElement(r,o);wt(s,"The linear element does not exist in the provided Scene"),wt(i!=null,"There are no selected points to duplicate");let{points:a}=s,l=[],d=!1,c=-1,u=a.reduce((m,h,g)=>{if(++c,m.push(h),i.includes(g)){let E=a[g+1];E||(d=!0),m.push(E?U((h[0]+E[0])/2,(h[1]+E[1])/2):U(h[0],h[1])),l.push(c+1),++c}return m},[]);if(n.mutateElement(s,{points:u}),d){let m=s.points[s.points.length-1];e.movePoints(s,n,new Map([[s.points.length-1,{point:U(m[0]+30,m[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));Ye(t)&&t.polygon&&(i||o.includes(0)||o.includes(t.points.length-1))&&(r[0]=U(r[r.length-1][0],r[r.length-1][1]));let{points:a,offsetX:l,offsetY:d}=ya({points:r});e._updatePoints(t,n.scene,a,l,d)}static addPoints(t,n,o){let i=[...t.points,...o];Ye(t)&&t.polygon&&(i[0]=U(i[i.length-1][0],i[i.length-1][1]));let{points:r,offsetX:s,offsetY:a}=ya({points:i});e._updatePoints(t,n,r,s,a)}static movePoints(t,n,o,i,r){let{points:s}=t;if(Ye(t)&&t.polygon){let u=o.get(0),m=o.get(s.length-1);u?o.set(s.length-1,{point:U(u.point[0],u.point[1]),isDragging:u.isDragging}):m&&o.set(0,{point:U(m.point[0],m.point[1]),isDragging:m.isDragging})}let a=o.get(0)?.point??U(0,0),[l,d]=a,c=ee(t)?[o.get(0)?.point??s[0],o.get(s.length-1)?.point??s[s.length-1]]:s.map((u,m)=>{let h=o.get(m)?.point??u;return i?.moveMidPointsWithElement&&m!==0&&m!==s.length-1&&!o.has(m)?h:U(h[0]-l,h[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&&ee(r)||!r)return!1;let{segmentMidpoint:s}=t.initialState;if(s.added||s.value===null||s.index===null||t.initialState.origin===null)return!1;let a=t.initialState.origin,l=ho(a,U(n.x,n.y));return!(!o.selectedLinearElement?.isEditing&&l<zf/o.zoom.value)}static addMidpoint(t,n,o,i,r){let s=r.getNonDeletedElementsMap(),a=e.getElement(t.elementId,s);if(!a)return;let{segmentMidpoint:l}=t.initialState,d={pointerDownState:t.initialState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(a,s,n.x,n.y,i&&!ee(a)?o.getEffectiveGridSize():null),u=[...a.points.slice(0,l.index),c,...a.points.slice(l.index)];return r.mutateElement(a,{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,s,a){if(ee(t)){let l={};s?.startBinding!==void 0&&(l.startBinding=s.startBinding),s?.endBinding!==void 0&&(l.endBinding=s.endBinding),l.points=Array.from(o),n.mutateElement(t,l,{informMutation:!0,isDragging:a?.isDragging??!1,isBindingEnabled:a?.isBindingEnabled,isMidpointSnappingEnabled:a?.isMidpointSnappingEnabled})}else{let l=ba(t,o),d=ba(t,t.points),c=(l[0]+l[2])/2,u=(l[1]+l[3])/2,m=(d[0]+d[2])/2,h=(d[1]+d[3])/2,g=m-c,f=h-u,E=ct(U(i,r),U(g,f),t.angle);n.mutateElement(t,{...s,points:o,x:t.x+E[0],y:t.y+E[1]})}}static _getShiftLockedDelta(t,n,o,i,r,s){let a=e.getPointGlobalCoordinates(t,o,n);if(ee(t))return[i[0]-a[0],i[1]-a[1]];let[l,d]=Rc(i[0],i[1],r),{width:c,height:u}=_c(a[0],a[1],l,d,s);return ct(U(c,u),U(0,0),-t.angle)}static getBoundTextElementCenter=(t,n)=>{if(t.points.length%2===1){let i=Math.floor(t.points.length/2);return e.getPointGlobalCoordinates(t,t.points[i],n)}let o=t.points.length/2-1;return e.getSegmentMidPoint(t,o+1,n)};static getBoundTextElementPosition=(t,n,o)=>{e.getPointsGlobalCoordinates(t,o).length<2&&$e(n,o,{isDeleted:!0});let r=e.getBoundTextElementCenter(t,o);return{x:r[0]-n.width/2,y:r[1]-n.height/2}};static getMinMaxXYWithBoundText=(t,n,o,i)=>{let[r,s,a,l]=o,d=(r+a)/2,c=(s+l)/2,{x:u,y:m}=e.getBoundTextElementPosition(t,i,n),h=u+i.width,g=m+i.height,f=U(d,c),E=ct(U(r,s),f,t.angle),x=ct(U(a,s),f,t.angle),y=ct(U(u,m),f,-t.angle),b=ct(U(h,m),f,-t.angle),M=ct(U(u,g),f,-t.angle),w=ct(U(h,g),f,-t.angle);return E[0]<x[0]&&E[1]>=x[1]?(r=Math.min(r,M[0]),a=Math.max(a,Math.max(b[0],w[0])),s=Math.min(s,y[1]),l=Math.max(l,w[1])):E[0]>=x[0]&&E[1]>x[1]?(r=Math.min(r,w[0]),a=Math.max(a,Math.max(y[0],b[0])),s=Math.min(s,M[1]),l=Math.max(l,b[1])):E[0]>=x[0]?(r=Math.min(r,b[0]),a=Math.max(a,M[0]),s=Math.min(s,w[1]),l=Math.max(l,y[1])):E[1]<=x[1]&&(r=Math.min(r,Math.min(b[0],y[0])),a=Math.max(a,w[0]),s=Math.min(s,b[1]),l=Math.max(l,M[1])),[r,s,a,l,d,c]};static getElementAbsoluteCoords=(t,n,o=!1)=>{let i=Lt.generateElementShape(t,null),r=pn(i[0]),[s,a,l,d]=bi(r),c=s+t.x,u=a+t.y,m=l+t.x,h=d+t.y,g=(c+m)/2,f=(u+h)/2,E=o&&pe(t,n);return E?e.getMinMaxXYWithBoundText(t,n,[c,u,m,h],E):[c,u,m,h,g,f]};static moveFixedSegment(t,n,o,i,r){let s=r.getNonDeletedElementsMap(),a=e.getElement(t.elementId,s);if(!a||!ee(a))return t;if(n&&n>0&&n<a.points.length){let l=yt(rn(Rf(a.points[n],a.points[n-1]))),d=(a.fixedSegments??[]).reduce((h,g)=>(h[g.index]=g,h),{});d[n]={index:n,start:U(l?a.points[n-1][0]:o-a.x,l?i-a.y:a.points[n-1][1]),end:U(l?a.points[n][0]:o-a.x,l?i-a.y:a.points[n][1])};let c=Object.values(d).sort((h,g)=>h.index-g.index),u=c.map(h=>h.index).reduce((h,g)=>g<n?h+1:h,0);r.mutateElement(a,{fixedSegments:c});let m=U(a.x+(a.fixedSegments[u].start[0]+a.fixedSegments[u].end[0])/2,a.y+(a.fixedSegments[u].start[1]+a.fixedSegments[u].end[1])/2);return{...t,segmentMidPointHoveredCoords:m,initialState:{...t.initialState,segmentMidpoint:{added:!1,index:a.fixedSegments[u].index,value:m}}}}return t}static deleteFixedSegment(t,n,o){n.mutateElement(t,{fixedSegments:t.fixedSegments?.filter(i=>i.index!==o)})}},Wf=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,o)=>n-o),t.length?t:null},Fc=(e,t,n,o,i,r,s,a,l,d,c,u)=>{let m=new Map(e.map(V=>{let D=s.points[V]??s.points.at(-1);return[V,{point:U(D[0]+t,D[1]+n),isDragging:!0}]}));if(!J(s))return{positions:m};let h=e.includes(0),g=e.includes(s.points.length-1),{start:f,end:E}=sa(s,m,o,i,r,a,l.state,{newArrow:!!l.state.newElement,angleLocked:d,altKey:c,gridSize:l.getEffectiveGridSize()});if(ee(s)){let V=h?f.element:g?E.element:null;return{positions:m,updates:{suggestedBinding:V?{element:V,midPoint:l.state.isMidpointSnappingEnabled?aa(V,r,U(o-u.pointerOffset.x,i-u.pointerOffset.y)):void 0}:null}}}if(!h&&!g){let V={...s,points:s.points.map((B,I)=>m.get(I)?.point??B)},D=new Map(m);if(s.startBinding){let B=r.get(s.startBinding.elementId);if(B){let I=Yt(V,"startBinding",s.startBinding,B,r)??null;I&&D.set(0,{point:I,isDragging:!0})}}if(s.endBinding){let B=r.get(s.endBinding.elementId);if(B){let I=Yt(V,"endBinding",s.endBinding,B,r)??null;I&&D.set(s.points.length-1,{point:I,isDragging:!0})}}return{positions:D}}if(h===g)return{positions:m};let x={suggestedBinding:null};f.mode===null?x.startBinding=null:f.mode?(x.startBinding={elementId:f.element.id,mode:f.mode,...Go(s,f.element,"start",r,f.focusPoint)},h&&(x.startBinding.mode==="orbit"||!Ro("COMPLEX_BINDINGS"))&&(x.suggestedBinding=f.element?{element:f.element,midPoint:er(U(o-u.pointerOffset.x,i-u.pointerOffset.y),f.element,r,l.state.zoom)}:null)):h&&(x.suggestedBinding=l.state.suggestedBinding),E.mode===null?x.endBinding=null:E.mode?(x.endBinding={elementId:E.element.id,mode:E.mode,...Go(s,E.element,"end",r,E.focusPoint)},g&&(x.endBinding.mode==="orbit"||!Ro("COMPLEX_BINDINGS"))&&(x.suggestedBinding=E.element?{element:E.element,midPoint:er(U(o-u.pointerOffset.x,i-u.pointerOffset.y),E.element,r,l.state.zoom)}:null)):g&&(x.suggestedBinding=l.state.suggestedBinding);let y=h?U(s.points[0][0]+t,s.points[0][1]+n):s.points[0],b=g?U(s.points[s.points.length-1][0]+t,s.points[s.points.length-1][1]+n):s.points[s.points.length-1],M={...s,points:[y,...s.points.slice(1,-1),b],startBinding:x.startBinding===void 0?s.startBinding:x.startBinding===null?null:x.startBinding,endBinding:x.endBinding===void 0?s.endBinding:x.endBinding===null?null:x.endBinding},w=s.endBinding&&M.startBinding&&h&&M.startBinding.elementId===s.endBinding.elementId,v=s.startBinding&&M.endBinding&&g&&s.startBinding.elementId===M.endBinding.elementId,A=M.endBinding?E.element??r.get(M.endBinding.elementId):null,k=v&&l.state.bindMode!=="inside"&&Ro("COMPLEX_BINDINGS")?M.points[0]:A&&Yt(M,"endBinding",M.endBinding,A,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,z=v&&Ro("COMPLEX_BINDINGS")?M.points[0]:w&&l.state.bindMode!=="inside"&&Ro("COMPLEX_BINDINGS")?k:T&&Yt(M,"startBinding",M.startBinding,T,r,h)||M.points[0],C=!(v&&l.state.bindMode!=="inside"&&Ro("COMPLEX_BINDINGS"))&&!!A,O=ho(z,M.points[0])!==0,N=new Set(e);T&&O&&N.add(0),A&&C&&N.add(s.points.length-1);let j=Array.from(N);return{updates:x,positions:new Map(j.map(V=>[V,V===0?{point:z,isDragging:!0}:V===s.points.length-1?{point:k,isDragging:!0}:m.get(V)]))}},Hc=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]);S();import{MIME_TYPES as Yc,SVG_NS as Vf}from"@excalidraw/common";S();function Wc(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:s,abs:a}=Math,l=0,d=0,c=0,u=0;for(let $=0,X=0;$<e*t;$++,X+=4){let Y=n[X+3]/255;l+=Y/255*n[X],d+=Y/255*n[X+1],c+=Y/255*n[X+2],u+=Y}u&&(l/=u,d/=u,c/=u);let m=u<e*t,h=m?5:7,g=r(1,i(h*e/r(e,t))),f=r(1,i(h*t/r(e,t))),E=[],x=[],y=[],b=[];for(let $=0,X=0;$<e*t;$++,X+=4){let Y=n[X+3]/255,we=l*(1-Y)+Y/255*n[X],Q=d*(1-Y)+Y/255*n[X+1],me=c*(1-Y)+Y/255*n[X+2];E[$]=(we+Q+me)/3,x[$]=(we+Q)/2-me,y[$]=we-Q,b[$]=Y}let M=($,X,Y)=>{let we=0,Q=[],me=0,Ae=[];for(let ne=0;ne<Y;ne++)for(let ie=0;ie*Y<X*(Y-ne);ie++){let Ie=0;for(let ye=0;ye<e;ye++)Ae[ye]=s(o/e*ie*(ye+.5));for(let ye=0;ye<t;ye++)for(let He=0,Rt=s(o/t*ne*(ye+.5));He<e;He++)Ie+=$[He+ye*e]*Ae[He]*Rt;Ie/=e*t,ie||ne?(Q.push(Ie),me=r(me,a(Ie))):we=Ie}if(me)for(let ne=0;ne<Q.length;ne++)Q[ne]=.5+.5/me*Q[ne];return[we,Q,me]},[w,v,A]=M(E,r(3,g),r(3,f)),[k,T,z]=M(x,3,3),[C,O,N]=M(y,3,3),[j,V,D]=m?M(b,5,5):[],B=e>t,I=i(63*w)|i(31.5+31.5*k)<<6|i(31.5+31.5*C)<<12|i(31*A)<<18|m<<23,L=(B?f:g)|i(63*z)<<3|i(63*N)<<9|B<<15,G=[I&255,I>>8&255,I>>16,L&255,L>>8],_=m?6:5,K=0;m&&G.push(i(15*j)|i(15*D)<<4);for(let $ of m?[v,T,O,V]:[v,T,O])for(let X of $)G[_+(K>>1)]|=i(15*X)<<((K++&1)<<2);return new Uint8Array(G)}function jc(e){let{PI:t,min:n,max:o,cos:i,round:r}=Math,s=e[0]|e[1]<<8|e[2]<<16,a=e[3]|e[4]<<8,l=(s&63)/63,d=(s>>6&63)/31.5-1,c=(s>>12&63)/31.5-1,u=(s>>18&31)/31,m=s>>23,h=(a>>3&63)/63,g=(a>>9&63)/63,f=a>>15,E=o(3,f?m?5:7:a&7),x=o(3,f?a&7:m?5:7),y=m?(e[5]&15)/15:1,b=(e[5]>>4)/15,M=m?6:5,w=0,v=(B,I,L)=>{let G=[];for(let _=0;_<I;_++)for(let K=_?0:1;K*I<B*(I-_);K++)G.push(((e[M+(w>>1)]>>((w++&1)<<2)&15)/7.5-1)*L);return G},A=v(E,x,u),k=v(3,3,h*1.25),T=v(3,3,g*1.25),z=m&&v(5,5,b),C=jf(e),O=r(C>1?32:32*C),N=r(C>1?32/C:32),j=new Uint8Array(O*N*4),V=[],D=[];for(let B=0,I=0;B<N;B++)for(let L=0;L<O;L++,I+=4){let G=l,_=d,K=c,$=y;for(let Q=0,me=o(E,m?5:3);Q<me;Q++)V[Q]=i(t/O*(L+.5)*Q);for(let Q=0,me=o(x,m?5:3);Q<me;Q++)D[Q]=i(t/N*(B+.5)*Q);for(let Q=0,me=0;Q<x;Q++)for(let Ae=Q?0:1,ne=D[Q]*2;Ae*x<E*(x-Q);Ae++,me++)G+=A[me]*V[Ae]*ne;for(let Q=0,me=0;Q<3;Q++)for(let Ae=Q?0:1,ne=D[Q]*2;Ae<3-Q;Ae++,me++){let ie=V[Ae]*ne;_+=k[me]*ie,K+=T[me]*ie}if(m)for(let Q=0,me=0;Q<5;Q++)for(let Ae=Q?0:1,ne=D[Q]*2;Ae<5-Q;Ae++,me++)$+=z[me]*V[Ae]*ne;let X=G-2/3*_,Y=(3*G-X+K)/2,we=Y-K;j[I]=o(0,255*n(1,Y)),j[I+1]=o(0,255*n(1,we)),j[I+2]=o(0,255*n(1,X)),j[I+3]=o(0,255*n(1,$))}return{w:O,h:N,rgba:j}}function jf(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 Uf=100,Vc=new Map,Uc=new Set,Yf=e=>{let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t)},Xf=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},K4=e=>{let t=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(!t||!n)return null;let o=Math.min(1,Uf/Math.max(t,n)),i=Math.max(1,Math.round(t*o)),r=Math.max(1,Math.round(n*o)),s=document.createElement("canvas");s.width=i,s.height=r;let a=s.getContext("2d");if(!a)return null;a.drawImage(e,0,0,i,r);let l=a.getImageData(0,0,i,r);return Yf(Wc(i,r,l.data))},Xc=e=>{if(Uc.has(e))return null;let t=Vc.get(e);if(t)return t;try{let{w:n,h:o,rgba:i}=jc(Xf(e)),r=document.createElement("canvas");r.width=n,r.height=o;let s=r.getContext("2d");if(!s)return null;let a=s.createImageData(n,o);return a.data.set(i),s.putImageData(a,0,0),Vc.set(e,r),r}catch(n){return Uc.add(e),console.warn("Invalid ThumbHash",n),null}},$f=e=>new Promise((t,n)=>{let o=new Image;o.onload=()=>{t(o)},o.onerror=i=>{n(i)},o.src=e}),Q4=async({fileIds:e,files:t,imageCache:n})=>{let o=new Map,i=new Map;return await Promise.all(e.reduce((r,s)=>{let a=t[s];return a&&!o.has(s)?(o.set(s,!0),r.concat((async()=>{try{if(a.mimeType===Yc.binary)throw new Error("Only images can be added to ImageCache");let l=n.get(s),d=$f(a.dataURL),c={image:d,mimeType:a.mimeType};n.set(s,c);let u=await d;l?.isPlaceholder?n.set(s,{...c,image:u,placeholderImage:await l.image,transitionStart:performance.now()}):n.set(s,{...c,image:u})}catch{i.set(s,!0)}})())):r},[])),{imageCache:n,updatedFiles:o,erroredFiles:i}},J4=e=>e.filter(t=>Dn(t)),Zf=e=>e?.nodeName.toLowerCase()==="svg",e5=e=>{let t=new DOMParser().parseFromString(e,Yc.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!Zf(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",Vf);let i=n.getAttribute("width"),r=n.getAttribute("height");(i?.includes("%")||i==="auto")&&(i=null),(r?.includes("%")||r==="auto")&&(r=null);let s=n.getAttribute("viewBox");if(!i||!r){if(i=i||"50",r=r||"50",s){let a=s.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);a&&([,i,r]=a)}n.setAttribute("width",i),n.setAttribute("height",r)}return s||n.setAttribute("viewBox",`0 0 ${i} ${r}`),n.outerHTML}};var r0=(e,t)=>Dn(e)&&!t.imageCache.has(e.fileId),Br=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}},s0=(e,t,n,o,i=1)=>{let r=(t?.opacity??100)*e.opacity/1e4*i;return(n.has(e.id)||o&&o.some(s=>s.id===e.id)||t&&n.has(t.id))&&(r*=Qf/100),r},a0=(e,t,n)=>{let r=Br(e),[s,a,l,d]=ae(e,t),c=le(e)||Le(e)?Xn(s,l):e.width,u=le(e)||Le(e)?Xn(a,d):e.height,m=c*window.devicePixelRatio+r*2,h=u*window.devicePixelRatio+r*2,g=n.value;return(m*g>32767||h*g>32767)&&(g=Math.min(32767/m,32767/h)),m*h*g*g>16777216&&(g=Math.sqrt(16777216/(m*h))),m=Math.floor(m*g),h=Math.floor(h*g),{width:m,height:h,scale:g}},Kc=(e,t,n,o,i)=>{let r=document.createElement("canvas"),s=r.getContext("2d"),a=Br(e),{width:l,height:d,scale:c}=a0(e,t,n);if(!l||!d)return null;r.width=l,r.height=d;let u=-100,m=0;if(le(e)||Le(e)){let[g,f]=ae(e,t);u=e.x>g?Xn(e.x,g)*window.devicePixelRatio*c:0,m=e.y>f?Xn(e.y,f)*window.devicePixelRatio*c:0,s.translate(u,m)}s.save(),s.translate(a*c,a*c),s.scale(window.devicePixelRatio*c,window.devicePixelRatio*c);let h=Mo.canvas(r);return Dr(e,h,s,o),s.restore(),{element:e,canvas:r,theme:i.theme,scale:c,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:m,containingFrameOpacity:Wn(e,t)?.opacity||100,imageCrop:Ue(e)?e.crop:null}},g5=14,Qc=typeof document<"u"?document.createElement("img"):{src:""};Qc.src=`data:${Pa.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 Jc=typeof document<"u"?document.createElement("img"):{src:""};Jc.src=`data:${Pa.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 Zc=(e,t,n)=>{if(e.status!=="error"&&e.thumbHash){let r=Xc(e.thumbHash);if(r){t.drawImage(r,0,0,e.width,e.height);return}}t.fillStyle=n===Fo.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"?Jc:Qc,e.width/2-i/2,e.height/2-i/2,i,i)},Dr=(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(Lt.generateElementShape(e,o));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",Lt.generateElementShape(e,o).forEach(i=>{t.draw(i)});break}case"freedraw":{n.save();let i=Lt.generateElementShape(e,o);for(let r of i)typeof r=="string"?(n.fillStyle=Cr(e.strokeColor,o.theme===Fo.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=Dn(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,fn(Math.min(e.width,e.height),e)),n.clip());let s=o.imageTransitionDuration??0;if(!o.isExporting&&i?.transitionStart!==void 0)if(s>0){let m=Math.min(1,(performance.now()-i.transitionStart)/s);m<1?(i.placeholderImage?n.drawImage(i.placeholderImage,0,0,e.width,e.height):Zc(e,n,o.theme),n.globalAlpha*=m):(delete i.placeholderImage,delete i.transitionStart)}else delete i.placeholderImage,delete i.transitionStart;let{x:a,y:l,width:d,height:c}=e.crop?e.crop:{x:0,y:0,width:r.naturalWidth,height:r.naturalHeight},u=o.theme===Fo.DARK&&i?.mimeType===Pa.svg;if(u&&i0){let m=window.devicePixelRatio||1,h=document.createElement("canvas");h.width=e.width*m,h.height=e.height*m;let g=h.getContext("2d");if(g){g.scale(m,m),g.drawImage(r,a,l,d,c,0,0,e.width,e.height);let f=g.getImageData(0,0,h.width,h.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(h,0,0,h.width,h.height,0,0,e.width,e.height)}}else u&&(n.filter=Jf),n.drawImage(r,a,l,d,c,0,0,e.width,e.height)}else Zc(e,n,o.theme);n.restore();break}default:if(ue(e)){let i=t0(e.text),r=i&&!n.canvas.isConnected;r&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",i?"rtl":"ltr"),n.save(),n.font=e0(e),n.fillStyle=Cr(e.strokeColor,o.theme===Fo.DARK),n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
|
|
12
|
+
`),d.stack,e.map(u=>s(u)),...c),t)throw d}},yc=e=>e.sort((t,n)=>xc(t)&&xc(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),po=(e,t)=>{try{let n=Ar(e),o=Pf(e,t),i=ma(e,o),r=e.map(s=>{let a=i.get(s);return a?{...s,index:a.index}:s});Mf(r,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(let[s,{index:a}]of i)$e(s,n,{index:a})}catch{ha(e)}return e},ha=e=>{let t=Ar(e),n=wc(e),o=ma(e,n);for(let[i,{index:r}]of o)$e(i,t,{index:r});return e},bc=e=>{let t=Ar(e),n=wc(e),o=ma(e,n);for(let[i,{index:r}]of o)t.set(i.id,at(i,{index:r}));return t},Pf=(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},wc=e=>{let t=[],n,o,i=-1,r=0,s=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]},a=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]=s(l),[o,r]=a(l),pa(d,n,o))l++;else{let c=[i,l];for(;++l<e.length;){let u=e[l].index,[h,m]=s(l),[g,f]=a(l);if(pa(u,h,g))break;[n,i]=[h,m],[o,r]=[g,f],c.push(l)}c.push(r),t.push(c)}}return t},pa=(e,t,n)=>{if(!e)return!1;try{bf(e)}catch{return!1}return t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e},ma=(e,t)=>{let n=new Map;for(let o of t){let i=o.shift(),r=o.pop(),s=wf(e[i]?.index,e[r]?.index,o.length);for(let a=0;a<o.length;a++){let l=e[o[a]];n.set(l,{index:s[a]})}}return n},xc=e=>!!e.index;var Mc=(e,t,n)=>{let o=$t(e);for(let i of t)if(i.frameId){let r=n.get(i.id),s=n.get(i.frameId),a=r&&o.get(r);a&&$e(a,o,{frameId:s??null})}};function Ro(e,t,n){let o=Oo(t,n),i=Oo(e,n);return o.some(s=>i.some(a=>Sf(s,a)))}var Pc=(e,t,n)=>Tr(vc(e,t,n,!1)).filter(o=>!ce(o)&&!o.frameId||o.frameId===t.id),ga=(e,t,n)=>xa(we(e,n),we(t,n)),m4=(e,t)=>{let n=$t(e);return e.filter(o=>Ro(o,t,n))},jn=(e,t,n)=>{let[o,i,r,s]=ae(t,n),[a,l,d,c]=dt(e);return o<=a&&i<=l&&r>=d&&s>=c},Wn=(e,t,n)=>jn([e],t,n)||Ro(e,t,n)||ga(e,t,n),f4=(e,t,n)=>{let[o,i,r,s]=ae(t,n);return If(fa(o,i),fa(e.x,e.y),fa(r,s))},g4=(e,t,n)=>{let o=$t(e),i=t.flatMap(r=>lt(e,r));return i.length===0?!0:!!i.find(r=>jn([r],n,o)||Ro(r,n,o))},E4=(e,t,n)=>{let o=$t(e),i=t.flatMap(r=>lt(e,r));return i.length===0?!0:i.find(r=>jn([r],n,o)||Ro(r,n,o))===void 0},x4=e=>{let t=new Map;for(let n of e){let o=ce(n)?n.id:n.frameId;o&&!t.has(o)&&t.set(o,Vn(e,o))}return t},Vn=(e,t)=>{let n=[];for(let o of e.values())o.frameId===t&&n.push(o);return n},Ea=e=>e.filter(t=>ce(t)),y4=e=>{let t=$t(Ea(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},b4=(e,t,n,o)=>{let i=Vn(e,t.id),r=new Set(i),s=new Set([...Pc(e,t,o),...i.filter(m=>ga(m,t,o))]),a=i.filter(m=>!s.has(m)),l=new Set(Array.from(s).flatMap(m=>m.groupIds));for(let m of a)if(!Ro(m,t,o))m.groupIds.length===0&&r.delete(m);else if(m.groupIds.length>0)for(let g of m.groupIds)l.add(g);for(let m of a)if(m.groupIds.length>0){let g=!0;for(let f of m.groupIds)l.has(f)&&(g=!1);g&&r.delete(m)}let d=Array.from(s).filter(m=>m.groupIds.length===0);for(let m of d)r.add(m);let c=Array.from(s).filter(m=>m.groupIds.length>0),u=Xn(c),h=kc(u,n);for(let[m,g]of Object.entries(h))if(g){let f=lt(e,m);if(jn(f,t,o))for(let E of f)r.add(E)}return[...r].filter(m=>!(pe(m)&&m.containerId))},w4=(e,t,n)=>vf(Tr(e,Pc(e,t,n)),t,n),vf=(e,t,n)=>{let o=[],i=new Map;for(let r of e){let s=!1;if(r.groupIds.length>0){if(r.groupIds.some(a=>i.get(a)))s=!0;else{let a=new Set(r.groupIds.flatMap(l=>lt(n,l)));s=!jn(Array.from(a),t,n)}r.groupIds.forEach(a=>{i.set(a,s)})}s||o.push(r)}return o},Un=(e,t)=>e.frameId&&t.get(e.frameId)||null,M4=(e,t)=>{let n=new Set,o=$t(e);e=Tr(e);for(let s of e)ce(s)&&s.id!==t.id&&n.add(s.id);let i=new Set,r=[];for(let s of e)if(!(ce(s)||s.frameId&&n.has(s.frameId)))if(s.groupIds.length){let a=s.groupIds.at(-1);if(!i.has(a)){i.add(a);let l=lt(e,a);if(l.some(d=>Wn(d,t,o)))for(let d of l)r.push(d)}}else Wn(s,t,o)&&r.push(s);return r},kf=e=>{let t;for(let n of e){if(ce(n)||!n.frameId)return null;if(t===void 0)t=n.frameId;else if(t!==n.frameId)return null}return t??null},Af=(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},Tf=(e,t,n)=>{let o=$t(e),i=kf(t),r=new Set,s=new Set;for(let c of t)ce(c)&&c.id!==n.id&&s.add(c.id);for(let c of Tr(e,t)){if(ce(c)||c.frameId&&s.has(c.frameId))continue;r.add(c);let u=he(c,o);u&&!r.has(u)&&r.add(u)}for(let c of r)c.frameId!==n.id&&$e(c,o,{frameId:n.id});if(!r.size||i===n.id)return e;let a=Array.from(e.values()).filter(c=>!r.has(c)),l=Af(a,n.id);if(l===null)return e;let d=[...a.slice(0,l),...r,...a.slice(l)];return po(d,$t([...r])),Array.isArray(e)?d:new Map(d.map(c=>[c.id,c]))},Ic=(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 s=he(i,t);s&&(n.set(s.id,s),r.push(s)),o.set(i.frameId,r)}for(let[,i]of n)$e(i,t,{frameId:null})},Cf=(e,t)=>{let n=Vn(e,t.id);return Ic(n,$t(e)),e},P4=(e,t,n)=>Tf(Cf(e,n),t,n).slice(),I4=(e,t,n)=>{let o=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(o);if(t.editingGroupId)for(let a of o)a.groupIds.length===0?i.add(a):a.groupIds.flatMap(l=>lt(e,l)).forEach(l=>i.add(l));let r=new Set,s=$t(e);return i.forEach(a=>{a.frameId&&!ce(a)&&!Sc(a,s,t)&&r.add(a)}),r.size>0&&Ic(r,s),e},Tr=(e,t)=>{let n=new Set,o=t||e;for(let s of o.values()){let a=s.groupIds[s.groupIds.length-1];a&&n.add(a)}let i=new Set;for(let s of n)lt(e,s).some(a=>ce(a))&&i.add(s);let r=[];for(let s of o.values())i.has(s.groupIds[s.groupIds.length-1])||r.push(s);return r},Lf=(e,t,n)=>{let o=pe(e)&&et(e,t)||e;return o.frameId&&n.selectedElementIds[o.id]&&n.selectedElementIds[o.frameId]?Un(o,t):n.selectedElementIds[o.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Un(o,t)},Sc=(e,t,n,o)=>{let i=o?.targetFrame??Lf(e,t,n);if(!i)return!1;let r=pe(e)&&et(e,t)||e,s=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 Wn(r,i,t);for(let l of r.groupIds)if(o?.checkedGroups?.has(l))return o.checkedGroups.get(l);let a=new Set(r.groupIds.filter(l=>o?.checkedGroups?!o.checkedGroups.has(l):!0).flatMap(l=>lt(t,l)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let l=new Set(un(t,n));if(n.frameToHighlight!==null)return!0;l.forEach(c=>{a.delete(c)})}for(let l of a)if(ce(l))return s(!1),!1;for(let l of a)if(Wn(l,i,t))return s(!0),!0;return!1},S4=(e,t,n,o,i)=>{if(!n.frameRendering||!n.frameRendering.clip)return!1;let r=Ro(e,t,o)||ga(e,t,o);if(r){for(let s of e.groupIds)i?.set(s,!0);return!0}if(!r&&e.groupIds.length>0&&!jn([e],t,o)){let s=!1;if(n.selectedElementsAreBeingDragged)s=Sc(e,o,n,{targetFrame:t,checkedGroups:i});else{s=e.frameId===t.id;for(let a of e.groupIds)i?.set(a,s)}for(let a of e.groupIds)i?.set(a,s);return s}return!1},Df="Frame",Bf="AI Frame",Gf=e=>tr(e)?Df:Bf,v4=e=>e.name===null?Gf(e):e.name,k4=(e,t,n)=>e.filter(o=>(!o.frameId||o.frameId===t.id)&&Tt(we(o,n),we(t,n))),A4=e=>{let t=$t(e);return e.length>1&&e.some(n=>n.frameId&&t.has(n.frameId))};var Rf=e=>e.locked||Ne(e),Ff=(e,t)=>e.filter(n=>!(n.frameId&&t.has(n.frameId))),Hf=e=>{let t=new Set;return e.forEach(n=>{ce(n)&&t.add(n.id)}),Ff(e,t)},vc=(e,t,n,o=!0,i="contain")=>{let[r,s,a,l]=ae(t,n),d=Math.min(r,a),c=Math.min(s,l),u=Math.max(r,a),h=Math.max(s,l);return Tc({elements:e,bounds:[d,c,u,h],elementsMap:n,type:i,shouldIgnoreElementFromSelection:Rf,excludeElementsInFrames:o})},H4=(e,t,n,o)=>{let i=new Set(t.map(r=>r.id));return e.filter(r=>{let s=Cc(r,n.width,n.height,n,o);return!i.has(r.id)&&s})},_4=function(){let e=null,t=null,n=null,o=(i,r)=>(n!=null&&i===e&&r.selectedElementIds===t||(n=i.some(s=>r.selectedElementIds[s.id]),e=i,t=r.selectedElementIds),n);return o.clearCache=()=>{e=null,t=null,n=null},o}(),un=(e,t,n)=>{let o=new Set,i=[];for(let r of e.values()){if(t.selectedElementIds[r.id]){rt(r)?(i.push(r),o.add(r.id)):console.error("[NONDELETED][INVARIANT] getSelectedElements skipping deleted selected element which should not be in the selection");continue}if(n?.includeBoundTextElement&&Ne(r)&&rt(r)&&t.selectedElementIds[r?.containerId]){i.push(r),o.add(r.id);continue}}if(n?.includeElementsInFrames){let r=[];return i.forEach(s=>{ce(s)&&Vn(e,s.id).forEach(a=>!o.has(a.id)&&r.push(a)),r.push(s)}),r}return i},z4=(e,t)=>t.editingTextElement?[t.editingTextElement]:t.newElement&&t.activeTool.type!=="autoshape"?[t.newElement]:un(e,t,{includeBoundTextElement:!0}),ya=(e,t)=>Of(t.selectedElementIds,e)?t.selectedElementIds:e,_f=(e,t)=>{let n=e.filter(le);if(n.length===1){let o=n[0],i=o.boundElements?.map(s=>s.id)??[];if(e.every(s=>s.id===o.id||i.includes(s.id)))return new U(o,Nf(t))}return null},W4=(e,t,n)=>({selectedLinearElement:_f(e,t),...Ac({editingGroupId:n.editingGroupId,selectedElementIds:Hf(e).reduce((o,i)=>(Ne(i)||(o[i.id]=!0),o),{})},t,n,null)}),U4=(e,t)=>t.editingTextElement||e.length===1&&pe(e[0])&&e[0]||null;var zf=(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}}},Ac=function(){let e=null,t=null,n=null,o=(r,s,a,l)=>{if(n!==void 0&&s===t&&r===e&&a.editingGroupId===n?.editingGroupId)return n;let d={};for(let h of r){let m=h.groupIds;if(a.editingGroupId){let g=m.indexOf(a.editingGroupId);g>-1&&(m=m.slice(0,g))}if(m.length>0){let g=m[m.length-1];d[g]=!0}}let c={},u=s.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=s,e=r,n={editingGroupId:a.editingGroupId,selectedGroupIds:d,selectedElementIds:ya({...a.selectedElementIds,...u},l)},n},i=(r,s,a,l)=>{let d=l?l.scene.getSelectedElements({selectedElementIds:r.selectedElementIds,elements:s}):un(s,r);return d.length?o(d,s,r,a):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:ya(r.selectedElementIds,a)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),Wf=(e,t)=>ba(e,t)!=null,ba=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Uf=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),kc=(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,...zf(r,n,e)}}}return n.selectedGroupIds},Z4=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),jf=(e,t)=>e.groupIds.includes(t),lt=(e,t)=>{let n=[];for(let o of e.values())jf(o,t)&&n.push(o);return n},Vf=(e,t)=>e.groupIds.find(n=>t[n]),q4=(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},K4=(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)||[],s=he(o,t);s&&r.push(s),n.set(i,[...r,o])}),Array.from(n.values())},Lc=e=>{let t=new Set;for(let[,n]of e)if(!n.isDeleted)for(let o of n.groupIds??[])t.add(o);return t},Dc=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},Bc=e=>e.groupIds.length>0,Gc=(e,t,n)=>{let o=[...e],i=t?e.indexOf(t):-1,r=i>-1?i:e.length;for(let s=0;s<r;s++)o[s]=n(o[s]);return o},Lr=(e,t,n)=>{let o=new Map,r=Uf(n).length===1&&e.every(s=>Wf(n,s));return e.forEach(s=>{if(Ne(s))return;let a,l=Vf(s,n.selectedGroupIds);if(!l)a=`${s.id}_element`;else{let u=r?s.groupIds.indexOf(l)-1:s.groupIds.indexOf(l);a=u<0?`${s.id}_element`:`${s.groupIds[u]}_group`}let d=o.get(a)??[],c=he(s,t);o.set(a,[...d,s,...c?[c]:[]])}),[...o.values()]};var wa=(e,t)=>e.frameId===t||e.id===t,Hc=(e,t,n)=>{let o=[],i=[],r=null,s=-1,a=Oc(n||un(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++s<e.length;){let l=e[s];a.get(l.id)?(i.length&&(o=o.concat(i),i=[]),o.push(s),r=s+1):l.isDeleted&&r===s?(r=s+1,i.push(s)):i=[]}return o},Yf=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),[])},Nc=(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))}}},$f=(e,t)=>{let n=-1,o=-1;return e.forEach((i,r)=>{wa(i,t)&&(n===-1&&(n=r),o=r)}),n===-1?[]:e.slice(n,o+1)},bi=(e,t,n,o,i,r)=>{let s=r||bn(e,Xn(n),o);if(!s)return n;let a=he(s,o),l=pe(s)?et(s,o):null,d=[s.id,a?.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},Zf=(e,t,n,o,i,r)=>{let s=t[n],a=h=>h.isDeleted?!1:i?h.frameId===i:e.editingGroupId?h.groupIds.includes(e.editingGroupId):!0,l=o==="left"?Fc(t,h=>a(h),Math.max(0,n-1)):Rc(t,h=>a(h),n+1),d=t[l];if(!d)return-1;if(e.editingGroupId){if(s?.groupIds.join("")===d?.groupIds.join(""))return Nc(d,t,o,r)??l;if(!d?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(d.frameId||ce(d))){let h=$f(t,d.frameId||d.id);return o==="left"?t.indexOf(h[0]):t.indexOf(h[h.length-1])}if(!d.groupIds.length)return Nc(d,t,o,r)??l;let c=e.editingGroupId?d.groupIds[d.groupIds.indexOf(e.editingGroupId)-1]:d.groupIds[d.groupIds.length-1],u=lt(t,c);return u.length?o==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1]):l},_c=(e,t)=>t.reduce((n,o)=>{let i=e[o];return n.set(i.id,i),n},new Map),zc=(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},Wc=(e,t,n,o)=>{let i=e,r=Hc(e,t),s=_c(e,r),a=Yf(r);n==="right"&&(a=a.reverse());let l=new Set(r.filter(d=>ce(e[d])).map(d=>e[d].id));return a.forEach((d,c)=>{let u=d[0],h=d[d.length-1],m=n==="left"?u:h,g=d.some(M=>{let w=e[M];return w.frameId&&l.has(w.frameId)})?null:e[m]?.frameId,f=Zf(t,e,m,n,g,o);if(f===-1||m===f)return;let E=n==="left"?e.slice(0,f):e.slice(0,u),x=e.slice(u,h+1),y=n==="left"?e.slice(f,u):e.slice(h+1,f+1),b=n==="left"?e.slice(h+1):e.slice(f+1);e=n==="left"?[...E,...x,...y,...b]:[...E,...y,...x,...b]}),zc(i,e)?(po(e,s),e):i},Uc=(e,t,n,o,i)=>{let r=Hc(e,t,i);if(r.length===0)return e;let s=_c(e,r),a=[],l,d;if(n==="left"){if(o)l=Rc(e,f=>wa(f,o));else if(t.editingGroupId){let f=lt(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=Fc(e,f=>wa(f,o));else if(t.editingGroupId){let f=lt(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=>Xf(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)||a.push(e[f]);let u=Array.from(s.values()),h=e.slice(0,l),m=e.slice(d+1),g=n==="left"?[...h,...u,...a,...m]:[...h,...a,...u,...m];return zc(e,g)?(po(g,s),g):e};function jc(e,t,n,o){let i=Oc(un(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),r={regularElements:[],frameChildren:new Map},s=new Set;for(let d of e)i.has(d.id)&&ce(d)&&s.add(d.id);for(let d of e)if(i.has(d.id))if(ce(d)||d.frameId&&s.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 a=e,l=Array.from(r.frameChildren.entries());for(let[d,c]of l)a=o(a,t,n,d,c);return o(a,t,n,null,r.regularElements)}var d5=(e,t,n)=>Wc(e,t,"left",n),c5=(e,t,n)=>Wc(e,t,"right",n),u5=(e,t)=>jc(e,t,"left",Uc),p5=(e,t)=>jc(e,t,"right",Uc);var Ma=({points:e})=>{let t=e[0][0],n=e[0][1];return{points:e.map(o=>X(o[0]-t,o[1]-n)),offsetX:t,offsetY:n}},U=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,Xc(t.points[0],X(0,0))||(console.error("Linear element is not normalized",Error().stack),$e(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,arrowOtherEndpointInitialBinding:null,altFocusPoint:null},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null,this.hoveredFocusPointBinding=null,this.draggedFocusPointBinding=null,this.elbowed=ee(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:s,elementId:a}=r,l=e.getElement(a,i);if(!l)return!1;let[d,c,u,h]=ae(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&&s?.includes(x))&&f.push(x),f),[]).filter(f=>!(ee(l)&&f!==0&&f!==l.points.length-1));o({selectedLinearElement:{...r,selectedPointsIndices:g.length?g:null}})}static handlePointerMove(t,n,o,i,r){let s=n.scene.getNonDeletedElementsMap(),a=n.scene.getNonDeletedElements(),{elementId:l}=r,d=e.getElement(l,s);wt(d,"Element being dragged must exist in the scene"),wt(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??Zc(h,d.points[c]),g=0,f=0;if(mo(t)){let[v,k]=e._getShiftLockedDelta(d,s,h,X(o,i),t[ho.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),m),T=X(v+h[0],k+h[1]);g=T[0]-u[0],f=T[1]-u[1]}else{let v=e.createPointAt(d,s,o-r.pointerOffset.x,i-r.pointerOffset.y,t[ho.CTRL_OR_CMD]?null:n.getEffectiveGridSize());g=v[0]-u[0],f=v[1]-u[1]}let E=null,{positions:x,updates:y}=$c([c],g,f,o,i,s,d,a,n,mo(t),t.altKey,r),b=mo(t);if(e.movePoints(d,n.scene,x,{startBinding:y?.startBinding,endBinding:y?.endBinding,moveMidPointsWithElement:y?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled&&!b&&!n.state.gridModeEnabled}),Ke(d,!1)&&dn(n.state)&&(E=y?.suggestedBinding??null),Ke(d)&&bi(e.getPointGlobalCoordinates(d,d.points[d.points.length-1],s),d,a,s,n.scene),n.state.selectedLinearElement?.customLineAngle===m&&r.initialState.altFocusPoint&&(!E||e0(n.state.suggestedBinding??[],E)))return null;let M=Ke(d)&&d.startBinding&&s.get(d.startBinding.elementId);return{selectedLinearElement:{...r,customLineAngle:m,initialState:{...r.initialState,altFocusPoint:!r.initialState.altFocusPoint&&M&&y?.suggestedBinding?.element.id!==M.id?vo(d,X(d.x,d.y),M,"start",s,n.state.zoom,n.state.isMidpointSnappingEnabled&&!b&&!n.state.gridModeEnabled):r.initialState.altFocusPoint}},suggestedBinding:E}}static handlePointDragging(t,n,o,i,r){let s=n.scene.getNonDeletedElementsMap(),a=n.scene.getNonDeletedElements(),{elbowed:l,elementId:d,initialState:c}=r,u=Array.from(r.selectedPointsIndices??[]),{lastClickedPoint:h}=c,m=e.getElement(d,s);wt(m,"Element being dragged must exist in the scene"),wt(m.points.length>1,"Element must have at least 2 points"),wt(u,"There must be selected points in order to drag them"),l&&u.some((C,G)=>C>0&&C!==m.points.length-1?(u[G]=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??Zc(f,m.points[h]),y=u.includes(0),b=u.includes(m.points.length-1),M=0,w=0;if(mo(t)&&E){let[C,G]=e._getShiftLockedDelta(m,s,f,X(o,i),t[ho.CTRL_OR_CMD]?null:n.getEffectiveGridSize(),x),z=X(C+f[0],G+f[1]);M=z[0]-g[0],w=z[1]-g[1]}else{let C=e.createPointAt(m,s,o-r.pointerOffset.x,i-r.pointerOffset.y,t[ho.CTRL_OR_CMD]?null:n.getEffectiveGridSize());M=C[0]-g[0],w=C[1]-g[1]}let v=null,{positions:k,updates:T}=$c(u,M,w,o,i,s,m,a,n,mo(t)&&E,t.altKey,r),A=mo(t)&&E;e.movePoints(m,n.scene,k,{startBinding:T?.startBinding,endBinding:T?.endBinding,moveMidPointsWithElement:T?.moveMidPointsWithElement},{isBindingEnabled:n.state.isBindingEnabled,isMidpointSnappingEnabled:n.state.isMidpointSnappingEnabled&&!A&&!n.state.gridModeEnabled}),Ke(m,!1)&&dn(n.state)&&(y||b)&&(v=T?.suggestedBinding??null),Ke(m)&&y!==b&&bi(e.getPointGlobalCoordinates(m,y?m.points[0]:m.points[m.points.length-1],s),m,a,s,n.scene),he(m,s)&&co(m,n.scene,!1);let D=l?b?[m.points.length-1]:[0]:u,O=l?D[0]:h,N=!y&&!b?e.getPointGlobalCoordinates(m,g,s):null,W=O,j=Ke(m)&&m.startBinding&&s.get(m.startBinding.elementId),L=Ke(m)&&m.endBinding&&s.get(m.endBinding.elementId),B=b&&j&&T?.suggestedBinding?.element.id!==j.id?j:y&&L&&T?.suggestedBinding?.element.id!==L.id?L:null;return{selectedLinearElement:{...r,selectedPointsIndices:D,initialState:{...r.initialState,lastClickedPoint:O,altFocusPoint:!r.initialState.altFocusPoint&&Ke(m)&&B?vo(m,X(m.x,m.y),B,"start",s,n.state.zoom,n.state.isMidpointSnappingEnabled&&!A&&!n.state.gridModeEnabled):r.initialState.altFocusPoint},segmentMidPointHoveredCoords:N,hoverPointIndex:W,isDragging:!0,customLineAngle:x},suggestedBinding:v}}static handlePointerUp(t,n,o,i){let r=i.getNonDeletedElementsMap(),{elementId:s,selectedPointsIndices:a,isDragging:l,initialState:d}=n,c=e.getElement(s,r);if(!c)return n;if(l&&a)for(let u of a)(u===0||u===c.points.length-1)&&vt(c.points,o.zoom.value)&&(Xe(c)&&i.mutateElement(c,{...qc(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)?a&&a.filter(u=>u!==d.lastClickedPoint):a:a?.includes(d.lastClickedPoint)?[d.lastClickedPoint]:a,isDragging:!1,customLineAngle:null,initialState:{...n.initialState,origin:null,arrowStartIsInside:!1,arrowOtherEndpointInitialBinding:null}}}static getEditorMidPoints=(t,n,o)=>{let i=he(t,n);if(!ee(t)&&!o.selectedLinearElement?.isEditing&&t.points.length>2&&!i)return[];let r=e.getPointsGlobalCoordinates(t,n),s=0,a=[];for(;s<r.length-1;){if(e.isSegmentTooShort(t,t.points[s],t.points[s+1],s,o.zoom,n)){a.push(null),s++;continue}let l=e.getSegmentMidPoint(t,s+1,n);a.push(l),s++}return a};static getSegmentMidpointHitCoords=(t,n,o,i)=>{let{elementId:r}=t,s=e.getElement(r,i);if(!s)return null;let a=e.getPointIndexUnderCursor(s,i,o.zoom,n.x,n.y);if(!ee(s)&&a>=0||e.getPointsGlobalCoordinates(s,i).length>=3&&!o.selectedLinearElement?.isEditing&&!ee(s))return null;let d=(e.POINT_HANDLE_SIZE+1)/o.zoom.value,c=t.segmentMidPointHoveredCoords;if(c&&fo(X(c[0],c[1]),X(n.x,n.y))<=d)return c;let u=0,h=e.getEditorMidPoints(s,i,o);for(;u<h.length;){if(h[u]!==null&&fo(h[u],X(n.x,n.y))<=d)return h[u];u++}return null};static isSegmentTooShort(t,n,o,i,r,s){if(ee(t))return i>=0&&i<t.points.length?fo(n,o)*r.value<e.POINT_HANDLE_SIZE/2:!1;let a=fo(n,o);if(t.points.length>2&&t.roundness){let[l,d]=ao(t,s);wt(l.length===0&&d.length>0,"Only linears built out of curves are supported"),wt(l.length+d.length>=i,"Invalid segment index while calculating mid point"),a=Kf(d[i])}return a*r.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,o){if(ee(t)){wt(t.points.length>=n,"Invalid segment index while calculating elbow arrow mid point");let s=Vc(t.points[n-1],t.points[n]);return X(t.x+s[0],t.y+s[1])}let[i,r]=ao(t,o);if(wt(i.length===0&&r.length>0||i.length>0&&r.length===0,"Only linears built out of either segments or curves are supported"),wt(i.length+r.length>=n,"Invalid segment index while calculating mid point"),i.length){let s=i[n-1];return Vc(s[0],s[1])}if(r.length){let s=r[n-1];return Qf(s,.5)}wt(!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 s=e.getEditorMidPoints(r,i,n),a=0;for(;a<s.length;){if(e.arePointsEqual(o,s[a]))return a+1;a++}return-1}static handlePointerDown(t,n,o,i,r,s){let a=n.state,l=s.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,a,l),m=X(i.x,i.y),g=null;if(h)g=e.getSegmentMidPointIndex(r,a,h,l);else if(t.altKey&&a.selectedLinearElement?.isEditing)return r.lastUncommittedPoint==null&&(s.mutateElement(u,{points:[...u.points,e.createPointAt(u,l,i.x,i.y,t[ho.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,arrowOtherEndpointInitialBinding:u.startBinding},selectedPointsIndices:[u.points.length-1],lastUncommittedPoint:null},d.didAddPoint=!0,d;let f=e.getPointIndexUnderCursor(u,l,a.zoom,i.x,i.y);(f>=0||h)&&(d.hitElement=u);let[E,x,y,b]=ae(u,l),M=(E+y)/2,w=(x+b)/2,v=f>-1&&ct(X(u.x+u.points[f][0],u.y+u.points[f][1]),X(M,w),u.angle),k=f>-1||t.shiftKey?t.shiftKey||r.selectedPointsIndices?.includes(f)?t0([...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,arrowOtherEndpointInitialBinding:k?.includes(0)?u.endBinding:u.startBinding},selectedPointsIndices:k,pointerOffset:v?{x:i.x-v[0],y:i.y-v[1]}:{x:0,y:0}},d}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:Xc(t,n)}static handlePointerMoveInEditMode(t,n,o,i){let r=i.state;if(!r.selectedLinearElement?.isEditing)return null;let{elementId:s,lastUncommittedPoint:a}=r.selectedLinearElement,l=i.scene.getNonDeletedElementsMap(),d=e.getElement(s,l);if(!d)return r.selectedLinearElement;let{points:c}=d,u=c[c.length-1];if(!t.altKey)return u===a&&e.deletePoints(d,i,[c.length-1]),r.selectedLinearElement?.lastUncommittedPoint?{...r.selectedLinearElement,lastUncommittedPoint:null}:r.selectedLinearElement;let h;if(mo(t)&&c.length>=2){let m=c[c.length-2],[g,f]=e._getShiftLockedDelta(d,l,m,X(n,o),t[ho.CTRL_OR_CMD]?null:i.getEffectiveGridSize());h=X(g+m[0],f+m[1])}else h=e.createPointAt(d,l,n-r.selectedLinearElement.pointerOffset.x,o-r.selectedLinearElement.pointerOffset.y,t[ho.CTRL_OR_CMD]||ee(d)?null:i.getEffectiveGridSize());return u===a?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,s,a]=ae(t,o),l=(i+s)/2,d=(r+a)/2,{x:c,y:u}=t;return ct(X(c+n[0],u+n[1]),X(l,d),t.angle)}static getPointsGlobalCoordinates(t,n){let[o,i,r,s]=ae(t,n),a=(o+r)/2,l=(i+s)/2;return t.points.map(d=>{let{x:c,y:u}=t;return ct(X(c+d[0],u+d[1]),X(a,l),t.angle)})}static getPointAtIndexGlobalCoordinates(t,n,o){let i=n<0?t.points.length+n:n,[,,,,r,s]=ae(t,o),a=X(r,s),l=t.points[i],{x:d,y:c}=t;return l?ct(X(d+l[0],c+l[1]),a,t.angle):ct(X(d,c),a,t.angle)}static pointFromAbsoluteCoords(t,n,o){if(ee(t))return X(n[0]-t.x,n[1]-t.y);let[i,r,s,a]=ae(t,o),l=(i+s)/2,d=(r+a)/2,[c,u]=ct(X(n[0],n[1]),X(l,d),-t.angle);return X(c-t.x,u-t.y)}static getPointIndexUnderCursor(t,n,o,i,r){let s=e.getPointsGlobalCoordinates(t,n),a=s.length;for(;--a>-1;){let l=s[a];if(fo(X(i,r),X(l[0],l[1]))*o.value<e.POINT_HANDLE_SIZE+1)return a}return-1}static createPointAt(t,n,o,i,r){let s=Yc(o,i,r),[a,l,d,c]=ae(t,n),u=(a+d)/2,h=(l+c)/2,[m,g]=ct(X(s[0],s[1]),X(u,h),-t.angle);return X(m-t.x,g-t.y)}static getNormalizeElementPointsAndCoords(t){let{points:n,offsetX:o,offsetY:i}=Ma(t);return{points:n,x:t.x+o,y:t.y+i}}static duplicateSelectedPoints(t,n){wt(t.selectedLinearElement?.isEditing,"Not currently editing a linear element");let o=n.getNonDeletedElementsMap(),{selectedPointsIndices:i,elementId:r}=t.selectedLinearElement,s=e.getElement(r,o);wt(s,"The linear element does not exist in the provided Scene"),wt(i!=null,"There are no selected points to duplicate");let{points:a}=s,l=[],d=!1,c=-1,u=a.reduce((h,m,g)=>{if(++c,h.push(m),i.includes(g)){let E=a[g+1];E||(d=!0),h.push(E?X((m[0]+E[0])/2,(m[1]+E[1])/2):X(m[0],m[1])),l.push(c+1),++c}return h},[]);if(n.mutateElement(s,{points:u}),d){let h=s.points[s.points.length-1];e.movePoints(s,n,new Map([[s.points.length-1,{point:X(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));Xe(t)&&t.polygon&&(i||o.includes(0)||o.includes(t.points.length-1))&&(r[0]=X(r[r.length-1][0],r[r.length-1][1]));let{points:a,offsetX:l,offsetY:d}=Ma({points:r});e._updatePoints(t,n.scene,a,l,d)}static addPoints(t,n,o){let i=[...t.points,...o];Xe(t)&&t.polygon&&(i[0]=X(i[i.length-1][0],i[i.length-1][1]));let{points:r,offsetX:s,offsetY:a}=Ma({points:i});e._updatePoints(t,n,r,s,a)}static movePoints(t,n,o,i,r){let{points:s}=t;if(Xe(t)&&t.polygon){let u=o.get(0),h=o.get(s.length-1);u?o.set(s.length-1,{point:X(u.point[0],u.point[1]),isDragging:u.isDragging}):h&&o.set(0,{point:X(h.point[0],h.point[1]),isDragging:h.isDragging})}let a=o.get(0)?.point??X(0,0),[l,d]=a,c=ee(t)?[o.get(0)?.point??s[0],o.get(s.length-1)?.point??s[s.length-1]]:s.map((u,h)=>{let m=o.get(h)?.point??u;return i?.moveMidPointsWithElement&&h!==0&&h!==s.length-1&&!o.has(h)?m:X(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&&ee(r)||!r)return!1;let{segmentMidpoint:s}=t.initialState;if(s.added||s.value===null||s.index===null||t.initialState.origin===null)return!1;let a=t.initialState.origin,l=fo(a,X(n.x,n.y));return!(!o.selectedLinearElement?.isEditing&&l<Jf/o.zoom.value)}static addMidpoint(t,n,o,i,r){let s=r.getNonDeletedElementsMap(),a=e.getElement(t.elementId,s);if(!a)return;let{segmentMidpoint:l}=t.initialState,d={pointerDownState:t.initialState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(a,s,n.x,n.y,i&&!ee(a)?o.getEffectiveGridSize():null),u=[...a.points.slice(0,l.index),c,...a.points.slice(l.index)];return r.mutateElement(a,{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,s,a){if(ee(t)){let l={};s?.startBinding!==void 0&&(l.startBinding=s.startBinding),s?.endBinding!==void 0&&(l.endBinding=s.endBinding),l.points=Array.from(o),n.mutateElement(t,l,{informMutation:!0,isDragging:a?.isDragging??!1,isBindingEnabled:a?.isBindingEnabled,isMidpointSnappingEnabled:a?.isMidpointSnappingEnabled})}else{let l=Pa(t,o),d=Pa(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=ct(X(i,r),X(g,f),t.angle);n.mutateElement(t,{...s,points:o,x:t.x+E[0],y:t.y+E[1]})}}static _getShiftLockedDelta(t,n,o,i,r,s){let a=e.getPointGlobalCoordinates(t,o,n);if(ee(t))return[i[0]-a[0],i[1]-a[1]];let[l,d]=Yc(i[0],i[1],r),{width:c,height:u}=Kc(a[0],a[1],l,d,s);return ct(X(c,u),X(0,0),-t.angle)}static getBoundTextElementCenter=(t,n)=>{if(t.points.length%2===1){let i=Math.floor(t.points.length/2);return e.getPointGlobalCoordinates(t,t.points[i],n)}let o=t.points.length/2-1;return e.getSegmentMidPoint(t,o+1,n)};static getBoundTextElementPosition=(t,n,o)=>{e.getPointsGlobalCoordinates(t,o).length<2&&$e(n,o,{isDeleted:!0});let r=e.getBoundTextElementCenter(t,o);return{x:r[0]-n.width/2,y:r[1]-n.height/2}};static getMinMaxXYWithBoundText=(t,n,o,i)=>{let[r,s,a,l]=o,d=(r+a)/2,c=(s+l)/2,{x:u,y:h}=e.getBoundTextElementPosition(t,i,n),m=u+i.width,g=h+i.height,f=X(d,c),E=ct(X(r,s),f,t.angle),x=ct(X(a,s),f,t.angle),y=ct(X(u,h),f,-t.angle),b=ct(X(m,h),f,-t.angle),M=ct(X(u,g),f,-t.angle),w=ct(X(m,g),f,-t.angle);return E[0]<x[0]&&E[1]>=x[1]?(r=Math.min(r,M[0]),a=Math.max(a,Math.max(b[0],w[0])),s=Math.min(s,y[1]),l=Math.max(l,w[1])):E[0]>=x[0]&&E[1]>x[1]?(r=Math.min(r,w[0]),a=Math.max(a,Math.max(y[0],b[0])),s=Math.min(s,M[1]),l=Math.max(l,b[1])):E[0]>=x[0]?(r=Math.min(r,b[0]),a=Math.max(a,M[0]),s=Math.min(s,w[1]),l=Math.max(l,y[1])):E[1]<=x[1]&&(r=Math.min(r,Math.min(b[0],y[0])),a=Math.max(a,w[0]),s=Math.min(s,b[1]),l=Math.max(l,M[1])),[r,s,a,l,d,c]};static getElementAbsoluteCoords=(t,n,o=!1)=>{let i=Ct.generateElementShape(t,null),r=mn(i[0]),[s,a,l,d]=wi(r),c=s+t.x,u=a+t.y,h=l+t.x,m=d+t.y,g=(c+h)/2,f=(u+m)/2,E=o&&he(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 s=r.getNonDeletedElementsMap(),a=e.getElement(t.elementId,s);if(!a||!ee(a))return t;if(n&&n>0&&n<a.points.length){let l=yt(an(qf(a.points[n],a.points[n-1]))),d=(a.fixedSegments??[]).reduce((m,g)=>(m[g.index]=g,m),{});d[n]={index:n,start:X(l?a.points[n-1][0]:o-a.x,l?i-a.y:a.points[n-1][1]),end:X(l?a.points[n][0]:o-a.x,l?i-a.y:a.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(a,{fixedSegments:c});let h=X(a.x+(a.fixedSegments[u].start[0]+a.fixedSegments[u].end[0])/2,a.y+(a.fixedSegments[u].start[1]+a.fixedSegments[u].end[1])/2);return{...t,segmentMidPointHoveredCoords:h,initialState:{...t.initialState,segmentMidpoint:{added:!1,index:a.fixedSegments[u].index,value:h}}}}return t}static deleteFixedSegment(t,n,o){n.mutateElement(t,{fixedSegments:t.fixedSegments?.filter(i=>i.index!==o)})}},t0=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,o)=>n-o),t.length?t:null},$c=(e,t,n,o,i,r,s,a,l,d,c,u)=>{let h=new Map(e.map(j=>{let L=s.points[j]??s.points.at(-1);return[j,{point:X(L[0]+t,L[1]+n),isDragging:!0}]}));if(!J(s))return{positions:h};let m=e.includes(0),g=e.includes(s.points.length-1),{start:f,end:E}=da(s,h,o,i,r,a,l.state,{newArrow:!!l.state.newElement,angleLocked:d,altKey:c,gridSize:l.getEffectiveGridSize()});if(ee(s)){let j=m?f.element:g?E.element:null;return{positions:h,updates:{suggestedBinding:j?{element:j,midPoint:l.state.isMidpointSnappingEnabled?ca(j,r,X(o-u.pointerOffset.x,i-u.pointerOffset.y)):void 0}:null}}}if(!m&&!g){let j={...s,points:s.points.map((B,I)=>h.get(I)?.point??B)},L=new Map(h);if(s.startBinding){let B=r.get(s.startBinding.elementId);if(B){let I=Yt(j,"startBinding",s.startBinding,B,r)??null;I&&L.set(0,{point:I,isDragging:!0})}}if(s.endBinding){let B=r.get(s.endBinding.elementId);if(B){let I=Yt(j,"endBinding",s.endBinding,B,r)??null;I&&L.set(s.points.length-1,{point:I,isDragging:!0})}}return{positions:L}}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,...No(s,f.element,"start",r,f.focusPoint)},m&&(x.startBinding.mode==="orbit"||!Fo("COMPLEX_BINDINGS"))&&(x.suggestedBinding=f.element?{element:f.element,midPoint:or(X(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,...No(s,E.element,"end",r,E.focusPoint)},g&&(x.endBinding.mode==="orbit"||!Fo("COMPLEX_BINDINGS"))&&(x.suggestedBinding=E.element?{element:E.element,midPoint:or(X(o-u.pointerOffset.x,i-u.pointerOffset.y),E.element,r,l.state.zoom)}:null)):g&&(x.suggestedBinding=l.state.suggestedBinding);let y=m?X(s.points[0][0]+t,s.points[0][1]+n):s.points[0],b=g?X(s.points[s.points.length-1][0]+t,s.points[s.points.length-1][1]+n):s.points[s.points.length-1],M={...s,points:[y,...s.points.slice(1,-1),b],startBinding:x.startBinding===void 0?s.startBinding:x.startBinding===null?null:x.startBinding,endBinding:x.endBinding===void 0?s.endBinding:x.endBinding===null?null:x.endBinding},w=s.endBinding&&M.startBinding&&m&&M.startBinding.elementId===s.endBinding.elementId,v=s.startBinding&&M.endBinding&&g&&s.startBinding.elementId===M.endBinding.elementId,k=M.endBinding?E.element??r.get(M.endBinding.elementId):null,T=v&&l.state.bindMode!=="inside"&&Fo("COMPLEX_BINDINGS")?M.points[0]:k&&Yt(M,"endBinding",M.endBinding,k,r,g)||M.points[M.points.length-1];M.points[M.points.length-1]=T;let A=M.startBinding?f.element??r.get(M.startBinding.elementId):null,_=v&&Fo("COMPLEX_BINDINGS")?M.points[0]:w&&l.state.bindMode!=="inside"&&Fo("COMPLEX_BINDINGS")?T:A&&Yt(M,"startBinding",M.startBinding,A,r,m)||M.points[0],D=!(v&&l.state.bindMode!=="inside"&&Fo("COMPLEX_BINDINGS"))&&!!k,O=fo(_,M.points[0])!==0,N=new Set(e);A&&O&&N.add(0),k&&D&&N.add(s.points.length-1);let W=Array.from(N);return{updates:x,positions:new Map(W.map(j=>[j,j===0?{point:_,isDragging:!0}:j===s.points.length-1?{point:T,isDragging:!0}:h.get(j)]))}},Zc=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]);S();import{DEFAULT_GIF_AUTO_DECODE_MAX_FILE_SIZE_BYTES as A0,MIME_TYPES as Zt,SVG_NS as T0}from"@excalidraw/common";S();function Qc(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:s,abs:a}=Math,l=0,d=0,c=0,u=0;for(let $=0,V=0;$<e*t;$++,V+=4){let Y=n[V+3]/255;l+=Y/255*n[V],d+=Y/255*n[V+1],c+=Y/255*n[V+2],u+=Y}u&&(l/=u,d/=u,c/=u);let h=u<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=[],b=[];for(let $=0,V=0;$<e*t;$++,V+=4){let Y=n[V+3]/255,ue=l*(1-Y)+Y/255*n[V],q=d*(1-Y)+Y/255*n[V+1],me=c*(1-Y)+Y/255*n[V+2];E[$]=(ue+q+me)/3,x[$]=(ue+q)/2-me,y[$]=ue-q,b[$]=Y}let M=($,V,Y)=>{let ue=0,q=[],me=0,ke=[];for(let ne=0;ne<Y;ne++)for(let ie=0;ie*Y<V*(Y-ne);ie++){let Ie=0;for(let be=0;be<e;be++)ke[be]=s(o/e*ie*(be+.5));for(let be=0;be<t;be++)for(let He=0,Rt=s(o/t*ne*(be+.5));He<e;He++)Ie+=$[He+be*e]*ke[He]*Rt;Ie/=e*t,ie||ne?(q.push(Ie),me=r(me,a(Ie))):ue=Ie}if(me)for(let ne=0;ne<q.length;ne++)q[ne]=.5+.5/me*q[ne];return[ue,q,me]},[w,v,k]=M(E,r(3,g),r(3,f)),[T,A,_]=M(x,3,3),[D,O,N]=M(y,3,3),[W,j,L]=h?M(b,5,5):[],B=e>t,I=i(63*w)|i(31.5+31.5*T)<<6|i(31.5+31.5*D)<<12|i(31*k)<<18|h<<23,C=(B?f:g)|i(63*_)<<3|i(63*N)<<9|B<<15,G=[I&255,I>>8&255,I>>16,C&255,C>>8],z=h?6:5,Z=0;h&&G.push(i(15*W)|i(15*L)<<4);for(let $ of h?[v,A,O,j]:[v,A,O])for(let V of $)G[z+(Z>>1)]|=i(15*V)<<((Z++&1)<<2);return new Uint8Array(G)}function Jc(e){let{PI:t,min:n,max:o,cos:i,round:r}=Math,s=e[0]|e[1]<<8|e[2]<<16,a=e[3]|e[4]<<8,l=(s&63)/63,d=(s>>6&63)/31.5-1,c=(s>>12&63)/31.5-1,u=(s>>18&31)/31,h=s>>23,m=(a>>3&63)/63,g=(a>>9&63)/63,f=a>>15,E=o(3,f?h?5:7:a&7),x=o(3,f?a&7:h?5:7),y=h?(e[5]&15)/15:1,b=(e[5]>>4)/15,M=h?6:5,w=0,v=(B,I,C)=>{let G=[];for(let z=0;z<I;z++)for(let Z=z?0:1;Z*I<B*(I-z);Z++)G.push(((e[M+(w>>1)]>>((w++&1)<<2)&15)/7.5-1)*C);return G},k=v(E,x,u),T=v(3,3,m*1.25),A=v(3,3,g*1.25),_=h&&v(5,5,b),D=n0(e),O=r(D>1?32:32*D),N=r(D>1?32/D:32),W=new Uint8Array(O*N*4),j=[],L=[];for(let B=0,I=0;B<N;B++)for(let C=0;C<O;C++,I+=4){let G=l,z=d,Z=c,$=y;for(let q=0,me=o(E,h?5:3);q<me;q++)j[q]=i(t/O*(C+.5)*q);for(let q=0,me=o(x,h?5:3);q<me;q++)L[q]=i(t/N*(B+.5)*q);for(let q=0,me=0;q<x;q++)for(let ke=q?0:1,ne=L[q]*2;ke*x<E*(x-q);ke++,me++)G+=k[me]*j[ke]*ne;for(let q=0,me=0;q<3;q++)for(let ke=q?0:1,ne=L[q]*2;ke<3-q;ke++,me++){let ie=j[ke]*ne;z+=T[me]*ie,Z+=A[me]*ie}if(h)for(let q=0,me=0;q<5;q++)for(let ke=q?0:1,ne=L[q]*2;ke<5-q;ke++,me++)$+=_[me]*j[ke]*ne;let V=G-2/3*z,Y=(3*G-V+Z)/2,ue=Y-Z;W[I]=o(0,255*n(1,Y)),W[I+1]=o(0,255*n(1,ue)),W[I+2]=o(0,255*n(1,V)),W[I+3]=o(0,255*n(1,$))}return{w:O,h:N,rgba:W}}function n0(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}S();S();var o0="GIF",i0=["87a","89a"],r0=44,s0=33,a0=255,l0=11,d0=254,c0=249,u0=4,p0=1,h0=1,m0=59;function f0(e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0));return e.reduce((n,o)=>(t.set(o,n),n+o.byteLength),0),t}function eu(e,t,n){let o;if(ArrayBuffer.isView(e))o=e.buffer;else if(e instanceof ArrayBuffer)o=e;else{let i=document.createElement("canvas"),{width:r,height:s}=n||{},a=i.getContext("2d");if(!a)throw new Error("Failed to create canvas context2d");i.width=r??("width"in e?typeof e.width=="number"?e.width:e.width.baseVal.value:0),i.height=s??("height"in e?typeof e.height=="number"?e.height:e.height.baseVal.value:0),a.drawImage(e,0,0,i.width,i.height),o=a.getImageData(0,0,i.width,i.height).data.buffer}switch(t){case"uint8Array":return new Uint8Array(o);case"uint8ClampedArray":return new Uint8ClampedArray(o);case"dataView":return new DataView(o);default:throw new Error("Unsupported output format")}}var Ia=class{_view;offset=0;constructor(t){this._view=eu(t,"dataView")}readByte(){return this._view.getUint8(this.offset++)}readBytes(t){return Array.from({length:t}).map(()=>this.readByte())}readString(t){return String.fromCharCode(...this.readBytes(t))}readUnsigned(){return[this._view.getUint16(this.offset,!0),this.offset+=2][0]}readBits(){return this._view.getUint8(this.offset++).toString(2).padStart(8,"0").split("").map(Number)}readColorTable(t){return Array.from({length:t},()=>Array.from(this.readBytes(3)))}readSubBlock(){let t=[];for(;;){let n=this.readByte();if(n===0&&this._view.getUint8(this.offset)!==0)break;t.push(n)}return t}};function Sa(e){let t={},n=new Ia(e),o=()=>({index:0,delay:100,disposal:0}),i=n.readString(3),r=n.readString(3);if(i!==o0||!i0.includes(r))throw new Error("This is not a 87a/89a GIF data.");t.version=r,t.width=n.readUnsigned(),t.height=n.readUnsigned();let s=n.readBits();t.globalColorTable=!!s[0],t.colorResoluTion=Number.parseInt(s.slice(1,4).join(""),2)+1,t.colorTableSorted=!!s[4];let a=Number.parseInt(s.slice(5,8).join(""),2);t.colorTableSize=2**(a+1),t.backgroundColorIndex=n.readByte(),t.pixelAspectRatio=n.readByte(),t.globalColorTable&&(t.colorTableSize?t.colorTable=n.readColorTable(t.colorTableSize):n.readSubBlock()),t.frames=[];let l=o(),d=[],c=[];for(;;){let u=n.readByte();if(d.push(u),u===r0){l.left=n.readUnsigned(),l.top=n.readUnsigned(),l.width=n.readUnsigned(),l.height=n.readUnsigned();let h=n.readBits();l.localColorTable=!!h[0],l.interlaced=!!h[1],l.colorTableSorted=!!h[2],l.reserved=Number.parseInt(h.slice(3,5).join(""),2);let m=Number.parseInt(h.slice(5,8).join(""),2);for(l.colorTableSize=2**(m+1),l.localColorTable&&(l.colorTable=n.readColorTable(l.colorTableSize)),l.lzwMinCodeSize=n.readByte(),l.dataPositions=[];;){let g=n.readByte();if(g===0)break;let f=n.offset;l.dataPositions.push([f,g]),n.offset=f+g}t.frames.push(l),l=o(),l.index=t.frames.length;continue}if(u===s0){let h=n.readByte();if(c.push(h),h===a0){if(n.readByte()!==l0)continue;let m={identifier:n.readString(8),code:n.readString(3),data:[]};`${m.identifier}${m.code}`=="NETSCAPE2.0"&&n.readByte()===3&&(t.looped=!!n.readByte(),t.loopCount=n.readUnsigned()),m.data=n.readSubBlock(),l.application=m;continue}if(h===d0){l.comment=n.readSubBlock().map(m=>String.fromCharCode(m)).join("");continue}if(h===c0){if(n.readByte()!==u0)continue;let m=n.readBits(),g={reserved:Number.parseInt(m.slice(0,3).join(""),2),disposal:Number.parseInt(m.slice(3,6).join(""),2),userInput:!!m[6],transparent:!!m[7],delayTime:n.readUnsigned(),transparentIndex:n.readByte()};n.readSubBlock(),l.graphicControl=g,l.disposal=g.disposal,l.delay=(g.delayTime||10)*10;continue}if(h===p0){if(n.readByte()!==h0)continue;l.plainText={left:n.readUnsigned(),top:n.readUnsigned(),width:n.readUnsigned(),height:n.readUnsigned(),cellWidth:n.readByte(),cellHeight:n.readByte(),colorIndex:n.readByte(),backgroundColorIndex:n.readByte(),data:n.readSubBlock()};continue}console.warn(`Unknown extension block: 0x${h.toString(16)}`,d.slice(0,d.length-1).map(m=>`0x${m.toString(16)}`),c.slice(0,c.length-1).map(m=>`0x${m.toString(16)}`));continue}if(u===m0)break;console.warn(`Unknown block: 0x${u.toString(16)}`,d.slice(0,d.length-1).map(h=>`0x${h.toString(16)}`),c.slice(0,c.length-1).map(h=>`0x${h.toString(16)}`))}return t}function g0(e){let t=new Map,{workerUrl:n}=e,{workerNumber:o=1}=e,i=[...Array.from({length:n?o:0})].map(()=>{try{let l=new Worker(n);return l.onmessage=r,l}catch(l){return console.warn(l),null}}).filter(Boolean);o=i.length;function r(l){let{id:d,data:c}=l.data;t.get(d)?.(c),t.delete(d)}let s=function(){let l=0;return d=>i[(d??l++)%o]}();return{call:function(){let l=0;return(d,c,u,h)=>new Promise(m=>{let g=s(h);if(!g)return m(void 0);t.set(l,m),g.postMessage({id:l++,type:d,data:c},{transfer:u})})}()}}function E0(e,t){let n=Array.from({length:e.length}),o=e.length/t,i=[0,4,2,1],r=[8,8,4,2],s=0;for(let a=0;a<4;a++)for(let l=i[a];l<o;l+=r[a])n.splice.apply(n,[l*t,t].concat(e.slice(s*t,(s+1)*t))),s++;return n}function x0(e,t,n){let r=n,s,a,l,d,c,u,h,m=Array.from({length:n}),g=Array.from({length:4096}),f=Array.from({length:4096}),E=Array.from({length:4097}),x=e,y=1<<x,b=y+1;for(s=y+2,c=-1,l=x+1,a=(1<<l)-1,u=0;u<y;u++)g[u]=0,f[u]=u;let M,w,v,k,T,A;for(M=w=v=k=T=A=0,h=0;h<r;){if(k===0){if(w<l){M+=t[A]<<w,w+=8,A++;continue}if(u=M&a,M>>=l,w-=l,u>s||u===b)break;if(u===y){l=x+1,a=(1<<l)-1,s=y+2,c=-1;continue}if(c===-1){E[k++]=f[u],c=u,v=u;continue}for(d=u,u===s&&(E[k++]=v,u=c);u>y;)E[k++]=f[u],u=g[u];v=f[u]&255,E[k++]=v,s<4096&&(g[s]=c,f[s]=v,s++,!(s&a)&&s<4096&&(l++,a+=s)),c=d}k--,m[T++]=E[k],h++}for(h=T;h<r;h++)m[h]=0;return m}function va(e,t){let n=eu(e,"uint8Array");if(t?.workerUrl)return g0({workerUrl:t.workerUrl}).call("frames:decode",n,[n.buffer]);let{gif:o=Sa(e),range:i}=t??{},{width:r,height:s,colorTable:a,frames:l}=o,d=i?l.slice(i[0],i[1]+1):l,c=d.some(g=>g.disposal===3),u=new Uint8ClampedArray(r*s*4),h,m=u.slice();return d.map(g=>{let{left:f,top:E,width:x,height:y,interlaced:b,localColorTable:M,colorTable:w,lzwMinCodeSize:v,dataPositions:k,graphicControl:T,delay:A,disposal:_}=g,D=h?.disposal,O=E+y,{transparent:N,transparentIndex:W}=T??{},j=M?w:a,L=N?W:-1,B=f0(k.map(([C,G])=>n.subarray(C,C+G))),I=x0(v,B,x*y);if(b&&(I=E0(I,x)),D===3)u=m.slice();else if(D===2){let{left:C,top:G,width:z,height:Z}=h,$=G+Z;for(let V=G;V<$;V++){let Y=V*r+C;for(let ue=0;ue<z;ue++){let q=(Y+ue)*4;u[q]=u[q+1]=u[q+2]=u[q+3]=0}}}for(let C=E;C<O;C++){let G=C*r+f,z=(C-E)*x;for(let Z=0;Z<x;Z++){let $=I[z+Z],V=(G+Z)*4;if($!==L){let[Y,ue,q]=j?.[$]??[0,0,0];u[V]=Y,u[V+1]=ue,u[V+2]=q,u[V+3]=255}}}return c&&_!==1&&_!==3&&(m=u.slice()),h=g,{width:r,height:s,delay:A,data:u.slice()}})}var B5={"floyd-steinberg":[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]],stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]]};var y0=5,b0=(e,t)=>{console.debug("[excalidraw][gif-decode]",{mode:e,...t})},Mi,F5=e=>{Mi=e},w0=e=>{let t=e.indexOf(","),n=atob(e.slice(t+1)),o=new ArrayBuffer(n.length),i=new Uint8Array(o);for(let r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return o},M0=e=>typeof e=="string"&&e.startsWith("Unknown block: 0x"),P0=async e=>{let t=console.warn;console.warn=(...n)=>{M0(n[0])||t(...n)};try{return await e()}finally{console.warn=t}},I0=async e=>{let t=w0(e);b0(Mi?"worker":"main-thread",{byteLength:t.byteLength,workerUrl:Mi});let{gif:o,decodedFrames:i}=await P0(async()=>{let s=Sa(t);return{gif:s,decodedFrames:Mi?await va(t,{gif:s,workerUrl:Mi}):await va(t,{gif:s})}});return{frames:i.map(s=>{let a=document.createElement("canvas");a.width=s.width,a.height=s.height;let l=a.getContext("2d");if(l){let d=l.createImageData(s.width,s.height);d.data.set(s.data),l.putImageData(d,0,0)}return a}),delays:i.map(s=>Math.max(s.delay,16)),width:o.width,height:o.height}},ka=0,S0=0,Aa=!1,Pi=[],Ta=e=>{let t=e.indexOf(","),n=e.slice(t+1),o=n.endsWith("==")&&2||n.endsWith("=")&&1||0;return Math.floor(n.length*3/4)-o},v0=e=>{ka++,I0(e.dataURL).then(e.resolve,e.reject).finally(()=>{ka--,tu()})},k0=()=>{for(Aa=!1;ka<y0&&Pi.length;)v0(Pi.shift())},tu=()=>{Aa||(Aa=!0,queueMicrotask(k0))},nu=e=>new Promise((t,n)=>{let o={dataURL:e,priority:Ta(e),sequence:S0++,resolve:t,reject:n},i=Pi.findIndex(r=>r.priority>o.priority||r.priority===o.priority&&r.sequence>o.sequence);i===-1?Pi.push(o):Pi.splice(i,0,o),tu()}),H5=(e={})=>({frameIndex:0,speed:1,playing:e.playing??!1}),ou=(e,t,n)=>{let o=e.gifPlayback?.playing?n??e.gifPlayback.frameIndex:e.gifPlayback?.frameIndex??0;return t?.gif?.frames[o]},_5=(e,t)=>e.some(n=>{if(!Wt(n))return!1;let o=t.get(n.fileId);return o?.gifDecodeStatus==="pending"&&!o.gif?.frames.length}),z5=(e,t)=>e.some(n=>Wt(n)&&n.gifPlayback?.playing&&t.get(n.fileId)?.gif?.frames.length);var C0=100,iu=new Map,ru=new Set,L0=e=>{let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t)},D0=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},$5=e=>{let t=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(!t||!n)return null;let o=Math.min(1,C0/Math.max(t,n)),i=Math.max(1,Math.round(t*o)),r=Math.max(1,Math.round(n*o)),s=document.createElement("canvas");s.width=i,s.height=r;let a=s.getContext("2d");if(!a)return null;a.drawImage(e,0,0,i,r);let l=a.getImageData(0,0,i,r);return L0(Qc(i,r,l.data))},su=e=>{if(ru.has(e))return null;let t=iu.get(e);if(t)return t;try{let{w:n,h:o,rgba:i}=Jc(D0(e)),r=document.createElement("canvas");r.width=n,r.height=o;let s=r.getContext("2d");if(!s)return null;let a=s.createImageData(n,o);return a.data.set(i),s.putImageData(a,0,0),iu.set(e,r),r}catch(n){return ru.add(e),console.warn("Invalid ThumbHash",n),null}},B0=e=>new Promise((t,n)=>{let o=new Image;o.onload=()=>{t(o)},o.onerror=i=>{n(i)},o.src=e}),Z5=async({fileIds:e,files:t,imageCache:n,onImageCacheUpdate:o,gifAutoDecodeMaxFileSizeBytes:i=A0,forceGifDecode:r=!1})=>{let s=new Map,a=new Map;return await Promise.all(e.reduce((l,d)=>{let c=t[d];return c&&!s.has(d)?(s.set(d,!0),l.concat((async()=>{try{if(c.mimeType===Zt.binary)throw new Error("Only images can be added to ImageCache");let u=n.get(d),h=B0(c.dataURL),m={image:h,mimeType:c.mimeType,gifDecodeStatus:c.mimeType===Zt.gif?"pending":void 0};n.set(d,m),m.gifDecodeStatus==="pending"&&o?.(d);let g=h,f,E;try{if(g=await h,c.mimeType===Zt.gif){let x={...m,image:g,gifDecodeStatus:"pending"};n.set(d,x),o?.(d)}c.mimeType===Zt.gif&&!r&&Ta(c.dataURL)>i?E="deferred":(f=c.mimeType===Zt.gif?await nu(c.dataURL):void 0,c.mimeType===Zt.gif&&(E="success"))}catch{a.set(d,!0),c.mimeType===Zt.gif&&(E="error")}finally{c.mimeType===Zt.gif&&(n.set(d,{...m,image:g,gif:f,gifDecodeStatus:E??"error"}),o?.(d))}if(a.has(d))return;u?.isPlaceholder?n.set(d,{...m,image:g,gif:f,gifDecodeStatus:c.mimeType===Zt.gif?E:void 0,placeholderImage:await u.image,transitionStart:performance.now()}):n.set(d,{...m,image:g,gif:f,gifDecodeStatus:c.mimeType===Zt.gif?E:void 0}),o?.(d)}catch{a.set(d,!0)}})())):l},[])),{imageCache:n,updatedFiles:s,erroredFiles:a}},q5=e=>e.filter(t=>Wt(t)),G0=e=>e?.nodeName.toLowerCase()==="svg",K5=e=>{let t=new DOMParser().parseFromString(e,Zt.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!G0(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",T0);let i=n.getAttribute("width"),r=n.getAttribute("height");(i?.includes("%")||i==="auto")&&(i=null),(r?.includes("%")||r==="auto")&&(r=null);let s=n.getAttribute("viewBox");if(!i||!r){if(i=i||"50",r=r||"50",s){let a=s.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);a&&([,i,r]=a)}n.setAttribute("width",i),n.setAttribute("height",r)}return s||n.setAttribute("viewBox",`0 0 ${i} ${r}`),n.outerHTML}};S();var au=(e,t,n,o)=>{o(e,t,n);let i=.55+Math.sin(performance.now()/350)*.25,r="GIF Decoding",s="Assistant, system-ui, BlinkMacSystemFont, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",a=e.width/2,l=e.height/2;t.save(),t.globalAlpha*=i,t.textAlign="center",t.textBaseline="middle",t.font=`600 100px ${s}`;let d=e.width*.6,c=t.measureText(r).width,u=c?100*d/c:24,h=Math.max(12,Math.min(u,e.height*.35));t.font=`600 ${h}px ${s}`;let m=Number.parseFloat(t.font.match(/\d+(\.\d+)?px/)?.[0]??`${h}`),g=t.measureText(r).width,f=Math.max(12,m*.55),E=Math.max(8,m*.35),x=g+f*2,y=m+E*2,b=a-x/2,M=l-y/2,w=Math.min(y/2,m*.25);t.fillStyle="rgba(0, 0, 0, 0.62)",t.beginPath(),t.roundRect?t.roundRect(b,M,x,y,w):t.rect(b,M,x,y),t.fill(),t.fillStyle="#fff",t.fillText(r,a,l),t.restore()};var j0=(e,t)=>Wt(e)&&!t.imageCache.has(e.fileId),Or=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}},V0=(e,t,n,o,i=1)=>{let r=(t?.opacity??100)*e.opacity/1e4*i;return(n.has(e.id)||o&&o.some(s=>s.id===e.id)||t&&n.has(t.id))&&(r*=R0/100),r},X0=(e,t,n)=>{let r=Or(e),[s,a,l,d]=ae(e,t),c=le(e)||Ce(e)?$n(s,l):e.width,u=le(e)||Ce(e)?$n(a,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}},cu=(e,t,n,o,i)=>{let r=document.createElement("canvas"),s=r.getContext("2d"),a=Or(e),{width:l,height:d,scale:c}=X0(e,t,n);if(!l||!d)return null;r.width=l,r.height=d;let u=-100,h=0;if(le(e)||Ce(e)){let[g,f]=ae(e,t);u=e.x>g?$n(e.x,g)*window.devicePixelRatio*c:0,h=e.y>f?$n(e.y,f)*window.devicePixelRatio*c:0,s.translate(u,h)}s.save(),s.translate(a*c,a*c),s.scale(window.devicePixelRatio*c,window.devicePixelRatio*c);let m=Po.canvas(r);return Gr(e,m,s,o),s.restore(),{element:e,canvas:r,theme:i.theme,scale:c,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,containingFrameOpacity:Un(e,t)?.opacity||100,imageCrop:Ve(e)?e.crop:null}},EM=14,uu=typeof document<"u"?document.createElement("img"):{src:""};uu.src=`data:${Ba.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 pu=typeof document<"u"?document.createElement("img"):{src:""};pu.src=`data:${Ba.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 La=(e,t,n)=>{if(e.status!=="error"&&e.thumbHash){let r=su(e.thumbHash);if(r){t.drawImage(r,0,0,e.width,e.height);return}}t.fillStyle=n===Ho.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"?pu:uu,e.width/2-i/2,e.height/2-i/2,i,i)},Gr=(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(Ct.generateElementShape(e,o));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",Ct.generateElementShape(e,o).forEach(i=>{t.draw(i)});break}case"freedraw":{n.save();let i=Ct.generateElementShape(e,o);for(let r of i)typeof r=="string"?(n.fillStyle=Nr(e.strokeColor,o.theme===Ho.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=Wt(e)?i?.image:void 0;if(i?.gifDecodeStatus==="pending"&&!i.gif?.frames.length)au(e,n,o.theme,La);else if(r!=null&&!(r instanceof Promise)){e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,En(Math.min(e.width,e.height),e)),n.clip());let s=o.imageTransitionDuration??0;if(!o.isExporting&&i?.transitionStart!==void 0)if(s>0){let g=Math.min(1,(performance.now()-i.transitionStart)/s);g<1?(i.placeholderImage?n.drawImage(i.placeholderImage,0,0,e.width,e.height):La(e,n,o.theme),n.globalAlpha*=g):(delete i.placeholderImage,delete i.transitionStart)}else delete i.placeholderImage,delete i.transitionStart;let l=ou(e,i,o.getGifFrameIndex?.(e))??r,{x:d,y:c,width:u,height:h}=e.crop?e.crop:{x:0,y:0,width:l instanceof HTMLCanvasElement?l.width:l.naturalWidth,height:l instanceof HTMLCanvasElement?l.height:l.naturalHeight},m=o.theme===Ho.DARK&&i?.mimeType===Ba.svg;if(m&&U0){let g=window.devicePixelRatio||1,f=document.createElement("canvas");f.width=e.width*g,f.height=e.height*g;let E=f.getContext("2d");if(E){E.scale(g,g),E.drawImage(l,d,c,u,h,0,0,e.width,e.height);let x=E.getImageData(0,0,f.width,f.height),y=x.data;for(let b=0;b<y.length;b+=4)y[b]=255-y[b],y[b+1]=255-y[b+1],y[b+2]=255-y[b+2];E.putImageData(x,0,0),n.drawImage(f,0,0,f.width,f.height,0,0,e.width,e.height)}}else m&&(n.filter=F0),n.drawImage(l,d,c,u,h,0,0,e.width,e.height)}else La(e,n,o.theme);n.restore();break}default:if(pe(e)){let i=_0(e.text),r=i&&!n.canvas.isConnected;r&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",i?"rtl":"ltr"),n.save(),n.font=H0(e),n.fillStyle=Nr(e.strokeColor,o.theme===Ho.DARK),n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
|
|
13
13
|
`).split(`
|
|
14
|
-
`),a=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,l=ir(e.fontSize,e.lineHeight),d=n0(e.fontFamily,e.fontSize,l);for(let c=0;c<s.length;c++)n.fillText(s[c],a,c*l+d);n.restore(),r&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},wi=new WeakMap,qc=(e,t,n,o)=>{let i=n?o.zoom:{value:1},r=wi.get(e),s=r&&r.zoomValue!==i.value&&!o?.shouldCacheIgnoreZoom,a=Ue(e)?e.crop:null,l=Dn(e)&&n.imageCache.get(e.fileId)?.transitionStart!==void 0,d=Wn(e,t)?.opacity||100;if(!r||s||r.theme!==o.theme||r.imageCrop!==a||l||r.containingFrameOpacity!==d){let c=Kc(e,t,i,n,o);return c?(wi.set(e,c),c):null}return r},Ma=(e,t,n,o,i)=>{let r=e.element,s=Br(r),[a,l,d,c]=ae(r,i),u=((a+d)/2+o.scrollX)*window.devicePixelRatio,m=((l+c)/2+o.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let h=pe(r,i);if(J(r)&&h){let[,,,,g,f]=ae(h,i),E=Math.max(Xn(a,d),Xn(l,c))*window.devicePixelRatio+s*10;t.beginPath(),t.rect(u-E,m-E,E*2,E*2),t.rect((g-h.width/2-Yn+o.scrollX)*window.devicePixelRatio,(f-h.height/2-Yn+o.scrollY)*window.devicePixelRatio,(h.width+Yn*2)*window.devicePixelRatio,(h.height+Yn*2)*window.devicePixelRatio),t.clip("evenodd")}if(t.translate(u,m),t.rotate(r.angle),"scale"in e.element&&!r0(r,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-u,-m),t.drawImage(e.canvas,(a+o.scrollX)*window.devicePixelRatio-s*e.scale/e.scale,(l+o.scrollY)*window.devicePixelRatio-s*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),F.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&Jt(r)){let g=pe(r,i),f=Ns(r);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((f.x+o.scrollX)*window.devicePixelRatio,(f.y+o.scrollY)*window.devicePixelRatio,jt(r,g)*window.devicePixelRatio,mi(r,g)*window.devicePixelRatio)}t.restore()},E5=(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()},x5=(e,t,n,o,i,r,s)=>{let a=s.openDialog?.name==="elementLinkSelector"&&!s.selectedElementIds[e.id]&&!s.hoveredElementIds[e.id];switch(i.globalAlpha=s0(e,Wn(e,t),r.elementsPendingErasure,r.pendingFlowchartNodes,a?Kf:1),e.type){case"magicframe":case"frame":{s.frameRendering.enabled&&s.frameRendering.outline&&(i.save(),i.translate(e.x+s.scrollX,e.y+s.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=Lr.strokeWidth/s.zoom.value,i.strokeStyle=Cr(Lr.strokeColor,s.theme===Fo.DARK),td(e)&&(i.strokeStyle=s.theme===Fo.LIGHT?"#7affd7":Cr("#1d8264")),Lr.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,Lr.radius/s.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]=ae(e,t),m=(l+c)/2+s.scrollX,h=(d+u)/2+s.scrollY,g=(c-l)/2-(e.x-l),f=(u-d)/2-(e.y-d);i.save(),i.translate(m,h),i.rotate(e.angle),i.translate(-g,-f),Dr(e,o,i,r),i.restore()}else{let l=qc(e,n,r,s);if(!l)return;Ma(l,i,r,s,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]=ae(e,t),m=(l+c)/2,h=(d+u)/2,g=m+s.scrollX,f=h+s.scrollY,E=(c-l)/2-(e.x-l),x=(u-d)/2-(e.y-d);if(ue(e)){let b=et(e,t);if(J(b)){let M=W.getBoundTextElementPosition(b,e,t);E=(c-l)/2-(M.x-l),x=(u-d)/2-(M.y-d)}}i.save(),i.translate(g,f);let y=pe(e,t);if(J(e)&&y){E=e.width/2-(e.x-l),x=e.height/2-(e.y-d);let[,,,,b,M]=ae(y,t),w=b-m-y.width/2-Yn,v=M-h-y.height/2-Yn,A=y.width+Yn*2,k=y.height+Yn*2,T=Math.max(Xn(l,c),Xn(d,u))+Br(e)*10;i.save(),i.beginPath(),i.rect(-T,-T,T*2,T*2),i.rect(w,v,A,k),i.clip("evenodd"),i.rotate(e.angle),i.translate(-E,-x),Dr(e,o,i,r),i.restore()}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-E,-x),Dr(e,o,i,r);i.restore()}else{let l=qc(e,n,r,s);if(!l)return;let d=i.imageSmoothingEnabled;if(!s?.shouldCacheIgnoreZoom&&(!e.angle||qf(e.angle))&&(i.imageSmoothingEnabled=!1),e.id===s.croppingElementId&&Ue(l.element)&&l.element.crop!==null){i.save(),i.globalAlpha=.1;let c=Kc(Ql(l.element,t),n,s.zoom,r,s);c&&Ma(c,i,r,s,n),i.restore()}Ma(l,i,r,s,n),i.imageSmoothingEnabled=d}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1};function y5(e,t,n){let o=be({...e,angle:0},n),i=kr((o[0]+o[2])/2,(o[1]+o[3])/2);return o0(t.length>=2,"Freepath outline must have at least 2 points"),t.slice(2).reduce((r,s)=>(r.push($c(r[r.length-1][1],wa(kr(s[0]+e.x,s[1]+e.y),i,e.angle))),r),[$c(wa(kr(t[0][0]+e.x,t[0][1]+e.y),i,e.angle),wa(kr(t[1][0]+e.x,t[1][1]+e.y),i,e.angle))])}var Lt=class e{static rg=new Ct;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),wi.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;wi.delete(t);let i=f0(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:c0.white,embedsValidationStatus:null,theme:Sa.LIGHT});return n?.isExporting||e.cache.set(t,{shape:i,theme:n?.theme||Sa.LIGHT}),i}},m0=e=>[8,8+e],iu=e=>[1.5,6+e];function h0(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&&Pd(e.type)||le(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var Mt=(e,t=!1,n=!1)=>{let o={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?m0(e.strokeWidth):e.strokeStyle==="dotted"?iu(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:h0(e),stroke:Ii(e.strokeColor,n),preserveVertices:t||e.roughness<l0.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return o.fillStyle=e.fillStyle,o.fill=Pi(e.backgroundColor)?void 0:Ii(e.backgroundColor,n),e.type==="ellipse"&&(o.curveFitting=1),o;case"line":case"freedraw":return vt(e.points)&&(o.fillStyle=e.fillStyle,o.fill=e.backgroundColor==="transparent"?void 0:Ii(e.backgroundColor,n)),o;case"arrow":return o;default:throw new Error(`Unimplemented type ${e.type}`)}},tu=(e,t,n)=>Ki(e)&&(t||ed(e)&&n?.get(e.id)!==!0)&&Pi(e.backgroundColor)&&Pi(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:qi(e)?{...e,strokeColor:Pi(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:Pi(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,Mi=(e,t,n)=>{if(t===null)return[];let[,,o,i,r,s]=t;return[e.line(o,i,r,s,n)]},Gr=(e,t,n)=>{if(t===null)return[];let[o,i,r,s,a,l]=t;return[e.line(r,s,o,i,n),e.line(a,l,o,i,n)]},fo=(e,t)=>{let n={...t};if(e.strokeStyle==="dotted"){let o=iu(e.strokeWidth-1);n.strokeLineDash=[o[0],o[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},Ia=(e,t,n,o,i,r=1)=>{if(o===null)return[];let[s,a,l]=o,d={...t,fill:i,fillStyle:"solid",stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete d.strokeLineDash,[e.circle(s,a,l*r,d)]},nu=(e,t,n,o,i,r,s,a)=>{if(o===null)return[];let l=Ii(e.strokeColor,a),d=Ii(s,a),c=-.25,u=.8;switch(o){case"circle":case"circle_outline":return Ia(i,r,l,ut(e,t,n,o),o==="circle_outline"?d:l);case"triangle":case"triangle_outline":{let m=ut(e,t,n,o);if(m===null)return[];let[h,g,f,E,x,y]=m,b={...r,fill:o==="triangle_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete b.strokeLineDash,[i.polygon([[h,g],[f,E],[x,y],[h,g]],b)]}case"diamond":case"diamond_outline":{let m=ut(e,t,n,o);if(m===null)return[];let[h,g,f,E,x,y,b,M]=m,w={...r,fill:o==="diamond_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete w.strokeLineDash,[i.polygon([[h,g],[f,E],[x,y],[b,M],[h,g]],w)]}case"cardinality_one":return Mi(i,ut(e,t,n,o),fo(e,r));case"cardinality_many":return Gr(i,ut(e,t,n,o),fo(e,r));case"cardinality_one_or_many":{let m=fo(e,r);return[...Gr(i,ut(e,t,n,"cardinality_many"),m),...Mi(i,ut(e,t,n,"cardinality_one",c),m)]}case"cardinality_exactly_one":{let m=fo(e,r);return[...Mi(i,ut(e,t,n,"cardinality_one",-.5),m),...Mi(i,ut(e,t,n,"cardinality_one"),m)]}case"cardinality_zero_or_one":{let m=fo(e,r);return[...Ia(i,r,l,ut(e,t,n,"circle_outline",1.5),d,u),...Mi(i,ut(e,t,n,"cardinality_one",-.5),m)]}case"cardinality_zero_or_many":{let m=fo(e,r);return[...Gr(i,ut(e,t,n,"cardinality_many"),m),...Ia(i,r,l,ut(e,t,n,"circle_outline",1.5),d,u)]}case"bar":case"arrow":default:return Gr(i,ut(e,t,n,o),fo(e,r))}},md=(e,t)=>{let n=new Ct,o={seed:e.seed,disableMultiStroke:!0,disableMultiStrokeFill:!0,roughness:0,preserveVertices:!0},i=he(e,t);switch(e.type){case"line":case"arrow":{let r=e.points.length?e.points:[Ce(0,0)];return ee(e)?n.path(ru(r,16),o).sets[0].ops:e.roundness?n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((s,a)=>{if(a===0){let l=Mn(Ce(e.x+s.data[0],e.y+s.data[1]),i,e.angle);return{op:"move",data:Ce(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[Mn(Ce(e.x+s.data[0],e.y+s.data[1]),i,e.angle),Mn(Ce(e.x+s.data[2],e.y+s.data[3]),i,e.angle),Mn(Ce(e.x+s.data[4],e.y+s.data[5]),i,e.angle)].map(l=>Ce(l[0]-e.x,l[1]-e.y)).flat()}}):r.map((s,a)=>{let l=Mn(Ce(e.x+s[0],e.y+s[1]),i,e.angle);return{op:a===0?"move":"lineTo",data:Ce(l[0]-e.x,l[1]-e.y)}})}case"freedraw":{if(e.points.length<2)return[];let r=Tn(e.points,.75);return n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((s,a)=>{if(a===0){let l=Mn(Ce(e.x+s.data[0],e.y+s.data[1]),i,e.angle);return{op:"move",data:Ce(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[Mn(Ce(e.x+s.data[0],e.y+s.data[1]),i,e.angle),Mn(Ce(e.x+s.data[2],e.y+s.data[3]),i,e.angle),Mn(Ce(e.x+s.data[4],e.y+s.data[5]),i,e.angle)].map(l=>Ce(l[0]-e.x,l[1]-e.y)).flat()}})}}},f0=(e,t,{isExporting:n,canvasBackgroundColor:o,embedsValidationStatus:i,theme:r})=>{let s=r===Sa.DARK;switch(e.type){case"rectangle":case"iframe":case"embeddable":{let a;if(e.roundness){let l=e.width,d=e.height,c=fn(Math.min(l,d),e);a=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`,Mt(tu(e,n,i),!0,s))}else a=t.rectangle(0,0,e.width,e.height,Mt(tu(e,n,i),!1,s));return a}case"diamond":{let a,[l,d,c,u,m,h,g,f]=vo(e);if(e.roundness){let E=fn(Math.abs(l-g),e),x=fn(Math.abs(u-d),e);a=t.path(`M ${l+E} ${d+x} L ${c-E} ${u-x}
|
|
14
|
+
`),a=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,l=ar(e.fontSize,e.lineHeight),d=z0(e.fontFamily,e.fontSize,l);for(let c=0;c<s.length;c++)n.fillText(s[c],a,c*l+d);n.restore(),r&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},Ii=new WeakMap,du=(e,t,n,o)=>{let i=n?o.zoom:{value:1},r=Ii.get(e),s=r&&r.zoomValue!==i.value&&!o?.shouldCacheIgnoreZoom,a=Ve(e)?e.crop:null,l=Wt(e)&&n.imageCache.get(e.fileId)?.transitionStart!==void 0,d=Un(e,t)?.opacity||100;if(!r||s||r.theme!==o.theme||r.imageCrop!==a||l||r.containingFrameOpacity!==d){let c=cu(e,t,i,n,o);return c?(Ii.set(e,c),c):null}return r},Da=(e,t,n,o,i)=>{let r=e.element,s=Or(r),[a,l,d,c]=ae(r,i),u=((a+d)/2+o.scrollX)*window.devicePixelRatio,h=((l+c)/2+o.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let m=he(r,i);if(J(r)&&m){let[,,,,g,f]=ae(m,i),E=Math.max($n(a,d),$n(l,c))*window.devicePixelRatio+s*10;t.beginPath(),t.rect(u-E,h-E,E*2,E*2),t.rect((g-m.width/2-Yn+o.scrollX)*window.devicePixelRatio,(f-m.height/2-Yn+o.scrollY)*window.devicePixelRatio,(m.width+Yn*2)*window.devicePixelRatio,(m.height+Yn*2)*window.devicePixelRatio),t.clip("evenodd")}if(t.translate(u,h),t.rotate(r.angle),"scale"in e.element&&!j0(r,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-u,-h),t.drawImage(e.canvas,(a+o.scrollX)*window.devicePixelRatio-s*e.scale/e.scale,(l+o.scrollY)*window.devicePixelRatio-s*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),F.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&tn(r)){let g=he(r,i),f=Fs(r);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((f.x+o.scrollX)*window.devicePixelRatio,(f.y+o.scrollY)*window.devicePixelRatio,jt(r,g)*window.devicePixelRatio,mi(r,g)*window.devicePixelRatio)}t.restore()},xM=(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()},yM=(e,t,n,o,i,r,s)=>{let a=s.openDialog?.name==="elementLinkSelector"&&!s.selectedElementIds[e.id]&&!s.hoveredElementIds[e.id];switch(i.globalAlpha=V0(e,Un(e,t),r.elementsPendingErasure,r.pendingFlowchartNodes,a?O0:1),e.type){case"magicframe":case"frame":{s.frameRendering.enabled&&s.frameRendering.outline&&(i.save(),i.translate(e.x+s.scrollX,e.y+s.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=Br.strokeWidth/s.zoom.value,i.strokeStyle=Nr(Br.strokeColor,s.theme===Ho.DARK),ud(e)&&(i.strokeStyle=s.theme===Ho.LIGHT?"#7affd7":Nr("#1d8264")),Br.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,Br.radius/s.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]=ae(e,t),h=(l+c)/2+s.scrollX,m=(d+u)/2+s.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),Gr(e,o,i,r),i.restore()}else{let l=du(e,n,r,s);if(!l)return;Da(l,i,r,s,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]=ae(e,t),h=(l+c)/2,m=(d+u)/2,g=h+s.scrollX,f=m+s.scrollY,E=(c-l)/2-(e.x-l),x=(u-d)/2-(e.y-d);if(pe(e)){let b=et(e,t);if(J(b)){let M=U.getBoundTextElementPosition(b,e,t);E=(c-l)/2-(M.x-l),x=(u-d)/2-(M.y-d)}}i.save(),i.translate(g,f);let y=he(e,t);if(J(e)&&y){E=e.width/2-(e.x-l),x=e.height/2-(e.y-d);let[,,,,b,M]=ae(y,t),w=b-h-y.width/2-Yn,v=M-m-y.height/2-Yn,k=y.width+Yn*2,T=y.height+Yn*2,A=Math.max($n(l,c),$n(d,u))+Or(e)*10;i.save(),i.beginPath(),i.rect(-A,-A,A*2,A*2),i.rect(w,v,k,T),i.clip("evenodd"),i.rotate(e.angle),i.translate(-E,-x),Gr(e,o,i,r),i.restore()}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-E,-x),Gr(e,o,i,r);i.restore()}else{let l=du(e,n,r,s);if(!l)return;let d=i.imageSmoothingEnabled;if(!s?.shouldCacheIgnoreZoom&&(!e.angle||N0(e.angle))&&(i.imageSmoothingEnabled=!1),e.id===s.croppingElementId&&Ve(l.element)&&l.element.crop!==null){i.save(),i.globalAlpha=.1;let c=cu(ld(l.element,t),n,s.zoom,r,s);c&&Da(c,i,r,s,n),i.restore()}Da(l,i,r,s,n),i.imageSmoothingEnabled=d}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1};function bM(e,t,n){let o=we({...e,angle:0},n),i=Dr((o[0]+o[2])/2,(o[1]+o[3])/2);return W0(t.length>=2,"Freepath outline must have at least 2 points"),t.slice(2).reduce((r,s)=>(r.push(lu(r[r.length-1][1],Ca(Dr(s[0]+e.x,s[1]+e.y),i,e.angle))),r),[lu(Ca(Dr(t[0][0]+e.x,t[0][1]+e.y),i,e.angle),Ca(Dr(t[1][0]+e.x,t[1][1]+e.y),i,e.angle))])}var Ct=class e{static rg=new Dt;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),Ii.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;Ii.delete(t);let i=eg(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:Z0.white,embedsValidationStatus:null,theme:Na.LIGHT});return n?.isExporting||e.cache.set(t,{shape:i,theme:n?.theme||Na.LIGHT}),i}},Q0=e=>[8,8+e],Eu=e=>[1.5,6+e];function J0(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&&Bd(e.type)||le(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var Mt=(e,t=!1,n=!1)=>{let o={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?Q0(e.strokeWidth):e.strokeStyle==="dotted"?Eu(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:J0(e),stroke:ki(e.strokeColor,n),preserveVertices:t||e.roughness<Y0.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return o.fillStyle=e.fillStyle,o.fill=vi(e.backgroundColor)?void 0:ki(e.backgroundColor,n),e.type==="ellipse"&&(o.curveFitting=1),o;case"line":case"freedraw":return vt(e.points)&&(o.fillStyle=e.fillStyle,o.fill=e.backgroundColor==="transparent"?void 0:ki(e.backgroundColor,n)),o;case"arrow":return o;default:throw new Error(`Unimplemented type ${e.type}`)}},mu=(e,t,n)=>er(e)&&(t||cd(e)&&n?.get(e.id)!==!0)&&vi(e.backgroundColor)&&vi(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Ji(e)?{...e,strokeColor:vi(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:vi(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,Si=(e,t,n)=>{if(t===null)return[];let[,,o,i,r,s]=t;return[e.line(o,i,r,s,n)]},Rr=(e,t,n)=>{if(t===null)return[];let[o,i,r,s,a,l]=t;return[e.line(r,s,o,i,n),e.line(a,l,o,i,n)]},go=(e,t)=>{let n={...t};if(e.strokeStyle==="dotted"){let o=Eu(e.strokeWidth-1);n.strokeLineDash=[o[0],o[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},Ga=(e,t,n,o,i,r=1)=>{if(o===null)return[];let[s,a,l]=o,d={...t,fill:i,fillStyle:"solid",stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete d.strokeLineDash,[e.circle(s,a,l*r,d)]},fu=(e,t,n,o,i,r,s,a)=>{if(o===null)return[];let l=ki(e.strokeColor,a),d=ki(s,a),c=-.25,u=.8;switch(o){case"circle":case"circle_outline":return Ga(i,r,l,ut(e,t,n,o),o==="circle_outline"?d:l);case"triangle":case"triangle_outline":{let h=ut(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y]=h,b={...r,fill:o==="triangle_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete b.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[m,g]],b)]}case"diamond":case"diamond_outline":{let h=ut(e,t,n,o);if(h===null)return[];let[m,g,f,E,x,y,b,M]=h,w={...r,fill:o==="diamond_outline"?d:l,fillStyle:"solid",roughness:Math.min(1,r.roughness||0)};return delete w.strokeLineDash,[i.polygon([[m,g],[f,E],[x,y],[b,M],[m,g]],w)]}case"cardinality_one":return Si(i,ut(e,t,n,o),go(e,r));case"cardinality_many":return Rr(i,ut(e,t,n,o),go(e,r));case"cardinality_one_or_many":{let h=go(e,r);return[...Rr(i,ut(e,t,n,"cardinality_many"),h),...Si(i,ut(e,t,n,"cardinality_one",c),h)]}case"cardinality_exactly_one":{let h=go(e,r);return[...Si(i,ut(e,t,n,"cardinality_one",-.5),h),...Si(i,ut(e,t,n,"cardinality_one"),h)]}case"cardinality_zero_or_one":{let h=go(e,r);return[...Ga(i,r,l,ut(e,t,n,"circle_outline",1.5),d,u),...Si(i,ut(e,t,n,"cardinality_one",-.5),h)]}case"cardinality_zero_or_many":{let h=go(e,r);return[...Rr(i,ut(e,t,n,"cardinality_many"),h),...Ga(i,r,l,ut(e,t,n,"circle_outline",1.5),d,u)]}case"bar":case"arrow":default:return Rr(i,ut(e,t,n,o),go(e,r))}},Pd=(e,t)=>{let n=new Dt,o={seed:e.seed,disableMultiStroke:!0,disableMultiStrokeFill:!0,roughness:0,preserveVertices:!0},i=fe(e,t);switch(e.type){case"line":case"arrow":{let r=e.points.length?e.points:[De(0,0)];return ee(e)?n.path(xu(r,16),o).sets[0].ops:e.roundness?n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((s,a)=>{if(a===0){let l=In(De(e.x+s.data[0],e.y+s.data[1]),i,e.angle);return{op:"move",data:De(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[In(De(e.x+s.data[0],e.y+s.data[1]),i,e.angle),In(De(e.x+s.data[2],e.y+s.data[3]),i,e.angle),In(De(e.x+s.data[4],e.y+s.data[5]),i,e.angle)].map(l=>De(l[0]-e.x,l[1]-e.y)).flat()}}):r.map((s,a)=>{let l=In(De(e.x+s[0],e.y+s[1]),i,e.angle);return{op:a===0?"move":"lineTo",data:De(l[0]-e.x,l[1]-e.y)}})}case"freedraw":{if(e.points.length<2)return[];let r=Cn(e.points,.75);return n.curve(r,o).sets[0].ops.slice(0,e.points.length).map((s,a)=>{if(a===0){let l=In(De(e.x+s.data[0],e.y+s.data[1]),i,e.angle);return{op:"move",data:De(l[0]-e.x,l[1]-e.y)}}return{op:"bcurveTo",data:[In(De(e.x+s.data[0],e.y+s.data[1]),i,e.angle),In(De(e.x+s.data[2],e.y+s.data[3]),i,e.angle),In(De(e.x+s.data[4],e.y+s.data[5]),i,e.angle)].map(l=>De(l[0]-e.x,l[1]-e.y)).flat()}})}}},eg=(e,t,{isExporting:n,canvasBackgroundColor:o,embedsValidationStatus:i,theme:r})=>{let s=r===Na.DARK;switch(e.type){case"rectangle":case"iframe":case"embeddable":{let a;if(e.roundness){let l=e.width,d=e.height,c=En(Math.min(l,d),e);a=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`,Mt(mu(e,n,i),!0,s))}else a=t.rectangle(0,0,e.width,e.height,Mt(mu(e,n,i),!1,s));return a}case"diamond":{let a,[l,d,c,u,h,m,g,f]=ko(e);if(e.roundness){let E=En(Math.abs(l-g),e),x=En(Math.abs(u-d),e);a=t.path(`M ${l+E} ${d+x} L ${c-E} ${u-x}
|
|
15
15
|
C ${c} ${u}, ${c} ${u}, ${c-E} ${u+x}
|
|
16
|
-
L ${
|
|
17
|
-
C ${
|
|
16
|
+
L ${h+E} ${m-x}
|
|
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}`,Mt(e,!0,s))}else a=t.polygon([[l,d],[c,u],[m,h],[g,f]],Mt(e,!1,s));return a}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Mt(e,!1,s));case"line":case"arrow":{let a,l=Mt(e,!1,s),d=e.points.length?e.points:[Ce(0,0)];if(ee(e)?d.every(c=>Math.abs(c[0])<=1e6&&Math.abs(c[1])<=1e6)?a=[t.path(ru(d,16),Mt(e,!0,s))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(d)),a=[]):e.roundness?a=[t.curve(d,l)]:l.fill?a=[t.polygon(d,l)]:a=[t.linearPath(d,l)],e.type==="arrow"){let{startArrowhead:c=null,endArrowhead:u="arrow"}=e;if(c!==null){let m=nu(e,a,"start",c,t,l,o,s);a.push(...m)}if(u!==null){let m=nu(e,a,"end",u,t,l,o,s);a.push(...m)}}return a}case"freedraw":{let a=[];if(vt(e.points)){let l=Tn(e.points,.75);a.push(t.curve(l,{...Mt(e,!1,s),stroke:"none"}))}return a.push(g0(e)),a}case"frame":case"magicframe":case"text":case"image":return null;default:return d0(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},ru=(e,t)=>{let n=[];for(let i=1;i<e.length-1;i+=1){let r=e[i-1],s=e[i+1],a=e[i],l=Ut(a,r),d=Ut(s,a),c=Math.min(t,eu(e[i],s)/2,eu(e[i],r)/2);l?r[0]<a[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):r[1]<a[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c]),n.push(e[i]),d?s[0]<a[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):s[1]<a[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(" ")},Si=(e,t)=>{switch(e.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return Bl(e);case"arrow":case"line":{let n=Lt.generateElementShape(e,null)[0],[,,,,o,i]=ae(e,t);return lr(e)?Rl(e,n,Ce(e.x,e.y),e.angle,Ce(o,i)):Nl(n,Ce(e.x,e.y),e.angle,Ce(o,i))}case"ellipse":return Gl(e);case"freedraw":{let[,,,,n,o]=ae(e,t);return Ol(e,Ce(n,o),lr(e))}}},zc=(e,t)=>{let n=[...e.points];if(t){if(!sd(e.points))return null;let i=n[0],r=n[n.length-1];Math.hypot(i[0]-r[0],i[1]-r[1])>u0||n.length<4?n.push(Ce(i[0],i[1])):n[n.length-1]=Ce(i[0],i[1])}return{polygon:t,points:n}},g0=e=>P0(w0(e)),Nr={SIZE_FACTOR:4.25,THINNING:.6,SMOOTHING:.5},E0={SIZE_FACTOR:1.4},va=e=>e.strokeOptions?.streamline??p0,x0=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 Vl(t,{simulatePressure:e.simulatePressure,size:e.strokeWidth*Nr.SIZE_FACTOR,thinning:Nr.THINNING,smoothing:Nr.SMOOTHING,streamline:va(e),easing:n=>Math.sin(n*Math.PI/2),last:!0})},y0=e=>new Xi({size:e.strokeWidth*E0.SIZE_FACTOR,streamline:va(e),simplify:0,sizeMapping:t=>Math.max(.1,t.pressure)}),b0=e=>{let t=y0(e);return e.points.map(([n,o])=>t.addPoint([n,o,1])),t.getStrokeOutline().map(([n,o])=>[n,o])},w0=e=>e.strokeOptions?.variability==="constant"?b0(e):x0(e),su=e=>Es(e.points,{size:e.strokeWidth*Nr.SIZE_FACTOR,streamline:va(e),last:!0}).map(t=>t.point),ou=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],M0=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,P0=e=>{if(!e.length)return"";let t=e.length-1;return e.reduce((n,o,i,r)=>(i===t?n.push(o,ou(o,r[0]),"L",r[0],"Z"):n.push(o,ou(o,r[i+1])),n),["M",e[0],"Q"]).join(" ").replace(M0,"$1")};var ka=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&&!Ne(t))return i.bounds;if(o&&t.angle!==0){let s=e.calculateBounds({...t,angle:0},n);return e.nonRotatedBoundsCache.set(t,{version:t.version,bounds:s}),s}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,s,a,l,d]=ae(t,n);if(Le(t)){let[c,u,m,h]=go(t.points.map(([g,f])=>ge(H(g,f),H(l-t.x,d-t.y),t.angle)));return[c+t.x,u+t.y,m+t.x,h+t.y]}else if(le(t))o=B0(t,l,d,n);else if(t.type==="diamond"){let[c,u]=ge(H(l,r),H(l,d),t.angle),[m,h]=ge(H(l,a),H(l,d),t.angle),[g,f]=ge(H(i,d),H(l,d),t.angle),[E,x]=ge(H(s,d),H(l,d),t.angle),y=Math.min(c,m,g,E),b=Math.min(u,h,f,x),M=Math.max(c,m,g,E),w=Math.max(u,h,f,x);o=[y,b,M,w]}else if(t.type==="ellipse"){let c=(s-i)/2,u=(a-r)/2,m=Math.cos(t.angle),h=Math.sin(t.angle),g=Math.hypot(c*m,u*h),f=Math.hypot(u*m,c*h);o=[l-g,d-f,l+g,d+f]}else{let[c,u]=ge(H(i,r),H(l,d),t.angle),[m,h]=ge(H(i,a),H(l,d),t.angle),[g,f]=ge(H(s,a),H(l,d),t.angle),[E,x]=ge(H(s,r),H(l,d),t.angle),y=Math.min(c,m,g,E),b=Math.min(u,h,f,x),M=Math.max(c,m,g,E),w=Math.max(u,h,f,x);o=[y,b,M,w]}return o}},ae=(e,t,n=!1)=>{if(Le(e))return A0(e);if(le(e))return W.getElementAbsoluteCoords(e,t,n);if(ue(e)){let o=t?et(e,t):null;if(J(o)){let{x:i,y:r}=W.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]},No=(e,t)=>{let n=Si(e,t),[o,i,r,s,a,l]=ae(e,t),d=H(a,l);if(n.type==="polycurve"){let x=n.data.map(b=>Ft(b,10)),y=[];if(Ye(e)&&!e.polygon||J(e))for(let b of x){let M=0;for(;M<b.length-1;)y.push(Be(H(b[M][0],b[M][1]),H(b[M+1][0],b[M+1][1]))),M++}else{let b=x.flat(),M=0;for(;M<b.length-1;)y.push(Be(H(b[M][0],b[M][1]),H(b[M+1][0],b[M+1][1]))),M++}return y}else{if(n.type==="polyline")return n.data;if(S0(e)){let[E,x]=Cn(e),y=x.map(M=>du(M,d,e.angle)).flat();return[...lu(E,d,e.angle),...y]}else if(e.type==="diamond"){let[E,x]=Bn(e),y=x.map(M=>du(M,d,e.angle)).flat();return[...lu(E,d,e.angle),...y]}else if(n.type==="polygon"){if(ue(e)){let y=et(e,t);if(y&&le(y))return[Be(H(o,i),H(r,i)),Be(H(r,i),H(r,s)),Be(H(r,s),H(o,s)),Be(H(o,s),H(o,i))]}let E=n.data,x=[];for(let y=0;y<E.length-1;y++)x.push(Be(E[y],E[y+1]));return x}else if(n.type==="ellipse")return v0(e)}let[c,u,m,h,,,g,f]=[[o,i],[r,i],[o,s],[r,s],[a,i],[a,s],[o,l],[r,l]].map(E=>ge(E,d,e.angle));return[Be(c,u),Be(m,h),Be(c,m),Be(u,h),Be(c,f),Be(m,f),Be(u,g),Be(h,g)]},S0=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),lu=(e,t,n)=>e.map(o=>Be(ge(o[0],t,n),ge(o[1],t,n))),du=(e,t,n)=>{let o=Ft(e,10),i=0,r=[];for(;i<o.length-1;)r.push(Be(ge(H(o[i][0],o[i][1]),t,n),ge(H(o[i+1][0],o[i+1][1]),t,n))),i++;return r},v0=e=>{let t=H(e.x+e.width/2,e.y+e.height/2),n=e.width/2,o=e.height/2,i=[],r=[],s=90,a=Math.PI*2/s;for(let l=0;l<s;l++){let d=l*a,c=t[0]+n*Math.cos(d),u=t[1]+o*Math.sin(d);r.push(ge(H(c,u),t,e.angle))}for(let l=0;l<r.length-1;l++)i.push(Be(r[l],r[l+1]));return i.push(Be(r[r.length-1],r[0])),i},Q5=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],vo=e=>{let t=Math.floor(e.width/2)+1,n=0,o=e.width,i=Math.floor(e.height/2)+1,r=t,s=e.height;return[t,n,o,i,r,s,0,i]},cu=(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},uu=(e,t,n,o)=>{let i=t-e,r=n-t,s=o-n,a=3*i-6*r+3*s,l=6*r-6*i,d=3*i,c=l*l-4*a*d;if(!(c>=0))return!1;let m=null,h=null,g=1/0,f=1/0;return a===0?g=f=-d/l:(g=(-l+Math.sqrt(c))/(2*a),f=(-l-Math.sqrt(c))/(2*a)),g>=0&&g<=1&&(m=cu(g,e,t,n,o)),f>=0&&f<=1&&(h=cu(f,e,t,n,o)),[m,h]},cr=(e,t,n,o)=>{let i=uu(e[0],t[0],n[0],o[0]),r=uu(e[1],t[1],n[1],o[1]),s=Math.min(e[0],o[0]),a=Math.max(e[0],o[0]);if(i){let c=i.filter(u=>u!==null);s=Math.min(s,...c),a=Math.max(a,...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[s,l,a,d]},bi=(e,t)=>{let n=H(0,0),{minX:o,minY:i,maxX:r,maxY:s}=e.reduce((a,{op:l,data:d})=>{if(l==="move"){let c=mu(d);Ta(c!=null,"Op data is not a point"),n=c}else if(l==="bcurveTo"){let c=H(d[0],d[1]),u=H(d[2],d[3]),m=H(d[4],d[5]),h=t?t(c):c,g=t?t(u):u,f=t?t(m):m,E=t?t(n):n;n=m;let[x,y,b,M]=cr(E,h,g,f);a.minX=Math.min(a.minX,x),a.minY=Math.min(a.minY,y),a.maxX=Math.max(a.maxX,b),a.maxY=Math.max(a.maxY,M)}return a},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[o,i,r,s]},go=(e,t=0)=>{let n=1/0,o=1/0,i=-1/0,r=-1/0;for(let[s,a]of e)n=Math.min(n,s),o=Math.min(o,a),i=Math.max(i,s),r=Math.max(r,a);return[n-t,o-t,i+t,r+t]},A0=e=>{let[t,n,o,i]=go(e.points),r=t+e.x,s=n+e.y,a=o+e.x,l=i+e.y;return[r,s,a,l,(r+a)/2,(s+l)/2]},T0=20,k0=15,L0=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 k0;case"cardinality_one":case"cardinality_exactly_one":case"cardinality_zero_or_one":return T0;default:return 15}},D0=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},ut=(e,t,n,o,i=0)=>{if(o===null||t.length<1)return null;let r=pn(t[0]);if(r.length<1)return null;let s=n==="start"?1:r.length-1,a=r[s].data;Ta(a.length===6,"Op data length is not 6");let l=H(a[4],a[5]),d=H(a[2],a[3]),c=H(a[0],a[1]),u=r[s-1],m=H(0,0);if(u.op==="move"){let I=mu(u.data);Ta(I!=null,"Op data is not a point"),m=I}else u.op==="bcurveTo"&&(m=H(u.data[4],u.data[5]));let h=(I,L)=>Math.pow(1-I,3)*l[L]+3*I*Math.pow(1-I,2)*d[L]+3*Math.pow(I,2)*(1-I)*c[L]+m[L]*Math.pow(I,3),[g,f]=n==="start"?m:l,[E,x]=[h(.3,0),h(.3,1)],y=Math.hypot(g-E,f-x),b=(g-E)/y,M=(f-x)/y,w=L0(o),v=0;{let[I,L]=n==="end"?e.points[e.points.length-1]:e.points[0],[G,_]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];v=Math.hypot(I-G,L-_)}let k=Math.min(w,v*(o==="diamond"||o==="diamond_outline"?.25:.5)),T=g-b*k*i,z=f-M*k*i,C=T-b*k,O=z-M*k;if(o==="circle"||o==="circle_outline"){let I=Math.hypot(O-z,C-T)+e.strokeWidth-2;return[T,z,I]}let N=D0(o);if(o==="cardinality_many"||o==="cardinality_one_or_many"){let[I,L]=ge(H(T,z),H(C,O),Aa(-N)),[G,_]=ge(H(T,z),H(C,O),Aa(N));return[C,O,I,L,G,_]}let[j,V]=ge(H(C,O),H(T,z),-N*Math.PI/180),[D,B]=ge(H(C,O),H(T,z),Aa(N));if(o==="diamond"||o==="diamond_outline"){let I,L;if(n==="start"){let[G,_]=e.points.length>1?e.points[1]:[0,0];[I,L]=ge(H(T+k*2,z),H(T,z),Math.atan2(_-z,G-T))}else{let[G,_]=e.points.length>1?e.points[e.points.length-2]:[0,0];[I,L]=ge(H(T-k*2,z),H(T,z),Math.atan2(z-_,T-G))}return[T,z,j,V,I,L,D,B]}return[T,z,j,V,D,B]},C0=e=>{let t=Mo.generator(),n=Mt(e),o=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[o](e.points,n)},B0=(e,t,n,o)=>{let i=pe(e,o);if(e.points.length<2){let[u,m]=e.points[0],[h,g]=ge(H(e.x+u,e.y+m),H(t,n),e.angle),f=[h,g,h,g];if(i){let E=W.getMinMaxXYWithBoundText(e,o,[h,g,h,g],i);f=[E[0],E[1],E[2],E[3]]}return f}let s=Lt.get(e,null)?.[0]??C0(e),a=pn(s),d=bi(a,([u,m])=>ge(H(e.x+u,e.y+m),H(t,n),e.angle)),c=[d[0],d[1],d[2],d[3]];if(i){let u=W.getMinMaxXYWithBoundText(e,o,c,i);c=[u[0],u[1],u[2],u[3]]}return c},be=(e,t,n=!1)=>ka.getBounds(e,t,n),dt=(e,t)=>{if(!I0(e))return[0,0,0,0];let n=1/0,o=-1/0,i=1/0,r=-1/0,s=t||pu(e);return e.forEach(a=>{let[l,d,c,u]=be(a,s);n=Math.min(n,l),i=Math.min(i,d),o=Math.max(o,c),r=Math.max(r,u)}),[n,i,o,r]},J5=(e,t)=>{let[n,o,i,r]=dt(e);return[n+t.x,o+t.y,i+t.x,r+t.y]},Ln=(e,t,n,o)=>{if(!(le(e)||Le(e)))return[e.x,e.y,e.x+t,e.y+n];let i=au(0,t,au(1,n,e.points,o),o),r;if(Le(e))r=go(i);else{let c=Mo.generator(),u=e.roundness?c.curve(i,Mt(e)):c.linearPath(i,Mt(e)),m=pn(u);r=bi(m)}let[s,a,l,d]=r;return[s+e.x,a+e.y,l+e.x,d+e.y]},ba=(e,t)=>{let n=Mo.generator(),o=e.roundness==null?n.linearPath(t,Mt(e)):n.curve(t,Mt(e)),i=pn(o),[r,s,a,l]=bi(i);return[r+e.x,s+e.y,a+e.x,l+e.y]},it=e=>{let[t,n,o,i]=dt(e);return{minX:t,minY:n,maxX:o,maxY:i,width:o-t,height:i-n,midX:(t+o)/2,midY:(n+i)/2}},eM=({scrollX:e,scrollY:t,width:n,height:o,zoom:i})=>[-e,-t,-e+n/i.value,-t+o/i.value],yn=e=>H(e[0]+(e[2]-e[0])/2,e[1]+(e[3]-e[1])/2),bt=(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=he(e,t),[r,s]=ge(H(o.minX,o.minY),i,e.angle),[a,l]=ge(H(o.maxX,o.minY),i,e.angle),[d,c]=ge(H(o.maxX,o.maxY),i,e.angle),[u,m]=ge(H(o.minX,o.maxY),i,e.angle),h=[Math.min(r,a,d,u),Math.min(s,l,c,m),Math.max(r,a,d,u),Math.max(s,l,c,m)];if(n){let[g,f,E,x]=n;return[h[0]-x,h[1]-g,h[2]+f,h[3]+E]}return h},on=(e,t)=>e[0]>t[0]&&e[0]<t[2]&&e[1]>t[1]&&e[1]<t[3],G0=(e,t)=>e[0]>=t[0]&&e[0]<=t[2]&&e[1]>=t[1]&&e[1]<=t[3],kt=(e,t)=>{if(e==null||t==null)return!1;let[n,o,i,r]=e,[s,a,l,d]=t;return n<l&&i>s&&o<d&&r>a},fa=(e,t)=>[H(t[0],t[1]),H(t[0],t[3]),H(t[2],t[1]),H(t[2],t[3])].every(n=>G0(n,e)),yc=({elements:e,elementsMap:t,bounds:n,type:o,excludeElementsInFrames:i,shouldIgnoreElementFromSelection:r})=>{t||(t=pu(e));let s=od(n)?be(n,t):n,[a,l,d,c]=s,u=[Be(H(a,l),H(d,l)),Be(H(d,l),H(d,c)),Be(H(d,c),H(a,c)),Be(H(a,c),H(a,l))],m=i?new Set:null,h={},g=new Set;for(let f of e){if(r?.(f))continue;let E=f.groupIds.at(-1);E&&(h[E]||(h[E]=[]),h[E].push(f));let x=f.strokeWidth,y=null,b=be(f,t);b=[b[0]-x/2,b[1]-x/2,b[2]+x/2,b[3]+x/2];let M=J(f)&&pe(f,t);if(M){let{x:A,y:k}=W.getBoundTextElementPosition(f,M,t);y=[A,k,A+M.width,k+M.height]}let w=Wn(f,t);if(w&&_n(f,w,t)){let A=be(w,t);b=[Math.max(b[0],A[0]),Math.max(b[1],A[1]),Math.min(b[2],A[2]),Math.min(b[3],A[3])],y=y?[Math.max(y[0],A[0]),Math.max(y[1],A[1]),Math.min(y[2],A[2]),Math.min(y[3],A[3])]:null}let v=y?[Math.min(y[0],b[0]),Math.min(y[1],b[1]),Math.max(y[2],b[2]),Math.max(y[3],b[3])]:b;if(fa(s,v)){m&&ce(f)&&m.add(f.id),g.add(f);continue}if(o==="overlap"&&y&&kt(s,y)){g.add(f);continue}if(o==="overlap"&&kt(s,b)){let A=!1;if(le(f)||Le(f)){let k=he(f,t);A=f.points.some(T=>{let z=ge(H(f.x+T[0],f.y+T[1]),k,f.angle);return on(z,s)})}else{let k=be(f,t,!0),T=he(f,t);A=[ge(H((k[0]+k[2])/2,k[1]),T,f.angle),ge(H(k[2],(k[1]+k[3])/2),T,f.angle),ge(H((k[0]+k[2])/2,k[3]),T,f.angle),ge(H(k[0],(k[1]+k[3])/2),T,f.angle)].some(z=>on(ge(z,T,f.angle),s))}if(A||(A=u.some(k=>gt(f,t,k,x/2,!0).length>0)),A){m&&ce(f)&&m.add(f.id),g.add(f);continue}}}return m&&g.forEach(f=>{f.frameId&&m.has(f.frameId)&&g.delete(f)}),o==="overlap"?Array.from(g).forEach(f=>{let E=f.groupIds.at(-1);(E?h[E]:null)?.forEach(y=>g.add(y))}):o==="contain"&&g.forEach(f=>{let E=f.groupIds.at(-1),x=E?h[E]:null;x&&!x.every(y=>g.has(y))&&g.delete(f)}),e.filter(f=>g.has(f))},he=(e,t,n=0,o=0)=>{if(le(e)||Le(e)){let[s,a,l,d]=ae(e,t),[c,u]=H((s+l)/2,(a+d)/2);return H(c+n,u+o)}let[i,r]=yn(be(e,t));return H(i+n,r+o)};var F0=.1,fu=e=>le(e)||Le(e)?e.points.length<2||e.points.length===2&&J(e)&&R0(e.points[0],e.points[e.points.length-1],F0):e.width===0&&e.height===0,bc=(e,t,n,o,i)=>{let[r,s,a,l]=be(e,i),d=Or({clientX:o.offsetLeft,clientY:o.offsetTop},o),c=Or({clientX:o.offsetLeft+t,clientY:o.offsetTop+n},o);return d.x<=a&&d.y<=l&&c.x>=r&&c.y>=s},lM=(e,t,n,o,i,r)=>{let[s,a,l,d]=dt(e,i),c=Or({clientX:o.offsetLeft+(r?.left||0),clientY:o.offsetTop+(r?.top||0)},o),u=Or({clientX:o.offsetLeft+t-(r?.right||0),clientY:o.offsetTop+n-(r?.bottom||0)},o);return s>=c.x&&a>=c.y&&l<=u.x&&d<=u.y},La=(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)/Pn)*Pn;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}},_c=(e,t,n,o,i)=>{let r=n-e,s=o-t,a=Math.atan2(s,r),l=Math.round(a/Pn)*Pn;if(i){let d=Math.floor(i/Pn)*Pn;N0(a,d,d+Pn)&&(O0(a,i)<Pn/6?l=i:hu(a)>hu(i)?l=d+Pn:l=d)}if(l===0)s=0;else if(l===Math.PI/2)r=0;else{let d=Math.tan(l),c=-1,u=t-d*e,m=-1/d,h=-1,g=o-m*n,f=(c*g-h*u)/(d*h-m*c),E=(u*m-g*d)/(d*h-m*c);r=f-e,s=E-t}return{width:r,height:s}},dM=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};S();var gM=(e,t,n,o)=>{let i=Tr(e,n.getNonDeletedElementsMap(),o).map(Un),r=it(e);return i.flatMap(s=>{let a=H0(s,r,t);return s.map(l=>{let d=n.mutateElement(l,{x:l.x+a.x,y:l.y+a.y});return ot(l,n,{simultaneouslyUpdated:s}),d})})},H0=(e,t,{axis:n,position:o})=>{let i=it(e),[r,s]=n==="x"?["minX","maxX"]:["minY","maxY"],a={x:0,y:0};return o==="start"?{...a,[n]:t[r]-i[r]}:o==="end"?{...a,[n]:t[s]-i[s]}:{...a,[n]:(t[r]+t[s])/2-(i[r]+i[s])/2}};S();S();var Rr=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 s=t[r],a=this.findNode(this.root,s.w,s.h);a?s.fit=this.splitNode(a,s.w,s.h):s.fit=this.growNode(s.w,s.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,s=o&&this.root.w>=this.root.h+n+this.gap;return r?this.growRight(t,n):s?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}};S();var z0=[1,1.08,1.18,1.32,1.5,1.75,2.1,2.6,3.25],_0=[1,4/3,3/4,3/2,2/3,2,1/2],W0=(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},j0=(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,gu=(e,t,n)=>Math.min(Math.max(e,t),n),V0=(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,Eu=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})},Y0=(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 s=r.fit.x+r.actualW/2,a=r.fit.y+r.actualH/2;return i+Math.abs(s-n)+Math.abs(a-o)},0)},X0=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},$0=(e,t)=>{let n=[];for(let o of e){if(!V0(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 X0(n)},Z0=(e,t,n,o)=>{let i=e.x+e.w-t.packedW,r=e.y+e.h-t.packedH,s=[{x:e.x,y:e.y},{x:i,y:e.y},{x:e.x,y:r},{x:i,y:r}];return n==="center-distance"&&s.push({x:gu(o.x-t.actualW/2,e.x,i),y:gu(o.y-t.actualH/2,e.y,r)}),s.filter((a,l,d)=>d.findIndex(c=>c.x===a.x&&c.y===a.y)===l)},q0=(e,t,n,o,i,r,s)=>{let a=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[a,c,u,n.y,n.x];let m=i?{x:(i.minX+i.maxX)/2,y:(i.minY+i.maxY)/2}:{x:r/2,y:s/2},h=n.x+t.actualW/2,g=n.y+t.actualH/2,f=Math.abs(h-m.x)+Math.abs(g-m.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,b=x*y;return[f,b,a,c,u]},K0=(e,t,n,o)=>{let i=[{x:0,y:0,w:t,h:n}];for(let l of e){let d=Eu(e),c=null;for(let u of i){if(l.packedW>u.w||l.packedH>u.h)continue;let m=d?{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2}:{x:t/2,y:n/2},h=Z0(u,l,o,m);for(let g of h){let f=q0(u,l,g,o,d,t,n);(!c||W0(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=$0(i,{x:c.x,y:c.y,w:l.packedW,h:l.packedH})}let r=Eu(e);if(!r)return{width:0,height:0,spread:0};let s=r.minX,a=r.minY;return e.forEach(l=>{l.fit&&(l.fit={x:l.fit.x-s,y:l.fit.y-a})}),{width:r.maxX-r.minX,height:r.maxY-r.minY,spread:Y0(e,{minX:0,minY:0,maxX:r.maxX-r.minX,maxY:r.maxY-r.minY})}},xu=(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(j0),r=i.reduce((d,c)=>d+c.packedW*c.packedH,0),s=Math.max(...i.map(d=>d.packedW)),a=Math.max(...i.map(d=>d.packedH)),l=null;for(let d of z0){let c=r*d;for(let u of _0){let m=Math.max(s,Math.ceil(Math.sqrt(c*u))),h=Math.max(a,Math.ceil(c/m)),g=i.map(M=>({...M,fit:null})),f=K0(g,m,h,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),b=Math.abs(l.width-l.height);(x<0||x===0&&(y<b||y===b&&(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 Q0=(e,t,n)=>{let o=it(t),i=n.x-o.minX,r=n.y-o.minY;t.forEach(s=>{e.mutateElement(s,{x:s.x+i,y:s.y+r})})},yu=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),bu=(e,t,n)=>{let o=t.filter(i=>i.fit);return o.forEach(i=>{Q0(e,i.group,{x:n.x+(i.fit?.x??0),y:n.y+(i.fit?.y??0)})}),o.flatMap(i=>i.group)},wu=(e,t,n)=>{let o=t.flatMap(l=>l.group),i=it(o),r={x:i.minX,y:i.minY},s=yu(t);return new Rr(n).fit(s),bu(e,s,r)},Da=(e,t,n,o)=>{let i=t.flatMap(d=>d.group),r=it(i),s={x:r.minX,y:r.minY},a=yu(t);return xu(a,{gap:n,heuristic:o})?bu(e,a,s):(console.warn(`Packing heuristic [${o}] failed - using binary tree packer`),wu(e,t,n))},AM=(e,t,n,o,i)=>{let s=Ar(t,n).map(a=>({group:a,boundingBox:it(a)}));switch(o){case"bin-packing":case"bin-packing-center":return Da(e,s,i,"center-distance");case"bin-packing-max-rects":return Da(e,s,i,"best-area-fit");case"bin-packing-binary-tree":return wu(e,s,i);default:return console.warn(`Unimplemented algorithm [${o}] - using bin-packing`),Da(e,s,i,"center-distance")}};S();import{TEXT_ALIGN as zr,VERTICAL_ALIGN as _r}from"@excalidraw/common";import{pointDistance as cg,pointFromVector as ug,pointsEqual as Tu,vector as pg,vectorDot as mg,vectorFromPoint as Au,vectorNormalize as hg,vectorScale as fg}from"@excalidraw/math";S();import{DEFAULT_ELEMENT_PROPS as $n,DEFAULT_FONT_FAMILY as J0,DEFAULT_FONT_SIZE as eg,DEFAULT_TEXT_ALIGN as tg,DEFAULT_VERTICAL_ALIGN as ng,DEFAULT_STROKE_STREAMLINE as og,VERTICAL_ALIGN as Eo,randomInteger as ig,randomId as rg,getFontString as Fr,getUpdatedTimestamp as sg,getLineHeight as ag}from"@excalidraw/common";var $t=(e,{x:t,y:n,strokeColor:o=$n.strokeColor,backgroundColor:i=$n.backgroundColor,fillStyle:r=$n.fillStyle,strokeWidth:s=$n.strokeWidth,strokeStyle:a=$n.strokeStyle,roughness:l=$n.roughness,opacity:d=$n.opacity,width:c=0,height:u=0,angle:m=0,groupIds:h=[],frameId:g=null,index:f=null,roundness:E=null,boundElements:x=null,link:y=null,locked:b=$n.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||rg(),type:e,x:t,y:n,width:c,height:u,angle:m,strokeColor:o,backgroundColor:i,fillStyle:r,strokeWidth:s,strokeStyle:a,roughness:l,opacity:d,groupIds:h,frameId:g,index:f,roundness:E,seed:M.seed??ig(),version:M.version||1,versionNonce:M.versionNonce??0,isDeleted:!1,boundElements:x,updated:sg(),link:y,locked:b,customData:M.customData}),Ho=e=>$t(e.type,e),RM=e=>$t("embeddable",e),FM=e=>({...$t("iframe",e)}),Mu=e=>at({...$t("frame",e),type:"frame",name:e?.name||null},{}),Pu=e=>at({...$t("magicframe",e),type:"magicframe",name:e?.name||null},{}),Ca=e=>({x:e.textAlign==="center"?.5:e.textAlign==="right"?1:0,y:e.verticalAlign===Eo.MIDDLE?.5:e.verticalAlign===Eo.BOTTOM?1:0}),Iu=(e,t)=>{let n=Ca(e);return{x:t.width*n.x,y:t.height*n.y}},xo=e=>{let t=e.fontFamily||J0,n=e.fontSize||eg,o=e.lineHeight||ag(t),i=ui(e.text),r=At(i,Fr({fontFamily:t,fontSize:n}),o),s=e.textAlign||tg,a=e.verticalAlign||ng,l=Iu({textAlign:s,verticalAlign:a},r),d={...$t("text",e),text:i,fontSize:n,fontFamily:t,textAlign:s,verticalAlign:a,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 at(d,{})},lg=(e,t,n)=>{let{width:o,height:i}=At(n,Fr(e),e.lineHeight);e.autoResize||(o=e.width);let{textAlign:r,verticalAlign:s}=e,a,l;if(r==="center"&&s===Eo.MIDDLE&&!e.containerId&&e.autoResize){let d=At(e.text,Fr(e),e.lineHeight),c=Iu(e,{width:o-d.width,height:i-d.height});a=e.x-c.x,l=e.y-c.y}else{let[d,c,u,m]=ae(e,t),[h,g,f,E]=Ln(e,o,i,!1),x=(d-h)/2,y=(c-g)/2,b=(u-f)/2,M=(m-E)/2;[a,l]=dg({n:s===Eo.MIDDLE||s===Eo.BOTTOM,s:s===Eo.MIDDLE||s===Eo.TOP,e:r==="center"||r==="left",w:r==="center"||r==="right"},e.x,e.y,e.angle,x,y,b,M)}return{width:o,height:i,x:Number.isFinite(a)?a:e.x,y:Number.isFinite(l)?l:e.y}},dg=(e,t,n,o,i,r,s,a)=>{let l=Math.cos(o),d=Math.sin(o);return e.e&&e.w?t+=i+s:e.e?(t+=i*(1+l),n+=i*d,t+=s*(1-l),n+=s*-d):e.w&&(t+=i*(1-l),n+=i*-d,t+=s*(1+l),n+=s*d),e.n&&e.s?n+=r+a:e.n?(t+=r*d,n+=r*(1-l),t+=a*-d,n+=a*(1+l)):e.s&&(t+=r*-d,n+=r*(1+l),t+=a*d,n+=a*(1-l)),[t,n]},HM=(e,t,n,o=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(o=En(o,Fr(e),t?jt(t,e):e.width));let i=lg(e,n,o);return{text:o,...i}},zM=e=>({...$t(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure,strokeOptions:e.strokeOptions??{variability:"variable",streamline:og}}),Su=e=>{let t={...$t(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null};return Ye(t)?{...t,polygon:e.polygon??!1}:t},Hr=e=>e.elbowed?{...$t(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}:{...$t(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!1},vu=e=>({...$t("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 qM=(e,t,n,o)=>{for(let i=t.length-1;i>=0;i--){let r=t[i];if(!(!J(r)||r.locked||r.points.length<2))for(let s of["end","start"]){if(r[s==="start"?"startBinding":"endBinding"]||Tu(r.points[s==="start"?0:r.points.length-1],r.points[s==="start"?1:r.points.length-2]))continue;let a=W.getPointAtIndexGlobalCoordinates(r,s==="start"?0:-1,n);if(cg(e,a)*o.value<W.POINT_HANDLE_SIZE+1)return{arrow:r,startOrEnd:s}}}return null},KM=(e,t,n,o)=>{let i=W.getPointAtIndexGlobalCoordinates(e,t==="start"?0:-1,n),r=W.getPointAtIndexGlobalCoordinates(e,t==="start"?1:-2,n);if(Tu(i,r))return null;let s=Au(i,r),a=Math.abs(s[0])>=Math.abs(s[1])?s[0]>=0?Se:Xe:s[1]>=0?We:st,l=ee(e)?0:_e({strokeWidth:o},e),d=hg(Au(r,i)),c=Math.abs(mg(d,pg(a[0],a[1]))),u=ug(fg(d,-l/c),i);return Pe(a,Se)?{fixedPoint:Je([0,.5]),anchor:u,textAlign:zr.LEFT,verticalAlign:_r.MIDDLE}:Pe(a,Xe)?{fixedPoint:Je([1,.5]),anchor:u,textAlign:zr.RIGHT,verticalAlign:_r.MIDDLE}:Pe(a,We)?{fixedPoint:Je([.5,0]),anchor:u,textAlign:zr.CENTER,verticalAlign:_r.TOP}:{fixedPoint:Je([.5,1]),anchor:u,textAlign:zr.CENTER,verticalAlign:_r.BOTTOM}},QM=(e,t)=>!!e.boundElements?.some(({id:n,type:o})=>{if(o!=="arrow")return!1;let i=t.get(n);return J(i)&&(i.startBinding?.elementId===e.id||i.endBinding?.elementId===e.id)}),JM=e=>{let t=Ca(e).x;return{anchorRatio:t,anchorX:e.x+e.width*t}};S();import{distanceToLineSegment as ku,lineSegment as yo,lineSegmentIntersectionPoints as gg,pointDistance as cn,pointFrom as _o,pointRotateRads as jr,polygonArea as Ai,polygonIncludesPoint as Lu,polygonIncludesPointNonZero as Wr,polygonSignedArea as Ga}from"@excalidraw/math";import{isOpaqueColor as Eg,isTransparent as Ti}from"@excalidraw/common";var xg=6,yg=2,bg=2,wg=.5,Mg={snapEpsilon:.5,gapTolerance:xg,minArea:4,maxBoundarySegments:2560,maxGeneratedPoints:1536,fallbackSearchRadius:512},Gu=([e,t,n,o],i)=>[e-i,t-i,n+i,o+i],Pg=e=>cn(e[0],e[1]),vi=(e,t,n)=>{let o=t[0]-e[0],i=t[1]-e[1],r=o*o+i*i;return r===0?0:((n[0]-e[0])*o+(n[1]-e[1])*i)/r},Du=(e,t,n,o,i)=>{let r=Math.min(e[0],t[0]),s=Math.max(e[0],t[0]),a=t[0]-e[0],l=t[1]-e[1],d=Math.floor((r-n)/o),c=Math.floor((s+n)/o);for(let u=d;u<=c;u++){let m=e[1],h=t[1];if(a!==0){let E=(Math.max(r,u*o-n)-e[0])/a,x=(Math.min(s,(u+1)*o+n)-e[0])/a;m=e[1]+E*l,h=e[1]+x*l}let g=Math.floor((Math.min(m,h)-n)/o),f=Math.floor((Math.max(m,h)+n)/o);for(let E=g;E<=f;E++)i(u,E)}},Ig=(e,t,n)=>{let o=n[0]-t[0],i=n[1]-t[1],r=Math.hypot(o,i);return r===0?cn(e,t):Math.abs((e[0]-t[0])*i-(e[1]-t[1])*o)/r},zo=(e,t,n)=>_o(e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n),Sg=(e,t)=>{let n=e;for(let[o,i]of t){let r=[];for(let[s,a]of n){if(i<=s||o>=a){r.push([s,a]);continue}o>s&&r.push([s,o]),i<a&&r.push([i,a])}n=r}return n},vg=(e,t)=>{let n=he(e,t),i=(e.roundness&&e.points.length>2?Ft(Wi(e.points),.15,wg):e.points).map(s=>jr(_o(e.x+s[0],e.y+s[1]),n,e.angle)),r=[];for(let s=0;s<i.length-1;s++)r.push(yo(i[s],i[s+1]));return r},Ag=(e,t)=>{let n=he(e,t),o=su(e).map(r=>jr(_o(e.x+r[0],e.y+r[1]),n,e.angle)),i=[];for(let r=0;r<o.length-1;r++)i.push(yo(o[r],o[r+1]));return i},Tg=(e,t,n,o,i,r)=>{let s=[[0,1]];for(let a of n){if(s.length===0)break;let d=[0,...gt(a,o,yo(e,t)).map(u=>vi(e,t,u)).filter(u=>u>0&&u<1).sort((u,m)=>u-m),1],c=[];for(let u=0;u<d.length-1;u++){let m=d[u],h=d[u+1];if(h-m<1e-9)continue;let g=zo(e,t,(m+h)/2);ft(g,a,o)&&nn(a,o,g)>r&&c.push([m,h])}c.length&&(s=Sg(s,c))}return s.filter(([a,l])=>cn(zo(e,t,a),zo(e,t,l))>=i).map(([a,l])=>[zo(e,t,a),zo(e,t,l)])},Na=class{constructor(t){this.eps=t;this.cellSize=Math.max(t,1)}nodes=[];cells=new Map;cellSize;cellKey(t,n){return`${t}:${n}`}getOrCreate(t){let n=Math.floor(t[0]/this.cellSize),o=Math.floor(t[1]/this.cellSize);for(let a=-1;a<=1;a++)for(let l=-1;l<=1;l++){let d=this.cells.get(this.cellKey(n+a,o+l));if(d){for(let c of d)if(cn(this.nodes[c],t)<=this.eps)return c}}let i=this.nodes.length;this.nodes.push(t);let r=this.cellKey(n,o),s=this.cells.get(r);return s?s.push(i):this.cells.set(r,[i]),i}forEachInRadius(t,n,o){let i=Math.floor((t[0]-n)/this.cellSize),r=Math.floor((t[0]+n)/this.cellSize),s=Math.floor((t[1]-n)/this.cellSize),a=Math.floor((t[1]+n)/this.cellSize);for(let l=i;l<=r;l++)for(let d=s;d<=a;d++){let c=this.cells.get(this.cellKey(l,d));if(c)for(let u of c)o(u)}}},Cu=e=>!(!To(e.type)||e.fillStyle!=="solid"||e.opacity<100||!Eg(e.backgroundColor)||(Ye(e)||Le(e))&&!vt(e.points)),Nu=new Set(["rectangle","diamond","ellipse","frame","magicframe","line","freedraw"]),Oa=e=>e.opacity<=0,Ou=e=>!Oa(e)&&(e.type==="image"||!Ti(e.strokeColor)||To(e.type)&&!Ti(e.backgroundColor)),Ru=e=>Ye(e)&&e.polygon&&Ps(e.points)&&!Oa(e)&&!Ti(e.backgroundColor)&&Ti(e.strokeColor),kg=e=>Nu.has(e.type)?Ye(e)?e.polygon&&Ps(e.points):Le(e)?vt(e.points):!0:!1,Ba=e=>!Oa(e)&&Nu.has(e.type)&&!Ti(e.strokeColor),Lg=(e,t,n)=>{for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!Ou(i)||Ru(i))&&kg(i)&&ft(e,i,n))return i}return null},Dg=(e,t)=>{let n=t.snapEpsilon,o=new Na(n),i=[],r=new Map;for(let{segment:D,elementId:B}of e){let I=o.getOrCreate(D[0]),L=o.getOrCreate(D[1]);if(r.has(I)||r.set(I,B),r.has(L)||r.set(L,B),I===L)continue;let G=o.nodes[I],_=o.nodes[L];i.push({a:I,b:L,pa:G,pb:_,elementId:B,box:[Math.min(G[0],_[0]),Math.min(G[1],_[1]),Math.max(G[0],_[0]),Math.max(G[1],_[1])],splits:[{node:I,t:0},{node:L,t:1}]})}let s=i.map(D=>yo(D.pa,D.pb)),a=i.map((D,B)=>B).sort((D,B)=>i[D].box[0]-i[B].box[0]);for(let D=0;D<a.length;D++){let B=a[D],I=i[B],L=I.box[2]+n;for(let G=D+1;G<a.length;G++){let _=a[G],K=i[_];if(K.box[0]>L)break;if(!kt(Gu(I.box,n),K.box))continue;let $=gg(s[B],s[_],n);if(!$)continue;let X=o.getOrCreate($);r.has(X)||r.set(X,I.elementId),I.splits.push({node:X,t:vi(I.pa,I.pb,o.nodes[X])}),K.splits.push({node:X,t:vi(K.pa,K.pb,o.nodes[X])})}}if(o.nodes.length>t.maxBoundarySegments*4)return null;let l=1/0,d=1/0,c=-1/0,u=-1/0;for(let D of i)l=Math.min(l,D.box[0]),d=Math.min(d,D.box[1]),c=Math.max(c,D.box[2]),u=Math.max(u,D.box[3]);let m=Math.max(c-l,u-d,0),h=Math.max(n*2,m/128),g=new Map;i.forEach((D,B)=>{Du(D.pa,D.pb,n,h,(I,L)=>{let G=`${I}:${L}`,_=g.get(G);_?_.push(B):g.set(G,[B])})});for(let D=0;D<o.nodes.length;D++){let B=o.nodes[D],I=g.get(`${Math.floor(B[0]/h)}:${Math.floor(B[1]/h)}`);if(I)for(let L of I){let G=i[L];if(D===G.a||D===G.b)continue;let _=vi(G.pa,G.pb,B);_<=0||_>=1||ku(B,s[L])<=n&&G.splits.push({node:D,t:_})}}let f=new Set,E=new Map,x=new Map,y=(D,B)=>D<B?`${D}-${B}`:`${B}-${D}`,b=(D,B)=>{let I=E.get(D);I?I.push(B):E.set(D,[B])},M=(D,B,I)=>{if(D===B||cn(o.nodes[D],o.nodes[B])<n)return;let L=y(D,B),G=x.get(L);G?G.add(I):x.set(L,new Set([I])),!f.has(L)&&(f.add(L),b(D,B),b(B,D))};for(let D of i){let B=new Map;for(let L of D.splits)B.has(L.node)||B.set(L.node,L.t);let I=[...B.entries()].map(([L,G])=>({node:L,t:G})).sort((L,G)=>L.t-G.t);for(let L=0;L<I.length-1;L++)M(I[L].node,I[L+1].node,D.elementId)}if(f.size===0)return[];let w=Math.max(n,t.gapTolerance),v=D=>new Set(E.get(D)??[]).size===1,A=[];for(let D of E.keys())v(D)&&A.push(D);if(A.length>0){let D=Math.max(w,m/128,1),B=new Map,I=(G,_)=>{let K={u:G,v:_};Du(o.nodes[G],o.nodes[_],0,D,($,X)=>{let Y=`${$}:${X}`,we=B.get(Y);we?we.push(K):B.set(Y,[K])})};for(let G of f){let[_,K]=G.split("-").map(Number);I(_,K)}let L=(G,_)=>{let K=y(G,_);f.delete(K);let $=x.get(K);x.delete(K);let X=E.get(G),Y=E.get(_);return X?.splice(X.indexOf(_),1),Y?.splice(Y.indexOf(G),1),$};for(let G of A){if(!v(G))continue;let _=o.nodes[G],K=E.get(G)??[],$=-1,X=1/0;o.forEachInRadius(_,w,Ie=>{if(Ie===G||K.includes(Ie))return;let ye=cn(_,o.nodes[Ie]);ye>=n&&ye<=w&&ye<X&&(X=ye,$=Ie)});let Y=null,we=1/0,Q=0,me=Math.floor(_[0]/D),Ae=Math.floor(_[1]/D),ne=new Set;for(let Ie=-1;Ie<=1;Ie++)for(let ye=-1;ye<=1;ye++){let He=B.get(`${me+Ie}:${Ae+ye}`);if(He)for(let Rt of He){let bo=y(Rt.u,Rt.v);if(ne.has(bo)||(ne.add(bo),!f.has(bo)||Rt.u===G||Rt.v===G))continue;let El=o.nodes[Rt.u],xl=o.nodes[Rt.v],rs=vi(El,xl,_);if(rs<=0||rs>=1)continue;let ss=ku(_,yo(El,xl));ss<=w&&ss<we&&(we=ss,Y=Rt,Q=rs)}}let ie=r.get(G)??i[0].elementId;if(Y&&we<X){let Ie=o.nodes[Y.u],ye=o.nodes[Y.v],He=o.getOrCreate(zo(Ie,ye,Q));if(He===Y.u||He===Y.v)M(G,He,ie),I(G,He);else{r.has(He)||r.set(He,x.get(y(Y.u,Y.v))?.values().next().value??ie);let Rt=L(Y.u,Y.v)??new Set([ie]);for(let bo of Rt)M(Y.u,He,bo),M(He,Y.v,bo);I(Y.u,He),I(He,Y.v),M(G,He,ie),I(G,He)}}else $>=0&&(M(G,$,ie),I(G,$))}}let k=new Map,T=0;for(let D of E.keys()){if(k.has(D))continue;let B=[D];for(k.set(D,T);B.length;){let I=B.pop();for(let L of E.get(I)??[])k.has(L)||(k.set(L,T),B.push(L))}T++}let z=(D,B)=>Math.atan2(o.nodes[B][1]-o.nodes[D][1],o.nodes[B][0]-o.nodes[D][0]),C=new Map,O=new Map;for(let[D,B]of E){let I=Array.from(new Set(B));I.sort((G,_)=>z(D,G)-z(D,_)),C.set(D,I);let L=new Map;I.forEach((G,_)=>L.set(G,_)),O.set(D,L)}let N=new Set,j=[],V=f.size*2+4;for(let[D,B]of E)for(let I of B){if(N.has(`${D}->${I}`))continue;let L=[],G=D,_=I,K=0;for(;K++<=V;){N.add(`${G}->${_}`),L.push(G);let $=C.get(_),Y=(O.get(_).get(G)-1+$.length)%$.length,we=$[Y];if(G=_,_=we,G===D&&_===I)break}if(L.length>=3){let $=new Set;for(let X=0;X<L.length;X++){let Y=x.get(y(L[X],L[(X+1)%L.length]));if(Y)for(let we of Y)$.add(we)}j.push({ring:L.map(X=>o.nodes[X]),contributors:$,componentId:k.get(D)??-1})}}return j},Cg=(e,t,n)=>{if(e.length===0)return null;let o=1,i=new Map;for(let c of e)i.set(c,-Ga(c.ring,0));let r=null,s=1/0;for(let c of e){let u=i.get(c);if(Math.sign(u)===o)continue;let m=Math.abs(u);m<n.minArea||Wr(t,c.ring)&&m<s&&(s=m,r=c)}if(!r)return null;let a=r,l=e.filter(c=>c.componentId!==a.componentId&&Math.sign(i.get(c))===o&&Math.abs(i.get(c))>=n.minArea&&!Wr(t,c.ring)&&Wr(c.ring[0],a.ring)),d=l.filter(c=>!l.some(u=>u!==c&&Wr(c.ring[0],u.ring)));return{face:a,holes:d}},Bg=(e,t)=>{let n=[];for(let o of e)(n.length===0||cn(n[n.length-1],o)>=t)&&n.push(o);for(;n.length>1&&cn(n[0],n[n.length-1])<t;)n.pop();return n},Gg=(e,t)=>{if(e.length<=3)return e;let n=[];for(let o=0;o<e.length;o++){let i=n[n.length-1]??e[e.length-1],r=e[(o+1)%e.length];Ig(e[o],i,r)>=t&&n.push(e[o])}return n.length>=3?n:e},Bu=(e,t,n)=>{let o=Bg(e,t.snapEpsilon);if(o.length<3)return null;let i=.75,r=Tn(o,i);for(;r.length>n&&i<1e6;)i*=2,r=Tn(o,i);return r.length>n?null:(r=Gg(r,.05),r.length>=3?r:null)},Ng=(e,t)=>{let n=Math.sign(Ga(t,0))===Math.sign(Ga(e,0))?[...t].reverse():t,o=0,i=0,r=1/0;for(let a=0;a<e.length;a++)for(let l=0;l<n.length;l++){let d=cn(e[a],n[l]);d<r&&(r=d,o=a,i=l)}let s=e.slice(0,o+1);for(let a=0;a<=n.length;a++)s.push(n[(i+a)%n.length]);return s.push(e[o]),s.push(...e.slice(o+1)),s},Og=(e,t,n)=>{let o=Bu(e,n,n.maxGeneratedPoints);if(!o)return null;let i=t.map((s,a)=>({holeRing:s,index:a})).sort((s,a)=>Ai(a.holeRing,0)-Ai(s.holeRing,0)),r=[];for(let{holeRing:s,index:a}of i){let l=n.maxGeneratedPoints-o.length-2;if(l<3)break;let d=Bu(s,n,l);d&&(o=Ng(o,d),r.push(a))}return{scenePoints:[...o,o[0]],splicedHoleIndices:r}},mP=e=>{let t={...Mg,...e.options},{point:n,elements:o,elementsMap:i}=e,r=Lg(n,o,i),s=new Map;o.forEach((C,O)=>s.set(C.id,O));let a=(C,O)=>{let N=I=>kt(C,be(I,i)),j=o.filter(I=>I.id!==O?.id&&Ba(I)&&N(I)),V=o.filter(I=>Cu(I)&&N(I)),D=[],B=I=>{let L=s.get(I.id)??0,G=V.filter($=>$.id!==I.id&&(s.get($.id)??0)>L),_=Math.max(t.snapEpsilon,I.strokeWidth/2,bg),K=Ye(I)?vg(I,i):Le(I)?Ag(I,i):No(I,i);if((I.type==="freedraw"||Ye(I)&&!I.polygon)&&vt(I.points)&&K.length>0){let $=K[0][0],X=K[K.length-1][1];cn($,X)>=t.snapEpsilon&&K.push(yo(X,$))}for(let $ of K){if(D.length>t.maxBoundarySegments)return;if(Pg($)!==0){if(G.length===0){D.push({segment:$,elementId:I.id});continue}for(let[X,Y]of Tg($[0],$[1],G,i,t.snapEpsilon,_))D.push({segment:yo(X,Y),elementId:I.id})}}};for(let I of O?[O,...j]:j){if(D.length>t.maxBoundarySegments)break;B(I)}return D.length>t.maxBoundarySegments?null:D},l=C=>{let O=Dg(C,t);return O?Cg(O,n,t):"too_complex"},d=null;if(r){let C=t.gapTolerance+2+Math.max(r.strokeWidth??1,1),O=Gu(be(r,i),C),N=a(O,r);if(!N)return{ok:!1,reason:"too_complex"};let j=l(N);if(j==="too_complex")return{ok:!1,reason:"too_complex"};if(!j)return{ok:!1,reason:"open_region"};d=j}else{let C=o.reduce((N,j)=>N+(Ba(j)?1:0),0);if(C===0)return{ok:!1,reason:"no_owner"};let O=t.fallbackSearchRadius;for(let N=0;N<4&&!d;N++,O*=2){let j=[n[0]-O,n[1]-O,n[0]+O,n[1]+O],V=o.reduce((L,G)=>L+(Ba(G)&&kt(j,be(G,i))?1:0),0),D=N===3||V===C;if(V===0)continue;let B=a(j,null);if(!B)return{ok:!1,reason:"no_owner"};let I=l(B);if(I==="too_complex")return{ok:!1,reason:"no_owner"};if(I&&(D||I.face.ring.every(L=>L[0]>j[0]+t.gapTolerance&&L[1]>j[1]+t.gapTolerance&&L[0]<j[2]-t.gapTolerance&&L[1]<j[3]-t.gapTolerance))&&(d=I),!d&&D)break}if(!d)return{ok:!1,reason:"no_owner"}}let{face:c,holes:u}=d,m=Og(c.ring,u.map(C=>C.ring),t);if(!m)return{ok:!1,reason:"invalid_polygon"};let{scenePoints:h,splicedHoleIndices:g}=m;if(Ai(h,0)<t.minArea)return{ok:!1,reason:"too_small"};let f=new Set(c.contributors);for(let C of g)for(let O of u[C].contributors)f.add(O);let E=new Set(r?[r.id,...f]:f);for(let C of u)for(let O of C.contributors)E.add(O);let x=h,[y,b,M,w]=go(h),v=C=>{let[O,N,j,V]=be(C,i);if(j<y||O>M||V<b||N>w)return!1;let D=[_o((O+j)/2,(N+V)/2)];if(le(C)||Le(C)){let B=he(C,i),I=Math.max(1,Math.floor(C.points.length/8));for(let L=0;L<C.points.length;L+=I)D.push(jr(_o(C.x+C.points[L][0],C.y+C.points[L][1]),B,C.angle))}return D.some(B=>Lu(B,x))},A=C=>{let[O,N,j,V]=be(C,i);if(j<y||O>M||V<b||N>w)return!1;if(ft(n,C,i))return!0;let D=No(C,i),B=Math.max(1,Math.floor(D.length/16));for(let L=0;L<D.length;L+=B)if(Lu(D[L][0],x))return!0;let I=Math.max(1,Math.floor(h.length/16));for(let L=0;L<h.length;L+=I)if(ft(h[L],C,i))return!0;return!1},k=null,T=null;for(let C of o)Cu(C)&&A(C)&&(T=C),(E.has(C.id)||Ou(C)&&v(C))&&(k=k??C);let z=T?{placement:"above",elementId:T.id}:{placement:"below",elementId:(k??o[o.length-1]).id};return{ok:!0,ownerId:r?.id??null,boundaryElementIds:[...f].filter(C=>C!==r?.id),scenePoints:h,insertion:z}},hP=e=>{let{hitElement:t,scenePoints:n,elementsMap:o}=e;if(!Ru(t))return!1;let i=he(t,o),r=t.points.map(b=>jr(_o(t.x+b[0],t.y+b[1]),i,t.angle)),s=Ai(r,0),a=Ai(n,0),l=Math.abs(s-a)<=.05*Math.max(s,a),[d,c,u,m]=go(r),[h,g,f,E]=go(n),x=yg,y=Math.abs(d-h)<=x&&Math.abs(c-g)<=x&&Math.abs(u-f)<=x&&Math.abs(m-E)<=x;return l&&y};S();import{arrayToMap as kE,arrayToObject as In,assertNever as op,isDevEnv as Qn,isShallowEqual as ip,isTestEnv as Jn,randomInteger as np}from"@excalidraw/common";S();import{assertNever as Xg,COLOR_PALETTE as $g,isDevEnv as Zg,isTestEnv as qg,randomId as Kg,Emitter as zu,toIterable as jo}from"@excalidraw/common";S();import{ORIG_ID as zg,randomId as Hu,randomInteger as _g,arrayToMap as Wg,castArray as Ra,findLastIndex as Wo,getUpdatedTimestamp as jg,isTestEnv as Vg}from"@excalidraw/common";S();import{arrayToMap as Rg}from"@excalidraw/common";var Fg=e=>{let t=(i,r)=>i.groupIds[i.groupIds.length-r-1],n=(i,r)=>{let s=new Map,a=[];for(let l of i){let d=t(l,r);if(d===void 0){a.push(l);continue}let c=s.get(d);c||(c=[],s.set(d,c),a.push(d)),c.push(l)}return a.flatMap(l=>typeof l=="string"?n(s.get(l),r+1):[l])},o=n(e,0);return o.length!==e.length?(console.error("defragmentGroups: lost some elements... bailing!"),e):o},Hg=e=>{let t=Rg(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]},Fu=e=>Hg(Fg(e));var Ug=(e,t,n,o)=>{let i=Ha(n);return Vg()&&Yg(i,n.id),i.id=Hu(),i.updated=jg(),o&&(i.seed=_g(),$d(i)),i.groupIds=Ic(i.groupIds,e,r=>(t.has(r)||t.set(r,Hu()),t.get(r))),i},kP=e=>{let{elements:t}=e,n="appState"in e?e.appState:{editingGroupId:null,selectedGroupIds:{}},o=new Map,i=new Map,r=[],s=[],a=new Map,l=new Map,d=new Map,c=Wg(t),u=e.type==="in-place"?e.idsOfElementsToDuplicate:new Map(t.map(x=>[x.id,x])),m=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=Fu(t);let h=t.slice(),g=x=>{let b=Ra(x).reduce((M,w)=>{if(o.has(w.id))return M;o.set(w.id,!0),rt(w)||console.error("[NONDELETED][INVARIANT] Element to duplicate should be non-deleted");let v=Ug(n.editingGroupId,i,w,e.randomizeSeed);return o.set(v.id,!0),d.set(v.id,v),a.set(w.id,v.id),l.set(v.id,w),s.push(w),r.push(v),M.push(v),M},[]);return Array.isArray(x)?b:b[0]||null},f=(x,y)=>{if(y){if(x>h.length-1){h.push(...Ra(y));return}h.splice(x+1,0,...Ra(y))}},E=new Set(t.filter(x=>u.has(x.id)&&ce(x)).map(x=>x.id));for(let x of t){if(o.has(x.id)||!u.has(x.id))continue;let y=Ea(n,x);if(y){let b=lt(t,y).flatMap(w=>ce(w)&&!m?[...Vn(t,w.id),w]:[w]),M=Wo(h,w=>w.groupIds?.includes(y));f(M,g(b));continue}if(!(!m&&x.frameId&&E.has(x.frameId))){if(ce(x)){let b=x.id;if(m){f(Wo(h,v=>v.id===b),g(x));continue}let M=Vn(t,b),w=Wo(h,v=>v.frameId===b||v.id===b);f(w,g([...M,x]));continue}if(Jt(x)){let b=pe(x,c),M=Wo(h,w=>w.id===x.id||"containerId"in w&&w.containerId===x.id);b?f(M,g([x,b])):f(M,g(x));continue}if(Ne(x)){let b=et(x,c),M=Wo(h,w=>w.id===x.id||w.id===b?.id);b?f(M,g([b,x])):f(M,g(x));continue}f(Wo(h,b=>b.id===x.id),g(x))}}if(rc(r,a,d),pc(h,s,a),e.overrides)for(let x of r){let y=l.get(x.id);y&&Object.assign(x,e.overrides({duplicateElement:x,origElement:y,origIdToDuplicateId:a}))}return{duplicatedElements:r,duplicateElementsMap:d,elementsWithDuplicates:h,origIdToDuplicateId:a}},Fa=(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]=Fa(e[i],t+1)}return o}if(Array.isArray(e)){let o=e.length,i=new Array(o);for(;o--;)i[o]=Fa(e[o],t+1);return i}return F.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Ha=e=>Fa(e),Yg=(e,t)=>{Object.defineProperty(e,zg,{value:t,writable:!1,enumerable:!1})};var Pt={IMMEDIATELY:"IMMEDIATELY",NEVER:"NEVER",EVENTUALLY:"EVENTUALLY"},_u=class{constructor(t){this.app=t}onDurableIncrementEmitter=new zu;onStoreIncrementEmitter=new zu;scheduledMacroActions=new Set;scheduledMicroActions=[];_snapshot=Kn.empty();get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}scheduleAction(t){this.scheduledMacroActions.add(t),this.satisfiesScheduledActionsInvariant()}scheduleCapture(){this.scheduleAction(Pt.IMMEDIATELY)}scheduleMicroAction(t){let{action:n}=t,o;if("change"in t)o=t.change;else{let r=Kn.create(this.app.scene.getElementsMapIncludingDeleted(),this.app.state),s=r.maybeClone(n,t.elements?cc(t.elements):void 0,t.appState);o=ki.create(r,s)}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=Kn.empty(),this.scheduledMacroActions=new Set}emitDurableIncrement(t,n=void 0,o=void 0){let i=this.snapshot,r,s;if(n?r=n:r=ki.create(i,t),o?s=o:s=Wa.calculate(i,t),!s.isEmpty()){let a=new za(r,s);this.onDurableIncrementEmitter.trigger(a),this.onStoreIncrementEmitter.trigger(a)}}emitEphemeralIncrement(t,n=void 0){let o;if(n)o=n;else{let r=this.snapshot;o=ki.create(r,t)}let i=new _a(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===Pt.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 Pt.IMMEDIATELY:this.emitDurableIncrement(o,i,r);break;case Pt.NEVER:case Pt.EVENTUALLY:this.emitEphemeralIncrement(o,i);break;default:Xg(n,"Unknown store action")}}finally{switch(n){case Pt.IMMEDIATELY:case Pt.NEVER:this.snapshot=o;break}}}getScheduledMacroAction(){let t;return this.scheduledMacroActions.has(Pt.IMMEDIATELY)?t=Pt.IMMEDIATELY:this.scheduledMacroActions.has(Pt.NEVER)?t=Pt.NEVER:t=Pt.EVENTUALLY,t}satisfiesScheduledActionsInvariant(){if(!(this.scheduledMacroActions.size>=0&&this.scheduledMacroActions.size<=Object.keys(Pt).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()),qg()||Zg())throw new Error(t)}}},ki=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)}},Vr=class{constructor(t,n){this.type=t;this.change=n}static isDurable(t){return t.type==="durable"}static isEphemeral(t){return t.type==="ephemeral"}},za=class extends Vr{constructor(n,o){super("durable",n);this.change=n;this.delta=o}},_a=class extends Vr{constructor(n){super("ephemeral",n);this.change=n}},Wa=class e{constructor(t,n,o){this.id=t;this.elements=n;this.appState=o}static create(t,n,o={id:Kg()}){return new this(o.id,t,n)}static calculate(t,n){let o=n.metadata.didElementsChange?qn.calculate(t.elements,n.elements):qn.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,qn.restore(o),Zn.restore(i))}static load({id:t,elements:{added:n,removed:o,updated:i},appState:{delta:r}}){let s=qn.create(n,o,i),a=Zn.create(r);return new this(t,s,a)}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,s]=t.elements.applyTo(n,Kn.empty().elements,i),[a,l]=t.appState.applyTo(o,r);return[r,a,s||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(qn.empty(),Zn.empty())}isEmpty(){return this.elements.isEmpty()&&this.appState.isEmpty()}},Kn=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,Wu(n)?n:Vo(n),o)}static empty(){return new e(new Map,Qg(),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}getChangedElements(t){let n={};for(let o of jo(t.elements))this.elements.get(o.id)||(n[o.id]=at(o,{isDeleted:!0}));for(let o of jo(this.elements))t.elements.get(o.id)!==o&&(n[o.id]=o);return n}getChangedAppState(t){return oe.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===Pt.EVENTUALLY&&(i.shouldCompareHashes=!0);let r=this.maybeCreateElementsSnapshot(n,i),s=this.maybeCreateAppStateSnapshot(o,i),a=!1,l=!1;return this.elements!==r&&(a=!0),this.appState!==s&&(l=!0),!a&&!l?this:new e(r,s,{didElementsChange:a,didAppStateChange:l})}maybeCreateAppStateSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.appState;let o=Wu(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=oe.isRightDifferent(this.appState,t);if(!o)return;let i=Uu(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 jo(this.elements))t.get(r.id)||o.set(r.id,at(r,{isDeleted:!0}));for(let r of jo(t)){let s=this.elements.get(r.id);if(!s||s.version<r.version){if(Ue(r)&&!Dn(r))continue;o.set(r.id,r)}}if(!o.size)return;let i=Vu(o);if(!(n.shouldCompareHashes&&this._lastChangedElementsHash===i))return this._lastChangedElementsHash=i,o}createElementsSnapshot(t){let n=new Map;for(let o of jo(this.elements))n.set(o.id,o);for(let o of jo(t))n.set(o.id,Ha(o));return n}},ju="__observedAppState",Qg=()=>({name:null,editingGroupId:null,viewBackgroundColor:$g.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,ju,{value:!0,enumerable:!1}),t},Wu=e=>!!Reflect.get(e,ju);S();var tp=Li(qu(),1);import{randomInteger as gE,arrayToMap as EE,toBrandedType as Ku,isDevEnv as Qu,isTestEnv as Ju,toArray as xE}from"@excalidraw/common";import{isNonDeletedElement as yE}from"@excalidraw/element";import{isFrameLikeElement as bE}from"@excalidraw/element";import{getElementsInGroup as wE}from"@excalidraw/element";import{syncInvalidIndices as ME,syncMovedIndices as PE,validateFractionalIndices as IE}from"@excalidraw/element";import{getSelectedElements as SE}from"@excalidraw/element";import{mutateElement as vE}from"@excalidraw/element";var ep=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}},AE=(0,tp.default)(e=>{(Qu()||Ju()||window?.DEBUG_FRACTIONAL_INDICES)&&IE(e,{shouldThrow:Qu()||Ju(),includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1}),TE=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let o of t)n+=`${o}:${e[o]?"1":"0"}`;return n},Uo=class{callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=Ku(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=Ku(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=TE(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=SE(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&&yE(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=xE(t),i=[];n?.skipValidation||AE(o),this.elements=ME(o),this.elementsMap.clear(),this.elements.forEach(s=>{bE(s)&&i.push(s),this.elementsMap.set(s.id,s)});let r=ep(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=i,this.nonDeletedFramesLikes=ep(this.frames).elements,this.triggerUpdate()}triggerUpdate(){this.sceneNonce=gE();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)];PE(o,EE(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]:wE(n,t)};mutateElement(t,n,o={informMutation:!0,isDragging:!1}){let i=this.getNonDeletedElementsMap(),{version:r}=t,{version:s}=vE(t,i,n,o);return this.elementsMap.has(t.id)&&r!==s&&o.informMutation&&this.triggerUpdate(),t}};var oe=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,s=o&&i!=="deleted"?o(n,"inserted"):n;return new e(r,s)}static calculate(t,n,o,i){if(t===n)return e.empty();let r={},s={};for(let d of this.getDifferences(t,n))r[d]=t[d],s[d]=n[d];let[a,l]=i?i(r,s):[r,s];return e.create(a,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(In(t??[],i),In(n??[],i),In(o??[],i)))}static diffObjects(t,n,o,i){if(!t[o]&&!n[o])return;let r=t[o]!==null&&typeof t[o]=="object",s=n[o]!==null&&typeof n[o]=="object";if(r||s){let a=t[o]??{},l=n[o]??{},d=e.getLeftDifferences(a,l).reduce((u,m)=>(u[m]=i(a[m]),u),{}),c=e.getRightDifferences(a,l).reduce((u,m)=>(u[m]=i(l[m]),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]:[],s=Array.isArray(n[o])?n[o]:[],a=In(e.getLeftDifferences(In(r,i),In(s,i)),d=>d),l=In(e.getRightDifferences(In(r,i),In(s,i)),d=>d);if(Object.keys(a).length||Object.keys(l).length){let d=r.filter(u=>a[i?i(u):String(u)]),c=s.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(s=>s in o):t==="full"?r=Array.from(new Set([...Object.keys(n),...Object.keys(o)])):op(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let s of r){let a=n[s],l=o[s];if(a!==l){if(!i&&typeof a=="object"&&typeof l=="object"&&a!==null&&l!==null&&ip(a,l))continue;yield s}}}},Zn=class e{constructor(t){this.delta=t}static create(t){return new e(t)}static calculate(t,n){let o=oe.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(oe.create({},{}))}inverse(){let t=oe.create(this.delta.inserted,this.delta.deleted);return new e(t)}squash(t){if(t.isEmpty())return this;let n=oe.mergeObjects(this.delta.deleted.selectedElementIds??{},t.delta.deleted.selectedElementIds??{}),o=oe.mergeObjects(this.delta.inserted.selectedElementIds??{},t.delta.inserted.selectedElementIds??{}),i=oe.mergeObjects(this.delta.deleted.selectedGroupIds??{},t.delta.deleted.selectedGroupIds??{}),r=oe.mergeObjects(this.delta.inserted.selectedGroupIds??{},t.delta.inserted.selectedGroupIds??{}),s=oe.mergeObjects(this.delta.deleted.lockedMultiSelections??{},t.delta.deleted.lockedMultiSelections??{}),a=oe.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(s).length||Object.keys(a).length)&&(d.lockedMultiSelections=s,l.lockedMultiSelections=a),this.delta=oe.merge(this.delta,t.delta,oe.create(d,l)),this}applyTo(t,n){try{let{selectedElementIds:o={},selectedGroupIds:i={},lockedMultiSelections:r={}}=this.delta.deleted,{selectedElementIds:s={},selectedGroupIds:a={},lockedMultiSelections:l={},selectedLinearElement:d,...c}=this.delta.inserted,u=oe.mergeObjects(t.selectedElementIds,s,o),m=oe.mergeObjects(t.selectedGroupIds,a,i),h=oe.mergeObjects(t.lockedMultiSelections,l,r),g=d&&n.has(d.elementId)?new W(n.get(d.elementId),n,d.isEditing):null,f={...t,...c,selectedElementIds:u,selectedGroupIds:m,lockedMultiSelections:h,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),Jn()||Qn())throw o;return[t,!1]}}isEmpty(){return oe.isEmpty(this.delta)}filterInvisibleChanges(t,n,o){let i=Vo(t),r=Vo(n),s=oe.isRightDifferent(e.stripElementsProps(i),e.stripElementsProps(r)),a=oe.isRightDifferent(e.stripStandaloneProps(i),e.stripStandaloneProps(r));if(!s&&!a)return!1;let l={value:s};if(a){let d=oe.getRightDifferences(e.stripStandaloneProps(i),e.stripStandaloneProps(r)),c=new Set;(d.includes("editingGroupId")||d.includes("selectedGroupIds"))&&(c=wc(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 b=o.get(y);b&&!b.isDeleted?l.value=!0:n[u]=null}break}case"editingGroupId":let m=n[u];m?c.has(m)?l.value=!0:n[u]=null:l.value=!0;break;case"selectedLinearElement":let h=n[u];if(!h)l.value=!0;else{let y=o.get(h.elementId);y&&!y.isDeleted?l.value=!0:n[u]=null}break;case"lockedMultiSelections":let g=t[u]||{},f=n[u]||{};ip(g,f)||(l.value=!0);break;case"activeLockedId":let E=t[u]||null,x=n[u]||null;E!==x&&(l.value=!0);break;default:op(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 s of i){let a=n.get(s);a&&!a.isDeleted?o.value=!0:delete r[s]}return r}static filterSelectedGroups(t,n,o){if(!Object.keys(t).length)return o.value=!0,t;let r={...t};for(let s of Object.keys(r))n.has(s)?o.value=!0:delete r[s];return r}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:o,selectedElementIds:i,selectedLinearElement:r,croppingElementId:s,lockedMultiSelections:a,activeLockedId:l,...d}=t;return d}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:o,...i}=t;return i}static postProcess(t,n){try{oe.diffObjects(t,n,"selectedElementIds",o=>!0),oe.diffObjects(t,n,"selectedGroupIds",o=>o??!1),oe.diffObjects(t,n,"lockedMultiSelections",o=>o??{})}catch(o){if(console.error("Couldn't postprocess appstate change deltas."),Jn()||Qn())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}},qn=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 s={},a={},l={},d=[...Object.entries(t),...Object.entries(n),...Object.entries(o)];for(let[c,u]of d)this.satisfiesAddition(u)?s[c]=u:this.satisfiesRemoval(u)?a[c]=u:l[c]=u;r=new e(s,a,l)}else r=new e(t,n,o);return(Jn()||Qn())&&(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 s of t.values())if(!n.get(s.id)){let l={...s},d={isDeleted:!0,version:s.version+1,versionNonce:np()},c=oe.create(l,d,e.stripIrrelevantProps);s.isDeleted?r[s.id]=c:i[s.id]=c}for(let s of n.values()){let a=t.get(s.id);if(!a){let l={isDeleted:!0,version:s.version-1,versionNonce:np()},d={...s},c=oe.create(l,d,e.stripIrrelevantProps);s.isDeleted?r[s.id]=c:o[s.id]=c;continue}if(a.versionNonce!==s.versionNonce){let l=oe.calculate(a,s,e.stripIrrelevantProps,e.postProcess);if(typeof a.isDeleted=="boolean"&&typeof s.isDeleted=="boolean"&&a.isDeleted!==s.isDeleted){a.isDeleted&&!s.isDeleted?o[s.id]=l:i[s.id]=l;continue}r[s.id]=l}}return e.create(o,i,r)}static empty(){return e.create({},{},{})}inverse(){let t=r=>{let s={};for(let[a,{inserted:l,deleted:d}]of Object.entries(r))s[a]=oe.create({...l},{...d});return s},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,m)=>{let h;switch(m){case"deleted":h=d;break;case"inserted":h=c;break}if(!h)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]=h[f]}return g},r=d=>{let c={};for(let[u,m]of Object.entries(d)){let h=t.get(u),g=n.get(u),f=null;h||g?f=oe.create(m.deleted,m.inserted,i(h,g),o):f=m,oe.isInnerDifferent(f.deleted,f.inserted)&&(c[u]=f)}return c},s=r(this.added),a=r(this.removed),l=r(this.updated);return e.create(s,a,l,{shouldRedistribute:!0})}applyTo(t,n=Kn.empty().elements,o){let i=new Map(t),r,s={containsVisibleDifference:!1,containsZindexDifference:!1,applyDirection:void 0};try{let a=e.createApplier(t,i,n,s,o),l=a(this.added),d=a(this.removed),c=a(this.updated),u=this.resolveConflicts(t,i,s.applyDirection);r=new Map([...l,...d,...c,...u])}catch(a){if(console.error("Couldn't apply elements delta",a),Jn()||Qn())throw a;return[t,!0]}try{i=e.reorderElements(i,r,s),e.redrawElements(i,r)}catch(a){if(console.error("Couldn't mutate elements after applying elements change",a),Jn()||Qn())throw a}finally{return[i,s.containsVisibleDifference]}}squash(t){if(t.isEmpty())return this;let{added:n,removed:o,updated:i}=t,r=(s,a)=>{let l=oe.mergeArrays(s.deleted.boundElements??[],a.deleted.boundElements??[],void 0,c=>c.id)??[],d=oe.mergeArrays(s.inserted.boundElements??[],a.inserted.boundElements??[],void 0,c=>c.id)??[];if(!(!l.length&&!d.length))return oe.create({boundElements:l},{boundElements:d})};for(let[s,a]of Object.entries(n)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.added[s]=a;else{let d=r(l,a);delete this.removed[s],delete this.updated[s],this.added[s]=oe.merge(l,a,d)}}for(let[s,a]of Object.entries(o)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.removed[s]=a;else{let d=r(l,a);delete this.added[s],delete this.updated[s],this.removed[s]=oe.merge(l,a,d)}}for(let[s,a]of Object.entries(i)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.updated[s]=a;else{let d=r(l,a),c=oe.merge(l,a,d);l===this.added[s]?this.added[s]=c:l===this.removed[s]?this.removed[s]=c:this.updated[s]=c}}return(Jn()||Qn())&&(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)=>s=>{let a=e.createGetter(n,o,i);return Object.entries(s).reduce((l,[d,c])=>{let u=a(d,c.inserted);if(u){let m=e.applyDelta(u,c,i,r);if(n.set(m.id,m),l.set(m.id,m),!i.applyDirection){let h=t.get(d);h&&(i.applyDirection=h.version>m.version?"backward":"forward")}}return l},new Map)};static createGetter=(t,n,o)=>(i,r)=>{let s=t.get(i);return s||(s=n.get(i),s?(o.containsZindexDifference=!0,(!r.isDeleted||r.isDeleted&&!s.isDeleted)&&(o.containsVisibleDifference=!0)):s=at({id:i,version:1},{...r})),s};static applyDelta(t,n,o,i){let r={};for(let s of Object.keys(n.inserted)){if(s==="boundElements"||i?.excludedProperties?.has(s))continue;let a=n.inserted[s];Reflect.set(r,s,a)}if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let s=oe.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,a=>a.id);Object.assign(r,{boundElements:s})}if(!o.containsVisibleDifference){let{index:s,...a}=r,l=e.checkForVisibleDifference(t,a);o.containsVisibleDifference=l}return o.containsZindexDifference||(o.containsZindexDifference=n.deleted.index!==n.inserted.index),at(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:oe.isRightDifferent(t,n)}resolveConflicts(t,n,o="forward"){let i=new Map,r=(a,l)=>{let d=n.get(a.id);if(!d)return;let c=t.get(a.id),u=o==="forward"?d.version+1:d.version-1,m=l,h;c===d?h=at(d,{...m,version:u},!0):h=$e(d,n,{...m,version:c?.version!==d.version?d.version:u}),i.set(h.id,h),n.set(h.id,h)};for(let a of Object.keys(this.removed))e.unbindAffected(t,n,a,r);for(let a of Object.keys(this.added))e.rebindAffected(t,n,a,r);for(let[a]of Array.from(Object.entries(this.updated)).filter(([l,d])=>Object.keys({...d.deleted,...d.inserted}).find(c=>sc.has(c)))){let l=n.get(a);!l||l.isDeleted||e.rebindAffected(t,n,a,r)}let s=new Map(Array.from(t).filter(([a])=>i.has(a)));return this.squash(e.calculate(s,i)),i}static unbindAffected(t,n,o,i){let r=()=>t.get(o),s=()=>n.get(o);Hn.unbindAffected(n,r(),i),Hn.unbindAffected(n,s(),i),zn.unbindAffected(n,r(),i),zn.unbindAffected(n,s(),i)}static rebindAffected(t,n,o,i){let r=()=>t.get(o),s=()=>n.get(o);Hn.unbindAffected(n,r(),i),Hn.rebindAffected(n,s(),i),zn.unbindAffected(n,r(),(a,l)=>{ue(a)&&i(a,l)}),zn.rebindAffected(n,s(),i)}static redrawElements(t,n){try{let o=new Uo(t,{skipValidation:!0});e.redrawTextBoundingBoxes(o,n),e.redrawBoundArrows(o,n)}catch(o){if(console.error("Couldn't redraw elements",o),Jn()||Qn())throw o}finally{return t}}static redrawTextBoundingBoxes(t,n){let o=t.getNonDeletedElementsMap(),i=new Map;for(let r of n.values()){if(Ne(r)){let{containerId:s}=r,a=s?o.get(s):void 0;a&&i.set(a.id,{container:a,boundText:r})}if(Jt(r)){let s=Vt(r),a=s?o.get(s):void 0;a&&i.set(r.id,{container:r,boundText:a})}}for(let{container:r,boundText:s}of i.values())r.isDeleted||s.isDeleted||ar(s,r,t)}static redrawBoundArrows(t,n){for(let o of n.values())!o.isDeleted&&De(o)&&ot(o,t,{changedElements:n})}static reorderElements(t,n,o){if(!o.containsZindexDifference)return t;let i=Array.from(t.values()),r=dc([...i]),s=oe.getRightDifferences(i,r,!0).reduce((a,l)=>{let d=i[Number(l)];return d&&n.has(d.id)&&a.set(d.id,d),a},new Map);return!o.containsVisibleDifference&&s.size&&(o.containsVisibleDifference=!0),kE(uo(r,s))}static postProcess(t,n){try{oe.diffArrays(t,n,"boundElements",r=>r.id);let o=t.points??[],i=n.points??[];oe.isDifferent(o,i)||(Reflect.deleteProperty(t,"points"),Reflect.deleteProperty(n,"points"))}catch(o){if(console.error("Couldn't postprocess elements delta."),Jn()||Qn())throw o}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:o,...i}=t;return i}};S();var mI=(e,t,n,o,i)=>{let[r,s,a,l]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],d=it(e),c=Tr(e,t,o).map(Un).map(g=>[g,it(g)]).sort((g,f)=>g[1][s]-f[1][s]),u=0;for(let g of c)u+=g[1][l];let m=(d[l]-u)/(c.length-1);if(m<0){let g=c.findIndex(y=>y[1][r]===d[r]),f=c.findIndex(y=>y[1][a]===d[a]),E=(c[f][1][s]-c[g][1][s])/(c.length-1),x=c[g][1][s];return c.flatMap(([y,b],M)=>{let w={x:0,y:0};return M!==g&&M!==f&&(x+=E,w[n.axis]=x-b[s]),y.map(v=>{let A=i.mutateElement(v,{x:v.x+w.x,y:v.y+w.y});return ot(v,i,{simultaneouslyUpdated:y}),A})})}let h=d[r];return c.flatMap(([g,f])=>{let E={x:0,y:0};return E[n.axis]=h-f[r],h+=m,h+=f[l],g.map(x=>{let y=i.mutateElement(x,{x:x.x+E.x,y:x.y+E.y});return ot(x,i,{simultaneouslyUpdated:g}),y})})};S();import{TEXT_AUTOWRAP_THRESHOLD as LE,getGridPoint as DE,getFontString as CE,DRAGGING_THRESHOLD as BE}from"@excalidraw/common";var PI=(e,t,n,o,i,r)=>{if(t.length===1&&ee(t[0])&&(t[0].startBinding||t[0].endBinding))return;let s=t.filter(m=>{if(ee(m)&&m.startBinding&&m.endBinding){let h=t.find(f=>f.id===m.startBinding?.elementId),g=t.find(f=>f.id===m.endBinding?.elementId);return h&&g}return!0}),a=new Set(s),l=s.filter(m=>ce(m)).map(m=>m.id);if(l.length>0)for(let m of o.getNonDeletedElements())m.frameId!==null&&l.includes(m.frameId)&&a.add(m);let d=[];for(let m of a){let h=e.originalElements.get(m.id);if(!h)return;d.push(h)}let c=GE(dt(d),n,i,r),u=new Set(Array.from(a,m=>m.id));a.forEach(m=>{let h=!J(m),g=h||(m.startBinding?u.has(m.startBinding.elementId):!1),f=h||(m.endBinding?u.has(m.endBinding.elementId):!1);if(J(m)){if(a.size>1||Math.max(Math.abs(c.x),Math.abs(c.y))>BE||!m.startBinding&&!m.endBinding){Va(e,m,o,c);let E=m.startBinding&&!g,x=m.endBinding&&!f;(E||x)&&(E&&nt(m,"start",o),x&&nt(m,"end",o))}}else{Va(e,m,o,c);let E=pe(m,o.getNonDeletedElementsMap());E&&Va(e,E,o,c),ot(m,o,{simultaneouslyUpdated:Array.from(a)})}})},GE=(e,t,n,o)=>{let[i,r]=e,s=i+t.x+n.x,a=r+t.y+n.y;if(n.x===0||n.y===0){let[l,d]=DE(i+t.x,r+t.y,o);n.x===0&&(s=l),n.y===0&&(a=d)}return{x:s-i,y:a-r}},Va=(e,t,n,o)=>{let i=e.originalElements.get(t.id)??t,r=i.x+o.x,s=i.y+o.y;n.mutateElement(t,{x:r,y:s})},II=(e,t,n)=>{let[o,i]=dt(e);return[t-o,n-i]},NE=({newElement:e,anchorX:t,anchorRatio:n,pointerX:o,nextY:i,zoom:r,scene:s,informMutation:a=!0})=>{let l=o-t,d=n===0?l:n===1?-l:Math.abs(l),c=Math.max(n===.5?d*2:d,or(CE({fontSize:e.fontSize,fontFamily:e.fontFamily}),e.lineHeight));s.mutateElement(e,{x:t-c*n,...i===void 0?{}:{y:i},width:c,...d>LE/r?{autoResize:!1}:{}},{informMutation:a,isDragging:!1})},SI=({newElement:e,elementType:t,originX:n,originY:o,x:i,y:r,width:s,height:a,shouldMaintainAspectRatio:l,shouldResizeFromCenter:d,zoom:c,scene:u,widthAspectRatio:m=null,originOffset:h=null,informMutation:g=!0})=>{if(l&&e.type!=="selection"&&(m?a=s/m:(Math.abs(r-o)>Math.abs(i-n)?{width:s,height:a}=La(t,a,i<n?-s:s):{width:s,height:a}=La(t,s,r<o?-a:a),a<0&&(a=-a))),ue(e)){NE({newElement:e,anchorX:n+(h?.x??0),anchorRatio:d?.5:i<n?1:0,pointerX:i,nextY:o+(h?.y??0),zoom:c,scene:u,informMutation:g});return}let f=i<n?n-s:n,E=r<o?o-a:o;if(d&&(s+=s,a+=a,f=n-s/2,E=o-a/2),s!==0&&a!==0){let x=null;Ue(e)&&(x={initialWidth:s,initialHeight:a}),u.mutateElement(e,{x:f+(h?.x??0),y:E+(h?.y??0),width:s,height:a,...x},{informMutation:g,isDragging:!1})}};S();import{ELEMENT_LINK_KEY as Yr,normalizeLink as rp}from"@excalidraw/common";var LI=(e,t)=>{let n=window.location.href;try{let o=new URL(n);return o.searchParams.set(Yr,e),rp(o.toString())}catch(o){console.error(o)}return rp(n)},DI=(e,t)=>{if(e.length>0&&OE(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},OE=e=>!!(e.length===1||e.length>1&&Mc(e)),CI=e=>{try{let t=new URL(e);return t.searchParams.has(Yr)&&t.host===window.location.host}catch{return!1}},BI=e=>{try{let{searchParams:t}=new URL(e);if(t.has(Yr))return t.get(Yr)}catch{}return null};S();import{FONT_FAMILY as RE,VERTICAL_ALIGN as FE,escapeDoubleQuotes as Ua,getFontString as HE}from"@excalidraw/common";var Zt=new Map,zE=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)/,_E=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,WE=/^https:\/\/(?:www\.)?figma\.com/,sp=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,jE=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,VE=/^(?:https?:\/\/)?forms\.microsoft\.com\//,ap=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,UE=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,YE=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,XE=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,lp=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,dp=/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/,$E=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i,up=e=>{let t;try{let s=new URL(e.startsWith("http")?e:`https://${e}`);t=s.searchParams.get("t")||s.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)},ZE=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"),s=up(t.toString());return{fileId:o,resourceKey:r&&/^[a-zA-Z0-9_-]+$/.test(r)?r:void 0,timestamp:s>0?s:void 0}}catch{return null}},Xa=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"]),cp=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"]),Ya=e=>`<html><body>${e}</body></html>`,zI=e=>{if(!e)return null;if(Zt.has(e))return Zt.get(e);let t=e,n=cp.has($a(e,cp)||""),o="generic",i={w:560,h:840},r=e.match(zE);if(r?.[2]){let c=up(t),u=c>0?`&start=${c}`:"",m=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=m?{w:315,h:560}:{w:560,h:315},Zt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}let s=e.match(_E);if(s?.[1]){let c=s?.[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},Zt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,error:u,sandbox:{allowSameOrigin:n}}}let a=ZE(e);if(a){o="video";let c=new URLSearchParams;a.resourceKey&&c.set("resourcekey",a.resourceKey),a.timestamp&&c.set("t",`${a.timestamp}`);let u=c.toString();return e=`https://drive.google.com/file/d/${a.fileId}/preview${u?`?${u}`:""}`,i={w:560,h:315},Zt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}if(e.match(WE))return o="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},Zt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};let d=e.match(YE);if(d)return e=d[1]==="embed"?d[0]:d[0].replace("/v","/embed"),Zt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};if(VE.test(e)&&!e.includes("embed=true")&&(e+=e.includes("?")?"&embed=true":"?embed=true"),ap.test(e)){let c=e.match(ap)[1],u=Ua(`https://twitter.com/x/status/${c}`),m={type:"document",srcdoc:h=>Ya(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${h}"><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 Zt.set(t,m),m}if(dp.test(e)){let[,c,u,m]=e.match(dp),h=Ua(`https://reddit.com/r/${c}/comments/${u}/${m}`),g={type:"document",srcdoc:f=>Ya(`<blockquote class="reddit-embed-bq" data-embed-theme="${f}"><a href="${h}"></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 Zt.set(t,g),g}if(sp.test(e)){let[,c,u]=e.match(sp),m=Ua(`https://gist.github.com/${c}/${u}`),h={type:"document",srcdoc:()=>Ya(`
|
|
22
|
-
<script src="${
|
|
21
|
+
C ${l} ${d}, ${l} ${d}, ${l+E} ${d+x}`,Mt(e,!0,s))}else a=t.polygon([[l,d],[c,u],[h,m],[g,f]],Mt(e,!1,s));return a}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Mt(e,!1,s));case"line":case"arrow":{let a,l=Mt(e,!1,s),d=e.points.length?e.points:[De(0,0)];if(ee(e)?d.every(c=>Math.abs(c[0])<=1e6&&Math.abs(c[1])<=1e6)?a=[t.path(xu(d,16),Mt(e,!0,s))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(d)),a=[]):e.roundness?a=[t.curve(d,l)]:l.fill?a=[t.polygon(d,l)]:a=[t.linearPath(d,l)],e.type==="arrow"){let{startArrowhead:c=null,endArrowhead:u="arrow"}=e;if(c!==null){let h=fu(e,a,"start",c,t,l,o,s);a.push(...h)}if(u!==null){let h=fu(e,a,"end",u,t,l,o,s);a.push(...h)}}return a}case"freedraw":{let a=[];if(vt(e.points)){let l=Cn(e.points,.75);a.push(t.curve(l,{...Mt(e,!1,s),stroke:"none"}))}return a.push(tg(e)),a}case"frame":case"magicframe":case"text":case"image":return null;default:return $0(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},xu=(e,t)=>{let n=[];for(let i=1;i<e.length-1;i+=1){let r=e[i-1],s=e[i+1],a=e[i],l=Xt(a,r),d=Xt(s,a),c=Math.min(t,hu(e[i],s)/2,hu(e[i],r)/2);l?r[0]<a[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):r[1]<a[1]?n.push([e[i][0],e[i][1]-c]):n.push([e[i][0],e[i][1]+c]),n.push(e[i]),d?s[0]<a[0]?n.push([e[i][0]-c,e[i][1]]):n.push([e[i][0]+c,e[i][1]]):s[1]<a[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(" ")},Ai=(e,t)=>{switch(e.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return Ul(e);case"arrow":case"line":{let n=Ct.generateElementShape(e,null)[0],[,,,,o,i]=ae(e,t);return ur(e)?Yl(e,n,De(e.x,e.y),e.angle,De(o,i)):Vl(n,De(e.x,e.y),e.angle,De(o,i))}case"ellipse":return jl(e);case"freedraw":{let[,,,,n,o]=ae(e,t);return Xl(e,De(n,o),ur(e))}}},qc=(e,t)=>{let n=[...e.points];if(t){if(!gd(e.points))return null;let i=n[0],r=n[n.length-1];Math.hypot(i[0]-r[0],i[1]-r[1])>q0||n.length<4?n.push(De(i[0],i[1])):n[n.length-1]=De(i[0],i[1])}return{polygon:t,points:n}},tg=e=>lg(sg(e)),Fr={SIZE_FACTOR:4.25,THINNING:.6,SMOOTHING:.5},ng={SIZE_FACTOR:1.4},Oa=e=>e.strokeOptions?.streamline??K0,og=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 ed(t,{simulatePressure:e.simulatePressure,size:e.strokeWidth*Fr.SIZE_FACTOR,thinning:Fr.THINNING,smoothing:Fr.SMOOTHING,streamline:Oa(e),easing:n=>Math.sin(n*Math.PI/2),last:!0})},ig=e=>new qi({size:e.strokeWidth*ng.SIZE_FACTOR,streamline:Oa(e),simplify:0,sizeMapping:t=>Math.max(.1,t.pressure)}),rg=e=>{let t=ig(e);return e.points.map(([n,o])=>t.addPoint([n,o,1])),t.getStrokeOutline().map(([n,o])=>[n,o])},sg=e=>e.strokeOptions?.variability==="constant"?rg(e):og(e),yu=e=>bs(e.points,{size:e.strokeWidth*Fr.SIZE_FACTOR,streamline:Oa(e),last:!0}).map(t=>t.point),gu=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],ag=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,lg=e=>{if(!e.length)return"";let t=e.length-1;return e.reduce((n,o,i,r)=>(i===t?n.push(o,gu(o,r[0]),"L",r[0],"Z"):n.push(o,gu(o,r[i+1])),n),["M",e[0],"Q"]).join(" ").replace(ag,"$1")};var Ha=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&&!Ne(t))return i.bounds;if(o&&t.angle!==0){let s=e.calculateBounds({...t,angle:0},n);return e.nonRotatedBoundsCache.set(t,{version:t.version,bounds:s}),s}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,s,a,l,d]=ae(t,n);if(Ce(t)){let[c,u,h,m]=Eo(t.points.map(([g,f])=>Ee(H(g,f),H(l-t.x,d-t.y),t.angle)));return[c+t.x,u+t.y,h+t.x,m+t.y]}else if(le(t))o=xg(t,l,d,n);else if(t.type==="diamond"){let[c,u]=Ee(H(l,r),H(l,d),t.angle),[h,m]=Ee(H(l,a),H(l,d),t.angle),[g,f]=Ee(H(i,d),H(l,d),t.angle),[E,x]=Ee(H(s,d),H(l,d),t.angle),y=Math.min(c,h,g,E),b=Math.min(u,m,f,x),M=Math.max(c,h,g,E),w=Math.max(u,m,f,x);o=[y,b,M,w]}else if(t.type==="ellipse"){let c=(s-i)/2,u=(a-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]=Ee(H(i,r),H(l,d),t.angle),[h,m]=Ee(H(i,a),H(l,d),t.angle),[g,f]=Ee(H(s,a),H(l,d),t.angle),[E,x]=Ee(H(s,r),H(l,d),t.angle),y=Math.min(c,h,g,E),b=Math.min(u,m,f,x),M=Math.max(c,h,g,E),w=Math.max(u,m,f,x);o=[y,b,M,w]}return o}},ae=(e,t,n=!1)=>{if(Ce(e))return pg(e);if(le(e))return U.getElementAbsoluteCoords(e,t,n);if(pe(e)){let o=t?et(e,t):null;if(J(o)){let{x:i,y:r}=U.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]},Oo=(e,t)=>{let n=Ai(e,t),[o,i,r,s,a,l]=ae(e,t),d=H(a,l);if(n.type==="polycurve"){let x=n.data.map(b=>Ft(b,10)),y=[];if(Xe(e)&&!e.polygon||J(e))for(let b of x){let M=0;for(;M<b.length-1;)y.push(Be(H(b[M][0],b[M][1]),H(b[M+1][0],b[M+1][1]))),M++}else{let b=x.flat(),M=0;for(;M<b.length-1;)y.push(Be(H(b[M][0],b[M][1]),H(b[M+1][0],b[M+1][1]))),M++}return y}else{if(n.type==="polyline")return n.data;if(cg(e)){let[E,x]=Bn(e),y=x.map(M=>Mu(M,d,e.angle)).flat();return[...wu(E,d,e.angle),...y]}else if(e.type==="diamond"){let[E,x]=Gn(e),y=x.map(M=>Mu(M,d,e.angle)).flat();return[...wu(E,d,e.angle),...y]}else if(n.type==="polygon"){if(pe(e)){let y=et(e,t);if(y&&le(y))return[Be(H(o,i),H(r,i)),Be(H(r,i),H(r,s)),Be(H(r,s),H(o,s)),Be(H(o,s),H(o,i))]}let E=n.data,x=[];for(let y=0;y<E.length-1;y++)x.push(Be(E[y],E[y+1]));return x}else if(n.type==="ellipse")return ug(e)}let[c,u,h,m,,,g,f]=[[o,i],[r,i],[o,s],[r,s],[a,i],[a,s],[o,l],[r,l]].map(E=>Ee(E,d,e.angle));return[Be(c,u),Be(h,m),Be(c,h),Be(u,m),Be(c,f),Be(h,f),Be(u,g),Be(m,g)]},cg=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),wu=(e,t,n)=>e.map(o=>Be(Ee(o[0],t,n),Ee(o[1],t,n))),Mu=(e,t,n)=>{let o=Ft(e,10),i=0,r=[];for(;i<o.length-1;)r.push(Be(Ee(H(o[i][0],o[i][1]),t,n),Ee(H(o[i+1][0],o[i+1][1]),t,n))),i++;return r},ug=e=>{let t=H(e.x+e.width/2,e.y+e.height/2),n=e.width/2,o=e.height/2,i=[],r=[],s=90,a=Math.PI*2/s;for(let l=0;l<s;l++){let d=l*a,c=t[0]+n*Math.cos(d),u=t[1]+o*Math.sin(d);r.push(Ee(H(c,u),t,e.angle))}for(let l=0;l<r.length-1;l++)i.push(Be(r[l],r[l+1]));return i.push(Be(r[r.length-1],r[0])),i},JM=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],ko=e=>{let t=Math.floor(e.width/2)+1,n=0,o=e.width,i=Math.floor(e.height/2)+1,r=t,s=e.height;return[t,n,o,i,r,s,0,i]},Pu=(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},Iu=(e,t,n,o)=>{let i=t-e,r=n-t,s=o-n,a=3*i-6*r+3*s,l=6*r-6*i,d=3*i,c=l*l-4*a*d;if(!(c>=0))return!1;let h=null,m=null,g=1/0,f=1/0;return a===0?g=f=-d/l:(g=(-l+Math.sqrt(c))/(2*a),f=(-l-Math.sqrt(c))/(2*a)),g>=0&&g<=1&&(h=Pu(g,e,t,n,o)),f>=0&&f<=1&&(m=Pu(f,e,t,n,o)),[h,m]},hr=(e,t,n,o)=>{let i=Iu(e[0],t[0],n[0],o[0]),r=Iu(e[1],t[1],n[1],o[1]),s=Math.min(e[0],o[0]),a=Math.max(e[0],o[0]);if(i){let c=i.filter(u=>u!==null);s=Math.min(s,...c),a=Math.max(a,...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[s,l,a,d]},wi=(e,t)=>{let n=H(0,0),{minX:o,minY:i,maxX:r,maxY:s}=e.reduce((a,{op:l,data:d})=>{if(l==="move"){let c=vu(d);Fa(c!=null,"Op data is not a point"),n=c}else if(l==="bcurveTo"){let c=H(d[0],d[1]),u=H(d[2],d[3]),h=H(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,b,M]=hr(E,m,g,f);a.minX=Math.min(a.minX,x),a.minY=Math.min(a.minY,y),a.maxX=Math.max(a.maxX,b),a.maxY=Math.max(a.maxY,M)}return a},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[o,i,r,s]},Eo=(e,t=0)=>{let n=1/0,o=1/0,i=-1/0,r=-1/0;for(let[s,a]of e)n=Math.min(n,s),o=Math.min(o,a),i=Math.max(i,s),r=Math.max(r,a);return[n-t,o-t,i+t,r+t]},pg=e=>{let[t,n,o,i]=Eo(e.points),r=t+e.x,s=n+e.y,a=o+e.x,l=i+e.y;return[r,s,a,l,(r+a)/2,(s+l)/2]},hg=20,mg=15,fg=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 mg;case"cardinality_one":case"cardinality_exactly_one":case"cardinality_zero_or_one":return hg;default:return 15}},gg=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},ut=(e,t,n,o,i=0)=>{if(o===null||t.length<1)return null;let r=mn(t[0]);if(r.length<1)return null;let s=n==="start"?1:r.length-1,a=r[s].data;Fa(a.length===6,"Op data length is not 6");let l=H(a[4],a[5]),d=H(a[2],a[3]),c=H(a[0],a[1]),u=r[s-1],h=H(0,0);if(u.op==="move"){let I=vu(u.data);Fa(I!=null,"Op data is not a point"),h=I}else u.op==="bcurveTo"&&(h=H(u.data[4],u.data[5]));let m=(I,C)=>Math.pow(1-I,3)*l[C]+3*I*Math.pow(1-I,2)*d[C]+3*Math.pow(I,2)*(1-I)*c[C]+h[C]*Math.pow(I,3),[g,f]=n==="start"?h:l,[E,x]=[m(.3,0),m(.3,1)],y=Math.hypot(g-E,f-x),b=(g-E)/y,M=(f-x)/y,w=fg(o),v=0;{let[I,C]=n==="end"?e.points[e.points.length-1]:e.points[0],[G,z]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];v=Math.hypot(I-G,C-z)}let T=Math.min(w,v*(o==="diamond"||o==="diamond_outline"?.25:.5)),A=g-b*T*i,_=f-M*T*i,D=A-b*T,O=_-M*T;if(o==="circle"||o==="circle_outline"){let I=Math.hypot(O-_,D-A)+e.strokeWidth-2;return[A,_,I]}let N=gg(o);if(o==="cardinality_many"||o==="cardinality_one_or_many"){let[I,C]=Ee(H(A,_),H(D,O),Ra(-N)),[G,z]=Ee(H(A,_),H(D,O),Ra(N));return[D,O,I,C,G,z]}let[W,j]=Ee(H(D,O),H(A,_),-N*Math.PI/180),[L,B]=Ee(H(D,O),H(A,_),Ra(N));if(o==="diamond"||o==="diamond_outline"){let I,C;if(n==="start"){let[G,z]=e.points.length>1?e.points[1]:[0,0];[I,C]=Ee(H(A+T*2,_),H(A,_),Math.atan2(z-_,G-A))}else{let[G,z]=e.points.length>1?e.points[e.points.length-2]:[0,0];[I,C]=Ee(H(A-T*2,_),H(A,_),Math.atan2(_-z,A-G))}return[A,_,W,j,I,C,L,B]}return[A,_,W,j,L,B]},Eg=e=>{let t=Po.generator(),n=Mt(e),o=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[o](e.points,n)},xg=(e,t,n,o)=>{let i=he(e,o);if(e.points.length<2){let[u,h]=e.points[0],[m,g]=Ee(H(e.x+u,e.y+h),H(t,n),e.angle),f=[m,g,m,g];if(i){let E=U.getMinMaxXYWithBoundText(e,o,[m,g,m,g],i);f=[E[0],E[1],E[2],E[3]]}return f}let s=Ct.get(e,null)?.[0]??Eg(e),a=mn(s),d=wi(a,([u,h])=>Ee(H(e.x+u,e.y+h),H(t,n),e.angle)),c=[d[0],d[1],d[2],d[3]];if(i){let u=U.getMinMaxXYWithBoundText(e,o,c,i);c=[u[0],u[1],u[2],u[3]]}return c},we=(e,t,n=!1)=>Ha.getBounds(e,t,n),dt=(e,t)=>{if(!dg(e))return[0,0,0,0];let n=1/0,o=-1/0,i=1/0,r=-1/0,s=t||Su(e);return e.forEach(a=>{let[l,d,c,u]=we(a,s);n=Math.min(n,l),i=Math.min(i,d),o=Math.max(o,c),r=Math.max(r,u)}),[n,i,o,r]},eP=(e,t)=>{let[n,o,i,r]=dt(e);return[n+t.x,o+t.y,i+t.x,r+t.y]},Dn=(e,t,n,o)=>{if(!(le(e)||Ce(e)))return[e.x,e.y,e.x+t,e.y+n];let i=bu(0,t,bu(1,n,e.points,o),o),r;if(Ce(e))r=Eo(i);else{let c=Po.generator(),u=e.roundness?c.curve(i,Mt(e)):c.linearPath(i,Mt(e)),h=mn(u);r=wi(h)}let[s,a,l,d]=r;return[s+e.x,a+e.y,l+e.x,d+e.y]},Pa=(e,t)=>{let n=Po.generator(),o=e.roundness==null?n.linearPath(t,Mt(e)):n.curve(t,Mt(e)),i=mn(o),[r,s,a,l]=wi(i);return[r+e.x,s+e.y,a+e.x,l+e.y]},it=e=>{let[t,n,o,i]=dt(e);return{minX:t,minY:n,maxX:o,maxY:i,width:o-t,height:i-n,midX:(t+o)/2,midY:(n+i)/2}},tP=({scrollX:e,scrollY:t,width:n,height:o,zoom:i})=>[-e,-t,-e+n/i.value,-t+o/i.value],wn=e=>H(e[0]+(e[2]-e[0])/2,e[1]+(e[3]-e[1])/2),bt=(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=fe(e,t),[r,s]=Ee(H(o.minX,o.minY),i,e.angle),[a,l]=Ee(H(o.maxX,o.minY),i,e.angle),[d,c]=Ee(H(o.maxX,o.maxY),i,e.angle),[u,h]=Ee(H(o.minX,o.maxY),i,e.angle),m=[Math.min(r,a,d,u),Math.min(s,l,c,h),Math.max(r,a,d,u),Math.max(s,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},sn=(e,t)=>e[0]>t[0]&&e[0]<t[2]&&e[1]>t[1]&&e[1]<t[3],yg=(e,t)=>e[0]>=t[0]&&e[0]<=t[2]&&e[1]>=t[1]&&e[1]<=t[3],Tt=(e,t)=>{if(e==null||t==null)return!1;let[n,o,i,r]=e,[s,a,l,d]=t;return n<l&&i>s&&o<d&&r>a},xa=(e,t)=>[H(t[0],t[1]),H(t[0],t[3]),H(t[2],t[1]),H(t[2],t[3])].every(n=>yg(n,e)),Tc=({elements:e,elementsMap:t,bounds:n,type:o,excludeElementsInFrames:i,shouldIgnoreElementFromSelection:r})=>{t||(t=Su(e));let s=hd(n)?we(n,t):n,[a,l,d,c]=s,u=[Be(H(a,l),H(d,l)),Be(H(d,l),H(d,c)),Be(H(d,c),H(a,c)),Be(H(a,c),H(a,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,b=we(f,t);b=[b[0]-x/2,b[1]-x/2,b[2]+x/2,b[3]+x/2];let M=J(f)&&he(f,t);if(M){let{x:k,y:T}=U.getBoundTextElementPosition(f,M,t);y=[k,T,k+M.width,T+M.height]}let w=Un(f,t);if(w&&Wn(f,w,t)){let k=we(w,t);b=[Math.max(b[0],k[0]),Math.max(b[1],k[1]),Math.min(b[2],k[2]),Math.min(b[3],k[3])],y=y?[Math.max(y[0],k[0]),Math.max(y[1],k[1]),Math.min(y[2],k[2]),Math.min(y[3],k[3])]:null}let v=y?[Math.min(y[0],b[0]),Math.min(y[1],b[1]),Math.max(y[2],b[2]),Math.max(y[3],b[3])]:b;if(xa(s,v)){h&&ce(f)&&h.add(f.id),g.add(f);continue}if(o==="overlap"&&y&&Tt(s,y)){g.add(f);continue}if(o==="overlap"&&Tt(s,b)){let k=!1;if(le(f)||Ce(f)){let T=fe(f,t);k=f.points.some(A=>{let _=Ee(H(f.x+A[0],f.y+A[1]),T,f.angle);return sn(_,s)})}else{let T=we(f,t,!0),A=fe(f,t);k=[Ee(H((T[0]+T[2])/2,T[1]),A,f.angle),Ee(H(T[2],(T[1]+T[3])/2),A,f.angle),Ee(H((T[0]+T[2])/2,T[3]),A,f.angle),Ee(H(T[0],(T[1]+T[3])/2),A,f.angle)].some(_=>sn(Ee(_,A,f.angle),s))}if(k||(k=u.some(T=>gt(f,t,T,x/2,!0).length>0)),k){h&&ce(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))},fe=(e,t,n=0,o=0)=>{if(le(e)||Ce(e)){let[s,a,l,d]=ae(e,t),[c,u]=H((s+l)/2,(a+d)/2);return H(c+n,u+o)}let[i,r]=wn(we(e,t));return H(i+n,r+o)};var Pg=.1,Au=e=>le(e)||Ce(e)?e.points.length<2||e.points.length===2&&J(e)&&Mg(e.points[0],e.points[e.points.length-1],Pg):e.width===0&&e.height===0,Cc=(e,t,n,o,i)=>{let[r,s,a,l]=we(e,i),d=Hr({clientX:o.offsetLeft,clientY:o.offsetTop},o),c=Hr({clientX:o.offsetLeft+t,clientY:o.offsetTop+n},o);return d.x<=a&&d.y<=l&&c.x>=r&&c.y>=s},dP=(e,t,n,o,i,r)=>{let[s,a,l,d]=dt(e,i),c=Hr({clientX:o.offsetLeft+(r?.left||0),clientY:o.offsetTop+(r?.top||0)},o),u=Hr({clientX:o.offsetLeft+t-(r?.right||0),clientY:o.offsetTop+n-(r?.bottom||0)},o);return s>=c.x&&a>=c.y&&l<=u.x&&d<=u.y},_a=(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)/Sn)*Sn;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}},Kc=(e,t,n,o,i)=>{let r=n-e,s=o-t,a=Math.atan2(s,r),l=Math.round(a/Sn)*Sn;if(i){let d=Math.floor(i/Sn)*Sn;bg(a,d,d+Sn)&&(wg(a,i)<Sn/6?l=i:ku(a)>ku(i)?l=d+Sn:l=d)}if(l===0)s=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,s=E-t}return{width:r,height:s}},cP=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};S();var EP=(e,t,n,o)=>{let i=Lr(e,n.getNonDeletedElementsMap(),o).map(Xn),r=it(e);return i.flatMap(s=>{let a=Ig(s,r,t);return s.map(l=>{let d=n.mutateElement(l,{x:l.x+a.x,y:l.y+a.y});return ot(l,n,{simultaneouslyUpdated:s}),d})})},Ig=(e,t,{axis:n,position:o})=>{let i=it(e),[r,s]=n==="x"?["minX","maxX"]:["minY","maxY"],a={x:0,y:0};return o==="start"?{...a,[n]:t[r]-i[r]}:o==="end"?{...a,[n]:t[s]-i[s]}:{...a,[n]:(t[r]+t[s])/2-(i[r]+i[s])/2}};S();S();var _r=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 s=t[r],a=this.findNode(this.root,s.w,s.h);a?s.fit=this.splitNode(a,s.w,s.h):s.fit=this.growNode(s.w,s.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,s=o&&this.root.w>=this.root.h+n+this.gap;return r?this.growRight(t,n):s?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}};S();var Sg=[1,1.08,1.18,1.32,1.5,1.75,2.1,2.6,3.25],vg=[1,4/3,3/4,3/2,2/3,2,1/2],kg=(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},Ag=(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,Tu=(e,t,n)=>Math.min(Math.max(e,t),n),Tg=(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,Cg=(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,Cu=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})},Lg=(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 s=r.fit.x+r.actualW/2,a=r.fit.y+r.actualH/2;return i+Math.abs(s-n)+Math.abs(a-o)},0)},Dg=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&&Cg(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},Bg=(e,t)=>{let n=[];for(let o of e){if(!Tg(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 Dg(n)},Gg=(e,t,n,o)=>{let i=e.x+e.w-t.packedW,r=e.y+e.h-t.packedH,s=[{x:e.x,y:e.y},{x:i,y:e.y},{x:e.x,y:r},{x:i,y:r}];return n==="center-distance"&&s.push({x:Tu(o.x-t.actualW/2,e.x,i),y:Tu(o.y-t.actualH/2,e.y,r)}),s.filter((a,l,d)=>d.findIndex(c=>c.x===a.x&&c.y===a.y)===l)},Ng=(e,t,n,o,i,r,s)=>{let a=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[a,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:s/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,b=x*y;return[f,b,a,c,u]},Og=(e,t,n,o)=>{let i=[{x:0,y:0,w:t,h:n}];for(let l of e){let d=Cu(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=Gg(u,l,o,h);for(let g of m){let f=Ng(u,l,g,o,d,t,n);(!c||kg(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=Bg(i,{x:c.x,y:c.y,w:l.packedW,h:l.packedH})}let r=Cu(e);if(!r)return{width:0,height:0,spread:0};let s=r.minX,a=r.minY;return e.forEach(l=>{l.fit&&(l.fit={x:l.fit.x-s,y:l.fit.y-a})}),{width:r.maxX-r.minX,height:r.maxY-r.minY,spread:Lg(e,{minX:0,minY:0,maxX:r.maxX-r.minX,maxY:r.maxY-r.minY})}},Lu=(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(Ag),r=i.reduce((d,c)=>d+c.packedW*c.packedH,0),s=Math.max(...i.map(d=>d.packedW)),a=Math.max(...i.map(d=>d.packedH)),l=null;for(let d of Sg){let c=r*d;for(let u of vg){let h=Math.max(s,Math.ceil(Math.sqrt(c*u))),m=Math.max(a,Math.ceil(c/h)),g=i.map(M=>({...M,fit:null})),f=Og(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),b=Math.abs(l.width-l.height);(x<0||x===0&&(y<b||y===b&&(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 Rg=(e,t,n)=>{let o=it(t),i=n.x-o.minX,r=n.y-o.minY;t.forEach(s=>{e.mutateElement(s,{x:s.x+i,y:s.y+r})})},Du=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),Bu=(e,t,n)=>{let o=t.filter(i=>i.fit);return o.forEach(i=>{Rg(e,i.group,{x:n.x+(i.fit?.x??0),y:n.y+(i.fit?.y??0)})}),o.flatMap(i=>i.group)},Gu=(e,t,n)=>{let o=t.flatMap(l=>l.group),i=it(o),r={x:i.minX,y:i.minY},s=Du(t);return new _r(n).fit(s),Bu(e,s,r)},za=(e,t,n,o)=>{let i=t.flatMap(d=>d.group),r=it(i),s={x:r.minX,y:r.minY},a=Du(t);return Lu(a,{gap:n,heuristic:o})?Bu(e,a,s):(console.warn(`Packing heuristic [${o}] failed - using binary tree packer`),Gu(e,t,n))},AP=(e,t,n,o,i)=>{let s=Cr(t,n).map(a=>({group:a,boundingBox:it(a)}));switch(o){case"bin-packing":case"bin-packing-center":return za(e,s,i,"center-distance");case"bin-packing-max-rects":return za(e,s,i,"best-area-fit");case"bin-packing-binary-tree":return Gu(e,s,i);default:return console.warn(`Unimplemented algorithm [${o}] - using bin-packing`),za(e,s,i,"center-distance")}};S();import{TEXT_ALIGN as Ur,VERTICAL_ALIGN as jr}from"@excalidraw/common";import{pointDistance as Zg,pointFromVector as qg,pointsEqual as zu,vector as Kg,vectorDot as Qg,vectorFromPoint as _u,vectorNormalize as Jg,vectorScale as eE}from"@excalidraw/math";S();import{DEFAULT_ELEMENT_PROPS as Zn,DEFAULT_FONT_FAMILY as Fg,DEFAULT_FONT_SIZE as Hg,DEFAULT_TEXT_ALIGN as _g,DEFAULT_VERTICAL_ALIGN as zg,DEFAULT_STROKE_STREAMLINE as Wg,VERTICAL_ALIGN as xo,randomInteger as Ug,randomId as jg,getFontString as zr,getUpdatedTimestamp as Vg,getLineHeight as Xg}from"@excalidraw/common";var qt=(e,{x:t,y:n,strokeColor:o=Zn.strokeColor,backgroundColor:i=Zn.backgroundColor,fillStyle:r=Zn.fillStyle,strokeWidth:s=Zn.strokeWidth,strokeStyle:a=Zn.strokeStyle,roughness:l=Zn.roughness,opacity:d=Zn.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:b=Zn.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||jg(),type:e,x:t,y:n,width:c,height:u,angle:h,strokeColor:o,backgroundColor:i,fillStyle:r,strokeWidth:s,strokeStyle:a,roughness:l,opacity:d,groupIds:m,frameId:g,index:f,roundness:E,seed:M.seed??Ug(),version:M.version||1,versionNonce:M.versionNonce??0,isDeleted:!1,boundElements:x,updated:Vg(),link:y,locked:b,customData:M.customData}),_o=e=>qt(e.type,e),FP=e=>qt("embeddable",e),HP=e=>({...qt("iframe",e)}),Nu=e=>at({...qt("frame",e),type:"frame",name:e?.name||null},{}),Ou=e=>at({...qt("magicframe",e),type:"magicframe",name:e?.name||null},{}),Wa=e=>({x:e.textAlign==="center"?.5:e.textAlign==="right"?1:0,y:e.verticalAlign===xo.MIDDLE?.5:e.verticalAlign===xo.BOTTOM?1:0}),Ru=(e,t)=>{let n=Wa(e);return{x:t.width*n.x,y:t.height*n.y}},yo=e=>{let t=e.fontFamily||Fg,n=e.fontSize||Hg,o=e.lineHeight||Xg(t),i=pi(e.text),r=kt(i,zr({fontFamily:t,fontSize:n}),o),s=e.textAlign||_g,a=e.verticalAlign||zg,l=Ru({textAlign:s,verticalAlign:a},r),d={...qt("text",e),text:i,fontSize:n,fontFamily:t,textAlign:s,verticalAlign:a,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 at(d,{})},Yg=(e,t,n)=>{let{width:o,height:i}=kt(n,zr(e),e.lineHeight);e.autoResize||(o=e.width);let{textAlign:r,verticalAlign:s}=e,a,l;if(r==="center"&&s===xo.MIDDLE&&!e.containerId&&e.autoResize){let d=kt(e.text,zr(e),e.lineHeight),c=Ru(e,{width:o-d.width,height:i-d.height});a=e.x-c.x,l=e.y-c.y}else{let[d,c,u,h]=ae(e,t),[m,g,f,E]=Dn(e,o,i,!1),x=(d-m)/2,y=(c-g)/2,b=(u-f)/2,M=(h-E)/2;[a,l]=$g({n:s===xo.MIDDLE||s===xo.BOTTOM,s:s===xo.MIDDLE||s===xo.TOP,e:r==="center"||r==="left",w:r==="center"||r==="right"},e.x,e.y,e.angle,x,y,b,M)}return{width:o,height:i,x:Number.isFinite(a)?a:e.x,y:Number.isFinite(l)?l:e.y}},$g=(e,t,n,o,i,r,s,a)=>{let l=Math.cos(o),d=Math.sin(o);return e.e&&e.w?t+=i+s:e.e?(t+=i*(1+l),n+=i*d,t+=s*(1-l),n+=s*-d):e.w&&(t+=i*(1-l),n+=i*-d,t+=s*(1+l),n+=s*d),e.n&&e.s?n+=r+a:e.n?(t+=r*d,n+=r*(1-l),t+=a*-d,n+=a*(1+l)):e.s&&(t+=r*-d,n+=r*(1+l),t+=a*d,n+=a*(1-l)),[t,n]},_P=(e,t,n,o=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(o=yn(o,zr(e),t?jt(t,e):e.width));let i=Yg(e,n,o);return{text:o,...i}},zP=e=>({...qt(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure,strokeOptions:e.strokeOptions??{variability:"variable",streamline:Wg}}),Fu=e=>{let t={...qt(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null};return Xe(t)?{...t,polygon:e.polygon??!1}:t},Wr=e=>e.elbowed?{...qt(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}:{...qt(e.type,e),points:e.points||[],startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!1},Hu=e=>({...qt("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,gifPlayback:e.gifPlayback??null});var KP=(e,t,n,o)=>{for(let i=t.length-1;i>=0;i--){let r=t[i];if(!(!J(r)||r.locked||r.points.length<2))for(let s of["end","start"]){if(r[s==="start"?"startBinding":"endBinding"]||zu(r.points[s==="start"?0:r.points.length-1],r.points[s==="start"?1:r.points.length-2]))continue;let a=U.getPointAtIndexGlobalCoordinates(r,s==="start"?0:-1,n);if(Zg(e,a)*o.value<U.POINT_HANDLE_SIZE+1)return{arrow:r,startOrEnd:s}}}return null},QP=(e,t,n,o)=>{let i=U.getPointAtIndexGlobalCoordinates(e,t==="start"?0:-1,n),r=U.getPointAtIndexGlobalCoordinates(e,t==="start"?1:-2,n);if(zu(i,r))return null;let s=_u(i,r),a=Math.abs(s[0])>=Math.abs(s[1])?s[0]>=0?Se:Ye:s[1]>=0?We:st,l=ee(e)?0:ze({strokeWidth:o},e),d=Jg(_u(r,i)),c=Math.abs(Qg(d,Kg(a[0],a[1]))),u=qg(eE(d,-l/c),i);return Pe(a,Se)?{fixedPoint:Je([0,.5]),anchor:u,textAlign:Ur.LEFT,verticalAlign:jr.MIDDLE}:Pe(a,Ye)?{fixedPoint:Je([1,.5]),anchor:u,textAlign:Ur.RIGHT,verticalAlign:jr.MIDDLE}:Pe(a,We)?{fixedPoint:Je([.5,0]),anchor:u,textAlign:Ur.CENTER,verticalAlign:jr.TOP}:{fixedPoint:Je([.5,1]),anchor:u,textAlign:Ur.CENTER,verticalAlign:jr.BOTTOM}},JP=(e,t)=>!!e.boundElements?.some(({id:n,type:o})=>{if(o!=="arrow")return!1;let i=t.get(n);return J(i)&&(i.startBinding?.elementId===e.id||i.endBinding?.elementId===e.id)}),eI=e=>{let t=Wa(e).x;return{anchorRatio:t,anchorX:e.x+e.width*t}};S();import{distanceToLineSegment as Wu,lineSegment as bo,lineSegmentIntersectionPoints as tE,pointDistance as pn,pointFrom as Wo,pointRotateRads as Xr,polygonArea as Ci,polygonIncludesPoint as Uu,polygonIncludesPointNonZero as Vr,polygonSignedArea as ja}from"@excalidraw/math";import{isOpaqueColor as nE,isTransparent as Li}from"@excalidraw/common";var oE=6,iE=2,rE=2,sE=.5,aE={snapEpsilon:.5,gapTolerance:oE,minArea:4,maxBoundarySegments:2560,maxGeneratedPoints:1536,fallbackSearchRadius:512},Yu=([e,t,n,o],i)=>[e-i,t-i,n+i,o+i],lE=e=>pn(e[0],e[1]),Ti=(e,t,n)=>{let o=t[0]-e[0],i=t[1]-e[1],r=o*o+i*i;return r===0?0:((n[0]-e[0])*o+(n[1]-e[1])*i)/r},ju=(e,t,n,o,i)=>{let r=Math.min(e[0],t[0]),s=Math.max(e[0],t[0]),a=t[0]-e[0],l=t[1]-e[1],d=Math.floor((r-n)/o),c=Math.floor((s+n)/o);for(let u=d;u<=c;u++){let h=e[1],m=t[1];if(a!==0){let E=(Math.max(r,u*o-n)-e[0])/a,x=(Math.min(s,(u+1)*o+n)-e[0])/a;h=e[1]+E*l,m=e[1]+x*l}let g=Math.floor((Math.min(h,m)-n)/o),f=Math.floor((Math.max(h,m)+n)/o);for(let E=g;E<=f;E++)i(u,E)}},dE=(e,t,n)=>{let o=n[0]-t[0],i=n[1]-t[1],r=Math.hypot(o,i);return r===0?pn(e,t):Math.abs((e[0]-t[0])*i-(e[1]-t[1])*o)/r},zo=(e,t,n)=>Wo(e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n),cE=(e,t)=>{let n=e;for(let[o,i]of t){let r=[];for(let[s,a]of n){if(i<=s||o>=a){r.push([s,a]);continue}o>s&&r.push([s,o]),i<a&&r.push([i,a])}n=r}return n},uE=(e,t)=>{let n=fe(e,t),i=(e.roundness&&e.points.length>2?Ft(Vi(e.points),.15,sE):e.points).map(s=>Xr(Wo(e.x+s[0],e.y+s[1]),n,e.angle)),r=[];for(let s=0;s<i.length-1;s++)r.push(bo(i[s],i[s+1]));return r},pE=(e,t)=>{let n=fe(e,t),o=yu(e).map(r=>Xr(Wo(e.x+r[0],e.y+r[1]),n,e.angle)),i=[];for(let r=0;r<o.length-1;r++)i.push(bo(o[r],o[r+1]));return i},hE=(e,t,n,o,i,r)=>{let s=[[0,1]];for(let a of n){if(s.length===0)break;let d=[0,...gt(a,o,bo(e,t)).map(u=>Ti(e,t,u)).filter(u=>u>0&&u<1).sort((u,h)=>u-h),1],c=[];for(let u=0;u<d.length-1;u++){let h=d[u],m=d[u+1];if(m-h<1e-9)continue;let g=zo(e,t,(h+m)/2);ft(g,a,o)&&rn(a,o,g)>r&&c.push([h,m])}c.length&&(s=cE(s,c))}return s.filter(([a,l])=>pn(zo(e,t,a),zo(e,t,l))>=i).map(([a,l])=>[zo(e,t,a),zo(e,t,l)])},Va=class{constructor(t){this.eps=t;this.cellSize=Math.max(t,1)}nodes=[];cells=new Map;cellSize;cellKey(t,n){return`${t}:${n}`}getOrCreate(t){let n=Math.floor(t[0]/this.cellSize),o=Math.floor(t[1]/this.cellSize);for(let a=-1;a<=1;a++)for(let l=-1;l<=1;l++){let d=this.cells.get(this.cellKey(n+a,o+l));if(d){for(let c of d)if(pn(this.nodes[c],t)<=this.eps)return c}}let i=this.nodes.length;this.nodes.push(t);let r=this.cellKey(n,o),s=this.cells.get(r);return s?s.push(i):this.cells.set(r,[i]),i}forEachInRadius(t,n,o){let i=Math.floor((t[0]-n)/this.cellSize),r=Math.floor((t[0]+n)/this.cellSize),s=Math.floor((t[1]-n)/this.cellSize),a=Math.floor((t[1]+n)/this.cellSize);for(let l=i;l<=r;l++)for(let d=s;d<=a;d++){let c=this.cells.get(this.cellKey(l,d));if(c)for(let u of c)o(u)}}},Vu=e=>!(!To(e.type)||e.fillStyle!=="solid"||e.opacity<100||!nE(e.backgroundColor)||(Xe(e)||Ce(e))&&!vt(e.points)),$u=new Set(["rectangle","diamond","ellipse","frame","magicframe","line","freedraw"]),Xa=e=>e.opacity<=0,Zu=e=>!Xa(e)&&(e.type==="image"||!Li(e.strokeColor)||To(e.type)&&!Li(e.backgroundColor)),qu=e=>Xe(e)&&e.polygon&&vs(e.points)&&!Xa(e)&&!Li(e.backgroundColor)&&Li(e.strokeColor),mE=e=>$u.has(e.type)?Xe(e)?e.polygon&&vs(e.points):Ce(e)?vt(e.points):!0:!1,Ua=e=>!Xa(e)&&$u.has(e.type)&&!Li(e.strokeColor),fE=(e,t,n)=>{for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!Zu(i)||qu(i))&&mE(i)&&ft(e,i,n))return i}return null},gE=(e,t)=>{let n=t.snapEpsilon,o=new Va(n),i=[],r=new Map;for(let{segment:L,elementId:B}of e){let I=o.getOrCreate(L[0]),C=o.getOrCreate(L[1]);if(r.has(I)||r.set(I,B),r.has(C)||r.set(C,B),I===C)continue;let G=o.nodes[I],z=o.nodes[C];i.push({a:I,b:C,pa:G,pb:z,elementId:B,box:[Math.min(G[0],z[0]),Math.min(G[1],z[1]),Math.max(G[0],z[0]),Math.max(G[1],z[1])],splits:[{node:I,t:0},{node:C,t:1}]})}let s=i.map(L=>bo(L.pa,L.pb)),a=i.map((L,B)=>B).sort((L,B)=>i[L].box[0]-i[B].box[0]);for(let L=0;L<a.length;L++){let B=a[L],I=i[B],C=I.box[2]+n;for(let G=L+1;G<a.length;G++){let z=a[G],Z=i[z];if(Z.box[0]>C)break;if(!Tt(Yu(I.box,n),Z.box))continue;let $=tE(s[B],s[z],n);if(!$)continue;let V=o.getOrCreate($);r.has(V)||r.set(V,I.elementId),I.splits.push({node:V,t:Ti(I.pa,I.pb,o.nodes[V])}),Z.splits.push({node:V,t:Ti(Z.pa,Z.pb,o.nodes[V])})}}if(o.nodes.length>t.maxBoundarySegments*4)return null;let l=1/0,d=1/0,c=-1/0,u=-1/0;for(let L of i)l=Math.min(l,L.box[0]),d=Math.min(d,L.box[1]),c=Math.max(c,L.box[2]),u=Math.max(u,L.box[3]);let h=Math.max(c-l,u-d,0),m=Math.max(n*2,h/128),g=new Map;i.forEach((L,B)=>{ju(L.pa,L.pb,n,m,(I,C)=>{let G=`${I}:${C}`,z=g.get(G);z?z.push(B):g.set(G,[B])})});for(let L=0;L<o.nodes.length;L++){let B=o.nodes[L],I=g.get(`${Math.floor(B[0]/m)}:${Math.floor(B[1]/m)}`);if(I)for(let C of I){let G=i[C];if(L===G.a||L===G.b)continue;let z=Ti(G.pa,G.pb,B);z<=0||z>=1||Wu(B,s[C])<=n&&G.splits.push({node:L,t:z})}}let f=new Set,E=new Map,x=new Map,y=(L,B)=>L<B?`${L}-${B}`:`${B}-${L}`,b=(L,B)=>{let I=E.get(L);I?I.push(B):E.set(L,[B])},M=(L,B,I)=>{if(L===B||pn(o.nodes[L],o.nodes[B])<n)return;let C=y(L,B),G=x.get(C);G?G.add(I):x.set(C,new Set([I])),!f.has(C)&&(f.add(C),b(L,B),b(B,L))};for(let L of i){let B=new Map;for(let C of L.splits)B.has(C.node)||B.set(C.node,C.t);let I=[...B.entries()].map(([C,G])=>({node:C,t:G})).sort((C,G)=>C.t-G.t);for(let C=0;C<I.length-1;C++)M(I[C].node,I[C+1].node,L.elementId)}if(f.size===0)return[];let w=Math.max(n,t.gapTolerance),v=L=>new Set(E.get(L)??[]).size===1,k=[];for(let L of E.keys())v(L)&&k.push(L);if(k.length>0){let L=Math.max(w,h/128,1),B=new Map,I=(G,z)=>{let Z={u:G,v:z};ju(o.nodes[G],o.nodes[z],0,L,($,V)=>{let Y=`${$}:${V}`,ue=B.get(Y);ue?ue.push(Z):B.set(Y,[Z])})};for(let G of f){let[z,Z]=G.split("-").map(Number);I(z,Z)}let C=(G,z)=>{let Z=y(G,z);f.delete(Z);let $=x.get(Z);x.delete(Z);let V=E.get(G),Y=E.get(z);return V?.splice(V.indexOf(z),1),Y?.splice(Y.indexOf(G),1),$};for(let G of k){if(!v(G))continue;let z=o.nodes[G],Z=E.get(G)??[],$=-1,V=1/0;o.forEachInRadius(z,w,Ie=>{if(Ie===G||Z.includes(Ie))return;let be=pn(z,o.nodes[Ie]);be>=n&&be<=w&&be<V&&(V=be,$=Ie)});let Y=null,ue=1/0,q=0,me=Math.floor(z[0]/L),ke=Math.floor(z[1]/L),ne=new Set;for(let Ie=-1;Ie<=1;Ie++)for(let be=-1;be<=1;be++){let He=B.get(`${me+Ie}:${ke+be}`);if(He)for(let Rt of He){let wo=y(Rt.u,Rt.v);if(ne.has(wo)||(ne.add(wo),!f.has(wo)||Rt.u===G||Rt.v===G))continue;let kl=o.nodes[Rt.u],Al=o.nodes[Rt.v],ls=Ti(kl,Al,z);if(ls<=0||ls>=1)continue;let ds=Wu(z,bo(kl,Al));ds<=w&&ds<ue&&(ue=ds,Y=Rt,q=ls)}}let ie=r.get(G)??i[0].elementId;if(Y&&ue<V){let Ie=o.nodes[Y.u],be=o.nodes[Y.v],He=o.getOrCreate(zo(Ie,be,q));if(He===Y.u||He===Y.v)M(G,He,ie),I(G,He);else{r.has(He)||r.set(He,x.get(y(Y.u,Y.v))?.values().next().value??ie);let Rt=C(Y.u,Y.v)??new Set([ie]);for(let wo of Rt)M(Y.u,He,wo),M(He,Y.v,wo);I(Y.u,He),I(He,Y.v),M(G,He,ie),I(G,He)}}else $>=0&&(M(G,$,ie),I(G,$))}}let T=new Map,A=0;for(let L of E.keys()){if(T.has(L))continue;let B=[L];for(T.set(L,A);B.length;){let I=B.pop();for(let C of E.get(I)??[])T.has(C)||(T.set(C,A),B.push(C))}A++}let _=(L,B)=>Math.atan2(o.nodes[B][1]-o.nodes[L][1],o.nodes[B][0]-o.nodes[L][0]),D=new Map,O=new Map;for(let[L,B]of E){let I=Array.from(new Set(B));I.sort((G,z)=>_(L,G)-_(L,z)),D.set(L,I);let C=new Map;I.forEach((G,z)=>C.set(G,z)),O.set(L,C)}let N=new Set,W=[],j=f.size*2+4;for(let[L,B]of E)for(let I of B){if(N.has(`${L}->${I}`))continue;let C=[],G=L,z=I,Z=0;for(;Z++<=j;){N.add(`${G}->${z}`),C.push(G);let $=D.get(z),Y=(O.get(z).get(G)-1+$.length)%$.length,ue=$[Y];if(G=z,z=ue,G===L&&z===I)break}if(C.length>=3){let $=new Set;for(let V=0;V<C.length;V++){let Y=x.get(y(C[V],C[(V+1)%C.length]));if(Y)for(let ue of Y)$.add(ue)}W.push({ring:C.map(V=>o.nodes[V]),contributors:$,componentId:T.get(L)??-1})}}return W},EE=(e,t,n)=>{if(e.length===0)return null;let o=1,i=new Map;for(let c of e)i.set(c,-ja(c.ring,0));let r=null,s=1/0;for(let c of e){let u=i.get(c);if(Math.sign(u)===o)continue;let h=Math.abs(u);h<n.minArea||Vr(t,c.ring)&&h<s&&(s=h,r=c)}if(!r)return null;let a=r,l=e.filter(c=>c.componentId!==a.componentId&&Math.sign(i.get(c))===o&&Math.abs(i.get(c))>=n.minArea&&!Vr(t,c.ring)&&Vr(c.ring[0],a.ring)),d=l.filter(c=>!l.some(u=>u!==c&&Vr(c.ring[0],u.ring)));return{face:a,holes:d}},xE=(e,t)=>{let n=[];for(let o of e)(n.length===0||pn(n[n.length-1],o)>=t)&&n.push(o);for(;n.length>1&&pn(n[0],n[n.length-1])<t;)n.pop();return n},yE=(e,t)=>{if(e.length<=3)return e;let n=[];for(let o=0;o<e.length;o++){let i=n[n.length-1]??e[e.length-1],r=e[(o+1)%e.length];dE(e[o],i,r)>=t&&n.push(e[o])}return n.length>=3?n:e},Xu=(e,t,n)=>{let o=xE(e,t.snapEpsilon);if(o.length<3)return null;let i=.75,r=Cn(o,i);for(;r.length>n&&i<1e6;)i*=2,r=Cn(o,i);return r.length>n?null:(r=yE(r,.05),r.length>=3?r:null)},bE=(e,t)=>{let n=Math.sign(ja(t,0))===Math.sign(ja(e,0))?[...t].reverse():t,o=0,i=0,r=1/0;for(let a=0;a<e.length;a++)for(let l=0;l<n.length;l++){let d=pn(e[a],n[l]);d<r&&(r=d,o=a,i=l)}let s=e.slice(0,o+1);for(let a=0;a<=n.length;a++)s.push(n[(i+a)%n.length]);return s.push(e[o]),s.push(...e.slice(o+1)),s},wE=(e,t,n)=>{let o=Xu(e,n,n.maxGeneratedPoints);if(!o)return null;let i=t.map((s,a)=>({holeRing:s,index:a})).sort((s,a)=>Ci(a.holeRing,0)-Ci(s.holeRing,0)),r=[];for(let{holeRing:s,index:a}of i){let l=n.maxGeneratedPoints-o.length-2;if(l<3)break;let d=Xu(s,n,l);d&&(o=bE(o,d),r.push(a))}return{scenePoints:[...o,o[0]],splicedHoleIndices:r}},mI=e=>{let t={...aE,...e.options},{point:n,elements:o,elementsMap:i}=e,r=fE(n,o,i),s=new Map;o.forEach((D,O)=>s.set(D.id,O));let a=(D,O)=>{let N=I=>Tt(D,we(I,i)),W=o.filter(I=>I.id!==O?.id&&Ua(I)&&N(I)),j=o.filter(I=>Vu(I)&&N(I)),L=[],B=I=>{let C=s.get(I.id)??0,G=j.filter($=>$.id!==I.id&&(s.get($.id)??0)>C),z=Math.max(t.snapEpsilon,I.strokeWidth/2,rE),Z=Xe(I)?uE(I,i):Ce(I)?pE(I,i):Oo(I,i);if((I.type==="freedraw"||Xe(I)&&!I.polygon)&&vt(I.points)&&Z.length>0){let $=Z[0][0],V=Z[Z.length-1][1];pn($,V)>=t.snapEpsilon&&Z.push(bo(V,$))}for(let $ of Z){if(L.length>t.maxBoundarySegments)return;if(lE($)!==0){if(G.length===0){L.push({segment:$,elementId:I.id});continue}for(let[V,Y]of hE($[0],$[1],G,i,t.snapEpsilon,z))L.push({segment:bo(V,Y),elementId:I.id})}}};for(let I of O?[O,...W]:W){if(L.length>t.maxBoundarySegments)break;B(I)}return L.length>t.maxBoundarySegments?null:L},l=D=>{let O=gE(D,t);return O?EE(O,n,t):"too_complex"},d=null;if(r){let D=t.gapTolerance+2+Math.max(r.strokeWidth??1,1),O=Yu(we(r,i),D),N=a(O,r);if(!N)return{ok:!1,reason:"too_complex"};let W=l(N);if(W==="too_complex")return{ok:!1,reason:"too_complex"};if(!W)return{ok:!1,reason:"open_region"};d=W}else{let D=o.reduce((N,W)=>N+(Ua(W)?1:0),0);if(D===0)return{ok:!1,reason:"no_owner"};let O=t.fallbackSearchRadius;for(let N=0;N<4&&!d;N++,O*=2){let W=[n[0]-O,n[1]-O,n[0]+O,n[1]+O],j=o.reduce((C,G)=>C+(Ua(G)&&Tt(W,we(G,i))?1:0),0),L=N===3||j===D;if(j===0)continue;let B=a(W,null);if(!B)return{ok:!1,reason:"no_owner"};let I=l(B);if(I==="too_complex")return{ok:!1,reason:"no_owner"};if(I&&(L||I.face.ring.every(C=>C[0]>W[0]+t.gapTolerance&&C[1]>W[1]+t.gapTolerance&&C[0]<W[2]-t.gapTolerance&&C[1]<W[3]-t.gapTolerance))&&(d=I),!d&&L)break}if(!d)return{ok:!1,reason:"no_owner"}}let{face:c,holes:u}=d,h=wE(c.ring,u.map(D=>D.ring),t);if(!h)return{ok:!1,reason:"invalid_polygon"};let{scenePoints:m,splicedHoleIndices:g}=h;if(Ci(m,0)<t.minArea)return{ok:!1,reason:"too_small"};let f=new Set(c.contributors);for(let D of g)for(let O of u[D].contributors)f.add(O);let E=new Set(r?[r.id,...f]:f);for(let D of u)for(let O of D.contributors)E.add(O);let x=m,[y,b,M,w]=Eo(m),v=D=>{let[O,N,W,j]=we(D,i);if(W<y||O>M||j<b||N>w)return!1;let L=[Wo((O+W)/2,(N+j)/2)];if(le(D)||Ce(D)){let B=fe(D,i),I=Math.max(1,Math.floor(D.points.length/8));for(let C=0;C<D.points.length;C+=I)L.push(Xr(Wo(D.x+D.points[C][0],D.y+D.points[C][1]),B,D.angle))}return L.some(B=>Uu(B,x))},k=D=>{let[O,N,W,j]=we(D,i);if(W<y||O>M||j<b||N>w)return!1;if(ft(n,D,i))return!0;let L=Oo(D,i),B=Math.max(1,Math.floor(L.length/16));for(let C=0;C<L.length;C+=B)if(Uu(L[C][0],x))return!0;let I=Math.max(1,Math.floor(m.length/16));for(let C=0;C<m.length;C+=I)if(ft(m[C],D,i))return!0;return!1},T=null,A=null;for(let D of o)Vu(D)&&k(D)&&(A=D),(E.has(D.id)||Zu(D)&&v(D))&&(T=T??D);let _=A?{placement:"above",elementId:A.id}:{placement:"below",elementId:(T??o[o.length-1]).id};return{ok:!0,ownerId:r?.id??null,boundaryElementIds:[...f].filter(D=>D!==r?.id),scenePoints:m,insertion:_}},fI=e=>{let{hitElement:t,scenePoints:n,elementsMap:o}=e;if(!qu(t))return!1;let i=fe(t,o),r=t.points.map(b=>Xr(Wo(t.x+b[0],t.y+b[1]),i,t.angle)),s=Ci(r,0),a=Ci(n,0),l=Math.abs(s-a)<=.05*Math.max(s,a),[d,c,u,h]=Eo(r),[m,g,f,E]=Eo(n),x=iE,y=Math.abs(d-m)<=x&&Math.abs(c-g)<=x&&Math.abs(u-f)<=x&&Math.abs(h-E)<=x;return l&&y};S();import{arrayToMap as m2,arrayToObject as vn,assertNever as gp,isDevEnv as Jn,isShallowEqual as Ep,isTestEnv as eo,randomInteger as fp}from"@excalidraw/common";S();import{assertNever as DE,COLOR_PALETTE as BE,isDevEnv as GE,isTestEnv as NE,randomId as OE,Emitter as Ju,toIterable as jo}from"@excalidraw/common";S();import{ORIG_ID as SE,randomId as Qu,randomInteger as vE,arrayToMap as kE,castArray as Ya,findLastIndex as Uo,getUpdatedTimestamp as AE,isTestEnv as TE}from"@excalidraw/common";S();import{arrayToMap as ME}from"@excalidraw/common";var PE=e=>{let t=(i,r)=>i.groupIds[i.groupIds.length-r-1],n=(i,r)=>{let s=new Map,a=[];for(let l of i){let d=t(l,r);if(d===void 0){a.push(l);continue}let c=s.get(d);c||(c=[],s.set(d,c),a.push(d)),c.push(l)}return a.flatMap(l=>typeof l=="string"?n(s.get(l),r+1):[l])},o=n(e,0);return o.length!==e.length?(console.error("defragmentGroups: lost some elements... bailing!"),e):o},IE=e=>{let t=ME(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]},Ku=e=>IE(PE(e));var CE=(e,t,n,o)=>{let i=Za(n);return TE()&&LE(i,n.id),i.id=Qu(),i.updated=AE(),o&&(i.seed=vE(),ic(i)),i.groupIds=Gc(i.groupIds,e,r=>(t.has(r)||t.set(r,Qu()),t.get(r))),i},CI=e=>{let{elements:t}=e,n="appState"in e?e.appState:{editingGroupId:null,selectedGroupIds:{}},o=new Map,i=new Map,r=[],s=[],a=new Map,l=new Map,d=new Map,c=kE(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=Ku(t);let m=t.slice(),g=x=>{let b=Ya(x).reduce((M,w)=>{if(o.has(w.id))return M;o.set(w.id,!0),rt(w)||console.error("[NONDELETED][INVARIANT] Element to duplicate should be non-deleted");let v=CE(n.editingGroupId,i,w,e.randomizeSeed);return o.set(v.id,!0),d.set(v.id,v),a.set(w.id,v.id),l.set(v.id,w),s.push(w),r.push(v),M.push(v),M},[]);return Array.isArray(x)?b:b[0]||null},f=(x,y)=>{if(y){if(x>m.length-1){m.push(...Ya(y));return}m.splice(x+1,0,...Ya(y))}},E=new Set(t.filter(x=>u.has(x.id)&&ce(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 b=lt(t,y).flatMap(w=>ce(w)&&!h?[...Vn(t,w.id),w]:[w]),M=Uo(m,w=>w.groupIds?.includes(y));f(M,g(b));continue}if(!(!h&&x.frameId&&E.has(x.frameId))){if(ce(x)){let b=x.id;if(h){f(Uo(m,v=>v.id===b),g(x));continue}let M=Vn(t,b),w=Uo(m,v=>v.frameId===b||v.id===b);f(w,g([...M,x]));continue}if(tn(x)){let b=he(x,c),M=Uo(m,w=>w.id===x.id||"containerId"in w&&w.containerId===x.id);b?f(M,g([x,b])):f(M,g(x));continue}if(Ne(x)){let b=et(x,c),M=Uo(m,w=>w.id===x.id||w.id===b?.id);b?f(M,g([b,x])):f(M,g(x));continue}f(Uo(m,b=>b.id===x.id),g(x))}}if(fc(r,a,d),Mc(m,s,a),e.overrides)for(let x of r){let y=l.get(x.id);y&&Object.assign(x,e.overrides({duplicateElement:x,origElement:y,origIdToDuplicateId:a}))}return{duplicatedElements:r,duplicateElementsMap:d,elementsWithDuplicates:m,origIdToDuplicateId:a}},$a=(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]=$a(e[i],t+1)}return o}if(Array.isArray(e)){let o=e.length,i=new Array(o);for(;o--;)i[o]=$a(e[o],t+1);return i}return F.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Za=e=>$a(e),LE=(e,t)=>{Object.defineProperty(e,SE,{value:t,writable:!1,enumerable:!1})};var Pt={IMMEDIATELY:"IMMEDIATELY",NEVER:"NEVER",EVENTUALLY:"EVENTUALLY"},ep=class{constructor(t){this.app=t}onDurableIncrementEmitter=new Ju;onStoreIncrementEmitter=new Ju;scheduledMacroActions=new Set;scheduledMicroActions=[];_snapshot=Qn.empty();get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}scheduleAction(t){this.scheduledMacroActions.add(t),this.satisfiesScheduledActionsInvariant()}scheduleCapture(){this.scheduleAction(Pt.IMMEDIATELY)}scheduleMicroAction(t){let{action:n}=t,o;if("change"in t)o=t.change;else{let r=Qn.create(this.app.scene.getElementsMapIncludingDeleted(),this.app.state),s=r.maybeClone(n,t.elements?bc(t.elements):void 0,t.appState);o=Di.create(r,s)}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=Qn.empty(),this.scheduledMacroActions=new Set}emitDurableIncrement(t,n=void 0,o=void 0){let i=this.snapshot,r,s;if(n?r=n:r=Di.create(i,t),o?s=o:s=Qa.calculate(i,t),!s.isEmpty()){let a=new qa(r,s);this.onDurableIncrementEmitter.trigger(a),this.onStoreIncrementEmitter.trigger(a)}}emitEphemeralIncrement(t,n=void 0){let o;if(n)o=n;else{let r=this.snapshot;o=Di.create(r,t)}let i=new Ka(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===Pt.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 Pt.IMMEDIATELY:this.emitDurableIncrement(o,i,r);break;case Pt.NEVER:case Pt.EVENTUALLY:this.emitEphemeralIncrement(o,i);break;default:DE(n,"Unknown store action")}}finally{switch(n){case Pt.IMMEDIATELY:case Pt.NEVER:this.snapshot=o;break}}}getScheduledMacroAction(){let t;return this.scheduledMacroActions.has(Pt.IMMEDIATELY)?t=Pt.IMMEDIATELY:this.scheduledMacroActions.has(Pt.NEVER)?t=Pt.NEVER:t=Pt.EVENTUALLY,t}satisfiesScheduledActionsInvariant(){if(!(this.scheduledMacroActions.size>=0&&this.scheduledMacroActions.size<=Object.keys(Pt).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()),NE()||GE())throw new Error(t)}}},Di=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)}},Yr=class{constructor(t,n){this.type=t;this.change=n}static isDurable(t){return t.type==="durable"}static isEphemeral(t){return t.type==="ephemeral"}},qa=class extends Yr{constructor(n,o){super("durable",n);this.change=n;this.delta=o}},Ka=class extends Yr{constructor(n){super("ephemeral",n);this.change=n}},Qa=class e{constructor(t,n,o){this.id=t;this.elements=n;this.appState=o}static create(t,n,o={id:OE()}){return new this(o.id,t,n)}static calculate(t,n){let o=n.metadata.didElementsChange?Kn.calculate(t.elements,n.elements):Kn.empty(),i=n.metadata.didAppStateChange?qn.calculate(t.appState,n.appState):qn.empty();return this.create(o,i)}static restore(t){let{id:n,elements:o,appState:i}=t;return new this(n,Kn.restore(o),qn.restore(i))}static load({id:t,elements:{added:n,removed:o,updated:i},appState:{delta:r}}){let s=Kn.create(n,o,i),a=qn.create(r);return new this(t,s,a)}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,s]=t.elements.applyTo(n,Qn.empty().elements,i),[a,l]=t.appState.applyTo(o,r);return[r,a,s||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(Kn.empty(),qn.empty())}isEmpty(){return this.elements.isEmpty()&&this.appState.isEmpty()}},Qn=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,tp(n)?n:Vo(n),o)}static empty(){return new e(new Map,RE(),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}getChangedElements(t){let n={};for(let o of jo(t.elements))this.elements.get(o.id)||(n[o.id]=at(o,{isDeleted:!0}));for(let o of jo(this.elements))t.elements.get(o.id)!==o&&(n[o.id]=o);return n}getChangedAppState(t){return oe.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===Pt.EVENTUALLY&&(i.shouldCompareHashes=!0);let r=this.maybeCreateElementsSnapshot(n,i),s=this.maybeCreateAppStateSnapshot(o,i),a=!1,l=!1;return this.elements!==r&&(a=!0),this.appState!==s&&(l=!0),!a&&!l?this:new e(r,s,{didElementsChange:a,didAppStateChange:l})}maybeCreateAppStateSnapshot(t,n={shouldCompareHashes:!1}){if(!t)return this.appState;let o=tp(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=oe.isRightDifferent(this.appState,t);if(!o)return;let i=ip(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 jo(this.elements))t.get(r.id)||o.set(r.id,at(r,{isDeleted:!0}));for(let r of jo(t)){let s=this.elements.get(r.id);if(!s||s.version<r.version){if(Ve(r)&&!Wt(r))continue;o.set(r.id,r)}}if(!o.size)return;let i=op(o);if(!(n.shouldCompareHashes&&this._lastChangedElementsHash===i))return this._lastChangedElementsHash=i,o}createElementsSnapshot(t){let n=new Map;for(let o of jo(this.elements))n.set(o.id,o);for(let o of jo(t))n.set(o.id,Za(o));return n}},np="__observedAppState",RE=()=>({name:null,editingGroupId:null,viewBackgroundColor:BE.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,np,{value:!0,enumerable:!1}),t},tp=e=>!!Reflect.get(e,np);S();var mp=Bi(dp(),1);import{randomInteger as t2,arrayToMap as n2,toBrandedType as cp,isDevEnv as up,isTestEnv as pp,toArray as o2}from"@excalidraw/common";import{isNonDeletedElement as i2}from"@excalidraw/element";import{isFrameLikeElement as r2}from"@excalidraw/element";import{getElementsInGroup as s2}from"@excalidraw/element";import{syncInvalidIndices as a2,syncMovedIndices as l2,validateFractionalIndices as d2}from"@excalidraw/element";import{getSelectedElements as c2}from"@excalidraw/element";import{mutateElement as u2}from"@excalidraw/element";var hp=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}},p2=(0,mp.default)(e=>{(up()||pp()||window?.DEBUG_FRACTIONAL_INDICES)&&d2(e,{shouldThrow:up()||pp(),includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1}),h2=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let o of t)n+=`${o}:${e[o]?"1":"0"}`;return n},Xo=class{callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=cp(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=cp(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=h2(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=c2(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&&i2(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=o2(t),i=[];n?.skipValidation||p2(o),this.elements=a2(o),this.elementsMap.clear(),this.elements.forEach(s=>{r2(s)&&i.push(s),this.elementsMap.set(s.id,s)});let r=hp(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=i,this.nonDeletedFramesLikes=hp(this.frames).elements,this.triggerUpdate()}triggerUpdate(){this.sceneNonce=t2();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)];l2(o,n2(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]:s2(n,t)};mutateElement(t,n,o={informMutation:!0,isDragging:!1}){let i=this.getNonDeletedElementsMap(),{version:r}=t,{version:s}=u2(t,i,n,o);return this.elementsMap.has(t.id)&&r!==s&&o.informMutation&&this.triggerUpdate(),t}};var oe=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,s=o&&i!=="deleted"?o(n,"inserted"):n;return new e(r,s)}static calculate(t,n,o,i){if(t===n)return e.empty();let r={},s={};for(let d of this.getDifferences(t,n))r[d]=t[d],s[d]=n[d];let[a,l]=i?i(r,s):[r,s];return e.create(a,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(vn(t??[],i),vn(n??[],i),vn(o??[],i)))}static diffObjects(t,n,o,i){if(!t[o]&&!n[o])return;let r=t[o]!==null&&typeof t[o]=="object",s=n[o]!==null&&typeof n[o]=="object";if(r||s){let a=t[o]??{},l=n[o]??{},d=e.getLeftDifferences(a,l).reduce((u,h)=>(u[h]=i(a[h]),u),{}),c=e.getRightDifferences(a,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]:[],s=Array.isArray(n[o])?n[o]:[],a=vn(e.getLeftDifferences(vn(r,i),vn(s,i)),d=>d),l=vn(e.getRightDifferences(vn(r,i),vn(s,i)),d=>d);if(Object.keys(a).length||Object.keys(l).length){let d=r.filter(u=>a[i?i(u):String(u)]),c=s.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(s=>s in o):t==="full"?r=Array.from(new Set([...Object.keys(n),...Object.keys(o)])):gp(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let s of r){let a=n[s],l=o[s];if(a!==l){if(!i&&typeof a=="object"&&typeof l=="object"&&a!==null&&l!==null&&Ep(a,l))continue;yield s}}}},qn=class e{constructor(t){this.delta=t}static create(t){return new e(t)}static calculate(t,n){let o=oe.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(oe.create({},{}))}inverse(){let t=oe.create(this.delta.inserted,this.delta.deleted);return new e(t)}squash(t){if(t.isEmpty())return this;let n=oe.mergeObjects(this.delta.deleted.selectedElementIds??{},t.delta.deleted.selectedElementIds??{}),o=oe.mergeObjects(this.delta.inserted.selectedElementIds??{},t.delta.inserted.selectedElementIds??{}),i=oe.mergeObjects(this.delta.deleted.selectedGroupIds??{},t.delta.deleted.selectedGroupIds??{}),r=oe.mergeObjects(this.delta.inserted.selectedGroupIds??{},t.delta.inserted.selectedGroupIds??{}),s=oe.mergeObjects(this.delta.deleted.lockedMultiSelections??{},t.delta.deleted.lockedMultiSelections??{}),a=oe.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(s).length||Object.keys(a).length)&&(d.lockedMultiSelections=s,l.lockedMultiSelections=a),this.delta=oe.merge(this.delta,t.delta,oe.create(d,l)),this}applyTo(t,n){try{let{selectedElementIds:o={},selectedGroupIds:i={},lockedMultiSelections:r={}}=this.delta.deleted,{selectedElementIds:s={},selectedGroupIds:a={},lockedMultiSelections:l={},selectedLinearElement:d,...c}=this.delta.inserted,u=oe.mergeObjects(t.selectedElementIds,s,o),h=oe.mergeObjects(t.selectedGroupIds,a,i),m=oe.mergeObjects(t.lockedMultiSelections,l,r),g=d&&n.has(d.elementId)?new U(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),eo()||Jn())throw o;return[t,!1]}}isEmpty(){return oe.isEmpty(this.delta)}filterInvisibleChanges(t,n,o){let i=Vo(t),r=Vo(n),s=oe.isRightDifferent(e.stripElementsProps(i),e.stripElementsProps(r)),a=oe.isRightDifferent(e.stripStandaloneProps(i),e.stripStandaloneProps(r));if(!s&&!a)return!1;let l={value:s};if(a){let d=oe.getRightDifferences(e.stripStandaloneProps(i),e.stripStandaloneProps(r)),c=new Set;(d.includes("editingGroupId")||d.includes("selectedGroupIds"))&&(c=Lc(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 b=o.get(y);b&&!b.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]||{};Ep(g,f)||(l.value=!0);break;case"activeLockedId":let E=t[u]||null,x=n[u]||null;E!==x&&(l.value=!0);break;default:gp(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 s of i){let a=n.get(s);a&&!a.isDeleted?o.value=!0:delete r[s]}return r}static filterSelectedGroups(t,n,o){if(!Object.keys(t).length)return o.value=!0,t;let r={...t};for(let s of Object.keys(r))n.has(s)?o.value=!0:delete r[s];return r}static stripElementsProps(t){let{editingGroupId:n,selectedGroupIds:o,selectedElementIds:i,selectedLinearElement:r,croppingElementId:s,lockedMultiSelections:a,activeLockedId:l,...d}=t;return d}static stripStandaloneProps(t){let{name:n,viewBackgroundColor:o,...i}=t;return i}static postProcess(t,n){try{oe.diffObjects(t,n,"selectedElementIds",o=>!0),oe.diffObjects(t,n,"selectedGroupIds",o=>o??!1),oe.diffObjects(t,n,"lockedMultiSelections",o=>o??{})}catch(o){if(console.error("Couldn't postprocess appstate change deltas."),eo()||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}},Kn=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 s={},a={},l={},d=[...Object.entries(t),...Object.entries(n),...Object.entries(o)];for(let[c,u]of d)this.satisfiesAddition(u)?s[c]=u:this.satisfiesRemoval(u)?a[c]=u:l[c]=u;r=new e(s,a,l)}else r=new e(t,n,o);return(eo()||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 s of t.values())if(!n.get(s.id)){let l={...s},d={isDeleted:!0,version:s.version+1,versionNonce:fp()},c=oe.create(l,d,e.stripIrrelevantProps);s.isDeleted?r[s.id]=c:i[s.id]=c}for(let s of n.values()){let a=t.get(s.id);if(!a){let l={isDeleted:!0,version:s.version-1,versionNonce:fp()},d={...s},c=oe.create(l,d,e.stripIrrelevantProps);s.isDeleted?r[s.id]=c:o[s.id]=c;continue}if(a.versionNonce!==s.versionNonce){let l=oe.calculate(a,s,e.stripIrrelevantProps,e.postProcess);if(typeof a.isDeleted=="boolean"&&typeof s.isDeleted=="boolean"&&a.isDeleted!==s.isDeleted){a.isDeleted&&!s.isDeleted?o[s.id]=l:i[s.id]=l;continue}r[s.id]=l}}return e.create(o,i,r)}static empty(){return e.create({},{},{})}inverse(){let t=r=>{let s={};for(let[a,{inserted:l,deleted:d}]of Object.entries(r))s[a]=oe.create({...l},{...d});return s},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=oe.create(h.deleted,h.inserted,i(m,g),o):f=h,oe.isInnerDifferent(f.deleted,f.inserted)&&(c[u]=f)}return c},s=r(this.added),a=r(this.removed),l=r(this.updated);return e.create(s,a,l,{shouldRedistribute:!0})}applyTo(t,n=Qn.empty().elements,o){let i=new Map(t),r,s={containsVisibleDifference:!1,containsZindexDifference:!1,applyDirection:void 0};try{let a=e.createApplier(t,i,n,s,o),l=a(this.added),d=a(this.removed),c=a(this.updated),u=this.resolveConflicts(t,i,s.applyDirection);r=new Map([...l,...d,...c,...u])}catch(a){if(console.error("Couldn't apply elements delta",a),eo()||Jn())throw a;return[t,!0]}try{i=e.reorderElements(i,r,s),e.redrawElements(i,r)}catch(a){if(console.error("Couldn't mutate elements after applying elements change",a),eo()||Jn())throw a}finally{return[i,s.containsVisibleDifference]}}squash(t){if(t.isEmpty())return this;let{added:n,removed:o,updated:i}=t,r=(s,a)=>{let l=oe.mergeArrays(s.deleted.boundElements??[],a.deleted.boundElements??[],void 0,c=>c.id)??[],d=oe.mergeArrays(s.inserted.boundElements??[],a.inserted.boundElements??[],void 0,c=>c.id)??[];if(!(!l.length&&!d.length))return oe.create({boundElements:l},{boundElements:d})};for(let[s,a]of Object.entries(n)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.added[s]=a;else{let d=r(l,a);delete this.removed[s],delete this.updated[s],this.added[s]=oe.merge(l,a,d)}}for(let[s,a]of Object.entries(o)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.removed[s]=a;else{let d=r(l,a);delete this.added[s],delete this.updated[s],this.removed[s]=oe.merge(l,a,d)}}for(let[s,a]of Object.entries(i)){let l=this.added[s]??this.removed[s]??this.updated[s];if(!l)this.updated[s]=a;else{let d=r(l,a),c=oe.merge(l,a,d);l===this.added[s]?this.added[s]=c:l===this.removed[s]?this.removed[s]=c:this.updated[s]=c}}return(eo()||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)=>s=>{let a=e.createGetter(n,o,i);return Object.entries(s).reduce((l,[d,c])=>{let u=a(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 s=t.get(i);return s||(s=n.get(i),s?(o.containsZindexDifference=!0,(!r.isDeleted||r.isDeleted&&!s.isDeleted)&&(o.containsVisibleDifference=!0)):s=at({id:i,version:1},{...r})),s};static applyDelta(t,n,o,i){let r={};for(let s of Object.keys(n.inserted)){if(s==="boundElements"||i?.excludedProperties?.has(s))continue;let a=n.inserted[s];Reflect.set(r,s,a)}if(n.deleted.boundElements?.length||n.inserted.boundElements?.length){let s=oe.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,a=>a.id);Object.assign(r,{boundElements:s})}if(!o.containsVisibleDifference){let{index:s,...a}=r,l=e.checkForVisibleDifference(t,a);o.containsVisibleDifference=l}return o.containsZindexDifference||(o.containsZindexDifference=n.deleted.index!==n.inserted.index),at(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:oe.isRightDifferent(t,n)}resolveConflicts(t,n,o="forward"){let i=new Map,r=(a,l)=>{let d=n.get(a.id);if(!d)return;let c=t.get(a.id),u=o==="forward"?d.version+1:d.version-1,h=l,m;c===d?m=at(d,{...h,version:u},!0):m=$e(d,n,{...h,version:c?.version!==d.version?d.version:u}),i.set(m.id,m),n.set(m.id,m)};for(let a of Object.keys(this.removed))e.unbindAffected(t,n,a,r);for(let a of Object.keys(this.added))e.rebindAffected(t,n,a,r);for(let[a]of Array.from(Object.entries(this.updated)).filter(([l,d])=>Object.keys({...d.deleted,...d.inserted}).find(c=>gc.has(c)))){let l=n.get(a);!l||l.isDeleted||e.rebindAffected(t,n,a,r)}let s=new Map(Array.from(t).filter(([a])=>i.has(a)));return this.squash(e.calculate(s,i)),i}static unbindAffected(t,n,o,i){let r=()=>t.get(o),s=()=>n.get(o);_n.unbindAffected(n,r(),i),_n.unbindAffected(n,s(),i),zn.unbindAffected(n,r(),i),zn.unbindAffected(n,s(),i)}static rebindAffected(t,n,o,i){let r=()=>t.get(o),s=()=>n.get(o);_n.unbindAffected(n,r(),i),_n.rebindAffected(n,s(),i),zn.unbindAffected(n,r(),(a,l)=>{pe(a)&&i(a,l)}),zn.rebindAffected(n,s(),i)}static redrawElements(t,n){try{let o=new Xo(t,{skipValidation:!0});e.redrawTextBoundingBoxes(o,n),e.redrawBoundArrows(o,n)}catch(o){if(console.error("Couldn't redraw elements",o),eo()||Jn())throw o}finally{return t}}static redrawTextBoundingBoxes(t,n){let o=t.getNonDeletedElementsMap(),i=new Map;for(let r of n.values()){if(Ne(r)){let{containerId:s}=r,a=s?o.get(s):void 0;a&&i.set(a.id,{container:a,boundText:r})}if(tn(r)){let s=Vt(r),a=s?o.get(s):void 0;a&&i.set(r.id,{container:r,boundText:a})}}for(let{container:r,boundText:s}of i.values())r.isDeleted||s.isDeleted||cr(s,r,t)}static redrawBoundArrows(t,n){for(let o of n.values())!o.isDeleted&&Le(o)&&ot(o,t,{changedElements:n})}static reorderElements(t,n,o){if(!o.containsZindexDifference)return t;let i=Array.from(t.values()),r=yc([...i]),s=oe.getRightDifferences(i,r,!0).reduce((a,l)=>{let d=i[Number(l)];return d&&n.has(d.id)&&a.set(d.id,d),a},new Map);return!o.containsVisibleDifference&&s.size&&(o.containsVisibleDifference=!0),m2(po(r,s))}static postProcess(t,n){try{oe.diffArrays(t,n,"boundElements",r=>r.id);let o=t.points??[],i=n.points??[];oe.isDifferent(o,i)||(Reflect.deleteProperty(t,"points"),Reflect.deleteProperty(n,"points"))}catch(o){if(console.error("Couldn't postprocess elements delta."),eo()||Jn())throw o}finally{return[t,n]}}static stripIrrelevantProps(t){let{id:n,updated:o,...i}=t;return i}};S();var mS=(e,t,n,o,i)=>{let[r,s,a,l]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],d=it(e),c=Lr(e,t,o).map(Xn).map(g=>[g,it(g)]).sort((g,f)=>g[1][s]-f[1][s]),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][a]===d[a]),E=(c[f][1][s]-c[g][1][s])/(c.length-1),x=c[g][1][s];return c.flatMap(([y,b],M)=>{let w={x:0,y:0};return M!==g&&M!==f&&(x+=E,w[n.axis]=x-b[s]),y.map(v=>{let k=i.mutateElement(v,{x:v.x+w.x,y:v.y+w.y});return ot(v,i,{simultaneouslyUpdated:y}),k})})}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 ot(x,i,{simultaneouslyUpdated:g}),y})})};S();import{TEXT_AUTOWRAP_THRESHOLD as f2,getGridPoint as g2,getFontString as E2,DRAGGING_THRESHOLD as x2}from"@excalidraw/common";var IS=(e,t,n,o,i,r)=>{if(t.length===1&&ee(t[0])&&(t[0].startBinding||t[0].endBinding))return;let s=t.filter(h=>{if(ee(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}),a=new Set(s),l=s.filter(h=>ce(h)).map(h=>h.id);if(l.length>0)for(let h of o.getNonDeletedElements())h.frameId!==null&&l.includes(h.frameId)&&a.add(h);let d=[];for(let h of a){let m=e.originalElements.get(h.id);if(!m)return;d.push(m)}let c=y2(dt(d),n,i,r),u=new Set(Array.from(a,h=>h.id));a.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(a.size>1||Math.max(Math.abs(c.x),Math.abs(c.y))>x2||!h.startBinding&&!h.endBinding){el(e,h,o,c);let E=h.startBinding&&!g,x=h.endBinding&&!f;(E||x)&&(E&&nt(h,"start",o),x&&nt(h,"end",o))}}else{el(e,h,o,c);let E=he(h,o.getNonDeletedElementsMap());E&&el(e,E,o,c),ot(h,o,{simultaneouslyUpdated:Array.from(a)})}})},y2=(e,t,n,o)=>{let[i,r]=e,s=i+t.x+n.x,a=r+t.y+n.y;if(n.x===0||n.y===0){let[l,d]=g2(i+t.x,r+t.y,o);n.x===0&&(s=l),n.y===0&&(a=d)}return{x:s-i,y:a-r}},el=(e,t,n,o)=>{let i=e.originalElements.get(t.id)??t,r=i.x+o.x,s=i.y+o.y;n.mutateElement(t,{x:r,y:s})},SS=(e,t,n)=>{let[o,i]=dt(e);return[t-o,n-i]},b2=({newElement:e,anchorX:t,anchorRatio:n,pointerX:o,nextY:i,zoom:r,scene:s,informMutation:a=!0})=>{let l=o-t,d=n===0?l:n===1?-l:Math.abs(l),c=Math.max(n===.5?d*2:d,sr(E2({fontSize:e.fontSize,fontFamily:e.fontFamily}),e.lineHeight));s.mutateElement(e,{x:t-c*n,...i===void 0?{}:{y:i},width:c,...d>f2/r?{autoResize:!1}:{}},{informMutation:a,isDragging:!1})},vS=({newElement:e,elementType:t,originX:n,originY:o,x:i,y:r,width:s,height:a,shouldMaintainAspectRatio:l,shouldResizeFromCenter:d,zoom:c,scene:u,widthAspectRatio:h=null,originOffset:m=null,informMutation:g=!0})=>{if(l&&e.type!=="selection"&&(h?a=s/h:(Math.abs(r-o)>Math.abs(i-n)?{width:s,height:a}=_a(t,a,i<n?-s:s):{width:s,height:a}=_a(t,s,r<o?-a:a),a<0&&(a=-a))),pe(e)){b2({newElement:e,anchorX:n+(m?.x??0),anchorRatio:d?.5:i<n?1:0,pointerX:i,nextY:o+(m?.y??0),zoom:c,scene:u,informMutation:g});return}let f=i<n?n-s:n,E=r<o?o-a:o;if(d&&(s+=s,a+=a,f=n-s/2,E=o-a/2),s!==0&&a!==0){let x=null;Ve(e)&&(x={initialWidth:s,initialHeight:a}),u.mutateElement(e,{x:f+(m?.x??0),y:E+(m?.y??0),width:s,height:a,...x},{informMutation:g,isDragging:!1})}};S();import{ELEMENT_LINK_KEY as Zr,normalizeLink as xp}from"@excalidraw/common";var LS=(e,t)=>{let n=window.location.href;try{let o=new URL(n);return o.searchParams.set(Zr,e),xp(o.toString())}catch(o){console.error(o)}return xp(n)},DS=(e,t)=>{if(e.length>0&&w2(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},w2=e=>!!(e.length===1||e.length>1&&Dc(e)),BS=e=>{try{let t=new URL(e);return t.searchParams.has(Zr)&&t.host===window.location.host}catch{return!1}},GS=e=>{try{let{searchParams:t}=new URL(e);if(t.has(Zr))return t.get(Zr)}catch{}return null};S();import{FONT_FAMILY as M2,VERTICAL_ALIGN as P2,escapeDoubleQuotes as tl,getFontString as I2}from"@excalidraw/common";var Kt=new Map,S2=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)/,v2=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,k2=/^https:\/\/(?:www\.)?figma\.com/,yp=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,A2=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,T2=/^(?:https?:\/\/)?forms\.microsoft\.com\//,bp=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,C2=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,L2=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,D2=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,wp=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Mp=/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/,B2=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i,Ip=e=>{let t;try{let s=new URL(e.startsWith("http")?e:`https://${e}`);t=s.searchParams.get("t")||s.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)},G2=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"),s=Ip(t.toString());return{fileId:o,resourceKey:r&&/^[a-zA-Z0-9_-]+$/.test(r)?r:void 0,timestamp:s>0?s:void 0}}catch{return null}},ol=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"]),Pp=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"]),nl=e=>`<html><body>${e}</body></html>`,zS=e=>{if(!e)return null;if(Kt.has(e))return Kt.get(e);let t=e,n=Pp.has(il(e,Pp)||""),o="generic",i={w:560,h:840},r=e.match(S2);if(r?.[2]){let c=Ip(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},Kt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}let s=e.match(v2);if(s?.[1]){let c=s?.[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},Kt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,error:u,sandbox:{allowSameOrigin:n}}}let a=G2(e);if(a){o="video";let c=new URLSearchParams;a.resourceKey&&c.set("resourcekey",a.resourceKey),a.timestamp&&c.set("t",`${a.timestamp}`);let u=c.toString();return e=`https://drive.google.com/file/d/${a.fileId}/preview${u?`?${u}`:""}`,i={w:560,h:315},Kt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}}if(e.match(k2))return o="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,i={w:550,h:550},Kt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};let d=e.match(L2);if(d)return e=d[1]==="embed"?d[0]:d[0].replace("/v","/embed"),Kt.set(t,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}};if(T2.test(e)&&!e.includes("embed=true")&&(e+=e.includes("?")?"&embed=true":"?embed=true"),bp.test(e)){let c=e.match(bp)[1],u=tl(`https://twitter.com/x/status/${c}`),h={type:"document",srcdoc:m=>nl(`<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 Kt.set(t,h),h}if(Mp.test(e)){let[,c,u,h]=e.match(Mp),m=tl(`https://reddit.com/r/${c}/comments/${u}/${h}`),g={type:"document",srcdoc:f=>nl(`<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 Kt.set(t,g),g}if(yp.test(e)){let[,c,u]=e.match(yp),h=tl(`https://gist.github.com/${c}/${u}`),m={type:"document",srcdoc:()=>nl(`
|
|
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 Zt.set(e,h),h}return Zt.set(e,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}},_I=e=>{let t;qi(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=RE.Helvetica,i=HE({fontSize:n,fontFamily:o});return xo({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:En(t,i,e.width-20),textAlign:"center",verticalAlign:FE.MIDDLE,angle:e.angle??0})},$a=(e,t)=>{try{let{hostname:n}=new URL(e),o=n.replace(/^www\./,"");if(t instanceof Set){if(Xa.has(o))return o;let r=o.replace(/^([^.]+)/,"*");return Xa.has(r)?r:null}let i=t.replace(/^www\./,"");if(o===i)return i}catch{}return null},WI=e=>{let t=e.match(UE);if(t&&t.length===2)return t[1];let n=e.match($E);if(n&&n.length===2)return n[1];let o=e.match(jE);if(o&&o.length===2)return o[1];if(lp.test(e))return`https://giphy.com/embed/${lp.exec(e)[1]}`;let i=e.match(XE);return i&&i.length===2?i[1]:e},jI=(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($a(e,n))return!0;return!1}}return!!$a(e,Xa)};S();import{invariant as Za,toBrandedType as qE}from"@excalidraw/common";import{clamp as KE,pointFrom as pp}from"@excalidraw/math";var mp=100,hp=100,QE=e=>{let t=[...e].sort((o,i)=>o.start-i.start),n=[];for(let o of t){let i=n[n.length-1];i&&o.start<=i.end?i.end=Math.max(i.end,o.end):n.push({...o})}return n},Ep=(e,t,n)=>n.every(o=>e+t<=o.start||e>=o.end),JE=(e,t,n)=>{if(Ep(e,t,n))return e;let o=[-1/0,...n.map(a=>a.end)],i=[...n.map(a=>a.start),1/0],r=e,s=1/0;for(let a=0;a<o.length;a++){if(i[a]-o[a]<t)continue;let l=KE(e,o[a],i[a]-t),d=Math.abs(l-e);d<=s&&(r=l,s=d)}return r},e2=(e,t)=>{let n=[...t.values()].filter(ee),o=new Set([e.id]),i=[e.id],r=[];for(;i.length>0;){let s=i.shift();for(let a of n){let l=a.startBinding?.elementId,d=a.endBinding?.elementId,c;if(l===s?c=d:d===s&&(c=l),!c||o.has(c))continue;o.add(c);let u=t.get(c);u&&De(u)&&(r.push(u),i.push(c))}}return r},t2=(e,t,n,o,i)=>{let r=t==="left"||t==="right",s=r?e.width:e.height,a=r?e.height:e.width,l=r?hp:mp,d=r?mp:hp,c=r?e.x:e.y,u=r?e.y+e.height/2:e.x+e.width/2,m=t==="right"||t==="down"?c+s+l:c-l-s,h=QE(o.filter(b=>{let M=r?b[0]:b[1],w=r?b[2]:b[3];return M<m+s&&w>m}).map(b=>({start:(r?b[1]:b[0])-d,end:(r?b[3]:b[2])+d}))),g=a+d,f=n*a+(n-1)*d,x=(i===null?null:[i,i-g].filter(b=>Ep(b,f,h)).sort((b,M)=>Math.abs(b+f/2-u)-Math.abs(M+f/2-u))[0]??null)??JE(u-f/2,f,h);return{positions:Array.from({length:n},(b,M)=>{let w=x+M*g;return r?{x:m,y:w}:{x:w,y:m}}),crossStart:x}},n2=(e,t,n)=>{let o=Ho({type:e.type,x:t,y:n,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});return Za(id(o),"not an ExcalidrawFlowchartNodeElement"),o},o2=(e,t,n,o,i,r=null)=>{let s=o.getNonDeletedElementsMap(),a=e2(e,s).map(u=>bt(u,s)),{positions:l,crossStart:d}=t2(e,n,i,a,r),c=[];for(let u of l){let m=n2(e,u.x,u.y),h=i2(e,m,n,t,o);c.push(m,h)}return{nodes:c,crossStart:d}},i2=(e,t,n,o,i)=>{let r,s;switch(n){case"up":{r=e.x+e.width/2,s=e.y-6;break}case"down":{r=e.x+e.width/2,s=e.y+e.height+6;break}case"right":{r=e.x+e.width+6,s=e.y+e.height/2;break}case"left":{r=e.x-6,s=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-s+6;break}case"down":{l=t.x+t.width/2-r,d=t.y-s-6;break}case"right":{l=t.x-r-6,d=t.y-s+t.height/2;break}case"left":{l=t.x+t.width-r+6,d=t.y-s+t.height/2;break}}let c=Hr({type:"arrow",x:r,y:s,startArrowhead:null,endArrowhead:o.currentItemEndArrowhead,strokeColor:e.strokeColor,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,opacity:e.opacity,roughness:e.roughness,points:[pp(0,0),pp(l,d)],elbowed:!0}),u=i.getNonDeletedElementsMap();ln(c,e,"orbit","start",i),ln(c,t,"orbit","end",i);let m=new Map;m.set(e.id,e),m.set(t.id,t),m.set(c.id,c),W.movePoints(c,i,new Map([[1,{point:c.points[1]}]]));let h=Do(c,qE(new Map([...u.entries(),[e.id,e],[t.id,t],[c.id,c]])),{points:c.points});return{...c,...h,isDeleted:c.isDeleted}},fp=class e{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(!De(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=[...e.getSuccessors(t,n,o),...e.getPredecessors(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 s=["up","right","down","left"].filter(a=>a!==o).map(a=>[...e.getSuccessors(t,n,a),...e.getPredecessors(t,n,a)]).flat().filter(a=>!this.visitedNodes.has(a.id));for(let a of s)if(!this.visitedNodes.has(a.id))return this.visitedNodes.add(a.id),this.isExploring=!0,this.direction=o,a.id}return null}static getNodeRelatives(t,n,o,i){let r=[...o.values()].reduce((s,a)=>{let l;if(ee(a)&&(l=a[t==="predecessors"?"startBinding":"endBinding"])&&a[t==="predecessors"?"endBinding":"startBinding"]?.elementId===n.id){let d=o.get(l.elementId);if(!d)return s;Za(De(d),"not an ExcalidrawBindableElement");let c=t==="predecessors"?a.points[a.points.length-1]:[0,0],u=ko(n,bt(n,o),[c[0]+a.x,c[1]+a.y]);s.push({relative:d,heading:u})}return s},[]);switch(i){case"up":return r.filter(s=>Pe(s.heading,st)).map(s=>s.relative);case"down":return r.filter(s=>Pe(s.heading,We)).map(s=>s.relative);case"right":return r.filter(s=>Pe(s.heading,Se)).map(s=>s.relative);case"left":return r.filter(s=>Pe(s.heading,Xe)).map(s=>s.relative)}}static getSuccessors(t,n,o){return e.getNodeRelatives("successors",t,n,o)}static getPredecessors(t,n,o){return e.getNodeRelatives("predecessors",t,n,o)}},gp=class{isCreatingChart=!1;numberOfNodes=0;direction=null;clusterCrossStart=null;pendingNodes=null;createNodes(t,n,o,i){let r=i.getNonDeletedElementsMap();o!==this.direction?(this.numberOfNodes=1,this.clusterCrossStart=null):this.numberOfNodes+=1;let{nodes:s,crossStart:a}=o2(t,n,o,i,this.numberOfNodes,this.clusterCrossStart);if(this.isCreatingChart=!0,this.direction=o,this.clusterCrossStart=a,this.pendingNodes=s,t.frameId){let l=r.get(t.frameId);Za(l&&Qi(l),"not an ExcalidrawFrameElement"),l&&this.pendingNodes.every(d=>jn([d],l,r)||_n(d,l,r))&&(this.pendingNodes=this.pendingNodes.map(d=>$e(d,r,{frameId:t.frameId})))}}clear(){this.isCreatingChart=!1,this.pendingNodes=null,this.direction=null,this.numberOfNodes=0,this.clusterCrossStart=null}},oS=(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};S();import{pointDistance as Yo,pointFrom as qa}from"@excalidraw/math";import{invariant as xp}from"@excalidraw/common";var Xr=(e,t,n,o,i,r,s=!1)=>{if(ee(t)||!an(i)||t.points.length!==2)return!1;if(!s){let l=t.startBinding?.elementId===n.id?0:t.points.length-1,d=W.getPointAtIndexGlobalCoordinates(t,l,o);if(Yo(e,d)<xi*1.5/i.zoom.value)return!1}let a=W.getPointAtIndexGlobalCoordinates(t,r==="end"?t.points.length-1:0,o);return Yo(e,a)>=xi*1.5/i.zoom.value&&en({element:n,elementsMap:o,point:e,threshold:_e(n,t),overrideShouldTestInside:!0})},r2=(e,t,n,o,i,r,s)=>{let a=new Map,l=r.selectedLinearElement?.initialState.arrowOtherEndpointInitialBinding,d=n?"startBinding":"endBinding",c=n?"endBinding":"startBinding",u=e[d],m=l?.mode==="orbit"&&e[c]?.mode==="inside"?l:e[c];if(u&&t){let h=t&&m&&u.elementId===m.elementId;s||h?u={...u,mode:"inside"}:u={...u,mode:"orbit"};let g=n?0:e.points.length-1,f=Yt(e,d,u,t,o,!0);f&&a.set(g,{point:f})}if(m&&m.mode==="orbit"){let h=o.get(m.elementId);if(h&&De(h)&&an(r)){t&&m.elementId===t.id?m={...m,mode:"inside"}:m={...m,mode:"orbit"};let f=n?e.points.length-1:0,E=Yt(e,c,m,h,o);E&&a.set(f,{point:E})}}a.size>0&&W.movePoints(e,i,a,{[d]:u,[c]:m})},yp=(e,t,n,o,i,r,s)=>{let a=W.getElement(e.elementId,t);if(!a||!Ke(a)||ee(a)||!e.hoveredFocusPointBinding||!e.draggedFocusPointBinding)return;let l=e.draggedFocusPointBinding==="start",d=l?a.startBinding:a.endBinding,{x:c,y:u}=e.pointerOffset,m=qa(n.x-c,n.y-u),h=l?"startBinding":"endBinding",g=Nd(m,a,o.getNonDeletedElements(),t,Wt(i.zoom));if(g&&an(i)){a[h]&&g.id!==d?.elementId&&nt(a,e.draggedFocusPointBinding,o);let f=s&&a[h]?.mode==="orbit"?"inside":!s&&a[h]?.mode==="inside"?"orbit":null;(!a[h]||f)&&ln(a,g,f||"orbit",e.draggedFocusPointBinding,o,m),o.mutateElement(a,{[h]:{...a[h],elementId:g.id,mode:f||a[h]?.mode||"orbit",...Go(a,g,e.draggedFocusPointBinding,t,m)}})}else{let f=new Map,E=l?0:a.points.length-1;f.set(E,{point:W.createPointAt(a,t,m[0],m[1],r)}),W.movePoints(a,o,f),a[h]&&nt(a,l?"start":"end",o)}r2(a,g,l,t,o,i,s),g&&an(i)&&yi(m,a,o.getElementsIncludingDeleted(),t,o,g)},mS=(e,t,n,o)=>{let i=qa(t.origin.x,t.origin.y),r=xi*1.5/o.zoom.value;if(e.startBinding?.elementId){let s=n.get(e.startBinding.elementId);if(s&&De(s)&&!s.isDeleted){let a=Qe(e.startBinding.fixedPoint,s,n);if(Xr(a,e,s,n,o,"start")&&Yo(i,a)<=r)return{hitFocusPoint:"start",pointerOffset:{x:i[0]-a[0],y:i[1]-a[1]},arrowOtherEndpointInitialBinding:e.endBinding}}}if(e.endBinding?.elementId){let s=n.get(e.endBinding.elementId);if(s&&De(s)&&!s.isDeleted){let a=Qe(e.endBinding.fixedPoint,s,n);if(Xr(a,e,s,n,o,"end")&&Yo(i,a)<=r)return{hitFocusPoint:"end",pointerOffset:{x:i[0]-a[0],y:i[1]-a[1]},arrowOtherEndpointInitialBinding:e.startBinding}}}return{hitFocusPoint:null,pointerOffset:{x:0,y:0},arrowOtherEndpointInitialBinding:null}},hS=(e,t)=>{xp(e.draggedFocusPointBinding,"Must have a dragged focus point at pointer release");let n=W.getElement(e.elementId,t.getNonDeletedElementsMap());xp(n,"Arrow must be in the scene");let o=e.draggedFocusPointBinding==="start"?"startBinding":"endBinding",i=e.draggedFocusPointBinding==="start"?"endBinding":"startBinding",r=n[o]?.elementId,s=n[i]?.elementId,a=r&&t.getNonDeletedElements().find(d=>d.id!==r&&d.id!==s&&De(d)&&d.boundElements?.find(({id:c})=>c===n.id));a&&t.mutateElement(a,{boundElements:a.boundElements?.filter(({id:d})=>d!==n.id)});let l=r&&t.getNonDeletedElementsMap().get(r);return l&&t.mutateElement(l,{boundElements:[...(l.boundElements||[])?.filter(({id:d})=>d!==n.id),{id:n.id,type:"arrow"}]}),{arrowOtherEndpointInitialBinding:null}},fS=(e,t,n,o,i)=>{let r=o.getNonDeletedElementsMap(),s=qa(t,n),a=xi*1.5/i.zoom.value;if(e.startBinding?.elementId){let l=r.get(e.startBinding.elementId);if(l&&De(l)&&!l.isDeleted){let d=Qe(e.startBinding.fixedPoint,l,r);if(Xr(d,e,l,r,i,"start")&&Yo(s,d)<=a)return"start"}}if(e.endBinding?.elementId){let l=r.get(e.endBinding.elementId);if(l&&De(l)&&!l.isDeleted){let d=Qe(e.endBinding.fixedPoint,l,r);if(Xr(d,e,l,r,i,"end")&&Yo(s,d)<=a)return"end"}}return null};S();var s2=e=>({x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}),bp=(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}},a2=(e,t,n)=>n==="first"?bp(e,t[0].boundingBox):t.reduce((i,r)=>i+bp(e,r.boundingBox),0)/t.length,l2=(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)}},bS=(e,t,n,o="average",i="size")=>{let s=Ar(t,n).map(d=>({group:d,boundingBox:it(d)}));if(s.length===0)return t;let a=a2(i,s,o),l=[];return s.forEach(d=>{let c=l2(i,a,d.boundingBox);if(!Number.isFinite(c)||c<=0)return;let u=s2(d.boundingBox);d.group.forEach(m=>{let h={x:m.x+m.width/2,y:m.y+m.height/2},g={x:u.x+(h.x-u.x)*c,y:u.y+(h.y-u.y)*c},f=m.width*c,E=m.height*c;e.mutateElement(m,{x:g.x-f/2,y:g.y-E/2,width:f,height:E}),l.push(m)})}),l};S();var SS=(e,t,n,o=50)=>{if(!e||e.length===0)return[];let i=[],r=Array.isArray(e[0])?e:e.map(h=>[h]),s=r.length,a=Math.max(1,Math.ceil(Math.sqrt(s))),l=[];for(let h=0;h<s;h+=a)l.push(r.slice(h,h+a));let d=0,c=l.map(h=>{let g=0,f=0,E=h.map(x=>{let[y,b,M,w]=dt(x);return{elements:x,bounds:[y,b,M,w],width:M-y,height:w-b}});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,m=n-u/2;return c.forEach(h=>{let{unitBounds:g,width:f,maxHeight:E}=h,x=t-f/2;g.forEach(y=>{let[b,M]=y.bounds,w=x-b,v=m-M;y.elements.forEach(A=>{i.push(at(A,{x:A.x+w,y:A.y+v}))}),x+=y.width+o}),m+=E+o}),i};S();import{pointCenter as d2,normalizeRadians as Zr,pointFrom as Me,pointRotateRads as qt}from"@excalidraw/math";import{MIN_FONT_SIZE as Qa,SHIFT_LOCKING_ANGLE as qr,rescalePoints as wp,getFontString as $r}from"@excalidraw/common";var FS=(e,t,n,o,i,r,s,a,l,d,c)=>{let u=o.getNonDeletedElementsMap();if(n.length===1){let[m]=n;if(t==="rotation")ee(m)||(c2(m,o,a,l,i),ot(m,o));else if(t){let h=n[0].id,g=u.get(h),f=e.get(h);if(g&&f){let{nextWidth:E,nextHeight:x}=f2(g,f,t,a,l,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r});h2(E,x,g,f,e,o,t,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r})}}return ue(m)&&ot(m,o),!0}else if(n.length>1){if(t==="rotation")return p2(e,n,o,a,l,i,d,c),!0;if(t){let{nextWidth:m,nextHeight:h,flipByX:g,flipByY:f,originalBoundingBox:E}=g2(n,e,u,t,a,l,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r});return E2(n,u,t,o,e,{shouldResizeFromCenter:r,shouldMaintainAspectRatio:s,flipByX:g,flipByY:f,nextWidth:m,nextHeight:h,originalBoundingBox:E}),!0}}return!1},c2=(e,t,n,o,i)=>{let[r,s,a,l]=ae(e,t.getNonDeletedElementsMap()),d=(r+a)/2,c=(s+l)/2,u;ce(e)?u=0:(u=5*Math.PI/2+Math.atan2(o-c,n-d),i&&(u=u+qr/2,u=u-u%qr),u=Zr(u));let m=Vt(e),h={angle:u};if(Ke(e)&&(h={...h},e.startBinding&&nt(e,"start",t),e.endBinding&&nt(e,"end",t)),t.mutateElement(e,h),m){let g=t.getElement(m);if(g&&!J(e)){let{x:f,y:E}=pi(e,g,t.getNonDeletedElementsMap());t.mutateElement(g,{angle:u,x:f,y:E})}}},Mp=(e,t,n,o)=>le(e)||Le(e)?{points:wp(0,t,wp(1,n,e.points,o),o)}:{},Ja=(e,t,n)=>{let o=e.width;if(Ne(e)){let s=et(e,t);s&&(o=jt(s,e))}let r=e.fontSize*(n/o);return r<Qa?null:{size:r}},u2=(e,t,n,o,i,r,s)=>{let a=n.getNonDeletedElementsMap(),l=t.width*(s/t.height),d=Ja(t,a,l);if(d!==null){if(o.includes("n")||o.includes("s")){let c=Me(e.x,e.y),u=Ka(c,e.width,e.height,l,s,e.angle,o,!1,i);n.mutateElement(t,{fontSize:d.size,width:l,height:s,x:u.x,y:u.y});return}if(o==="e"||o==="w"){let c=or($r({fontSize:t.fontSize,fontFamily:t.fontFamily}),t.lineHeight),u=Math.max(c,r),m=En(t.originalText,$r(t),Math.abs(u)),h=At(m,$r(t),t.lineHeight),g=h.height,f=Me(e.x,e.y),E=Ka(f,e.width,e.height,u,g,t.angle,o,!1,i),x={width:Math.abs(u),height:Math.abs(h.height),x:E.x,y:E.y,text:m,autoResize:!1};n.mutateElement(t,x)}}},p2=(e,t,n,o,i,r,s,a)=>{let l=n.getNonDeletedElementsMap(),d=5*Math.PI/2+Math.atan2(i-a,o-s);r&&(d+=qr/2,d-=d%qr);let c=new Map(t.map(u=>[u.id,u]));for(let u of t)if(!ce(u)){let[m,h,g,f]=ae(u,l),E=(m+g)/2,x=(h+f)/2,y=e.get(u.id)?.angle??u.angle,[b,M]=qt(Me(E,x),Me(s,a),d+y-u.angle),w=ee(u)?{points:ac(u,l)}:{x:u.x+(b-E),y:u.y+(M-x),angle:Zr(d+y)};n.mutateElement(u,w),ot(u,n,{simultaneouslyUpdated:t}),Ke(u)&&(u.startBinding&&(c.has(u.startBinding.elementId)||nt(u,"start",n)),u.endBinding&&(c.has(u.endBinding.elementId)||nt(u,"end",n)));let v=pe(u,l);if(v&&!J(u)){let{x:A,y:k}=pi(u,v,l);n.mutateElement(v,{x:A,y:k,angle:Zr(d+y)})}}n.triggerUpdate()},HS=(e,t,n,o,i)=>{let[r,s,a,l]=t.length===1?ae(t[0],n):dt(t),d=(r+a)/2,c=(s+l)/2,u=t.length===1?t[0].angle:0;switch([o,i]=qt(Me(o,i),Me(d,c),-u),e){case"n":return qt(Me(o-(r+a)/2,i-s),Me(0,0),u);case"s":return qt(Me(o-(r+a)/2,i-l),Me(0,0),u);case"w":return qt(Me(o-r,i-(s+l)/2),Me(0,0),u);case"e":return qt(Me(o-a,i-(s+l)/2),Me(0,0),u);case"nw":return qt(Me(o-r,i-s),Me(0,0),u);case"ne":return qt(Me(o-a,i-s),Me(0,0),u);case"sw":return qt(Me(o-r,i-l),Me(0,0),u);case"se":return qt(Me(o-a,i-l),Me(0,0),u);default:return[0,0]}},zS=(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"},m2=(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"},Ka=(e,t,n,o,i,r,s,a,l)=>{let d=m2(s,a,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)}}},h2=(e,t,n,o,i,r,s,{shouldInformMutation:a=!0,shouldMaintainAspectRatio:l=!1,shouldResizeFromCenter:d=!1}={})=>{if(ue(n)&&ue(o))return u2(o,n,r,s,d,e,t);let c={},u=r.getNonDeletedElementsMap(),m=pe(n,u);if(m){let E=i.get(m.id);if(E&&(c={fontSize:E.fontSize}),l){let x={...n,width:e,height:t},y=Ja(m,u,jt(x,m));if(y===null)return;c={fontSize:y.size}}else{let x=Ed($r(m),m.lineHeight),y=xd(m.fontSize,m.lineHeight);e=Math.max(e,x),t=Math.max(t,y)}}let h=Mp(o,e,t,!0),g=Me(o.x,o.y);if(le(o)){let[E,x]=be(o,i);g=Me(E,x)}let f=Ka(g,o.width,o.height,e,t,o.angle,s,l,d);if(le(o)&&h.points){let E=o.x-g[0],x=o.y-g[1];f.x+=E,f.y+=x;let y=h.points[0][0],b=h.points[0][1];f.x+=y,f.y+=b,h.points=h.points.map(M=>Me(M[0]-y,M[1]-b))}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)&&m&&l){let E=e/n.width*m.fontSize;if(E<Qa)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),...h};Ke(n)&&(n.startBinding&&(E={...E},n.startBinding&&nt(n,"start",r)),n.endBinding&&(E={...E,endBinding:null})),r.mutateElement(n,E,{informMutation:a,isDragging:!1}),m&&c!=null&&r.mutateElement(m,{fontSize:c.fontSize}),lo(n,r,s,l,d),ot(n,r)}},f2=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:s=!1}={})=>{let[a,l,d,c]=Ln(t,t.width,t.height,!0),u=Me(a,l),m=Me(d,c),h=d2(u,m),g=qt(Me(o,i),h,-t.angle),[f,E,x,y]=Ln(e,e.width,e.height,!0),b=x-f,M=y-E,w=m[0]-u[0],v=m[1]-u[1],A=w/b,k=v/M;n.includes("e")&&(A=(g[0]-u[0])/b),n.includes("s")&&(k=(g[1]-u[1])/M),n.includes("w")&&(A=(m[0]-g[0])/b),n.includes("n")&&(k=(m[1]-g[1])/M);let T=e.width*A,z=e.height*k;if(s&&(T=2*T-t.width,z=2*z-t.height),r){let C=Math.abs(T)/t.width,O=Math.abs(z)/t.height;if(n.length===1&&(z*=C,T*=O),n.length===2){let N=Math.max(C,O);T=t.width*N*Math.sign(T),z=t.height*N*Math.sign(z)}}return{nextWidth:T,nextHeight:z}},g2=(e,t,n,o,i,r,{shouldMaintainAspectRatio:s=!1,shouldResizeFromCenter:a=!1}={})=>{let l=e.map(N=>t.get(N.id)),d=l.reduce((N,j)=>{if(!le(j))return N;let V=Vt(j);if(!V)return N;let D=t.get(V)??null;return Ne(D)?[...N,{...D,...W.getBoundTextElementPosition(j,D,n)}]:N},[]),c=it(l.map(N=>N).concat(d)),{minX:u,minY:m,maxX:h,maxY:g,midX:f,midY:E}=c,x=h-u,y=g-m,b={ne:[u,g],se:[u,m],sw:[h,m],nw:[h,g],e:[u,m+y/2],w:[h,m+y/2],n:[u+x/2,g],s:[u+x/2,m]},[M,w]=a?[f,E]:b[o],v=a?2:1,A=Math.max(Math.abs(i-M)/x||0,Math.abs(r-w)/y||0)*v,k=o.includes("e")||o.includes("w")?Math.abs(i-M)*v:x,T=o.includes("n")||o.includes("s")?Math.abs(r-w)*v:y;s&&(k=x*A*Math.sign(i-M),T=y*A*Math.sign(r-w));let z={ne:[i<M,r>w],se:[i<M,r<w],sw:[i>M,r<w],nw:[i>M,r>w],e:[i<M,!1],w:[i>M,!1],n:[!1,r>w],s:[!1,r<w]},[C,O]=z[o].map(N=>N);return{originalBoundingBox:c,nextWidth:k,nextHeight:T,flipByX:C,flipByY:O}},E2=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:s=!1,flipByX:a=!1,flipByY:l=!1,nextHeight:d,nextWidth:c,originalBoundingBox:u}={})=>{if(c===void 0&&d===void 0&&a===void 0&&l===void 0||d===0||c===0)return;i||(i=t);let m=e.reduce((v,A)=>{let k=i.get(A.id);return k&&v.push({orig:k,latest:A}),v},[]),h;if(u)h=u;else{let v=m.reduce((A,{orig:k})=>{if(!le(k))return A;let T=Vt(k);if(!T)return A;let z=i.get(T)??null;return Ne(z)?[...A,{...z,...W.getBoundTextElementPosition(k,z,t)}]:A},[]);h=it([...m.map(({orig:A})=>A),...v])}let{minX:g,minY:f,maxX:E,maxY:x,midX:y,midY:b}=h,M=E-g,w=x-f;if(c===void 0&&d===void 0&&(c=M,d=w),r&&(c===void 0?c=d*(M/w):d===void 0?d=c*(w/M):Math.abs(c/d-M/w)>.001&&(c=d*(M/w))),c&&d){let v=n.includes("e")||n.includes("w")?Math.abs(c)/M:1,A=n.includes("n")||n.includes("s")?Math.abs(d)/w:1,k;n.length===1?k=n.includes("e")||n.includes("w")?v:A:k=Math.max(Math.abs(c)/M||0,Math.abs(d)/w||0);let T={ne:[g,x],se:[g,f],sw:[E,f],nw:[E,x],e:[g,f+w/2],w:[E,f+w/2],n:[g+M/2,x],s:[g+M/2,f]},[z,C]=s?[y,b]:T[n],O=r||m.some(I=>I.latest.angle!==0||ue(I.latest)||Pc(I.latest));O&&(v=k,A=k);let[N,j]=[a?-1:1,l?-1:1],V=[];for(let{orig:I,latest:L}of m){if(ue(I)&&Ne(I))continue;let G=I.width*v,_=I.height*A,K=Zr(I.angle*N*j),$=le(I)||Le(I),X=I.x-z,Y=I.y-C,we=a&&!$?G:0,Q=l&&!$?_:0,me=z+N*(X*v+we),Ae=C+j*(Y*A+Q),ne=Mp(I,G*N,_*j,!1),ie={x:me,y:Ae,width:G,height:_,angle:K,...ne};if(ee(I)&&(I.startBinding&&(ie.startBinding={...I.startBinding,fixedPoint:[a?-I.startBinding.fixedPoint[0]+1:I.startBinding.fixedPoint[0],l?-I.startBinding.fixedPoint[1]+1:I.startBinding.fixedPoint[1]]}),I.endBinding&&(ie.endBinding={...I.endBinding,fixedPoint:[a?-I.endBinding.fixedPoint[0]+1:I.endBinding.fixedPoint[0],l?-I.endBinding.fixedPoint[1]+1:I.endBinding.fixedPoint[1]]}),I.fixedSegments&&ne.points&&(ie.fixedSegments=I.fixedSegments.map(ye=>({...ye,start:ne.points[ye.index-1],end:ne.points[ye.index]})))),Ue(I)&&(ie.scale=[I.scale[0]*N,I.scale[1]*j]),ue(I)){let ye=Ja(I,t,G);if(!ye)return;ie.fontSize=ye.size}let Ie=i.get(Vt(I)??"");if(Ie)if(O){let ye=Ie.fontSize*k;if(ye<Qa)return;ie.boundTextFontSize=ye}else ie.boundTextFontSize=Ie.fontSize;V.push({element:L,update:ie})}let D=V.map(({element:I})=>I),B=new Map(V.map(({element:I})=>[I.id,I]));for(let{element:I,update:{boundTextFontSize:L,...G}}of V){let{angle:_}=G;o.mutateElement(I,G),ot(I,o,{simultaneouslyUpdated:D}),Ke(I)&&(I.startBinding&&(B.has(I.startBinding.elementId)||nt(I,"start",o)),I.endBinding&&(B.has(I.endBinding.elementId)||nt(I,"end",o)));let K=pe(I,t);K&&L&&(o.mutateElement(K,{fontSize:L,angle:le(I)?void 0:_}),lo(I,o,n,!0,s))}o.triggerUpdate()}};S();import{pointFrom as Nt,pointOnLineSegment as Tp,pointRotateRads as Qr}from"@excalidraw/math";import{SIDE_RESIZING_THRESHOLD as rl}from"@excalidraw/common";S();import{DEFAULT_TRANSFORM_HANDLE_SPACING as tl}from"@excalidraw/common";import{pointFrom as Pp,pointRotateRads as x2}from"@excalidraw/math";var Ip={mouse:8,pen:16,touch:28},y2=16,vp={e:!0,s:!0,n:!0,w:!0},XS={e:!0,s:!0,n:!0,w:!0},$S={e:!0,s:!0,n:!0,w:!0,rotation:!0},Sp={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},el={e:!0,s:!0,n:!0,w:!0},Sn=(e,t,n,o,i,r,s)=>{let[a,l]=x2(Pp(e+n/2,t+o/2),Pp(i,r),s);return[a-n/2,l-o/2,n,o]},Kr=e=>!(e.formFactor==="phone"&&e.userAgent.isMobileDevice),nl=e=>Kr(e)?vp:{},ol=([e,t,n,o,i,r],s,a,l,d={},c=4,u=tl)=>{let m=Ip[l],h=m/a.value,g=m/a.value,f=m/a.value,E=m/a.value,x=n-e,y=o-t,b=c/a.value,M=(m-u*2)/(2*a.value),w={nw:d.nw?void 0:Sn(e-b-f+M,t-b-E+M,h,g,i,r,s),ne:d.ne?void 0:Sn(n+b-M,t-b-E+M,h,g,i,r,s),sw:d.sw?void 0:Sn(e-b-f+M,o+b-M,h,g,i,r,s),se:d.se?void 0:Sn(n+b-M,o+b-M,h,g,i,r,s),rotation:d.rotation?void 0:Sn(e+x/2-h/2,t-b-E+M-y2/a.value,h,g,i,r,s)},v=5*Ip.mouse/a.value;return Math.abs(x)>v&&(d.n||(w.n=Sn(e+x/2-h/2,t-b-E+M,h,g,i,r,s)),d.s||(w.s=Sn(e+x/2-h/2,o+b-M,h,g,i,r,s))),Math.abs(y)>v&&(d.w||(w.w=Sn(e-b-f+M,t+y/2-g/2,h,g,i,r,s)),d.e||(w.e=Sn(n+b-M,t+y/2-g/2,h,g,i,r,s))),w},Ap=(e,t,n,o="mouse",i=vp)=>{if(e.locked||ee(e))return{};if(e.type==="freedraw"||le(e)){if(e.points.length===2){let[,s]=e.points;s[0]===0||s[1]===0?i=el:s[0]>0&&s[1]<0?i=Sp:s[0]>0&&s[1]>0?i=el:s[0]<0&&s[1]>0?i=Sp:s[0]<0&&s[1]<0&&(i=el)}}else ce(e)&&(i={...i,rotation:!0});let r=le(e)?tl+8:Ue(e)?0:tl;return ol(ae(e,n,!0),e.angle,t,o,i,r,Ue(e)?0:void 0)},ZS=(e,t,n)=>{if(t.selectedLinearElement?.isEditing||t.selectedLinearElement?.isDragging)return!1;if(e.length>1)return!0;let o=e[0];return ee(o)?!1:le(o)?o.points.length>2&&!n.userAgent.isMobileDevice:!0};var sl=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],b2=(e,t,n,o,i,r,s,a)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...d}=Ap(e,r,t,s,nl(a));if(l&&sl(l,o,i))return"rotation";let c=Object.keys(d).filter(u=>{let m=d[u];return m?sl(m,o,i):!1});if(c.length>0)return c[0];if(Kr(a)){let[u,m,h,g,f,E]=ae(e,t);if(!(le(e)&&e.points.length<=2)){let x=Ue(e)?0:rl/r.value,y=rl/r.value,b=kp(Nt(u-x,m-x),Nt(h+x,g+x),Nt(f,E),e.angle);for(let[M,w]of Object.entries(b))if(Tp(Nt(o,i),w,y))return M}}return!1},ov=(e,t,n,o,i,r,s,a)=>e.reduce((l,d)=>{if(l)return l;let c=b2(d,s,t,n,o,i,r,a);return c?{element:d,transformHandleType:c}:null},null),iv=([e,t,n,o],i,r,s,a,l)=>{let d=ol([e,t,n,o,(e+n)/2,(t+o)/2],0,s,a,nl(l)),c=Object.keys(d).find(u=>{let m=d[u];return m&&sl(m,i,r)});if(c)return c;if(Kr(l)){let u=(e+n)/2,m=(t+o)/2,h=rl/s.value,g=kp(Nt(e-h,t-h),Nt(n+h,o+h),Nt(u,m),0);for(let[f,E]of Object.entries(g))if(Tp(Nt(i,r),E,h))return f}return!1},il=["ns","nesw","ew","nwse"],w2=(e,t)=>{let n=il.indexOf(e);if(n>=0){let o=Math.round(t/(Math.PI/4));e=il[(n+o)%il.length]}return e},rv=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=w2(i,t.angle)),i?`${i}-resize`:""},kp=([e,t],[n,o],i,r)=>{let s=Qr(Nt(e,t),i,r),a=Qr(Nt(n,t),i,r),l=Qr(Nt(e,o),i,r),d=Qr(Nt(n,o),i,r);return{n:[s,a],e:[a,d],s:[d,l],w:[l,s]}};S();import{KEYS as Ot}from"@excalidraw/common";S();S();function Lp(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=Lp(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function Dp(){for(var e=0,t,n,o="";e<arguments.length;)(t=arguments[e++])&&(n=Lp(t))&&(o&&(o+=" "),o+=n);return o}var Re=Li(Up(),1),p=Li(ml(),1);import{THEME as H2}from"@excalidraw/common";var Kt=e=>"var(--icon-fill-color)",Zp=e=>e===H2.LIGHT?"#fff":"#1e1e1e",P=(e,t=512)=>{let{width:n=512,height:o=n,mirror:i,style:r,...s}=typeof t=="number"?{width:t}:t;return(0,p.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${o}`,className:Dp({"rtl-mirror":i}),style:r,...s,children:typeof e=="string"?(0,p.jsx)("path",{fill:"currentColor",d:e}):e})},R={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},te={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},pt={width:40,height:20},bv=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"})]}),R),wv=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"})]}),R),Mv=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"})]}),R),Pv=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"})]}),R),Iv=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"})]}),R),Sv=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"})]}),R),vv=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"})})]}),te),Av=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"})]}),te),Tv=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}),kv=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"}),Lv=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"}),Dv=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"}),Cv=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"}),hl=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}),Bv=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}),qp=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"})]}),R),Kp=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"})]}),R),Qp=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"})]}),R),Jp=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"})]}),R),em=P((0,p.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),te),Gv=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"})]}),R),tm=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"})]}),te),nm=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"})]}),R),Nv=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"})]}),R),om=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"})]}),te),im=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"})]}),R),Ov=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),te),Rv=P((0,p.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),te),Fv=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"})]}),R),Hv=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"}),te),zv=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"})]}),te),_v=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"})]}),te),Wv=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"}),te),jv=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"})}),{...te,strokeWidth:1.5}),Vv=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"})]}),R),Uv=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"}),te),Yv=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"})]}),R),Xv=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"})]}),R),$v=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"}),te),Zv=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"}),te),qv=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"})]}),te),Kv=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"})]}),R),Qv=P((0,p.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),Jv=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"})]}),te),e7=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}),t7=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}),n7=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"}),te),o7=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}),i7=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"),z2=["M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z","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","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"],r7=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),z2.map(e=>(0,p.jsx)("path",{d:e},e))]}),R),s7=P((0,p.jsx)("g",{strokeWidth:1.5,children:(0,p.jsx)("path",{d:"M6 18l12 -12"})}),R),a7=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"})]}),R),l7=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}),d7=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}),c7=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}),u7=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"),p7=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"),m7=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"}),te),h7=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"}),te),f7=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}),g7=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"}),te),E7=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"),x7=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}),y7=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"})]}),R),b7=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}),w7=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}),rm=(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"})]}),sm=(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"})]}),M7=P(sm,R),P7=P(sm,{...R,style:{transform:"rotate(180deg)"}}),I7=P(rm,R),S7=P(rm,{...R,style:{transform:"rotate(180deg)"}}),v7=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"})})})]}),te),A7=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"})})})]}),te),T7=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"})})})]}),te),k7=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"})})})]}),te),L7=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"})})})]}),te),D7=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"})})})]}),te),C7=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"})]}),te),B7=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"})]}),te),G7=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"})]}),R),N7=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"),O7=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"),R7=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"})})})]}),te),F7=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}),H7=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}),z7=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}),_7=Re.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:Kt(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:Kt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:Kt(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:Kt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:Zp(e),stroke:Kt(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})),W7=Re.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:Kt(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:Kt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:Kt(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:Kt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:Zp(e),stroke:Kt(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})),j7=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"})}),te),V7=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"})})]}),te),U7=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"})})})]}),te),Y7=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"})})})]}),{...te,fill:"currentColor"}),X7=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"})}),te),$7=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),te),Z7=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),te),q7=Re.default.memo(({theme:e})=>P((0,p.jsx)("path",{d:"M6 10H34",stroke:Kt(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),K7=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"})]}),R),Q7=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"})]}),R),J7=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"}),te),e8=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"}),te),t8=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"}),te),n8=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]}),R),o8=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"2.75",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"3.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),R),i8=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"})]}),te),r8=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"})]}),R),s8=Re.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"})]}),pt)),a8=Re.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"})}),pt)),l8=Re.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"})]}),pt)),d8=Re.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"})]}),pt)),c8=Re.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"})]}),pt)),u8=Re.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"})]}),pt)),p8=Re.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"})]}),pt)),m8=Re.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"})]}),pt)),h8=Re.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"})}),pt)),f8=Re.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"})}),pt)),g8=Re.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"})}),pt)),E8=Re.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"})}),pt)),x8=Re.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"})}),pt)),y8=Re.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"})]}),pt)),b8=Re.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"})]}),pt)),w8=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"})})})]}),te),M8=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"})})})]}),te),P8=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"})})})]}),te),I8=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"})}),te),S8=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"})]}),R),v8=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"})]})}),R),A8=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"})})}),te),T8=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"})]}),R);var k8=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"})]}),R),L8=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"})]}),R),D8=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"})]}),R),C8=Re.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"})]}),R)),B8=Re.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"})]}),R)),G8=Re.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"})]}),R)),N8=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"})]}),R),O8=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}),R8=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"})),F8=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"})]}),R),H8=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"})]}),R),z8=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"})]}),R),_8=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"})]}),R),W8=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"})]}),R),j8=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"})]}),R),V8=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"})]}),R),U8=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"})]}),R),Y8=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"})]}),R),_2=["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","M11 7l6 6"],X8=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_2.map(e=>(0,p.jsx)("path",{d:e},e))]}),R),$8=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"})]}),R),Z8=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"})]}),R),q8=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"})]}),R),K8=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"})]}),te),Q8=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 9.5a6.5 6.5 0 1 0 13 0a6.5 6.5 0 1 0 -13 0"}),(0,p.jsx)("path",{d:"M10 12a2 2 0 0 1 2 -2h7a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2l0 -7"})]}),R),J8=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),eA=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"})]}),R),tA=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"})]}),R),nA=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"})]}),R),oA=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"})]}),R),iA=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"})]}),R),rA=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"})]}),R),sA=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"})]}),R),aA=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"})]}),R),lA=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"})]}),R),dA=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"})]}),R),cA=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"})]}),R),uA=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"})]}),R),pA=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"})]}),R),mA=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"})]}),R),hA=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"})]}),R),fA=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"})]}),R),gA=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"})]}),R),EA=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"})]}),R),xA=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"})]}),R),yA=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"})]}),R),bA=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"})]}),R),wA=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"})]}),R),MA=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"})]}),R),PA=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"})]}),R),IA=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"})]}),{...R,strokeWidth:1.5}),SA=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"})]}),R),vA=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"})]}),R),AA=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"})]}),R),TA=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"})]}),R),kA=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"})]}),R),LA=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"})]}),R),DA=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"})]}),R),CA=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"})]}),R),BA=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"})]}),R),GA=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"})]}),R),NA=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"})]}),R),OA=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"})]}),R),RA=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"})]}),R),FA=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"})]}),R),HA=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"})]}),R),zA=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"})})),_A=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"})]}),R),WA=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"})]}),R),jA=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"})]}),R),VA=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"})]}),R),UA=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"})]}),R),YA=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"})]}),R),XA=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"})]}),R);var $A=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:"6 9 12 15 18 9"})]}),R),ZA=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"})]}),R),qA=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"})]}),R);var am=[{icon:hl,value:"selection",key:Ot.V,numericKey:void 0,fillable:!0,myocSimplifiedMode:!0},{icon:qp,value:"rectangle",key:Ot.R,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Kp,value:"diamond",key:Ot.D,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Qp,value:"ellipse",key:Ot.O,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:Jp,value:"arrow",key:Ot.A,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:em,value:"line",key:Ot.L,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:tm,value:"freedraw",key:[Ot.P,Ot.X],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:nm,value:"text",key:Ot.T,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:om,value:"image",key:[Ot.I],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:im,value:"eraser",key:Ot.E,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0}],W2=e=>e.state.preferredSelectionTool.type==="lasso"?[{value:"lasso",icon:hl,key:Ot.V,fillable:!0,myocSimplifiedMode:!0},...am.slice(1)]:am,iT=(e,t)=>W2(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,rT=(e,t)=>{let n=pe(e,t);return n?e.type==="arrow"?Si({...n,...W.getBoundTextElementPosition(e,n,t)},t):Si(n,t):null};S();var dT=(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")||dn(t,e).length));S();import{pointFrom as ts}from"@excalidraw/math";import{DEFAULT_FONT_FAMILY as j2,DEFAULT_FONT_SIZE as V2,TEXT_ALIGN as U2,VERTICAL_ALIGN as Y2,getSizeFromPoints as X2,randomId as $2,arrayToMap as Z2,assertNever as fl,cloneJSON as dm,getFontString as q2,isDevEnv as K2,toBrandedType as Q2,getLineHeight as J2}from"@excalidraw/common";var ns={width:100,height:0},eo=100,ex=(e,t,n)=>{let o=xo({x:0,y:0,textAlign:U2.CENTER,verticalAlign:Y2.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:o.id})}),ar(o,e,n),[e,o]},lm=(e,t,n,o,i)=>{let r,s;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let c=t?.width??eo,u=t?.height??eo,m;t.id&&(m=o.getElement(t.id),m||console.error(`No element for start binding with id ${t.id} found`));let h=t.x||e.x-c,g=t.y||e.y-u/2,f=m?m.type:t.type;if(f){if(f==="text"){let E="";m&&m.type==="text"?E=m.text:t.type==="text"&&(E=t.text),E||console.error(`No text found for start binding text element for ${e.id}`),r=xo({x:h,y:g,type:"text",...m,...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=Ho({x:h,y:g,width:c,height:u,...m,...t,type:f});break}default:fl(e,`Unhandled element start type "${t.type}"`,!0)}ln(e,r,"orbit","start",i)}}if(n){let c=n?.height??eo,u=n?.width??eo,m;n.id&&(m=o.getElement(n.id),m||console.error(`No element for end binding with id ${n.id} found`));let h=n.x||e.x+e.width,g=n.y||e.y-c/2,f=m?m.type:n.type;if(f){if(f==="text"){let E="";m&&m.type==="text"?E=m.text:n.type==="text"&&(E=n.text),E||console.error(`No text found for end binding text element for ${e.id}`),s=xo({x:h,y:g,type:"text",...m,...n,text:E}),Object.assign(s,{y:n.y||e.y-s.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{s=Ho({x:h,y:g,width:u,height:c,...m,...n,type:f});break}default:fl(e,`Unhandled element end type "${f}"`,!0)}ln(e,s,"orbit","end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:r,endBoundElement:s};let a=e.points.length-1,l=.5,d=dm(e.points);return e.points[a][0]>e.points[a-1][0]&&(d[0][0]=l,d[a][0]-=l),e.points[a][0]<e.points[a-1][0]&&(d[0][0]=-l,d[a][0]+=l),e.points[a][1]>e.points[a-1][1]&&(d[0][1]=l,d[a][1]-=l),e.points[a][1]<e.points[a-1][1]&&(d[0][1]=-l,d[a][1]+=l),Object.assign(e,W.getNormalizeElementPointsAndCoords({...e,points:d})),{linearElement:e,startBoundElement:r,endBoundElement:s}},gl=class{excalidrawElements=new Map;add=t=>{t&&this.excalidrawElements.set(t.id,t)};getElements=()=>ca(Array.from(this.excalidrawElements.values()));getElementsMap=()=>Q2(Z2(this.getElements()));getElement=t=>this.excalidrawElements.get(t)},PT=(e,t)=>{if(!e)return[];let n=dm(e),o=new gl,i=new Map,r=new Map;for(let l of n){let d,c=l.id;switch(t?.regenerateIds!==!1&&Object.assign(l,{id:$2()}),l.type){case"rectangle":case"ellipse":case"diamond":{let m=l?.label?.text&&l.width===void 0?0:l?.width||eo,h=l?.label?.text&&l.height===void 0?0:l?.height||eo;d=Ho({...l,width:m,height:h});break}case"line":{let m=l.width||ns.width,h=l.height||ns.height;d=Su({width:m,height:h,points:[ts(0,0),ts(m,h)],...l});break}case"arrow":{let m=l.width||ns.width,h=l.height||ns.height;d=Hr({width:m,height:h,endArrowhead:"arrow",points:[ts(0,0),ts(m,h)],...l,type:"arrow"}),Object.assign(d,X2(d.points));break}case"text":{let m=l?.fontFamily||j2,h=l?.fontSize||V2,g=l?.lineHeight||J2(m),f=l.text??"",E=ui(f),x=At(E,q2({fontFamily:m,fontSize:h}),g);d=xo({width:x.width,height:x.height,fontFamily:m,fontSize:h,...l});break}case"image":{d=vu({width:l?.width||eo,height:l?.height||eo,...l});break}case"frame":{d=Mu({x:0,y:0,...l});break}case"magicframe":{d=Pu({x:0,y:0,...l});break}case"freedraw":case"iframe":case"embeddable":{d=l;break}default:d=l,fl(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 s=o.getElementsMap(),a=new Uo(s);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,m]=ex(c,d?.label,a);if(o.add(u),o.add(m),J(u)){let h=d.type==="arrow"?d?.start:void 0,g=d.type==="arrow"?d?.end:void 0;if(h&&h.id){let y=r.get(h.id);y&&Object.assign(h,{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}=lm(u,h,g,o,a);u=f,o.add(f),o.add(E),o.add(x)}}else switch(d.type){case"arrow":{let{start:u,end:m}=d;if(u&&u.id){let E=r.get(u.id);Object.assign(u,{id:E})}if(m&&m.id){let E=r.get(m.id);Object.assign(m,{id:E})}let{linearElement:h,startBoundElement:g,endBoundElement:f}=lm(c,u,m,o,a);o.add(h),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(w=>{let v=r.get(w);if(!v)throw new Error(`Element with ${w} wasn't mapped correctly`);let A=o.getElement(v);if(!A)throw new Error(`Frame element with id ${v} doesn't exist`);Object.assign(A,{frameId:c.id}),A?.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(A)});let[m,h,g,f]=dt(u),E=10;m=m-E,h=h-E,g=g+E,f=f+E;let x=c?.x||m,y=c?.y||h,b=c?.width||g-m,M=c?.height||f-h;Object.assign(c,{x,y,width:b,height:M}),K2()&&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()};S();var TT=({app:e,event:t})=>{let n=e.state;if(n.selectedLinearElement&&e.lastPointerMoveCoords){if(n.selectedLinearElement.draggedFocusPointBinding)return yp(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 W.handlePointDragging(e.lastPointerMoveEvent,e,e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y,n.selectedLinearElement),!0}return!1};S();var tx=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}},DT=e=>{let t=tx(e);return t===null?null:t};S();import{getBoundsFromPoints as mm,getElementAbsoluteCoords as nx}from"@excalidraw/element/bounds";import{newArrowElement as cm,newElement as ox,newLinearElement as os}from"@excalidraw/element/newElement";import{ELEMENT_PENDING_DRAW_SHAPE_OPACITY as ix,getStrokeWidthByKey as is,ROUNDNESS as um}from"@excalidraw/common";import{convexHull as rx,distanceToLineSegment as sx,elongation as ax,kurtosis as pm,lineSegment as lx,orientPrincipalAxes as dx,pointFrom as mt,polygonArea as cx,principalAxes as ux,principalCoords as px,skewness as mx}from"@excalidraw/math";var hx=64,fx=25,gx=.15,Ex=.25,xx=.5,yx=.15,bx=.3,wx=1.5,Zo=3;function Mx(e,t){let n=0;for(let a=1;a<e.length;a++)n+=Math.hypot(e[a][0]-e[a-1][0],e[a][1]-e[a-1][1]);let o=n/(t-1),i=0,r=[e[0]],s=e[0];for(let a=1;a<e.length;a++){let l=e[a],d=Math.hypot(l[0]-s[0],l[1]-s[1]);if(i+d>=o){let c=o-i;for(;c<=d+1e-10;){let u=c/d,m=[s[0]+u*(l[0]-s[0]),s[1]+u*(l[1]-s[1])];if(r.push(m),r.length===t)return r;s=m,i=0,c+=o}i=d-(c-o)}else i+=d;s=l}for(;r.length<t;)r.push(e[e.length-1]);return r}function Px(e){let t=e[0],n=t,o=0;for(let s of e){let a=Math.hypot(s[0]-t[0],s[1]-t[1]);a>o&&(o=a,n=s)}if(o===0)return 0;let i=lx(t,n),r=0;for(let s of e)Math.hypot(s[0]-n[0],s[1]-n[1])<=xx*o||(r=Math.max(r,sx(s,i)));return r/o}function Ix(e){let t=[];for(let n=Zo;n<e.length-Zo;n++){let[o,i]=e[n-Zo],[r,s]=e[n],[a,l]=e[n+Zo],d=r-o,c=s-i,u=a-r,m=l-s;t.push(Math.abs(Math.atan2(d*m-c*u,d*u+c*m)))}return t}function Sx(e){let t=Ix(e),n=t.reduce((r,s)=>r+s,0);if(n===0)return 0;let o=new Array(t.length).fill(!1),i=0;for(let r=0;r<4;r++){let s=-1,a=0;for(let l=0;l<t.length;l++)!o[l]&&t[l]>a&&(a=t[l],s=l);if(s<0)break;for(let l=s-Zo;l<=s+Zo;l++)l>=0&&l<t.length&&!o[l]&&(i+=t[l],o[l]=!0)}return i/n}function vx(e){let t=Mx(e,hx),n=0;for(let m=1;m<t.length;m++)n+=Math.hypot(t[m][0]-t[m-1][0],t[m][1]-t[m-1][1]);let o=Math.hypot(t[t.length-1][0]-t[0][0],t[t.length-1][1]-t[0][1]),i=dx(t,ux(t)),r=px(t,i).map(([m])=>m),s=rx(t),[a,l,d,c]=mm(t),u=(d-a)*(c-l);return{gapRatio:n>0?o/n:0,elongation:ax(i),majorSkew:mx(r),hullFillRatio:u>0?cx(s)/u:0,cornerTurnShare:Sx(t),kurtosisProduct:pm(t.map(([m])=>m))*pm(t.map(([,m])=>m)),shaftDeviationRatio:Px(t)}}var Ax=[{type:"rectangle",hullFillRatio:1,cornerTurnShare:.95,kurtosisProduct:1.83},{type:"diamond",hullFillRatio:.5,cornerTurnShare:.95,kurtosisProduct:3.24},{type:"ellipse",hullFillRatio:Math.PI/4,cornerTurnShare:.55,kurtosisProduct:2.25}],Tx=.2,kx=.2,Lx=.7;function Dx(e){let t="freedraw",n=wx;for(let o of Ax){let i=Math.hypot((e.hullFillRatio-o.hullFillRatio)/Tx,(e.cornerTurnShare-o.cornerTurnShare)/kx,(e.kurtosisProduct-o.kurtosisProduct)/Lx);i<n&&(n=i,t=o.type)}return t}function Cx(e){return e.elongation>Ex||e.shaftDeviationRatio>yx?"freedraw":Math.abs(e.majorSkew)>=bx?"arrow":"line"}function Bx(e){return e.gapRatio>gx?Cx(e):Dx(e)}function Gx(e,t,n){let[o,i,r,s]=t,a=r-o,l=s-i;if(a===0&&l===0)return e[e.length-1];let d=[mt(o,i),mt((o+r)/2,i),mt(r,i),mt(r,(i+s)/2),mt(r,s),mt((o+r)/2,s),mt(o,s),mt(o,(i+s)/2)],c=-1,u=mt(r,s);for(let g of d){let f=Math.hypot(g[0]-n[0],g[1]-n[1]);f>c&&(c=f,u=g)}let m=1/0,h=e[e.length-1];for(let g of e){let f=Math.hypot(g[0]-u[0],g[1]-u[1]);f<m&&(m=f,h=g)}return h}var Nx=(e,t,n=1)=>{typeof window<"u"&&(window.LAST_POINTS=e.map(([u,m])=>mt(u,m)));let o=mm(e),[i,r,s,a]=o,l=Math.max(s-i,a-r);if(e.length<3||l*n<fx)return{type:"freedraw",points:e,boundingBox:o};let d=Bx(vx(e));return{type:t?.type==="arrow"&&d!=="arrow"?"freedraw":d,points:e,boundingBox:o}},Ox=(e,t,n,o,i)=>{let r=Nx(e,o,t.zoom.value),s=r.boundingBox,[a,l,d,c]=s,m=(i??ha([...n.values()])).find(g=>{let[f,E,x,y]=nx(g,n);return f<=a&&E<=l&&x>=d&&y>=c})?.id??null,h=t.currentItemRoundness==="round"?{type:Ji(r.type)?um.ADAPTIVE_RADIUS:um.PROPORTIONAL_RADIUS}:null;switch(r.type){case"rectangle":case"diamond":case"ellipse":return ox({type:r.type,x:r.boundingBox[0],y:r.boundingBox[1],width:r.boundingBox[2]-r.boundingBox[0],height:r.boundingBox[3]-r.boundingBox[1],groupIds:[],angle:0,frameId:m,roundness:h,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:is(r.type,t.currentItemStrokeWidthKey)});case"arrow":{let[g,f]=r.points[0],[E,x]=Gx(r.points,r.boundingBox,r.points[0]),y=mt(E-g,x-f);if(Math.hypot(E-r.points[0][0],x-r.points[0][1])<60){let v=os({type:"line",x:g,y:f,points:[mt(r.points[0][0]-g,r.points[0][1]-f),y],groupIds:[],frameId:m,locked:!1,angle:0,roundness:h,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:is(r.type,t.currentItemStrokeWidthKey)}),A=W.getNormalizeElementPointsAndCoords(v);return os({...v,...A})}let M=cm({type:"arrow",x:g,y:f,startArrowhead:t.currentItemStartArrowhead,endArrowhead:t.currentItemEndArrowhead,points:[mt(r.points[0][0]-g,r.points[0][1]-f),y],groupIds:[],frameId:m,locked:!1,angle:0,roundness:h,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:is(r.type,t.currentItemStrokeWidthKey)}),w=W.getNormalizeElementPointsAndCoords(M);return cm({...M,...w})}case"line":{let[g,f]=r.points[0],E=r.points[r.points.length-1],x=os({type:r.type,x:g,y:f,points:[mt(r.points[0][0]-g,r.points[0][1]-f),mt(E[0]-g,E[1]-f)],groupIds:[],frameId:m,locked:!1,angle:0,roundness:h,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:is(r.type,t.currentItemStrokeWidthKey)}),y=W.getNormalizeElementPointsAndCoords(x);return os({...x,...y})}}},Rx=(e,t)=>{if(!e||e.type!==t.type||e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height||e.angle!==t.angle)return!1;if(le(e)&&le(t)){if(e.points.length!==t.points.length)return!1;for(let n=0;n<e.points.length;n++)if(e.points[n][0]!==t.points[n][0]||e.points[n][1]!==t.points[n][1])return!1}return!0},_T=(e,t)=>{if(e.state.activeTool.type==="autoshape"){e.drawShape.trail.addPointToPath(t.x,t.y);let n=e.drawShape.trail.getCurrentPoints();if(n.length>=3){let o=Ox(n,e.state,e.scene.getNonDeletedElementsMap(),e.state.newElement,e.scene.getNonDeletedFramesLikes());if(o&&!Ye(o)){let i=e.state.newElement,r={...o,id:i?.type===o.type?i.id:o.id,seed:1,opacity:ix,isDeleted:!1};Rx(i,r)||e.setState({newElement:r})}else e.state.newElement!==null&&e.setState({newElement:null})}return!0}return!1};var YT=e=>e.reduce((t,n)=>t+n.version,0),Vu=e=>{let t=5381;for(let n of Fx(e))t=(t<<5)+t+n.versionNonce;return t>>>0},Uu=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},rt=e=>!e.isDeleted,XT=e=>e.filter(t=>rt(t)&&!fu(t)),Un=e=>e.filter(rt);export{Zn as AppStateDelta,j1 as BASE_ARROW_MIN_LENGTH,tc as BASE_BINDING_GAP,co as BASE_BINDING_GAP_ELBOW,xe as BASE_PADDING,zn as BindableElement,Hn as BoundElement,Pt as CaptureUpdateAction,Mg as DEFAULT_BUCKET_FILL_OPTIONS,g5 as DEFAULT_LINK_SIZE,vp as DEFAULT_OMIT_SIDES,oe as Delta,za as DurableIncrement,ka as ElementBounds,qn as ElementsDelta,_a as EphemeralIncrement,xi as FOCUS_POINT_SIZE,gp as FlowChartCreator,fp as FlowChartNavigator,We as HEADING_DOWN,Xe as HEADING_LEFT,Se as HEADING_RIGHT,st as HEADING_UP,F0 as INVISIBLY_SMALL_ELEMENT_SIZE,la as InvalidFractionalIndexError,W as LinearElementEditor,qe as MINIMAL_CROP_SIZE,$S as OMIT_SIDES_FOR_FRAME,XS as OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,am as SHAPES,Uo as Scene,Lt as ShapeCache,_u as Store,ki as StoreChange,Wa as StoreDelta,Vr as StoreIncrement,Kn as StoreSnapshot,bt as aabbForElement,gf as addElementsToFrame,u4 as addToGroup,gM as alignElements,AM as arrangeElements,q1 as avoidRectangularCorner,ln as bindBindingElement,l6 as bindBindingElementToFixedPoint,pc as bindElementsToFramesAfterDuplication,V1 as bindOrUnbindBindingElement,i6 as bindOrUnbindBindingElements,ta as bindPointToSnapToElementOutline,sc as bindingProperties,fa as boundsContainBounds,$d as bumpVersion,J1 as calculateFixedPointForElbowArrowBinding,Go as calculateFixedPointForNonElbowArrowBinding,Qb as canApplyRoundnessTypeToElement,sd as canBecomePolygon,Pd as canChangeRoundness,OE as canCreateLinkFromElements,i3 as canHaveArrowheads,Kr as canResizeFromSides,Ao as charWidth,Pe as compareHeading,pi as computeBoundTextPosition,mP as computeBucketFillPolygon,Gs as computeContainerDimensionForBoundText,Aw as containsCJK,PT as convertToExcalidrawElements,Ox as convertToShape,_T as convertToShapeHandlePointerMoveFromPointerDown,_I as createPlaceholderEmbeddableLabel,Ya as createSrcDoc,Vb as cropElement,Bn as deconstructDiamondElement,so as deconstructLinearOrFreeDrawElement,Cn as deconstructRectanguloidElement,Ha as deepCopyElement,LI as defaultGetElementLinkFromSelection,bw as detectLineHeight,nn as distanceToElement,mI as distributeElements,kt as doBoundsIntersect,SI as dragNewElement,NE as dragNewTextElement,PI as dragSelectedElements,Ug as duplicateElement,kP as duplicateElements,c4 as editGroupForSelectedElement,he as elementCenterPoint,_n as elementOverlapsWithFrame,wi as elementWithCanvasCache,jn as elementsAreInFrameBounds,Mc as elementsAreInSameGroup,yc as elementsOverlappingBBox,jI as embeddableURLValidator,vf as excludeElementsInFramesFromSelection,R6 as filterElementsEligibleAsFrameChildren,iT as findShapeByKey,s6 as fixBindingsAfterDeletion,rc as fixDuplicatedBindingsAfterDuplication,Us as flipHeading,j6 as frameAndChildrenSelectedTogether,md as generateLinearCollisionShape,Mt as generateRoughOptions,K4 as generateThumbHash,i4 as getActiveTextElement,dr as getAllHoveredElementAtPoint,xd as getApproxMinLineHeight,Ed as getApproxMinLineWidth,ac as getArrowLocalFixedPoints,D0 as getArrowheadAngle,DT as getArrowheadForPicker,ut as getArrowheadPoints,L0 as getArrowheadSize,_e as getBindingGap,a6 as getBindingSideMidPoint,sa as getBindingStrategyForDraggingBindingElementEndpoints,pe as getBoundTextElement,Vt as getBoundTextElementId,zw as getBoundTextElementPosition,mi as getBoundTextMaxHeight,jt as getBoundTextMaxWidth,rT as getBoundTextShape,go as getBoundsFromPoints,yn as getCenterForBounds,it as getCommonBoundingBox,dt as getCommonBounds,hf as getCommonFrameId,Fw as getContainerCenter,Ns as getContainerCoords,et as getContainerElement,Wn as getContainingFrame,fn as getCornerRadius,cr as getCubicBezierCurveBound,rv as getCursorForResizingElement,wf as getDefaultFrameName,Jb as getDefaultRoundnessTypeForElement,pd as getDiamondBaseCorners,vo as getDiamondPoints,II as getDragOffsetXY,J5 as getDraggedElementsBounds,ae as getElementAbsoluteCoords,be as getElementBounds,No as getElementLineSegments,ba as getElementPointsCoords,Si as getElementShape,ov as getElementWithTransformHandleType,mc as getElementsCompletelyInFrame,lt as getElementsInGroup,O6 as getElementsInNewFrame,N6 as getElementsInResizingFrame,k6 as getElementsIntersectingFrame,W6 as getElementsOverlappingFrame,gc as getElementsWithinSelection,zI as getEmbedLink,JM as getEndpointBoundTextDragAnchor,Ub as getFlipAdjustedCropPosition,Vn as getFrameChildren,ff as getFrameChildrenInsertionIndex,ha as getFrameLikeElements,_6 as getFrameLikeTitle,y5 as getFreedrawOutlineAsSegments,w0 as getFreedrawOutlinePoints,su as getFreedrawStrokeCenterPoints,Qe as getGlobalFixedPointForBindableElement,ef as getGlobalFixedPoints,Xd as getHeadingForElbowArrowSnap,xn as getHoveredElementForBinding,Nd as getHoveredElementForFocusPoint,J4 as getInitializedImageElements,ir as getLineHeightInPx,Gn as getLineWidth,ew as getLinearElementSubType,DI as getLinkIdAndTypeFromSelection,_c as getLockedLinearCursorAlignSize,Th as getMaxCharWidth,Ar as getMaximumGroups,Mw as getMinCharWidth,bi as getMinMaxXYFromCurvePathOps,or as getMinTextElementWidth,Ic as getNewGroupIdsForDuplication,Un as getNonDeletedElements,wc as getNonDeletedGroupIds,dM as getNormalizedDimensions,Vo as getObservedAppState,nl as getOmitSidesForEditorInterface,fw as getOriginalContainerHeightFromCache,La as getPerfectElementSize,Q5 as getRectangleBoxAbsoluteCoords,s0 as getRenderOpacity,zS as getResizeArrowDirection,HS as getResizeOffsetXY,Ln as getResizedElementAbsoluteCoords,G6 as getRootElements,YT as getSceneVersion,dn as getSelectedElements,Tr as getSelectedElementsByGroup,Ea as getSelectedGroupForElement,Cf as getSelectedGroupIdForElement,Lf as getSelectedGroupIds,o4 as getSelectionStateForElements,er as getSnapOutlineMidPoint,n4 as getTargetElements,xf as getTargetFrame,Ca as getTextAnchorRatios,KM as getTextBindingForArrowEndpoint,Hw as getTextElementAngle,Vw as getTextFromElements,Ah as getTextHeight,yd as getTextWidth,Xc as getThumbHashPlaceholder,W2 as getToolbarTools,iv as getTransformHandleTypeFromCoords,Ap as getTransformHandles,ol as getTransformHandlesFromCoords,qM as getUnboundArrowEndpointAtPoint,Ql as getUncroppedImageElement,Ms as getUncroppedWidthAndHeight,e4 as getVisibleAndNonSelectedElements,XT as getVisibleElements,eM as getVisibleSceneBounds,Rh as getWrappedTextLines,B6 as groupByFrameLikes,D6 as groupsAreAtLeastIntersectingTheFrame,C6 as groupsAreCompletelyOutOfFrame,lo as handleBindTextResize,yp as handleFocusPointDrag,fS as handleFocusPointHover,mS as handleFocusPointPointerDown,hS as handleFocusPointPointerUp,To as hasBackground,Jt as hasBoundTextElement,ZS as hasBoundingBox,n3 as hasFreedrawMode,Jw as hasStrokeColor,t3 as hasStrokeStyle,e3 as hasStrokeWidth,Vu as hashElementsVersion,Uu as hashString,xt as headingForPoint,ko as headingForPointFromElement,Ut as headingForPointIsHorizontal,yt as headingIsHorizontal,S3 as headingIsVertical,u1 as hitElementBoundText,c1 as hitElementBoundingBox,y3 as hitElementBoundingBoxOnly,en as hitElementItself,gt as intersectElementWithLineSegment,Kb as isArrowBoundToElement,J as isArrowElement,De as isBindableElement,js as isBindableElementInsideOtherBindable,Ke as isBindingElement,uh as isBindingElementType,an as isBindingEnabled,Ne as isBoundToContainer,Ru as isBucketFillCompatible,L6 as isCursorInFrame,dh as isCurvedArrow,ee as isElbowArrow,lM as isElementCompletelyInViewport,ma as isElementContainingFrame,fc as isElementInFrame,Df as isElementInGroup,bc as isElementInViewport,Oo as isElementIntersectingFrame,CI as isElementLink,tw as isEligibleFrameChildType,ed as isEmbeddableElement,QM as isEndpointBoundText,od as isExcalidrawElement,tf as isFixedPoint,id as isFlowchartNodeElement,Xr as isFocusPointVisible,Qi as isFrameElement,ce as isFrameLikeElement,Le as isFreeDrawElement,ah as isFreeDrawElementType,Zf as isHTMLSVGElement,qi as isIframeElement,Ki as isIframeLikeElement,Ue as isImageElement,Pc as isInGroup,Dn as isInitializedImageElement,fu as isInvisiblySmallElement,Ye as isLineElement,le as isLinearElement,ch as isLinearElementType,td as isMagicFrameElement,yw as isMeasureTextSupported,oS as isNodeInFlowchart,rt as isNonDeletedElement,vt as isPathALoop,ft as isPointInElement,li as isRectangularElement,nd as isRectanguloidElement,hP as isRestylableFill,kf as isSelectedViaGroup,lh as isSharpArrow,qb as isSimpleArrow,t4 as isSomeElementSelected,ph as isTextBindableContainer,ue as isTextElement,Ji as isUsingAdaptiveRadius,rd as isUsingProportionalRadius,Ps as isValidPolygon,jw as isValidTextContainer,$f as loadHTMLImageElement,ga as makeNextSelectedElementIds,Wt as maxBindingDistance_simple,TT as maybeHandleArrowPointlikeDrag,WI as maybeParseEmbedSrc,Ja as measureFontSizeFromWidth,At as measureText,v4 as moveAllLeft,A4 as moveAllRight,yi as moveArrowAboveBindable,I4 as moveOneLeft,S4 as moveOneRight,$e as mutateElement,Hr as newArrowElement,Ho as newElement,at as newElementWith,RM as newEmbeddableElement,Mu as newFrameElement,zM as newFreeDrawElement,FM as newIframeElement,vu as newImageElement,Su as newLinearElement,Pu as newMagicFrameElement,xo as newTextElement,bS as normaliseElements,tx as normalizeArrowhead,Hg as normalizeBoundElementsOrder,Fu as normalizeElementOrder,Je as normalizeFixedPoint,e5 as normalizeSVG,ui as normalizeText,vr as omitGroupsContainingFrameLikes,mf as omitPartialGroups,dc as orderByFractionalIndex,ci as originalContainerCache,BI as parseElementLinkFromURL,Nh as parseTokens,on as pointInsideBounds,G0 as pointInsideBoundsInclusive,SS as positionElementsOnGrid,So as projectFixedPointOntoDiagonal,Nx as recognizeShape,ar as redrawTextBoundingBox,HM as refreshTextDimensions,Ef as removeAllElementsFromFrame,hc as removeElementsFromFrame,p4 as removeFromSelectedGroups,x5 as renderElement,E5 as renderSelectionElement,Cu as rendersOpaqueFill,F6 as replaceAllElementsInFrame,Mp as rescalePointsInElement,fd as resetOriginalContainerCache,E2 as resizeMultipleElements,h2 as resizeSingleElement,u2 as resizeSingleTextElement,b2 as resizeTest,Tf as selectGroup,xc as selectGroupsForSelectedElements,Ec as selectGroupsFromGivenElements,ww as setCustomTextMetricsProvider,_w as shouldAllowVerticalAlign,z6 as shouldApplyFrameClip,lr as shouldTestInside,dT as showSelectedShapeActions,aa as snapToMid,Ww as suppportsHorizontalAlign,ca as syncInvalidIndices,cc as syncInvalidIndicesImmutable,uo as syncMovedIndices,zc as toggleLinePolygonState,o3 as toolIsArrow,FS as transformElements,nt as unbindBindingElement,r6 as updateBindings,ot as updateBoundElements,Yt as updateBoundPoint,Do as updateElbowArrowPoints,H6 as updateFrameMembershipOfSelectedElements,Q4 as updateImageCache,hd as updateOriginalContainerCache,Yd as validateElbowPoints,df as validateFractionalIndices,rn as vectorToHeading,En as wrapText};
|
|
28
|
+
`),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return Kt.set(e,m),m}return Kt.set(e,{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:o,sandbox:{allowSameOrigin:n}}},WS=e=>{let t;Ji(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=M2.Helvetica,i=I2({fontSize:n,fontFamily:o});return yo({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:yn(t,i,e.width-20),textAlign:"center",verticalAlign:P2.MIDDLE,angle:e.angle??0})},il=(e,t)=>{try{let{hostname:n}=new URL(e),o=n.replace(/^www\./,"");if(t instanceof Set){if(ol.has(o))return o;let r=o.replace(/^([^.]+)/,"*");return ol.has(r)?r:null}let i=t.replace(/^www\./,"");if(o===i)return i}catch{}return null},US=e=>{let t=e.match(C2);if(t&&t.length===2)return t[1];let n=e.match(B2);if(n&&n.length===2)return n[1];let o=e.match(A2);if(o&&o.length===2)return o[1];if(wp.test(e))return`https://giphy.com/embed/${wp.exec(e)[1]}`;let i=e.match(D2);return i&&i.length===2?i[1]:e},jS=(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(il(e,n))return!0;return!1}}return!!il(e,ol)};S();import{invariant as rl,toBrandedType as N2}from"@excalidraw/common";import{clamp as O2,pointFrom as Sp}from"@excalidraw/math";var vp=100,kp=100,R2=e=>{let t=[...e].sort((o,i)=>o.start-i.start),n=[];for(let o of t){let i=n[n.length-1];i&&o.start<=i.end?i.end=Math.max(i.end,o.end):n.push({...o})}return n},Cp=(e,t,n)=>n.every(o=>e+t<=o.start||e>=o.end),F2=(e,t,n)=>{if(Cp(e,t,n))return e;let o=[-1/0,...n.map(a=>a.end)],i=[...n.map(a=>a.start),1/0],r=e,s=1/0;for(let a=0;a<o.length;a++){if(i[a]-o[a]<t)continue;let l=O2(e,o[a],i[a]-t),d=Math.abs(l-e);d<=s&&(r=l,s=d)}return r},H2=(e,t)=>{let n=[...t.values()].filter(ee),o=new Set([e.id]),i=[e.id],r=[];for(;i.length>0;){let s=i.shift();for(let a of n){let l=a.startBinding?.elementId,d=a.endBinding?.elementId,c;if(l===s?c=d:d===s&&(c=l),!c||o.has(c))continue;o.add(c);let u=t.get(c);u&&Le(u)&&(r.push(u),i.push(c))}}return r},_2=(e,t,n,o,i)=>{let r=t==="left"||t==="right",s=r?e.width:e.height,a=r?e.height:e.width,l=r?kp:vp,d=r?vp:kp,c=r?e.x:e.y,u=r?e.y+e.height/2:e.x+e.width/2,h=t==="right"||t==="down"?c+s+l:c-l-s,m=R2(o.filter(b=>{let M=r?b[0]:b[1],w=r?b[2]:b[3];return M<h+s&&w>h}).map(b=>({start:(r?b[1]:b[0])-d,end:(r?b[3]:b[2])+d}))),g=a+d,f=n*a+(n-1)*d,x=(i===null?null:[i,i-g].filter(b=>Cp(b,f,m)).sort((b,M)=>Math.abs(b+f/2-u)-Math.abs(M+f/2-u))[0]??null)??F2(u-f/2,f,m);return{positions:Array.from({length:n},(b,M)=>{let w=x+M*g;return r?{x:h,y:w}:{x:w,y:h}}),crossStart:x}},z2=(e,t,n)=>{let o=_o({type:e.type,x:t,y:n,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});return rl(md(o),"not an ExcalidrawFlowchartNodeElement"),o},W2=(e,t,n,o,i,r=null)=>{let s=o.getNonDeletedElementsMap(),a=H2(e,s).map(u=>bt(u,s)),{positions:l,crossStart:d}=_2(e,n,i,a,r),c=[];for(let u of l){let h=z2(e,u.x,u.y),m=U2(e,h,n,t,o);c.push(h,m)}return{nodes:c,crossStart:d}},U2=(e,t,n,o,i)=>{let r,s;switch(n){case"up":{r=e.x+e.width/2,s=e.y-6;break}case"down":{r=e.x+e.width/2,s=e.y+e.height+6;break}case"right":{r=e.x+e.width+6,s=e.y+e.height/2;break}case"left":{r=e.x-6,s=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-s+6;break}case"down":{l=t.x+t.width/2-r,d=t.y-s-6;break}case"right":{l=t.x-r-6,d=t.y-s+t.height/2;break}case"left":{l=t.x+t.width-r+6,d=t.y-s+t.height/2;break}}let c=Wr({type:"arrow",x:r,y:s,startArrowhead:null,endArrowhead:o.currentItemEndArrowhead,strokeColor:e.strokeColor,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,opacity:e.opacity,roughness:e.roughness,points:[Sp(0,0),Sp(l,d)],elbowed:!0}),u=i.getNonDeletedElementsMap();cn(c,e,"orbit","start",i),cn(c,t,"orbit","end",i);let h=new Map;h.set(e.id,e),h.set(t.id,t),h.set(c.id,c),U.movePoints(c,i,new Map([[1,{point:c.points[1]}]]));let m=Do(c,N2(new Map([...u.entries(),[e.id,e],[t.id,t],[c.id,c]])),{points:c.points});return{...c,...m,isDeleted:c.isDeleted}},Ap=class e{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(!Le(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=[...e.getSuccessors(t,n,o),...e.getPredecessors(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 s=["up","right","down","left"].filter(a=>a!==o).map(a=>[...e.getSuccessors(t,n,a),...e.getPredecessors(t,n,a)]).flat().filter(a=>!this.visitedNodes.has(a.id));for(let a of s)if(!this.visitedNodes.has(a.id))return this.visitedNodes.add(a.id),this.isExploring=!0,this.direction=o,a.id}return null}static getNodeRelatives(t,n,o,i){let r=[...o.values()].reduce((s,a)=>{let l;if(ee(a)&&(l=a[t==="predecessors"?"startBinding":"endBinding"])&&a[t==="predecessors"?"endBinding":"startBinding"]?.elementId===n.id){let d=o.get(l.elementId);if(!d)return s;rl(Le(d),"not an ExcalidrawBindableElement");let c=t==="predecessors"?a.points[a.points.length-1]:[0,0],u=Co(n,bt(n,o),[c[0]+a.x,c[1]+a.y]);s.push({relative:d,heading:u})}return s},[]);switch(i){case"up":return r.filter(s=>Pe(s.heading,st)).map(s=>s.relative);case"down":return r.filter(s=>Pe(s.heading,We)).map(s=>s.relative);case"right":return r.filter(s=>Pe(s.heading,Se)).map(s=>s.relative);case"left":return r.filter(s=>Pe(s.heading,Ye)).map(s=>s.relative)}}static getSuccessors(t,n,o){return e.getNodeRelatives("successors",t,n,o)}static getPredecessors(t,n,o){return e.getNodeRelatives("predecessors",t,n,o)}},Tp=class{isCreatingChart=!1;numberOfNodes=0;direction=null;clusterCrossStart=null;pendingNodes=null;createNodes(t,n,o,i){let r=i.getNonDeletedElementsMap();o!==this.direction?(this.numberOfNodes=1,this.clusterCrossStart=null):this.numberOfNodes+=1;let{nodes:s,crossStart:a}=W2(t,n,o,i,this.numberOfNodes,this.clusterCrossStart);if(this.isCreatingChart=!0,this.direction=o,this.clusterCrossStart=a,this.pendingNodes=s,t.frameId){let l=r.get(t.frameId);rl(l&&tr(l),"not an ExcalidrawFrameElement"),l&&this.pendingNodes.every(d=>jn([d],l,r)||Wn(d,l,r))&&(this.pendingNodes=this.pendingNodes.map(d=>$e(d,r,{frameId:t.frameId})))}}clear(){this.isCreatingChart=!1,this.pendingNodes=null,this.direction=null,this.numberOfNodes=0,this.clusterCrossStart=null}},iv=(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};S();import{pointDistance as Yo,pointFrom as sl}from"@excalidraw/math";import{invariant as Lp}from"@excalidraw/common";var qr=(e,t,n,o,i,r,s=!1)=>{if(ee(t)||!dn(i)||t.points.length!==2)return!1;if(!s){let l=t.startBinding?.elementId===n.id?0:t.points.length-1,d=U.getPointAtIndexGlobalCoordinates(t,l,o);if(Yo(e,d)<yi*1.5/i.zoom.value)return!1}let a=U.getPointAtIndexGlobalCoordinates(t,r==="end"?t.points.length-1:0,o);return Yo(e,a)>=yi*1.5/i.zoom.value&&nn({element:n,elementsMap:o,point:e,threshold:ze(n,t),overrideShouldTestInside:!0})},j2=(e,t,n,o,i,r,s)=>{let a=new Map,l=r.selectedLinearElement?.initialState.arrowOtherEndpointInitialBinding,d=n?"startBinding":"endBinding",c=n?"endBinding":"startBinding",u=e[d],h=l?.mode==="orbit"&&e[c]?.mode==="inside"?l:e[c];if(u&&t){let m=t&&h&&u.elementId===h.elementId;s||m?u={...u,mode:"inside"}:u={...u,mode:"orbit"};let g=n?0:e.points.length-1,f=Yt(e,d,u,t,o,!0);f&&a.set(g,{point:f})}if(h&&h.mode==="orbit"){let m=o.get(h.elementId);if(m&&Le(m)&&dn(r)){t&&h.elementId===t.id?h={...h,mode:"inside"}:h={...h,mode:"orbit"};let f=n?e.points.length-1:0,E=Yt(e,c,h,m,o);E&&a.set(f,{point:E})}}a.size>0&&U.movePoints(e,i,a,{[d]:u,[c]:h})},Dp=(e,t,n,o,i,r,s)=>{let a=U.getElement(e.elementId,t);if(!a||!Ke(a)||ee(a)||!e.hoveredFocusPointBinding||!e.draggedFocusPointBinding)return;let l=e.draggedFocusPointBinding==="start",d=l?a.startBinding:a.endBinding,{x:c,y:u}=e.pointerOffset,h=sl(n.x-c,n.y-u),m=l?"startBinding":"endBinding",g=Vd(h,a,o.getNonDeletedElements(),t,Ut(i.zoom));if(g&&dn(i)){a[m]&&g.id!==d?.elementId&&nt(a,e.draggedFocusPointBinding,o);let f=s&&a[m]?.mode==="orbit"?"inside":!s&&a[m]?.mode==="inside"?"orbit":null;(!a[m]||f)&&cn(a,g,f||"orbit",e.draggedFocusPointBinding,o,h),o.mutateElement(a,{[m]:{...a[m],elementId:g.id,mode:f||a[m]?.mode||"orbit",...No(a,g,e.draggedFocusPointBinding,t,h)}})}else{let f=new Map,E=l?0:a.points.length-1;f.set(E,{point:U.createPointAt(a,t,h[0],h[1],r)}),U.movePoints(a,o,f),a[m]&&nt(a,l?"start":"end",o)}j2(a,g,l,t,o,i,s),g&&dn(i)&&bi(h,a,o.getElementsIncludingDeleted(),t,o,g)},mv=(e,t,n,o)=>{let i=sl(t.origin.x,t.origin.y),r=yi*1.5/o.zoom.value;if(e.startBinding?.elementId){let s=n.get(e.startBinding.elementId);if(s&&Le(s)&&!s.isDeleted){let a=Qe(e.startBinding.fixedPoint,s,n);if(qr(a,e,s,n,o,"start")&&Yo(i,a)<=r)return{hitFocusPoint:"start",pointerOffset:{x:i[0]-a[0],y:i[1]-a[1]},arrowOtherEndpointInitialBinding:e.endBinding}}}if(e.endBinding?.elementId){let s=n.get(e.endBinding.elementId);if(s&&Le(s)&&!s.isDeleted){let a=Qe(e.endBinding.fixedPoint,s,n);if(qr(a,e,s,n,o,"end")&&Yo(i,a)<=r)return{hitFocusPoint:"end",pointerOffset:{x:i[0]-a[0],y:i[1]-a[1]},arrowOtherEndpointInitialBinding:e.startBinding}}}return{hitFocusPoint:null,pointerOffset:{x:0,y:0},arrowOtherEndpointInitialBinding:null}},fv=(e,t)=>{Lp(e.draggedFocusPointBinding,"Must have a dragged focus point at pointer release");let n=U.getElement(e.elementId,t.getNonDeletedElementsMap());Lp(n,"Arrow must be in the scene");let o=e.draggedFocusPointBinding==="start"?"startBinding":"endBinding",i=e.draggedFocusPointBinding==="start"?"endBinding":"startBinding",r=n[o]?.elementId,s=n[i]?.elementId,a=r&&t.getNonDeletedElements().find(d=>d.id!==r&&d.id!==s&&Le(d)&&d.boundElements?.find(({id:c})=>c===n.id));a&&t.mutateElement(a,{boundElements:a.boundElements?.filter(({id:d})=>d!==n.id)});let l=r&&t.getNonDeletedElementsMap().get(r);return l&&t.mutateElement(l,{boundElements:[...(l.boundElements||[])?.filter(({id:d})=>d!==n.id),{id:n.id,type:"arrow"}]}),{arrowOtherEndpointInitialBinding:null}},gv=(e,t,n,o,i)=>{let r=o.getNonDeletedElementsMap(),s=sl(t,n),a=yi*1.5/i.zoom.value;if(e.startBinding?.elementId){let l=r.get(e.startBinding.elementId);if(l&&Le(l)&&!l.isDeleted){let d=Qe(e.startBinding.fixedPoint,l,r);if(qr(d,e,l,r,i,"start")&&Yo(s,d)<=a)return"start"}}if(e.endBinding?.elementId){let l=r.get(e.endBinding.elementId);if(l&&Le(l)&&!l.isDeleted){let d=Qe(e.endBinding.fixedPoint,l,r);if(qr(d,e,l,r,i,"end")&&Yo(s,d)<=a)return"end"}}return null};S();var V2=e=>({x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}),Bp=(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}},X2=(e,t,n)=>n==="first"?Bp(e,t[0].boundingBox):t.reduce((i,r)=>i+Bp(e,r.boundingBox),0)/t.length,Y2=(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)}},wv=(e,t,n,o="average",i="size")=>{let s=Cr(t,n).map(d=>({group:d,boundingBox:it(d)}));if(s.length===0)return t;let a=X2(i,s,o),l=[];return s.forEach(d=>{let c=Y2(i,a,d.boundingBox);if(!Number.isFinite(c)||c<=0)return;let u=V2(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};S();var vv=(e,t,n,o=50)=>{if(!e||e.length===0)return[];let i=[],r=Array.isArray(e[0])?e:e.map(m=>[m]),s=r.length,a=Math.max(1,Math.ceil(Math.sqrt(s))),l=[];for(let m=0;m<s;m+=a)l.push(r.slice(m,m+a));let d=0,c=l.map(m=>{let g=0,f=0,E=m.map(x=>{let[y,b,M,w]=dt(x);return{elements:x,bounds:[y,b,M,w],width:M-y,height:w-b}});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[b,M]=y.bounds,w=x-b,v=h-M;y.elements.forEach(k=>{i.push(at(k,{x:k.x+w,y:k.y+v}))}),x+=y.width+o}),h+=E+o}),i};S();import{pointCenter as $2,normalizeRadians as Qr,pointFrom as Me,pointRotateRads as Qt}from"@excalidraw/math";import{MIN_FONT_SIZE as ll,SHIFT_LOCKING_ANGLE as Jr,rescalePoints as Gp,getFontString as Kr}from"@excalidraw/common";var Hv=(e,t,n,o,i,r,s,a,l,d,c)=>{let u=o.getNonDeletedElementsMap();if(n.length===1){let[h]=n;if(t==="rotation")ee(h)||(Z2(h,o,a,l,i),ot(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}=ex(g,f,t,a,l,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r});J2(E,x,g,f,e,o,t,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r})}}return pe(h)&&ot(h,o),!0}else if(n.length>1){if(t==="rotation")return K2(e,n,o,a,l,i,d,c),!0;if(t){let{nextWidth:h,nextHeight:m,flipByX:g,flipByY:f,originalBoundingBox:E}=tx(n,e,u,t,a,l,{shouldMaintainAspectRatio:s,shouldResizeFromCenter:r});return nx(n,u,t,o,e,{shouldResizeFromCenter:r,shouldMaintainAspectRatio:s,flipByX:g,flipByY:f,nextWidth:h,nextHeight:m,originalBoundingBox:E}),!0}}return!1},Z2=(e,t,n,o,i)=>{let[r,s,a,l]=ae(e,t.getNonDeletedElementsMap()),d=(r+a)/2,c=(s+l)/2,u;ce(e)?u=0:(u=5*Math.PI/2+Math.atan2(o-c,n-d),i&&(u=u+Jr/2,u=u-u%Jr),u=Qr(u));let h=Vt(e),m={angle:u};if(Ke(e)&&(m={...m},e.startBinding&&nt(e,"start",t),e.endBinding&&nt(e,"end",t)),t.mutateElement(e,m),h){let g=t.getElement(h);if(g&&!J(e)){let{x:f,y:E}=hi(e,g,t.getNonDeletedElementsMap());t.mutateElement(g,{angle:u,x:f,y:E})}}},Np=(e,t,n,o)=>le(e)||Ce(e)?{points:Gp(0,t,Gp(1,n,e.points,o),o)}:{},dl=(e,t,n)=>{let o=e.width;if(Ne(e)){let s=et(e,t);s&&(o=jt(s,e))}let r=e.fontSize*(n/o);return r<ll?null:{size:r}},q2=(e,t,n,o,i,r,s)=>{let a=n.getNonDeletedElementsMap(),l=t.width*(s/t.height),d=dl(t,a,l);if(d!==null){if(o.includes("n")||o.includes("s")){let c=Me(e.x,e.y),u=al(c,e.width,e.height,l,s,e.angle,o,!1,i);n.mutateElement(t,{fontSize:d.size,width:l,height:s,x:u.x,y:u.y});return}if(o==="e"||o==="w"){let c=sr(Kr({fontSize:t.fontSize,fontFamily:t.fontFamily}),t.lineHeight),u=Math.max(c,r),h=yn(t.originalText,Kr(t),Math.abs(u)),m=kt(h,Kr(t),t.lineHeight),g=m.height,f=Me(e.x,e.y),E=al(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)}}},K2=(e,t,n,o,i,r,s,a)=>{let l=n.getNonDeletedElementsMap(),d=5*Math.PI/2+Math.atan2(i-a,o-s);r&&(d+=Jr/2,d-=d%Jr);let c=new Map(t.map(u=>[u.id,u]));for(let u of t)if(!ce(u)){let[h,m,g,f]=ae(u,l),E=(h+g)/2,x=(m+f)/2,y=e.get(u.id)?.angle??u.angle,[b,M]=Qt(Me(E,x),Me(s,a),d+y-u.angle),w=ee(u)?{points:Ec(u,l)}:{x:u.x+(b-E),y:u.y+(M-x),angle:Qr(d+y)};n.mutateElement(u,w),ot(u,n,{simultaneouslyUpdated:t}),Ke(u)&&(u.startBinding&&(c.has(u.startBinding.elementId)||nt(u,"start",n)),u.endBinding&&(c.has(u.endBinding.elementId)||nt(u,"end",n)));let v=he(u,l);if(v&&!J(u)){let{x:k,y:T}=hi(u,v,l);n.mutateElement(v,{x:k,y:T,angle:Qr(d+y)})}}n.triggerUpdate()},_v=(e,t,n,o,i)=>{let[r,s,a,l]=t.length===1?ae(t[0],n):dt(t),d=(r+a)/2,c=(s+l)/2,u=t.length===1?t[0].angle:0;switch([o,i]=Qt(Me(o,i),Me(d,c),-u),e){case"n":return Qt(Me(o-(r+a)/2,i-s),Me(0,0),u);case"s":return Qt(Me(o-(r+a)/2,i-l),Me(0,0),u);case"w":return Qt(Me(o-r,i-(s+l)/2),Me(0,0),u);case"e":return Qt(Me(o-a,i-(s+l)/2),Me(0,0),u);case"nw":return Qt(Me(o-r,i-s),Me(0,0),u);case"ne":return Qt(Me(o-a,i-s),Me(0,0),u);case"sw":return Qt(Me(o-r,i-l),Me(0,0),u);case"se":return Qt(Me(o-a,i-l),Me(0,0),u);default:return[0,0]}},zv=(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"},Q2=(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"},al=(e,t,n,o,i,r,s,a,l)=>{let d=Q2(s,a,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)}}},J2=(e,t,n,o,i,r,s,{shouldInformMutation:a=!0,shouldMaintainAspectRatio:l=!1,shouldResizeFromCenter:d=!1}={})=>{if(pe(n)&&pe(o))return q2(o,n,r,s,d,e,t);let c={},u=r.getNonDeletedElementsMap(),h=he(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=dl(h,u,jt(x,h));if(y===null)return;c={fontSize:y.size}}else{let x=kd(Kr(h),h.lineHeight),y=Ad(h.fontSize,h.lineHeight);e=Math.max(e,x),t=Math.max(t,y)}}let m=Np(o,e,t,!0),g=Me(o.x,o.y);if(le(o)){let[E,x]=we(o,i);g=Me(E,x)}let f=al(g,o.width,o.height,e,t,o.angle,s,l,d);if(le(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],b=m.points[0][1];f.x+=y,f.y+=b,m.points=m.points.map(M=>Me(M[0]-y,M[1]-b))}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<ll)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};Ke(n)&&(n.startBinding&&(E={...E},n.startBinding&&nt(n,"start",r)),n.endBinding&&(E={...E,endBinding:null})),r.mutateElement(n,E,{informMutation:a,isDragging:!1}),h&&c!=null&&r.mutateElement(h,{fontSize:c.fontSize}),co(n,r,s,l,d),ot(n,r)}},ex=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:s=!1}={})=>{let[a,l,d,c]=Dn(t,t.width,t.height,!0),u=Me(a,l),h=Me(d,c),m=$2(u,h),g=Qt(Me(o,i),m,-t.angle),[f,E,x,y]=Dn(e,e.width,e.height,!0),b=x-f,M=y-E,w=h[0]-u[0],v=h[1]-u[1],k=w/b,T=v/M;n.includes("e")&&(k=(g[0]-u[0])/b),n.includes("s")&&(T=(g[1]-u[1])/M),n.includes("w")&&(k=(h[0]-g[0])/b),n.includes("n")&&(T=(h[1]-g[1])/M);let A=e.width*k,_=e.height*T;if(s&&(A=2*A-t.width,_=2*_-t.height),r){let D=Math.abs(A)/t.width,O=Math.abs(_)/t.height;if(n.length===1&&(_*=D,A*=O),n.length===2){let N=Math.max(D,O);A=t.width*N*Math.sign(A),_=t.height*N*Math.sign(_)}}return{nextWidth:A,nextHeight:_}},tx=(e,t,n,o,i,r,{shouldMaintainAspectRatio:s=!1,shouldResizeFromCenter:a=!1}={})=>{let l=e.map(N=>t.get(N.id)),d=l.reduce((N,W)=>{if(!le(W))return N;let j=Vt(W);if(!j)return N;let L=t.get(j)??null;return Ne(L)?[...N,{...L,...U.getBoundTextElementPosition(W,L,n)}]:N},[]),c=it(l.map(N=>N).concat(d)),{minX:u,minY:h,maxX:m,maxY:g,midX:f,midY:E}=c,x=m-u,y=g-h,b={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,w]=a?[f,E]:b[o],v=a?2:1,k=Math.max(Math.abs(i-M)/x||0,Math.abs(r-w)/y||0)*v,T=o.includes("e")||o.includes("w")?Math.abs(i-M)*v:x,A=o.includes("n")||o.includes("s")?Math.abs(r-w)*v:y;s&&(T=x*k*Math.sign(i-M),A=y*k*Math.sign(r-w));let _={ne:[i<M,r>w],se:[i<M,r<w],sw:[i>M,r<w],nw:[i>M,r>w],e:[i<M,!1],w:[i>M,!1],n:[!1,r>w],s:[!1,r<w]},[D,O]=_[o].map(N=>N);return{originalBoundingBox:c,nextWidth:T,nextHeight:A,flipByX:D,flipByY:O}},nx=(e,t,n,o,i,{shouldMaintainAspectRatio:r=!1,shouldResizeFromCenter:s=!1,flipByX:a=!1,flipByY:l=!1,nextHeight:d,nextWidth:c,originalBoundingBox:u}={})=>{if(c===void 0&&d===void 0&&a===void 0&&l===void 0||d===0||c===0)return;i||(i=t);let h=e.reduce((v,k)=>{let T=i.get(k.id);return T&&v.push({orig:T,latest:k}),v},[]),m;if(u)m=u;else{let v=h.reduce((k,{orig:T})=>{if(!le(T))return k;let A=Vt(T);if(!A)return k;let _=i.get(A)??null;return Ne(_)?[...k,{..._,...U.getBoundTextElementPosition(T,_,t)}]:k},[]);m=it([...h.map(({orig:k})=>k),...v])}let{minX:g,minY:f,maxX:E,maxY:x,midX:y,midY:b}=m,M=E-g,w=x-f;if(c===void 0&&d===void 0&&(c=M,d=w),r&&(c===void 0?c=d*(M/w):d===void 0?d=c*(w/M):Math.abs(c/d-M/w)>.001&&(c=d*(M/w))),c&&d){let v=n.includes("e")||n.includes("w")?Math.abs(c)/M:1,k=n.includes("n")||n.includes("s")?Math.abs(d)/w:1,T;n.length===1?T=n.includes("e")||n.includes("w")?v:k:T=Math.max(Math.abs(c)/M||0,Math.abs(d)/w||0);let A={ne:[g,x],se:[g,f],sw:[E,f],nw:[E,x],e:[g,f+w/2],w:[E,f+w/2],n:[g+M/2,x],s:[g+M/2,f]},[_,D]=s?[y,b]:A[n],O=r||h.some(I=>I.latest.angle!==0||pe(I.latest)||Bc(I.latest));O&&(v=T,k=T);let[N,W]=[a?-1:1,l?-1:1],j=[];for(let{orig:I,latest:C}of h){if(pe(I)&&Ne(I))continue;let G=I.width*v,z=I.height*k,Z=Qr(I.angle*N*W),$=le(I)||Ce(I),V=I.x-_,Y=I.y-D,ue=a&&!$?G:0,q=l&&!$?z:0,me=_+N*(V*v+ue),ke=D+W*(Y*k+q),ne=Np(I,G*N,z*W,!1),ie={x:me,y:ke,width:G,height:z,angle:Z,...ne};if(ee(I)&&(I.startBinding&&(ie.startBinding={...I.startBinding,fixedPoint:[a?-I.startBinding.fixedPoint[0]+1:I.startBinding.fixedPoint[0],l?-I.startBinding.fixedPoint[1]+1:I.startBinding.fixedPoint[1]]}),I.endBinding&&(ie.endBinding={...I.endBinding,fixedPoint:[a?-I.endBinding.fixedPoint[0]+1:I.endBinding.fixedPoint[0],l?-I.endBinding.fixedPoint[1]+1:I.endBinding.fixedPoint[1]]}),I.fixedSegments&&ne.points&&(ie.fixedSegments=I.fixedSegments.map(be=>({...be,start:ne.points[be.index-1],end:ne.points[be.index]})))),Ve(I)&&(ie.scale=[I.scale[0]*N,I.scale[1]*W]),pe(I)){let be=dl(I,t,G);if(!be)return;ie.fontSize=be.size}let Ie=i.get(Vt(I)??"");if(Ie)if(O){let be=Ie.fontSize*T;if(be<ll)return;ie.boundTextFontSize=be}else ie.boundTextFontSize=Ie.fontSize;j.push({element:C,update:ie})}let L=j.map(({element:I})=>I),B=new Map(j.map(({element:I})=>[I.id,I]));for(let{element:I,update:{boundTextFontSize:C,...G}}of j){let{angle:z}=G;o.mutateElement(I,G),ot(I,o,{simultaneouslyUpdated:L}),Ke(I)&&(I.startBinding&&(B.has(I.startBinding.elementId)||nt(I,"start",o)),I.endBinding&&(B.has(I.endBinding.elementId)||nt(I,"end",o)));let Z=he(I,t);Z&&C&&(o.mutateElement(Z,{fontSize:C,angle:le(I)?void 0:z}),co(I,o,n,!0,s))}o.triggerUpdate()}};S();import{pointFrom as Nt,pointOnLineSegment as zp,pointRotateRads as ts}from"@excalidraw/math";import{SIDE_RESIZING_THRESHOLD as fl}from"@excalidraw/common";S();import{DEFAULT_TRANSFORM_HANDLE_SPACING as ul}from"@excalidraw/common";import{pointFrom as Op,pointRotateRads as ox}from"@excalidraw/math";var Rp={mouse:8,pen:16,touch:28},ix=16,Hp={e:!0,s:!0,n:!0,w:!0},$v={e:!0,s:!0,n:!0,w:!0},Zv={e:!0,s:!0,n:!0,w:!0,rotation:!0},Fp={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},cl={e:!0,s:!0,n:!0,w:!0},kn=(e,t,n,o,i,r,s)=>{let[a,l]=ox(Op(e+n/2,t+o/2),Op(i,r),s);return[a-n/2,l-o/2,n,o]},es=e=>!(e.formFactor==="phone"&&e.userAgent.isMobileDevice),pl=e=>es(e)?Hp:{},hl=([e,t,n,o,i,r],s,a,l,d={},c=4,u=ul)=>{let h=Rp[l],m=h/a.value,g=h/a.value,f=h/a.value,E=h/a.value,x=n-e,y=o-t,b=c/a.value,M=(h-u*2)/(2*a.value),w={nw:d.nw?void 0:kn(e-b-f+M,t-b-E+M,m,g,i,r,s),ne:d.ne?void 0:kn(n+b-M,t-b-E+M,m,g,i,r,s),sw:d.sw?void 0:kn(e-b-f+M,o+b-M,m,g,i,r,s),se:d.se?void 0:kn(n+b-M,o+b-M,m,g,i,r,s),rotation:d.rotation?void 0:kn(e+x/2-m/2,t-b-E+M-ix/a.value,m,g,i,r,s)},v=5*Rp.mouse/a.value;return Math.abs(x)>v&&(d.n||(w.n=kn(e+x/2-m/2,t-b-E+M,m,g,i,r,s)),d.s||(w.s=kn(e+x/2-m/2,o+b-M,m,g,i,r,s))),Math.abs(y)>v&&(d.w||(w.w=kn(e-b-f+M,t+y/2-g/2,m,g,i,r,s)),d.e||(w.e=kn(n+b-M,t+y/2-g/2,m,g,i,r,s))),w},_p=(e,t,n,o="mouse",i=Hp)=>{if(e.locked||ee(e))return{};if(e.type==="freedraw"||le(e)){if(e.points.length===2){let[,s]=e.points;s[0]===0||s[1]===0?i=cl:s[0]>0&&s[1]<0?i=Fp:s[0]>0&&s[1]>0?i=cl:s[0]<0&&s[1]>0?i=Fp:s[0]<0&&s[1]<0&&(i=cl)}}else ce(e)&&(i={...i,rotation:!0});let r=le(e)?ul+8:Ve(e)?0:ul;return hl(ae(e,n,!0),e.angle,t,o,i,r,Ve(e)?0:void 0)},qv=(e,t,n)=>{if(t.selectedLinearElement?.isEditing||t.selectedLinearElement?.isDragging)return!1;if(e.length>1)return!0;let o=e[0];return ee(o)?!1:le(o)?o.points.length>2&&!n.userAgent.isMobileDevice:!0};var gl=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],rx=(e,t,n,o,i,r,s,a)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:l,...d}=_p(e,r,t,s,pl(a));if(l&&gl(l,o,i))return"rotation";let c=Object.keys(d).filter(u=>{let h=d[u];return h?gl(h,o,i):!1});if(c.length>0)return c[0];if(es(a)){let[u,h,m,g,f,E]=ae(e,t);if(!(le(e)&&e.points.length<=2)){let x=Ve(e)?0:fl/r.value,y=fl/r.value,b=Wp(Nt(u-x,h-x),Nt(m+x,g+x),Nt(f,E),e.angle);for(let[M,w]of Object.entries(b))if(zp(Nt(o,i),w,y))return M}}return!1},i8=(e,t,n,o,i,r,s,a)=>e.reduce((l,d)=>{if(l)return l;let c=rx(d,s,t,n,o,i,r,a);return c?{element:d,transformHandleType:c}:null},null),r8=([e,t,n,o],i,r,s,a,l)=>{let d=hl([e,t,n,o,(e+n)/2,(t+o)/2],0,s,a,pl(l)),c=Object.keys(d).find(u=>{let h=d[u];return h&&gl(h,i,r)});if(c)return c;if(es(l)){let u=(e+n)/2,h=(t+o)/2,m=fl/s.value,g=Wp(Nt(e-m,t-m),Nt(n+m,o+m),Nt(u,h),0);for(let[f,E]of Object.entries(g))if(zp(Nt(i,r),E,m))return f}return!1},ml=["ns","nesw","ew","nwse"],sx=(e,t)=>{let n=ml.indexOf(e);if(n>=0){let o=Math.round(t/(Math.PI/4));e=ml[(n+o)%ml.length]}return e},s8=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=sx(i,t.angle)),i?`${i}-resize`:""},Wp=([e,t],[n,o],i,r)=>{let s=ts(Nt(e,t),i,r),a=ts(Nt(n,t),i,r),l=ts(Nt(e,o),i,r),d=ts(Nt(n,o),i,r);return{n:[s,a],e:[a,d],s:[d,l],w:[l,s]}};S();import{KEYS as Ot}from"@excalidraw/common";S();S();function Up(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=Up(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function jp(){for(var e=0,t,n,o="";e<arguments.length;)(t=arguments[e++])&&(n=Up(t))&&(o&&(o+=" "),o+=n);return o}var Re=Bi(ih(),1),p=Bi(Pl(),1);import{THEME as Ix}from"@excalidraw/common";var Jt=e=>"var(--icon-fill-color)",lh=e=>e===Ix.LIGHT?"#fff":"#1e1e1e",P=(e,t=512)=>{let{width:n=512,height:o=n,mirror:i,style:r,...s}=typeof t=="number"?{width:t}:t;return(0,p.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${o}`,className:jp({"rtl-mirror":i}),style:r,...s,children:typeof e=="string"?(0,p.jsx)("path",{fill:"currentColor",d:e}):e})},R={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},te={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},pt={width:40,height:20},w8=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"})]}),R),M8=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"})]}),R),P8=P("M320 112C434.9 112 528 205.1 528 320C528 434.9 434.9 528 320 528C205.1 528 112 434.9 112 320C112 205.1 205.1 112 320 112zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM288 248C288 234.7 277.3 224 264 224C250.7 224 240 234.7 240 248L240 392C240 405.3 250.7 416 264 416C277.3 416 288 405.3 288 392L288 248zM400 248C400 234.7 389.3 224 376 224C362.7 224 352 234.7 352 248L352 392C352 405.3 362.7 416 376 416C389.3 416 400 405.3 400 392L400 248z",640),I8=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"})]}),R),S8=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"})]}),R),v8=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"})]}),R),k8=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"})]}),R),A8=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"})})]}),te),T8=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"})]}),te),C8=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}),L8=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"}),D8=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"}),B8=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"}),G8=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"}),Il=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}),N8=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}),dh=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"})]}),R),ch=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"})]}),R),uh=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"})]}),R),ph=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"})]}),R),hh=P((0,p.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),te),O8=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"})]}),R),mh=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"})]}),te),fh=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"})]}),R),R8=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"})]}),R),gh=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"})]}),te),Eh=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"})]}),R),F8=P((0,p.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),te),H8=P((0,p.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),te),_8=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"})]}),R),z8=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"}),te),W8=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"})]}),te),U8=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"})]}),te),j8=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"}),te),V8=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"})}),{...te,strokeWidth:1.5}),X8=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"})]}),R),Y8=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"}),te),$8=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"})]}),R),Z8=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"})]}),R),q8=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"}),te),K8=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"}),te),Q8=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"})]}),te),J8=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"})]}),R),e7=P((0,p.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),t7=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"})]}),te),n7=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}),o7=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}),i7=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"}),te),r7=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}),s7=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"),Sx=["M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z","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","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"],a7=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Sx.map(e=>(0,p.jsx)("path",{d:e},e))]}),R),l7=P((0,p.jsx)("g",{strokeWidth:1.5,children:(0,p.jsx)("path",{d:"M6 18l12 -12"})}),R),d7=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"})]}),R),c7=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}),u7=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}),p7=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}),h7=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"),m7=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"),f7=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"}),te),g7=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"}),te),E7=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}),x7=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"}),te),y7=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"),b7=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}),w7=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"})]}),R),M7=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}),P7=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}),xh=(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"})]}),yh=(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"})]}),I7=P(yh,R),S7=P(yh,{...R,style:{transform:"rotate(180deg)"}}),v7=P(xh,R),k7=P(xh,{...R,style:{transform:"rotate(180deg)"}}),A7=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"})})})]}),te),T7=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"})})})]}),te),C7=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"})})})]}),te),L7=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"})})})]}),te),D7=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"})})})]}),te),B7=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"})})})]}),te),G7=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"})]}),te),N7=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"})]}),te),O7=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"})]}),R),R7=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"),F7=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"),H7=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"})})})]}),te),_7=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}),z7=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}),W7=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}),U7=Re.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:Jt(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:Jt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:Jt(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:Jt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:lh(e),stroke:Jt(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})),j7=Re.default.memo(({theme:e})=>P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M25 26H111V111H25",fill:Jt(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:Jt(e),strokeWidth:"2"}),(0,p.jsx)("path",{d:"M100 100H160V160H100",fill:Jt(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:Jt(e),strokeWidth:"2"}),(0,p.jsxs)("g",{fill:lh(e),stroke:Jt(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})),V7=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"})}),te),X7=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"})})]}),te),Y7=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"})})})]}),te),$7=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"})})})]}),{...te,fill:"currentColor"}),Z7=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"})}),te),q7=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),te),K7=P((0,p.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),te),Q7=Re.default.memo(({theme:e})=>P((0,p.jsx)("path",{d:"M6 10H34",stroke:Jt(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),J7=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"})]}),R),ek=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"})]}),R),tk=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"}),te),nk=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"}),te),ok=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"}),te),ik=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]}),R),rk=P((0,p.jsxs)("g",{children:[(0,p.jsx)("path",{d:"M4 12 C 5 8, 6 8, 8 12",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8 12 C 9 16, 10 16, 12 12",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M12 12 C 14 8, 15 8, 16 12",fill:"none",strokeWidth:"2.75",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M16 12 C 17 16, 18 16, 19 12",fill:"none",strokeWidth:"3.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),R),sk=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"})]}),te),ak=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"})]}),R),lk=Re.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"})]}),pt)),dk=Re.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"})}),pt)),ck=Re.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"})]}),pt)),uk=Re.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"})]}),pt)),pk=Re.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"})]}),pt)),hk=Re.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"})]}),pt)),mk=Re.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"})]}),pt)),fk=Re.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"})]}),pt)),gk=Re.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"})}),pt)),Ek=Re.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"})}),pt)),xk=Re.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"})}),pt)),yk=Re.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"})}),pt)),bk=Re.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"})}),pt)),wk=Re.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"})]}),pt)),Mk=Re.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"})]}),pt)),Pk=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"})})})]}),te),Ik=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"})})})]}),te),Sk=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"})})})]}),te),vk=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"})}),te),kk=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"})]}),R),Ak=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"})]})}),R),Tk=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"})})}),te),Ck=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"})]}),R);var Lk=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"})]}),R),Dk=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"})]}),R),Bk=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"})]}),R),Gk=Re.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"})]}),R)),Nk=Re.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"})]}),R)),Ok=Re.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"})]}),R)),Rk=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"})]}),R),Fk=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}),Hk=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"})),_k=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"})]}),R),zk=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"})]}),R),Wk=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"})]}),R),Uk=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"})]}),R),jk=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"})]}),R),Vk=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"})]}),R),Xk=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"})]}),R),Yk=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M7 5v14"}),(0,p.jsx)("path",{d:"M19 6l-9 6l9 6z"})]}),R),$k=P((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("path",{d:"M17 5v14"}),(0,p.jsx)("path",{d:"M5 6l9 6l-9 6z"})]}),R),Zk=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 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10a1 1 0 0 1 1 -1z"}),(0,p.jsx)("path",{d:"M7 6v12"}),(0,p.jsx)("path",{d:"M17 6v12"}),(0,p.jsx)("path",{d:"M3 10h4"}),(0,p.jsx)("path",{d:"M3 14h4"}),(0,p.jsx)("path",{d:"M17 10h4"}),(0,p.jsx)("path",{d:"M17 14h4"})]}),R),qk=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"})]}),R),Kk=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"})]}),R),vx=["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","M11 7l6 6"],Qk=P((0,p.jsxs)("g",{strokeWidth:1.25,children:[(0,p.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),vx.map(e=>(0,p.jsx)("path",{d:e},e))]}),R),Jk=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"})]}),R),eA=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"})]}),R),tA=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"})]}),R),nA=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"})]}),te),oA=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 9.5a6.5 6.5 0 1 0 13 0a6.5 6.5 0 1 0 -13 0"}),(0,p.jsx)("path",{d:"M10 12a2 2 0 0 1 2 -2h7a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2l0 -7"})]}),R),iA=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),rA=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"})]}),R),sA=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"})]}),R),aA=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"})]}),R),lA=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"})]}),R),dA=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"})]}),R),cA=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"})]}),R),uA=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"})]}),R),pA=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"})]}),R),hA=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"})]}),R),mA=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"})]}),R),fA=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"})]}),R),gA=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"})]}),R),EA=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"})]}),R),xA=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"})]}),R),yA=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"})]}),R),bA=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"})]}),R),wA=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"})]}),R),MA=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"})]}),R),PA=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"})]}),R),IA=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"})]}),R),SA=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"})]}),R),vA=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"})]}),R),kA=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"})]}),R),AA=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"})]}),R),TA=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"})]}),{...R,strokeWidth:1.5}),CA=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"})]}),R),LA=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"})]}),R),DA=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"})]}),R),BA=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"})]}),R),GA=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"})]}),R),NA=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"})]}),R),OA=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"})]}),R),RA=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"})]}),R),FA=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"})]}),R),HA=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"})]}),R),_A=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"})]}),R),zA=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"})]}),R),WA=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"})]}),R),UA=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"})]}),R),jA=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"})]}),R),VA=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"})})),XA=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"})]}),R),YA=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"})]}),R),$A=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"})]}),R),ZA=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"})]}),R),qA=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"})]}),R),KA=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"})]}),R),QA=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"})]}),R);var JA=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:"6 9 12 15 18 9"})]}),R),eT=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"})]}),R),tT=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"})]}),R);var bh=[{icon:Il,value:"selection",key:Ot.V,numericKey:void 0,fillable:!0,myocSimplifiedMode:!0},{icon:dh,value:"rectangle",key:Ot.R,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:ch,value:"diamond",key:Ot.D,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:uh,value:"ellipse",key:Ot.O,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:ph,value:"arrow",key:Ot.A,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:hh,value:"line",key:Ot.L,numericKey:void 0,fillable:!0,myocSimplifiedMode:!1},{icon:mh,value:"freedraw",key:[Ot.P,Ot.X],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:fh,value:"text",key:Ot.T,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:gh,value:"image",key:[Ot.I],numericKey:void 0,fillable:!1,myocSimplifiedMode:!0},{icon:Eh,value:"eraser",key:Ot.E,numericKey:void 0,fillable:!1,myocSimplifiedMode:!0}],kx=e=>e.state.preferredSelectionTool.type==="lasso"?[{value:"lasso",icon:Il,key:Ot.V,fillable:!0,myocSimplifiedMode:!0},...bh.slice(1)]:bh,dT=(e,t)=>kx(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,cT=(e,t)=>{let n=he(e,t);return n?e.type==="arrow"?Ai({...n,...U.getBoundTextElementPosition(e,n,t)},t):Ai(n,t):null};S();var mT=(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")||un(t,e).length));S();import{pointFrom as is}from"@excalidraw/math";import{DEFAULT_FONT_FAMILY as Ax,DEFAULT_FONT_SIZE as Tx,TEXT_ALIGN as Cx,VERTICAL_ALIGN as Lx,getSizeFromPoints as Dx,randomId as Bx,arrayToMap as Gx,assertNever as Sl,cloneJSON as Mh,getFontString as Nx,isDevEnv as Ox,toBrandedType as Rx,getLineHeight as Fx}from"@excalidraw/common";var rs={width:100,height:0},to=100,Hx=(e,t,n)=>{let o=yo({x:0,y:0,textAlign:Cx.CENTER,verticalAlign:Lx.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:o.id})}),cr(o,e,n),[e,o]},wh=(e,t,n,o,i)=>{let r,s;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let c=t?.width??to,u=t?.height??to,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=yo({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=_o({x:m,y:g,width:c,height:u,...h,...t,type:f});break}default:Sl(e,`Unhandled element start type "${t.type}"`,!0)}cn(e,r,"orbit","start",i)}}if(n){let c=n?.height??to,u=n?.width??to,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}`),s=yo({x:m,y:g,type:"text",...h,...n,text:E}),Object.assign(s,{y:n.y||e.y-s.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{s=_o({x:m,y:g,width:u,height:c,...h,...n,type:f});break}default:Sl(e,`Unhandled element end type "${f}"`,!0)}cn(e,s,"orbit","end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:r,endBoundElement:s};let a=e.points.length-1,l=.5,d=Mh(e.points);return e.points[a][0]>e.points[a-1][0]&&(d[0][0]=l,d[a][0]-=l),e.points[a][0]<e.points[a-1][0]&&(d[0][0]=-l,d[a][0]+=l),e.points[a][1]>e.points[a-1][1]&&(d[0][1]=l,d[a][1]-=l),e.points[a][1]<e.points[a-1][1]&&(d[0][1]=-l,d[a][1]+=l),Object.assign(e,U.getNormalizeElementPointsAndCoords({...e,points:d})),{linearElement:e,startBoundElement:r,endBoundElement:s}},vl=class{excalidrawElements=new Map;add=t=>{t&&this.excalidrawElements.set(t.id,t)};getElements=()=>ha(Array.from(this.excalidrawElements.values()));getElementsMap=()=>Rx(Gx(this.getElements()));getElement=t=>this.excalidrawElements.get(t)},AT=(e,t)=>{if(!e)return[];let n=Mh(e),o=new vl,i=new Map,r=new Map;for(let l of n){let d,c=l.id;switch(t?.regenerateIds!==!1&&Object.assign(l,{id:Bx()}),l.type){case"rectangle":case"ellipse":case"diamond":{let h=l?.label?.text&&l.width===void 0?0:l?.width||to,m=l?.label?.text&&l.height===void 0?0:l?.height||to;d=_o({...l,width:h,height:m});break}case"line":{let h=l.width||rs.width,m=l.height||rs.height;d=Fu({width:h,height:m,points:[is(0,0),is(h,m)],...l});break}case"arrow":{let h=l.width||rs.width,m=l.height||rs.height;d=Wr({width:h,height:m,endArrowhead:"arrow",points:[is(0,0),is(h,m)],...l,type:"arrow"}),Object.assign(d,Dx(d.points));break}case"text":{let h=l?.fontFamily||Ax,m=l?.fontSize||Tx,g=l?.lineHeight||Fx(h),f=l.text??"",E=pi(f),x=kt(E,Nx({fontFamily:h,fontSize:m}),g);d=yo({width:x.width,height:x.height,fontFamily:h,fontSize:m,...l});break}case"image":{d=Hu({width:l?.width||to,height:l?.height||to,...l});break}case"frame":{d=Nu({x:0,y:0,...l});break}case"magicframe":{d=Ou({x:0,y:0,...l});break}case"freedraw":case"iframe":case"embeddable":{d=l;break}default:d=l,Sl(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 s=o.getElementsMap(),a=new Xo(s);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]=Hx(c,d?.label,a);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}=wh(u,m,g,o,a);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}=wh(c,u,h,o,a);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(w=>{let v=r.get(w);if(!v)throw new Error(`Element with ${w} wasn't mapped correctly`);let k=o.getElement(v);if(!k)throw new Error(`Frame element with id ${v} doesn't exist`);Object.assign(k,{frameId:c.id}),k?.boundElements?.forEach(T=>{let A=o.getElement(T.id);if(!A)throw new Error(`Bound element with id ${T.id} doesn't exist`);Object.assign(A,{frameId:c.id}),u.push(A)}),u.push(k)});let[h,m,g,f]=dt(u),E=10;h=h-E,m=m-E,g=g+E,f=f+E;let x=c?.x||h,y=c?.y||m,b=c?.width||g-h,M=c?.height||f-m;Object.assign(c,{x,y,width:b,height:M}),Ox()&&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()};S();var BT=({app:e,event:t})=>{let n=e.state;if(n.selectedLinearElement&&e.lastPointerMoveCoords){if(n.selectedLinearElement.draggedFocusPointBinding)return Dp(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 U.handlePointDragging(e.lastPointerMoveEvent,e,e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y,n.selectedLinearElement),!0}return!1};S();var _x=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}},OT=e=>{let t=_x(e);return t===null?null:t};S();import{getBoundsFromPoints as vh,getElementAbsoluteCoords as zx}from"@excalidraw/element/bounds";import{newArrowElement as Ph,newElement as Wx,newLinearElement as ss}from"@excalidraw/element/newElement";import{ELEMENT_PENDING_DRAW_SHAPE_OPACITY as Ux,getStrokeWidthByKey as as,ROUNDNESS as Ih}from"@excalidraw/common";import{convexHull as jx,distanceToLineSegment as Vx,elongation as Xx,kurtosis as Sh,lineSegment as Yx,orientPrincipalAxes as $x,pointFrom as ht,polygonArea as Zx,principalAxes as qx,principalCoords as Kx,skewness as Qx}from"@excalidraw/math";var Jx=64,ey=25,ty=.15,ny=.25,oy=.5,iy=.15,ry=.3,sy=1.5,qo=3;function ay(e,t){let n=0;for(let a=1;a<e.length;a++)n+=Math.hypot(e[a][0]-e[a-1][0],e[a][1]-e[a-1][1]);let o=n/(t-1),i=0,r=[e[0]],s=e[0];for(let a=1;a<e.length;a++){let l=e[a],d=Math.hypot(l[0]-s[0],l[1]-s[1]);if(i+d>=o){let c=o-i;for(;c<=d+1e-10;){let u=c/d,h=[s[0]+u*(l[0]-s[0]),s[1]+u*(l[1]-s[1])];if(r.push(h),r.length===t)return r;s=h,i=0,c+=o}i=d-(c-o)}else i+=d;s=l}for(;r.length<t;)r.push(e[e.length-1]);return r}function ly(e){let t=e[0],n=t,o=0;for(let s of e){let a=Math.hypot(s[0]-t[0],s[1]-t[1]);a>o&&(o=a,n=s)}if(o===0)return 0;let i=Yx(t,n),r=0;for(let s of e)Math.hypot(s[0]-n[0],s[1]-n[1])<=oy*o||(r=Math.max(r,Vx(s,i)));return r/o}function dy(e){let t=[];for(let n=qo;n<e.length-qo;n++){let[o,i]=e[n-qo],[r,s]=e[n],[a,l]=e[n+qo],d=r-o,c=s-i,u=a-r,h=l-s;t.push(Math.abs(Math.atan2(d*h-c*u,d*u+c*h)))}return t}function cy(e){let t=dy(e),n=t.reduce((r,s)=>r+s,0);if(n===0)return 0;let o=new Array(t.length).fill(!1),i=0;for(let r=0;r<4;r++){let s=-1,a=0;for(let l=0;l<t.length;l++)!o[l]&&t[l]>a&&(a=t[l],s=l);if(s<0)break;for(let l=s-qo;l<=s+qo;l++)l>=0&&l<t.length&&!o[l]&&(i+=t[l],o[l]=!0)}return i/n}function uy(e){let t=ay(e,Jx),n=0;for(let h=1;h<t.length;h++)n+=Math.hypot(t[h][0]-t[h-1][0],t[h][1]-t[h-1][1]);let o=Math.hypot(t[t.length-1][0]-t[0][0],t[t.length-1][1]-t[0][1]),i=$x(t,qx(t)),r=Kx(t,i).map(([h])=>h),s=jx(t),[a,l,d,c]=vh(t),u=(d-a)*(c-l);return{gapRatio:n>0?o/n:0,elongation:Xx(i),majorSkew:Qx(r),hullFillRatio:u>0?Zx(s)/u:0,cornerTurnShare:cy(t),kurtosisProduct:Sh(t.map(([h])=>h))*Sh(t.map(([,h])=>h)),shaftDeviationRatio:ly(t)}}var py=[{type:"rectangle",hullFillRatio:1,cornerTurnShare:.95,kurtosisProduct:1.83},{type:"diamond",hullFillRatio:.5,cornerTurnShare:.95,kurtosisProduct:3.24},{type:"ellipse",hullFillRatio:Math.PI/4,cornerTurnShare:.55,kurtosisProduct:2.25}],hy=.2,my=.2,fy=.7;function gy(e){let t="freedraw",n=sy;for(let o of py){let i=Math.hypot((e.hullFillRatio-o.hullFillRatio)/hy,(e.cornerTurnShare-o.cornerTurnShare)/my,(e.kurtosisProduct-o.kurtosisProduct)/fy);i<n&&(n=i,t=o.type)}return t}function Ey(e){return e.elongation>ny||e.shaftDeviationRatio>iy?"freedraw":Math.abs(e.majorSkew)>=ry?"arrow":"line"}function xy(e){return e.gapRatio>ty?Ey(e):gy(e)}function yy(e,t,n){let[o,i,r,s]=t,a=r-o,l=s-i;if(a===0&&l===0)return e[e.length-1];let d=[ht(o,i),ht((o+r)/2,i),ht(r,i),ht(r,(i+s)/2),ht(r,s),ht((o+r)/2,s),ht(o,s),ht(o,(i+s)/2)],c=-1,u=ht(r,s);for(let g of d){let f=Math.hypot(g[0]-n[0],g[1]-n[1]);f>c&&(c=f,u=g)}let h=1/0,m=e[e.length-1];for(let g of e){let f=Math.hypot(g[0]-u[0],g[1]-u[1]);f<h&&(h=f,m=g)}return m}var by=(e,t,n=1)=>{typeof window<"u"&&(window.LAST_POINTS=e.map(([u,h])=>ht(u,h)));let o=vh(e),[i,r,s,a]=o,l=Math.max(s-i,a-r);if(e.length<3||l*n<ey)return{type:"freedraw",points:e,boundingBox:o};let d=xy(uy(e));return{type:t?.type==="arrow"&&d!=="arrow"?"freedraw":d,points:e,boundingBox:o}},wy=(e,t,n,o,i)=>{let r=by(e,o,t.zoom.value),s=r.boundingBox,[a,l,d,c]=s,h=(i??Ea([...n.values()])).find(g=>{let[f,E,x,y]=zx(g,n);return f<=a&&E<=l&&x>=d&&y>=c})?.id??null,m=t.currentItemRoundness==="round"?{type:nr(r.type)?Ih.ADAPTIVE_RADIUS:Ih.PROPORTIONAL_RADIUS}:null;switch(r.type){case"rectangle":case"diamond":case"ellipse":return Wx({type:r.type,x:r.boundingBox[0],y:r.boundingBox[1],width:r.boundingBox[2]-r.boundingBox[0],height:r.boundingBox[3]-r.boundingBox[1],groupIds:[],angle:0,frameId:h,roundness:m,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:as(r.type,t.currentItemStrokeWidthKey)});case"arrow":{let[g,f]=r.points[0],[E,x]=yy(r.points,r.boundingBox,r.points[0]),y=ht(E-g,x-f);if(Math.hypot(E-r.points[0][0],x-r.points[0][1])<60){let v=ss({type:"line",x:g,y:f,points:[ht(r.points[0][0]-g,r.points[0][1]-f),y],groupIds:[],frameId:h,locked:!1,angle:0,roundness:m,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:as(r.type,t.currentItemStrokeWidthKey)}),k=U.getNormalizeElementPointsAndCoords(v);return ss({...v,...k})}let M=Ph({type:"arrow",x:g,y:f,startArrowhead:t.currentItemStartArrowhead,endArrowhead:t.currentItemEndArrowhead,points:[ht(r.points[0][0]-g,r.points[0][1]-f),y],groupIds:[],frameId:h,locked:!1,angle:0,roundness:m,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:as(r.type,t.currentItemStrokeWidthKey)}),w=U.getNormalizeElementPointsAndCoords(M);return Ph({...M,...w})}case"line":{let[g,f]=r.points[0],E=r.points[r.points.length-1],x=ss({type:r.type,x:g,y:f,points:[ht(r.points[0][0]-g,r.points[0][1]-f),ht(E[0]-g,E[1]-f)],groupIds:[],frameId:h,locked:!1,angle:0,roundness:m,roughness:t.currentItemRoughness,backgroundColor:t.currentItemBackgroundColor,strokeColor:t.currentItemStrokeColor,fillStyle:t.currentItemFillStyle,opacity:t.currentItemOpacity,strokeStyle:t.currentItemStrokeStyle,strokeWidth:as(r.type,t.currentItemStrokeWidthKey)}),y=U.getNormalizeElementPointsAndCoords(x);return ss({...x,...y})}}},My=(e,t)=>{if(!e||e.type!==t.type||e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height||e.angle!==t.angle)return!1;if(le(e)&&le(t)){if(e.points.length!==t.points.length)return!1;for(let n=0;n<e.points.length;n++)if(e.points[n][0]!==t.points[n][0]||e.points[n][1]!==t.points[n][1])return!1}return!0},XT=(e,t)=>{if(e.state.activeTool.type==="autoshape"){e.drawShape.trail.addPointToPath(t.x,t.y);let n=e.drawShape.trail.getCurrentPoints();if(n.length>=3){let o=wy(n,e.state,e.scene.getNonDeletedElementsMap(),e.state.newElement,e.scene.getNonDeletedFramesLikes());if(o&&!Xe(o)){let i=e.state.newElement,r={...o,id:i?.type===o.type?i.id:o.id,seed:1,opacity:Ux,isDeleted:!1};My(i,r)||e.setState({newElement:r})}else e.state.newElement!==null&&e.setState({newElement:null})}return!0}return!1};var KT=e=>e.reduce((t,n)=>t+n.version,0),op=e=>{let t=5381;for(let n of Py(e))t=(t<<5)+t+n.versionNonce;return t>>>0},ip=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},rt=e=>!e.isDeleted,QT=e=>e.filter(t=>rt(t)&&!Au(t)),Xn=e=>e.filter(rt);export{qn as AppStateDelta,nf as BASE_ARROW_MIN_LENGTH,uc as BASE_BINDING_GAP,uo as BASE_BINDING_GAP_ELBOW,ye as BASE_PADDING,zn as BindableElement,_n as BoundElement,Pt as CaptureUpdateAction,aE as DEFAULT_BUCKET_FILL_OPTIONS,EM as DEFAULT_LINK_SIZE,Hp as DEFAULT_OMIT_SIDES,oe as Delta,qa as DurableIncrement,Ha as ElementBounds,Kn as ElementsDelta,Ka as EphemeralIncrement,yi as FOCUS_POINT_SIZE,Tp as FlowChartCreator,Ap as FlowChartNavigator,We as HEADING_DOWN,Ye as HEADING_LEFT,Se as HEADING_RIGHT,st as HEADING_UP,Pg as INVISIBLY_SMALL_ELEMENT_SIZE,ua as InvalidFractionalIndexError,U as LinearElementEditor,qe as MINIMAL_CROP_SIZE,Zv as OMIT_SIDES_FOR_FRAME,$v as OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,bh as SHAPES,Xo as Scene,Ct as ShapeCache,ep as Store,Di as StoreChange,Qa as StoreDelta,Yr as StoreIncrement,Qn as StoreSnapshot,bt as aabbForElement,Tf as addElementsToFrame,q4 as addToGroup,EP as alignElements,AP as arrangeElements,cf as avoidRectangularCorner,cn as bindBindingElement,Y6 as bindBindingElementToFixedPoint,Mc as bindElementsToFramesAfterDuplication,of as bindOrUnbindBindingElement,U6 as bindOrUnbindBindingElements,ia as bindPointToSnapToElementOutline,gc as bindingProperties,xa as boundsContainBounds,ic as bumpVersion,hf as calculateFixedPointForElbowArrowBinding,No as calculateFixedPointForNonElbowArrowBinding,Rw as canApplyRoundnessTypeToElement,gd as canBecomePolygon,Bd as canChangeRoundness,w2 as canCreateLinkFromElements,U3 as canHaveArrowheads,es as canResizeFromSides,Ao as charWidth,Pe as compareHeading,hi as computeBoundTextPosition,mI as computeBucketFillPolygon,Rs as computeContainerDimensionForBoundText,F5 as configureGifWorkerUrl,p3 as containsCJK,AT as convertToExcalidrawElements,wy as convertToShape,XT as convertToShapeHandlePointerMoveFromPointerDown,H5 as createGifPlaybackMetadata,WS as createPlaceholderEmbeddableLabel,nl as createSrcDoc,Tw as cropElement,I0 as decodeGifFrames,nu as decodeGifFramesQueued,Gn as deconstructDiamondElement,ao as deconstructLinearOrFreeDrawElement,Bn as deconstructRectanguloidElement,Za as deepCopyElement,LS as defaultGetElementLinkFromSelection,r3 as detectLineHeight,rn as distanceToElement,mS as distributeElements,Tt as doBoundsIntersect,vS as dragNewElement,b2 as dragNewTextElement,IS as dragSelectedElements,au as drawGifDecodePlaceholder,CE as duplicateElement,CI as duplicateElements,Z4 as editGroupForSelectedElement,fe as elementCenterPoint,Wn as elementOverlapsWithFrame,Ii as elementWithCanvasCache,jn as elementsAreInFrameBounds,Dc as elementsAreInSameGroup,Tc as elementsOverlappingBBox,jS as embeddableURLValidator,Hf as excludeElementsInFramesFromSelection,M4 as filterElementsEligibleAsFrameChildren,dT as findShapeByKey,V6 as fixBindingsAfterDeletion,fc as fixDuplicatedBindingsAfterDuplication,$s as flipHeading,A4 as frameAndChildrenSelectedTogether,Pd as generateLinearCollisionShape,Mt as generateRoughOptions,$5 as generateThumbHash,U4 as getActiveTextElement,pr as getAllHoveredElementAtPoint,Ad as getApproxMinLineHeight,kd as getApproxMinLineWidth,Ec as getArrowLocalFixedPoints,gg as getArrowheadAngle,OT as getArrowheadForPicker,ut as getArrowheadPoints,fg as getArrowheadSize,ze as getBindingGap,X6 as getBindingSideMidPoint,da as getBindingStrategyForDraggingBindingElementEndpoints,he as getBoundTextElement,Vt as getBoundTextElementId,S3 as getBoundTextElementPosition,mi as getBoundTextMaxHeight,jt as getBoundTextMaxWidth,cT as getBoundTextShape,Eo as getBoundsFromPoints,wn as getCenterForBounds,it as getCommonBoundingBox,dt as getCommonBounds,kf as getCommonFrameId,P3 as getContainerCenter,Fs as getContainerCoords,et as getContainerElement,Un as getContainingFrame,En as getCornerRadius,hr as getCubicBezierCurveBound,s8 as getCursorForResizingElement,Ta as getDataURLByteLength,Gf as getDefaultFrameName,Fw as getDefaultRoundnessTypeForElement,Md as getDiamondBaseCorners,ko as getDiamondPoints,SS as getDragOffsetXY,eP as getDraggedElementsBounds,ae as getElementAbsoluteCoords,we as getElementBounds,Oo as getElementLineSegments,Pa as getElementPointsCoords,Ai as getElementShape,i8 as getElementWithTransformHandleType,Pc as getElementsCompletelyInFrame,lt as getElementsInGroup,w4 as getElementsInNewFrame,b4 as getElementsInResizingFrame,m4 as getElementsIntersectingFrame,k4 as getElementsOverlappingFrame,vc as getElementsWithinSelection,zS as getEmbedLink,eI as getEndpointBoundTextDragAnchor,Cw as getFlipAdjustedCropPosition,Vn as getFrameChildren,Af as getFrameChildrenInsertionIndex,Ea as getFrameLikeElements,v4 as getFrameLikeTitle,bM as getFreedrawOutlineAsSegments,sg as getFreedrawOutlinePoints,yu as getFreedrawStrokeCenterPoints,ou as getGifRenderFrame,Qe as getGlobalFixedPointForBindableElement,mf as getGlobalFixedPoints,oc as getHeadingForElbowArrowSnap,bn as getHoveredElementForBinding,Vd as getHoveredElementForFocusPoint,q5 as getInitializedImageElements,ar as getLineHeightInPx,Nn as getLineWidth,Hw as getLinearElementSubType,DS as getLinkIdAndTypeFromSelection,Kc as getLockedLinearCursorAlignSize,zm as getMaxCharWidth,Cr as getMaximumGroups,a3 as getMinCharWidth,wi as getMinMaxXYFromCurvePathOps,sr as getMinTextElementWidth,Gc as getNewGroupIdsForDuplication,Xn as getNonDeletedElements,Lc as getNonDeletedGroupIds,cP as getNormalizedDimensions,Vo as getObservedAppState,pl as getOmitSidesForEditorInterface,e3 as getOriginalContainerHeightFromCache,_a as getPerfectElementSize,JM as getRectangleBoxAbsoluteCoords,V0 as getRenderOpacity,zv as getResizeArrowDirection,_v as getResizeOffsetXY,Dn as getResizedElementAbsoluteCoords,y4 as getRootElements,KT as getSceneVersion,un as getSelectedElements,Lr as getSelectedElementsByGroup,ba as getSelectedGroupForElement,Vf as getSelectedGroupIdForElement,Uf as getSelectedGroupIds,W4 as getSelectionStateForElements,or as getSnapOutlineMidPoint,z4 as getTargetElements,Lf as getTargetFrame,Wa as getTextAnchorRatios,QP as getTextBindingForArrowEndpoint,I3 as getTextElementAngle,T3 as getTextFromElements,_m as getTextHeight,Td as getTextWidth,su as getThumbHashPlaceholder,kx as getToolbarTools,r8 as getTransformHandleTypeFromCoords,_p as getTransformHandles,hl as getTransformHandlesFromCoords,KP as getUnboundArrowEndpointAtPoint,ld as getUncroppedImageElement,Ss as getUncroppedWidthAndHeight,H4 as getVisibleAndNonSelectedElements,QT as getVisibleElements,tP as getVisibleSceneBounds,qm as getWrappedTextLines,x4 as groupByFrameLikes,g4 as groupsAreAtLeastIntersectingTheFrame,E4 as groupsAreCompletelyOutOfFrame,co as handleBindTextResize,Dp as handleFocusPointDrag,gv as handleFocusPointHover,mv as handleFocusPointPointerDown,fv as handleFocusPointPointerUp,_5 as hasActiveGifDecode,To as hasBackground,tn as hasBoundTextElement,qv as hasBoundingBox,z3 as hasFreedrawMode,z5 as hasPlayableGif,F3 as hasStrokeColor,_3 as hasStrokeStyle,H3 as hasStrokeWidth,op as hashElementsVersion,ip as hashString,xt as headingForPoint,Co as headingForPointFromElement,Xt as headingForPointIsHorizontal,yt as headingIsHorizontal,c6 as headingIsVertical,I1 as hitElementBoundText,P1 as hitElementBoundingBox,i6 as hitElementBoundingBoxOnly,nn as hitElementItself,gt as intersectElementWithLineSegment,Ow as isArrowBoundToElement,J as isArrowElement,Le as isBindableElement,Xs as isBindableElementInsideOtherBindable,Ke as isBindingElement,Im as isBindingElementType,dn as isBindingEnabled,Ne as isBoundToContainer,qu as isBucketFillCompatible,f4 as isCursorInFrame,Mm as isCurvedArrow,ee as isElbowArrow,dP as isElementCompletelyInViewport,ga as isElementContainingFrame,Sc as isElementInFrame,jf as isElementInGroup,Cc as isElementInViewport,Ro as isElementIntersectingFrame,BS as isElementLink,_w as isEligibleFrameChildType,cd as isEmbeddableElement,JP as isEndpointBoundText,hd as isExcalidrawElement,ff as isFixedPoint,md as isFlowchartNodeElement,qr as isFocusPointVisible,tr as isFrameElement,ce as isFrameLikeElement,Ce as isFreeDrawElement,bm as isFreeDrawElementType,G0 as isHTMLSVGElement,Ji as isIframeElement,er as isIframeLikeElement,Ve as isImageElement,Bc as isInGroup,Wt as isInitializedImageElement,Au as isInvisiblySmallElement,Xe as isLineElement,le as isLinearElement,Pm as isLinearElementType,ud as isMagicFrameElement,i3 as isMeasureTextSupported,iv as isNodeInFlowchart,rt as isNonDeletedElement,vt as isPathALoop,ft as isPointInElement,di as isRectangularElement,pd as isRectanguloidElement,fI as isRestylableFill,Wf as isSelectedViaGroup,wm as isSharpArrow,Nw as isSimpleArrow,_4 as isSomeElementSelected,Sm as isTextBindableContainer,pe as isTextElement,nr as isUsingAdaptiveRadius,fd as isUsingProportionalRadius,vs as isValidPolygon,A3 as isValidTextContainer,B0 as loadHTMLImageElement,ya as makeNextSelectedElementIds,Ut as maxBindingDistance_simple,BT as maybeHandleArrowPointlikeDrag,US as maybeParseEmbedSrc,dl as measureFontSizeFromWidth,kt as measureText,u5 as moveAllLeft,p5 as moveAllRight,bi as moveArrowAboveBindable,d5 as moveOneLeft,c5 as moveOneRight,$e as mutateElement,Wr as newArrowElement,_o as newElement,at as newElementWith,FP as newEmbeddableElement,Nu as newFrameElement,zP as newFreeDrawElement,HP as newIframeElement,Hu as newImageElement,Fu as newLinearElement,Ou as newMagicFrameElement,yo as newTextElement,wv as normaliseElements,_x as normalizeArrowhead,IE as normalizeBoundElementsOrder,Ku as normalizeElementOrder,Je as normalizeFixedPoint,K5 as normalizeSVG,pi as normalizeText,Tr as omitGroupsContainingFrameLikes,vf as omitPartialGroups,yc as orderByFractionalIndex,ui as originalContainerCache,GS as parseElementLinkFromURL,$m as parseTokens,sn as pointInsideBounds,yg as pointInsideBoundsInclusive,vv as positionElementsOnGrid,vo as projectFixedPointOntoDiagonal,by as recognizeShape,cr as redrawTextBoundingBox,_P as refreshTextDimensions,Cf as removeAllElementsFromFrame,Ic as removeElementsFromFrame,K4 as removeFromSelectedGroups,yM as renderElement,xM as renderSelectionElement,Vu as rendersOpaqueFill,P4 as replaceAllElementsInFrame,Np as rescalePointsInElement,Sd as resetOriginalContainerCache,nx as resizeMultipleElements,J2 as resizeSingleElement,q2 as resizeSingleTextElement,rx as resizeTest,zf as selectGroup,Ac as selectGroupsForSelectedElements,kc as selectGroupsFromGivenElements,s3 as setCustomTextMetricsProvider,v3 as shouldAllowVerticalAlign,S4 as shouldApplyFrameClip,ur as shouldTestInside,mT as showSelectedShapeActions,ca as snapToMid,k3 as suppportsHorizontalAlign,ha as syncInvalidIndices,bc as syncInvalidIndicesImmutable,po as syncMovedIndices,qc as toggleLinePolygonState,W3 as toolIsArrow,Hv as transformElements,nt as unbindBindingElement,j6 as updateBindings,ot as updateBoundElements,Yt as updateBoundPoint,Do as updateElbowArrowPoints,I4 as updateFrameMembershipOfSelectedElements,Z5 as updateImageCache,Id as updateOriginalContainerCache,nc as validateElbowPoints,Mf as validateFractionalIndices,an as vectorToHeading,yn as wrapText};
|
|
29
29
|
/*! Bundled license information:
|
|
30
30
|
|
|
31
31
|
react/cjs/react.production.js:
|