(function(){
shadow$provide[587]=function(ya,ca,Sa,Q){function w(u,A,z){var C,P={},g=null,h=null;void 0!==z&&(g=""+z);void 0!==A.key&&(g=""+A.key);void 0!==A.ref&&(h=A.ref);for(C in A)q.call(A,C)&&!c.hasOwnProperty(C)&&(P[C]=A[C]);if(u&&u.defaultProps)for(C in A=u.defaultProps,A)void 0===P[C]&&(P[C]=A[C]);return{$$typeof:Y,type:u,key:g,ref:h,props:P,_owner:y.current}}ca(158);ya=ca(19);var Y=60103;Q.Fragment=60107;"function"===typeof Symbol&&Symbol.for&&(ca=Symbol.for,Y=ca("react.element"),Q.Fragment=ca("react.fragment"));
var y=ya.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,q=Object.prototype.hasOwnProperty,c={key:!0,ref:!0,__self:!0,__source:!0};Q.jsx=w;Q.jsxs=w};
shadow$provide[589]=function(ya,ca,Sa,Q){Sa.exports=ca(587)};
shadow$provide[590]=function(ya,ca,Sa,Q){function w(dc){for(var Nc="https://reactjs.org/docs/error-decoder.html?invariant\x3d"+dc,Qc=1;Qc<arguments.length;Qc++)Nc+="\x26args[]\x3d"+encodeURIComponent(arguments[Qc]);return"Minified React error #"+dc+"; visit "+Nc+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Y(dc){if(null==dc)return null;if("function"===typeof dc)return dc.displayName||dc.name||null;if("string"===typeof dc)return dc;
switch(dc){case R:return"Fragment";case T:return"Portal";case F:return"Profiler";case G:return"StrictMode";case ia:return"Suspense";case U:return"SuspenseList"}if("object"===typeof dc)switch(dc.$$typeof){case M:return(dc.displayName||"Context")+".Consumer";case O:return(dc._context.displayName||"Context")+".Provider";case I:var Nc=dc.render;Nc=Nc.displayName||Nc.name||"";return dc.displayName||(""!==Nc?"ForwardRef("+Nc+")":"ForwardRef");case Z:return Y(dc.type);case W:return Y(dc._render);case aa:Nc=
dc._payload;dc=dc._init;try{return Y(dc(Nc))}catch(Qc){}}return null}function y(dc,Nc){for(var Qc=dc._threadCount|0;Qc<=Nc;Qc++)dc[Qc]=dc._currentValue2,dc._threadCount=Qc+1}function q(dc,Nc,Qc,Ad){if(Ad&&(Ad=dc.contextType,"object"===typeof Ad&&null!==Ad))return y(Ad,Qc),Ad[Qc];if(dc=dc.contextTypes){Qc={};for(var Xc in dc)Qc[Xc]=Nc[Xc];Nc=Qc}else Nc=va;return Nc}function c(dc){if(Ga.call(Ya,dc))return!0;if(Ga.call(Ia,dc))return!1;if(xa.test(dc))return Ya[dc]=!0;Ia[dc]=!0;return!1}function u(dc,
Nc,Qc,Ad){if(null!==Qc&&0===Qc.type)return!1;switch(typeof Nc){case "function":case "symbol":return!0;case "boolean":if(Ad)return!1;if(null!==Qc)return!Qc.acceptsBooleans;dc=dc.toLowerCase().slice(0,5);return"data-"!==dc&&"aria-"!==dc;default:return!1}}function A(dc,Nc,Qc,Ad){if(null===Nc||"undefined"===typeof Nc||u(dc,Nc,Qc,Ad))return!0;if(Ad)return!1;if(null!==Qc)switch(Qc.type){case 3:return!Nc;case 4:return!1===Nc;case 5:return isNaN(Nc);case 6:return isNaN(Nc)||1>Nc}return!1}function z(dc,Nc,
Qc,Ad,Xc,sc,Sc){this.acceptsBooleans=2===Nc||3===Nc||4===Nc;this.attributeName=Ad;this.attributeNamespace=Xc;this.mustUseProperty=Qc;this.propertyName=dc;this.type=Nc;this.sanitizeURL=sc;this.removeEmptyString=Sc}function C(dc){return dc[1].toUpperCase()}function P(dc){if("boolean"===typeof dc||"number"===typeof dc)return""+dc;dc=""+dc;var Nc=Ba.exec(dc);if(Nc){var Qc="",Ad,Xc=0;for(Ad=Nc.index;Ad<dc.length;Ad++){switch(dc.charCodeAt(Ad)){case 34:Nc="\x26quot;";break;case 38:Nc="\x26amp;";break;case 39:Nc=
"\x26#x27;";break;case 60:Nc="\x26lt;";break;case 62:Nc="\x26gt;";break;default:continue}Xc!==Ad&&(Qc+=dc.substring(Xc,Ad));Xc=Ad+1;Qc+=Nc}dc=Xc!==Ad?Qc+dc.substring(Xc,Ad):Qc}return dc}function g(dc,Nc){var Qc=Fa.hasOwnProperty(dc)?Fa[dc]:null,Ad;if(Ad="style"!==dc)Ad=null!==Qc?0===Qc.type:!(2<dc.length)||"o"!==dc[0]&&"O"!==dc[0]||"n"!==dc[1]&&"N"!==dc[1]?!1:!0;if(Ad||A(dc,Nc,Qc,!1))return"";if(null!==Qc){dc=Qc.attributeName;Ad=Qc.type;if(3===Ad||4===Ad&&!0===Nc)return dc+'\x3d""';Qc.sanitizeURL&&
(Nc=""+Nc);return dc+'\x3d"'+(P(Nc)+'"')}return c(dc)?dc+'\x3d"'+(P(Nc)+'"'):""}function h(dc,Nc){return dc===Nc&&(0!==dc||1/dc===1/Nc)||dc!==dc&&Nc!==Nc}function b(){if(null===ka)throw Error(w(321));return ka}function l(){if(0<Va)throw Error(w(312));return{memoizedState:null,queue:null,next:null}}function m(){null===na?null===ua?(oa=!1,ua=na=l()):(oa=!0,na=ua):null===na.next?(oa=!1,na=na.next=l()):(oa=!0,na=na.next);return na}function p(dc,Nc,Qc,Ad){for(;La;)La=!1,Va+=1,na=null,Qc=dc(Nc,Ad);D();
return Qc}function D(){ka=null;La=!1;ua=null;Va=0;na=Oa=null}function v(dc,Nc){return"function"===typeof Nc?Nc(dc):Nc}function t(dc,Nc,Qc){ka=b();na=m();if(oa){var Ad=na.queue;Nc=Ad.dispatch;if(null!==Oa&&(Qc=Oa.get(Ad),void 0!==Qc)){Oa.delete(Ad);Ad=na.memoizedState;do Ad=dc(Ad,Qc.action),Qc=Qc.next;while(null!==Qc);na.memoizedState=Ad;return[Ad,Nc]}return[na.memoizedState,Nc]}dc=dc===v?"function"===typeof Nc?Nc():Nc:void 0!==Qc?Qc(Nc):Nc;na.memoizedState=dc;dc=na.queue={last:null,dispatch:null};
dc=dc.dispatch=f.bind(null,ka,dc);return[na.memoizedState,dc]}function r(dc,Nc){ka=b();na=m();Nc=void 0===Nc?null:Nc;if(null!==na){var Qc=na.memoizedState;if(null!==Qc&&null!==Nc){var Ad=Qc[1];a:if(null===Ad)Ad=!1;else{for(var Xc=0;Xc<Ad.length&&Xc<Nc.length;Xc++)if(!la(Nc[Xc],Ad[Xc])){Ad=!1;break a}Ad=!0}if(Ad)return Qc[0]}}dc=dc();na.memoizedState=[dc,Nc];return dc}function f(dc,Nc,Qc){if(!(25>Va))throw Error(w(301));if(dc===ka)if(La=!0,dc={action:Qc,next:null},null===Oa&&(Oa=new Map),Qc=Oa.get(Nc),
void 0===Qc)Oa.set(Nc,dc);else{for(Nc=Qc;null!==Nc.next;)Nc=Nc.next;Nc.next=dc}}function E(){}function B(dc){switch(dc){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function J(dc){if(void 0===dc||null===dc)return dc;var Nc="";L.Children.forEach(dc,function(Qc){null!=Qc&&(Nc+=Qc)});return Nc}function V(dc,Nc){if(void 0===dc)throw Error(w(152,Y(Nc)||"Component"));}function H(dc,Nc,Qc){function Ad(Sc,
Ib){var lb=Ib.prototype&&Ib.prototype.isReactComponent,Db=q(Ib,Nc,Qc,lb),Gb=[],db=!1,rb={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===Gb)return null},enqueueReplaceState:function(Rc,fd){db=!0;Gb=[fd]},enqueueSetState:function(Rc,fd){if(null===Gb)return null;Gb.push(fd)}};if(lb){if(lb=new Ib(Sc.props,Db,rb),"function"===typeof Ib.getDerivedStateFromProps){var Nb=Ib.getDerivedStateFromProps.call(null,Sc.props,lb.state);null!=Nb&&(lb.state=S({},lb.state,Nb))}}else if(ka={},
lb=Ib(Sc.props,Db,rb),lb=p(Ib,Sc.props,lb,Db),null==lb||null==lb.render){dc=lb;V(dc,Ib);return}lb.props=Sc.props;lb.context=Db;lb.updater=rb;rb=lb.state;void 0===rb&&(lb.state=rb=null);if("function"===typeof lb.UNSAFE_componentWillMount||"function"===typeof lb.componentWillMount)if("function"===typeof lb.componentWillMount&&"function"!==typeof Ib.getDerivedStateFromProps&&lb.componentWillMount(),"function"===typeof lb.UNSAFE_componentWillMount&&"function"!==typeof Ib.getDerivedStateFromProps&&lb.UNSAFE_componentWillMount(),
Gb.length){rb=Gb;var fc=db;Gb=null;db=!1;if(fc&&1===rb.length)lb.state=rb[0];else{Nb=fc?rb[0]:lb.state;var Bc=!0;for(fc=fc?1:0;fc<rb.length;fc++){var Jc=rb[fc];Jc="function"===typeof Jc?Jc.call(lb,Nb,Sc.props,Db):Jc;null!=Jc&&(Bc?(Bc=!1,Nb=S({},Nb,Jc)):S(Nb,Jc))}lb.state=Nb}}else Gb=null;dc=lb.render();V(dc,Ib);if("function"===typeof lb.getChildContext&&(Sc=Ib.childContextTypes,"object"===typeof Sc)){var ic=lb.getChildContext(),Oc;for(Oc in ic)if(!(Oc in Sc))throw Error(w(108,Y(Ib)||"Unknown",Oc));
}ic&&(Nc=S({},Nc,ic))}for(;L.isValidElement(dc);){var Xc=dc,sc=Xc.type;if("function"!==typeof sc)break;Ad(Xc,sc)}return{child:dc,context:Nc}}var S=ca(158),L=ca(19),T=60106,R=60107,G=60108,F=60114,O=60109,M=60110,I=60112,ia=60113,U=60120,Z=60115,aa=60116,W=60121,fa=60117,X=60119,ea=60129,pa=60131;"function"===typeof Symbol&&Symbol.for&&(ya=Symbol.for,T=ya("react.portal"),R=ya("react.fragment"),G=ya("react.strict_mode"),F=ya("react.profiler"),O=ya("react.provider"),M=ya("react.context"),I=ya("react.forward_ref"),
ia=ya("react.suspense"),U=ya("react.suspense_list"),Z=ya("react.memo"),aa=ya("react.lazy"),W=ya("react.block"),fa=ya("react.fundamental"),X=ya("react.scope"),ea=ya("react.debug_trace_mode"),pa=ya("react.legacy_hidden"));ya=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;var va={},ta=new Uint16Array(16);for(ca=0;15>ca;ca++)ta[ca]=ca+1;ta[15]=0;var xa=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,
Ga=Object.prototype.hasOwnProperty,Ia={},Ya={},Fa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(dc){Fa[dc]=new z(dc,0,!1,dc,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(dc){var Nc=dc[0];Fa[Nc]=new z(Nc,1,!1,dc[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(dc){Fa[dc]=
new z(dc,2,!1,dc.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(dc){Fa[dc]=new z(dc,2,!1,dc,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(dc){Fa[dc]=new z(dc,3,!1,dc.toLowerCase(),null,!1,!1)});["checked",
"multiple","muted","selected"].forEach(function(dc){Fa[dc]=new z(dc,3,!0,dc,null,!1,!1)});["capture","download"].forEach(function(dc){Fa[dc]=new z(dc,4,!1,dc,null,!1,!1)});["cols","rows","size","span"].forEach(function(dc){Fa[dc]=new z(dc,6,!1,dc,null,!1,!1)});["rowSpan","start"].forEach(function(dc){Fa[dc]=new z(dc,5,!1,dc.toLowerCase(),null,!1,!1)});var Ka=/[\-:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(dc){var Nc=
dc.replace(Ka,C);Fa[Nc]=new z(Nc,1,!1,dc,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(dc){var Nc=dc.replace(Ka,C);Fa[Nc]=new z(Nc,1,!1,dc,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(dc){var Nc=dc.replace(Ka,C);Fa[Nc]=new z(Nc,1,!1,dc,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(dc){Fa[dc]=new z(dc,1,!1,dc.toLowerCase(),null,!1,!1)});
Fa.xlinkHref=new z("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(dc){Fa[dc]=new z(dc,1,!1,dc.toLowerCase(),null,!0,!0)});var Ba=/["'&<>]/,la="function"===typeof Object.is?Object.is:h,ka=null,ua=null,na=null,oa=!1,La=!1,Oa=null,Va=0,Ma=null,Ua={readContext:function(dc){var Nc=Ma.threadID;y(dc,Nc);return dc[Nc]},useContext:function(dc){b();var Nc=Ma.threadID;y(dc,Nc);return dc[Nc]},useMemo:r,useReducer:t,useRef:function(dc){ka=
b();na=m();var Nc=na.memoizedState;return null===Nc?(dc={current:dc},na.memoizedState=dc):Nc},useState:function(dc){return t(v,dc)},useLayoutEffect:function(){},useCallback:function(dc,Nc){return r(function(){return dc},Nc)},useImperativeHandle:E,useEffect:E,useDebugValue:E,useDeferredValue:function(dc){b();return dc},useTransition:function(){b();return[function(dc){dc()},!1]},useOpaqueIdentifier:function(){return(Ma.identifierPrefix||"")+"R:"+(Ma.uniqueID++).toString(36)},useMutableSource:function(dc,
Nc){b();return Nc(dc._source)}},ib={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},vb=S({menuitem:!0},ib),yb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,
gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Wa=["Webkit","ms","Moz","O"];Object.keys(yb).forEach(function(dc){Wa.forEach(function(Nc){Nc=Nc+dc.charAt(0).toUpperCase()+dc.substring(1);yb[Nc]=yb[dc]})});var hb=/([A-Z])/g,ab=/^ms-/,Qa=L.Children.toArray,
bb=ya.ReactCurrentDispatcher,Pa={listing:!0,pre:!0,textarea:!0},Lb=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xc={},oc={},pc=Object.prototype.hasOwnProperty,Cc={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},bd=function(){function dc(Qc,Ad,Xc){L.isValidElement(Qc)?Qc.type!==R?Qc=[Qc]:(Qc=Qc.props.children,Qc=L.isValidElement(Qc)?[Qc]:Qa(Qc)):Qc=Qa(Qc);Qc={type:null,domNamespace:"http://www.w3.org/1999/xhtml",children:Qc,childIndex:0,context:va,footer:""};
var sc=ta[0];if(0===sc){var Sc=ta;sc=Sc.length;var Ib=2*sc;if(!(65536>=Ib))throw Error(w(304));var lb=new Uint16Array(Ib);lb.set(Sc);ta=lb;ta[0]=sc+1;for(Sc=sc;Sc<Ib-1;Sc++)ta[Sc]=Sc+1;ta[Ib-1]=0}else ta[0]=ta[sc];this.threadID=sc;this.stack=[Qc];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=Ad;this.suspenseDepth=0;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[];this.uniqueID=0;this.identifierPrefix=Xc&&Xc.identifierPrefix||""}
var Nc=dc.prototype;Nc.destroy=function(){if(!this.exhausted){this.exhausted=!0;this.clearProviders();var Qc=this.threadID;ta[Qc]=ta[0];ta[0]=Qc}};Nc.pushProvider=function(Qc){var Ad=++this.contextIndex,Xc=Qc.type._context,sc=this.threadID;y(Xc,sc);var Sc=Xc[sc];this.contextStack[Ad]=Xc;this.contextValueStack[Ad]=Sc;Xc[sc]=Qc.props.value};Nc.popProvider=function(){var Qc=this.contextIndex,Ad=this.contextStack[Qc],Xc=this.contextValueStack[Qc];this.contextStack[Qc]=null;this.contextValueStack[Qc]=
null;this.contextIndex--;Ad[this.threadID]=Xc};Nc.clearProviders=function(){for(var Qc=this.contextIndex;0<=Qc;Qc--)this.contextStack[Qc][this.threadID]=this.contextValueStack[Qc]};Nc.read=function(Qc){if(this.exhausted)return null;var Ad=Ma;Ma=this;var Xc=bb.current;bb.current=Ua;try{for(var sc=[""],Sc=!1;sc[0].length<Qc;){if(0===this.stack.length){this.exhausted=!0;var Ib=this.threadID;ta[Ib]=ta[0];ta[0]=Ib;break}var lb=this.stack[this.stack.length-1];if(Sc||lb.childIndex>=lb.children.length){var Db=
lb.footer;""!==Db&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===lb.type)this.currentSelectValue=null;else if(null!=lb.type&&null!=lb.type.type&&lb.type.type.$$typeof===O)this.popProvider(lb.type);else if(lb.type===ia){this.suspenseDepth--;var Gb=sc.pop();if(Sc){Sc=!1;var db=lb.fallbackFrame;if(!db)throw Error(w(303));this.stack.push(db);sc[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}else sc[this.suspenseDepth]+=Gb}sc[this.suspenseDepth]+=Db}else{var rb=lb.children[lb.childIndex++],
Nb="";try{Nb+=this.render(rb,lb.context,lb.domNamespace)}catch(fc){if(null!=fc&&"function"===typeof fc.then)throw Error(w(294));throw fc;}finally{}sc.length<=this.suspenseDepth&&sc.push("");sc[this.suspenseDepth]+=Nb}}return sc[0]}finally{bb.current=Xc,Ma=Ad,D()}};Nc.render=function(Qc,Ad,Xc){if("string"===typeof Qc||"number"===typeof Qc){Xc=""+Qc;if(""===Xc)return"";if(this.makeStaticMarkup)return P(Xc);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+P(Xc);this.previousWasTextNode=!0;return P(Xc)}Ad=
H(Qc,Ad,this.threadID);Qc=Ad.child;Ad=Ad.context;if(null===Qc||!1===Qc)return"";if(!L.isValidElement(Qc)){if(null!=Qc&&null!=Qc.$$typeof){Xc=Qc.$$typeof;if(Xc===T)throw Error(w(257));throw Error(w(258,Xc.toString()));}Qc=Qa(Qc);this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""});return""}var sc=Qc.type;if("string"===typeof sc)return this.renderDOM(Qc,Ad,Xc);switch(sc){case pa:case ea:case G:case F:case U:case R:return Qc=Qa(Qc.props.children),this.stack.push({type:null,
domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""}),"";case ia:throw Error(w(294));case X:throw Error(w(343));}if("object"===typeof sc&&null!==sc)switch(sc.$$typeof){case I:ka={};var Sc=sc.render(Qc.props,Qc.ref);Sc=p(sc.render,Qc.props,Sc,Qc.ref);Sc=Qa(Sc);this.stack.push({type:null,domNamespace:Xc,children:Sc,childIndex:0,context:Ad,footer:""});return"";case Z:return Qc=[L.createElement(sc.type,S({ref:Qc.ref},Qc.props))],this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,
context:Ad,footer:""}),"";case O:return sc=Qa(Qc.props.children),Xc={type:Qc,domNamespace:Xc,children:sc,childIndex:0,context:Ad,footer:""},this.pushProvider(Qc),this.stack.push(Xc),"";case M:sc=Qc.type;Sc=Qc.props;var Ib=this.threadID;y(sc,Ib);sc=Qa(Sc.children(sc[Ib]));this.stack.push({type:Qc,domNamespace:Xc,children:sc,childIndex:0,context:Ad,footer:""});return"";case fa:throw Error(w(338));case aa:return sc=Qc.type,Sc=sc._init,sc=Sc(sc._payload),Qc=[L.createElement(sc,S({ref:Qc.ref},Qc.props))],
this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""}),""}throw Error(w(130,null==sc?sc:typeof sc,""));};Nc.renderDOM=function(Qc,Ad,Xc){var sc=Qc.type.toLowerCase();"http://www.w3.org/1999/xhtml"===Xc&&B(sc);if(!xc.hasOwnProperty(sc)){if(!Lb.test(sc))throw Error(w(65,sc));xc[sc]=!0}var Sc=Qc.props;if("input"===sc)Sc=S({type:void 0},Sc,{defaultChecked:void 0,defaultValue:void 0,value:null!=Sc.value?Sc.value:Sc.defaultValue,checked:null!=Sc.checked?Sc.checked:Sc.defaultChecked});
else if("textarea"===sc){var Ib=Sc.value;if(null==Ib){Ib=Sc.defaultValue;var lb=Sc.children;if(null!=lb){if(null!=Ib)throw Error(w(92));if(Array.isArray(lb)){if(!(1>=lb.length))throw Error(w(93));lb=lb[0]}Ib=""+lb}null==Ib&&(Ib="")}Sc=S({},Sc,{value:void 0,children:""+Ib})}else if("select"===sc)this.currentSelectValue=null!=Sc.value?Sc.value:Sc.defaultValue,Sc=S({},Sc,{value:void 0});else if("option"===sc){lb=this.currentSelectValue;var Db=J(Sc.children);if(null!=lb){var Gb=null!=Sc.value?Sc.value+
"":Db;Ib=!1;if(Array.isArray(lb))for(var db=0;db<lb.length;db++){if(""+lb[db]===Gb){Ib=!0;break}}else Ib=""+lb===Gb;Sc=S({selected:void 0,children:void 0},Sc,{selected:Ib,children:Db})}}if(Ib=Sc){if(vb[sc]&&(null!=Ib.children||null!=Ib.dangerouslySetInnerHTML))throw Error(w(137,sc));if(null!=Ib.dangerouslySetInnerHTML){if(null!=Ib.children)throw Error(w(60));if(!("object"===typeof Ib.dangerouslySetInnerHTML&&"__html"in Ib.dangerouslySetInnerHTML))throw Error(w(61));}if(null!=Ib.style&&"object"!==
typeof Ib.style)throw Error(w(62));}Ib=Sc;lb=this.makeStaticMarkup;Db=1===this.stack.length;Gb="\x3c"+Qc.type;a:if(-1===sc.indexOf("-"))db="string"===typeof Ib.is;else switch(sc){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":db=!1;break a;default:db=!0}for(fd in Ib)if(pc.call(Ib,fd)){var rb=Ib[fd];if(null!=rb){if("style"===fd){var Nb=void 0,fc="",Bc="";for(Nb in rb)if(rb.hasOwnProperty(Nb)){var Jc=
0===Nb.indexOf("--"),ic=rb[Nb];if(null!=ic){if(Jc)var Oc=Nb;else if(Oc=Nb,oc.hasOwnProperty(Oc))Oc=oc[Oc];else{var Rc=Oc.replace(hb,"-$1").toLowerCase().replace(ab,"-ms-");Oc=oc[Oc]=Rc}fc+=Bc+Oc+":";Bc=Nb;Jc=null==ic||"boolean"===typeof ic||""===ic?"":Jc||"number"!==typeof ic||0===ic||yb.hasOwnProperty(Bc)&&yb[Bc]?(""+ic).trim():ic+"px";fc+=Jc;Bc=";"}}rb=fc||null}Nb=null;db?Cc.hasOwnProperty(fd)||(Nb=fd,Nb=c(Nb)&&null!=rb?Nb+'\x3d"'+(P(rb)+'"'):""):Nb=g(fd,rb);Nb&&(Gb+=" "+Nb)}}lb||Db&&(Gb+=' data-reactroot\x3d""');
var fd=Gb;Ib="";ib.hasOwnProperty(sc)?fd+="/\x3e":(fd+="\x3e",Ib="\x3c/"+Qc.type+"\x3e");a:{lb=Sc.dangerouslySetInnerHTML;if(null!=lb){if(null!=lb.__html){lb=lb.__html;break a}}else if(lb=Sc.children,"string"===typeof lb||"number"===typeof lb){lb=P(lb);break a}lb=null}null!=lb?(Sc=[],Pa.hasOwnProperty(sc)&&"\n"===lb.charAt(0)&&(fd+="\n"),fd+=lb):Sc=Qa(Sc.children);Qc=Qc.type;Xc=null==Xc||"http://www.w3.org/1999/xhtml"===Xc?B(Qc):"http://www.w3.org/2000/svg"===Xc&&"foreignObject"===Qc?"http://www.w3.org/1999/xhtml":
Xc;this.stack.push({domNamespace:Xc,type:sc,children:Sc,childIndex:0,context:Ad,footer:Ib});this.previousWasTextNode=!1;return fd};return dc}();Q.renderToNodeStream=function(){throw Error(w(207));};Q.renderToStaticMarkup=function(dc,Nc){dc=new bd(dc,!0,Nc);try{return dc.read(Infinity)}finally{dc.destroy()}};Q.renderToStaticNodeStream=function(){throw Error(w(208));};Q.renderToString=function(dc,Nc){dc=new bd(dc,!1,Nc);try{return dc.read(Infinity)}finally{dc.destroy()}};Q.version="17.0.2"};
shadow$provide[592]=function(ya,ca,Sa,Q){Sa.exports=ca(590)};
shadow$provide[593]=function(ya,ca,Sa,Q){function w(){if(!Ou&&(Ou="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ou))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ou(DD)}function Y(a,d=0){return(Ll[a[d+0]]+Ll[a[d+1]]+Ll[a[d+2]]+Ll[a[d+3]]+"-"+Ll[a[d+4]]+Ll[a[d+5]]+"-"+Ll[a[d+6]]+Ll[a[d+7]]+"-"+Ll[a[d+8]]+Ll[a[d+9]]+"-"+Ll[a[d+10]]+Ll[a[d+11]]+Ll[a[d+12]]+Ll[a[d+13]]+Ll[a[d+14]]+
Ll[a[d+15]]).toLowerCase()}function y(a){let d=0;var k=0;for(var K of a)d+=K.w*K.h,k=Math.max(k,K.w);a.sort((ra,Ja)=>Ja.h-ra.h);k=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(d/.95)),k),h:Infinity}];let da=K=0;for(const ra of a)for(a=k.length-1;0<=a;a--){var ja=k[a];if(!(ra.w>ja.w||ra.h>ja.h)){ra.x=ja.x;ra.y=ja.y;da=Math.max(da,ra.y+ra.h);K=Math.max(K,ra.x+ra.w);ra.w===ja.w&&ra.h===ja.h?(ja=k.pop(),a<k.length&&(k[a]=ja)):ra.h===ja.h?(ja.x+=ra.w,ja.w-=ra.w):(ra.w!==ja.w&&k.push({x:ja.x+ra.w,y:ja.y,w:ja.w-
ra.w,h:ra.h}),ja.y+=ra.h,ja.h-=ra.h);break}}return{w:K,h:da,fill:d/(K*da)||0}}function q(a,...d){return{didIntersect:0<d.length,message:a,points:d}}function c(a,d,k=0){const K=[a[0]+d[0]/2,a[1]+d[1]/2],da=yd.rotWith(a,K,k),ja=yd.rotWith(yd.add(a,[d[0],0]),K,k),ra=yd.rotWith(yd.add(a,d),K,k);a=yd.rotWith(yd.add(a,[0,d[1]]),K,k);return[["top",[da,ja]],["right",[ja,ra]],["bottom",[ra,a]],["left",[a,da]]]}function u(a,d,k,K){const [da,ja]=a,[ra,Ja]=d,[Ra,$a]=k,[fb,jb]=K;return Ja/ra!==(jb-$a)/(fb-Ra)&&
(d=ra*(jb-$a)-Ja*(fb-Ra),0!==d&&(a=((ja-$a)*(fb-Ra)-(da-Ra)*(jb-$a))/d,d=((ja-$a)*ra-(da-Ra)*Ja)/d,0<=a&&0<=d&&1>=d))?q("intersection",[da+a*ra,ja+a*Ja]):q("no intersection")}function A(a,d,k,K,da=0){return b(k,K,da,a,d)}function z(a,d,k,K=0){const {minX:da,minY:ja,width:ra,height:Ja}=k;return A(a,d,[da,ja],[ra,Ja],K)}function C(a,d,k,K){var da=yd.sub(a,k);k=yd.sub(K,k);d=yd.sub(d,a);K=k[0]*da[1]-k[1]*da[0];da=d[0]*da[1]-d[1]*da[0];k=k[1]*d[0]-k[0]*d[1];return 0===K||0===da?q("coincident"):0===k?
q("parallel"):0!==k&&(K/=k,da/=k,0<=K&&1>=K&&0<=da&&1>=da)?q("intersection",yd.add(a,yd.mul(d,K))):q("no intersection")}function P(a,d,k,K){var da=(d[0]-a[0])*(d[0]-a[0])+(d[1]-a[1])*(d[1]-a[1]),ja=2*((d[0]-a[0])*(a[0]-k[0])+(d[1]-a[1])*(a[1]-k[1]));k=ja*ja-4*da*(k[0]*k[0]+k[1]*k[1]+a[0]*a[0]+a[1]*a[1]-2*(k[0]*a[0]+k[1]*a[1])-K*K);if(0>k)return q("outside");if(0===k)return q("tangent");K=Math.sqrt(k);k=(-ja+K)/(2*da);da=(-ja-K)/(2*da);if((0>k||1<k)&&(0>da||1<da))return 0>k&&0>da||1<k&&1<da?q("outside"):
q("inside");ja=[];0<=k&&1>=k&&ja.push(yd.lrp(a,d,k));0<=da&&1>=da&&ja.push(yd.lrp(a,d,da));return q("intersection",...ja)}function g(a,d,k,K,da,ja=0){if(0===K||0===da||yd.isEqual(a,d))return q("no intersection");K=0>K?K:-K;da=0>da?da:-da;a=yd.sub(yd.rotWith(a,k,-ja),k);d=yd.sub(yd.rotWith(d,k,-ja),k);var ra=yd.sub(d,a),Ja=ra[0]*ra[0]/K/K+ra[1]*ra[1]/da/da;ra=2*a[0]*ra[0]/K/K+2*a[1]*ra[1]/da/da;const Ra=[];K=ra*ra-4*Ja*(a[0]*a[0]/K/K+a[1]*a[1]/da/da-1);0===K?Ra.push(-ra/2/Ja):0<K&&(K=Math.sqrt(K),
Ra.push((-ra+K)/2/Ja),Ra.push((-ra-K)/2/Ja));Ja=Ra.filter($a=>0<=$a&&1>=$a).map($a=>yd.add(k,yd.add(a,yd.mul(yd.sub(d,a),$a)))).map($a=>yd.rotWith($a,k,ja));return q("intersection",...Ja)}function h(a,d,k){const K=[];for(let da=1;da<k.length;da++){const ja=C(a,d,k[da-1],k[da]);ja&&K.push(...ja.points)}return 0===K.length?q("no intersection"):q("intersection",...k)}function b(a,d,k,K,da){return c(a,d,k).reduce((ja,[ra,[Ja,Ra]])=>{(Ja=u(K,da,Ja,Ra))&&ja.push(q(ra,...Ja.points));return ja},[]).filter(ja=>
ja.didIntersect)}function l(a,d,k,K){return c(a,d).reduce((da,[ja,[ra,Ja]])=>{(ra=C(k,K,ra,Ja))&&da.push(q(ja,...ra.points));return da},[]).filter(da=>da.didIntersect)}function m(a,d,k,K){return c(a,d).reduce((da,[ja,[ra,Ja]])=>{(ra=P(ra,Ja,k,K))&&da.push(ff(Zd({},ra),{message:ja}));return da},[]).filter(da=>da.didIntersect)}function p(a,d,k,K,da,ja=0){return c(a,d).reduce((ra,[Ja,[Ra,$a]])=>{(Ra=g(Ra,$a,k,K,da,ja))&&ra.push(ff(Zd({},Ra),{message:Ja}));return ra},[]).filter(ra=>ra.didIntersect)}function D(a,
d,k){return c(a,d).reduce((K,[da,[ja,ra]])=>{ja=h(ja,ra,k);ja.didIntersect&&K.push(q(da,...ja.points));return K},[]).filter(K=>K.didIntersect)}function v(a,d,k){return c(a,d).reduce((K,[da,[ja,ra]])=>{{const Ja=[];for(let Ra=1;Ra<k.length+1;Ra++){const $a=C(ja,ra,k[Ra-1],k[Ra%k.length]);$a&&Ja.push(...$a.points)}ja=0===Ja.length?q("no intersection"):q("intersection",...k)}ja.didIntersect&&K.push(q(da,...ja.points));return K},[]).filter(K=>K.didIntersect)}function t(a,d,k,K=0,da,ja){return d===k?m(da,
ja,a,d):p(da,ja,a,d,k,K)}function r(a,d,k){const {minX:K,minY:da,width:ja,height:ra}=a;return l([K,da],[ja,ra],d,k)}function f(a){for(var d=arguments.length,k=Array(1<d?d-1:0),K=1;K<d;K++)k[K-1]=arguments[K];throw Error("number"===typeof a?"[MobX] minified error nr: "+a+(k.length?" "+k.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+a);}function E(){return"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?
window:"undefined"!==typeof ya?ya:"undefined"!==typeof self?self:FD}function B(){HD||f("Proxy not available")}function J(a){var d=!1;return function(){if(!d)return d=!0,a.apply(this,arguments)}}function V(a){return"function"===typeof a}function H(a){switch(typeof a){case "string":case "symbol":case "number":return!0}return!1}function S(a){return null!==a&&"object"===typeof a}function L(a){if(!S(a))return!1;a=Object.getPrototypeOf(a);if(null==a)return!0;a=Object.hasOwnProperty.call(a,"constructor")&&
a.constructor;return"function"===typeof a&&a.toString()===ID}function T(a){return(a=null==a?void 0:a.constructor)?"GeneratorFunction"===a.name||"GeneratorFunction"===a.displayName?!0:!1:!1}function R(a,d,k){jp(a,d,{enumerable:!1,writable:!0,configurable:!0,value:k})}function G(a,d,k){jp(a,d,{enumerable:!1,writable:!1,configurable:!0,value:k})}function F(a,d){var k="isMobX"+a;d.prototype[k]=!0;return function(K){return S(K)&&!0===K[k]}}function O(a){return a instanceof Map}function M(a){return a instanceof
Set}function I(a){var d=Object.keys(a);if(!Zy)return d;var k=Object.getOwnPropertySymbols(a);return k.length?[].concat(d,k.filter(function(K){return pt.propertyIsEnumerable.call(a,K)})):d}function ia(a){return null===a?null:"object"===typeof a?""+a:a}function U(a,d){return pt.hasOwnProperty.call(a,d)}function Z(a,d){for(var k=0;k<d.length;k++){var K=d[k];K.enumerable=K.enumerable||!1;K.configurable=!0;"value"in K&&(K.writable=!0);Object.defineProperty(a,K.key,K)}}function aa(a,d,k){d&&Z(a.prototype,
d);k&&Z(a,k);Object.defineProperty(a,"prototype",{writable:!1});return a}function W(){W=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],K;for(K in k)Object.prototype.hasOwnProperty.call(k,K)&&(a[K]=k[K])}return a};return W.apply(this,arguments)}function fa(a,d){a.prototype=Object.create(d.prototype);a.prototype.constructor=a;X(a,d)}function X(a,d){X=Object.setPrototypeOf||function(k,K){k.__proto__=K;return k};return X(a,d)}function ea(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return a}function pa(a,d){if(a){if("string"===typeof a)return va(a,d);var k=Object.prototype.toString.call(a).slice(8,-1);"Object"===k&&a.constructor&&(k=a.constructor.name);if("Map"===k||"Set"===k)return Array.from(a);if("Arguments"===k||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return va(a,d)}}function va(a,d){if(null==d||d>a.length)d=a.length;for(var k=0,K=Array(d);k<d;k++)K[k]=a[k];return K}function ta(a,d){var k="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(k)return(k=
k.call(a)).next.bind(k);if(Array.isArray(a)||(k=pa(a))||d&&a&&"number"===typeof a.length){k&&(a=k);var K=0;return function(){return K>=a.length?{done:!0}:{done:!1,value:a[K++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function xa(a){return Object.assign(function(d,k){Ga(d,k,a)},a)}function Ga(a,d,k){U(a,ko)||R(a,ko,W({},a[ko]));k.annotationType_!==KD&&(a[ko][d]=k)}function Ia(a){U(a,
ko)||R(a,ko,W({},a[ko]));return a[ko]}function Ya(a,d,k){void 0===d&&(d=bs);void 0===k&&(k=bs);a=new qt(a);d!==bs&&Ic($D,a,d,void 0);k!==bs&&pd(a,k);return a}function Fa(a,d,k){return kd(a)?a:Array.isArray(a)?yg.array(a,{name:k}):L(a)?yg.object(a,void 0,{name:k}):O(a)?yg.map(a,{name:k}):M(a)?yg.set(a,{name:k}):"function"!==typeof a||Jc(a)||ue(a)?a:T(a)?vt(a):ut(k,a)}function Ka(a){return a}function Ba(a,d){return{annotationType_:a,options_:d,make_:la,extend_:ka}}function la(a,d,k,K){var da;if(null!=
(da=this.options_)&&da.bound)return null===this.extend_(a,d,k,!1)?0:1;if(K===a.target_)return null===this.extend_(a,d,k,!1)?0:2;if(Jc(k.value))return 1;a=ua(a,this,d,k,!1);jp(K,d,a);return 2}function ka(a,d,k,K){k=ua(a,this,d,k);return a.defineProperty_(d,k,K)}function ua(a,d,k,K,da){var ja,ra,Ja,Ra,$a,fb,jb;void 0===da&&(da=Af.safeDescriptors);K=K.value;if(null!=(ja=d.options_)&&ja.bound){var Jb;K=K.bind(null!=(Jb=a.proxy_)?Jb:a.target_)}return{value:Pa(null!=(ra=null==(Ja=d.options_)?void 0:Ja.name)?
ra:k.toString(),K,null!=(Ra=null==($a=d.options_)?void 0:$a.autoAction)?Ra:!1,null!=(fb=d.options_)&&fb.bound?null!=(jb=a.proxy_)?jb:a.target_:void 0),configurable:da?a.isPlainObject_:!0,enumerable:!1,writable:da?!1:!0}}function na(a,d){return{annotationType_:a,options_:d,make_:oa,extend_:La}}function oa(a,d,k,K){var da;if(K===a.target_)return null===this.extend_(a,d,k,!1)?0:2;if(null!=(da=this.options_)&&da.bound&&(!U(a.target_,d)||!ue(a.target_[d]))&&null===this.extend_(a,d,k,!1))return 0;if(ue(k.value))return 1;
a=Oa(a,this,d,k,!1,!1);jp(K,d,a);return 2}function La(a,d,k,K){var da;k=Oa(a,this,d,k,null==(da=this.options_)?void 0:da.bound);return a.defineProperty_(d,k,K)}function Oa(a,d,k,K,da,ja){void 0===ja&&(ja=Af.safeDescriptors);d=K.value;ue(d)||(d=vt(d));if(da){var ra;d=d.bind(null!=(ra=a.proxy_)?ra:a.target_);d.isMobXFlow=!0}return{value:d,configurable:ja?a.isPlainObject_:!0,enumerable:!1,writable:ja?!1:!0}}function Va(a,d){return{annotationType_:a,options_:d,make_:Ma,extend_:Ua}}function Ma(a,d,k){return null===
this.extend_(a,d,k,!1)?0:1}function Ua(a,d,k,K){return a.defineComputedProperty_(d,W({},this.options_,{get:k.get,set:k.set}),K)}function ib(a,d){return{annotationType_:a,options_:d,make_:vb,extend_:yb}}function vb(a,d,k){return null===this.extend_(a,d,k,!1)?0:1}function yb(a,d,k,K){var da,ja;return a.defineObservableProperty_(d,k.value,null!=(da=null==(ja=this.options_)?void 0:ja.enhancer)?da:Fa,K)}function Wa(a){return{annotationType_:"true",options_:a,make_:hb,extend_:ab}}function hb(a,d,k,K){var da,
ja;if(k.get)return Dg.make_(a,d,k,K);if(k.set){k=Pa(d.toString(),k.set);if(K===a.target_)return null===a.defineProperty_(d,{configurable:Af.safeDescriptors?a.isPlainObject_:!0,set:k})?0:2;jp(K,d,{configurable:!0,set:k});return 2}if(K!==a.target_&&"function"===typeof k.value){var ra;if(T(k.value)){var Ja;return(null!=(Ja=this.options_)&&Ja.autoBind?vt.bound:vt).make_(a,d,k,K)}return(null!=(ra=this.options_)&&ra.autoBind?ut.bound:ut).make_(a,d,k,K)}ra=!1===(null==(da=this.options_)?void 0:da.deep)?
yg.ref:yg;if("function"===typeof k.value&&null!=(ja=this.options_)&&ja.autoBind){var Ra;k.value=k.value.bind(null!=(Ra=a.proxy_)?Ra:a.target_)}return ra.make_(a,d,k,K)}function ab(a,d,k,K){var da,ja;if(k.get)return Dg.extend_(a,d,k,K);if(k.set)return a.defineProperty_(d,{configurable:Af.safeDescriptors?a.isPlainObject_:!0,set:Pa(d.toString(),k.set)},K);if("function"===typeof k.value&&null!=(da=this.options_)&&da.autoBind){var ra;k.value=k.value.bind(null!=(ra=a.proxy_)?ra:a.target_)}return(!1===(null==
(ja=this.options_)?void 0:ja.deep)?yg.ref:yg).extend_(a,d,k,K)}function Qa(a){if(!0===a.deep)var d=Fa;else{if(!1===a.deep)a=Ka;else{a=a.defaultDecorator;var k;a=a?null!=(d=null==(k=a.options_)?void 0:k.enhancer)?d:Fa:Fa}d=a}return d}function bb(a,d,k){if(H(d))Ga(a,d,$y);else return kd(a)?a:L(a)?yg.object(a,d,k):Array.isArray(a)?yg.array(a,d):O(a)?yg.map(a,d):M(a)?yg.set(a,d):"object"===typeof a&&null!==a?a:yg.box(a,d)}function Pa(a,d,k,K){function da(){a:{var ja=K||this,ra=arguments,Ja=Af.trackingDerivation,
Ra=!k||!Ja;Sc();var $a=Af.allowStateChanges;Ra&&(dc(),$a=xc(!0));var fb=Nc(!0),jb=RD++,Jb=Tu;Tu=jb;try{var Ob=d.apply(ja,ra);break a}catch(gc){var Kb=gc;throw gc;}finally{Tu!==jb&&f(30),Tu=Jb,void 0!==Kb&&(Af.suppressReactionErrors=!0),Af.allowStateChanges=$a,Af.allowStateReads=fb,Ib(),Ra&&(Af.trackingDerivation=Ja),Af.suppressReactionErrors=!1}Ob=void 0}return Ob}void 0===k&&(k=!1);da.isMobxAction=!0;SD&&(ez.value=a,Object.defineProperty(da,"name",ez));return da}function Lb(a,d){a=xc(a);try{return d()}finally{Af.allowStateChanges=
a}}function xc(a){var d=Af.allowStateChanges;Af.allowStateChanges=a;return d}function oc(a){switch(a.dependenciesState_){case Ti.UP_TO_DATE_:return!1;case Ti.NOT_TRACKING_:case Ti.STALE_:return!0;case Ti.POSSIBLY_STALE_:for(var d=Nc(!0),k=dc(),K=a.observing_,da=K.length,ja=0;ja<da;ja++){var ra=K[ja];if(tt(ra)){if(Af.disableErrorBoundaries)ra.get();else try{ra.get()}catch(Ja){return Af.trackingDerivation=k,Af.allowStateReads=d,!0}if(a.dependenciesState_===Ti.STALE_)return Af.trackingDerivation=k,Af.allowStateReads=
d,!0}}Qc(a);Af.trackingDerivation=k;Af.allowStateReads=d;return!1}}function pc(a,d,k){var K=Nc(!0);Qc(a);a.newObserving_=Array(a.observing_.length+100);a.unboundDepsCount_=0;a.runId_=++Af.runId;var da=Af.trackingDerivation;Af.trackingDerivation=a;Af.inBatch++;if(!0===Af.disableErrorBoundaries)var ja=d.call(k);else try{ja=d.call(k)}catch(fb){ja=new fr(fb)}Af.inBatch--;Af.trackingDerivation=da;var ra=a.observing_;d=a.observing_=a.newObserving_;k=Ti.UP_TO_DATE_;da=0;for(var Ja=a.unboundDepsCount_,Ra=
0;Ra<Ja;Ra++){var $a=d[Ra];0===$a.diffValue_&&($a.diffValue_=1,da!==Ra&&(d[da]=$a),da++);$a.dependenciesState_>k&&(k=$a.dependenciesState_)}d.length=da;a.newObserving_=null;for(Ja=ra.length;Ja--;)Ra=ra[Ja],0===Ra.diffValue_&&Xc(Ra,a),Ra.diffValue_=0;for(;da--;)ra=d[da],1===ra.diffValue_&&(ra.diffValue_=0,Ja=a,ra.observers_.add(Ja),ra.lowestObserverState_>Ja.dependenciesState_&&(ra.lowestObserverState_=Ja.dependenciesState_));k!==Ti.UP_TO_DATE_&&(a.dependenciesState_=k,a.onBecomeStale_());Af.allowStateReads=
K;return ja}function Cc(a){var d=a.observing_;a.observing_=[];for(var k=d.length;k--;)Xc(d[k],a);a.dependenciesState_=Ti.NOT_TRACKING_}function bd(a){var d=dc();try{return a()}finally{Af.trackingDerivation=d}}function dc(){var a=Af.trackingDerivation;Af.trackingDerivation=null;return a}function Nc(a){var d=Af.allowStateReads;Af.allowStateReads=a;return d}function Qc(a){if(a.dependenciesState_!==Ti.UP_TO_DATE_){a.dependenciesState_=Ti.UP_TO_DATE_;a=a.observing_;for(var d=a.length;d--;)a[d].lowestObserverState_=
Ti.UP_TO_DATE_}}function Ad(){(Af.pendingReactions.length||Af.inBatch||Af.isRunningReactions)&&f(36);fz=!0;if(Vu){var a=E();0===--a.__mobxInstanceCount&&(a.__mobxGlobals=void 0);Af=new Uu}}function Xc(a,d){a.observers_["delete"](d);0===a.observers_.size&&sc(a)}function sc(a){!1===a.isPendingUnobservation_&&(a.isPendingUnobservation_=!0,Af.pendingUnobservations.push(a))}function Sc(){Af.inBatch++}function Ib(){if(0===--Af.inBatch){0<Af.inBatch||Af.isRunningReactions||Wu(rb);for(var a=Af.pendingUnobservations,
d=0;d<a.length;d++){var k=a[d];k.isPendingUnobservation_=!1;0===k.observers_.size&&(k.isBeingObserved_&&(k.isBeingObserved_=!1,k.onBUO()),k instanceof st&&k.suspend_())}Af.pendingUnobservations=[]}}function lb(a){var d=Af.trackingDerivation;if(null!==d)return d.runId_!==a.lastAccessedBy_&&(a.lastAccessedBy_=d.runId_,d.newObserving_[d.unboundDepsCount_++]=a,!a.isBeingObserved_&&Af.trackingContext&&(a.isBeingObserved_=!0,a.onBO())),a.isBeingObserved_;0===a.observers_.size&&0<Af.inBatch&&sc(a);return!1}
function Db(a){a.lowestObserverState_!==Ti.STALE_&&(a.lowestObserverState_=Ti.STALE_,a.observers_.forEach(function(d){if(d.dependenciesState_===Ti.UP_TO_DATE_)d.onBecomeStale_();d.dependenciesState_=Ti.STALE_}))}function Gb(a){a.lowestObserverState_!==Ti.STALE_&&(a.lowestObserverState_=Ti.STALE_,a.observers_.forEach(function(d){d.dependenciesState_===Ti.POSSIBLY_STALE_?d.dependenciesState_=Ti.STALE_:d.dependenciesState_===Ti.UP_TO_DATE_&&(a.lowestObserverState_=Ti.UP_TO_DATE_)}))}function db(a){a.lowestObserverState_===
Ti.UP_TO_DATE_&&(a.lowestObserverState_=Ti.POSSIBLY_STALE_,a.observers_.forEach(function(d){d.dependenciesState_===Ti.UP_TO_DATE_&&(d.dependenciesState_=Ti.POSSIBLY_STALE_,d.onBecomeStale_())}))}function rb(){Af.isRunningReactions=!0;for(var a=Af.pendingReactions,d=0;0<a.length;){++d===WD&&(console.error("[mobx] cycle in reaction: "+a[0]),a.splice(0));for(var k=a.splice(0),K=0,da=k.length;K<da;K++)k[K].runReaction_()}Af.isRunningReactions=!1}function Nb(a){var d=Wu;Wu=function(k){return a(function(){return d(k)})}}
function fc(a){console.warn("[mobx.spy] Is a no-op in production builds");return function(){}}function Bc(a){return function(d,k){if(V(d))return Pa(d.name||"\x3cunnamed action\x3e",d,a);if(V(k))return Pa(d,k,a);if(H(k))return Ga(d,k,a?iz:hz);if(H(d))return xa(Ba(a?"autoAction":gz,{name:d,autoAction:a}))}}function Jc(a){return V(a)&&!0===a.isMobxAction}function ic(a,d){function k(){a(Ra)}var K,da;void 0===d&&(d=Ow);var ja=null!=(K=null==(da=d)?void 0:da.name)?K:"Autorun";if(d.scheduler||d.delay){var ra=
Oc(d),Ja=!1;var Ra=new es(ja,function(){Ja||(Ja=!0,ra(function(){Ja=!1;Ra.isDisposed_||Ra.track(k)}))},d.onError,d.requiresObservable)}else Ra=new es(ja,function(){this.track(k)},d.onError,d.requiresObservable);Ra.schedule_();return Ra.getDisposer_()}function Oc(a){return a.scheduler?a.scheduler:a.delay?function(d){return setTimeout(d,a.delay)}:ZD}function Rc(a,d,k){function K(){fb=!1;if(!Kb.isDisposed_){var gc=!1;Kb.track(function(){var rc=Lb(!1,function(){return a(Kb)});gc=$a||!Ob(jb,rc);Jb=jb;
jb=rc});$a&&k.fireImmediately?ra(jb,Jb,Kb):!$a&&gc&&ra(jb,Jb,Kb);$a=!1}}var da;void 0===k&&(k=Ow);var ja=null!=(da=k.name)?da:"Reaction",ra=jg(ja,k.onError?fd(k.onError,d):d),Ja=!k.scheduler&&!k.delay,Ra=Oc(k),$a=!0,fb=!1,jb,Jb,Ob=k.compareStructural?cs.structural:k.equals||cs["default"],Kb=new es(ja,function(){$a||Ja?K():fb||(fb=!0,Ra(K))},k.onError,k.requiresObservable);Kb.schedule_();return Kb.getDisposer_()}function fd(a,d){return function(){try{return d.apply(this,arguments)}catch(k){a.call(this,
k)}}}function pd(a,d,k){return Ic(aE,a,d,k)}function Ic(a,d,k,K){var da="function"===typeof K?ec(d,k):ec(d),ja=V(K)?K:k,ra=a+"L";da[ra]?da[ra].add(ja):da[ra]=new Set([ja]);return function(){var Ja=da[ra];Ja&&(Ja["delete"](ja),0===Ja.size&&delete da[ra])}}function wc(a){!0===a.isolateGlobalState&&Ad();var d=a.useProxies,k=a.enforceActions;void 0!==d&&(Af.useProxies="always"===d?!0:"never"===d?!1:"undefined"!==typeof Proxy);"ifavailable"===d&&(Af.verifyProxies=!0);void 0!==k&&(d="always"===k?"always":
"observed"===k,Af.enforceActions=d,Af.allowStateChanges=!0===d||"always"===d?!1:!0);["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(K){K in a&&(Af[K]=!!a[K])});Af.allowStateReads=!Af.observableRequiresReaction;a.reactionScheduler&&Nb(a.reactionScheduler)}function je(a,d,k,K){var da=JD(d),ja=Hd(a,K)[ih];Sc();try{Su(da).forEach(function(ra){ja.extend_(ra,da[ra],k?ra in k?k[ra]:!0:!0)})}finally{Ib()}return a}
function pf(a){var d={name:a.name_};a.observing_&&0<a.observing_.length&&(d.dependencies=Array.from(new Set(a.observing_)).map(pf));return d}function qe(){this.message="FLOW_CANCELLED"}function ue(a){return!0===(null==a?void 0:a.isMobXFlow)}function kd(a,d){return a?void 0!==d?ve(a)?a[ih].values_.has(d):!1:ve(a)||!!a[ih]||Pw(a)||Xu(a)||tt(a):!1}function Ae(a){if(ve(a))return a[ih].ownKeys_();f(38)}function Bf(a,d,k){a.set(d,k);return k}function gg(a,d){if(null==a||"object"!==typeof a||a instanceof
Date||!kd(a))return a;if(UD(a)||tt(a))return gg(a.get(),d);if(d.has(a))return d.get(a);if(rd(a)){var k=Bf(d,a,Array(a.length));a.forEach(function(ra,Ja){k[Ja]=gg(ra,d)});return k}if(gr(a)){var K=Bf(d,a,new Set);a.forEach(function(ra){K.add(gg(ra,d))});return K}if(Vp(a)){var da=Bf(d,a,new Map);a.forEach(function(ra,Ja){da.set(Ja,gg(ra,d))});return da}var ja=Bf(d,a,{});Ae(a).forEach(function(ra){pt.propertyIsEnumerable.call(a,ra)&&(ja[ra]=gg(a[ra],d))});return ja}function jc(a,d){return gg(a,new Map)}
function Zc(){f("trace() is not available in production builds");for(var a=!1,d=arguments.length,k=Array(d),K=0;K<d;K++)k[K]=arguments[K];"boolean"===typeof k[k.length-1]&&(a=k.pop());a:{switch(k.length){case 0:d=Af.trackingDerivation;break a;case 1:d=ec(k[0]);break a;case 2:d=ec(k[0],k[1]);break a}d=void 0}if(!d)return f("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");d.isTracing_===ds.NONE&&console.log("[mobx.trace] '"+
d.name_+"' tracing enabled");d.isTracing_=a?ds.BREAK:ds.LOG}function Gc(a,d){void 0===d&&(d=void 0);Sc();try{return a.apply(d)}finally{Ib()}}function ub(a){return void 0!==a.interceptors_&&0<a.interceptors_.length}function Bb(a,d){var k=a.interceptors_||(a.interceptors_=[]);k.push(d);return J(function(){var K=k.indexOf(d);-1!==K&&k.splice(K,1)})}function Eb(a,d){var k=dc();try{var K=[].concat(a.interceptors_||[]);a=0;for(var da=K.length;a<da&&((d=K[a](d))&&!d.type&&f(14),d);a++);return d}finally{Af.trackingDerivation=
k}}function hd(a){return void 0!==a.changeListeners_&&0<a.changeListeners_.length}function Ud(a,d){var k=a.changeListeners_||(a.changeListeners_=[]);k.push(d);return J(function(){var K=k.indexOf(d);-1!==K&&k.splice(K,1)})}function Td(a,d){var k=dc();if(a=a.changeListeners_){a=a.slice();for(var K=0,da=a.length;K<da;K++)a[K](d);Af.trackingDerivation=k}}function Ue(a,d,k){var K=Hd(a,k)[ih];Sc();try{var da;null!=(da=d)?da:d=Ia(a);Su(d).forEach(function(ja){return K.make_(ja,d[ja])})}finally{Ib()}return a}
function kb(a,d,k,K){void 0===k&&(k="ObservableArray");void 0===K&&(K=!1);B();d=new Qw(k,d,K,!1);G(d.values_,ih,d);k=new Proxy(d.values_,eE);d.proxy_=k;a&&a.length&&(K=xc(!0),d.spliceWithArray_(0,0,a),Af.allowStateChanges=K);return k}function tb(a,d){"function"===typeof Array.prototype[a]&&(Yu[a]=d(a))}function ob(a){return function(){var d=this[ih];d.atom_.reportObserved();d=d.dehanceValues_(d.values_);return d[a].apply(d,arguments)}}function Ub(a){return function(d,k){var K=this,da=this[ih];da.atom_.reportObserved();
return da.dehanceValues_(da.values_)[a](function(ja,ra){return d.call(k,ja,ra,K)})}}function Tb(a){return function(){var d=this,k=this[ih];k.atom_.reportObserved();k=k.dehanceValues_(k.values_);var K=arguments[0];arguments[0]=function(da,ja,ra){return K(da,ja,ra,d)};return k[a].apply(k,arguments)}}function rd(a){return S(a)&&fE(a[ih])}function td(a){if(O(a)||Vp(a))return a;if(Array.isArray(a))return new Map(a);if(L(a)){var d=new Map,k;for(k in a)d.set(k,a[k]);return d}return f(21,a)}function Hd(a,
d){var k;if(U(a,ih))return a;var K=null!=(k=null==d?void 0:d.name)?k:"ObservableObject";k=nz;var da=new Map;K=String(K);var ja;var ra=d?null!=(ja=d.defaultDecorator)?ja:Wa(d):void 0;d=new k(a,da,K,ra);R(a,ih,d);return a}function te(a){return mz[a]||(mz[a]={get:function(){return this[ih].getObservablePropValue_(a)},set:function(d){return this[ih].setObservablePropValue_(a,d)}})}function ve(a){return S(a)?mE(a[ih]):!1}function pe(a){return{enumerable:!1,configurable:!0,get:function(){return this[ih].get_(a)},
set:function(d){this[ih].set_(a,d)}}}function $d(a){if(a>Rw){for(var d=Rw;d<a+100;d++)jp(Sw.prototype,""+d,pe(d));Rw=a}}function Ab(a,d,k){return new Sw(a,d,k)}function ec(a,d){if("object"===typeof a&&null!==a){if(rd(a))return void 0!==d&&f(23),a[ih].atom_;if(gr(a))return a[ih];if(Vp(a)){if(void 0===d)return a.keysAtom_;var k=a.data_.get(d)||a.hasMap_.get(d);k||f(25,d,Xa(a));return k}if(ve(a)){if(!d)return f(26);(k=a[ih].values_.get(d))||f(27,d,Xa(a));return k}if(Pw(a)||tt(a)||Xu(a))return a}else if(V(a)&&
Xu(a[ih]))return a[ih];f(28)}function vc(a,d){a||f(29);if(void 0!==d)return vc(ec(a,d));if(Pw(a)||tt(a)||Xu(a)||Vp(a)||gr(a))return a;if(a[ih])return a[ih];f(24,a)}function Xa(a,d){if(void 0!==d)a=ec(a,d);else{if(Jc(a))return a.name;a=ve(a)||Vp(a)||gr(a)?vc(a):ec(a)}return a.name_}function sa(a,d,k){void 0===k&&(k=-1);return qa(a,d,k)}function qa(a,d,k,K,da){if(a===d)return 0!==a||1/a===1/d;if(null==a||null==d)return!1;if(a!==a)return d!==d;var ja=typeof a;if("function"!==ja&&"object"!==ja&&"object"!=
typeof d)return!1;ja=pz.call(a);if(ja!==pz.call(d))return!1;switch(ja){case "[object RegExp]":case "[object String]":return""+a===""+d;case "[object Number]":return+a!==+a?+d!==+d:0===+a?1/+a===1/d:+a===+d;case "[object Date]":case "[object Boolean]":return+a===+d;case "[object Symbol]":return"undefined"!==typeof Symbol&&Symbol.valueOf.call(a)===Symbol.valueOf.call(d);case "[object Map]":case "[object Set]":0<=k&&k++}a=Da(a);d=Da(d);ja="[object Array]"===ja;if(!ja){if("object"!=typeof a||"object"!=
typeof d)return!1;var ra=a.constructor,Ja=d.constructor;if(ra!==Ja&&!(V(ra)&&ra instanceof ra&&V(Ja)&&Ja instanceof Ja)&&"constructor"in a&&"constructor"in d)return!1}if(0===k)return!1;0>k&&(k=-1);K=K||[];da=da||[];for(ra=K.length;ra--;)if(K[ra]===a)return da[ra]===d;K.push(a);da.push(d);if(ja){ra=a.length;if(ra!==d.length)return!1;for(;ra--;)if(!qa(a[ra],d[ra],k-1,K,da))return!1}else{ja=Object.keys(a);ra=ja.length;if(Object.keys(d).length!==ra)return!1;for(;ra--;)if(Ja=ja[ra],!U(d,Ja)||!qa(a[Ja],
d[Ja],k-1,K,da))return!1}K.pop();da.pop();return!0}function Da(a){return rd(a)?a.slice():O(a)||Vp(a)||M(a)||gr(a)?Array.from(a.entries()):a}function Ta(a){a[Symbol.iterator]=wb;return a}function wb(){return this}function ac(a,d){const k=new Set(d),K=Object.values(a),da=new Set(K.filter(ja=>k.has(ja.toId)||k.has(ja.fromId)));a=da.size;for(d=-1;0!==d;)da.forEach(ja=>{ja=ja.fromId;for(const ra of K)ra.fromId===ja&&da.add(ra),ra.toId===ja&&da.add(ra)}),d=da.size-a,a=da.size;return Array.from(da.values())}
function Hc(a,d,k,K,da,ja,ra,Ja){if(da=d.getBindingPoint(da,ja,ra,Ja))return{id:K,type:"line",fromId:a.id,toId:d.id,handleId:k,point:be.toFixed(da.point),distance:da.distance}}function Wc(a,d){const k=a.getCenter(),K=d.getCenter();var da=qk();da=ff(Zd({},wt.defaultProps),{id:da,type:wt.id,parentId:a.props.parentId,point:k});a=Hc(da,a,"start",qk(),k,k,be.uni(be.sub(K,k)),!1);d=Hc(da,d,"end",qk(),K,K,be.uni(be.sub(k,K)),!1);return a&&d?(da.handles.start.point=[0,0],da.handles.end.point=be.sub(K,k),
da.handles.start.bindingId=a.id,da.handles.end.bindingId=d.id,[da,[a,d]]):null}function Wd(){return new vE}function re(){return new WeakMap}function xe(a){if(!a)return $w(null);var d=a.constructor;if(d===Object)return a===Object.prototype?{}:$w(a);if(~tE.call(d).indexOf("[native code]"))try{return new d}catch(k){}return $w(a)}function Cf(a){var d="";a.global&&(d+="g");a.ignoreCase&&(d+="i");a.multiline&&(d+="m");a.unicode&&(d+="u");a.sticky&&(d+="y");return d}function kf(a){return a.flags}function Df(a){a=
uE.call(a);return a.substring(8,a.length-1)}function tf(a){return a[Symbol.toStringTag]||Df(a)}function rg(a){return bA(a).concat(ax(a))}function gh(a,d,k){for(var K=CE(a),da=0,ja=K.length,ra,Ja;da<ja;++da)if(ra=K[da],"callee"!==ra&&"caller"!==ra)if(Ja=AE(a,ra)){Ja.get||Ja.set||(Ja.value=k.copier(Ja.value,k));try{zE(d,ra,Ja)}catch(Ra){d[ra]=Ja.value}}else d[ra]=k.copier(a[ra],k);return d}function jh(a,d){var k=new d.Constructor;d.cache.set(a,k);a.forEach(function(K,da){k.set(da,d.copier(K,d))});return k}
function Uf(a,d){var k=xe(d.prototype);d.cache.set(a,k);for(var K in a)dA.call(a,K)&&(k[K]=d.copier(a[K],d));return k}function hh(a,d){var k=xe(d.prototype);d.cache.set(a,k);for(var K in a)dA.call(a,K)&&(k[K]=d.copier(a[K],d));K=ax(a);for(var da=0,ja=K.length,ra;da<ja;++da)ra=K[da],BE.call(a,ra)&&(k[ra]=d.copier(a[ra],d));return k}function ti(a,d){return new d.Constructor(a.valueOf())}function hi(a,d){return a}function Rj(a,d){var k=new d.Constructor;d.cache.set(a,k);a.forEach(function(K){k.add(d.copier(K,
d))});return k}function Lk(a){function d(ja,ra){ra.prototype=ra.Constructor=void 0;if(!ja||"object"!==typeof ja)return ja;if(ra.cache.has(ja))return ra.cache.get(ja);ra.prototype=ja.__proto__||EE(ja);ra.Constructor=ra.prototype&&ra.prototype.constructor;if(!ra.Constructor||ra.Constructor===Object)return da(ja,ra);if(DE(ja))return K(ja,ra);var Ja=k[yE(ja)];return Ja?Ja(ja,ra):"function"===typeof ja.then?ja:da(ja,ra)}a=bx({},fA,a);var k={Arguments:a.object,Array:a.array,ArrayBuffer:a.arrayBuffer,Blob:a.blob,
Boolean:ti,DataView:a.dataView,Date:a.date,Error:a.error,Float32Array:a.arrayBuffer,Float64Array:a.arrayBuffer,Int8Array:a.arrayBuffer,Int16Array:a.arrayBuffer,Int32Array:a.arrayBuffer,Map:a.map,Number:ti,Object:a.object,Promise:hi,RegExp:a.regExp,Set:a.set,String:ti,WeakMap:hi,WeakSet:hi,Uint8Array:a.arrayBuffer,Uint8ClampedArray:a.arrayBuffer,Uint16Array:a.arrayBuffer,Uint32Array:a.arrayBuffer,Uint64Array:a.arrayBuffer},K=k.Array,da=k.Object;return function(ja){return d(ja,{Constructor:void 0,cache:wE(),
copier:d,prototype:void 0})}}function Vl(a,d){return(0,IE.default)(a,d,{arrayMerge:(k,K,da)=>K})}function jk(a,d,k,K=!1){const [da,ja]=d,[ra,Ja]=k;a=ra+(a-da)/(ja-da)*(Ja-ra);return K?ra<Ja?Math.max(Math.min(a,Ja),ra):Math.max(Math.min(a,ra),Ja):a}function lj(a,d){return new Promise((k,K)=>{if("video"===d){const da=document.createElement("video");da.addEventListener("loadedmetadata",function(){k([this.videoWidth,this.videoHeight])},!1);da.src=a}else if("image"===d){const da=new Image;da.onload=()=>
k([da.width,da.height]);da.src=a;da.onerror=ja=>K(ja)}else"pdf"===d&&k([595,842])})}function Gi(a){return Object.values(Iw).includes(a)}function sh(a,d){return Gi(a)||null==a?`var(--ls-wb-${d}-color-${a?a:"default"})`:a}function Wl(){var a;null==(a=document.getElementById("__textLabelMeasure"))?void 0:a.remove();a=document.createElement("pre");a.id="__textLabelMeasure";Object.assign(a.style,{whiteSpace:"pre",width:"auto",borderLeft:"2px solid transparent",borderRight:"1px solid transparent",borderBottom:"2px solid transparent",
padding:"0px",margin:"0px",opacity:"0",position:"absolute",top:"-500px",left:"0px",zIndex:"9999",userSelect:"none",pointerEvents:"none",font:"var(--ls-font-family)"});a.tabIndex=-1;document.body.appendChild(a);return a}function Mi(a,d,k=0){var K,da,ja;if(!a)return[16,32];let ra;ra="string"===typeof d?d:`${null!=(K=d.fontStyle)?K:"normal"} ${null!=(da=d.fontVariant)?da:"normal"} ${null!=(ja=d.fontWeight)?ja:"normal"} ${d.fontSize}px/${d.fontSize*d.lineHeight}px ${d.fontFamily}`;if(!cx.has(`${a}-${ra}-${k}`)){if(!Zp)return[10,
10];Zp.parentNode||document.body.appendChild(Zp);Zp.innerHTML=`${a}&#8203;`;Zp.style.font=ra;Zp.style.padding=k+"px";d=Zp.getBoundingClientRect();cx.set(`${a}-${ra}-${k}`,[Math.ceil(d.width||1),Math.ceil(d.height||1)])}return cx.get(`${a}-${ra}-${k}`)}function Dj(a){try{if("string"!==typeof a||!ED.test(a))throw TypeError("Invalid UUID");let d;const k=new Uint8Array(16);k[0]=(d=parseInt(a.slice(0,8),16))>>>24;k[1]=d>>>16&255;k[2]=d>>>8&255;k[3]=d&255;k[4]=(d=parseInt(a.slice(9,13),16))>>>8;k[5]=d&
255;k[6]=(d=parseInt(a.slice(14,18),16))>>>8;k[7]=d&255;k[8]=(d=parseInt(a.slice(19,23),16))>>>8;k[9]=d&255;k[10]=(d=parseInt(a.slice(24,36),16))/1099511627776&255;k[11]=d/4294967296&255;k[12]=d>>>24&255;k[13]=d>>>16&255;k[14]=d>>>8&255;k[15]=d&255;return!0}catch(d){return!1}}function Xj(a,d=0,k){let K;return function(...da){null==k?void 0:k(...da);clearTimeout(K);K=setTimeout(()=>a.apply(da),d)}}function oh(){return/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)}function wf(){var a,d,k;return(null==
(k=null==(d=null==(a=null==window?void 0:window.logseq)?void 0:a.api)?void 0:d.get_state_from_store)?void 0:k.call(d,"ui/developer-mode?"))||!1}function cg(a){return!!a}function zk(a=0){return new Promise(d=>setTimeout(d,a))}function ll(a="noid"){dx[a]||(dx[a]=iA.createContext({}));return dx[a]}function dh(a="noid"){return iA.useContext(ll(a))}function kk(a){const {callbacks:d}=dh(),k=hA.useRef(-1);return hA.useMemo(()=>{const K=da=>{var ja,ra;const {order:Ja=0}=da;if(!Ja){var Ra=da.target;Ra.removeEventListener("pointerup",
K);Ra.releasePointerCapture(da.pointerId);null==(ja=d.onPointerUp)?void 0:ja.call(d,{type:"selection",handle:a,order:Ja},da);ja=Date.now();Ra=ja-k.current;300<Ra?k.current=ja:300>=Ra&&(null==(ra=d.onDoubleClick)?void 0:ra.call(d,{type:"selection",handle:a,order:Ja},da),k.current=-1);da.order=Ja+1}};return{onPointerDown:da=>{var ja;const {order:ra=0}=da;if(!ra){var Ja=Zk(da.currentTarget);Ja.setPointerCapture(da.pointerId);Ja.addEventListener("pointerup",K);null==(ja=d.onPointerDown)?void 0:ja.call(d,
{type:"selection",handle:a,order:ra},da);da.order=ra+1}},onPointerMove:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerMove)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},da),da.order=ra+1)},onPointerEnter:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerEnter)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},da),da.order=ra+1)},onPointerLeave:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerLeave)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},
da),da.order=ra+1)},onKeyDown:da=>{var ja;null==(ja=d.onKeyDown)?void 0:ja.call(d,{type:"selection",handle:a,order:-1},da)},onKeyUp:da=>{var ja;null==(ja=d.onKeyUp)?void 0:ja.call(d,{type:"selection",handle:a,order:-1},da)}}},[d])}function Zk(a){var d;if(null==(d=a.namespaceURI)?0:d.endsWith("svg")){if(a.parentElement)return Zk(a.parentElement);throw Error("Could not find a parent element of an HTML type!");}return a}function mj(a,d,k){const K=yt.useRef(!1),da=yt.useCallback(()=>{var ja;if(K.current){const ra=
null==(ja=a.current)?void 0:ja.getBoundingClientRect();ra&&(ja={minX:ra.left,maxX:ra.left+ra.width,minY:ra.top,maxY:ra.top+ra.height,width:ra.width,height:ra.height},d.updateBounds(ja),null==k?void 0:k(ja))}else K.current=!0},[a,k]);yt.useEffect(()=>{const ja=a.current?LE(a.current):document,ra=Xj(da,100);ja.addEventListener("scroll",ra);window.addEventListener("resize",ra);return()=>{ja.removeEventListener("scroll",ra);window.removeEventListener("resize",ra)}},[]);yt.useLayoutEffect(()=>{const ja=
new ResizeObserver(ra=>{ra[0].contentRect&&da()});a.current&&ja.observe(a.current);return()=>{ja.disconnect()}},[a]);yt.useEffect(()=>{da();setTimeout(()=>{var ja,ra;null==(ra=null==(ja=a.current)?void 0:ja.querySelector(".tl-canvas"))?void 0:ra.focus()})},[a])}function ml(a,d){return Object.keys(d).reduce((k,K)=>{const da=d[K];return da?k+`${`--${a}-${K}`}: ${da};
`:k},"")}function Ch(a,d,k=".logseq-tldraw"){ex.useLayoutEffect(()=>{const K=document.createElement("style"),da=ml(a,d);K.setAttribute("id",`${a}-theme`);K.setAttribute("data-selector",k);K.innerHTML=`
        ${k} {
          ${da}
        }
      `;document.head.appendChild(K);return()=>{K&&document.head.contains(K)&&document.head.removeChild(K)}},[a,d,k])}function Yj(a,d){ex.useLayoutEffect(()=>{if(fx.get(a))return()=>{};const k=document.createElement("style");k.innerHTML=d;k.setAttribute("id",a);document.head.appendChild(k);fx.set(a,k);return()=>{k&&document.head.contains(k)&&(document.head.removeChild(k),fx.delete(a))}},[a,d])}function $k(a,d){const k=ex.useMemo(()=>Zd(Zd({},ME),a),[a]);Ch("tl",k,d);Yj("tl-canvas",NE)}function Ej(a=
"noid"){gx[a]||(gx[a]=kA.createContext({}));return gx[a]}function mg(a="noid"){return kA.useContext(Ej(a))}function hg(){const a=mg(),{callbacks:d}=dh(),k=jA.useRef(-1);return jA.useMemo(()=>({onPointerDown:K=>{var da,ja,ra;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:Ja=0}=K;Ja||(null==(da=K.currentTarget)?void 0:da.setPointerCapture(K.pointerId));K.isPrimary&&(null==(ja=d.onPointerDown)?void 0:ja.call(d,{type:"canvas",order:Ja},K),da=Date.now(),ja=da-k.current,300<ja?k.current=
da:300>=ja&&(null==(ra=d.onDoubleClick)?void 0:ra.call(d,{type:"canvas",order:Ja},K),k.current=-1))}},onPointerMove:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerMove)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onPointerUp:K=>{var da,ja;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ra=0}=K;ra||(null==(da=K.currentTarget)?void 0:da.releasePointerCapture(K.pointerId));null==(ja=d.onPointerUp)?void 0:ja.call(d,
{type:"canvas",order:ra},K)}},onPointerEnter:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerEnter)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onPointerLeave:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerLeave)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onDrop:K=>Oh(this,null,function*(){K.preventDefault();"clientX"in K&&a.drop(K.dataTransfer,[K.clientX,K.clientY])}),
onDragOver:K=>{K.preventDefault()},onTouchEnd:K=>{let da=a.selectedTool.id;"pencil"!==da&&"highlighter"!==da||K.preventDefault()}}),[d])}function qf(a,d,k){return 0===d||Infinity===Math.abs(d)?Math.pow(a,5*k):a*d*k/(d+k*a)}function nj(a,d,k,K=.15){return 0===K?Math.max(d,Math.min(a,k)):a<d?-qf(d-a,k-d,K)+d:a>k?+qf(a-k,k-d,K)+k:a}function Zh(a,[d,k],[K,da]){const [[ja,ra],[Ja,Ra]]=a;return[nj(d,ja,ra,K),nj(k,Ja,Ra,da)]}function ui(a,d,k){d in a?Object.defineProperty(a,d,{value:k,enumerable:!0,configurable:!0,
writable:!0}):a[d]=k;return a}function oj(a,d){var k=Object.keys(a);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(a);d&&(K=K.filter(function(da){return Object.getOwnPropertyDescriptor(a,da).enumerable}));k.push.apply(k,K)}return k}function Tg(a){for(var d=1;d<arguments.length;d++){var k=null!=arguments[d]?arguments[d]:{};d%2?oj(Object(k),!0).forEach(function(K){ui(a,K,k[K])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(k)):oj(Object(k)).forEach(function(K){Object.defineProperty(a,
K,Object.getOwnPropertyDescriptor(k,K))})}return a}function $h(a){return a?a[0].toUpperCase()+a.slice(1):""}function fj(a=!1,d){return a&&!OE.includes(d)}function El(a,d="",k=!1){const K=lA[a];d=K?K[d]||d:d;return"on"+$h(a)+$h(d)+(fj(k,d)?"Capture":"")}function Of(a){a=a.substring(2).toLowerCase();const d=!!~a.indexOf("passive");d&&(a=a.replace("passive",""));var k=PE.includes(a)?"capturecapture":"capture";(k=!!~a.indexOf(k))&&(a=a.replace("capture",""));return{device:a,capture:k,passive:d}}function Ni(a,
d=""){const k=lA[a];return a+(k?k[d]||d:d)}function wh(a){return"touches"in a?"touch":"pointerType"in a?a.pointerType:"mouse"}function nl(a){return Array.from(a.touches).filter(d=>{var k,K;return d.target===a.currentTarget||(null===(k=a.currentTarget)||void 0===k?void 0:null===(K=k.contains)||void 0===K?void 0:K.call(k,d.target))})}function Sj(a){return"touches"in a?("touchend"===a.type||"touchcancel"===a.type?a.changedTouches:a.targetTouches)[0]:a}function im(a,d){const k=d.clientX-a.clientX,K=d.clientY-
a.clientY;return{angle:-(180*Math.atan2(k,K))/Math.PI,distance:Math.hypot(k,K),origin:[(d.clientX+a.clientX)/2,(d.clientY+a.clientY)/2]}}function Fj(a){return nl(a).map(d=>d.identifier)}function Oi(a,d){const [k,K]=Array.from(a.touches).filter(da=>d.includes(da.identifier));return im(k,K)}function Zi(a){const d=Sj(a);return"touches"in a?d.identifier:d.pointerId}function Mk(a){a=Sj(a);return[a.clientX,a.clientY]}function Nk(a){let {deltaX:d,deltaY:k,deltaMode:K}=a;1===K?(d*=40,k*=40):2===K&&(d*=800,
k*=800);return[d,k]}function ah(a,...d){return"function"===typeof a?a(...d):a}function ai(){}function Ph(...a){return 0===a.length?ai:1===a.length?a[0]:function(){let d;for(const k of a)d=k.apply(this,arguments)||d;return d}}function Ak([a,d],k){a=Math.abs(a);d=Math.abs(d);if(a>d&&a>k)return"x";if(d>a&&d>k)return"y"}function al(a){const [d,k]=a.overflow,[K,da]=a._delta,[ja,ra]=a._direction;if(0>d&&0<K&&0>ja||0<d&&0>K&&0<ja)a._movement[0]=a._movementBound[0];if(0>k&&0<da&&0>ra||0<k&&0>da&&0<ra)a._movement[1]=
a._movementBound[1]}function bi(a){hx.set(a.key,a.engine);ix.set(a.key,a.resolver)}function bl(a={},d){const k={};for(const [K,da]of Object.entries(d))switch(typeof da){case "function":k[K]=da.call(k,a[K],K,a);break;case "object":k[K]=bl(a[K],da);break;case "boolean":da&&(k[K]=a[K])}return k}function Di(a,d,k={}){const {target:K,eventOptions:da,window:ja,enabled:ra,transform:Ja}=a;var Ra=lF;if(null==a)a={};else{if(null==a)var $a={};else{$a={};var fb=Object.keys(a),jb;for(jb=0;jb<fb.length;jb++){var Jb=
fb[jb];0<=Ra.indexOf(Jb)||($a[Jb]=a[Jb])}}if(Object.getOwnPropertySymbols)for(jb=Object.getOwnPropertySymbols(a),Jb=0;Jb<jb.length;Jb++)fb=jb[Jb],0<=Ra.indexOf(fb)||Object.prototype.propertyIsEnumerable.call(a,fb)&&($a[fb]=a[fb]);a=$a}k.shared=bl({target:K,eventOptions:da,window:ja,enabled:ra,transform:Ja},kF);if(d){var Ob=ix.get(d);k[d]=bl(Tg({shared:k.shared},a),Ob)}else for(Ob in a)(d=ix.get(Ob))&&(k[Ob]=bl(Tg({shared:k.shared},a[Ob]),d));return k}function mi(a,d){a.gestures.add(d);a.gestureEventStores[d]=
new tA(a,d);a.gestureTimeoutStores[d]=new mF}function Zj(a,d,k,K,da,ja){if(a.has(k)&&hx.has(K)){var ra=k+"Start",Ja=k+"End";da[K]=Ra=>{let $a=void 0;if(Ra.first&&ra in d)d[ra](Ra);k in d&&($a=d[k](Ra));if(Ra.last&&Ja in d)d[Ja](Ra);return $a};ja[K]=ja[K]||{}}}function ni(a,d={},k,K){const da=jx.default.useMemo(()=>new nF(a),[]);da.applyHandlers(a,K);da.applyConfig(d,k);jx.default.useEffect(da.effect.bind(da));jx.default.useEffect(()=>da.clean.bind(da),[]);if(void 0===d.target)return da.bind.bind(da)}
function Dh(a){a.forEach(bi);return function(d,k){k=k||{};const K={},da={},ja=new Set;for(let Jb in d)oF.test(Jb)?(ja.add(RegExp.lastMatch),da[Jb]=d[Jb]):K[Jb]=d[Jb];const [ra,Ja,Ra]=[da,K,ja];d={};Zj(Ra,ra,"onDrag","drag",d,k);Zj(Ra,ra,"onWheel","wheel",d,k);Zj(Ra,ra,"onScroll","scroll",d,k);Zj(Ra,ra,"onPinch","pinch",d,k);Zj(Ra,ra,"onMove","move",d,k);Zj(Ra,ra,"onHover","hover",d,k);const {handlers:$a,nativeHandlers:fb,config:jb}={handlers:d,config:k,nativeHandlers:Ja};return ni($a,jb,void 0,fb)}}
function vi(a,d){return Dh([eF,hF,iF,jF,gF,fF])(a,d||{})}function $i(a){const {viewport:d,inputs:k,callbacks:K}=dh(),da=cv.useRef(void 0),ja=cv.useRef([0,0]),ra=cv.useRef(0),Ja=cv.useMemo(()=>({onWheel:Ra=>{var $a;({event:Ra}=Ra);Ra.preventDefault();const {deltaY:fb,deltaX:jb}=Ra;var Jb=0;if(Ra.ctrlKey||Ra.metaKey){Jb=Math.sign(Ra.deltaY);let rc=fb;10<Math.abs(Ra.deltaY)&&(rc=10*Jb);Jb=rc}const [Ob,Kb,gc]=[jb,fb,Jb];"pinching"===k.state||ra.current>=Ra.timeStamp||(ra.current=Ra.timeStamp,(Ra.altKey||
Ra.ctrlKey||Ra.metaKey)&&0===Ra.buttons?(Jb=d.bounds,Ra=null!=($a=k.currentScreenPoint)?$a:[Jb.width/2,Jb.height/2],$a=d.camera.zoom,d.onZoom(Ra,$a-gc/100*$a)):($a=be.mul(Ra.shiftKey&&!oh()?[Kb,0]:[Ob,Kb],.8),be.isEqual($a,[0,0])||d.panCamera($a)))},onPinchStart:({event:Ra,delta:$a,offset:fb,origin:jb})=>{var Jb;const Ob=a.current;Ra instanceof WheelEvent||!(Ra.target===Ob||null!=Ob&&Ob.contains(Ra.target))||(null==(Jb=K.onPinchStart)?void 0:Jb.call(K,{type:"canvas",order:0,delta:[...$a,fb[0]],offset:fb,
point:be.sub(jb,k.containerOffset)},Ra),da.current=jb,ja.current=[0,0])},onPinchEnd:({event:Ra,offset:$a,origin:fb})=>{var jb;const Jb=a.current;Ra instanceof WheelEvent||!(Ra.target===Jb||null!=Jb&&Jb.contains(Ra.target))||"pinching"!==k.state||(null==(jb=K.onPinchEnd)?void 0:jb.call(K,{type:"canvas",order:0,delta:[0,0,$a[0]],offset:$a,point:be.sub(fb,k.containerOffset)},Ra),ja.current=[0,0])},onPinch:({event:Ra,offset:$a,origin:fb})=>{var jb,Jb=a.current;if(!(Ra instanceof WheelEvent)&&(Ra.target===
Jb||null!=Jb&&Jb.contains(Ra.target))){da.current||(da.current=fb);Jb=be.sub(da.current,fb);var Ob=be.sub(Jb,ja.current);null==(jb=K.onPinch)?void 0:jb.call(K,{type:"canvas",order:0,delta:[...Ob,$a[0]],offset:$a,point:be.sub(fb,k.containerOffset)},Ra);ja.current=Jb}}}),[K]);vi(Ja,{target:a,eventOptions:{passive:!1},pinch:{from:[d.camera.zoom,d.camera.zoom],scaleBounds:()=>({from:d.camera.zoom,max:Mn.maxZoom,min:Mn.minZoom})}})}function pb(a,d,k,K){kx.useLayoutEffect(()=>{a.current.style.transform=
`translate(
        calc(${d.minX}px - var(--tl-padding)),
        calc(${d.minY}px - var(--tl-padding)))
        scale(var(--tl-scale))`},[d.minX,d.minY,k,d.rotation]);kx.useLayoutEffect(()=>{const da=a.current;da.style.width=`calc(${Math.floor(d.width)}px + (var(--tl-padding) * 2))`;da.style.height=`calc(${Math.floor(d.height)}px + (var(--tl-padding) * 2))`},[d.width,d.height]);kx.useLayoutEffect(()=>{const da=a.current;void 0!==K&&(da.style.zIndex=K.toString())},[K])}function mc(a,d){const {onPersist:k,onError:K,onMount:da,onCreateAssets:ja,onCreateShapes:ra,onDeleteAssets:Ja,onDeleteShapes:Ra,onDrop:$a,
onPaste:fb,onCopy:jb,onCanvasDBClick:Jb}=d;vA.useLayoutEffect(()=>{const Ob=[];if(a)return window.tlapps=window.tlapps||{},window.tlapps[a.uuid]=a,da&&da(a,null),()=>{Ob.forEach(Kb=>Kb());window.tlapps&&delete window.tlapps[a.uuid]}},[a]);vA.useLayoutEffect(()=>{const Ob=[];k&&Ob.push(a.subscribe("persist",k));K&&Ob.push(a.subscribe("error",K));ra&&Ob.push(a.subscribe("create-shapes",ra));ja&&Ob.push(a.subscribe("create-assets",ja));Ra&&Ob.push(a.subscribe("delete-shapes",Ra));Ja&&Ob.push(a.subscribe("delete-assets",
Ja));$a&&Ob.push(a.subscribe("drop",$a));fb&&Ob.push(a.subscribe("paste",fb));jb&&Ob.push(a.subscribe("copy",jb));Jb&&Ob.push(a.subscribe("canvas-dbclick",Jb));return()=>Ob.forEach(Kb=>Kb())},[a,k,K])}function yc(a){if("app"in a)return a.app;const [d]=wA.useState(()=>new JE(a.model,a.Shapes,a.Tools,a.readOnly));wA.useLayoutEffect(()=>()=>{d.dispose()},[d]);return d}function Tc(a,d){pF.useEffect(()=>{"model"in d&&d.model&&a.loadDocumentModel(d.model)},[d.model])}function $c(a){const d=dh(),{viewport:{bounds:k}}=
d;qF.useEffect(()=>{const K=ra=>{ra.preventDefault()},da=ra=>{if(0!==ra.touches.length){var Ja=ra.touches[0].pageX,Ra=ra.touches[0].radiusX||0;(10>Ja-Ra||Ja+Ra>k.width-10)&&ra.preventDefault()}},ja=a.current;if(!ja)return()=>{};ja.addEventListener("touchstart",K,{passive:!0});ja.addEventListener("gestureend",K,{passive:!0});ja.addEventListener("gesturechange",K,{passive:!0});ja.addEventListener("gesturestart",K,{passive:!0});ja.addEventListener("touchstart",da,{passive:!0});return()=>{ja&&(ja.removeEventListener("touchstart",
K),ja.removeEventListener("gestureend",K),ja.removeEventListener("gesturechange",K),ja.removeEventListener("gesturestart",K),ja.removeEventListener("touchstart",da))}},[a,k.width])}function ld(a,d){const {inputs:k,callbacks:K}=dh();return rF.useMemo(()=>({onPointerDown:da=>{var ja,ra;const {order:Ja=0}=da;Ja||(null==(ja=da.currentTarget)?void 0:ja.setPointerCapture(da.pointerId));ja=a.props.handles[d];null==(ra=K.onPointerDown)?void 0:ra.call(K,{type:"handle",shape:a,handle:ja,id:d,order:Ja},da);
da.order=Ja+1},onPointerMove:da=>{var ja;const {order:ra=0}=da,Ja=a.props.handles[d];null==(ja=K.onPointerMove)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ja,id:d,order:ra},da);da.order=ra+1},onPointerUp:da=>{var ja,ra;const {order:Ja=0}=da;Ja||(null==(ja=da.currentTarget)?void 0:ja.releasePointerCapture(da.pointerId));ja=a.props.handles[d];null==(ra=K.onPointerUp)?void 0:ra.call(K,{type:"handle",shape:a,handle:ja,id:d,order:Ja},da);da.order=Ja+1},onPointerEnter:da=>{var ja;const {order:ra=0}=
da,Ja=a.props.handles[d];null==(ja=K.onPointerEnter)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ja,id:d,order:ra},da);da.order=ra+1},onPointerLeave:da=>{var ja;const {order:ra=0}=da,Ja=a.props.handles[d];null==(ja=K.onPointerLeave)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ja,id:d,order:ra},da);da.order=ra+1},onKeyUp:da=>{var ja;const ra=a.props.handles[d];null==(ja=K.onKeyUp)?void 0:ja.call(K,{type:"handle",shape:a,handle:ra,id:d,order:-1},da)},onKeyDown:da=>{var ja;const ra=a.props.handles[d];
null==(ja=K.onKeyDown)?void 0:ja.call(K,{type:"handle",shape:a,handle:ra,id:d,order:-1},da)}}),[a.id,k,K])}function Ed(a,d,k=!1){return`url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 35 35' xmlns='http://www.w3.org/2000/svg'><g fill='none' style='transform-origin:center center' transform='rotate(${d})${k?" scale(-1,-1) translate(0, -32)":""}'>`+a.replaceAll('"',"'")+'\x3c/g\x3e\x3c/svg\x3e") 16 16, pointer'}function Xd(a,d,k=0){sF.useEffect(()=>{const K=a.current;K&&(K.style.cursor=
tF[d](Ml.radiansToDegrees(k)))},[d,k])}function oe(a){const {viewport:d}=dh(),k=mg();uF.useLayoutEffect(()=>ic(()=>{const K=Xj(()=>{var da;null==(da=a.current)?void 0:da.style.setProperty("--tl-zoom",d.camera.zoom.toString())},200);"pinching"!==k.inputs.state&&null!=d.camera.zoom&&K()}),[])}function ye(a,d=0){const [k,K]=(0,xA.useState)(a);(0,xA.useEffect)(()=>{let da=!1;const ja=setTimeout(()=>{da||K(a)},d);return()=>{da=!0;clearTimeout(ja)}},[a,d]);return k}function ie(){const a=mg();yA.useEffect(()=>
{Rc(()=>Zd({},a.viewport.camera),()=>{window.sessionStorage.setItem("logseq.tldraw.camera:"+a.currentPageId,JSON.stringify(a.viewport.camera))})},[a.viewport.camera]);yA.useEffect(()=>{var d;const k=JSON.parse(null!=(d=window.sessionStorage.getItem("logseq.tldraw.camera:"+a.currentPageId))?d:"null");k?a.viewport.update(k):a.selectedIds.size?a.api.zoomToSelection():a.api.zoomToFit()},[a])}function se(a){a()}function Ke(a){return pf(ec(a,void 0))}function Se(a){return{reaction:a,mounted:!1,changedBeforeMount:!1,
cleanAt:Date.now()+wF}}function Nd(a){var d=new Map,k=1,K=new a(function(da){var ja=d.get(da);ja&&(ja.reaction.dispose(),d.delete(da))});return{addReactionToTrack:function(da,ja,ra){var Ja=k++;K.register(ra,Ja,da);da.current=Se(ja);da.current.finalizationRegistryCleanupToken=Ja;d.set(Ja,da.current);return da.current},recordReactionAsCommitted:function(da){K.unregister(da);da.current&&da.current.finalizationRegistryCleanupToken&&d.delete(da.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},
resetCleanupScheduleForTests:function(){}}}function Le(){function a(){void 0===K&&(K=setTimeout(d,1E4))}function d(){K=void 0;var da=Date.now();k.forEach(function(ja){var ra=ja.current;ra&&da>=ra.cleanAt&&(ra.reaction.dispose(),ja.current=null,k.delete(ja))});0<k.size&&a()}var k=new Set,K;return{addReactionToTrack:function(da,ja,ra){da.current=Se(ja);k.add(da);a();return da.current},recordReactionAsCommitted:function(da){k.delete(da)},forceCleanupTimerToRunNowForTests:function(){K&&(clearTimeout(K),
d())},resetCleanupScheduleForTests:function(){var da;if(0<k.size){try{for(var ja=xF(k),ra=ja.next();!ra.done;ra=ja.next()){var Ja=ra.value,Ra=Ja.current;Ra&&(Ra.reaction.dispose(),Ja.current=null)}}catch(fb){var $a={error:fb}}finally{try{ra&&!ra.done&&(da=ja.return)&&da.call(ja)}finally{if($a)throw $a.error;}}k.clear()}K&&(clearTimeout(K),K=void 0)}}}function ne(){return new AF}function Qf(a,d){void 0===d&&(d="observed");var k=BA(Bt.default.useState(ne),1)[0],K=BA(Bt.default.useState(),2)[1],da=Bt.default.useRef(null);
if(!da.current)var ja=new es("observer".concat(d),function(){ra.mounted?K([]):ra.changedBeforeMount=!0}),ra=yF(da,ja,k);k=da.current.reaction;Bt.default.useDebugValue(k,Ke);Bt.default.useEffect(function(){zF(da);da.current?(da.current.mounted=!0,da.current.changedBeforeMount&&(da.current.changedBeforeMount=!1,K([]))):(da.current={reaction:new es("observer".concat(d),function(){K([])}),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},K([]));return function(){da.current.reaction.dispose();da.current=
null}},[]);var Ja,Ra;k.track(function(){try{Ja=a()}catch($a){Ra=$a}});if(Ra)throw Ra;return Ja}function ee(a,d){var k;if(EA&&a.$$typeof===EA)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");d=null!==(k=null===d||void 0===d?void 0:d.forwardRef)&&void 0!==k?k:!1;var K=a,da=a.displayName||a.name;if(DA&&a.$$typeof===DA&&(d=!0,K=a.render,"function"!==typeof K))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");
k=function(ja,ra){return Qf(function(){return K(ja,ra)},da)};""!==da&&(k.displayName=da);a.contextTypes&&(k.contextTypes=a.contextTypes);d&&(k=(0,ns.forwardRef)(k));k=(0,ns.memo)(k);Qe(a,k);return k}function Qe(a,d){Object.keys(a).forEach(function(k){BF[k]||Object.defineProperty(d,k,Object.getOwnPropertyDescriptor(a,k))})}function rf(a){var d=a.render;a=a.children||d;return"function"!==typeof a?null:Qf(a)}function sg(a){const d=mg(),{callbacks:k}=dh(),K=FA.useRef(!1);FA.useEffect(()=>{const da=Ra=>
{var $a,fb;if(null==($a=a.current)?0:$a.contains(document.activeElement))null==(fb=k.onKeyDown)?void 0:fb.call(k,{type:"canvas",order:-1},Ra),K.current=Ra.shiftKey},ja=Ra=>{var $a,fb;if(null==($a=a.current)?0:$a.contains(document.activeElement))null==(fb=k.onKeyUp)?void 0:fb.call(k,{type:"canvas",order:-1},Ra),K.current=Ra.shiftKey},ra=Ra=>{var $a,fb,jb;!d.editingShape&&(null==($a=a.current)?0:$a.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(jb=null==(fb=document.activeElement)?
void 0:fb.tagName)?jb:"")&&(Ra.preventDefault(),d.paste(Ra,K.current))},Ja=Ra=>{var $a,fb,jb;!d.editingShape&&0<d.selectedShapes.size&&(null==($a=a.current)?0:$a.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(jb=null==(fb=document.activeElement)?void 0:fb.tagName)?jb:"")&&(Ra.preventDefault(),d.copy())};window.addEventListener("keydown",da);window.addEventListener("keyup",ja);document.addEventListener("paste",ra);document.addEventListener("copy",Ja);return()=>{window.removeEventListener("keydown",
da);window.removeEventListener("keyup",ja);document.removeEventListener("paste",ra);document.removeEventListener("copy",Ja)}},[])}function Jg(a){const d=mg(),{inputs:k,callbacks:K}=dh(),da=KA.useRef(-1);return KA.useMemo(()=>({onPointerDown:ja=>{var ra,Ja;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ra=0}=ja;Ra||(null==(ra=ja.currentTarget)?void 0:ra.setPointerCapture(ja.pointerId));null==(Ja=K.onPointerDown)?void 0:Ja.call(K,{type:"shape",shape:a,order:Ra},ja);ja.order=
Ra+1}},onPointerMove:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ja=0}=ja;null==(ra=K.onPointerMove)?void 0:ra.call(K,{type:"shape",shape:a,order:Ja},ja);ja.order=Ja+1}},onPointerUp:ja=>{var ra,Ja,Ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:$a=0}=ja;$a||(null==(ra=ja.currentTarget)?void 0:ra.releasePointerCapture(ja.pointerId));null==(Ja=K.onPointerUp)?void 0:Ja.call(K,{type:"shape",shape:a,order:$a},ja);ra=Date.now();Ja=ra-
da.current;300<Ja?da.current=ra:300>=Ja&&(null==(Ra=K.onDoubleClick)?void 0:Ra.call(K,{type:"shape",shape:a,order:$a},ja),da.current=-1);ja.order=$a+1}},onPointerEnter:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ja=0}=ja;null==(ra=K.onPointerEnter)?void 0:ra.call(K,{type:"shape",shape:a,order:Ja},ja);ja.order=Ja+1}},onPointerLeave:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ja=0}=ja;null==(ra=K.onPointerLeave)?void 0:
ra.call(K,{type:"shape",shape:a,order:Ja},ja);ja.order=Ja+1}},onKeyUp:ja=>{var ra;null==(ra=K.onKeyUp)?void 0:ra.call(K,{type:"shape",shape:a,order:-1},ja)},onKeyDown:ja=>{var ra;null==(ra=K.onKeyDown)?void 0:ra.call(K,{type:"shape",shape:a,order:-1},ja)}}),[a.id,k,K])}function Mg(a){var {viewport:d,inputs:k,callbacks:K,components:da}=a;a=Jf(a,["viewport","inputs","callbacks","components"]);return(0,bB.jsx)(VF,{id:a.id,viewport:d,inputs:k,callbacks:K,components:da,meta:a.meta,children:(0,bB.jsx)(RF,
Zd({},a))})}function Oe(){Oe=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],K;for(K in k)Object.prototype.hasOwnProperty.call(k,K)&&(a[K]=k[K])}return a};return Oe.apply(this,arguments)}function Wf(a,d,{checkForDefaultPrevented:k=!0}={}){return function(K){null===a||void 0===a||a(K);if(!1===k||!K.defaultPrevented)return null===d||void 0===d?void 0:d(K)}}function vg(...a){return d=>a.forEach(k=>{"function"===typeof k?k(d):null!==k&&void 0!==k&&
(k.current=d)})}function $g(...a){return(0,$F.useCallback)(vg(...a),a)}function Gh(a,d=[]){let k=[];const K=()=>{const da=k.map(ja=>(0,lr.createContext)(ja));return function(ja){const ra=(null===ja||void 0===ja?void 0:ja[a])||da;return(0,lr.useMemo)(()=>({[`__scope${a}`]:ff(Zd({},ja),{[a]:ra})}),[ja,ra])}};K.scopeName=a;return[function(da,ja){function ra($a){const {scope:fb,children:jb}=$a,Jb=Jf($a,["scope","children"]);$a=(null===fb||void 0===fb?void 0:fb[a][Ra])||Ja;const Ob=(0,lr.useMemo)(()=>
Jb,Object.values(Jb));return(0,lr.createElement)($a.Provider,{value:Ob},jb)}const Ja=(0,lr.createContext)(ja),Ra=k.length;k=[...k,ja];ra.displayName=da+"Provider";return[ra,function($a,fb){if(fb=(0,lr.useContext)((null===fb||void 0===fb?void 0:fb[a][Ra])||Ja))return fb;if(void 0!==ja)return ja;throw Error(`\`${$a}\` must be used within \`${da}\``);}]},Qk(K,...d)]}function Qk(...a){const d=a[0];if(1===a.length)return d;const k=()=>{const K=a.map(da=>({useScope:da(),scopeName:da.scopeName}));return function(da){const ja=
K.reduce((ra,{useScope:Ja,scopeName:Ra})=>{Ja=Ja(da)[`__scope${Ra}`];return Zd(Zd({},ra),Ja)},{});return(0,lr.useMemo)(()=>({[`__scope${d.scopeName}`]:ja}),[ja])}};k.scopeName=d.scopeName;return k}function ug(a){return(0,Nl.isValidElement)(a)&&a.type===cB}function Zl(a,d){const k=Zd({},d);for(const K in d){const da=a[K],ja=d[K];/^on[A-Z]/.test(K)?da&&ja?k[K]=(...ra)=>{ja(...ra);da(...ra)}:da&&(k[K]=da):"style"===K?k[K]=Zd(Zd({},da),ja):"className"===K&&(k[K]=[da,ja].filter(Boolean).join(" "))}return Zd(Zd({},
a),k)}function ql(a,d){a&&(0,aG.flushSync)(()=>a.dispatchEvent(d))}function Qi(a){const d=(0,wx.useRef)(a);(0,wx.useEffect)(()=>{d.current=a});return(0,wx.useMemo)(()=>(...k)=>{var K;return null===(K=d.current)||void 0===K?void 0:K.call(d,...k)},[])}function rl(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Qi(a);(0,bG.useEffect)(()=>{const K=da=>{"Escape"===da.key&&k(da)};d.addEventListener("keydown",K);return()=>d.removeEventListener("keydown",K)},[k,d])}function Il(a,
d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Qi(a),K=(0,Mm.useRef)(!1),da=(0,Mm.useRef)(()=>{});(0,Mm.useEffect)(()=>{const ja=Ja=>{if(Ja.target&&!K.current){let Ra=function(){Tj("dismissableLayer.pointerDownOutside",k,$a,{discrete:!0})};const $a={originalEvent:Ja};"touch"===Ja.pointerType?(d.removeEventListener("click",da.current),da.current=Ra,d.addEventListener("click",da.current,{once:!0})):Ra()}K.current=!1},ra=window.setTimeout(()=>{d.addEventListener("pointerdown",
ja)},0);return()=>{window.clearTimeout(ra);d.removeEventListener("pointerdown",ja);d.removeEventListener("click",da.current)}},[d,k]);return{onPointerDownCapture:()=>K.current=!0}}function sl(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Qi(a),K=(0,Mm.useRef)(!1);(0,Mm.useEffect)(()=>{const da=ja=>{ja.target&&!K.current&&Tj("dismissableLayer.focusOutside",k,{originalEvent:ja},{discrete:!1})};d.addEventListener("focusin",da);return()=>d.removeEventListener("focusin",
da)},[d,k]);return{onFocusCapture:()=>K.current=!0,onBlurCapture:()=>K.current=!1}}function Jn(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function Tj(a,d,k,{discrete:K}){const da=k.originalEvent.target;k=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:k});d&&da.addEventListener(a,d,{once:!0});K?ql(da,k):da.dispatchEvent(k)}function Ei(a){const [d,k]=eB.useState(eG());vl(()=>{a||k(K=>null!==K&&void 0!==K?K:String(fG++))},[a]);return a||(d?`radix-${d}`:"")}function Ih(a){return a.split("-")[0]}
function cl(a){return["top","bottom"].includes(Ih(a))?"x":"y"}function $l(a){return"y"===a?"height":"width"}function Ck(a,d,k){let {reference:K,floating:da}=a;var ja=K.x+K.width/2-da.width/2;const ra=K.y+K.height/2-da.height/2;a=cl(d);var Ja=$l(a);Ja=K[Ja]/2-da[Ja]/2;const Ra="x"===a;switch(Ih(d)){case "top":ja={x:ja,y:K.y-da.height};break;case "bottom":ja={x:ja,y:K.y+K.height};break;case "right":ja={x:K.x+K.width,y:ra};break;case "left":ja={x:K.x-da.width,y:ra};break;default:ja={x:K.x,y:K.y}}switch(d.split("-")[1]){case "start":ja[a]-=
Ja*(k&&Ra?-1:1);break;case "end":ja[a]+=Ja*(k&&Ra?-1:1)}return ja}function mm(a){return"number"!=typeof a?Zd({top:0,right:0,bottom:0,left:0},a):{top:a,right:a,bottom:a,left:a}}function am(a){return ff(Zd({},a),{top:a.y,left:a.x,right:a.x+a.width,bottom:a.y+a.height})}function Jl(a,d){return Oh(this,null,function*(){var k;void 0===d&&(d={});const {x:K,y:da,platform:ja,rects:ra,elements:Ja,strategy:Ra}=a,{boundary:$a="clippingAncestors",rootBoundary:fb="viewport",elementContext:jb="floating",altBoundary:Jb=
!1,padding:Ob=0}=d,Kb=mm(Ob),gc=Ja[Jb?"floating"===jb?"reference":"floating":jb],rc=am(yield ja.getClippingRect({element:null==(k=yield null==ja.isElement?void 0:ja.isElement(gc))||k?gc:gc.contextElement||(yield null==ja.getDocumentElement?void 0:ja.getDocumentElement(Ja.floating)),boundary:$a,rootBoundary:fb,strategy:Ra}));k=am(ja.convertOffsetParentRelativeRectToViewportRelativeRect?yield ja.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===jb?ff(Zd({},ra.floating),{x:K,y:da}):
ra.reference,offsetParent:yield null==ja.getOffsetParent?void 0:ja.getOffsetParent(Ja.floating),strategy:Ra}):ra[jb]);return{top:rc.top-k.top+Kb.top,bottom:k.bottom-rc.bottom+Kb.bottom,left:rc.left-k.left+Kb.left,right:k.right-rc.right+Kb.right}})}function dl(a){return a.replace(/left|right|bottom|top/g,d=>hG[d])}function tl(a,d,k){void 0===k&&(k=!1);const K=a.split("-")[1],da=cl(a);a=$l(da);k="x"===da?K===(k?"end":"start")?"right":"left":"start"===K?"bottom":"top";return d.reference[a]>d.floating[a]&&
(k=dl(k)),{main:k,cross:dl(k)}}function xi(a){return a.replace(/start|end/g,d=>iG[d])}function dk(a,d){return{top:a.top-d.height,right:a.right-d.width,bottom:a.bottom-d.height,left:a.left-d.width}}function ek(a){return gB.some(d=>0<=a[d])}function ok(a){return null==a?window:a&&a.document&&a.location&&a.alert&&a.setInterval?a:(a=a.ownerDocument)&&a.defaultView||window}function Ri(a){return ok(a).getComputedStyle(a)}function Ci(a){return a&&a.document&&a.location&&a.alert&&a.setInterval?"":a?(a.nodeName||
"").toLowerCase():""}function Li(){const a=navigator.userAgentData;return null!=a&&a.brands?a.brands.map(d=>d.brand+"/"+d.version).join(" "):navigator.userAgent}function rj(a){return a instanceof ok(a).HTMLElement}function xk(a){return a instanceof ok(a).Element}function kj(a){return"undefined"==typeof ShadowRoot?!1:a instanceof ok(a).ShadowRoot||a instanceof ShadowRoot}function Ji(a){const {overflow:d,overflowX:k,overflowY:K}=Ri(a);return/auto|scroll|overlay|hidden/.test(d+K+k)}function Jk(a){const d=
/firefox/i.test(Li());a=Ri(a);return"none"!==a.transform||"none"!==a.perspective||"paint"===a.contain||["transform","perspective"].includes(a.willChange)||d&&"filter"===a.willChange||d&&!!a.filter&&"none"!==a.filter}function Kk(){return!/^((?!chrome|android).)*safari/i.test(Li())}function ik(a,d,k){var K,da,ja,ra;void 0===d&&(d=!1);void 0===k&&(k=!1);var Ja=a.getBoundingClientRect();let Ra=1,$a=1;d&&rj(a)&&(Ra=0<a.offsetWidth&&lv(Ja.width)/a.offsetWidth||1,$a=0<a.offsetHeight&&lv(Ja.height)/a.offsetHeight||
1);a=xk(a)?ok(a):window;d=!Kk()&&k;k=(Ja.left+(d&&null!=(K=null==(da=a.visualViewport)?void 0:da.offsetLeft)?K:0))/Ra;K=(Ja.top+(d&&null!=(ja=null==(ra=a.visualViewport)?void 0:ra.offsetTop)?ja:0))/$a;ja=Ja.width/Ra;Ja=Ja.height/$a;return{width:ja,height:Ja,top:K,right:k+ja,bottom:K+Ja,left:k,x:k,y:K}}function Cj(a){return(d=a,(d instanceof ok(d).Node?a.ownerDocument:a.document)||window.document).documentElement;var d}function bm(a){return xk(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.pageXOffset,
scrollTop:a.pageYOffset}}function yn(a){return ik(Cj(a)).left+bm(a).scrollLeft}function yk(a){return"html"===Ci(a)?a:a.assignedSlot||a.parentNode||(kj(a)?a.host:null)||Cj(a)}function dj(a){return rj(a)&&"fixed"!==getComputedStyle(a).position?a.offsetParent:null}function bj(a){for(var d=ok(a),k=dj(a);k&&["table","td","th"].includes(Ci(k))&&"static"===getComputedStyle(k).position;)k=dj(k);if(!k||"html"!==Ci(k)&&("body"!==Ci(k)||"static"!==getComputedStyle(k).position||Jk(k))){if(!k)a:{a=yk(a);for(kj(a)&&
(a=a.host);rj(a)&&!["html","body"].includes(Ci(a));){if(Jk(a)){k=a;break a}a=a.parentNode}k=null}d=k||d}return d}function Ul(a){if(rj(a))return{width:a.offsetWidth,height:a.offsetHeight};a=ik(a);return{width:a.width,height:a.height}}function nm(a){const d=yk(a);return["html","body","#document"].includes(Ci(d))?a.ownerDocument.body:rj(d)&&Ji(d)?d:nm(d)}function Hm(a,d){var k;void 0===d&&(d=[]);var K=nm(a);a=K===(null==(k=a.ownerDocument)?void 0:k.body);k=ok(K);K=a?[k].concat(k.visualViewport||[],Ji(K)?
K:[]):K;d=d.concat(K);return a?d:d.concat(Hm(K))}function co(a,d,k){return"viewport"===d?am(function(K,da){var ja=ok(K),ra=Cj(K);ja=ja.visualViewport;K=ra.clientWidth;ra=ra.clientHeight;let Ja=0,Ra=0;if(ja){K=ja.width;ra=ja.height;const $a=Kk();($a||!$a&&"fixed"===da)&&(Ja=ja.offsetLeft,Ra=ja.offsetTop)}return{width:K,height:ra,x:Ja,y:Ra}}(a,k)):xk(d)?function(K,da){var ja=ik(K,!1,"fixed"===da);da=ja.top+K.clientTop;ja=ja.left+K.clientLeft;return{top:da,left:ja,x:ja,y:da,right:ja+K.clientWidth,bottom:da+
K.clientHeight,width:K.clientWidth,height:K.clientHeight}}(d,k):am(function(K){var da;const ja=Cj(K);var ra=bm(K);const Ja=null==(da=K.ownerDocument)?void 0:da.body;da=Dt(ja.scrollWidth,ja.clientWidth,Ja?Ja.scrollWidth:0,Ja?Ja.clientWidth:0);const Ra=Dt(ja.scrollHeight,ja.clientHeight,Ja?Ja.scrollHeight:0,Ja?Ja.clientHeight:0);K=-ra.scrollLeft+yn(K);ra=-ra.scrollTop;return"rtl"===Ri(Ja||ja).direction&&(K+=Dt(ja.clientWidth,Ja?Ja.clientWidth:0)-da),{width:da,height:Ra,x:K,y:ra}}(Cj(a)))}function gp(a){const d=
Hm(a),k=["absolute","fixed"].includes(Ri(a).position)&&rj(a)?bj(a):a;return xk(k)?d.filter(K=>{var da;if(da=xk(K))a:if(da=null==k.getRootNode?void 0:k.getRootNode(),K.contains(k))da=!0;else{if(da&&kj(da)){da=k;do{if(da&&K===da){da=!0;break a}da=da.parentNode||da.host}while(da)}da=!1}return da&&"body"!==Ci(K)}):[]}function Sb(a,d,k,K){void 0===K&&(K={});const {ancestorScroll:da=!0,ancestorResize:ja=!0,elementResize:ra=!0,animationFrame:Ja=!1}=K,Ra=da&&!Ja,$a=ja&&!Ja,fb=Ra||$a?[...(xk(a)?Hm(a):[]),
...Hm(d)]:[];fb.forEach(Kb=>{Ra&&Kb.addEventListener("scroll",k,{passive:!0});$a&&Kb.addEventListener("resize",k)});let jb,Jb=null;if(ra){let Kb=!0;Jb=new ResizeObserver(()=>{Kb||k();Kb=!1});xk(a)&&!Ja&&Jb.observe(a);Jb.observe(d)}let Ob=Ja?ik(a):null;return Ja&&function gc(){const rc=ik(a);!Ob||rc.x===Ob.x&&rc.y===Ob.y&&rc.width===Ob.width&&rc.height===Ob.height||k();Ob=rc;jb=requestAnimationFrame(gc)}(),k(),()=>{var gc;fb.forEach(rc=>{Ra&&rc.removeEventListener("scroll",k);$a&&rc.removeEventListener("resize",
k)});null==(gc=Jb)||gc.disconnect();Jb=null;Ja&&cancelAnimationFrame(jb)}}function Ea(a,d){if(a===d)return!0;if(typeof a!==typeof d)return!1;if("function"===typeof a&&a.toString()===d.toString())return!0;let k,K;if(a&&d&&"object"==typeof a){if(Array.isArray(a)){var da=a.length;if(da!=d.length)return!1;for(k=da;0!==k--;)if(!Ea(a[k],d[k]))return!1;return!0}K=Object.keys(a);da=K.length;if(da!==Object.keys(d).length)return!1;for(k=da;0!==k--;)if(!Object.prototype.hasOwnProperty.call(d,K[k]))return!1;
for(k=da;0!==k--;)if(da=K[k],!("_owner"===da&&a.$$typeof||Ea(a[da],d[da])))return!1;return!0}return a!==a&&d!==d}function $b(a){const d=mn.useRef(a);zx(()=>{d.current=a});return d}function Xb(a){let {middleware:d,placement:k="bottom",strategy:K="absolute",whileElementsMounted:da}=void 0===a?{}:a;const ja=mn.useRef(null),ra=mn.useRef(null),Ja=$b(da),Ra=mn.useRef(null),[$a,fb]=mn.useState({x:null,y:null,strategy:K,placement:k,middlewareData:{}}),[jb,Jb]=mn.useState(d);Ea(null==jb?void 0:jb.map(hc=>
{({options:hc}=hc);return hc}),null==d?void 0:d.map(hc=>{({options:hc}=hc);return hc}))||Jb(d);const Ob=mn.useCallback(()=>{ja.current&&ra.current&&lG(ja.current,ra.current,{middleware:jb,placement:k,strategy:K}).then(hc=>{Kb.current&&mG.flushSync(()=>{fb(hc)})})},[jb,k,K]);zx(()=>{Kb.current&&Ob()},[Ob]);const Kb=mn.useRef(!1);zx(()=>{Kb.current=!0;return()=>{Kb.current=!1}},[]);const gc=mn.useCallback(()=>{"function"===typeof Ra.current&&(Ra.current(),Ra.current=null);if(ja.current&&ra.current)if(Ja.current){const hc=
Ja.current(ja.current,ra.current,Ob);Ra.current=hc}else Ob()},[Ob,Ja]),rc=mn.useCallback(hc=>{ja.current=hc;gc()},[gc]),Wb=mn.useCallback(hc=>{ra.current=hc;gc()},[gc]),kc=mn.useMemo(()=>({reference:ja,floating:ra}),[]);return mn.useMemo(()=>ff(Zd({},$a),{update:Ob,refs:kc,reference:rc,floating:Wb}),[$a,Ob,kc,rc,Wb])}function sb(a){const [d,k]=(0,oG.useState)(void 0);vl(()=>{if(a){k({width:a.offsetWidth,height:a.offsetHeight});const K=new ResizeObserver(da=>{if(Array.isArray(da)&&da.length){da=da[0];
if("borderBoxSize"in da){da=da.borderBoxSize;var ja=Array.isArray(da)?da[0]:da;da=ja.inlineSize;ja=ja.blockSize}else da=a.offsetWidth,ja=a.offsetHeight;k({width:da,height:ja})}});K.observe(a,{box:"border-box"});return()=>K.unobserve(a)}k(void 0)},[a]);return d}function cc(a){return void 0!==a}function Qb(a){return null!==a}function zb(a){const [d,k="center"]=a.split("-");return[d,k]}function xb(a,d){return(0,mp.useReducer)((k,K)=>{K=d[k][K];return null!==K&&void 0!==K?K:k},a)}function Zb(a){const [d,
k]=(0,mp.useState)(),K=(0,mp.useRef)({}),da=(0,mp.useRef)(a),ja=(0,mp.useRef)("none"),[ra,Ja]=xb(a?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});(0,mp.useEffect)(()=>{const Ra=qc(K.current);ja.current="mounted"===ra?Ra:"none"},[ra]);vl(()=>{const Ra=K.current,$a=da.current;if($a!==a){const fb=ja.current,jb=qc(Ra);a?Ja("MOUNT"):"none"===jb||"none"===(null===Ra||void 0===
Ra?void 0:Ra.display)?Ja("UNMOUNT"):$a&&fb!==jb?Ja("ANIMATION_OUT"):Ja("UNMOUNT");da.current=a}},[a,Ja]);vl(()=>{if(d){const Ra=fb=>{const jb=qc(K.current).includes(fb.animationName);fb.target===d&&jb&&(0,yG.flushSync)(()=>Ja("ANIMATION_END"))},$a=fb=>{fb.target===d&&(ja.current=qc(K.current))};d.addEventListener("animationstart",$a);d.addEventListener("animationcancel",Ra);d.addEventListener("animationend",Ra);return()=>{d.removeEventListener("animationstart",$a);d.removeEventListener("animationcancel",
Ra);d.removeEventListener("animationend",Ra)}}Ja("ANIMATION_END")},[d,Ja]);return{isPresent:["mounted","unmountSuspended"].includes(ra),ref:(0,mp.useCallback)(Ra=>{Ra&&(K.current=getComputedStyle(Ra));k(Ra)},[])}}function qc(a){return(null===a||void 0===a?void 0:a.animationName)||"none"}function Dc({prop:a,defaultProp:d,onChange:k=()=>{}}){const [K,da]=Yc({defaultProp:d,onChange:k}),ja=void 0!==a;d=ja?a:K;const ra=Qi(k);k=(0,mv.useCallback)(Ja=>{ja?(Ja="function"===typeof Ja?Ja(a):Ja,Ja!==a&&ra(Ja)):
da(Ja)},[ja,a,da,ra]);return[d,k]}function Yc({defaultProp:a,onChange:d}){a=(0,mv.useState)(a);const [k]=a,K=(0,mv.useRef)(k),da=Qi(d);(0,mv.useEffect)(()=>{K.current!==k&&(da(k),K.current=k)},[k,K,da]);return a}function ed(a,d){const k=Math.abs(d.top-a.y),K=Math.abs(d.bottom-a.y),da=Math.abs(d.right-a.x);a=Math.abs(d.left-a.x);switch(Math.min(k,K,da,a)){case a:return"left";case da:return"right";case k:return"top";case K:return"bottom";default:return null}}function nd(a){a=a.slice();a.sort((d,k)=>
d.x<k.x?-1:d.x>k.x?1:d.y<k.y?-1:d.y>k.y?1:0);return Rd(a)}function Rd(a){if(1>=a.length)return a.slice();const d=[];for(var k=0;k<a.length;k++){for(var K=a[k];2<=d.length;){var da=d[d.length-1],ja=d[d.length-2];if((da.x-ja.x)*(K.y-ja.y)>=(da.y-ja.y)*(K.x-ja.x))d.pop();else break}d.push(K)}d.pop();k=[];for(K=a.length-1;0<=K;K--){for(da=a[K];2<=k.length;){ja=k[k.length-1];const ra=k[k.length-2];if((ja.x-ra.x)*(da.y-ra.y)>=(ja.y-ra.y)*(da.x-ra.x))k.pop();else break}k.push(da)}k.pop();return 1===d.length&&
1===k.length&&d[0].x===k[0].x&&d[0].y===k[0].y?d:d.concat(k)}function ce(a){var {side:d,content:k,sideOffset:K=10}=a;a=Jf(a,["side","content","sideOffset"]);return k?(0,bq.jsx)(KG,{delayDuration:300,children:(0,bq.jsxs)(LG,{children:[(0,bq.jsx)(MG,{asChild:!0,children:a.children}),(0,bq.jsx)(NG,{children:(0,bq.jsxs)(OG,ff(Zd({className:"tl-tooltip-content",sideOffset:K,side:d},a),{children:[k,(0,bq.jsx)(PG,{className:"tl-tooltip-arrow"})]}))})]})}):(0,bq.jsx)(bq.Fragment,{children:a.children})}function Yd(a){var {className:d,
tooltip:k,tooltipSide:K}=a;a=Jf(a,["className","tooltip","tooltipSide"]);return(0,uB.jsx)(ce,{content:k,side:K,children:(0,uB.jsx)("button",Zd({className:"tl-button "+(null!=d?d:"")},a))})}function Ne(a){var {toggle:d=!0,pressed:k,onPressedChange:K,className:da,tooltip:ja}=a;a=Jf(a,["toggle","pressed","onPressedChange","className","tooltip"]);return(0,Hx.jsx)(ce,{content:ja,children:(0,Hx.jsx)("div",{className:"inline-block",children:(0,Hx.jsx)(RG,ff(Zd({},a),{"data-toggle":d,className:"tl-toggle-input"+
(da?" "+da:""),pressed:k,onPressedChange:K}))})})}function ag(a){var d=a+"CollectionProvider";const [k,K]=Gh(d),[da,ja]=k(d,{collectionRef:{current:null},itemMap:new Map}),ra=fb=>{const {scope:jb,children:Jb}=fb;fb=Po.default.useRef(null);const Ob=Po.default.useRef(new Map).current;return Po.default.createElement(da,{scope:jb,itemMap:Ob,collectionRef:fb},Jb)};Object.assign(ra,{displayName:d});const Ja=a+"CollectionSlot";d=Po.default.forwardRef((fb,jb)=>{const {scope:Jb,children:Ob}=fb;fb=ja(Ja,Jb);
jb=$g(jb,fb.collectionRef);return Po.default.createElement(Oo,{ref:jb},Ob)});Object.assign(d,{displayName:Ja});const Ra=a+"CollectionItemSlot",$a=Po.default.forwardRef((fb,jb)=>{const {scope:Jb,children:Ob}=fb,Kb=Jf(fb,["scope","children"]),gc=Po.default.useRef(null);fb=$g(jb,gc);const rc=ja(Ra,Jb);Po.default.useEffect(()=>{rc.itemMap.set(gc,Zd({ref:gc},Kb));return()=>void rc.itemMap.delete(gc)});return Po.default.createElement(Oo,{["data-radix-collection-item"]:"",ref:fb},Ob)});Object.assign($a,
{displayName:Ra});return[{Provider:ra,Slot:d,ItemSlot:$a},function(fb){const jb=ja(a+"CollectionConsumer",fb);return Po.default.useCallback(()=>{const Jb=jb.collectionRef.current;if(!Jb)return[];const Ob=Array.from(Jb.querySelectorAll("[data-radix-collection-item]"));return Array.from(jb.itemMap.values()).sort((Kb,gc)=>Ob.indexOf(Kb.ref.current)-Ob.indexOf(gc.ref.current))},[jb.collectionRef,jb.itemMap])},K]}function pg(a){const d=(0,xB.useContext)(SG);return a||d||"ltr"}function Gf(){(0,TG.useEffect)(()=>
{var a,d;const k=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",null!==(a=k[0])&&void 0!==a?a:Tf());document.body.insertAdjacentElement("beforeend",null!==(d=k[1])&&void 0!==d?d:Tf());Ix++;return()=>{1===Ix&&document.querySelectorAll("[data-radix-focus-guard]").forEach(K=>K.remove());Ix--}},[])}function Tf(){const a=document.createElement("span");a.setAttribute("data-radix-focus-guard","");a.tabIndex=0;a.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none";
return a}function nf(a,{select:d=!1}={}){const k=document.activeElement;for(const K of a)if(hf(K,{select:d}),document.activeElement!==k)break}function Ze(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:k=>{const K="INPUT"===k.tagName&&"hidden"===k.type;return k.disabled||k.hidden||K?NodeFilter.FILTER_SKIP:0<=k.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);return d}function xg(a,d){for(const k of a)if(!og(k,{upTo:d}))return k}
function og(a,{upTo:d}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===d||a!==d);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}function hf(a,{select:d=!1}={}){if(a&&a.focus){const k=document.activeElement;a.focus({preventScroll:!0});a!==k&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function th(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function xh(a){return a.filter(d=>"A"!==d.tagName)}function Qh(a,d,k){a=
a.key;k="rtl"!==k?a:"ArrowLeft"===a?"ArrowRight":"ArrowRight"===a?"ArrowLeft":a;if("vertical"!==d||!["ArrowLeft","ArrowRight"].includes(k))if("horizontal"!==d||!["ArrowUp","ArrowDown"].includes(k))return $G[k]}function Hg(a){const d=document.activeElement;for(const k of a){if(k===d)break;k.focus();if(document.activeElement!==d)break}}function tg(a,d){return a.map((k,K)=>a[(d+K)%a.length])}function Hh(a,d){var k=(0,cH.useState)(function(){return{value:a,callback:d,facade:{get current(){return k.value},
set current(K){var da=k.value;da!==K&&(k.value=K,k.callback(K,da))}}}})[0];k.callback=d;return k.facade}function Gj(a,d){return Hh(d||null,function(k){return a.forEach(function(K){"function"===typeof K?K(k):K&&(K.current=k);return K})})}function zn(a){return a}function Xl(a,d){void 0===d&&(d=zn);var k=[],K=!1;return{read:function(){if(K)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return k.length?k[k.length-1]:a},useMedium:function(da){var ja=
d(da,K);k.push(ja);return function(){k=k.filter(function(ra){return ra!==ja})}},assignSyncMedium:function(da){for(K=!0;k.length;){var ja=k;k=[];ja.forEach(da)}k={push:function(ra){return da(ra)},filter:function(){return k}}},assignMedium:function(da){K=!0;var ja=[];if(k.length){var ra=k;k=[];ra.forEach(da);ja=k}var Ja=function(){var Ra=ja;ja=[];Ra.forEach(da)};Promise.resolve().then(Ja);k={push:function(Ra){ja.push(Ra);Promise.resolve().then(Ja)},filter:function(Ra){ja=ja.filter(Ra);return k}}}}}
function yo(a){const d=document.activeElement;for(const k of a){if(k===d)break;k.focus();if(document.activeElement!==d)break}}function Fl(a,d){return a.map((k,K)=>a[(d+K)%a.length])}function pj(a,d,k){const K=1<d.length&&Array.from(d).every(ja=>ja===d[0])?d[0]:d,da=k?a.indexOf(k):-1;a=Fl(a,Math.max(da,0));1===K.length&&(a=a.filter(ja=>ja!==k));a=a.find(ja=>ja.toLowerCase().startsWith(K.toLowerCase()));return a!==k?a:void 0}function zo(a){return d=>"mouse"===d.pointerType?a(d):void 0}function $o(a,
[d,k]){return Math.min(k,Math.max(d,a))}function Yn(a){const d=(0,Xx.useRef)({value:a,previous:a});return(0,Xx.useMemo)(()=>{d.current.value!==a&&(d.current.previous=d.current.value,d.current.value=a);return d.current.previous},[a])}function Zm(a=[],d,k){a=[...a];a[k]=d;return a.sort((K,da)=>K-da)}function wi(a,d,k){return 100/(k-d)*(a-d)}function ol(a,d){if(2<d)return`Value ${a+1} of ${d}`;if(2===d)return["Minimum","Maximum"][a]}function Xs(a,d){if(1===a.length)return 0;a=a.map(K=>Math.abs(K-d));
const k=Math.min(...a);return a.indexOf(k)}function Yl(a,d,k){a/=2;const K=cn([0,50],[0,a]);return(a-K(d)*k)*k}function dn(a){return a.slice(0,-1).map((d,k)=>a[k+1]-d)}function cn(a,d){return k=>a[0]===a[1]||d[0]===d[1]?d[0]:d[0]+(d[1]-d[0])/(a[1]-a[0])*(k-a[0])}function Io(a,d){d=Math.pow(10,d);return Math.round(a*d)/d}function km(a){function d($a){return $a?(0,Oj.jsx)("div",{className:"tl-color-bg",style:{backgroundColor:$a},children:(0,Oj.jsx)("div",{className:`w-full h-full bg-${$a}-500`})}):
(0,Oj.jsx)("div",{className:"tl-color-bg",children:(0,Oj.jsx)(Qg,{name:"color-swatch"})})}var {color:k,opacity:K,popoverSide:da,setColor:ja,setOpacity:ra}=a;a=Jf(a,["color","opacity","popoverSide","setColor","setOpacity"]);const {handlers:{t:Ja}}=He.default.useContext(ji),Ra=He.default.useMemo(()=>{let $a="";return Xj(fb=>{ja($a)},100,fb=>{$a=fb.target.value})},[]);return(0,Oj.jsx)(qm,ff(Zd({},a),{border:!0,arrow:!0,side:da,label:(0,Oj.jsx)(ce,{content:Ja("whiteboard/color"),side:da,sideOffset:14,
children:d(k)}),children:(0,Oj.jsxs)("div",{className:"p-1",children:[(0,Oj.jsx)("div",{className:"tl-color-palette",children:Object.values(Iw).map($a=>(0,Oj.jsx)("button",{className:`tl-color-drip m-1${$a===k?" active":""}`,onClick:()=>ja($a),children:d($a)},$a))}),(0,Oj.jsxs)("div",{className:"flex items-center tl-custom-color",children:[(0,Oj.jsx)("div",{className:`tl-color-drip m-1 mr-3 ${Gi(k)?"":"active"}`,children:(0,Oj.jsx)("div",{className:"color-input-wrapper tl-color-bg",children:(0,Oj.jsx)("input",
Zd({className:"color-input cursor-pointer",id:"tl-custom-color-input",type:"color",value:/^#(?:[0-9a-f]{3}){1,2}$/i.test(k)?k:"#000000",onChange:Ra,style:{opacity:Gi(k)?0:1}},a))})}),(0,Oj.jsx)("label",{htmlFor:"tl-custom-color-input",className:"cursor-pointer",children:Ja("whiteboard/select-custom-color")})]}),ra&&(0,Oj.jsx)("div",{className:"mx-1 my-2",children:(0,Oj.jsxs)(sk,{defaultValue:[null!=K?K:0],onValueCommit:$a=>ra($a[0]),max:1,step:.1,"aria-label":Ja("whiteboard/opacity"),className:"tl-slider-root",
children:[(0,Oj.jsx)(St,{className:"tl-slider-track",children:(0,Oj.jsx)(vj,{className:"tl-slider-range"})}),(0,Oj.jsx)(So,{className:"tl-slider-thumb"})]})})]})}))}function ei(a,d){a&&(0,rm.flushSync)(()=>a.dispatchEvent(d))}function dp(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Qi(a),K=(0,Hk.useRef)(!1),da=(0,Hk.useRef)(()=>{});(0,Hk.useEffect)(()=>{const ja=Ja=>{if(Ja.target&&!K.current){let Ra=function(){jm("dismissableLayer.pointerDownOutside",k,$a,{discrete:!0})};
const $a={originalEvent:Ja};"touch"===Ja.pointerType?(d.removeEventListener("click",da.current),da.current=Ra,d.addEventListener("click",da.current,{once:!0})):Ra()}K.current=!1},ra=window.setTimeout(()=>{d.addEventListener("pointerdown",ja)},0);return()=>{window.clearTimeout(ra);d.removeEventListener("pointerdown",ja);d.removeEventListener("click",da.current)}},[d,k]);return{onPointerDownCapture:()=>K.current=!0}}function $m(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=
Qi(a),K=(0,Hk.useRef)(!1);(0,Hk.useEffect)(()=>{const da=ja=>{ja.target&&!K.current&&jm("dismissableLayer.focusOutside",k,{originalEvent:ja},{discrete:!1})};d.addEventListener("focusin",da);return()=>d.removeEventListener("focusin",da)},[d,k]);return{onFocusCapture:()=>K.current=!0,onBlurCapture:()=>K.current=!1}}function Bn(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function jm(a,d,k,{discrete:K}){const da=k.originalEvent.target;k=new CustomEvent(a,{bubbles:!1,
cancelable:!0,detail:k});d&&da.addEventListener(a,d,{once:!0});K?ei(da,k):da.dispatchEvent(k)}function Rq(a,{select:d=!1}={}){const k=document.activeElement;for(const K of a)if(Em(K,{select:d}),document.activeElement!==k)break}function Go(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:k=>{const K="INPUT"===k.tagName&&"hidden"===k.type;return k.disabled||k.hidden||K?NodeFilter.FILTER_SKIP:0<=k.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);
return d}function Hn(a,d){for(const k of a)if(!An(k,{upTo:d}))return k}function An(a,{upTo:d}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===d||a!==d);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}function Em(a,{select:d=!1}={}){if(a&&a.focus){const k=document.activeElement;a.focus({preventScroll:!0});a!==k&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function Zn(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function Fp(a){return a.filter(d=>
"A"!==d.tagName)}function ap(a){return void 0!==a}function Og(a){return null!==a}function ep(a){const [d,k="center"]=a.split("-");return[d,k]}function fp(a){const d=Qi(a),k=(0,mf.useRef)(""),K=(0,mf.useRef)(0);a=(0,mf.useCallback)(ja=>{ja=k.current+ja;d(ja);(function Ra(Ja){k.current=Ja;window.clearTimeout(K.current);""!==Ja&&(K.current=window.setTimeout(()=>Ra(""),1E3))})(ja)},[d]);const da=(0,mf.useCallback)(()=>{k.current="";window.clearTimeout(K.current)},[]);(0,mf.useEffect)(()=>()=>window.clearTimeout(K.current),
[]);return[k,a,da]}function In(a,d,k){const K=1<d.length&&Array.from(d).every(ja=>ja===d[0])?d[0]:d,da=k?a.indexOf(k):-1;a=bn(a,Math.max(da,0));1===K.length&&(a=a.filter(ja=>ja!==k));a=a.find(ja=>ja.textValue.toLowerCase().startsWith(K.toLowerCase()));return a!==k?a:void 0}function bn(a,d){return a.map((k,K)=>a[(d+K)%a.length])}function Pp(a){var {options:d,tooltip:k,popoverSide:K,chevron:da=!0,value:ja,onValueChange:ra}=a;a=Jf(a,"options tooltip popoverSide chevron value onValueChange".split(" "));
const [Ja,Ra]=XB.useState(!1);return(0,Rg.jsx)("div",ff(Zd({},a),{className:"tl-select-input",children:(0,Rg.jsxs)(oq,{open:Ja,onOpenChange:Ra,value:ja,onValueChange:ra,children:[(0,Rg.jsx)(ce,{content:k,side:K,children:(0,Rg.jsxs)(gC,{className:"tl-select-input-trigger",children:[(0,Rg.jsx)("div",{className:"tl-select-input-trigger-value",children:(0,Rg.jsx)(iC,{})}),da&&(0,Rg.jsx)(jC,{style:{lineHeight:1},className:"ml-1 md:ml-3",children:(0,Rg.jsx)(Qg,{name:Ja?"chevron-up":"chevron-down"})})]})}),
(0,Rg.jsx)(wl,{className:"tl-select-input-portal",children:(0,Rg.jsxs)(iy,{className:"tl-select-input-content",side:K,position:"popper",sideOffset:14,align:"center",onKeyDown:$a=>$a.stopPropagation(),children:[(0,Rg.jsx)(kC,{}),(0,Rg.jsx)(hC,{className:"tl-select-input-viewport",children:d.map($a=>(0,Rg.jsx)(Pm,{className:"tl-select-input-select-item",value:$a.value,children:(0,Rg.jsx)(zd,{children:$a.label})},$a.value))}),(0,Rg.jsx)(Ah,{})]})})]})}))}function Jr(a){var {scaleLevel:d,compact:k,popoverSide:K}=
a;Jf(a,["scaleLevel","compact","popoverSide"]);const da=mg();({handlers:{t:a}}=lC.default.useContext(ji));const ja=[{label:k?"XS":a("whiteboard/extra-small"),value:"xs"},{label:k?"SM":a("whiteboard/small"),value:"sm"},{label:k?"MD":a("whiteboard/medium"),value:"md"},{label:k?"LG":a("whiteboard/large"),value:"lg"},{label:k?"XL":a("whiteboard/extra-large"),value:"xl"},{label:k?"XXL":a("whiteboard/huge"),value:"xxl"}];return(0,Zt.jsx)(Pp,{tooltip:a("whiteboard/scale-level"),options:ja,value:d,popoverSide:K,
chevron:!k,onValueChange:ra=>{da.api.setScaleLevel(ra)}})}function bo(a,d){return function(k){return a(d(k))}}function Cq(a,d){return d(a)}function Dm(a,d){return function(k){return a(d,k)}}function Cm(a,d){return function(){return a(d)}}function Wi(a,d){d(a);return a}function Si(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return d}function lm(a){a()}function Yq(a){return function(){return a}}function Vr(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];
return function(){d.map(lm)}}function fi(){}function fh(a,d){return a(1,d)}function Ur(a,d){a(0,d)}function bt(a){a(2)}function eo(a){return a(4)}function Kg(a,d){return fh(a,Dm(d,0))}function Fm(a,d){var k=a(1,function(K){k();d(K)});return k}function Cg(){var a=[];return function(d,k){switch(d){case 2:a.splice(0,a.length);break;case 1:return a.push(k),function(){var K=a.indexOf(k);-1<K&&a.splice(K,1)};case 0:a.slice().forEach(function(K){K(k)});break;default:throw Error("unrecognized action "+d);
}}}function Rf(a){var d=a,k=Cg();return function(K,da){switch(K){case 1:da(d);break;case 0:d=da;break;case 4:return d}return k(K,da)}}function Gm(a){var d,k;return function(K,da){switch(K){case 1:if(da){if(k===da)break;d&&d();k=da;return d=a(1,da)}d&&d();return fi;case 2:d&&d();k=null;break;default:throw Error("unrecognized action "+K);}}}function nk(a){return Wi(Cg(),function(d){return Kg(a,d)})}function Uj(a,d){return Wi(Rf(d),function(k){return Kg(a,k)})}function fo(){for(var a=arguments.length,
d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return function(K){return d.reduceRight(Cq,K)}}function xf(a){for(var d=arguments.length,k=Array(1<d?d-1:0),K=1;K<d;K++)k[K-1]=arguments[K];var da=fo.apply(void 0,k);return function(ja,ra){switch(ja){case 1:return fh(a,da(ra));case 2:a(2);break;default:throw Error("unrecognized action "+ja);}}}function Im(a,d){return a===d}function Sh(a){void 0===a&&(a=Im);var d;return function(k){return function(K){a(d,K)||(d=K,k(K))}}}function lg(a){return function(d){return function(k){a(k)&&
d(k)}}}function qg(a){return function(d){return bo(d,a)}}function en(a){return function(d){return function(){return d(a)}}}function fk(a,d){return function(k){return function(K){return k(d=a(d,K))}}}function cm(a){return function(d){return function(k){0<a?a--:d(k)}}}function go(a){var d,k;return function(K){return function(da){d=da;k||=setTimeout(function(){k=void 0;K(d)},a)}}}function Jj(a){var d,k;return function(K){return function(da){d=da;k&&clearTimeout(k);k=setTimeout(function(){K(d)},a)}}}
function vh(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];var K=Array(d.length),da=0,ja=null,ra=Math.pow(2,d.length)-1;d.forEach(function(Ja,Ra){var $a=Math.pow(2,Ra);fh(Ja,function(fb){var jb=da;da|=$a;K[Ra]=fb;jb!==ra&&da===ra&&ja&&(ja(),ja=null)})});return function(Ja){return function(Ra){var $a=function(){return Ja([Ra].concat(K))};da===ra?$a():ja=$a}}}function Qp(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return function(K,da){switch(K){case 1:return Vr.apply(void 0,
d.map(function(ja){return ja(1,da)}));case 2:break;default:throw Error("unrecognized action "+K);}}}function kh(a,d){void 0===d&&(d=Im);return xf(a,Sh(d))}function sj(){for(var a=Cg(),d=arguments.length,k=Array(d),K=0;K<d;K++)k[K]=arguments[K];var da=Array(k.length),ja=0,ra=Math.pow(2,k.length)-1;k.forEach(function(Ja,Ra){var $a=Math.pow(2,Ra);fh(Ja,function(fb){da[Ra]=fb;ja|=$a;ja===ra&&a(0,da)})});return function(Ja,Ra){switch(Ja){case 1:return ja===ra&&Ra(da),a(1,Ra);case 2:a(2);break;default:throw Error("unrecognized action "+
Ja);}}}function Vh(a,d,k){void 0===d&&(d=[]);k=(void 0===k?{singleton:!0}:k).singleton;return{id:Symbol(),constructor:a,dependencies:d,singleton:k}}function hp(a){var d=new Map;return function da(K){var ja=K.id,ra=K.constructor,Ja=K.dependencies;if((K=K.singleton)&&d.has(ja))return d.get(ja);ra=ra(Ja.map(function(Ra){return da(Ra)}));K&&d.set(ja,ra);return ra}(a)}function Jo(a,d){if(null==a)return{};var k={},K=Object.keys(a),da;for(da=0;da<K.length;da++){var ja=K[da];0<=d.indexOf(ja)||(k[ja]=a[ja])}return k}
function ip(a,d){if(a){if("string"===typeof a)return Rp(a,d);var k=Object.prototype.toString.call(a).slice(8,-1);"Object"===k&&a.constructor&&(k=a.constructor.name);if("Map"===k||"Set"===k)return Array.from(a);if("Arguments"===k||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return Rp(a,d)}}function Rp(a,d){if(null==d||d>a.length)d=a.length;for(var k=0,K=Array(d);k<d;k++)K[k]=a[k];return K}function ho(a,d){var k="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(k)return(k=k.call(a)).next.bind(k);
if(Array.isArray(a)||(k=ip(a))||d&&a&&"number"===typeof a.length){k&&(a=k);var K=0;return function(){return K>=a.length?{done:!0}:{done:!1,value:a[K++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function Sp(a,d){for(var k={},K={},da=0,ja=a.length;da<ja;)K[a[da]]=1,da+=1;for(var ra in d)K.hasOwnProperty(ra)||(k[ra]=d[ra]);return k}function tj(a,d,k){function K(jb,Jb){jb.propsReady&&
(0,jb.propsReady)(0,!1);for(var Ob=ho(ra),Kb;!(Kb=Ob()).done;)Kb=Kb.value,(0,jb[d.required[Kb]])(0,Jb[Kb]);for(Ob=ho(Ja);!(Kb=Ob()).done;)if(Kb=Kb.value,Kb in Jb)(0,jb[d.optional[Kb]])(0,Jb[Kb]);jb.propsReady&&(0,jb.propsReady)(0,!0)}function da(jb){return Ra.reduce(function(Jb,Ob){Jb[Ob]=function(Kb){(0,jb[d.methods[Ob]])(0,Kb)};return Jb},{})}function ja(jb){return $a.reduce(function(Jb,Ob){Jb[Ob]=Gm(jb[d.events[Ob]]);return Jb},{})}var ra=Object.keys(d.required||{}),Ja=Object.keys(d.optional||
{}),Ra=Object.keys(d.methods||{}),$a=Object.keys(d.events||{}),fb=(0,sm.createContext)({});return{Component:(0,sm.forwardRef)(function(jb,Jb){var Ob=jb.children,Kb=Jo(jb,pC),gc=(0,sm.useState)(function(){return Wi(hp(a),function(Wb){return K(Wb,Kb)})})[0],rc=(0,sm.useState)(Cm(ja,gc))[0];Ds(function(){for(var Wb=ho($a),kc;!(kc=Wb()).done;)if(kc=kc.value,kc in Kb)(0,rc[kc])(1,Kb[kc]);return function(){Object.values(rc).map(bt)}},[Kb,rc,gc]);Ds(function(){K(gc,Kb)});(0,sm.useImperativeHandle)(Jb,Yq(da(gc)));
return(0,sm.createElement)(fb.Provider,{value:gc},k?(0,sm.createElement)(k,Sp([].concat(ra,Ja,$a),Kb),Ob):Ob)}),usePublisher:function(jb){return(0,sm.useCallback)(Dm(Ur,(0,sm.useContext)(fb)[jb]),[jb])},useEmitterValue:function(jb){var Jb=(0,sm.useContext)(fb)[jb];jb=(0,sm.useState)(Cm(eo,Jb));var Ob=jb[0],Kb=jb[1];Ds(function(){return fh(Jb,function(gc){gc!==Ob&&Kb(Yq(gc))})},[Jb,Ob]);return Ob},useEmitter:function(jb,Jb){var Ob=(0,sm.useContext)(fb)[jb];Ds(function(){return Ob(1,Jb)},[Jb,Ob])}}}
function bh(){return bh=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],K;for(K in k)Object.prototype.hasOwnProperty.call(k,K)&&(a[K]=k[K])}return a},bh.apply(this,arguments)}function dm(a,d){if(null==a)return{};var k,K,da={},ja=Object.keys(a);for(K=0;K<ja.length;K++)0<=d.indexOf(k=ja[K])||(da[k]=a[k]);return da}function io(a,d){(null==d||d>a.length)&&(d=a.length);for(var k=0,K=Array(d);k<d;k++)K[k]=a[k];return K}function em(a,d){var k="undefined"!=typeof Symbol&&
a[Symbol.iterator]||a["@@iterator"];if(k)return(k=k.call(a)).next.bind(k);if(Array.isArray(a)||(k=function(da,ja){if(da){if("string"==typeof da)return io(da,ja);var ra=Object.prototype.toString.call(da).slice(8,-1);return"Object"===ra&&da.constructor&&(ra=da.constructor.name),"Map"===ra||"Set"===ra?Array.from(da):"Arguments"===ra||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ra)?io(da,ja):void 0}}(a))||d&&a&&"number"==typeof a.length){k&&(a=k);var K=0;return function(){return K>=a.length?{done:!0}:
{done:!1,value:a[K++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function Ko(a,d){void 0===d&&(d=!0);var k=(0,qh.useRef)(null),K=function(ja){};if("undefined"!=typeof ResizeObserver){var da=new ResizeObserver(function(ja){ja=ja[0].target;null!==ja.offsetParent&&a(ja)});K=function(ja){ja&&d?(da.observe(ja),k.current=ja):(k.current&&da.unobserve(k.current),k.current=null)}}return{ref:k,
callbackRef:K}}function hj(a,d){return void 0===d&&(d=!0),Ko(a,d).callbackRef}function oi(a,d,k,K,da,ja,ra){return Ko(function(Ja){for(var Ra=function(jb,Jb,Ob,Kb){Ob=jb.length;if(0===Ob)return null;for(var gc=[],rc=0;rc<Ob;rc++){var Wb=jb.item(rc);if(Wb&&void 0!==Wb.dataset.index){var kc=parseInt(Wb.dataset.index),hc=parseFloat(Wb.dataset.knownSize),Fc=Jb(Wb,"offsetHeight");if(0===Fc&&Kb("Zero-sized element, this should not happen",{child:Wb},Ik.ERROR),Fc!==hc)Wb=gc[gc.length-1],0===gc.length||Wb.size!==
Fc||Wb.endIndex!==kc-1?gc.push({startIndex:kc,endIndex:kc,size:Fc}):gc[gc.length-1].endIndex++}}return gc}(Ja.children,d,0,da),$a=Ja.parentElement;!$a.dataset.virtuosoScroller;)$a=$a.parentElement;var fb="window"===$a.firstElementChild.dataset.viewportType;K({scrollTop:Math.max(ra?ra.scrollTop:fb?window.pageYOffset||document.documentElement.scrollTop:$a.scrollTop,0),scrollHeight:ra?ra.scrollHeight:fb?document.documentElement.scrollHeight:$a.scrollHeight,viewportHeight:ra?ra.offsetHeight:fb?window.innerHeight:
$a.offsetHeight});null==ja||ja(function(jb,Jb,Ob){return"normal"===Jb||null!=Jb&&Jb.endsWith("px")||Ob("row-gap was not resolved to pixel value correctly",Jb,Ik.WARN),"normal"===Jb?0:parseInt(null!=Jb?Jb:"0",10)}(0,getComputedStyle(Ja).rowGap,da));null!==Ra&&a(Ra)},k)}function ii(a,d){return Math.round(a.getBoundingClientRect()[d])}function Wr(a,d,k,K,da){void 0===K&&(K=fi);var ja=(0,qh.useRef)(null),ra=(0,qh.useRef)(null),Ja=(0,qh.useRef)(null),Ra=(0,qh.useRef)(!1),$a=(0,qh.useCallback)(function(fb){fb=
fb.target;var jb=fb===window||fb===document,Jb=jb?window.pageYOffset||document.documentElement.scrollTop:fb.scrollTop,Ob=jb?document.documentElement.scrollHeight:fb.scrollHeight,Kb=jb?window.innerHeight:fb.offsetHeight;fb=function(){a({scrollTop:Math.max(Jb,0),scrollHeight:Ob,viewportHeight:Kb})};Ra.current?(0,qC.flushSync)(fb):fb();Ra.current=!1;null!==ra.current&&(Jb===ra.current||0>=Jb||Jb===Ob-Kb)&&(ra.current=null,d(!0),Ja.current&&(clearTimeout(Ja.current),Ja.current=null))},[a,d]);return(0,qh.useEffect)(function(){var fb=
da||ja.current;return K(da||ja.current),$a({target:fb}),fb.addEventListener("scroll",$a,{passive:!0}),function(){K(null);fb.removeEventListener("scroll",$a)}},[ja,$a,k,K,da]),{scrollerRef:ja,scrollByCallback:function(fb){Ra.current=!0;ja.current.scrollBy(fb)},scrollToCallback:function(fb){var jb=ja.current;if(jb&&!("offsetHeight"in jb&&0===jb.offsetHeight)){var Jb,Ob,Kb,gc="smooth"===fb.behavior;if(jb===window?(Ob=Math.max(ii(document.documentElement,"height"),document.documentElement.scrollHeight),
Jb=window.innerHeight,Kb=document.documentElement.scrollTop):(Ob=jb.scrollHeight,Jb=ii(jb,"height"),Kb=jb.scrollTop),fb.top=Math.ceil(Math.max(Math.min(Ob-Jb,fb.top),0)),1.01>Math.abs(Jb-Ob)||fb.top===Kb)return a({scrollTop:Kb,scrollHeight:Ob,viewportHeight:Jb}),void(gc&&d(!0));gc?(ra.current=fb.top,Ja.current&&clearTimeout(Ja.current),Ja.current=setTimeout(function(){Ja.current=null;ra.current=null;d(!0)},1E3)):ra.current=null;jb.scrollTo(fb)}}}}function Lo(a,d,k,K,da){return void 0===K&&(K=gi),
void 0===da&&(da=gi),{k:a,v:d,lvl:k,l:K,r:da}}function x(a,d){if(a===gi)return gi;var k=a.k,K=a.l,da=a.r;if(d===k){if(K===gi)return da;if(da===gi)return K;d=cb(K);return zc(qb(a,{k:d[0],v:d[1],l:nb(K)}))}return zc(qb(a,d<k?{l:x(K,d)}:{r:x(da,d)}))}function ba(a,d,k){return(void 0===k&&(k="k"),a===gi)?[-Infinity,void 0]:a[k]===d?[a.k,a.v]:a[k]<d?(d=ba(a.r,d,k),-Infinity===d[0]?[a.k,a.v]:d):ba(a.l,d,k)}function za(a,d,k){return a===gi?Lo(d,k,1):d===a.k?qb(a,{k:d,v:k}):Bd(Id(qb(a,d<a.k?{l:za(a.l,d,k)}:
{r:za(a.r,d,k)})))}function wa(a,d,k){if(a===gi)return[];var K=a.k,da=a.v,ja=a.r,ra=[];return K>d&&(ra=ra.concat(wa(a.l,d,k))),K>=d&&K<=k&&ra.push({k:K,v:da}),K<=k&&(ra=ra.concat(wa(ja,d,k))),ra}function Ha(a){return a===gi?[]:[].concat(Ha(a.l),[{k:a.k,v:a.v}],Ha(a.r))}function cb(a){return a.r===gi?[a.k,a.v]:cb(a.r)}function nb(a){return a.r===gi?a.l:zc(qb(a,{r:nb(a.r)}))}function qb(a,d){return Lo(void 0!==d.k?d.k:a.k,void 0!==d.v?d.v:a.v,void 0!==d.lvl?d.lvl:a.lvl,void 0!==d.l?d.l:a.l,void 0!==
d.r?d.r:a.r)}function Vb(a){return a===gi||a.lvl>a.r.lvl}function zc(a){var d=a.l,k=a.r,K=a.lvl;if(k.lvl>=K-1&&d.lvl>=K-1)return a;if(K>k.lvl+1){if(Vb(d))return Id(qb(a,{lvl:K-1}));if(d===gi||d.r===gi)throw Error("Unexpected empty nodes");return qb(d.r,{l:qb(d,{r:d.r.l}),r:qb(a,{l:d.r.r,lvl:K-1}),lvl:K})}if(Vb(a))return Bd(qb(a,{lvl:K-1}));if(k===gi||k.l===gi)throw Error("Unexpected empty nodes");d=k.l;var da=Vb(d)?k.lvl-1:k.lvl;return qb(d,{l:qb(a,{r:d.l,lvl:K-1}),r:Bd(qb(k,{l:d.r,lvl:da})),lvl:d.lvl+
1})}function Pc(a,d,k){return a===gi?[]:wd(wa(a,ba(a,d)[0],k),function(K){return{index:K.k,value:K.v}})}function wd(a,d){var k=a.length;if(0===k)return[];var K=d(a[0]),da=K.index;K=K.value;for(var ja=[],ra=1;ra<k;ra++){var Ja=d(a[ra]),Ra=Ja.index;Ja=Ja.value;ja.push({start:da,end:Ra-1,value:K});da=Ra;K=Ja}return ja.push({start:da,end:Infinity,value:K}),ja}function Bd(a){var d=a.r,k=a.lvl;return d===gi||d.r===gi||d.lvl!==k||d.r.lvl!==k?a:qb(d,{l:qb(a,{r:d.l}),lvl:k+1})}function Id(a){var d=a.l;return d===
gi||d.lvl!==a.lvl?a:qb(d,{r:qb(a,{l:d.r})})}function Ce(a,d,k,K){void 0===K&&(K=0);for(var da=a.length-1;K<=da;){var ja=Math.floor((K+da)/2),ra=k(a[ja],d);if(0===ra)return ja;if(-1===ra){if(2>da-K)return ja-1;da=ja-1}else{if(da===K)return ja;K=ja+1}}throw Error("Failed binary finding record in array - "+a.join(",")+", searched for "+d);}function Mf(a){var d=a.size,k=a.startIndex,K=a.endIndex;return function(da){return da.start===k&&(da.end===K||Infinity===da.end)&&da.value===d}}function Pg(a,d){a=
a.index;return d===a?0:d<a?-1:1}function Vj(a,d){a=a.offset;return d===a?0:d<a?-1:1}function Ag(a){return{index:a.index,value:a}}function yi(a,d,k,K){var da=0,ja=0,ra=0,Ja;0!==d?(ra=a[Ja=Ce(a,d-1,Pg)].offset,ja=ba(k,d-1),da=ja[0],ja=ja[1],a.length&&a[Ja].size===ba(k,d)[1]&&--Ja,a=a.slice(0,Ja+1)):a=[];for(d=em(Pc(k,d,Infinity));!(k=d()).done;)Ja=k.value,k=Ja.start,Ja=Ja.value,da=k-da,ra=da*ja+ra+da*K,a.push({offset:ra,size:Ja,index:k}),da=k,ja=Ja;return{offsetTree:a,lastIndex:da,lastOffset:ra,lastSize:ja}}
function pi(a,d){var k=d[0],K=d[1],da=d[3];0<k.length&&(0,d[2])("received item sizes",k,Ik.DEBUG);var ja=a.sizeTree;d=ja;var ra=0;if(0<K.length&&ja===gi&&2===k.length){var Ja=k[0].size,Ra=k[1].size;d=K.reduce(function(fb,jb){return za(za(fb,jb,Ja),jb+1,Ra)},d)}else k=function(fb,jb){var Jb,Ob=fb===gi?0:Infinity;for(jb=em(jb);!(Jb=jb()).done;){var Kb=Jb.value;Jb=Kb.size;var gc=Kb.startIndex,rc=Kb.endIndex;if(Ob=Math.min(Ob,gc),fb===gi)fb=za(fb,0,Jb);else{var Wb=Pc(fb,gc-1,rc+1);if(!Wb.some(Mf(Kb))){var kc,
hc=Kb=!1;for(Wb=em(Wb);!(kc=Wb()).done;){var Fc=kc.value;kc=Fc.start;var Lc=Fc.end;Fc=Fc.value;Kb?(rc>=kc||Jb===Fc)&&(fb=x(fb,kc)):(hc=Fc!==Jb,Kb=!0);Lc>rc&&rc>=kc&&Fc!==Jb&&(fb=za(fb,rc+1,Fc))}hc&&(fb=za(fb,gc,Jb))}}}return[fb,Ob]}(d,k),d=k[0],ra=k[1];if(d===ja)return a;a=yi(a.offsetTree,ra,d,da);var $a=a.offsetTree;return{sizeTree:d,offsetTree:$a,lastIndex:a.lastIndex,lastOffset:a.lastOffset,lastSize:a.lastSize,groupOffsetTree:K.reduce(function(fb,jb){return za(fb,jb,Th(jb,$a,da))},gi),groupIndices:K}}
function Th(a,d,k){if(0===d.length)return 0;d=d[Ce(d,a,Pg)];a-=d.index;a=d.size*a+(a-1)*k+d.offset;return 0<a?a+k:a}function zi(a,d,k){if(void 0!==a.groupIndex)return d.groupIndices[a.groupIndex]+1;a=zh("LAST"===a.index?k:a.index,d);return Math.max(0,a,Math.min(k,a))}function zh(a,d){if(d.groupOffsetTree===gi)return a;for(var k=0;d.groupIndices[k]<=a+k;)k++;return a+k}function Uh(a){a="number"==typeof a?{index:a}:a;return a.align||(a.align="start"),a.behavior&&qH||(a.behavior="auto"),a.offset||(a.offset=
0),a}function Wh(a){return!!a&&("smooth"===a?"smooth":"auto")}function qi(a){return a.reduce(function(d,k){return d.groupIndices.push(d.totalCount),d.totalCount+=k+1,d},{totalCount:0,groupIndices:[]})}function uj(a,d){return!(!a||a[0]!==d[0]||a[1]!==d[1])}function Dk(a,d){return!(!a||a.startIndex!==d.startIndex||a.endIndex!==d.endIndex)}function ul(a,d,k){return"number"==typeof a?"up"===k&&"top"===d||"down"===k&&"bottom"===d?a:0:"up"===k?"top"===d?a.main:a.reverse:"bottom"===d?a.main:a.reverse}function Kn(a,
d,k){if(0===a.length)return[];if(d.groupOffsetTree===gi)return a.map(function(Ra){return bh({},Ra,{index:Ra.index+k,originalIndex:Ra.index})});var K,da=[],ja=Pc(d.groupOffsetTree,a[0].index,a[a.length-1].index),ra=void 0,Ja=0;for(a=em(a);!(K=a()).done;)K=K.value,(!ra||ra.end<K.index)&&(ra=ja.shift(),Ja=d.groupIndices.indexOf(ra.start)),da.push(bh({},K.index===ra.start?{type:"group",index:Ja}:{index:K.index-(Ja+1)+k,groupIndex:Ja},{size:K.size,offset:K.offset,originalIndex:K.index,data:K.data}));return da}
function Jm(a,d,k,K,da,ja){var ra=0,Ja=0;0<a.length&&(ra=a[0].offset,Ja=a[a.length-1],Ja=Ja.offset+Ja.size);var Ra=k-da.lastIndex,$a=ra;K=da.lastOffset+Ra*da.lastSize+(Ra-1)*K-Ja;return{items:Kn(a,da,ja),topItems:Kn(d,da,ja),topListHeight:d.reduce(function(fb,jb){return jb.size+fb},0),offsetTop:ra,offsetBottom:K,top:$a,bottom:Ja,totalCount:k,firstItemIndex:ja}}function Km(a){var d,k=!1;return function(){return k||(k=!0,d=a()),d}}function ph(a,d){var k=(0,qh.useRef)(null),K=(0,qh.useCallback)(function(Ra){if(null!==
Ra&&Ra.offsetParent){var $a=Ra.getBoundingClientRect();Ra=$a.width;if(d){var fb=d.getBoundingClientRect();$a=$a.top-fb.top;fb=fb.height-Math.max(0,$a);$a+=d.scrollTop}else fb=window.innerHeight-Math.max(0,$a.top),$a=$a.top+window.pageYOffset;k.current={offsetTop:$a,visibleHeight:fb,visibleWidth:Ra};a(k.current)}},[a,d]),da=Ko(K),ja=da.callbackRef,ra=da.ref,Ja=(0,qh.useCallback)(function(){K(ra.current)},[K,ra]);return(0,qh.useEffect)(function(){if(d){d.addEventListener("scroll",Ja);var Ra=new ResizeObserver(Ja);
return Ra.observe(d),function(){d.removeEventListener("scroll",Ja);Ra.unobserve(d)}}return window.addEventListener("scroll",Ja),window.addEventListener("resize",Ja),function(){window.removeEventListener("scroll",Ja);window.removeEventListener("resize",Ja)}},[Ja,d]),ja}function ct(a){return a}function om(a,d){var k=Cg();return fh(k,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+d,"color: red;","color: inherit;","color: blue;")}),Kg(k,a),k}function gk(a,d){if("string"!=
typeof a)return{context:d}}function Xr(a){var d=a.usePublisher,k=a.useEmitter,K=a.useEmitterValue;return Zg.memo(function(da){var ja=da.style,ra=da.children;da=dm(da,ty);var Ja=d("scrollContainerState"),Ra=K("ScrollerComponent"),$a=d("smoothScrollTargetReached"),fb=K("scrollerRef"),jb=K("context");Ja=Wr(Ja,$a,Ra,fb);$a=Ja.scrollerRef;fb=Ja.scrollByCallback;return k("scrollTo",Ja.scrollToCallback),k("scrollBy",fb),(0,qh.createElement)(Ra,bh({ref:$a,style:bh({},uH,ja),"data-test-id":"virtuoso-scroller",
"data-virtuoso-scroller":!0,tabIndex:0},da,gk(Ra,jb)),ra)})}function Zq(a){var d=a.usePublisher,k=a.useEmitter,K=a.useEmitterValue;return Zg.memo(function(da){var ja=da.style,ra=da.children;da=dm(da,yC);var Ja=d("windowScrollContainerState"),Ra=K("ScrollerComponent"),$a=d("smoothScrollTargetReached"),fb=K("totalListHeight"),jb=K("deviation"),Jb=K("customScrollParent"),Ob=K("context");$a=Wr(Ja,$a,Ra,fi,Jb);var Kb=$a.scrollerRef;Ja=$a.scrollByCallback;$a=$a.scrollToCallback;return oH(function(){return Kb.current=
Jb||window,function(){Kb.current=null}},[Kb,Jb]),k("windowScrollTo",$a),k("scrollBy",Ja),(0,qh.createElement)(Ra,bh({style:bh({position:"relative"},ja,0!==fb?{height:fb+jb}:{}),"data-virtuoso-scroller":!0},da,gk(Ra,Ob)),ra)})}function Yr(a,d,k){return Array.from({length:d-a+1}).map(function(K,da){return{index:da+a,data:null==k?void 0:k[da+a]}})}function Tp(a,d){return a&&a.column===d.column&&a.row===d.row}function Fu(a,d,k,K){var da=k.height;return void 0===da||0===K.length?{top:0,bottom:0}:{top:dt(a,
d,k,K[0].index),bottom:dt(a,d,k,K[K.length-1].index)+da}}function dt(a,d,k,K){var da=d.column;a=ki(1,gu((a.width+da)/(k.width+da)));K=gu(K/a);k=K*k.height+ki(0,K-1)*d.row;return 0<k?k+d.row:k}function Gu(a,d,k){return"normal"===d||null!=d&&d.endsWith("px")||k(a+" was not resolved to pixel value correctly",d,Ik.WARN),"normal"===d?0:parseInt(null!=d?d:"0",10)}function Up(a,d){Up=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(k,K){k.__proto__=K;return k};return Up(a,d)}function Zr(a,d){a.prototype=
Object.create(d.prototype);a.prototype.constructor=a;Up(a,d)}function et(a){et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(d){return d.__proto__||Object.getPrototypeOf(d)};return et(a)}function ww(){if("undefined"===typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function ft(a,d,k){ft=ww()?Reflect.construct.bind():function(K,
da,ja){var ra=[null];ra.push.apply(ra,da);K=new (Function.bind.apply(K,ra));ja&&Up(K,ja.prototype);return K};return ft.apply(null,arguments)}function gt(a){var d="function"===typeof Map?new Map:void 0;gt=function(k){function K(){return ft(k,arguments,et(this).constructor)}if(null===k||-1===Function.toString.call(k).indexOf("[native code]"))return k;if("function"!==typeof k)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof d){if(d.has(k))return d.get(k);
d.set(k,K)}K.prototype=Object.create(k.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}});return Up(K,k)};return gt(a)}function xw(a,d,k){return Math.round(255*a)+","+Math.round(255*d)+","+Math.round(255*k)}function $q(a,d,k,K){void 0===K&&(K=xw);if(0===d)return K(k,k,k);a=(a%360+360)%360/60;var da=(1-Math.abs(2*k-1))*d,ja=da*(1-Math.abs(a%2-1)),ra=d=0,Ja=0;0<=a&&1>a?(d=da,ra=ja):1<=a&&2>a?(d=ja,ra=da):2<=a&&3>a?(ra=da,Ja=ja):3<=a&&4>a?(ra=ja,Ja=da):4<=a&&5>a?(d=ja,Ja=da):
5<=a&&6>a&&(d=da,Ja=ja);k-=da/2;return K(d+k,ra+k,Ja+k)}function yw(a){if("string"!==typeof a)throw new Ql(3);if("string"===typeof a){var d=a.toLowerCase();a=Tv[d]?"#"+Tv[d]:a}if(a.match(KC))return{red:parseInt(""+a[1]+a[2],16),green:parseInt(""+a[3]+a[4],16),blue:parseInt(""+a[5]+a[6],16)};if(a.match(LC))return d=parseFloat((parseInt(""+a[7]+a[8],16)/255).toFixed(2)),{red:parseInt(""+a[1]+a[2],16),green:parseInt(""+a[3]+a[4],16),blue:parseInt(""+a[5]+a[6],16),alpha:d};if(a.match(yy))return{red:parseInt(""+
a[1]+a[1],16),green:parseInt(""+a[2]+a[2],16),blue:parseInt(""+a[3]+a[3],16)};if(a.match(tn))return d=parseFloat((parseInt(""+a[4]+a[4],16)/255).toFixed(2)),{red:parseInt(""+a[1]+a[1],16),green:parseInt(""+a[2]+a[2],16),blue:parseInt(""+a[3]+a[3],16),alpha:d};if(d=vr.exec(a))return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10)};if(d=jl.exec(a.substring(0,50)))return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:1<parseFloat(""+
d[4])?parseFloat(""+d[4])/100:parseFloat(""+d[4])};var k=Uv.exec(a);if(k){d=parseInt(""+k[1],10);var K=parseInt(""+k[2],10)/100;k=parseInt(""+k[3],10)/100;d="rgb("+$q(d,K,k)+")";K=vr.exec(d);if(!K)throw new Ql(4,a,d);return{red:parseInt(""+K[1],10),green:parseInt(""+K[2],10),blue:parseInt(""+K[3],10)}}if(d=ju.exec(a.substring(0,50))){K=parseInt(""+d[1],10);k=parseInt(""+d[2],10)/100;var da=parseInt(""+d[3],10)/100;K="rgb("+$q(K,k,da)+")";k=vr.exec(K);if(!k)throw new Ql(4,a,K);return{red:parseInt(""+
k[1],10),green:parseInt(""+k[2],10),blue:parseInt(""+k[3],10),alpha:1<parseFloat(""+d[4])?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Ql(5);}function jo(a){a=a.toString(16);return 1===a.length?"0"+a:a}function ht(a,d,k){return Tm("#"+jo(Math.round(255*a))+jo(Math.round(255*d))+jo(Math.round(255*k)))}function Hu(a,d,k){if("number"===typeof a&&"number"===typeof d&&"number"===typeof k)return Tm("#"+jo(a)+jo(d)+jo(k));if("object"===typeof a&&void 0===d&&void 0===k)return Tm("#"+jo(a.red)+jo(a.green)+
jo(a.blue));throw new Ql(6);}function zw(a){if("object"!==typeof a)throw new Ql(8);if("number"===typeof a.red&&"number"===typeof a.green&&"number"===typeof a.blue&&"number"===typeof a.alpha){if("object"===typeof a)a=1<=a.alpha?Hu(a.red,a.green,a.blue):"rgba("+a.red+","+a.green+","+a.blue+","+a.alpha+")";else throw new Ql(7);return a}if("number"===typeof a.red&&"number"===typeof a.green&&"number"===typeof a.blue&&("number"!==typeof a.alpha||"undefined"===typeof a.alpha))return Hu(a);if("number"===
typeof a.hue&&"number"===typeof a.saturation&&"number"===typeof a.lightness&&"number"===typeof a.alpha){if("object"===typeof a)a=1<=a.alpha?$q(a.hue,a.saturation,a.lightness,ht):"rgba("+$q(a.hue,a.saturation,a.lightness)+","+a.alpha+")";else throw new Ql(2);return a}if("number"===typeof a.hue&&"number"===typeof a.saturation&&"number"===typeof a.lightness&&("number"!==typeof a.alpha||"undefined"===typeof a.alpha)){if("object"===typeof a)a=$q(a.hue,a.saturation,a.lightness,ht);else throw new Ql(1);
return a}throw new Ql(8);}function it(a,d,k){return function(){var K=k.concat(Array.prototype.slice.call(arguments));return K.length>=d?a.apply(this,K):it(a,d,K)}}function jt(a,d){if("transparent"===d)return d;d=yw(d);var k=d.red/255,K=d.green/255,da=d.blue/255,ja=Math.max(k,K,da),ra=Math.min(k,K,da),Ja=(ja+ra)/2;if(ja===ra)d=void 0!==d.alpha?{hue:0,saturation:0,lightness:Ja,alpha:d.alpha}:{hue:0,saturation:0,lightness:Ja};else{var Ra=ja-ra;ra=.5<Ja?Ra/(2-ja-ra):Ra/(ja+ra);switch(ja){case k:k=(K-
da)/Ra+(K<da?6:0);break;case K:k=(da-k)/Ra+2;break;default:k=(k-K)/Ra+4}k*=60;d=void 0!==d.alpha?{hue:k,saturation:ra,lightness:Ja,alpha:d.alpha}:{hue:k,saturation:ra,lightness:Ja}}Ja=Oe;a=d.lightness-parseFloat(a);return zw(Ja({},d,{lightness:Math.max(0,Math.min(1,a))}))}function fn(a,d){var k;void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));void 0!==d.opacity&&(d.opacity=Math.min(1,Math.max(d.opacity,0)));let K=null!=(k=d.fill)?k:a.props.fill;void 0===K||Gi(K)||"var(--ls-secondary-background-color)"===
K||d.noFill||!DH.includes(a.props.type)||(a=Ui(.3,K),d.stroke=a);return d}function kt({strokeWidth:a,size:d,mode:k}){return"svg"===k?(0,Ns.jsx)("rect",{className:"tl-binding-indicator",x:a,y:a,rx:2,ry:2,width:Math.max(0,d[0]-2*a),height:Math.max(0,d[1]-2*a),strokeWidth:4*a}):(0,Ns.jsx)("div",{className:"tl-binding-indicator",style:{position:"absolute",left:0,top:0,right:0,bottom:0,boxShadow:"0 0 0 4px var(--tl-binding)",borderRadius:4}})}function $r(){const a=mg();return"panning"===a.inputs.state||
"pinching"===a.inputs.state}function Iu({left:a,middle:d,right:k,stroke:K,strokeWidth:da}){return(0,Yv.jsxs)("g",{children:[(0,Yv.jsx)("path",{className:"tl-stroke-hitarea",d:`M ${a} L ${d} ${k}`}),(0,Yv.jsx)("path",{d:`M ${a} L ${d} ${k}`,fill:"none",stroke:K,strokeWidth:da,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"})]})}function lt(a,d,k){d=P(a,d,a,k).points;if(!d)return console.warn("Could not find an intersection for the arrow head."),{left:a,right:a};d=(k=d[0])?be.rotWith(k,
a,Math.PI/6):a;a=k?be.rotWith(k,a,-Math.PI/6):a;return{left:d,right:a}}function Ju(a,d,k){const {left:K,right:da}=lt(a,d,k);return`M ${K} L ${a} ${da}`}function Aw(a,d,k,K,da){a=a.strokeWidth;var ja=be.dist(d,k);a=Math.min(ja/3,16*a);ja=[];ja.push(`M ${d} L ${k}`);K&&ja.push(Ju(d,k,a));da&&ja.push(Ju(k,d,a));return ja.join(" ")}function mt({id:a,bounds:d,labelSize:k,offset:K,scale:da=1}){return(0,nu.jsx)("defs",{children:(0,nu.jsxs)("mask",{id:a+"_clip",children:[(0,nu.jsx)("rect",{x:-100,y:-100,
width:d.width+200,height:d.height+200,fill:"white"}),(0,nu.jsx)("rect",{x:d.width/2-k[0]/2*da+((null==K?void 0:K[0])||0),y:d.height/2-k[1]/2*da+((null==K?void 0:K[1])||0),width:k[0]*da,height:k[1]*da,rx:4*da,ry:4*da,fill:"black"})]})})}function nt(a,d,k,K=da=>da){return a*K(.5-d*(.5-k))}function Bw(a){return[-a[0],-a[1]]}function gn(a,d){return[a[0]+d[0],a[1]+d[1]]}function pm(a,d){return[a[0]-d[0],a[1]-d[1]]}function hn(a,d){return[a[0]*d,a[1]*d]}function ar(a){return[a[1],-a[0]]}function Cw(a,d){return a[0]===
d[0]&&a[1]===d[1]}function Ku(a){return a[0]*a[0]+a[1]*a[1]}function Lu(a){var d=Math.hypot(a[0],a[1]);return[a[0]/d,a[1]/d]}function Dw(a,d){return Math.hypot(a[1]-d[1],a[0]-d[0])}function br(a,d,k){let K=Math.sin(k);k=Math.cos(k);let da=a[0]-d[0];a=a[1]-d[1];return[da*k-a*K+d[0],da*K+a*k+d[1]]}function ot(a,d,k){return gn(a,hn(pm(d,a),k))}function Mu(a,d,k){return gn(a,hn(d,k))}function Ew(a,d={}){let {size:k=16,smoothing:K=.5,thinning:da=.5,simulatePressure:ja=!0,easing:ra=Dd=>Dd,start:Ja={},end:Ra=
{},last:$a=!1}=d,{cap:fb=!0,easing:jb=Dd=>Dd*(2-Dd)}=Ja,{cap:Jb=!0,easing:Ob=Dd=>--Dd*Dd*Dd+1}=Ra;if(0===a.length||0>=k)return[];var Kb=a[a.length-1].runningLength;let gc=!1===Ja.taper?0:!0===Ja.taper?Math.max(k,Kb):Ja.taper,rc=!1===Ra.taper?0:!0===Ra.taper?Math.max(k,Kb):Ra.taper;var Wb=Math.pow(k*K,2);d=[];let kc=[];var hc=a.slice(0,10).reduce((Dd,jd)=>{var Cd=jd.pressure;ja&&(jd=so(1,jd.distance/k),Cd=so(1,1-jd),Cd=so(1,Dd+.275*(Cd-Dd)*jd));return(Dd+Cd)/2},a[0].pressure),Fc=nt(k,da,a[a.length-
1].pressure,ra),Lc;let ud=a[0].vector;var Jd=a[0].point;let Ee=Jd;var Sd=Jd;let De=Ee;var gf=!1;for(var Te=0;Te<a.length;Te++){var {pressure:df}=a[Te];let {point:Dd,vector:jd,distance:Cd,runningLength:Me}=a[Te];if(Te<a.length-1&&3>Kb-Me)continue;da?(ja&&(Fc=so(1,Cd/k),df=so(1,1-Fc),df=so(1,hc+.275*(df-hc)*Fc)),Fc=nt(k,da,df,ra)):Fc=k/2;void 0===Lc&&(Lc=Fc);var Gd=Me<gc?jb(Me/gc):1,od=Kb-Me<rc?Ob((Kb-Me)/rc):1;Fc=Math.max(.01,Fc*Math.min(Gd,od));od=(Te<a.length-1?a[Te+1]:a[Te]).vector;let af=Te<a.length-
1?jd[0]*od[0]+jd[1]*od[1]:1;Gd=null!==af&&0>af;if(0>jd[0]*ud[0]+jd[1]*ud[1]&&!gf||Gd){Jd=hn(ar(ud),Fc);for(let Nf=1/13,bg=0;1>=bg;bg+=Nf)Sd=br(pm(Dd,Jd),Dd,xp*bg),d.push(Sd),De=br(gn(Dd,Jd),Dd,xp*-bg),kc.push(De);Jd=Sd;Ee=De;Gd&&(gf=!0)}else(gf=!1,Te===a.length-1)?(df=hn(ar(jd),Fc),d.push(pm(Dd,df)),kc.push(gn(Dd,df))):(hc=hn(ar(ot(od,jd,af)),Fc),Sd=pm(Dd,hc),(1>=Te||Ku(pm(Jd,Sd))>Wb)&&(d.push(Sd),Jd=Sd),De=gn(Dd,hc),(1>=Te||Ku(pm(Ee,De))>Wb)&&(kc.push(De),Ee=De),hc=df,ud=jd)}Kb=a[0].point.slice(0,
2);Wb=1<a.length?a[a.length-1].point.slice(0,2):gn(a[0].point,[1,1]);Sd=[];gf=[];if(1===a.length){if(!gc&&!rc||$a){a=Mu(Kb,Lu(ar(pm(Kb,Wb))),-(Lc||Fc));d=[];for(let Dd=1/13,jd=Dd;1>=jd;jd+=Dd)d.push(br(a,Kb,2*xp*jd));return d}}else{if(!(gc||rc&&1===a.length))if(fb)for(let Dd=1/13,jd=Dd;1>=jd;jd+=Dd)Lc=br(kc[0],Kb,xp*jd),Sd.push(Lc);else Te=pm(d[0],kc[0]),Lc=hn(Te,.5),Te=hn(Te,.51),Sd.push(pm(Kb,Lc),pm(Kb,Te),gn(Kb,Te),gn(Kb,Lc));Lc=ar(Bw(a[a.length-1].vector));if(rc||gc&&1===a.length)gf.push(Wb);
else if(Jb){a=Mu(Wb,Lc,Fc);for(let Dd=1/29,jd=Dd;1>jd;jd+=Dd)gf.push(br(a,Wb,3*xp*jd))}else gf.push(gn(Wb,hn(Lc,Fc)),gn(Wb,hn(Lc,.99*Fc)),pm(Wb,hn(Lc,.99*Fc)),pm(Wb,hn(Lc,Fc)))}return d.concat(gf,kc.reverse(),Sd)}function Fw(a,d={}){var k;let {streamline:K=.5,size:da=16,last:ja=!1}=d;if(0===a.length)return[];d=.15+.85*(1-K);a=Array.isArray(a[0])?a:a.map(({x:jb,y:Jb,pressure:Ob=.5})=>[jb,Jb,Ob]);if(2===a.length){var ra=a[1];a=a.slice(0,-1);for(var Ja=1;5>Ja;Ja++)a.push(ot(a[0],ra,Ja/4))}1===a.length&&
(a=[...a,[...gn(a[0],[1,1]),...a[0].slice(2)]]);ra=[{point:[a[0][0],a[0][1]],pressure:0<=a[0][2]?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}];Ja=!1;let Ra=0,$a=ra[0],fb=a.length-1;for(let jb=1;jb<a.length;jb++){let Jb=ja&&jb===fb?a[jb].slice(0,2):ot($a.point,a[jb],d);if(Cw($a.point,Jb))continue;let Ob=Dw(Jb,$a.point);if(Ra+=Ob,jb<fb&&!Ja){if(Ra<da)continue;Ja=!0}$a={point:Jb,pressure:0<=a[jb][2]?a[jb][2]:.5,vector:Lu(pm($a.point,Jb)),distance:Ob,runningLength:Ra};ra.push($a)}return ra[0].vector=
(null==(k=ra[1])?void 0:k.vector)||[0,0],ra}function Gw(a,d=4/3){return(new nh(a)).exportAsSVG(d)}function Hw(a,d=4/3){return(new nh(a)).generatePreviewJsx(void 0,d)}function Nu({id:a,type:d,onRemove:k,showContent:K}){const da=mg(),{handlers:ja}=ky.default.useContext(ji),ra=ja.t;return(0,Yh.jsxs)("div",{className:"tl-shape-links-panel-item color-level relative",children:[(0,Yh.jsx)("div",{className:"whitespace-pre break-all overflow-hidden text-ellipsis inline-flex",children:(0,Yh.jsx)(ly,{id:a,showReferenceContent:K})}),
(0,Yh.jsx)("div",{className:"flex-1"}),ja.getBlockPageName(a)!==da.currentPage.name&&(0,Yh.jsx)(Yd,{tooltip:ra("whiteboard/open-page"),type:"button",onClick:()=>null==ja?void 0:ja.redirectToPage(a),children:(0,Yh.jsx)(Qg,{name:"open-as-page"})}),(0,Yh.jsx)(Yd,{tooltip:ra("whiteboard/open-page-in-sidebar"),type:"button",onClick:()=>null==ja?void 0:ja.sidebarAddBlock(a,"B"===d?"block":"page"),children:(0,Yh.jsx)(Qg,{name:"move-to-sidebar-right"})}),k&&(0,Yh.jsx)(Yd,{className:"tl-shape-links-panel-item-remove-button",
tooltip:ra("whiteboard/remove-link"),type:"button",onClick:k,children:(0,Yh.jsx)(Qg,{name:"x",className:"!translate-y-0"})})]})}function ha({options:a,value:d,onValueChange:k}){return(0,Bp.jsx)(XC,{className:"tl-toggle-group-input",type:"single",value:d,onValueChange:k,children:a.map(K=>(0,Bp.jsx)(ce,{content:K.tooltip,children:(0,Bp.jsx)("div",{className:"inline-block",children:(0,Bp.jsx)(YC,{className:"tl-toggle-group-input-button",value:K.value,disabled:K.value===d,children:(0,Bp.jsx)(Qg,{name:K.icon})})})},
K.value))})}function Aa({options:a,value:d,onValueChange:k}){return(0,Bp.jsx)(XC,{className:"tl-toggle-group-input",type:"multiple",value:d,onValueChange:k,children:a.map(K=>(0,Bp.jsx)(YC,{className:"tl-toggle-group-input-button",value:K.value,children:(0,Bp.jsx)(Qg,{name:K.icon})},K.value))})}function Za(a){return mg().selectedShapesArray.filter(d=>!d.props.isLocked).filter(d=>{var k;return null==(k=Iy[d.props.type])?void 0:k.includes(a)})}function Rb(a){var d;a=a.match(/\.[0-9a-z]+$/i);if(!a)return"unknown";
const k=a[0].toLowerCase();[a]=null!=(d=Object.entries(dD).find(([,K])=>K.includes(k)))?d:["unknown",null];return a}function tc(...a){return(...d)=>Oh(this,null,function*(){for(const k of a){const K=yield k(...d);if(K&&0<K.length)return K}return null})}function Kc(a,d){return Oh(this,null,function*(){return a.types.includes(d)?a instanceof DataTransfer?a.getData(d):yield(yield a.getType(d)).text():null})}function xd(){const {handlers:a}=fw.useContext(ji);return fw.useCallback((d,k)=>Oh(this,null,
function*(){if(k.shiftKey&&1===d.selectedShapesArray.length){var K=yield navigator.clipboard.read();let da;0<K.length&&(K=(yield(yield K[0].getType("text/plain")).text()).trim())&&(/^\(\(.*\)\)$/.test(K)&&40===K.length?(K=K.slice(2,-2),Dj(K)&&(da=K)):/^\[\[.*\]\]$/.test(K)&&(da=K.slice(2,-2)));if(da){d.selectedShapesArray[0].update({refs:[da]});d.persist();return}}RH(d,k,a)}),[])}function Md(){const a=xd();return Ky.useCallback((d,k)=>Oh(this,[d,k],function*(K,{dataTransfer:da,point:ja}){a(K,{point:ja,
shiftKey:!1,dataTransfer:da,fromDrop:!0})}),[])}function de(){const {handlers:a}=Ly.useContext(ji);return Ly.useCallback((d,{text:k,html:K})=>{a.copyToClipboard(k,K)},[])}function Be(){return xq.default.useCallback(a=>Oh(this,null,function*(){setTimeout(()=>{a.transition("logseq-portal").selectedTool.transition("creating")},100)}),[])}var Xe=Object.create,Ff=Object.defineProperty,dg=Object.defineProperties,lh=Object.getOwnPropertyDescriptor,Kh=Object.getOwnPropertyDescriptors,Ek=Object.getOwnPropertyNames,
jn=Object.getOwnPropertySymbols,Lm=Object.getPrototypeOf,Lh=Object.prototype.hasOwnProperty,pk=Object.prototype.propertyIsEnumerable,Kl=(a,d,k)=>d in a?Ff(a,d,{enumerable:!0,configurable:!0,writable:!0,value:k}):a[d]=k,Zd=(a,d)=>{for(var k in d||={})Lh.call(d,k)&&Kl(a,k,d[k]);if(jn)for(k of jn(d))pk.call(d,k)&&Kl(a,k,d[k]);return a},ff=(a,d)=>dg(a,Kh(d)),Jf=(a,d)=>{var k={},K;for(K in a)Lh.call(a,K)&&0>d.indexOf(K)&&(k[K]=a[K]);if(null!=a&&jn)for(K of jn(a))0>d.indexOf(K)&&pk.call(a,K)&&(k[K]=a[K]);
return k},cr=(a,d)=>function(){return d||(0,a[Ek(a)[0]])((d={exports:{}}).exports,d),d.exports},Wy=(a,d,k,K)=>{if(d&&"object"===typeof d||"function"===typeof d)for(let da of Ek(d))Lh.call(a,da)||da===k||Ff(a,da,{get:()=>d[da],enumerable:!(K=lh(d,da))||K.enumerable});return a},Kf=(a,d,k)=>(k=null!=a?Xe(Lm(a)):{},Wy(!d&&a&&a.__esModule?k:Ff(k,"default",{value:a,enumerable:!0}),a)),fe=(a,d,k,K)=>{for(var da=1<K?void 0:K?lh(d,k):d,ja=a.length-1,ra;0<=ja;ja--)if(ra=a[ja])da=(K?ra(d,k,da):ra(da))||da;K&&
da&&Ff(d,k,da);return da},gb=(a,d,k)=>{Kl(a,"symbol"!==typeof d?d+"":d,k);return k},Oh=(a,d,k)=>new Promise((K,da)=>{var ja=Ra=>{try{Ja(k.next(Ra))}catch($a){da($a)}},ra=Ra=>{try{Ja(k.throw(Ra))}catch($a){da($a)}},Ja=Ra=>Ra.done?K(Ra.value):Promise.resolve(Ra.value).then(ja,ra);Ja((k=k.apply(a,d)).next())}),zD=cr({["../../node_modules/rbush/rbush.min.js"](a,d){!function(k,K){"object"==typeof a&&"undefined"!=typeof d?d.exports=K():"function"==typeof define&&define.amd?define(K):(k=k||self).RBush=K()}(a,
function(){function k(Wb,kc,hc,Fc,Lc){!function Te(Jd,Ee,Sd,De,gf){for(;De>Sd;){if(600<De-Sd){var df=De-Sd+1,Gd=Ee-Sd+1,od=Math.log(df),Dd=.5*Math.exp(2*od/3);od=.5*Math.sqrt(od*Dd*(df-Dd)/df)*(0>Gd-df/2?-1:1);Te(Jd,Ee,Math.max(Sd,Math.floor(Ee-Gd*Dd/df+od)),Math.min(De,Math.floor(Ee+(df-Gd)*Dd/df+od)),gf)}df=Jd[Ee];Gd=Sd;Dd=De;K(Jd,Sd,Ee);for(0<gf(Jd[De],df)&&K(Jd,Sd,De);Gd<Dd;){K(Jd,Gd,Dd);Gd++;for(Dd--;0>gf(Jd[Gd],df);)Gd++;for(;0<gf(Jd[Dd],df);)Dd--}0===gf(Jd[Sd],df)?K(Jd,Sd,Dd):K(Jd,++Dd,De);
Dd<=Ee&&(Sd=Dd+1);Ee<=Dd&&(De=Dd-1)}}(Wb,kc,hc||0,Fc||Wb.length-1,Lc||da)}function K(Wb,kc,hc){var Fc=Wb[kc];Wb[kc]=Wb[hc];Wb[hc]=Fc}function da(Wb,kc){return Wb<kc?-1:Wb>kc?1:0}function ja(Wb,kc){ra(Wb,0,Wb.children.length,kc,Wb)}function ra(Wb,kc,hc,Fc,Lc){Lc||=Kb(null);Lc.minX=1/0;Lc.minY=1/0;Lc.maxX=-1/0;for(Lc.maxY=-1/0;kc<hc;kc++){var ud=Wb.children[kc];Ja(Lc,Wb.leaf?Fc(ud):ud)}return Lc}function Ja(Wb,kc){return Wb.minX=Math.min(Wb.minX,kc.minX),Wb.minY=Math.min(Wb.minY,kc.minY),Wb.maxX=Math.max(Wb.maxX,
kc.maxX),Wb.maxY=Math.max(Wb.maxY,kc.maxY),Wb}function Ra(Wb,kc){return Wb.minX-kc.minX}function $a(Wb,kc){return Wb.minY-kc.minY}function fb(Wb){return(Wb.maxX-Wb.minX)*(Wb.maxY-Wb.minY)}function jb(Wb){return Wb.maxX-Wb.minX+(Wb.maxY-Wb.minY)}function Jb(Wb,kc){return Wb.minX<=kc.minX&&Wb.minY<=kc.minY&&kc.maxX<=Wb.maxX&&kc.maxY<=Wb.maxY}function Ob(Wb,kc){return kc.minX<=Wb.maxX&&kc.minY<=Wb.maxY&&kc.maxX>=Wb.minX&&kc.maxY>=Wb.minY}function Kb(Wb){return{children:Wb,height:1,leaf:!0,minX:1/0,minY:1/
0,maxX:-1/0,maxY:-1/0}}function gc(Wb,kc,hc,Fc,Lc){for(var ud=[kc,hc];ud.length;)if(!((hc=ud.pop())-(kc=ud.pop())<=Fc)){var Jd=kc+Math.ceil((hc-kc)/Fc/2)*Fc;k(Wb,Jd,kc,hc,Lc);ud.push(kc,Jd,Jd,hc)}}var rc=function(Wb){void 0===Wb&&(Wb=9);this._maxEntries=Math.max(4,Wb);this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries));this.clear()};return rc.prototype.all=function(){return this._all(this.data,[])},rc.prototype.search=function(Wb){var kc=this.data,hc=[];if(!Ob(Wb,kc))return hc;for(var Fc=
this.toBBox,Lc=[];kc;){for(var ud=0;ud<kc.children.length;ud++){var Jd=kc.children[ud],Ee=kc.leaf?Fc(Jd):Jd;Ob(Wb,Ee)&&(kc.leaf?hc.push(Jd):Jb(Wb,Ee)?this._all(Jd,hc):Lc.push(Jd))}kc=Lc.pop()}return hc},rc.prototype.collides=function(Wb){var kc=this.data;if(!Ob(Wb,kc))return!1;for(var hc=[];kc;){for(var Fc=0;Fc<kc.children.length;Fc++){var Lc=kc.children[Fc],ud=kc.leaf?this.toBBox(Lc):Lc;if(Ob(Wb,ud)){if(kc.leaf||Jb(Wb,ud))return!0;hc.push(Lc)}}kc=hc.pop()}return!1},rc.prototype.load=function(Wb){if(!Wb||
!Wb.length)return this;if(Wb.length<this._minEntries){for(var kc=0;kc<Wb.length;kc++)this.insert(Wb[kc]);return this}Wb=this._build(Wb.slice(),0,Wb.length-1,0);this.data.children.length?this.data.height===Wb.height?this._splitRoot(this.data,Wb):(this.data.height<Wb.height&&(kc=this.data,this.data=Wb,Wb=kc),this._insert(Wb,this.data.height-Wb.height-1,!0)):this.data=Wb;return this},rc.prototype.insert=function(Wb){return Wb&&this._insert(Wb,this.data.height-1),this},rc.prototype.clear=function(){return this.data=
Kb([]),this},rc.prototype.remove=function(Wb,kc){if(!Wb)return this;for(var hc,Fc,Lc,ud=this.data,Jd=this.toBBox(Wb),Ee=[],Sd=[];ud||Ee.length;){if(ud||(ud=Ee.pop(),Fc=Ee[Ee.length-1],hc=Sd.pop(),Lc=!0),ud.leaf){a:{var De=Wb;var gf=ud.children,Te=kc;if(Te){for(var df=0;df<gf.length;df++)if(Te(De,gf[df])){De=df;break a}De=-1}else De=gf.indexOf(De)}if(-1!==De)return ud.children.splice(De,1),Ee.push(ud),this._condense(Ee),this}Lc||ud.leaf||!Jb(ud,Jd)?Fc?(hc++,ud=Fc.children[hc],Lc=!1):ud=null:(Ee.push(ud),
Sd.push(hc),hc=0,Fc=ud,ud=ud.children[0])}return this},rc.prototype.toBBox=function(Wb){return Wb},rc.prototype.compareMinX=function(Wb,kc){return Wb.minX-kc.minX},rc.prototype.compareMinY=function(Wb,kc){return Wb.minY-kc.minY},rc.prototype.toJSON=function(){return this.data},rc.prototype.fromJSON=function(Wb){return this.data=Wb,this},rc.prototype._all=function(Wb,kc){for(var hc=[];Wb;)Wb.leaf?kc.push.apply(kc,Wb.children):hc.push.apply(hc,Wb.children),Wb=hc.pop();return kc},rc.prototype._build=
function(Wb,kc,hc,Fc){var Lc,ud=hc-kc+1,Jd=this._maxEntries;if(ud<=Jd)return ja(Lc=Kb(Wb.slice(kc,hc+1)),this.toBBox),Lc;Fc||(Fc=Math.ceil(Math.log(ud)/Math.log(Jd)),Jd=Math.ceil(ud/Math.pow(Jd,Fc-1)));(Lc=Kb([])).leaf=!1;Lc.height=Fc;ud=Math.ceil(ud/Jd);Jd=ud*Math.ceil(Math.sqrt(Jd));for(gc(Wb,kc,hc,Jd,this.compareMinX);kc<=hc;kc+=Jd){var Ee=Math.min(kc+Jd-1,hc);gc(Wb,kc,Ee,ud,this.compareMinY);for(var Sd=kc;Sd<=Ee;Sd+=ud)Lc.children.push(this._build(Wb,Sd,Math.min(Sd+ud-1,Ee),Fc-1))}return ja(Lc,
this.toBBox),Lc},rc.prototype._chooseSubtree=function(Wb,kc,hc,Fc){for(;Fc.push(kc),!kc.leaf&&Fc.length-1!==hc;){for(var Lc=1/0,ud=1/0,Jd=void 0,Ee=0;Ee<kc.children.length;Ee++){var Sd=kc.children[Ee],De=fb(Sd),gf=(Te=Wb,df=Sd,(Math.max(df.maxX,Te.maxX)-Math.min(df.minX,Te.minX))*(Math.max(df.maxY,Te.maxY)-Math.min(df.minY,Te.minY))-De);gf<ud?(ud=gf,Lc=De<Lc?De:Lc,Jd=Sd):gf===ud&&De<Lc&&(Lc=De,Jd=Sd)}kc=Jd||kc.children[0]}var Te,df;return kc},rc.prototype._insert=function(Wb,kc,hc){hc=hc?Wb:this.toBBox(Wb);
var Fc=[],Lc=this._chooseSubtree(hc,this.data,kc,Fc);Lc.children.push(Wb);for(Ja(Lc,hc);0<=kc&&Fc[kc].children.length>this._maxEntries;)this._split(Fc,kc),kc--;this._adjustParentBBoxes(hc,Fc,kc)},rc.prototype._split=function(Wb,kc){var hc=Wb[kc],Fc=hc.children.length,Lc=this._minEntries;this._chooseSplitAxis(hc,Lc,Fc);Fc=this._chooseSplitIndex(hc,Lc,Fc);Fc=Kb(hc.children.splice(Fc,hc.children.length-Fc));Fc.height=hc.height;Fc.leaf=hc.leaf;ja(hc,this.toBBox);ja(Fc,this.toBBox);kc?Wb[kc-1].children.push(Fc):
this._splitRoot(hc,Fc)},rc.prototype._splitRoot=function(Wb,kc){this.data=Kb([Wb,kc]);this.data.height=Wb.height+1;this.data.leaf=!1;ja(this.data,this.toBBox)},rc.prototype._chooseSplitIndex=function(Wb,kc,hc){for(var Fc,Lc,ud,Jd,Ee,Sd,De,gf=1/0,Te=1/0,df=kc;df<=hc-kc;df++){var Gd=ra(Wb,0,df,this.toBBox),od=ra(Wb,df,hc,this.toBBox),Dd=(Lc=Gd,ud=od,Jd=void 0,Ee=void 0,Sd=void 0,De=void 0,Jd=Math.max(Lc.minX,ud.minX),Ee=Math.max(Lc.minY,ud.minY),Sd=Math.min(Lc.maxX,ud.maxX),De=Math.min(Lc.maxY,ud.maxY),
Math.max(0,Sd-Jd)*Math.max(0,De-Ee));Gd=fb(Gd)+fb(od);Dd<gf?(gf=Dd,Fc=df,Te=Gd<Te?Gd:Te):Dd===gf&&Gd<Te&&(Te=Gd,Fc=df)}return Fc||hc-kc},rc.prototype._chooseSplitAxis=function(Wb,kc,hc){var Fc=Wb.leaf?this.compareMinX:Ra,Lc=Wb.leaf?this.compareMinY:$a;this._allDistMargin(Wb,kc,hc,Fc)<this._allDistMargin(Wb,kc,hc,Lc)&&Wb.children.sort(Fc)},rc.prototype._allDistMargin=function(Wb,kc,hc,Fc){Wb.children.sort(Fc);Fc=this.toBBox;for(var Lc=ra(Wb,0,kc,Fc),ud=ra(Wb,hc-kc,hc,Fc),Jd=jb(Lc)+jb(ud),Ee=kc;Ee<
hc-kc;Ee++){var Sd=Wb.children[Ee];Ja(Lc,Wb.leaf?Fc(Sd):Sd);Jd+=jb(Lc)}for(hc=hc-kc-1;hc>=kc;hc--)Lc=Wb.children[hc],Ja(ud,Wb.leaf?Fc(Lc):Lc),Jd+=jb(ud);return Jd},rc.prototype._adjustParentBBoxes=function(Wb,kc,hc){for(;0<=hc;hc--)Ja(kc[hc],Wb)},rc.prototype._condense=function(Wb){for(var kc=Wb.length-1,hc=void 0;0<=kc;kc--)0===Wb[kc].children.length?0<kc?(hc=Wb[kc-1].children).splice(hc.indexOf(Wb[kc]),1):this.clear():ja(Wb[kc],this.toBBox)},rc})}}),AD=cr({["../../node_modules/fast-deep-equal/index.js"](a,
d){d.exports=function ja(K,da){if(K===da)return!0;if(K&&da&&"object"==typeof K&&"object"==typeof da){if(K.constructor!==da.constructor)return!1;var ra;if(Array.isArray(K)){var Ja=K.length;if(Ja!=da.length)return!1;for(ra=Ja;0!==ra--;)if(!ja(K[ra],da[ra]))return!1;return!0}if(K.constructor===RegExp)return K.source===da.source&&K.flags===da.flags;if(K.valueOf!==Object.prototype.valueOf)return K.valueOf()===da.valueOf();if(K.toString!==Object.prototype.toString)return K.toString()===da.toString();var Ra=
Object.keys(K);Ja=Ra.length;if(Ja!==Object.keys(da).length)return!1;for(ra=Ja;0!==ra--;)if(!Object.prototype.hasOwnProperty.call(da,Ra[ra]))return!1;for(ra=Ja;0!==ra--;)if(Ja=Ra[ra],!ja(K[Ja],da[Ja]))return!1;return!0}return K!==K&&da!==da}}}),BD=cr({["../../../node_modules/deepmerge/dist/cjs.js"](a,d){function k(jb,Jb){return!1!==Jb.clone&&Jb.isMergeableObject(jb)?Ra(Array.isArray(jb)?[]:{},jb,Jb):jb}function K(jb,Jb,Ob){return jb.concat(Jb).map(function(Kb){return k(Kb,Ob)})}function da(jb){return Object.getOwnPropertySymbols?
Object.getOwnPropertySymbols(jb).filter(function(Jb){return Object.propertyIsEnumerable.call(jb,Jb)}):[]}function ja(jb){return Object.keys(jb).concat(da(jb))}function ra(jb,Jb){try{return Jb in jb}catch(Ob){return!1}}function Ja(jb,Jb,Ob){var Kb={};Ob.isMergeableObject(jb)&&ja(jb).forEach(function(gc){Kb[gc]=k(jb[gc],Ob)});ja(Jb).forEach(function(gc){if(!ra(jb,gc)||Object.hasOwnProperty.call(jb,gc)&&Object.propertyIsEnumerable.call(jb,gc))if(ra(jb,gc)&&Ob.isMergeableObject(Jb[gc])){if(Ob.customMerge){var rc=
Ob.customMerge(gc);rc="function"===typeof rc?rc:Ra}else rc=Ra;Kb[gc]=rc(jb[gc],Jb[gc],Ob)}else Kb[gc]=k(Jb[gc],Ob)});return Kb}function Ra(jb,Jb,Ob){Ob=Ob||{};Ob.arrayMerge=Ob.arrayMerge||K;Ob.isMergeableObject=Ob.isMergeableObject||$a;Ob.cloneUnlessOtherwiseSpecified=k;var Kb=Array.isArray(Jb),gc=Array.isArray(jb);return Kb!==gc?k(Jb,Ob):Kb?Ob.arrayMerge(jb,Jb,Ob):Ja(jb,Jb,Ob)}var $a=function(jb){var Jb;if(Jb=!!jb&&"object"===typeof jb)Jb=Object.prototype.toString.call(jb),Jb=!("[object RegExp]"===
Jb||"[object Date]"===Jb||jb.$$typeof===fb);return Jb},fb="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;Ra.all=function(jb,Jb){if(!Array.isArray(jb))throw Error("first argument should be an array");return jb.reduce(function(Ob,Kb){return Ra(Ob,Kb,Jb)},{})};d.exports=Ra}}),CD=cr({["../../node_modules/tslib/tslib.js"](a,d){var k,K,da,ja,ra,Ja,Ra,$a,fb,jb,Jb,Ob,Kb,gc,rc,Wb,kc,hc,Fc,Lc,ud,Jd,Ee,Sd,De;(function(gf){function Te(Gd,od){Gd!==df&&("function"===typeof Object.create?
Object.defineProperty(Gd,"__esModule",{value:!0}):Gd.__esModule=!0);return function(Dd,jd){return Gd[Dd]=od?od(Dd,jd):jd}}var df="object"===typeof ya?ya:"object"===typeof self?self:"object"===typeof this?this:{};"function"===typeof define&&define.amd?define("tslib",["exports"],function(Gd){gf(Te(df,Te(Gd)))}):"object"===typeof d&&"object"===typeof d.exports?gf(Te(df,Te(d.exports))):gf(Te(df))})(function(gf){var Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Gd,od){Gd.__proto__=
od}||function(Gd,od){for(var Dd in od)Object.prototype.hasOwnProperty.call(od,Dd)&&(Gd[Dd]=od[Dd])};k=function(Gd,od){function Dd(){this.constructor=Gd}if("function"!==typeof od&&null!==od)throw new TypeError("Class extends value "+String(od)+" is not a constructor or null");Te(Gd,od);Gd.prototype=null===od?Object.create(od):(Dd.prototype=od.prototype,new Dd)};K=Object.assign||function(Gd){for(var od,Dd=1,jd=arguments.length;Dd<jd;Dd++){od=arguments[Dd];for(var Cd in od)Object.prototype.hasOwnProperty.call(od,
Cd)&&(Gd[Cd]=od[Cd])}return Gd};da=function(Gd,od){var Dd={},jd;for(jd in Gd)Object.prototype.hasOwnProperty.call(Gd,jd)&&0>od.indexOf(jd)&&(Dd[jd]=Gd[jd]);if(null!=Gd&&"function"===typeof Object.getOwnPropertySymbols){var Cd=0;for(jd=Object.getOwnPropertySymbols(Gd);Cd<jd.length;Cd++)0>od.indexOf(jd[Cd])&&Object.prototype.propertyIsEnumerable.call(Gd,jd[Cd])&&(Dd[jd[Cd]]=Gd[jd[Cd]])}return Dd};ja=function(Gd,od,Dd,jd){var Cd=arguments.length,Me=3>Cd?od:null===jd?jd=Object.getOwnPropertyDescriptor(od,
Dd):jd,af;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)Me=Reflect.decorate(Gd,od,Dd,jd);else for(var Nf=Gd.length-1;0<=Nf;Nf--)if(af=Gd[Nf])Me=(3>Cd?af(Me):3<Cd?af(od,Dd,Me):af(od,Dd))||Me;return 3<Cd&&Me&&Object.defineProperty(od,Dd,Me),Me};ra=function(Gd,od){return function(Dd,jd){od(Dd,jd,Gd)}};Ja=function(Gd,od){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(Gd,od)};Ra=function(Gd,od,Dd,jd){function Cd(Me){return Me instanceof Dd?
Me:new Dd(function(af){af(Me)})}return new (Dd||=Promise)(function(Me,af){function Nf(Eg){try{ef(jd.next(Eg))}catch(yf){af(yf)}}function bg(Eg){try{ef(jd["throw"](Eg))}catch(yf){af(yf)}}function ef(Eg){Eg.done?Me(Eg.value):Cd(Eg.value).then(Nf,bg)}ef((jd=jd.apply(Gd,od||[])).next())})};$a=function(Gd,od){function Dd(ef){return function(Eg){return jd([ef,Eg])}}function jd(ef){if(Me)throw new TypeError("Generator is already executing.");for(;Cd;)try{if(Me=1,af&&(Nf=ef[0]&2?af["return"]:ef[0]?af["throw"]||
((Nf=af["return"])&&Nf.call(af),0):af.next)&&!(Nf=Nf.call(af,ef[1])).done)return Nf;if(af=0,Nf)ef=[ef[0]&2,Nf.value];switch(ef[0]){case 0:case 1:Nf=ef;break;case 4:return Cd.label++,{value:ef[1],done:!1};case 5:Cd.label++;af=ef[1];ef=[0];continue;case 7:ef=Cd.ops.pop();Cd.trys.pop();continue;default:if(!(Nf=Cd.trys,Nf=0<Nf.length&&Nf[Nf.length-1])&&(6===ef[0]||2===ef[0])){Cd=0;continue}if(3===ef[0]&&(!Nf||ef[1]>Nf[0]&&ef[1]<Nf[3]))Cd.label=ef[1];else if(6===ef[0]&&Cd.label<Nf[1])Cd.label=Nf[1],Nf=
ef;else if(Nf&&Cd.label<Nf[2])Cd.label=Nf[2],Cd.ops.push(ef);else{Nf[2]&&Cd.ops.pop();Cd.trys.pop();continue}}ef=od.call(Gd,Cd)}catch(Eg){ef=[6,Eg],af=0}finally{Me=Nf=0}if(ef[0]&5)throw ef[1];return{value:ef[0]?ef[1]:void 0,done:!0}}var Cd={label:0,sent:function(){if(Nf[0]&1)throw Nf[1];return Nf[1]},trys:[],ops:[]},Me,af,Nf,bg;return bg={next:Dd(0),"throw":Dd(1),"return":Dd(2)},"function"===typeof Symbol&&(bg[Symbol.iterator]=function(){return this}),bg};fb=function(Gd,od){for(var Dd in Gd)"default"===
Dd||Object.prototype.hasOwnProperty.call(od,Dd)||De(od,Gd,Dd)};De=Object.create?function(Gd,od,Dd,jd){void 0===jd&&(jd=Dd);var Cd=Object.getOwnPropertyDescriptor(od,Dd);if(!Cd||("get"in Cd?!od.__esModule:Cd.writable||Cd.configurable))Cd={enumerable:!0,get:function(){return od[Dd]}};Object.defineProperty(Gd,jd,Cd)}:function(Gd,od,Dd,jd){void 0===jd&&(jd=Dd);Gd[jd]=od[Dd]};jb=function(Gd){var od="function"===typeof Symbol&&Symbol.iterator,Dd=od&&Gd[od],jd=0;if(Dd)return Dd.call(Gd);if(Gd&&"number"===
typeof Gd.length)return{next:function(){Gd&&jd>=Gd.length&&(Gd=void 0);return{value:Gd&&Gd[jd++],done:!Gd}}};throw new TypeError(od?"Object is not iterable.":"Symbol.iterator is not defined.");};Jb=function(Gd,od){var Dd="function"===typeof Symbol&&Gd[Symbol.iterator];if(!Dd)return Gd;Gd=Dd.call(Gd);var jd,Cd=[];try{for(;(void 0===od||0<od--)&&!(jd=Gd.next()).done;)Cd.push(jd.value)}catch(af){var Me={error:af}}finally{try{jd&&!jd.done&&(Dd=Gd["return"])&&Dd.call(Gd)}finally{if(Me)throw Me.error;}}return Cd};
Ob=function(){for(var Gd=[],od=0;od<arguments.length;od++)Gd=Gd.concat(Jb(arguments[od]));return Gd};Kb=function(){for(var Gd=0,od=0,Dd=arguments.length;od<Dd;od++)Gd+=arguments[od].length;Gd=Array(Gd);var jd=0;for(od=0;od<Dd;od++)for(var Cd=arguments[od],Me=0,af=Cd.length;Me<af;Me++,jd++)Gd[jd]=Cd[Me];return Gd};gc=function(Gd,od,Dd){if(Dd||2===arguments.length)for(var jd=0,Cd=od.length,Me;jd<Cd;jd++)!Me&&jd in od||(Me||=Array.prototype.slice.call(od,0,jd),Me[jd]=od[jd]);return Gd.concat(Me||Array.prototype.slice.call(od))};
rc=function(Gd){return this instanceof rc?(this.v=Gd,this):new rc(Gd)};Wb=function(Gd,od,Dd){function jd(yf){bg[yf]&&(ef[yf]=function(Fg){return new Promise(function(Gg,Bi){1<Eg.push([yf,Fg,Gg,Bi])||Cd(yf,Fg)})})}function Cd(yf,Fg){try{var Gg=bg[yf](Fg);Gg.value instanceof rc?Promise.resolve(Gg.value.v).then(Me,af):Nf(Eg[0][2],Gg)}catch(Bi){Nf(Eg[0][3],Bi)}}function Me(yf){Cd("next",yf)}function af(yf){Cd("throw",yf)}function Nf(yf,Fg){(yf(Fg),Eg.shift(),Eg.length)&&Cd(Eg[0][0],Eg[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");
var bg=Dd.apply(Gd,od||[]),ef,Eg=[];return ef={},jd("next"),jd("throw"),jd("return"),ef[Symbol.asyncIterator]=function(){return this},ef};kc=function(Gd){function od(Cd,Me){Dd[Cd]=Gd[Cd]?function(af){return(jd=!jd)?{value:rc(Gd[Cd](af)),done:"return"===Cd}:Me?Me(af):af}:Me}var Dd,jd;return Dd={},od("next"),od("throw",function(Cd){throw Cd;}),od("return"),Dd[Symbol.iterator]=function(){return this},Dd};hc=function(Gd){function od(Me){Cd[Me]=Gd[Me]&&function(af){return new Promise(function(Nf,bg){af=
Gd[Me](af);Dd(Nf,bg,af.done,af.value)})}}function Dd(Me,af,Nf,bg){Promise.resolve(bg).then(function(ef){Me({value:ef,done:Nf})},af)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var jd=Gd[Symbol.asyncIterator],Cd;return jd?jd.call(Gd):(Gd="function"===typeof jb?jb(Gd):Gd[Symbol.iterator](),Cd={},od("next"),od("throw"),od("return"),Cd[Symbol.asyncIterator]=function(){return this},Cd)};Fc=function(Gd,od){Object.defineProperty?Object.defineProperty(Gd,"raw",{value:od}):
Gd.raw=od;return Gd};var df=Object.create?function(Gd,od){Object.defineProperty(Gd,"default",{enumerable:!0,value:od})}:function(Gd,od){Gd["default"]=od};Lc=function(Gd){if(Gd&&Gd.__esModule)return Gd;var od={};if(null!=Gd)for(var Dd in Gd)"default"!==Dd&&Object.prototype.hasOwnProperty.call(Gd,Dd)&&De(od,Gd,Dd);df(od,Gd);return od};ud=function(Gd){return Gd&&Gd.__esModule?Gd:{"default":Gd}};Jd=function(Gd,od,Dd,jd){if("a"===Dd&&!jd)throw new TypeError("Private accessor was defined without a getter");
if("function"===typeof od?Gd!==od||!jd:!od.has(Gd))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Dd?jd:"a"===Dd?jd.call(Gd):jd?jd.value:od.get(Gd)};Ee=function(Gd,od,Dd,jd,Cd){if("m"===jd)throw new TypeError("Private method is not writable");if("a"===jd&&!Cd)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof od?Gd!==od||!Cd:!od.has(Gd))throw new TypeError("Cannot write private member to an object whose class did not declare it");
return"a"===jd?Cd.call(Gd,Dd):Cd?Cd.value=Dd:od.set(Gd,Dd),Dd};Sd=function(Gd,od){if(null===od||"object"!==typeof od&&"function"!==typeof od)throw new TypeError("Cannot use 'in' operator on non-object");return"function"===typeof Gd?od===Gd:Gd.has(od)};gf("__extends",k);gf("__assign",K);gf("__rest",da);gf("__decorate",ja);gf("__param",ra);gf("__metadata",Ja);gf("__awaiter",Ra);gf("__generator",$a);gf("__exportStar",fb);gf("__createBinding",De);gf("__values",jb);gf("__read",Jb);gf("__spread",Ob);gf("__spreadArrays",
Kb);gf("__spreadArray",gc);gf("__await",rc);gf("__asyncGenerator",Wb);gf("__asyncDelegator",kc);gf("__asyncValues",hc);gf("__makeTemplateObject",Fc);gf("__importStar",Lc);gf("__importDefault",ud);gf("__classPrivateFieldGet",Jd);gf("__classPrivateFieldSet",Ee);gf("__classPrivateFieldIn",Sd)})}}),Xy={};((a,d)=>{for(var k in d)Ff(a,k,{get:d[k],enumerable:!0})})(Xy,{App:()=>Cp,PreviewManager:()=>nh,generateJSXFromModel:()=>Hw,generateSVGFromModel:()=>Gw});Sa.exports=(a=>Wy(Ff({},"__esModule",{value:!0}),
a))(Xy);var Iw=(a=>{a.Yellow="yellow";a.Red="red";a.Pink="pink";a.Green="green";a.Blue="blue";a.Purple="purple";a.Gray="gray";a.Default="";return a})(Iw||{}),as=(a=>{a.Box="box";a.Ellipse="ellipse";a.Polygon="polygon";return a})(as||{}),Ou,DD=new Uint8Array(16),ED=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ll=[];for(let a=0;256>a;++a)Ll.push((a+256).toString(16).slice(1));var Yy,Jw,Kw=0,Lw=0,qk=function(a,d,k){k=d&&k||0;const K=
d||Array(16);a=a||{};let da=a.node||Yy;var ja=void 0!==a.clockseq?a.clockseq:Jw;if(null==da||null==ja){var ra=a.random||(a.rng||w)();null==da&&(da=Yy=[ra[0]|1,ra[1],ra[2],ra[3],ra[4],ra[5]]);null==ja&&(ja=Jw=(ra[6]<<8|ra[7])&16383)}ra=void 0!==a.msecs?a.msecs:Date.now();let Ja=void 0!==a.nsecs?a.nsecs:Lw+1;const Ra=ra-Kw+(Ja-Lw)/1E4;0>Ra&&void 0===a.clockseq&&(ja=ja+1&16383);(0>Ra||ra>Kw)&&void 0===a.nsecs&&(Ja=0);if(1E4<=Ja)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");Kw=ra;Lw=
Ja;Jw=ja;ra+=122192928E5;a=(1E4*(ra&268435455)+Ja)%4294967296;K[k++]=a>>>24&255;K[k++]=a>>>16&255;K[k++]=a>>>8&255;K[k++]=a&255;a=ra/4294967296*1E4&268435455;K[k++]=a>>>8&255;K[k++]=a&255;K[k++]=a>>>24&15|16;K[k++]=a>>>16&255;K[k++]=ja>>>8|128;K[k++]=ja&255;for(ja=0;6>ja;++ja)K[k+ja]=da[ja];return d||Y(K)},mh=class{static clamp(a,d,k){return Math.max(d,"undefined"!==typeof k?Math.min(a,k):a)}static clampV(a,d,k){return a.map(K=>k?mh.clamp(K,d,k):mh.clamp(K,d))}static cross(a,d,k){return(d[0]-a[0])*
(k[1]-a[1])-(k[0]-a[0])*(d[1]-a[1])}static snap(a,d=1){return[Math.round(a[0]/d)*d,Math.round(a[1]/d)*d]}},yd=mh;yd.neg=a=>[-a[0],-a[1]];yd.add=(a,d)=>[a[0]+d[0],a[1]+d[1]];yd.addScalar=(a,d)=>[a[0]+d,a[1]+d];yd.sub=(a,d)=>[a[0]-d[0],a[1]-d[1]];yd.subScalar=(a,d)=>[a[0]-d,a[1]-d];yd.vec=(a,d)=>[d[0]-a[0],d[1]-a[1]];yd.mul=(a,d)=>[a[0]*d,a[1]*d];yd.mulV=(a,d)=>[a[0]*d[0],a[1]*d[1]];yd.div=(a,d)=>[a[0]/d,a[1]/d];yd.divV=(a,d)=>[a[0]/d[0],a[1]/d[1]];yd.per=a=>[a[1],-a[0]];yd.dpr=(a,d)=>a[0]*d[0]+a[1]*
d[1];yd.cpr=(a,d)=>a[0]*d[1]-d[0]*a[1];yd.len2=a=>a[0]*a[0]+a[1]*a[1];yd.len=a=>Math.hypot(a[0],a[1]);yd.pry=(a,d)=>mh.dpr(a,d)/mh.len(d);yd.uni=a=>mh.div(a,mh.len(a));yd.normalize=a=>mh.uni(a);yd.tangent=(a,d)=>mh.uni(mh.sub(a,d));yd.dist2=(a,d)=>mh.len2(mh.sub(a,d));yd.dist=(a,d)=>Math.hypot(a[1]-d[1],a[0]-d[0]);yd.fastDist=(a,d)=>{a=[d[0]-a[0],d[1]-a[1]];d=[Math.abs(a[0]),Math.abs(a[1])];let k=1/Math.max(d[0],d[1]);k*=1.29289-(d[0]+d[1])*k*.29289;return[a[0]*k,a[1]*k]};yd.ang=(a,d)=>Math.atan2(mh.cpr(a,
d),mh.dpr(a,d));yd.angle=(a,d)=>Math.atan2(d[1]-a[1],d[0]-a[0]);yd.med=(a,d)=>mh.mul(mh.add(a,d),.5);yd.rot=(a,d=0)=>[a[0]*Math.cos(d)-a[1]*Math.sin(d),a[0]*Math.sin(d)+a[1]*Math.cos(d)];yd.rotWith=(a,d,k=0)=>{if(0===k)return a;const K=Math.sin(k);k=Math.cos(k);const da=a[0]-d[0];a=a[1]-d[1];return[da*k-a*K+d[0],da*K+a*k+d[1]]};yd.isEqual=(a,d)=>a[0]===d[0]&&a[1]===d[1];yd.lrp=(a,d,k)=>mh.add(a,mh.mul(mh.sub(d,a),k));yd.int=(a,d,k,K,da=1)=>{k=(mh.clamp(k,K)-k)/(K-k);return mh.add(mh.mul(a,1-k),mh.mul(d,
da))};yd.ang3=(a,d,k)=>{a=mh.vec(d,a);d=mh.vec(d,k);return mh.ang(a,d)};yd.abs=a=>[Math.abs(a[0]),Math.abs(a[1])];yd.rescale=(a,d)=>{const k=mh.len(a);return[d*a[0]/k,d*a[1]/k]};yd.isLeft=(a,d,k)=>(d[0]-a[0])*(k[1]-a[1])-(k[0]-a[0])*(d[1]-a[1]);yd.clockwise=(a,d,k)=>0<mh.isLeft(a,d,k);yd.toFixed=a=>a.map(d=>Math.round(100*d)/100);yd.nearestPointOnLineThroughPoint=(a,d,k)=>mh.add(a,mh.mul(d,mh.pry(mh.sub(k,a),d)));yd.distanceToLineThroughPoint=(a,d,k)=>mh.dist(k,mh.nearestPointOnLineThroughPoint(a,
d,k));yd.nearestPointOnLineSegment=(a,d,k,K=!0)=>{const da=mh.uni(mh.sub(d,a));k=mh.add(a,mh.mul(da,mh.pry(mh.sub(k,a),da)));if(K){if(k[0]<Math.min(a[0],d[0]))return a[0]<d[0]?a:d;if(k[0]>Math.max(a[0],d[0]))return a[0]>d[0]?a:d;if(k[1]<Math.min(a[1],d[1]))return a[1]<d[1]?a:d;if(k[1]>Math.max(a[1],d[1]))return a[1]>d[1]?a:d}return k};yd.distanceToLineSegment=(a,d,k,K=!0)=>mh.dist(k,mh.nearestPointOnLineSegment(a,d,k,K));yd.nudge=(a,d,k)=>mh.isEqual(a,d)?a:mh.add(a,mh.mul(mh.uni(mh.sub(d,a)),k));
yd.nudgeAtAngle=(a,d,k)=>[Math.cos(d)*k+a[0],Math.sin(d)*k+a[1]];yd.toPrecision=(a,d=4)=>[+a[0].toPrecision(d),+a[1].toPrecision(d)];yd.pointsBetween=(a,d,k=6)=>Array.from(Array(k)).map((K,da)=>{K=da/(k-1);da=Math.min(1,.5+Math.abs(.5-K));return[...mh.lrp(a,d,K),da]});yd.slope=(a,d)=>a[0]===d[0]?NaN:(a[1]-d[1])/(a[0]-d[0]);yd.toAngle=a=>{a=Math.atan2(a[1],a[0]);return 0>a?a+2*Math.PI:a};yd.max=(...a)=>[Math.max(...a.map(d=>d[0])),Math.max(...a.map(d=>d[1]))];yd.min=(...a)=>[Math.min(...a.map(d=>d[0])),
Math.min(...a.map(d=>d[1]))];var be=yd,sf=class{static getRectangleSides(a,d,k=0){const K=[a[0]+d[0]/2,a[1]+d[1]/2],da=yd.rotWith(a,K,k),ja=yd.rotWith(yd.add(a,[d[0],0]),K,k),ra=yd.rotWith(yd.add(a,d),K,k);a=yd.rotWith(yd.add(a,[0,d[1]]),K,k);return[["top",[da,ja]],["right",[ja,ra]],["bottom",[ra,a]],["left",[a,da]]]}static getBoundsSides(a){return sf.getRectangleSides([a.minX,a.minY],[a.width,a.height])}static expandBounds(a,d){return{minX:a.minX-d,minY:a.minY-d,maxX:a.maxX+d,maxY:a.maxY+d,width:a.width+
2*d,height:a.height+2*d}}static boundsCollide(a,d){return!(a.maxX<d.minX||a.minX>d.maxX||a.maxY<d.minY||a.minY>d.maxY)}static boundsContain(a,d){return Array.isArray(d)?a.minX<d[0]&&a.minY<d[1]&&a.maxY>d[1]&&a.maxX>d[0]:a.minX<d.minX&&a.minY<d.minY&&a.maxY>d.maxY&&a.maxX>d.maxX}static boundsContained(a,d){return sf.boundsContain(d,a)}static boundsAreEqual(a,d){return!(d.maxX!==a.maxX||d.minX!==a.minX||d.maxY!==a.maxY||d.minY!==a.minY)}static getBoundsFromPoints(a,d=0){let k=Infinity,K=Infinity,da=
-Infinity,ja=-Infinity;if(2>a.length)K=k=0,ja=da=1;else for(const ra of a)k=Math.min(ra[0],k),K=Math.min(ra[1],K),da=Math.max(ra[0],da),ja=Math.max(ra[1],ja);return 0!==d?sf.getBoundsFromPoints(a.map(ra=>yd.rotWith(ra,[(k+da)/2,(K+ja)/2],d))):{minX:k,minY:K,maxX:da,maxY:ja,width:Math.max(1,da-k),height:Math.max(1,ja-K)}}static centerBounds(a,d){const k=sf.getBoundsCenter(a);return sf.translateBounds(a,[d[0]-k[0],d[1]-k[1]])}static snapBoundsToGrid(a,d){const k=Math.round(a.minX/d)*d,K=Math.round(a.minY/
d)*d,da=Math.round(a.maxX/d)*d;a=Math.round(a.maxY/d)*d;return{minX:k,minY:K,maxX:da,maxY:a,width:Math.max(1,da-k),height:Math.max(1,a-K)}}static translateBounds(a,d){return{minX:a.minX+d[0],minY:a.minY+d[1],maxX:a.maxX+d[0],maxY:a.maxY+d[1],width:a.width,height:a.height}}static multiplyBounds(a,d){const k=sf.getBoundsCenter(a);return sf.centerBounds({minX:a.minX*d,minY:a.minY*d,maxX:a.maxX*d,maxY:a.maxY*d,width:a.width*d,height:a.height*d},[k[0]*d,k[1]*d])}static divideBounds(a,d){const k=sf.getBoundsCenter(a);
return sf.centerBounds({minX:a.minX/d,minY:a.minY/d,maxX:a.maxX/d,maxY:a.maxY/d,width:a.width/d,height:a.height/d},[k[0]/d,k[1]/d])}static getRotatedBounds(a,d=0){a=sf.getRotatedCorners(a,d);let k=d=Infinity,K=-Infinity,da=-Infinity;for(const ja of a)d=Math.min(ja[0],d),k=Math.min(ja[1],k),K=Math.max(ja[0],K),da=Math.max(ja[1],da);return{minX:d,minY:k,maxX:K,maxY:da,width:Math.max(1,K-d),height:Math.max(1,da-k),rotation:0}}static getRotatedEllipseBounds(a,d,k,K,da=0){var ja=Math.cos(da);const ra=
Math.sin(da);da=Math.hypot(k*ja,K*ra);ja=Math.hypot(k*ra,K*ja);return{minX:a+k-da,minY:d+K-ja,maxX:a+k+da,maxY:d+K+ja,width:2*da,height:2*ja}}static getExpandedBounds(a,d){const k=Math.min(a.minX,d.minX),K=Math.min(a.minY,d.minY),da=Math.max(a.maxX,d.maxX);a=Math.max(a.maxY,d.maxY);return{minX:k,minY:K,maxX:da,maxY:a,width:Math.abs(da-k),height:Math.abs(a-K)}}static getCommonBounds(a){if(2>a.length)return a[0];let d=a[0];for(let k=1;k<a.length;k++)d=sf.getExpandedBounds(d,a[k]);return d}static getRotatedCorners(a,
d=0){const k=[a.minX+a.width/2,a.minY+a.height/2];a=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];return d?a.map(K=>yd.rotWith(K,k,d)):a}static getTransformedBoundingBox(a,d,k,K=0,da=!1){const [ja,ra]=[a.minX,a.minY],[Ja,Ra]=[a.maxX,a.maxY];let [$a,fb]=[a.minX,a.minY],[jb,Jb]=[a.maxX,a.maxY];if("center"===d)return{minX:$a+k[0],minY:fb+k[1],maxX:jb+k[0],maxY:Jb+k[1],width:jb-$a,height:Jb-fb,scaleX:1,scaleY:1};const [Ob,Kb]=yd.rot(k,-K);switch(d){case "top_edge":case "top_left_corner":case "top_right_corner":fb+=
Kb;break;case "bottom_edge":case "bottom_left_corner":case "bottom_right_corner":Jb+=Kb}switch(d){case "left_edge":case "top_left_corner":case "bottom_left_corner":$a+=Ob;break;case "right_edge":case "top_right_corner":case "bottom_right_corner":jb+=Ob}var gc=Ja-ja;const rc=Ra-ra;var Wb=(jb-$a)/gc,kc=(Jb-fb)/rc;a=0>Wb;k=0>kc;var hc=Math.abs(jb-$a),Fc=Math.abs(Jb-fb);if(da)switch(da=gc/rc,gc=da<hc/Fc,kc=1/da*(0>kc?1:-1)*hc,Wb=Fc*(0>Wb?1:-1)*da,d){case "top_left_corner":gc?fb=Jb+kc:$a=jb+Wb;break;case "top_right_corner":gc?
fb=Jb+kc:jb=$a-Wb;break;case "bottom_right_corner":gc?Jb=fb-kc:jb=$a-Wb;break;case "bottom_left_corner":gc?Jb=fb-kc:$a=jb+Wb;break;case "bottom_edge":case "top_edge":hc=($a+jb)/2;Fc*=da;$a=hc-Fc/2;jb=hc+Fc/2;break;case "left_edge":case "right_edge":Fc=(fb+Jb)/2,hc/=da,fb=Fc-hc/2,Jb=Fc+hc/2}if(0!==K%(2*Math.PI)){hc=[0,0];Fc=yd.med([ja,ra],[Ja,Ra]);Wb=yd.med([$a,fb],[jb,Jb]);switch(d){case "top_left_corner":hc=yd.sub(yd.rotWith([jb,Jb],Wb,K),yd.rotWith([Ja,Ra],Fc,K));break;case "top_right_corner":hc=
yd.sub(yd.rotWith([$a,Jb],Wb,K),yd.rotWith([ja,Ra],Fc,K));break;case "bottom_right_corner":hc=yd.sub(yd.rotWith([$a,fb],Wb,K),yd.rotWith([ja,ra],Fc,K));break;case "bottom_left_corner":hc=yd.sub(yd.rotWith([jb,fb],Wb,K),yd.rotWith([Ja,ra],Fc,K));break;case "top_edge":hc=yd.sub(yd.rotWith(yd.med([$a,Jb],[jb,Jb]),Wb,K),yd.rotWith(yd.med([ja,Ra],[Ja,Ra]),Fc,K));break;case "left_edge":hc=yd.sub(yd.rotWith(yd.med([jb,fb],[jb,Jb]),Wb,K),yd.rotWith(yd.med([Ja,ra],[Ja,Ra]),Fc,K));break;case "bottom_edge":hc=
yd.sub(yd.rotWith(yd.med([$a,fb],[jb,fb]),Wb,K),yd.rotWith(yd.med([ja,ra],[Ja,ra]),Fc,K));break;case "right_edge":hc=yd.sub(yd.rotWith(yd.med([$a,fb],[$a,Jb]),Wb,K),yd.rotWith(yd.med([ja,ra],[ja,Ra]),Fc,K))}[$a,fb]=yd.sub([$a,fb],hc);[jb,Jb]=yd.sub([jb,Jb],hc)}jb<$a&&([jb,$a]=[$a,jb]);Jb<fb&&([Jb,fb]=[fb,Jb]);return{minX:$a,minY:fb,maxX:jb,maxY:Jb,width:jb-$a,height:Jb-fb,scaleX:(jb-$a)/(Ja-ja||1)*(a?-1:1),scaleY:(Jb-fb)/(Ra-ra||1)*(k?-1:1)}}static getTransformAnchor(a,d,k){let K=a;switch(a){case "top_left_corner":K=
d&&k?"bottom_right_corner":d?"top_right_corner":k?"bottom_left_corner":"bottom_right_corner";break;case "top_right_corner":K=d&&k?"bottom_left_corner":d?"top_left_corner":k?"bottom_right_corner":"bottom_left_corner";break;case "bottom_right_corner":K=d&&k?"top_left_corner":d?"bottom_left_corner":k?"top_right_corner":"top_left_corner";break;case "bottom_left_corner":K=d&&k?"top_right_corner":d?"bottom_right_corner":k?"top_left_corner":"top_right_corner"}return K}static getRelativeTransformedBoundingBox(a,
d,k,K,da){K=a.minX+(K?d.maxX-k.maxX:k.minX-d.minX)/d.width*a.width;da=a.minY+(da?d.maxY-k.maxY:k.minY-d.minY)/d.height*a.height;const ja=k.width/d.width*a.width;a=k.height/d.height*a.height;return{minX:K,minY:da,maxX:K+ja,maxY:da+a,width:ja,height:a}}static getRotatedSize(a,d){const k=yd.div(a,2);a=[[0,0],[a[0],0],a,[0,a[1]]].map(K=>yd.rotWith(K,k,d));a=sf.getBoundsFromPoints(a);return[a.width,a.height]}static getBoundsCenter(a){return[a.minX+a.width/2,a.minY+a.height/2]}static getBoundsWithCenter(a){const d=
sf.getBoundsCenter(a);return ff(Zd({},a),{midX:d[0],midY:d[1]})}static getCommonTopLeft(a){const d=[Infinity,Infinity];a.forEach(k=>{d[0]=Math.min(d[0],k[0]);d[1]=Math.min(d[1],k[1])});return d}static getTLSnapPoints(a,d,k){const K=Zd({},a);a=[0,0];const da=[],ja={minX:{id:"minX",isSnapped:!1},midX:{id:"midX",isSnapped:!1},maxX:{id:"maxX",isSnapped:!1},minY:{id:"minY",isSnapped:!1},midY:{id:"midY",isSnapped:!1},maxY:{id:"maxY",isSnapped:!1}},ra=["midX","minX","maxX"],Ja=["midY","minY","maxY"];d=d.map(Jb=>
{const Ob=ra.flatMap((gc,rc)=>ra.map((Wb,kc)=>{const hc=K[gc]-Jb[Wb];return{f:gc,t:Wb,gap:hc,distance:Math.abs(hc),isCareful:0===rc||3===rc+kc}})),Kb=Ja.flatMap((gc,rc)=>Ja.map((Wb,kc)=>{const hc=K[gc]-Jb[Wb];return{f:gc,t:Wb,gap:hc,distance:Math.abs(hc),isCareful:0===rc||3===rc+kc}}));return[Jb,Ob,Kb]});let Ra=Infinity,$a=Infinity,fb=Infinity,jb=Infinity;d.forEach(([,Jb,Ob])=>{Jb.forEach(Kb=>{Kb.distance<k&&Kb.distance<fb&&(fb=Kb.distance,Ra=Kb.gap)});Ob.forEach(Kb=>{Kb.distance<k&&Kb.distance<jb&&
(jb=Kb.distance,$a=Kb.gap)})});d.forEach(([Jb,Ob,Kb])=>{Infinity!==Ra&&Ob.forEach(gc=>{2>Math.abs(gc.gap-Ra)&&(ja[gc.f]=ff(Zd({},ja[gc.f]),{isSnapped:!0,to:Jb[gc.t],B:Jb,distance:gc.distance}))});Infinity!==$a&&Kb.forEach(gc=>{2>Math.abs(gc.gap-$a)&&(ja[gc.f]=ff(Zd({},ja[gc.f]),{isSnapped:!0,to:Jb[gc.t],B:Jb,distance:gc.distance}))})});a[0]=Infinity===Ra?0:Ra;a[1]=Infinity===$a?0:$a;K.minX-=a[0];K.midX-=a[0];K.maxX-=a[0];K.minY-=a[1];K.midY-=a[1];K.maxY-=a[1];ra.forEach(Jb=>{Jb=ja[Jb];if(Jb.isSnapped){var {id:Ob,
B:Kb}=Jb;Jb=K[Ob];da.push("minX"===Ob?[[Jb,K.midY],[Jb,Kb.minY],[Jb,Kb.maxY]]:[[Jb,K.minY],[Jb,K.maxY],[Jb,Kb.minY],[Jb,Kb.maxY]])}});Ja.forEach(Jb=>{Jb=ja[Jb];if(Jb.isSnapped){var {id:Ob,B:Kb}=Jb;Jb=K[Ob];da.push("midY"===Ob?[[K.midX,Jb],[Kb.minX,Jb],[Kb.maxX,Jb]]:[[K.minX,Jb],[K.maxX,Jb],[Kb.minX,Jb],[Kb.maxX,Jb]])}});return{offset:a,snapLines:da}}static ensureRatio(a,d){const {width:k,height:K}=a,da=Zd({},a);k/K<d?(da.width=K*d,da.maxX+=k-a.width):(da.height=k/d,da.maxY+=K-a.height);return da}static getDistributions(a,
d){var k=a.map(ja=>{const ra=ja.getBounds();return{id:ja.id,point:[ra.minX,ra.minY],bounds:ra,center:ja.getCenter()}});a=k.length;var K=sf.getCommonBounds(k.map(({bounds:ja})=>ja));const da=[];switch(d){case "horizontal":d=k.reduce((ja,ra)=>ja+ra.bounds.width,0);if(d>K.width){const ja=k.sort(($a,fb)=>$a.bounds.minX-fb.bounds.minX)[0],ra=k.sort(($a,fb)=>fb.bounds.maxX-$a.bounds.maxX)[0];K=k.filter($a=>$a!==ja&&$a!==ra).sort(($a,fb)=>$a.center[0]-fb.center[0]);const Ja=(ra.center[0]-ja.center[0])/(a-
1),Ra=ja.center[0]+Ja;K.forEach(({id:$a,point:fb,bounds:jb},Jb)=>{da.push({id:$a,prev:fb,next:[Ra+Ja*Jb-jb.width/2,jb.minY]})})}else{k=k.sort((Ja,Ra)=>Ja.center[0]-Ra.center[0]);let ja=K.minX;const ra=(K.width-d)/(a-1);k.forEach(({id:Ja,point:Ra,bounds:$a})=>{da.push({id:Ja,prev:Ra,next:[ja,$a.minY]});ja+=$a.width+ra})}break;case "vertical":if(d=k.reduce((ja,ra)=>ja+ra.bounds.height,0),d>K.height){const ja=k.sort(($a,fb)=>$a.bounds.minY-fb.bounds.minY)[0],ra=k.sort(($a,fb)=>fb.bounds.maxY-$a.bounds.maxY)[0];
K=k.filter($a=>$a!==ja&&$a!==ra).sort(($a,fb)=>$a.center[1]-fb.center[1]);const Ja=(ra.center[1]-ja.center[1])/(a-1),Ra=ja.center[1]+Ja;K.forEach(({id:$a,point:fb,bounds:jb},Jb)=>{da.push({id:$a,prev:fb,next:[jb.minX,Ra+Ja*Jb-jb.height/2]})})}else{k=k.sort((Ja,Ra)=>Ja.center[1]-Ra.center[1]);let ja=K.minY;const ra=(K.height-d)/(a-1);k.forEach(({id:Ja,point:Ra,bounds:$a})=>{da.push({id:Ja,prev:Ra,next:[$a.minX,ja]});ja+=$a.height+ra})}}return da}static getPackedDistributions(a){const d=sf.getCommonBounds(a.map(({bounds:da})=>
da)),k=[d.minX,d.minY],K=Object.fromEntries(a.map(da=>[da.id,[da.bounds.minX,da.bounds.minY]]));a=a.filter(da=>{var ja,ra,Ja,Ra;return!((null==(ra=null==(ja=da.props.handles)?void 0:ja.start)?0:ra.bindingId)||(null==(Ra=null==(Ja=da.props.handles)?void 0:Ja.end)?0:Ra.bindingId))}).map(da=>{const ja=da.getBounds();return{id:da.id,w:ja.width+16,h:ja.height+16,x:ja.minX,y:ja.minY}});y(a);return a.map(({id:da,x:ja,y:ra})=>({id:da,prev:K[da],next:[ja+k[0],ra+k[1]]}))}},dr=class{static pointInCircle(a,
d,k){return yd.dist(a,d)<=k}static pointInEllipse(a,d,k,K,da=0){da=da||0;var ja=Math.cos(da);da=Math.sin(da);d=yd.sub(a,d);a=ja*d[0]+da*d[1];ja=da*d[0]-ja*d[1];return 1>=a*a/(k*k)+ja*ja/(K*K)}static pointInRect(a,d){return!(a[0]<d[0]||a[0]>a[0]+d[0]||a[1]<d[1]||a[1]>a[1]+d[1])}static pointInPolygon(a,d){let k=0;d.forEach((K,da)=>{da=d[(da+1)%d.length];K[1]<=a[1]?da[1]>a[1]&&0<yd.cross(K,da,a)&&(k+=1):da[1]<=a[1]&&0>yd.cross(K,da,a)&&--k});return 0!==k}static pointInBounds(a,d){return!(a[0]<d.minX||
a[0]>d.maxX||a[1]<d.minY||a[1]>d.maxY)}static pointInPolyline(a,d,k=3){for(let K=1;K<d.length;K++)if(yd.distanceToLineSegment(d[K-1],d[K],a)<k)return!0;return!1}static _getSqSegDist(a,d,k){let K=d[0];d=d[1];let da=k[0]-K,ja=k[1]-d;if(0!==da||0!==ja){const ra=((a[0]-K)*da+(a[1]-d)*ja)/(da*da+ja*ja);1<ra?(K=k[0],d=k[1]):0<ra&&(K+=da*ra,d+=ja*ra)}da=a[0]-K;ja=a[1]-d;return da*da+ja*ja}static _simplifyStep(a,d,k,K,da){let ja=K,ra=-1;for(let Ja=d+1;Ja<k;Ja++){const Ra=dr._getSqSegDist(a[Ja],a[d],a[k]);
Ra>ja&&(ra=Ja,ja=Ra)}-1<ra&&ja>K&&(1<ra-d&&dr._simplifyStep(a,d,ra,K,da),da.push(a[ra]),1<k-ra&&dr._simplifyStep(a,ra,k,K,da))}static simplify2(a,d=1){if(2>=a.length)return a;d*=d;var k=a[0],K=a[1];const da=[k];for(let ja=1,ra=a.length;ja<ra;ja++)K=a[ja],(K[0]-k[0])*(K[0]-k[0])+(K[1]-k[1])*(K[1]-k[1])>d&&(da.push(K),k=K);k!==K&&da.push(K);k=da.length-1;K=[da[0]];dr._simplifyStep(da,0,k,d,K);K.push(da[k],a[a.length-1]);return K}static pointNearToPolyline(a,d,k=8){const K=d.length;for(let da=1;da<K;da++)if(yd.distanceToLineSegment(d[da-
1],d[da],a)<k)return!0;return!1}},Fk=dr;gb(Fk,"simplify",(a,d=1)=>{var k=a.length;const K=a[0],da=a[k-1],[ja,ra]=K,[Ja,Ra]=da;if(2<k){let $a=0,fb=0;const jb=yd.len2([Ra-ra,Ja-ja]);for(let Jb=1;Jb<k-1;Jb++){const [Ob,Kb]=a[Jb],gc=Math.pow(Ob*(Ra-ra)+ja*(Kb-Ra)+Ja*(ra-Kb),2)/jb;$a>gc||($a=gc,fb=Jb)}if($a>d)return k=dr.simplify(a.slice(0,fb+1),d),a=dr.simplify(a.slice(fb+1),d),k.concat(a.slice(1))}return[K,da]});var Ln=Math.PI,Mo=Ln/2,el=2*Ln,Pu={},Qu={bottom_edge:"ns-resize",top_edge:"ns-resize",left_edge:"ew-resize",
right_edge:"ew-resize",bottom_left_corner:"nesw-resize",bottom_right_corner:"nwse-resize",top_left_corner:"nwse-resize",top_right_corner:"nesw-resize",bottom_left_resize_corner:"swne-rotate",bottom_right_resize_corner:"senw-rotate",top_left_resize_corner:"nwse-rotate",top_right_resize_corner:"nesw-rotate",rotate:"rotate",center:"grab",background:"grab"},Ml=class{static circleFromThreePoints(a,d,k){const [K,da]=a,[ja,ra]=d,[Ja,Ra]=k;d=K*(ra-Ra)-da*(ja-Ja)+ja*Ra-Ja*ra;a=-((K*K+da*da)*(Ra-ra)+(ja*ja+
ra*ra)*(da-Ra)+(Ja*Ja+Ra*Ra)*(ra-da))/(2*d);d=-((K*K+da*da)*(ja-Ja)+(ja*ja+ra*ra)*(Ja-K)+(Ja*Ja+Ra*Ra)*(K-ja))/(2*d);return[a,d,Math.hypot(a-K,d-da)]}static perimeterOfEllipse(a,d){const k=Math.pow(a-d,2)/Math.pow(a+d,2);return Ln*(a+d)*(1+3*k/(10+Math.sqrt(4-3*k)))}static shortAngleDist(a,d){a=(d-a)%el;return 2*a%el-a}static longAngleDist(a,d){return el-Ml.shortAngleDist(a,d)}static lerpAngles(a,d,k){return a+Ml.shortAngleDist(a,d)*k}static angleDelta(a,d){return Ml.shortAngleDist(a,d)}static getSweep(a,
d,k){return Ml.angleDelta(be.angle(a,d),be.angle(a,k))}static clampRadians(a){return(el+a)%el}static snapAngleToSegments(a,d){d=el/d;a=Math.floor((Ml.clampRadians(a)+d/2)/d)*d%el;a<Ln&&(a+=el);a>Ln&&(a-=el);return a}static isAngleBetween(a,d,k){if(k===a||k===d)return!0;d=(d-a+Mo)%Mo;return d<=Ln!==(k-a+Mo)%Mo>d}static degreesToRadians(a){return a*Ln/180}static radiansToDegrees(a){return 180*a/Ln}static getArcLength(a,d,k,K){a=Ml.getSweep(a,k,K);return a/el*el*d}static getSweepFlag(a,d,k){k=be.angle(a,
k);return 0<(be.angle(a,d)-k+3*Ln)%el-Ln?0:1}static getLargeArcFlag(a,d,k){a=be.angle(k,a);d=(be.angle(k,d)-a+3*Ln)%el-Ln;return Math.abs(d)>Mo?0:1}static getArcDashOffset(a,d,k,K,da){const ja=Ml.getSweepFlag(a,k,K);d=Ml.getArcLength(a,d,k,K);return-(0>ja?d:el*a[2]-d)/2+da}static getEllipseDashOffset(a,d){return-(el*a[2])/2+-d}static radiansToCardinalDirection(a){return a<.25*Math.PI?"north":a<.75*Math.PI?"east":a<1.25*Math.PI?"south":a<1.75*Math.PI?"west":"north"}},Rk=class{static getPolygonCentroid(a){var d=
a.map(k=>k[0]);a=a.map(k=>k[1]);d=Math.min(...d)+Math.max(...d);a=Math.min(...a)+Math.max(...a);return[d?d/2:0,a?a/2:0]}};gb(Rk,"getEdges",a=>{const d=a.length;return a.map((k,K)=>[k,a[(K+1)%d]])});gb(Rk,"getEdgeOutwardNormal",(a,d)=>be.per(be.uni(be.sub(d,a))));gb(Rk,"getEdgeInwardNormal",(a,d)=>be.neg(Rk.getEdgeOutwardNormal(a,d)));gb(Rk,"getOffsetEdge",(a,d,k)=>{k=be.mul(be.per(be.uni(be.sub(d,a))),k);return[be.add(a,k),be.add(d,k)]});gb(Rk,"getOffsetEdges",(a,d)=>a.map(([k,K])=>Rk.getOffsetEdge(k,
K,d)));gb(Rk,"getOffsetPolygon",(a,d)=>{if(1>a.length)throw Error("Expected at least one point.");if(1===a.length)return a=a[0],[be.add(a,[-d,-d]),be.add(a,[d,-d]),be.add(a,[d,d]),be.add(a,[-d,d])];if(2===a.length){const [k,K]=a;return[...Rk.getOffsetEdge(k,K,d),...Rk.getOffsetEdge(K,k,d)]}return Rk.getOffsetEdges(Rk.getEdges(a),d).flatMap((k,K,da)=>{{K=da[(K+1)%da.length];const ja=yd.slope(k[0],k[1]);da=yd.slope(K[0],K[1]);ja!==da?Number.isNaN(ja)&&!Number.isNaN(da)?k=[k[0][0],(k[0][0]-K[0][0])*
da+K[0][1]]:Number.isNaN(da)&&!Number.isNaN(ja)?k=[K[0][0],(K[0][0]-k[0][0])*ja+k[0][1]]:(k=(ja*k[0][0]-da*K[0][0]+K[0][1]-k[0][1])/(ja-da),k=[k,da*(k-K[0][0])+K[0][1]]):k=void 0}if(void 0===k)throw Error("Expected an intersection");return k})});gb(Rk,"getPolygonVertices",(a,d,k=0,K=1)=>{a=be.div(a,2);const [da,ja]=[Math.max(1,a[0]-k),Math.max(1,a[1]-k)];k=[];for(let $a=0,fb=el/d;$a<d;$a++){var ra=(-Mo+$a*fb)%el,Ja=(-Mo+($a+1)*fb)%el;ra=be.add(a,[da*Math.cos(ra),ja*Math.sin(ra)]);Ja=be.add(a,[da*
Math.cos(Ja),ja*Math.sin(Ja)]);var Ra=be.med(ra,Ja);Ra=be.nudge(Ra,a,be.dist(a,Ra)*(1-K));k.push(ra,Ra,Ja)}return k});gb(Rk,"getTriangleVertices",(a,d=0,k=1)=>{const [K,da]=a;var ja=1-k;a=[K/2,d/2];k=[K-d,da-d];d=[d/2,da-d];const ra=Rk.getPolygonCentroid([a,k,d]),Ja=be.med(a,k),Ra=be.med(k,d),$a=be.med(d,a),fb=be.dist(Ja,ra)*ja,jb=be.dist(Ra,ra)*ja;ja*=be.dist($a,ra);return[a,fb?be.nudge(Ja,ra,fb):Ja,k,jb?be.nudge(Ra,ra,jb):Ra,d,ja?be.nudge($a,ra,ja):$a]});gb(Rk,"getStarVertices",(a,d,k,K=1)=>{const da=
be.div(d,2),ja=be.mul(da,K/2),ra=el/k/2;return Array.from(Array(2*k)).map((Ja,Ra)=>{Ja=-Mo+Ra*ra;const [$a,fb]=Ra%2?ja:da;return be.add(a,[$a*Math.cos(Ja),fb*Math.sin(Ja)])})});var Mw=class{static getCurvedPathForPolygon(a){if(3>a.length)return"M -4, 0\n      a 4,4 0 1,0 8,0\n      a 4,4 0 1,0 -8,0";const d=["M",...a[0].slice(0,2),"Q"],k=a.length;for(let K=1;K<k;K++){const [da,ja]=a[K],[ra,Ja]=a[(K+1)%k];d.push(da,ja,(da+ra)/2,(ja+Ja)/2)}d.push("Z");return d.join(" ")}static getCurvedPathForPoints(a){if(3>
a.length)return"M -4, 0\n      a 4,4 0 1,0 8,0\n      a 4,4 0 1,0 -8,0";const d=["M",...a[0].slice(0,2),"Q"],k=a.length;for(let K=1;K<k-1;K++){const [da,ja]=a[K],[ra,Ja]=a[K+1];d.push(da,ja,(da+ra)/2,(ja+Ja)/2)}return d.join(" ")}static getSvgPathFromStroke(a,d=!0){const k=a.length;if(4>k)return"";let K=a[0],da=a[1];var ja=a[2];ja=`M${K[0].toFixed(2)},${K[1].toFixed(2)} Q${da[0].toFixed(2)},${da[1].toFixed(2)} ${((da[0]+ja[0])/2).toFixed(2)},${((da[1]+ja[1])/2).toFixed(2)} T`;for(let ra=2,Ja=k-1;ra<
Ja;ra++)K=a[ra],da=a[ra+1],ja+=`${((K[0]+da[0])/2).toFixed(2)},${((K[1]+da[1])/2).toFixed(2)} `;d&&(ja+="Z");return ja}static getSvgPathFromStrokePoints(a,d=!1){const k=a.length;if(4>k)return"";let K=a[0].point,da=a[1].point;var ja=a[2].point;ja=`M${K[0].toFixed(2)},${K[1].toFixed(2)} Q${da[0].toFixed(2)},${da[1].toFixed(2)} ${((da[0]+ja[0])/2).toFixed(2)},${((da[1]+ja[1])/2).toFixed(2)} T`;for(let ra=2,Ja=k-1;ra<Ja;ra++)K=a[ra].point,da=a[ra+1].point,ja+=`${((K[0]+da[0])/2).toFixed(2)},${((K[1]+
da[1])/2).toFixed(2)} `;d&&(ja+="Z");return ja}};gb(Mw,"TRIM_NUMBERS",/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g);var FD={},GD=Object.assign,Ru=Object.getOwnPropertyDescriptor,jp=Object.defineProperty,pt=Object.prototype,Nw=[];Object.freeze(Nw);var Ow={};Object.freeze(Ow);var HD="undefined"!==typeof Proxy,ID=Object.toString(),bs=function(){},Zy="undefined"!==typeof Object.getOwnPropertySymbols,Su="undefined"!==typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Zy?function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:
Object.getOwnPropertyNames,JD=Object.getOwnPropertyDescriptors||function(a){var d={};Su(a).forEach(function(k){d[k]=Ru(a,k)});return d},ko=Symbol("mobx-stored-annotations"),ih=Symbol("mobx administration"),qt=function(){function a(k){void 0===k&&(k="Atom");this.name_=void 0;this.isBeingObserved_=this.isPendingUnobservation_=!1;this.observers_=new Set;this.lastAccessedBy_=this.diffValue_=0;this.lowestObserverState_=Ti.NOT_TRACKING_;this.onBUOL=this.onBOL=void 0;this.name_=k}var d=a.prototype;d.onBO=
function(){this.onBOL&&this.onBOL.forEach(function(k){return k()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(k){return k()})};d.reportObserved=function(){return lb(this)};d.reportChanged=function(){Sc();Db(this);Ib()};d.toString=function(){return this.name_};return a}(),Pw=F("Atom",qt),cs={identity:function(a,d){return a===d},structural:function(a,d){return sa(a,d)},"default":function(a,d){return Object.is?Object.is(a,d):a===d?0!==a||1/a===1/d:a!==a&&d!==d},shallow:function(a,
d){return sa(a,d,1)}},KD="override",LD=Wa(),rt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(rt);var $y=ib("observable"),MD=ib("observable.ref",{enhancer:Ka}),ND=ib("observable.shallow",{enhancer:function(a,d,k){if(void 0===a||null===a||ve(a)||rd(a)||Vp(a)||gr(a))return a;if(Array.isArray(a))return yg.array(a,{name:k,deep:!1});if(L(a))return yg.object(a,void 0,{name:k,deep:!1});if(O(a))return yg.map(a,{name:k,deep:!1});if(M(a))return yg.set(a,{name:k,deep:!1})}}),OD=ib("observable.struct",
{enhancer:function(a,d){return sa(a,d)?d:a}}),az=xa($y);Object.assign(bb,az);var PD={box:function(a,d){d=d||rt;return new er(a,Qa(d),d.name,!0,d.equals)},array:function(a,d){d=d||rt;return(!1===Af.useProxies||!1===d.proxy?Ab:kb)(a,Qa(d),d.name)},map:function(a,d){d=d||rt;return new kz(a,Qa(d),d.name)},set:function(a,d){d=d||rt;return new lz(a,Qa(d),d.name)},object:function(a,d,k){if(!1===Af.useProxies||!1===(null==k?void 0:k.proxy))k=Hd({},k);else{var K={},da,ja;B();K=Hd(K,k);k=null!=(ja=(da=K[ih]).proxy_)?
ja:da.proxy_=new Proxy(K,dE)}return je(k,a,d)},ref:xa(MD),shallow:xa(ND),deep:az,struct:xa(OD)},yg=GD(bb,PD),bz=Va("computed"),QD=Va("computed.struct",{equals:cs.structural}),Dg=function(a,d){if(H(d))return Ga(a,d,bz);if(L(a))return xa(Va("computed",a));d=L(d)?d:{};d.get=a;d.name||(d.name=a.name||"");return new st(d)};Object.assign(Dg,bz);Dg.struct=xa(QD);var cz,dz,Tu=0,RD=1,SD=null!=(cz=null==(dz=Ru(function(){},"name"))?void 0:dz.configurable)?cz:!1,ez={value:"action",configurable:!0,writable:!1,
enumerable:!1};var TD=Symbol.toPrimitive;var er=function(a){function d(K,da,ja,ra,Ja){void 0===ja&&(ja="ObservableValue");void 0===Ja&&(Ja=cs["default"]);ra=a.call(this,ja)||this;ra.enhancer=void 0;ra.hasUnreportedChange_=!1;ra.interceptors_=void 0;ra.changeListeners_=void 0;ra.value_=void 0;ra.dehancer=void 0;ra.enhancer=da;ra.name_=ja;ra.equals=Ja;ra.value_=da(K,void 0,ja);return ra}fa(d,a);var k=d.prototype;k.dehanceValue=function(K){return void 0!==this.dehancer?this.dehancer(K):K};k.set=function(K){K=
this.prepareNewValue_(K);K!==Af.UNCHANGED&&this.setNewValue_(K)};k.prepareNewValue_=function(K){if(ub(this)){K=Eb(this,{object:this,type:No,newValue:K});if(!K)return Af.UNCHANGED;K=K.newValue}K=this.enhancer(K,this.value_,this.name_);return this.equals(this.value_,K)?Af.UNCHANGED:K};k.setNewValue_=function(K){var da=this.value_;this.value_=K;this.reportChanged();hd(this)&&Td(this,{type:No,object:this,newValue:K,oldValue:da})};k.get=function(){this.reportObserved();return this.dehanceValue(this.value_)};
k.intercept_=function(K){return Bb(this,K)};k.observe_=function(K,da){da&&K({observableKind:"value",debugObjectName:this.name_,object:this,type:No,newValue:this.value_,oldValue:void 0});return Ud(this,K)};k.raw=function(){return this.value_};k.toJSON=function(){return this.get()};k.toString=function(){return this.name_+"["+this.value_+"]"};k.valueOf=function(){return ia(this.get())};k[TD]=function(){return this.valueOf()};return d}(qt),UD=F("ObservableValue",er);var VD=Symbol.toPrimitive;var st=function(){function a(k){this.dependenciesState_=
Ti.NOT_TRACKING_;this.observing_=[];this.newObserving_=null;this.isPendingUnobservation_=this.isBeingObserved_=!1;this.observers_=new Set;this.lastAccessedBy_=this.runId_=this.diffValue_=0;this.lowestObserverState_=Ti.UP_TO_DATE_;this.unboundDepsCount_=0;this.value_=new fr(null);this.triggeredBy_=this.name_=void 0;this.isRunningSetter_=this.isComputing_=!1;this.setter_=this.derivation=void 0;this.isTracing_=ds.NONE;this.onBUOL=this.onBOL=this.keepAlive_=this.requiresReaction_=this.equals_=this.scope_=
void 0;k.get||f(31);this.derivation=k.get;this.name_=k.name||"ComputedValue";k.set&&(this.setter_=Pa("ComputedValue-setter",k.set));this.equals_=k.equals||(k.compareStructural||k.struct?cs.structural:cs["default"]);this.scope_=k.context;this.requiresReaction_=k.requiresReaction;this.keepAlive_=!!k.keepAlive}var d=a.prototype;d.onBecomeStale_=function(){db(this)};d.onBO=function(){this.onBOL&&this.onBOL.forEach(function(k){return k()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(k){return k()})};
d.get=function(){this.isComputing_&&f(32,this.name_,this.derivation);if(0!==Af.inBatch||0!==this.observers_.size||this.keepAlive_){if(lb(this),oc(this)){var k=Af.trackingContext;this.keepAlive_&&!k&&(Af.trackingContext=this);this.trackAndCompute()&&Gb(this);Af.trackingContext=k}}else oc(this)&&(this.warnAboutUntrackedRead_(),Sc(),this.value_=this.computeValue_(!1),Ib());k=this.value_;if(k instanceof fr)throw k.cause;return k};d.set=function(k){if(this.setter_){this.isRunningSetter_&&f(33,this.name_);
this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,k)}finally{this.isRunningSetter_=!1}}else f(34,this.name_)};d.trackAndCompute=function(){var k=this.value_,K=this.dependenciesState_===Ti.NOT_TRACKING_,da=this.computeValue_(!0);if(k=K||k instanceof fr||da instanceof fr||!this.equals_(k,da))this.value_=da;return k};d.computeValue_=function(k){this.isComputing_=!0;var K=xc(!1);if(k)var da=pc(this,this.derivation,this.scope_);else if(!0===Af.disableErrorBoundaries)da=this.derivation.call(this.scope_);
else try{da=this.derivation.call(this.scope_)}catch(ja){da=new fr(ja)}Af.allowStateChanges=K;this.isComputing_=!1;return da};d.suspend_=function(){this.keepAlive_||(Cc(this),this.value_=void 0)};d.observe_=function(k,K){var da=this,ja=!0,ra=void 0;return ic(function(){var Ja=da.get();if(!ja||K){var Ra=dc();k({observableKind:"computed",debugObjectName:da.name_,type:No,object:da,newValue:Ja,oldValue:ra});Af.trackingDerivation=Ra}ja=!1;ra=Ja})};d.warnAboutUntrackedRead_=function(){};d.toString=function(){return this.name_+
"["+this.derivation.toString()+"]"};d.valueOf=function(){return ia(this.get())};d[VD]=function(){return this.valueOf()};return a}(),tt=F("ComputedValue",st),Ti;(function(a){a[a.NOT_TRACKING_=-1]="NOT_TRACKING_";a[a.UP_TO_DATE_=0]="UP_TO_DATE_";a[a.POSSIBLY_STALE_=1]="POSSIBLY_STALE_";a[a.STALE_=2]="STALE_"})(Ti||={});var ds;(function(a){a[a.NONE=0]="NONE";a[a.LOG=1]="LOG";a[a.BREAK=2]="BREAK"})(ds||={});var fr=function(a){this.cause=void 0;this.cause=a},Uu=function(){this.version=6;this.UNCHANGED=
{};this.trackingContext=this.trackingDerivation=null;this.inBatch=this.mobxGuid=this.runId=0;this.pendingUnobservations=[];this.pendingReactions=[];this.allowStateChanges=this.isRunningReactions=!1;this.enforceActions=this.allowStateReads=!0;this.spyListeners=[];this.globalReactionErrorHandlers=[];this.suppressReactionErrors=this.disableErrorBoundaries=this.observableRequiresReaction=this.reactionRequiresObservable=this.computedRequiresReaction=!1;this.useProxies=!0;this.verifyProxies=!1;this.safeDescriptors=
!0},Vu=!0,fz=!1,Af=function(){var a=E();0<a.__mobxInstanceCount&&!a.__mobxGlobals&&(Vu=!1);a.__mobxGlobals&&a.__mobxGlobals.version!==(new Uu).version&&(Vu=!1);if(Vu){if(a.__mobxGlobals)return a.__mobxInstanceCount+=1,a.__mobxGlobals.UNCHANGED||(a.__mobxGlobals.UNCHANGED={}),a.__mobxGlobals;a.__mobxInstanceCount=1;return a.__mobxGlobals=new Uu}setTimeout(function(){fz||f(35)},1);return new Uu}(),es=function(){function a(k,K,da,ja){void 0===k&&(k="Reaction");this.requiresObservable_=this.errorHandler_=
this.onInvalidate_=this.name_=void 0;this.observing_=[];this.newObserving_=[];this.dependenciesState_=Ti.NOT_TRACKING_;this.unboundDepsCount_=this.runId_=this.diffValue_=0;this.isRunning_=this.isTrackPending_=this.isScheduled_=this.isDisposed_=!1;this.isTracing_=ds.NONE;this.name_=k;this.onInvalidate_=K;this.errorHandler_=da;this.requiresObservable_=ja}var d=a.prototype;d.onBecomeStale_=function(){this.schedule_()};d.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Af.pendingReactions.push(this),
0<Af.inBatch||Af.isRunningReactions||Wu(rb))};d.isScheduled=function(){return this.isScheduled_};d.runReaction_=function(){if(!this.isDisposed_){Sc();this.isScheduled_=!1;var k=Af.trackingContext;Af.trackingContext=this;if(oc(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(K){this.reportExceptionInDerivation_(K)}}Af.trackingContext=k;Ib()}};d.track=function(k){if(!this.isDisposed_){Sc();this.isRunning_=!0;var K=Af.trackingContext;Af.trackingContext=this;k=pc(this,k,void 0);Af.trackingContext=
K;this.isTrackPending_=this.isRunning_=!1;this.isDisposed_&&Cc(this);k instanceof fr&&this.reportExceptionInDerivation_(k.cause);Ib()}};d.reportExceptionInDerivation_=function(k){var K=this;if(this.errorHandler_)this.errorHandler_(k,this);else{if(Af.disableErrorBoundaries)throw k;Af.suppressReactionErrors||console.error("[mobx] uncaught error in '"+this+"'",k);Af.globalReactionErrorHandlers.forEach(function(da){return da(k,K)})}};d.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||
(Sc(),Cc(this),Ib()))};d.getDisposer_=function(){var k=this.dispose.bind(this);k[ih]=this;return k};d.toString=function(){return"Reaction["+this.name_+"]"};d.trace=function(k){void 0===k&&(k=!1);Zc(this,k)};return a}(),WD=100,Wu=function(a){return a()},Xu=F("Reaction",es),gz="action",hz=Ba(gz),XD=Ba("action.bound",{bound:!0}),iz=Ba("autoAction",{autoAction:!0}),YD=Ba("autoAction.bound",{autoAction:!0,bound:!0}),jg=Bc(!1);Object.assign(jg,hz);var ut=Bc(!0);Object.assign(ut,iz);jg.bound=xa(XD);ut.bound=
xa(YD);var ZD=function(a){return a()},$D="onBO",aE="onBUO",bE=0;qe.prototype=Object.create(Error.prototype);var jz=na("flow"),cE=na("flow.bound",{bound:!0}),vt=Object.assign(function(a,d){if(H(d))return Ga(a,d,jz);var k=a.name||"\x3cunnamed flow\x3e";d=function(){var K=arguments,da=++bE,ja=jg(k+" - runid: "+da+" - init",a).apply(this,K),ra,Ja=void 0;K=new Promise(function(Ra,$a){function fb(Kb){Ja=void 0;try{var gc=jg(k+" - runid: "+da+" - yield "+Ob++,ja.next).call(ja,Kb)}catch(rc){return $a(rc)}Jb(gc)}
function jb(Kb){Ja=void 0;try{var gc=jg(k+" - runid: "+da+" - yield "+Ob++,ja["throw"]).call(ja,Kb)}catch(rc){return $a(rc)}Jb(gc)}function Jb(Kb){if(V(null==Kb?void 0:Kb.then))Kb.then(Jb,$a);else{if(Kb.done)return Ra(Kb.value);Ja=Promise.resolve(Kb.value);return Ja.then(fb,jb)}}var Ob=0;ra=$a;fb(void 0)});K.cancel=jg(k+" - runid: "+da+" - cancel",function(){try{if(Ja){var Ra=Ja;V(Ra.cancel)&&Ra.cancel()}var $a=ja["return"](void 0),fb=Promise.resolve($a.value);fb.then(bs,bs);V(fb.cancel)&&fb.cancel();
ra(new qe)}catch(jb){ra(jb)}});return K};d.isMobXFlow=!0;return d},jz);vt.bound=xa(cE);var dE={has:function(a,d){return a[ih].has_(d)},get:function(a,d){return a[ih].get_(d)},set:function(a,d,k){var K;return H(d)?null!=(K=a[ih].set_(d,k,!0))?K:!0:!1},deleteProperty:function(a,d){var k;return H(d)?null!=(k=a[ih].delete_(d,!0))?k:!0:!1},defineProperty:function(a,d,k){var K;return null!=(K=a[ih].defineProperty_(d,k))?K:!0},ownKeys:function(a){return a[ih].ownKeys_()},preventExtensions:function(a){f(13)}},
No="update",eE={get:function(a,d){var k=a[ih];return d===ih?k:"length"===d?k.getArrayLength_():"string"!==typeof d||isNaN(d)?U(Yu,d)?Yu[d]:a[d]:k.get_(parseInt(d))},set:function(a,d,k){var K=a[ih];"length"===d&&K.setArrayLength_(k);"symbol"===typeof d||isNaN(d)?a[d]=k:K.set_(parseInt(d),k);return!0},preventExtensions:function(){f(15)}},Qw=function(){function a(k,K,da,ja){void 0===k&&(k="ObservableArray");this.atom_=this.legacyMode_=this.owned_=void 0;this.values_=[];this.proxy_=this.dehancer=this.enhancer_=
this.changeListeners_=this.interceptors_=void 0;this.lastKnownLength_=0;this.owned_=da;this.legacyMode_=ja;this.atom_=new qt(k);this.enhancer_=function(ra,Ja){return K(ra,Ja,"ObservableArray[..]")}}var d=a.prototype;d.dehanceValue_=function(k){return void 0!==this.dehancer?this.dehancer(k):k};d.dehanceValues_=function(k){return void 0!==this.dehancer&&0<k.length?k.map(this.dehancer):k};d.intercept_=function(k){return Bb(this,k)};d.observe_=function(k,K){void 0===K&&(K=!1);K&&k({observableKind:"array",
object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0});return Ud(this,k)};d.getArrayLength_=function(){this.atom_.reportObserved();return this.values_.length};d.setArrayLength_=function(k){("number"!==typeof k||isNaN(k)||0>k)&&f("Out of range: "+k);var K=this.values_.length;if(k!==K)if(k>K){for(var da=Array(k-K),ja=0;ja<k-K;ja++)da[ja]=void 0;this.spliceWithArray_(K,0,da)}else this.spliceWithArray_(k,
K-k)};d.updateArrayLength_=function(k,K){k!==this.lastKnownLength_&&f(16);this.lastKnownLength_+=K;this.legacyMode_&&0<K&&$d(k+K+1)};d.spliceWithArray_=function(k,K,da){var ja=this,ra=this.values_.length;void 0===k?k=0:k>ra?k=ra:0>k&&(k=Math.max(0,ra+k));K=1===arguments.length?ra-k:void 0===K||null===K?0:Math.max(0,Math.min(K,ra-k));void 0===da&&(da=Nw);if(ub(this)){var Ja=Eb(this,{object:this.proxy_,type:"splice",index:k,removedCount:K,added:da});if(!Ja)return Nw;K=Ja.removedCount;da=Ja.added}da=
0===da.length?da:da.map(function(Ra){return ja.enhancer_(Ra,void 0)});this.legacyMode_&&this.updateArrayLength_(ra,da.length-K);ra=this.spliceItemsIntoValues_(k,K,da);0===K&&0===da.length||this.notifyArraySplice_(k,da,ra);return this.dehanceValues_(ra)};d.spliceItemsIntoValues_=function(k,K,da){if(1E4>da.length){var ja;return(ja=this.values_).splice.apply(ja,[k,K].concat(da))}ja=this.values_.slice(k,k+K);var ra=this.values_.slice(k+K);this.values_.length+=da.length-K;for(K=0;K<da.length;K++)this.values_[k+
K]=da[K];for(K=0;K<ra.length;K++)this.values_[k+da.length+K]=ra[K];return ja};d.notifyArrayChildUpdate_=function(k,K,da){var ja=!this.owned_&&!1,ra=hd(this);k=ra||ja?{observableKind:"array",object:this.proxy_,type:No,debugObjectName:this.atom_.name_,index:k,newValue:K,oldValue:da}:null;this.atom_.reportChanged();ra&&Td(this,k)};d.notifyArraySplice_=function(k,K,da){var ja=!this.owned_&&!1,ra=hd(this);k=ra||ja?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",
index:k,removed:da,added:K,removedCount:da.length,addedCount:K.length}:null;this.atom_.reportChanged();ra&&Td(this,k)};d.get_=function(k){if(this.legacyMode_&&k>=this.values_.length)console.warn("[mobx] Out of bounds read: "+k);else return this.atom_.reportObserved(),this.dehanceValue_(this.values_[k])};d.set_=function(k,K){var da=this.values_;this.legacyMode_&&k>da.length&&f(17,k,da.length);if(k<da.length){var ja=da[k];if(ub(this)){K=Eb(this,{type:No,object:this.proxy_,index:k,newValue:K});if(!K)return;
K=K.newValue}K=this.enhancer_(K,ja);K!==ja&&(da[k]=K,this.notifyArrayChildUpdate_(k,K,ja))}else{k=Array(k+1-da.length);for(ja=0;ja<k.length-1;ja++)k[ja]=void 0;k[k.length-1]=K;this.spliceWithArray_(da.length,0,k)}};return a}(),Yu={clear:function(){return this.splice(0)},replace:function(a){var d=this[ih];return d.spliceWithArray_(0,d.values_.length,a)},toJSON:function(){return this.slice()},splice:function(a,d){for(var k=arguments.length,K=Array(2<k?k-2:0),da=2;da<k;da++)K[da-2]=arguments[da];k=this[ih];
switch(arguments.length){case 0:return[];case 1:return k.spliceWithArray_(a);case 2:return k.spliceWithArray_(a,d)}return k.spliceWithArray_(a,d,K)},spliceWithArray:function(a,d,k){return this[ih].spliceWithArray_(a,d,k)},push:function(){for(var a=this[ih],d=arguments.length,k=Array(d),K=0;K<d;K++)k[K]=arguments[K];a.spliceWithArray_(a.values_.length,0,k);return a.values_.length},pop:function(){return this.splice(Math.max(this[ih].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},
unshift:function(){for(var a=this[ih],d=arguments.length,k=Array(d),K=0;K<d;K++)k[K]=arguments[K];a.spliceWithArray_(0,0,k);return a.values_.length},reverse:function(){Af.trackingDerivation&&f(37,"reverse");this.replace(this.slice().reverse());return this},sort:function(){Af.trackingDerivation&&f(37,"sort");var a=this.slice();a.sort.apply(a,arguments);this.replace(a);return this},remove:function(a){var d=this[ih];a=d.dehanceValues_(d.values_).indexOf(a);return-1<a?(this.splice(a,1),!0):!1}};tb("concat",
ob);tb("flat",ob);tb("includes",ob);tb("indexOf",ob);tb("join",ob);tb("lastIndexOf",ob);tb("slice",ob);tb("toString",ob);tb("toLocaleString",ob);tb("every",Ub);tb("filter",Ub);tb("find",Ub);tb("findIndex",Ub);tb("flatMap",Ub);tb("forEach",Ub);tb("map",Ub);tb("some",Ub);tb("reduce",Tb);tb("reduceRight",Tb);var fE=F("ObservableArrayAdministration",Qw),gE={};var hE=Symbol.iterator;var iE=Symbol.toStringTag;var kz=function(){function a(k,K,da){var ja=this;void 0===K&&(K=Fa);void 0===da&&(da="ObservableMap");
this.name_=this.enhancer_=void 0;this[ih]=gE;this.dehancer=this.changeListeners_=this.interceptors_=this.keysAtom_=this.hasMap_=this.data_=void 0;this.enhancer_=K;this.name_=da;V(Map)||f(18);this.keysAtom_=Ya("ObservableMap.keys()");this.data_=new Map;this.hasMap_=new Map;Lb(!0,function(){ja.merge(k)})}var d=a.prototype;d.has_=function(k){return this.data_.has(k)};d.has=function(k){var K=this;if(!Af.trackingDerivation)return this.has_(k);var da=this.hasMap_.get(k);if(!da){var ja=da=new er(this.has_(k),
Ka,"ObservableMap.key?",!1);this.hasMap_.set(k,ja);pd(ja,function(){return K.hasMap_["delete"](k)})}return da.get()};d.set=function(k,K){var da=this.has_(k);if(ub(this)){K=Eb(this,{type:da?No:"add",object:this,newValue:K,name:k});if(!K)return this;K=K.newValue}da?this.updateValue_(k,K):this.addValue_(k,K);return this};d["delete"]=function(k){var K=this;if(ub(this)&&!Eb(this,{type:"delete",object:this,name:k}))return!1;if(this.has_(k)){var da=hd(this),ja=da?{observableKind:"map",debugObjectName:this.name_,
type:"delete",object:this,oldValue:this.data_.get(k).value_,name:k}:null;Gc(function(){var ra;K.keysAtom_.reportChanged();null==(ra=K.hasMap_.get(k))?void 0:ra.setNewValue_(!1);K.data_.get(k).setNewValue_(void 0);K.data_["delete"](k)});da&&Td(this,ja);return!0}return!1};d.updateValue_=function(k,K){var da=this.data_.get(k);K=da.prepareNewValue_(K);if(K!==Af.UNCHANGED){var ja=hd(this);k=ja?{observableKind:"map",debugObjectName:this.name_,type:No,object:this,oldValue:da.value_,name:k,newValue:K}:null;
da.setNewValue_(K);ja&&Td(this,k)}};d.addValue_=function(k,K){var da=this;Gc(function(){var Ja,Ra=new er(K,da.enhancer_,"ObservableMap.key",!1);da.data_.set(k,Ra);K=Ra.value_;null==(Ja=da.hasMap_.get(k))?void 0:Ja.setNewValue_(!0);da.keysAtom_.reportChanged()});var ja=hd(this),ra=ja?{observableKind:"map",debugObjectName:this.name_,type:"add",object:this,name:k,newValue:K}:null;ja&&Td(this,ra)};d.get=function(k){return this.has(k)?this.dehanceValue_(this.data_.get(k).get()):this.dehanceValue_(void 0)};
d.dehanceValue_=function(k){return void 0!==this.dehancer?this.dehancer(k):k};d.keys=function(){this.keysAtom_.reportObserved();return this.data_.keys()};d.values=function(){var k=this,K=this.keys();return Ta({next:function(){var da=K.next(),ja=da.done;da=da.value;return{done:ja,value:ja?void 0:k.get(da)}}})};d.entries=function(){var k=this,K=this.keys();return Ta({next:function(){var da=K.next(),ja=da.done;da=da.value;return{done:ja,value:ja?void 0:[da,k.get(da)]}}})};d[hE]=function(){return this.entries()};
d.forEach=function(k,K){for(var da=ta(this),ja;!(ja=da()).done;)ja=ja.value,k.call(K,ja[1],ja[0],this)};d.merge=function(k){var K=this;Vp(k)&&(k=new Map(k));Gc(function(){L(k)?I(k).forEach(function(da){return K.set(da,k[da])}):Array.isArray(k)?k.forEach(function(da){return K.set(da[0],da[1])}):O(k)?(k.constructor!==Map&&f(19,k),k.forEach(function(da,ja){return K.set(ja,da)})):null!==k&&void 0!==k&&f(20,k)});return this};d.clear=function(){var k=this;Gc(function(){bd(function(){for(var K=ta(k.keys()),
da;!(da=K()).done;)k["delete"](da.value)})})};d.replace=function(k){var K=this;Gc(function(){for(var da=td(k),ja=new Map,ra=!1,Ja=ta(K.data_.keys()),Ra;!(Ra=Ja()).done;)if(Ra=Ra.value,!da.has(Ra))if(K["delete"](Ra))ra=!0;else{var $a=K.data_.get(Ra);ja.set(Ra,$a)}for(da=ta(da.entries());!(Ja=da()).done;)Ra=Ja.value,Ja=Ra[0],$a=Ra[1],Ra=K.data_.has(Ja),K.set(Ja,$a),K.data_.has(Ja)&&($a=K.data_.get(Ja),ja.set(Ja,$a),Ra||(ra=!0));if(!ra)if(K.data_.size!==ja.size)K.keysAtom_.reportChanged();else for(ra=
K.data_.keys(),da=ja.keys(),Ja=ra.next(),Ra=da.next();!Ja.done;){if(Ja.value!==Ra.value){K.keysAtom_.reportChanged();break}Ja=ra.next();Ra=da.next()}K.data_=ja});return this};d.toString=function(){return"[object ObservableMap]"};d.toJSON=function(){return Array.from(this)};d.observe_=function(k,K){return Ud(this,k)};d.intercept_=function(k){return Bb(this,k)};aa(a,[{key:"size",get:function(){this.keysAtom_.reportObserved();return this.data_.size}},{key:iE,get:function(){return"Map"}}]);return a}(),
Vp=F("ObservableMap",kz),jE={};var kE=Symbol.iterator;var lE=Symbol.toStringTag;var lz=function(){function a(k,K,da){void 0===K&&(K=Fa);void 0===da&&(da="ObservableSet");this.name_=void 0;this[ih]=jE;this.data_=new Set;this.enhancer_=this.dehancer=this.interceptors_=this.changeListeners_=this.atom_=void 0;this.name_=da;V(Set)||f(22);this.atom_=Ya(this.name_);this.enhancer_=function(ja,ra){return K(ja,ra,da)};k&&this.replace(k)}var d=a.prototype;d.dehanceValue_=function(k){return void 0!==this.dehancer?
this.dehancer(k):k};d.clear=function(){var k=this;Gc(function(){bd(function(){for(var K=ta(k.data_.values()),da;!(da=K()).done;)k["delete"](da.value)})})};d.forEach=function(k,K){for(var da=ta(this),ja;!(ja=da()).done;)ja=ja.value,k.call(K,ja,ja,this)};d.add=function(k){var K=this;if(ub(this)&&!Eb(this,{type:"add",object:this,newValue:k}))return this;if(!this.has(k)){Gc(function(){K.data_.add(K.enhancer_(k,void 0));K.atom_.reportChanged()});var da=hd(this),ja=da?{observableKind:"set",debugObjectName:this.name_,
type:"add",object:this,newValue:k}:null;da&&Td(this,ja)}return this};d["delete"]=function(k){var K=this;if(ub(this)&&!Eb(this,{type:"delete",object:this,oldValue:k}))return!1;if(this.has(k)){var da=hd(this),ja=da?{observableKind:"set",debugObjectName:this.name_,type:"delete",object:this,oldValue:k}:null;Gc(function(){K.atom_.reportChanged();K.data_["delete"](k)});da&&Td(this,ja);return!0}return!1};d.has=function(k){this.atom_.reportObserved();return this.data_.has(this.dehanceValue_(k))};d.entries=
function(){var k=0,K=Array.from(this.keys()),da=Array.from(this.values());return Ta({next:function(){var ja=k;k+=1;return ja<da.length?{value:[K[ja],da[ja]],done:!1}:{done:!0}}})};d.keys=function(){return this.values()};d.values=function(){this.atom_.reportObserved();var k=this,K=0,da=Array.from(this.data_.values());return Ta({next:function(){return K<da.length?{value:k.dehanceValue_(da[K++]),done:!1}:{done:!0}}})};d.replace=function(k){var K=this;gr(k)&&(k=new Set(k));Gc(function(){Array.isArray(k)?
(K.clear(),k.forEach(function(da){return K.add(da)})):M(k)?(K.clear(),k.forEach(function(da){return K.add(da)})):null!==k&&void 0!==k&&f("Cannot initialize set from "+k)});return this};d.observe_=function(k,K){return Ud(this,k)};d.intercept_=function(k){return Bb(this,k)};d.toJSON=function(){return Array.from(this)};d.toString=function(){return"[object ObservableSet]"};d[kE]=function(){return this.values()};aa(a,[{key:"size",get:function(){this.atom_.reportObserved();return this.data_.size}},{key:lE,
get:function(){return"Set"}}]);return a}(),gr=F("ObservableSet",lz),mz=Object.create(null),nz=function(){function a(k,K,da,ja){void 0===K&&(K=new Map);void 0===ja&&(ja=LD);this.pendingKeys_=this.appliedAnnotations_=this.isPlainObject_=this.proxy_=this.interceptors_=this.changeListeners_=this.keysAtom_=this.defaultAnnotation_=this.values_=this.target_=void 0;this.target_=k;this.values_=K;this.name_=da;this.defaultAnnotation_=ja;this.keysAtom_=new qt("ObservableObject.keys");this.isPlainObject_=L(this.target_)}
var d=a.prototype;d.getObservablePropValue_=function(k){return this.values_.get(k).get()};d.setObservablePropValue_=function(k,K){var da=this.values_.get(k);if(da instanceof st)return da.set(K),!0;if(ub(this)){K=Eb(this,{type:No,object:this.proxy_||this.target_,name:k,newValue:K});if(!K)return null;K=K.newValue}K=da.prepareNewValue_(K);if(K!==Af.UNCHANGED){var ja=hd(this);k=ja?{type:No,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:da.value_,name:k,newValue:K}:
null;da.setNewValue_(K);ja&&Td(this,k)}return!0};d.get_=function(k){Af.trackingDerivation&&!U(this.target_,k)&&this.has_(k);return this.target_[k]};d.set_=function(k,K,da){void 0===da&&(da=!1);if(U(this.target_,k)){if(this.values_.has(k))return this.setObservablePropValue_(k,K);if(da)return Reflect.set(this.target_,k,K);this.target_[k]=K;return!0}return this.extend_(k,{value:K,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,da)};d.has_=function(k){if(!Af.trackingDerivation)return k in
this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var K=this.pendingKeys_.get(k);K||(K=new er(k in this.target_,Ka,"ObservableObject.key?",!1),this.pendingKeys_.set(k,K));return K.get()};d.make_=function(k,K){!0===K&&(K=this.defaultAnnotation_);if(!1!==K){if(!(k in this.target_)){var da;if(null!=(da=this.target_[ko])&&da[k])return;f(1,K.annotationType_,this.name_+"."+k.toString())}for(da=this.target_;da&&da!==pt;){var ja=Ru(da,k);if(ja){ja=K.make_(this,k,ja,da);if(0===ja)return;if(1===ja)break}da=
Object.getPrototypeOf(da)}var ra;null==(ra=this.target_[ko])?!0:delete ra[k]}};d.extend_=function(k,K,da,ja){void 0===ja&&(ja=!1);!0===da&&(da=this.defaultAnnotation_);if(!1===da)return this.defineProperty_(k,K,ja);if(K=da.extend_(this,k,K,ja)){var ra;null==(ra=this.target_[ko])?!0:delete ra[k]}return K};d.defineProperty_=function(k,K,da){void 0===da&&(da=!1);try{Sc();var ja=this.delete_(k);if(!ja)return ja;if(ub(this)){var ra=Eb(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:K.value});
if(!ra)return null;var Ja=ra.newValue;K.value!==Ja&&(K=W({},K,{value:Ja}))}if(da){if(!Reflect.defineProperty(this.target_,k,K))return!1}else jp(this.target_,k,K);this.notifyPropertyAddition_(k,K.value)}finally{Ib()}return!0};d.defineObservableProperty_=function(k,K,da,ja){void 0===ja&&(ja=!1);try{Sc();var ra=this.delete_(k);if(!ra)return ra;if(ub(this)){var Ja=Eb(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:K});if(!Ja)return null;K=Ja.newValue}var Ra=te(k),$a={configurable:Af.safeDescriptors?
this.isPlainObject_:!0,enumerable:!0,get:Ra.get,set:Ra.set};if(ja){if(!Reflect.defineProperty(this.target_,k,$a))return!1}else jp(this.target_,k,$a);var fb=new er(K,da,"ObservableObject.key",!1);this.values_.set(k,fb);this.notifyPropertyAddition_(k,fb.value_)}finally{Ib()}return!0};d.defineComputedProperty_=function(k,K,da){void 0===da&&(da=!1);try{Sc();var ja=this.delete_(k);if(!ja)return ja;if(ub(this)&&!Eb(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:void 0}))return null;K.name||
(K.name="ObservableObject.key");K.context=this.proxy_||this.target_;var ra=te(k),Ja={configurable:Af.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:ra.get,set:ra.set};if(da){if(!Reflect.defineProperty(this.target_,k,Ja))return!1}else jp(this.target_,k,Ja);this.values_.set(k,new st(K));this.notifyPropertyAddition_(k,void 0)}finally{Ib()}return!0};d.delete_=function(k,K){void 0===K&&(K=!1);if(!U(this.target_,k))return!0;if(ub(this)&&!Eb(this,{object:this.proxy_||this.target_,name:k,type:"remove"}))return null;
try{var da,ja;Sc();var ra=hd(this),Ja=this.values_.get(k),Ra=void 0;if(!Ja&&ra){var $a;Ra=null==($a=Ru(this.target_,k))?void 0:$a.value}if(K){if(!Reflect.deleteProperty(this.target_,k))return!1}else delete this.target_[k];Ja&&(this.values_["delete"](k),Ja instanceof er&&(Ra=Ja.value_),Db(Ja));this.keysAtom_.reportChanged();null==(da=this.pendingKeys_)?void 0:null==(ja=da.get(k))?void 0:ja.set(k in this.target_);if(ra){var fb={type:"remove",observableKind:"object",object:this.proxy_||this.target_,
debugObjectName:this.name_,oldValue:Ra,name:k};ra&&Td(this,fb)}}finally{Ib()}return!0};d.observe_=function(k,K){return Ud(this,k)};d.intercept_=function(k){return Bb(this,k)};d.notifyPropertyAddition_=function(k,K){var da,ja,ra=hd(this);ra&&(K=ra?{type:"add",observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:k,newValue:K}:null,ra&&Td(this,K));null==(da=this.pendingKeys_)?void 0:null==(ja=da.get(k))?void 0:ja.set(!0);this.keysAtom_.reportChanged()};d.ownKeys_=
function(){this.keysAtom_.reportObserved();return Su(this.target_)};d.keys_=function(){this.keysAtom_.reportObserved();return Object.keys(this.target_)};return a}(),mE=F("ObservableObjectAdministration",nz),nE=pe(0),Rw=0,oz=function(){};(function(a,d){Object.setPrototypeOf?Object.setPrototypeOf(a.prototype,d):void 0!==a.prototype.__proto__?a.prototype.__proto__=d:a.prototype=d})(oz,Array.prototype);var Sw=function(a,d,k){function K(ja,ra,Ja,Ra){void 0===Ja&&(Ja="ObservableArray");void 0===Ra&&(Ra=
!1);var $a=a.call(this)||this;ra=new Qw(Ja,ra,Ra,!0);ra.proxy_=ea($a);G(ea($a),ih,ra);ja&&ja.length&&(ra=xc(!0),$a.spliceWithArray(0,0,ja),Af.allowStateChanges=ra);Object.defineProperty(ea($a),"0",nE);return $a}fa(K,a);var da=K.prototype;da.concat=function(){this[ih].atom_.reportObserved();for(var ja=arguments.length,ra=Array(ja),Ja=0;Ja<ja;Ja++)ra[Ja]=arguments[Ja];return Array.prototype.concat.apply(this.slice(),ra.map(function(Ra){return rd(Ra)?Ra.slice():Ra}))};da[k]=function(){var ja=this,ra=
0;return Ta({next:function(){return ra<ja.length?{value:ja[ra++],done:!1}:{done:!0,value:void 0}}})};aa(K,[{key:"length",get:function(){return this[ih].getArrayLength_()},set:function(ja){this[ih].setArrayLength_(ja)}},{key:d,get:function(){return"Array"}}]);return K}(oz,Symbol.toStringTag,Symbol.iterator);Object.entries(Yu).forEach(function(a){var d=a[0];a=a[1];"concat"!==d&&R(Sw.prototype,d,a)});$d(1E3);var pz=pt.toString;["Symbol","Map","Set"].forEach(function(a){"undefined"===typeof E()[a]&&f("MobX requires global '"+
a+"' to be available or polyfilled")});"object"===typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:fc,extras:{getDebugName:Xa},$mobx:ih});var oE=ca(589),fl=class{constructor(a){gb(this,"props");gb(this,"aspectRatio");gb(this,"type");gb(this,"hideCloneHandles",!1);gb(this,"hideResizeHandles",!1);gb(this,"hideRotateHandle",!1);gb(this,"hideContextBar",!1);gb(this,"hideSelectionDetail",!1);gb(this,"hideSelection",!1);gb(this,"canChangeAspectRatio",!0);gb(this,"canUnmount",
!0);gb(this,"canResize",[!0,!0]);gb(this,"canScale",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!1);gb(this,"canBind",!1);gb(this,"nonce");gb(this,"bindingDistance",4);gb(this,"isDirty",!1);gb(this,"lastSerialized");gb(this,"getCenter",()=>sf.getBoundsCenter(this.bounds));gb(this,"getRotatedBounds",()=>{const {bounds:ja,props:{rotation:ra}}=this;return ra?sf.getBoundsFromPoints(sf.getRotatedCorners(ja,ra)):ja});gb(this,"hitTestPoint",ja=>{var ra=this.rotatedBounds;if(!this.props.rotation)return Fk.pointInBounds(ja,
ra);ra=sf.getRotatedCorners(ra,this.props.rotation);return Fk.pointInPolygon(ja,ra)});gb(this,"hitTestLineSegment",(ja,ra)=>{const Ja=sf.getBoundsFromPoints([ja,ra]),{rotatedBounds:Ra,props:{rotation:$a=0}}=this;return sf.boundsContain(Ra,Ja)||$a?h(ja,ra,sf.getRotatedCorners(this.bounds)).didIntersect:0<r(Ra,ja,ra).length});gb(this,"hitTestBounds",ja=>{const {rotatedBounds:ra,props:{rotation:Ja=0}}=this,Ra=sf.getRotatedCorners(this.bounds,Ja);return sf.boundsContain(ja,ra)||0<v([ja.minX,ja.minY],
[ja.width,ja.height],Ra).length});gb(this,"getExpandedBounds",()=>sf.expandBounds(this.getBounds(),this.bindingDistance));gb(this,"getBindingPoint",(ja,ra,Ja,Ra)=>{var $a=this.getBounds(),fb=this.getExpandedBounds();if(Fk.pointInBounds(ja,fb)){var jb=z(ra,Ja,fb).filter(Jb=>Jb.didIntersect).map(Jb=>Jb.points[0]);if(jb.length)return Ja=this.getCenter(),jb=jb.sort((Jb,Ob)=>be.dist(Ob,ra)-be.dist(Jb,ra))[0],jb=be.med(ja,jb),Ra?(Ra=2>be.dist(ja,Ja)?Ja:ja,$a=0):(Ra=2>be.distanceToLineSegment(ja,jb,Ja)?
Ja:jb,$a=Fk.pointInBounds(ja,$a)?this.bindingDistance:Math.max(this.bindingDistance,sf.getBoundsSides($a).map(Jb=>be.distanceToLineSegment(Jb[1][0],Jb[1][1],ja)).sort((Jb,Ob)=>Jb-Ob)[0])),fb=be.divV(be.sub(Ra,[fb.minX,fb.minY]),[fb.width,fb.height]),{point:be.clampV(fb,0,1),distance:$a}}});gb(this,"getSerialized",()=>jc(ff(Zd({},this.props),{type:this.type,nonce:this.nonce})));gb(this,"getCachedSerialized",()=>{!this.isDirty&&this.lastSerialized||Gc(()=>{this.setIsDirty(!1);this.setLastSerialized(this.getSerialized())});
if(this.lastSerialized)return this.lastSerialized;throw Error("Should not get here for getCachedSerialized");});gb(this,"validateProps",ja=>ja);gb(this,"update",(ja,ra=!1,Ja=!1)=>{ra||this.isDirty||this.setIsDirty(!0);ra||Ja||this.incNonce();Object.assign(this.props,this.validateProps(ja));return this});gb(this,"clone",()=>new this.constructor(this.serialized));gb(this,"onResetBounds",ja=>this);gb(this,"scale",[1,1]);gb(this,"onResizeStart",ja=>{var ra;this.scale=[...(null!=(ra=this.props.scale)?
ra:[1,1])];return this});gb(this,"onResize",(ja,ra)=>{const {bounds:Ja,rotation:Ra,scale:[$a,fb]}=ra;ja=[...this.scale];0>$a&&(ja[0]*=-1);0>fb&&(ja[1]*=-1);this.update({point:[Ja.minX,Ja.minY],scale:ja,rotation:Ra});return this});gb(this,"onHandleChange",(ja,{id:ra,delta:Ja})=>{if(void 0!==ja.handles){var Ra=ir(ja.handles);Ra[ra]=ff(Zd({},Ra[ra]),{point:be.add(Ja,ja.handles[ra].point)});var $a=sf.getCommonTopLeft(Object.values(Ra).map(fb=>fb.point));Object.values(Ra).forEach(fb=>{fb.point=be.sub(fb.point,
$a)});this.update({point:be.add(ja.point,$a),handles:Ra})}});var d,k;const K=this.constructor.id,da=null!=(d=this.constructor.defaultProps)?d:{};this.type=K;this.props=Zd(Zd({scale:[1,1]},da),a);this.nonce=null!=(k=a.nonce)?k:Date.now();Ue(this)}get id(){return this.props.id}setNonce(a){this.nonce=a}incNonce(){this.nonce++}setIsDirty(a){this.isDirty=a}setLastSerialized(a){this.lastSerialized=a}get center(){return this.getCenter()}get bounds(){return this.getBounds()}get rotatedBounds(){return this.getRotatedBounds()}get serialized(){return this.getCachedSerialized()}getShapeSVGJsx(a){a=
this.getBounds();const {stroke:d,strokeWidth:k,strokeType:K,opacity:da,fill:ja,noFill:ra,borderRadius:Ja}=this.props;return(0,oE.jsx)("rect",{fill:ra?"none":sh(ja,"background"),stroke:sh(d,"stroke"),strokeWidth:null!=k?k:2,strokeDasharray:"dashed"===K?"8 2":void 0,fillOpacity:null!=da?da:.2,width:a.width,height:a.height,rx:Ja,ry:Ja})}};gb(fl,"type");fe([yg],fl.prototype,"props",2);fe([yg],fl.prototype,"canResize",2);fe([yg],fl.prototype,"nonce",2);fe([yg],fl.prototype,"isDirty",2);fe([yg],fl.prototype,
"lastSerialized",2);fe([Dg],fl.prototype,"id",1);fe([jg],fl.prototype,"setNonce",1);fe([jg],fl.prototype,"incNonce",1);fe([jg],fl.prototype,"setIsDirty",1);fe([jg],fl.prototype,"setLastSerialized",1);fe([Dg],fl.prototype,"center",1);fe([Dg],fl.prototype,"bounds",1);fe([Dg],fl.prototype,"rotatedBounds",1);fe([Dg],fl.prototype,"serialized",1);fe([jg],fl.prototype,"update",2);var fm=class extends fl{constructor(a={}){super(a);gb(this,"canBind",!0);gb(this,"getBounds",()=>{const [d,k]=this.props.point,
[K,da]=this.props.size;return{minX:d,minY:k,maxX:d+K,maxY:k+da,width:K,height:da}});gb(this,"getRotatedBounds",()=>sf.getBoundsFromPoints(sf.getRotatedCorners(this.bounds,this.props.rotation)));gb(this,"onResize",(d,k)=>{const {bounds:K,rotation:da,scale:[ja,ra]}=k;d=[...this.scale];0>ja&&(d[0]*=-1);0>ra&&(d[1]*=-1);this.update({point:[K.minX,K.minY],scale:d,rotation:da});return this.update({rotation:da,point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,K.height)],scale:d})});gb(this,"validateProps",
d=>{void 0!==d.size&&(d.size[0]=Math.max(d.size[0],1),d.size[1]=Math.max(d.size[1],1));return d});Ue(this)}};gb(fm,"id","box");gb(fm,"defaultProps",{id:"box",type:"box",parentId:"page",point:[0,0],size:[100,100]});var fs=class extends fl{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {pointBounds:d,props:{point:k}}=this;return sf.translateBounds(d,k)});gb(this,"getRotatedBounds",()=>{const {props:{rotation:d,point:k},bounds:K,rotatedPoints:da}=this;return d?sf.translateBounds(sf.getBoundsFromPoints(da),
k):K});gb(this,"normalizedPoints",[]);gb(this,"isResizeFlippedX",!1);gb(this,"isResizeFlippedY",!1);gb(this,"onResizeStart",()=>{var d;const {bounds:k,props:{points:K}}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const da=[k.width,k.height];this.normalizedPoints=K.map(ja=>yd.divV(ja,da));return this});gb(this,"onResize",(d,k)=>{const {bounds:K,scale:[da,ja]}=k,ra=[K.width,K.height];d=[...this.scale];0>da&&(d[0]*=-1);0>ja&&(d[1]*=-1);return this.update(da||ja?{point:[K.minX,K.minY],points:this.normalizedPoints.map(Ja=>
yd.mulV(Ja,ra).concat(Ja[2])),scale:d}:{point:[K.minX,K.minY],points:this.normalizedPoints.map(Ja=>yd.mulV(Ja,ra).concat(Ja[2]))})});gb(this,"hitTestPoint",d=>{const {props:{points:k,point:K}}=this;return Fk.pointNearToPolyline(yd.sub(d,K),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {bounds:K,props:{points:da,point:ja}}=this;if(Fk.pointInBounds(d,K)||Fk.pointInBounds(k,K)||0<r(K,d,k).length){const ra=yd.sub(d,ja),Ja=yd.sub(k,ja);return h(ra,Ja,da).didIntersect||!!da.find(Ra=>5>yd.dist(ra,Ra)||
5>yd.dist(Ja,Ra))}return!1});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,props:{points:K,point:da}}=this,ja=sf.translateBounds(d,yd.neg(da));return sf.boundsContain(d,k)||K.every(ra=>Fk.pointInBounds(ra,ja))||sf.boundsCollide(d,k)&&0<D([ja.minX,ja.minY],[ja.width,ja.height],K).length});Ue(this)}get pointBounds(){const {props:{points:a}}=this;return sf.getBoundsFromPoints(a)}get rotatedPoints(){const {props:{point:a,points:d,rotation:k},center:K}=this;if(!k)return d;const da=yd.sub(K,a);return d.map(ja=>
yd.rotWith(ja,da,k))}};gb(fs,"id","draw");gb(fs,"defaultProps",{id:"draw",type:"draw",parentId:"page",point:[0,0],points:[],isComplete:!1});fe([Dg],fs.prototype,"pointBounds",1);fe([Dg],fs.prototype,"rotatedPoints",1);var Tw=class extends fm{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {props:{point:[d,k],size:[K,da]}}=this;return sf.getRotatedEllipseBounds(d,k,K/2,da/2,0)});gb(this,"getRotatedBounds",()=>{const {props:{point:[d,k],size:[K,da],rotation:ja}}=this;return sf.getRotatedEllipseBounds(d,
k,K/2,da/2,ja)});gb(this,"hitTestPoint",d=>{const {props:{size:k,rotation:K},center:da}=this;return Fk.pointInEllipse(d,da,k[0],k[1],K||0)});gb(this,"hitTestLineSegment",(d,k)=>{const {props:{size:[K,da],rotation:ja=0},center:ra}=this;return g(d,k,ra,K,da,ja).didIntersect});gb(this,"hitTestBounds",d=>{const {props:{size:[k,K],rotation:da=0},rotatedBounds:ja}=this;var ra;if(!(ra=sf.boundsContain(d,ja))){const {minX:Ja,minY:Ra,width:$a,height:fb}=d;ra=0<t(this.center,k/2,K/2,da,[Ja,Ra],[$a,fb]).length}return ra});
Ue(this)}};gb(Tw,"id","ellipse");gb(Tw,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100]});var Uw=class extends fm{constructor(a={}){super(a);gb(this,"onResetBounds",d=>{const {clipping:k,size:K,point:da}=this.props;if(k){const [ja,ra,Ja,Ra]=Array.isArray(k)?k:[k,k,k,k];return this.update({clipping:0,point:[da[0]-Ra,da[1]-ja],size:[K[0]+(Ra-ra),K[1]+(ja-Ja)]})}if(d.asset){const {size:[ja,ra]}=d.asset;this.update({clipping:0,point:[da[0]+K[0]/2-ja/2,da[1]+K[1]/
2-ra/2],size:[ja,ra]})}return this});gb(this,"onResize",(d,k)=>{const {bounds:K,clip:da,scale:ja}=k;({clipping:k}=this.props);const {clipping:ra}=d;if(da){const {point:[Ja,Ra],size:[$a,fb]}=d,[jb,Jb,Ob,Kb]=ra?Array.isArray(ra)?ra:[ra,ra,ra,ra]:[0,0,0,0];k=[jb+(K.minY-Ra),Jb+(K.maxX-(Ja+$a)),Ob+(K.maxY-(Ra+fb)),Kb+(K.minX-Ja)]}else void 0!==ra&&(k=Array.isArray(ra)?ra:[ra,ra,ra,ra],k=[k[0]*ja[1],k[1]*ja[0],k[2]*ja[1],k[3]*ja[0]]);if(k&&Array.isArray(k)){const Ja=k;Ja.every((Ra,$a)=>0===$a||Ra===Ja[$a-
1])&&(k=Ja[0])}return this.update({point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,K.height)],clipping:k})});Ue(this)}};gb(Uw,"id","ellipse");gb(Uw,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100],clipping:0,objectFit:"none",assetId:""});var qz=class extends fl{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {points:d,props:{point:k}}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),k)});gb(this,"getRotatedBounds",()=>{const {rotatedPoints:d,
props:{point:k}}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),k)});gb(this,"normalizedHandles",[]);gb(this,"onResizeStart",()=>{var d;const {props:{handles:k},bounds:K}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const da=[K.width,K.height];this.normalizedHandles=Object.values(k).map(ja=>yd.divV(ja.point,da));return this});gb(this,"onResize",(d,k)=>{const {bounds:K,scale:[da,ja]}=k,{props:{handles:ra},normalizedHandles:Ja}=this,Ra=[K.width,K.height];d=[...this.scale];0>da&&
(d[0]*=-1);0>ja&&(d[1]*=-1);return this.update({point:[K.minX,K.minY],handles:Object.values(ra).map(($a,fb)=>ff(Zd({},$a),{point:yd.mulV(Ja[fb],Ra)})),scale:d})});gb(this,"hitTestPoint",d=>{const {points:k}=this;return Fk.pointNearToPolyline(yd.sub(d,this.props.point),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {bounds:K,points:da,props:{point:ja}}=this;if(Fk.pointInBounds(d,K)||Fk.pointInBounds(k,K)||0<r(K,d,k).length){const ra=yd.sub(d,ja),Ja=yd.sub(k,ja);return h(ra,Ja,da).didIntersect||!!da.find(Ra=>
5>yd.dist(ra,Ra)||5>yd.dist(Ja,Ra))}return!1});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,points:K,props:{point:da}}=this,ja=sf.translateBounds(d,yd.neg(da));return sf.boundsContain(d,k)||K.every(ra=>Fk.pointInBounds(ra,ja))||sf.boundsCollide(d,k)&&0<D([ja.minX,ja.minY],[ja.width,ja.height],K).length});gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=qz.defaultProps.handles);return d});Ue(this)}get points(){return Object.values(this.props.handles).map(a=>
a.point)}get centroid(){const {points:a}=this;return Rk.getPolygonCentroid(a)}get rotatedPoints(){const {centroid:a,props:{handles:d,rotation:k}}=this;return k?Object.values(d).map(K=>yd.rotWith(K.point,a,k)):this.points}},gs=qz;gb(gs,"id","polyline");gb(gs,"defaultProps",{id:"polyline",type:"polyline",parentId:"page",point:[0,0],handles:{}});fe([Dg],gs.prototype,"points",1);fe([Dg],gs.prototype,"centroid",1);fe([Dg],gs.prototype,"rotatedPoints",1);var rz=class extends gs{constructor(a={}){super(a);
gb(this,"hideResizeHandles",!0);gb(this,"hideRotateHandle",!0);gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=rz.defaultProps.handles);return d});gb(this,"getHandlesChange",(d,k)=>{var K=Vl(d.handles,k);K=Vl(K,{start:{point:be.toFixed(K.start.point)},end:{point:be.toFixed(K.end.point)}});if(!be.isEqual(K.start.point,K.end.point)){k={point:d.point,handles:ir(K)};d=d.point;K=sf.translateBounds(sf.getBoundsFromPoints(Object.values(K).map(ja=>
ja.point)),k.point);var da=be.sub([K.minX,K.minY],d);be.isEqual(da,[0,0])||(Object.values(k.handles).forEach(ja=>{ja.point=be.toFixed(be.sub(ja.point,da))}),k.point=be.toFixed(be.add(k.point,da)));return k}});Ue(this)}},wt=rz;gb(wt,"id","line");gb(wt,"defaultProps",{id:"line",type:"line",parentId:"page",point:[0,0],handles:{start:{id:"start",canBind:!0,point:[0,0]},end:{id:"end",canBind:!0,point:[1,1]}}});var Wp=class extends fm{constructor(a={}){super(a);gb(this,"getRotatedBounds",()=>{const {rotatedVertices:d,
props:{point:k},offset:K}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),yd.add(k,K))});gb(this,"hitTestPoint",d=>{const {vertices:k}=this;return Fk.pointInPolygon(yd.add(d,this.props.point),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {vertices:K,props:{point:da}}=this;return h(yd.sub(d,da),yd.sub(k,da),K).didIntersect});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,offset:K,rotatedVertices:da,props:{point:ja}}=this,ra=sf.translateBounds(d,yd.neg(yd.add(ja,K)));return sf.boundsContain(d,
k)||da.every(Ja=>Fk.pointInBounds(Ja,ra))||0<v([ra.minX,ra.minY],[ra.width,ra.height],da).length});gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.sides&&3>d.sides&&(d.sides=3);return d});Ue(this)}get vertices(){return this.getVertices()}get pageVertices(){const {props:{point:a},vertices:d}=this;return d.map(k=>yd.add(k,a))}get centroid(){const {vertices:a}=this;return Rk.getPolygonCentroid(a)}get rotatedVertices(){const {vertices:a,centroid:d,props:{rotation:k}}=this;return k?a.map(K=>
yd.rotWith(K,d,k)):a}get offset(){const {props:{size:[a,d]}}=this,k=sf.getBoundsCenter(sf.getBoundsFromPoints(this.vertices));return yd.sub(yd.div([a,d],2),k)}getVertices(a=0){const {ratio:d,sides:k,size:K}=this.props;return 3===k?Rk.getTriangleVertices(K,a,d):Rk.getPolygonVertices(K,k,a,d)}};gb(Wp,"id","polygon");gb(Wp,"defaultProps",{id:"polygon",type:"polygon",parentId:"page",point:[0,0],size:[100,100],sides:5,ratio:1,isFlippedY:!1});fe([Dg],Wp.prototype,"vertices",1);fe([Dg],Wp.prototype,"pageVertices",
1);fe([Dg],Wp.prototype,"centroid",1);fe([Dg],Wp.prototype,"rotatedVertices",1);fe([Dg],Wp.prototype,"offset",1);var Vw=class extends fm{constructor(a={}){super(a);gb(this,"canEdit",!0);gb(this,"canFlip",!1);Ue(this)}};gb(Vw,"id","text");gb(Vw,"defaultProps",{id:"text",type:"text",parentId:"page",isSizeLocked:!0,point:[0,0],size:[16,32],text:""});var Zu=class extends fm{constructor(a={}){super(a);gb(this,"canEdit",!1);gb(this,"canFlip",!1);gb(this,"getBounds",()=>0===this.shapes.length?(mg().deleteShapes([this.id]),
{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}):sf.getCommonBounds(this.shapes.map(d=>d.getBounds())));Ue(this);this.canResize=[!1,!1]}getShapes(){throw Error("will be implemented other places");}get shapes(){return this.getShapes()}};gb(Zu,"id","group");gb(Zu,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});fe([Dg],Zu.prototype,"shapes",1);var hs=class{constructor(){gb(this,"_id");gb(this,"_initial");gb(this,"_states");gb(this,"_isActive",!1);gb(this,"cursor");
gb(this,"_disposables",[]);gb(this,"children",new Map([]));gb(this,"registerStates",k=>{k.forEach(K=>this.children.set(K.id,new K(this,this)));return this});gb(this,"deregisterStates",k=>{k.forEach(K=>{var da;null==(da=this.children.get(K.id))?void 0:da.dispose();this.children.delete(K.id)});return this});gb(this,"currentState",{});gb(this,"transition",(k,K={})=>{if(0===this.children.size)throw Error(`Tool ${this.id} has no states, cannot transition to ${k}.`);const da=this.children.get(k),ja=this.currentState;
if(!da)throw Error(`Could not find a state named ${k}.`);Gc(()=>{this.currentState?(ja._events.onExit(ff(Zd({},K),{toId:k})),ja.dispose(),this.setCurrentState(da),this._events.onTransition(ff(Zd({},K),{fromId:ja.id,toId:k})),da._events.onEnter(ff(Zd({},K),{fromId:ja.id}))):(this.currentState=da,da._events.onEnter(ff(Zd({},K),{fromId:""})))});return this});gb(this,"isIn",k=>{k=k.split(".").reverse();let K=this;for(;0<k.length;){const da=k.pop();if(!da)return!0;if(K.currentState.id===da){if(0===k.length)return!0;
K=K.currentState}else break}return!1});gb(this,"isInAny",(...k)=>k.some(this.isIn));gb(this,"forwardEvent",(k,...K)=>{var da,ja;(null==(ja=null==(da=this.currentState)?void 0:da._events)?0:ja[k])&&Gc(()=>{var ra;return null==(ra=this.currentState._events)?void 0:ra[k](...K)})});gb(this,"_events",{onTransition:k=>{var K;null==(K=this.onTransition)?void 0:K.call(this,k)},onEnter:k=>{var K;this._isActive=!0;this.initial&&this.transition(this.initial,k);null==(K=this.onEnter)?void 0:K.call(this,k)},onExit:k=>
{var K,da,ja;this._isActive=!1;null==(da=null==(K=this.currentState)?void 0:K.onExit)?void 0:da.call(K,{toId:"parent"});null==(ja=this.onExit)?void 0:ja.call(this,k)},onPointerDown:(k,K)=>{var da;null==(da=this.onPointerDown)?void 0:da.call(this,k,K);this.forwardEvent("onPointerDown",k,K)},onPointerUp:(k,K)=>{var da;null==(da=this.onPointerUp)?void 0:da.call(this,k,K);this.forwardEvent("onPointerUp",k,K)},onPointerMove:(k,K)=>{var da;null==(da=this.onPointerMove)?void 0:da.call(this,k,K);this.forwardEvent("onPointerMove",
k,K)},onPointerEnter:(k,K)=>{var da;null==(da=this.onPointerEnter)?void 0:da.call(this,k,K);this.forwardEvent("onPointerEnter",k,K)},onPointerLeave:(k,K)=>{var da;null==(da=this.onPointerLeave)?void 0:da.call(this,k,K);this.forwardEvent("onPointerLeave",k,K)},onDoubleClick:(k,K)=>{var da;null==(da=this.onDoubleClick)?void 0:da.call(this,k,K);this.forwardEvent("onDoubleClick",k,K)},onKeyDown:(k,K)=>{var da;this._events.onModifierKey(k,K);null==(da=this.onKeyDown)?void 0:da.call(this,k,K);this.forwardEvent("onKeyDown",
k,K)},onKeyUp:(k,K)=>{var da;this._events.onModifierKey(k,K);null==(da=this.onKeyUp)?void 0:da.call(this,k,K);this.forwardEvent("onKeyUp",k,K)},onPinchStart:(k,K)=>{var da;null==(da=this.onPinchStart)?void 0:da.call(this,k,K);this.forwardEvent("onPinchStart",k,K)},onPinch:(k,K)=>{var da;null==(da=this.onPinch)?void 0:da.call(this,k,K);this.forwardEvent("onPinch",k,K)},onPinchEnd:(k,K)=>{var da;null==(da=this.onPinchEnd)?void 0:da.call(this,k,K);this.forwardEvent("onPinchEnd",k,K)},onModifierKey:(k,
K)=>{switch(K.key){case "Shift":case "Alt":case "Ctrl":case "Meta":this._events.onPointerMove(k,K)}}});gb(this,"onEnter");gb(this,"onExit");gb(this,"onTransition");gb(this,"onPointerDown");gb(this,"onPointerUp");gb(this,"onPointerMove");gb(this,"onPointerEnter");gb(this,"onPointerLeave");gb(this,"onDoubleClick");gb(this,"onKeyDown");gb(this,"onKeyUp");gb(this,"onPinchStart");gb(this,"onPinch");gb(this,"onPinchEnd");const a=this.constructor.initial,d=this.constructor.states;this._id=this.constructor.id;
this._initial=a;this._states=d}dispose(){this._disposables.forEach(a=>a());this._disposables=[];return this}get initial(){return this._initial}get states(){return this._states}get id(){return this._id}get isActive(){return this._isActive}get ascendants(){return[this]}get descendants(){return Array.from(this.children.values()).flatMap(a=>[a,...a.descendants])}setCurrentState(a){this.currentState=a}};gb(hs,"id");gb(hs,"shortcuts");fe([yg],hs.prototype,"currentState",2);fe([jg],hs.prototype,"setCurrentState",
1);var Ww=class extends hs{constructor(a,d){var k,K;super();gb(this,"_root");gb(this,"_parent");gb(this,"children",new Map([]));gb(this,"registerStates",da=>{da.forEach(ja=>this.children.set(ja.id,new ja(this,this._root)));return this});gb(this,"deregisterStates",da=>{da.forEach(ja=>{var ra;null==(ra=this.children.get(ja.id))?void 0:ra.dispose();this.children.delete(ja.id)});return this});this._parent=a;this._root=d;this.states&&0<this.states.length&&(this.registerStates(this.states),a=null!=(k=this.initial)?
k:this.states[0].id,k=this.children.get(a))&&(this.setCurrentState(k),null==(K=this.currentState)?void 0:K._events.onEnter({fromId:"initial"}));Ue(this)}get root(){return this._root}get parent(){return this._parent}get ascendants(){return this.parent?"ascendants"in this.parent?[...this.parent.ascendants,this]:[this.parent,this]:[this]}};gb(Ww,"cursor");var Xp=class extends Ww{constructor(){super(...arguments);gb(this,"isLocked",!1);gb(this,"previous");gb(this,"onEnter",({fromId:a})=>{this.previous=
a;this.cursor&&this.app.cursors.setCursor(this.cursor)});gb(this,"onTransition",a=>{({toId:a}=a);a=this.children.get(a);this.app.cursors.reset();a.cursor?this.app.cursors.setCursor(a.cursor):this.cursor&&this.app.cursors.setCursor(this.cursor)})}get app(){return this.root}},Xh=class extends Ww{get app(){return this.root}get tool(){return this.parent}},sz=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"creatingShape");gb(this,"aspectRatio");gb(this,"initialBounds",
{});gb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d,currentPoint:k}}=this.app;var {Shape:K}=this.tool;K=new K({id:qk(),type:K.id,parentId:a.id,point:[...d],fill:this.app.settings.color,stroke:this.app.settings.color,size:be.abs(be.sub(k,d))});this.initialBounds={minX:d[0],minY:d[1],maxX:d[0]+1,maxY:d[1]+1,width:1,height:1};K.canChangeAspectRatio||(K.aspectRatio?(this.aspectRatio=K.aspectRatio,this.initialBounds.height=this.aspectRatio):(this.aspectRatio=1,this.initialBounds.height=
1),this.initialBounds.width=1,this.initialBounds.maxY=this.initialBounds.minY+this.initialBounds.height);this.creatingShape=K;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);this.app.currentPage.addShapes(K);this.app.setSelectedShapes([K])});gb(this,"onPointerMove",a=>{if(!a.order){if(!this.creatingShape)throw Error("Expected a creating shape.");var {initialBounds:d}=this,{currentPoint:k,originPoint:K,shiftKey:da}=this.app.inputs;a=da||this.creatingShape.props.isAspectRatioLocked||
!this.creatingShape.canChangeAspectRatio;d=sf.getTransformedBoundingBox(d,"bottom_right_corner",be.sub(k,K),0,a);this.app.settings.snapToGrid&&!a&&(d=sf.snapBoundsToGrid(d,8));this.creatingShape.update({point:[d.minX,d.minY],size:[d.width,d.height]})}});gb(this,"onPointerUp",()=>{this.tool.transition("idle");this.creatingShape?(this.app.setSelectedShapes([this.creatingShape]),this.app.api.editShape(this.creatingShape)):this.app.transition("select");this.app.persist()});gb(this,"onKeyDown",(a,d)=>
{switch(d.key){case "Escape":if(!this.creatingShape)throw Error("Expected a creating shape.");this.app.deleteShapes([this.creatingShape]);this.tool.transition("idle")}})}};gb(sz,"id","creating");var tz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});
gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(tz,"id","idle");var uz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))});gb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};gb(uz,"id","pointing");var kp=class extends Xp{constructor(){super(...arguments);
gb(this,"cursor","crosshair")}};gb(kp,"id","box");gb(kp,"states",[tz,uz,sz]);gb(kp,"initial","idle");var vz=class extends Xh{constructor(){super(...arguments);gb(this,"shape",{});gb(this,"points",[[0,0,.5]]);gb(this,"persistDebounced",Xj(this.app.persist,200));gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onEnter",()=>{var a;const {Shape:d,previousShape:k}=this.tool;var {originPoint:K}=this.app.inputs;this.app.history.pause();if(this.app.inputs.shiftKey&&
k){this.shape=k;var {shape:da}=this;var ja=da.props.points[da.props.points.length-1];const Ja=yd.sub(K,da.props.point).concat(null!=(a=K[2])?a:.5);this.points=[...da.props.points,ja,ja];const Ra=Math.ceil(yd.dist(ja,K)/16);for(let $a=0,fb=$a/(Ra-1);$a<Ra;$a++){a=this.points;K=a.push;da=yd.lrp(ja,Ja,fb);var ra=ja[2];K.call(a,da.concat.call(da,ra+(Ja[2]-ra)*fb))}this.addNextPoint(Ja)}else this.tool.previousShape=void 0,this.points=[[0,0,null!=(ja=K[2])?ja:.5]],this.shape=new d({id:qk(),type:d.id,parentId:this.app.currentPage.id,
point:K.slice(0,2),points:this.points,isComplete:!1,fill:this.app.settings.color,stroke:this.app.settings.color}),this.shape.setScaleLevel(this.app.settings.scaleLevel),this.app.currentPage.addShapes(this.shape)});gb(this,"onPointerMove",()=>{const {shape:a}=this,{currentPoint:d,previousPoint:k}=this.app.inputs;yd.isEqual(k,d)||this.addNextPoint(yd.sub(d,a.props.point).concat(d[2]))});gb(this,"onPointerUp",()=>{if(!this.shape)throw Error("Expected a creating shape.");this.app.history.resume();this.shape.update({isComplete:!0,
points:this.tool.simplify?Fk.simplify2(this.points,this.tool.simplifyTolerance):this.shape.props.points});this.tool.previousShape=this.shape;this.tool.transition("idle");let a=this.app.selectedTool.id;"pencil"===a||"highlighter"===a?this.persistDebounced():this.app.persist()});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":if(!this.shape)throw Error("Expected a creating shape.");this.app.deleteShapes([this.shape]);this.tool.transition("idle")}})}addNextPoint(a){const {shape:d}=this,k=yd.min(a,
[0,0]);this.points.push(a);0>k[0]||0>k[1]?(this.points=this.points.map(K=>yd.sub(K,k).concat(K[2])),d.update({point:yd.add(d.props.point,k),points:this.points})):d.update({points:this.points})}};gb(vz,"id","creating");var wz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};
gb(wz,"id","idle");var xz=class extends Xh{constructor(){super(...arguments);gb(this,"origin",[0,0]);gb(this,"prevDelta",[0,0]);gb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};gb(xz,"id","pinching");var xt=class extends Xp{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"simplify",!0);gb(this,"simplifyTolerance",
1);gb(this,"previousShape");gb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};gb(xt,"id","draw");gb(xt,"states",[wz,vz,xz]);gb(xt,"initial","idle");var yz=class extends Xh{constructor(){super(...arguments);gb(this,"points",[[0,0,.5]]);gb(this,"hitShapes",new Set);gb(this,"onEnter",()=>{const {originPoint:a}=this.app.inputs;this.points=[a];this.hitShapes.clear()});gb(this,"onPointerMove",()=>{const {currentPoint:a,previousPoint:d}=this.app.inputs;yd.isEqual(d,a)||(this.points.push(a),
this.app.shapesInViewport.filter(k=>k.hitTestLineSegment(d,a)).forEach(k=>this.hitShapes.add(k)),this.app.setErasingShapes(Array.from(this.hitShapes.values())))});gb(this,"onPointerUp",()=>{this.app.deleteShapes(Array.from(this.hitShapes.values()));this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.setErasingShapes([]),this.tool.transition("idle")}})}};gb(yz,"id","erasing");var zz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",
(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(zz,"id","idle");var Az=class extends Xh{constructor(){super(...arguments);gb(this,"onEnter",()=>{const {currentPoint:a}=this.app.inputs;this.app.setErasingShapes(this.app.shapesInViewport.filter(d=>
d.hitTestPoint(a)))});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&(this.tool.transition("erasing"),this.app.setSelectedShapes([]))});gb(this,"onPointerUp",()=>{const a=[...this.app.erasingShapes];this.app.setErasingShapes([]);this.app.deleteShapes(a);this.tool.transition("idle")})}};gb(Az,"id","pointing");var $u=class extends Xp{constructor(){super(...arguments);gb(this,"cursor","crosshair")}};gb($u,"id","erase");gb($u,"states",[zz,Az,yz]);gb($u,
"initial","idle");var Xw=class extends Xh{constructor(){super(...arguments);gb(this,"handle",{});gb(this,"handleId","end");gb(this,"currentShape",{});gb(this,"initialShape",{});gb(this,"bindableShapeIds",[]);gb(this,"startBindingShapeId");gb(this,"newStartBindingId","");gb(this,"draggedBindingId","");gb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,previousPoint:d,originPoint:k,currentPoint:K,modKey:da,altKey:ja},settings:{snapToGrid:ra}}=this.app;var Ja=this.app.getShapeById(this.initialShape.id),
{handles:Ra}=this.initialShape,$a=this.handleId,fb="start"===this.handleId?"end":"start";if(!be.isEqual(d,K)){var jb=be.sub(K,k);if(a){var Jb=Ra[fb].point,Ob=be.add(Ra[$a].point,jb),Kb=be.angle(Jb,Ob);Jb=be.rotWith(Ob,Jb,Ml.snapAngleToSegments(Kb,24)-Kb);jb=be.add(jb,be.sub(Jb,Ob))}jb=be.add(Ra[$a].point,jb);Ra={[$a]:ff(Zd({},Ra[$a]),{point:ra?be.snap(jb,8):be.toFixed(jb),bindingId:void 0})};var gc=this.currentShape.getHandlesChange(this.initialShape,Ra);if(gc){Ra=Vl(Ja.props,gc);var rc={},Wb;$a=
Ra.handles[$a];fb=Ra.handles[fb];if(this.startBindingShapeId){var kc;if(jb=this.app.getShapeById(this.startBindingShapeId)){Ob=jb.getCenter();Jb=Ra.handles.end;var hc=be.add(Ra.handles.start.point,Ra.point);be.isEqual(hc,Ob)&&hc[1]++;Kb=jb.hitTestPoint(K);hc=be.uni(be.sub(hc,Ob));const Fc=void 0!==this.app.currentPage.bindings[this.newStartBindingId];da||jb.hitTestPoint(be.add(Ra.point,Jb.point))||(kc=Hc(Ja.props,jb,"start",this.newStartBindingId,Ob,Ob,hc,Kb));kc&&!Fc?(rc[this.newStartBindingId]=
kc,Ra.handles.start.bindingId=kc.id):!kc&&Fc&&(console.log("removing start binding"),delete rc[this.newStartBindingId],Ra.handles.start.bindingId=void 0)}}if(!da){kc=be.add(fb.point,Ra.point);fb=be.add($a.point,Ra.point);$a=be.uni(be.sub(fb,kc));const Fc=be.add(Ra.point,Ra.handles.start.point),Lc=be.add(Ra.point,Ra.handles.end.point);jb=this.bindableShapeIds.map(ud=>this.app.getShapeById(ud)).sort((ud,Jd)=>Jd.nonce-ud.nonce).filter(ud=>![Fc,Lc].every(Jd=>ud.hitTestPoint(Jd)));for(const ud of jb)if(Wb=
Hc(Ja.props,ud,this.handleId,this.draggedBindingId,fb,kc,$a,ja))break}Wb?(rc[this.draggedBindingId]=Wb,Ra=Vl(Ra,{handles:{[this.handleId]:{bindingId:this.draggedBindingId}}})):(Ja=Ja.props.handles[this.handleId].bindingId,void 0!==Ja&&(delete rc[Ja],Ra=Vl(Ra,{handles:{[this.handleId]:{bindingId:void 0}}})));gc=this.currentShape.getHandlesChange(Ra,Ra.handles);Gc(()=>{var Fc;if(gc){this.currentShape.update(gc);this.app.currentPage.updateBindings(rc);const Lc=Object.values(null!=(Fc=gc.handles)?Fc:
{}).map(ud=>ud.bindingId).map(ud=>this.app.currentPage.bindings[ud]).filter(Boolean).flatMap(ud=>[ud.toId,ud.fromId].filter(Boolean));this.app.setBindingShapes(Lc)}})}}});gb(this,"onPointerUp",()=>{this.tool.transition("idle");this.currentShape&&this.app.setSelectedShapes([this.currentShape]);this.app.transition("select");this.app.persist()});gb(this,"onExit",()=>{this.app.clearBindingShape();this.app.history.resume();this.app.persist()});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.deleteShapes([this.currentShape]),
this.tool.transition("idle")}})}};gb(Xw,"id","creating");var Bz=class extends Xw{constructor(){super(...arguments);gb(this,"onEnter",()=>{var a;this.app.history.pause();this.newStartBindingId=qk();this.draggedBindingId=qk();this.bindableShapeIds=this.app.currentPage.getBindableShapes();var {Shape:d}=this.tool;const {originPoint:k}=this.app.inputs;d=new d(ff(Zd({},d.defaultProps),{id:qk(),type:d.id,parentId:this.app.currentPage.id,point:this.app.settings.snapToGrid?be.snap(k,8):k,fill:this.app.settings.color,
stroke:this.app.settings.color,scaleLevel:this.app.settings.scaleLevel}));this.initialShape=jc(d.props);this.currentShape=d;this.app.currentPage.addShapes(d);this.app.setSelectedShapes([d]);if(this.startBindingShapeId=null==(a=this.bindableShapeIds.map(K=>this.app.getShapeById(K)).filter(K=>Fk.pointInBounds(k,K.bounds))[0])?void 0:a.id)this.bindableShapeIds.splice(this.bindableShapeIds.indexOf(this.startBindingShapeId),1),this.app.setBindingShapes([this.startBindingShapeId])})}};gb(Bz,"id","creating");
var Cz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});gb(this,"onPointerEnter",a=>{if(!a.order)switch(a.type){case "shape":this.app.setHoveredShape(a.shape.id);
break;case "selection":"background"!==a.handle&&"center"!==a.handle&&this.tool.transition("hoveringSelectionHandle",a)}});gb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)})}};gb(Cz,"id","idle");var Dz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))})}};
gb(Dz,"id","pointing");var av=class extends Xp{constructor(){super(...arguments);gb(this,"cursor","crosshair")}};gb(av,"id","line");gb(av,"states",[Cz,Dz,Bz]);gb(av,"initial","idle");var Ez=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"creatingShape");gb(this,"aspectRatio");gb(this,"initialBounds",{});gb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d}}=this.app,{Shape:k}=this.tool,K=new k({id:qk(),type:k.id,parentId:a.id,point:[...d],text:"",
size:[16,32],isSizeLocked:!0,fill:this.app.settings.color,stroke:this.app.settings.color});this.creatingShape=K;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);Gc(()=>{this.app.currentPage.addShapes(K);const da=this.app.settings.snapToGrid?be.snap([...d],8):d,{bounds:ja}=K;K.update({point:be.sub(da,[ja.width/2,ja.height/2])});this.app.transition("select");this.app.setSelectedShapes([K]);this.app.currentState.transition("editingShape",{type:"shape",shape:this.creatingShape,order:0})})})}};
gb(Ez,"id","creating");var Fz=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(Fz,"id","idle");var bv=class extends Xp{constructor(){super(...arguments);
gb(this,"cursor","crosshair")}};gb(bv,"id","box");gb(bv,"states",[Fz,Ez]);gb(bv,"initial","idle");var pE=Kf(zD()),qE=class extends pE.default{constructor(){super(...arguments);gb(this,"toBBox",a=>a.rotatedBounds)}},Gz=class extends Xh{constructor(){super(...arguments);gb(this,"initialSelectedIds",[]);gb(this,"initialSelectedShapes",[]);gb(this,"tree",new qE);gb(this,"onEnter",()=>{const {selectedShapes:a,currentPage:d,selectedIds:k}=this.app;this.initialSelectedIds=Array.from(k.values());this.initialSelectedShapes=
Array.from(a.values());this.tree.load(d.shapes)});gb(this,"onExit",()=>{this.initialSelectedIds=[];this.tree.clear();this.app.setBrush(void 0)});gb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,ctrlKey:d,originPoint:k,currentPoint:K}}=this.app,da=sf.getBoundsFromPoints([K,k],0);this.app.setBrush(da);const ja=[...(new Set(this.tree.search(da).filter(ra=>d?sf.boundsContain(da,ra.rotatedBounds):ra.hitTestBounds(da)).filter(ra=>"group"!==ra.type).map(ra=>{var Ja;return null!=(Ja=this.app.getParentGroup(ra))?
Ja:ra})))];a?ja.every(ra=>this.initialSelectedShapes.includes(ra))?this.app.setSelectedShapes(this.initialSelectedShapes.filter(ra=>!ja.includes(ra))):this.app.setSelectedShapes([...(new Set([...this.initialSelectedShapes,...ja]))]):this.app.setSelectedShapes(ja);this.app.viewport.panToPointWhenNearBounds(K)});gb(this,"onPointerUp",()=>{this.app.setBrush(void 0);this.tool.transition("idle")});gb(this,"handleModifierKey",(a,d)=>{switch(d.key){case "Escape":this.app.setBrush(void 0),this.app.setSelectedShapes(this.initialSelectedIds),
this.tool.transition("idle")}})}};gb(Gz,"id","brushing");var Hz=class extends Xh{constructor(){super(...arguments);gb(this,"onEnter",a=>{var d;const {selectedIds:k,inputs:{shiftKey:K}}=this.app;if("shape"===a.type&&!k.has(a.shape.id)){const da=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;K?this.app.setSelectedShapes([...Array.from(k.values()),da.id]):this.app.setSelectedShapes([da])}});gb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};gb(Hz,"id","contextMenu");var Iz=class extends Xh{constructor(){super(...arguments);
gb(this,"onEnter",a=>{"pinching"===a.fromId&&this.parent.returnTo&&this.app.transition(this.parent.returnTo)});gb(this,"onExit",()=>{});gb(this,"onPointerEnter",a=>{if(!a.order)switch(a.type){case "shape":this.app.setHoveredShape(a.shape.id);break;case "selection":"background"!==a.handle&&"center"!==a.handle&&this.tool.transition("hoveringSelectionHandle",a);break;case "canvas":this.app.setHoveredShape(void 0)}});gb(this,"onPointerDown",(a,d)=>{const {selectedShapes:k,inputs:{ctrlKey:K}}=this.app;
if(2===d.button)this.tool.transition("contextMenu",a);else if(K)this.tool.transition("pointingCanvas");else switch(a.type){case "selection":switch(a.handle){case "center":break;case "background":this.tool.transition("pointingBoundsBackground");break;case "rotate":this.tool.transition("pointingRotateHandle");break;default:this.tool.transition("pointingResizeHandle",a)}break;case "shape":if(k.has(a.shape))this.tool.transition("pointingSelectedShape",a);else{const {selectionBounds:da,inputs:ja}=this.app;
da&&Fk.pointInBounds(ja.currentPoint,da)?this.tool.transition("pointingShapeBehindBounds",a):this.tool.transition("pointingShape",a)}break;case "handle":this.tool.transition("pointingHandle",a);break;case "canvas":this.tool.transition("pointingCanvas");break;case "minimap":this.tool.transition("pointingMinimap",Zd(Zd({},d),a))}});gb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",
{info:a,event:d})});gb(this,"onDoubleClick",a=>{if(!a.order&&1===this.app.selectedShapesArray.length&&!this.app.readOnly){var d=this.app.selectedShapesArray[0];if(d.canEdit&&!d.props.isLocked)switch(a.type){case "shape":this.tool.transition("editingShape",a);break;case "selection":1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:d})}}});gb(this,"onKeyDown",(a,d)=>{({selectedShapesArray:a}=this.app);switch(d.key){case "Enter":1===a.length&&a[0].canEdit&&
!this.app.readOnly&&this.tool.transition("editingShape",{type:"shape",shape:a[0],order:0});break;case "Escape":a.length&&this.app.setSelectedShapes([])}})}};gb(Iz,"id","idle");var Jz=class extends Xh{constructor(){super(...arguments);gb(this,"onEnter",a=>{var d;const {selectedIds:k,inputs:{shiftKey:K}}=this.app,da=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;K?this.app.setSelectedShapes([...Array.from(k.values()),da.id]):this.app.setSelectedShapes([da])});gb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});gb(this,"onPointerUp",()=>{this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(Jz,"id","pointingShape");var Kz=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","move");gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
gb(this,"onPointerUp",()=>{this.app.setSelectedShapes([]);this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(Kz,"id","pointingBoundsBackground");var Lz=class extends Xh{constructor(){super(...arguments);gb(this,"onEnter",()=>{var a;const {shiftKey:d}=this.app.inputs;d||(this.app.setSelectedShapes([]),this.app.setEditingShape(),null==(a=window.getSelection())?void 0:a.removeAllRanges())});gb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("brushing")});gb(this,"onPointerUp",()=>{this.app.inputs.shiftKey||this.app.setSelectedShapes([]);this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onDoubleClick",()=>{this.app.notify("canvas-dbclick",{point:this.app.inputs.originPoint})})}};gb(Lz,"id","pointingCanvas");var Mz=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","move");gb(this,
"isCloning",!1);gb(this,"didClone",!1);gb(this,"initialPoints",{});gb(this,"initialShapePoints",{});gb(this,"initialClonePoints",{});gb(this,"clones",[]);gb(this,"onEnter",()=>{var a;this.app.history.pause();const {allSelectedShapesArray:d,inputs:k}=this.app;this.initialPoints=this.initialShapePoints=Object.fromEntries(d.map(({id:K,props:{point:da}})=>[K,da.slice()]));document.querySelectorAll("input,textarea").forEach(K=>K.blur());null==(a=document.getSelection())?void 0:a.empty();k.altKey?this.startCloning():
this.moveSelectedShapesToPointer()});gb(this,"onExit",()=>{this.app.history.resume();this.isCloning=this.didClone=!1;this.clones=[];this.initialPoints={};this.initialShapePoints={};this.initialClonePoints={}});gb(this,"onPointerMove",()=>{const {inputs:{currentPoint:a}}=this.app;this.moveSelectedShapesToPointer();this.app.viewport.panToPointWhenNearBounds(a)});gb(this,"onPointerDown",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onPointerUp",()=>{this.app.history.resume();
this.app.persist();this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Alt":this.startCloning();break;case "Escape":this.app.allSelectedShapes.forEach(k=>{k.update({point:this.initialPoints[k.id]})}),this.tool.transition("idle")}});gb(this,"onKeyUp",(a,d)=>{switch(d.key){case "Alt":if(!this.isCloning)throw Error("Expected to be cloning.");const {currentPage:k,allSelectedShapes:K}=this.app;k.removeShapes(...K);this.initialPoints=this.initialShapePoints;this.app.setSelectedShapes(Object.keys(this.initialPoints));
this.moveSelectedShapesToPointer();this.isCloning=!1}})}moveSelectedShapesToPointer(){const {inputs:{shiftKey:a,originPoint:d,currentPoint:k}}=this.app,{initialPoints:K}=this,da=yd.sub(k,d);a&&(Math.abs(da[0])<Math.abs(da[1])?da[0]=0:da[1]=0);Gc(()=>{this.app.allSelectedShapesArray.filter(ja=>!ja.props.isLocked).forEach(ja=>{let ra=yd.add(K[ja.id],da);this.app.settings.snapToGrid&&(ra=yd.snap(ra,8));ja.update({point:ra})})})}startCloning(){this.didClone||(this.clones=this.app.allSelectedShapesArray.map(a=>
{const d=this.app.getShapeClass(a.type);if(!d)throw Error("Could not find that shape class.");return new d(ff(Zd({},a.serialized),{id:qk(),type:a.type,point:this.initialPoints[a.id],rotation:a.props.rotation,isLocked:!1}))}),this.initialClonePoints=Object.fromEntries(this.clones.map(({id:a,props:{point:d}})=>[a,d.slice()])),this.didClone=!0);this.app.allSelectedShapes.forEach(a=>{a.update({point:this.initialPoints[a.id]})});this.initialPoints=this.initialClonePoints;this.app.currentPage.addShapes(...this.clones);
this.app.setSelectedShapes(Object.keys(this.initialClonePoints));this.moveSelectedShapesToPointer();this.isCloning=!0}};gb(Mz,"id","translating");var Nz=class extends Xh{constructor(){super(...arguments);gb(this,"pointedSelectedShape");gb(this,"onEnter",a=>{this.pointedSelectedShape=a.shape});gb(this,"onExit",()=>{this.pointedSelectedShape=void 0});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
gb(this,"onPointerUp",()=>{const {shiftKey:a,currentPoint:d}=this.app.inputs;var {selectedShapesArray:k}=this.app;if(!this.pointedSelectedShape)throw Error("Expected a pointed selected shape");if(a)({selectedIds:k}=this.app),k=Array.from(k.values()),k.splice(k.indexOf(this.pointedSelectedShape.id),1),this.app.setSelectedShapes(k);else{if(1===k.length&&this.pointedSelectedShape.canEdit&&!this.app.readOnly&&!this.pointedSelectedShape.props.isLocked&&this.pointedSelectedShape instanceof fm&&Fk.pointInBounds(d,
this.pointedSelectedShape.bounds)){this.tool.transition("editingShape",{shape:this.pointedSelectedShape,order:0,type:"shape"});return}this.app.setSelectedShapes([this.pointedSelectedShape.id])}this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(Nz,"id","pointingSelectedShape");var Oz=class extends Xh{constructor(){super(...arguments);gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a;this.updateCursor()});gb(this,"onExit",()=>{this.app.cursors.reset()});
gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("resizing",this.info)});gb(this,"onPointerUp",()=>{this.tool.transition("hoveringSelectionHandle",this.info)});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(Qu[this.info.handle],this.app.selectionBounds.rotation)}};gb(Oz,"id","pointingResizeHandle");var Pz=class extends Xh{constructor(){super(...arguments);
gb(this,"isSingle",!1);gb(this,"handle","bottom_right_corner");gb(this,"snapshots",{});gb(this,"initialCommonBounds",{});gb(this,"selectionRotation",0);gb(this,"resizeType","corner");gb(this,"onEnter",a=>{var d,k;const {history:K,selectedShapesArray:da,selectionBounds:ja}=this.app;if(!ja)throw Error("Expected a selected bounds.");this.handle=a.handle;this.resizeType="left_edge"===a.handle||"right_edge"===a.handle?"horizontal-edge":"top_edge"===a.handle||"bottom_edge"===a.handle?"vertical-edge":"corner";
this.app.cursors.setCursor(Pz.CURSORS[a.handle],null==(d=this.app.selectionBounds)?void 0:d.rotation);K.pause();const ra=sf.getBoundsFromPoints(da.map(Ja=>sf.getBoundsCenter(Ja.bounds)));this.selectionRotation=(this.isSingle=1===da.length)?null!=(k=da[0].props.rotation)?k:0:0;this.initialCommonBounds=Zd({},ja);this.snapshots=Object.fromEntries(da.map(Ja=>{const Ra=Zd({},Ja.bounds),[$a,fb]=sf.getBoundsCenter(Ra);return[Ja.id,{props:Ja.serialized,bounds:Ra,transformOrigin:[($a-this.initialCommonBounds.minX)/
this.initialCommonBounds.width,(fb-this.initialCommonBounds.minY)/this.initialCommonBounds.height],innerTransformOrigin:[($a-ra.minX)/ra.width,(fb-ra.minY)/ra.height],isAspectRatioLocked:Ja.props.isAspectRatioLocked||!(Ja.canChangeAspectRatio&&!Ja.props.rotation)}]}));da.forEach(Ja=>{var Ra;null==(Ra=Ja.onResizeStart)?void 0:Ra.call(Ja,{isSingle:this.isSingle})})});gb(this,"onExit",()=>{this.app.cursors.reset();this.snapshots={};this.initialCommonBounds={};this.selectionRotation=0;this.app.history.resume()});
gb(this,"onPointerMove",()=>{const {inputs:{altKey:a,shiftKey:d,ctrlKey:k,originPoint:K,currentPoint:da}}=this.app,{handle:ja,snapshots:ra,initialCommonBounds:Ja}=this;let Ra=yd.sub(da,K);a&&(Ra=yd.mul(Ra,2));const $a=this.app.selectedShapes.values().next().value;let fb=sf.getTransformedBoundingBox(Ja,ja,Ra,this.selectionRotation,d||this.isSingle&&(k?!("clipping"in $a.props):!$a.canChangeAspectRatio||$a.props.isAspectRatioLocked));a&&(fb=Zd(Zd({},fb),sf.centerBounds(fb,sf.getBoundsCenter(Ja))));const {scaleX:jb,
scaleY:Jb}=fb;this.app.selectedShapes.forEach(Ob=>{var Kb,gc;const {isAspectRatioLocked:rc,props:Wb,bounds:kc,transformOrigin:hc}=ra[Ob.id];let Fc=sf.getRelativeTransformedBoundingBox(fb,Ja,kc,0>jb,0>Jb);if(Ob.canResize.some(Jd=>Jd)||Ob.props.isSizeLocked||!this.isSingle){var Lc=[jb,Jb],ud=null!=(Kb=Wb.rotation)?Kb:0;Kb=sf.getBoundsCenter(Fc);Ob.canFlip||(Lc=yd.abs(Lc));Ob.canScale||(Lc=null!=(gc=Wb.scale)?gc:[1,1]);if(ud&&0>jb&&0<=Jb||0>Jb&&0<=jb)ud*=-1;this.app.settings.snapToGrid&&!rc&&(Fc=sf.snapBoundsToGrid(Fc,
8));Ob.onResize(Wb,{center:Kb,rotation:ud,scale:Lc,bounds:Fc,type:ja,clip:k,transformOrigin:hc})}});this.updateCursor(jb,Jb);this.app.viewport.panToPointWhenNearBounds(da)});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(k=>{k.update(Zd({},this.snapshots[k.id].props))}),this.tool.transition("idle")}})}updateCursor(a,d){var k,K,da,ja;const ra=0>a&&0<=d;a=0>
d&&0<=a;switch(this.handle){case "top_left_corner":case "bottom_right_corner":ra||a?"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(k=this.app.selectionBounds)?void 0:k.rotation):"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==(K=this.app.selectionBounds)?void 0:K.rotation);break;case "top_right_corner":case "bottom_left_corner":ra||a?"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==
(da=this.app.selectionBounds)?void 0:da.rotation):"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(ja=this.app.selectionBounds)?void 0:ja.rotation)}}},Yw=Pz;gb(Yw,"id","resizing");gb(Yw,"CURSORS",{bottom_edge:"ns-resize",top_edge:"ns-resize",left_edge:"ew-resize",right_edge:"ew-resize",bottom_left_corner:"nesw-resize",bottom_right_corner:"nwse-resize",top_left_corner:"nwse-resize",top_right_corner:"nesw-resize"});var Qz=class extends Xh{constructor(){super(...arguments);
gb(this,"cursor","rotate");gb(this,"handle","");gb(this,"onEnter",a=>{this.app.history.pause();this.handle=a.handle;this.updateCursor()});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("rotating",{handle:this.handle})});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(Qu[this.handle],
this.app.selectionRotation)}};gb(Qz,"id","pointingRotateHandle");var Rz=class extends Xh{constructor(){super(...arguments);gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});gb(this,"onPointerUp",()=>{const {selectedIds:a,inputs:{shiftKey:d}}=this.app;d?this.app.setSelectedShapes([...Array.from(a.values()),this.info.shape.id]):this.app.setSelectedShapes([this.info.shape.id]);
this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(Rz,"id","pointingShapeBehindBounds");var Zw=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","rotate");gb(this,"snapshot",{});gb(this,"initialCommonCenter",[0,0]);gb(this,"initialCommonBounds",{});gb(this,"initialAngle",0);gb(this,"initialSelectionRotation",0);gb(this,"handle","");gb(this,"onEnter",a=>{const {history:d,selectedShapesArray:k,selectionBounds:K}=this.app;
if(!K)throw Error("Expected selected bounds.");d.pause();this.handle=a.handle;this.initialSelectionRotation=this.app.selectionRotation;this.initialCommonBounds=Zd({},K);this.initialCommonCenter=sf.getBoundsCenter(K);this.initialAngle=yd.angle(this.initialCommonCenter,this.app.inputs.currentPoint);this.snapshot=Object.fromEntries(k.map(da=>[da.id,{point:[...da.props.point],center:[...da.center],rotation:da.props.rotation,handles:"handles"in da?ir(da.handles):void 0}]));this.updateCursor()});gb(this,
"onExit",()=>{this.app.history.resume();this.snapshot={}});gb(this,"onPointerMove",()=>{const {selectedShapes:a,inputs:{shiftKey:d,currentPoint:k}}=this.app,{snapshot:K,initialCommonCenter:da,initialAngle:ja,initialSelectionRotation:ra}=this;let Ja=yd.angle(da,k)-ja;d&&(Ja=Ml.snapAngleToSegments(Ja,24));a.forEach($a=>{var fb=K[$a.id];let jb=0;if(d){var {rotation:Jb=0}=fb;jb=Ml.snapAngleToSegments(Jb,24)-Jb}const Ob=yd.sub(fb.center,fb.point);Jb=yd.rotWith(fb.center,da,Ja);if("handles"in $a){fb=fb.handles;
const Kb=fb.map(rc=>yd.rotWith(rc.point,Ob,Ja)),gc=sf.getCommonTopLeft(Kb);$a.update({point:yd.add(gc,yd.sub(Jb,Ob)),handles:fb.map((rc,Wb)=>ff(Zd({},rc),{point:yd.sub(Kb[Wb],gc)}))})}else $a.update({point:yd.sub(Jb,Ob),rotation:Ml.clampRadians((fb.rotation||0)+Ja+jb)})});const Ra=Ml.clampRadians(ra+Ja);this.app.setSelectionRotation(d?Ml.snapAngleToSegments(Ra,24):Ra);this.updateCursor()});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,
"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(k=>{k.update(this.snapshot[k.id])}),this.tool.transition("idle")}})}updateCursor(){this.app.cursors.setCursor(Qu[this.handle],this.app.selectionRotation)}};gb(Zw,"id","rotating");var Sz=class extends Xh{constructor(){super(...arguments);gb(this,"onPinch",(a,d)=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")});gb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};
gb(Sz,"id","pinching");var Tz=class extends Xw{constructor(){super(...arguments);gb(this,"cursor","grabbing");gb(this,"onEnter",a=>{this.app.history.pause();this.newStartBindingId=qk();this.draggedBindingId=qk();this.bindableShapeIds=this.app.currentPage.getBindableShapes();this.handleId=a.id;this.currentShape=a.shape;this.initialShape=jc(this.currentShape.props);this.app.setSelectedShapes([this.currentShape])})}};gb(Tz,"id","translatingHandle");var Uz=class extends Xh{constructor(){super(...arguments);
gb(this,"cursor","grabbing");gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("translatingHandle",this.info)});gb(this,"onPointerUp",()=>{this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(Uz,"id","pointingHandle");var Vz=class extends Xh{constructor(){super(...arguments);gb(this,"handle");gb(this,"onEnter",
a=>{var d;this.app.cursors.setCursor(Qu[a.handle],null!=(d=this.app.selectionBounds.rotation)?d:0);this.handle=a.handle});gb(this,"onExit",()=>{this.app.cursors.reset()});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onPointerDown",a=>{switch(a.type){case "selection":switch(a.handle){case "center":break;case "background":break;case "top_left_resize_corner":case "top_right_resize_corner":case "bottom_right_resize_corner":case "bottom_left_resize_corner":this.tool.transition("pointingRotateHandle",
a);break;default:this.tool.transition("pointingResizeHandle",a)}}});gb(this,"onPointerLeave",()=>{this.tool.transition("idle")});gb(this,"onDoubleClick",a=>{var d;if(!a.order&&1===this.app.selectedShapes.size){var k=this.app.selectedShapes.values().next().value;if(!k.canEdit||this.app.readOnly||k.props.isLocked)k.onResetBounds({asset:k.props.assetId?this.app.assets[k.props.assetId]:void 0,zoom:this.app.viewport.camera.zoom}),this.tool.transition("idle");else switch(a.type){case "shape":this.tool.transition("editingShape",
a);break;case "selection":null==(d=k.onResetBounds)?void 0:d.call(k,{zoom:this.app.viewport.camera.zoom}),1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:k})}}})}};gb(Vz,"id","hoveringSelectionHandle");var Wz=class extends Xh{constructor(){super(...arguments);gb(this,"editingShape",{});gb(this,"onEnter",a=>{this.editingShape=a.shape;this.app.setEditingShape(a.shape)});gb(this,"onExit",()=>{var a;if(this.editingShape&&"text"in this.editingShape.props){const d=
this.editingShape.props.text.trim();""===d&&"text"===this.editingShape.props.type?this.app.deleteShapes([this.editingShape]):(this.editingShape.onResetBounds(),this.editingShape.update({text:d}))}this.app.persist();this.app.setEditingShape();null==(a=document.querySelector(".tl-canvas"))?void 0:a.focus()});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onPointerDown",a=>{switch(a.type){case "shape":if(a.shape===this.editingShape)break;this.tool.transition("idle",
a);break;case "canvas":a.order||this.tool.transition("idle",a)}});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":Gc(()=>{d.stopPropagation();this.app.setSelectedShapes([this.editingShape]);this.tool.transition("idle")})}})}};gb(Wz,"id","editingShape");var Xz=class extends Xh{constructor(){super(...arguments);gb(this,"minimapZoom",1);gb(this,"minimapRect",{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0});gb(this,"getCameraPoint",a=>{const d=document.querySelector(".tl-preview-minimap svg");
var k=document.querySelector(".tl-preview-minimap #minimap-camera-rect");if(d&&k){const K=d.getBoundingClientRect();this.minimapRect.height=K.height;this.minimapRect.width=K.width;this.minimapRect.minX=K.left;this.minimapRect.minY=K.top;this.minimapRect.maxX=K.right;this.minimapRect.maxY=K.bottom;this.minimapZoom=+d.dataset.commonBoundWidth/this.minimapRect.width;a=yd.sub(a,[this.minimapRect.minX,this.minimapRect.minY]);k=k.getBoundingClientRect();k=yd.mul(yd.sub(a,[k.left+k.width/2,k.top+k.height/
2]),this.minimapZoom);return yd.sub(this.app.viewport.camera.point,k)}});gb(this,"onEnter",a=>{(a=this.getCameraPoint([a.clientX,a.clientY]))?this.app.viewport.update({point:a}):this.tool.transition("idle")});gb(this,"onPointerMove",(a,d)=>{"clientX"in d&&(a=this.getCameraPoint([d.clientX,d.clientY]))&&this.app.viewport.update({point:a})});gb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};gb(Xz,"id","pointingMinimap");var is=class extends Xp{constructor(){super(...arguments);gb(this,"returnTo",
"");gb(this,"onEnter",a=>{this.returnTo=null==a?void 0:a.returnTo})}};gb(is,"id","select");gb(is,"initial","idle");gb(is,"shortcut","whiteboard/select");gb(is,"states",[Iz,Gz,Hz,Lz,Jz,Rz,Nz,Kz,Vz,Oz,Qz,Xz,Uz,Tz,Mz,Yw,Zw,Zw,Sz,Wz]);var Yz=class extends Xh{constructor(){super(...arguments);gb(this,"cursor","grabbing");gb(this,"originalScreenPoint",[]);gb(this,"originalCameraPoint",[]);gb(this,"prevState","idle");gb(this,"onEnter",a=>{this.prevState=null==a?void 0:a.prevState;this.originalScreenPoint=
this.app.inputs.currentScreenPoint;this.originalCameraPoint=this.app.viewport.camera.point});gb(this,"onPointerMove",(a,d)=>{a=be.sub(this.originalScreenPoint,this.app.inputs.currentScreenPoint);this.app.viewport.update({point:be.sub(this.originalCameraPoint,be.div(a,this.app.viewport.camera.zoom))})});gb(this,"onPointerUp",()=>{var a;this.tool.transition(null!=(a=this.prevState)?a:"idle")})}};gb(Yz,"id","panning");var Zz=class extends Xh{constructor(){super(...arguments);gb(this,"onEnter",a=>{this.parent.prevTool&&
a.exit&&(this.app.setCurrentState(this.parent.prevTool),setTimeout(()=>{this.app.cursors.reset();this.app.cursors.setCursor(this.parent.prevTool.cursor)}))});gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning")})}};gb(Zz,"id","idle");var $z=class extends Xh{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning",{prevState:"idleHold"})});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb($z,
"id","idleHold");var aA=class extends Xh{constructor(){super(...arguments);gb(this,"origin",[0,0]);gb(this,"prevDelta",[0,0]);gb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};gb(aA,"id","pinching");var js=class extends Xp{constructor(){super(...arguments);gb(this,"cursor","grab");gb(this,"prevTool",null);gb(this,"onEnter",a=>{this.prevTool=
null==a?void 0:a.prevTool});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});gb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};gb(js,"id","move");gb(js,"shortcut","whiteboard/pan");gb(js,"states",[Zz,$z,Yz,aA]);gb(js,"initial","idle");var gl=class{constructor(a,d={}){gb(this,"lastShapesNounces",null);gb(this,"app");gb(this,"id");gb(this,"name");gb(this,"shapes",[]);gb(this,"bindings",{});gb(this,"nonce",0);gb(this,"bringForward",
Ja=>{const Ra=this.parseShapesArg(Ja);Ra.sort(($a,fb)=>this.shapes.indexOf(fb)-this.shapes.indexOf($a)).map($a=>this.shapes.indexOf($a)).forEach($a=>{if($a!==this.shapes.length-1&&!Ra.includes(this.shapes[$a+1])){var fb=this.shapes[$a];this.shapes[$a]=this.shapes[$a+1];this.shapes[$a+1]=fb}});this.app.persist();return this});gb(this,"sendBackward",Ja=>{const Ra=this.parseShapesArg(Ja);Ra.sort(($a,fb)=>this.shapes.indexOf($a)-this.shapes.indexOf(fb)).map($a=>this.shapes.indexOf($a)).forEach($a=>{if(0!==
$a&&!Ra.includes(this.shapes[$a-1])){var fb=this.shapes[$a];this.shapes[$a]=this.shapes[$a-1];this.shapes[$a-1]=fb}});this.app.persist();return this});gb(this,"bringToFront",Ja=>{const Ra=this.parseShapesArg(Ja);this.shapes=this.shapes.filter($a=>!Ra.includes($a)).concat(Ra);this.app.persist();return this});gb(this,"sendToBack",Ja=>{const Ra=this.parseShapesArg(Ja);this.shapes=Ra.concat(this.shapes.filter($a=>!Ra.includes($a)));this.app.persist();return this});gb(this,"flip",(Ja,Ra)=>{Ja=this.parseShapesArg(Ja);
const $a=sf.getCommonBounds(Ja.map(fb=>fb.bounds));Ja.forEach(fb=>{var jb;const Jb=sf.getRelativeTransformedBoundingBox($a,$a,fb.bounds,"horizontal"===Ra,"vertical"===Ra);if(fb.serialized)fb.onResize(fb.serialized,{bounds:Jb,center:sf.getBoundsCenter(Jb),rotation:null!=(jb=fb.props.rotation)?jb:-0,type:"top_left_corner",scale:fb.canFlip&&fb.props.scale?"horizontal"===Ra?[-fb.props.scale[0],1]:[1,-fb.props.scale[1]]:[1,1],clip:!1,transformOrigin:[.5,.5]})});this.app.persist();return this});gb(this,
"getShapeById",Ja=>this.shapes.find(Ra=>Ra.id===Ja));gb(this,"cleanup",Ja=>{Ja=ac(this.bindings,Ja);const Ra=new Set;let $a=!1,fb=!1;const jb=ir(this.bindings);Ja.forEach(Jb=>{var Ob;if(this.bindings[Jb.id]){var Kb=this.getShapeById(Jb.toId),gc=this.getShapeById(Jb.fromId);Kb&&gc?Ra.has(gc.id)||(Jb=this.updateArrowBindings(gc),Ra.add(gc.id),Jb&&(Kb=Zd(Zd({},gc.props),Jb),$a=!0,null==(Ob=this.getShapeById(Kb.id))?void 0:Ob.update(Kb,!1,(0,HE.default)(null==Jb?void 0:Jb.handles,null==gc?void 0:gc.props.handles)))):
(delete jb[Jb.id],fb=!0)}});Object.keys(jb).forEach(Jb=>{const Ob=this.bindings[Jb];0===this.shapes.filter(Kb=>Kb.id===Ob.fromId||Kb.id===Ob.toId).length&&(delete jb[Jb],fb=!0)});fb&&this.update({bindings:jb});($a||fb)&&this.app.persist(!0)});gb(this,"updateArrowBindings",Ja=>{var Ra,$a,fb,jb={start:ir(Ja.props.handles.start),end:ir(Ja.props.handles.end)},Jb={isBound:!1,handle:Ja.props.handles.start,point:be.add(Ja.props.handles.start.point,Ja.props.point)},Ob={isBound:!1,handle:Ja.props.handles.end,
point:be.add(Ja.props.handles.end.point,Ja.props.point)};if(Ja.props.handles.start.bindingId){var Kb=void 0!==(null==(Ra=Ja.props.decorations)?void 0:Ra.start);Ra=Ja.props.handles.start;var gc=this.bindings[Ja.props.handles.start.bindingId],rc=this.getShapeById(null==gc?void 0:gc.toId);if(rc){Jb=rc.getBounds();var Wb=rc.getExpandedBounds(),kc=sf.expandBounds(Jb,Kb?gc.distance:1);const {minX:hc,minY:Fc,width:Lc,height:ud}=Wb,Jd=be.add([hc,Fc],be.mulV([Lc,ud],be.rotWith(gc.point,[.5,.5],rc.props.rotation||
0)));Jb={isBound:!0,hasDecoration:Kb,binding:gc,handle:Ra,point:Jd,target:rc,bounds:Jb,expandedBounds:Wb,intersectBounds:kc,center:rc.getCenter()}}}if(Ja.props.handles.end.bindingId&&(Kb=void 0!==(null==($a=Ja.props.decorations)?void 0:$a.end),$a=Ja.props.handles.end,Ra=this.bindings[Ja.props.handles.end.bindingId],gc=this.getShapeById(null==Ra?void 0:Ra.toId))){Ob=gc.getBounds();rc=gc.getExpandedBounds();Wb=Kb?sf.expandBounds(Ob,Ra.distance):Ob;const {minX:hc,minY:Fc,width:Lc,height:ud}=rc;kc=be.add([hc,
Fc],be.mulV([Lc,ud],be.rotWith(Ra.point,[.5,.5],gc.props.rotation||0)));Ob={isBound:!0,hasDecoration:Kb,binding:Ra,handle:$a,point:kc,target:gc,bounds:Ob,expandedBounds:rc,intersectBounds:Wb,center:gc.getCenter()}}for(const hc of["end","start"]){$a="start"===hc?Jb:Ob;const Fc="start"===hc?Ob:Jb;if($a.isBound)if($a.binding.distance){if(Kb=be.uni(be.sub($a.point,Fc.point)),Ra=z(Fc.point,Kb,$a.intersectBounds,$a.target.props.rotation).filter(Lc=>Lc.didIntersect).map(Lc=>Lc.points[0]).sort((Lc,ud)=>be.dist(Lc,
Fc.point)-be.dist(ud,Fc.point)),Ra[0])if(gc=void 0,Fc.isBound&&(gc=z(Fc.point,Kb,Fc.intersectBounds,Fc.target.props.rotation).filter(Lc=>Lc.didIntersect).map(Lc=>Lc.points[0]).sort((Lc,ud)=>be.dist(Lc,Fc.point)-be.dist(ud,Fc.point))[0]),Fc.isBound&&(2>Ra.length||gc&&Ra[0]&&10>Math.ceil(be.dist(Ra[0],gc))||sf.boundsContain($a.expandedBounds,Fc.expandedBounds)||sf.boundsCollide($a.expandedBounds,Fc.expandedBounds)))Kb=be.uni(be.sub(Fc.point,$a.point)),Ra=z($a.point,Kb,$a.bounds,$a.target.props.rotation).filter(Lc=>
Lc.didIntersect).map(Lc=>Lc.points[0]),Ra[0]&&(jb[hc].point=be.toFixed(be.sub(Ra[0],Ja.props.point)),jb["start"===hc?"end":"start"].point=be.toFixed(be.add(be.sub(Ra[0],Ja.props.point),be.mul(Kb,Math.min(be.dist(Ra[0],Fc.point),10*(sf.boundsContain(Fc.bounds,$a.intersectBounds)?-1:1))))));else{if(!Fc.isBound&&(Ra[0]&&10>be.dist(Ra[0],Fc.point)||Fk.pointInBounds(Fc.point,$a.intersectBounds)))return jb=be.uni(be.sub($a.center,Fc.point)),null==(fb=Ja.getHandlesChange)?void 0:fb.call(Ja,Ja.props,{[hc]:ff(Zd({},
Ja.props.handles[hc]),{point:be.toFixed(be.add(be.sub(Fc.point,Ja.props.point),be.mul(jb,10)))})});Ra[0]&&(jb[hc].point=be.toFixed(be.sub(Ra[0],Ja.props.point)))}}else jb[hc].point=be.sub($a.point,Ja.props.point)}return Ja.getHandlesChange(Ja.props,jb)});const {id:k,name:K,shapes:da=[],bindings:ja={},nonce:ra}=d;this.id=k;this.name=K;this.bindings=Object.assign({},ja);this.app=a;this.nonce=ra||0;this.addShapes(...da);Ue(this);ic(()=>{const Ja=0<this.shapes.length?Object.fromEntries(this.shapes.map(Ra=>
[Ra.id,Ra.nonce])):null;if(this.lastShapesNounces&&Ja){const Ra=this.lastShapesNounces,$a=[...(new Set([...Object.keys(Ja),...Object.keys(Ra)]))].filter(fb=>Ra[fb]!==Ja[fb]);requestAnimationFrame(()=>{this.cleanup($a)})}Ja&&(this.lastShapesNounces=Ja)})}get serialized(){return{id:this.id,name:this.name,shapes:this.shapes.map(a=>a.serialized).filter(a=>!!a).map(a=>jc(a)),bindings:ir(this.bindings),nonce:this.nonce}}get shapesById(){return Object.fromEntries(this.shapes.map(a=>[a.id,a]))}update(a){Object.assign(this,
a);return this}updateBindings(a){Object.assign(this.bindings,a);return this}updateShapesIndex(a){this.shapes.sort((d,k)=>a.indexOf(d.id)-a.indexOf(k.id));return this}addShapes(...a){if(0!==a.length)return a="getBounds"in a[0]?a:a.map(d=>new (this.app.getShapeClass(d.type))(d)),this.shapes.push(...a),a}parseShapesArg(a){return"string"===typeof a[0]?this.shapes.filter(d=>a.includes(d.id)):a}removeShapes(...a){const d=this.parseShapesArg(a);this.shapes=this.shapes.filter(k=>!d.includes(k));return d}getBindableShapes(){return this.shapes.filter(a=>
a.canBind).sort((a,d)=>d.nonce-a.nonce).map(a=>a.id)}};fe([yg],gl.prototype,"id",2);fe([yg],gl.prototype,"name",2);fe([yg],gl.prototype,"shapes",2);fe([yg],gl.prototype,"bindings",2);fe([Dg],gl.prototype,"serialized",1);fe([Dg],gl.prototype,"shapesById",1);fe([yg],gl.prototype,"nonce",2);fe([jg],gl.prototype,"update",1);fe([jg],gl.prototype,"updateBindings",1);fe([jg],gl.prototype,"updateShapesIndex",1);fe([jg],gl.prototype,"addShapes",1);fe([jg],gl.prototype,"removeShapes",1);fe([jg],gl.prototype,
"bringForward",2);fe([jg],gl.prototype,"sendBackward",2);fe([jg],gl.prototype,"bringToFront",2);fe([jg],gl.prototype,"sendToBack",2);fe([jg],gl.prototype,"cleanup",2);var Kj=class{constructor(){gb(this,"shiftKey",!1);gb(this,"ctrlKey",!1);gb(this,"modKey",!1);gb(this,"altKey",!1);gb(this,"spaceKey",!1);gb(this,"isPinching",!1);gb(this,"currentScreenPoint",[0,0]);gb(this,"currentPoint",[0,0]);gb(this,"previousScreenPoint",[0,0]);gb(this,"previousPoint",[0,0]);gb(this,"originScreenPoint",[0,0]);gb(this,
"originPoint",[0,0]);gb(this,"pointerIds",new Set);gb(this,"state","idle");gb(this,"containerOffset",[0,0]);gb(this,"onPointerDown",(a,d)=>{this.pointerIds.add(d.pointerId);this.updateModifiers(d);this.originScreenPoint=this.currentScreenPoint;this.originPoint=a;this.state="pointing"});gb(this,"onPointerMove",(a,d)=>{"pinching"!==this.state&&("panning"===this.state&&(this.state="idle"),this.updateModifiers(d),this.previousPoint=this.currentPoint,this.currentPoint=a)});gb(this,"onPointerUp",(a,d)=>
{this.pointerIds.clear();this.updateModifiers(d);this.state="idle"});gb(this,"onKeyDown",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!0}});gb(this,"onKeyUp",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!1}});gb(this,"onPinchStart",(a,d)=>{this.updateModifiers(d);this.state="pinching"});gb(this,"onPinch",(a,d)=>{"pinching"===this.state&&this.updateModifiers(d)});gb(this,"onPinchEnd",(a,d)=>{"pinching"===this.state&&(this.updateModifiers(d),this.state="idle")});
Ue(this)}updateContainerOffset(a){Object.assign(this.containerOffset,a)}updateModifiers(a){a.isPrimary&&("clientX"in a&&(this.previousScreenPoint=this.currentScreenPoint,this.currentScreenPoint=be.sub([a.clientX,a.clientY],this.containerOffset)),"shiftKey"in a&&(this.shiftKey=a.shiftKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.modKey=oh()?a.metaKey:a.ctrlKey))}};fe([yg],Kj.prototype,"shiftKey",2);fe([yg],Kj.prototype,"ctrlKey",2);fe([yg],Kj.prototype,"modKey",2);fe([yg],Kj.prototype,"altKey",
2);fe([yg],Kj.prototype,"spaceKey",2);fe([yg],Kj.prototype,"isPinching",2);fe([yg],Kj.prototype,"currentScreenPoint",2);fe([yg],Kj.prototype,"currentPoint",2);fe([yg],Kj.prototype,"previousScreenPoint",2);fe([yg],Kj.prototype,"previousPoint",2);fe([yg],Kj.prototype,"originScreenPoint",2);fe([yg],Kj.prototype,"originPoint",2);fe([yg],Kj.prototype,"state",2);fe([yg],Kj.prototype,"containerOffset",2);fe([jg],Kj.prototype,"updateContainerOffset",1);fe([jg],Kj.prototype,"updateModifiers",1);fe([jg],Kj.prototype,
"onPointerDown",2);fe([jg],Kj.prototype,"onPointerMove",2);fe([jg],Kj.prototype,"onPointerUp",2);fe([jg],Kj.prototype,"onKeyDown",2);fe([jg],Kj.prototype,"onKeyUp",2);fe([jg],Kj.prototype,"onPinchStart",2);fe([jg],Kj.prototype,"onPinch",2);fe([jg],Kj.prototype,"onPinchEnd",2);var rE=(a,d=100)=>-(Math.cos(Math.PI*yd.clamp(a/d,0,1))-1)/2,hr=class{constructor(){gb(this,"bounds",{minX:0,minY:0,maxX:1080,maxY:720,width:1080,height:720});gb(this,"camera",{point:[0,0],zoom:1});gb(this,"updateBounds",a=>
{this.bounds=a;return this});gb(this,"panCamera",a=>this.update({point:yd.sub(this.camera.point,yd.div(a,this.camera.zoom))}));gb(this,"panToPointWhenNearBounds",a=>{const d=yd.div([hr.panThreshold,hr.panThreshold],this.camera.zoom),k=yd.sub([this.currentView.maxX,this.currentView.maxY],yd.add(a,d));a=yd.sub([this.currentView.minX,this.currentView.minY],yd.sub(a,d));this.panCamera(yd.mul([0>k[0]?k[0]:0<a[0]?a[0]:0,0>k[1]?k[1]:0<a[1]?a[1]:0],-hr.panMultiplier*this.camera.zoom))});gb(this,"update",
({point:a,zoom:d})=>{void 0===a||isNaN(a[0])||isNaN(a[1])||(this.camera.point=a);void 0===d||isNaN(d)||(this.camera.zoom=Math.min(4,Math.max(.1,d)));return this});gb(this,"getPagePoint",a=>{const {camera:d,bounds:k}=this;return yd.sub(yd.div(yd.sub(a,[k.minX,k.minY]),d.zoom),d.point)});gb(this,"getScreenPoint",a=>{const {camera:d}=this;return yd.mul(yd.add(a,d.point),d.zoom)});gb(this,"onZoom",(a,d,k=!1)=>this.pinchZoom(a,[0,0],d,k));gb(this,"pinchZoom",(a,d,k,K=!1)=>{var {camera:da}=this;d=yd.sub(da.point,
yd.div(d,da.zoom));k=yd.clamp(k,hr.minZoom,hr.maxZoom);da=yd.div(a,da.zoom);a=yd.div(a,k);a=yd.toFixed(yd.add(d,yd.sub(a,da)));K?this.animateCamera({point:a,zoom:k}):this.update({point:a,zoom:k});return this});gb(this,"setZoom",(a,d=!1)=>{const {bounds:k}=this;this.onZoom([k.width/2,k.height/2],a,d)});gb(this,"zoomIn",()=>{const {camera:a}=this;this.setZoom(a.zoom/.8,!0)});gb(this,"zoomOut",()=>{const {camera:a}=this;this.setZoom(.8*a.zoom,!0)});gb(this,"resetZoom",()=>{this.setZoom(1,!0);return this});
gb(this,"animateCamera",({point:a,zoom:d})=>this.animateToViewport({minX:-a[0],minY:-a[1],maxX:this.bounds.width/d-a[0],maxY:this.bounds.height/d-a[1],width:this.bounds.width/d,height:this.bounds.height/d}));gb(this,"animateToViewport",a=>{const d=performance.now(),k=Zd({},this.currentView),K=()=>{var da=performance.now()-d;da=rE(da);var ja=k.minX+(a.minX-k.minX)*da;this.update({point:[-ja,-(k.minY+(a.minY-k.minY)*da)],zoom:this.bounds.width/(k.maxX+(a.maxX-k.maxX)*da-ja)});1>da&&requestAnimationFrame(K)};
K()});gb(this,"zoomToBounds",({width:a,height:d,minX:k,minY:K})=>{const {bounds:da,camera:ja}=this;let ra=Math.min((da.width-100)/a,(da.height-100)/d);ra=Math.min(1,Math.max(hr.minZoom,ja.zoom===ra||1>ja.zoom?Math.min(1,ra):ra));a=yd.add([-k,-K],[(da.width-a*ra)/2/ra,(da.height-d*ra)/2/ra]);this.animateCamera({point:a,zoom:ra})});Ue(this)}get currentView(){const {bounds:a,camera:{point:d,zoom:k}}=this,K=a.width/k,da=a.height/k;return{minX:-d[0],minY:-d[1],maxX:K-d[0],maxY:da-d[1],width:K,height:da}}},
Mn=hr;gb(Mn,"minZoom",.1);gb(Mn,"maxZoom",4);gb(Mn,"panMultiplier",.05);gb(Mn,"panThreshold",100);fe([yg],Mn.prototype,"bounds",2);fe([yg],Mn.prototype,"camera",2);fe([jg],Mn.prototype,"updateBounds",2);fe([jg],Mn.prototype,"update",2);fe([Dg],Mn.prototype,"currentView",1);var sE=class{constructor(a){gb(this,"app");gb(this,"editShape",d=>{(null==d?0:d.props.isLocked)||this.app.transition("select").selectedTool.transition("editingShape",{shape:d});return this});gb(this,"hoverShape",d=>{this.app.setHoveredShape(d);
return this});gb(this,"createShapes",(...d)=>{this.app.createShapes(d);return this});gb(this,"updateShapes",(...d)=>{this.app.updateShapes(d);return this});gb(this,"deleteShapes",(...d)=>{this.app.deleteShapes(d.length?d:this.app.selectedShapesArray);return this});gb(this,"selectShapes",(...d)=>{this.app.setSelectedShapes(d);return this});gb(this,"deselectShapes",(...d)=>{const k="string"===typeof d[0]?d:d.map(K=>K.id);this.app.setSelectedShapes(this.app.selectedShapesArray.filter(K=>!k.includes(K.id)));
return this});gb(this,"flipHorizontal",(...d)=>{this.app.flipHorizontal(d);return this});gb(this,"flipVertical",(...d)=>{this.app.flipVertical(d);return this});gb(this,"selectAll",()=>{this.app.setSelectedShapes(this.app.currentPage.shapes.filter(d=>!this.app.shapesInGroups().includes(d)));return this});gb(this,"deselectAll",()=>{this.app.setSelectedShapes([]);return this});gb(this,"zoomIn",()=>{this.app.viewport.zoomIn();return this});gb(this,"zoomOut",()=>{this.app.viewport.zoomOut();return this});
gb(this,"resetZoom",()=>{this.app.viewport.resetZoom();return this});gb(this,"zoomToFit",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=sf.getCommonBounds(d.map(k=>k.bounds));this.app.viewport.zoomToBounds(d);return this});gb(this,"cameraToCenter",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=sf.getCommonBounds(d.map(k=>k.bounds));this.app.viewport.update({point:be.add(be.neg(sf.getBoundsCenter(d)),[this.app.viewport.currentView.width/2,this.app.viewport.currentView.height/
2])});return this});gb(this,"zoomToSelection",()=>{const {selectionBounds:d}=this.app;if(!d)return this;this.app.viewport.zoomToBounds(d);return this});gb(this,"resetZoomToCursor",()=>{this.app.viewport.animateCamera({zoom:1,point:be.sub(this.app.inputs.originScreenPoint,this.app.inputs.originPoint)});return this});gb(this,"toggleGrid",()=>{const {settings:d}=this.app;d.update({showGrid:!d.showGrid});return this});gb(this,"toggleSnapToGrid",()=>{const {settings:d}=this.app;d.update({snapToGrid:!d.snapToGrid});
return this});gb(this,"togglePenMode",()=>{const {settings:d}=this.app;d.update({penMode:!d.penMode});return this});gb(this,"setColor",d=>{const {settings:k}=this.app;k.update({color:d});this.app.selectedShapesArray.forEach(K=>{K.props.isLocked||K.update({fill:d,stroke:d})});this.app.persist();return this});gb(this,"setScaleLevel",d=>{const {settings:k}=this.app;k.update({scaleLevel:d});this.app.selectedShapes.forEach(K=>{K.props.isLocked||K.setScaleLevel(d)});this.app.persist();return this});gb(this,
"undo",()=>{this.app.undo();return this});gb(this,"redo",()=>{this.app.redo();return this});gb(this,"persist",()=>{this.app.persist();return this});gb(this,"createNewLineBinding",(d,k)=>this.app.createNewLineBinding(d,k));gb(this,"clone",d=>{if(!this.app.readOnly&&1===this.app.selectedShapesArray.length&&Object.values(as).some(Jb=>Jb===this.app.selectedShapesArray[0].type)){var k=this.app.allSelectedShapesArray[0],K=this.app.getShapeClass(k.type),{minX:da,minY:ja,maxX:ra,maxY:Ja,width:Ra,height:$a}=
k.bounds,fb=[0,0];switch(d){case "down":fb=[da,Ja+100];break;case "up":fb=[da,ja-100-$a];break;case "left":fb=[da-100-Ra,ja];break;case "right":fb=[ra+100,ja]}var jb=new K(ff(Zd({},k.serialized),{id:qk(),nonce:Date.now(),refs:[],label:"",point:fb}));this.app.history.pause();this.app.currentPage.addShapes(jb);this.app.createNewLineBinding(k,jb);this.app.history.resume();this.app.persist();setTimeout(()=>this.editShape(jb))}});gb(this,"cloneShapes",({shapes:d,assets:k,bindings:K,point:da=[0,0]})=>{const ja=
sf.getCommonBounds(d.filter(Ra=>"group"!==Ra.type).map(Ra=>{var $a,fb,jb,Jb,Ob,Kb,gc,rc,Wb,kc,hc,Fc,Lc,ud,Jd,Ee;return{minX:null!=(fb=null==($a=Ra.point)?void 0:$a[0])?fb:da[0],minY:null!=(Jb=null==(jb=Ra.point)?void 0:jb[1])?Jb:da[1],width:null!=(Kb=null==(Ob=Ra.size)?void 0:Ob[0])?Kb:4,height:null!=(rc=null==(gc=Ra.size)?void 0:gc[1])?rc:4,maxX:(null!=(kc=null==(Wb=Ra.point)?void 0:Wb[0])?kc:da[0])+(null!=(Fc=null==(hc=Ra.size)?void 0:hc[0])?Fc:4),maxY:(null!=(ud=null==(Lc=Ra.point)?void 0:Lc[1])?
ud:da[1])+(null!=(Ee=null==(Jd=Ra.size)?void 0:Jd[1])?Ee:4)}})),ra=d.map(Ra=>ff(Zd({},Ra),{id:qk(),point:[da[0]+Ra.point[0]-ja.minX,da[1]+Ra.point[1]-ja.minY]}));ra.forEach(Ra=>{var $a;Ra.children&&0<(null==($a=Ra.children)?void 0:$a.length)&&(Ra.children=Ra.children.map(fb=>{var jb;return null==(jb=ra[d.findIndex(Jb=>Jb.id===fb)])?void 0:jb.id}).filter(cg))});const Ja=[];ra.flatMap(Ra=>{var $a;return Object.values(null!=($a=Ra.handles)?$a:{})}).forEach(Ra=>{if(Ra.bindingId){var $a=K[Ra.bindingId];
if($a){var fb=d.findIndex(Jb=>Jb.id===$a.fromId);const jb=d.findIndex(Jb=>Jb.id===$a.toId);$a&&-1!==fb&&-1!==jb?(fb=ff(Zd({},$a),{id:qk(),fromId:ra[fb].id,toId:ra[jb].id}),Ja.push(fb),Ra.bindingId=fb.id):Ra.bindingId=void 0}else console.warn("binding not found",Ra.bindingId)}});k=k.filter(Ra=>ra.some($a=>$a.assetId===Ra.id));return{shapes:ra,assets:k,bindings:Ja}});gb(this,"getClonedShapesFromTldrString",(d,k)=>{try{{var K;const $a=null==(K=d.match(/<whiteboard-tldr>(.*)<\/whiteboard-tldr>/))?void 0:
K[1];if($a){try{var da=JSON.parse($a)}catch(fb){da=null}var ja=da}else ja=void 0}d=ja;if(!d)return null;const {shapes:ra,bindings:Ja,assets:Ra}=d;return this.cloneShapes({shapes:ra,bindings:Ja,assets:Ra,point:k})}catch(ra){console.log(ra)}return null});gb(this,"cloneShapesIntoCurrentPage",d=>{(d=this.cloneShapes(d))&&this.addClonedShapes(d);return this});gb(this,"addClonedShapes",d=>{const {shapes:k,assets:K,bindings:da}=d;0<K.length&&this.app.createAssets(K);0<k.length&&this.app.createShapes(k);
this.app.currentPage.updateBindings(Object.fromEntries(da.map(ja=>[ja.id,ja])));this.app.selectedTool.transition("idle");return this});gb(this,"addClonedShapesFromTldrString",(d,k)=>{(d=this.getClonedShapesFromTldrString(d,k))&&this.addClonedShapes(d);return this});gb(this,"doGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){var k=[...d.filter(K=>"group"===K.type),...d.map(K=>this.app.getParentGroup(K))].filter(cg);this.app.currentPage.removeShapes(...k);d=d.filter(K=>"group"!==
K.type);1<d.length&&(k=this.app.getShapeClass("group"),k=new k({id:qk(),type:k.id,parentId:this.app.currentPage.id,children:d.map(K=>K.id)}),this.app.currentPage.addShapes(k),this.app.setSelectedShapes([k]),this.app.bringForward(d));this.app.persist()}});gb(this,"unGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){d=[...d.filter(K=>"group"===K.type),...d.map(K=>this.app.getParentGroup(K))].filter(cg);var k=this.app.shapesInGroups(d);0<d.length&&(this.app.currentPage.removeShapes(...d),
this.app.persist(),this.app.setSelectedShapes(k))}});gb(this,"convertShapes",(d,k=this.app.allSelectedShapesArray)=>{const K=this.app.getShapeClass(d);this.app.currentPage.removeShapes(...k);k=k.map(da=>new K(ff(Zd({},da.serialized),{type:d,nonce:Date.now()})));this.app.currentPage.addShapes(...k);this.app.persist();this.app.setSelectedShapes(k)});gb(this,"setCollapsed",(d,k=this.app.allSelectedShapesArray)=>{k.forEach(K=>{"logseq-portal"===K.props.type&&K.setCollapsed(d)});this.app.persist()});this.app=
a}},ks=class{constructor(){gb(this,"cursor","default");gb(this,"rotation",0);gb(this,"reset",()=>{this.cursor="default"});gb(this,"setCursor",(a,d=0)=>{if(a!==this.cursor||d!==this.rotation)this.cursor=a,this.rotation=d});gb(this,"setRotation",a=>{a!==this.rotation&&(this.rotation=a)});Ue(this)}};fe([yg],ks.prototype,"cursor",2);fe([yg],ks.prototype,"rotation",2);fe([jg],ks.prototype,"reset",2);fe([jg],ks.prototype,"setCursor",2);fe([jg],ks.prototype,"setRotation",2);var ls=class{constructor(a){gb(this,
"app");gb(this,"stack",[]);gb(this,"isPaused",!0);gb(this,"pause",()=>{this.isPaused||(this.isPaused=!0)});gb(this,"resume",()=>{this.isPaused&&(this.isPaused=!1)});gb(this,"persist",(d=!1)=>{this.isPaused||this.creating||this.app.notify("persist",{replace:d})});gb(this,"undo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appUndo&&this.app.appUndo()});gb(this,"redo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appRedo&&this.app.appRedo()});
gb(this,"instantiateShape",d=>new (this.app.getShapeClass(d.type))(d));gb(this,"deserialize",d=>{Gc(()=>{var k,{pages:K}=d;const da=this.isPaused;this.pause();const ja=[...this.app.selectedIds];try{const ra=new Map(this.app.pages),Ja=[];for(const Ra of K){const $a=ra.get(Ra.id);if(void 0!==$a){const fb=new Map($a.shapes.map(jb=>[jb.props.id,jb]));K=[];for(const jb of Ra.shapes){const Jb=fb.get(jb.id);void 0!==Jb?(Jb.nonce!==jb.nonce&&(Jb.update(jb,!0),Jb.nonce=jb.nonce,Jb.setLastSerialized(jb)),fb.delete(jb.id)):
K.push(this.instantiateShape(jb))}0<fb.size&&!this.app.selectedTool.isInAny("creating","editingShape")&&$a.removeShapes(...fb.values());0<K.length&&$a.addShapes(...K);ra.delete(Ra.id);$a.updateBindings(Ra.bindings);$a.nonce=null!=(k=Ra.nonce)?k:0}else{const {id:fb,name:jb,shapes:Jb,bindings:Ob,nonce:Kb}=Ra;Ja.push(new gl(this.app,{id:fb,name:jb,nonce:Kb,bindings:Ob,shapes:Jb.map(gc=>this.instantiateShape(gc))}))}}0<Ja.length&&this.app.addPages(Ja);0<ra.size&&this.app.removePages(Array.from(ra.values()));
this.app.setSelectedShapes(ja).setErasingShapes([])}catch(ra){console.warn(ra)}da||this.resume()})});this.app=a;Ue(this)}get creating(){return"creating"===this.app.selectedTool.currentState.id}};fe([yg],ls.prototype,"stack",2);fe([jg],ls.prototype,"persist",2);fe([jg],ls.prototype,"undo",2);fe([jg],ls.prototype,"redo",2);fe([jg],ls.prototype,"deserialize",2);var Yp=class{constructor(){gb(this,"mode","light");gb(this,"showGrid",!0);gb(this,"snapToGrid",!0);gb(this,"penMode",!1);gb(this,"scaleLevel",
"md");gb(this,"color","");Ue(this)}update(a){Object.assign(this,a)}};fe([yg],Yp.prototype,"mode",2);fe([yg],Yp.prototype,"showGrid",2);fe([yg],Yp.prototype,"snapToGrid",2);fe([yg],Yp.prototype,"penMode",2);fe([yg],Yp.prototype,"scaleLevel",2);fe([yg],Yp.prototype,"color",2);fe([jg],Yp.prototype,"update",1);var Vg=class extends hs{constructor(a,d,k,K){var da,ja;super();gb(this,"uuid",qk());gb(this,"readOnly");gb(this,"api");gb(this,"inputs",new Kj);gb(this,"cursors",new ks);gb(this,"viewport",new Mn);
gb(this,"settings",new Yp);gb(this,"Tools",[]);gb(this,"history",new ls(this));gb(this,"persist",this.history.persist);gb(this,"undo",this.history.undo);gb(this,"redo",this.history.redo);gb(this,"saving",!1);gb(this,"saveState",()=>{this.history.isPaused||(this.saving=!0,requestAnimationFrame(()=>{this.saving&&(this.persist(),this.saving=!1)}))});gb(this,"load",()=>{this.notify("load",null);return this});gb(this,"save",()=>{this.notify("save",null);return this});gb(this,"pages",new Map([["page",new gl(this,
{id:"page",name:"page",shapes:[],bindings:{}})]]));gb(this,"getPageById",ra=>{const Ja=this.pages.get(ra);if(!Ja)throw Error(`Could not find a page named ${ra}.`);return Ja});gb(this,"getShapeById",(ra,Ja=this.currentPage.id)=>{var Ra;return null==(Ra=this.getPageById(Ja))?void 0:Ra.shapesById[ra]});gb(this,"createShapes",ra=>{if(this.readOnly)return this;(ra=this.currentPage.addShapes(...ra))&&this.notify("create-shapes",ra);this.persist();return this});gb(this,"updateShapes",ra=>{if(this.readOnly)return this;
ra.forEach(Ja=>{const Ra=this.getShapeById(Ja.id);null==Ra?void 0:Ra.update(Ja);Ja.type!==(null==Ra?void 0:Ra.type)&&this.api.convertShapes(Ja.type,[Ra])});this.persist();return this});gb(this,"deleteShapes",ra=>{if(0===ra.length||this.readOnly)return this;ra=ra.map(fb=>"string"===typeof fb?this.getShapeById(fb):fb).filter(cg).filter(fb=>!fb.props.isLocked);const Ja=this.shapesInGroups(ra);ra.forEach(fb=>{this.getParentGroup(fb)&&Ja.push(fb)});let Ra=new Set([...ra,...Ja].map(fb=>fb.id));Ja.forEach(fb=>
{var jb;const Jb=this.getParentGroup(fb);if(Jb){const Ob=null==(jb=Jb.props.children)?void 0:jb.filter(Kb=>Kb!==fb.id);!Ob||1>=(null==Ob?void 0:Ob.length)?Ra.add(Jb.id):Jb.update({children:Ob})}});const $a=(fb,jb)=>{var Jb;[...Ra].includes(fb)&&"line"===(null==(Jb=this.getShapeById(jb))?void 0:Jb.type)&&Ra.add(jb)};this.currentPage.shapes.filter(fb=>!fb.props.isLocked).flatMap(fb=>{var jb;return Object.values(null!=(jb=fb.props.handles)?jb:{})}).flatMap(fb=>fb.bindingId).filter(cg).map(fb=>{var jb,
Jb;const Ob=null==(jb=this.currentPage.bindings[fb])?void 0:jb.toId;fb=null==(Jb=this.currentPage.bindings[fb])?void 0:Jb.fromId;Ob&&fb&&($a(Ob,fb),$a(fb,Ob))});ra=[...Ra].map(fb=>this.getShapeById(fb));this.setSelectedShapes(this.selectedShapesArray.filter(fb=>!Ra.has(fb.id)));(ra=this.currentPage.removeShapes(...ra))&&this.notify("delete-shapes",ra);this.persist();return this});gb(this,"bringForward",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.bringForward(ra);
return this});gb(this,"sendBackward",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.sendBackward(ra);return this});gb(this,"sendToBack",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.sendToBack(ra);return this});gb(this,"bringToFront",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.bringToFront(ra);return this});gb(this,"flipHorizontal",(ra=this.selectedShapesArray)=>{this.currentPage.flip(ra,"horizontal");
return this});gb(this,"flipVertical",(ra=this.selectedShapesArray)=>{this.currentPage.flip(ra,"vertical");return this});gb(this,"align",(ra,Ja=this.selectedShapesArray)=>{if(2>Ja.length||this.readOnly)return this;const Ra=Ja.map(Ob=>{const Kb=Ob.getBounds();return{id:Ob.id,point:[Kb.minX,Kb.minY],bounds:Kb}}),$a=sf.getCommonBounds(Ra.map(({bounds:Ob})=>Ob)),fb=$a.minX+$a.width/2,jb=$a.minY+$a.height/2,Jb=Object.fromEntries(Ra.map(({id:Ob,point:Kb,bounds:gc})=>[Ob,{prev:Kb,next:{top:[Kb[0],$a.minY],
centerVertical:[Kb[0],jb-gc.height/2],bottom:[Kb[0],$a.maxY-gc.height],left:[$a.minX,Kb[1]],centerHorizontal:[fb-gc.width/2,Kb[1]],right:[$a.maxX-gc.width,Kb[1]]}[ra]}]));Ja.forEach(Ob=>{Jb[Ob.id]&&Ob.update({point:Jb[Ob.id].next})});this.persist();return this});gb(this,"distribute",(ra,Ja=this.selectedShapesArray)=>{if(2>Ja.length||this.readOnly)return this;const Ra=Object.fromEntries(sf.getDistributions(Ja,ra).map($a=>[$a.id,$a]));Ja.forEach($a=>{Ra[$a.id]&&$a.update({point:Ra[$a.id].next})});this.persist();
return this});gb(this,"packIntoRectangle",(ra=this.selectedShapesArray)=>{if(2>ra.length||this.readOnly)return this;const Ja=Object.fromEntries(sf.getPackedDistributions(ra).map(Ra=>[Ra.id,Ra]));ra.forEach(Ra=>{Ja[Ra.id]&&Ra.update({point:Ja[Ra.id].next})});this.persist();return this});gb(this,"setLocked",ra=>{if(0===this.selectedShapesArray.length||this.readOnly)return this;this.selectedShapesArray.forEach(Ja=>{Ja.update({isLocked:ra})});this.persist();return this});gb(this,"assets",{});gb(this,
"removeUnusedAssets",()=>{const ra=this.getCleanUpAssets();Object.keys(this.assets).forEach(Ja=>{ra.some(Ra=>Ra.id===Ja)||delete this.assets[Ja]});this.persist();return this});gb(this,"copy",()=>{if(0<this.selectedShapesArray.length&&!this.editingShape){const Ja=this.allSelectedShapesArray;var ra=JSON.stringify({shapes:Ja.map($a=>$a.serialized),assets:this.getCleanUpAssets().filter($a=>Ja.some(fb=>fb.props.assetId===$a.id)),bindings:jc(this.currentPage.bindings)});ra=encodeURIComponent(`<whiteboard-tldr>${ra}</whiteboard-tldr>`);
const Ra=this.selectedShapesArray.map($a=>`((${$a.props.id}))`).join(" ");this.notify("copy",{text:Ra,html:ra})}});gb(this,"paste",(ra,Ja)=>{var Ra;this.editingShape||this.readOnly||this.notify("paste",{point:this.inputs.currentPoint,shiftKey:!!Ja,dataTransfer:null!=(Ra=null==ra?void 0:ra.clipboardData)?Ra:void 0})});gb(this,"cut",()=>{this.copy();this.api.deleteShapes()});gb(this,"drop",(ra,Ja)=>{this.notify("drop",{dataTransfer:ra,point:Ja?this.viewport.getPagePoint(Ja):sf.getBoundsCenter(this.viewport.currentView)})});
gb(this,"selectTool",(ra,Ja={})=>{this.readOnly&&!["select","move"].includes(ra)||this.transition(ra,Ja)});gb(this,"editingId");gb(this,"setEditingShape",ra=>{this.editingId="string"===typeof ra?ra:null==ra?void 0:ra.id;return this});gb(this,"clearEditingState",()=>{this.selectedTool.transition("idle");return this.setEditingShape()});gb(this,"hoveredId");gb(this,"setHoveredShape",ra=>{this.hoveredId="string"===typeof ra?ra:null==ra?void 0:ra.id;return this});gb(this,"selectedIds",new Set);gb(this,
"selectedShapes",new Set);gb(this,"selectionRotation",0);gb(this,"setSelectedShapes",ra=>{var Ja;const {selectedIds:Ra,selectedShapes:$a}=this;Ra.clear();$a.clear();ra[0]&&"string"===typeof ra[0]?ra.forEach(jb=>Ra.add(jb)):ra.forEach(jb=>Ra.add(jb.id));const fb=this.currentPage.shapes.filter(jb=>Ra.has(jb.id));fb.forEach(jb=>$a.add(jb));this.selectionRotation=1===fb.length?null!=(Ja=fb[0].props.rotation)?Ja:0:0;0===ra.length&&this.setEditingShape();return this});gb(this,"erasingIds",new Set);gb(this,
"erasingShapes",new Set);gb(this,"setErasingShapes",ra=>{const {erasingIds:Ja,erasingShapes:Ra}=this;Ja.clear();Ra.clear();ra[0]&&"string"===typeof ra[0]?ra.forEach($a=>Ja.add($a)):ra.forEach($a=>Ja.add($a.id));this.currentPage.shapes.filter($a=>Ja.has($a.id)).forEach($a=>Ra.add($a));return this});gb(this,"bindingIds");gb(this,"setBindingShapes",ra=>{this.bindingIds=ra;return this});gb(this,"clearBindingShape",()=>this.setBindingShapes());gb(this,"createNewLineBinding",(ra,Ja)=>{ra="string"===typeof ra?
this.getShapeById(ra):ra;Ja="string"===typeof Ja?this.getShapeById(Ja):Ja;if((null==ra?0:ra.canBind)&&(null==Ja?0:Ja.canBind)&&(Ja=Wc(ra,Ja))){const [Ra,$a]=Ja;this.createShapes([Ra]);this.currentPage.updateBindings(Object.fromEntries($a.map(fb=>[fb.id,fb])));this.persist();return!0}return!1});gb(this,"brush");gb(this,"setBrush",ra=>{this.brush=ra;return this});gb(this,"setCamera",(ra,Ja)=>{this.viewport.update({point:ra,zoom:Ja});return this});gb(this,"getPagePoint",ra=>{const {camera:Ja}=this.viewport;
return yd.sub(yd.div(ra,Ja.zoom),Ja.point)});gb(this,"getScreenPoint",ra=>{const {camera:Ja}=this.viewport;return yd.mul(yd.add(ra,Ja.point),Ja.zoom)});gb(this,"Shapes",new Map);gb(this,"registerShapes",ra=>{ra.forEach(Ja=>{if("group"===Ja.id){const Ra=this;Ja.prototype.getShapes=function(){var $a,fb;return null!=(fb=null==($a=this.props.children)?void 0:$a.map(jb=>Ra.getShapeById(jb)).filter(Boolean))?fb:[]}}return this.Shapes.set(Ja.id,Ja)})});gb(this,"deregisterShapes",ra=>{ra.forEach(Ja=>this.Shapes.delete(Ja.id))});
gb(this,"getShapeClass",ra=>{if(!ra)throw Error("No shape type provided.");const Ja=this.Shapes.get(ra);if(!Ja)throw Error(`Could not find shape class for ${ra}`);return Ja});gb(this,"wrapUpdate",ra=>{Gc(()=>{const Ja=!this.history.isPaused;Ja&&this.history.pause();ra();Ja&&(this.history.resume(),this.persist())})});gb(this,"subscriptions",new Set([]));gb(this,"subscribe",(ra,Ja)=>{if(void 0===Ja)throw Error("Callback is required.");const Ra={event:ra,callback:Ja};this.subscriptions.add(Ra);return()=>
this.unsubscribe(Ra)});gb(this,"unsubscribe",ra=>{this.subscriptions.delete(ra);return this});gb(this,"notify",(ra,Ja)=>{this.subscriptions.forEach(Ra=>{Ra.event===ra&&Ra.callback(this,Ja)});return this});gb(this,"onTransition",()=>{});gb(this,"onPointerDown",(ra,Ja)=>{if(!this.editingShape&&1===Ja.button&&!this.isIn("move"))this.temporaryTransitionToMove(Ja);else if(2===Ja.button&&!this.editingShape)Ja.preventDefault(),this.transition("select");else if("clientX"in Ja)this.inputs.onPointerDown([...this.viewport.getPagePoint([Ja.clientX,
Ja.clientY]),Ja.pressure],Ja)});gb(this,"onPointerUp",(ra,Ja)=>{if(!this.editingShape&&1===Ja.button&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),Ja.stopPropagation(),Ja.preventDefault();else if("clientX"in Ja)this.inputs.onPointerUp([...this.viewport.getPagePoint([Ja.clientX,Ja.clientY]),Ja.pressure],Ja)});gb(this,"onPointerMove",(ra,Ja)=>{if("clientX"in Ja)this.inputs.onPointerMove([...this.viewport.getPagePoint([Ja.clientX,Ja.clientY]),Ja.pressure],Ja)});gb(this,"onKeyDown",
(ra,Ja)=>{if(this.editingShape||" "!==Ja.key||this.isIn("move"))this.inputs.onKeyDown(Ja);else this.temporaryTransitionToMove(Ja)});gb(this,"onKeyUp",(ra,Ja)=>{if(!this.editingShape&&" "===Ja.key&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),Ja.stopPropagation(),Ja.preventDefault();else this.inputs.onKeyUp(Ja)});gb(this,"onPinchStart",(ra,Ja)=>{this.inputs.onPinchStart([...this.viewport.getPagePoint(ra.point),.5],Ja)});gb(this,"onPinch",(ra,Ja)=>{this.inputs.onPinch([...this.viewport.getPagePoint(ra.point),
.5],Ja)});gb(this,"onPinchEnd",(ra,Ja)=>{this.inputs.onPinchEnd([...this.viewport.getPagePoint(ra.point),.5],Ja)});this._states=[is,js];this.readOnly=K;this.history.pause();this.states&&0<this.states.length&&(this.registerStates(this.states),K=null!=(da=this.initial)?da:this.states[0].id,da=this.children.get(K))&&(this.currentState=da,null==(ja=this.currentState)?void 0:ja._events.onEnter({fromId:"initial"}));d&&this.registerShapes(d);k&&this.registerTools(k);this.history.resume();a&&this.history.deserialize(a);
this.api=new sE(this);Ue(this);this.notify("mount",null)}loadDocumentModel(a){this.history.deserialize(a);a.assets&&0<a.assets.length&&this.addAssets(a.assets);return this}get serialized(){return{}}get currentPageId(){return this.pages.keys().next().value}get currentPage(){return this.getPageById(this.currentPageId)}addPages(a){a.forEach(d=>this.pages.set(d.id,d));this.persist();return this}removePages(a){a.forEach(d=>this.pages.delete(d.id));this.persist();return this}shapesInGroups(a=this.shapes){return a.flatMap(d=>
d.props.children).filter(cg).map(d=>this.getShapeById(d)).filter(cg)}getParentGroup(a){return this.shapes.find(d=>{var k;return null==(k=d.props.children)?void 0:k.includes(a.id)})}addAssets(a){a.forEach(d=>this.assets[d.id]=d);return this}removeAssets(a){"string"===typeof a[0]?a.forEach(d=>delete this.assets[d]):a.forEach(d=>delete this.assets[d.id]);this.persist();return this}getCleanUpAssets(){const a=new Set;this.pages.forEach(d=>d.shapes.forEach(k=>{k.props.assetId&&this.assets[k.props.assetId]&&
a.add(this.assets[k.props.assetId])}));return Array.from(a)}createAssets(a){this.addAssets(a);this.notify("create-assets",{assets:a});this.persist();return this}get selectedTool(){return this.currentState}registerTools(a){this.Tools=a;return this.registerStates(a)}get editingShape(){const {editingId:a,currentPage:d}=this;return a?d.shapes.find(k=>k.id===a):void 0}get hoveredShape(){const {hoveredId:a,currentPage:d}=this;return a?d.shapes.find(k=>k.id===a):void 0}get hoveredGroup(){const {hoveredShape:a}=
this;return a?this.shapes.find(d=>{var k;return"group"===d.type&&(null==(k=d.props.children)?void 0:k.includes(a.id))}):void 0}get selectedShapesArray(){const {selectedShapes:a,selectedTool:d}=this;return"select"!==d.id?[]:Array.from(a.values())}get allSelectedShapes(){return new Set(this.allSelectedShapesArray)}get allSelectedShapesArray(){const {selectedShapesArray:a}=this;return[...(new Set([...a,...this.shapesInGroups(a)]))]}setSelectionRotation(a){this.selectionRotation=a}get erasingShapesArray(){return Array.from(this.erasingShapes.values())}get bindingShapes(){var a;
const d=1===this.selectedShapesArray.length?this.selectedShapesArray.flatMap(K=>{var da;return Object.values(null!=(da=K.props.handles)?da:{})}).flatMap(K=>K.bindingId).filter(cg).flatMap(K=>{var da,ja;return[null==(da=this.currentPage.bindings[K])?void 0:da.fromId,null==(ja=this.currentPage.bindings[K])?void 0:ja.toId]}).filter(cg):[],k=[...(null!=(a=this.bindingIds)?a:[]),...d];return k?this.currentPage.shapes.filter(K=>null==k?void 0:k.includes(K.id)):void 0}get currentGrid(){const {zoom:a}=this.viewport.camera;
return.15>a?128:1>a?32:8}get shapes(){const {currentPage:{shapes:a}}=this;return Array.from(a.values())}get shapesInViewport(){const {selectedShapes:a,currentPage:d,viewport:{currentView:k}}=this;return d.shapes.filter(K=>!K.canUnmount||a.has(K)||sf.boundsContain(k,K.rotatedBounds)||sf.boundsCollide(k,K.rotatedBounds))}get selectionDirectionHint(){const {selectionBounds:a,viewport:{currentView:d}}=this;if(a&&!sf.boundsContain(d,a)&&!sf.boundsCollide(d,a)){var k=sf.getBoundsCenter(a);return yd.clampV([(k[0]-
d.minX-d.width/2)/d.width,(k[1]-d.minY-d.height/2)/d.height],-1,1)}}get selectionBounds(){const {selectedShapesArray:a}=this;if(0!==a.length)return 1===a.length?ff(Zd({},a[0].bounds),{rotation:a[0].props.rotation}):sf.getCommonBounds(this.selectedShapesArray.map(d=>d.rotatedBounds))}get showSelection(){var a;const {selectedShapesArray:d}=this;return this.isIn("select")&&!this.isInAny("select.translating","select.pinching","select.rotating")&&(1===d.length&&!(null==(a=d[0])?0:a.hideSelection)||1<d.length)}get showSelectionDetail(){return this.isIn("select")&&
!this.isInAny("select.translating","select.pinching")&&0<this.selectedShapes.size&&!this.selectedShapesArray.every(a=>a.hideSelectionDetail)&&!1}get showSelectionRotation(){return this.showSelectionDetail&&this.isInAny("select.rotating","select.pointingRotateHandle")}get showContextBar(){const {selectedShapesArray:a}=this;return this.isInAny("select.idle","select.hoveringSelectionHandle")&&!this.isIn("select.contextMenu")&&0<a.length&&!this.readOnly&&!a.every(d=>d.hideContextBar)}get showRotateHandles(){const {selectedShapesArray:a}=
this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingRotateHandle","select.pointingResizeHandle")&&0<a.length&&!this.readOnly&&!a.some(d=>d.hideRotateHandle)}get showResizeHandles(){const {selectedShapesArray:a}=this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingShape","select.pointingSelectedShape","select.pointingRotateHandle","select.pointingResizeHandle")&&1===a.length&&!this.readOnly&&!a.every(d=>d.hideResizeHandles)}get showCloneHandles(){const {selectedShapesArray:a}=
this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingShape","select.pointingSelectedShape")&&1===a.length&&Object.values(as).some(d=>d===this.selectedShapesArray[0].type)&&!this.readOnly}temporaryTransitionToMove(a){a.stopPropagation();a.preventDefault();this.transition("move",{prevTool:this.selectedTool});this.selectedTool.transition("idleHold")}};gb(Vg,"id","app");gb(Vg,"initial","select");fe([Dg],Vg.prototype,"serialized",1);fe([yg],Vg.prototype,"pages",2);fe([Dg],
Vg.prototype,"currentPageId",1);fe([Dg],Vg.prototype,"currentPage",1);fe([jg],Vg.prototype,"addPages",1);fe([jg],Vg.prototype,"removePages",1);fe([jg],Vg.prototype,"createShapes",2);fe([jg],Vg.prototype,"updateShapes",2);fe([jg],Vg.prototype,"deleteShapes",2);fe([yg],Vg.prototype,"assets",2);fe([jg],Vg.prototype,"addAssets",1);fe([jg],Vg.prototype,"removeAssets",1);fe([jg],Vg.prototype,"removeUnusedAssets",2);fe([Dg],Vg.prototype,"selectedTool",1);fe([yg],Vg.prototype,"editingId",2);fe([Dg],Vg.prototype,
"editingShape",1);fe([jg],Vg.prototype,"setEditingShape",2);fe([yg],Vg.prototype,"hoveredId",2);fe([Dg],Vg.prototype,"hoveredShape",1);fe([Dg],Vg.prototype,"hoveredGroup",1);fe([jg],Vg.prototype,"setHoveredShape",2);fe([yg],Vg.prototype,"selectedIds",2);fe([yg],Vg.prototype,"selectedShapes",2);fe([yg],Vg.prototype,"selectionRotation",2);fe([Dg],Vg.prototype,"selectedShapesArray",1);fe([Dg],Vg.prototype,"allSelectedShapes",1);fe([Dg],Vg.prototype,"allSelectedShapesArray",1);fe([jg],Vg.prototype,"setSelectedShapes",
2);fe([jg],Vg.prototype,"setSelectionRotation",1);fe([yg],Vg.prototype,"erasingIds",2);fe([yg],Vg.prototype,"erasingShapes",2);fe([Dg],Vg.prototype,"erasingShapesArray",1);fe([jg],Vg.prototype,"setErasingShapes",2);fe([yg],Vg.prototype,"bindingIds",2);fe([Dg],Vg.prototype,"bindingShapes",1);fe([jg],Vg.prototype,"setBindingShapes",2);fe([jg],Vg.prototype,"createNewLineBinding",2);fe([yg],Vg.prototype,"brush",2);fe([jg],Vg.prototype,"setBrush",2);fe([jg],Vg.prototype,"setCamera",2);fe([Dg],Vg.prototype,
"currentGrid",1);fe([Dg],Vg.prototype,"shapes",1);fe([Dg],Vg.prototype,"shapesInViewport",1);fe([Dg],Vg.prototype,"selectionDirectionHint",1);fe([Dg],Vg.prototype,"selectionBounds",1);fe([Dg],Vg.prototype,"showSelection",1);fe([Dg],Vg.prototype,"showSelectionDetail",1);fe([Dg],Vg.prototype,"showSelectionRotation",1);fe([Dg],Vg.prototype,"showContextBar",1);fe([Dg],Vg.prototype,"showRotateHandles",1);fe([Dg],Vg.prototype,"showResizeHandles",1);fe([Dg],Vg.prototype,"showCloneHandles",1);var tE=Function.prototype.toString,
$w=Object.create,uE=Object.prototype.toString,vE=function(){function a(){this._keys=[];this._values=[]}a.prototype.has=function(d){return!!~this._keys.indexOf(d)};a.prototype.get=function(d){return this._values[this._keys.indexOf(d)]};a.prototype.set=function(d,k){this._keys.push(d);this._values.push(k)};return a}(),wE="undefined"!==typeof WeakMap?re:Wd,xE="g"===/test/g.flags?kf:Cf,yE="undefined"!==typeof Symbol?tf:Df,zE=Object.defineProperty,AE=Object.getOwnPropertyDescriptor,bA=Object.getOwnPropertyNames,
ax=Object.getOwnPropertySymbols,cA=Object.prototype,dA=cA.hasOwnProperty,BE=cA.propertyIsEnumerable,eA="function"===typeof ax,CE=eA?rg:bA,DE=Array.isArray,bx=Object.assign,EE=Object.getPrototypeOf,fA={array:function(a,d){var k=new d.Constructor;d.cache.set(a,k);for(var K=0,da=a.length;K<da;++K)k[K]=d.copier(a[K],d);return k},arrayBuffer:function(a,d){return a.slice(0)},blob:function(a,d){return a.slice(0,a.size,a.type)},dataView:function(a,d){return new d.Constructor(a.buffer.slice(0))},date:function(a,
d){return new d.Constructor(a.getTime())},error:hi,map:jh,object:eA?hh:Uf,regExp:function(a,d){d=new d.Constructor(a.source,xE(a));d.lastIndex=a.lastIndex;return d},set:Rj},FE=bx({},fA,{array:function(a,d){var k=new d.Constructor;d.cache.set(a,k);return gh(a,k,d)},map:function(a,d){return gh(a,jh(a,d),d)},object:function(a,d){var k=xe(d.prototype);d.cache.set(a,k);return gh(a,k,d)},set:function(a,d){return gh(a,Rj(a,d),d)}});Lk(bx({},FE,{}));var GE=Lk({}),HE=Kf(AD()),IE=Kf(BD()),ir=GE,kn=class{static insertTextFirefox(a,
d){a.setRangeText(d,a.selectionStart||0,a.selectionEnd||0,"end");a.dispatchEvent(new InputEvent("input",{data:d,inputType:"insertText",isComposing:!1}))}static insert(a,d){const k=a.ownerDocument,K=k.activeElement;K!==a&&a.focus();k.execCommand("insertText",!1,d)||kn.insertTextFirefox(a,d);K===k.body?a.blur():K instanceof HTMLElement&&K!==a&&K.focus()}static set(a,d){a.select();kn.insert(a,d)}static getSelection(a){const {selectionStart:d,selectionEnd:k}=a;return a.value.slice(d?d:void 0,k?k:void 0)}static wrapSelection(a,
d,k){const {selectionStart:K,selectionEnd:da}=a,ja=kn.getSelection(a);kn.insert(a,d+ja+(null!=k?k:d));a.selectionStart=(K||0)+d.length;a.selectionEnd=(da||0)+d.length}static replace(a,d,k){let K=0;a.value.replace(d,(...da)=>{const ja=K+da[da.length-2],ra=da[0].length;a.selectionStart=ja;a.selectionEnd=ja+ra;da="string"===typeof k?k:k(...da);kn.insert(a,da);a.selectionStart=ja;K+=da.length-ra;return da})}static findLineEnd(a,d){const k=a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(k)?d:k+1}static indent(a){var d;
const {selectionStart:k,selectionEnd:K,value:da}=a;var ja=da.slice(k,K);if((ja=null==(d=/\n/g.exec(ja))?void 0:d.length)&&0<ja){d=da.lastIndexOf("\n",k-1)+1;var ra=a.value.slice(d,K-1);ja=ra.replace(/^|\n/g,`$&${kn.INDENT}`);ra=ja.length-ra.length;a.setSelectionRange(d,K-1);kn.insert(a,ja);a.setSelectionRange(k+1,K+ra)}else kn.insert(a,kn.INDENT)}static unindent(a){const {selectionStart:d,selectionEnd:k,value:K}=a;var da=K.lastIndexOf("\n",d-1)+1;const ja=kn.findLineEnd(K,k);var ra=a.value.slice(da,
ja);const Ja=ra.replace(/(^|\n)(\t| {1,2})/g,"$1");ra=ra.length-Ja.length;a.setSelectionRange(da,ja);kn.insert(a,Ja);da=(da=/\t| {1,2}/.exec(K.slice(da,d)))?da[0].length:0;a.setSelectionRange(d-da,Math.max(d-da,k-ra))}static normalizeText(a){return a.replace(kn.fixNewLines,"\n")}},ms=kn;gb(ms,"fixNewLines",/\r?\n|\r/g);gb(ms,"INDENT","  ");var Zp;"undefined"!==typeof window&&(Zp=Wl());var cx=new Map,gA=oh()?"⌘":"ctrl",JE=class extends Vg{},hA=Kf(ca(19)),KE=()=>{};/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var iA=Kf(ca(19)),dx={},yt=Kf(ca(19)),LE=a=>{for(a=a.parentElement;a&&a!==document.body;){const {overflowY:d}=window.getComputedStyle(a);if(a.scrollHeight>a.clientHeight&&("auto"===d||"scroll"===d||"overlay"===d))return a;a=a.parentElement}return document},ex=Kf(ca(19)),fx=new Map,ME={accent:"var(--lx-accent-09, hsl(var(--primary)))",brushFill:"var(--ls-scrollbar-background-color, rgba(0, 0, 0, .05))",brushStroke:"var(--ls-scrollbar-thumb-hover-color, rgba(0, 0, 0, .05))",selectStroke:"var(--color-selectedStroke)",
selectFill:"var(--color-selectedFill)",binding:"var(--color-binding, rgba(65, 132, 244, 0.5))",background:"var(--ls-primary-background-color, hsl(var(--background)))",foreground:"var(--ls-primary-text-color, hsl(var(--foreground)))",grid:"var(--ls-quaternary-background-color, hsl(var(--secondary)))"},NE=((a,...d)=>a.reduce((k,K,da)=>k+K+(da<d.length?d[da]:""),""))`
  .tl-container {
    --tl-zoom: 1;
    --tl-scale: calc(1 / var(--tl-zoom));
    --tl-padding: calc(64px / var(--tl-zoom));;
    --tl-shadow-color: 0deg 0% 0%;
    --tl-binding-distance: ${4}px;
    --tl-shadow-elevation-low: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
      0px 0.6px 0.8px -0.7px hsl(var(--tl-shadow-color) / 0.06),
      0.1px 1.2px 1.5px -1.4px hsl(var(--tl-shadow-color) / 0.08);
    --tl-shadow-elevation-medium: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
      0.1px 1.3px 1.7px -0.5px hsl(var(--tl-shadow-color) / 0.06),
      0.1px 2.8px 3.6px -1px hsl(var(--tl-shadow-color) / 0.07),
      0.3px 6.1px 7.8px -1.4px hsl(var(--tl-shadow-color) / 0.09);
    --tl-shadow-elevation-high: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
      0.1px 2.3px 3px -0.2px hsl(var(--tl-shadow-color) / 0.05),
      0.2px 4.1px 5.3px -0.5px hsl(var(--tl-shadow-color) / 0.06),
      0.4px 6.6px 8.5px -0.7px hsl(var(--tl-shadow-color) / 0.07),
      0.6px 10.3px 13.2px -1px hsl(var(--tl-shadow-color) / 0.08),
      0.9px 16px 20.6px -1.2px hsl(var(--tl-shadow-color) / 0.09),
      1.3px 24.3px 31.2px -1.4px hsl(var(--tl-shadow-color) / 0.1);
    box-sizing: border-box;
    position: relative;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
    outline: none;
    z-index: 100;
    user-select: none;
    touch-action: none;
    overscroll-behavior: none;
    background-color: var(--tl-background);
    cursor: inherit;
    box-sizing: border-box;
    color: var(--tl-foreground);
    -webkit-user-select: none;
    -webkit-user-drag: none;
  }

  .tl-overlay {
    background: none;
    fill: transparent;
    position: absolute;
    width: 100%;
    height: 100%;
    touch-action: none;
    pointer-events: none;
  }

  .tl-snap-line {
    stroke: var(--tl-accent);
    stroke-width: calc(1px * var(--tl-scale));
  }

  .tl-snap-point {
    stroke: var(--tl-accent);
    stroke-width: calc(1px * var(--tl-scale));
  }

  .tl-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    touch-action: none;
    pointer-events: all;
    overflow: clip;
    outline: none;
  }

  .tl-layer {
    position: absolute;
    top: 0px;
    left: 0px;
    height: 0px;
    width: 0px;
    contain: layout style size;
  }

  .tl-absolute {
    position: absolute;
    top: 0px;
    left: 0px;
    transform-origin: center center;
    contain: layout style size;
  }

  .tl-positioned {
    position: absolute;
    transform-origin: center center;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout style size;
  }

  .tl-positioned-svg {
    width: 100%;
    height: 100%;
    overflow: hidden;
    contain: layout style size;
    pointer-events: none;
  }

  .tl-positioned-div {
    position: relative;
    width: 100%;
    height: 100%;
    padding: var(--tl-padding);
    contain: layout style size;
  }

  .tl-positioned-inner {
    position: relative;
    width: 100%;
    height: 100%;
  }

  .tl-counter-scaled {
    transform: scale(var(--tl-scale));
  }

  .tl-dashed {
    stroke-dasharray: calc(2px * var(--tl-scale)), calc(2px * var(--tl-scale));
  }

  .tl-transparent {
    fill: transparent;
    stroke: transparent;
  }

  .tl-corner-handle {
    stroke: var(--tl-selectStroke);
    fill: var(--tl-background);
    stroke-width: calc(1.5px * var(--tl-scale));
  }

  .tl-rotate-handle {
    stroke: var(--tl-selectStroke);
    fill: var(--tl-background);
    stroke-width: calc(1.5px * var(--tl-scale));
  }

  .tl-clone-handle {
    stroke: var(--tl-selectStroke);
    fill: var(--tl-background);
    stroke-width: calc(1.5px * var(--tl-scale));
  }

  .tl-clone-handle:hover {
    fill: var(--tl-selectStroke);
    cursor: pointer;
  }

  .tl-clone-handle:hover line {
    stroke: var(--tl-background);
  }

  .tl-user {
    left: -4px;
    top: -4px;
    height: 8px;
    width: 8px;
    border-radius: 100%;
    pointer-events: none;
  }

  .tl-indicator {
    fill: transparent;
    stroke-width: calc(1.5px * var(--tl-scale));
    pointer-events: none;
  }

  .tl-indicator-container {
    transform-origin: 0 0;
    fill: transparent;
    stroke-width: calc(1.5px * var(--tl-scale));
    pointer-events: none;
  }

  .tl-user-indicator-bounds {
    border-style: solid;
    border-width: calc(1px * var(--tl-scale));
  }

  .tl-selected {
    stroke: var(--tl-selectStroke);
  }

  .tl-hovered {
    stroke: var(--tl-selectStroke);
  }

  .tl-clone-target {
    pointer-events: all;
  }

  .tl-clone-target:hover .tl-clone-button {
    opacity: 1;
  }

  .tl-clone-button-target {
    cursor: pointer;
    pointer-events: all;
  }

  .tl-clone-button-target:hover .tl-clone-button {
    fill: var(--tl-selectStroke);
  }

  .tl-clone-button {
    opacity: 0;
    r: calc(8px * var(--tl-scale));
    stroke-width: calc(1.5px * var(--tl-scale));
    stroke: var(--tl-selectStroke);
    fill: var(--tl-background);
  }

  .tl-bounds {
    pointer-events: none;
    contain: layout style size;
  }

  .tl-bounds-bg {
    stroke: none;
    fill: var(--tl-selectFill);
    pointer-events: all;
    contain: layout style size;
  }

  .tl-bounds-fg {
    fill: transparent;
    stroke: var(--tl-selectStroke);
    stroke-width: calc(1.5px * var(--tl-scale));
  }

  .tl-brush {
    fill: var(--tl-brushFill);
    stroke: var(--tl-brushStroke);
    stroke-width: calc(1px * var(--tl-scale));
    pointer-events: none;
  }

  .tl-dot {
    fill: var(--tl-background);
    stroke: var(--tl-foreground);
    stroke-width: 2px;
  }

  .tl-handle {
    fill: var(--tl-background);
    stroke: var(--tl-selectStroke);
    stroke-width: 1.5px;
    pointer-events: none;
  }

  .tl-handle-bg {
    fill: transparent;
    stroke: none;
    r: calc(16px / max(1, var(--tl-zoom)));
    pointer-events: all;
    cursor: grab;
  }

  .tl-handle-bg:active {
    pointer-events: all;
    fill: none;
  }

  .tl-handle-bg:hover {
    cursor: grab;
    fill: var(--tl-selectFill);
  }

  .tl-binding-indicator {
    fill: transparent;
    stroke: var(--tl-binding);
  }

  .tl-centered {
    display: grid;
    place-content: center;
    place-items: center;
  }

  .tl-centered > * {
    grid-column: 1;
    grid-row: 1;
  }

  .tl-centered-g {
    transform: translate(var(--tl-padding), var(--tl-padding));
  }

  .tl-current-parent > *[data-shy='true'] {
    opacity: 1;
  }

  .tl-binding {
    fill: none;
    stroke: var(--tl-selectStroke);
    stroke-width: calc(2px * var(--tl-scale));
  }

  .tl-counter-scaled-positioned {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    padding: 0;
    contain: layout style size;
  }

  .tl-fade-in {
    opacity: 1;
    transition-timing-function: ease-in-out;
    transition-property: opacity;
    transition-duration: 0.12s;
    transition-delay: 0;
  }

  .tl-fade-out {
    opacity: 0;
    transition-timing-function: ease-out;
    transition-property: opacity;
    transition-duration: 0.12s;
    transition-delay: 0;
  }

  .tl-counter-scaled-positioned > .tl-positioned-div {
    user-select: none;
    padding: 64px;
  }

  .tl-context-bar > * {
    grid-column: 1;
    grid-row: 1;
  }

  .tl-bounds-detail {
    padding: 2px 3px;
    border-radius: 1px;
    white-space: nowrap;
    width: fit-content;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    background-color: var(--tl-selectStroke);
    color: var(--tl-background);
  }

  .tl-grid-canvas {
    position: absolute;
    touch-action: none;
    pointer-events: none;
    user-select: none;
  }

  .tl-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    touch-action: none;
    pointer-events: none;
    user-select: none;
  }

  .tl-grid-dot {
    fill: var(--tl-grid);
  }

  .tl-html-canvas {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    zindex: 20000;
    pointer-events: none;
    border: 2px solid red;
  }

  .tl-direction-indicator {
    z-index: 100000;
    position: absolute;
    top: 0px;
    left: 0px;
    fill: var(--tl-selectStroke);
  }
`,jA=Kf(ca(19)),kA=Kf(ca(19)),gx={},Lj={toVector(a,d){void 0===a&&(a=d);return Array.isArray(a)?a:[a,a]},add(a,d){return[a[0]+d[0],a[1]+d[1]]},sub(a,d){return[a[0]-d[0],a[1]-d[1]]},addTo(a,d){a[0]+=d[0];a[1]+=d[1]},subTo(a,d){a[0]-=d[0];a[1]-=d[1]}},lA={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}},OE=["enter","leave"],PE=["gotpointercapture","lostpointercapture"],
mA=class{constructor(a,d,k){this.ctrl=a;this.args=d;this.key=k;this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(a){this.ctrl.state[this.key]=a}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const {state:a,
shared:d,ingKey:k,args:K}=this;d[k]=a._active=a.active=a._blocked=a._force=!1;a._step=[!1,!1];a.intentional=!1;a._movement=[0,0];a._distance=[0,0];a._direction=[0,0];a._delta=[0,0];a._bounds=[[-Infinity,Infinity],[-Infinity,Infinity]];a.args=K;a.axis=void 0;a.memo=void 0;a.elapsedTime=0;a.direction=[0,0];a.distance=[0,0];a.overflow=[0,0];a._movementBound=[!1,!1];a.velocity=[0,0];a.movement=[0,0];a.delta=[0,0];a.timeStamp=0}start(a){const d=this.state,k=this.config;d._active||(this.reset(),this.computeInitial(),
d._active=!0,d.target=a.target,d.currentTarget=a.currentTarget,d.lastOffset=k.from?ah(k.from,d):d.offset,d.offset=d.lastOffset);d.startTime=d.timeStamp=a.timeStamp}computeValues(a){const d=this.state;d._values=a;d.values=this.config.transform(a)}computeInitial(){const a=this.state;a._initial=a._values;a.initial=a.values}compute(a){const {state:d,config:k,shared:K}=this;d.args=this.args;var da=0;if(a){d.event=a;k.preventDefault&&a.cancelable&&d.event.preventDefault();d.type=a.type;K.touches=this.ctrl.pointerIds.size||
this.ctrl.touchIds.size;K.locked=!!document.pointerLockElement;da=Object;var ja=da.assign,ra={};"buttons"in a&&(ra.buttons=a.buttons);if("shiftKey"in a){const {shiftKey:Fc,altKey:Lc,metaKey:ud,ctrlKey:Jd}=a;Object.assign(ra,{shiftKey:Fc,altKey:Lc,metaKey:ud,ctrlKey:Jd})}ja.call(da,K,ra);K.down=K.pressed=1===K.buttons%2||0<K.touches;da=a.timeStamp-d.timeStamp;d.timeStamp=a.timeStamp;d.elapsedTime=d.timeStamp-d.startTime}d._active&&(ja=d._delta.map(Math.abs),Lj.addTo(d._distance,ja));this.axisIntent&&
this.axisIntent(a);const [Ja,Ra]=d._movement,[$a,fb]=k.threshold,{_step:jb,values:Jb}=d;k.hasCustomTransform?(!1===jb[0]&&(jb[0]=Math.abs(Ja)>=$a&&Jb[0]),!1===jb[1]&&(jb[1]=Math.abs(Ra)>=fb&&Jb[1])):(!1===jb[0]&&(jb[0]=Math.abs(Ja)>=$a&&Math.sign(Ja)*$a),!1===jb[1]&&(jb[1]=Math.abs(Ra)>=fb&&Math.sign(Ra)*fb));d.intentional=!1!==jb[0]||!1!==jb[1];if(d.intentional){ja=[0,0];if(k.hasCustomTransform){const [Fc,Lc]=Jb;ja[0]=!1!==jb[0]?Fc-jb[0]:0;ja[1]=!1!==jb[1]?Lc-jb[1]:0}else ja[0]=!1!==jb[0]?Ja-jb[0]:
0,ja[1]=!1!==jb[1]?Ra-jb[1]:0;this.restrictToAxis&&!d._blocked&&this.restrictToAxis(ja);ra=d.offset;var Ob=d._active&&!d._blocked||d.active;Ob&&(d.first=d._active&&!d.active,d.last=!d._active&&d.active,d.active=K[this.ingKey]=d._active,a&&(d.first&&("bounds"in k&&(d._bounds=ah(k.bounds,d)),this.setup&&this.setup()),d.movement=ja,this.computeOffset()));var [Kb,gc]=d.offset,[[rc,Wb],[kc,hc]]=d._bounds;d.overflow=[Kb<rc?-1:Kb>Wb?1:0,gc<kc?-1:gc>hc?1:0];d._movementBound[0]=d.overflow[0]?!1===d._movementBound[0]?
d._movement[0]:d._movementBound[0]:!1;d._movementBound[1]=d.overflow[1]?!1===d._movementBound[1]?d._movement[1]:d._movementBound[1]:!1;d.offset=Zh(d._bounds,d.offset,d._active?k.rubberband||[0,0]:[0,0]);d.delta=Lj.sub(d.offset,ra);this.computeMovement();Ob&&(!d.last||32<da)&&(d.delta=Lj.sub(d.offset,ra),a=d.delta.map(Math.abs),Lj.addTo(d.distance,a),d.direction=d.delta.map(Math.sign),d._direction=d._delta.map(Math.sign),!d.first&&0<da&&(d.velocity=[a[0]/da,a[1]/da]))}}emit(){const a=this.state;var d=
this.shared;const k=this.config;a._active||this.clean();if(!a._blocked&&a.intentional||a._force||k.triggerAllEvents)d=this.handler(Tg(Tg(Tg({},d),a),{},{[this.aliasKey]:a.values})),void 0!==d&&(a.memo=d)}clean(){this.eventStore.clean();this.timeoutStore.clean()}},zt=class extends mA{constructor(...a){super(...a);ui(this,"aliasKey","xy")}reset(){super.reset();this.state.axis=void 0}init(){this.state.offset=[0,0];this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Lj.add(this.state.lastOffset,
this.state.movement)}computeMovement(){this.state.movement=Lj.sub(this.state.offset,this.state.lastOffset)}axisIntent(a){const d=this.state,k=this.config;!d.axis&&a&&(a="object"===typeof k.axisThreshold?k.axisThreshold[wh(a)]:k.axisThreshold,d.axis=Ak(d._movement,a));d._blocked=(k.lockDirection||!!k.axis)&&!d.axis||!!k.axis&&k.axis!==d.axis}restrictToAxis(a){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case "x":a[1]=0;break;case "y":a[0]=0}}},QE=a=>a,nA={enabled(a=!0){return a},
eventOptions(a,d,k){return Tg(Tg({},k.shared.eventOptions),a)},preventDefault(a=!1){return a},triggerAllEvents(a=!1){return a},rubberband(a=0){switch(a){case !0:return[.15,.15];case !1:return[0,0];default:return Lj.toVector(a)}},from(a){if("function"===typeof a)return a;if(null!=a)return Lj.toVector(a)},transform(a,d,k){a=a||k.shared.transform;this.hasCustomTransform=!!a;return a||QE},threshold(a){return Lj.toVector(a,0)}},jr=Tg(Tg({},nA),{},{axis(a,d,{axis:k}){this.lockDirection="lock"===k;if(!this.lockDirection)return k},
axisThreshold(a=0){return a},bounds(a={}){if("function"===typeof a)return ja=>jr.bounds(a(ja));if("current"in a)return()=>a.current;if("function"===typeof HTMLElement&&a instanceof HTMLElement)return a;const {left:d=-Infinity,right:k=Infinity,top:K=-Infinity,bottom:da=Infinity}=a;return[[d,k],[K,da]]}}),oA={ArrowRight:(a=1)=>[10*a,0],ArrowLeft:(a=1)=>[-10*a,0],ArrowUp:(a=1)=>[0,-10*a],ArrowDown:(a=1)=>[0,10*a]},RE=class extends zt{constructor(...a){super(...a);ui(this,"ingKey","dragging")}reset(){super.reset();
const a=this.state;a._pointerId=void 0;a._pointerActive=!1;a._keyboardActive=!1;a._preventScroll=!1;a._delayed=!1;a.swipe=[0,0];a.tap=!1;a.canceled=!1;a.cancel=this.cancel.bind(this)}setup(){const a=this.state;if(a._bounds instanceof HTMLElement){const d=a._bounds.getBoundingClientRect(),k=a.currentTarget.getBoundingClientRect();a._bounds=jr.bounds({left:d.left-k.left+a.offset[0],right:d.right-k.right+a.offset[0],top:d.top-k.top+a.offset[1],bottom:d.bottom-k.bottom+a.offset[1]})}}cancel(){const a=
this.state;a.canceled||(a.canceled=!0,a._active=!1,setTimeout(()=>{this.compute();this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean();this.state._pointerActive=!1;this.state._keyboardActive=!1;super.clean()}pointerDown(a){const d=this.config,k=this.state;if(null==a.buttons||(Array.isArray(d.pointerButtons)?d.pointerButtons.includes(a.buttons):-1===d.pointerButtons||d.pointerButtons===a.buttons)){var K=this.ctrl.setEventIds(a);
d.pointerCapture&&a.target.setPointerCapture(a.pointerId);K&&1<K.size&&k._pointerActive||(this.start(a),this.setupPointer(a),k._pointerId=Zi(a),k._pointerActive=!0,this.computeValues(Mk(a)),this.computeInitial(),d.preventScrollAxis&&"mouse"!==wh(a)?(k._active=!1,this.setupScrollPrevention(a)):0<d.delay?(this.setupDelayTrigger(a),d.triggerAllEvents&&(this.compute(a),this.emit())):this.startPointerDrag(a))}}startPointerDrag(a){const d=this.state;d._active=!0;d._preventScroll=!0;d._delayed=!1;this.compute(a);
this.emit()}pointerMove(a){const d=this.state,k=this.config;if(d._pointerActive&&(d.type!==a.type||a.timeStamp!==d.timeStamp)){var K=Zi(a);if(void 0===d._pointerId||K===d._pointerId)K=Mk(a),document.pointerLockElement===a.target?d._delta=[a.movementX,a.movementY]:(d._delta=Lj.sub(K,d._values),this.computeValues(K)),Lj.addTo(d._movement,d._delta),this.compute(a),d._delayed&&d.intentional?(this.timeoutStore.remove("dragDelay"),d.active=!1,this.startPointerDrag(a)):k.preventScrollAxis&&!d._preventScroll?
d.axis&&(d.axis===k.preventScrollAxis||"xy"===k.preventScrollAxis?(d._active=!1,this.clean()):(this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(a))):this.emit()}}pointerUp(a){this.ctrl.setEventIds(a);try{this.config.pointerCapture&&a.target.hasPointerCapture(a.pointerId)&&a.target.releasePointerCapture(a.pointerId)}catch(ra){}const d=this.state,k=this.config;if(d._active&&d._pointerActive){var K=Zi(a);if(void 0===d._pointerId||K===d._pointerId){this.state._pointerActive=!1;this.setActive();
this.compute(a);var [da,ja]=d._distance;d.tap=da<=k.tapsThreshold&&ja<=k.tapsThreshold;if(d.tap&&k.filterTaps)d._force=!0;else{const [ra,Ja]=d.direction,[Ra,$a]=d.velocity,[fb,jb]=d.movement,[Jb,Ob]=k.swipe.velocity,[Kb,gc]=k.swipe.distance;d.elapsedTime<k.swipe.duration&&(Math.abs(Ra)>Jb&&Math.abs(fb)>Kb&&(d.swipe[0]=ra),Math.abs($a)>Ob&&Math.abs(jb)>gc&&(d.swipe[1]=Ja))}this.emit()}}}pointerClick(a){!this.state.tap&&0<a.detail&&(a.preventDefault(),a.stopPropagation())}setupPointer(a){const d=this.config,
k=d.device;d.pointerLock&&a.currentTarget.requestPointerLock();d.pointerCapture||(this.eventStore.add(this.sharedConfig.window,k,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,k,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,k,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(a){this.state._preventScroll&&a.cancelable&&
a.preventDefault()}setupScrollPrevention(a){this.state._preventScroll=!1;"persist"in a&&"function"===typeof a.persist&&a.persist();const d=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",d);this.eventStore.add(this.sharedConfig.window,"touch","cancel",d);this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,a)}setupDelayTrigger(a){this.state._delayed=
!0;this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0];this.startPointerDrag(a)},this.config.delay)}keyDown(a){const d=oA[a.key];if(d){const k=this.state,K=a.shiftKey?10:a.altKey?.1:1;this.start(a);k._delta=d(K);k._keyboardActive=!0;Lj.addTo(k._movement,k._delta);this.compute(a);this.emit()}}keyUp(a){a.key in oA&&(this.state._keyboardActive=!1,this.setActive(),this.compute(a),this.emit())}bind(a){const d=this.config.device;a(d,"start",this.pointerDown.bind(this));this.config.pointerCapture&&
(a(d,"change",this.pointerMove.bind(this)),a(d,"end",this.pointerUp.bind(this)),a(d,"cancel",this.pointerUp.bind(this)),a("lostPointerCapture","",this.pointerUp.bind(this)));this.config.keys&&(a("key","down",this.keyDown.bind(this)),a("key","up",this.keyUp.bind(this)));this.config.filterTaps&&a("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},kr="undefined"!==typeof window&&window.document&&window.document.createElement;try{var pA="constructor"in GestureEvent}catch(a){pA=!1}var SE=
pA,At=kr&&"ontouchstart"in window||kr&&1<window.navigator.maxTouchPoints,qA=kr&&"ontouchstart"in window||kr&&1<window.navigator.maxTouchPoints,rA=kr&&"onpointerdown"in window,TE=kr&&"exitPointerLock"in window.document,sA={mouse:0,touch:0,pen:8},UE=Tg(Tg({},jr),{},{device(a,d,{pointer:{touch:k=!1,lock:K=!1,mouse:da=!1}={}}){this.pointerLock=K&&TE;return At&&k?"touch":this.pointerLock?"mouse":rA&&!da?"pointer":At?"touch":"mouse"},preventScrollAxis(a,d,{preventScroll:k}){this.preventScrollDelay="number"===
typeof k?k:k||void 0===k&&a?250:void 0;if(qA&&!1!==k)return a?a:void 0!==k?"y":void 0},pointerCapture(a,d,{pointer:{capture:k=!0,buttons:K=1,keys:da=!0}={}}){this.pointerButtons=K;this.keys=da;return!this.pointerLock&&"pointer"===this.device&&k},threshold(a,d,{filterTaps:k=!1,tapsThreshold:K=3,axis:da}){a=Lj.toVector(a,k?K:da?1:0);this.filterTaps=k;this.tapsThreshold=K;return a},swipe({velocity:a=.5,distance:d=50,duration:k=250}={}){return{velocity:this.transform(Lj.toVector(a)),distance:this.transform(Lj.toVector(d)),
duration:k}},delay(a=0){switch(a){case !0:return 180;case !1:return 0;default:return a}},axisThreshold(a){return a?Tg(Tg({},sA),a):sA}}),VE=class extends mA{constructor(...a){super(...a);ui(this,"ingKey","pinching");ui(this,"aliasKey","da")}init(){this.state.offset=[1,0];this.state.lastOffset=[1,0];this.state._pointerEvents=new Map}reset(){super.reset();const a=this.state;a._touchIds=[];a.canceled=!1;a.cancel=this.cancel.bind(this);a.turns=0}computeOffset(){const {type:a,movement:d,lastOffset:k}=
this.state;this.state.offset="wheel"===a?Lj.add(d,k):[(1+d[0])*k[0],d[1]+k[1]]}computeMovement(){const {offset:a,lastOffset:d}=this.state;this.state.movement=[a[0]/d[0],a[1]-d[1]]}axisIntent(){const a=this.state,[d,k]=a._movement;if(!a.axis){const K=30*Math.abs(d)-Math.abs(k);0>K?a.axis="angle":0<K&&(a.axis="scale")}}restrictToAxis(a){this.config.lockDirection&&("scale"===this.state.axis?a[1]=0:"angle"===this.state.axis&&(a[0]=0))}cancel(){const a=this.state;a.canceled||setTimeout(()=>{a.canceled=
!0;a._active=!1;this.compute();this.emit()},0)}touchStart(a){this.ctrl.setEventIds(a);var d=this.state;const k=this.ctrl.touchIds;d._active&&d._touchIds.every(K=>k.has(K))||2>k.size||(this.start(a),d._touchIds=Array.from(k).slice(0,2),d=Oi(a,d._touchIds),this.pinchStart(a,d))}pointerStart(a){if(null==a.buttons||1===a.buttons%2){this.ctrl.setEventIds(a);a.target.setPointerCapture(a.pointerId);var d=this.state,k=d._pointerEvents,K=this.ctrl.pointerIds;d._active&&Array.from(k.keys()).every(da=>K.has(da))||
(2>k.size&&k.set(a.pointerId,a),2>d._pointerEvents.size||(this.start(a),d=im(...Array.from(k.values())),this.pinchStart(a,d)))}}pinchStart(a,d){this.state.origin=d.origin;this.computeValues([d.distance,d.angle]);this.computeInitial();this.compute(a);this.emit()}touchMove(a){if(this.state._active){var d=Oi(a,this.state._touchIds);this.pinchMove(a,d)}}pointerMove(a){var d=this.state._pointerEvents;d.has(a.pointerId)&&d.set(a.pointerId,a);this.state._active&&(d=im(...Array.from(d.values())),this.pinchMove(a,
d))}pinchMove(a,d){const k=this.state,K=d.angle-k._values[1];let da=0;270<Math.abs(K)&&(da+=Math.sign(K));this.computeValues([d.distance,d.angle-360*da]);k.origin=d.origin;k.turns=da;k._movement=[k._values[0]/k._initial[0]-1,k._values[1]-k._initial[1]];this.compute(a);this.emit()}touchEnd(a){this.ctrl.setEventIds(a);this.state._active&&this.state._touchIds.some(d=>!this.ctrl.touchIds.has(d))&&(this.state._active=!1,this.compute(a),this.emit())}pointerEnd(a){const d=this.state;this.ctrl.setEventIds(a);
try{a.target.releasePointerCapture(a.pointerId)}catch(k){}d._pointerEvents.has(a.pointerId)&&d._pointerEvents.delete(a.pointerId);d._active&&2>d._pointerEvents.size&&(d._active=!1,this.compute(a),this.emit())}gestureStart(a){a.cancelable&&a.preventDefault();const d=this.state;d._active||(this.start(a),this.computeValues([a.scale,a.rotation]),d.origin=[a.clientX,a.clientY],this.compute(a),this.emit())}gestureMove(a){a.cancelable&&a.preventDefault();if(this.state._active){var d=this.state;this.computeValues([a.scale,
a.rotation]);d.origin=[a.clientX,a.clientY];var k=d._movement;d._movement=[a.scale-1,a.rotation];d._delta=Lj.sub(d._movement,k);this.compute(a);this.emit()}}gestureEnd(a){this.state._active&&(this.state._active=!1,this.compute(a),this.emit())}wheel(a){const d=this.config.modifierKey;if(!d||a[d])this.state._active?this.wheelChange(a):this.wheelStart(a),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelStart(a){this.start(a);this.wheelChange(a)}wheelChange(a){"uv"in a||a.cancelable&&a.preventDefault();
const d=this.state;d._delta=[-Nk(a)[1]/100*d.offset[0],0];Lj.addTo(d._movement,d._delta);al(d);this.state.origin=[a.clientX,a.clientY];this.compute(a);this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(a){const d=this.config.device;d&&(a(d,"start",this[d+"Start"].bind(this)),a(d,"change",this[d+"Move"].bind(this)),a(d,"end",this[d+"End"].bind(this)),a(d,"cancel",this[d+"End"].bind(this)));this.config.pinchOnWheel&&a("wheel","",this.wheel.bind(this),
{passive:!1})}},WE=Tg(Tg({},nA),{},{device(a,d,{shared:k,pointer:{touch:K=!1}={}}){if(k.target&&!At&&SE)return"gesture";if(At&&K)return"touch";if(qA){if(rA)return"pointer";if(At)return"touch"}},bounds(a,d,{scaleBounds:k={},angleBounds:K={}}){const da=ra=>{ra=ah(k,ra);ra=Object.assign({},{min:-Infinity,max:Infinity},ra||{});return[ra.min,ra.max]},ja=ra=>{ra=ah(K,ra);ra=Object.assign({},{min:-Infinity,max:Infinity},ra||{});return[ra.min,ra.max]};return"function"!==typeof k&&"function"!==typeof K?[da(),
ja()]:ra=>[da(ra),ja(ra)]},threshold(a,d,k){this.lockDirection="lock"===k.axis;return Lj.toVector(a,this.lockDirection?[.1,3]:0)},modifierKey(a){return void 0===a?"ctrlKey":a},pinchOnWheel(a=!0){return a}}),XE=class extends zt{constructor(...a){super(...a);ui(this,"ingKey","moving")}move(a){this.config.mouseOnly&&"mouse"!==a.pointerType||(this.state._active?this.moveChange(a):this.moveStart(a),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(a){this.start(a);this.computeValues(Mk(a));
this.compute(a);this.computeInitial();this.emit()}moveChange(a){if(this.state._active){var d=Mk(a),k=this.state;k._delta=Lj.sub(d,k._values);Lj.addTo(k._movement,k._delta);this.computeValues(d);this.compute(a);this.emit()}}moveEnd(a){this.state._active&&(this.state._active=!1,this.compute(a),this.emit())}bind(a){a("pointer","change",this.move.bind(this));a("pointer","leave",this.moveEnd.bind(this))}},YE=Tg(Tg({},jr),{},{mouseOnly:(a=!0)=>a}),ZE=class extends zt{constructor(...a){super(...a);ui(this,
"ingKey","scrolling")}scroll(a){this.state._active||this.start(a);this.scrollChange(a);this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(a){a.cancelable&&a.preventDefault();const d=this.state;var k,K;const {scrollX:da,scrollY:ja,scrollLeft:ra,scrollTop:Ja}=a.currentTarget;var Ra=[null!==(k=null!==da&&void 0!==da?da:ra)&&void 0!==k?k:0,null!==(K=null!==ja&&void 0!==ja?ja:Ja)&&void 0!==K?K:0];d._delta=Lj.sub(Ra,d._values);Lj.addTo(d._movement,d._delta);this.computeValues(Ra);
this.compute(a);this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(a){a("scroll","",this.scroll.bind(this))}},$E=jr,aF=class extends zt{constructor(...a){super(...a);ui(this,"ingKey","wheeling")}wheel(a){this.state._active||this.start(a);this.wheelChange(a);this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(a){const d=this.state;d._delta=Nk(a);Lj.addTo(d._movement,d._delta);al(d);this.compute(a);this.emit()}wheelEnd(){this.state._active&&
(this.state._active=!1,this.compute(),this.emit())}bind(a){a("wheel","",this.wheel.bind(this))}},bF=jr,cF=class extends zt{constructor(...a){super(...a);ui(this,"ingKey","hovering")}enter(a){this.config.mouseOnly&&"mouse"!==a.pointerType||(this.start(a),this.computeValues(Mk(a)),this.compute(a),this.emit())}leave(a){if(!this.config.mouseOnly||"mouse"===a.pointerType){var d=this.state;if(d._active){d._active=!1;var k=Mk(a);d._movement=d._delta=Lj.sub(k,d._values);this.computeValues(k);this.compute(a);
d.delta=d.movement;this.emit()}}}bind(a){a("pointer","enter",this.enter.bind(this));a("pointer","leave",this.leave.bind(this))}},dF=Tg(Tg({},jr),{},{mouseOnly:(a=!0)=>a}),hx=new Map,ix=new Map,eF={key:"drag",engine:RE,resolver:UE},fF={key:"hover",engine:cF,resolver:dF},gF={key:"move",engine:XE,resolver:YE},hF={key:"pinch",engine:VE,resolver:WE},iF={key:"scroll",engine:ZE,resolver:$E},jF={key:"wheel",engine:aF,resolver:bF},jx=Kf(ca(19)),kF={target(a){if(a)return()=>"current"in a?a.current:a},enabled(a=
!0){return a},window(a=kr?window:void 0){return a},eventOptions({passive:a=!0,capture:d=!1}={}){return{passive:a,capture:d}},transform(a){return a}},lF=["target","eventOptions","window","enabled","transform"],tA=class{constructor(a,d){ui(this,"_listeners",new Set);this._ctrl=a;this._gestureKey=d}add(a,d,k,K,da){const ja=this._listeners,ra=Ni(d,k),Ja=Tg(Tg({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),da);a.addEventListener(ra,K,Ja);const Ra=()=>{a.removeEventListener(ra,
K,Ja);ja.delete(Ra)};ja.add(Ra);return Ra}clean(){this._listeners.forEach(a=>a());this._listeners.clear()}},mF=class{constructor(){ui(this,"_timeouts",new Map)}add(a,d,k=140,...K){this.remove(a);this._timeouts.set(a,window.setTimeout(d,k,...K))}remove(a){(a=this._timeouts.get(a))&&window.clearTimeout(a)}clean(){this._timeouts.forEach(a=>void window.clearTimeout(a));this._timeouts.clear()}},nF=class{constructor(a){ui(this,"gestures",new Set);ui(this,"_targetEventStore",new tA(this));ui(this,"gestureEventStores",
{});ui(this,"gestureTimeoutStores",{});ui(this,"handlers",{});ui(this,"config",{});ui(this,"pointerIds",new Set);ui(this,"touchIds",new Set);ui(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}});a.drag&&mi(this,"drag");a.wheel&&mi(this,"wheel");a.scroll&&mi(this,"scroll");a.move&&mi(this,"move");a.pinch&&mi(this,"pinch");a.hover&&mi(this,"hover")}setEventIds(a){if("touches"in a)return this.touchIds=new Set(Fj(a));if("pointerId"in a)return"pointerup"===a.type||"pointercancel"===a.type?
this.pointerIds.delete(a.pointerId):"pointerdown"===a.type&&this.pointerIds.add(a.pointerId),this.pointerIds}applyHandlers(a,d){this.handlers=a;this.nativeHandlers=d}applyConfig(a,d){this.config=Di(a,d,this.config)}clean(){this._targetEventStore.clean();for(const a of this.gestures)this.gestureEventStores[a].clean(),this.gestureTimeoutStores[a].clean()}effect(){this.config.shared.target&&this.bind();return()=>this._targetEventStore.clean()}bind(...a){var d=this.config.shared;const k={};let K;if(d.target&&
(K=d.target(),!K))return;if(d.enabled){for(const da of this.gestures){const ja=this.config[da],ra=uA(k,ja.eventOptions,!!K);ja.enabled&&(new (hx.get(da))(this,a,da)).bind(ra)}d=uA(k,d.eventOptions,!!K);for(const da in this.nativeHandlers)d(da,"",ja=>this.nativeHandlers[da](Tg(Tg({},this.state.shared),{},{event:ja,args:a})),void 0,!0)}for(const da in k)k[da]=Ph(...k[da]);if(!K)return k;for(const da in k){const {device:ja,capture:ra,passive:Ja}=Of(da);this._targetEventStore.add(K,ja,"",k[da],{capture:ra,
passive:Ja})}}},uA=(a,d,k)=>(K,da,ja,ra={},Ja=!1)=>{var Ra,$a;const fb=null!==(Ra=ra.capture)&&void 0!==Ra?Ra:d.capture;ra=null!==($a=ra.passive)&&void 0!==$a?$a:d.passive;K=Ja?K:El(K,da,fb);k&&ra&&(K+="Passive");a[K]=a[K]||[];a[K].push(ja)},oF=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/,cv=Kf(ca(19)),kx=Kf(ca(19)),vA=Kf(ca(19)),wA=Kf(ca(19)),pF=Kf(ca(19)),qF=Kf(ca(19)),rF=Kf(ca(19)),sF=Kf(ca(19)),tF={none:(a,d)=>"none",["default"]:(a,d)=>"default",pointer:(a,d)=>"pointer",crosshair:(a,d)=>"crosshair",
move:(a,d)=>"move",wait:(a,d)=>"wait",progress:(a,d)=>"progress",grab:(a,d)=>Ed('\x3cpath d\x3d"m13.5557 17.5742c-.098-.375-.196-.847-.406-1.552-.167-.557-.342-.859-.47-1.233-.155-.455-.303-.721-.496-1.181-.139-.329-.364-1.048-.457-1.44-.119-.509.033-.924.244-1.206.253-.339.962-.49 1.357-.351.371.13.744.512.916.788.288.46.357.632.717 1.542.393.992.564 1.918.611 2.231l.085.452c-.001-.04-.043-1.122-.044-1.162-.035-1.029-.06-1.823-.038-2.939.002-.126.064-.587.084-.715.078-.5.305-.8.673-.979.412-.201.926-.215 1.401-.017.423.173.626.55.687 1.022.014.109.094.987.093 1.107-.013 1.025.006 1.641.015 2.174.004.231.003 1.625.017 1.469.061-.656.094-3.189.344-3.942.144-.433.405-.746.794-.929.431-.203 1.113-.07 1.404.243.285.305.446.692.482 1.153.032.405-.019.897-.02 1.245 0 .867-.021 1.324-.037 2.121-.001.038-.015.298.023.182.094-.28.188-.542.266-.745.049-.125.241-.614.359-.859.114-.234.211-.369.415-.688.2-.313.415-.448.668-.561.54-.235 1.109.112 1.301.591.086.215.009.713-.028 1.105-.061.647-.254 1.306-.352 1.648-.128.447-.274 1.235-.34 1.601-.072.394-.234 1.382-.359 1.82-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.192 1.812-.117.563-.078.567-.101.965-.024.399.121.923.121.923s-.802.104-1.234.034c-.391-.062-.875-.841-1-1.078-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.03-3.139.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.284-.36-.629-1.093-1.243-1.985-.348-.504-1.027-1.085-1.284-1.579-.223-.425-.331-.954-.19-1.325.225-.594.675-.897 1.362-.832.519.05.848.206 1.238.537.225.19.573.534.75.748.163.195.203.276.377.509.23.307.302.459.214.121" fill\x3d"%23fff"/\x3e\x3cg stroke\x3d"%23000" stroke-linecap\x3d"round" stroke-width\x3d".75"\x3e\x3cpath d\x3d"m13.5557 17.5742c-.098-.375-.196-.847-.406-1.552-.167-.557-.342-.859-.47-1.233-.155-.455-.303-.721-.496-1.181-.139-.329-.364-1.048-.457-1.44-.119-.509.033-.924.244-1.206.253-.339.962-.49 1.357-.351.371.13.744.512.916.788.288.46.357.632.717 1.542.393.992.564 1.918.611 2.231l.085.452c-.001-.04-.043-1.122-.044-1.162-.035-1.029-.06-1.823-.038-2.939.002-.126.064-.587.084-.715.078-.5.305-.8.673-.979.412-.201.926-.215 1.401-.017.423.173.626.55.687 1.022.014.109.094.987.093 1.107-.013 1.025.006 1.641.015 2.174.004.231.003 1.625.017 1.469.061-.656.094-3.189.344-3.942.144-.433.405-.746.794-.929.431-.203 1.113-.07 1.404.243.285.305.446.692.482 1.153.032.405-.019.897-.02 1.245 0 .867-.021 1.324-.037 2.121-.001.038-.015.298.023.182.094-.28.188-.542.266-.745.049-.125.241-.614.359-.859.114-.234.211-.369.415-.688.2-.313.415-.448.668-.561.54-.235 1.109.112 1.301.591.086.215.009.713-.028 1.105-.061.647-.254 1.306-.352 1.648-.128.447-.274 1.235-.34 1.601-.072.394-.234 1.382-.359 1.82-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.192 1.812-.117.563-.078.567-.101.965-.024.399.121.923.121.923s-.802.104-1.234.034c-.391-.062-.875-.841-1-1.078-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.03-3.139.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.284-.36-.629-1.093-1.243-1.985-.348-.504-1.027-1.085-1.284-1.579-.223-.425-.331-.954-.19-1.325.225-.594.675-.897 1.362-.832.519.05.848.206 1.238.537.225.19.573.534.75.748.163.195.203.276.377.509.23.307.302.459.214.121" stroke-linejoin\x3d"round"/\x3e\x3cpath d\x3d"m20.5664 21.7344v-3.459"/\x3e\x3cpath d\x3d"m18.5508 21.7461-.016-3.473"/\x3e\x3cpath d\x3d"m16.5547 18.3047.021 3.426"/\x3e\x3c/g\x3e',
a,d),grabbing:(a,d)=>Ed("\x3cpath d\x3d'm13.5732 12.0361c.48-.178 1.427-.069 1.677.473.213.462.396 1.241.406 1.075.024-.369-.024-1.167.137-1.584.117-.304.347-.59.686-.691.285-.086.62-.116.916-.055.313.064.642.287.765.499.362.623.368 1.899.385 1.831.064-.272.07-1.229.283-1.584.141-.235.497-.445.687-.479.294-.052.656-.068.964-.008.249.049.586.344.677.487.219.344.342 1.316.379 1.658.016.141.074-.393.293-.736.406-.639 1.844-.763 1.898.639.026.654.02.624.02 1.064 0 .516-.012.828-.04 1.202-.03.399-.116 1.304-.241 1.742-.086.301-.371.978-.653 1.384 0 0-1.074 1.25-1.191 1.812-.117.563-.078.567-.102.965-.023.399.121.923.121.923s-.801.104-1.234.034c-.391-.062-.875-.84-1-1.078-.172-.328-.539-.265-.682-.023-.224.383-.709 1.07-1.05 1.113-.669.084-2.055.03-3.14.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.283-.36-1.002-.929-1.243-1.985-.213-.936-.192-1.395.037-1.77.232-.381.67-.589.854-.625.208-.042.692-.039.875.062.223.123.313.159.488.391.23.307.312.456.213.121-.076-.262-.322-.595-.434-.97-.109-.361-.401-.943-.38-1.526.008-.221.103-.771.832-1.042' fill\x3d'%23fff'/\x3e\x3cg stroke\x3d'%23000' stroke-width\x3d'.75'\x3e\x3cpath d\x3d'm13.5732 12.0361c.48-.178 1.427-.069 1.677.473.213.462.396 1.241.406 1.075.024-.369-.024-1.167.137-1.584.117-.304.347-.59.686-.691.285-.086.62-.116.916-.055.313.064.642.287.765.499.362.623.368 1.899.385 1.831.064-.272.07-1.229.283-1.584.141-.235.497-.445.687-.479.294-.052.656-.068.964-.008.249.049.586.344.677.487.219.344.342 1.316.379 1.658.016.141.074-.393.293-.736.406-.639 1.844-.763 1.898.639.026.654.02.624.02 1.064 0 .516-.012.828-.04 1.202-.03.399-.116 1.304-.241 1.742-.086.301-.371.978-.653 1.384 0 0-1.074 1.25-1.191 1.812-.117.563-.078.567-.102.965-.023.399.121.923.121.923s-.801.104-1.234.034c-.391-.062-.875-.84-1-1.078-.172-.328-.539-.265-.682-.023-.224.383-.709 1.07-1.05 1.113-.669.084-2.055.03-3.14.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.283-.36-1.002-.929-1.243-1.985-.213-.936-.192-1.395.037-1.77.232-.381.67-.589.854-.625.208-.042.692-.039.875.062.223.123.313.159.488.391.23.307.312.456.213.121-.076-.262-.322-.595-.434-.97-.109-.361-.401-.943-.38-1.526.008-.221.103-.771.832-1.042z' stroke-linejoin\x3d'round'/\x3e\x3cpath d\x3d'm20.5664 19.7344v-3.459' stroke-linecap\x3d'round'/\x3e\x3cpath d\x3d'm18.5508 19.7461-.016-3.473' stroke-linecap\x3d'round'/\x3e\x3cpath d\x3d'm16.5547 16.3047.021 3.426' stroke-linecap\x3d'round'/\x3e\x3c/g\x3e",
a,d),text:(a,d)=>Ed("\x3cpath d\x3d'm6.94 2v-1c-1.35866267-.08246172-2.66601117.53165299-3.47 1.63-.80398883-1.09834701-2.11133733-1.71246172-3.47-1.63v1c1.30781678-.16635468 2.55544738.59885876 3 1.84v5.1h-1v1h1v4.16c-.4476345 1.2386337-1.69302129 2.002471-3 1.84v1c1.35687108.0731933 2.6600216-.5389494 3.47-1.63.8099784 1.0910506 2.11312892 1.7031933 3.47 1.63v-1c-1.28590589.133063-2.49760499-.6252793-2.94-1.84v-4.18h1v-1h-1v-5.08c.43943906-1.21710975 1.65323743-1.97676587 2.94-1.84z' transform\x3d'translate(14 9)'/\x3e",
a,d),["resize-edge"]:(a,d)=>Ed("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",a,d),["resize-corner"]:(a,d)=>Ed("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",
a,d),["ew-resize"]:(a,d)=>Ed("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",a,d),["ns-resize"]:(a,d)=>Ed("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",
a+90,d),["nesw-resize"]:(a,d)=>Ed("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",a,d),["nwse-resize"]:(a,d)=>Ed("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",
a+90,d),rotate:(a,d)=>Ed('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+45,d),["nwse-rotate"]:(a,d)=>Ed('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a,d),["nesw-rotate"]:(a,d)=>Ed('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+90,d),["senw-rotate"]:(a,d)=>Ed('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+180,d),["swne-rotate"]:(a,d)=>Ed('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+270,d)},uF=Kf(ca(19));Kf(ca(19));var xA=ca(19),yA=Kf(ca(19));if(!ca(19).useState)throw Error("mobx-react-lite requires React with Hooks support");if(!Ue)throw Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var vF=ca(20),Bt=Kf(ca(19)),zA="undefined"===typeof FinalizationRegistry?void 0:FinalizationRegistry,wF=1E4,xF=function(a){var d="function"===typeof Symbol&&Symbol.iterator,k=d&&a[d],K=0;if(k)return k.call(a);if(a&&"number"===typeof a.length)return{next:function(){a&&
K>=a.length&&(a=void 0);return{value:a&&a[K++],done:!a}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.");},AA=zA?Nd(zA):Le(),yF=AA.addReactionToTrack,zF=AA.recordReactionAsCommitted,BA=function(a,d){var k="function"===typeof Symbol&&a[Symbol.iterator];if(!k)return a;a=k.call(a);var K,da=[];try{for(;(void 0===d||0<d--)&&!(K=a.next()).done;)da.push(K.value)}catch(ra){var ja={error:ra}}finally{try{K&&!K.done&&(k=a["return"])&&k.call(a)}finally{if(ja)throw ja.error;
}}return da},AF=function(){return function(){}}(),ns=ca(19),CA="function"===typeof Symbol&&Symbol.for,DA=CA?Symbol.for("react.forward_ref"):"function"===typeof ns.forwardRef&&(0,ns.forwardRef)(function(a){return null}).$$typeof,EA=CA?Symbol.for("react.memo"):"function"===typeof ns.memo&&(0,ns.memo)(function(a){return null}).$$typeof,BF={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};rf.displayName="Observer";ca(19);ca(19);ca(19);(function(a){a||=se;wc({reactionScheduler:a})})(vF.unstable_batchedUpdates);
var CF=Kf(ca(19)),lx=ca(589),ln=CF.forwardRef(function(a,d){var {children:k,opacity:K,centered:da,className:ja=""}=a,ra=Jf(a,["children","opacity","centered","className"]);return(0,lx.jsx)(rf,{children:()=>(0,lx.jsx)("div",{ref:d,className:`tl-positioned-div ${ja}`,style:K?{opacity:K}:void 0,draggable:!1,children:(0,lx.jsx)("div",ff(Zd({className:`tl-positioned-inner ${da?"tl-centered":""}`},ra),{children:k}))})})}),DF=Kf(ca(19)),mx=ca(589),Nn=DF.forwardRef(function(a,d){var {id:k,className:K="",
style:da,children:ja}=a,ra=Jf(a,["id","className","style","children"]);return(0,mx.jsx)(rf,{children:()=>(0,mx.jsx)("svg",{ref:d,style:da,className:`tl-positioned-svg ${K}`,children:(0,mx.jsx)("g",ff(Zd({id:k,className:"tl-centered-g"},ra),{children:ja}))})})}),Ct=Kf(ca(19)),FA=Kf(ca(19)),dv=Kf(ca(19)),EF=ca(589),$p=ee(function(a){var {id:d,bounds:k,zIndex:K,rotation:da=0,className:ja="",children:ra}=a;a=Jf(a,"id bounds zIndex rotation className children".split(" "));const Ja=dv.useRef(null);dv.useLayoutEffect(()=>
{Ja.current.style.transform=`translate(
        calc(${k.minX}px - var(--tl-padding)),
        calc(${k.minY}px - var(--tl-padding)))
        rotate(${da+(k.rotation||0)}rad)`},[k.minX,k.minY,da,k.rotation]);dv.useLayoutEffect(()=>{const Ra=Ja.current;Ra.style.width=`calc(${Math.floor(k.width)}px + (var(--tl-padding) * 2))`;Ra.style.height=`calc(${Math.floor(k.height)}px + (var(--tl-padding) * 2))`},[k.width,k.height]);dv.useLayoutEffect(()=>{const Ra=Ja.current;void 0!==K&&(Ra.style.zIndex=K.toString())},[K]);return(0,EF.jsx)("div",ff(Zd({id:d,ref:Ja,className:`tl-positioned ${ja}`,"aria-label":"container"},a),{children:ra}))}),
FF=Kf(ca(19)),GA=ca(589),GF=ee(function({shapes:a,hidden:d,bounds:k,rotation:K=0}){const {components:{ContextBar:da},viewport:{bounds:ja,camera:{point:[ra,Ja],zoom:Ra}}}=dh(),$a=FF.useRef(null);var fb=sf.getRotatedBounds(k,K);fb=sf.multiplyBounds(fb,Ra);pb($a,k,K,10005);if(!da)throw Error("Expected a ContextBar component.");const jb=sf.translateBounds(fb,[ra*Ra,Ja*Ra]);return(0,GA.jsx)("div",{ref:$a,className:"tl-counter-scaled-positioned","aria-label":"context-bar-container","data-html2canvas-ignore":"true",
children:(0,GA.jsx)(da,{hidden:d,shapes:a,bounds:k,offsets:{left:jb.minX,right:ja.width-jb.maxX,top:jb.minY,bottom:ja.height-jb.maxY,width:jb.width,height:jb.height},scaledBounds:fb,rotation:K})})}),HA=Kf(ca(19)),HF=ca(589),IA=ee(function({children:a}){const d=HA.useRef(null),{viewport:k}=dh(),K=d.current,{zoom:da,point:ja}=k.camera;HA.useEffect(()=>{K&&(K.style.transform=`scale(${da}) translate3d(${ja[0]}px, ${ja[1]}px, 0)`)},[da,ja,K]);return(0,HF.jsx)("div",{ref:d,className:"tl-absolute tl-layer",
children:a})}),ev=ca(589),JA=ee(function({shape:a,isHovered:d=!1,isSelected:k=!1,isBinding:K=!1,isEditing:da=!1,isLocked:ja=!1,meta:ra}){const {bounds:Ja,props:{scale:Ra,rotation:$a=0},ReactIndicator:fb}=a;return(0,ev.jsx)($p,{"data-type":"Indicator","data-html2canvas-ignore":"true",bounds:Ja,rotation:$a,scale:Ra,zIndex:da?1E3:1E4,children:(0,ev.jsx)(Nn,{children:(0,ev.jsx)("g",{className:`tl-indicator-container ${k?"tl-selected":"tl-hovered"} ${ja?"tl-locked":""}`,children:(0,ev.jsx)(fb,{isEditing:da,
isBinding:K,isHovered:d,isLocked:ja,isSelected:k,isErasing:!1,meta:ra})})})})}),KA=Kf(ca(19)),fv=ca(589),IF=ee(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:k}},components:{QuickLinks:K}}=dh();var da=mg();const ja=Jg(d);if(!K)throw Error("Expected a QuickLinks component.");da=50>a.height*k||!da.selectedShapesArray.includes(d);return(0,fv.jsx)($p,{bounds:a,className:"tl-quick-links-container","data-html2canvas-ignore":"true",children:(0,fv.jsx)(ln,{children:(0,fv.jsx)("span",ff(Zd({style:{position:"absolute",
top:"100%",pointerEvents:"all",transformOrigin:"left top",paddingTop:"8px",transform:"scale(var(--tl-scale))",minWidth:"320px"}},ja),{onPointerDown:ra=>ra.stopPropagation(),children:(0,fv.jsx)(K,{className:"tl-backlinks-count "+(da?"tl-backlinks-count-rounded":""),id:d.id,shape:d})}))})})}),gv=ca(589),JF=ee(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:k}},components:{BacklinksCount:K}}=dh();var da=mg();if(!K)throw Error("Expected a BacklinksCount component.");const ja=ra=>ra.stopPropagation();
da=50>a.height*k||!da.selectedShapesArray.includes(d)||d.hideSelection;return(0,gv.jsx)($p,{bounds:a,className:"tl-backlinks-count-container",children:(0,gv.jsx)(ln,{children:(0,gv.jsx)("span",{style:{position:"absolute",left:"100%",pointerEvents:"all",transformOrigin:"left top",transform:"translateY(6px) scale(var(--tl-scale))"},onPointerDown:ja,onWheelCapture:ja,onKeyDown:ja,title:"Shape Backlinks",children:(0,gv.jsx)(K,{className:"tl-backlinks-count "+(da?"tl-backlinks-count-rounded":""),id:d.id,
shape:d})})})})}),KF=Kf(ca(19)),LA=ca(589),LF=ee(function({bounds:a,hidden:d,shapes:k,rotation:K=0,detail:da="size"}){const {components:{SelectionDetail:ja},viewport:{camera:{zoom:ra}}}=dh(),Ja=KF.useRef(null),Ra=sf.multiplyBounds(a,ra);pb(Ja,a,K,10003);if(!ja)throw Error("Expected a SelectionDetail component.");return(0,LA.jsx)("div",{ref:Ja,className:`tl-counter-scaled-positioned ${d?"tl-fade-out":""}`,"aria-label":"bounds-detail-container","data-html2canvas-ignore":"true",children:(0,LA.jsx)(ja,
{shapes:k,bounds:a,scaledBounds:Ra,zoom:ra,rotation:K,detail:da})})}),MA=ca(589),MF=ee(function({shape:a,isHovered:d=!1,isSelected:k=!1,isBinding:K=!1,isErasing:da=!1,isEditing:ja=!1,onEditingEnd:ra,asset:Ja,meta:Ra,zIndex:$a}){const {bounds:fb,props:{rotation:jb,scale:Jb},ReactComponent:Ob}=a,Kb=mg(),gc=Jg(a);var rc=Kb.getParentGroup(a);rc=Kb.selectedIds.has(null==rc?void 0:rc.id);return(0,MA.jsx)($p,{"data-shape-id":a.id,"data-html2canvas-ignore":!k&&!rc&&0!==Kb.selectedShapes.size||null,zIndex:$a,
"data-type":"Shape",bounds:fb,rotation:jb,scale:Jb,children:(0,MA.jsx)(Ob,{meta:Ra,isEditing:ja,isBinding:K,isHovered:d,isSelected:k,isErasing:da,events:gc,asset:Ja,onEditingEnd:ra})})}),os=ca(589),NA=[[-1,.15,64],[.05,.375,16],[.15,1,4],[.7,2.5,1]],NF=ee(function({size:a}){const {viewport:{camera:{point:d,zoom:k}}}=dh();return(0,os.jsxs)("svg",{className:"tl-grid",version:"1.1",xmlns:"http://www.w3.org/2000/svg","data-html2canvas-ignore":"true",children:[(0,os.jsx)("defs",{children:NA.map(([K,da,
ja],ra)=>{ja=ja*a*k;var Ja=d[0]*k,Ra=d[1]*k;Ja=0<Ja?Ja%ja:ja+Ja%ja;Ra=0<Ra?Ra%ja:ja+Ra%ja;K=jk(k,[K,da],[0,1]);return(0,os.jsx)("pattern",{id:`grid-${ra}`,width:ja,height:ja,patternUnits:"userSpaceOnUse",children:!(2<K||.1>K)&&(0,os.jsx)("circle",{className:"tl-grid-dot",cx:Ja,cy:Ra,r:1.5,opacity:Math.max(0,Math.min(K,1))})},`grid-pattern-${ra}`)})}),NA.map((K,da)=>(0,os.jsx)("rect",{width:"100%",height:"100%",fill:`url(#grid-${da})`},`grid-rect-${da}`))]})}),OA=ee(function({size:a}){return(0,os.jsx)(NF,
{size:a})}),PA=ca(589),QA=ee(function({bounds:a}){const d=kk("background");return(0,PA.jsx)(Nn,ff(Zd({"data-html2canvas-ignore":"true"},d),{children:(0,PA.jsx)("rect",{className:"tl-bounds-bg",width:Math.max(1,a.width),height:Math.max(1,a.height),pointerEvents:"all",rx:8,ry:8})}))});ca(19);var RA=ca(589),SA=ee(function({scaledBounds:a,shapes:d,detail:k="size",rotation:K=0}){var da;const ja=1===d.length?K:null!=(da=a.rotation)?da:0;return(0,RA.jsx)(ln,{centered:!0,children:(0,RA.jsx)("div",{className:"tl-bounds-detail",
style:{transform:ja<Mo||ja>3*Mo?`rotate(${ja}rad) translateY(${a.height/2+24}px)`:`rotate(${Math.PI+ja}rad) translateY(${a.height/2+32}px)`,padding:"2px 3px",borderRadius:"1px"},children:1===d.length&&"line"===d[0].type?`${be.dist(d[0].props.handles.start.point,d[0].props.handles.end.point).toFixed()}`:"size"===k?`${a.width.toFixed()} \xD7 ${a.height.toFixed()}`:`\u2220${Ml.radiansToDegrees(Ml.clampRadians(K)).toFixed()}\xB0`})})}),nx=ca(589),OF={top_left_corner:"tl-cursor-nwse",top_right_corner:"tl-cursor-nesw",
bottom_right_corner:"tl-cursor-nwse",bottom_left_corner:"tl-cursor-nesw"},hv=ee(function({cx:a,cy:d,size:k,targetSize:K,corner:da,isHidden:ja}){const ra=kk(da);return(0,nx.jsxs)("g",ff(Zd({opacity:ja?0:1},ra),{children:[(0,nx.jsx)("rect",{className:"tl-transparent "+(ja?"":OF[da]),"aria-label":`${da} target`,x:a-1.25*K,y:d-1.25*K,width:2.5*K,height:2.5*K,pointerEvents:ja?"none":"all"}),(0,nx.jsx)("rect",{className:"tl-corner-handle","aria-label":`${da} handle`,x:a-k/2,y:d-k/2,width:k,height:k,pointerEvents:"none"})]}))}),
iv=ca(589),ox=ee(function({cx:a,cy:d,size:k,direction:K,isHidden:da}){const ja=mg();return(0,iv.jsxs)("g",{className:"tl-clone-handle",opacity:da?0:1,children:[(0,iv.jsx)("circle",{"aria-label":`${K} handle`,pointerEvents:"all",onPointerDown:ra=>ja.api.clone(K),cx:a,cy:d,r:k}),(0,iv.jsx)("line",{x1:a-k/2,y1:d,x2:a+k/2,y2:d}),(0,iv.jsx)("line",{x1:a,y1:d-k/2,x2:a,y2:d+k/2})]})}),PF=ca(589),QF={top_edge:"tl-cursor-ns",right_edge:"tl-cursor-ew",bottom_edge:"tl-cursor-ns",left_edge:"tl-cursor-ew"},jv=
ee(function({x:a,y:d,width:k,height:K,targetSize:da,edge:ja,disabled:ra,isHidden:Ja}){const Ra=kk(ja);return(0,PF.jsx)("rect",Zd({pointerEvents:Ja||ra?"none":"all",className:"tl-transparent tl-edge-handle "+(Ja?"":QF[ja]),"aria-label":`${ja} target`,opacity:Ja?0:1,x:a-da,y:d-da,width:Math.max(1,k+2*da),height:Math.max(1,K+2*da)},Ra))}),px=ca(589);ee(function({cx:a,cy:d,size:k,targetSize:K,isHidden:da}){const ja=kk("rotate");return(0,px.jsxs)("g",ff(Zd({opacity:da?0:1},ja),{children:[(0,px.jsx)("circle",
{className:"tl-transparent ","aria-label":"rotate target",cx:a,cy:d,r:K,pointerEvents:da?"none":"all"}),(0,px.jsx)("circle",{className:"tl-rotate-handle","aria-label":"rotate handle",cx:a,cy:d,r:k/2,pointerEvents:"none"})]}))});ca(19);var TA=ca(589),kv=ee(function({cx:a,cy:d,targetSize:k,corner:K,isHidden:da}){const ja=kk(K);return(0,TA.jsx)("g",ff(Zd({opacity:da?0:1},ja),{children:(0,TA.jsx)("rect",{className:"tl-transparent","aria-label":`${K} target`,x:a-2.5*k,y:d-2.5*k,width:3*k,height:3*k,pointerEvents:da?
"none":"all"})}))}),Gk=ca(589),UA=ee(function({bounds:a,showResizeHandles:d,showRotateHandles:k,showCloneHandles:K,shapes:da}){var ja,ra;const Ja=mg();let {width:Ra,height:$a}=a;var fb=Ja.viewport.camera.zoom;a=8/fb;const jb=6/fb;fb=30/fb;const Jb=2*a,Ob=1===da.length?da[0].canResize:[!0,!0],Kb=null!=(ra=null==(ja=Ja.editingShape)?void 0:ja.props.borderRadius)?ra:0;return(0,Gk.jsx)(Gk.Fragment,{children:0<da.length&&(0,Gk.jsxs)(Nn,{children:[!Ja.editingShape&&(0,Gk.jsx)("rect",{className:"tl-bounds-fg",
width:Math.max(Ra,1),height:Math.max($a,1),rx:Kb,ry:Kb,pointerEvents:"none"}),(0,Gk.jsx)(jv,{x:2*jb,y:0,width:Ra-4*jb,height:0,targetSize:jb,edge:"top_edge",disabled:!Ob[1],isHidden:!d}),(0,Gk.jsx)(jv,{x:Ra,y:2*jb,width:0,height:$a-4*jb,targetSize:jb,edge:"right_edge",disabled:!Ob[0],isHidden:!d}),(0,Gk.jsx)(jv,{x:2*jb,y:$a,width:Ra-4*jb,height:0,targetSize:jb,edge:"bottom_edge",disabled:!Ob[1],isHidden:!d}),(0,Gk.jsx)(jv,{x:0,y:2*jb,width:0,height:$a-4*jb,targetSize:jb,edge:"left_edge",disabled:!Ob[0],
isHidden:!d}),(0,Gk.jsx)(kv,{cx:0,cy:0,targetSize:jb,corner:"top_left_resize_corner",isHidden:!k}),(0,Gk.jsx)(kv,{cx:Ra+2*jb,cy:0,targetSize:jb,corner:"top_right_resize_corner",isHidden:!k}),(0,Gk.jsx)(kv,{cx:Ra+2*jb,cy:$a+2*jb,targetSize:jb,corner:"bottom_right_resize_corner",isHidden:!k}),(0,Gk.jsx)(kv,{cx:0,cy:$a+2*jb,targetSize:jb,corner:"bottom_left_resize_corner",isHidden:!k}),(0,Gk.jsx)(ox,{cx:-fb,cy:$a/2,size:Jb,direction:"left",isHidden:!K}),(0,Gk.jsx)(ox,{cx:Ra+fb,cy:$a/2,size:Jb,direction:"right",
isHidden:!K}),(0,Gk.jsx)(ox,{cx:Ra/2,cy:$a+fb,size:Jb,direction:"down",isHidden:!K}),(null==Ob?void 0:Ob.every(gc=>gc))&&(0,Gk.jsxs)(Gk.Fragment,{children:[(0,Gk.jsx)(hv,{cx:0,cy:0,size:a,targetSize:jb,corner:"top_left_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:Ra,cy:0,size:a,targetSize:jb,corner:"top_right_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:Ra,cy:$a,size:a,targetSize:jb,corner:"bottom_right_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:0,cy:$a,size:a,targetSize:jb,corner:"bottom_left_corner",isHidden:!d})]})]})})}),
qx=ca(589),VA=ee(function({bounds:a}){return(0,qx.jsx)($p,{bounds:a,zIndex:10001,children:(0,qx.jsx)(Nn,{children:(0,qx.jsx)("rect",{className:"tl-brush",x:0,y:0,width:a.width,height:a.height})})})}),WA=ca(589);ee(function(){return(0,WA.jsx)(WA.Fragment,{})});var rx=ca(589),XA=ee(function({shape:a,handle:d,id:k}){a=ld(a,k);const [K,da]=d.point;return(0,rx.jsxs)("g",ff(Zd({className:"tl-handle","aria-label":"handle"},a),{transform:`translate(${K}, ${da})`,children:[(0,rx.jsx)("circle",{className:"tl-handle-bg",
pointerEvents:"all"}),(0,rx.jsx)("circle",{className:"tl-counter-scaled tl-handle",pointerEvents:"none",r:4})]}))}),YA=Kf(ca(19)),sx=ca(589),tx=ee(function({direction:a}){const {viewport:{bounds:d}}=dh(),k=YA.useRef(null);YA.useLayoutEffect(()=>{const K=k.current;if(K){var da=[d.width/2,d.height/2],ja=sf.getRectangleSides([12,12],[d.width-24,d.height-24]);for(const [,[ra,Ja]]of ja)ja=u(da,a,ra,Ja),ja.didIntersect&&(ja=ja.points[0],K.style.transform=`translate(${ja[0]-6}px,${ja[1]-6}px) rotate(${be.toAngle(a)}rad)`)}},
[a,d]);return(0,sx.jsx)("div",{ref:k,className:"tl-direction-indicator","data-html2canvas-ignore":"true",children:(0,sx.jsx)("svg",{height:12,width:12,children:(0,sx.jsx)("polygon",{points:"0,0 12,6 0,12"})})})}),Mj=ca(589),RF=ee(function({id:a,className:d,brush:k,shapes:K,assets:da,bindingShapes:ja,editingShape:ra,hoveredShape:Ja,hoveredGroup:Ra,selectionBounds:$a,selectedShapes:fb,erasingShapes:jb,selectionDirectionHint:Jb,cursor:Ob="default",cursorRotation:Kb=0,selectionRotation:gc=0,showSelection:rc=
!0,showHandles:Wb=!0,showSelectionRotation:kc=!1,showResizeHandles:hc=!0,showRotateHandles:Fc=!0,showCloneHandles:Lc=!0,showSelectionDetail:ud=!0,showContextBar:Jd=!0,showGrid:Ee=!0,gridSize:Sd=8,onEditingEnd:De=KE,theme:gf=Pu,children:Te}){var df;const Gd=Ct.useRef(null),{viewport:od,components:Dd,meta:jd}=dh(),Cd=mg(),Me=Ct.useCallback(ef=>{Cd.inputs.updateContainerOffset([ef.minX,ef.minY])},[]);$k(gf,a);$c(Gd);mj(Gd,od,Me);$i(Gd);ie();Xd(Gd,Ob,Kb);oe(Gd);sg(Gd);a=hg();const af=(Ob=1===(null==fb?
void 0:fb.length)&&fb[0])&&"handles"in Ob.props?null==fb?void 0:fb[0]:void 0,Nf=Ct.useMemo(()=>new Set(fb||[]),[fb]),bg=Ct.useMemo(()=>new Set(jb||[]),[jb]);Ob=1===(null==fb?void 0:fb.length)?fb[0]:void 0;Ra=[...(new Set([Ra,Ja]))].filter(cg);return(0,Mj.jsxs)("div",{ref:Gd,className:`tl-container ${null!=d?d:""}`,children:[(0,Mj.jsxs)("div",ff(Zd({tabIndex:-1,className:"tl-absolute tl-canvas"},a),{children:[Ee&&Dd.Grid&&(0,Mj.jsx)(Dd.Grid,{size:Sd}),(0,Mj.jsxs)(IA,{children:[Dd.SelectionBackground&&
fb&&$a&&rc&&(0,Mj.jsx)($p,{"data-type":"SelectionBackground",bounds:$a,zIndex:2,"data-html2canvas-ignore":"true",children:(0,Mj.jsx)(Dd.SelectionBackground,{shapes:fb,bounds:$a,showResizeHandles:hc,showRotateHandles:Fc})}),K&&K.map((ef,Eg)=>(0,Mj.jsx)(MF,{shape:ef,asset:da&&ef.props.assetId?da[ef.props.assetId]:void 0,isEditing:ef===ra,isHovered:ef===Ja,isBinding:null==ja?void 0:ja.includes(ef),isSelected:Nf.has(ef),isErasing:bg.has(ef),meta:jd,zIndex:1E3+Eg,onEditingEnd:De},"shape_"+ef.id)),!Cd.isIn("select.pinching")&&
(null==fb?void 0:fb.map(ef=>(0,Mj.jsx)(JA,{shape:ef,isEditing:ef===ra,isHovered:!1,isBinding:!1,isSelected:!0,isLocked:ef.props.isLocked},"selected_indicator_"+ef.id))),Ra.map(ef=>ef!==ra&&(0,Mj.jsx)(JA,{shape:ef},"hovered_indicator_"+ef.id)),Ob&&Dd.BacklinksCount&&(0,Mj.jsx)(JF,{hidden:!1,bounds:Ob.bounds,shape:Ob}),Ja&&Ja!==Ob&&Dd.QuickLinks&&(0,Mj.jsx)(IF,{hidden:!1,bounds:Ja.bounds,shape:Ja}),k&&Dd.Brush&&(0,Mj.jsx)(Dd.Brush,{bounds:k}),fb&&$a&&(0,Mj.jsxs)(Mj.Fragment,{children:[rc&&Dd.SelectionForeground&&
(0,Mj.jsx)($p,{"data-type":"SelectionForeground","data-html2canvas-ignore":"true",bounds:$a,zIndex:ra&&fb.includes(ra)?1002:10002,children:(0,Mj.jsx)(Dd.SelectionForeground,{shapes:fb.filter(ef=>!ef.props.isLocked),bounds:$a,showResizeHandles:hc,showRotateHandles:Fc,showCloneHandles:Lc})}),Wb&&af&&Dd.Handle&&(0,Mj.jsx)($p,{"data-type":"onlySelectedShapeWithHandles","data-html2canvas-ignore":"true",bounds:$a,zIndex:10003,children:(0,Mj.jsx)(Nn,{children:Object.entries(null!=(df=af.props.handles)?df:
{}).map(([ef,Eg])=>Ct.createElement(Dd.Handle,{key:`${Eg.id}_handle_${Eg.id}`,shape:af,handle:Eg,id:ef}))})}),fb&&Dd.SelectionDetail&&(0,Mj.jsx)(LF,{"data-html2canvas-ignore":"true",shapes:fb,bounds:$a,detail:kc?"rotation":"size",hidden:!ud,rotation:gc},"detail"+fb.map(ef=>ef.id).join(""))]})]}),Jb&&$a&&fb&&(0,Mj.jsx)(tx,{direction:Jb,bounds:$a,shapes:fb}),(0,Mj.jsx)("div",{id:"tl-dev-tools-canvas-anchor","data-html2canvas-ignore":"true"})]})),(0,Mj.jsx)(IA,{children:fb&&$a&&(0,Mj.jsx)(Mj.Fragment,
{children:fb&&Dd.ContextBar&&(0,Mj.jsx)(GF,{shapes:fb.filter(ef=>!ef.props.isLocked),hidden:!Jd,bounds:Ob?Ob.bounds:$a,rotation:Ob?Ob.props.rotation:0},"context"+fb.map(ef=>ef.id).join(""))})}),Te]})}),ZA=Kf(ca(19)),$A=Kf(ca(19)),aB=ca(589);ee(function({children:a}){const d=$A.useRef(null),{viewport:k}=dh();$A.useEffect(()=>ic(()=>{const K=d.current;if(K){var {zoom:da,point:ja}=k.camera;K.style.transform=`scale(${da}) translateX(${ja[0]}px) translateY(${ja[1]}px)`}}),[]);return(0,aB.jsx)("svg",{className:"tl-absolute tl-overlay",
pointerEvents:"none",children:(0,aB.jsx)("g",{ref:d,pointerEvents:"none",children:a})})});var SF=ca(589),TF=ee(function(a){const d=yc(a),k=Ej(a.id);Tc(d,a);mc(d,a);return(0,SF.jsx)(k.Provider,{value:d,children:a.children})}),UF=ca(589),VF=ee(function({id:a="noid",viewport:d,inputs:k,callbacks:K=Pu,meta:da=Pu,components:ja=Pu,children:ra}){const [Ja,Ra]=ZA.useState(()=>{const {Brush:fb,ContextBar:jb,DirectionIndicator:Jb,Grid:Ob,Handle:Kb,SelectionBackground:gc,SelectionDetail:rc,SelectionForeground:Wb}=
ja,kc=Jf(ja,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return{id:a,viewport:d,inputs:k,callbacks:K,meta:da,components:ff(Zd({},kc),{Brush:null===fb?void 0:VA,ContextBar:jb,DirectionIndicator:null===Jb?void 0:tx,Grid:null===Ob?void 0:OA,Handle:null===Kb?void 0:XA,SelectionBackground:null===gc?void 0:QA,SelectionDetail:null===rc?void 0:SA,SelectionForeground:null===Wb?void 0:UA})}});ZA.useLayoutEffect(()=>{const {Brush:fb,ContextBar:jb,
DirectionIndicator:Jb,Grid:Ob,Handle:Kb,SelectionBackground:gc,SelectionDetail:rc,SelectionForeground:Wb}=ja,kc=Jf(ja,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return ic(()=>{Ra({id:a,viewport:d,inputs:k,callbacks:K,meta:da,components:ff(Zd({},kc),{Brush:null===fb?void 0:VA,ContextBar:jb,DirectionIndicator:null===Jb?void 0:tx,Grid:null===Ob?void 0:OA,Handle:null===Kb?void 0:XA,SelectionBackground:null===gc?void 0:QA,SelectionDetail:null===
rc?void 0:SA,SelectionForeground:null===Wb?void 0:UA})})})},[]);const $a=ll(a);return(0,UF.jsx)($a.Provider,{value:Ja,children:ra})}),bB=ca(589),WF=ca(589),XF=ee(function(a){const d=mg();return(0,WF.jsx)(Mg,Zd({viewport:d.viewport,inputs:d.inputs,callbacks:d._events,brush:d.brush,editingShape:d.editingShape,hoveredShape:d.hoveredShape,hoveredGroup:d.hoveredGroup,bindingShapes:d.bindingShapes,selectionDirectionHint:d.selectionDirectionHint,selectionBounds:d.selectionBounds,selectedShapes:d.selectedShapesArray,
erasingShapes:d.erasingShapesArray,shapes:d.shapes,assets:d.assets,showGrid:d.settings.showGrid,penMode:d.settings.penMode,showSelection:d.showSelection,showSelectionRotation:d.showSelectionRotation,showResizeHandles:d.showResizeHandles,showRotateHandles:d.showRotateHandles,showCloneHandles:d.showCloneHandles,showSelectionDetail:d.showSelectionDetail,showContextBar:d.showContextBar,cursor:d.cursors.cursor,cursorRotation:d.cursors.rotation,selectionRotation:d.selectionRotation,onEditingEnd:d.clearEditingState},
a))});ca(589);var ps=Kf(ca(19)),aq=Kf(ca(19)),YF=ca(589),ZF="add-link block-search block connector group internal-link link-to-block link-to-page link-to-whiteboard move-to-sidebar-right object-compact object-expanded open-as-page page-search page references-hide references-show select-cursor text ungroup whiteboard-element whiteboard".split(" "),Qg=a=>{var {name:d,className:k}=a;a=Jf(a,["name","className"]);const K=ZF.includes(d)?"tie tie-":"ti ti-";return(0,YF.jsx)("i",Zd({className:[K+d,k].join(" ")},
a))},Yg=ca(19),$F=ca(19),lr=ca(19),Mm=ca(19),ux=ca(19),aG=ca(20),Nl=ca(19),Oo=(0,Nl.forwardRef)((a,d)=>{var {children:k}=a;a=Jf(a,["children"]);const K=Nl.Children.toArray(k),da=K.find(ug);if(da){const ja=da.props.children;k=K.map(ra=>ra===da?1<Nl.Children.count(ja)?Nl.Children.only(null):(0,Nl.isValidElement)(ja)?ja.props.children:null:ra);return(0,Nl.createElement)(vx,Oe({},a,{ref:d}),(0,Nl.isValidElement)(ja)?(0,Nl.cloneElement)(ja,void 0,k):null)}return(0,Nl.createElement)(vx,Oe({},a,{ref:d}),
k)});Oo.displayName="Slot";var vx=(0,Nl.forwardRef)((a,d)=>{const {children:k}=a;a=Jf(a,["children"]);return(0,Nl.isValidElement)(k)?(0,Nl.cloneElement)(k,ff(Zd({},Zl(a,k.props)),{ref:vg(d,k.ref)})):1<Nl.Children.count(k)?Nl.Children.only(null):null});vx.displayName="SlotClone";var cB=({children:a})=>(0,Nl.createElement)(Nl.Fragment,null,a),rk="a button div h2 h3 img label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const k=(0,ux.forwardRef)((K,da)=>{var {asChild:ja}=K;K=Jf(K,["asChild"]);
ja=ja?Oo:d;(0,ux.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]);return(0,ux.createElement)(ja,Oe({},K,{ref:da}))});k.displayName=`Primitive.${d}`;return ff(Zd({},a),{[d]:k})},{}),wx=ca(19),bG=ca(19),dB,cG=(0,Mm.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xx=(0,Mm.forwardRef)((a,d)=>{var k;const {disableOutsidePointerEvents:K=!1,onEscapeKeyDown:da,onPointerDownOutside:ja,onFocusOutside:ra,onInteractOutside:Ja,onDismiss:Ra}=a,$a=Jf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),
fb=(0,Mm.useContext)(cG),[jb,Jb]=(0,Mm.useState)(null),Ob=null!==(k=null===jb||void 0===jb?void 0:jb.ownerDocument)&&void 0!==k?k:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Kb]=(0,Mm.useState)({});d=$g(d,hc=>Jb(hc));k=Array.from(fb.layers);var [gc]=[...fb.layersWithOutsidePointerEventsDisabled].slice(-1);gc=k.indexOf(gc);const rc=jb?k.indexOf(jb):-1;k=0<fb.layersWithOutsidePointerEventsDisabled.size;const Wb=rc>=gc;gc=Il(hc=>{const Fc=hc.target,Lc=[...fb.branches].some(ud=>
ud.contains(Fc));Wb&&!Lc&&(null===ja||void 0===ja||ja(hc),null===Ja||void 0===Ja||Ja(hc),hc.defaultPrevented||null===Ra||void 0===Ra||Ra())},Ob);const kc=sl(hc=>{const Fc=hc.target;[...fb.branches].some(Lc=>Lc.contains(Fc))||(null===ra||void 0===ra||ra(hc),null===Ja||void 0===Ja||Ja(hc),hc.defaultPrevented||null===Ra||void 0===Ra||Ra())},Ob);rl(hc=>{rc===fb.layers.size-1&&(null===da||void 0===da||da(hc),!hc.defaultPrevented&&Ra&&(hc.preventDefault(),Ra()))},Ob);(0,Mm.useEffect)(()=>{if(jb)return K&&
(0===fb.layersWithOutsidePointerEventsDisabled.size&&(dB=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),fb.layersWithOutsidePointerEventsDisabled.add(jb)),fb.layers.add(jb),Jn(),()=>{K&&1===fb.layersWithOutsidePointerEventsDisabled.size&&(Ob.body.style.pointerEvents=dB)}},[jb,Ob,K,fb]);(0,Mm.useEffect)(()=>()=>{jb&&(fb.layers.delete(jb),fb.layersWithOutsidePointerEventsDisabled.delete(jb),Jn())},[jb,fb]);(0,Mm.useEffect)(()=>{const hc=()=>Kb({});document.addEventListener("dismissableLayer.update",
hc);return()=>document.removeEventListener("dismissableLayer.update",hc)},[]);return(0,Mm.createElement)(rk.div,Oe({},$a,{ref:d,style:Zd({pointerEvents:k?Wb?"auto":"none":void 0},a.style),onFocusCapture:Wf(a.onFocusCapture,kc.onFocusCapture),onBlurCapture:Wf(a.onBlurCapture,kc.onBlurCapture),onPointerDownCapture:Wf(a.onPointerDownCapture,gc.onPointerDownCapture)}))}),eB=Kf(ca(19)),dG=ca(19),vl=(null===globalThis||void 0===globalThis?0:globalThis.document)?dG.useLayoutEffect:()=>{},eG=eB["useId".toString()]||
(()=>{}),fG=0,Sk=ca(19),gG=(a,d,k)=>Oh(void 0,null,function*(){const {placement:K="bottom",strategy:da="absolute",middleware:ja=[],platform:ra}=k,Ja=yield null==ra.isRTL?void 0:ra.isRTL(d);let Ra=yield ra.getElementRects({reference:a,floating:d,strategy:da}),{x:$a,y:fb}=Ck(Ra,K,Ja),jb=K,Jb={},Ob=0;for(let Kb=0;Kb<ja.length;Kb++){const {name:gc,fn:rc}=ja[Kb],{x:Wb,y:kc,data:hc,reset:Fc}=yield rc({x:$a,y:fb,initialPlacement:K,placement:jb,strategy:da,middlewareData:Jb,rects:Ra,platform:ra,elements:{reference:a,
floating:d}});$a=null!=Wb?Wb:$a;fb=null!=kc?kc:fb;Jb=ff(Zd({},Jb),{[gc]:Zd(Zd({},Jb[gc]),hc)});Fc&&50>=Ob&&(Ob++,"object"==typeof Fc&&(Fc.placement&&(jb=Fc.placement),Fc.rects&&(Ra=!0===Fc.rects?yield ra.getElementRects({reference:a,floating:d,strategy:da}):Fc.rects),{x:$a,y:fb}=Ck(Ra,jb,Ja)),Kb=-1)}return{x:$a,y:fb,placement:jb,strategy:da,middlewareData:Jb}}),yx=Math.min,lp=Math.max,fB=a=>({name:"arrow",options:a,fn(d){return Oh(this,null,function*(){const {element:k,padding:K=0}=null!=a?a:{},{x:da,
y:ja,placement:ra,rects:Ja,platform:Ra}=d;if(null==k)return{};const $a=mm(K),fb={x:da,y:ja},jb=cl(ra),Jb=ra.split("-")[1],Ob=$l(jb);var Kb=yield Ra.getDimensions(k);const gc="y"===jb?"top":"left",rc="y"===jb?"bottom":"right";var Wb=Ja.reference[Ob]+Ja.reference[jb]-fb[jb]-Ja.floating[Ob];const kc=fb[jb]-Ja.reference[jb];var hc=yield null==Ra.getOffsetParent?void 0:Ra.getOffsetParent(k);let Fc=hc?"y"===jb?hc.clientHeight||0:hc.clientWidth||0:0;0===Fc&&(Fc=Ja.floating[Ob]);hc=$a[gc];const Lc=Fc-Kb[Ob]-
$a[rc];Kb=Fc/2-Kb[Ob]/2+(Wb/2-kc/2);Wb=lp(hc,yx(Kb,Lc));return{[jb]:fb[jb]-(0<("start"===Jb?$a[gc]:$a[rc])&&Kb!==Wb&&Ja.reference[Ob]<=Ja.floating[Ob]?Kb<hc?hc-Kb:Lc-Kb:0),data:{[jb]:Wb,centerOffset:Kb-Wb}}})}}),hG={left:"right",right:"left",bottom:"top",top:"bottom"},iG={start:"end",end:"start"},gB=["top","right","bottom","left"];gB.reduce((a,d)=>a.concat(d,d+"-start",d+"-end"),[]);var hB=function(a){return void 0===a&&(a={}),{name:"flip",options:a,fn(d){return Oh(this,null,function*(){var k;const {placement:K,
middlewareData:da,rects:ja,initialPlacement:ra,platform:Ja,elements:Ra}=d;var $a=a;const {mainAxis:fb=!0,crossAxis:jb=!0,fallbackPlacements:Jb,fallbackStrategy:Ob="bestFit",flipAlignment:Kb=!0}=$a;$a=Jf($a,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]);const gc=Ih(K);var rc=Jb||(gc!==ra&&Kb?function(ud){const Jd=dl(ud);return[xi(ud),Jd,xi(Jd)]}(ra):[dl(ra)]);rc=[ra,...rc];const Wb=yield Jl(d,$a),kc=[];$a=(null==(k=da.flip)?void 0:k.overflows)||[];if(fb&&kc.push(Wb[gc]),
jb){const {main:ud,cross:Jd}=tl(K,ja,yield null==Ja.isRTL?void 0:Ja.isRTL(Ra.floating));kc.push(Wb[ud],Wb[Jd])}if($a=[...$a,{placement:K,overflows:kc}],!kc.every(ud=>0>=ud)){var hc,Fc;k=(null!=(hc=null==(Fc=da.flip)?void 0:Fc.index)?hc:0)+1;if(hc=rc[k])return{data:{index:k,overflows:$a},reset:{placement:hc}};hc="bottom";switch(Ob){case "bestFit":var Lc;(Fc=null==(Lc=$a.map(ud=>[ud,ud.overflows.filter(Jd=>0<Jd).reduce((Jd,Ee)=>Jd+Ee,0)]).sort((ud,Jd)=>ud[1]-Jd[1])[0])?void 0:Lc[0].placement)&&(hc=
Fc);break;case "initialPlacement":hc=ra}if(K!==hc)return{reset:{placement:hc}}}return{}})}}},iB=function(a){a=void 0===a?{}:a;let {strategy:d="referenceHidden"}=a,k=Jf(a,["strategy"]);return{name:"hide",fn(K){return Oh(this,null,function*(){var {rects:da}=K;switch(d){case "referenceHidden":return da=dk(yield Jl(K,ff(Zd({},k),{elementContext:"reference"})),da.reference),{data:{referenceHiddenOffsets:da,referenceHidden:ek(da)}};case "escaped":return da=dk(yield Jl(K,ff(Zd({},k),{altBoundary:!0})),da.floating),
{data:{escapedOffsets:da,escaped:ek(da)}};default:return{}}})}}},jB=function(a){return void 0===a&&(a=0),{name:"offset",options:a,fn(d){return Oh(this,null,function*(){const {x:k,y:K}=d,da=yield function(ja,ra){return Oh(this,null,function*(){const {placement:Ja,platform:Ra,elements:$a}=ja;var fb=yield null==Ra.isRTL?void 0:Ra.isRTL($a.floating),jb=Ih(Ja);const Jb=Ja.split("-")[1],Ob="x"===cl(Ja);jb=["left","top"].includes(jb)?-1:1;fb=fb&&Ob?-1:1;const Kb="function"==typeof ra?ra(ja):ra;let {mainAxis:gc,
crossAxis:rc,alignmentAxis:Wb}="number"==typeof Kb?{mainAxis:Kb,crossAxis:0,alignmentAxis:null}:Zd({mainAxis:0,crossAxis:0,alignmentAxis:null},Kb);return Jb&&"number"==typeof Wb&&(rc="end"===Jb?-1*Wb:Wb),Ob?{x:rc*fb,y:gc*jb}:{x:gc*jb,y:rc*fb}})}(d,a);return{x:k+da.x,y:K+da.y,data:da}})}}},kB=function(a){return void 0===a&&(a={}),{name:"shift",options:a,fn(d){return Oh(this,null,function*(){const {x:k,y:K,placement:da}=d;var ja=a;const {mainAxis:ra=!0,crossAxis:Ja=!1,limiter:Ra={fn:Ob=>{let {x:Kb,
y:gc}=Ob;return{x:Kb,y:gc}}}}=ja;var $a=Jf(ja,["mainAxis","crossAxis","limiter"]);ja={x:k,y:K};$a=yield Jl(d,$a);const fb=cl(Ih(da)),jb="x"===fb?"y":"x";let Jb=ja[fb];ja=ja[jb];ra&&(Jb=lp(Jb+$a["y"===fb?"top":"left"],yx(Jb,Jb-$a["y"===fb?"bottom":"right"])));Ja&&(ja=lp(ja+$a["y"===jb?"top":"left"],yx(ja,ja-$a["y"===jb?"bottom":"right"])));ja=Ra.fn(ff(Zd({},d),{[fb]:Jb,[jb]:ja}));return ff(Zd({},ja),{data:{x:ja.x-k,y:ja.y-K}})})}}},lB=function(a){return void 0===a&&(a={}),{options:a,fn(d){const {x:k,
y:K,placement:da,rects:ja,middlewareData:ra}=d,{offset:Ja=0,mainAxis:Ra=!0,crossAxis:$a=!0}=a;var fb={x:k,y:K};d=cl(da);const jb="x"===d?"y":"x";let Jb=fb[d];fb=fb[jb];var Ob="function"==typeof Ja?Ja(ff(Zd({},ja),{placement:da})):Ja;Ob="number"==typeof Ob?{mainAxis:Ob,crossAxis:0}:Zd({mainAxis:0,crossAxis:0},Ob);if(Ra){var Kb="y"===d?"height":"width",gc=ja.reference[d]-ja.floating[Kb]+Ob.mainAxis;Kb=ja.reference[d]+ja.reference[Kb]-Ob.mainAxis;Jb<gc?Jb=gc:Jb>Kb&&(Jb=Kb)}if($a){var rc,Wb,kc,hc;const Fc=
"y"===d?"width":"height";gc=["top","left"].includes(Ih(da));Kb=ja.reference[jb]-ja.floating[Fc]+(gc&&null!=(rc=null==(Wb=ra.offset)?void 0:Wb[jb])?rc:0)+(gc?0:Ob.crossAxis);rc=ja.reference[jb]+ja.reference[Fc]+(gc?0:null!=(kc=null==(hc=ra.offset)?void 0:hc[jb])?kc:0)-(gc?Ob.crossAxis:0);fb<Kb?fb=Kb:fb>rc&&(fb=rc)}return{[d]:Jb,[jb]:fb}}}},jG=function(a){return void 0===a&&(a={}),{name:"size",options:a,fn(d){return Oh(this,null,function*(){const {placement:k,rects:K,platform:da,elements:ja}=d;var ra=
a,{apply:Ja}=ra;ra=Jf(ra,["apply"]);ra=yield Jl(d,ra);var Ra=Ih(k),$a=k.split("-")[1],fb,jb;"top"===Ra||"bottom"===Ra?(fb=Ra,jb=$a===((yield null==da.isRTL?void 0:da.isRTL(ja.floating))?"start":"end")?"left":"right"):(jb=Ra,fb="end"===$a?"top":"bottom");Ra=lp(ra.left,0);$a=lp(ra.right,0);const Jb=lp(ra.top,0),Ob=lp(ra.bottom,0);jb={availableHeight:K.floating.height-(["left","right"].includes(k)?2*(0!==Jb||0!==Ob?Jb+Ob:lp(ra.top,ra.bottom)):ra[fb]),availableWidth:K.floating.width-(["top","bottom"].includes(k)?
2*(0!==Ra||0!==$a?Ra+$a:lp(ra.left,ra.right)):ra[jb])};fb=yield da.getDimensions(ja.floating);null==Ja||Ja(Zd(Zd({},d),jb));Ja=yield da.getDimensions(ja.floating);return fb.width!==Ja.width||fb.height!==Ja.height?{reset:{rects:!0}}:{}})}}},mB=Math.min,Dt=Math.max,lv=Math.round,kG={getClippingRect:function(a){let {element:d,boundary:k,rootBoundary:K,strategy:da}=a;a=[...("clippingAncestors"===k?gp(d):[].concat(k)),K];a=a.reduce((ja,ra)=>{ra=co(d,ra,da);return ja.top=Dt(ra.top,ja.top),ja.right=mB(ra.right,
ja.right),ja.bottom=mB(ra.bottom,ja.bottom),ja.left=Dt(ra.left,ja.left),ja},co(d,a[0],da));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(a){let {rect:d,offsetParent:k,strategy:K}=a;var da=rj(k);const ja=Cj(k);if(k===ja)return d;a={scrollLeft:0,scrollTop:0};var ra=0,Ja=0;(da||!da&&"fixed"!==K)&&(("body"!==Ci(k)||Ji(ja))&&(a=bm(k)),rj(k))&&(da=ik(k,!0),ra=da.x+k.clientLeft,Ja=da.y+k.clientTop);return ff(Zd({},d),{x:d.x-
a.scrollLeft+ra,y:d.y-a.scrollTop+Ja})},isElement:xk,getDimensions:Ul,getOffsetParent:bj,getDocumentElement:Cj,getElementRects:a=>{let {reference:d,floating:k,strategy:K}=a;a=bj(k);var da=rj(a);const ja=Cj(a);var ra;if(ra=da)ra=ik(a),ra=lv(ra.width)!==a.offsetWidth||lv(ra.height)!==a.offsetHeight;ra=ik(d,ra,"fixed"===K);let Ja={scrollLeft:0,scrollTop:0};var Ra=0,$a=0;if(da||!da&&"fixed"!==K)(("body"!==Ci(a)||Ji(ja))&&(Ja=bm(a)),rj(a))?(da=ik(a,!0),Ra=da.x+a.clientLeft,$a=da.y+a.clientTop):ja&&(Ra=
yn(ja));return{reference:{x:ra.left+Ja.scrollLeft-Ra,y:ra.top+Ja.scrollTop-$a,width:ra.width,height:ra.height},floating:ff(Zd({},Ul(k)),{x:0,y:0})}},getClientRects:a=>Array.from(a.getClientRects()),isRTL:a=>"rtl"===Ri(a).direction},lG=(a,d,k)=>gG(a,d,Zd({platform:kG},k)),mn=Kf(ca(19),1),nB=ca(19),mG=Kf(ca(20),1),zx="undefined"!==typeof document?nB.useLayoutEffect:nB.useEffect,oB=a=>{const {element:d,padding:k}=a;return{name:"arrow",options:a,fn(K){if(Object.prototype.hasOwnProperty.call(d,"current")){if(null!=
d.current)return fB({element:d.current,padding:k}).fn(K)}else if(d)return fB({element:d,padding:k}).fn(K);return{}}}},Ax=ca(19),nG=(0,Ax.forwardRef)((a,d)=>{const {children:k,width:K=10,height:da=5}=a,ja=Jf(a,["children","width","height"]);return(0,Ax.createElement)(rk.svg,Oe({},ja,{ref:d,width:K,height:da,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),a.asChild?k:(0,Ax.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),oG=ca(19),[Bx,qs]=Gh("Popper"),[pG,pB]=Bx("Popper"),Cx=(0,Sk.forwardRef)((a,
d)=>{const {__scopePopper:k,virtualRef:K}=a;a=Jf(a,["__scopePopper","virtualRef"]);const da=pB("PopperAnchor",k),ja=(0,Sk.useRef)(null);d=$g(d,ja);(0,Sk.useEffect)(()=>{da.onAnchorChange((null===K||void 0===K?void 0:K.current)||ja.current)});return K?null:(0,Sk.createElement)(rk.div,Oe({},a,{ref:d}))}),[qG,rG]=Bx("PopperContent"),[sG,tG]=Bx("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),Dx=(0,Sk.forwardRef)((a,d)=>{var k,K,da,ja,ra,Ja,Ra,$a;const {__scopePopper:fb,side:jb="bottom",sideOffset:Jb=
0,align:Ob="center",alignOffset:Kb=0,arrowPadding:gc=0,collisionBoundary:rc=[],collisionPadding:Wb=0,sticky:kc="partial",hideWhenDetached:hc=!1,avoidCollisions:Fc=!0}=a;a=Jf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Lc=pB("PopperContent",fb),[ud,Jd]=(0,Sk.useState)(null);d=$g(d,Fi=>Jd(Fi));const [Ee,Sd]=(0,Sk.useState)(null);var De=sb(Ee),gf=null!==(k=null===De||void 0===De?void 0:De.width)&&
void 0!==k?k:0;k=null!==(K=null===De||void 0===De?void 0:De.height)&&void 0!==K?K:0;K=jb+("center"!==Ob?"-"+Ob:"");De="number"===typeof Wb?Wb:Zd({top:0,right:0,bottom:0,left:0},Wb);const Te=Array.isArray(rc)?rc:[rc],df=0<Te.length;De={padding:De,boundary:Te.filter(Qb),altBoundary:df};const {reference:Gd,floating:od,strategy:Dd,x:jd,y:Cd,placement:Me,middlewareData:af,update:Nf}=Xb({strategy:"fixed",placement:K,whileElementsMounted:Sb,middleware:[jB({mainAxis:Jb+k,alignmentAxis:Kb}),Fc?kB(Zd({mainAxis:!0,
crossAxis:!1,limiter:"partial"===kc?lB():void 0},De)):void 0,Ee?oB({element:Ee,padding:gc}):void 0,Fc?hB(Zd({},De)):void 0,vG({arrowWidth:gf,arrowHeight:k}),hc?iB({strategy:"referenceHidden"}):void 0].filter(cc)});vl(()=>{Gd(Lc.anchor)},[Gd,Lc.anchor]);const bg=null!==jd&&null!==Cd,[ef,Eg]=zb(Me);gf=null===(da=af.arrow)||void 0===da?void 0:da.x;da=null===(ja=af.arrow)||void 0===ja?void 0:ja.y;ja=0!==(null===(ra=af.arrow)||void 0===ra?void 0:ra.centerOffset);const [yf,Fg]=(0,Sk.useState)();vl(()=>
{ud&&Fg(window.getComputedStyle(ud).zIndex)},[ud]);const {hasParent:Gg,positionUpdateFns:Bi}=tG("PopperContent",fb),Bj=!Gg;(0,Sk.useLayoutEffect)(()=>{if(!Bj)return Bi.add(Nf),()=>{Bi.delete(Nf)}},[Bj,Bi,Nf]);(0,Sk.useLayoutEffect)(()=>{Bj&&bg&&Array.from(Bi).reverse().forEach(Fi=>requestAnimationFrame(Fi))},[Bj,bg,Bi]);ra=ff(Zd({"data-side":ef,"data-align":Eg},a),{ref:d,style:ff(Zd({},a.style),{animation:bg?void 0:"none",opacity:null!==(Ja=af.hide)&&void 0!==Ja&&Ja.referenceHidden?0:void 0})});return(0,Sk.createElement)("div",
{ref:od,"data-radix-popper-content-wrapper":"",style:{position:Dd,left:0,top:0,transform:bg?`translate3d(${Math.round(jd)}px, ${Math.round(Cd)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:yf,["--radix-popper-transform-origin"]:[null===(Ra=af.transformOrigin)||void 0===Ra?void 0:Ra.x,null===($a=af.transformOrigin)||void 0===$a?void 0:$a.y].join(" ")}},(0,Sk.createElement)(qG,{scope:fb,placedSide:ef,onArrowChange:Sd,arrowX:gf,arrowY:da,shouldHideArrow:ja},Bj?(0,Sk.createElement)(sG,
{scope:fb,hasParent:!0,positionUpdateFns:Bi},(0,Sk.createElement)(rk.div,ra)):(0,Sk.createElement)(rk.div,ra)))}),uG={top:"bottom",right:"left",bottom:"top",left:"right"},qB=(0,Sk.forwardRef)(function(a,d){var {__scopePopper:k}=a;a=Jf(a,["__scopePopper"]);k=rG("PopperArrow",k);return(0,Sk.createElement)("span",{ref:k.onArrowChange,style:{position:"absolute",left:k.arrowX,top:k.arrowY,[uG[k.placedSide]]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[k.placedSide],transform:{top:"translateY(100%)",
right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[k.placedSide],visibility:k.shouldHideArrow?"hidden":void 0}},(0,Sk.createElement)(nG,Oe({},a,{ref:d,style:ff(Zd({},a.style),{display:"block"})})))}),vG=a=>({name:"transformOrigin",options:a,fn(d){var k,K,da,ja,ra;const {placement:Ja,rects:Ra,middlewareData:$a}=d,fb=(d=0!==(null===(k=$a.arrow)||void 0===k?void 0:k.centerOffset))?0:a.arrowWidth;k=d?0:a.arrowHeight;const [jb,
Jb]=zb(Ja),Ob={start:"0%",center:"50%",end:"100%"}[Jb],Kb=(null!==(K=null===(da=$a.arrow)||void 0===da?void 0:da.x)&&void 0!==K?K:0)+fb/2;K=(null!==(ja=null===(ra=$a.arrow)||void 0===ra?void 0:ra.y)&&void 0!==ja?ja:0)+k/2;ra=ja="";"bottom"===jb?(ja=d?Ob:`${Kb}px`,ra=`${-k}px`):"top"===jb?(ja=d?Ob:`${Kb}px`,ra=`${Ra.floating.height+k}px`):"right"===jb?(ja=`${-k}px`,ra=d?Ob:`${K}px`):"left"===jb&&(ja=`${Ra.floating.width+k}px`,ra=d?Ob:`${K}px`);return{data:{x:ja,y:ra}}}}),Ex=a=>{const {__scopePopper:d,
children:k}=a,[K,da]=(0,Sk.useState)(null);return(0,Sk.createElement)(pG,{scope:d,anchor:K,onAnchorChange:da},k)},rB=ca(19),wG=Kf(ca(20)),xG=(0,rB.forwardRef)((a,d)=>{var k;const {container:K=null===globalThis||void 0===globalThis?void 0:null===(k=globalThis.document)||void 0===k?void 0:k.body}=a;a=Jf(a,["container"]);return K?wG.default.createPortal((0,rB.createElement)(rk.div,Oe({},a,{ref:d})),K):null}),mp=ca(19),yG=ca(20),Et=a=>{const {present:d,children:k}=a;a=Zb(d);const K="function"===typeof k?
k({present:a.isPresent}):mp.Children.only(k),da=$g(a.ref,K.ref);return"function"===typeof k||a.isPresent?(0,mp.cloneElement)(K,{ref:da}):null};Et.displayName="Presence";var mv=ca(19),sB=ca(19),zG=(0,sB.forwardRef)((a,d)=>(0,sB.createElement)(rk.span,Oe({},a,{ref:d,style:Zd({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"},a.style)}))),[nv]=Gh("Tooltip",[qs]),ov=qs(),[AG,Fx]=nv("TooltipProvider"),[BG,
Ft]=nv("Tooltip"),CG=(0,Yg.forwardRef)((a,d)=>{var {__scopeTooltip:k}=a;const K=Jf(a,["__scopeTooltip"]),da=Ft("TooltipTrigger",k),ja=Fx("TooltipTrigger",k);k=ov(k);const ra=(0,Yg.useRef)(null);d=$g(d,ra,da.onTriggerChange);const Ja=(0,Yg.useRef)(!1),Ra=(0,Yg.useRef)(!1),$a=(0,Yg.useCallback)(()=>Ja.current=!1,[]);(0,Yg.useEffect)(()=>()=>document.removeEventListener("pointerup",$a),[$a]);return(0,Yg.createElement)(Cx,Oe({asChild:!0},k),(0,Yg.createElement)(rk.button,Oe({"aria-describedby":da.open?
da.contentId:void 0,"data-state":da.stateAttribute},K,{ref:d,onPointerMove:Wf(a.onPointerMove,fb=>{"touch"===fb.pointerType||Ra.current||ja.isPointerInTransitRef.current||(da.onTriggerEnter(),Ra.current=!0)}),onPointerLeave:Wf(a.onPointerLeave,()=>{da.onTriggerLeave();Ra.current=!1}),onPointerDown:Wf(a.onPointerDown,()=>{Ja.current=!0;document.addEventListener("pointerup",$a,{once:!0})}),onFocus:Wf(a.onFocus,()=>{if(!Ja.current)da.onOpen()}),onBlur:Wf(a.onBlur,da.onClose),onClick:Wf(a.onClick,da.onClose)})))}),
[DG,EG]=nv("TooltipPortal",{forceMount:void 0}),FG=(0,Yg.forwardRef)((a,d)=>{var k=EG("TooltipContent",a.__scopeTooltip);const {forceMount:K=k.forceMount,side:da="top"}=a;k=Jf(a,["forceMount","side"]);a=Ft("TooltipContent",a.__scopeTooltip);return(0,Yg.createElement)(Et,{present:K||a.open},a.disableHoverableContent?(0,Yg.createElement)(tB,Oe({side:da},k,{ref:d})):(0,Yg.createElement)(GG,Oe({side:da},k,{ref:d})))}),GG=(0,Yg.forwardRef)((a,d)=>{const k=Ft("TooltipContent",a.__scopeTooltip),K=Fx("TooltipContent",
a.__scopeTooltip),da=(0,Yg.useRef)(null);d=$g(d,da);const [ja,ra]=(0,Yg.useState)(null),{trigger:Ja,onClose:Ra}=k,$a=da.current,{onPointerInTransitChange:fb}=K,jb=(0,Yg.useCallback)(()=>{ra(null);fb(!1)},[fb]),Jb=(0,Yg.useCallback)((Ob,Kb)=>{const gc=ed({x:Ob.clientX,y:Ob.clientY},Ob.currentTarget.getBoundingClientRect()),rc="right"===gc||"bottom"===gc?-5:5;Ob="right"===gc||"left"===gc?{x:Ob.clientX+rc,y:Ob.clientY}:{x:Ob.clientX,y:Ob.clientY+rc};Kb=Kb.getBoundingClientRect();const {top:Wb,right:kc,
bottom:hc,left:Fc}=Kb;Kb=nd([Ob,{x:Fc,y:Wb},{x:kc,y:Wb},{x:kc,y:hc},{x:Fc,y:hc}]);ra(Kb);fb(!0)},[fb]);(0,Yg.useEffect)(()=>()=>jb(),[jb]);(0,Yg.useEffect)(()=>{if(Ja&&$a){const Ob=gc=>Jb(gc,$a),Kb=gc=>Jb(gc,Ja);Ja.addEventListener("pointerleave",Ob);$a.addEventListener("pointerleave",Kb);return()=>{Ja.removeEventListener("pointerleave",Ob);$a.removeEventListener("pointerleave",Kb)}}},[Ja,$a,Jb,jb]);(0,Yg.useEffect)(()=>{if(ja){const Ob=Kb=>{var gc=Kb.target;Kb={x:Kb.clientX,y:Kb.clientY};gc=(null===
Ja||void 0===Ja?void 0:Ja.contains(gc))||(null===$a||void 0===$a?void 0:$a.contains(gc));const {x:rc,y:Wb}=Kb;Kb=!1;for(let kc=0,hc=ja.length-1;kc<ja.length;hc=kc++){const Fc=ja[kc].x,Lc=ja[kc].y,ud=ja[hc].x,Jd=ja[hc].y;Lc>Wb!==Jd>Wb&&rc<(ud-Fc)*(Wb-Lc)/(Jd-Lc)+Fc&&(Kb=!Kb)}Kb=!Kb;gc?jb():Kb&&(jb(),Ra())};document.addEventListener("pointermove",Ob);return()=>document.removeEventListener("pointermove",Ob)}},[Ja,$a,ja,Ra,jb]);return(0,Yg.createElement)(tB,Oe({},a,{ref:d}))}),[HG,IG]=nv("Tooltip",{isInside:!1}),
tB=(0,Yg.forwardRef)((a,d)=>{const {__scopeTooltip:k,children:K,"aria-label":da,onEscapeKeyDown:ja,onPointerDownOutside:ra}=a;a=Jf(a,["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"]);const Ja=Ft("TooltipContent",k),Ra=ov(k),{onClose:$a}=Ja;(0,Yg.useEffect)(()=>{document.addEventListener("tooltip.open",$a);return()=>document.removeEventListener("tooltip.open",$a)},[$a]);(0,Yg.useEffect)(()=>{if(Ja.trigger){const fb=jb=>{jb=jb.target;null!==jb&&void 0!==jb&&jb.contains(Ja.trigger)&&
$a()};window.addEventListener("scroll",fb,{capture:!0});return()=>window.removeEventListener("scroll",fb,{capture:!0})}},[Ja.trigger,$a]);return(0,Yg.createElement)(xx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:ja,onPointerDownOutside:ra,onFocusOutside:fb=>fb.preventDefault(),onDismiss:$a},(0,Yg.createElement)(Dx,Oe({"data-state":Ja.stateAttribute},Ra,a,{ref:d,style:ff(Zd({},a.style),{["--radix-tooltip-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}),(0,Yg.createElement)(cB,
null,K),(0,Yg.createElement)(HG,{scope:k,isInside:!0},(0,Yg.createElement)(zG,{id:Ja.contentId,role:"tooltip"},da||K))))}),JG=(0,Yg.forwardRef)((a,d)=>{const {__scopeTooltip:k}=a;a=Jf(a,["__scopeTooltip"]);const K=ov(k);return IG("TooltipArrow",k).isInside?null:(0,Yg.createElement)(qB,Oe({},K,a,{ref:d}))}),KG=a=>{const {__scopeTooltip:d,delayDuration:k=700,skipDelayDuration:K=300,disableHoverableContent:da=!1,children:ja}=a,[ra,Ja]=(0,Yg.useState)(!0),Ra=(0,Yg.useRef)(!1),$a=(0,Yg.useRef)(0);(0,Yg.useEffect)(()=>
{const fb=$a.current;return()=>window.clearTimeout(fb)},[]);return(0,Yg.createElement)(AG,{scope:d,isOpenDelayed:ra,delayDuration:k,onOpen:(0,Yg.useCallback)(()=>{window.clearTimeout($a.current);Ja(!1)},[]),onClose:(0,Yg.useCallback)(()=>{window.clearTimeout($a.current);$a.current=window.setTimeout(()=>Ja(!0),K)},[K]),isPointerInTransitRef:Ra,onPointerInTransitChange:(0,Yg.useCallback)(fb=>{Ra.current=fb},[]),disableHoverableContent:da},ja)},LG=a=>{const {__scopeTooltip:d,children:k,open:K,defaultOpen:da=
!1,onOpenChange:ja,disableHoverableContent:ra,delayDuration:Ja}=a,Ra=Fx("Tooltip",a.__scopeTooltip);a=ov(d);const [$a,fb]=(0,Yg.useState)(null),jb=Ei(),Jb=(0,Yg.useRef)(0),Ob=null!==ra&&void 0!==ra?ra:Ra.disableHoverableContent,Kb=null!==Ja&&void 0!==Ja?Ja:Ra.delayDuration,gc=(0,Yg.useRef)(!1),[rc=!1,Wb]=Dc({prop:K,defaultProp:da,onChange:ud=>{if(ud)Ra.onOpen(),document.dispatchEvent(new CustomEvent("tooltip.open"));else Ra.onClose();null===ja||void 0===ja||ja(ud)}}),kc=(0,Yg.useMemo)(()=>rc?gc.current?
"delayed-open":"instant-open":"closed",[rc]),hc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);gc.current=!1;Wb(!0)},[Wb]),Fc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);Wb(!1)},[Wb]),Lc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);Jb.current=window.setTimeout(()=>{gc.current=!0;Wb(!0)},Kb)},[Kb,Wb]);(0,Yg.useEffect)(()=>()=>window.clearTimeout(Jb.current),[]);return(0,Yg.createElement)(Ex,a,(0,Yg.createElement)(BG,{scope:d,contentId:jb,open:rc,stateAttribute:kc,trigger:$a,
onTriggerChange:fb,onTriggerEnter:(0,Yg.useCallback)(()=>{Ra.isOpenDelayed?Lc():hc()},[Ra.isOpenDelayed,Lc,hc]),onTriggerLeave:(0,Yg.useCallback)(()=>{Ob?Fc():window.clearTimeout(Jb.current)},[Fc,Ob]),onOpen:hc,onClose:Fc,disableHoverableContent:Ob},k))},MG=CG,NG=a=>{const {__scopeTooltip:d,forceMount:k,children:K,container:da}=a;a=Ft("TooltipPortal",d);return(0,Yg.createElement)(DG,{scope:d,forceMount:k},(0,Yg.createElement)(Et,{present:k||a.open},(0,Yg.createElement)(xG,{asChild:!0,container:da},
K)))},OG=FG,PG=JG,bq=ca(589),uB=ca(589),Gx=ca(589),QG=({style:a,icon:d,onClick:k})=>(0,Gx.jsx)("button",{"data-html2canvas-ignore":"true",style:a,className:"tl-circle-button",onPointerDown:k,children:(0,Gx.jsx)("div",{className:"tl-circle-button-icons-wrapper",children:(0,Gx.jsx)(Qg,{name:d})})}),vB=ca(19),wB=(0,vB.forwardRef)((a,d)=>{const {pressed:k,defaultPressed:K=!1,onPressedChange:da}=a,ja=Jf(a,["pressed","defaultPressed","onPressedChange"]),[ra=!1,Ja]=Dc({prop:k,onChange:da,defaultProp:K});
return(0,vB.createElement)(rk.button,Oe({type:"button","aria-pressed":ra,"data-state":ra?"on":"off","data-disabled":a.disabled?"":void 0},ja,{ref:d,onClick:Wf(a.onClick,()=>{a.disabled||Ja(!ra)})}))}),RG=wB,Hx=ca(589),On=ca(19),Wg=ca(19),Po=Kf(ca(19)),xB=ca(19),SG=(0,xB.createContext)(void 0),TG=ca(19),Ix=0,cq=ca(19),yB={bubbles:!1,cancelable:!0},zB=(0,cq.forwardRef)((a,d)=>{const {loop:k=!1,trapped:K=!1,onMountAutoFocus:da,onUnmountAutoFocus:ja}=a;a=Jf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);
const [ra,Ja]=(0,cq.useState)(null),Ra=Qi(da),$a=Qi(ja),fb=(0,cq.useRef)(null);d=$g(d,Ob=>Ja(Ob));const jb=(0,cq.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,cq.useEffect)(()=>{if(K){let Ob=function(gc){!jb.paused&&ra&&(gc=gc.target,ra.contains(gc)?fb.current=gc:hf(fb.current,{select:!0}))},Kb=function(gc){!jb.paused&&ra&&(ra.contains(gc.relatedTarget)||hf(fb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Kb);
return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Kb)}}},[K,ra,jb.paused]);(0,cq.useEffect)(()=>{if(ra){AB.add(jb);const Ob=document.activeElement;if(!ra.contains(Ob)){const Kb=new CustomEvent("focusScope.autoFocusOnMount",yB);ra.addEventListener("focusScope.autoFocusOnMount",Ra);ra.dispatchEvent(Kb);Kb.defaultPrevented||(nf(xh(Ze(ra)),{select:!0}),document.activeElement===Ob&&hf(ra))}return()=>{ra.removeEventListener("focusScope.autoFocusOnMount",Ra);setTimeout(()=>
{const Kb=new CustomEvent("focusScope.autoFocusOnUnmount",yB);ra.addEventListener("focusScope.autoFocusOnUnmount",$a);ra.dispatchEvent(Kb);Kb.defaultPrevented||hf(null!==Ob&&void 0!==Ob?Ob:document.body,{select:!0});ra.removeEventListener("focusScope.autoFocusOnUnmount",$a);AB.remove(jb)},0)}}},[ra,Ra,$a,jb]);const Jb=(0,cq.useCallback)(Ob=>{if((k||K)&&!jb.paused){var Kb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Kb){const rc=Ob.currentTarget;var gc=rc;const Wb=
Ze(gc),kc=xg(Wb,gc);gc=xg(Wb.reverse(),gc);const [hc,Fc]=[kc,gc];hc&&Fc?Ob.shiftKey||Kb!==Fc?Ob.shiftKey&&Kb===hc&&(Ob.preventDefault(),k&&hf(Fc,{select:!0})):(Ob.preventDefault(),k&&hf(hc,{select:!0})):Kb===rc&&Ob.preventDefault()}}},[k,K,jb.paused]);return(0,cq.createElement)(rk.div,Oe({tabIndex:-1},a,{ref:d,onKeyDown:Jb}))}),AB=function(){let a=[];return{add(d){const k=a[0];d===k||null!==k&&void 0!==k&&k.pause();a=th(a,d);a.unshift(d)},remove(d){var k;a=th(a,d);null===(k=a[0])||void 0===k||k.resume()}}}(),
Tk=ca(19),UG={bubbles:!1,cancelable:!0},[Jx,BB,VG]=ag("RovingFocusGroup"),[WG,pv]=Gh("RovingFocusGroup",[VG]),[XG,YG]=WG("RovingFocusGroup"),CB=(0,Tk.forwardRef)((a,d)=>(0,Tk.createElement)(Jx.Provider,{scope:a.__scopeRovingFocusGroup},(0,Tk.createElement)(Jx.Slot,{scope:a.__scopeRovingFocusGroup},(0,Tk.createElement)(ZG,Oe({},a,{ref:d}))))),ZG=(0,Tk.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:k,orientation:K,loop:da=!1,dir:ja,currentTabStopId:ra,defaultCurrentTabStopId:Ja,onCurrentTabStopIdChange:Ra,
onEntryFocus:$a}=a,fb=Jf(a,"__scopeRovingFocusGroup orientation loop dir currentTabStopId defaultCurrentTabStopId onCurrentTabStopIdChange onEntryFocus".split(" ")),jb=(0,Tk.useRef)(null);d=$g(d,jb);const Jb=pg(ja),[Ob=null,Kb]=Dc({prop:ra,defaultProp:Ja,onChange:Ra}),[gc,rc]=(0,Tk.useState)(!1),Wb=Qi($a),kc=BB(k),hc=(0,Tk.useRef)(!1),[Fc,Lc]=(0,Tk.useState)(0);(0,Tk.useEffect)(()=>{const ud=jb.current;if(ud)return ud.addEventListener("rovingFocusGroup.onEntryFocus",Wb),()=>ud.removeEventListener("rovingFocusGroup.onEntryFocus",
Wb)},[Wb]);return(0,Tk.createElement)(XG,{scope:k,orientation:K,dir:Jb,loop:da,currentTabStopId:Ob,onItemFocus:(0,Tk.useCallback)(ud=>Kb(ud),[Kb]),onItemShiftTab:(0,Tk.useCallback)(()=>rc(!0),[]),onFocusableItemAdd:(0,Tk.useCallback)(()=>Lc(ud=>ud+1),[]),onFocusableItemRemove:(0,Tk.useCallback)(()=>Lc(ud=>ud-1),[])},(0,Tk.createElement)(rk.div,Oe({tabIndex:gc||0===Fc?-1:0,"data-orientation":K},fb,{ref:d,style:Zd({outline:"none"},a.style),onMouseDown:Wf(a.onMouseDown,()=>{hc.current=!0}),onFocus:Wf(a.onFocus,
ud=>{var Jd=!hc.current;if(ud.target===ud.currentTarget&&Jd&&!gc&&(Jd=new CustomEvent("rovingFocusGroup.onEntryFocus",UG),ud.currentTarget.dispatchEvent(Jd),!Jd.defaultPrevented)){ud=kc().filter(Sd=>Sd.focusable);Jd=ud.find(Sd=>Sd.active);const Ee=ud.find(Sd=>Sd.id===Ob);ud=[Jd,Ee,...ud].filter(Boolean).map(Sd=>Sd.ref.current);Hg(ud)}hc.current=!1}),onBlur:Wf(a.onBlur,()=>rc(!1))})))}),DB=(0,Tk.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:k,focusable:K=!0,active:da=!1}=a,ja=Jf(a,["__scopeRovingFocusGroup",
"focusable","active"]),ra=Ei(),Ja=YG("RovingFocusGroupItem",k),Ra=Ja.currentTabStopId===ra,$a=BB(k),{onFocusableItemAdd:fb,onFocusableItemRemove:jb}=Ja;(0,Tk.useEffect)(()=>{if(K)return fb(),()=>jb()},[K,fb,jb]);return(0,Tk.createElement)(Jx.ItemSlot,{scope:k,id:ra,focusable:K,active:da},(0,Tk.createElement)(rk.span,Oe({tabIndex:Ra?0:-1,"data-orientation":Ja.orientation},ja,{ref:d,onMouseDown:Wf(a.onMouseDown,Jb=>{if(K)Ja.onItemFocus(ra);else Jb.preventDefault()}),onFocus:Wf(a.onFocus,()=>Ja.onItemFocus(ra)),
onKeyDown:Wf(a.onKeyDown,Jb=>{if("Tab"===Jb.key&&Jb.shiftKey)Ja.onItemShiftTab();else if(Jb.target===Jb.currentTarget){var Ob=Qh(Jb,Ja.orientation,Ja.dir);if(void 0!==Ob){Jb.preventDefault();let Kb=$a().filter(gc=>gc.focusable).map(gc=>gc.ref.current);if("last"===Ob)Kb.reverse();else if("prev"===Ob||"next"===Ob)"prev"===Ob&&Kb.reverse(),Jb=Kb.indexOf(Jb.currentTarget),Kb=Ja.loop?tg(Kb,Jb+1):Kb.slice(Jb+1);setTimeout(()=>Hg(Kb))}}})})))}),$G={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",
PageUp:"first",Home:"first",PageDown:"last",End:"last"},aH=function(a){return"undefined"===typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body},rs=new WeakMap,qv=new WeakMap,rv={},Kx=0,Lx=function(a,d,k){void 0===d&&(d=aH(a));void 0===k&&(k="data-aria-hidden");var K=Array.isArray(a)?a:[a];rv[k]||(rv[k]=new WeakMap);var da=rv[k],ja=[],ra=new Set,Ja=function($a){$a&&!ra.has($a)&&(ra.add($a),Ja($a.parentNode))};K.forEach(Ja);var Ra=function($a){!$a||0<=K.indexOf($a)||Array.prototype.forEach.call($a.children,
function(fb){if(ra.has(fb))Ra(fb);else{var jb=fb.getAttribute("aria-hidden");jb=null!==jb&&"false"!==jb;var Jb=(rs.get(fb)||0)+1,Ob=(da.get(fb)||0)+1;rs.set(fb,Jb);da.set(fb,Ob);ja.push(fb);1===Jb&&jb&&qv.set(fb,!0);1===Ob&&fb.setAttribute(k,"true");jb||fb.setAttribute("aria-hidden","true")}})};Ra(d);ra.clear();Kx++;return function(){ja.forEach(function($a){var fb=rs.get($a)-1,jb=da.get($a)-1;rs.set($a,fb);da.set($a,jb);fb||(qv.has($a)||$a.removeAttribute("aria-hidden"),qv.delete($a));jb||$a.removeAttribute(k)});
Kx--;Kx||(rs=new WeakMap,rs=new WeakMap,qv=new WeakMap,rv={})}},bH=Kf(CD(),1),{__assign:dq,__rest:EB,__spreadArray:lo}=bH.default,FB=Kf(ca(19)),np=Kf(ca(19)),cH=ca(19),GB=Kf(ca(19)),Dl=function(a){var d=a.sideCar;a=EB(a,["sideCar"]);if(!d)throw Error("Sidecar: please provide `sideCar` property to import the right car");d=d.read();if(!d)throw Error("Sidecar medium not found");return GB.createElement(d,dq({},a))};Dl.isSideCarExport=!0;var Nm=function(a){void 0===a&&(a={});var d=Xl(null);d.options=dq({async:!0,
ssr:!1},a);return d}(),Ws=function(){},Eu=np.forwardRef(function(a,d){var k=np.useRef(null),K=np.useState({onScrollCapture:Ws,onWheelCapture:Ws,onTouchMoveCapture:Ws}),da=K[0];K=K[1];var ja=a.forwardProps,ra=a.children,Ja=a.className,Ra=a.removeScrollBar,$a=a.enabled,fb=a.shards,jb=a.sideCar,Jb=a.noIsolation,Ob=a.inert,Kb=a.allowPinchZoom,gc=a.as;gc=void 0===gc?"div":gc;a=EB(a,"forwardProps children className removeScrollBar enabled shards sideCar noIsolation inert allowPinchZoom as".split(" "));
d=Gj([k,d]);da=dq(dq({},a),da);return np.createElement(np.Fragment,null,$a&&np.createElement(jb,{sideCar:Nm,removeScrollBar:Ra,shards:fb,noIsolation:Jb,inert:Ob,setCallbacks:K,allowPinchZoom:!!Kb,lockRef:k}),ja?np.cloneElement(np.Children.only(ra),dq(dq({},da),{ref:d})):np.createElement(gc,dq({},da,{className:Ja,ref:d}),ra))});Eu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Eu.classNames={fullWidth:"width-before-scroll-bar",zeroRight:"right-scroll-bar-position"};var Yk=Kf(ca(19)),sw=Kf(ca(19)),
yD=Kf(ca(19)),Hr=function(){var a=0,d=null;return{add:function(k){if(0==a){if(document){var K=document.createElement("style");K.type="text/css";var da="undefined"!==typeof __webpack_nonce__?__webpack_nonce__:void 0;da&&K.setAttribute("nonce",da)}else K=null;if(d=K)K=d,K.styleSheet?K.styleSheet.cssText=k:K.appendChild(document.createTextNode(k)),k=d,(document.head||document.getElementsByTagName("head")[0]).appendChild(k)}a++},remove:function(){a--;!a&&d&&(d.parentNode&&d.parentNode.removeChild(d),
d=null)}}},tw=function(){var a=Hr();return function(d,k){yD.useEffect(function(){a.add(d);return function(){a.remove()}},[d&&k])}},HB=function(){var a=tw();return function(d){a(d.styles,d.dynamic);return null}},IB={left:0,top:0,right:0,gap:0},JB=HB(),KB=function(a,d,k,K){var da=a.left,ja=a.top,ra=a.right;a=a.gap;void 0===k&&(k="margin");return"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(K,";\n   padding-right: ").concat(a,"px ").concat(K,";\n  }\n  body {\n    overflow: hidden ").concat(K,
";\n    overscroll-behavior: contain;\n    ").concat([d&&"position: relative ".concat(K,";"),"margin"===k&&"\n    padding-left: ".concat(da,"px;\n    padding-top: ").concat(ja,"px;\n    padding-right: ").concat(ra,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(a,"px ").concat(K,";\n    "),"padding"===k&&"padding-right: ".concat(a,"px ").concat(K,";")].filter(Boolean).join(""),"\n  }\n  \n  .").concat("right-scroll-bar-position"," {\n    right: ").concat(a,"px ").concat(K,
";\n  }\n  \n  .").concat("width-before-scroll-bar"," {\n    margin-right: ").concat(a,"px ").concat(K,";\n  }\n  \n  .").concat("right-scroll-bar-position"," .").concat("right-scroll-bar-position"," {\n    right: 0 ").concat(K,";\n  }\n  \n  .").concat("width-before-scroll-bar"," .").concat("width-before-scroll-bar"," {\n    margin-right: 0 ").concat(K,";\n  }\n  \n  body {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n  }\n")},LB=function(a){var d=a.noRelative,k=a.noImportant;
a=a.gapMode;var K=void 0===a?"margin":a;a=sw.useMemo(function(){var da=K;void 0===da&&(da="margin");if("undefined"===typeof window)da=IB;else{var ja=window.getComputedStyle(document.body),ra=ja["padding"===da?"paddingTop":"marginTop"],Ja=ja["padding"===da?"paddingRight":"marginRight"];da=[parseInt(ja["padding"===da?"paddingLeft":"marginLeft"]||"",10)||0,parseInt(ra||"",10)||0,parseInt(Ja||"",10)||0];da={left:da[0],top:da[1],right:da[2],gap:Math.max(0,window.innerWidth-document.documentElement.clientWidth+
da[2]-da[0])}}return da},[K]);return sw.createElement(JB,{styles:KB(a,!d,K,k?"":"!important")})},uw=!1;if("undefined"!==typeof window)try{var Wq=Object.defineProperty({},"passive",{get:function(){return uw=!0}});window.addEventListener("test",Wq,Wq);window.removeEventListener("test",Wq,Wq)}catch(a){uw=!1}var Xq=uw?{passive:!1}:!1,vw=function(a,d){var k=window.getComputedStyle(a);return"hidden"!==k[d]&&!(k.overflowY===k.overflowX&&"TEXTAREA"!==a.tagName&&"visible"===k[d])},MB=function(a,d){do{"undefined"!==
typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host);if(NB(a,d)){var k=OB(a,d);if(k[1]>k[2])return!0}d=d.parentNode}while(d&&d!==document.body);return!1},NB=function(a,d){return"v"===a?vw(d,"overflowY"):vw(d,"overflowX")},OB=function(a,d){return"v"===a?[d.scrollTop,d.scrollHeight,d.clientHeight]:[d.scrollLeft,d.scrollWidth,d.clientWidth]},Gt=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},sv=function(a){return a&&"current"in a?a.current:a},
Nj=function(a){return"\n  .block-interactivity-".concat(a," {pointer-events: none;}\n  .allow-interactivity-").concat(a," {pointer-events: all;}\n")},mo=0,ij=[];Nm.useMedium(function(a){var d=Yk.useRef([]),k=Yk.useRef([0,0]),K=Yk.useRef(),da=Yk.useState(mo++)[0],ja=Yk.useState(function(){return HB()})[0],ra=Yk.useRef(a);Yk.useEffect(function(){ra.current=a},[a]);Yk.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(da));var Kb=lo([a.lockRef.current],(a.shards||
[]).map(sv),!0).filter(Boolean);Kb.forEach(function(gc){return gc.classList.add("allow-interactivity-".concat(da))});return function(){document.body.classList.remove("block-interactivity-".concat(da));Kb.forEach(function(gc){return gc.classList.remove("allow-interactivity-".concat(da))})}}},[a.inert,a.lockRef.current,a.shards]);var Ja=Yk.useCallback(function(Kb,gc){if("touches"in Kb&&2===Kb.touches.length)return!ra.current.allowPinchZoom;var rc=Gt(Kb),Wb=k.current,kc="deltaX"in Kb?Kb.deltaX:Wb[0]-
rc[0];Wb="deltaY"in Kb?Kb.deltaY:Wb[1]-rc[1];var hc=Kb.target,Fc=Math.abs(kc)>Math.abs(Wb)?"h":"v";if("touches"in Kb&&"h"===Fc&&"range"===hc.type)return!1;var Lc=MB(Fc,hc);if(!Lc)return!0;Lc?rc=Fc:(rc="v"===Fc?"h":"v",Lc=MB(Fc,hc));if(!Lc)return!1;!K.current&&"changedTouches"in Kb&&(kc||Wb)&&(K.current=rc);if(!rc)return!0;rc=K.current||rc;Wb="h"===rc?kc:Wb;kc=window.getComputedStyle(gc).direction;kc="h"===rc&&"rtl"===kc?-1:1;Fc=kc*Wb;Kb=Kb.target;Wb=gc.contains(Kb);hc=!1;Fc=0<Fc;var ud=Lc=0;do{var Jd=
OB(rc,Kb),Ee=Jd[0];Jd=Jd[1]-Jd[2]-kc*Ee;(Ee||Jd)&&NB(rc,Kb)&&(Lc+=Jd,ud+=Ee);Kb=Kb.parentNode}while(!Wb&&Kb!==document.body||Wb&&(gc.contains(Kb)||gc===Kb));Fc&&0===Lc?hc=!0:Fc||0!==ud||(hc=!0);return hc},[]),Ra=Yk.useCallback(function(Kb){if(ij.length&&ij[ij.length-1]===ja){var gc="deltaY"in Kb?[Kb.deltaX,Kb.deltaY]:Gt(Kb),rc=d.current.filter(function(Wb){var kc;if(kc=Wb.name===Kb.type&&Wb.target===Kb.target)Wb=Wb.delta,kc=Wb[0]===gc[0]&&Wb[1]===gc[1];return kc})[0];rc&&rc.should?Kb.cancelable&&
Kb.preventDefault():rc||(rc=(ra.current.shards||[]).map(sv).filter(Boolean).filter(function(Wb){return Wb.contains(Kb.target)}),(0<rc.length?Ja(Kb,rc[0]):!ra.current.noIsolation)&&Kb.cancelable&&Kb.preventDefault())}},[]),$a=Yk.useCallback(function(Kb,gc,rc,Wb){var kc={name:Kb,delta:gc,target:rc,should:Wb};d.current.push(kc);setTimeout(function(){d.current=d.current.filter(function(hc){return hc!==kc})},1)},[]),fb=Yk.useCallback(function(Kb){k.current=Gt(Kb);K.current=void 0},[]),jb=Yk.useCallback(function(Kb){$a(Kb.type,
[Kb.deltaX,Kb.deltaY],Kb.target,Ja(Kb,a.lockRef.current))},[]),Jb=Yk.useCallback(function(Kb){$a(Kb.type,Gt(Kb),Kb.target,Ja(Kb,a.lockRef.current))},[]);Yk.useEffect(function(){ij.push(ja);a.setCallbacks({onScrollCapture:jb,onWheelCapture:jb,onTouchMoveCapture:Jb});document.addEventListener("wheel",Ra,Xq);document.addEventListener("touchmove",Ra,Xq);document.addEventListener("touchstart",fb,Xq);return function(){ij=ij.filter(function(Kb){return Kb!==ja});document.removeEventListener("wheel",Ra,Xq);
document.removeEventListener("touchmove",Ra,Xq);document.removeEventListener("touchstart",fb,Xq)}},[]);var Ob=a.removeScrollBar;return Yk.createElement(Yk.Fragment,null,a.inert?Yk.createElement(ja,{styles:Nj(da)}):null,Ob?Yk.createElement(LB,{gapMode:"margin"}):null)});var Qo=FB.forwardRef(function(a,d){return FB.createElement(Eu,dq({},a,{ref:d,sideCar:Dl}))});Qo.classNames=Eu.classNames;var Uk=["Enter"," "],Om=["ArrowUp","PageDown","End"],Ai=["ArrowDown","PageUp","Home",...Om];[...Uk];[...Uk];var [tv,
uv,vv]=ag("Menu"),[op,Mx]=Gh("Menu",[vv,qs,pv]),Ht=qs(),ri=pv(),[Nx,ss]=op("Menu"),[Ox,eq]=op("Menu"),PB=(0,Wg.forwardRef)((a,d)=>{var {__scopeMenu:k}=a;a=Jf(a,["__scopeMenu"]);k=Ht(k);return(0,Wg.createElement)(Cx,Oe({},k,a,{ref:d}))}),[,mr]=op("MenuPortal",{forceMount:void 0}),[dH,It]=op("MenuContent"),wv=(0,Wg.forwardRef)((a,d)=>{var k=mr("MenuContent",a.__scopeMenu);({forceMount:k=k.forceMount}=a);const K=Jf(a,["forceMount"]),da=ss("MenuContent",a.__scopeMenu),ja=eq("MenuContent",a.__scopeMenu);
return(0,Wg.createElement)(tv.Provider,{scope:a.__scopeMenu},(0,Wg.createElement)(Et,{present:k||da.open},(0,Wg.createElement)(tv.Slot,{scope:a.__scopeMenu},ja.modal?(0,Wg.createElement)(Px,Oe({},K,{ref:d})):(0,Wg.createElement)(Jt,Oe({},K,{ref:d})))))}),Px=(0,Wg.forwardRef)((a,d)=>{const k=ss("MenuContent",a.__scopeMenu),K=(0,Wg.useRef)(null);d=$g(d,K);(0,Wg.useEffect)(()=>{const da=K.current;if(da)return Lx(da)},[]);return(0,Wg.createElement)(xv,Oe({},a,{ref:d,trapFocus:k.open,disableOutsidePointerEvents:k.open,
disableOutsideScroll:!0,onFocusOutside:Wf(a.onFocusOutside,da=>da.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>k.onOpenChange(!1)}))}),Jt=(0,Wg.forwardRef)((a,d)=>{const k=ss("MenuContent",a.__scopeMenu);return(0,Wg.createElement)(xv,Oe({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>k.onOpenChange(!1)}))}),xv=(0,Wg.forwardRef)((a,d)=>{const {__scopeMenu:k,loop:K=!1,trapFocus:da,onOpenAutoFocus:ja,onCloseAutoFocus:ra,disableOutsidePointerEvents:Ja,
onEscapeKeyDown:Ra,onPointerDownOutside:$a,onFocusOutside:fb,onInteractOutside:jb,onDismiss:Jb,disableOutsideScroll:Ob}=a,Kb=Jf(a,"__scopeMenu loop trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss disableOutsideScroll".split(" ")),gc=ss("MenuContent",k),rc=eq("MenuContent",k),Wb=Ht(k),kc=ri(k),hc=uv(k),[Fc,Lc]=(0,Wg.useState)(null),ud=(0,Wg.useRef)(null);d=$g(d,ud,gc.onContentChange);const Jd=(0,Wg.useRef)(0),
Ee=(0,Wg.useRef)(""),Sd=(0,Wg.useRef)(0),De=(0,Wg.useRef)(null),gf=(0,Wg.useRef)("right"),Te=(0,Wg.useRef)(0),df=Ob?Qo:Wg.Fragment,Gd=Ob?{as:Oo,allowPinchZoom:!0}:void 0,od=jd=>{var Cd,Me;jd=Ee.current+jd;const af=hc().filter(yf=>!yf.disabled),Nf=document.activeElement,bg=null===(Cd=af.find(yf=>yf.ref.current===Nf))||void 0===Cd?void 0:Cd.textValue;Cd=af.map(yf=>yf.textValue);const ef=pj(Cd,jd,bg),Eg=null===(Me=af.find(yf=>yf.textValue===ef))||void 0===Me?void 0:Me.ref.current;(function Gg(Fg){Ee.current=
Fg;window.clearTimeout(Jd.current);""!==Fg&&(Jd.current=window.setTimeout(()=>Gg(""),1E3))})(jd);Eg&&setTimeout(()=>Eg.focus())};(0,Wg.useEffect)(()=>()=>window.clearTimeout(Jd.current),[]);Gf();const Dd=(0,Wg.useCallback)(jd=>{var Cd,Me,af;if(af=gf.current===(null===(Cd=De.current)||void 0===Cd?void 0:Cd.side)){if(Cd=null===(Me=De.current)||void 0===Me?void 0:Me.area){const {x:Nf,y:bg}={x:jd.clientX,y:jd.clientY};jd=!1;for(let ef=0,Eg=Cd.length-1;ef<Cd.length;Eg=ef++){Me=Cd[ef].x;af=Cd[ef].y;const yf=
Cd[Eg].x,Fg=Cd[Eg].y;af>bg!==Fg>bg&&Nf<(yf-Me)*(bg-af)/(Fg-af)+Me&&(jd=!jd)}Cd=jd}else Cd=!1;af=Cd}return af},[]);return(0,Wg.createElement)(dH,{scope:k,searchRef:Ee,onItemEnter:(0,Wg.useCallback)(jd=>{Dd(jd)&&jd.preventDefault()},[Dd]),onItemLeave:(0,Wg.useCallback)(jd=>{var Cd;Dd(jd)||(null===(Cd=ud.current)||void 0===Cd||Cd.focus(),Lc(null))},[Dd]),onTriggerLeave:(0,Wg.useCallback)(jd=>{Dd(jd)&&jd.preventDefault()},[Dd]),pointerGraceTimerRef:Sd,onPointerGraceIntentChange:(0,Wg.useCallback)(jd=>
{De.current=jd},[])},(0,Wg.createElement)(df,Gd,(0,Wg.createElement)(zB,{asChild:!0,trapped:da,onMountAutoFocus:Wf(ja,jd=>{var Cd;jd.preventDefault();null===(Cd=ud.current)||void 0===Cd||Cd.focus()}),onUnmountAutoFocus:ra},(0,Wg.createElement)(xx,{asChild:!0,disableOutsidePointerEvents:Ja,onEscapeKeyDown:Ra,onPointerDownOutside:$a,onFocusOutside:fb,onInteractOutside:jb,onDismiss:Jb},(0,Wg.createElement)(CB,Oe({asChild:!0},kc,{dir:rc.dir,orientation:"vertical",loop:K,currentTabStopId:Fc,onCurrentTabStopIdChange:Lc,
onEntryFocus:jd=>{rc.isUsingKeyboardRef.current||jd.preventDefault()}}),(0,Wg.createElement)(Dx,Oe({role:"menu","aria-orientation":"vertical","data-state":gc.open?"open":"closed","data-radix-menu-content":"",dir:rc.dir},Wb,Kb,{ref:d,style:Zd({outline:"none"},Kb.style),onKeyDown:Wf(Kb.onKeyDown,jd=>{var Cd=jd.target.closest("[data-radix-menu-content]")===jd.currentTarget;const Me=jd.ctrlKey||jd.altKey||jd.metaKey,af=1===jd.key.length;Cd&&("Tab"===jd.key&&jd.preventDefault(),!Me&&af&&od(jd.key));jd.target===
ud.current&&Ai.includes(jd.key)&&(jd.preventDefault(),Cd=hc().filter(Nf=>!Nf.disabled).map(Nf=>Nf.ref.current),Om.includes(jd.key)&&Cd.reverse(),yo(Cd))}),onBlur:Wf(a.onBlur,jd=>{jd.currentTarget.contains(jd.target)||(window.clearTimeout(Jd.current),Ee.current="")}),onPointerMove:Wf(a.onPointerMove,zo(jd=>{const Cd=Te.current!==jd.clientX;jd.currentTarget.contains(jd.target)&&Cd&&(gf.current=jd.clientX>Te.current?"right":"left",Te.current=jd.clientX)}))})))))))}),Kt=(0,Wg.forwardRef)((a,d)=>{const {disabled:k=
!1,onSelect:K}=a,da=Jf(a,["disabled","onSelect"]),ja=(0,Wg.useRef)(null),ra=eq("MenuItem",a.__scopeMenu),Ja=It("MenuItem",a.__scopeMenu);d=$g(d,ja);const Ra=(0,Wg.useRef)(!1);return(0,Wg.createElement)(QB,Oe({},da,{ref:d,disabled:k,onClick:Wf(a.onClick,()=>{const $a=ja.current;if(!k&&$a){const fb=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});$a.addEventListener("menu.itemSelect",jb=>null===K||void 0===K?void 0:K(jb),{once:!0});ql($a,fb);if(fb.defaultPrevented)Ra.current=!1;else ra.onClose()}}),
onPointerDown:$a=>{var fb;null===(fb=a.onPointerDown)||void 0===fb||fb.call(a,$a);Ra.current=!0},onPointerUp:Wf(a.onPointerUp,$a=>{var fb;Ra.current||null===(fb=$a.currentTarget)||void 0===fb||fb.click()}),onKeyDown:Wf(a.onKeyDown,$a=>{const fb=""!==Ja.searchRef.current;k||fb&&" "===$a.key||!Uk.includes($a.key)||($a.currentTarget.click(),$a.preventDefault())})}))}),QB=(0,Wg.forwardRef)((a,d)=>{const {__scopeMenu:k,disabled:K=!1,textValue:da}=a,ja=Jf(a,["__scopeMenu","disabled","textValue"]),ra=It("MenuItem",
k),Ja=ri(k),Ra=(0,Wg.useRef)(null);d=$g(d,Ra);const [$a,fb]=(0,Wg.useState)(!1),[jb,Jb]=(0,Wg.useState)("");(0,Wg.useEffect)(()=>{const Ob=Ra.current;if(Ob){var Kb;Jb((null!==(Kb=Ob.textContent)&&void 0!==Kb?Kb:"").trim())}},[ja.children]);return(0,Wg.createElement)(tv.ItemSlot,{scope:k,disabled:K,textValue:null!==da&&void 0!==da?da:jb},(0,Wg.createElement)(DB,Oe({asChild:!0},Ja,{focusable:!K}),(0,Wg.createElement)(rk.div,Oe({role:"menuitem","data-highlighted":$a?"":void 0,"aria-disabled":K||void 0,
"data-disabled":K?"":void 0},ja,{ref:d,onPointerMove:Wf(a.onPointerMove,zo(Ob=>{if(K)ra.onItemLeave(Ob);else ra.onItemEnter(Ob),Ob.defaultPrevented||Ob.currentTarget.focus()})),onPointerLeave:Wf(a.onPointerLeave,zo(Ob=>ra.onItemLeave(Ob))),onFocus:Wf(a.onFocus,()=>fb(!0)),onBlur:Wf(a.onBlur,()=>fb(!1))}))))});op("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});op("MenuItemIndicator",{checked:!1});op("MenuSub");var RB=a=>{const {__scopeMenu:d,open:k=!1,children:K,dir:da,onOpenChange:ja,modal:ra=
!0}=a;a=Ht(d);const [Ja,Ra]=(0,Wg.useState)(null),$a=(0,Wg.useRef)(!1),fb=Qi(ja),jb=pg(da);(0,Wg.useEffect)(()=>{const Jb=()=>{$a.current=!0;document.addEventListener("pointerdown",Ob,{capture:!0,once:!0});document.addEventListener("pointermove",Ob,{capture:!0,once:!0})},Ob=()=>$a.current=!1;document.addEventListener("keydown",Jb,{capture:!0});return()=>{document.removeEventListener("keydown",Jb,{capture:!0});document.removeEventListener("pointerdown",Ob,{capture:!0});document.removeEventListener("pointermove",
Ob,{capture:!0})}},[]);return(0,Wg.createElement)(Ex,a,(0,Wg.createElement)(Nx,{scope:d,open:k,onOpenChange:fb,content:Ja,onContentChange:Ra},(0,Wg.createElement)(Ox,{scope:d,onClose:(0,Wg.useCallback)(()=>fb(!1),[fb]),isUsingKeyboardRef:$a,dir:jb,modal:ra},K)))},[eH]=Gh("DropdownMenu",[Mx]),pp=Mx(),[Lt,Mt]=eH("DropdownMenu"),yv=(0,On.forwardRef)((a,d)=>{const {__scopeDropdownMenu:k,disabled:K=!1}=a,da=Jf(a,["__scopeDropdownMenu","disabled"]),ja=Mt("DropdownMenuTrigger",k),ra=pp(k);return(0,On.createElement)(PB,
Oe({asChild:!0},ra),(0,On.createElement)(rk.button,Oe({type:"button",id:ja.triggerId,"aria-haspopup":"menu","aria-expanded":ja.open,"aria-controls":ja.open?ja.contentId:void 0,"data-state":ja.open?"open":"closed","data-disabled":K?"":void 0,disabled:K},da,{ref:vg(d,ja.triggerRef),onPointerDown:Wf(a.onPointerDown,Ja=>{K||0!==Ja.button||!1!==Ja.ctrlKey||(ja.onOpenToggle(),ja.open||Ja.preventDefault())}),onKeyDown:Wf(a.onKeyDown,Ja=>{if(!K){if(["Enter"," "].includes(Ja.key))ja.onOpenToggle();if("ArrowDown"===
Ja.key)ja.onOpenChange(!0);["Enter"," ","ArrowDown"].includes(Ja.key)&&Ja.preventDefault()}})})))}),SB=(0,On.forwardRef)((a,d)=>{var {__scopeDropdownMenu:k}=a;const K=Jf(a,["__scopeDropdownMenu"]),da=Mt("DropdownMenuContent",k);k=pp(k);const ja=(0,On.useRef)(!1);return(0,On.createElement)(wv,Oe({id:da.contentId,"aria-labelledby":da.triggerId},k,K,{ref:d,onCloseAutoFocus:Wf(a.onCloseAutoFocus,ra=>{var Ja;ja.current||null===(Ja=da.triggerRef.current)||void 0===Ja||Ja.focus();ja.current=!1;ra.preventDefault()}),
onInteractOutside:Wf(a.onInteractOutside,ra=>{ra=ra.detail.originalEvent;const Ja=0===ra.button&&!0===ra.ctrlKey;ra=2===ra.button||Ja;if(!da.modal||ra)ja.current=!0}),style:ff(Zd({},a.style),{["--radix-dropdown-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),fq=(0,On.forwardRef)((a,d)=>{var {__scopeDropdownMenu:k}=a;a=Jf(a,["__scopeDropdownMenu"]);k=pp(k);return(0,On.createElement)(Kt,Oe({},k,a,{ref:d}))}),fH=a=>{const {__scopeDropdownMenu:d,children:k,dir:K,open:da,
defaultOpen:ja,onOpenChange:ra,modal:Ja=!0}=a;a=pp(d);const Ra=(0,On.useRef)(null),[$a=!1,fb]=Dc({prop:da,defaultProp:ja,onChange:ra});return(0,On.createElement)(Lt,{scope:d,triggerId:Ei(),triggerRef:Ra,contentId:Ei(),open:$a,onOpenChange:fb,onOpenToggle:(0,On.useCallback)(()=>fb(jb=>!jb),[fb]),modal:Ja},(0,On.createElement)(RB,Oe({},a,{open:$a,onOpenChange:fb,dir:K,modal:Ja}),k))},ji=Kf(ca(19)).default.createContext({}),gH=Kf(ca(19)),Qx=ca(589),hl=a=>{var {action:d,shortcut:k,opts:K}=a;a=Jf(a,["action",
"shortcut","opts"]);var {renderers:da}=gH.useContext(ji);da=null==da?void 0:da.KeyboardShortcut;return(0,Qx.jsx)("div",ff(Zd({className:"tl-menu-right-slot"},a),{children:(0,Qx.jsx)(da,{action:d,shortcut:k,opts:K})}))};ca(19);var Ol=ca(589),nr=ee(function(){const a=mg(),d=k=>{k.preventDefault()};return(0,Ol.jsxs)(fH,{children:[(0,Ol.jsx)(yv,{className:"tl-button text-sm px-2 important",id:"tl-zoom",children:(100*a.viewport.camera.zoom).toFixed(0)+"%"}),(0,Ol.jsxs)(SB,{onCloseAutoFocus:k=>k.preventDefault(),
className:"tl-menu",id:"zoomPopup",sideOffset:12,children:[(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToFit,children:["Zoom to drawing",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-to-fit"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToSelection,disabled:0===a.selectedShapesArray.length,children:["Zoom to fit selection",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-to-selection"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomIn,
children:["Zoom in",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-in"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomOut,children:["Zoom out",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-out"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.resetZoom,children:["Reset zoom",(0,Ol.jsx)(hl,{action:"whiteboard/reset-zoom"})]})]})]})}),Rx=ca(19),zv=["horizontal","vertical"],gq=(0,Rx.forwardRef)((a,d)=>{const {decorative:k,orientation:K="horizontal"}=a;a=Jf(a,["decorative",
"orientation"]);const da=zv.includes(K)?K:"horizontal";return(0,Rx.createElement)(rk.div,Oe({"data-orientation":da},k?{role:"none"}:{"aria-orientation":"vertical"===da?da:void 0,role:"separator"},a,{ref:d}))});gq.propTypes={orientation(a,d,k){a=a[d];d=String(a);return a&&!zv.includes(a)?Error(`Invalid prop \`orientation\` of value \`${d}\` supplied to \`${k}\`, expected one of:
  - horizontal
  - vertical

Defaulting to \`${"horizontal"}\`.`):null}};var Wj=ca(589),TB=ee(function(){const a=mg(),{handlers:{t:d}}=aq.useContext(ji),k=aq.useCallback(()=>{a.api.undo()},[a]),K=aq.useCallback(()=>{a.api.redo()},[a]),da=aq.useCallback(()=>{a.api.zoomIn()},[a]),ja=aq.useCallback(()=>{a.api.zoomOut()},[a]),ra=aq.useCallback(()=>{a.api.toggleGrid()},[a]),Ja=aq.useCallback(()=>{a.api.toggleSnapToGrid()},[a]),Ra=aq.useCallback(()=>{a.api.togglePenMode()},[a]);return(0,Wj.jsxs)("div",{className:"tl-action-bar","data-html2canvas-ignore":"true",
children:[!a.readOnly&&(0,Wj.jsxs)("div",{className:"tl-toolbar tl-history-bar mr-2 mb-2",children:[(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/undo"),onClick:k,children:(0,Wj.jsx)(Qg,{name:"arrow-back-up"})}),(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/redo"),onClick:K,children:(0,Wj.jsx)(Qg,{name:"arrow-forward-up"})})]}),(0,Wj.jsxs)("div",{className:"tl-toolbar tl-zoom-bar mr-2 mb-2",children:[(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/zoom-in"),onClick:da,id:"tl-zoom-in",children:(0,Wj.jsx)(Qg,{name:"plus"})}),(0,Wj.jsx)(Yd,
{tooltip:d("whiteboard/zoom-out"),onClick:ja,id:"tl-zoom-out",children:(0,Wj.jsx)(Qg,{name:"minus"})}),(0,Wj.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,Wj.jsx)(nr,{})]}),(0,Wj.jsxs)("div",{className:"tl-toolbar tl-grid-bar mr-2 mb-2",children:[(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/toggle-grid"),className:"tl-button",pressed:a.settings.showGrid,id:"tl-show-grid",onPressedChange:ra,children:(0,Wj.jsx)(Qg,{name:"grid-dots"})}),!a.readOnly&&(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/snap-to-grid"),
className:"tl-button",pressed:a.settings.snapToGrid,id:"tl-snap-to-grid",onPressedChange:Ja,children:(0,Wj.jsx)(Qg,{name:a.settings.snapToGrid?"magnet":"magnet-off"})})]}),!a.readOnly&&(0,Wj.jsx)("div",{className:"tl-toolbar tl-pen-mode-bar mb-2",children:(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/toggle-pen-mode"),className:"tl-button",pressed:a.settings.penMode,id:"tl-toggle-pen-mode",onPressedChange:Ra,children:(0,Wj.jsx)(Qg,{name:a.settings.penMode?"pencil":"pencil-off"})})})]})}),Av=Kf(ca(19)),Nt=
Kf(ca(20)),Ot=ca(589),Pt=a=>`[${a.map(d=>{var k;return null!=(k=null==d?void 0:d.toFixed(2))?k:"-"}).join(", ")}]`,nn=ee(()=>{var a;const {viewport:{bounds:d,camera:{point:k,zoom:K}},inputs:da}=dh(),ja=Av.default.useRef();Av.default.useEffect(()=>{const Ja=document.getElementById("tl-statusbar-anchor");ja.current=Ja},[]);const ra=[["Z",null!=(a=null==K?void 0:K.toFixed(2))?a:"null"],["MP",Pt(da.currentPoint)],["MS",Pt(da.currentScreenPoint)],["VP",Pt(k)],["VBR",Pt([d.maxX,d.maxY])]].map(Ja=>Ja.join("")).join("|");
a=ja.current?Nt.default.createPortal((0,Ot.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center"},children:ra}),ja.current):null;return(0,Ot.jsx)(Ot.Fragment,{children:a})}),il=Kf(ca(19)),on=ca(589),no=ee(a=>{var {id:d,icon:k,tooltip:K,tooltipSide:da="left",handleClick:ja}=a;a=Jf(a,["id","icon","tooltip","tooltipSide","handleClick"]);var ra;const Ja=mg(),Ra=null==(ra=[...Ja.Tools,is,js])?void 0:ra.find($a=>$a.id===d);ra=(ra=null==Ra?void 0:Ra.shortcut)&&K?(0,on.jsxs)("div",{className:"flex",
children:[K,(0,on.jsx)(hl,{action:ra})]}):K;return(0,on.jsx)(Yd,ff(Zd({},a),{tooltipSide:da,tooltip:ra,"data-tool":d,"data-selected":d===Ja.selectedTool.id,onClick:ja,children:"string"===typeof k?(0,on.jsx)(Qg,{name:k}):k}))}),Xi=ca(19),[Sx]=Gh("Popover",[qs]),Qt=qs(),[Tx,or]=Sx("Popover"),Bv=(0,Xi.forwardRef)((a,d)=>{var {__scopePopover:k}=a;const K=Jf(a,["__scopePopover"]),da=or("PopoverTrigger",k);k=Qt(k);d=$g(d,da.triggerRef);a=(0,Xi.createElement)(rk.button,Oe({type:"button","aria-haspopup":"dialog",
"aria-expanded":da.open,"aria-controls":da.contentId,"data-state":da.open?"open":"closed"},K,{ref:d,onClick:Wf(a.onClick,da.onOpenToggle)}));return da.hasCustomAnchor?a:(0,Xi.createElement)(Cx,Oe({asChild:!0},k),a)}),[,UB]=Sx("PopoverPortal",{forceMount:void 0}),Cv=(0,Xi.forwardRef)((a,d)=>{var k=UB("PopoverContent",a.__scopePopover);({forceMount:k=k.forceMount}=a);const K=Jf(a,["forceMount"]);a=or("PopoverContent",a.__scopePopover);return(0,Xi.createElement)(Et,{present:k||a.open},a.modal?(0,Xi.createElement)(VB,
Oe({},K,{ref:d})):(0,Xi.createElement)(ts,Oe({},K,{ref:d})))}),VB=(0,Xi.forwardRef)((a,d)=>{const k=or("PopoverContent",a.__scopePopover),K=(0,Xi.useRef)(null);d=$g(d,K);const da=(0,Xi.useRef)(!1);(0,Xi.useEffect)(()=>{const ja=K.current;if(ja)return Lx(ja)},[]);return(0,Xi.createElement)(Qo,{as:Oo,allowPinchZoom:!0},(0,Xi.createElement)(Ux,Oe({},a,{ref:d,trapFocus:k.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wf(a.onCloseAutoFocus,ja=>{var ra;ja.preventDefault();da.current||null===(ra=k.triggerRef.current)||
void 0===ra||ra.focus()}),onPointerDownOutside:Wf(a.onPointerDownOutside,ja=>{ja=ja.detail.originalEvent;const ra=0===ja.button&&!0===ja.ctrlKey;da.current=2===ja.button||ra},{checkForDefaultPrevented:!1}),onFocusOutside:Wf(a.onFocusOutside,ja=>ja.preventDefault(),{checkForDefaultPrevented:!1})})))}),ts=(0,Xi.forwardRef)((a,d)=>{const k=or("PopoverContent",a.__scopePopover),K=(0,Xi.useRef)(!1);return(0,Xi.createElement)(Ux,Oe({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:da=>
{var ja;null===(ja=a.onCloseAutoFocus)||void 0===ja||ja.call(a,da);if(!da.defaultPrevented){var ra;K.current||null===(ra=k.triggerRef.current)||void 0===ra||ra.focus();da.preventDefault()}K.current=!1},onInteractOutside:da=>{var ja,ra;null===(ja=a.onInteractOutside)||void 0===ja||ja.call(a,da);da.defaultPrevented||(K.current=!0);ja=da.target;(null===(ra=k.triggerRef.current)||void 0===ra?0:ra.contains(ja))&&da.preventDefault()}}))}),Ux=(0,Xi.forwardRef)((a,d)=>{const {__scopePopover:k,trapFocus:K,
onOpenAutoFocus:da,onCloseAutoFocus:ja,disableOutsidePointerEvents:ra,onEscapeKeyDown:Ja,onPointerDownOutside:Ra,onFocusOutside:$a,onInteractOutside:fb}=a;a=Jf(a,"__scopePopover trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside".split(" "));const jb=or("PopoverContent",k),Jb=Qt(k);Gf();return(0,Xi.createElement)(zB,{asChild:!0,loop:!0,trapped:K,onMountAutoFocus:da,onUnmountAutoFocus:ja},(0,Xi.createElement)(xx,
{asChild:!0,disableOutsidePointerEvents:ra,onInteractOutside:fb,onEscapeKeyDown:Ja,onPointerDownOutside:Ra,onFocusOutside:$a,onDismiss:()=>jb.onOpenChange(!1)},(0,Xi.createElement)(Dx,Oe({"data-state":jb.open?"open":"closed",role:"dialog",id:jb.contentId},Jb,a,{ref:d,style:ff(Zd({},a.style),{["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))))}),WB=(0,Xi.forwardRef)((a,d)=>{var {__scopePopover:k}=a;a=Jf(a,["__scopePopover"]);k=Qt(k);return(0,Xi.createElement)(qB,
Oe({},k,a,{ref:d}))}),pr=a=>{const {__scopePopover:d,children:k,open:K,defaultOpen:da,onOpenChange:ja,modal:ra=!1}=a;a=Qt(d);const Ja=(0,Xi.useRef)(null),[Ra,$a]=(0,Xi.useState)(!1),[fb=!1,jb]=Dc({prop:K,defaultProp:da,onChange:ja});return(0,Xi.createElement)(Ex,a,(0,Xi.createElement)(Tx,{scope:d,contentId:Ei(),triggerRef:Ja,open:fb,onOpenChange:jb,onOpenToggle:(0,Xi.useCallback)(()=>jb(Jb=>!Jb),[jb]),hasCustomAnchor:Ra,onCustomAnchorAdd:(0,Xi.useCallback)(()=>$a(!0),[]),onCustomAnchorRemove:(0,Xi.useCallback)(()=>
$a(!1),[]),modal:ra},k))},Vx=Kf(ca(19)),Ro=ca(589),Wx=ee(function(a){var {popoverSide:d="left",setGeometry:k,activeGeometry:K,chevron:da=!0}=a;a=Jf(a,["popoverSide","setGeometry","activeGeometry","chevron"]);var {handlers:{t:ja}}=Vx.default.useContext(ji);const ra=[{id:"box",icon:"square",tooltip:ja("whiteboard/rectangle")},{id:"ellipse",icon:"circle",tooltip:ja("whiteboard/circle")},{id:"polygon",icon:"triangle",tooltip:ja("whiteboard/triangle")}];ja={id:"shapes",icon:"triangle-square-circle",tooltip:ja("whiteboard/shape")};
ja=K?ra.find(Ja=>Ja.id===K):ja;return(0,Ro.jsxs)(pr,{children:[(0,Ro.jsx)(Bv,{asChild:!0,children:(0,Ro.jsxs)("div",ff(Zd({},a),{className:"tl-geometry-tools-pane-anchor",children:[(0,Ro.jsx)(no,ff(Zd({},ja),{tooltipSide:d})),da&&(0,Ro.jsx)(Qg,{"data-selected":K,className:"tl-popover-indicator",name:"chevron-down-left"})]}))}),(0,Ro.jsxs)(Cv,{className:"tl-popover-content",side:d,sideOffset:15,children:[(0,Ro.jsx)("div",{className:`tl-toolbar tl-geometry-toolbar ${["left","right"].includes(d)?"flex-col":
"flex-row"}`,children:ra.map(Ja=>(0,Ro.jsx)(no,{id:Ja.id,icon:Ja.icon,tooltip:K?Ja.tooltip:"",handleClick:k,tooltipSide:d},Ja.id))}),(0,Ro.jsx)(WB,{className:"tl-popover-arrow"})]})]})}),Mh=ca(19),Xx=ca(19),Yx=["PageUp","PageDown"],Zx=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},
[Dv,hH,iH]=ag("Slider"),[$x]=Gh("Slider",[iH]),[qp,Pn]=$x("Slider"),us=(0,Mh.forwardRef)((a,d)=>{function k(Te){const df=Xs(Sd,Te);ja(Te,df)}function K(Te){ja(Te,ud.current)}function da(){Sd[ud.current]!==gf.current[ud.current]&&rc(Sd)}function ja(Te,df,{commit:Gd}={commit:!1}){const od=(String($a).split(".")[1]||"").length;Te=Io(Math.round((Te-Ja)/$a)*$a+Ja,od);const Dd=$o(Te,[Ja,Ra]);De((jd=[])=>{const Cd=Zm(jd,Dd,df);var Me=Jb*$a;if(0<Me){const af=dn(Cd);Me=Math.min(...af)>=Me}else Me=!0;return Me?
(ud.current=Cd.indexOf(Dd),(Me=String(Cd)!==String(jd))&&Gd&&rc(Cd),Me?Cd:jd):jd})}const {name:ra,min:Ja=0,max:Ra=100,step:$a=1,orientation:fb="horizontal",disabled:jb=!1,minStepsBetweenThumbs:Jb=0,defaultValue:Ob=[Ja],value:Kb,onValueChange:gc=()=>{},onValueCommit:rc=()=>{},inverted:Wb=!1}=a,kc=Jf(a,"name min max step orientation disabled minStepsBetweenThumbs defaultValue value onValueChange onValueCommit inverted".split(" ")),[hc,Fc]=(0,Mh.useState)(null);d=$g(d,Te=>Fc(Te));const Lc=(0,Mh.useRef)(new Set),
ud=(0,Mh.useRef)(0);var Jd="horizontal"===fb;const Ee=hc?!!hc.closest("form"):!0;Jd=Jd?jH:kH;const [Sd=[],De]=Dc({prop:Kb,defaultProp:Ob,onChange:Te=>{var df;null===(df=[...Lc.current][ud.current])||void 0===df||df.focus();gc(Te)}}),gf=(0,Mh.useRef)(Sd);return(0,Mh.createElement)(qp,{scope:a.__scopeSlider,disabled:jb,min:Ja,max:Ra,valueIndexToChangeRef:ud,thumbs:Lc.current,values:Sd,orientation:fb},(0,Mh.createElement)(Dv.Provider,{scope:a.__scopeSlider},(0,Mh.createElement)(Dv.Slot,{scope:a.__scopeSlider},
(0,Mh.createElement)(Jd,Oe({"aria-disabled":jb,"data-disabled":jb?"":void 0},kc,{ref:d,onPointerDown:Wf(kc.onPointerDown,()=>{jb||(gf.current=Sd)}),min:Ja,max:Ra,inverted:Wb,onSlideStart:jb?void 0:k,onSlideMove:jb?void 0:K,onSlideEnd:jb?void 0:da,onHomeKeyDown:()=>!jb&&ja(Ja,0,{commit:!0}),onEndKeyDown:()=>!jb&&ja(Ra,Sd.length-1,{commit:!0}),onStepKeyDown:({event:Te,direction:df})=>{if(!jb){Te=Yx.includes(Te.key)||Te.shiftKey&&Zx.includes(Te.key);const Gd=ud.current;ja(Sd[Gd]+$a*(Te?10:1)*df,Gd,{commit:!0})}}})))),
Ee&&Sd.map((Te,df)=>(0,Mh.createElement)(pn,{key:df,name:ra?ra+(1<Sd.length?"[]":""):void 0,value:Te})))}),[hq,ay]=$x("Slider",{startEdge:"left",endEdge:"right",size:"width",direction:1}),jH=(0,Mh.forwardRef)((a,d)=>{function k(kc){const hc=Kb.current||Jb.getBoundingClientRect(),Fc=cn([0,hc.width],Wb?[K,da]:[da,K]);Kb.current=hc;return Fc(kc-hc.left)}const {min:K,max:da,dir:ja,inverted:ra,onSlideStart:Ja,onSlideMove:Ra,onSlideEnd:$a,onStepKeyDown:fb}=a,jb=Jf(a,"min max dir inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),
[Jb,Ob]=(0,Mh.useState)(null);d=$g(d,kc=>Ob(kc));const Kb=(0,Mh.useRef)(),gc=pg(ja),rc="ltr"===gc,Wb=rc&&!ra||!rc&&ra;return(0,Mh.createElement)(hq,{scope:a.__scopeSlider,startEdge:Wb?"left":"right",endEdge:Wb?"right":"left",direction:Wb?1:-1,size:"width"},(0,Mh.createElement)(by,Oe({dir:gc,"data-orientation":"horizontal"},jb,{ref:d,style:ff(Zd({},jb.style),{["--radix-slider-thumb-transform"]:"translateX(-50%)"}),onSlideStart:kc=>{kc=k(kc.clientX);null===Ja||void 0===Ja||Ja(kc)},onSlideMove:kc=>{kc=
k(kc.clientX);null===Ra||void 0===Ra||Ra(kc)},onSlideEnd:()=>{Kb.current=void 0;null===$a||void 0===$a||$a()},onStepKeyDown:kc=>{const hc=Rt[Wb?"from-left":"from-right"].includes(kc.key);null===fb||void 0===fb||fb({event:kc,direction:hc?-1:1})}})))}),kH=(0,Mh.forwardRef)((a,d)=>{function k(Kb){const gc=Jb.current||jb.current.getBoundingClientRect(),rc=cn([0,gc.height],Ob?[da,K]:[K,da]);Jb.current=gc;return rc(Kb-gc.top)}const {min:K,max:da,inverted:ja,onSlideStart:ra,onSlideMove:Ja,onSlideEnd:Ra,
onStepKeyDown:$a}=a,fb=Jf(a,"min max inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),jb=(0,Mh.useRef)(null);d=$g(d,jb);const Jb=(0,Mh.useRef)(),Ob=!ja;return(0,Mh.createElement)(hq,{scope:a.__scopeSlider,startEdge:Ob?"bottom":"top",endEdge:Ob?"top":"bottom",size:"height",direction:Ob?1:-1},(0,Mh.createElement)(by,Oe({"data-orientation":"vertical"},fb,{ref:d,style:ff(Zd({},fb.style),{["--radix-slider-thumb-transform"]:"translateY(50%)"}),onSlideStart:Kb=>{Kb=k(Kb.clientY);null===
ra||void 0===ra||ra(Kb)},onSlideMove:Kb=>{Kb=k(Kb.clientY);null===Ja||void 0===Ja||Ja(Kb)},onSlideEnd:()=>{Jb.current=void 0;null===Ra||void 0===Ra||Ra()},onStepKeyDown:Kb=>{const gc=Rt[Ob?"from-bottom":"from-top"].includes(Kb.key);null===$a||void 0===$a||$a({event:Kb,direction:gc?-1:1})}})))}),by=(0,Mh.forwardRef)((a,d)=>{const {__scopeSlider:k,onSlideStart:K,onSlideMove:da,onSlideEnd:ja,onHomeKeyDown:ra,onEndKeyDown:Ja,onStepKeyDown:Ra}=a,$a=Jf(a,"__scopeSlider onSlideStart onSlideMove onSlideEnd onHomeKeyDown onEndKeyDown onStepKeyDown".split(" ")),
fb=Pn("Slider",k);return(0,Mh.createElement)(rk.span,Oe({},$a,{ref:d,onKeyDown:Wf(a.onKeyDown,jb=>{"Home"===jb.key?(ra(jb),jb.preventDefault()):"End"===jb.key?(Ja(jb),jb.preventDefault()):Yx.concat(Zx).includes(jb.key)&&(Ra(jb),jb.preventDefault())}),onPointerDown:Wf(a.onPointerDown,jb=>{const Jb=jb.target;Jb.setPointerCapture(jb.pointerId);jb.preventDefault();fb.thumbs.has(Jb)?Jb.focus():K(jb)}),onPointerMove:Wf(a.onPointerMove,jb=>{jb.target.hasPointerCapture(jb.pointerId)&&da(jb)}),onPointerUp:Wf(a.onPointerUp,
jb=>{const Jb=jb.target;Jb.hasPointerCapture(jb.pointerId)&&(Jb.releasePointerCapture(jb.pointerId),ja(jb))})}))}),We=(0,Mh.forwardRef)((a,d)=>{var {__scopeSlider:k}=a;a=Jf(a,["__scopeSlider"]);k=Pn("SliderTrack",k);return(0,Mh.createElement)(rk.span,Oe({"data-disabled":k.disabled?"":void 0,"data-orientation":k.orientation},a,{ref:d}))}),Zf=(0,Mh.forwardRef)((a,d)=>{var {__scopeSlider:k}=a;const K=Jf(a,["__scopeSlider"]),da=Pn("SliderRange",k);k=ay("SliderRange",k);var ja=(0,Mh.useRef)(null);d=$g(d,
ja);var ra=da.values.length;ja=da.values.map(Ja=>wi(Ja,da.min,da.max));ra=1<ra?Math.min(...ja):0;ja=100-Math.max(...ja);return(0,Mh.createElement)(rk.span,Oe({"data-orientation":da.orientation,"data-disabled":da.disabled?"":void 0},K,{ref:d,style:ff(Zd({},a.style),{[k.startEdge]:ra+"%",[k.endEdge]:ja+"%"})}))}),Ye=(0,Mh.forwardRef)((a,d)=>{const k=hH(a.__scopeSlider),[K,da]=(0,Mh.useState)(null);d=$g(d,ra=>da(ra));const ja=(0,Mh.useMemo)(()=>K?k().findIndex(ra=>ra.ref.current===K):-1,[k,K]);return(0,Mh.createElement)(Hf,
Oe({},a,{ref:d,index:ja}))}),Hf=(0,Mh.forwardRef)((a,d)=>{const {__scopeSlider:k,index:K}=a,da=Jf(a,["__scopeSlider","index"]),ja=Pn("SliderThumb",k),ra=ay("SliderThumb",k),[Ja,Ra]=(0,Mh.useState)(null);d=$g(d,Ob=>Ra(Ob));var $a=sb(Ja);const fb=ja.values[K],jb=void 0===fb?0:wi(fb,ja.min,ja.max),Jb=ol(K,ja.values.length);$a=($a=null===$a||void 0===$a?void 0:$a[ra.size])?Yl($a,jb,ra.direction):0;(0,Mh.useEffect)(()=>{if(Ja)return ja.thumbs.add(Ja),()=>{ja.thumbs.delete(Ja)}},[Ja,ja.thumbs]);return(0,Mh.createElement)("span",
{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[ra.startEdge]:`calc(${jb}% + ${$a}px)`}},(0,Mh.createElement)(Dv.ItemSlot,{scope:a.__scopeSlider},(0,Mh.createElement)(rk.span,Oe({role:"slider","aria-label":a["aria-label"]||Jb,"aria-valuemin":ja.min,"aria-valuenow":fb,"aria-valuemax":ja.max,"aria-orientation":ja.orientation,"data-orientation":ja.orientation,"data-disabled":ja.disabled?"":void 0,tabIndex:ja.disabled?void 0:0},da,{ref:d,style:void 0===fb?{display:"none"}:
a.style,onFocus:Wf(a.onFocus,()=>{ja.valueIndexToChangeRef.current=K})}))))}),pn=a=>{const {value:d}=a;a=Jf(a,["value"]);const k=(0,Mh.useRef)(null),K=Yn(d);(0,Mh.useEffect)(()=>{const da=k.current,ja=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(K!==d&&ja){const ra=new Event("input",{bubbles:!0});ja.call(da,d);da.dispatchEvent(ra)}},[K,d]);return(0,Mh.createElement)("input",Oe({style:{display:"none"}},a,{ref:k,defaultValue:d}))},sk=us,St=We,vj=Zf,So=Ye,Je=Kf(ca(19)),
Lf=ca(589),qm=ee(a=>{var {side:d,align:k,alignOffset:K,label:da,arrow:ja,children:ra,border:Ja}=a;a=Jf(a,"side align alignOffset label arrow children border".split(" "));const Ra=Je.useRef(null),[$a,fb]=Je.useState(!1),{viewport:{bounds:jb,camera:{point:Jb,zoom:Ob}}}=mg(),[Kb,gc]=Je.useState(0);Je.useEffect(()=>{if(Ra.current&&$a){var rc=Ra.current.getBoundingClientRect();sf.boundsContain(jb,{minX:rc.x,minY:rc.y,maxX:rc.right,maxY:rc.bottom,width:rc.width,height:rc.height})||gc(Wb=>Wb+1)}},[Jb[0],
Jb[1],Ob,$a]);return(0,Lf.jsxs)(pr,{onOpenChange:rc=>fb(rc),children:[(0,Lf.jsx)(Bv,ff(Zd({},a),{"data-border":Ja,className:"tl-button tl-popover-trigger-button",children:da})),(0,Lf.jsxs)(Cv,{ref:Ra,className:"tl-popover-content",align:k,alignOffset:K,side:d,sideOffset:15,collisionBoundary:document.querySelector(".logseq-tldraw"),children:[ra,ja&&(0,Lf.jsx)(WB,{className:"tl-popover-arrow"})]},"popover-content-"+Kb)]})}),He=Kf(ca(19)),Oj=ca(589),XB=Kf(ca(19)),mf=ca(19),vs=ca(20),hk=Kf(ca(19)),Hk=
ca(19),Tt=ca(19),rm=ca(20),tk="a button div form h2 h3 img input label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const k=(0,Tt.forwardRef)((K,da)=>{var {asChild:ja}=K;K=Jf(K,["asChild"]);ja=ja?Oo:d;(0,Tt.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]);return(0,Tt.createElement)(ja,Oe({},K,{ref:da}))});k.displayName=`Primitive.${d}`;return ff(Zd({},a),{[d]:k})},{}),rp,oo=(0,Hk.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zg=(0,Hk.forwardRef)((a,
d)=>{var k;const {disableOutsidePointerEvents:K=!1,onEscapeKeyDown:da,onPointerDownOutside:ja,onFocusOutside:ra,onInteractOutside:Ja,onDismiss:Ra}=a,$a=Jf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),fb=(0,Hk.useContext)(oo),[jb,Jb]=(0,Hk.useState)(null),Ob=null!==(k=null===jb||void 0===jb?void 0:jb.ownerDocument)&&void 0!==k?k:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Kb]=(0,Hk.useState)({});
d=$g(d,hc=>Jb(hc));k=Array.from(fb.layers);var [gc]=[...fb.layersWithOutsidePointerEventsDisabled].slice(-1);gc=k.indexOf(gc);const rc=jb?k.indexOf(jb):-1;k=0<fb.layersWithOutsidePointerEventsDisabled.size;const Wb=rc>=gc;gc=dp(hc=>{const Fc=hc.target,Lc=[...fb.branches].some(ud=>ud.contains(Fc));Wb&&!Lc&&(null===ja||void 0===ja||ja(hc),null===Ja||void 0===Ja||Ja(hc),hc.defaultPrevented||null===Ra||void 0===Ra||Ra())},Ob);const kc=$m(hc=>{const Fc=hc.target;[...fb.branches].some(Lc=>Lc.contains(Fc))||
(null===ra||void 0===ra||ra(hc),null===Ja||void 0===Ja||Ja(hc),hc.defaultPrevented||null===Ra||void 0===Ra||Ra())},Ob);rl(hc=>{rc===fb.layers.size-1&&(null===da||void 0===da||da(hc),!hc.defaultPrevented&&Ra&&(hc.preventDefault(),Ra()))},Ob);(0,Hk.useEffect)(()=>{if(jb)return K&&(0===fb.layersWithOutsidePointerEventsDisabled.size&&(rp=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),fb.layersWithOutsidePointerEventsDisabled.add(jb)),fb.layers.add(jb),Bn(),()=>{K&&1===fb.layersWithOutsidePointerEventsDisabled.size&&
(Ob.body.style.pointerEvents=rp)}},[jb,Ob,K,fb]);(0,Hk.useEffect)(()=>()=>{jb&&(fb.layers.delete(jb),fb.layersWithOutsidePointerEventsDisabled.delete(jb),Bn())},[jb,fb]);(0,Hk.useEffect)(()=>{const hc=()=>Kb({});document.addEventListener("dismissableLayer.update",hc);return()=>document.removeEventListener("dismissableLayer.update",hc)},[]);return(0,Hk.createElement)(tk.div,Oe({},$a,{ref:d,style:Zd({pointerEvents:k?Wb?"auto":"none":void 0},a.style),onFocusCapture:Wf(a.onFocusCapture,kc.onFocusCapture),
onBlurCapture:Wf(a.onBlurCapture,kc.onBlurCapture),onPointerDownCapture:Wf(a.onPointerDownCapture,gc.onPointerDownCapture)}))}),uk=ca(19),To={bubbles:!1,cancelable:!0},YB=(0,uk.forwardRef)((a,d)=>{const {loop:k=!1,trapped:K=!1,onMountAutoFocus:da,onUnmountAutoFocus:ja}=a;a=Jf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);const [ra,Ja]=(0,uk.useState)(null),Ra=Qi(da),$a=Qi(ja),fb=(0,uk.useRef)(null);d=$g(d,Ob=>Ja(Ob));const jb=(0,uk.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=
!1}}).current;(0,uk.useEffect)(()=>{if(K){let Ob=function(gc){!jb.paused&&ra&&(gc=gc.target,ra.contains(gc)?fb.current=gc:Em(fb.current,{select:!0}))},Kb=function(gc){!jb.paused&&ra&&(ra.contains(gc.relatedTarget)||Em(fb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Kb);return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Kb)}}},[K,ra,jb.paused]);(0,uk.useEffect)(()=>{if(ra){iq.add(jb);const Ob=document.activeElement;
if(!ra.contains(Ob)){const Kb=new CustomEvent("focusScope.autoFocusOnMount",To);ra.addEventListener("focusScope.autoFocusOnMount",Ra);ra.dispatchEvent(Kb);Kb.defaultPrevented||(Rq(Fp(Go(ra)),{select:!0}),document.activeElement===Ob&&Em(ra))}return()=>{ra.removeEventListener("focusScope.autoFocusOnMount",Ra);setTimeout(()=>{const Kb=new CustomEvent("focusScope.autoFocusOnUnmount",To);ra.addEventListener("focusScope.autoFocusOnUnmount",$a);ra.dispatchEvent(Kb);Kb.defaultPrevented||Em(null!==Ob&&void 0!==
Ob?Ob:document.body,{select:!0});ra.removeEventListener("focusScope.autoFocusOnUnmount",$a);iq.remove(jb)},0)}}},[ra,Ra,$a,jb]);const Jb=(0,uk.useCallback)(Ob=>{if((k||K)&&!jb.paused){var Kb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Kb){const rc=Ob.currentTarget;var gc=rc;const Wb=Go(gc),kc=Hn(Wb,gc);gc=Hn(Wb.reverse(),gc);const [hc,Fc]=[kc,gc];hc&&Fc?Ob.shiftKey||Kb!==Fc?Ob.shiftKey&&Kb===hc&&(Ob.preventDefault(),k&&Em(Fc,{select:!0})):(Ob.preventDefault(),k&&
Em(hc,{select:!0})):Kb===rc&&Ob.preventDefault()}}},[k,K,jb.paused]);return(0,uk.createElement)(tk.div,Oe({tabIndex:-1},a,{ref:d,onKeyDown:Jb}))}),iq=function(){let a=[];return{add(d){const k=a[0];d===k||null!==k&&void 0!==k&&k.pause();a=Zn(a,d);a.unshift(d)},remove(d){var k;a=Zn(a,d);null===(k=a[0])||void 0===k||k.resume()}}}(),Xf=ca(19),[Ev,Uo]=Gh("Popper"),[Lg,ws]=Ev("Popper"),jj=(0,Xf.forwardRef)((a,d)=>{const {__scopePopper:k,virtualRef:K}=a;a=Jf(a,["__scopePopper","virtualRef"]);const da=ws("PopperAnchor",
k),ja=(0,Xf.useRef)(null);d=$g(d,ja);(0,Xf.useEffect)(()=>{da.onAnchorChange((null===K||void 0===K?void 0:K.current)||ja.current)});return K?null:(0,Xf.createElement)(tk.div,Oe({},a,{ref:d}))}),[vk]=Ev("PopperContent"),[xs,Ut]=Ev("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),cy=(0,Xf.forwardRef)((a,d)=>{var k,K,da,ja,ra,Ja,Ra,$a;const {__scopePopper:fb,side:jb="bottom",sideOffset:Jb=0,align:Ob="center",alignOffset:Kb=0,arrowPadding:gc=0,collisionBoundary:rc=[],collisionPadding:Wb=0,sticky:kc=
"partial",hideWhenDetached:hc=!1,avoidCollisions:Fc=!0,onPlaced:Lc}=a,ud=Jf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions onPlaced".split(" ")),Jd=ws("PopperContent",fb),[Ee,Sd]=(0,Xf.useState)(null);d=$g(d,Am=>Sd(Am));const [De,gf]=(0,Xf.useState)(null);var Te=sb(De),df=null!==(k=null===Te||void 0===Te?void 0:Te.width)&&void 0!==k?k:0;k=null!==(K=null===Te||void 0===Te?void 0:Te.height)&&void 0!==K?K:0;K=
jb+("center"!==Ob?"-"+Ob:"");Te="number"===typeof Wb?Wb:Zd({top:0,right:0,bottom:0,left:0},Wb);const Gd=Array.isArray(rc)?rc:[rc],od=0<Gd.length;Te={padding:Te,boundary:Gd.filter(Og),altBoundary:od};const {reference:Dd,floating:jd,strategy:Cd,x:Me,y:af,placement:Nf,middlewareData:bg,update:ef}=Xb({strategy:"fixed",placement:K,whileElementsMounted:Sb,middleware:[ys(),jB({mainAxis:Jb+k,alignmentAxis:Kb}),Fc?kB(Zd({mainAxis:!0,crossAxis:!1,limiter:"partial"===kc?lB():void 0},Te)):void 0,De?oB({element:De,
padding:gc}):void 0,Fc?hB(Zd({},Te)):void 0,jG(ff(Zd({},Te),{apply:({elements:Am,availableWidth:jw,availableHeight:zu})=>{Am.floating.style.setProperty("--radix-popper-available-width",`${jw}px`);Am.floating.style.setProperty("--radix-popper-available-height",`${zu}px`)}})),Vk({arrowWidth:df,arrowHeight:k}),hc?iB({strategy:"referenceHidden"}):void 0].filter(ap)});vl(()=>{Dd(Jd.anchor)},[Dd,Jd.anchor]);const Eg=null!==Me&&null!==af,[yf,Fg]=ep(Nf),Gg=Qi(Lc);vl(()=>{Eg&&(null===Gg||void 0===Gg||Gg())},
[Eg,Gg]);df=null===(da=bg.arrow)||void 0===da?void 0:da.x;da=null===(ja=bg.arrow)||void 0===ja?void 0:ja.y;ja=0!==(null===(ra=bg.arrow)||void 0===ra?void 0:ra.centerOffset);const [Bi,Bj]=(0,Xf.useState)();vl(()=>{Ee&&Bj(window.getComputedStyle(Ee).zIndex)},[Ee]);const {hasParent:Fi,positionUpdateFns:Xm}=Ut("PopperContent",fb),Dp=!Fi;(0,Xf.useLayoutEffect)(()=>{if(!Dp)return Xm.add(ef),()=>{Xm.delete(ef)}},[Dp,Xm,ef]);vl(()=>{Dp&&Eg&&Array.from(Xm).reverse().forEach(Am=>requestAnimationFrame(Am))},
[Dp,Eg,Xm]);ra=ff(Zd({"data-side":yf,"data-align":Fg},ud),{ref:d,style:ff(Zd({},ud.style),{animation:Eg?void 0:"none",opacity:null!==(Ja=bg.hide)&&void 0!==Ja&&Ja.referenceHidden?0:void 0})});return(0,Xf.createElement)("div",{ref:jd,"data-radix-popper-content-wrapper":"",style:{position:Cd,left:0,top:0,transform:Eg?`translate3d(${Math.round(Me)}px, ${Math.round(af)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Bi,["--radix-popper-transform-origin"]:[null===(Ra=bg.transformOrigin)||
void 0===Ra?void 0:Ra.x,null===($a=bg.transformOrigin)||void 0===$a?void 0:$a.y].join(" ")},dir:a.dir},(0,Xf.createElement)(vk,{scope:fb,placedSide:yf,onArrowChange:gf,arrowX:df,arrowY:da,shouldHideArrow:ja},Dp?(0,Xf.createElement)(xs,{scope:fb,hasParent:!0,positionUpdateFns:Xm},(0,Xf.createElement)(tk.div,ra)):(0,Xf.createElement)(tk.div,ra)))}),ys=()=>({name:"anchorCssProperties",fn(a){const {rects:d,elements:k}=a,{width:K,height:da}=d.reference;k.floating.style.setProperty("--radix-popper-anchor-width",
`${K}px`);k.floating.style.setProperty("--radix-popper-anchor-height",`${da}px`);return{}}}),Vk=a=>({name:"transformOrigin",options:a,fn(d){var k,K,da,ja,ra;const {placement:Ja,rects:Ra,middlewareData:$a}=d,fb=(d=0!==(null===(k=$a.arrow)||void 0===k?void 0:k.centerOffset))?0:a.arrowWidth;k=d?0:a.arrowHeight;const [jb,Jb]=ep(Ja),Ob={start:"0%",center:"50%",end:"100%"}[Jb],Kb=(null!==(K=null===(da=$a.arrow)||void 0===da?void 0:da.x)&&void 0!==K?K:0)+fb/2;K=(null!==(ja=null===(ra=$a.arrow)||void 0===
ra?void 0:ra.y)&&void 0!==ja?ja:0)+k/2;ra=ja="";"bottom"===jb?(ja=d?Ob:`${Kb}px`,ra=`${-k}px`):"top"===jb?(ja=d?Ob:`${Kb}px`,ra=`${Ra.floating.height+k}px`):"right"===jb?(ja=`${-k}px`,ra=d?Ob:`${K}px`):"left"===jb&&(ja=`${Ra.floating.width+k}px`,ra=d?Ob:`${K}px`);return{data:{x:ja,y:ra}}}}),ZB=a=>{const {__scopePopper:d,children:k}=a,[K,da]=(0,Xf.useState)(null);return(0,Xf.createElement)(Lg,{scope:d,anchor:K,onAnchorChange:da},k)},$B=ca(19),lH=Kf(ca(20)),mH=(0,$B.forwardRef)((a,d)=>{var k;const {container:K=
null===globalThis||void 0===globalThis?void 0:null===(k=globalThis.document)||void 0===k?void 0:k.body}=a;a=Jf(a,["container"]);return K?lH.default.createPortal((0,$B.createElement)(tk.div,Oe({},a,{ref:d})),K):null}),sp=ca(19),jq=(0,sp.forwardRef)((a,d)=>(0,sp.createElement)(tk.span,Oe({},a,{ref:d,style:Zd({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"},a.style)}))),ej=[" ","Enter","ArrowUp","ArrowDown"],
aC=[" ","Enter"],[zs,Fv,kq]=function(a){var d=a+"CollectionProvider";const [k,K]=Gh(d),[da,ja]=k(d,{collectionRef:{current:null},itemMap:new Map}),ra=fb=>{const {scope:jb,children:Jb}=fb;fb=hk.default.useRef(null);const Ob=hk.default.useRef(new Map).current;return hk.default.createElement(da,{scope:jb,itemMap:Ob,collectionRef:fb},Jb)};Object.assign(ra,{displayName:d});const Ja=a+"CollectionSlot";d=hk.default.forwardRef((fb,jb)=>{const {scope:Jb,children:Ob}=fb;fb=ja(Ja,Jb);jb=$g(jb,fb.collectionRef);
return hk.default.createElement(Oo,{ref:jb},Ob)});Object.assign(d,{displayName:Ja});const Ra=a+"CollectionItemSlot",$a=hk.default.forwardRef((fb,jb)=>{const {scope:Jb,children:Ob}=fb,Kb=Jf(fb,["scope","children"]),gc=hk.default.useRef(null);fb=$g(jb,gc);const rc=ja(Ra,Jb);hk.default.useEffect(()=>{rc.itemMap.set(gc,Zd({ref:gc},Kb));return()=>void rc.itemMap.delete(gc)});return hk.default.createElement(Oo,{["data-radix-collection-item"]:"",ref:fb},Ob)});Object.assign($a,{displayName:Ra});return[{Provider:ra,
Slot:d,ItemSlot:$a},function(fb){const jb=ja(a+"CollectionConsumer",fb);return hk.default.useCallback(()=>{const Jb=jb.collectionRef.current;if(!Jb)return[];const Ob=Array.from(Jb.querySelectorAll("[data-radix-collection-item]"));return Array.from(jb.itemMap.values()).sort((Kb,gc)=>Ob.indexOf(Kb.ref.current)-Ob.indexOf(gc.ref.current))},[jb.collectionRef,jb.itemMap])},K]}("Select"),[As]=Gh("Select",[kq,Uo]),Bs=Uo(),[nH,Vo]=As("Select"),[dy,ey]=As("Select"),fy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,
disabled:K=!1}=a;a=Jf(a,["__scopeSelect","disabled"]);const da=Bs(k),ja=Vo("SelectTrigger",k),ra=ja.disabled||K;d=$g(d,ja.onTriggerChange);const Ja=Fv(k),[Ra,$a,fb]=fp(jb=>{const Jb=Ja().filter(Kb=>!Kb.disabled),Ob=Jb.find(Kb=>Kb.value===ja.value);jb=In(Jb,jb,Ob);if(void 0!==jb)ja.onValueChange(jb.value)});return(0,mf.createElement)(jj,Oe({asChild:!0},da),(0,mf.createElement)(tk.button,Oe({type:"button",role:"combobox","aria-controls":ja.contentId,"aria-expanded":ja.open,"aria-required":ja.required,
"aria-autocomplete":"none",dir:ja.dir,"data-state":ja.open?"open":"closed",disabled:ra,"data-disabled":ra?"":void 0,"data-placeholder":void 0===ja.value?"":void 0},a,{ref:d,onClick:Wf(a.onClick,jb=>{jb.currentTarget.focus()}),onPointerDown:Wf(a.onPointerDown,jb=>{const Jb=jb.target;Jb.hasPointerCapture(jb.pointerId)&&Jb.releasePointerCapture(jb.pointerId);0===jb.button&&!1===jb.ctrlKey&&(ra||(ja.onOpenChange(!0),fb()),ja.triggerPointerDownPosRef.current={x:Math.round(jb.pageX),y:Math.round(jb.pageY)},
jb.preventDefault())}),onKeyDown:Wf(a.onKeyDown,jb=>{const Jb=""!==Ra.current;jb.ctrlKey||jb.altKey||jb.metaKey||1!==jb.key.length||$a(jb.key);Jb&&" "===jb.key||!ej.includes(jb.key)||(ra||(ja.onOpenChange(!0),fb()),jb.preventDefault())})})))}),bC=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,children:K,placeholder:da}=a;a=Jf(a,["__scopeSelect","className","style","children","placeholder"]);const ja=Vo("SelectValue",k),{onValueNodeHasChildrenChange:ra}=ja,Ja=void 0!==K;d=$g(d,ja.onValueNodeChange);
vl(()=>{ra(Ja)},[ra,Ja]);return(0,mf.createElement)(tk.span,Oe({},a,{ref:d,style:{pointerEvents:"none"}}),void 0===ja.value&&void 0!==da?da:K)}),cC=(0,mf.forwardRef)((a,d)=>{const {children:k}=a;a=Jf(a,["__scopeSelect","children"]);return(0,mf.createElement)(tk.span,Oe({"aria-hidden":!0},a,{ref:d}),k||"▼")}),dC=(0,mf.forwardRef)((a,d)=>{const k=Vo("SelectContent",a.__scopeSelect),[K,da]=(0,mf.useState)();vl(()=>{da(new DocumentFragment)},[]);return k.open?(0,mf.createElement)(gy,Oe({},a,{ref:d})):
K?(0,vs.createPortal)((0,mf.createElement)(lq,{scope:a.__scopeSelect},(0,mf.createElement)(zs.Slot,{scope:a.__scopeSelect},(0,mf.createElement)("div",null,a.children))),K):null}),[lq,qn]=As("SelectContent"),gy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,position:K="item-aligned",onCloseAutoFocus:da,onEscapeKeyDown:ja,onPointerDownOutside:ra,side:Ja,sideOffset:Ra,align:$a,alignOffset:fb,arrowPadding:jb,collisionBoundary:Jb,collisionPadding:Ob,sticky:Kb,hideWhenDetached:gc,avoidCollisions:rc}=
a;a=Jf(a,"__scopeSelect position onCloseAutoFocus onEscapeKeyDown onPointerDownOutside side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Wb=Vo("SelectContent",k),[kc,hc]=(0,mf.useState)(null),[Fc,Lc]=(0,mf.useState)(null);d=$g(d,yf=>hc(yf));const [ud,Jd]=(0,mf.useState)(null),[Ee,Sd]=(0,mf.useState)(null),De=Fv(k),[gf,Te]=(0,mf.useState)(!1),df=(0,mf.useRef)(!1);(0,mf.useEffect)(()=>{if(kc)return Lx(kc)},[kc]);
Gf();const Gd=(0,mf.useCallback)(yf=>{const [Fg,...Gg]=De().map(Fi=>Fi.ref.current),[Bi]=Gg.slice(-1),Bj=document.activeElement;for(const Fi of yf){if(Fi===Bj)break;null===Fi||void 0===Fi||Fi.scrollIntoView({block:"nearest"});Fi===Fg&&Fc&&(Fc.scrollTop=0);Fi===Bi&&Fc&&(Fc.scrollTop=Fc.scrollHeight);null===Fi||void 0===Fi||Fi.focus();if(document.activeElement!==Bj)break}},[De,Fc]),od=(0,mf.useCallback)(()=>Gd([ud,kc]),[Gd,ud,kc]);(0,mf.useEffect)(()=>{gf&&od()},[gf,od]);const {onOpenChange:Dd,triggerPointerDownPosRef:jd}=
Wb;(0,mf.useEffect)(()=>{if(kc){var yf=0,Fg=0;const Gg=Bj=>{var Fi,Xm,Dp,Am;yf=Math.abs(Math.round(Bj.pageX)-(null!==(Fi=null===(Xm=jd.current)||void 0===Xm?void 0:Xm.x)&&void 0!==Fi?Fi:0));Fg=Math.abs(Math.round(Bj.pageY)-(null!==(Dp=null===(Am=jd.current)||void 0===Am?void 0:Am.y)&&void 0!==Dp?Dp:0))},Bi=Bj=>{10>=yf&&10>=Fg?Bj.preventDefault():kc.contains(Bj.target)||Dd(!1);document.removeEventListener("pointermove",Gg);jd.current=null};null!==jd.current&&(document.addEventListener("pointermove",
Gg),document.addEventListener("pointerup",Bi,{capture:!0,once:!0}));return()=>{document.removeEventListener("pointermove",Gg);document.removeEventListener("pointerup",Bi,{capture:!0})}}},[kc,Dd,jd]);(0,mf.useEffect)(()=>{const yf=()=>Dd(!1);window.addEventListener("blur",yf);window.addEventListener("resize",yf);return()=>{window.removeEventListener("blur",yf);window.removeEventListener("resize",yf)}},[Dd]);const [Cd,Me]=fp(yf=>{const Fg=De().filter(Bj=>!Bj.disabled),Gg=Fg.find(Bj=>Bj.ref.current===
document.activeElement),Bi=In(Fg,yf,Gg);Bi&&setTimeout(()=>Bi.ref.current.focus())}),af=(0,mf.useCallback)((yf,Fg,Gg)=>{Gg=!df.current&&!Gg;if(void 0!==Wb.value&&Wb.value===Fg||Gg)Jd(yf),Gg&&(df.current=!0)},[Wb.value]),Nf=(0,mf.useCallback)(()=>null===kc||void 0===kc?void 0:kc.focus(),[kc]),bg=(0,mf.useCallback)((yf,Fg,Gg)=>{Gg=!df.current&&!Gg;(void 0!==Wb.value&&Wb.value===Fg||Gg)&&Sd(yf)},[Wb.value]),ef="popper"===K?hy:eC,Eg=ef===hy?{side:Ja,sideOffset:Ra,align:$a,alignOffset:fb,arrowPadding:jb,
collisionBoundary:Jb,collisionPadding:Ob,sticky:Kb,hideWhenDetached:gc,avoidCollisions:rc}:{};return(0,mf.createElement)(lq,{scope:k,content:kc,viewport:Fc,onViewportChange:Lc,itemRefCallback:af,selectedItem:ud,onItemLeave:Nf,itemTextRefCallback:bg,focusSelectedItem:od,selectedItemText:Ee,position:K,isPositioned:gf,searchRef:Cd},(0,mf.createElement)(Qo,{as:Oo,allowPinchZoom:!0},(0,mf.createElement)(YB,{asChild:!0,trapped:Wb.open,onMountAutoFocus:yf=>{yf.preventDefault()},onUnmountAutoFocus:Wf(da,
yf=>{var Fg;null===(Fg=Wb.trigger)||void 0===Fg||Fg.focus({preventScroll:!0});yf.preventDefault()})},(0,mf.createElement)(zg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:ja,onPointerDownOutside:ra,onFocusOutside:yf=>yf.preventDefault(),onDismiss:()=>Wb.onOpenChange(!1)},(0,mf.createElement)(ef,Oe({role:"listbox",id:Wb.contentId,"data-state":Wb.open?"open":"closed",dir:Wb.dir,onContextMenu:yf=>yf.preventDefault()},a,Eg,{onPlaced:()=>Te(!0),ref:d,style:Zd({display:"flex",flexDirection:"column",
outline:"none"},a.style),onKeyDown:Wf(a.onKeyDown,yf=>{var Fg=yf.ctrlKey||yf.altKey||yf.metaKey;"Tab"===yf.key&&yf.preventDefault();Fg||1!==yf.key.length||Me(yf.key);if(["ArrowUp","ArrowDown","Home","End"].includes(yf.key)){let Gg=De().filter(Bi=>!Bi.disabled).map(Bi=>Bi.ref.current);["ArrowUp","End"].includes(yf.key)&&(Gg=Gg.slice().reverse());["ArrowUp","ArrowDown"].includes(yf.key)&&(Fg=Gg.indexOf(yf.target),Gg=Gg.slice(Fg+1));setTimeout(()=>Gd(Gg));yf.preventDefault()}})}))))))}),eC=(0,mf.forwardRef)((a,
d)=>{const {__scopeSelect:k,onPlaced:K}=a;a=Jf(a,["__scopeSelect","onPlaced"]);const da=Vo("SelectContent",k);var ja=qn("SelectContent",k);const [ra,Ja]=(0,mf.useState)(null),[Ra,$a]=(0,mf.useState)(null);d=$g(d,Fc=>$a(Fc));const fb=Fv(k),jb=(0,mf.useRef)(!1),Jb=(0,mf.useRef)(!0),{viewport:Ob,selectedItem:Kb,selectedItemText:gc,focusSelectedItem:rc}=ja,Wb=(0,mf.useCallback)(()=>{if(da.trigger&&da.valueNode&&ra&&Ra&&Ob&&Kb&&gc){var Fc=da.trigger.getBoundingClientRect(),Lc=Ra.getBoundingClientRect(),
ud=da.valueNode.getBoundingClientRect(),Jd=gc.getBoundingClientRect();"rtl"!==da.dir?(Jd=ud.left-(Jd.left-Lc.left),ud=Fc.width+(Fc.left-Jd),Lc=$o(Jd,[10,window.innerWidth-10-Math.max(ud,Lc.width)]),ra.style.minWidth=ud+"px",ra.style.left=Lc+"px"):(Jd=window.innerWidth-ud.right-(Lc.right-Jd.right),ud=Fc.width+(window.innerWidth-Fc.right-Jd),Lc=$o(Jd,[10,window.innerWidth-10-Math.max(ud,Lc.width)]),ra.style.minWidth=ud+"px",ra.style.right=Lc+"px");const df=fb();Lc=window.innerHeight-20;var Ee=Ob.scrollHeight,
Sd=window.getComputedStyle(Ra);ud=parseInt(Sd.borderTopWidth,10);var De=parseInt(Sd.paddingTop,10);Jd=parseInt(Sd.borderBottomWidth,10);Sd=parseInt(Sd.paddingBottom,10);var gf=ud+De+Ee+Sd+Jd;Ee=Math.min(5*Kb.offsetHeight,gf);var Te=window.getComputedStyle(Ob);Sd=parseInt(Te.paddingTop,10);Te=parseInt(Te.paddingBottom,10);const Gd=Fc.top+Fc.height/2-10,od=Lc-Gd;Fc=Kb.offsetHeight/2;De=ud+De+(Kb.offsetTop+Fc);gf-=De;De<=Gd?(ud=Kb===df[df.length-1].ref.current,ra.style.bottom="0px",ra.style.height=De+
Math.max(od,Fc+(ud?Te:0)+(Ra.clientHeight-Ob.offsetTop-Ob.offsetHeight)+Jd)+"px"):(Jd=Kb===df[0].ref.current,ra.style.top="0px",ra.style.height=Math.max(Gd,ud+Ob.offsetTop+(Jd?Sd:0)+Fc)+gf+"px",Ob.scrollTop=De-Gd+Ob.offsetTop);ra.style.margin="10px 0";ra.style.minHeight=Ee+"px";ra.style.maxHeight=Lc+"px";null===K||void 0===K||K();requestAnimationFrame(()=>jb.current=!0)}},[fb,da.trigger,da.valueNode,ra,Ra,Ob,Kb,gc,da.dir,K]);vl(()=>Wb(),[Wb]);const [kc,hc]=(0,mf.useState)();vl(()=>{Ra&&hc(window.getComputedStyle(Ra).zIndex)},
[Ra]);ja=(0,mf.useCallback)(Fc=>{Fc&&!0===Jb.current&&(Wb(),null===rc||void 0===rc||rc(),Jb.current=!1)},[Wb,rc]);return(0,mf.createElement)(Cs,{scope:k,contentWrapper:ra,shouldExpandOnScrollRef:jb,onScrollButtonChange:ja},(0,mf.createElement)("div",{ref:Ja,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:kc}},(0,mf.createElement)(tk.div,Oe({},a,{ref:d,style:Zd({boxSizing:"border-box",maxHeight:"100%"},a.style)}))))}),hy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,align:K=
"start",collisionPadding:da=10}=a;a=Jf(a,["__scopeSelect","align","collisionPadding"]);const ja=Bs(k);return(0,mf.createElement)(cy,Oe({},ja,a,{ref:d,align:K,collisionPadding:da,style:ff(Zd({boxSizing:"border-box"},a.style),{"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)",
"--radix-select-trigger-height":"var(--radix-popper-anchor-height)"})}))}),[Cs,mq]=As("SelectContent",{}),Vt=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k}=a;a=Jf(a,["__scopeSelect"]);const K=qn("SelectViewport",k),da=mq("SelectViewport",k);d=$g(d,K.onViewportChange);const ja=(0,mf.useRef)(0);return(0,mf.createElement)(mf.Fragment,null,(0,mf.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),
(0,mf.createElement)(zs.Slot,{scope:k},(0,mf.createElement)(tk.div,Oe({"data-radix-select-viewport":"",role:"presentation"},a,{ref:d,style:Zd({position:"relative",flex:1,overflow:"auto"},a.style),onScroll:Wf(a.onScroll,ra=>{ra=ra.currentTarget;const {contentWrapper:Ja,shouldExpandOnScrollRef:Ra}=da;if(null!==Ra&&void 0!==Ra&&Ra.current&&Ja){var $a=Math.abs(ja.current-ra.scrollTop);if(0<$a){var fb=window.innerHeight-20,jb=parseFloat(Ja.style.minHeight);const Jb=parseFloat(Ja.style.height);jb=Math.max(jb,
Jb);jb<fb&&($a=jb+$a,fb=Math.min(fb,$a),$a-=fb,Ja.style.height=fb+"px","0px"===Ja.style.bottom&&(ra.scrollTop=0<$a?$a:0,Ja.style.justifyContent="flex-end"))}}ja.current=ra.scrollTop})}))))});As("SelectGroup");var [Wt,Xt]=As("SelectItem"),nq=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,value:K,disabled:da=!1,textValue:ja}=a;a=Jf(a,["__scopeSelect","value","disabled","textValue"]);const ra=Vo("SelectItem",k),Ja=qn("SelectItem",k),Ra=ra.value===K,[$a,fb]=(0,mf.useState)(null!==ja&&void 0!==ja?ja:
""),[jb,Jb]=(0,mf.useState)(!1);d=$g(d,gc=>{var rc;return null===(rc=Ja.itemRefCallback)||void 0===rc?void 0:rc.call(Ja,gc,K,da)});const Ob=Ei(),Kb=()=>{da||(ra.onValueChange(K),ra.onOpenChange(!1))};return(0,mf.createElement)(Wt,{scope:k,value:K,disabled:da,textId:Ob,isSelected:Ra,onItemTextChange:(0,mf.useCallback)(gc=>{fb(rc=>{var Wb;return rc||(null!==(Wb=null===gc||void 0===gc?void 0:gc.textContent)&&void 0!==Wb?Wb:"").trim()})},[])},(0,mf.createElement)(zs.ItemSlot,{scope:k,value:K,disabled:da,
textValue:$a},(0,mf.createElement)(tk.div,Oe({role:"option","aria-labelledby":Ob,"data-highlighted":jb?"":void 0,"aria-selected":Ra&&jb,"data-state":Ra?"checked":"unchecked","aria-disabled":da||void 0,"data-disabled":da?"":void 0,tabIndex:da?void 0:-1},a,{ref:d,onFocus:Wf(a.onFocus,()=>Jb(!0)),onBlur:Wf(a.onBlur,()=>Jb(!1)),onPointerUp:Wf(a.onPointerUp,Kb),onPointerMove:Wf(a.onPointerMove,gc=>{if(da){var rc;null===(rc=Ja.onItemLeave)||void 0===rc||rc.call(Ja)}else gc.currentTarget.focus({preventScroll:!0})}),
onPointerLeave:Wf(a.onPointerLeave,gc=>{if(gc.currentTarget===document.activeElement){var rc;null===(rc=Ja.onItemLeave)||void 0===rc||rc.call(Ja)}}),onKeyDown:Wf(a.onKeyDown,gc=>{var rc;if(""===(null===(rc=Ja.searchRef)||void 0===rc?void 0:rc.current)||" "!==gc.key)aC.includes(gc.key)&&Kb()," "===gc.key&&gc.preventDefault()})}))))}),Qn=(0,mf.forwardRef)((a,d)=>{var {__scopeSelect:k}=a;a=Jf(a,["__scopeSelect","className","style"]);const K=Vo("SelectItemText",k),da=qn("SelectItemText",k),ja=Xt("SelectItemText",
k);k=ey("SelectItemText",k);const [ra,Ja]=(0,mf.useState)(null);d=$g(d,Jb=>Ja(Jb),ja.onItemTextChange,Jb=>{var Ob;return null===(Ob=da.itemTextRefCallback)||void 0===Ob?void 0:Ob.call(da,Jb,ja.value,ja.disabled)});const Ra=null===ra||void 0===ra?void 0:ra.textContent,$a=(0,mf.useMemo)(()=>(0,mf.createElement)("option",{key:ja.value,value:ja.value,disabled:ja.disabled},Ra),[ja.disabled,ja.value,Ra]),{onNativeOptionAdd:fb,onNativeOptionRemove:jb}=k;vl(()=>{fb($a);return()=>jb($a)},[fb,jb,$a]);return(0,mf.createElement)(mf.Fragment,
null,(0,mf.createElement)(tk.span,Oe({id:ja.textId},a,{ref:d})),ja.isSelected&&K.valueNode&&!K.valueNodeHasChildren?(0,vs.createPortal)(a.children,K.valueNode):null)}),fC=(0,mf.forwardRef)((a,d)=>{const k=qn("SelectScrollUpButton",a.__scopeSelect),K=mq("SelectScrollUpButton",a.__scopeSelect),[da,ja]=(0,mf.useState)(!1);d=$g(d,K.onScrollButtonChange);vl(()=>{if(k.viewport&&k.isPositioned){let ra=function(){ja(0<Ja.scrollTop)};const Ja=k.viewport;ra();Ja.addEventListener("scroll",ra);return()=>Ja.removeEventListener("scroll",
ra)}},[k.viewport,k.isPositioned]);return da?(0,mf.createElement)(qr,Oe({},a,{ref:d,onAutoScroll:()=>{const {viewport:ra,selectedItem:Ja}=k;ra&&Ja&&(ra.scrollTop-=Ja.offsetHeight)}})):null}),rn=(0,mf.forwardRef)((a,d)=>{const k=qn("SelectScrollDownButton",a.__scopeSelect),K=mq("SelectScrollDownButton",a.__scopeSelect),[da,ja]=(0,mf.useState)(!1);d=$g(d,K.onScrollButtonChange);vl(()=>{if(k.viewport&&k.isPositioned){let ra=function(){ja(Math.ceil(Ja.scrollTop)<Ja.scrollHeight-Ja.clientHeight)};const Ja=
k.viewport;ra();Ja.addEventListener("scroll",ra);return()=>Ja.removeEventListener("scroll",ra)}},[k.viewport,k.isPositioned]);return da?(0,mf.createElement)(qr,Oe({},a,{ref:d,onAutoScroll:()=>{const {viewport:ra,selectedItem:Ja}=k;ra&&Ja&&(ra.scrollTop+=Ja.offsetHeight)}})):null}),qr=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:k,onAutoScroll:K}=a;a=Jf(a,["__scopeSelect","onAutoScroll"]);const da=qn("SelectScrollButton",k),ja=(0,mf.useRef)(null),ra=Fv(k),Ja=(0,mf.useCallback)(()=>{null!==ja.current&&
(window.clearInterval(ja.current),ja.current=null)},[]);(0,mf.useEffect)(()=>()=>Ja(),[Ja]);vl(()=>{var Ra;const $a=ra().find(fb=>fb.ref.current===document.activeElement);null===$a||void 0===$a||null===(Ra=$a.ref.current)||void 0===Ra||Ra.scrollIntoView({block:"nearest"})},[ra]);return(0,mf.createElement)(tk.div,Oe({"aria-hidden":!0},a,{ref:d,style:Zd({flexShrink:0},a.style),onPointerMove:Wf(a.onPointerMove,()=>{var Ra;null===(Ra=da.onItemLeave)||void 0===Ra||Ra.call(da);null===ja.current&&(ja.current=
window.setInterval(K,50))}),onPointerLeave:Wf(a.onPointerLeave,()=>{Ja()})}))}),Yt=(0,mf.forwardRef)((a,d)=>{const {value:k}=a;a=Jf(a,["value"]);const K=(0,mf.useRef)(null);d=$g(d,K);const da=Yn(k);(0,mf.useEffect)(()=>{const ja=K.current,ra=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(da!==k&&ra){const Ja=new Event("change",{bubbles:!0});ra.call(ja,k);ja.dispatchEvent(Ja)}},[da,k]);return(0,mf.createElement)(jq,{asChild:!0},(0,mf.createElement)("select",Oe({},
a,{ref:d,defaultValue:k})))});Yt.displayName="BubbleSelect";var oq=a=>{const {__scopeSelect:d,children:k,open:K,defaultOpen:da,onOpenChange:ja,value:ra,defaultValue:Ja,onValueChange:Ra,dir:$a,name:fb,autoComplete:jb,disabled:Jb,required:Ob}=a,Kb=Bs(d),[gc,rc]=(0,mf.useState)(null),[Wb,kc]=(0,mf.useState)(null),[hc,Fc]=(0,mf.useState)(!1),Lc=pg($a),[ud=!1,Jd]=Dc({prop:K,defaultProp:da,onChange:ja}),[Ee,Sd]=Dc({prop:ra,defaultProp:Ja,onChange:Ra}),De=(0,mf.useRef)(null),gf=gc?!!gc.closest("form"):!0,
[Te,df]=(0,mf.useState)(new Set),Gd=Array.from(Te).map(od=>od.props.value).join(";");return(0,mf.createElement)(ZB,Kb,(0,mf.createElement)(nH,{required:Ob,scope:d,trigger:gc,onTriggerChange:rc,valueNode:Wb,onValueNodeChange:kc,valueNodeHasChildren:hc,onValueNodeHasChildrenChange:Fc,contentId:Ei(),value:Ee,onValueChange:Sd,open:ud,onOpenChange:Jd,dir:Lc,triggerPointerDownPosRef:De,disabled:Jb},(0,mf.createElement)(zs.Provider,{scope:d},(0,mf.createElement)(dy,{scope:a.__scopeSelect,onNativeOptionAdd:(0,mf.useCallback)(od=>
{df(Dd=>(new Set(Dd)).add(od))},[]),onNativeOptionRemove:(0,mf.useCallback)(od=>{df(Dd=>{Dd=new Set(Dd);Dd.delete(od);return Dd})},[])},k)),gf?(0,mf.createElement)(Yt,{key:Gd,"aria-hidden":!0,required:Ob,tabIndex:-1,name:fb,autoComplete:jb,value:Ee,onChange:od=>Sd(od.target.value),disabled:Jb},void 0===Ee?(0,mf.createElement)("option",{value:""}):null,Array.from(Te)):null))},gC=fy,iC=bC,jC=cC,wl=a=>(0,mf.createElement)(mH,Oe({asChild:!0},a)),iy=dC,hC=Vt,Pm=nq,zd=Qn,kC=fC,Ah=rn,Rg=ca(589),lC=Kf(ca(19)),
Zt=ca(589),xl=ca(589),mC=ee(function(){const a=mg(),{handlers:{t:d}}=il.useContext(ji),k=il.useCallback(ra=>{a.api.setColor(ra)},[]),K=il.useCallback(ra=>{(ra=ra.currentTarget.dataset.tool)&&a.selectTool(ra)},[]),[da,ja]=il.useState(()=>{var ra;return null!=(ra=Object.values(as).find(Ja=>Ja===a.selectedTool.id))?ra:Object.values(as)[0]});il.useEffect(()=>{ja(ra=>{var Ja;return null!=(Ja=Object.values(as).find(Ra=>Ra===a.selectedTool.id))?Ja:ra})},[a.selectedTool.id]);return(0,xl.jsx)("div",{className:"tl-primary-tools",
"data-html2canvas-ignore":"true",children:(0,xl.jsxs)("div",{className:"tl-toolbar tl-tools-floating-panel",children:[(0,xl.jsx)(no,{handleClick:()=>a.selectTool("select"),tooltip:d("whiteboard/select"),id:"select",icon:"select-cursor"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("move"),tooltip:d("whiteboard/pan"),id:"move",icon:a.isIn("move.panning")?"hand-grab":"hand-stop"}),(0,xl.jsx)(gq,{className:"tl-toolbar-separator",orientation:"horizontal"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("logseq-portal"),
tooltip:d("whiteboard/add-block-or-page"),id:"logseq-portal",icon:"circle-plus"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("pencil"),tooltip:d("whiteboard/draw"),id:"pencil",icon:"ballpen"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("highlighter"),tooltip:d("whiteboard/highlight"),id:"highlighter",icon:"highlight"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("erase"),tooltip:d("whiteboard/eraser"),id:"erase",icon:"eraser"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("line"),tooltip:d("whiteboard/connector"),
id:"line",icon:"connector"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("text"),tooltip:d("whiteboard/text"),id:"text",icon:"text"}),(0,xl.jsx)(Wx,{activeGeometry:da,setGeometry:K}),(0,xl.jsx)(gq,{className:"tl-toolbar-separator",orientation:"horizontal",style:{margin:"0 -4px"}}),(0,xl.jsx)(km,{popoverSide:"left",color:a.settings.color,setColor:k}),(0,xl.jsx)(Jr,{scaleLevel:a.settings.scaleLevel,popoverSide:"left",compact:!0})]})})}),jy=ca(589),Gv=ee(function(){const a=mg();return(0,jy.jsxs)("div",
{className:"tl-statusbar","data-html2canvas-ignore":"true",children:[a.selectedTool.id," | ",a.selectedTool.currentState.id,(0,jy.jsx)("div",{style:{flex:1}}),(0,jy.jsx)("div",{id:"tl-statusbar-anchor",className:"flex gap-1"})]})}),rr=ca(589),nC=ee(function(){const a=mg();return(0,rr.jsxs)(rr.Fragment,{children:[wf()&&(0,rr.jsx)(Gv,{}),wf()&&(0,rr.jsx)(nn,{}),!a.readOnly&&(0,rr.jsx)(mC,{}),(0,rr.jsx)(TB,{})]})}),sn=Kf(ca(19)),Wk=Kf(ca(19)),ky=Kf(ca(19)),oC=Kf(ca(19)),tp=ca(589),ly=({id:a,showReferenceContent:d=
!1})=>{var k;const {handlers:{isWhiteboardPage:K,redirectToPage:da,sidebarAddBlock:ja,queryBlockByUUID:ra},renderers:{Breadcrumb:Ja,PageName:Ra}}=oC.default.useContext(ji);var $a="";let fb=Dj(a)?"B":"P",jb="";if(Dj(a)){$a=ra(a);if(!$a)return(0,tp.jsx)("span",{className:"p-2",children:"Invalid reference. Did you remove it?"});jb=$a.content;$a="whiteboard-shape"===(null==(k=$a.properties)?void 0:k["ls-type"])?"link-to-whiteboard":"link-to-block"}else $a=K(a)?"link-to-whiteboard":"link-to-page";k=jb&&
23<jb.length?jb.slice(0,20)+"...":jb;return(0,tp.jsxs)("button",{className:"inline-flex gap-1 items-center w-full",onPointerDown:Jb=>{Jb.stopPropagation();Jb.shiftKey?ja(a,"B"===fb?"block":"page"):da(a)},children:[(0,tp.jsx)(Qg,{name:$a}),(0,tp.jsx)("span",{className:"pointer-events-none block-link-reference-row",children:"P"===fb?(0,tp.jsx)(Ra,{pageName:a}):(0,tp.jsxs)(tp.Fragment,{children:[(0,tp.jsx)(Ja,{levelLimit:1,blockId:a,endSeparator:d}),d&&k]})})]})},Pj=Kf(ca(19)),sm=ca(19),pC=["children"],
Ds="undefined"!==typeof document?sm.useLayoutEffect:sm.useEffect,Zg=Kf(ca(19)),qh=ca(19),qC=ca(20),$t,Ik,oH="undefined"!=typeof document?qh.useLayoutEffect:qh.useEffect;!function(a){a[a.DEBUG=0]="DEBUG";a[a.INFO=1]="INFO";a[a.WARN=2]="WARN";a[a.ERROR=3]="ERROR"}(Ik||={});var rC=(($t={})[Ik.DEBUG]="debug",$t[Ik.INFO]="log",$t[Ik.WARN]="warn",$t[Ik.ERROR]="error",$t),up=Vh(function(){var a=Rf(Ik.ERROR);return{log:Rf(function(d,k,K){var da;void 0===K&&(K=Ik.INFO);K>=(null!=(da=("undefined"==typeof globalThis?
window:globalThis).VIRTUOSO_LOG_LEVEL)?da:a(4))&&console[rC[K]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",d,k)}),logLevel:a}},[],{singleton:!0}),tm=Vh(function(){var a=Cg(),d=Cg(),k=Rf(0),K=Cg(),da=Rf(0),ja=Cg(),ra=Cg(),Ja=Rf(0),Ra=Rf(0),$a=Rf(0),fb=Rf(0),jb=Cg(),Jb=Cg(),Ob=Rf(!1),Kb=Rf(!1);return Kg(xf(a,qg(function(gc){return gc.scrollTop})),d),Kg(xf(a,qg(function(gc){return gc.scrollHeight})),ra),Kg(d,da),{scrollContainerState:a,scrollTop:d,viewportHeight:ja,
headerHeight:Ja,fixedHeaderHeight:Ra,fixedFooterHeight:$a,footerHeight:fb,scrollHeight:ra,smoothScrollTargetReached:K,react18ConcurrentRendering:Kb,scrollTo:jb,scrollBy:Jb,statefulScrollTop:da,deviation:k,scrollingInProgress:Ob}},[],{singleton:!0}),gi={lvl:0},my=Vh(function(){return{recalcInProgress:Rf(!1)}},[],{singleton:!0}),pH={offsetHeight:"height",offsetWidth:"width"},vp=Vh(function(a){var d=a[0].log,k=a[1].recalcInProgress;a=Cg();var K=Cg(),da=Uj(K,0),ja=Cg(),ra=Cg(),Ja=Rf(0),Ra=Rf([]),$a=Rf(void 0),
fb=Rf(void 0),jb=Rf(function(kc,hc){return ii(kc,pH[hc])}),Jb=Rf(void 0),Ob=Rf(0),Kb={offsetTree:[],sizeTree:gi,groupOffsetTree:gi,lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},gc=Uj(xf(a,vh(Ra,d,Ob),fk(pi,Kb),Sh()),Kb);Kg(xf(Ra,lg(function(kc){return 0<kc.length}),vh(gc,Ob),qg(function(kc){var hc=kc[0],Fc=kc[1],Lc=kc[2];kc=hc.reduce(function(ud,Jd,Ee){return za(ud,Jd,Th(Jd,Fc.offsetTree,Lc)||Ee)},gi);return bh({},Fc,{groupIndices:hc,groupOffsetTree:kc})})),gc);Kg(xf(K,vh(gc),lg(function(kc){return kc[0]<
kc[1].lastIndex}),qg(function(kc){var hc=kc[1];return[{startIndex:kc[0],endIndex:hc.lastIndex,size:hc.lastSize}]})),a);Kg($a,fb);var rc=Uj(xf($a,qg(function(kc){return void 0===kc})),!0);Kg(xf(fb,lg(function(kc){return void 0!==kc&&gc(4).sizeTree===gi}),qg(function(kc){return[{startIndex:0,endIndex:0,size:kc}]})),a);Kb=nk(xf(a,vh(gc),fk(function(kc,hc){hc=hc[1];return{changed:hc!==kc.sizes,sizes:hc}},{changed:!1,sizes:Kb}),qg(function(kc){return kc.changed})));fh(xf(Ja,fk(function(kc,hc){return{diff:kc.prev-
hc,prev:hc}},{diff:0,prev:0}),qg(function(kc){return kc.diff})),function(kc){0<kc?(k(0,!0),ja(0,kc)):0>kc&&ra(0,kc)});fh(xf(Ja,vh(d)),function(kc){0>kc[0]&&(0,kc[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:Ja},Ik.ERROR)});d=nk(ja);Kg(xf(ja,vh(gc),qg(function(kc){var hc=kc[0];kc=kc[1];if(0<kc.groupIndices.length)throw Error("Virtuoso: prepending items does not work with groups");return Ha(kc.sizeTree).reduce(function(Fc,
Lc){var ud=Lc.k;Lc=Lc.v;return{ranges:[].concat(Fc.ranges,[{startIndex:Fc.prevIndex,endIndex:ud+hc-1,size:Fc.prevSize}]),prevIndex:ud+hc,prevSize:Lc}},{ranges:[],prevIndex:0,prevSize:kc.lastSize}).ranges})),a);var Wb=nk(xf(ra,vh(gc,Ob),qg(function(kc){return Th(-kc[0],kc[1].offsetTree,kc[2])})));return Kg(xf(ra,vh(gc,Ob),qg(function(kc){var hc=kc[0],Fc=kc[1];kc=kc[2];if(0<Fc.groupIndices.length)throw Error("Virtuoso: shifting items does not work with groups");var Lc=Ha(Fc.sizeTree).reduce(function(ud,
Jd){return za(ud,Math.max(0,Jd.k+hc),Jd.v)},gi);return bh({},Fc,{sizeTree:Lc},yi(Fc.offsetTree,0,Lc,kc))})),gc),{data:Jb,totalCount:K,sizeRanges:a,groupIndices:Ra,defaultItemSize:fb,fixedItemSize:$a,unshiftWith:ja,shiftWith:ra,shiftWithOffset:Wb,beforeUnshiftWith:d,firstItemIndex:Ja,gap:Ob,sizes:gc,listRefresh:Kb,statefulTotalCount:da,trackItemSizes:rc,itemSize:jb}},Si(up,my),{singleton:!0}),qH="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style,au=Vh(function(a){function d(){rc&&
(rc(),rc=null);kc&&(kc(),kc=null);Wb&&(clearTimeout(Wb),Wb=null);Ja(0,!1)}var k=a[0],K=k.sizes,da=k.totalCount,ja=k.listRefresh;k=k.gap;var ra=a[1],Ja=ra.scrollingInProgress,Ra=ra.viewportHeight,$a=ra.scrollTo,fb=ra.smoothScrollTargetReached,jb=ra.headerHeight,Jb=ra.footerHeight,Ob=ra.fixedHeaderHeight;ra=ra.fixedFooterHeight;a=a[2].log;var Kb=Cg(),gc=Rf(0),rc=null,Wb=null,kc=null;return Kg(xf(Kb,vh(K,Ra,da,gc,jb,Jb,a),vh(k,Ob,ra),qg(function(hc){var Fc=hc[0],Lc=Fc[0],ud=Fc[1],Jd=Fc[2],Ee=Fc[3],Sd=
Fc[4],De=Fc[5],gf=Fc[6],Te=Fc[7],df=hc[1];Fc=hc[2];hc=hc[3];var Gd=Uh(Lc),od=Gd.align,Dd=Gd.behavior,jd=Gd.offset;--Ee;Gd=zi(Gd,ud,Ee);De=Th(Gd,ud.offsetTree,df)+De;"end"===od?(De+=Fc+ba(ud.sizeTree,Gd)[1]-Jd+hc,Gd===Ee&&(De+=gf)):"center"===od?De+=(Fc+ba(ud.sizeTree,Gd)[1]-Jd+hc)/2:De-=Sd;jd&&(De+=jd);var Cd=function(af){d();af?(Te("retrying to scroll to",{location:Lc},Ik.DEBUG),Kb(0,Lc)):Te("list did not change, scroll successful",{},Ik.DEBUG)};if(d(),"smooth"===Dd){var Me=!1;kc=fh(ja,function(af){Me=
Me||af});rc=Fm(fb,function(){Cd(Me)})}else rc=Fm(xf(ja,function(af){var Nf=setTimeout(function(){af(!1)},150);return function(bg){bg&&(af(!0),clearTimeout(Nf))}}),Cd);Wb=setTimeout(function(){d()},1200);Ja(0,!0);return Te("scrolling from index to",{index:Gd,top:De,behavior:Dd},Ik.DEBUG),{top:De,behavior:Dd}})),$a),{scrollToIndex:Kb,topListHeight:gc}},Si(vp,tm,up),{singleton:!0}),rH={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},
bu=Vh(function(a){var d=a[0],k=d.scrollContainerState;a=d.scrollTop;var K=d.viewportHeight,da=d.headerHeight,ja=d.footerHeight,ra=d.scrollBy;d=Rf(!1);var Ja=Rf(!0),Ra=Cg(),$a=Cg(),fb=Rf(4),jb=Rf(0),Jb=Uj(xf(Qp(xf(kh(a),cm(1),en(!0)),xf(kh(a),cm(1),en(!1),Jj(100))),Sh()),!1),Ob=Uj(xf(Qp(xf(ra,en(!0)),xf(ra,en(!1),Jj(200))),Sh()),!1);Kg(xf(sj(kh(a),kh(jb)),qg(function(Kb){return Kb[0]<=Kb[1]}),Sh()),Ja);Kg(xf(Ja,go(50)),$a);K=nk(xf(sj(k,kh(K),kh(da),kh(ja),kh(fb)),fk(function(Kb,gc){var rc,Wb,kc=gc[0],
hc=kc.scrollTop;kc=kc.scrollHeight;var Fc=gc[1],Lc={viewportHeight:Fc,scrollTop:hc,scrollHeight:kc};return hc+Fc-kc>-gc[4]?(hc>Kb.state.scrollTop?(rc="SCROLLED_DOWN",Wb=Kb.state.scrollTop-hc):(rc="SIZE_DECREASED",Wb=Kb.state.scrollTop-hc||Kb.scrollTopDelta),{atBottom:!0,state:Lc,atBottomBecause:rc,scrollTopDelta:Wb}):{atBottom:!1,notAtBottomBecause:Lc.scrollHeight>Kb.state.scrollHeight?"SIZE_INCREASED":Fc<Kb.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":hc<Kb.state.scrollTop?"SCROLLING_UPWARDS":
"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:Lc}},rH),Sh(function(Kb,gc){return Kb&&Kb.atBottom===gc.atBottom})));da=Uj(xf(k,fk(function(Kb,gc){var rc=gc.scrollTop,Wb=gc.scrollHeight;gc=gc.viewportHeight;return 1.01>Math.abs(Kb.scrollHeight-Wb)?{scrollTop:rc,scrollHeight:Wb,jump:0,changed:!1}:Kb.scrollTop!==rc&&1>Wb-(rc+gc)?{scrollHeight:Wb,scrollTop:rc,jump:Kb.scrollTop-rc,changed:!0}:{scrollHeight:Wb,scrollTop:rc,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),lg(function(Kb){return Kb.changed}),
qg(function(Kb){return Kb.jump})),0);Kg(xf(K,qg(function(Kb){return Kb.atBottom})),d);Kg(xf(d,go(50)),Ra);ja=Rf("down");Kg(xf(k,qg(function(Kb){return Kb.scrollTop}),Sh(),fk(function(Kb,gc){return Ob(4)?{direction:Kb.direction,prevScrollTop:gc}:{direction:gc<Kb.prevScrollTop?"up":"down",prevScrollTop:gc}},{direction:"down",prevScrollTop:0}),qg(function(Kb){return Kb.direction})),ja);Kg(xf(k,go(50),en("none")),ja);k=Rf(0);return Kg(xf(Jb,lg(function(Kb){return!Kb}),en(0)),k),Kg(xf(a,go(100),vh(Jb),
lg(function(Kb){return!!Kb[1]}),fk(function(Kb,gc){return[Kb[1],gc[0]]},[0,0]),qg(function(Kb){return Kb[1]-Kb[0]})),k),{isScrolling:Jb,isAtTop:Ja,isAtBottom:d,atBottomState:K,atTopStateChange:$a,atBottomStateChange:Ra,scrollDirection:ja,atBottomThreshold:fb,atTopThreshold:jb,scrollVelocity:k,lastJumpDueToItemResize:da}},Si(tm)),sr=Vh(function(a){var d=a[0].log;a=Rf(!1);var k=nk(xf(a,lg(function(K){return K}),Sh()));return fh(a,function(K){K&&d(4)("props updated",{},Ik.DEBUG)}),{propsReady:a,didMount:k}},
Si(up),{singleton:!0}),Hv=Vh(function(a){var d=a[0],k=d.sizes,K=d.listRefresh;d=d.defaultItemSize;var da=a[1].scrollTop,ja=a[2].scrollToIndex;a=a[3].didMount;var ra=Rf(!0),Ja=Rf(0);return Kg(xf(a,vh(Ja),lg(function(Ra){return!!Ra[1]}),en(!1)),ra),fh(xf(sj(K,a),vh(ra,k,d),lg(function(Ra){var $a=Ra[1],fb=Ra[3];return Ra[0][1]&&(Ra[2].sizeTree!==gi||void 0!==fb)&&!$a}),vh(Ja)),function(Ra){var $a=Ra[1];setTimeout(function(){Fm(da,function(){ra(0,!0)});ja(0,$a)})}),{scrolledToInitialItem:ra,initialTopMostItemIndex:Ja}},
Si(vp,tm,au,sr),{singleton:!0}),sC=Vh(function(a){function d(gc){Ra(0,{index:"LAST",align:"end",behavior:gc})}function k(gc){var rc=Fm(Ja,function(Wb){!gc||Wb.atBottom||"SIZE_INCREASED"!==Wb.notAtBottomBecause||Kb||(jb(4)("scrolling to bottom due to increased size",{},Ik.DEBUG),d("auto"))});setTimeout(rc,100)}var K=a[0],da=K.totalCount,ja=K.listRefresh,ra=a[1];K=ra.isAtBottom;var Ja=ra.atBottomState,Ra=a[2].scrollToIndex;ra=a[3].scrolledToInitialItem;var $a=a[4],fb=$a.propsReady;$a=$a.didMount;var jb=
a[5].log;a=a[6].scrollingInProgress;var Jb=Rf(!1),Ob=Cg(),Kb=null;return fh(xf(sj(xf(kh(da),cm(1)),$a),vh(kh(Jb),K,ra,a),qg(function(gc){var rc=gc[0],Wb=rc[0];rc=rc[1]&&gc[3];var kc="auto";rc&&(kc=gc[1],gc=gc[2]||gc[4],kc="function"==typeof kc?Wh(kc(gc)):gc&&Wh(kc),rc=rc&&!!kc);return{totalCount:Wb,shouldFollow:rc,followOutputBehavior:kc}}),lg(function(gc){return gc.shouldFollow})),function(gc){var rc=gc.totalCount,Wb=gc.followOutputBehavior;Kb&&(Kb(),Kb=null);Kb=Fm(ja,function(){jb(4)("following output to ",
{totalCount:rc},Ik.DEBUG);d(Wb);Kb=null})}),fh(xf(sj(kh(Jb),da,fb),lg(function(gc){return gc[0]&&gc[2]}),fk(function(gc,rc){rc=rc[1];return{refreshed:gc.value===rc,value:rc}},{refreshed:!1,value:0}),lg(function(gc){return gc.refreshed}),vh(Jb,da)),function(gc){k(!1!==gc[1])}),fh(Ob,function(){k(!1!==Jb(4))}),fh(sj(kh(Jb),Ja),function(gc){var rc=gc[1];gc[0]&&!rc.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===rc.notAtBottomBecause&&d("auto")}),{followOutput:Jb,autoscrollToBottom:Ob}},Si(vp,bu,au,Hv,sr,up,
tm)),ny=Vh(function(a){var d=a[0],k=d.totalCount,K=d.groupIndices;d=d.sizes;var da=a[1];a=da.scrollTop;da=da.headerHeight;var ja=Cg(),ra=Cg(),Ja=nk(xf(ja,qg(qi)));return Kg(xf(Ja,qg(function(Ra){return Ra.totalCount})),k),Kg(xf(Ja,qg(function(Ra){return Ra.groupIndices})),K),Kg(xf(sj(a,d,da),lg(function(Ra){return Ra[1].groupOffsetTree!==gi}),qg(function(Ra){return ba(Ra[1].groupOffsetTree,Math.max(Ra[0]-Ra[2],0),"v")[0]}),Sh(),qg(function(Ra){return[Ra]})),ra),{groupCounts:ja,topItemsIndexes:ra}},
Si(vp,tm)),oy=Vh(function(a){var d=a[0];a=d.scrollTop;var k=d.viewportHeight,K=d.deviation,da=d.headerHeight,ja=d.fixedHeaderHeight;d=Cg();var ra=Rf(0),Ja=Rf(0),Ra=Rf(0);a=Uj(xf(sj(kh(a),kh(k),kh(da),kh(d,uj),kh(Ra),kh(ra),kh(ja),kh(K),kh(Ja)),qg(function($a){var fb=$a[0],jb=$a[1],Jb=$a[2],Ob=$a[3],Kb=Ob[0];Ob=Ob[1];var gc=$a[4],rc=$a[6],Wb=$a[7],kc=$a[8],hc=fb-Wb;$a=$a[5]+rc;var Fc=Math.max(Jb-hc,0),Lc="none",ud="number"==typeof kc?kc:kc.top||0;kc="number"==typeof kc?kc:kc.bottom||0;return Kb-=Wb,
Ob+=Jb+rc,Kb+(Jb+rc)>fb+$a-ud&&(Lc="up"),Ob-Wb<fb-Fc+jb+kc&&(Lc="down"),"none"!==Lc?[Math.max(hc-Jb-ul(gc,"top",Lc)-ud,0),hc-Fc-rc+jb+ul(gc,"bottom",Lc)+kc]:null}),lg(function($a){return null!=$a}),Sh(uj)),[0,0]);return{listBoundary:d,overscan:Ra,topListHeight:ra,increaseViewportBy:Ja,visibleRange:a}},Si(tm),{singleton:!0}),tC={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0},Es=Vh(function(a){var d=a[0],k=d.sizes,K=d.totalCount,da=d.data,
ja=d.firstItemIndex,ra=d.gap,Ja=a[1],Ra=a[2],$a=Ra.visibleRange;d=Ra.listBoundary;Ra=Ra.topListHeight;var fb=a[3],jb=fb.scrolledToInitialItem,Jb=fb.initialTopMostItemIndex;fb=a[4].topListHeight;var Ob=a[5],Kb=a[6].didMount,gc=a[7].recalcInProgress;a=Rf([]);var rc=Cg();Kg(Ja.topItemsIndexes,a);k=Uj(xf(sj(Kb,gc,kh($a,uj),kh(K),kh(k),kh(Jb),jb,kh(a),kh(ja),kh(ra),da),lg(function(Wb){return Wb[0]&&!Wb[1]}),qg(function(Wb){var kc=Wb[2],hc=kc[0],Fc=kc[1];kc=Wb[3];var Lc=Wb[5],ud=Wb[6],Jd=Wb[7],Ee=Wb[8],
Sd=Wb[9],De=Wb[10];Wb=Wb[4];var gf=Wb.sizeTree,Te=Wb.offsetTree;if(0===kc||0===hc&&0===Fc)return bh({},tC,{totalCount:kc});if(gf===gi)return Jm(function(bg,ef,Eg){return ef.groupOffsetTree!==gi?(bg=zh(bg,ef),[{index:ba(ef.groupOffsetTree,bg)[0],size:0,offset:0},{index:bg,size:0,offset:0,data:Eg&&Eg[0]}]):[{index:bg,size:0,offset:0,data:Eg&&Eg[0]}]}("number"==typeof Lc?Lc:"LAST"===Lc.index?kc-1:Lc.index,Wb,De),[],kc,Sd,Wb,Ee);Lc=[];if(0<Jd.length){var df,Gd=Jd[0],od=Jd[Jd.length-1],Dd=0;for(gf=em(Pc(gf,
Gd,od));!(df=gf()).done;){var jd=df.value;df=jd.value;var Cd=Math.min(jd.end,od);for(jd=Math.max(jd.start,Gd);jd<=Cd;jd++)Lc.push({index:jd,size:df,offset:Dd,data:De&&De[jd]}),Dd+=df}}if(!ud)return Jm([],Lc,kc,Sd,Wb,Ee);var Me=0<Jd.length?Jd[Jd.length-1]+1:0,af=function(bg,ef,Eg,yf){return void 0===yf&&(yf=0),0<yf&&(ef=Math.max(ef,bg[Ce(bg,yf,Pg)].offset)),wd((Gg=Eg,Bj=Ce(Fg=bg,ef,Bi=Vj),Fi=Ce(Fg,Gg,Bi,Bj),Fg.slice(Bj,Fi+1)),Ag);var Fg,Gg,Bi,Bj,Fi}(Te,hc,Fc,Me);if(0===af.length)return null;var Nf=
kc-1;return Jm(Wi([],function(bg){for(var ef,Eg=em(af);!(ef=Eg()).done;){var yf=ef.value,Fg=yf.value;ef=Fg.offset;var Gg=yf.start,Bi=Fg.size;Fg.offset<hc&&(Fg=(Gg+=Math.floor((hc-Fg.offset+Sd)/(Bi+Sd)))-yf.start,ef+=Fg*Bi+Fg*Sd);Gg<Me&&(ef+=(Me-Gg)*Bi,Gg=Me);for(yf=Math.min(yf.end,Nf);Gg<=yf&&!(ef>=Fc);Gg++)bg.push({index:Gg,size:Bi,offset:ef,data:De&&De[Gg]}),ef+=Bi+Sd}}),Lc,kc,Sd,Wb,Ee)}),lg(function(Wb){return null!==Wb}),Sh()),tC);return Kg(xf(da,lg(function(Wb){return void 0!==Wb}),qg(function(Wb){return Wb.length})),
K),Kg(xf(k,qg(function(Wb){return Wb.topListHeight})),fb),Kg(fb,Ra),Kg(xf(k,qg(function(Wb){return[Wb.top,Wb.bottom]})),d),Kg(xf(k,qg(function(Wb){return Wb.items})),rc),bh({listState:k,topItemsIndexes:a,endReached:nk(xf(k,lg(function(Wb){return 0<Wb.items.length}),vh(K,da),lg(function(Wb){var kc=Wb[0].items;return kc[kc.length-1].originalIndex===Wb[1]-1}),qg(function(Wb){return[Wb[1]-1,Wb[2]]}),Sh(uj),qg(function(Wb){return Wb[0]}))),startReached:nk(xf(k,go(200),lg(function(Wb){var kc=Wb.items;return 0<
kc.length&&kc[0].originalIndex===Wb.topItems.length}),qg(function(Wb){return Wb.items[0].index}),Sh())),rangeChanged:nk(xf(k,lg(function(Wb){return 0<Wb.items.length}),qg(function(Wb){Wb=Wb.items;for(var kc=0,hc=Wb.length-1;"group"===Wb[kc].type&&kc<hc;)kc++;for(;"group"===Wb[hc].type&&hc>kc;)hc--;return{startIndex:Wb[kc].index,endIndex:Wb[hc].index}}),Sh(Dk))),itemsRendered:rc},Ob)},Si(vp,ny,oy,Hv,au,bu,sr,my),{singleton:!0}),sH=Vh(function(a){var d=a[0],k=d.sizes,K=d.firstItemIndex,da=d.data;d=
d.gap;var ja=a[1].listState;a=a[2].didMount;var ra=Rf(0);return Kg(xf(a,vh(ra),lg(function(Ja){return 0!==Ja[1]}),vh(k,K,d,da),qg(function(Ja){var Ra=Ja[0][1],$a=Ja[1],fb=Ja[2],jb=Ja[3];Ja=Ja[4];var Jb=void 0===Ja?[]:Ja;Ja=0;if(0<$a.groupIndices.length)for(var Ob,Kb=em($a.groupIndices);!((Ob=Kb()).done||Ob.value-Ja>=Ra);)Ja++;Ra+=Ja;return Jm(Array.from({length:Ra}).map(function(gc,rc){return{index:rc,size:0,offset:0,data:Jb[rc]}}),[],Ra,jb,$a,fb)})),ja),{initialItemCount:ra}},Si(vp,Es,sr),{singleton:!0}),
Wo=Vh(function(a){a=a[0].scrollVelocity;var d=Rf(!1),k=Cg(),K=Rf(!1);return Kg(xf(a,vh(K,d,k),lg(function(da){return!!da[1]}),qg(function(da){var ja=da[0],ra=da[1],Ja=da[2];da=da[3];var Ra=ra.enter;if(Ja){if((0,ra.exit)(ja,da))return!1}else if(Ra(ja,da))return!0;return Ja}),Sh()),d),fh(xf(sj(d,a,k),vh(K)),function(da){var ja=da[0];da=da[1];return ja[0]&&da&&da.change&&da.change(ja[1],ja[2])}),{isSeeking:d,scrollSeekConfiguration:K,scrollVelocity:a,scrollSeekRangeChanged:k}},Si(bu),{singleton:!0}),
py=Vh(function(a){a=a[0].topItemsIndexes;var d=Rf(0);return Kg(xf(d,lg(function(k){return 0<k}),qg(function(k){return Array.from({length:k}).map(function(K,da){return da})})),a),{topItemCount:d}},Si(Es)),Fs=Vh(function(a){var d=a[0],k=d.footerHeight,K=d.headerHeight,da=d.fixedHeaderHeight;d=d.fixedFooterHeight;var ja=a[1].listState;a=Cg();k=Uj(xf(sj(k,d,K,da,ja),qg(function(ra){var Ja=ra[4];return ra[0]+ra[1]+ra[2]+ra[3]+Ja.offsetBottom+Ja.bottom})),0);return Kg(kh(k),a),{totalListHeight:k,totalListHeightChanged:a}},
Si(tm,Es),{singleton:!0}),Iv=Km(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),qy=Vh(function(a){function d(rc){0<rc?(K(0,{top:-rc,behavior:"auto"}),ja(0,0)):(ja(0,0),K(0,{top:-rc,behavior:"auto"}))}var k=a[0],K=k.scrollBy,da=k.scrollTop,ja=k.deviation,ra=k.scrollingInProgress,Ja=a[1];k=Ja.isScrolling;var Ra=Ja.isAtBottom,$a=Ja.scrollDirection,fb=a[3],jb=fb.beforeUnshiftWith,Jb=fb.shiftWithOffset,Ob=fb.sizes;fb=fb.gap;var Kb=a[4].log,gc=a[5].recalcInProgress;
a=nk(xf(a[2].listState,vh(Ja.lastJumpDueToItemResize),fk(function(rc,Wb){var kc=rc[1],hc=Wb[0],Fc=hc.items,Lc=hc.totalCount;hc=hc.bottom+hc.offsetBottom;var ud=0;return rc[2]===Lc&&0<kc.length&&0<Fc.length&&(0===Fc[0].originalIndex&&0===kc[0].originalIndex||0!=(ud=hc-rc[3])&&(ud+=Wb[1])),[ud,Fc,Lc,hc]},[0,[],0,0]),lg(function(rc){return 0!==rc[0]}),vh(da,$a,ra,Ra,Kb),lg(function(rc){return!rc[3]&&0!==rc[1]&&"up"===rc[2]}),qg(function(rc){var Wb=rc[0][0];return(0,rc[5])("Upward scrolling compensation",
{amount:Wb},Ik.DEBUG),Wb})));return fh(xf(a,vh(ja,k)),function(rc){var Wb=rc[0],kc=rc[1];rc[2]&&Iv()?ja(0,kc-Wb):d(-Wb)}),fh(xf(sj(Uj(k,!1),ja,gc),lg(function(rc){return!rc[0]&&!rc[2]&&0!==rc[1]}),qg(function(rc){return rc[1]}),go(1)),d),Kg(xf(Jb,qg(function(rc){return{top:-rc}})),K),fh(xf(jb,vh(Ob,fb),qg(function(rc){var Wb=rc[0];return Wb*rc[1].lastSize+Wb*rc[2]})),function(rc){ja(0,rc);requestAnimationFrame(function(){Ur(K,{top:rc});requestAnimationFrame(function(){ja(0,0);gc(0,!1)})})}),{deviation:ja}},
Si(tm,bu,Es,vp,up,my)),uC=Vh(function(a){var d=a[0].totalListHeight,k=a[1].didMount,K=a[2].scrollTo;a=Rf(0);return fh(xf(k,vh(a),lg(function(da){return 0!==da[1]}),qg(function(da){return{top:da[1]}})),function(da){Fm(xf(d,lg(function(ja){return 0!==ja})),function(){setTimeout(function(){K(0,da)})})}),{initialScrollTop:a}},Si(Fs,sr,tm),{singleton:!0}),ry=Vh(function(a){var d=a[0].viewportHeight;a=a[1].totalListHeight;var k=Rf(!1);return{alignToBottom:k,paddingTopAddition:Uj(xf(sj(k,d,a),lg(function(K){return K[0]}),
qg(function(K){return Math.max(0,K[1]-K[2])}),Sh()),0)}},Si(tm,Fs),{singleton:!0}),Jv=Vh(function(a){var d=a[0];a=d.scrollTo;d=d.scrollContainerState;var k=Cg(),K=Cg(),da=Cg(),ja=Rf(!1),ra=Rf(void 0);return Kg(xf(sj(k,K),qg(function(Ja){var Ra=Ja[0];return{scrollTop:Math.max(0,Ra.scrollTop-Ja[1].offsetTop),scrollHeight:Ra.scrollHeight,viewportHeight:Ra.viewportHeight}})),d),Kg(xf(a,vh(K),qg(function(Ja){var Ra=Ja[0];return bh({},Ra,{top:Ra.top+Ja[1].offsetTop})})),da),{useWindowScroll:ja,customScrollParent:ra,
windowScrollContainerState:k,windowViewportRect:K,windowScrollTo:da}},Si(tm)),tr=["done","behavior","align"],pq=Vh(function(a){var d=a[0],k=d.sizes,K=d.totalCount;d=d.gap;var da=a[1],ja=da.scrollTop,ra=da.viewportHeight,Ja=da.headerHeight,Ra=da.fixedHeaderHeight,$a=da.fixedFooterHeight,fb=da.scrollingInProgress;a=a[2].scrollToIndex;da=Cg();return Kg(xf(da,vh(k,ra,K,Ja,Ra,$a,ja),vh(d),qg(function(jb){var Jb=jb[0],Ob=Jb[0],Kb=Jb[1],gc=Jb[2],rc=Jb[3],Wb=Jb[4],kc=Jb[5],hc=Jb[6];Jb=Jb[7];var Fc=jb[1];
jb=Ob.done;var Lc=Ob.behavior,ud=Ob.align,Jd=dm(Ob,tr),Ee=null;Ob=zi(Ob,Kb,rc-1);Wb=Th(Ob,Kb.offsetTree,Fc)+Wb+kc;return Wb<Jb+kc?Ee=bh({},Jd,{behavior:Lc,align:null!=ud?ud:"start"}):Wb+ba(Kb.sizeTree,Ob)[1]>Jb+gc-hc&&(Ee=bh({},Jd,{behavior:Lc,align:null!=ud?ud:"end"})),Ee?jb&&Fm(xf(fb,cm(1),lg(function(Sd){return!1===Sd})),jb):jb&&jb(),Ee}),lg(function(jb){return null!==jb})),a),{scrollIntoView:da}},Si(vp,tm,au,Es,up),{singleton:!0}),sy=["listState","topItemsIndexes"],vC=Vh(function(a){return bh({},
a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},Si(oy,sH,sr,Wo,Fs,uC,ry,Jv,pq)),Gs=Vh(function(a){var d=a[0],k=d.totalCount,K=d.sizeRanges,da=d.fixedItemSize,ja=d.defaultItemSize,ra=d.trackItemSizes,Ja=d.itemSize,Ra=d.data,$a=d.firstItemIndex,fb=d.groupIndices,jb=d.statefulTotalCount;d=d.gap;var Jb=a[1],Ob=Jb.initialTopMostItemIndex;Jb=Jb.scrolledToInitialItem;var Kb=a[2],gc=a[3],rc=a[4],Wb=rc.listState,kc=rc.topItemsIndexes;rc=dm(rc,sy);var hc=a[5].scrollToIndex,Fc=a[7].topItemCount,Lc=a[8].groupCounts,
ud=a[9];a=a[10];return Kg(rc.rangeChanged,ud.scrollSeekRangeChanged),Kg(xf(ud.windowViewportRect,qg(function(Jd){return Jd.visibleHeight})),Kb.viewportHeight),bh({totalCount:k,data:Ra,firstItemIndex:$a,sizeRanges:K,initialTopMostItemIndex:Ob,scrolledToInitialItem:Jb,topItemsIndexes:kc,topItemCount:Fc,groupCounts:Lc,fixedItemHeight:da,defaultItemHeight:ja,gap:d},gc,{statefulTotalCount:jb,listState:Wb,scrollToIndex:hc,trackItemSizes:ra,itemSize:Ja,groupIndices:fb},rc,ud,Kb,a)},Si(vp,Hv,tm,sC,Es,au,
qy,py,ny,vC,up)),wC=Km(function(){if("undefined"==typeof document)return"sticky";var a=document.createElement("div");return a.style.position="-webkit-sticky","-webkit-sticky"===a.style.position?"-webkit-sticky":"sticky"}),cu=Zg.createContext(void 0),po=Zg.createContext(void 0),xC=["placeholder"],ty=["style","children"],yC=["style","children"],zC=Vh(function(){var a=Rf(function(Ra){return"Item "+Ra}),d=Rf(null),k=Rf(function(Ra){return"Group "+Ra}),K=Rf({}),da=Rf(ct),ja=Rf("div"),ra=Rf(fi),Ja=function(Ra,
$a){return void 0===$a&&($a=null),Uj(xf(K,qg(function(fb){return fb[Ra]}),Sh()),$a)};return{context:d,itemContent:a,groupContent:k,components:K,computeItemKey:da,headerFooterTag:ja,scrollerRef:ra,FooterComponent:Ja("Footer"),HeaderComponent:Ja("Header"),TopItemListComponent:Ja("TopItemList"),ListComponent:Ja("List","div"),ItemComponent:Ja("Item","div"),GroupComponent:Ja("Group","div"),ScrollerComponent:Ja("Scroller","div"),EmptyPlaceholder:Ja("EmptyPlaceholder"),ScrollSeekPlaceholder:Ja("ScrollSeekPlaceholder")}}),
Kv=Vh(function(a){function d(da,ja,ra){Kg(xf(da,vh(K.components),qg(function(Ja){var Ra,$a=Ja[0];Ja=Ja[1];return console.warn("react-virtuoso: "+ra+" property is deprecated. Pass components."+ja+" instead."),bh({},Ja,((Ra={})[ja]=$a,Ra))})),K.components)}var k=a[0],K=a[1];a={item:om(K.itemContent,"Rename the %citem%c prop to %citemContent."),group:om(K.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:om(k.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:om(k.fixedItemHeight,
"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:om(k.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:Cg(),maxHeightCacheSize:Cg(),footer:Cg(),header:Cg(),HeaderContainer:Cg(),FooterContainer:Cg(),ItemContainer:Cg(),ScrollContainer:Cg(),GroupContainer:Cg(),ListContainer:Cg(),emptyComponent:Cg(),scrollSeek:Cg()};return fh(a.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.",
"color: red;","color: inherit;","color: blue;")}),fh(a.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),fh(a.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),fh(a.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),
fh(a.scrollSeek,function(da){var ja=da.placeholder;da=dm(da,xC);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ja=bh({},(0,K.components)(4),{ScrollSeekPlaceholder:ja});(0,K.components)(0,ja);(0,k.scrollSeekConfiguration)(0,da)}),d(a.footer,"Footer","footer"),d(a.header,"Header","header"),d(a.ItemContainer,"Item","ItemContainer"),d(a.ListContainer,"List","ListContainer"),d(a.ScrollContainer,
"Scroller","ScrollContainer"),d(a.emptyComponent,"EmptyPlaceholder","emptyComponent"),d(a.GroupContainer,"Group","GroupContainer"),bh({},k,K,a)},Si(Gs,zC)),AC=function(a){return Zg.createElement("div",{style:{height:a.height}})},um={position:wC(),zIndex:1,overflowAnchor:"none"},tH={overflowAnchor:"none"},Hs=Zg.memo(function(a){a=a.showTopList;a=void 0!==a&&a;var d=Jh("listState"),k=Qm("sizeRanges"),K=Jh("useWindowScroll"),da=Jh("customScrollParent"),ja=Qm("windowScrollContainerState"),ra=Qm("scrollContainerState");
K=da||K?ja:ra;var Ja=Jh("itemContent"),Ra=Jh("context"),$a=Jh("groupContent");ja=Jh("trackItemSizes");ra=Jh("itemSize");var fb=Jh("log"),jb=Qm("gap");k=oi(k,ra,ja,a?fi:K,fb,jb,da).callbackRef;da=Zg.useState(0);var Jb=da[0],Ob=da[1];si("deviation",function(Fc){Jb!==Fc&&Ob(Fc)});da=Jh("EmptyPlaceholder");var Kb=Jh("ScrollSeekPlaceholder")||AC;K=Jh("ListComponent");var gc=Jh("ItemComponent"),rc=Jh("GroupComponent"),Wb=Jh("computeItemKey"),kc=Jh("isSeeking"),hc=0<Jh("groupIndices").length;ja=Jh("paddingTopAddition");
ja=a?{}:{boxSizing:"border-box",paddingTop:d.offsetTop+ja,paddingBottom:d.offsetBottom,marginTop:Jb};return!a&&0===d.totalCount&&da?(0,qh.createElement)(da,gk(da,Ra)):(0,qh.createElement)(K,bh({},gk(K,Ra),{ref:k,style:ja,"data-test-id":a?"virtuoso-top-item-list":"virtuoso-item-list"}),(a?d.topItems:d.items).map(function(Fc){var Lc=Fc.originalIndex,ud=Wb(Lc+d.firstItemIndex,Fc.data,Ra);return kc?(0,qh.createElement)(Kb,bh({},gk(Kb,Ra),{key:ud,index:Fc.index,height:Fc.size,type:Fc.type||"item"},"group"===
Fc.type?{}:{groupIndex:Fc.groupIndex})):"group"===Fc.type?(0,qh.createElement)(rc,bh({},gk(rc,Ra),{key:ud,"data-index":Lc,"data-known-size":Fc.size,"data-item-index":Fc.index,style:um}),$a(Fc.index)):(0,qh.createElement)(gc,bh({},gk(gc,Ra),{key:ud,"data-index":Lc,"data-known-size":Fc.size,"data-item-index":Fc.index,"data-item-group-index":Fc.groupIndex,style:tH}),hc?Ja(Fc.index,Fc.groupIndex,Fc.data,Ra):Ja(Fc.index,Fc.data,Ra))}))}),uH={height:"100%",outline:"none",overflowY:"auto",position:"relative",
WebkitOverflowScrolling:"touch"},Is={width:"100%",height:"100%",position:"absolute",top:0},BC={width:"100%",position:wC(),top:0},Lv=Zg.memo(function(){var a=Jh("HeaderComponent"),d=Qm("headerHeight"),k=Jh("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=Jh("context");return a?(0,qh.createElement)(k,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),Mv=Zg.memo(function(){var a=Jh("FooterComponent"),d=Qm("footerHeight"),k=Jh("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),
da=Jh("context");return a?(0,qh.createElement)(k,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),vH=function(a){a=a.children;var d=(0,qh.useContext)(cu),k=Qm("viewportHeight"),K=Qm("fixedItemHeight"),da=hj(bo(k,function(ja){return ii(ja,"height")}));return Zg.useEffect(function(){d&&(k(d.viewportHeight),K(d.itemHeight))},[d,k,K]),Zg.createElement("div",{style:Is,ref:da,"data-viewport-type":"element"},a)},CC=function(a){a=a.children;var d=(0,qh.useContext)(cu),k=Qm("windowViewportRect"),K=Qm("fixedItemHeight"),
da=Jh("customScrollParent");da=ph(k,da);return Zg.useEffect(function(){d&&(K(d.itemHeight),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,k,K]),Zg.createElement("div",{ref:da,style:Is,"data-viewport-type":"window"},a)},DC=function(a){a=a.children;var d=Jh("TopItemListComponent"),k=Jh("headerHeight");k=bh({},BC,{marginTop:k+"px"});var K=Jh("context");return(0,qh.createElement)(d||"div",{style:k,context:K},a)},du=tj(Kv,{required:{},optional:{context:"context",followOutput:"followOutput",
firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",
headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",
ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",
startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Zg.memo(function(a){var d=Jh("useWindowScroll"),k=0<Jh("topItemsIndexes").length,K=Jh("customScrollParent"),da=K||d?CC:vH;return Zg.createElement(K||d?eu:qq,bh({},a),Zg.createElement(da,null,Zg.createElement(Lv,null),Zg.createElement(Hs,null),Zg.createElement(Mv,
null)),k&&Zg.createElement(DC,null,Zg.createElement(Hs,{showTopList:!0})))})),uy=du.Component,Qm=du.usePublisher,Jh=du.useEmitterValue,si=du.useEmitter,qq=Xr({usePublisher:Qm,useEmitterValue:Jh,useEmitter:si}),eu=Zq({usePublisher:Qm,useEmitterValue:Jh,useEmitter:si}),fu={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Rm={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},vy=Math.round,Nv=Math.ceil,gu=Math.floor,wy=Math.min,ki=Math.max,
Js=Vh(function(a){var d=a[0],k=d.overscan,K=d.visibleRange,da=d.listBoundary,ja=a[1];d=ja.scrollTop;var ra=ja.viewportHeight,Ja=ja.scrollBy,Ra=ja.scrollTo,$a=ja.smoothScrollTargetReached,fb=ja.scrollContainerState,jb=ja.footerHeight;ja=ja.headerHeight;var Jb=a[2],Ob=a[3],Kb=a[4],gc=Kb.propsReady,rc=Kb.didMount,Wb=a[5];Kb=Wb.windowViewportRect;var kc=Wb.windowScrollTo,hc=Wb.useWindowScroll,Fc=Wb.customScrollParent;Wb=Wb.windowScrollContainerState;a=a[6];var Lc=Rf(0),ud=Rf(0),Jd=Rf(fu),Ee=Rf({height:0,
width:0}),Sd=Rf({height:0,width:0}),De=Cg(),gf=Cg(),Te=Rf(0),df=Rf(void 0),Gd=Rf({row:0,column:0});Kg(xf(sj(rc,ud,df),lg(function(od){return 0!==od[1]}),qg(function(od){return{items:Yr(0,od[1]-1,od[2]),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),Jd);Kg(xf(sj(kh(Lc),K,kh(Gd,Tp),kh(Sd,function(od,Dd){return od&&od.width===Dd.width&&od.height===Dd.height}),df),vh(Ee),qg(function(od){var Dd=od[0],jd=Dd[0],Cd=Dd[1],Me=Cd[0],af=Cd[1],Nf=Dd[2],bg=Dd[3],ef=Dd[4],Eg=od[1];od=Nf.row;
var yf=Nf.column;Dd=bg.height;Cd=bg.width;var Fg=Eg.width;if(0===jd||0===Fg)return fu;if(0===Cd)return bh({},Rm,{items:Yr(0,0,ef)});yf=ki(1,gu((Fg+yf)/(Cd+yf)));Me=yf*gu((Me+od)/(Dd+od));af=yf*Nv((af+od)/(Dd+od))-1;af=wy(jd-1,ki(af,yf-1));Me=Yr(wy(af,ki(0,Me)),af,ef);bg=Fu(Eg,Nf,bg,Me);Nf=bg.top;bg=bg.bottom;jd=Nv(jd/yf);return{items:Me,offsetTop:Nf,offsetBottom:jd*Dd+(jd-1)*od-bg,top:Nf,bottom:bg,itemHeight:Dd,itemWidth:Cd}})),Jd);Kg(xf(df,lg(function(od){return void 0!==od}),qg(function(od){return od.length})),
Lc);Kg(xf(Ee,qg(function(od){return od.height})),ra);Kg(xf(sj(Ee,Sd,Jd,Gd),qg(function(od){od=Fu(od[0],od[3],od[1],od[2].items);return[od.top,od.bottom]}),Sh(uj)),da);K=nk(xf(kh(Jd),lg(function(od){return 0<od.items.length}),vh(Lc),lg(function(od){var Dd=od[0].items;return Dd[Dd.length-1].index===od[1]-1}),qg(function(od){return od[1]-1}),Sh()));da=nk(xf(kh(Jd),lg(function(od){od=od.items;return 0<od.length&&0===od[0].index}),en(0),Sh()));ra=nk(xf(kh(Jd),lg(function(od){return 0<od.items.length}),
qg(function(od){od=od.items;return{startIndex:od[0].index,endIndex:od[od.length-1].index}}),Sh(Dk)));Kg(ra,Ob.scrollSeekRangeChanged);Kg(xf(De,vh(Ee,Sd,Lc,Gd),qg(function(od){var Dd=od[1],jd=od[2],Cd=od[3],Me=od[4],af=Uh(od[0]);od=af.align;var Nf=af.behavior,bg=af.offset;af=af.index;"LAST"===af&&(af=Cd-1);Cd=dt(Dd,Me,jd,ki(0,af,wy(Cd-1,af)));return"end"===od?Cd=vy(Cd-Dd.height+jd.height):"center"===od&&(Cd=vy(Cd-Dd.height/2+jd.height/2)),bg&&(Cd+=bg),{top:Cd,behavior:Nf}})),Ra);rc=Uj(xf(Jd,qg(function(od){return od.offsetBottom+
od.bottom})),0);return Kg(xf(Kb,qg(function(od){return{width:od.visibleWidth,height:od.visibleHeight}})),Ee),bh({data:df,totalCount:Lc,viewportDimensions:Ee,itemDimensions:Sd,scrollTop:d,scrollHeight:gf,overscan:k,scrollBy:Ja,scrollTo:Ra,scrollToIndex:De,smoothScrollTargetReached:$a,windowViewportRect:Kb,windowScrollTo:kc,useWindowScroll:hc,customScrollParent:Fc,windowScrollContainerState:Wb,deviation:Te,scrollContainerState:fb,footerHeight:jb,headerHeight:ja,initialItemCount:ud,gap:Gd},Ob,{gridState:Jd,
totalListHeight:rc},Jb,{startReached:da,endReached:K,rangeChanged:ra,propsReady:gc},a)},Si(oy,tm,bu,Wo,sr,Jv,up)),hu=["placeholder"],wH=Vh(function(){var a=Rf(function($a){return"Item "+$a}),d=Rf({}),k=Rf(null),K=Rf("virtuoso-grid-item"),da=Rf("virtuoso-grid-list"),ja=Rf(ct),ra=Rf("div"),Ja=Rf(fi),Ra=function($a,fb){return void 0===fb&&(fb=null),Uj(xf(d,qg(function(jb){return jb[$a]}),Sh()),fb)};return{context:k,itemContent:a,components:d,computeItemKey:ja,itemClassName:K,listClassName:da,headerFooterTag:ra,
scrollerRef:Ja,FooterComponent:Ra("Footer"),HeaderComponent:Ra("Header"),ListComponent:Ra("List","div"),ItemComponent:Ra("Item","div"),ScrollerComponent:Ra("Scroller","div"),ScrollSeekPlaceholder:Ra("ScrollSeekPlaceholder","div")}}),wj=Vh(function(a){function d(da,ja,ra){Kg(xf(da,vh(K.components),qg(function(Ja){var Ra,$a=Ja[0];Ja=Ja[1];return console.warn("react-virtuoso: "+ra+" property is deprecated. Pass components."+ja+" instead."),bh({},Ja,((Ra={})[ja]=$a,Ra))})),K.components)}var k=a[0],K=
a[1];a={item:om(K.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:Cg(),ScrollContainer:Cg(),ListContainer:Cg(),emptyComponent:Cg(),scrollSeek:Cg()};return fh(a.scrollSeek,function(da){var ja=da.placeholder;da=dm(da,hu);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ja=bh({},(0,K.components)(4),{ScrollSeekPlaceholder:ja});(0,K.components)(0,ja);(0,k.scrollSeekConfiguration)(0,
da)}),d(a.ItemContainer,"Item","ItemContainer"),d(a.ListContainer,"List","ListContainer"),d(a.ScrollContainer,"Scroller","ScrollContainer"),bh({},k,K,a)},Si(Js,wH)),ur=Zg.memo(function(){var a=xj("gridState"),d=xj("listClassName"),k=xj("itemClassName"),K=xj("itemContent"),da=xj("computeItemKey"),ja=xj("isSeeking"),ra=Pl("scrollHeight"),Ja=xj("ItemComponent"),Ra=xj("ListComponent"),$a=xj("ScrollSeekPlaceholder"),fb=xj("context"),jb=Pl("itemDimensions"),Jb=Pl("gap"),Ob=xj("log"),Kb=hj(function(gc){ra(gc.parentElement.parentElement.scrollHeight);
var rc=gc.firstChild;rc&&jb(rc.getBoundingClientRect());Jb({row:Gu("row-gap",getComputedStyle(gc).rowGap,Ob),column:Gu("column-gap",getComputedStyle(gc).columnGap,Ob)})});return(0,qh.createElement)(Ra,bh({ref:Kb,className:d},gk(Ra,fb),{style:{paddingTop:a.offsetTop,paddingBottom:a.offsetBottom}}),a.items.map(function(gc){var rc=da(gc.index,gc.data,fb);return ja?(0,qh.createElement)($a,bh({key:rc},gk($a,fb),{index:gc.index,height:a.itemHeight,width:a.itemWidth})):(0,qh.createElement)(Ja,bh({},gk(Ja,
fb),{className:k,"data-index":gc.index,key:rc}),K(gc.index,gc.data,fb))}))}),EC=Zg.memo(function(){var a=xj("HeaderComponent"),d=Pl("headerHeight"),k=xj("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=xj("context");return a?(0,qh.createElement)(k,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),FC=Zg.memo(function(){var a=xj("FooterComponent"),d=Pl("footerHeight"),k=xj("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=xj("context");return a?(0,qh.createElement)(k,
{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),Sg=function(a){a=a.children;var d=(0,qh.useContext)(po),k=Pl("itemDimensions"),K=Pl("viewportDimensions"),da=hj(function(ja){K(ja.getBoundingClientRect())});return Zg.useEffect(function(){d&&(K({height:d.viewportHeight,width:d.viewportWidth}),k({height:d.itemHeight,width:d.itemWidth}))},[d,K,k]),Zg.createElement("div",{style:Is,ref:da},a)},Ov=function(a){a=a.children;var d=(0,qh.useContext)(po),k=Pl("windowViewportRect"),K=Pl("itemDimensions"),da=xj("customScrollParent");
da=ph(k,da);return Zg.useEffect(function(){d&&(K({height:d.itemHeight,width:d.itemWidth}),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:d.viewportWidth}))},[d,k,K]),Zg.createElement("div",{ref:da,style:Is},a)},Sm=tj(wj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",
listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",
atTopStateChange:"atTopStateChange"}},Zg.memo(function(a){a=bh({},a);var d=xj("useWindowScroll"),k=xj("customScrollParent"),K=k||d?Ov:Sg;return Zg.createElement(k||d?Ks:GC,bh({},a),Zg.createElement(K,null,Zg.createElement(EC,null),Zg.createElement(ur,null),Zg.createElement(FC,null)))})),Pl=Sm.usePublisher,xj=Sm.useEmitterValue,Pv=Sm.useEmitter,GC=Xr({usePublisher:Pl,useEmitterValue:xj,useEmitter:Pv}),Ks=Zq({usePublisher:Pl,useEmitterValue:xj,useEmitter:Pv}),Qv=Vh(function(){var a=Rf(function(Ra){return Zg.createElement("td",
null,"Item $",Ra)}),d=Rf(null),k=Rf(null),K=Rf(null),da=Rf({}),ja=Rf(ct),ra=Rf(fi),Ja=function(Ra,$a){return void 0===$a&&($a=null),Uj(xf(da,qg(function(fb){return fb[Ra]}),Sh()),$a)};return{context:d,itemContent:a,fixedHeaderContent:k,fixedFooterContent:K,components:da,computeItemKey:ja,scrollerRef:ra,TableComponent:Ja("Table","table"),TableHeadComponent:Ja("TableHead","thead"),TableFooterComponent:Ja("TableFoot","tfoot"),TableBodyComponent:Ja("TableBody","tbody"),TableRowComponent:Ja("TableRow",
"tr"),ScrollerComponent:Ja("Scroller","div"),EmptyPlaceholder:Ja("EmptyPlaceholder"),ScrollSeekPlaceholder:Ja("ScrollSeekPlaceholder"),FillerRow:Ja("FillerRow")}}),Ls=Vh(function(a){return bh({},a[0],a[1])},Si(Gs,Qv)),HC=function(a){return Zg.createElement("tr",null,Zg.createElement("td",{style:{height:a.height}}))},IC=function(a){return Zg.createElement("tr",null,Zg.createElement("td",{style:{height:a.height,padding:0,border:0}}))},vm=Zg.memo(function(){var a=Yi("listState"),d=Rn("sizeRanges"),k=
Yi("useWindowScroll"),K=Yi("customScrollParent"),da=Rn("windowScrollContainerState"),ja=Rn("scrollContainerState");k=K||k?da:ja;var ra=Yi("itemContent");da=Yi("trackItemSizes");K=oi(d,Yi("itemSize"),da,k,Yi("log"),void 0,K);d=K.callbackRef;var Ja=K.ref;K=Zg.useState(0);var Ra=K[0],$a=K[1];Sv("deviation",function(Wb){Ra!==Wb&&(Ja.current.style.marginTop=Wb+"px",$a(Wb))});da=Yi("EmptyPlaceholder");var fb=Yi("ScrollSeekPlaceholder")||HC;k=Yi("FillerRow")||IC;K=Yi("TableBodyComponent");var jb=Yi("TableRowComponent"),
Jb=Yi("computeItemKey"),Ob=Yi("isSeeking");ja=Yi("paddingTopAddition");var Kb=Yi("firstItemIndex"),gc=Yi("statefulTotalCount"),rc=Yi("context");if(0===gc&&da)return(0,qh.createElement)(da,gk(da,rc));da=a.offsetTop+ja+Ra;ja=a.offsetBottom;da=0<da?Zg.createElement(k,{height:da,key:"padding-top"}):null;k=0<ja?Zg.createElement(k,{height:ja,key:"padding-bottom"}):null;a=a.items.map(function(Wb){var kc=Wb.originalIndex,hc=Jb(kc+Kb,Wb.data,rc);return Ob?(0,qh.createElement)(fb,bh({},gk(fb,rc),{key:hc,index:Wb.index,
height:Wb.size,type:Wb.type||"item"})):(0,qh.createElement)(jb,bh({},gk(jb,rc),{key:hc,"data-index":kc,"data-known-size":Wb.size,"data-item-index":Wb.index,style:{overflowAnchor:"none"}}),ra(Wb.index,Wb.data,rc))});return(0,qh.createElement)(K,bh({ref:d,"data-test-id":"virtuoso-item-list"},gk(K,rc)),[da].concat(a,[k]))}),Rv=function(a){a=a.children;var d=(0,qh.useContext)(cu),k=Rn("viewportHeight"),K=Rn("fixedItemHeight"),da=hj(bo(k,function(ja){return ii(ja,"height")}));return Zg.useEffect(function(){d&&
(k(d.viewportHeight),K(d.itemHeight))},[d,k,K]),Zg.createElement("div",{style:Is,ref:da,"data-viewport-type":"element"},a)},xy=function(a){a=a.children;var d=(0,qh.useContext)(cu),k=Rn("windowViewportRect"),K=Rn("fixedItemHeight"),da=Yi("customScrollParent");da=ph(k,da);return Zg.useEffect(function(){d&&(K(d.itemHeight),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,k,K]),Zg.createElement("div",{ref:da,style:Is,"data-viewport-type":"window"},a)},iu=tj(Ls,{required:{},optional:{context:"context",
followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",
fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},
events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Zg.memo(function(a){var d=Yi("useWindowScroll"),k=Yi("customScrollParent"),K=Rn("fixedHeaderHeight"),da=Rn("fixedFooterHeight"),ja=Yi("fixedHeaderContent"),ra=Yi("fixedFooterContent"),Ja=Yi("context");
K=hj(bo(K,function(jb){return ii(jb,"height")}));var Ra=hj(bo(da,function(jb){return ii(jb,"height")}));da=k||d?JC:xH;d=k||d?xy:Rv;k=Yi("TableComponent");var $a=Yi("TableHeadComponent"),fb=Yi("TableFooterComponent");ja=ja?Zg.createElement($a,bh({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:K},gk($a,Ja)),ja()):null;ra=ra?Zg.createElement(fb,bh({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:Ra},gk(fb,Ja)),ra()):null;return Zg.createElement(da,bh({},a),Zg.createElement(d,
null,Zg.createElement(k,bh({style:{borderSpacing:0}},gk(k,Ja)),[ja,Zg.createElement(vm,{key:"TableBody"}),ra])))})),Rn=iu.usePublisher,Yi=iu.useEmitterValue,Sv=iu.useEmitter,xH=Xr({usePublisher:Rn,useEmitterValue:Yi,useEmitter:Sv}),JC=Zq({usePublisher:Rn,useEmitterValue:Yi,useEmitter:Sv}),Ms=Kf(ca(19)),Ql=function(a){function d(k){k=a.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+k+" for more information.")||this;if(void 0===
k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k}Zr(d,a);return d}(gt(Error)),Tv={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",
darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",
floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",
lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",
mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",
sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},KC=/^#[a-fA-F0-9]{6}$/,LC=/^#[a-fA-F0-9]{8}$/,yy=/^#[a-fA-F0-9]{3}$/,tn=/^#[a-fA-F0-9]{4}$/,vr=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,
jl=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Uv=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,ju=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Tm=function(a){return 7===a.length&&a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]?"#"+a[1]+a[3]+a[5]:a},Ui=it(jt,jt.length,[]),Ns=
ca(589),yl=Kf(ca(19)),Um=class{static insertTextFirefox(a,d){a.setRangeText(d,a.selectionStart||0,a.selectionEnd||0,"end");a.dispatchEvent(new InputEvent("input",{data:d,inputType:"insertText",isComposing:!1}))}static insert(a,d){const k=a.ownerDocument,K=k.activeElement;K!==a&&a.focus();k.execCommand("insertText",!1,d)||Um.insertTextFirefox(a,d);K===k.body?a.blur():K instanceof HTMLElement&&K!==a&&K.focus()}static set(a,d){a.select();Um.insert(a,d)}static getSelection(a){const {selectionStart:d,
selectionEnd:k}=a;return a.value.slice(d?d:void 0,k?k:void 0)}static wrapSelection(a,d,k){const {selectionStart:K,selectionEnd:da}=a,ja=Um.getSelection(a);Um.insert(a,d+ja+(null!=k?k:d));a.selectionStart=(K||0)+d.length;a.selectionEnd=(da||0)+d.length}static replace(a,d,k){let K=0;a.value.replace(d,(...da)=>{const ja=K+da[da.length-2],ra=da[0].length;a.selectionStart=ja;a.selectionEnd=ja+ra;da="string"===typeof k?k:k(...da);Um.insert(a,da);a.selectionStart=ja;K+=da.length-ra;return da})}static findLineEnd(a,
d){const k=a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(k)?d:k+1}static indent(a){var d;const {selectionStart:k,selectionEnd:K,value:da}=a;var ja=da.slice(k,K);if((ja=null==(d=/\n/g.exec(ja))?void 0:d.length)&&0<ja){d=da.lastIndexOf("\n",k-1)+1;var ra=a.value.slice(d,K-1);ja=ra.replace(/^|\n/g,"$\x26  ");ra=ja.length-ra.length;a.setSelectionRange(d,K-1);Um.insert(a,ja);a.setSelectionRange(k+1,K+ra)}else Um.insert(a,"  ")}static unindent(a){const {selectionStart:d,selectionEnd:k,value:K}=a;var da=
K.lastIndexOf("\n",d-1)+1;const ja=Um.findLineEnd(K,k);var ra=a.value.slice(da,ja);const Ja=ra.replace(/(^|\n)(\t| {1,2})/g,"$1");ra=ra.length-Ja.length;a.setSelectionRange(da,ja);Um.insert(a,Ja);da=(da=/\t| {1,2}/.exec(K.slice(da,d)))?da[0].length:0;a.setSelectionRange(d-da,Math.max(d-da,k-ra))}},Vv=ca(589),Os=a=>a.stopPropagation(),Ps=yl.memo(function({font:a,text:d,color:k,fontStyle:K,fontSize:da,fontWeight:ja,offsetX:ra=0,offsetY:Ja=0,scale:Ra=1,isEditing:$a=!1,pointerEvents:fb=!1,onBlur:jb,onChange:Jb}){const Ob=
yl.useRef(null),Kb=yl.useRef(!1),gc=yl.useCallback(Lc=>{Jb(ms.normalizeText(Lc.currentTarget.value))},[Jb]),rc=yl.useCallback(Lc=>{if("Escape"!==Lc.key)if("Tab"===Lc.key&&0===d.length)Lc.preventDefault();else{if("Meta"!==Lc.key&&!Lc.metaKey)Lc.stopPropagation();else if("z"===Lc.key&&Lc.metaKey){document.execCommand(Lc.shiftKey?"redo":"undo",!1);Lc.stopPropagation();Lc.preventDefault();return}"Tab"===Lc.key&&(Lc.preventDefault(),Lc.shiftKey?Um.unindent(Lc.currentTarget):Um.indent(Lc.currentTarget),
null==Jb?void 0:Jb(ms.normalizeText(Lc.currentTarget.value)))}},[Jb]),Wb=yl.useCallback(Lc=>{$a&&(Lc.currentTarget.setSelectionRange(0,0),null==jb?void 0:jb())},[jb]),kc=yl.useCallback(Lc=>{$a&&Kb.current&&document.activeElement===Lc.currentTarget&&Lc.currentTarget.select()},[$a]),hc=yl.useCallback(Lc=>{$a&&Lc.stopPropagation()},[$a]);yl.useEffect(()=>{$a&&requestAnimationFrame(()=>{Kb.current=!0;const Lc=Ob.current;Lc&&(Lc.focus(),Lc.select())})},[$a,jb]);const Fc=yl.useRef(null);yl.useLayoutEffect(()=>
{const Lc=Fc.current;if(Lc){var ud=Mi(d||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:da,lineHeight:1,fontWeight:ja},4);Lc.style.transform=`scale(${Ra}, ${Ra}) translate(${ra}px, ${Ja}px)`;Lc.style.width=ud[0]+1+"px";Lc.style.height=ud[1]+1+"px"}},[d,ja,da,Ja,ra,Ra]);return(0,Vv.jsx)("div",{className:"tl-text-label-wrapper",children:(0,Vv.jsxs)("div",{className:"tl-text-label-inner-wrapper",ref:Fc,style:{font:a,fontStyle:K,fontSize:da,fontWeight:ja,color:k,pointerEvents:fb?"all":"none",
userSelect:$a?"text":"none"},children:[$a?(0,Vv.jsx)("textarea",{ref:Ob,style:{font:a,color:k,fontStyle:K,fontSize:da,fontWeight:ja},className:"tl-text-label-textarea",name:"text",tabIndex:-1,autoComplete:"false",autoCapitalize:"false",autoCorrect:"false",autoSave:"false",autoFocus:!0,placeholder:"Enter text",spellCheck:"true",wrap:"off",dir:"auto",datatype:"wysiwyg",defaultValue:d,color:k,onFocus:kc,onChange:gc,onKeyDown:rc,onBlur:Wb,onPointerDown:hc,onContextMenu:Os,onCopy:Os,onPaste:Os,onCut:Os}):
d,"​"]})})}),Sn=ca(589),Vm={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},wm=class extends fm{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",ee(({events:a,isErasing:d,isBinding:k,isSelected:K,isEditing:da,onEditingEnd:ja})=>{const {props:{size:[ra,Ja],stroke:Ra,fill:$a,noFill:fb,strokeWidth:jb,strokeType:Jb,borderRadius:Ob,opacity:Kb,label:gc,italic:rc,fontWeight:Wb,fontSize:kc}}=this;var hc=gc||da?Mi(gc,{fontFamily:"var(--ls-font-family)",fontSize:kc,lineHeight:1,fontWeight:Wb},
4):[0,0];const Fc=be.mul(this.props.size,.5);hc=Math.max(.5,Math.min(1,ra/hc[0],Ja/hc[1]));const Lc=this.getBounds(),ud=Ms.useMemo(()=>be.sub(Fc,be.toFixed([Lc.width/2,Lc.height/2])),[Lc,hc,Fc]),Jd=Ms.useCallback(Ee=>{var Sd;null==(Sd=this.update)?void 0:Sd.call(this,{label:Ee})},[gc]);return(0,Sn.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-box-container",children:[(0,Sn.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:gc,color:sh(Ra,"text"),offsetX:ud[0],
offsetY:ud[1],fontSize:kc,scale:hc,isEditing:da,onChange:Jd,onBlur:ja,fontStyle:rc?"italic":"normal",fontWeight:Wb,pointerEvents:!!gc}),(0,Sn.jsxs)(Nn,{opacity:d?.2:Kb,children:[k&&(0,Sn.jsx)(kt,{mode:"svg",strokeWidth:jb,size:[ra,Ja]}),(0,Sn.jsx)("rect",{className:K||!fb?"tl-hitarea-fill":"tl-hitarea-stroke",x:jb/2,y:jb/2,rx:Ob,ry:Ob,width:Math.max(.01,ra-jb),height:Math.max(.01,Ja-jb),pointerEvents:"all"}),(0,Sn.jsx)("rect",{x:jb/2,y:jb/2,rx:Ob,ry:Ob,width:Math.max(.01,ra-jb),height:Math.max(.01,
Ja-jb),strokeWidth:jb,stroke:sh(Ra,"stroke"),strokeDasharray:"dashed"===Jb?"8 2":void 0,fill:fb?"none":sh($a,"background")})]})]}))}));gb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:Vm[null!=a?a:"md"],strokeWidth:Vm[null!=a?a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],borderRadius:k,isLocked:K}}=this;return(0,Sn.jsx)("g",{children:(0,Sn.jsx)("rect",{width:a,height:d,rx:k,ry:k,fill:"transparent",strokeDasharray:K?
"8 2":void 0})})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));void 0!==a.borderRadius&&(a.borderRadius=Math.max(0,a.borderRadius));return fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};gb(wm,"id","box");gb(wm,"defaultProps",{id:"box",parentId:"page",type:"box",point:[0,0],size:[100,100],borderRadius:2,stroke:"",fill:"",noFill:!1,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",strokeWidth:2,
opacity:1,label:""});fe([Dg],wm.prototype,"scaleLevel",1);fe([jg],wm.prototype,"setScaleLevel",2);var Wv=Kf(ca(19)),Tn=ca(589),ku={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},wr=class extends Tw{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",ee(({isSelected:a,isErasing:d,events:k,isEditing:K,onEditingEnd:da})=>{const {size:[ja,ra],stroke:Ja,fill:Ra,noFill:$a,strokeWidth:fb,strokeType:jb,opacity:Jb,label:Ob,italic:Kb,fontWeight:gc,fontSize:rc}=this.props;var Wb=Ob||K?Mi(Ob,
{fontFamily:"var(--ls-font-family)",fontSize:rc,lineHeight:1,fontWeight:gc},4):[0,0];const kc=be.mul(this.props.size,.5);Wb=Math.max(.5,Math.min(1,ja/Wb[0],ra/Wb[1]));const hc=this.getBounds(),Fc=Wv.useMemo(()=>be.sub(kc,be.toFixed([hc.width/2,hc.height/2])),[hc,Wb,kc]),Lc=Wv.useCallback(ud=>{var Jd;null==(Jd=this.update)?void 0:Jd.call(this,{label:ud})},[Ob]);return(0,Tn.jsxs)("div",ff(Zd({},k),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-ellipse-container",children:[(0,Tn.jsx)(Ps,
{font:"18px / 1 var(--ls-font-family)",text:Ob,color:sh(Ja,"text"),offsetX:Fc[0],offsetY:Fc[1],scale:Wb,isEditing:K,onChange:Lc,onBlur:da,fontStyle:Kb?"italic":"normal",fontSize:rc,fontWeight:gc,pointerEvents:!!Ob}),(0,Tn.jsxs)(Nn,ff(Zd({},k),{opacity:d?.2:Jb,children:[(0,Tn.jsx)("ellipse",{className:a||!$a?"tl-hitarea-fill":"tl-hitarea-stroke",cx:ja/2,cy:ra/2,rx:Math.max(.01,(ja-fb)/2),ry:Math.max(.01,(ra-fb)/2)}),(0,Tn.jsx)("ellipse",{cx:ja/2,cy:ra/2,rx:Math.max(.01,(ja-fb)/2),ry:Math.max(.01,(ra-
fb)/2),strokeWidth:fb,stroke:sh(Ja,"stroke"),strokeDasharray:"dashed"===jb?"8 2":void 0,fill:$a?"none":sh(Ra,"background")})]}))]}))}));gb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:ku[null!=a?a:"md"],strokeWidth:ku[null!=a?a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",ee(()=>{const {size:[a,d],isLocked:k}=this.props;return(0,Tn.jsx)("g",{children:(0,Tn.jsx)("ellipse",{cx:a/2,cy:d/2,rx:a/2,ry:d/2,strokeWidth:2,fill:"transparent",strokeDasharray:k?
"8 2":"undefined"})})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));return fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {size:[d,k],stroke:K,fill:da,noFill:ja,strokeWidth:ra,strokeType:Ja,opacity:Ra}=this.props;return(0,Tn.jsxs)("g",{opacity:Ra,children:[(0,Tn.jsx)("ellipse",{className:ja?"tl-hitarea-stroke":"tl-hitarea-fill",cx:d/2,cy:k/2,rx:Math.max(.01,(d-ra)/2),ry:Math.max(.01,
(k-ra)/2)}),(0,Tn.jsx)("ellipse",{cx:d/2,cy:k/2,rx:Math.max(.01,(d-ra)/2),ry:Math.max(.01,(k-ra)/2),strokeWidth:ra,stroke:sh(K,"stroke"),strokeDasharray:"dashed"===Ja?"8 2":void 0,fill:ja?"none":sh(da,"background")})]})}};gb(wr,"id","ellipse");gb(wr,"defaultProps",{id:"ellipse",parentId:"page",type:"ellipse",point:[0,0],size:[100,100],stroke:"",fill:"",noFill:!1,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",strokeWidth:2,opacity:1,label:""});fe([Dg],wr.prototype,"scaleLevel",1);fe([jg],wr.prototype,
"setScaleLevel",2);var rq=ca(589),Xv=class extends Zu{constructor(){super(...arguments);gb(this,"ReactComponent",ee(({events:a})=>{const d=this.getBounds(),k=mg(),K=k.selectedShapesArray.some(ja=>k.shapesInGroups([this]).includes(ja)),da=this.ReactIndicator;return(0,rq.jsxs)(Nn,ff(Zd({},a),{className:"tl-group-container",children:[(0,rq.jsx)("rect",{className:"tl-hitarea-fill",x:1,y:1,width:Math.max(.01,d.width-2),height:Math.max(.01,d.height-2),pointerEvents:"all"}),K&&(0,rq.jsx)("g",{stroke:"var(--color-selectedFill)",
children:(0,rq.jsx)(da,{})})]}))}));gb(this,"ReactIndicator",ee(()=>{const a=this.getBounds();return(0,rq.jsx)("rect",{strokeDasharray:"8 2",x:-8,y:-8,rx:4,ry:4,width:a.width+16,height:a.height+16,fill:"transparent"})}))}};gb(Xv,"id","group");gb(Xv,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});var lu=ca(589),zy={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},sq=class extends fs{constructor(a={}){super(a);gb(this,"ReactComponent",ee(({events:d,isErasing:k})=>{const {pointsPath:K,
props:{stroke:da,strokeWidth:ja,opacity:ra}}=this;return(0,lu.jsx)(Nn,ff(Zd({},d),{opacity:k?.2:1,children:(0,lu.jsx)("path",{d:K,strokeWidth:16*ja,stroke:sh(da,"stroke"),fill:"none",pointerEvents:"all",strokeLinejoin:"round",strokeLinecap:"round",opacity:ra})}))}));gb(this,"setScaleLevel",d=>Oh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:zy[null!=d?d:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",ee(()=>{const {pointsPath:d,props:k}=this;return(0,lu.jsx)("path",{d,fill:"none",
strokeDasharray:k.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",d=>{d=fn(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Ue(this)}get pointsPath(){const {points:a}=this.props;return Mw.getCurvedPathForPoints(a)}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:k,opacity:K}}=this;return(0,lu.jsx)("path",{d:a,strokeWidth:16*k,stroke:sh(d,"stroke"),fill:"none",pointerEvents:"all",
strokeLinejoin:"round",strokeLinecap:"round",opacity:K})}};gb(sq,"id","highlighter");gb(sq,"defaultProps",{id:"highlighter",parentId:"page",type:"highlighter",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:.5});fe([Dg],sq.prototype,"pointsPath",1);fe([Dg],sq.prototype,"scaleLevel",1);fe([jg],sq.prototype,"setScaleLevel",2);var xr=Kf(ca(19)),$e=ca(589),Ig={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},qo=class extends fm{constructor(){super(...arguments);
gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"htmlAnchorRef",xr.createRef());gb(this,"setScaleLevel",a=>Oh(this,null,function*(){var d;const k=be.mul(this.props.size,Ig[null!=a?a:"md"]/Ig[null!=(d=this.props.scaleLevel)?d:"md"]);this.update({scaleLevel:a});yield zk();this.update({size:k})}));gb(this,"onResetBounds",a=>{var d;if(this.htmlAnchorRef.current){const k=this.htmlAnchorRef.current.getBoundingClientRect(),[K,da]=be.div([k.width,k.height],null!=(d=
null==a?void 0:a.zoom)?d:1);this.update({size:[Math.max(Math.min(K||400,1400),10),Math.max(Math.min(da||400,1400),10)]})}return this});gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k})=>{const {props:{html:K,scaleLevel:da}}=this,ja=$r(),ra=mg(),Ja=ra.selectedIds.has(this.id),Ra=ja||Ja&&!k||"select"!==ra.selectedTool.id,$a=xr.useCallback(jb=>{Ra||jb.stopPropagation()},[Ra]),fb=Ig[null!=da?da:"md"];xr.useEffect(()=>{0===this.props.size[1]&&(this.onResetBounds({zoom:ra.viewport.camera.zoom}),
ra.persist(!0))},[]);return(0,$e.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,$e.jsx)("div",{onWheelCapture:$a,onPointerDown:$a,onPointerUp:$a,className:"tl-html-container",style:{pointerEvents:ja||!k&&!Ja?"none":"all",overflow:k?"auto":"hidden",width:`calc(100% / ${fb})`,height:`calc(100% / ${fb})`,transform:`scale(${fb})`},children:(0,$e.jsx)("div",{ref:this.htmlAnchorRef,className:"tl-html-anchor",dangerouslySetInnerHTML:{__html:K.trim()}})})}))}));
gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,$e.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));return fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};gb(qo,"id","html");gb(qo,"defaultProps",{id:"html",type:"html",parentId:"page",point:[0,0],size:[600,0],html:""});fe([Dg],
qo.prototype,"scaleLevel",1);fe([jg],qo.prototype,"setScaleLevel",2);var Ay=Kf(ca(19)),Qs=ca(589),tq=class extends fm{constructor(){super(...arguments);gb(this,"frameRef",Ay.createRef());gb(this,"canEdit",!0);gb(this,"onIFrameSourceChange",a=>{this.update({url:a})});gb(this,"reload",()=>{var a,d;this.frameRef.current&&(this.frameRef.current.src=null==(d=null==(a=this.frameRef)?void 0:a.current)?void 0:d.src)});gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k})=>{Ay.useRef(null);const K=
mg();return(0,Qs.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Qs.jsx)("div",{className:"tl-iframe-container",style:{pointerEvents:k||K.readOnly?"all":"none",userSelect:"none"},children:this.props.url&&(0,Qs.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,Qs.jsx)("iframe",{ref:this.frameRef,className:"absolute inset-0 w-full h-full m-0",width:"100%",height:"100%",src:`${this.props.url}`,frameBorder:"0",sandbox:"allow-scripts allow-same-origin allow-presentation"})})})}))}));
gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Qs.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}))}};gb(tq,"id","iframe");gb(tq,"defaultProps",{id:"iframe",type:"iframe",parentId:"page",point:[0,0],size:[853,480],url:""});fe([jg],tq.prototype,"onIFrameSourceChange",2);fe([jg],tq.prototype,"reload",2);var By=Kf(ca(19)),yr=ca(589),mu=class extends Uw{constructor(){super(...arguments);gb(this,"ReactComponent",ee(({events:a,
isErasing:d,isBinding:k,asset:K})=>{const {props:{opacity:da,objectFit:ja,clipping:ra,size:[Ja,Ra]}}=this,[$a,fb,jb,Jb]=Array.isArray(ra)?ra:[ra,ra,ra,ra],{handlers:Ob}=By.useContext(ji);return(0,yr.jsxs)(ln,ff(Zd({},a),{opacity:d?.2:da,children:[k&&(0,yr.jsx)(kt,{mode:"html",strokeWidth:4,size:[Ja,Ra]}),(0,yr.jsx)("div",{"data-asset-loaded":!!K,className:"tl-image-shape-container",children:K?(0,yr.jsx)("img",{src:Ob?Ob.makeAssetUrl(K.src):K.src,draggable:!1,style:{position:"relative",top:-$a,left:-Jb,
width:Ja+(Jb-fb),height:Ra+($a-jb),objectFit:ja}}):"Asset is missing"})]}))}));gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,yr.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}))}getShapeSVGJsx({assets:a}){var d,k;const K=this.getBounds(),{assetId:da,clipping:ja}=this.props;if(a=a.find(ra=>ra.id===da)){Array.isArray(ja);const ra=null==(k=null==(d=window.logseq)?void 0:d.api)?void 0:k.make_asset_url;return(0,yr.jsx)("image",
{width:K.width,height:K.height,href:ra?ra(a.src):a.src})}return super.getShapeSVGJsx({})}};gb(mu,"id","image");gb(mu,"defaultProps",{id:"image1",parentId:"page",type:"image",point:[0,0],size:[100,100],opacity:1,assetId:"",clipping:0,objectFit:"fill",isAspectRatioLocked:!0});var li=Kf(ca(19)),MC=Kf(ca(19)),Yv=ca(589),wp=ca(589),NC={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Rs=MC.memo(function({style:a,start:d,end:k,decorationStart:K,decorationEnd:da,scaleLevel:ja}){const ra=be.dist(d,k);if(2>ra)return null;
const {strokeWidth:Ja}=a,Ra=1+Ja*NC[null!=ja?ja:"md"]/10,$a="M"+be.toFixed(d)+"L"+be.toFixed(k);ja=Math.min(ra/3,Ja*NC[null!=ja?ja:"md"]);K=K?lt(d,k,ja):null;da=da?lt(k,d,ja):null;return(0,wp.jsxs)(wp.Fragment,{children:[(0,wp.jsx)("path",{className:"tl-stroke-hitarea",d:$a}),(0,wp.jsx)("path",{d:$a,strokeWidth:Ra,stroke:a.stroke,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"dashed"===a.strokeType?"8 4":void 0,pointerEvents:"stroke"}),K&&(0,wp.jsx)(Iu,{left:K.left,middle:d,right:K.right,
stroke:a.stroke,strokeWidth:Ra}),da&&(0,wp.jsx)(Iu,{left:da.left,middle:k,right:da.right,stroke:a.stroke,strokeWidth:Ra})]})}),nu=ca(589),xm=ca(589),uq={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},zr=class extends wt{constructor(){super(...arguments);gb(this,"hideSelection",!0);gb(this,"canEdit",!0);gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k,onEditingEnd:K})=>{const {stroke:da,handles:{start:ja,end:ra},opacity:Ja,label:Ra,italic:$a,fontWeight:fb,fontSize:jb,id:Jb}=this.props,Ob=Ra||
k?Mi(Ra||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:jb,lineHeight:1,fontWeight:fb},6):[0,0],Kb=be.med(ja.point,ra.point);var gc=be.dist(ja.point,ra.point);gc=Math.max(.5,Math.min(1,Math.max(gc/(Ob[1]+128),gc/(Ob[0]+128))));const rc=this.getBounds(),Wb=li.useMemo(()=>be.sub(Kb,be.toFixed([rc.width/2,rc.height/2])),[rc,gc,Kb]),kc=li.useCallback(hc=>{var Fc;null==(Fc=this.update)?void 0:Fc.call(this,{label:hc})},[Ra]);return(0,xm.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",
overflow:"hidden"},className:"tl-line-container",children:[(0,xm.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:Ra,fontSize:jb,color:sh(da,"text"),offsetX:Wb[0],offsetY:Wb[1],scale:gc,isEditing:k,onChange:kc,onBlur:K,fontStyle:$a?"italic":"normal",fontWeight:fb,pointerEvents:!!Ra}),(0,xm.jsxs)(Nn,{opacity:d?.2:Ja,id:Jb+"_svg",children:[(0,xm.jsx)(mt,{id:Jb,bounds:rc,labelSize:Ob,offset:Wb,scale:gc}),(0,xm.jsx)("g",{pointerEvents:"none",mask:Ra||k?`url(#${Jb}_clip)`:"",children:this.getShapeSVGJsx({preview:!1})})]})]}))}));
gb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:uq[null!=a?a:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",ee(({isEditing:a})=>{const {id:d,decorations:k,label:K,strokeWidth:da,fontSize:ja,fontWeight:ra,handles:{start:Ja,end:Ra},isLocked:$a}=this.props,fb=this.getBounds(),jb=K||a?Mi(K,{fontFamily:"var(--ls-font-family)",fontSize:ja,lineHeight:1,fontWeight:ra},6):[0,0],Jb=be.med(Ja.point,Ra.point);var Ob=be.dist(Ja.point,Ra.point);Ob=Math.max(.5,Math.min(1,
Math.max(Ob/(jb[1]+128),Ob/(jb[0]+128))));const Kb=li.useMemo(()=>be.sub(Jb,be.toFixed([fb.width/2,fb.height/2])),[fb,Ob,Jb]);return(0,xm.jsxs)("g",{children:[(0,xm.jsx)("path",{mask:K?`url(#${d}_clip)`:"",d:Aw({strokeWidth:da},Ja.point,Ra.point,null==k?void 0:k.start,null==k?void 0:k.end),strokeDasharray:$a?"8 2":"undefined"}),K&&!a&&(0,xm.jsx)("rect",{x:fb.width/2-jb[0]/2*Ob+Kb[0],y:fb.height/2-jb[1]/2*Ob+Kb[1],width:jb[0]*Ob,height:jb[1]*Ob,rx:4*Ob,ry:4*Ob,fill:"transparent"})]})}));gb(this,"validateProps",
a=>fn(this,a))}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx({preview:a}){const {stroke:d,fill:k,strokeWidth:K,strokeType:da,decorations:ja,label:ra,scaleLevel:Ja,handles:{start:Ra,end:$a}}=this.props,fb=be.med(Ra.point,$a.point);return(0,xm.jsxs)(xm.Fragment,{children:[(0,xm.jsx)(Rs,{style:{stroke:sh(d,"text"),fill:k,strokeWidth:K,strokeType:da},scaleLevel:Ja,start:Ra.point,end:$a.point,decorationStart:null==ja?void 0:ja.start,decorationEnd:null==ja?void 0:ja.end}),
a&&(0,xm.jsx)(xm.Fragment,{children:(0,xm.jsx)("text",{style:{transformOrigin:"top left"},fontFamily:"Inter",fontSize:20,transform:`translate(${fb[0]}, ${fb[1]})`,textAnchor:"middle",fill:sh(d,"text"),stroke:sh(d,"text"),children:ra})})]})}};gb(zr,"id","line");gb(zr,"defaultProps",{id:"line",parentId:"page",type:"line",point:[0,0],handles:{start:{id:"start",canBind:!0,point:[0,0]},end:{id:"end",canBind:!0,point:[1,1]}},stroke:"",fill:"",noFill:!0,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",
strokeWidth:1,opacity:1,decorations:{end:"arrow"},label:""});fe([Dg],zr.prototype,"scaleLevel",1);fe([jg],zr.prototype,"setScaleLevel",2);var ym=Kf(ca(19)),Ki=ca(589),Un={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},ro=ee(({type:a,fill:d,opacity:k,children:K})=>{const da="var(--ls-secondary-background-color)"!==d?sh(d,"background"):"var(--ls-tertiary-background-color)";d=d&&"var(--ls-secondary-background-color)"!==d?Gi(d)?`var(--ls-highlight-color-${d})`:d:"var(--ls-secondary-background-color)";return(0,Ki.jsxs)("div",
{className:`tl-logseq-portal-header tl-logseq-portal-header-${"P"===a?"page":"block"}`,children:[(0,Ki.jsx)("div",{className:"absolute inset-0 tl-logseq-portal-header-bg",style:{opacity:k,background:"P"===a?da:`linear-gradient(0deg, ${d}, ${da})`}}),(0,Ki.jsx)("div",{className:"relative",children:K})]})}),Qj=class extends fm{constructor(a={}){var d;super(a);gb(this,"hideRotateHandle",!0);gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!0);gb(this,"persist",null);gb(this,
"initialHeightCalculated",!0);gb(this,"getInnerHeight",null);gb(this,"setCollapsed",k=>Oh(this,null,function*(){var K;if("B"===this.props.blockType){if(this.update({compact:k}),this.canResize[1]=!k,!k)this.onResetBounds()}else{const da=this.props.size[1];this.canResize[1]=!k;this.update({isAutoResizing:!k,collapsed:k,size:[this.props.size[0],k?this.getHeaderHeight():this.props.collapsedHeight],collapsedHeight:k?da:this.props.collapsedHeight})}null==(K=this.persist)?void 0:K.call(this)}));gb(this,
"setScaleLevel",k=>Oh(this,null,function*(){var K;const da=be.mul(this.props.size,Un[null!=k?k:"md"]/Un[null!=(K=this.props.scaleLevel)?K:"md"]);this.update({scaleLevel:k});yield zk();this.update({size:da})}));gb(this,"onResetBounds",k=>{k=this.getAutoResizeHeight();null!==k&&1<Math.abs(k-this.props.size[1])&&(this.update({size:[this.props.size[0],k]}),this.initialHeightCalculated=!0);return this});gb(this,"onResize",(k,K)=>{var da;const {bounds:ja,rotation:ra,scale:[Ja,Ra]}=K;k=[...this.scale];0>
Ja&&(k[0]*=-1);0>Ra&&(k[1]*=-1);K=ja.height;this.props.isAutoResizing&&(K=null!=(da=this.getAutoResizeHeight())?da:K);return this.update({point:[ja.minX,ja.minY],size:[Math.max(1,ja.width),Math.max(1,K)],scale:k,rotation:ra})});gb(this,"PortalComponent",ee(({})=>{const {props:{pageId:k,fill:K,opacity:da}}=this,{renderers:ja}=ym.useContext(ji),ra=mg(),Ja=ym.useRef(null),[,Ra]=this.useComponentSize(Ja,this.props.compact?".tl-logseq-cp-container \x3e .single-block":".tl-logseq-cp-container \x3e .page");
if(null==ja||!ja.Page)return null;const {Page:$a,Block:fb}=ja,[jb,Jb]=ym.useState(!1);ym.useEffect(()=>{var Ob,Kb;if(this.props.isAutoResizing){const gc=(null!=(Kb=null==(Ob=this.getInnerHeight)?void 0:Ob.call(this))?Kb:Ra)+this.getHeaderHeight();Ra&&1<Math.abs(gc-this.props.size[1])&&(this.update({size:[this.props.size[0],gc]}),jb&&ra.persist(!0))}},[Ra,this.props.isAutoResizing]);ym.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();ra.persist(!0)})},[this.initialHeightCalculated]);
ym.useEffect(()=>{setTimeout(function(){Jb(!0)})},[]);return(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("div",{className:"absolute inset-0 tl-logseq-cp-container-bg",style:{textRendering:.5>ra.viewport.camera.zoom?"optimizeSpeed":"auto",background:K&&"var(--ls-secondary-background-color)"!==K?Gi(K)?`var(--ls-highlight-color-${K})`:K:"var(--ls-secondary-background-color)",opacity:da}}),(0,Ki.jsx)("div",{ref:Ja,className:"relative tl-logseq-cp-container",style:{overflow:this.props.isAutoResizing?
"visible":"auto"},children:(jb||!this.initialHeightCalculated)&&("B"===this.props.blockType&&this.props.compact?(0,Ki.jsx)(fb,{blockId:k}):(0,Ki.jsx)($a,{pageName:k}))})]})}));gb(this,"ReactComponent",ee(k=>{var K;const {events:da,isErasing:ja,isEditing:ra,isBinding:Ja}=k,{props:{opacity:Ra,pageId:$a,fill:fb,scaleLevel:jb,strokeWidth:Jb,size:Ob}}=this,Kb=mg(),{renderers:gc,handlers:rc}=ym.useContext(ji);this.persist=()=>Kb.persist();const Wb=$r(),kc=Kb.selectedIds.has(this.id)&&1===Kb.selectedIds.size,
hc=Kb.isIn("logseq-portal.creating")&&!$a,Fc=(Wb||kc&&!ra||"select"!==Kb.selectedTool.id)&&!hc,Lc=ym.useCallback(od=>{Fc||od.stopPropagation()},[Fc]),ud=1===Kb.selectedShapesArray.length&&Kb.selectedShapesArray.some(od=>"logseq-portal"===od.type&&od.props.id!==this.props.id&&$a&&od.props.pageId===$a),Jd=Un[null!=jb?jb:"md"];ym.useEffect(()=>this.props.collapsed&&ra?(this.update({size:[this.props.size[0],this.props.collapsedHeight]}),()=>{this.update({size:[this.props.size[0],this.getHeaderHeight()]})}):
()=>{},[ra,this.props.collapsed]);ym.useEffect(()=>{if(hc){const od=[Kb.viewport.bounds.width,Kb.viewport.bounds.height],Dd=Kb.viewport.getScreenPoint([this.bounds.minX,this.bounds.minY]);(Dd[0]>od[0]-400||Dd[1]>od[1]-240||1.5<Kb.viewport.camera.zoom||.5>Kb.viewport.camera.zoom)&&Kb.viewport.zoomToBounds(ff(Zd({},this.bounds),{minY:this.bounds.maxY+25}))}},[Kb.viewport.bounds.height.toFixed(2)]);const Ee=ym.useCallback(od=>{this.initialHeightCalculated=!1;const Dd=Dj(od)?"B":"P";this.update({pageId:od,
size:[400,320],blockType:Dd,compact:"B"===Dd});Kb.selectTool("select");Kb.history.resume();Kb.history.persist()},[]),Sd=this.PortalComponent;var De=ym.useMemo(()=>{var od;if($a&&"B"===this.props.blockType)return null==(od=null==rc?void 0:rc.queryBlockByUUID($a))?void 0:od.content},[null==rc?void 0:rc.queryBlockByUUID,$a]);De="B"===this.props.blockType&&"string"!==typeof De;const gf=(!this.props.collapsed||ra)&&!De;if(null==gc||!gc.Page)return null;const {Breadcrumb:Te,PageName:df}=gc,Gd={width:`calc(100% / ${Jd})`,
height:`calc(100% / ${Jd})`,opacity:ja?.2:1};1!==Jd&&(Gd.transform=`scale(${Jd})`);return(0,Ki.jsxs)(ln,ff(Zd({style:{pointerEvents:"all"}},da),{children:[Ja&&(0,Ki.jsx)(kt,{mode:"html",strokeWidth:Jb,size:Ob}),(0,Ki.jsx)("div",{"data-inner-events":!Fc,onWheelCapture:Lc,onPointerDown:Lc,onPointerUp:Lc,style:{width:"100%",height:"100%",pointerEvents:Wb||!ra&&!kc?"none":"all"},children:hc?(0,Ki.jsx)(Er,{onChange:Ee,onAddBlock:od=>{setTimeout(()=>{var Dd,jd,Cd;Kb.api.editShape(this);null==(Cd=null==
(jd=null==(Dd=window.logseq)?void 0:Dd.api)?void 0:jd.edit_block)?void 0:Cd.call(jd,od)})},placeholder:"Create or search your graph..."}):(0,Ki.jsxs)("div",{className:"tl-logseq-portal-container","data-collapsed":this.collapsed,"data-page-id":$a,"data-portal-selected":ud,"data-editing":ra,style:Gd,children:[!this.props.compact&&!De&&(0,Ki.jsx)(ro,{type:null!=(K=this.props.blockType)?K:"P",fill:fb,opacity:Ra,children:"P"===this.props.blockType?(0,Ki.jsx)(df,{pageName:$a}):(0,Ki.jsx)(Te,{blockId:$a})}),
De&&(0,Ki.jsx)("div",{className:"tl-target-not-found",children:"Target not found"}),gf&&(0,Ki.jsx)(Sd,Zd({},k))]})})]}))}));gb(this,"ReactIndicator",ee(()=>{const k=this.getBounds();return(0,Ki.jsx)("rect",{width:k.width,height:k.height,fill:"transparent",rx:8,ry:8,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",k=>{var K;if(void 0!==k.size){const da=Un[null!=(K=this.props.scaleLevel)?K:"md"];k.size[0]=Math.max(k.size[0],60*da);k.size[1]=Math.max(k.size[1],40*da)}return fn(this,
k)});Ue(this);a.collapsed&&Object.assign(this.canResize,[!0,!1]);0===(null==(d=a.size)?void 0:d[1])&&(this.initialHeightCalculated=!1)}static isPageOrBlock(a){return a?/^\(\(.*\)\)$/.test(a)&&40===a.length?"B":"P":!1}get collapsed(){return"B"===this.props.blockType?this.props.compact:this.props.collapsed}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}useComponentSize(a,d=""){const [k,K]=ym.useState([0,0]),da=mg();ym.useEffect(()=>{setTimeout(()=>{if(null==a?0:a.current){const ja=
d?a.current.querySelector(d):a.current;if(ja){const ra=()=>{const {width:Ra,height:$a}=ja.getBoundingClientRect(),fb=be.div([Ra,$a],da.viewport.camera.zoom);K(fb);return fb};ra();this.getInnerHeight=()=>ra()[1];const Ja=new ResizeObserver(()=>{ra()});Ja.observe(ja);return()=>{Ja.disconnect()}}}return()=>{}},10)},[a,d]);return k}getHeaderHeight(){var a;const d=Un[null!=(a=this.props.scaleLevel)?a:"md"];return this.props.compact?0:40*d}getAutoResizeHeight(){return this.getInnerHeight?this.getHeaderHeight()+
this.getInnerHeight():null}getShapeSVGJsx({}){var a,d,k;const K=this.getBounds();return(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?Gi(this.props.fill)?`var(--ls-highlight-color-${this.props.fill})`:this.props.fill:"var(--ls-secondary-background-color)",stroke:sh(this.props.fill,"background"),strokeWidth:null!=(a=this.props.strokeWidth)?a:2,fillOpacity:null!=(d=this.props.opacity)?d:.2,width:K.width,rx:8,ry:8,
height:K.height}),!this.props.compact&&(0,Ki.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?sh(this.props.fill,"background"):"var(--ls-tertiary-background-color)",fillOpacity:null!=(k=this.props.opacity)?k:.2,x:1,y:1,width:K.width-2,height:38,rx:8,ry:8}),(0,Ki.jsx)("text",{style:{transformOrigin:"top left"},transform:`translate(${K.width/2}, ${10+K.height/2})`,textAnchor:"middle",fontFamily:"var(--ls-font-family)",fontSize:"32",fill:"var(--ls-secondary-text-color)",
stroke:"var(--ls-secondary-text-color)",children:"P"===this.props.blockType?this.props.pageId:""})]})}};gb(Qj,"id","logseq-portal");gb(Qj,"defaultSearchQuery","");gb(Qj,"defaultSearchFilter",null);gb(Qj,"defaultProps",{id:"logseq-portal",type:"logseq-portal",parentId:"page",point:[0,0],size:[400,50],collapsedHeight:0,stroke:"",fill:"",noFill:!1,borderRadius:8,strokeWidth:2,strokeType:"line",opacity:1,pageId:"",collapsed:!1,compact:!1,scaleLevel:"md",isAutoResizing:!0});fe([Dg],Qj.prototype,"collapsed",
1);fe([jg],Qj.prototype,"setCollapsed",2);fe([Dg],Qj.prototype,"scaleLevel",1);fe([jg],Qj.prototype,"setScaleLevel",2);var {min:so,PI:OC}=Math,xp=OC+1E-4,ou=ca(589),to={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},Ar={easing:a=>Math.sin(a*Math.PI/2),simulatePressure:!0},Cy={easing:a=>a*a,simulatePressure:!1},ng=class extends fs{constructor(a={}){super(a);gb(this,"ReactComponent",ee(({events:d,isErasing:k})=>{const {props:{opacity:K}}=this;return(0,ou.jsx)(Nn,ff(Zd({},d),{opacity:k?.2:K,children:this.getShapeSVGJsx()}))}));
gb(this,"setScaleLevel",d=>Oh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:to[null!=d?d:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",ee(()=>{const {pointsPath:d}=this;return(0,ou.jsx)("path",{d,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",d=>{d=fn(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Ue(this)}get pointsPath(){var a=this.props;if(2>a.points.length)var d="";else d=ff(Zd({size:1+1.5*a.strokeWidth,
thinning:.65,streamline:.65,smoothing:.65},.5===a.points[1][2]?Ar:Cy),{last:a.isComplete}),a=Fw(a.points,d),d=Mw.getSvgPathFromStroke(Ew(a,d));return d}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:k,strokeType:K}}=this;return(0,ou.jsx)("path",{pointerEvents:"all",d:a,strokeWidth:k/2,strokeLinejoin:"round",strokeLinecap:"round",stroke:sh(d,"text"),fill:sh(d,"text"),strokeDasharray:"dashed"===K?"12 4":void 0})}};
gb(ng,"id","pencil");gb(ng,"defaultProps",{id:"pencil",parentId:"page",type:"pencil",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});fe([Dg],ng.prototype,"pointsPath",1);fe([Dg],ng.prototype,"scaleLevel",1);fe([jg],ng.prototype,"setScaleLevel",2);var pu=Kf(ca(19)),un=ca(589),yp={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},vn=class extends Wp{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",ee(({events:a,isErasing:d,
isSelected:k,isEditing:K,onEditingEnd:da})=>{const {offset:[ja,ra],props:{stroke:Ja,fill:Ra,noFill:$a,strokeWidth:fb,opacity:jb,strokeType:Jb,label:Ob,italic:Kb,fontWeight:gc,fontSize:rc}}=this,Wb=this.getVertices(fb/2).join();var kc=Ob||K?Mi(Ob,{fontFamily:"var(--ls-font-family)",fontSize:rc,lineHeight:1,fontWeight:gc},4):[0,0];const hc=[this.props.size[0]/2,2*this.props.size[1]/3];kc=Math.max(.5,Math.min(1,this.props.size[0]/(2*kc[0]),this.props.size[1]/(2*kc[1])));const Fc=this.getBounds(),Lc=
pu.useMemo(()=>be.sub(hc,be.toFixed([Fc.width/2,Fc.height/2])),[Fc,kc,hc]),ud=pu.useCallback(Jd=>{var Ee;null==(Ee=this.update)?void 0:Ee.call(this,{label:Jd})},[Ob]);return(0,un.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,un.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:Ob,fontSize:rc,color:sh(Ja,"text"),offsetX:Lc[0],offsetY:Lc[1]/kc,scale:kc,isEditing:K,onChange:ud,onBlur:da,fontStyle:Kb?"italic":"normal",fontWeight:gc,pointerEvents:!!Ob}),(0,un.jsx)(Nn,
{opacity:d?.2:jb,children:(0,un.jsxs)("g",{transform:`translate(${ja}, ${ra})`,children:[(0,un.jsx)("polygon",{className:k||!$a?"tl-hitarea-fill":"tl-hitarea-stroke",points:Wb}),(0,un.jsx)("polygon",{points:Wb,stroke:sh(Ja,"stroke"),fill:$a?"none":sh(Ra,"background"),strokeWidth:fb,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Jb?"8 2":void 0})]})})]}))}));gb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:yp[null!=a?a:"md"],strokeWidth:yp[null!=a?
a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",ee(()=>{const {offset:[a,d],props:{strokeWidth:k,isLocked:K}}=this;return(0,un.jsx)("g",{children:(0,un.jsx)("polygon",{transform:`translate(${a}, ${d})`,points:this.getVertices(k/2).join(),strokeDasharray:K?"8 2":"undefined"})})}));gb(this,"validateProps",a=>{void 0!==a.sides&&(a.sides=Math.max(a.sides,3));return fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {offset:[d,k],props:{stroke:K,
fill:da,noFill:ja,strokeWidth:ra,opacity:Ja,strokeType:Ra}}=this;a=this.getVertices(ra/2).join();return(0,un.jsxs)("g",{transform:`translate(${d}, ${k})`,opacity:Ja,children:[(0,un.jsx)("polygon",{className:ja?"tl-hitarea-stroke":"tl-hitarea-fill",points:a}),(0,un.jsx)("polygon",{points:a,stroke:sh(K,"stroke"),fill:ja?"none":sh(da,"background"),strokeWidth:ra,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Ra?"8 2":void 0})]})}};gb(vn,"id","polygon");gb(vn,"defaultProps",{id:"polygon",
parentId:"page",type:"polygon",point:[0,0],size:[100,100],sides:3,ratio:1,isFlippedY:!1,stroke:"",fill:"",fontWeight:400,fontSize:20,italic:!1,noFill:!1,strokeType:"line",strokeWidth:2,opacity:1,label:""});fe([Dg],vn.prototype,"scaleLevel",1);fe([jg],vn.prototype,"setScaleLevel",2);var Vn=Kf(ca(19)),zl=ca(589),PC={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Rl=class extends Vw{constructor(){super(...arguments);gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k,onEditingEnd:K})=>{const {props:{opacity:da,
fontFamily:ja,fontSize:ra,fontWeight:Ja,italic:Ra,lineHeight:$a,text:fb,stroke:jb,padding:Jb}}=this,Ob=Vn.useRef(null),Kb=Vn.useRef(!1),gc=Vn.useRef(null),rc=Vn.useCallback(Lc=>{const {isSizeLocked:ud}=this.props;Lc=ms.normalizeText(Lc.currentTarget.value);ud?this.update({text:Lc,size:this.getAutoSizedBoundingBox({text:Lc})}):this.update({text:Lc})},[]),Wb=Vn.useCallback(Lc=>{if("Escape"!==Lc.key)if("Tab"===Lc.key&&0===fb.length)Lc.preventDefault();else{if("Meta"!==Lc.key&&!Lc.metaKey)Lc.stopPropagation();
else if("z"===Lc.key&&Lc.metaKey){Lc.shiftKey?document.execCommand("redo",!1):document.execCommand("undo",!1);Lc.stopPropagation();Lc.preventDefault();return}"Tab"===Lc.key&&(Lc.preventDefault(),Lc.shiftKey?Um.unindent(Lc.currentTarget):Um.indent(Lc.currentTarget),this.update({text:ms.normalizeText(Lc.currentTarget.value)}))}},[]),kc=Vn.useCallback(Lc=>{k&&(null==K?void 0:K())},[K]),hc=Vn.useCallback(Lc=>{k&&Kb.current&&document.activeElement===Lc.currentTarget&&Lc.currentTarget.select()},[k]),Fc=
Vn.useCallback(Lc=>{k&&Lc.stopPropagation()},[k]);Vn.useEffect(()=>{k&&requestAnimationFrame(()=>{Kb.current=!0;const Lc=Ob.current;Lc&&(Lc.focus(),Lc.select())})},[k,K]);Vn.useLayoutEffect(()=>{if(0===this.props.size[0]||0===this.props.size[1])this.onResetBounds()},[]);return(0,zl.jsx)(ln,ff(Zd({},a),{opacity:d?.2:da,children:(0,zl.jsx)("div",{ref:gc,className:"tl-text-shape-wrapper","data-hastext":!!fb,"data-isediting":k,style:{fontFamily:ja,fontStyle:Ra?"italic":"normal",fontSize:ra,fontWeight:Ja,
padding:Jb,lineHeight:$a,color:sh(jb,"text")},children:k?(0,zl.jsx)("textarea",{ref:Ob,className:"tl-text-shape-input",name:"text",tabIndex:-1,autoComplete:"false",autoCapitalize:"false",autoCorrect:"false",autoSave:"false",placeholder:"",spellCheck:"true",wrap:"off",dir:"auto",datatype:"wysiwyg",defaultValue:fb,onFocus:hc,onChange:rc,onKeyDown:Wb,onBlur:kc,onPointerDown:Fc}):(0,zl.jsxs)(zl.Fragment,{children:[fb,"​"]})})}))}));gb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,
fontSize:PC[null!=a?a:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",ee(({isEditing:a})=>{const {props:{borderRadius:d,isLocked:k},bounds:K}=this;return a?null:(0,zl.jsx)("rect",{width:K.width,height:K.height,rx:d,ry:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>fn(this,a));gb(this,"getBounds",()=>{const [a,d]=this.props.point,[k,K]=this.props.size;return{minX:a,minY:d,maxX:a+k,maxY:d+K,width:k,height:K}});gb(this,"onResizeStart",({isSingle:a})=>
{var d;if(!a)return this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];return this.update({isSizeLocked:!1})});gb(this,"onResetBounds",()=>{this.update({size:this.getAutoSizedBoundingBox(),isSizeLocked:!0});return this})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getAutoSizedBoundingBox(a={}){const {text:d=this.props.text,fontFamily:k=this.props.fontFamily,fontSize:K=this.props.fontSize,fontWeight:da=this.props.fontWeight,lineHeight:ja=this.props.lineHeight,padding:ra=
this.props.padding}=a,[Ja,Ra]=Mi(d,{fontFamily:k,fontSize:K,lineHeight:ja,fontWeight:da},ra);return[Ja,Ra]}getShapeSVGJsx(){var a=window.navigator.userAgent.toLowerCase();if(a.includes("webkit")&&!a.includes("chrome"))return super.getShapeSVGJsx(null);const {props:{text:d,stroke:k,fontSize:K,fontFamily:da}}=this;a=this.getBounds();return(0,zl.jsx)("foreignObject",{width:a.width,height:a.height,children:(0,zl.jsx)("div",{style:{color:sh(k,"text"),fontSize:K,fontFamily:da,display:"contents"},children:d})})}};
gb(Rl,"id","text");gb(Rl,"defaultProps",{id:"box",parentId:"page",type:"text",point:[0,0],size:[0,0],isSizeLocked:!0,text:"",lineHeight:1.2,fontSize:20,fontWeight:400,italic:!1,padding:4,fontFamily:"var(--ls-font-family)",borderRadius:0,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});fe([Dg],Rl.prototype,"scaleLevel",1);fe([jg],Rl.prototype,"setScaleLevel",2);var Br=Kf(ca(19)),Ss=ca(589),vq=class extends fm{constructor(){super(...arguments);gb(this,"canFlip",!1);gb(this,"canEdit",
!0);gb(this,"canChangeAspectRatio",!1);gb(this,"ReactComponent",ee(({events:a,isErasing:d,asset:k,isEditing:K})=>{const {props:{opacity:da}}=this,ja=$r();var ra=mg();const Ja=ra.selectedIds.has(this.id),Ra=ja||Ja&&!K||"select"!==ra.selectedTool.id;ra=Br.useCallback(fb=>{Ra||fb.stopPropagation()},[Ra]);const {handlers:$a}=Br.useContext(ji);return(0,Ss.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:da}},a),{children:(0,Ss.jsx)("div",{onWheelCapture:ra,onPointerDown:ra,onPointerUp:ra,
className:"tl-video-container",style:{pointerEvents:ja||!K&&!Ja?"none":"all",overflow:K?"auto":"hidden"},children:k&&(0,Ss.jsx)("video",{controls:!0,src:$a?$a.makeAssetUrl(k.src):k.src})})}))}));gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Ss.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}))}};gb(vq,"id","video");gb(vq,"defaultProps",{id:"video1",parentId:"page",type:"video",point:[0,0],size:[100,100],opacity:1,assetId:"",
clipping:0,isAspectRatioLocked:!0});var Xk=ca(589),qu=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,Zv=class extends fm{constructor(){super(...arguments);gb(this,"aspectRatio",480/853);gb(this,"canChangeAspectRatio",!1);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"onYoutubeLinkChange",a=>{this.update({url:a,size:Zv.defaultProps.size})});gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k})=>{const K=mg();return(0,Xk.jsx)(ln,
ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Xk.jsx)("div",{className:"rounded-lg w-full h-full relative overflow-hidden shadow-xl tl-youtube-container",style:{pointerEvents:k||K.readOnly?"all":"none",userSelect:"none",background:`url('https://img.youtube.com/vi/${this.embedId}/mqdefault.jpg') no-repeat center/cover`},children:this.embedId?(0,Xk.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,Xk.jsx)("iframe",{className:"absolute inset-0 w-full h-full m-0",
width:"853",height:"480",src:`https://www.youtube.com/embed/${this.embedId}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Embedded youtube"})}):(0,Xk.jsx)("div",{className:"w-full h-full flex items-center justify-center p-4",style:{backgroundColor:"var(--ls-primary-background-color)"},children:(0,Xk.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 502 210.649",height:"210.65",width:"128",children:(0,Xk.jsxs)("g",
{children:[(0,Xk.jsx)("path",{d:"M498.333 45.7s-2.91-20.443-11.846-29.447C475.157 4.44 462.452 4.38 456.627 3.687c-41.7-3-104.25-3-104.25-3h-.13s-62.555 0-104.255 3c-5.826.693-18.523.753-29.86 12.566-8.933 9.004-11.84 29.447-11.84 29.447s-2.983 24.003-2.983 48.009v22.507c0 24.006 2.983 48.013 2.983 48.013s2.907 20.44 11.84 29.446c11.337 11.817 26.23 11.44 32.86 12.677 23.84 2.28 101.315 2.983 101.315 2.983s62.62-.094 104.32-3.093c5.824-.694 18.527-.75 29.857-12.567 8.936-9.006 11.846-29.446 11.846-29.446s2.98-24.007 2.98-48.013V93.709c0-24.006-2.98-48.01-2.98-48.01",
fill:"#cd201f"}),(0,Xk.jsx)("g",{children:(0,Xk.jsx)("path",{d:"M187.934 169.537h-18.96V158.56c-7.19 8.24-13.284 12.4-19.927 12.4-5.826 0-9.876-2.747-11.9-7.717-1.23-3.02-2.103-7.736-2.103-14.663V68.744h18.957v81.833c.443 2.796 1.636 3.823 4.043 3.823 3.63 0 6.913-3.153 10.93-8.817V68.744h18.96v100.793zM102.109 139.597c.996 9.98-2.1 14.93-7.987 14.93s-8.98-4.95-7.98-14.93v-39.92c-1-9.98 2.093-14.657 7.98-14.657 5.89 0 8.993 4.677 7.996 14.657l-.01 39.92zm18.96-37.923c0-10.77-2.164-18.86-5.987-23.95-5.054-6.897-12.973-9.72-20.96-9.72-9.033 0-15.913 2.823-20.957 9.72-3.886 5.09-5.97 13.266-5.97 24.036l-.016 35.84c0 10.71 1.853 18.11 5.736 23.153 5.047 6.873 13.227 10.513 21.207 10.513 7.986 0 16.306-3.64 21.36-10.513 3.823-5.043 5.586-12.443 5.586-23.153v-35.926zM46.223 114.647v54.889h-19.96v-54.89S5.582 47.358 1.314 34.815H22.27L36.277 87.38l13.936-52.566H71.17l-24.947 79.833z"})}),
(0,Xk.jsxs)("g",{fill:"#fff",children:[(0,Xk.jsx)("path",{d:"M440.413 96.647c0-9.33 2.557-11.874 8.59-11.874 5.99 0 8.374 2.777 8.374 11.997v10.893l-16.964.02V96.647zm35.96 25.986l-.003-20.4c0-10.656-2.1-18.456-5.88-23.5-5.06-6.823-12.253-10.436-21.317-10.436-9.226 0-16.42 3.613-21.643 10.436-3.84 5.044-6.076 13.28-6.076 23.943v34.927c0 10.596 2.46 18.013 6.296 23.003 5.227 6.813 12.42 10.216 21.87 10.216 9.44 0 16.853-3.566 21.85-10.81 2.2-3.196 3.616-6.82 4.226-10.823.164-1.81.64-5.933.64-11.753v-2.827h-18.96c0 7.247.037 11.557-.133 12.54-1.033 4.834-3.623 7.25-8.07 7.25-6.203 0-8.826-4.636-8.76-13.843v-17.923h35.96zM390.513 140.597c0 9.98-2.353 13.806-7.563 13.806-2.973 0-6.4-1.53-9.423-4.553l.02-60.523c3.02-2.98 6.43-4.55 9.403-4.55 5.21 0 7.563 2.93 7.563 12.91v42.91zm2.104-72.453c-6.647 0-13.253 4.087-19.09 11.27l.02-43.603h-17.963V169.54h17.963l.027-10.05c6.036 7.47 12.62 11.333 19.043 11.333 7.193 0 12.45-3.85 14.863-11.267 1.203-4.226 1.993-10.733 1.993-19.956V99.684c0-9.447-1.21-15.907-2.416-19.917-2.41-7.466-7.247-11.623-14.44-11.623M340.618 169.537h-18.956V158.56c-7.193 8.24-13.283 12.4-19.926 12.4-5.827 0-9.877-2.747-11.9-7.717-1.234-3.02-2.107-7.736-2.107-14.663V69.744h18.96v80.833c.443 2.796 1.633 3.823 4.043 3.823 3.63 0 6.913-3.153 10.93-8.817V69.744h18.957v99.793z"}),
(0,Xk.jsx)("path",{d:"M268.763 169.537h-19.956V54.77h-20.956V35.835l62.869-.024v18.96h-21.957v114.766z"})]})]})})})})}))}));gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Xk.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[0]*this.aspectRatio,1));return fn(this,a)})}get embedId(){var a,d;const k=this.props.url,
K=k.match(qu);return null!=(d=null!=(a=null==K?void 0:K[1])?a:k)?d:""}getShapeSVGJsx(){const a=this.getBounds(),d=this.embedId;return d?(0,Xk.jsxs)("g",{children:[(0,Xk.jsx)("image",{width:a.width,height:a.height,href:`https://img.youtube.com/vi/${d}/mqdefault.jpg`,className:"grayscale-[50%]"}),(0,Xk.jsx)("svg",{x:a.width/4,y:a.height/4,width:a.width/2,height:a.height/2,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Xk.jsx)("path",{d:"M4.76447 3.12199C5.63151 3.04859 6.56082 3 7.5 3C8.43918 3 9.36849 3.04859 10.2355 3.12199C11.2796 3.21037 11.9553 3.27008 12.472 3.39203C12.9425 3.50304 13.2048 3.64976 13.4306 3.88086C13.4553 3.90618 13.4902 3.94414 13.5133 3.97092C13.7126 4.20149 13.8435 4.4887 13.918 5.03283C13.9978 5.6156 14 6.37644 14 7.52493C14 8.66026 13.9978 9.41019 13.9181 9.98538C13.8439 10.5206 13.7137 10.8061 13.5125 11.0387C13.4896 11.0651 13.4541 11.1038 13.4296 11.1287C13.2009 11.3625 12.9406 11.5076 12.4818 11.6164C11.9752 11.7365 11.3143 11.7942 10.2878 11.8797C9.41948 11.9521 8.47566 12 7.5 12C6.52434 12 5.58052 11.9521 4.7122 11.8797C3.68572 11.7942 3.02477 11.7365 2.51816 11.6164C2.05936 11.5076 1.7991 11.3625 1.57037 11.1287C1.54593 11.1038 1.51035 11.0651 1.48748 11.0387C1.28628 10.8061 1.15612 10.5206 1.08193 9.98538C1.00221 9.41019 1 8.66026 1 7.52493C1 6.37644 1.00216 5.6156 1.082 5.03283C1.15654 4.4887 1.28744 4.20149 1.48666 3.97092C1.5098 3.94414 1.54468 3.90618 1.56942 3.88086C1.7952 3.64976 2.05752 3.50304 2.52796 3.39203C3.04473 3.27008 3.7204 3.21037 4.76447 3.12199ZM0 7.52493C0 5.28296 0 4.16198 0.729985 3.31713C0.766457 3.27491 0.815139 3.22194 0.854123 3.18204C1.63439 2.38339 2.64963 2.29744 4.68012 2.12555C5.56923 2.05028 6.52724 2 7.5 2C8.47276 2 9.43077 2.05028 10.3199 2.12555C12.3504 2.29744 13.3656 2.38339 14.1459 3.18204C14.1849 3.22194 14.2335 3.27491 14.27 3.31713C15 4.16198 15 5.28296 15 7.52493C15 9.74012 15 10.8477 14.2688 11.6929C14.2326 11.7348 14.1832 11.7885 14.1444 11.8281C13.3629 12.6269 12.3655 12.71 10.3709 12.8763C9.47971 12.9505 8.50782 13 7.5 13C6.49218 13 5.52028 12.9505 4.62915 12.8763C2.63446 12.71 1.63712 12.6269 0.855558 11.8281C0.816844 11.7885 0.767442 11.7348 0.731221 11.6929C0 10.8477 0 9.74012 0 7.52493ZM5.25 5.38264C5.25 5.20225 5.43522 5.08124 5.60041 5.15369L10.428 7.27105C10.6274 7.35853 10.6274 7.64147 10.428 7.72895L5.60041 9.84631C5.43522 9.91876 5.25 9.79775 5.25 9.61736V5.38264Z",
fill:"#D10014",fillRule:"evenodd",clipRule:"evenodd"})})]}):super.getShapeSVGJsx({})}},zp=Zv;gb(zp,"id","youtube");gb(zp,"defaultProps",{id:"youtube",type:"youtube",parentId:"page",point:[0,0],size:[853,480],url:""});fe([Dg],zp.prototype,"embedId",1);fe([jg],zp.prototype,"onYoutubeLinkChange",2);var wq=Kf(ca(19)),Xo=ca(589),$v=/https?:\/\/twitter.com\/[0-9a-zA-Z_]{1,20}\/status\/([0-9]*)/,Dy=class extends fm{constructor(){super(...arguments);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"initialHeightCalculated",
!0);gb(this,"getInnerHeight",null);gb(this,"onTwitterLinkChange",a=>{this.update({url:a,size:Dy.defaultProps.size})});gb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:k})=>{const {renderers:{Tweet:K}}=wq.useContext(ji),da=mg(),ja=wq.useRef(null),[,ra]=this.useComponentSize(ja);wq.useEffect(()=>{var Ja,Ra;const $a=null!=(Ra=null==(Ja=this.getInnerHeight)?void 0:Ja.call(this))?Ra:ra;ra&&1<Math.abs($a-this.props.size[1])&&(this.update({size:[this.props.size[0],$a]}),da.persist(!0))},[ra]);
wq.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();da.persist(!0)})},[this.initialHeightCalculated]);return(0,Xo.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Xo.jsx)("div",{className:"rounded-xl w-full h-full relative shadow-xl tl-tweet-container",style:{pointerEvents:k||da.readOnly?"all":"none",userSelect:"none"},children:this.embedId?(0,Xo.jsx)("div",{ref:ja,children:(0,Xo.jsx)(K,{tweetId:this.embedId})}):null})}))}));
gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Xo.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}));gb(this,"onResetBounds",a=>{a=this.getAutoResizeHeight();null!==a&&1<Math.abs(a-this.props.size[1])&&(this.update({size:[this.props.size[0],a]}),this.initialHeightCalculated=!0);return this});gb(this,"onResize",(a,d)=>{var k;const {bounds:K,rotation:da,scale:[ja,ra]}=d;a=[...this.scale];0>ja&&(a[0]*=-1);0>ra&&(a[1]*=
-1);d=null!=(k=this.getAutoResizeHeight())?k:K.height;return this.update({point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,d)],scale:a,rotation:da})});gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.min(Math.max(a.size[0],300),550),a.size[1]=Math.max(a.size[1],1));return fn(this,a)})}get embedId(){var a,d;const k=this.props.url,K=k.match($v);return null!=(d=null!=(a=null==K?void 0:K[1])?a:k)?d:""}useComponentSize(a,d=""){const [k,K]=wq.useState([0,0]),da=mg();wq.useEffect(()=>
{if(null==a?0:a.current){const ja=d?a.current.querySelector(d):a.current;if(ja){const ra=()=>{const {width:Ra,height:$a}=ja.getBoundingClientRect(),fb=be.div([Ra,$a],da.viewport.camera.zoom);K(fb);return fb};ra();this.getInnerHeight=()=>ra()[1];const Ja=new ResizeObserver(()=>{ra()});Ja.observe(ja);return()=>{Ja.disconnect()}}}return()=>{}},[a,d]);return k}getAutoResizeHeight(){return this.getInnerHeight?this.getInnerHeight():null}getShapeSVGJsx(){const a=this.getBounds();return this.embedId?(0,Xo.jsxs)("g",
{children:[(0,Xo.jsx)("rect",{width:a.width,height:a.height,fill:"#15202b",rx:8,ry:8}),(0,Xo.jsx)("svg",{x:a.width/4,y:a.height/4,width:a.width/2,height:a.height/2,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Xo.jsx)("path",{d:"m13.464 4.4401c0.0091 0.13224 0.0091 0.26447 0.0091 0.39793 0 4.0664-3.0957 8.7562-8.7562 8.7562v-0.0024c-1.6721 0.0024-3.3095-0.47658-4.7172-1.3797 0.24314 0.02925 0.48751 0.04387 0.73248 0.04448 1.3857 0.0013 2.7319-0.46374 3.8221-1.3199-1.3169-0.024981-2.4717-0.8836-2.8751-2.1371 0.4613 0.08897 0.93662 0.070688 1.3894-0.053016-1.4357-0.29007-2.4686-1.5515-2.4686-3.0165v-0.039001c0.42779 0.23827 0.90676 0.37051 1.3967 0.38513-1.3522-0.90372-1.769-2.7026-0.95247-4.1091 1.5625 1.9226 3.8678 3.0914 6.3425 3.2151-0.24802-1.0689 0.090798-2.1889 0.89031-2.9403 1.2395-1.1651 3.1889-1.1054 4.3541 0.13346 0.68921-0.13589 1.3498-0.38879 1.9543-0.74711-0.22974 0.71237-0.71054 1.3175-1.3528 1.702 0.60999-0.071907 1.206-0.23522 1.7672-0.48446-0.41316 0.61913-0.93358 1.1584-1.5356 1.5942z",
fill:"#1d9bf0",fillRule:"evenodd",clipRule:"evenodd"})})]}):super.getShapeSVGJsx({})}},Cr=Dy;gb(Cr,"id","tweet");gb(Cr,"defaultProps",{id:"tweet",type:"tweet",parentId:"page",point:[0,0],size:[331,290],url:""});fe([Dg],Cr.prototype,"embedId",1);fe([jg],Cr.prototype,"onTwitterLinkChange",2);var aw=Kf(ca(19)),ru=ca(589),uo=class extends fm{constructor(){super(...arguments);gb(this,"frameRef",aw.createRef());gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!0);gb(this,"ReactComponent",
ee(({events:a,asset:d,isErasing:k,isEditing:K})=>{aw.useRef(null);const {handlers:da}=aw.useContext(ji);mg();const ja=$r();return(0,ru.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:k?.2:1}},a),{children:d?(0,ru.jsx)("embed",{src:da?da.inflateAsset(d.src).url:d.src,className:"relative tl-pdf-container",onWheelCapture:stop,onPointerDown:stop,onPointerUp:stop,style:{width:"100%",height:"100%",pointerEvents:!ja&&K?"all":"none"}}):null}))}));gb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,
d],isLocked:k}}=this;return(0,ru.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}))}};gb(uo,"id","pdf");gb(uo,"defaultProps",{id:"pdf",type:"pdf",parentId:"page",point:[0,0],size:[595,842],assetId:""});ca(589);var bw=[wm,wr,sq,mu,vq,zr,ng,vn,Rl,zp,Cr,tq,qo,uo,Qj,Xv],Al=class extends kp{constructor(){super(...arguments);gb(this,"Shape",wm)}};gb(Al,"id","box");gb(Al,"shortcut","whiteboard/rectangle");var Dr=class extends kp{constructor(){super(...arguments);
gb(this,"Shape",wr)}};gb(Dr,"id","ellipse");gb(Dr,"shortcut","whiteboard/ellipse");var Sl=class extends $u{};gb(Sl,"id","erase");gb(Sl,"shortcut","whiteboard/eraser");var Ey=class extends xt{constructor(){super(...arguments);gb(this,"Shape",sq);gb(this,"simplify",!0);gb(this,"simplifyTolerance",.618)}};gb(Ey,"id","highlighter");gb(Ey,"shortcut","whiteboard/highlighter");var Bl=class extends av{constructor(){super(...arguments);gb(this,"Shape",zr)}};gb(Bl,"id","line");gb(Bl,"shortcut","whiteboard/connector");
var Wn=class extends xt{constructor(){super(...arguments);gb(this,"Shape",ng);gb(this,"simplify",!1)}};gb(Wn,"id","pencil");gb(Wn,"shortcut","whiteboard/pencil");var Fy=class extends kp{constructor(){super(...arguments);gb(this,"Shape",vn)}};gb(Fy,"id","polygon");var Gy=class extends bv{constructor(){super(...arguments);gb(this,"Shape",Rl)}};gb(Gy,"id","text");gb(Gy,"shortcut","whiteboard/text");var QC=class extends kp{constructor(){super(...arguments);gb(this,"Shape",zp)}};gb(QC,"id","youtube");
var wk=class extends Xh{constructor(){super(...arguments);gb(this,"creatingShape");gb(this,"offset",[0,0]);gb(this,"onEnter",()=>{this.app.history.pause();Gc(()=>{var a=be.sub(this.app.inputs.originPoint,this.offset);this.app.settings.snapToGrid&&(a=be.snap(a,8));this.creatingShape=a=new Qj({id:qk(),parentId:this.app.currentPage.id,point:a,size:Qj.defaultProps.size,fill:this.app.settings.color,stroke:this.app.settings.color});this.app.currentPage.addShapes(a);this.app.setEditingShape(a);this.app.setSelectedShapes([a])})});
gb(this,"onPointerDown",a=>{switch(a.type){case "shape":if(a.shape===this.creatingShape)break;this.app.selectTool("select");break;case "canvas":a.order||this.app.selectTool("select")}});gb(this,"onExit",()=>{var a;this.creatingShape&&(this.app.history.resume(),(null==(a=this.creatingShape)?0:a.props.pageId)?this.app.setSelectedShapes([this.creatingShape.id]):(this.app.deleteShapes([this.creatingShape.id]),this.app.setEditingShape()),this.creatingShape=void 0)})}};gb(wk,"id","creating");var Ap=class extends Xh{constructor(){super(...arguments);
gb(this,"cursor","crosshair");gb(this,"onPointerDown",a=>{this.tool.transition("creating")})}};gb(Ap,"id","idle");var gm=class extends Xp{constructor(){super(...arguments);gb(this,"Shape",Qj);gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])})}};gb(gm,"id","logseq-portal");gb(gm,"shortcut","whiteboard/portal");gb(gm,"states",[Ap,wk]);gb(gm,"initial","idle");var cw=class extends kp{constructor(){super(...arguments);gb(this,"Shape",qo)}};gb(cw,"id","youtube");var rh=class extends kp{constructor(){super(...arguments);
gb(this,"Shape",tq)}};gb(rh,"id","iframe");var yH=Kf(ca(592)),Xn=ca(589),RC=new Map(bw.map(a=>[a.id,a])),nh=class{constructor(a){gb(this,"shapes");gb(this,"pageId");gb(this,"assets");a&&this.load(a)}load(a){var d;const k=null==(d=null==a?void 0:a.pages)?void 0:d[0];this.pageId=null==k?void 0:k.id;this.assets=a.assets;this.shapes=null==k?void 0:k.shapes.map(K=>{var da=K.type;if(!da)throw Error("No shape type provided.");const ja=RC.get(da);if(!ja)throw Error(`Could not find shape class for ${da}`);
return new ja(K)}).filter(K=>"group"!==K.type)}generatePreviewJsx(a,d){var k,K;const da=[...(null!=(k=this.shapes)?k:[]).map($a=>$a.getRotatedBounds())];(k=null==a?void 0:a.currentView)&&da.push(k);let ja=sf.getCommonBounds(da);if(!ja)return null;ja=sf.expandBounds(ja,16);ja=d?sf.ensureRatio(ja,d):ja;const ra=$a=>[($a[0]-ja.minX).toFixed(2),($a[1]-ja.minY).toFixed(2)],[Ja,Ra]=k?ra([k.minX,k.minY]):[0,0];return ja&&(0,Xn.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg","data-common-bound-x":ja.minX.toFixed(2),
"data-common-bound-y":ja.minY.toFixed(2),"data-common-bound-width":ja.width.toFixed(2),"data-common-bound-height":ja.height.toFixed(2),viewBox:[0,0,ja.width,ja.height].join(" "),children:[(0,Xn.jsx)("defs",{children:k&&(0,Xn.jsxs)(Xn.Fragment,{children:[(0,Xn.jsx)("rect",{id:this.pageId+"-camera-rect",transform:`translate(${Ja}, ${Ra})`,width:k.width,height:k.height}),(0,Xn.jsxs)("mask",{id:this.pageId+"-camera-mask",children:[(0,Xn.jsx)("rect",{width:ja.width,height:ja.height,fill:"white"}),(0,Xn.jsx)("use",
{href:`#${this.pageId}-camera-rect`,fill:"black"})]})]})}),(0,Xn.jsx)("g",{id:this.pageId+"-preview-shapes",children:null==(K=this.shapes)?void 0:K.map($a=>{var fb,jb;const {bounds:Jb,props:{rotation:Ob}}=$a,[Kb,gc]=ra([Jb.minX,Jb.minY]),rc=+(180*((null!=Ob?Ob:0)+(null!=(fb=Jb.rotation)?fb:0))/Math.PI).toFixed(2),[Wb,kc]=[(Jb.width/2).toFixed(2),(Jb.height/2).toFixed(2)];return(0,Xn.jsx)("g",{transform:[`translate(${Kb}, ${gc})`,`rotate(${rc}, ${Wb}, ${kc})`].join(" "),children:$a.getShapeSVGJsx({assets:null!=
(jb=this.assets)?jb:[]})},$a.id)})}),(0,Xn.jsx)("rect",{mask:k?`url(#${this.pageId}-camera-mask)`:"",width:ja.width,height:ja.height,fill:"transparent"}),k&&(0,Xn.jsx)("use",{id:"minimap-camera-rect","data-x":Ja,"data-y":Ra,"data-width":k.width,"data-height":k.height,href:`#${this.pageId}-camera-rect`,fill:"transparent",stroke:"red",strokeWidth:4/a.camera.zoom})]})}exportAsSVG(a){return(a=this.generatePreviewJsx(void 0,a))?yH.default.renderToString(a):""}},Ts=Kf(ca(19)),wn=ca(589),vo=Ts.forwardRef((a,
d)=>{var {value:k,className:K}=a;a=Jf(a,["autoResize","value","className"]);return(0,wn.jsx)("div",{className:"tl-input"+(K?" "+K:""),children:(0,wn.jsxs)("div",{className:"tl-input-sizer",children:[(0,wn.jsx)("div",{className:"tl-input-hidden",children:k}),(0,wn.jsx)("input",Zd({ref:d,value:k,className:"tl-text-input",type:"text"},a))]})})}),Bh=ca(589),wo=({type:a,active:d})=>(0,Bh.jsx)("span",{className:"tl-type-tag","data-active":d,children:(0,Bh.jsx)("i",{className:`tie tie-${({B:"block",P:"page",
WP:"whiteboard",BA:"new-block",PA:"new-page",WA:"new-whiteboard",BS:"block-search",PS:"page-search"})[a]}`})}),SC=(a,d)=>(0,Bh.jsx)("span",{children:a.split(new RegExp(`(${d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$\x26")})`,"gi")).map((k,K)=>1===K%2?(0,Bh.jsx)("mark",{className:"tl-highlighted",children:k}):k).map((k,K)=>(0,Bh.jsx)(Pj.default.Fragment,{children:k},K))}),zH=(a,d)=>{const {handlers:k}=Pj.default.useContext(ji),[K,da]=Pj.default.useState(null),ja=ye(a,200);Pj.default.useEffect(()=>{let ra=
!1;if(0<ja.length){const Ja={"pages?":!0,"blocks?":!0,"files?":!1};"B"===d?Ja["pages?"]=!1:"P"===d&&(Ja["blocks?"]=!1);k.search(ja,Ja).then(Ra=>{ra||da(Ra)})}else da(null);return()=>{ra=!0}},[ja,null==k?void 0:k.search]);return K},Er=ee(({className:a,style:d,placeholder:k,onChange:K,onBlur:da,onAddBlock:ja})=>{const [ra,Ja]=Pj.default.useState(Qj.defaultSearchQuery),[Ra,$a]=Pj.default.useState(Qj.defaultSearchFilter),fb=Pj.default.useRef(null),{handlers:jb,renderers:Jb}=Pj.default.useContext(ji),
Ob=jb.t,Kb=Pj.default.useCallback(Sd=>{var De;setTimeout(()=>K(Sd));null==(De=fb.current)?void 0:De.blur();Sd&&(Qj.defaultSearchQuery="",Qj.defaultSearchFilter=null)},[]),gc=Pj.default.useCallback(Sd=>{if(Sd=null==jb?void 0:jb.addNewBlock(Sd))Kb(Sd),null==ja?void 0:ja(Sd);return Sd},[ja]),rc=Pj.default.useRef(null),[Wb,kc]=Pj.default.useState(0),hc=zH(ra,Ra),[Fc,Lc]=Pj.default.useState("circle-plus"),[ud,Jd]=Pj.default.useState(!1);Pj.default.useEffect(()=>{setTimeout(()=>{var Sd;null==(Sd=fb.current)?
void 0:Sd.focus()})},[Ra]);Pj.default.useEffect(()=>{Qj.defaultSearchQuery=ra;Qj.defaultSearchFilter=Ra},[ra,Ra]);const Ee=Pj.default.useMemo(()=>{var Sd;const De=[],gf=null==Jb?void 0:Jb.Breadcrumb;if(!gf||!jb)return[];ja&&De.push({actionIcon:"circle-plus",onChosen:()=>!!gc(ra),element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"BA"}),0<ra.length?(0,Bh.jsxs)(Bh.Fragment,{children:[(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-block")}),ra]}):
(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-block-no-colon")})]})});(null==(Sd=null==hc?void 0:hc.pages)?0:Sd.some(Te=>Te.toLowerCase()===ra.toLowerCase()))||!ra||De.push({actionIcon:"circle-plus",onChosen:()=>{Kb(ra);return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"PA"}),(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-page")}),ra]})},{actionIcon:"circle-plus",onChosen:()=>{null==jb?void 0:jb.addNewWhiteboard(ra);Kb(ra);return!0},
element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"WA"}),(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-whiteboard")}),ra]})});0===ra.length&&null===Ra&&De.push({actionIcon:"search",onChosen:()=>{$a("B");return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:"BS"}),Ob("whiteboard/search-only-blocks")]})},{actionIcon:"search",onChosen:()=>{$a("P");return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",
children:[(0,Bh.jsx)(wo,{type:"PS"}),Ob("whiteboard/search-only-pages")]})});Ra&&"P"!==Ra||!hc||!hc.pages||De.push(...hc.pages.map(Te=>({actionIcon:"search",onChosen:()=>{Kb(Te);return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:jb.isWhiteboardPage(Te)?"WP":"P"}),SC(Te,ra)]})})));Ra&&"B"!==Ra||!hc||!hc.blocks||De.push(...hc.blocks.filter(Te=>Te.content&&Te.uuid).map(({content:Te,uuid:df})=>{const Gd=jb.queryBlockByUUID(df);return{actionIcon:"search",
onChosen:()=>{var od,Dd,jd;return Gd?(Kb(df),null==(jd=null==(Dd=null==(od=window.logseq)?void 0:od.api)?void 0:Dd.set_blocks_id)?void 0:jd.call(Dd,[df]),!0):!1},element:Gd?(0,Bh.jsxs)(Bh.Fragment,{children:[(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:"B"}),(0,Bh.jsx)("div",{className:"tl-quick-search-option-breadcrumb",children:(0,Bh.jsx)(gf,{blockId:df})})]}),(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)("div",{className:"tl-quick-search-option-placeholder"}),
SC(Te,ra)]})]}):(0,Bh.jsx)("div",{className:"tl-quick-search-option-row",children:Ob("whiteboard/cache-outdated")})}}));return De},[ra,Ra,hc,null==Jb?void 0:Jb.Breadcrumb,jb]);Pj.default.useEffect(()=>{const Sd=De=>{var gf,Te;let df=Wb;"ArrowDown"===De.key?df=Math.min(Ee.length-1,Wb+1):"ArrowUp"===De.key?df=Math.max(0,Wb-1):"Enter"===De.key?(null==(gf=Ee[Wb])?void 0:gf.onChosen(),De.stopPropagation(),De.preventDefault()):"Backspace"===De.key&&0===ra.length?$a(null):"Escape"===De.key&&Kb("");df!==
Wb&&(gf=Ee[df],kc(df),Lc(gf.actionIcon),De.stopPropagation(),De.preventDefault(),(De=null==(Te=rc.current)?void 0:Te.querySelector(".tl-quick-search-option:nth-child("+(df+1)+")"))&&(null==De?void 0:De.scrollIntoViewIfNeeded(!1)))};document.addEventListener("keydown",Sd,!0);return()=>{document.removeEventListener("keydown",Sd,!0)}},[Ee,Wb,ra]);return(0,Bh.jsxs)("div",{className:"tl-quick-search "+(null!=a?a:""),style:d,children:[(0,Bh.jsx)(QG,{icon:Fc,onClick:()=>{var Sd;null==(Sd=Ee[Wb])?void 0:
Sd.onChosen()}}),(0,Bh.jsxs)("div",{className:"tl-quick-search-input-container",children:[Ra&&(0,Bh.jsxs)("div",{className:"tl-quick-search-input-filter",children:[(0,Bh.jsx)(wo,{type:Ra}),"B"===Ra?"Search blocks":"Search pages",(0,Bh.jsx)("div",{className:"tl-quick-search-input-filter-remove",onClick:()=>$a(null),children:(0,Bh.jsx)(Qg,{name:"x"})})]}),(0,Bh.jsx)(vo,{ref:fb,type:"text",value:ra,className:"tl-quick-search-input",placeholder:null!=k?k:"Create or search your graph...",onChange:Sd=>
Ja(Sd.target.value),onKeyDown:Sd=>{"Enter"===Sd.key&&Kb(ra);Sd.stopPropagation()},onFocus:()=>{Jd(!0)},onBlur:()=>{Jd(!1);null==da?void 0:da()}})]}),0<Ee.length&&(0,Bh.jsx)("div",{onWheelCapture:Sd=>Sd.stopPropagation(),className:"tl-quick-search-options",ref:rc,style:{visibility:ud?"visible":"hidden",pointerEvents:ud?"all":"none"},children:(0,Bh.jsx)(uy,{style:{height:40*Math.min(Math.max(1,Ee.length),12)},totalCount:Ee.length,itemContent:Sd=>{const {actionIcon:De,onChosen:gf,element:Te}=Ee[Sd];
return(0,Bh.jsx)("div",{"data-focused":Sd===Wb,className:"tl-quick-search-option",tabIndex:0,onMouseEnter:()=>{Lc(De);kc(Sd)},onPointerDownCapture:df=>{gf()&&(df.stopPropagation(),df.preventDefault())},children:Te},Sd)}})})]})}),Yh=ca(589),dw=ee(function(a){var {pageId:d,portalType:k,refs:K,side:da,onRefsChange:ja}=a;a=Jf(a,"pageId portalType shapeType refs side onRefsChange".split(" "));const {handlers:{t:ra}}=ky.default.useContext(ji),Ja=K.length+(d?1:0),Ra=0===K.length,$a=jb=>{jb&&!K.includes(jb)&&
Ra&&ja([...K,jb])},fb=!(!d||!k);return(0,Yh.jsx)(qm,ff(Zd({},a),{side:da,align:"start",alignOffset:-6,label:(0,Yh.jsx)(ce,{content:ra("whiteboard/link"),sideOffset:14,children:(0,Yh.jsxs)("div",{className:"flex gap-1 relative items-center justify-center px-1",children:[(0,Yh.jsx)(Qg,{name:0<Ja?"link":"add-link"}),0<Ja&&(0,Yh.jsx)("div",{className:"tl-shape-links-count",children:Ja})]})}),children:(0,Yh.jsxs)("div",{className:"color-level rounded-lg","data-show-reference-panel":fb,children:[fb&&(0,Yh.jsxs)("div",
{className:"tl-shape-links-reference-panel",children:[(0,Yh.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,Yh.jsx)(Qg,{className:"opacity-50",name:"internal-link"}),ra("whiteboard/references")]}),(0,Yh.jsx)(Nu,{type:k,id:d})]}),(0,Yh.jsxs)("div",{className:"tl-shape-links-panel color-level",children:[(0,Yh.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,Yh.jsx)(Qg,{className:"opacity-50",name:"add-link"}),ra("whiteboard/link-to-any-page-or-block")]}),
Ra&&(0,Yh.jsx)(Er,{style:{width:"calc(100% - 46px)",marginLeft:"46px"},placeholder:ra("whiteboard/start-typing-to-search"),onChange:$a}),0<K.length&&(0,Yh.jsx)("div",{className:"flex flex-col items-stretch gap-2",children:K.map((jb,Jb)=>(0,Yh.jsx)(Nu,{id:jb,type:Dj(jb)?"B":"P",onRemove:()=>{ja(K.filter((Ob,Kb)=>Jb!==Kb))},showContent:!0},jb))})]})]})}))}),yj=Kf(ca(19)),[su]=Gh("ToggleGroup",[pv]),tu=pv(),TC=yj.default.forwardRef((a,d)=>{const {type:k}=a;a=Jf(a,["type"]);if("single"===k)return yj.default.createElement(AH,
Oe({},a,{ref:d}));if("multiple"===k)return yj.default.createElement(BH,Oe({},a,{ref:d}));throw Error("Missing prop `type` expected on `ToggleGroup`");}),[Hy,xo]=su("ToggleGroup"),AH=yj.default.forwardRef((a,d)=>{const {value:k,defaultValue:K,onValueChange:da=()=>{}}=a,ja=Jf(a,["value","defaultValue","onValueChange"]),[ra,Ja]=Dc({prop:k,defaultProp:K,onChange:da});return yj.default.createElement(Hy,{scope:a.__scopeToggleGroup,type:"single",value:ra?[ra]:[],onItemActivate:Ja,onItemDeactivate:yj.default.useCallback(()=>
Ja(""),[Ja])},yj.default.createElement(VC,Oe({},ja,{ref:d})))}),BH=yj.default.forwardRef((a,d)=>{const {value:k,defaultValue:K,onValueChange:da=()=>{}}=a,ja=Jf(a,["value","defaultValue","onValueChange"]),[ra=[],Ja]=Dc({prop:k,defaultProp:K,onChange:da}),Ra=yj.default.useCallback(fb=>Ja((jb=[])=>[...jb,fb]),[Ja]),$a=yj.default.useCallback(fb=>Ja((jb=[])=>jb.filter(Jb=>Jb!==fb)),[Ja]);return yj.default.createElement(Hy,{scope:a.__scopeToggleGroup,type:"multiple",value:ra,onItemActivate:Ra,onItemDeactivate:$a},
yj.default.createElement(VC,Oe({},ja,{ref:d})))}),[CH,UC]=su("ToggleGroup"),VC=yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:k,disabled:K=!1,rovingFocus:da=!0,orientation:ja,dir:ra,loop:Ja=!0}=a;var Ra=Jf(a,"__scopeToggleGroup disabled rovingFocus orientation dir loop".split(" "));a=tu(k);const $a=pg(ra);Ra=Zd({role:"group",dir:$a},Ra);return yj.default.createElement(CH,{scope:k,rovingFocus:da,disabled:K},da?yj.default.createElement(CB,Oe({asChild:!0},a,{orientation:ja,dir:$a,loop:Ja}),
yj.default.createElement(rk.div,Oe({},Ra,{ref:d}))):yj.default.createElement(rk.div,Oe({},Ra,{ref:d})))}),uu=yj.default.forwardRef((a,d)=>{var k=xo("ToggleGroupItem",a.__scopeToggleGroup);const K=UC("ToggleGroupItem",a.__scopeToggleGroup),da=tu(a.__scopeToggleGroup);k=k.value.includes(a.value);const ja=K.disabled||a.disabled;a=ff(Zd({},a),{pressed:k,disabled:ja});const ra=yj.default.useRef(null);return K.rovingFocus?yj.default.createElement(DB,Oe({asChild:!0},da,{focusable:!ja,active:k,ref:ra}),yj.default.createElement(WC,
Oe({},a,{ref:d}))):yj.default.createElement(WC,Oe({},a,{ref:d}))}),WC=yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:k,value:K}=a,da=Jf(a,["__scopeToggleGroup","value"]),ja=xo("ToggleGroupItem",k);a={role:"radio","aria-checked":a.pressed,"aria-pressed":void 0};return yj.default.createElement(wB,Oe({},"single"===ja.type?a:void 0,da,{ref:d,onPressedChange:ra=>{if(ra)ja.onItemActivate(K);else ja.onItemDeactivate(K)}}))}),XC=TC,YC=uu,Bp=ca(589),Eh=ca(589),vu="EditPdf LogseqPortalViewMode Geometry AutoResizing Swatch NoFill StrokeType ScaleLevel TextStyle YoutubeLink TwitterLink IFrameSource ArrowMode Links".split(" "),
ZC=["YoutubeLink","TwitterLink","IFrameSource","Links","EditPdf"],zm=new Map,Iy={"logseq-portal":["Swatch","LogseqPortalViewMode","ScaleLevel","AutoResizing","Links"],youtube:["YoutubeLink","Links"],tweet:["TwitterLink","Links"],iframe:["IFrameSource","Links"],box:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),ellipse:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),polygon:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),
line:["TextStyle","Swatch","ScaleLevel","ArrowMode","Links"],pencil:["Swatch","Links","ScaleLevel"],highlighter:["Swatch","Links","ScaleLevel"],text:["TextStyle","Swatch","ScaleLevel","AutoResizing","Links"],html:["ScaleLevel","AutoResizing","Links"],image:["Links"],video:["Links"],pdf:["EditPdf","Links"]},DH=Object.entries(Iy).filter(([,a])=>a.includes("NoFill")&&a.includes("Swatch")).map(([a])=>a),EH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("AutoResizing"),K=k.every(da=>
da.props.isAutoResizing);return(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/auto-resize"),toggle:k.every(da=>"logseq-portal"===da.props.type),className:"tl-button",pressed:K,onPressedChange:da=>{k.forEach(ja=>{if("logseq-portal"===ja.props.type)ja.update({isAutoResizing:da});else ja.onResetBounds({zoom:a.viewport.camera.zoom})});a.persist()},children:(0,Eh.jsx)(Qg,{name:"dimensions"})})}),FH=ee(()=>{const a=mg();var {handlers:{t:d}}=Wk.default.useContext(ji);const k=Za("LogseqPortalViewMode"),K=k.every(da=>
da.collapsed);if(!K&&!k.every(da=>!da.collapsed))return null;d=(0,Eh.jsxs)("div",{className:"flex",children:[K?d("whiteboard/expand"):d("whiteboard/collapse"),(0,Eh.jsx)(hl,{action:K?"editor/expand-block-children":"editor/collapse-block-children"})]});return(0,Eh.jsx)(Ne,{tooltip:d,toggle:k.every(da=>"logseq-portal"===da.props.type),className:"tl-button",pressed:K,onPressedChange:()=>a.api.setCollapsed(!K),children:(0,Eh.jsx)(Qg,{name:K?"object-expanded":"object-compact"})})}),GH=ee(()=>{const {handlers:{isMobile:a}}=
Wk.default.useContext(ji);var d=Za("ScaleLevel");d=1<(new Set(d.map(k=>k.scaleLevel))).size?"":d[0].scaleLevel;return(0,Eh.jsx)(Jr,{scaleLevel:d,compact:a()})}),HH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("IFrameSource")[0],K=Wk.default.useCallback(ja=>{k.onIFrameSourceChange(ja.target.value.trim().toLowerCase());a.persist()},[]),da=Wk.default.useCallback(()=>{k.reload()},[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/reload"),
type:"button",onClick:da,children:(0,Eh.jsx)(Qg,{name:"refresh"})}),(0,Eh.jsx)(vo,{title:d("whiteboard/website-url"),className:"tl-iframe-src",value:`${k.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-website-url"),type:"button",onClick:()=>window.open(k.props.url),children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),Yo=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("YoutubeLink")[0],K=Wk.default.useCallback(da=>{k.onYoutubeLinkChange(da.target.value);a.persist()},
[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(vo,{title:d("whiteboard/youtube-url"),className:"tl-youtube-link",value:`${k.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-youtube-url"),type:"button",onClick:()=>{var da,ja,ra;return null==(ra=null==(ja=null==(da=window.logseq)?void 0:da.api)?void 0:ja.open_external_link)?void 0:ra.call(ja,k.props.url)},children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),IH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),
k=Za("TwitterLink")[0],K=Wk.default.useCallback(da=>{k.onTwitterLinkChange(da.target.value);a.persist()},[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(vo,{title:d("whiteboard/twitter-url"),className:"tl-twitter-link",value:`${k.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-twitter-url"),type:"button",onClick:()=>{var da,ja,ra;return null==(ra=null==(ja=null==(da=window.logseq)?void 0:da.api)?void 0:ja.open_external_link)?void 0:ra.call(ja,k.props.url)},
children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),JH=ee(()=>{const a=mg(),{handlers:{t:d,setCurrentPdf:k}}=Wk.default.useContext(ji),K=a.selectedShapesArray[0];return(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/edit-pdf"),type:"button",onClick:()=>k(a.assets[K.props.assetId].src),children:(0,Eh.jsx)(Qg,{name:"edit"})})}),KH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji);var k=Za("NoFill");const K=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>ja.update({noFill:da}));a.persist()},
[]);k=k.every(da=>da.props.noFill);return(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/fill"),className:"tl-button",pressed:k,onPressedChange:K,children:(0,Eh.jsx)(Qg,{name:k?"droplet-off":"droplet"})})}),LH=ee(()=>{const a=mg(),d=Za("Swatch"),k=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>{ja.update({fill:da,stroke:da})});a.persist()},[]),K=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>{ja.update({opacity:da})});a.persist()},[]);return(0,Eh.jsx)(km,{popoverSide:"top",color:d[0].props.noFill?
d[0].props.stroke:d[0].props.fill,opacity:d[0].props.opacity,setOpacity:K,setColor:k})}),MH=ee(()=>{const a=mg(),d=Wk.default.useCallback(k=>{a.api.convertShapes(k.currentTarget.dataset.tool)},[]);return(0,Eh.jsx)(Wx,{popoverSide:"top",chevron:!1,setGeometry:d})}),NH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("StrokeType"),K=k.every(da=>"dashed"===da.props.strokeType)?"dashed":k.every(da=>"line"===da.props.strokeType)?"line":"mixed";return(0,Eh.jsx)(ha,{title:d("whiteboard/stroke-type"),
options:[{value:"line",icon:"circle",tooltip:"Solid"},{value:"dashed",icon:"circle-dashed",tooltip:"Dashed"}],value:K,onValueChange:da=>{k.forEach(ja=>{ja.update({strokeType:da})});a.persist()}})}),$C=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("ArrowMode");var K=k.every(ja=>{var ra;return"arrow"===(null==(ra=ja.props.decorations)?void 0:ra.start)});const da=k.every(ja=>{var ra;return"arrow"===(null==(ra=ja.props.decorations)?void 0:ra.end)});K=[K?"start":null,da?"end":null].filter(cg);
return(0,Eh.jsx)(Aa,{title:d("whiteboard/arrow-head"),options:[{value:"start",icon:"arrow-narrow-left"},{value:"end",icon:"arrow-narrow-right"}],value:K,onValueChange:ja=>{k.forEach(ra=>{var Ja=ra.update;var Ra={start:ja.includes("start")?"arrow":null,end:ja.includes("end")?"arrow":null};Ja.call(ra,{decorations:Ra})});a.persist()}})}),OH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),k=Za("TextStyle"),K=k.every(ja=>500<ja.props.fontWeight),da=k.every(ja=>ja.props.italic);return(0,Eh.jsxs)("span",
{className:"flex gap-1",children:[(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/bold"),className:"tl-button",pressed:K,onPressedChange:ja=>{k.forEach(ra=>{ra.update({fontWeight:ja?700:400});ra.onResetBounds()});a.persist()},children:(0,Eh.jsx)(Qg,{name:"bold"})}),(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/italic"),className:"tl-button",pressed:da,onPressedChange:ja=>{k.forEach(ra=>{ra.update({italic:ja});ra.onResetBounds()});a.persist()},children:(0,Eh.jsx)(Qg,{name:"italic"})})]})}),PH=ee(()=>{var a;const d=mg(),
k=d.selectedShapesArray[0];return(0,Eh.jsx)(dw,{onRefsChange:K=>{k.update({refs:K});d.persist()},refs:null!=(a=k.props.refs)?a:[],shapeType:k.props.type,side:"right",pageId:"logseq-portal"===k.props.type?k.props.pageId:void 0,portalType:"logseq-portal"===k.props.type?k.props.blockType:void 0})});zm.set("Geometry",MH);zm.set("AutoResizing",EH);zm.set("LogseqPortalViewMode",FH);zm.set("ScaleLevel",GH);zm.set("YoutubeLink",Yo);zm.set("TwitterLink",IH);zm.set("IFrameSource",HH);zm.set("NoFill",KH);zm.set("Swatch",
LH);zm.set("StrokeType",NH);zm.set("ArrowMode",$C);zm.set("TextStyle",OH);zm.set("Links",PH);zm.set("EditPdf",JH);var aD=a=>{var d;return(null!=(d=Iy[a])?d:[]).filter(cg)},bD=a=>{const d=a.map(K=>K.props.type),k=new Set(0<a.length?aD(d[0]):[]);for(let K=1;K<d.length&&0<k.size;K++){const da=aD(d[K]);k.forEach(ja=>{da.includes(ja)||k.delete(ja)})}1<a.length&&ZC.forEach(K=>{k.has(K)&&k.delete(K)});return Array.from(k).sort((K,da)=>vu.indexOf(K)-vu.indexOf(da)).map(K=>zm.get(K))},wu=ca(589),QH=ee(({shapes:a,
offsets:d,hidden:k})=>{const K=mg(),da=sn.useRef(null),ja=sn.useRef(null);sn.useLayoutEffect(()=>{setTimeout(()=>{const Ja=ja.current;if(Ja){var {offsetWidth:Ra,offsetHeight:$a}=Ja;da.current=[Ra,$a]}})});sn.useLayoutEffect(()=>{var Ja;const Ra=ja.current;if(Ra){var $a=null!=(Ja=da.current)?Ja:[0,0];Ja=0;if(116>d.top){var fb=d.height/2+40;140>d.bottom&&(fb+=d.bottom-140)}else fb=-(d.height/2+40);16>d.left+d.width/2-$a[0]/2?Ja+=-(d.left+d.width/2-$a[0]/2-16):16>d.right+d.width/2-$a[0]/2&&(Ja+=d.right+
d.width/2-$a[0]/2-16);var [jb,Jb]=[Ja,fb];Ra.style.transform=`translateX(${jb}px) translateY(${Jb}px)`}},[d]);if(!K)return null;const ra=bD(a);return(0,wu.jsx)(ln,{centered:!0,children:0<ra.length&&(0,wu.jsx)("div",{ref:ja,className:"tl-toolbar tl-context-bar",style:{visibility:k?"hidden":"visible",pointerEvents:k?"none":"all"},children:ra.map((Ja,Ra)=>(0,wu.jsxs)(sn.Fragment,{children:[(0,wu.jsx)(Ja,{}),Ra<ra.length-1&&(0,wu.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"})]},Ra))})})}),
ew=Kf(ca(19)),vf=ca(589),Vi=window.LSUI,cD=ee(function({children:a,collisionRef:d}){var k,K,da,ja,ra,Ja,Ra,$a,fb,jb,Jb,Ob,Kb,gc,rc,Wb,kc;const hc=mg(),{handlers:Fc}=ew.useContext(ji),Lc=Fc.t,ud=ew.useRef(null),Jd=Sd=>{Sd();hc.transition("select")},Ee=ew.useMemo(()=>wf(),[]);return(0,vf.jsxs)(Vi.ContextMenu,{onOpenChange:Sd=>{Sd&&!hc.isIn("select.contextMenu")?hc.transition("select").selectedTool.transition("contextMenu"):!Sd&&hc.isIn("select.contextMenu")&&hc.selectedTool.transition("idle")},children:[(0,vf.jsx)(Vi.ContextMenuTrigger,
{disabled:hc.editingShape&&0!==Object.keys(hc.editingShape).length,children:a}),(0,vf.jsx)(Vi.ContextMenuContent,{className:"tl-menu tl-context-menu",ref:ud,onEscapeKeyDown:()=>hc.transition("select"),collisionBoundary:d.current,asChild:!0,tabIndex:-1,children:(0,vf.jsxs)("div",{children:[1<(null==(k=hc.selectedShapes)?void 0:k.size)&&!hc.readOnly&&(null==(K=hc.selectedShapesArray)?void 0:K.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-button-row-wrap",
children:[(0,vf.jsxs)("div",{className:"tl-menu-button-row pb-0",children:[(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-left"),onClick:()=>Jd(()=>hc.align("left")),children:(0,vf.jsx)(Qg,{name:"layout-align-left"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-center-horizontally"),onClick:()=>Jd(()=>hc.align("centerHorizontal")),children:(0,vf.jsx)(Qg,{name:"layout-align-center"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-right"),onClick:()=>Jd(()=>hc.align("right")),children:(0,vf.jsx)(Qg,{name:"layout-align-right"})}),
(0,vf.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/distribute-horizontally"),onClick:()=>Jd(()=>hc.distribute("horizontal")),children:(0,vf.jsx)(Qg,{name:"layout-distribute-vertical"})})]}),(0,vf.jsxs)("div",{className:"tl-menu-button-row pt-0",children:[(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-top"),onClick:()=>Jd(()=>hc.align("top")),children:(0,vf.jsx)(Qg,{name:"layout-align-top"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-center-vertically"),
onClick:()=>Jd(()=>hc.align("centerVertical")),children:(0,vf.jsx)(Qg,{name:"layout-align-middle"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-bottom"),onClick:()=>Jd(()=>hc.align("bottom")),children:(0,vf.jsx)(Qg,{name:"layout-align-bottom"})}),(0,vf.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/distribute-vertically"),onClick:()=>Jd(()=>hc.distribute("vertical")),children:(0,vf.jsx)(Qg,{name:"layout-distribute-horizontal"})})]})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,
{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.packIntoRectangle),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"layout-grid"}),Lc("whiteboard/pack-into-rectangle")]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),0<(null==(da=hc.selectedShapes)?void 0:da.size)&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.zoomToSelection),children:[(0,vf.jsx)(Qg,
{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/zoom-to-fit"),(0,vf.jsx)(hl,{action:"whiteboard/zoom-to-fit"})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),(hc.selectedShapesArray.some(Sd=>"group"===Sd.type||hc.getParentGroup(Sd))||1<hc.selectedShapesArray.length)&&(null==(ja=hc.selectedShapesArray)?void 0:ja.some(Sd=>!Sd.props.isLocked))&&!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[hc.selectedShapesArray.some(Sd=>"group"===Sd.type||hc.getParentGroup(Sd))&&
(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.unGroup),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"ungroup"}),Lc("whiteboard/ungroup"),(0,vf.jsx)(hl,{action:"whiteboard/ungroup"})]}),1<hc.selectedShapesArray.length&&(null==(ra=hc.selectedShapesArray)?void 0:ra.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.doGroup),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"group"}),Lc("whiteboard/group"),
(0,vf.jsx)(hl,{action:"whiteboard/group"})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),0<(null==(Ja=hc.selectedShapes)?void 0:Ja.size)&&(null==(Ra=hc.selectedShapesArray)?void 0:Ra.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.cut),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"cut"}),Lc("whiteboard/cut")]}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(hc.copy),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"copy"}),Lc("whiteboard/copy"),(0,vf.jsx)(hl,{action:"editor/copy"})]})]}),!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.paste),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"clipboard"}),Lc("whiteboard/paste"),(0,vf.jsx)(hl,{shortcut:`${gA}+v`})]}),1===(null==($a=hc.selectedShapes)?void 0:$a.size)&&!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(()=>hc.paste(void 0,!0)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/paste-as-link"),(0,vf.jsx)(hl,{shortcut:`${gA}+\u21E7+v`})]}),0<(null==(fb=hc.selectedShapes)?void 0:fb.size)&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(()=>{var Sd,De;return Fc.exportToImage(hc.currentPageId,{x:hc.selectionBounds.minX+hc.viewport.camera.point[0]-
8,y:hc.selectionBounds.minY+hc.viewport.camera.point[1]-8,width:(null==(Sd=hc.selectionBounds)?void 0:Sd.width)+16,height:(null==(De=hc.selectionBounds)?void 0:De.height)+16,zoom:hc.viewport.camera.zoom})}),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"file-export"}),Lc("whiteboard/export"),(0,vf.jsx)("div",{className:"tl-menu-right-slot",children:(0,vf.jsx)("span",{className:"keyboard-shortcut"})})]})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,
{className:"tl-menu-item",onClick:()=>Jd(hc.api.selectAll),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/select-all"),(0,vf.jsx)(hl,{action:"editor/select-parent"})]}),1<(null==(jb=hc.selectedShapes)?void 0:jb.size)&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.deselectAll),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/deselect-all")]}),!hc.readOnly&&0<(null==(Jb=hc.selectedShapes)?
void 0:Jb.size)&&(null==(Ob=hc.selectedShapesArray)?void 0:Ob.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(()=>hc.setLocked(!0)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"lock"}),Lc("whiteboard/lock"),(0,vf.jsx)(hl,{action:"whiteboard/lock"})]}),!hc.readOnly&&0<(null==(Kb=hc.selectedShapes)?void 0:Kb.size)&&(null==(gc=hc.selectedShapesArray)?void 0:gc.some(Sd=>Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(()=>hc.setLocked(!1)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"lock-open"}),Lc("whiteboard/unlock"),(0,vf.jsx)(hl,{action:"whiteboard/unlock"})]}),0<(null==(rc=hc.selectedShapes)?void 0:rc.size)&&!hc.readOnly&&(null==(Wb=hc.selectedShapesArray)?void 0:Wb.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.deleteShapes),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"backspace"}),
Lc("whiteboard/delete"),(0,vf.jsx)(hl,{action:"editor/delete"})]}),1<(null==(kc=hc.selectedShapes)?void 0:kc.size)&&!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.flipHorizontal),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"flip-horizontal"}),Lc("whiteboard/flip-horizontally")]}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>
Jd(hc.flipVertical),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"flip-vertical"}),Lc("whiteboard/flip-vertically")]})]}),!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.bringToFront),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/move-to-front"),(0,vf.jsx)(hl,{action:"whiteboard/bring-to-front"})]}),(0,vf.jsxs)(Vi.ContextMenuItem,
{className:"tl-menu-item",onClick:()=>Jd(hc.sendToBack),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/move-to-back"),(0,vf.jsx)(hl,{action:"whiteboard/send-to-back"})]})]}),Ee&&(0,vf.jsx)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>{1===hc.selectedShapesArray.length?console.log(jc(hc.selectedShapesArray[0].serialized)):console.log(hc.selectedShapesArray.map(Sd=>jc(Sd.serialized)))},children:Lc("whiteboard/dev-print-shape-props")})]})]})})]})}),
Jy=Kf(ca(19)),Fr=ca(589),xu=ee(({shape:a})=>{const d=mg(),{handlers:k}=Jy.default.useContext(ji),K=k.t,da=Jy.default.useMemo(()=>{var ja;const ra=[...(null!=(ja=a.props.refs)?ja:[])].map(Ja=>[Ja,!0]);"logseq-portal"===a.props.type&&a.props.pageId&&ra.unshift([a.props.pageId,!1]);return ra.filter(Ja=>Ja[0].toLowerCase()!==d.currentPage.name&&k.getBlockPageName(Ja[0])!==d.currentPage.name)},[a.props.id,a.props.type,a.props.parentId,a.props.refs]);return 0===da.length?null:(0,Fr.jsx)("div",{className:"tl-quick-links",
title:K("whiteboard/shape-quick-links"),children:da.map(([ja,ra])=>(0,Fr.jsx)("div",{className:"tl-quick-links-row",children:(0,Fr.jsx)(ly,{id:ja,showReferenceContent:ra})},ja))})}),Ky=Kf(ca(19)),fw=Kf(ca(19)),dD={image:[".png",".svg",".jpg",".jpeg",".gif"],video:[".mp4",".webm",".ogg"],pdf:[".pdf"]},RH=(a,d,k)=>Oh(void 0,[a,d,k],function*(K,{point:da,shiftKey:ja,dataTransfer:ra,fromDrop:Ja},Ra){function $a(jd,Cd){return Oh(this,null,function*(){const Me=Object.values(K.assets).find(af=>af.src===
jd);return Me?Me:{id:qk(),type:Cd,src:jd,size:yield lj(Ra.makeAssetUrl(jd),Cd)}})}function fb(jd){return Oh(this,null,function*(){const Cd=jd.filter(Me=>"unknown"!==Rb(Me.name)).map(Me=>Oh(this,null,function*(){try{const af=yield Ra.saveAsset(Me);return yield $a(af,Rb(Me.name))}catch(af){console.error(af)}return null}));return(yield Promise.all(Cd)).filter(cg)})}function jb(jd){return[ff(Zd({},qo.defaultProps),{html:jd,point:[da[0],da[1]]})]}function Jb(jd){return Oh(this,null,function*(){return tc(Kb,
gc,kc,Wb,hc,rc,Ee)(jd)})}function Ob(){return Oh(this,null,function*(){const jd=yield navigator.clipboard.read(),Cd=tc(hc,rc,Ee);return(yield Promise.all(jd.map(Me=>Cd(Me)))).flat().filter(cg)})}function Kb(jd){return Oh(this,null,function*(){var Cd=jd.getData("file");if(!Cd)return null;const Me=yield $a(Cd,"pdf");K.addAssets([Me]);Cd=ff(Zd({},uo.defaultProps),{id:qk(),assetId:Me.id,url:Cd,opacity:1});Me.size&&Object.assign(Cd,{point:[da[0]-Me.size[0]/4+16,da[1]-Me.size[1]/4+16],size:be.div(Me.size,
2)});return[Cd]})}function gc(jd){return Oh(this,null,function*(){var Cd=Array.from(jd.files);return 0<Cd.length?(gf=Cd=yield fb(Cd),Cd.map((Me,af)=>{switch(Me.type){case "video":var Nf=vq.defaultProps;break;case "image":Nf=mu.defaultProps;break;case "pdf":Nf=uo.defaultProps;break;default:return null}Nf=ff(Zd({},Nf),{id:qk(),assetId:Me.id,opacity:1});Me.size&&Object.assign(Nf,{point:[da[0]-Me.size[0]/4+16*af,da[1]-Me.size[1]/4+16*af],size:be.div(Me.size,2)});return Nf})):null})}function rc(jd){return Oh(this,
null,function*(){if(jd.types.includes("text/plain")&&(ja||Ja))return null;const Cd=yield Kc(jd,"text/html");return Cd?tc(Fc,jb)(Cd):null})}function Wb(jd){return Oh(this,null,function*(){var Cd,Me,af,Nf,bg,ef,Eg=jd.getData("block-uuid");if(Eg){Eg=Eg.trim();const yf=null==(af=null==(Me=null==(Cd=window.logseq)?void 0:Cd.api)?void 0:Me.get_selected_blocks)?void 0:af.call(Me);Cd=yf&&1<(null==yf?void 0:yf.length)?yf.map(Fg=>Fg.uuid):[Eg];null==(ef=null==(bg=null==(Nf=window.logseq)?void 0:Nf.api)?void 0:
bg.set_blocks_id)?void 0:ef.call(bg,Cd);Nf=Cd.map(Fg=>Jd(`((${Fg}))`));return(yield Promise.all(Nf)).flat().filter(cg).map((Fg,Gg)=>ff(Zd({},Fg),{point:[da[0]+(Qj.defaultProps.size[0]+16)*Gg,da[1]]}))}return null})}function kc(jd){return Oh(this,null,function*(){var Cd=jd.getData("page-name");return Cd?(Cd=Cd.trim(),Jd(`[[${Cd}]]`)):null})}function hc(jd){return Oh(this,null,function*(){var Cd=yield Kc(jd,"text/plain");return Cd?(Cd=Cd.trim(),tc(Lc,ud)(Cd)):null})}function Fc(jd){if(jd=K.api.getClonedShapesFromTldrString(decodeURIComponent(jd),
da)){const {shapes:Cd,assets:Me,bindings:af}=jd;Te.push(...Me);df.push(...af);return Cd}return null}function Lc(jd){return Oh(this,null,function*(){try{const Me=new URL(jd);var Cd=Me.host&&["http:","https:"].includes(Me.protocol)}catch(Me){Cd=!1}return Cd&&!ja?qu.test(jd)?[ff(Zd({},zp.defaultProps),{url:jd,point:[da[0],da[1]]})]:$v.test(jd)?[ff(Zd({},Cr.defaultProps),{url:jd,point:[da[0],da[1]]})]:[ff(Zd({},tq.defaultProps),{url:jd,point:[da[0],da[1]]})]:null})}function ud(jd){return jd.startsWith("\x3ciframe")?
[ff(Zd({},qo.defaultProps),{html:jd,point:[da[0],da[1]]})]:null}function Jd(jd){return Oh(this,null,function*(){if(/^\(\(.*\)\)$/.test(jd)&&40===jd.length){var Cd=jd.slice(2,-2);if(Dj(Cd))return[ff(Zd({},Qj.defaultProps),{point:[da[0],da[1]],size:[400,0],pageId:Cd,fill:K.settings.color,stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"B"})]}else if(/^\[\[.*\]\]$/.test(jd))return Cd=jd.slice(2,-2),[ff(Zd({},Qj.defaultProps),{point:[da[0],da[1]],size:[400,0],pageId:Cd,fill:K.settings.color,
stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"P"})];return null})}function Ee(jd){return Oh(this,null,function*(){var Cd=yield Kc(jd,"text/plain");return Cd&&(Cd=Cd.trim(),Cd=null==Ra?void 0:Ra.addNewBlock(Cd))?[ff(Zd({},Qj.defaultProps),{size:[400,0],point:[da[0],da[1]],pageId:Cd,fill:K.settings.color,stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"B",compact:!0})]:null})}var Sd,De;let gf=[],Te=[];const df=[];K.cursors.setCursor("progress");let Gd=[];try{ra?
Gd.push(...(null!=(Sd=yield Jb(ra))?Sd:[])):Gd.push(...(null!=(De=yield Ob())?De:[]))}catch(jd){console.error(jd)}const od=Gd.map(jd=>ff(Zd({},jd),{parentId:K.currentPageId,isLocked:!1,id:Dj(jd.id)?jd.id:qk()})),Dd=null==ra?void 0:ra.types.every(jd=>"Files"===jd);K.wrapUpdate(()=>{var jd=[...gf,...Te];0<jd.length&&K.createAssets(jd);0<od.length&&K.createShapes(od);K.currentPage.updateBindings(Object.fromEntries(df.map(Cd=>[Cd.id,Cd])));if(1===K.selectedShapesArray.length&&1===od.length&&Ja){jd=K.selectedShapesArray[0];
const Cd=K.getShapeById(od[0].id);K.createNewLineBinding(jd,Cd)}K.setSelectedShapes(od.map(Cd=>Cd.id));K.selectedTool.transition("idle");K.cursors.setCursor("default");(Ja||Dd)&&K.packIntoRectangle()})}),Ly=Kf(ca(19)),xq=Kf(ca(19)),Tl=ca(589),eD=[Al,Dr,Fy,Sl,Ey,Bl,Wn,Gy,QC,rh,cw,gm],fD=a=>{const {renderers:d}=ps.useContext(ji);return(0,Tl.jsx)(d.BacklinksCount,ff(Zd({},a),{options:{"portal?":!1}}))},SH=()=>{const a=ps.useRef(null),d=mg(),k=ps.useMemo(()=>({ContextBar:QH,BacklinksCount:fD,QuickLinks:xu}),
[]);return(0,Tl.jsx)(cD,{collisionRef:a,children:(0,Tl.jsx)("div",{ref:a,className:"logseq-tldraw logseq-tldraw-wrapper","data-tlapp":d.uuid,children:(0,Tl.jsx)(XF,{components:k,children:(0,Tl.jsx)(nC,{})})})})},TH=a=>{var {onPersist:d,readOnly:k,model:K}=a;a=Jf(a,["onPersist","readOnly","model"]);const da=Md(),ja=xd(),ra=de(),Ja=k?null:Be(),Ra=ps.useCallback(($a,fb)=>{null==d?void 0:d($a,fb)},[K]);return(0,Tl.jsx)(TF,ff(Zd({Shapes:bw,Tools:eD,onDrop:da,onPaste:ja,onCopy:ra,readOnly:k,onCanvasDBClick:Ja,
onPersist:Ra,model:K},a),{children:(0,Tl.jsx)(SH,{})}))},Cp=function(a){var {renderers:d,handlers:k}=a;a=Jf(a,["renderers","handlers"]);const K={renderers:ps.useMemo(()=>Object.fromEntries(Object.entries(d).map(([da,ja])=>[da,ps.memo(ja)])),[]),handlers:k};return(0,Tl.jsx)(ji.Provider,{value:K,children:(0,Tl.jsx)(TH,Zd({},a))})}};
'use strict';var QCd=function(a){return a},RCd=function(a,b){return $APP.Vh.j(function(c){var d=$APP.Jf(c);c=$APP.G.j(d,$APP.EA);d=$APP.G.j(d,$APP.mD);return new $APP.l(null,2,[$APP.Hl,$APP.t.A(c),$APP.FPb,$APP.Vw.j(d,new $APP.N(null,2,5,$APP.O,[$APP.RB,$APP.FPb],null))],null)},$APP.qg.j(function(c){return $APP.RB.A($APP.mD.A(c))},$APP.oN.C(a,b,new $APP.l(null,1,[$APP.ls,new $APP.N(null,2,5,$APP.O,[$APP.EA,$APP.mD],null)],null))))},SCd=function(a){return $APP.Np.F(a,$APP.F([$APP.Op,!0]))},TCd=function(a,
b,c,d){var e=$APP.eE(a);b=new $APP.l(null,2,[$APP.SB,$APP.Iqb,$APP.UB,new $APP.l(null,6,[$APP.Hl,$APP.qa(b,"id"),$APP.qp,$APP.qa(b,"name"),$APP.SE,SCd($APP.qa(b,"bindings")),$APP.FPb,$APP.qa(b,"nonce"),$APP.GPb,SCd(c),$APP.CPb,d],null)],null);c=$APP.tv();e=$APP.uE.A(e);e=$APP.m(e)?e:$APP.tv();return new $APP.l(null,5,[$APP.uq,a,$APP.KD,"whiteboard",$APP.mD,b,$APP.vE,c,$APP.uE,e],null)},UCd=function(a,b,c,d,e,f){a=SCd(a.getCleanUpAssets());var g=b.shapes,h=$APP.Vh.j(function(E){return $APP.qa(E,"id")},
g),n=$APP.Ch(h,$APP.Pj.A(g.length));g=$APP.zh($APP.Vh.j(function(E){E=$APP.Jf(E);E=$APP.G.j(E,$APP.Hl);return $APP.P.C(SCd(b.getShapeById(E).serialized),$APP.gw,$APP.G.j(n,E))},$APP.vy.j(c,d)));d=$APP.zh($APP.Vh.j($APP.Hl,d));var p=$APP.zh($APP.Vh.j($APP.Hl,c)),q=$APP.zh($APP.Km.j($APP.nk,$APP.vy.j(p,d)));c=$APP.zh($APP.qg.j(function(E){E=$APP.Hl.A(E);return q.A?q.A(E):q.call(null,E)},g));var r=$APP.Km.j($APP.nk,$APP.vy.j(d,p)),v=$APP.Ez();d=$APP.x(r)?$APP.Vh.j(function(E){return $APP.Vw.j(E,new $APP.N(null,
2,5,$APP.O,[$APP.mD,$APP.RB],null))},function(){var E=new $APP.N(null,1,5,$APP.O,[$APP.ux],null),H=$APP.Oj.j(function(K){return new $APP.N(null,2,5,$APP.O,[$APP.EA,$APP.yi(K)],null)},r);return $APP.uC?$APP.uC(v,E,H):$APP.vC.call(null,v,E,H)}()):null;p=$APP.Oj.j(function(E){return new $APP.N(null,2,5,$APP.O,[$APP.jCb,new $APP.N(null,2,5,$APP.O,[$APP.EA,$APP.yi(E)],null)],null)},r);var y=$APP.vy.j(g,c),z=$APP.x(y)?function(){var E=new $APP.N(null,1,5,$APP.O,[$APP.ux],null),H=$APP.Oj.j(function(K){return new $APP.N(null,
2,5,$APP.O,[$APP.EA,$APP.yi($APP.Hl.A(K))],null)},y);return $APP.uC?$APP.uC(v,E,H):$APP.vC.call(null,v,E,H)}():null;return new $APP.l(null,4,[$APP.SEc,TCd(e,b,a,h),$APP.eVc,$APP.Vh.j(function(E){return $APP.ke(q,$APP.t.A($APP.EA.A(E)))?$APP.P.C(E,$APP.vE,$APP.tv()):$APP.iCb(E)},$APP.Vh.j(function(E){E=new $APP.l(null,2,[$APP.SB,$APP.kJ,$APP.RB,E],null);E=new $APP.l(null,3,[$APP.tC,new $APP.l(null,1,[$APP.uq,$APP.tq.A?$APP.tq.A(e):$APP.tq.call(null,e)],null),$APP.DC,new $APP.l(null,1,[$APP.uq,e],null),
$APP.mD,E],null);var H=$APP.Oqb(E,e);return $APP.$l.F($APP.F([E,H]))},g)),$APP.QC,p,$APP.b7b,new $APP.l(null,3,[$APP.oMb,$APP.xb(f),$APP.vBb,f,$APP.Ku,new $APP.l(null,5,[$APP.mJ,e,$APP.WPb,d,$APP.XPb,c,$APP.YPb,y,$APP.ZPb,z],null)],null)],null)},VCd=function(a,b,c){var d=$APP.Xc($APP.A(b.pages)),e=d.shapes,f=$APP.eE(a);f=$APP.Vw.j(f,new $APP.N(null,3,5,$APP.O,[$APP.mD,$APP.UB,$APP.CPb],null));var g=$APP.Ch(f,$APP.Pj.A($APP.Pc(f)));e=$APP.zh($APP.yn.j(function(q,r){var v=r.id;return new $APP.l(null,
2,[$APP.Hl,v,$APP.FPb,$APP.B.j(q,$APP.G.j(g,v))?r.nonce:Date.now()],null)},e));var h=$APP.Ez();f=function(){var q=$APP.Vw.j($APP.u($APP.Vmd),new $APP.N(null,2,5,$APP.O,[h,a],null));return $APP.m(q)?q:$APP.zh($APP.Vh.j(function(r){return $APP.Dq.C(r,$APP.Hl,$APP.t)},RCd(h,a)))}();b=UCd(b,d,e,f,a,c);f=$APP.Jf(b);d=$APP.G.j(f,$APP.SEc);b=$APP.G.j(f,$APP.eVc);c=$APP.G.j(f,$APP.QC);f=$APP.G.j(f,$APP.b7b);d=$APP.gl.F(c,new $APP.N(null,1,5,$APP.O,[d],null),$APP.F([b]));var n=$APP.Vw.j(f,new $APP.N(null,
2,5,$APP.O,[$APP.Ku,$APP.XPb],null)),p=$APP.Vw.j(f,new $APP.N(null,2,5,$APP.O,[$APP.Ku,$APP.WPb],null));n=$APP.m($APP.Xf(function(q){return $APP.B.j("group",$APP.Mm.A(q))},n))?$APP.P.C(f,$APP.$Pb,$APP.Bu):$APP.m(function(){var q=$APP.Lf(p);return $APP.m(q)?$APP.Wf(function(r){return $APP.B.j("group",$APP.Mm.A(r))},p):q}())?$APP.P.C(f,$APP.$Pb,$APP.aGc):$APP.m($APP.Xf(function(q){return $APP.B.j("line",$APP.Mm.A(q))&&$APP.B.j("arrow ",$APP.ko.A($APP.ODc.A(q)))},n))?$APP.P.C(f,$APP.$Pb,$APP.gRc):f;
b=$APP.x($APP.gl.j(b,c))?n:$APP.P.C(f,$APP.R1a,!0);$APP.ji.J($APP.Vmd,$APP.hu,new $APP.N(null,2,5,$APP.O,[h,a],null),e);if($APP.ke(new $APP.th(null,new $APP.l(null,1,[$APP.gRc,null],null),null),$APP.$Pb.A(b)))return $APP.Fz($APP.v7c,new $APP.l(null,2,[$APP.Nw,d,$APP.b7b,b],null));e=$APP.v7c.A($APP.u($APP.Bz));$APP.gl.j($APP.Nw.A(e),d);$APP.$l.F($APP.F([b,$APP.b7b.A(e)]));$APP.Fz($APP.v7c,$APP.If);return null},WCd=function(a){a=$APP.oN.A(a);return $APP.Km.j($APP.Gqb,a)},XCd=function(a){var b=$APP.Qw.A($APP.eE(a));
a=WCd(a);a=$APP.qg.j(function(d){return $APP.B.j(b,$APP.Qw.A($APP.DC.A(d)))},a);var c=$APP.zh($APP.Km.j($APP.ub,$APP.Vh.j(function(d){return $APP.Vw.C(d,new $APP.N(null,2,5,$APP.O,[$APP.EC,$APP.Qw],null),null)},a)));a=$APP.Km.j(function(d){d=$APP.Qw.A(d);return c.A?c.A(d):c.call(null,d)},a);return $APP.x(a)?$APP.A(a):null},YCd=function(){return $APP.nm(null,function(){return $APP.nm(fetch("./whiteboard/onboarding.edn"),function(a){return $APP.nm(a.text(),function(b){return $APP.nm($APP.Aq($APP.If,
b),function(c){return $APP.hm(c)})})})})},ZCd=function(a){var b=$APP.M5a();return($APP.vd(b)||$APP.B.j(1,$APP.Pc(b))&&$APP.B.j(a,$APP.uq.A($APP.A(b))))&&$APP.xb($APP.Vw.j($APP.u($APP.Bz),new $APP.N(null,1,5,$APP.O,[$APP.EYa],null)))},$Cd=function(a){return null!=a?$APP.qm($APP.nm(null,function(){return $APP.nm(YCd(),function(b){var c=$APP.Jf(b);b=$APP.G.j(c,$APP.sE);c=$APP.G.j(c,$APP.qv);var d=$APP.A(b);b=$APP.DPb(d,c);d=$APP.Fqb(d);c=$APP.GPb.A(d);d=$APP.SE.A(d);a.cloneShapesIntoCurrentPage($APP.hj(new $APP.l(null,
3,[$APP.OPb,b,$APP.GPb,c,$APP.SE,d],null)));b=$APP.GYa();return $APP.hm(b)})}),function(b){return console.warn("Failed to populate onboarding whiteboard",b)}):null},aDd=function(a){a.cleanup($APP.Vh.j(function(b){return b.id},a.shapes))},dDd=function(a,b){b=$APP.Np.F(b,$APP.F([new $APP.l(null,1,[$APP.Op,!0],null)]));b=$APP.Jf(b);var c=$APP.G.j(b,bDd),d=$APP.G.j(b,$APP.kG),e=$APP.G.j(b,cDd),f=$APP.Ez();return $APP.nm(null,function(){return $APP.nm($APP.m(d)?$APP.bkb(f,a,new $APP.l(null,1,[$APP.Pv,
100],null)):null,function(g){return $APP.nm($APP.m(c)?$APP.gkb(a):null,function(h){return $APP.nm($APP.m(e)?$APP.ikb(a,100):null,function(n){return $APP.hm($APP.hj(new $APP.l(null,3,[$APP.sE,h,$APP.qv,g,$APP.SG,n],null)))})})})})},eDd=function(a){return $APP.mm($APP.rJb($APP.Ez(),new $APP.N(null,1,5,$APP.O,[$APP.Np.A(a)],null)),function(b){var c=(c=$APP.x(b))?$APP.A(b):c;return $APP.m(c)?(b=$APP.C.C(c,0,null),$APP.C.C(c,1,null),c=$APP.C.C(c,2,null),$APP.tJb($APP.m(c)?c:b)):null})},fDd=function(){return $APP.sMb(null)},
gDd=function(){return $APP.uMb(null)},xDd=function(a){return $APP.fh([hDd,iDd,jDd,kDd,lDd,mDd,nDd,oDd,$APP.XA,pDd,qDd,rDd,sDd,$APP.EX,tDd,uDd,vDd,wDd],[function(b){if($APP.Yu(b))var c=$APP.uq.A($APP.V3a($APP.Ez(),$APP.aj(b)));else c=$APP.uq.A,b=new $APP.N(null,2,5,$APP.O,[$APP.uq,$APP.tq.A?$APP.tq.A(b):$APP.tq.call(null,b)],null),b=$APP.CC.A?$APP.CC.A(b):$APP.CC.call(null,b),c=c.call($APP.uq,b);return c},function(b){return $APP.hj($APP.S3b(b))},function(b){return $APP.fE(b,!1)},function(b){return $APP.PYa($APP.m(b)?
$APP.S3b(b):null)},function(b){return $APP.HPb(b)},$APP.Lv,function(b){return $APP.rIb(b,new $APP.l(null,1,[$APP.xN,!1],null))},$APP.rE,dDd,eDd,QCd,function(b,c){return $APP.wKa(b,$APP.F([$APP.pv,c]))},function(b){var c=$APP.t,d=c.A,e=$APP.Sy?$APP.Sy():$APP.Ty.call(null),f=$APP.eE(a),g=XCd(a);b=new $APP.l(null,6,[$APP.EC,$APP.sh($APP.m(g)?g:f,new $APP.N(null,1,5,$APP.O,[$APP.Qw],null)),$APP.EA,e,$APP.BA,$APP.m(b)?b:"",$APP.VC,$APP.vq,$APP.tC,new $APP.l(null,2,[$APP.uq,$APP.tq.A?$APP.tq.A(a):$APP.tq.call(null,
a),$APP.xv,a],null),$APP.DC,new $APP.l(null,1,[$APP.uq,a],null)],null);$APP.wC(new $APP.N(null,1,5,$APP.O,[b],null));return d.call(c,e)},function(b){return $APP.qH.F($APP.F([$APP.Wh.A(b)]))},function(b,c){return $APP.TA(function(){return(0,$APP.$0b)(b,$APP.$l.F($APP.F([$APP.Np.F(c,$APP.F([$APP.Op,!0])),new $APP.l(null,1,[$APP.yN,!0],null)])))})},function(b,c){return $APP.yA($APP.Ez(),$APP.Qw.A($APP.eE(b)),$APP.Wh.A(c))},function(b){var c=$APP.Yu(b)?$APP.uq.A($APP.V3a($APP.Ez(),$APP.aj(b))):null;c=
$APP.m(c)?c:b;var d=$APP.$D(c),e=$APP.rE(c);return $APP.m(d)?$APP.m(e)?$APP.Vnb(c,new $APP.l(null,1,[$APP.GI,b],null)):$APP.FI($APP.fE(b,!1)):null},function(b){return $APP.hj($APP.P2a($APP.aj(b)))}])},wDd=new $APP.M(null,"queryBlockByUUID","queryBlockByUUID",2091812895),tDd=new $APP.M(null,"exportToImage","exportToImage",-154356643),sDd=new $APP.M(null,"addNewBlock","addNewBlock",1426762680),yDd=new $APP.M(null,"KeyboardShortcut","KeyboardShortcut",1250004264),cDd=new $APP.M(null,"files?","files?",
-1267491104),hDd=new $APP.M(null,"getBlockPageName","getBlockPageName",-1656908032),zDd=new $APP.M(null,"renderers","renderers",-1460292282),ADd=new $APP.M(null,"model","model",331153215),jDd=new $APP.M(null,"getRedirectPageName","getRedirectPageName",-1858136925),mDd=new $APP.M(null,"isMobile","isMobile",-2043133877),kDd=new $APP.M(null,"setCurrentPdf","setCurrentPdf",-63289336),BDd=new $APP.M(null,"onMount","onMount",-876858467),nDd=new $APP.M(null,"insertFirstPageBlock","insertFirstPageBlock",
-1676658548),qDd=new $APP.M(null,"makeAssetUrl","makeAssetUrl",217779988),CDd=new $APP.M(null,"onPersist","onPersist",-1848738852),DDd=new $APP.M(null,"Breadcrumb","Breadcrumb",-1351298906),rDd=new $APP.M(null,"copyToClipboard","copyToClipboard",1092115063),vDd=new $APP.M(null,"redirectToPage","redirectToPage",87147838),lDd=new $APP.M(null,"addNewWhiteboard","addNewWhiteboard",554297706),pDd=new $APP.M(null,"saveAsset","saveAsset",-668047853),EDd=new $APP.M(null,"BacklinksCount","BacklinksCount",
364670631),FDd=new $APP.M(null,"Block","Block",-1959785792),uDd=new $APP.M(null,"sidebarAddBlock","sidebarAddBlock",-1204903203),GDd=new $APP.M(null,"Page","Page",-1267059506),bDd=new $APP.M(null,"pages?","pages?",-2065014049),HDd=new $APP.M(null,"PageName","PageName",-164991013),IDd=new $APP.M(null,"Tweet","Tweet",-452258680),oDd=new $APP.M(null,"isWhiteboardPage","isWhiteboardPage",-134150579),JDd=new $APP.M(null,"BlockReference","BlockReference",-120254741),iDd=new $APP.M(null,"inflateAsset","inflateAsset",
-1449040639);$APP.kda("tldraw");var KDd=$APP.xm(593);var LDd,MDd;$APP.otd={};LDd=$APP.VN($APP.qa(KDd,"App"));$APP.rtd=$APP.qa(KDd,"generateJSXFromModel");
MDd=new $APP.l(null,8,[GDd,$APP.Uq($APP.Yq,function(a){return(0,$APP.Vrd)(new $APP.l(null,2,[$APP.mJ,$APP.fE($APP.qa(a,"pageName"),!1),$APP.yN,!0],null))},null,"frontend.extensions.tldraw/page-cp"),FDd,$APP.Uq($APP.Yq,function(a){a=$APP.yi($APP.qa(a,"blockId"));var b=$APP.SXa($APP.ajc);a=b.A?b.A(a):b.call(null,a);return $APP.Iq(a)},null,"frontend.extensions.tldraw/block-cp"),DDd,$APP.Uq($APP.Yq,function(a){return $APP.Iq($APP.yQ(new $APP.l(null,1,[$APP.cV,!0],null),$APP.Ez(),$APP.yi($APP.qa(a,"blockId")),
new $APP.l(null,2,[$APP.X8b,$APP.qa(a,"endSeparator"),$APP.Y8b,$APP.qa(a,"levelLimit",3)],null)))},null,"frontend.extensions.tldraw/breadcrumb"),IDd,$APP.Uq($APP.Yq,function(a){return(0,$APP.N7b)($APP.qa(a,"tweetId"))},null,"frontend.extensions.tldraw/tweet"),HDd,$APP.Uq($APP.Yq,function(a){return(0,$APP.lQ)(new $APP.l(null,1,[$APP.cV,!0],null),new $APP.l(null,1,[$APP.uq,$APP.qa(a,"pageName")],null))},null,"frontend.extensions.tldraw/page-name-link"),EDd,function(a){return $APP.Zf.j($APP.utd,$APP.Vh.j(function(b){return $APP.Np.F($APP.qa(a,
b),$APP.F([new $APP.l(null,1,[$APP.Op,!0],null)]))},new $APP.N(null,3,5,$APP.O,["id","className","options"],null)))},JDd,$APP.Uq($APP.Yq,function(a){return(0,$APP.Z6b)($APP.If,$APP.qa(a,"blockId"),null)},null,"frontend.extensions.tldraw/block-reference"),yDd,$APP.Uq($APP.Yq,function(a){return $APP.Iq(function(){var b=$APP.gj(a);if($APP.m(b)){var c=$APP.Jf(b);b=$APP.G.j(c,$APP.VI);var d=$APP.G.j(c,$APP.SN);c=$APP.G.j(c,$APP.YF);b="string"===typeof b?$APP.iO($APP.Wh.A(b)):d;var e=$APP.$l.F($APP.F([new $APP.l(null,
1,[$APP.t3,!1],null),c]));return"string"===typeof b?$APP.QSb(b,$APP.F([e])):$APP.Po.j(" | ",$APP.Vh.j(function(f){return $APP.QSb(f,$APP.F([e]))},b))}return null}())},null,"frontend.extensions.tldraw/keyboard-shortcut")],null);
$APP.ptd=$APP.Uq($APP.Yq,function(a,b){function c(n){if($APP.m(n)){n.appUndo=fDd;n.appRedo=gDd;var p=$APP.qa(n,"api");return $APP.m(p)?$APP.mm(d?$Cd(p):null,function(){aDd(n.currentPage);$APP.QYa(n,b);return h.A?h.A(n):h.call(null,n)}):null}return null}var d=ZCd(a),e=$APP.PPb(a),f=$APP.dr(null),g=$APP.C.C(f,0,null),h=$APP.C.C(f,1,null);$APP.er(function(){$APP.m($APP.m(g)?b:g)&&$APP.QYa(g,b);return function(){return $APP.uc}},new $APP.N(null,2,5,$APP.O,[b,g],null));return $APP.m(e)?$APP.W("div",{style:{overscrollBehavior:"none"},
onBlur:function(n){n=$APP.qa(n,"target").tagName;var p=new $APP.th(null,new $APP.l(null,2,["INPUT",null,"TEXTAREA",null],null),null);n=p.A?p.A(n):p.call(null,n);return $APP.m(n)?$APP.DA():null},onWheel:$APP.jv,className:"draw tldraw whiteboard relative w-full h-full"},[d&&$APP.xb(g)?$APP.W("div",{style:{zIndex:200},className:"absolute inset-0 flex items-center justify-center"},[$APP.Iq($APP.nO("Loading onboarding whiteboard ..."))]):null,$APP.Iq(function(){var n=new $APP.l(null,6,[zDd,MDd,$APP.PSa,
xDd(a),BDd,c,$APP.KWc,!0,CDd,function(p,q){$APP.Fz(new $APP.N(null,2,5,$APP.O,[$APP.QYc,$APP.Ez()],null),$APP.tv());return $APP.m(!1)?(console.time("tldraw persist"),p=VCd(a,p,q.replace),console.timeEnd("tldraw persist"),p):VCd(a,p,q.replace)},ADd,e],null);return LDd.A?LDd.A(n):LDd.call(null,n)}())]):null},null,"frontend.extensions.tldraw/tldraw-app");$APP.Ra.Zi();
}).call(this);