(function(){
shadow$provide[584]=function(wa,V,Ta,E){function p(r,B,C){var a,G={},v=null,k=null;void 0!==C&&(v=""+C);void 0!==B.key&&(v=""+B.key);void 0!==B.ref&&(k=B.ref);for(a in B)q.call(B,a)&&!d.hasOwnProperty(a)&&(G[a]=B[a]);if(r&&r.defaultProps)for(a in B=r.defaultProps,B)void 0===G[a]&&(G[a]=B[a]);return{$$typeof:S,type:r,key:v,ref:k,props:G,_owner:A.current}}V(19);wa=V(22);var S=60103;E.Fragment=60107;"function"===typeof Symbol&&Symbol.for&&(V=Symbol.for,S=V("react.element"),E.Fragment=V("react.fragment"));
var A=wa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,q=Object.prototype.hasOwnProperty,d={key:!0,ref:!0,__self:!0,__source:!0};E.jsx=p;E.jsxs=p};
shadow$provide[586]=function(wa,V,Ta,E){Ta.exports=V(584)};
shadow$provide[587]=function(wa,V,Ta,E){function p(pc){for(var Ed="https://reactjs.org/docs/error-decoder.html?invariant\x3d"+pc,xd=1;xd<arguments.length;xd++)Ed+="\x26args[]\x3d"+encodeURIComponent(arguments[xd]);return"Minified React error #"+pc+"; visit "+Ed+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function S(pc){if(null==pc)return null;if("function"===typeof pc)return pc.displayName||pc.name||null;if("string"===typeof pc)return pc;
switch(pc){case M:return"Fragment";case aa:return"Portal";case D:return"Profiler";case Q:return"StrictMode";case X:return"Suspense";case F:return"SuspenseList"}if("object"===typeof pc)switch(pc.$$typeof){case P:return(pc.displayName||"Context")+".Consumer";case O:return(pc._context.displayName||"Context")+".Provider";case ba:var Ed=pc.render;Ed=Ed.displayName||Ed.name||"";return pc.displayName||(""!==Ed?"ForwardRef("+Ed+")":"ForwardRef");case ha:return S(pc.type);case Z:return S(pc._render);case K:Ed=
pc._payload;pc=pc._init;try{return S(pc(Ed))}catch(xd){}}return null}function A(pc,Ed){for(var xd=pc._threadCount|0;xd<=Ed;xd++)pc[xd]=pc._currentValue2,pc._threadCount=xd+1}function q(pc,Ed,xd,Yd){if(Yd&&(Yd=pc.contextType,"object"===typeof Yd&&null!==Yd))return A(Yd,xd),Yd[xd];if(pc=pc.contextTypes){xd={};for(var ud in pc)xd[ud]=Ed[ud];Ed=xd}else Ed=ya;return Ed}function d(pc){if(Ea.call(Za,pc))return!0;if(Ea.call(Oa,pc))return!1;if(Ua.test(pc))return Za[pc]=!0;Oa[pc]=!0;return!1}function r(pc,
Ed,xd,Yd){if(null!==xd&&0===xd.type)return!1;switch(typeof Ed){case "function":case "symbol":return!0;case "boolean":if(Yd)return!1;if(null!==xd)return!xd.acceptsBooleans;pc=pc.toLowerCase().slice(0,5);return"data-"!==pc&&"aria-"!==pc;default:return!1}}function B(pc,Ed,xd,Yd){if(null===Ed||"undefined"===typeof Ed||r(pc,Ed,xd,Yd))return!0;if(Yd)return!1;if(null!==xd)switch(xd.type){case 3:return!Ed;case 4:return!1===Ed;case 5:return isNaN(Ed);case 6:return isNaN(Ed)||1>Ed}return!1}function C(pc,Ed,
xd,Yd,ud,Qd,ld){this.acceptsBooleans=2===Ed||3===Ed||4===Ed;this.attributeName=Yd;this.attributeNamespace=ud;this.mustUseProperty=xd;this.propertyName=pc;this.type=Ed;this.sanitizeURL=Qd;this.removeEmptyString=ld}function a(pc){return pc[1].toUpperCase()}function G(pc){if("boolean"===typeof pc||"number"===typeof pc)return""+pc;pc=""+pc;var Ed=eb.exec(pc);if(Ed){var xd="",Yd,ud=0;for(Yd=Ed.index;Yd<pc.length;Yd++){switch(pc.charCodeAt(Yd)){case 34:Ed="\x26quot;";break;case 38:Ed="\x26amp;";break;case 39:Ed=
"\x26#x27;";break;case 60:Ed="\x26lt;";break;case 62:Ed="\x26gt;";break;default:continue}ud!==Yd&&(xd+=pc.substring(ud,Yd));ud=Yd+1;xd+=Ed}pc=ud!==Yd?xd+pc.substring(ud,Yd):xd}return pc}function v(pc,Ed){var xd=Ma.hasOwnProperty(pc)?Ma[pc]:null,Yd;if(Yd="style"!==pc)Yd=null!==xd?0===xd.type:!(2<pc.length)||"o"!==pc[0]&&"O"!==pc[0]||"n"!==pc[1]&&"N"!==pc[1]?!1:!0;if(Yd||B(pc,Ed,xd,!1))return"";if(null!==xd){pc=xd.attributeName;Yd=xd.type;if(3===Yd||4===Yd&&!0===Ed)return pc+'\x3d""';xd.sanitizeURL&&
(Ed=""+Ed);return pc+'\x3d"'+(G(Ed)+'"')}return d(pc)?pc+'\x3d"'+(G(Ed)+'"'):""}function k(pc,Ed){return pc===Ed&&(0!==pc||1/pc===1/Ed)||pc!==pc&&Ed!==Ed}function h(){if(null===oa)throw Error(p(321));return oa}function f(){if(0<Bb)throw Error(p(312));return{memoizedState:null,queue:null,next:null}}function w(){null===ra?null===Ca?(Aa=!1,Ca=ra=f()):(Aa=!0,ra=Ca):null===ra.next?(Aa=!1,ra=ra.next=f()):(Aa=!0,ra=ra.next);return ra}function x(pc,Ed,xd,Yd){for(;Ja;)Ja=!1,Bb+=1,ra=null,xd=pc(Ed,Yd);J();
return xd}function J(){oa=null;Ja=!1;Ca=null;Bb=0;ra=Sa=null}function z(pc,Ed){return"function"===typeof Ed?Ed(pc):Ed}function u(pc,Ed,xd){oa=h();ra=w();if(Aa){var Yd=ra.queue;Ed=Yd.dispatch;if(null!==Sa&&(xd=Sa.get(Yd),void 0!==xd)){Sa.delete(Yd);Yd=ra.memoizedState;do Yd=pc(Yd,xd.action),xd=xd.next;while(null!==xd);ra.memoizedState=Yd;return[Yd,Ed]}return[ra.memoizedState,Ed]}pc=pc===z?"function"===typeof Ed?Ed():Ed:void 0!==xd?xd(Ed):Ed;ra.memoizedState=pc;pc=ra.queue={last:null,dispatch:null};
pc=pc.dispatch=n.bind(null,oa,pc);return[ra.memoizedState,pc]}function t(pc,Ed){oa=h();ra=w();Ed=void 0===Ed?null:Ed;if(null!==ra){var xd=ra.memoizedState;if(null!==xd&&null!==Ed){var Yd=xd[1];a:if(null===Yd)Yd=!1;else{for(var ud=0;ud<Yd.length&&ud<Ed.length;ud++)if(!Na(Ed[ud],Yd[ud])){Yd=!1;break a}Yd=!0}if(Yd)return xd[0]}}pc=pc();ra.memoizedState=[pc,Ed];return pc}function n(pc,Ed,xd){if(!(25>Bb))throw Error(p(301));if(pc===oa)if(Ja=!0,pc={action:xd,next:null},null===Sa&&(Sa=new Map),xd=Sa.get(Ed),
void 0===xd)Sa.set(Ed,pc);else{for(Ed=xd;null!==Ed.next;)Ed=Ed.next;Ed.next=pc}}function R(){}function ka(pc){switch(pc){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 L(pc){if(void 0===pc||null===pc)return pc;var Ed="";H.Children.forEach(pc,function(xd){null!=xd&&(Ed+=xd)});return Ed}function ma(pc,Ed){if(void 0===pc)throw Error(p(152,S(Ed)||"Component"));}function Y(pc,Ed,xd){function Yd(ld,
Sd){var Nb=Sd.prototype&&Sd.prototype.isReactComponent,gc=q(Sd,Ed,xd,Nb),Yb=[],qb=!1,mb={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===Yb)return null},enqueueReplaceState:function(oe,rd){qb=!0;Yb=[rd]},enqueueSetState:function(oe,rd){if(null===Yb)return null;Yb.push(rd)}};if(Nb){if(Nb=new Sd(ld.props,gc,mb),"function"===typeof Sd.getDerivedStateFromProps){var cc=Sd.getDerivedStateFromProps.call(null,ld.props,Nb.state);null!=cc&&(Nb.state=fa({},Nb.state,cc))}}else if(oa={},
Nb=Sd(ld.props,gc,mb),Nb=x(Sd,ld.props,Nb,gc),null==Nb||null==Nb.render){pc=Nb;ma(pc,Sd);return}Nb.props=ld.props;Nb.context=gc;Nb.updater=mb;mb=Nb.state;void 0===mb&&(Nb.state=mb=null);if("function"===typeof Nb.UNSAFE_componentWillMount||"function"===typeof Nb.componentWillMount)if("function"===typeof Nb.componentWillMount&&"function"!==typeof Sd.getDerivedStateFromProps&&Nb.componentWillMount(),"function"===typeof Nb.UNSAFE_componentWillMount&&"function"!==typeof Sd.getDerivedStateFromProps&&Nb.UNSAFE_componentWillMount(),
Yb.length){mb=Yb;var uc=qb;Yb=null;qb=!1;if(uc&&1===mb.length)Nb.state=mb[0];else{cc=uc?mb[0]:Nb.state;var Uc=!0;for(uc=uc?1:0;uc<mb.length;uc++){var cd=mb[uc];cd="function"===typeof cd?cd.call(Nb,cc,ld.props,gc):cd;null!=cd&&(Uc?(Uc=!1,cc=fa({},cc,cd)):fa(cc,cd))}Nb.state=cc}}else Yb=null;pc=Nb.render();ma(pc,Sd);if("function"===typeof Nb.getChildContext&&(ld=Sd.childContextTypes,"object"===typeof ld)){var Od=Nb.getChildContext(),be;for(be in Od)if(!(be in ld))throw Error(p(108,S(Sd)||"Unknown",
be));}Od&&(Ed=fa({},Ed,Od))}for(;H.isValidElement(pc);){var ud=pc,Qd=ud.type;if("function"!==typeof Qd)break;Yd(ud,Qd)}return{child:pc,context:Ed}}var fa=V(19),H=V(22),aa=60106,M=60107,Q=60108,D=60114,O=60109,P=60110,ba=60112,X=60113,F=60120,ha=60115,K=60116,Z=60121,ea=60117,ca=60119,pa=60129,za=60131;"function"===typeof Symbol&&Symbol.for&&(wa=Symbol.for,aa=wa("react.portal"),M=wa("react.fragment"),Q=wa("react.strict_mode"),D=wa("react.profiler"),O=wa("react.provider"),P=wa("react.context"),ba=wa("react.forward_ref"),
X=wa("react.suspense"),F=wa("react.suspense_list"),ha=wa("react.memo"),K=wa("react.lazy"),Z=wa("react.block"),ea=wa("react.fundamental"),ca=wa("react.scope"),pa=wa("react.debug_trace_mode"),za=wa("react.legacy_hidden"));wa=H.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;var ya={},Ha=new Uint16Array(16);for(V=0;15>V;V++)Ha[V]=V+1;Ha[15]=0;var Ua=/^[: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]*$/,
Ea=Object.prototype.hasOwnProperty,Oa={},Za={},Ma={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(pc){Ma[pc]=new C(pc,0,!1,pc,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(pc){var Ed=pc[0];Ma[Ed]=new C(Ed,1,!1,pc[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(pc){Ma[pc]=
new C(pc,2,!1,pc.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(pc){Ma[pc]=new C(pc,2,!1,pc,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(pc){Ma[pc]=new C(pc,3,!1,pc.toLowerCase(),null,!1,!1)});["checked",
"multiple","muted","selected"].forEach(function(pc){Ma[pc]=new C(pc,3,!0,pc,null,!1,!1)});["capture","download"].forEach(function(pc){Ma[pc]=new C(pc,4,!1,pc,null,!1,!1)});["cols","rows","size","span"].forEach(function(pc){Ma[pc]=new C(pc,6,!1,pc,null,!1,!1)});["rowSpan","start"].forEach(function(pc){Ma[pc]=new C(pc,5,!1,pc.toLowerCase(),null,!1,!1)});var fb=/[\-:]([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(pc){var Ed=
pc.replace(fb,a);Ma[Ed]=new C(Ed,1,!1,pc,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(pc){var Ed=pc.replace(fb,a);Ma[Ed]=new C(Ed,1,!1,pc,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(pc){var Ed=pc.replace(fb,a);Ma[Ed]=new C(Ed,1,!1,pc,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(pc){Ma[pc]=new C(pc,1,!1,pc.toLowerCase(),null,!1,!1)});
Ma.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(pc){Ma[pc]=new C(pc,1,!1,pc.toLowerCase(),null,!0,!0)});var eb=/["'&<>]/,Na="function"===typeof Object.is?Object.is:k,oa=null,Ca=null,ra=null,Aa=!1,Ja=!1,Sa=null,Bb=0,ib=null,Ob={readContext:function(pc){var Ed=ib.threadID;A(pc,Ed);return pc[Ed]},useContext:function(pc){h();var Ed=ib.threadID;A(pc,Ed);return pc[Ed]},useMemo:t,useReducer:u,useRef:function(pc){oa=
h();ra=w();var Ed=ra.memoizedState;return null===Ed?(pc={current:pc},ra.memoizedState=pc):Ed},useState:function(pc){return u(z,pc)},useLayoutEffect:function(){},useCallback:function(pc,Ed){return t(function(){return pc},Ed)},useImperativeHandle:R,useEffect:R,useDebugValue:R,useDeferredValue:function(pc){h();return pc},useTransition:function(){h();return[function(pc){pc()},!1]},useOpaqueIdentifier:function(){return(ib.identifierPrefix||"")+"R:"+(ib.uniqueID++).toString(36)},useMutableSource:function(pc,
Ed){h();return Ed(pc._source)}},Wb={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},ic=fa({menuitem:!0},Wb),Pa={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},nb=["Webkit","ms","Moz","O"];Object.keys(Pa).forEach(function(pc){nb.forEach(function(Ed){Ed=Ed+pc.charAt(0).toUpperCase()+pc.substring(1);Pa[Ed]=Pa[pc]})});var ob=/([A-Z])/g,Zb=/^ms-/,Jc=H.Children.toArray,
ad=wa.ReactCurrentDispatcher,Nc={listing:!0,pre:!0,textarea:!0},Gb=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xc={},Wc={},hd=Object.prototype.hasOwnProperty,Nd={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},Ld=function(){function pc(xd,Yd,ud){H.isValidElement(xd)?xd.type!==M?xd=[xd]:(xd=xd.props.children,xd=H.isValidElement(xd)?[xd]:Jc(xd)):xd=Jc(xd);xd={type:null,domNamespace:"http://www.w3.org/1999/xhtml",children:xd,childIndex:0,context:ya,footer:""};
var Qd=Ha[0];if(0===Qd){var ld=Ha;Qd=ld.length;var Sd=2*Qd;if(!(65536>=Sd))throw Error(p(304));var Nb=new Uint16Array(Sd);Nb.set(ld);Ha=Nb;Ha[0]=Qd+1;for(ld=Qd;ld<Sd-1;ld++)Ha[ld]=ld+1;Ha[Sd-1]=0}else Ha[0]=Ha[Qd];this.threadID=Qd;this.stack=[xd];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=Yd;this.suspenseDepth=0;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[];this.uniqueID=0;this.identifierPrefix=ud&&ud.identifierPrefix||""}
var Ed=pc.prototype;Ed.destroy=function(){if(!this.exhausted){this.exhausted=!0;this.clearProviders();var xd=this.threadID;Ha[xd]=Ha[0];Ha[0]=xd}};Ed.pushProvider=function(xd){var Yd=++this.contextIndex,ud=xd.type._context,Qd=this.threadID;A(ud,Qd);var ld=ud[Qd];this.contextStack[Yd]=ud;this.contextValueStack[Yd]=ld;ud[Qd]=xd.props.value};Ed.popProvider=function(){var xd=this.contextIndex,Yd=this.contextStack[xd],ud=this.contextValueStack[xd];this.contextStack[xd]=null;this.contextValueStack[xd]=
null;this.contextIndex--;Yd[this.threadID]=ud};Ed.clearProviders=function(){for(var xd=this.contextIndex;0<=xd;xd--)this.contextStack[xd][this.threadID]=this.contextValueStack[xd]};Ed.read=function(xd){if(this.exhausted)return null;var Yd=ib;ib=this;var ud=ad.current;ad.current=Ob;try{for(var Qd=[""],ld=!1;Qd[0].length<xd;){if(0===this.stack.length){this.exhausted=!0;var Sd=this.threadID;Ha[Sd]=Ha[0];Ha[0]=Sd;break}var Nb=this.stack[this.stack.length-1];if(ld||Nb.childIndex>=Nb.children.length){var gc=
Nb.footer;""!==gc&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===Nb.type)this.currentSelectValue=null;else if(null!=Nb.type&&null!=Nb.type.type&&Nb.type.type.$$typeof===O)this.popProvider(Nb.type);else if(Nb.type===X){this.suspenseDepth--;var Yb=Qd.pop();if(ld){ld=!1;var qb=Nb.fallbackFrame;if(!qb)throw Error(p(303));this.stack.push(qb);Qd[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}else Qd[this.suspenseDepth]+=Yb}Qd[this.suspenseDepth]+=gc}else{var mb=Nb.children[Nb.childIndex++],
cc="";try{cc+=this.render(mb,Nb.context,Nb.domNamespace)}catch(uc){if(null!=uc&&"function"===typeof uc.then)throw Error(p(294));throw uc;}finally{}Qd.length<=this.suspenseDepth&&Qd.push("");Qd[this.suspenseDepth]+=cc}}return Qd[0]}finally{ad.current=ud,ib=Yd,J()}};Ed.render=function(xd,Yd,ud){if("string"===typeof xd||"number"===typeof xd){ud=""+xd;if(""===ud)return"";if(this.makeStaticMarkup)return G(ud);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+G(ud);this.previousWasTextNode=!0;return G(ud)}Yd=
Y(xd,Yd,this.threadID);xd=Yd.child;Yd=Yd.context;if(null===xd||!1===xd)return"";if(!H.isValidElement(xd)){if(null!=xd&&null!=xd.$$typeof){ud=xd.$$typeof;if(ud===aa)throw Error(p(257));throw Error(p(258,ud.toString()));}xd=Jc(xd);this.stack.push({type:null,domNamespace:ud,children:xd,childIndex:0,context:Yd,footer:""});return""}var Qd=xd.type;if("string"===typeof Qd)return this.renderDOM(xd,Yd,ud);switch(Qd){case za:case pa:case Q:case D:case F:case M:return xd=Jc(xd.props.children),this.stack.push({type:null,
domNamespace:ud,children:xd,childIndex:0,context:Yd,footer:""}),"";case X:throw Error(p(294));case ca:throw Error(p(343));}if("object"===typeof Qd&&null!==Qd)switch(Qd.$$typeof){case ba:oa={};var ld=Qd.render(xd.props,xd.ref);ld=x(Qd.render,xd.props,ld,xd.ref);ld=Jc(ld);this.stack.push({type:null,domNamespace:ud,children:ld,childIndex:0,context:Yd,footer:""});return"";case ha:return xd=[H.createElement(Qd.type,fa({ref:xd.ref},xd.props))],this.stack.push({type:null,domNamespace:ud,children:xd,childIndex:0,
context:Yd,footer:""}),"";case O:return Qd=Jc(xd.props.children),ud={type:xd,domNamespace:ud,children:Qd,childIndex:0,context:Yd,footer:""},this.pushProvider(xd),this.stack.push(ud),"";case P:Qd=xd.type;ld=xd.props;var Sd=this.threadID;A(Qd,Sd);Qd=Jc(ld.children(Qd[Sd]));this.stack.push({type:xd,domNamespace:ud,children:Qd,childIndex:0,context:Yd,footer:""});return"";case ea:throw Error(p(338));case K:return Qd=xd.type,ld=Qd._init,Qd=ld(Qd._payload),xd=[H.createElement(Qd,fa({ref:xd.ref},xd.props))],
this.stack.push({type:null,domNamespace:ud,children:xd,childIndex:0,context:Yd,footer:""}),""}throw Error(p(130,null==Qd?Qd:typeof Qd,""));};Ed.renderDOM=function(xd,Yd,ud){var Qd=xd.type.toLowerCase();"http://www.w3.org/1999/xhtml"===ud&&ka(Qd);if(!xc.hasOwnProperty(Qd)){if(!Gb.test(Qd))throw Error(p(65,Qd));xc[Qd]=!0}var ld=xd.props;if("input"===Qd)ld=fa({type:void 0},ld,{defaultChecked:void 0,defaultValue:void 0,value:null!=ld.value?ld.value:ld.defaultValue,checked:null!=ld.checked?ld.checked:
ld.defaultChecked});else if("textarea"===Qd){var Sd=ld.value;if(null==Sd){Sd=ld.defaultValue;var Nb=ld.children;if(null!=Nb){if(null!=Sd)throw Error(p(92));if(Array.isArray(Nb)){if(!(1>=Nb.length))throw Error(p(93));Nb=Nb[0]}Sd=""+Nb}null==Sd&&(Sd="")}ld=fa({},ld,{value:void 0,children:""+Sd})}else if("select"===Qd)this.currentSelectValue=null!=ld.value?ld.value:ld.defaultValue,ld=fa({},ld,{value:void 0});else if("option"===Qd){Nb=this.currentSelectValue;var gc=L(ld.children);if(null!=Nb){var Yb=
null!=ld.value?ld.value+"":gc;Sd=!1;if(Array.isArray(Nb))for(var qb=0;qb<Nb.length;qb++){if(""+Nb[qb]===Yb){Sd=!0;break}}else Sd=""+Nb===Yb;ld=fa({selected:void 0,children:void 0},ld,{selected:Sd,children:gc})}}if(Sd=ld){if(ic[Qd]&&(null!=Sd.children||null!=Sd.dangerouslySetInnerHTML))throw Error(p(137,Qd));if(null!=Sd.dangerouslySetInnerHTML){if(null!=Sd.children)throw Error(p(60));if(!("object"===typeof Sd.dangerouslySetInnerHTML&&"__html"in Sd.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=
Sd.style&&"object"!==typeof Sd.style)throw Error(p(62));}Sd=ld;Nb=this.makeStaticMarkup;gc=1===this.stack.length;Yb="\x3c"+xd.type;a:if(-1===Qd.indexOf("-"))qb="string"===typeof Sd.is;else switch(Qd){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":qb=!1;break a;default:qb=!0}for(rd in Sd)if(hd.call(Sd,rd)){var mb=Sd[rd];if(null!=mb){if("style"===rd){var cc=void 0,uc="",Uc="";for(cc in mb)if(mb.hasOwnProperty(cc)){var cd=
0===cc.indexOf("--"),Od=mb[cc];if(null!=Od){if(cd)var be=cc;else if(be=cc,Wc.hasOwnProperty(be))be=Wc[be];else{var oe=be.replace(ob,"-$1").toLowerCase().replace(Zb,"-ms-");be=Wc[be]=oe}uc+=Uc+be+":";Uc=cc;cd=null==Od||"boolean"===typeof Od||""===Od?"":cd||"number"!==typeof Od||0===Od||Pa.hasOwnProperty(Uc)&&Pa[Uc]?(""+Od).trim():Od+"px";uc+=cd;Uc=";"}}mb=uc||null}cc=null;qb?Nd.hasOwnProperty(rd)||(cc=rd,cc=d(cc)&&null!=mb?cc+'\x3d"'+(G(mb)+'"'):""):cc=v(rd,mb);cc&&(Yb+=" "+cc)}}Nb||gc&&(Yb+=' data-reactroot\x3d""');
var rd=Yb;Sd="";Wb.hasOwnProperty(Qd)?rd+="/\x3e":(rd+="\x3e",Sd="\x3c/"+xd.type+"\x3e");a:{Nb=ld.dangerouslySetInnerHTML;if(null!=Nb){if(null!=Nb.__html){Nb=Nb.__html;break a}}else if(Nb=ld.children,"string"===typeof Nb||"number"===typeof Nb){Nb=G(Nb);break a}Nb=null}null!=Nb?(ld=[],Nc.hasOwnProperty(Qd)&&"\n"===Nb.charAt(0)&&(rd+="\n"),rd+=Nb):ld=Jc(ld.children);xd=xd.type;ud=null==ud||"http://www.w3.org/1999/xhtml"===ud?ka(xd):"http://www.w3.org/2000/svg"===ud&&"foreignObject"===xd?"http://www.w3.org/1999/xhtml":
ud;this.stack.push({domNamespace:ud,type:Qd,children:ld,childIndex:0,context:Yd,footer:Sd});this.previousWasTextNode=!1;return rd};return pc}();E.renderToNodeStream=function(){throw Error(p(207));};E.renderToStaticMarkup=function(pc,Ed){pc=new Ld(pc,!0,Ed);try{return pc.read(Infinity)}finally{pc.destroy()}};E.renderToStaticNodeStream=function(){throw Error(p(208));};E.renderToString=function(pc,Ed){pc=new Ld(pc,!1,Ed);try{return pc.read(Infinity)}finally{pc.destroy()}};E.version="17.0.2"};
shadow$provide[589]=function(wa,V,Ta,E){Ta.exports=V(587)};
shadow$provide[590]=function(wa,V,Ta,E){function p(){if(!wc&&(wc="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wc))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wc(Xc)}function S(b,g=0){return(td[b[g+0]]+td[b[g+1]]+td[b[g+2]]+td[b[g+3]]+"-"+td[b[g+4]]+td[b[g+5]]+"-"+td[b[g+6]]+td[b[g+7]]+"-"+td[b[g+8]]+td[b[g+9]]+"-"+td[b[g+10]]+td[b[g+11]]+td[b[g+12]]+td[b[g+13]]+td[b[g+14]]+
td[b[g+15]]).toLowerCase()}function A(b){let g=0;var m=0;for(var I of b)g+=I.w*I.h,m=Math.max(m,I.w);b.sort((ua,La)=>La.h-ua.h);m=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(g/.95)),m),h:Infinity}];let W=I=0;for(const ua of b)for(b=m.length-1;0<=b;b--){var ia=m[b];if(!(ua.w>ia.w||ua.h>ia.h)){ua.x=ia.x;ua.y=ia.y;W=Math.max(W,ua.y+ua.h);I=Math.max(I,ua.x+ua.w);ua.w===ia.w&&ua.h===ia.h?(ia=m.pop(),b<m.length&&(m[b]=ia)):ua.h===ia.h?(ia.x+=ua.w,ia.w-=ua.w):(ua.w!==ia.w&&m.push({x:ia.x+ua.w,y:ia.y,w:ia.w-
ua.w,h:ua.h}),ia.y+=ua.h,ia.h-=ua.h);break}}return{w:I,h:W,fill:g/(I*W)||0}}function q(b,...g){return{didIntersect:0<g.length,message:b,points:g}}function d(b,g,m=0){const I=[b[0]+g[0]/2,b[1]+g[1]/2],W=sd.rotWith(b,I,m),ia=sd.rotWith(sd.add(b,[g[0],0]),I,m),ua=sd.rotWith(sd.add(b,g),I,m);b=sd.rotWith(sd.add(b,[0,g[1]]),I,m);return[["top",[W,ia]],["right",[ia,ua]],["bottom",[ua,b]],["left",[b,W]]]}function r(b,g,m,I){const [W,ia]=b,[ua,La]=g,[Va,$a]=m,[lb,ub]=I;return La/ua!==(ub-$a)/(lb-Va)&&(g=ua*
(ub-$a)-La*(lb-Va),0!==g&&(b=((ia-$a)*(lb-Va)-(W-Va)*(ub-$a))/g,g=((ia-$a)*ua-(W-Va)*La)/g,0<=b&&0<=g&&1>=g))?q("intersection",[W+b*ua,ia+b*La]):q("no intersection")}function B(b,g,m,I,W=0){return h(m,I,W,b,g)}function C(b,g,m,I=0){const {minX:W,minY:ia,width:ua,height:La}=m;return B(b,g,[W,ia],[ua,La],I)}function a(b,g,m,I){var W=sd.sub(b,m);m=sd.sub(I,m);g=sd.sub(g,b);I=m[0]*W[1]-m[1]*W[0];W=g[0]*W[1]-g[1]*W[0];m=m[1]*g[0]-m[0]*g[1];return 0===I||0===W?q("coincident"):0===m?q("parallel"):0!==m&&
(I/=m,W/=m,0<=I&&1>=I&&0<=W&&1>=W)?q("intersection",sd.add(b,sd.mul(g,I))):q("no intersection")}function G(b,g,m,I){var W=(g[0]-b[0])*(g[0]-b[0])+(g[1]-b[1])*(g[1]-b[1]),ia=2*((g[0]-b[0])*(b[0]-m[0])+(g[1]-b[1])*(b[1]-m[1]));m=ia*ia-4*W*(m[0]*m[0]+m[1]*m[1]+b[0]*b[0]+b[1]*b[1]-2*(m[0]*b[0]+m[1]*b[1])-I*I);if(0>m)return q("outside");if(0===m)return q("tangent");I=Math.sqrt(m);m=(-ia+I)/(2*W);W=(-ia-I)/(2*W);if((0>m||1<m)&&(0>W||1<W))return 0>m&&0>W||1<m&&1<W?q("outside"):q("inside");ia=[];0<=m&&1>=
m&&ia.push(sd.lrp(b,g,m));0<=W&&1>=W&&ia.push(sd.lrp(b,g,W));return q("intersection",...ia)}function v(b,g,m,I,W,ia=0){if(0===I||0===W||sd.isEqual(b,g))return q("no intersection");I=0>I?I:-I;W=0>W?W:-W;b=sd.sub(sd.rotWith(b,m,-ia),m);g=sd.sub(sd.rotWith(g,m,-ia),m);var ua=sd.sub(g,b),La=ua[0]*ua[0]/I/I+ua[1]*ua[1]/W/W;ua=2*b[0]*ua[0]/I/I+2*b[1]*ua[1]/W/W;const Va=[];I=ua*ua-4*La*(b[0]*b[0]/I/I+b[1]*b[1]/W/W-1);0===I?Va.push(-ua/2/La):0<I&&(I=Math.sqrt(I),Va.push((-ua+I)/2/La),Va.push((-ua-I)/2/La));
La=Va.filter($a=>0<=$a&&1>=$a).map($a=>sd.add(m,sd.add(b,sd.mul(sd.sub(g,b),$a)))).map($a=>sd.rotWith($a,m,ia));return q("intersection",...La)}function k(b,g,m){const I=[];for(let W=1;W<m.length;W++){const ia=a(b,g,m[W-1],m[W]);ia&&I.push(...ia.points)}return 0===I.length?q("no intersection"):q("intersection",...m)}function h(b,g,m,I,W){return d(b,g,m).reduce((ia,[ua,[La,Va]])=>{(La=r(I,W,La,Va))&&ia.push(q(ua,...La.points));return ia},[]).filter(ia=>ia.didIntersect)}function f(b,g,m,I){return d(b,
g).reduce((W,[ia,[ua,La]])=>{(ua=a(m,I,ua,La))&&W.push(q(ia,...ua.points));return W},[]).filter(W=>W.didIntersect)}function w(b,g,m,I){return d(b,g).reduce((W,[ia,[ua,La]])=>{(ua=G(ua,La,m,I))&&W.push(Ga(te({},ua),{message:ia}));return W},[]).filter(W=>W.didIntersect)}function x(b,g,m,I,W,ia=0){return d(b,g).reduce((ua,[La,[Va,$a]])=>{(Va=v(Va,$a,m,I,W,ia))&&ua.push(Ga(te({},Va),{message:La}));return ua},[]).filter(ua=>ua.didIntersect)}function J(b,g,m){return d(b,g).reduce((I,[W,[ia,ua]])=>{ia=k(ia,
ua,m);ia.didIntersect&&I.push(q(W,...ia.points));return I},[]).filter(I=>I.didIntersect)}function z(b,g,m){return d(b,g).reduce((I,[W,[ia,ua]])=>{{const La=[];for(let Va=1;Va<m.length+1;Va++){const $a=a(ia,ua,m[Va-1],m[Va%m.length]);$a&&La.push(...$a.points)}ia=0===La.length?q("no intersection"):q("intersection",...m)}ia.didIntersect&&I.push(q(W,...ia.points));return I},[]).filter(I=>I.didIntersect)}function u(b,g,m,I=0,W,ia){return g===m?w(W,ia,b,g):x(W,ia,b,g,m,I)}function t(b,g,m){const {minX:I,
minY:W,width:ia,height:ua}=b;return f([I,W],[ia,ua],g,m)}function n(b){for(var g=arguments.length,m=Array(1<g?g-1:0),I=1;I<g;I++)m[I-1]=arguments[I];throw Error("number"===typeof b?"[MobX] minified error nr: "+b+(m.length?" "+m.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+b);}function R(){return"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof wa?wa:"undefined"!==
typeof self?self:cm}function ka(){ps||n("Proxy not available")}function L(b){var g=!1;return function(){if(!g)return g=!0,b.apply(this,arguments)}}function ma(b){return"function"===typeof b}function Y(b){switch(typeof b){case "string":case "symbol":case "number":return!0}return!1}function fa(b){return null!==b&&"object"===typeof b}function H(b){if(!fa(b))return!1;b=Object.getPrototypeOf(b);if(null==b)return!0;b=Object.hasOwnProperty.call(b,"constructor")&&b.constructor;return"function"===typeof b&&
b.toString()===os}function aa(b){return(b=null==b?void 0:b.constructor)?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:!1:!1}function M(b,g,m){dn(b,g,{enumerable:!1,writable:!0,configurable:!0,value:m})}function Q(b,g,m){dn(b,g,{enumerable:!1,writable:!1,configurable:!0,value:m})}function D(b,g){var m="isMobX"+b;g.prototype[m]=!0;return function(I){return fa(I)&&!0===I[m]}}function O(b){return b instanceof Map}function P(b){return b instanceof Set}function ba(b){var g=Object.keys(b);
if(!lq)return g;var m=Object.getOwnPropertySymbols(b);return m.length?[].concat(g,m.filter(function(I){return Un.propertyIsEnumerable.call(b,I)})):g}function X(b){return null===b?null:"object"===typeof b?""+b:b}function F(b,g){return Un.hasOwnProperty.call(b,g)}function ha(b,g){for(var m=0;m<g.length;m++){var I=g[m];I.enumerable=I.enumerable||!1;I.configurable=!0;"value"in I&&(I.writable=!0);Object.defineProperty(b,I.key,I)}}function K(b,g,m){g&&ha(b.prototype,g);m&&ha(b,m);Object.defineProperty(b,
"prototype",{writable:!1});return b}function Z(){Z=Object.assign||function(b){for(var g=1;g<arguments.length;g++){var m=arguments[g],I;for(I in m)Object.prototype.hasOwnProperty.call(m,I)&&(b[I]=m[I])}return b};return Z.apply(this,arguments)}function ea(b,g){b.prototype=Object.create(g.prototype);b.prototype.constructor=b;ca(b,g)}function ca(b,g){ca=Object.setPrototypeOf||function(m,I){m.__proto__=I;return m};return ca(b,g)}function pa(b){if(void 0===b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return b}function za(b,g){if(b){if("string"===typeof b)return ya(b,g);var m=Object.prototype.toString.call(b).slice(8,-1);"Object"===m&&b.constructor&&(m=b.constructor.name);if("Map"===m||"Set"===m)return Array.from(b);if("Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return ya(b,g)}}function ya(b,g){if(null==g||g>b.length)g=b.length;for(var m=0,I=Array(g);m<g;m++)I[m]=b[m];return I}function Ha(b,g){var m="undefined"!==typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(m)return(m=
m.call(b)).next.bind(m);if(Array.isArray(b)||(m=za(b))||g&&b&&"number"===typeof b.length){m&&(b=m);var I=0;return function(){return I>=b.length?{done:!0}:{done:!1,value:b[I++]}}}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 Ua(b){return Object.assign(function(g,m){Ea(g,m,b)},b)}function Ea(b,g,m){F(b,Sl)||M(b,Sl,Z({},b[Sl]));m.annotationType_!==oo&&(b[Sl][g]=m)}function Oa(b){F(b,
Sl)||M(b,Sl,Z({},b[Sl]));return b[Sl]}function Za(b,g,m){void 0===g&&(g=cg);void 0===m&&(m=cg);b=new qo(b);g!==cg&&Mc(bv,b,g,void 0);m!==cg&&vc(b,m);return b}function Ma(b,g,m){return Ub(b)?b:Array.isArray(b)?yg.array(b,{name:m}):H(b)?yg.object(b,void 0,{name:m}):O(b)?yg.map(b,{name:m}):P(b)?yg.set(b,{name:m}):"function"!==typeof b||cd(b)||Lc(b)?b:aa(b)?ss(b):yh(m,b)}function fb(b){return b}function eb(b,g){return{annotationType_:b,options_:g,make_:Na,extend_:oa}}function Na(b,g,m,I){var W;if(null!=
(W=this.options_)&&W.bound)return null===this.extend_(b,g,m,!1)?0:1;if(I===b.target_)return null===this.extend_(b,g,m,!1)?0:2;if(cd(m.value))return 1;b=Ca(b,this,g,m,!1);dn(I,g,b);return 2}function oa(b,g,m,I){m=Ca(b,this,g,m);return b.defineProperty_(g,m,I)}function Ca(b,g,m,I,W){var ia,ua,La,Va,$a,lb,ub;void 0===W&&(W=Fe.safeDescriptors);I=I.value;if(null!=(ia=g.options_)&&ia.bound){var Rb;I=I.bind(null!=(Rb=b.proxy_)?Rb:b.target_)}return{value:Nc(null!=(ua=null==(La=g.options_)?void 0:La.name)?
ua:m.toString(),I,null!=(Va=null==($a=g.options_)?void 0:$a.autoAction)?Va:!1,null!=(lb=g.options_)&&lb.bound?null!=(ub=b.proxy_)?ub:b.target_:void 0),configurable:W?b.isPlainObject_:!0,enumerable:!1,writable:W?!1:!0}}function ra(b,g){return{annotationType_:b,options_:g,make_:Aa,extend_:Ja}}function Aa(b,g,m,I){var W;if(I===b.target_)return null===this.extend_(b,g,m,!1)?0:2;if(null!=(W=this.options_)&&W.bound&&(!F(b.target_,g)||!Lc(b.target_[g]))&&null===this.extend_(b,g,m,!1))return 0;if(Lc(m.value))return 1;
b=Sa(b,this,g,m,!1,!1);dn(I,g,b);return 2}function Ja(b,g,m,I){var W;m=Sa(b,this,g,m,null==(W=this.options_)?void 0:W.bound);return b.defineProperty_(g,m,I)}function Sa(b,g,m,I,W,ia){void 0===ia&&(ia=Fe.safeDescriptors);g=I.value;Lc(g)||(g=ss(g));if(W){var ua;g=g.bind(null!=(ua=b.proxy_)?ua:b.target_);g.isMobXFlow=!0}return{value:g,configurable:ia?b.isPlainObject_:!0,enumerable:!1,writable:ia?!1:!0}}function Bb(b,g){return{annotationType_:b,options_:g,make_:ib,extend_:Ob}}function ib(b,g,m){return null===
this.extend_(b,g,m,!1)?0:1}function Ob(b,g,m,I){return b.defineComputedProperty_(g,Z({},this.options_,{get:m.get,set:m.set}),I)}function Wb(b,g){return{annotationType_:b,options_:g,make_:ic,extend_:Pa}}function ic(b,g,m){return null===this.extend_(b,g,m,!1)?0:1}function Pa(b,g,m,I){var W,ia;return b.defineObservableProperty_(g,m.value,null!=(W=null==(ia=this.options_)?void 0:ia.enhancer)?W:Ma,I)}function nb(b){return{annotationType_:"true",options_:b,make_:ob,extend_:Zb}}function ob(b,g,m,I){var W,
ia;if(m.get)return Gg.make_(b,g,m,I);if(m.set){m=Nc(g.toString(),m.set);if(I===b.target_)return null===b.defineProperty_(g,{configurable:Fe.safeDescriptors?b.isPlainObject_:!0,set:m})?0:2;dn(I,g,{configurable:!0,set:m});return 2}if(I!==b.target_&&"function"===typeof m.value){var ua;if(aa(m.value)){var La;return(null!=(La=this.options_)&&La.autoBind?ss.bound:ss).make_(b,g,m,I)}return(null!=(ua=this.options_)&&ua.autoBind?yh.bound:yh).make_(b,g,m,I)}ua=!1===(null==(W=this.options_)?void 0:W.deep)?yg.ref:
yg;if("function"===typeof m.value&&null!=(ia=this.options_)&&ia.autoBind){var Va;m.value=m.value.bind(null!=(Va=b.proxy_)?Va:b.target_)}return ua.make_(b,g,m,I)}function Zb(b,g,m,I){var W,ia;if(m.get)return Gg.extend_(b,g,m,I);if(m.set)return b.defineProperty_(g,{configurable:Fe.safeDescriptors?b.isPlainObject_:!0,set:Nc(g.toString(),m.set)},I);if("function"===typeof m.value&&null!=(W=this.options_)&&W.autoBind){var ua;m.value=m.value.bind(null!=(ua=b.proxy_)?ua:b.target_)}return(!1===(null==(ia=
this.options_)?void 0:ia.deep)?yg.ref:yg).extend_(b,g,m,I)}function Jc(b){if(!0===b.deep)var g=Ma;else{if(!1===b.deep)b=fb;else{b=b.defaultDecorator;var m;b=b?null!=(g=null==(m=b.options_)?void 0:m.enhancer)?g:Ma:Ma}g=b}return g}function ad(b,g,m){if(Y(g))Ea(b,g,mq);else return Ub(b)?b:H(b)?yg.object(b,g,m):Array.isArray(b)?yg.array(b,g):O(b)?yg.map(b,g):P(b)?yg.set(b,g):"object"===typeof b&&null!==b?b:yg.box(b,g)}function Nc(b,g,m,I){function W(){a:{var ia=I||this,ua=arguments,La=Fe.trackingDerivation,
Va=!m||!La;ld();var $a=Fe.allowStateChanges;Va&&(pc(),$a=xc(!0));var lb=Ed(!0),ub=hr++,Rb=gr;gr=ub;try{var ec=g.apply(ia,ua);break a}catch(tc){var Vb=tc;throw tc;}finally{gr!==ub&&n(30),gr=Rb,void 0!==Vb&&(Fe.suppressReactionErrors=!0),Fe.allowStateChanges=$a,Fe.allowStateReads=lb,Sd(),Va&&(Fe.trackingDerivation=La),Fe.suppressReactionErrors=!1}ec=void 0}return ec}void 0===m&&(m=!1);W.isMobxAction=!0;T&&(la.value=b,Object.defineProperty(W,"name",la));return W}function Gb(b,g){b=xc(b);try{return g()}finally{Fe.allowStateChanges=
b}}function xc(b){var g=Fe.allowStateChanges;Fe.allowStateChanges=b;return g}function Wc(b){switch(b.dependenciesState_){case Bd.UP_TO_DATE_:return!1;case Bd.NOT_TRACKING_:case Bd.STALE_:return!0;case Bd.POSSIBLY_STALE_:for(var g=Ed(!0),m=pc(),I=b.observing_,W=I.length,ia=0;ia<W;ia++){var ua=I[ia];if(dd(ua)){if(Fe.disableErrorBoundaries)ua.get();else try{ua.get()}catch(La){return Fe.trackingDerivation=m,Fe.allowStateReads=g,!0}if(b.dependenciesState_===Bd.STALE_)return Fe.trackingDerivation=m,Fe.allowStateReads=
g,!0}}xd(b);Fe.trackingDerivation=m;Fe.allowStateReads=g;return!1}}function hd(b,g,m){var I=Ed(!0);xd(b);b.newObserving_=Array(b.observing_.length+100);b.unboundDepsCount_=0;b.runId_=++Fe.runId;var W=Fe.trackingDerivation;Fe.trackingDerivation=b;Fe.inBatch++;if(!0===Fe.disableErrorBoundaries)var ia=g.call(m);else try{ia=g.call(m)}catch(lb){ia=new Xf(lb)}Fe.inBatch--;Fe.trackingDerivation=W;var ua=b.observing_;g=b.observing_=b.newObserving_;m=Bd.UP_TO_DATE_;W=0;for(var La=b.unboundDepsCount_,Va=0;Va<
La;Va++){var $a=g[Va];0===$a.diffValue_&&($a.diffValue_=1,W!==Va&&(g[W]=$a),W++);$a.dependenciesState_>m&&(m=$a.dependenciesState_)}g.length=W;b.newObserving_=null;for(La=ua.length;La--;)Va=ua[La],0===Va.diffValue_&&ud(Va,b),Va.diffValue_=0;for(;W--;)ua=g[W],1===ua.diffValue_&&(ua.diffValue_=0,La=b,ua.observers_.add(La),ua.lowestObserverState_>La.dependenciesState_&&(ua.lowestObserverState_=La.dependenciesState_));m!==Bd.UP_TO_DATE_&&(b.dependenciesState_=m,b.onBecomeStale_());Fe.allowStateReads=
I;return ia}function Nd(b){var g=b.observing_;b.observing_=[];for(var m=g.length;m--;)ud(g[m],b);b.dependenciesState_=Bd.NOT_TRACKING_}function Ld(b){var g=pc();try{return b()}finally{Fe.trackingDerivation=g}}function pc(){var b=Fe.trackingDerivation;Fe.trackingDerivation=null;return b}function Ed(b){var g=Fe.allowStateReads;Fe.allowStateReads=b;return g}function xd(b){if(b.dependenciesState_!==Bd.UP_TO_DATE_){b.dependenciesState_=Bd.UP_TO_DATE_;b=b.observing_;for(var g=b.length;g--;)b[g].lowestObserverState_=
Bd.UP_TO_DATE_}}function Yd(){(Fe.pendingReactions.length||Fe.inBatch||Fe.isRunningReactions)&&n(36);Cg=!0;if(jf){var b=R();0===--b.__mobxInstanceCount&&(b.__mobxGlobals=void 0);Fe=new oh}}function ud(b,g){b.observers_["delete"](g);0===b.observers_.size&&Qd(b)}function Qd(b){!1===b.isPendingUnobservation_&&(b.isPendingUnobservation_=!0,Fe.pendingUnobservations.push(b))}function ld(){Fe.inBatch++}function Sd(){if(0===--Fe.inBatch){0<Fe.inBatch||Fe.isRunningReactions||Wd(mb);for(var b=Fe.pendingUnobservations,
g=0;g<b.length;g++){var m=b[g];m.isPendingUnobservation_=!1;0===m.observers_.size&&(m.isBeingObserved_&&(m.isBeingObserved_=!1,m.onBUO()),m instanceof Ic&&m.suspend_())}Fe.pendingUnobservations=[]}}function Nb(b){var g=Fe.trackingDerivation;if(null!==g)return g.runId_!==b.lastAccessedBy_&&(b.lastAccessedBy_=g.runId_,g.newObserving_[g.unboundDepsCount_++]=b,!b.isBeingObserved_&&Fe.trackingContext&&(b.isBeingObserved_=!0,b.onBO())),b.isBeingObserved_;0===b.observers_.size&&0<Fe.inBatch&&Qd(b);return!1}
function gc(b){b.lowestObserverState_!==Bd.STALE_&&(b.lowestObserverState_=Bd.STALE_,b.observers_.forEach(function(g){if(g.dependenciesState_===Bd.UP_TO_DATE_)g.onBecomeStale_();g.dependenciesState_=Bd.STALE_}))}function Yb(b){b.lowestObserverState_!==Bd.STALE_&&(b.lowestObserverState_=Bd.STALE_,b.observers_.forEach(function(g){g.dependenciesState_===Bd.POSSIBLY_STALE_?g.dependenciesState_=Bd.STALE_:g.dependenciesState_===Bd.UP_TO_DATE_&&(b.lowestObserverState_=Bd.UP_TO_DATE_)}))}function qb(b){b.lowestObserverState_===
Bd.UP_TO_DATE_&&(b.lowestObserverState_=Bd.POSSIBLY_STALE_,b.observers_.forEach(function(g){g.dependenciesState_===Bd.UP_TO_DATE_&&(g.dependenciesState_=Bd.POSSIBLY_STALE_,g.onBecomeStale_())}))}function mb(){Fe.isRunningReactions=!0;for(var b=Fe.pendingReactions,g=0;0<b.length;){++g===me&&(console.error("[mobx] cycle in reaction: "+b[0]),b.splice(0));for(var m=b.splice(0),I=0,W=m.length;I<W;I++)m[I].runReaction_()}Fe.isRunningReactions=!1}function cc(b){var g=Wd;Wd=function(m){return b(function(){return g(m)})}}
function uc(b){console.warn("[mobx.spy] Is a no-op in production builds");return function(){}}function Uc(b){return function(g,m){if(ma(g))return Nc(g.name||"\x3cunnamed action\x3e",g,b);if(ma(m))return Nc(g,m,b);if(Y(m))return Ea(g,m,b?ug:kf);if(Y(g))return Ua(eb(b?"autoAction":af,{name:g,autoAction:b}))}}function cd(b){return ma(b)&&!0===b.isMobxAction}function Od(b,g){function m(){b(Va)}var I,W;void 0===g&&(g=nq);var ia=null!=(I=null==(W=g)?void 0:W.name)?I:"Autorun";if(g.scheduler||g.delay){var ua=
be(g),La=!1;var Va=new Wg(ia,function(){La||(La=!0,ua(function(){La=!1;Va.isDisposed_||Va.track(m)}))},g.onError,g.requiresObservable)}else Va=new Wg(ia,function(){this.track(m)},g.onError,g.requiresObservable);Va.schedule_();return Va.getDisposer_()}function be(b){return b.scheduler?b.scheduler:b.delay?function(g){return setTimeout(g,b.delay)}:Lo}function oe(b,g,m){function I(){lb=!1;if(!Vb.isDisposed_){var tc=!1;Vb.track(function(){var oc=Gb(!1,function(){return b(Vb)});tc=$a||!ec(ub,oc);Rb=ub;
ub=oc});$a&&m.fireImmediately?ua(ub,Rb,Vb):!$a&&tc&&ua(ub,Rb,Vb);$a=!1}}var W;void 0===m&&(m=nq);var ia=null!=(W=m.name)?W:"Reaction",ua=hf(ia,m.onError?rd(m.onError,g):g),La=!m.scheduler&&!m.delay,Va=be(m),$a=!0,lb=!1,ub,Rb,ec=m.compareStructural?No.structural:m.equals||No["default"],Vb=new Wg(ia,function(){$a||La?I():lb||(lb=!0,Va(I))},m.onError,m.requiresObservable);Vb.schedule_();return Vb.getDisposer_()}function rd(b,g){return function(){try{return g.apply(this,arguments)}catch(m){b.call(this,
m)}}}function vc(b,g,m){return Mc(nC,b,g,m)}function Mc(b,g,m,I){var W="function"===typeof I?vg(g,m):vg(g),ia=ma(I)?I:m,ua=b+"L";W[ua]?W[ua].add(ia):W[ua]=new Set([ia]);return function(){var La=W[ua];La&&(La["delete"](ia),0===La.size&&delete W[ua])}}function Me(b){!0===b.isolateGlobalState&&Yd();var g=b.useProxies,m=b.enforceActions;void 0!==g&&(Fe.useProxies="always"===g?!0:"never"===g?!1:"undefined"!==typeof Proxy);"ifavailable"===g&&(Fe.verifyProxies=!0);void 0!==m&&(g="always"===m?"always":"observed"===
m,Fe.enforceActions=g,Fe.allowStateChanges=!0===g||"always"===g?!1:!0);["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(I){I in b&&(Fe[I]=!!b[I])});Fe.allowStateReads=!Fe.observableRequiresReaction;b.reactionScheduler&&cc(b.reactionScheduler)}function qc(b,g,m,I){var W=Vn(g),ia=Dd(b,I)[Zg];ld();try{up(W).forEach(function(ua){ia.extend_(ua,W[ua],m?ua in m?m[ua]:!0:!0)})}finally{Sd()}return b}function Le(b){var g=
{name:b.name_};b.observing_&&0<b.observing_.length&&(g.dependencies=Array.from(new Set(b.observing_)).map(Le));return g}function Sb(){this.message="FLOW_CANCELLED"}function Lc(b){return!0===(null==b?void 0:b.isMobXFlow)}function Ub(b,g){return b?void 0!==g?Xd(b)?b[Zg].values_.has(g):!1:Xd(b)||!!b[Zg]||tq(b)||je(b)||dd(b):!1}function ed(b){if(Xd(b))return b[Zg].ownKeys_();n(38)}function pe(b,g,m){b.set(g,m);return m}function le(b,g){if(null==b||"object"!==typeof b||b instanceof Date||!Ub(b))return b;
if(Ib(b)||dd(b))return le(b.get(),g);if(g.has(b))return g.get(b);if(jb(b)){var m=pe(g,b,Array(b.length));b.forEach(function(ua,La){m[La]=le(ua,g)});return m}if(Iq(b)){var I=pe(g,b,new Set);b.forEach(function(ua){I.add(le(ua,g))});return I}if(Ip(b)){var W=pe(g,b,new Map);b.forEach(function(ua,La){W.set(La,le(ua,g))});return W}var ia=pe(g,b,{});ed(b).forEach(function(ua){Un.propertyIsEnumerable.call(b,ua)&&(ia[ua]=le(b[ua],g))});return ia}function Dc(b,g){return le(b,new Map)}function Cb(){n("trace() is not available in production builds");
for(var b=!1,g=arguments.length,m=Array(g),I=0;I<g;I++)m[I]=arguments[I];"boolean"===typeof m[m.length-1]&&(b=m.pop());a:{switch(m.length){case 0:g=Fe.trackingDerivation;break a;case 1:g=vg(m[0]);break a;case 2:g=vg(m[0],m[1]);break a}g=void 0}if(!g)return n("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");g.isTracing_===Ee.NONE&&console.log("[mobx.trace] '"+g.name_+"' tracing enabled");g.isTracing_=b?
Ee.BREAK:Ee.LOG}function Kd(b,g){void 0===g&&(g=void 0);ld();try{return b.apply(g)}finally{Sd()}}function ce(b){return void 0!==b.interceptors_&&0<b.interceptors_.length}function pd(b,g){var m=b.interceptors_||(b.interceptors_=[]);m.push(g);return L(function(){var I=m.indexOf(g);-1!==I&&m.splice(I,1)})}function mc(b,g){var m=pc();try{var I=[].concat(b.interceptors_||[]);b=0;for(var W=I.length;b<W&&((g=I[b](g))&&!g.type&&n(14),g);b++);return g}finally{Fe.trackingDerivation=m}}function Ne(b){return void 0!==
b.changeListeners_&&0<b.changeListeners_.length}function Wf(b,g){var m=b.changeListeners_||(b.changeListeners_=[]);m.push(g);return L(function(){var I=m.indexOf(g);-1!==I&&m.splice(I,1)})}function cf(b,g){var m=pc();if(b=b.changeListeners_){b=b.slice();for(var I=0,W=b.length;I<W;I++)b[I](g);Fe.trackingDerivation=m}}function pg(b,g,m){var I=Dd(b,m)[Zg];ld();try{var W;null!=(W=g)?W:g=Oa(b);up(g).forEach(function(ia){return I.make_(ia,g[ia])})}finally{Sd()}return b}function bb(b,g,m,I){void 0===m&&(m=
"ObservableArray");void 0===I&&(I=!1);ka();g=new nv(m,g,I,!1);Q(g.values_,Zg,g);m=new Proxy(g.values_,lC);g.proxy_=m;b&&b.length&&(I=xc(!0),g.spliceWithArray_(0,0,b),Fe.allowStateChanges=I);return m}function Db(b,g){"function"===typeof Array.prototype[b]&&(Gt[b]=g(b))}function db(b){return function(){var g=this[Zg];g.atom_.reportObserved();g=g.dehanceValues_(g.values_);return g[b].apply(g,arguments)}}function Eb(b){return function(g,m){var I=this,W=this[Zg];W.atom_.reportObserved();return W.dehanceValues_(W.values_)[b](function(ia,
ua){return g.call(m,ia,ua,I)})}}function hc(b){return function(){var g=this,m=this[Zg];m.atom_.reportObserved();m=m.dehanceValues_(m.values_);var I=arguments[0];arguments[0]=function(W,ia,ua){return I(W,ia,ua,g)};return m[b].apply(m,arguments)}}function jb(b){return fa(b)&&qC(b[Zg])}function gd(b){if(O(b)||Ip(b))return b;if(Array.isArray(b))return new Map(b);if(H(b)){var g=new Map,m;for(m in b)g.set(m,b[m]);return g}return n(21,b)}function Dd(b,g){var m;if(F(b,Zg))return b;var I=null!=(m=null==g?
void 0:g.name)?m:"ObservableObject";m=ey;var W=new Map;I=String(I);var ia;var ua=g?null!=(ia=g.defaultDecorator)?ia:nb(g):void 0;g=new m(b,W,I,ua);M(b,Zg,g);return b}function ke(b){return dy[b]||(dy[b]={get:function(){return this[Zg].getObservablePropValue_(b)},set:function(g){return this[Zg].setObservablePropValue_(b,g)}})}function Xd(b){return fa(b)?xC(b[Zg]):!1}function Xe(b){return{enumerable:!1,configurable:!0,get:function(){return this[Zg].get_(b)},set:function(g){this[Zg].set_(b,g)}}}function qe(b){if(b>
jv){for(var g=jv;g<b+100;g++)dn(kv.prototype,""+g,Xe(g));jv=b}}function ff(b,g,m){return new kv(b,g,m)}function vg(b,g){if("object"===typeof b&&null!==b){if(jb(b))return void 0!==g&&n(23),b[Zg].atom_;if(Iq(b))return b[Zg];if(Ip(b)){if(void 0===g)return b.keysAtom_;var m=b.data_.get(g)||b.hasMap_.get(g);m||n(25,g,Ab(b));return m}if(Xd(b)){if(!g)return n(26);(m=b[Zg].values_.get(g))||n(27,g,Ab(b));return m}if(tq(b)||dd(b)||je(b))return b}else if(ma(b)&&je(b[Zg]))return b[Zg];n(28)}function uf(b,g){b||
n(29);if(void 0!==g)return uf(vg(b,g));if(tq(b)||dd(b)||je(b)||Ip(b)||Iq(b))return b;if(b[Zg])return b[Zg];n(24,b)}function Ab(b,g){if(void 0!==g)b=vg(b,g);else{if(cd(b))return b.name;b=Xd(b)||Ip(b)||Iq(b)?uf(b):vg(b)}return b.name_}function sa(b,g,m){void 0===m&&(m=-1);return qa(b,g,m)}function qa(b,g,m,I,W){if(b===g)return 0!==b||1/b===1/g;if(null==b||null==g)return!1;if(b!==b)return g!==g;var ia=typeof b;if("function"!==ia&&"object"!==ia&&"object"!=typeof g)return!1;ia=Zx.call(b);if(ia!==Zx.call(g))return!1;
switch(ia){case "[object RegExp]":case "[object String]":return""+b===""+g;case "[object Number]":return+b!==+b?+g!==+g:0===+b?1/+b===1/g:+b===+g;case "[object Date]":case "[object Boolean]":return+b===+g;case "[object Symbol]":return"undefined"!==typeof Symbol&&Symbol.valueOf.call(b)===Symbol.valueOf.call(g);case "[object Map]":case "[object Set]":0<=m&&m++}b=Ia(b);g=Ia(g);ia="[object Array]"===ia;if(!ia){if("object"!=typeof b||"object"!=typeof g)return!1;var ua=b.constructor,La=g.constructor;if(ua!==
La&&!(ma(ua)&&ua instanceof ua&&ma(La)&&La instanceof La)&&"constructor"in b&&"constructor"in g)return!1}if(0===m)return!1;0>m&&(m=-1);I=I||[];W=W||[];for(ua=I.length;ua--;)if(I[ua]===b)return W[ua]===g;I.push(b);W.push(g);if(ia){ua=b.length;if(ua!==g.length)return!1;for(;ua--;)if(!qa(b[ua],g[ua],m-1,I,W))return!1}else{ia=Object.keys(b);ua=ia.length;if(Object.keys(g).length!==ua)return!1;for(;ua--;)if(La=ia[ua],!F(g,La)||!qa(b[La],g[La],m-1,I,W))return!1}I.pop();W.pop();return!0}function Ia(b){return jb(b)?
b.slice():O(b)||Ip(b)||P(b)||Iq(b)?Array.from(b.entries()):b}function cb(b){b[Symbol.iterator]=Jb;return b}function Jb(){return this}function lc(b,g){const m=new Set(g),I=Object.values(b),W=new Set(I.filter(ia=>m.has(ia.toId)||m.has(ia.fromId)));b=W.size;for(g=-1;0!==g;)W.forEach(ia=>{ia=ia.fromId;for(const ua of I)ua.fromId===ia&&W.add(ua),ua.toId===ia&&W.add(ua)}),g=W.size-b,b=W.size;return Array.from(W.values())}function Sc(b,g,m,I,W,ia,ua,La){if(W=g.getBindingPoint(W,ia,ua,La))return{id:I,type:"line",
fromId:b.id,toId:g.id,handleId:m,point:Zd.toFixed(W.point),distance:W.distance}}function kd(b,g){const m=b.getCenter(),I=g.getCenter();var W=Of();W=Ga(te({},us.defaultProps),{id:W,type:us.id,parentId:b.props.parentId,point:m});b=Sc(W,b,"start",Of(),m,m,Zd.uni(Zd.sub(I,m)),!1);g=Sc(W,g,"end",Of(),I,I,Zd.uni(Zd.sub(m,I)),!1);return b&&g?(W.handles.start.point=[0,0],W.handles.end.point=Zd.sub(I,m),W.handles.start.bindingId=b.id,W.handles.end.bindingId=g.id,[W,[b,g]]):null}function ve(){return new fC}
function Ue(){return new WeakMap}function Kf(b){if(!b)return dv(null);var g=b.constructor;if(g===Object)return b===Object.prototype?{}:dv(b);if(~dC.call(g).indexOf("[native code]"))try{return new g}catch(m){}return dv(b)}function eg(b){var g="";b.global&&(g+="g");b.ignoreCase&&(g+="i");b.multiline&&(g+="m");b.unicode&&(g+="u");b.sticky&&(g+="y");return g}function Hf(b){return b.flags}function xf(b){b=eC.call(b);return b.substring(8,b.length-1)}function Qf(b){return b[Symbol.toStringTag]||xf(b)}function Pg(b){return gy(b).concat(pv(b))}
function ei(b,g,m){for(var I=EC(b),W=0,ia=I.length,ua,La;W<ia;++W)if(ua=I[W],"callee"!==ua&&"caller"!==ua)if(La=CC(b,ua)){La.get||La.set||(La.value=m.copier(La.value,m));try{AC(g,ua,La)}catch(Va){g[ua]=La.value}}else g[ua]=m.copier(b[ua],m);return g}function uh(b,g){var m=new g.Constructor;g.cache.set(b,m);b.forEach(function(I,W){m.set(W,g.copier(I,g))});return m}function li(b,g){var m=Kf(g.prototype);g.cache.set(b,m);for(var I in b)iy.call(b,I)&&(m[I]=g.copier(b[I],g));return m}function Zh(b,g){var m=
Kf(g.prototype);g.cache.set(b,m);for(var I in b)iy.call(b,I)&&(m[I]=g.copier(b[I],g));I=pv(b);for(var W=0,ia=I.length,ua;W<ia;++W)ua=I[W],DC.call(b,ua)&&(m[ua]=g.copier(b[ua],g));return m}function qg(b,g){return new g.Constructor(b.valueOf())}function Rh(b,g){return b}function df(b,g){var m=new g.Constructor;g.cache.set(b,m);b.forEach(function(I){m.add(g.copier(I,g))});return m}function Sh(b){function g(ia,ua){ua.prototype=ua.Constructor=void 0;if(!ia||"object"!==typeof ia)return ia;if(ua.cache.has(ia))return ua.cache.get(ia);
ua.prototype=ia.__proto__||yC(ia);ua.Constructor=ua.prototype&&ua.prototype.constructor;if(!ua.Constructor||ua.Constructor===Object)return W(ia,ua);if(FC(ia))return I(ia,ua);var La=m[zC(ia)];return La?La(ia,ua):"function"===typeof ia.then?ia:W(ia,ua)}b=ov({},fy,b);var m={Arguments:b.object,Array:b.array,ArrayBuffer:b.arrayBuffer,Blob:b.blob,Boolean:qg,DataView:b.dataView,Date:b.date,Error:b.error,Float32Array:b.arrayBuffer,Float64Array:b.arrayBuffer,Int8Array:b.arrayBuffer,Int16Array:b.arrayBuffer,
Int32Array:b.arrayBuffer,Map:b.map,Number:qg,Object:b.object,Promise:Rh,RegExp:b.regExp,Set:b.set,String:qg,WeakMap:Rh,WeakSet:Rh,Uint8Array:b.arrayBuffer,Uint8ClampedArray:b.arrayBuffer,Uint16Array:b.arrayBuffer,Uint32Array:b.arrayBuffer,Uint64Array:b.arrayBuffer},I=m.Array,W=m.Object;return function(ia){return g(ia,{Constructor:void 0,cache:bC(),copier:g,prototype:void 0})}}function yi(b,g){return(0,GC.default)(b,g,{arrayMerge:(m,I,W)=>I})}function Cl(b,g,m,I=!1){const [W,ia]=g,[ua,La]=m;b=ua+(b-
W)/(ia-W)*(La-ua);return I?ua<La?Math.max(Math.min(b,La),ua):Math.max(Math.min(b,ua),La):b}function vj(b,g){return new Promise((m,I)=>{if(g){const W=document.createElement("video");W.addEventListener("loadedmetadata",function(){m([this.videoWidth,this.videoHeight])},!1);W.src=b}else{const W=new Image;W.onload=()=>m([W.width,W.height]);W.src=b;W.onerror=ia=>I(ia)}})}function zf(b,g){return Object.values(bc).includes(b)||null==b?`var(--ls-wb-${g}-color-${b?b:"default"})`:b}function Bj(){var b;null==
(b=document.getElementById("__textLabelMeasure"))?void 0:b.remove();b=document.createElement("pre");b.id="__textLabelMeasure";Object.assign(b.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)"});b.tabIndex=-1;document.body.appendChild(b);return b}
function oj(b,g,m=0){var I,W,ia;if(!b)return[16,32];let ua;ua="string"===typeof g?g:`${null!=(I=g.fontStyle)?I:"normal"} ${null!=(W=g.fontVariant)?W:"normal"} ${null!=(ia=g.fontWeight)?ia:"normal"} ${g.fontSize}px/${g.fontSize*g.lineHeight}px ${g.fontFamily}`;if(!uv.has(`${b}-${ua}-${m}`)){if(!Jp)return[10,10];Jp.parentNode||document.body.appendChild(Jp);Jp.innerHTML=`${b}&#8203;`;Jp.style.font=ua;Jp.style.padding=m+"px";g=Jp.getBoundingClientRect();uv.set(`${b}-${ua}-${m}`,[Math.ceil(g.width||1),
Math.ceil(g.height||1)])}return uv.get(`${b}-${ua}-${m}`)}function Wh(b){try{if("string"!==typeof b||!nd.test(b))throw TypeError("Invalid UUID");let g;const m=new Uint8Array(16);m[0]=(g=parseInt(b.slice(0,8),16))>>>24;m[1]=g>>>16&255;m[2]=g>>>8&255;m[3]=g&255;m[4]=(g=parseInt(b.slice(9,13),16))>>>8;m[5]=g&255;m[6]=(g=parseInt(b.slice(14,18),16))>>>8;m[7]=g&255;m[8]=(g=parseInt(b.slice(19,23),16))>>>8;m[9]=g&255;m[10]=(g=parseInt(b.slice(24,36),16))/1099511627776&255;m[11]=g/4294967296&255;m[12]=g>>>
24&255;m[13]=g>>>16&255;m[14]=g>>>8&255;m[15]=g&255;return!0}catch(g){return!1}}function Dl(b,g=0,m){let I;return function(...W){null==m?void 0:m(...W);clearTimeout(I);I=setTimeout(()=>b.apply(W),g)}}function wk(b,g){return Ya(b,["symbol"===typeof g?g:g+""])}function xk(){return/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)}function Kg(b){return!!b}function Oj(b=0){return new Promise(g=>setTimeout(g,b))}function Cj(b="noid"){tv[b]||(tv[b]=ny.createContext({}));return tv[b]}function Ki(b="noid"){return ny.useContext(Cj(b))}
function lk(b){const {callbacks:g}=Ki(),m=oy.useRef(-1);return oy.useMemo(()=>{const I=W=>{var ia,ua;const {order:La=0}=W;if(!La){var Va=W.target;Va.removeEventListener("pointerup",I);Va.releasePointerCapture(W.pointerId);null==(ia=g.onPointerUp)?void 0:ia.call(g,{type:"selection",handle:b,order:La},W);ia=Date.now();Va=ia-m.current;300<Va?m.current=ia:300>=Va&&(null==(ua=g.onDoubleClick)?void 0:ua.call(g,{type:"selection",handle:b,order:La},W),m.current=-1);W.order=La+1}};return{onPointerDown:W=>
{var ia;const {order:ua=0}=W;if(!ua){var La=Yj(W.currentTarget);La.setPointerCapture(W.pointerId);La.addEventListener("pointerup",I);null==(ia=g.onPointerDown)?void 0:ia.call(g,{type:"selection",handle:b,order:ua},W);W.order=ua+1}},onPointerMove:W=>{var ia;const {order:ua=0}=W;ua||(null==(ia=g.onPointerMove)?void 0:ia.call(g,{type:"selection",handle:b,order:ua},W),W.order=ua+1)},onPointerEnter:W=>{var ia;const {order:ua=0}=W;ua||(null==(ia=g.onPointerEnter)?void 0:ia.call(g,{type:"selection",handle:b,
order:ua},W),W.order=ua+1)},onPointerLeave:W=>{var ia;const {order:ua=0}=W;ua||(null==(ia=g.onPointerLeave)?void 0:ia.call(g,{type:"selection",handle:b,order:ua},W),W.order=ua+1)},onKeyDown:W=>{var ia;null==(ia=g.onKeyDown)?void 0:ia.call(g,{type:"selection",handle:b,order:-1},W)},onKeyUp:W=>{var ia;null==(ia=g.onKeyUp)?void 0:ia.call(g,{type:"selection",handle:b,order:-1},W)}}},[g])}function Yj(b){var g;if(null==(g=b.namespaceURI)?0:g.endsWith("svg")){if(b.parentElement)return Yj(b.parentElement);
throw Error("Could not find a parent element of an HTML type!");}return b}function Pj(b,g,m){const I=Es.useRef(!1),W=Es.useCallback(()=>{var ia;if(I.current){const ua=null==(ia=b.current)?void 0:ia.getBoundingClientRect();ua&&(ia={minX:ua.left,maxX:ua.left+ua.width,minY:ua.top,maxY:ua.top+ua.height,width:ua.width,height:ua.height},g.updateBounds(ia),null==m?void 0:m(ia))}else I.current=!0},[b,m]);Es.useEffect(()=>{const ia=b.current?KC(b.current):document,ua=Dl(W,100);ia.addEventListener("scroll",
ua);window.addEventListener("resize",ua);return()=>{ia.removeEventListener("scroll",ua);window.removeEventListener("resize",ua)}},[]);Es.useLayoutEffect(()=>{const ia=new ResizeObserver(ua=>{ua[0].contentRect&&W()});b.current&&ia.observe(b.current);return()=>{ia.disconnect()}},[b]);Es.useEffect(()=>{W();setTimeout(()=>{var ia,ua;null==(ua=null==(ia=b.current)?void 0:ia.querySelector(".tl-canvas"))?void 0:ua.focus()})},[b])}function kl(b,g){return Object.keys(g).reduce((m,I)=>{const W=g[I];return W?
m+`${`--${b}-${I}`}: ${W};
`:m},"")}function Xk(b,g,m=".logseq-tldraw"){sv.useLayoutEffect(()=>{const I=document.createElement("style"),W=kl(b,g);I.setAttribute("id",`${b}-theme`);I.setAttribute("data-selector",m);I.innerHTML=`
        ${m} {
          ${W}
        }
      `;document.head.appendChild(I);return()=>{I&&document.head.contains(I)&&document.head.removeChild(I)}},[b,g,m])}function El(b,g){sv.useLayoutEffect(()=>{if(rv.get(b))return()=>{};const m=document.createElement("style");m.innerHTML=g;m.setAttribute("id",b);document.head.appendChild(m);rv.set(b,m);return()=>{m&&document.head.contains(m)&&(document.head.removeChild(m),rv.delete(b))}},[b,g])}function Zj(b,g){const m=sv.useMemo(()=>te(te({},JC),b),[b]);Xk("tl",m,g);El("tl-canvas",IC)}function Qj(b=
"noid"){Bv[b]||(Bv[b]=my.createContext({}));return Bv[b]}function xg(b="noid"){return my.useContext(Qj(b))}function jg(){const b=xg(),{callbacks:g}=Ki(),m=qv.useRef(-1);return qv.useMemo(()=>({onPointerDown:I=>{var W,ia,ua;const {order:La=0}=I;La||(null==(W=I.currentTarget)?void 0:W.setPointerCapture(I.pointerId));I.isPrimary&&(null==(ia=g.onPointerDown)?void 0:ia.call(g,{type:"canvas",order:La},I),W=Date.now(),ia=W-m.current,300<ia?m.current=W:300>=ia&&(null==(ua=g.onDoubleClick)?void 0:ua.call(g,
{type:"canvas",order:La},I),m.current=-1))},onPointerMove:I=>{var W;const {order:ia=0}=I;null==(W=g.onPointerMove)?void 0:W.call(g,{type:"canvas",order:ia},I)},onPointerUp:I=>{var W,ia;const {order:ua=0}=I;ua||(null==(W=I.currentTarget)?void 0:W.releasePointerCapture(I.pointerId));null==(ia=g.onPointerUp)?void 0:ia.call(g,{type:"canvas",order:ua},I)},onPointerEnter:I=>{var W;const {order:ia=0}=I;null==(W=g.onPointerEnter)?void 0:W.call(g,{type:"canvas",order:ia},I)},onPointerLeave:I=>{var W;const {order:ia=
0}=I;null==(W=g.onPointerLeave)?void 0:W.call(g,{type:"canvas",order:ia},I)},onDrop:I=>vd(this,null,function*(){I.preventDefault();b.drop(I.dataTransfer,[I.clientX,I.clientY])}),onDragOver:I=>{I.preventDefault()},onTouchEnd:I=>{I.preventDefault()}}),[g])}function lg(b,g,m){return 0===g||Infinity===Math.abs(g)?Math.pow(b,5*m):b*g*m/(g+m*b)}function dj(b,g,m,I=.15){return 0===I?Math.max(g,Math.min(b,m)):b<g?-lg(g-b,m-g,I)+g:b>m?+lg(b-m,m-g,I)+m:b}function Eh(b,[g,m],[I,W]){const [[ia,ua],[La,Va]]=b;
return[dj(g,ia,ua,I),dj(m,La,Va,W)]}function Xg(b,g,m){g in b?Object.defineProperty(b,g,{value:m,enumerable:!0,configurable:!0,writable:!0}):b[g]=m;return b}function ak(b,g){var m=Object.keys(b);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(b);g&&(I=I.filter(function(W){return Object.getOwnPropertyDescriptor(b,W).enumerable}));m.push.apply(m,I)}return m}function Ag(b){for(var g=1;g<arguments.length;g++){var m=null!=arguments[g]?arguments[g]:{};g%2?ak(Object(m),!0).forEach(function(I){Xg(b,
I,m[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(m)):ak(Object(m)).forEach(function(I){Object.defineProperty(b,I,Object.getOwnPropertyDescriptor(m,I))})}return b}function Th(b){return b?b[0].toUpperCase()+b.slice(1):""}function nk(b=!1,g){return b&&!eD.includes(g)}function yk(b,g="",m=!1){const I=ty[b];g=I?I[g]||g:g;return"on"+Th(b)+Th(g)+(nk(m,g)?"Capture":"")}function Kh(b){b=b.substring(2).toLowerCase();const g=!!~b.indexOf("passive");g&&(b=
b.replace("passive",""));var m=fD.includes(b)?"capturecapture":"capture";(m=!!~b.indexOf(m))&&(b=b.replace("capture",""));return{device:b,capture:m,passive:g}}function Di(b,g=""){const m=ty[b];return b+(m?m[g]||g:g)}function Lh(b){return"touches"in b?"touch":"pointerType"in b?b.pointerType:"mouse"}function Yk(b){return Array.from(b.touches).filter(g=>{var m,I;return g.target===b.currentTarget||(null===(m=b.currentTarget)||void 0===m?void 0:null===(I=m.contains)||void 0===I?void 0:I.call(m,g.target))})}
function bk(b){return"touches"in b?("touchend"===b.type||"touchcancel"===b.type?b.changedTouches:b.targetTouches)[0]:b}function wj(b,g){const m=g.clientX-b.clientX,I=g.clientY-b.clientY;return{angle:-(180*Math.atan2(m,I))/Math.PI,distance:Math.hypot(m,I),origin:[(g.clientX+b.clientX)/2,(g.clientY+b.clientY)/2]}}function Fl(b){return Yk(b).map(g=>g.identifier)}function Em(b,g){const [m,I]=Array.from(b.touches).filter(W=>g.includes(W.identifier));return wj(m,I)}function Rj(b){const g=bk(b);return"touches"in
b?g.identifier:g.pointerId}function fi(b){b=bk(b);return[b.clientX,b.clientY]}function Sj(b){let {deltaX:g,deltaY:m,deltaMode:I}=b;1===I?(g*=40,m*=40):2===I&&(g*=800,m*=800);return[g,m]}function Mh(b,...g){return"function"===typeof b?b(...g):b}function ej(){}function Nh(...b){return 0===b.length?ej:1===b.length?b[0]:function(){let g;for(const m of b)g=m.apply(this,arguments)||g;return g}}function Yi([b,g],m){b=Math.abs(b);g=Math.abs(g);if(b>g&&b>m)return"x";if(g>b&&g>m)return"y"}function mi(b){const [g,
m]=b.overflow,[I,W]=b._delta,[ia,ua]=b._direction;if(0>g&&0<I&&0>ia||0<g&&0>I&&0<ia)b._movement[0]=b._movementBound[0];if(0>m&&0<W&&0>ua||0<m&&0>W&&0<ua)b._movement[1]=b._movementBound[1]}function Zk(b){xv.set(b.key,b.engine);wv.set(b.key,b.resolver)}function ck(b={},g){const m={};for(const [I,W]of Object.entries(g))switch(typeof W){case "function":m[I]=W.call(m,b[I],I,b);break;case "object":m[I]=ck(b[I],W);break;case "boolean":W&&(m[I]=b[I])}return m}function fj(b,g,m={}){const {target:I,eventOptions:W,
window:ia,enabled:ua,transform:La}=b;var Va=xD;if(null==b)b={};else{if(null==b)var $a={};else{$a={};var lb=Object.keys(b),ub;for(ub=0;ub<lb.length;ub++){var Rb=lb[ub];0<=Va.indexOf(Rb)||($a[Rb]=b[Rb])}}if(Object.getOwnPropertySymbols)for(ub=Object.getOwnPropertySymbols(b),Rb=0;Rb<ub.length;Rb++)lb=ub[Rb],0<=Va.indexOf(lb)||Object.prototype.propertyIsEnumerable.call(b,lb)&&($a[lb]=b[lb]);b=$a}m.shared=ck({target:I,eventOptions:W,window:ia,enabled:ua,transform:La},OC);if(g){var ec=wv.get(g);m[g]=ck(Ag({shared:m.shared},
b),ec)}else for(ec in b)(g=wv.get(ec))&&(m[ec]=ck(Ag({shared:m.shared},b[ec]),g));return m}function zg(b,g){b.gestures.add(g);b.gestureEventStores[g]=new Qy(b,g);b.gestureTimeoutStores[g]=new qy}function Ei(b,g,m,I,W,ia){if(b.has(m)&&xv.has(I)){var ua=m+"Start",La=m+"End";W[I]=Va=>{let $a=void 0;if(Va.first&&ua in g)g[ua](Va);m in g&&($a=g[m](Va));if(Va.last&&La in g)g[La](Va);return $a};ia[I]=ia[I]||{}}}function ni(b,g={},m,I){const W=vv.default.useMemo(()=>new ry(b),[]);W.applyHandlers(b,I);W.applyConfig(g,
m);vv.default.useEffect(W.effect.bind(W));vv.default.useEffect(()=>W.clean.bind(W),[]);if(void 0===g.target)return W.bind.bind(W)}function Ej(b){b.forEach(Zk);return function(g,m){m=m||{};const I={},W={},ia=new Set;for(let Rb in g)yv.test(Rb)?(ia.add(RegExp.lastMatch),W[Rb]=g[Rb]):I[Rb]=g[Rb];const [ua,La,Va]=[W,I,ia];g={};Ei(Va,ua,"onDrag","drag",g,m);Ei(Va,ua,"onWheel","wheel",g,m);Ei(Va,ua,"onScroll","scroll",g,m);Ei(Va,ua,"onPinch","pinch",g,m);Ei(Va,ua,"onMove","move",g,m);Ei(Va,ua,"onHover",
"hover",g,m);const {handlers:$a,nativeHandlers:lb,config:ub}={handlers:g,config:m,nativeHandlers:La};return ni($a,ub,void 0,lb)}}function Fh(b,g){return Ej([QC,ip,yo,cD,PC,RC])(b,g||{})}function zi(b){const {viewport:g,inputs:m,callbacks:I}=Ki(),W=Jq.useRef(void 0),ia=Jq.useRef([0,0]),ua=Jq.useRef(0),La=Jq.useMemo(()=>({onWheel:Va=>{var $a;({event:Va}=Va);Va.preventDefault();const {deltaY:lb,deltaX:ub}=Va;var Rb=0;if(Va.ctrlKey||Va.metaKey){Rb=Math.sign(Va.deltaY);let oc=lb;10<Math.abs(Va.deltaY)&&
(oc=10*Rb);Rb=oc}const [ec,Vb,tc]=[ub,lb,Rb];"pinching"===m.state||ua.current>=Va.timeStamp||(ua.current=Va.timeStamp,(Va.altKey||Va.ctrlKey||Va.metaKey)&&0===Va.buttons?(Rb=g.bounds,Va=null!=($a=m.currentScreenPoint)?$a:[Rb.width/2,Rb.height/2],$a=g.camera.zoom,g.onZoom(Va,$a-tc/100*$a)):($a=Zd.mul(Va.shiftKey&&!xk()?[Vb,0]:[ec,Vb],.8),Zd.isEqual($a,[0,0])||g.panCamera($a)))},onPinchStart:({event:Va,delta:$a,offset:lb,origin:ub})=>{var Rb;const ec=b.current;Va instanceof WheelEvent||!(Va.target===
ec||null!=ec&&ec.contains(Va.target))||(null==(Rb=I.onPinchStart)?void 0:Rb.call(I,{type:"canvas",order:0,delta:[...$a,lb[0]],offset:lb,point:Zd.sub(ub,m.containerOffset)},Va),W.current=ub,ia.current=[0,0])},onPinchEnd:({event:Va,offset:$a,origin:lb})=>{var ub;const Rb=b.current;Va instanceof WheelEvent||!(Va.target===Rb||null!=Rb&&Rb.contains(Va.target))||"pinching"!==m.state||(null==(ub=I.onPinchEnd)?void 0:ub.call(I,{type:"canvas",order:0,delta:[0,0,$a[0]],offset:$a,point:Zd.sub(lb,m.containerOffset)},
Va),ia.current=[0,0])},onPinch:({event:Va,offset:$a,origin:lb})=>{var ub,Rb=b.current;if(!(Va instanceof WheelEvent)&&(Va.target===Rb||null!=Rb&&Rb.contains(Va.target))){W.current||(W.current=lb);Rb=Zd.sub(W.current,lb);var ec=Zd.sub(Rb,ia.current);null==(ub=I.onPinch)?void 0:ub.call(I,{type:"canvas",order:0,delta:[...ec,$a[0]],offset:$a,point:Zd.sub(lb,m.containerOffset)},Va);ia.current=Rb}}}),[I]);Fh(La,{target:b,eventOptions:{passive:!1},pinch:{from:[g.camera.zoom,g.camera.zoom],scaleBounds:()=>
({from:g.camera.zoom,max:Po.maxZoom,min:Po.minZoom})}})}function ok(b,g,m,I){zv.useLayoutEffect(()=>{b.current.style.transform=`translate(
        calc(${g.minX}px - var(--tl-padding)),
        calc(${g.minY}px - var(--tl-padding)))
        scale(var(--tl-scale))`},[g.minX,g.minY,m,g.rotation]);zv.useLayoutEffect(()=>{const W=b.current;W.style.width=`calc(${Math.floor(g.width)}px + (var(--tl-padding) * 2))`;W.style.height=`calc(${Math.floor(g.height)}px + (var(--tl-padding) * 2))`},[g.width,g.height]);zv.useLayoutEffect(()=>{const W=b.current;void 0!==I&&(W.style.zIndex=I.toString())},[I])}function hj(b,g){const {onPersist:m,onSave:I,onSaveAs:W,onError:ia,onMount:ua,onCreateAssets:La,onCreateShapes:Va,onDeleteAssets:$a,onDeleteShapes:lb,
onDrop:ub,onPaste:Rb,onCanvasDBClick:ec}=g;Ry.useLayoutEffect(()=>{const Vb=[];if(b)return b.history.reset(),window.tlapps=window.tlapps||{},window.tlapps[b.uuid]=b,ua&&ua(b,null),()=>{Vb.forEach(tc=>tc());window.tlapps&&delete window.tlapps[b.uuid]}},[b]);Ry.useLayoutEffect(()=>{const Vb=[];m&&Vb.push(b.subscribe("persist",m));I&&Vb.push(b.subscribe("save",I));W&&Vb.push(b.subscribe("saveAs",W));ia&&Vb.push(b.subscribe("error",ia));Va&&Vb.push(b.subscribe("create-shapes",Va));La&&Vb.push(b.subscribe("create-assets",
La));lb&&Vb.push(b.subscribe("delete-shapes",lb));$a&&Vb.push(b.subscribe("delete-assets",$a));ub&&Vb.push(b.subscribe("drop",ub));Rb&&Vb.push(b.subscribe("paste",Rb));ec&&Vb.push(b.subscribe("canvas-dbclick",ec));return()=>Vb.forEach(tc=>tc())},[b,m,I,W,ia])}function pj(b){if("app"in b)return b.app;const [g]=Iy.useState(()=>new MC(b.model,b.Shapes,b.Tools));Iy.useLayoutEffect(()=>{g.initKeyboardShortcuts();return()=>{g.dispose()}},[g]);return g}function en(b,g){yD.useEffect(()=>{"model"in g&&g.model&&
b.loadDocumentModel(g.model)},[g.model])}function Ak(b){const g=Ki(),{viewport:{bounds:m}}=g;zD.useEffect(()=>{const I=ua=>{ua.preventDefault()},W=ua=>{if(0!==ua.touches.length){var La=ua.touches[0].pageX,Va=ua.touches[0].radiusX||0;(10>La-Va||La+Va>m.width-10)&&ua.preventDefault()}},ia=b.current;if(!ia)return()=>{};ia.addEventListener("touchstart",I,{passive:!0});ia.addEventListener("gestureend",I,{passive:!0});ia.addEventListener("gesturechange",I,{passive:!0});ia.addEventListener("gesturestart",
I,{passive:!0});ia.addEventListener("touchstart",W,{passive:!0});return()=>{ia&&(ia.removeEventListener("touchstart",I),ia.removeEventListener("gestureend",I),ia.removeEventListener("gesturechange",I),ia.removeEventListener("gesturestart",I),ia.removeEventListener("touchstart",W))}},[b,m.width])}function nl(b,g){const {inputs:m,callbacks:I}=Ki();return AD.useMemo(()=>({onPointerDown:W=>{var ia,ua;const {order:La=0}=W;La||(null==(ia=W.currentTarget)?void 0:ia.setPointerCapture(W.pointerId));ia=b.props.handles[g];
null==(ua=I.onPointerDown)?void 0:ua.call(I,{type:"handle",shape:b,handle:ia,id:g,order:La},W);W.order=La+1},onPointerMove:W=>{var ia;const {order:ua=0}=W,La=b.props.handles[g];null==(ia=I.onPointerMove)?void 0:ia.call(I,{type:"handle",shape:b,handle:La,id:g,order:ua},W);W.order=ua+1},onPointerUp:W=>{var ia,ua;const {order:La=0}=W;La||(null==(ia=W.currentTarget)?void 0:ia.releasePointerCapture(W.pointerId));ia=b.props.handles[g];null==(ua=I.onPointerUp)?void 0:ua.call(I,{type:"handle",shape:b,handle:ia,
id:g,order:La},W);W.order=La+1},onPointerEnter:W=>{var ia;const {order:ua=0}=W,La=b.props.handles[g];null==(ia=I.onPointerEnter)?void 0:ia.call(I,{type:"handle",shape:b,handle:La,id:g,order:ua},W);W.order=ua+1},onPointerLeave:W=>{var ia;const {order:ua=0}=W,La=b.props.handles[g];null==(ia=I.onPointerLeave)?void 0:ia.call(I,{type:"handle",shape:b,handle:La,id:g,order:ua},W);W.order=ua+1},onKeyUp:W=>{var ia;const ua=b.props.handles[g];null==(ia=I.onKeyUp)?void 0:ia.call(I,{type:"handle",shape:b,handle:ua,
id:g,order:-1},W)},onKeyDown:W=>{var ia;const ua=b.props.handles[g];null==(ia=I.onKeyDown)?void 0:ia.call(I,{type:"handle",shape:b,handle:ua,id:g,order:-1},W)}}),[b.id,m,I])}function qj(b,g,m=!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(${g})${m?" scale(-1,-1) translate(0, -32)":""}'>`+b.replaceAll('"',"'")+'\x3c/g\x3e\x3c/svg\x3e") 16 16, pointer'}function Ol(b,
g,m=0){BD.useEffect(()=>{const I=b.current;I&&I.style.setProperty("--tl-cursor",CD[g](Si.radiansToDegrees(m)))},[g,m])}function sm(b){const {viewport:g}=Ki(),m=xg();DD.useLayoutEffect(()=>Od(()=>{var I;const W=g.camera.zoom;"pinching"!==m.inputs.state&&null!=W&&(null==(I=b.current)?void 0:I.style.setProperty("--tl-zoom",W.toString()))}),[])}function Pl(b,g=0){const [m,I]=(0,Sy.useState)(b);(0,Sy.useEffect)(()=>{let W=!1;const ia=setTimeout(()=>{W||I(b)},g);return()=>{W=!0;clearTimeout(ia)}},[b,g]);
return m}function pk(){const b=xg();Ty.useEffect(()=>{oe(()=>te({},b.viewport.camera),()=>{window.sessionStorage.setItem("logseq.tldraw.camera:"+b.currentPageId,JSON.stringify(b.viewport.camera))})},[b.viewport.camera]);Ty.useEffect(()=>{var g;const m=JSON.parse(null!=(g=window.sessionStorage.getItem("logseq.tldraw.camera:"+b.currentPageId))?g:"null");m?b.viewport.update(m):b.selectedIds.size?b.api.zoomToSelection():b.api.zoomToFit()},[b])}function Tj(b){b()}function Ql(b){return Le(vg(b,void 0))}
function dk(b){return{reaction:b,mounted:!1,changedBeforeMount:!1,cleanAt:Date.now()+FD}}function rg(b){var g=new Map,m=1,I=new b(function(W){var ia=g.get(W);ia&&(ia.reaction.dispose(),g.delete(W))});return{addReactionToTrack:function(W,ia,ua){var La=m++;I.register(ua,La,W);W.current=dk(ia);W.current.finalizationRegistryCleanupToken=La;g.set(La,W.current);return W.current},recordReactionAsCommitted:function(W){I.unregister(W);W.current&&W.current.finalizationRegistryCleanupToken&&g.delete(W.current.finalizationRegistryCleanupToken)},
forceCleanupTimerToRunNowForTests:function(){},resetCleanupScheduleForTests:function(){}}}function bm(){function b(){void 0===I&&(I=setTimeout(g,1E4))}function g(){I=void 0;var W=Date.now();m.forEach(function(ia){var ua=ia.current;ua&&W>=ua.cleanAt&&(ua.reaction.dispose(),ia.current=null,m.delete(ia))});0<m.size&&b()}var m=new Set,I;return{addReactionToTrack:function(W,ia,ua){W.current=dk(ia);m.add(W);b();return W.current},recordReactionAsCommitted:function(W){m.delete(W)},forceCleanupTimerToRunNowForTests:function(){I&&
(clearTimeout(I),g())},resetCleanupScheduleForTests:function(){var W;if(0<m.size){try{for(var ia=pD(m),ua=ia.next();!ua.done;ua=ia.next()){var La=ua.value,Va=La.current;Va&&(Va.reaction.dispose(),La.current=null)}}catch(lb){var $a={error:lb}}finally{try{ua&&!ua.done&&(W=ia.return)&&W.call(ia)}finally{if($a)throw $a.error;}}m.clear()}I&&(clearTimeout(I),I=void 0)}}}function rh(){return new oD}function Li(b,g){void 0===g&&(g="observed");var m=Gy(Hs.default.useState(rh),1)[0],I=Gy(Hs.default.useState(),
2)[1],W=Hs.default.useRef(null);if(!W.current)var ia=new Wg("observer".concat(g),function(){ua.mounted?I([]):ua.changedBeforeMount=!0}),ua=qD(W,ia,m);m=W.current.reaction;Hs.default.useDebugValue(m,Ql);Hs.default.useEffect(function(){nD(W);W.current?(W.current.mounted=!0,W.current.changedBeforeMount&&(W.current.changedBeforeMount=!1,I([]))):(W.current={reaction:new Wg("observer".concat(g),function(){I([])}),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},I([]));return function(){W.current.reaction.dispose();
W.current=null}},[]);var La,Va;m.track(function(){try{La=b()}catch($a){Va=$a}});if(Va)throw Va;return La}function sf(b,g){var m;if(Fy&&b.$$typeof===Fy)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.");g=null!==(m=null===g||void 0===g?void 0:g.forwardRef)&&void 0!==m?m:!1;var I=b,W=b.displayName||b.name;if(Ey&&b.$$typeof===Ey&&(g=!0,I=b.render,"function"!==
typeof I))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");m=function(ia,ua){return Li(function(){return I(ia,ua)},W)};""!==W&&(m.displayName=W);b.contextTypes&&(m.contextTypes=b.contextTypes);g&&(m=(0,zr.forwardRef)(m));m=(0,zr.memo)(m);xj(b,m);return m}function xj(b,g){Object.keys(b).forEach(function(m){kD[m]||Object.defineProperty(g,m,Object.getOwnPropertyDescriptor(b,m))})}function Mi(b){var g=b.render;b=b.children||g;return"function"!==typeof b?null:Li(b)}function Bk(b){const g=
xg(),{callbacks:m}=Ki(),I=Vy.useRef(!1);Vy.useEffect(()=>{const W=Va=>{var $a,lb;if(null==($a=b.current)?0:$a.contains(document.activeElement))null==(lb=m.onKeyDown)?void 0:lb.call(m,{type:"canvas",order:-1},Va),I.current=Va.shiftKey},ia=Va=>{var $a,lb;if(null==($a=b.current)?0:$a.contains(document.activeElement))null==(lb=m.onKeyUp)?void 0:lb.call(m,{type:"canvas",order:-1},Va),I.current=Va.shiftKey},ua=Va=>{var $a,lb,ub;!g.editingShape&&(null==($a=b.current)?0:$a.contains(document.activeElement))&&
!["INPUT","TEXTAREA"].includes(null!=(ub=null==(lb=document.activeElement)?void 0:lb.tagName)?ub:"")&&(Va.preventDefault(),g.paste(Va,I.current))},La=Va=>{var $a,lb,ub;!g.editingShape&&0<g.selectedShapes.size&&(null==($a=b.current)?0:$a.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(ub=null==(lb=document.activeElement)?void 0:lb.tagName)?ub:"")&&(Va.preventDefault(),g.copy())};window.addEventListener("keydown",W);window.addEventListener("keyup",ia);document.addEventListener("paste",
ua);document.addEventListener("copy",La);return()=>{window.removeEventListener("keydown",W);window.removeEventListener("keyup",ia);document.removeEventListener("paste",ua);document.removeEventListener("copy",La)}},[])}function ek(b){const {inputs:g,callbacks:m}=Ki(),I=Xy.useRef(-1);return Xy.useMemo(()=>({onPointerDown:W=>{var ia,ua;const {order:La=0}=W;La||(null==(ia=W.currentTarget)?void 0:ia.setPointerCapture(W.pointerId));null==(ua=m.onPointerDown)?void 0:ua.call(m,{type:"shape",shape:b,order:La},
W);W.order=La+1},onPointerMove:W=>{var ia;const {order:ua=0}=W;null==(ia=m.onPointerMove)?void 0:ia.call(m,{type:"shape",shape:b,order:ua},W);W.order=ua+1},onPointerUp:W=>{var ia,ua,La;const {order:Va=0}=W;Va||(null==(ia=W.currentTarget)?void 0:ia.releasePointerCapture(W.pointerId));null==(ua=m.onPointerUp)?void 0:ua.call(m,{type:"shape",shape:b,order:Va},W);ia=Date.now();ua=ia-I.current;300<ua?I.current=ia:300>=ua&&(null==(La=m.onDoubleClick)?void 0:La.call(m,{type:"shape",shape:b,order:Va},W),I.current=
-1);W.order=Va+1},onPointerEnter:W=>{var ia;const {order:ua=0}=W;null==(ia=m.onPointerEnter)?void 0:ia.call(m,{type:"shape",shape:b,order:ua},W);W.order=ua+1},onPointerLeave:W=>{var ia;const {order:ua=0}=W;null==(ia=m.onPointerLeave)?void 0:ia.call(m,{type:"shape",shape:b,order:ua},W);W.order=ua+1},onKeyUp:W=>{var ia;null==(ia=m.onKeyUp)?void 0:ia.call(m,{type:"shape",shape:b,order:-1},W)},onKeyDown:W=>{var ia;null==(ia=m.onKeyDown)?void 0:ia.call(m,{type:"shape",shape:b,order:-1},W)}}),[b.id,g,m])}
function dm(b){var {viewport:g,inputs:m,callbacks:I,components:W}=b;b=Ya(b,["viewport","inputs","callbacks","components"]);return(0,rb.jsx)(PD,{id:b.id,viewport:g,inputs:m,callbacks:I,components:W,meta:b.meta,children:(0,rb.jsx)(tD,te({},b))})}function re(){re=Object.assign?Object.assign.bind():function(b){for(var g=1;g<arguments.length;g++){var m=arguments[g],I;for(I in m)Object.prototype.hasOwnProperty.call(m,I)&&(b[I]=m[I])}return b};return re.apply(this,arguments)}function Zf(b,g,{checkForDefaultPrevented:m=
!0}={}){return function(I){null===b||void 0===b||b(I);if(!1===m||!I.defaultPrevented)return null===g||void 0===g?void 0:g(I)}}function Zi(...b){return g=>b.forEach(m=>{"function"===typeof m?m(g):null!==m&&void 0!==m&&(m.current=g)})}function bh(...b){return(0,SD.useCallback)(Zi(...b),b)}function og(b,g=[]){let m=[];const I=()=>{const W=m.map(ia=>(0,Nq.createContext)(ia));return function(ia){const ua=(null===ia||void 0===ia?void 0:ia[b])||W;return(0,Nq.useMemo)(()=>({[`__scope${b}`]:Ga(te({},ia),{[b]:ua})}),
[ia,ua])}};I.scopeName=b;return[function(W,ia){function ua($a){const {scope:lb,children:ub}=$a,Rb=Ya($a,["scope","children"]);$a=(null===lb||void 0===lb?void 0:lb[b][Va])||La;const ec=(0,Nq.useMemo)(()=>Rb,Object.values(Rb));return(0,Nq.createElement)($a.Provider,{value:ec},ub)}const La=(0,Nq.createContext)(ia),Va=m.length;m=[...m,ia];ua.displayName=W+"Provider";return[ua,function($a,lb){if(lb=(0,Nq.useContext)((null===lb||void 0===lb?void 0:lb[b][Va])||La))return lb;if(void 0!==ia)return ia;throw Error(`\`${$a}\` must be used within \`${W}\``);
}]},em(I,...g)]}function em(...b){const g=b[0];if(1===b.length)return g;const m=()=>{const I=b.map(W=>({useScope:W(),scopeName:W.scopeName}));return function(W){const ia=I.reduce((ua,{useScope:La,scopeName:Va})=>{La=La(W)[`__scope${Va}`];return te(te({},ua),La)},{});return(0,Nq.useMemo)(()=>({[`__scope${g.scopeName}`]:ia}),[ia])}};m.scopeName=g.scopeName;return m}function Lk(b){return(0,Jm.isValidElement)(b)&&b.type===az}function mg(b,g){const m=te({},g);for(const I in g){const W=b[I],ia=g[I];/^on[A-Z]/.test(I)?
W&&ia?m[I]=(...ua)=>{ia(...ua);W(...ua)}:W&&(m[I]=W):"style"===I?m[I]=te(te({},W),ia):"className"===I&&(m[I]=[W,ia].filter(Boolean).join(" "))}return te(te({},b),m)}function Ti(b,g){b&&(0,TD.flushSync)(()=>b.dispatchEvent(g))}function ij(b){const g=(0,Fv.useRef)(b);(0,Fv.useEffect)(()=>{g.current=b});return(0,Fv.useMemo)(()=>(...m)=>{var I;return null===(I=g.current)||void 0===I?void 0:I.call(g,...m)},[])}function If(b,g=null===globalThis||void 0===globalThis?void 0:globalThis.document){const m=ij(b);
(0,UD.useEffect)(()=>{const I=W=>{"Escape"===W.key&&m(W)};g.addEventListener("keydown",I);return()=>g.removeEventListener("keydown",I)},[m,g])}function rk(b,g=null===globalThis||void 0===globalThis?void 0:globalThis.document){const m=ij(b),I=(0,un.useRef)(!1),W=(0,un.useRef)(()=>{});(0,un.useEffect)(()=>{const ia=La=>{if(La.target&&!I.current){let Va=function(){zk("dismissableLayer.pointerDownOutside",m,$a,{discrete:!0})};const $a={originalEvent:La};"touch"===La.pointerType?(g.removeEventListener("click",
W.current),W.current=Va,g.addEventListener("click",W.current,{once:!0})):Va()}I.current=!1},ua=window.setTimeout(()=>{g.addEventListener("pointerdown",ia)},0);return()=>{window.clearTimeout(ua);g.removeEventListener("pointerdown",ia);g.removeEventListener("click",W.current)}},[g,m]);return{onPointerDownCapture:()=>I.current=!0}}function Dj(b,g=null===globalThis||void 0===globalThis?void 0:globalThis.document){const m=ij(b),I=(0,un.useRef)(!1);(0,un.useEffect)(()=>{const W=ia=>{ia.target&&!I.current&&
zk("dismissableLayer.focusOutside",m,{originalEvent:ia},{discrete:!1})};g.addEventListener("focusin",W);return()=>g.removeEventListener("focusin",W)},[g,m]);return{onFocusCapture:()=>I.current=!0,onBlurCapture:()=>I.current=!1}}function ll(){const b=new CustomEvent("dismissableLayer.update");document.dispatchEvent(b)}function zk(b,g,m,{discrete:I}){const W=m.originalEvent.target;m=new CustomEvent(b,{bubbles:!1,cancelable:!0,detail:m});g&&W.addEventListener(b,g,{once:!0});I?Ti(W,m):W.dispatchEvent(m)}
function pl(b){const [g,m]=cz.useState(XD());vn(()=>{b||m(I=>null!==I&&void 0!==I?I:String(YD++))},[b]);return b||(g?`radix-${g}`:"")}function ui(b){return b.split("-")[0]}function Ui(b){return["top","bottom"].includes(ui(b))?"x":"y"}function $k(b){return"y"===b?"height":"width"}function sk(b,g,m){let {reference:I,floating:W}=b;var ia=I.x+I.width/2-W.width/2;const ua=I.y+I.height/2-W.height/2;b=Ui(g);var La=$k(b);La=I[La]/2-W[La]/2;const Va="x"===b;switch(ui(g)){case "top":ia={x:ia,y:I.y-W.height};
break;case "bottom":ia={x:ia,y:I.y+I.height};break;case "right":ia={x:I.x+I.width,y:ua};break;case "left":ia={x:I.x-W.width,y:ua};break;default:ia={x:I.x,y:I.y}}switch(g.split("-")[1]){case "start":ia[b]-=La*(m&&Va?-1:1);break;case "end":ia[b]+=La*(m&&Va?-1:1)}return ia}function al(b){return"number"!=typeof b?te({top:0,right:0,bottom:0,left:0},b):{top:b,right:b,bottom:b,left:b}}function um(b){return Ga(te({},b),{top:b.y,left:b.x,right:b.x+b.width,bottom:b.y+b.height})}function Fm(b,g){return vd(this,
null,function*(){var m;void 0===g&&(g={});const {x:I,y:W,platform:ia,rects:ua,elements:La,strategy:Va}=b,{boundary:$a="clippingAncestors",rootBoundary:lb="viewport",elementContext:ub="floating",altBoundary:Rb=!1,padding:ec=0}=g,Vb=al(ec),tc=La[Rb?"floating"===ub?"reference":"floating":ub],oc=um(yield ia.getClippingRect({element:null==(m=yield null==ia.isElement?void 0:ia.isElement(tc))||m?tc:tc.contextElement||(yield null==ia.getDocumentElement?void 0:ia.getDocumentElement(La.floating)),boundary:$a,
rootBoundary:lb,strategy:Va}));m=um(ia.convertOffsetParentRelativeRectToViewportRelativeRect?yield ia.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===ub?Ga(te({},ua.floating),{x:I,y:W}):ua.reference,offsetParent:yield null==ia.getOffsetParent?void 0:ia.getOffsetParent(La.floating),strategy:Va}):ua[ub]);return{top:oc.top-m.top+Vb.top,bottom:m.bottom-oc.bottom+Vb.bottom,left:oc.left-m.left+Vb.left,right:m.right-oc.right+Vb.right}})}function ml(b){return b.replace(/left|right|bottom|top/g,
g=>$D[g])}function Qm(b,g,m){void 0===m&&(m=!1);const I=b.split("-")[1],W=Ui(b);b=$k(W);m="x"===W?I===(m?"end":"start")?"right":"left":"start"===I?"bottom":"top";return g.reference[b]>g.floating[b]&&(m=ml(m)),{main:m,cross:ml(m)}}function Mk(b){return b.replace(/start|end/g,g=>aE[g])}function Fj(b,g){return{top:b.top-g.height,right:b.right-g.width,bottom:b.bottom-g.height,left:b.left-g.width}}function Ck(b){return ez.some(g=>0<=b[g])}function Vi(b){return null==b?window:b&&b.document&&b.location&&
b.alert&&b.setInterval?b:(b=b.ownerDocument)&&b.defaultView||window}function Ok(b){return Vi(b).getComputedStyle(b)}function Gj(b){return b&&b.document&&b.location&&b.alert&&b.setInterval?"":b?(b.nodeName||"").toLowerCase():""}function Pk(){const b=navigator.userAgentData;return null!=b&&b.brands?b.brands.map(g=>g.brand+"/"+g.version).join(" "):navigator.userAgent}function Hj(b){return b instanceof Vi(b).HTMLElement}function Vj(b){return b instanceof Vi(b).Element}function tk(b){return"undefined"==
typeof ShadowRoot?!1:b instanceof Vi(b).ShadowRoot||b instanceof ShadowRoot}function yj(b){const {overflow:g,overflowX:m,overflowY:I}=Ok(b);return/auto|scroll|overlay|hidden/.test(g+I+m)}function tm(b){const g=/firefox/i.test(Pk());b=Ok(b);return"none"!==b.transform||"none"!==b.perspective||"paint"===b.contain||["transform","perspective"].includes(b.willChange)||g&&"filter"===b.willChange||g&&!!b.filter&&"none"!==b.filter}function Tl(){return!/^((?!chrome|android).)*safari/i.test(Pk())}function sj(b,
g,m){var I,W,ia,ua;void 0===g&&(g=!1);void 0===m&&(m=!1);var La=b.getBoundingClientRect();let Va=1,$a=1;g&&Hj(b)&&(Va=0<b.offsetWidth&&Ot(La.width)/b.offsetWidth||1,$a=0<b.offsetHeight&&Ot(La.height)/b.offsetHeight||1);b=Vj(b)?Vi(b):window;g=!Tl()&&m;m=(La.left+(g&&null!=(I=null==(W=b.visualViewport)?void 0:W.offsetLeft)?I:0))/Va;I=(La.top+(g&&null!=(ia=null==(ua=b.visualViewport)?void 0:ua.offsetTop)?ia:0))/$a;ia=La.width/Va;La=La.height/$a;return{width:ia,height:La,top:I,right:m+ia,bottom:I+La,
left:m,x:m,y:I}}function rj(b){return(g=b,(g instanceof Vi(g).Node?b.ownerDocument:b.document)||window.document).documentElement;var g}function gm(b){return Vj(b)?{scrollLeft:b.scrollLeft,scrollTop:b.scrollTop}:{scrollLeft:b.pageXOffset,scrollTop:b.pageYOffset}}function qk(b){return sj(rj(b)).left+gm(b).scrollLeft}function fk(b){return"html"===Gj(b)?b:b.assignedSlot||b.parentNode||(tk(b)?b.host:null)||rj(b)}function Jh(b){return Hj(b)&&"fixed"!==getComputedStyle(b).position?b.offsetParent:null}function gj(b){for(var g=
Vi(b),m=Jh(b);m&&["table","td","th"].includes(Gj(m))&&"static"===getComputedStyle(m).position;)m=Jh(m);if(!m||"html"!==Gj(m)&&("body"!==Gj(m)||"static"!==getComputedStyle(m).position||tm(m))){if(!m)a:{b=fk(b);for(tk(b)&&(b=b.host);Hj(b)&&!["html","body"].includes(Gj(b));){if(tm(b)){m=b;break a}b=b.parentNode}m=null}g=m||g}return g}function uk(b){if(Hj(b))return{width:b.offsetWidth,height:b.offsetHeight};b=sj(b);return{width:b.width,height:b.height}}function mk(b){const g=fk(b);return["html","body",
"#document"].includes(Gj(g))?b.ownerDocument.body:Hj(g)&&yj(g)?g:mk(g)}function ph(b,g){var m;void 0===g&&(g=[]);var I=mk(b);b=I===(null==(m=b.ownerDocument)?void 0:m.body);m=Vi(I);I=b?[m].concat(m.visualViewport||[],yj(I)?I:[]):I;g=g.concat(I);return b?g:g.concat(ph(I))}function ih(b,g,m){return"viewport"===g?um(function(I,W){var ia=Vi(I),ua=rj(I);ia=ia.visualViewport;I=ua.clientWidth;ua=ua.clientHeight;let La=0,Va=0;if(ia){I=ia.width;ua=ia.height;const $a=Tl();($a||!$a&&"fixed"===W)&&(La=ia.offsetLeft,
Va=ia.offsetTop)}return{width:I,height:ua,x:La,y:Va}}(b,m)):Vj(g)?function(I,W){var ia=sj(I,!1,"fixed"===W);W=ia.top+I.clientTop;ia=ia.left+I.clientLeft;return{top:W,left:ia,x:ia,y:W,right:ia+I.clientWidth,bottom:W+I.clientHeight,width:I.clientWidth,height:I.clientHeight}}(g,m):um(function(I){var W;const ia=rj(I);var ua=gm(I);const La=null==(W=I.ownerDocument)?void 0:W.body;W=Js(ia.scrollWidth,ia.clientWidth,La?La.scrollWidth:0,La?La.clientWidth:0);const Va=Js(ia.scrollHeight,ia.clientHeight,La?La.scrollHeight:
0,La?La.clientHeight:0);I=-ua.scrollLeft+qk(I);ua=-ua.scrollTop;return"rtl"===Ok(La||ia).direction&&(I+=Js(ia.clientWidth,La?La.clientWidth:0)-W),{width:W,height:Va,x:I,y:ua}}(rj(b)))}function Dg(b){const g=ph(b),m=["absolute","fixed"].includes(Ok(b).position)&&Hj(b)?gj(b):b;return Vj(m)?g.filter(I=>{var W;if(W=Vj(I))a:if(W=null==m.getRootNode?void 0:m.getRootNode(),I.contains(m))W=!0;else{if(W&&tk(W)){W=m;do{if(W&&I===W){W=!0;break a}W=W.parentNode||W.host}while(W)}W=!1}return W&&"body"!==Gj(I)}):
[]}function Xj(b,g,m,I){void 0===I&&(I={});const {ancestorScroll:W=!0,ancestorResize:ia=!0,elementResize:ua=!0,animationFrame:La=!1}=I,Va=W&&!La,$a=ia&&!La,lb=Va||$a?[...(Vj(b)?ph(b):[]),...ph(g)]:[];lb.forEach(Vb=>{Va&&Vb.addEventListener("scroll",m,{passive:!0});$a&&Vb.addEventListener("resize",m)});let ub,Rb=null;if(ua){let Vb=!0;Rb=new ResizeObserver(()=>{Vb||m();Vb=!1});Vj(b)&&!La&&Rb.observe(b);Rb.observe(g)}let ec=La?sj(b):null;return La&&function tc(){const oc=sj(b);!ec||oc.x===ec.x&&oc.y===
ec.y&&oc.width===ec.width&&oc.height===ec.height||m();ec=oc;ub=requestAnimationFrame(tc)}(),m(),()=>{var tc;lb.forEach(oc=>{Va&&oc.removeEventListener("scroll",m);$a&&oc.removeEventListener("resize",m)});null==(tc=Rb)||tc.disconnect();Rb=null;La&&cancelAnimationFrame(ub)}}function Dh(b,g){if(b===g)return!0;if(typeof b!==typeof g)return!1;if("function"===typeof b&&b.toString()===g.toString())return!0;let m,I;if(b&&g&&"object"==typeof b){if(Array.isArray(b)){var W=b.length;if(W!=g.length)return!1;for(m=
W;0!==m--;)if(!Dh(b[m],g[m]))return!1;return!0}I=Object.keys(b);W=I.length;if(W!==Object.keys(g).length)return!1;for(m=W;0!==m--;)if(!Object.prototype.hasOwnProperty.call(g,I[m]))return!1;for(m=W;0!==m--;)if(W=I[m],!("_owner"===W&&b.$$typeof||Dh(b[W],g[W])))return!1;return!0}return b!==b&&g!==g}function $i(b){const g=Jn.useRef(b);Iv(()=>{g.current=b});return g}function tg(b){let {middleware:g,placement:m="bottom",strategy:I="absolute",whileElementsMounted:W}=void 0===b?{}:b;const ia=Jn.useRef(null),
ua=Jn.useRef(null),La=$i(W),Va=Jn.useRef(null),[$a,lb]=Jn.useState({x:null,y:null,strategy:I,placement:m,middlewareData:{}}),[ub,Rb]=Jn.useState(g);Dh(null==ub?void 0:ub.map(Hc=>{({options:Hc}=Hc);return Hc}),null==g?void 0:g.map(Hc=>{({options:Hc}=Hc);return Hc}))||Rb(g);const ec=Jn.useCallback(()=>{ia.current&&ua.current&&hE(ia.current,ua.current,{middleware:ub,placement:m,strategy:I}).then(Hc=>{Vb.current&&iE.flushSync(()=>{lb(Hc)})})},[ub,m,I]);Iv(()=>{Vb.current&&ec()},[ec]);const Vb=Jn.useRef(!1);
Iv(()=>{Vb.current=!0;return()=>{Vb.current=!1}},[]);const tc=Jn.useCallback(()=>{"function"===typeof Va.current&&(Va.current(),Va.current=null);if(ia.current&&ua.current)if(La.current){const Hc=La.current(ia.current,ua.current,ec);Va.current=Hc}else ec()},[ec,La]),oc=Jn.useCallback(Hc=>{ia.current=Hc;tc()},[tc]),Xb=Jn.useCallback(Hc=>{ua.current=Hc;tc()},[tc]),sc=Jn.useMemo(()=>({reference:ia,floating:ua}),[]);return Jn.useMemo(()=>Ga(te({},$a),{update:ec,refs:sc,reference:oc,floating:Xb}),[$a,ec,
sc,oc,Xb])}function Oi(b){const [g,m]=(0,lE.useState)(void 0);vn(()=>{if(b){m({width:b.offsetWidth,height:b.offsetHeight});const I=new ResizeObserver(W=>{if(Array.isArray(W)&&W.length){W=W[0];if("borderBoxSize"in W){W=W.borderBoxSize;var ia=Array.isArray(W)?W[0]:W;W=ia.inlineSize;ia=ia.blockSize}else W=b.offsetWidth,ia=b.offsetHeight;m({width:W,height:ia})}});I.observe(b,{box:"border-box"});return()=>I.unobserve(b)}m(void 0)},[b]);return g}function Sf(b){return void 0!==b}function Ig(b){return null!==
b}function jj(b){const [g,m="center"]=b.split("-");return[g,m]}function oi(b,g){return(0,jp.useReducer)((m,I)=>{I=g[m][I];return null!==I&&void 0!==I?I:m},b)}function nh(b){const [g,m]=(0,jp.useState)(),I=(0,jp.useRef)({}),W=(0,jp.useRef)(b),ia=(0,jp.useRef)("none"),[ua,La]=oi(b?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});(0,jp.useEffect)(()=>{const Va=ig(I.current);
ia.current="mounted"===ua?Va:"none"},[ua]);vn(()=>{const Va=I.current,$a=W.current;if($a!==b){const lb=ia.current,ub=ig(Va);b?La("MOUNT"):"none"===ub||"none"===(null===Va||void 0===Va?void 0:Va.display)?La("UNMOUNT"):$a&&lb!==ub?La("ANIMATION_OUT"):La("UNMOUNT");W.current=b}},[b,La]);vn(()=>{if(g){const Va=lb=>{const ub=ig(I.current).includes(lb.animationName);lb.target===g&&ub&&(0,sE.flushSync)(()=>La("ANIMATION_END"))},$a=lb=>{lb.target===g&&(ia.current=ig(I.current))};g.addEventListener("animationstart",
$a);g.addEventListener("animationcancel",Va);g.addEventListener("animationend",Va);return()=>{g.removeEventListener("animationstart",$a);g.removeEventListener("animationcancel",Va);g.removeEventListener("animationend",Va)}}La("ANIMATION_END")},[g,La]);return{isPresent:["mounted","unmountSuspended"].includes(ua),ref:(0,jp.useCallback)(Va=>{Va&&(I.current=getComputedStyle(Va));m(Va)},[])}}function ig(b){return(null===b||void 0===b?void 0:b.animationName)||"none"}function Qg({prop:b,defaultProp:g,onChange:m=
()=>{}}){const [I,W]=Hl({defaultProp:g,onChange:m}),ia=void 0!==b;g=ia?b:I;const ua=ij(m);m=(0,Qt.useCallback)(La=>{ia?(La="function"===typeof La?La(b):La,La!==b&&ua(La)):W(La)},[ia,b,W,ua]);return[g,m]}function Hl({defaultProp:b,onChange:g}){b=(0,Qt.useState)(b);const [m]=b,I=(0,Qt.useRef)(m),W=ij(g);(0,Qt.useEffect)(()=>{I.current!==m&&(W(m),I.current=m)},[m,I,W]);return b}function Ai(b,g){const m=Math.abs(g.top-b.y),I=Math.abs(g.bottom-b.y),W=Math.abs(g.right-b.x);b=Math.abs(g.left-b.x);switch(Math.min(m,
I,W,b)){case b:return"left";case W:return"right";case m:return"top";case I:return"bottom";default:return null}}function Qi(b){b=b.slice();b.sort((g,m)=>g.x<m.x?-1:g.x>m.x?1:g.y<m.y?-1:g.y>m.y?1:0);return Qb(b)}function Qb(b){if(1>=b.length)return b.slice();const g=[];for(var m=0;m<b.length;m++){for(var I=b[m];2<=g.length;){var W=g[g.length-1],ia=g[g.length-2];if((W.x-ia.x)*(I.y-ia.y)>=(W.y-ia.y)*(I.x-ia.x))g.pop();else break}g.push(I)}g.pop();m=[];for(I=b.length-1;0<=I;I--){for(W=b[I];2<=m.length;){ia=
m[m.length-1];const ua=m[m.length-2];if((ia.x-ua.x)*(W.y-ua.y)>=(ia.y-ua.y)*(W.x-ua.x))m.pop();else break}m.push(W)}m.pop();return 1===g.length&&1===m.length&&g[0].x===m[0].x&&g[0].y===m[0].y?g:g.concat(m)}function fc(b){var {side:g,content:m,sideOffset:I=10}=b;b=Ya(b,["side","content","sideOffset"]);return m?(0,rb.jsx)(DE,{delayDuration:300,children:(0,rb.jsxs)(EE,{children:[(0,rb.jsx)(FE,{asChild:!0,children:b.children}),(0,rb.jsx)(GE,{children:(0,rb.jsxs)(HE,Ga(te({className:"tl-tooltip-content",
sideOffset:I,side:g},b),{children:[m,(0,rb.jsx)(IE,{className:"tl-tooltip-arrow"})]}))})]})}):(0,rb.jsx)(rb.Fragment,{children:b.children})}function dc(b){var {className:g,tooltip:m,tooltipSide:I}=b;b=Ya(b,["className","tooltip","tooltipSide"]);return(0,rb.jsx)(fc,{content:m,side:I,children:(0,rb.jsx)("button",te({className:"tl-button "+(null!=g?g:"")},b))})}function ja(b){var g=b+"CollectionProvider";const [m,I]=og(g),[W,ia]=m(g,{collectionRef:{current:null},itemMap:new Map}),ua=lb=>{const {scope:ub,
children:Rb}=lb;lb=Uo.default.useRef(null);const ec=Uo.default.useRef(new Map).current;return Uo.default.createElement(W,{scope:ub,itemMap:ec,collectionRef:lb},Rb)};Object.assign(ua,{displayName:g});const La=b+"CollectionSlot";g=Uo.default.forwardRef((lb,ub)=>{const {scope:Rb,children:ec}=lb;lb=ia(La,Rb);ub=bh(ub,lb.collectionRef);return Uo.default.createElement(Oq,{ref:ub},ec)});Object.assign(g,{displayName:La});const Va=b+"CollectionItemSlot",$a=Uo.default.forwardRef((lb,ub)=>{const {scope:Rb,children:ec}=
lb,Vb=Ya(lb,["scope","children"]),tc=Uo.default.useRef(null);lb=bh(ub,tc);const oc=ia(Va,Rb);Uo.default.useEffect(()=>{oc.itemMap.set(tc,te({ref:tc},Vb));return()=>void oc.itemMap.delete(tc)});return Uo.default.createElement(Oq,{["data-radix-collection-item"]:"",ref:lb},ec)});Object.assign($a,{displayName:Va});return[{Provider:ua,Slot:g,ItemSlot:$a},function(lb){const ub=ia(b+"CollectionConsumer",lb);return Uo.default.useCallback(()=>{const Rb=ub.collectionRef.current;if(!Rb)return[];const ec=Array.from(Rb.querySelectorAll("[data-radix-collection-item]"));
return Array.from(ub.itemMap.values()).sort((Vb,tc)=>ec.indexOf(Vb.ref.current)-ec.indexOf(tc.ref.current))},[ub.collectionRef,ub.itemMap])},I]}function Fb(b){const g=(0,sz.useContext)(JE);return b||g||"ltr"}function Tb(){(0,KE.useEffect)(()=>{var b,g;const m=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",null!==(b=m[0])&&void 0!==b?b:wb());document.body.insertAdjacentElement("beforeend",null!==(g=m[1])&&void 0!==g?g:wb());Ov++;return()=>{1===
Ov&&document.querySelectorAll("[data-radix-focus-guard]").forEach(I=>I.remove());Ov--}},[])}function wb(){const b=document.createElement("span");b.setAttribute("data-radix-focus-guard","");b.tabIndex=0;b.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none";return b}function zb(b,{select:g=!1}={}){const m=document.activeElement;for(const I of b)if($b(I,{select:g}),document.activeElement!==m)break}function Pb(b){const g=[];for(b=document.createTreeWalker(b,NodeFilter.SHOW_ELEMENT,
{acceptNode:m=>{const I="INPUT"===m.tagName&&"hidden"===m.type;return m.disabled||m.hidden||I?NodeFilter.FILTER_SKIP:0<=m.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});b.nextNode();)g.push(b.currentNode);return g}function sb(b,g){for(const m of b)if(!Mb(m,{upTo:g}))return m}function Mb(b,{upTo:g}){if("hidden"===getComputedStyle(b).visibility)return!0;for(;b&&(void 0===g||b!==g);){if("none"===getComputedStyle(b).display)return!0;b=b.parentElement}return!1}function $b(b,{select:g=!1}=
{}){if(b&&b.focus){const m=document.activeElement;b.focus({preventScroll:!0});b!==m&&b instanceof HTMLInputElement&&"select"in b&&g&&b.select()}}function Bc(b,g){b=[...b];g=b.indexOf(g);-1!==g&&b.splice(g,1);return b}function Pc(b){return b.filter(g=>"A"!==g.tagName)}function Tc(b,g,m){b=b.key;m="rtl"!==m?b:"ArrowLeft"===b?"ArrowRight":"ArrowRight"===b?"ArrowLeft":b;if("vertical"!==g||!["ArrowLeft","ArrowRight"].includes(m))if("horizontal"!==g||!["ArrowUp","ArrowDown"].includes(m))return RE[m]}function wd(b){const g=
document.activeElement;for(const m of b){if(m===g)break;m.focus();if(document.activeElement!==g)break}}function Rd(b,g){return b.map((m,I)=>b[(g+I)%b.length])}function Gd(b,g){var m=(0,VE.useState)(function(){return{value:b,callback:g,facade:{get current(){return m.value},set current(I){var W=m.value;W!==I&&(m.value=I,m.callback(I,W))}}}})[0];m.callback=g;return m.facade}function Cd(b,g){return Gd(g||null,function(m){return b.forEach(function(I){"function"===typeof I?I(m):I&&(I.current=m);return I})})}
function Id(b){return b}function xe(b,g){void 0===g&&(g=Id);var m=[],I=!1;return{read:function(){if(I)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return m.length?m[m.length-1]:b},useMedium:function(W){var ia=g(W,I);m.push(ia);return function(){m=m.filter(function(ua){return ua!==ia})}},assignSyncMedium:function(W){for(I=!0;m.length;){var ia=m;m=[];ia.forEach(W)}m={push:function(ua){return W(ua)},filter:function(){return m}}},assignMedium:function(W){I=
!0;var ia=[];if(m.length){var ua=m;m=[];ua.forEach(W);ia=m}var La=function(){var Va=ia;ia=[];Va.forEach(W)};Promise.resolve().then(La);m={push:function(Va){ia.push(Va);Promise.resolve().then(La)},filter:function(Va){ia=ia.filter(Va);return m}}}}}function Tf(b){const g=document.activeElement;for(const m of b){if(m===g)break;m.focus();if(document.activeElement!==g)break}}function se(b,g){return b.map((m,I)=>b[(g+I)%b.length])}function $e(b,g,m){const I=1<g.length&&Array.from(g).every(ia=>ia===g[0])?
g[0]:g,W=m?b.indexOf(m):-1;b=se(b,Math.max(W,0));1===I.length&&(b=b.filter(ia=>ia!==m));b=b.find(ia=>ia.toLowerCase().startsWith(I.toLowerCase()));return b!==m?b:void 0}function Pe(b){return g=>"mouse"===g.pointerType?b(g):void 0}function Re(b,[g,m]){return Math.min(m,Math.max(g,b))}function ng(b){const g=(0,$z.useRef)({value:b,previous:b});return(0,$z.useMemo)(()=>{g.current.value!==b&&(g.current.previous=g.current.value,g.current.value=b);return g.current.previous},[b])}function Rf(b=[],g,m){b=
[...b];b[m]=g;return b.sort((I,W)=>I-W)}function Ni(b,g,m){return 100/(m-g)*(b-g)}function Pf(b,g){if(2<g)return`Value ${b+1} of ${g}`;if(2===g)return["Minimum","Maximum"][b]}function gg(b,g){if(1===b.length)return 0;b=b.map(I=>Math.abs(I-g));const m=Math.min(...b);return b.indexOf(m)}function mh(b,g,m){b/=2;const I=Lg([0,50],[0,b]);return(b-I(g)*m)*m}function Og(b){return b.slice(0,-1).map((g,m)=>b[m+1]-g)}function Lg(b,g){return m=>b[0]===b[1]||g[0]===g[1]?g[0]:g[0]+(g[1]-g[0])/(b[1]-b[0])*(m-b[0])}
function lh(b,g){g=Math.pow(10,g);return Math.round(b*g)/g}function sg(b){function g(La){return La?(0,rb.jsx)("div",{className:"tl-color-bg",style:{backgroundColor:La},children:(0,rb.jsx)("div",{className:`w-full h-full bg-${La}-500`})}):(0,rb.jsx)("div",{className:"tl-color-bg",children:(0,rb.jsx)(Oh,{name:"color-swatch"})})}var {color:m,opacity:I,popoverSide:W,setColor:ia,setOpacity:ua}=b;b=Ya(b,["color","opacity","popoverSide","setColor","setOpacity"]);return(0,rb.jsx)(hA,Ga(te({},b),{border:!0,
arrow:!0,side:W,label:(0,rb.jsx)(fc,{content:"Color",side:W,sideOffset:14,children:g(m)}),children:(0,rb.jsxs)("div",{className:"p-1",children:[(0,rb.jsx)("div",{className:"tl-color-palette",children:Object.values(bc).map(La=>(0,rb.jsx)("button",{className:`tl-color-drip m-1${La===m?" active":""}`,onClick:()=>ia(La),children:g(La)},La))}),ua&&(0,rb.jsx)("div",{className:"mx-1 my-2",children:(0,rb.jsxs)(QF,{defaultValue:[null!=I?I:0],onValueCommit:La=>ua(La[0]),max:1,step:.1,"aria-label":"Opacity",
className:"tl-slider-root",children:[(0,rb.jsx)(RF,{className:"tl-slider-track",children:(0,rb.jsx)(SF,{className:"tl-slider-range"})}),(0,rb.jsx)(TF,{className:"tl-slider-thumb"})]})})]})}))}function hg(b){const g=ij(b),m=(0,Af.useRef)(""),I=(0,Af.useRef)(0);b=(0,Af.useCallback)(ia=>{ia=m.current+ia;g(ia);(function Va(La){m.current=La;window.clearTimeout(I.current);""!==La&&(I.current=window.setTimeout(()=>Va(""),1E3))})(ia)},[g]);const W=(0,Af.useCallback)(()=>{m.current="";window.clearTimeout(I.current)},
[]);(0,Af.useEffect)(()=>()=>window.clearTimeout(I.current),[]);return[m,b,W]}function $g(b,g,m){const I=1<g.length&&Array.from(g).every(ia=>ia===g[0])?g[0]:g,W=m?b.indexOf(m):-1;b=Mf(b,Math.max(W,0));1===I.length&&(b=b.filter(ia=>ia!==m));b=b.find(ia=>ia.textValue.toLowerCase().startsWith(I.toLowerCase()));return b!==m?b:void 0}function Mf(b,g){return b.map((m,I)=>b[(g+I)%b.length])}function Ri(b){var {options:g,tooltip:m,value:I,onValueChange:W}=b;b=Ya(b,["options","tooltip","value","onValueChange"]);
const [ia,ua]=WF.useState(!1);return(0,rb.jsx)("div",Ga(te({},b),{className:"tl-select-input",children:(0,rb.jsxs)(oG,{open:ia,onOpenChange:ua,value:I,onValueChange:W,children:[(0,rb.jsx)(fc,{content:m,children:(0,rb.jsxs)(pG,{className:"tl-select-input-trigger",children:[(0,rb.jsx)("div",{className:"tl-select-input-trigger-value",children:(0,rb.jsx)(qG,{})}),(0,rb.jsx)(rG,{style:{lineHeight:1},children:(0,rb.jsx)(Oh,{name:ia?"chevron-up":"chevron-down"})})]})}),(0,rb.jsx)(sG,{className:"tl-select-input-portal",
children:(0,rb.jsxs)(tG,{className:"tl-select-input-content",children:[(0,rb.jsx)(xG,{}),(0,rb.jsx)(uG,{className:"tl-select-input-viewport",children:g.map(La=>(0,rb.jsx)(vG,{className:"tl-select-input-select-item",value:La.value,children:(0,rb.jsx)(wG,{children:La.label})},La.value))}),(0,rb.jsx)(yG,{})]})})]})}))}function kh(b,g){return function(m){return b(g(m))}}function hi(b,g){return g(b)}function Nj(b,g){return function(m){return b(g,m)}}function ri(b,g){return function(){return b(g)}}function Mj(b,
g){g(b);return b}function Qh(){for(var b=arguments.length,g=Array(b),m=0;m<b;m++)g[m]=arguments[m];return g}function Ij(b){b()}function Yl(b){return function(){return b}}function Bm(){for(var b=arguments.length,g=Array(b),m=0;m<b;m++)g[m]=arguments[m];return function(){g.map(Ij)}}function ag(){}function di(b,g){return b(1,g)}function Lm(b,g){b(0,g)}function $l(b){b(2)}function Vk(b){return b(4)}function Yf(b,g){return di(b,Nj(g,0))}function Ci(b,g){var m=b(1,function(I){m();g(I)});return m}function Jf(){var b=
[];return function(g,m){switch(g){case 2:b.splice(0,b.length);break;case 1:return b.push(m),function(){var I=b.indexOf(m);-1<I&&b.splice(I,1)};case 0:b.slice().forEach(function(I){I(m)});break;default:throw Error("unrecognized action "+g);}}}function rf(b){var g=b,m=Jf();return function(I,W){switch(I){case 1:W(g);break;case 0:g=W;break;case 4:return g}return m(I,W)}}function Zl(b){var g,m;return function(I,W){switch(I){case 1:if(W){if(m===W)break;g&&g();m=W;return g=b(1,W)}g&&g();return ag;case 2:g&&
g();m=null;break;default:throw Error("unrecognized action "+I);}}}function uj(b){return Mj(Jf(),function(g){return Yf(b,g)})}function wh(b,g){return Mj(rf(g),function(m){return Yf(b,m)})}function wl(){for(var b=arguments.length,g=Array(b),m=0;m<b;m++)g[m]=arguments[m];return function(I){return g.reduceRight(hi,I)}}function Jd(b){for(var g=arguments.length,m=Array(1<g?g-1:0),I=1;I<g;I++)m[I-1]=arguments[I];var W=wl.apply(void 0,m);return function(ia,ua){switch(ia){case 1:return di(b,W(ua));case 2:b(2);
break;default:throw Error("unrecognized action "+ia);}}}function Ef(b,g){return b===g}function ye(b){void 0===b&&(b=Ef);var g;return function(m){return function(I){b(g,I)||(g=I,m(I))}}}function ze(b){return function(g){return function(m){b(m)&&g(m)}}}function Gf(b){return function(g){return kh(g,b)}}function Jg(b){return function(g){return function(){return g(b)}}}function ii(b,g){return function(m){return function(I){return m(g=b(g,I))}}}function sh(b){return function(g){return function(m){0<b?b--:
g(m)}}}function gk(b){var g,m;return function(I){return function(W){g=W;m||=setTimeout(function(){m=void 0;I(g)},b)}}}function He(b){var g,m;return function(I){return function(W){g=W;m&&clearTimeout(m);m=setTimeout(function(){I(g)},b)}}}function ue(){for(var b=arguments.length,g=Array(b),m=0;m<b;m++)g[m]=arguments[m];var I=Array(g.length),W=0,ia=null,ua=Math.pow(2,g.length)-1;g.forEach(function(La,Va){var $a=Math.pow(2,Va);di(La,function(lb){var ub=W;W|=$a;I[Va]=lb;ub!==ua&&W===ua&&ia&&(ia(),ia=null)})});
return function(La){return function(Va){var $a=function(){return La([Va].concat(I))};W===ua?$a():ia=$a}}}function qi(){for(var b=arguments.length,g=Array(b),m=0;m<b;m++)g[m]=arguments[m];return function(I,W){switch(I){case 1:return Bm.apply(void 0,g.map(function(ia){return ia(1,W)}));case 2:break;default:throw Error("unrecognized action "+I);}}}function de(b,g){void 0===g&&(g=Ef);return Jd(b,ye(g))}function xi(){for(var b=Jf(),g=arguments.length,m=Array(g),I=0;I<g;I++)m[I]=arguments[I];var W=Array(m.length),
ia=0,ua=Math.pow(2,m.length)-1;m.forEach(function(La,Va){var $a=Math.pow(2,Va);di(La,function(lb){W[Va]=lb;ia|=$a;ia===ua&&b(0,W)})});return function(La,Va){switch(La){case 1:return ia===ua&&Va(W),b(1,Va);case 2:b(2);break;default:throw Error("unrecognized action "+La);}}}function th(b,g,m){void 0===g&&(g=[]);m=(void 0===m?{singleton:!0}:m).singleton;return{id:Symbol(),constructor:b,dependencies:g,singleton:m}}function xl(b){var g=new Map;return function W(I){var ia=I.id,ua=I.constructor,La=I.dependencies;
if((I=I.singleton)&&g.has(ia))return g.get(ia);ua=ua(La.map(function(Va){return W(Va)}));I&&g.set(ia,ua);return ua}(b)}function si(b,g){if(null==b)return{};var m={},I=Object.keys(b),W;for(W=0;W<I.length;W++){var ia=I[W];0<=g.indexOf(ia)||(m[ia]=b[ia])}return m}function xh(b,g){if(b){if("string"===typeof b)return Ff(b,g);var m=Object.prototype.toString.call(b).slice(8,-1);"Object"===m&&b.constructor&&(m=b.constructor.name);if("Map"===m||"Set"===m)return Array.from(b);if("Arguments"===m||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return Ff(b,
g)}}function Ff(b,g){if(null==g||g>b.length)g=b.length;for(var m=0,I=Array(g);m<g;m++)I[m]=b[m];return I}function Yg(b,g){var m="undefined"!==typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(m)return(m=m.call(b)).next.bind(m);if(Array.isArray(b)||(m=xh(b))||g&&b&&"number"===typeof b.length){m&&(b=m);var I=0;return function(){return I>=b.length?{done:!0}:{done:!1,value:b[I++]}}}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 Ul(b,g){for(var m={},I={},W=0,ia=b.length;W<ia;)I[b[W]]=1,W+=1;for(var ua in g)I.hasOwnProperty(ua)||(m[ua]=g[ua]);return m}function yl(b,g,m){function I(ub,Rb){ub.propsReady&&(0,ub.propsReady)(0,!1);for(var ec=Yg(ua),Vb;!(Vb=ec()).done;)Vb=Vb.value,(0,ub[g.required[Vb]])(0,Rb[Vb]);for(ec=Yg(La);!(Vb=ec()).done;)if(Vb=Vb.value,Vb in Rb)(0,ub[g.optional[Vb]])(0,Rb[Vb]);ub.propsReady&&(0,ub.propsReady)(0,!0)}function W(ub){return Va.reduce(function(Rb,ec){Rb[ec]=function(Vb){(0,ub[g.methods[ec]])(0,
Vb)};return Rb},{})}function ia(ub){return $a.reduce(function(Rb,ec){Rb[ec]=Zl(ub[g.events[ec]]);return Rb},{})}var ua=Object.keys(g.required||{}),La=Object.keys(g.optional||{}),Va=Object.keys(g.methods||{}),$a=Object.keys(g.events||{}),lb=(0,wn.createContext)({});return{Component:(0,wn.forwardRef)(function(ub,Rb){var ec=ub.children,Vb=si(ub,BG),tc=(0,wn.useState)(function(){return Mj(xl(b),function(Xb){return I(Xb,Vb)})})[0],oc=(0,wn.useState)(ri(ia,tc))[0];hu(function(){for(var Xb=Yg($a),sc;!(sc=
Xb()).done;)if(sc=sc.value,sc in Vb)(0,oc[sc])(1,Vb[sc]);return function(){Object.values(oc).map($l)}},[Vb,oc,tc]);hu(function(){I(tc,Vb)});(0,wn.useImperativeHandle)(Rb,Yl(W(tc)));return(0,wn.createElement)(lb.Provider,{value:tc},m?(0,wn.createElement)(m,Ul([].concat(ua,La,$a),Vb),ec):ec)}),usePublisher:function(ub){return(0,wn.useCallback)(Nj(Lm,(0,wn.useContext)(lb)[ub]),[ub])},useEmitterValue:function(ub){var Rb=(0,wn.useContext)(lb)[ub];ub=(0,wn.useState)(ri(Vk,Rb));var ec=ub[0],Vb=ub[1];hu(function(){return di(Rb,
function(tc){tc!==ec&&Vb(Yl(tc))})},[Rb,ec]);return ec},useEmitter:function(ub,Rb){var ec=(0,wn.useContext)(lb)[ub];hu(function(){return ec(1,Rb)},[Rb,ec])}}}function Ve(){return Ve=Object.assign||function(b){for(var g=1;g<arguments.length;g++){var m=arguments[g],I;for(I in m)Object.prototype.hasOwnProperty.call(m,I)&&(b[I]=m[I])}return b},Ve.apply(this,arguments)}function Ml(b,g){if(null==b)return{};var m,I,W={},ia=Object.keys(b);for(I=0;I<ia.length;I++)0<=g.indexOf(m=ia[I])||(W[m]=b[m]);return W}
function cl(b,g){(null==g||g>b.length)&&(g=b.length);for(var m=0,I=Array(g);m<g;m++)I[m]=b[m];return I}function Bf(b,g){var m="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(m)return(m=m.call(b)).next.bind(m);if(Array.isArray(b)||(m=function(W,ia){if(W){if("string"==typeof W)return cl(W,ia);var ua=Object.prototype.toString.call(W).slice(8,-1);return"Object"===ua&&W.constructor&&(ua=W.constructor.name),"Map"===ua||"Set"===ua?Array.from(W):"Arguments"===ua||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ua)?
cl(W,ia):void 0}}(b))||g&&b&&"number"==typeof b.length){m&&(b=m);var I=0;return function(){return I>=b.length?{done:!0}:{done:!1,value:b[I++]}}}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 dl(b,g){void 0===g&&(g=!0);var m=(0,bi.useRef)(null),I=function(ia){};if("undefined"!=typeof ResizeObserver){var W=new ResizeObserver(function(ia){ia=ia[0].target;null!==ia.offsetParent&&b(ia)});
I=function(ia){ia&&g?(W.observe(ia),m.current=ia):(m.current&&W.unobserve(m.current),m.current=null)}}return{ref:m,callbackRef:I}}function ch(b,g){return void 0===g&&(g=!0),dl(b,g).callbackRef}function ji(b,g,m,I,W,ia,ua){return dl(function(La){for(var Va=function(ub,Rb,ec,Vb){ec=ub.length;if(0===ec)return null;for(var tc=[],oc=0;oc<ec;oc++){var Xb=ub.item(oc);if(Xb&&void 0!==Xb.dataset.index){var sc=parseInt(Xb.dataset.index),Hc=parseFloat(Xb.dataset.knownSize),Rc=Rb(Xb,"offsetHeight");if(0===Rc&&
Vb("Zero-sized element, this should not happen",{child:Xb},nm.ERROR),Rc!==Hc)Xb=tc[tc.length-1],0===tc.length||Xb.size!==Rc||Xb.endIndex!==sc-1?tc.push({startIndex:sc,endIndex:sc,size:Rc}):tc[tc.length-1].endIndex++}}return tc}(La.children,g,0,W),$a=La.parentElement;!$a.dataset.virtuosoScroller;)$a=$a.parentElement;var lb="window"===$a.firstElementChild.dataset.viewportType;I({scrollTop:Math.max(ua?ua.scrollTop:lb?window.pageYOffset||document.documentElement.scrollTop:$a.scrollTop,0),scrollHeight:ua?
ua.scrollHeight:lb?document.documentElement.scrollHeight:$a.scrollHeight,viewportHeight:ua?ua.offsetHeight:lb?window.innerHeight:$a.offsetHeight});null==ia||ia(function(ub,Rb,ec){return"normal"===Rb||null!=Rb&&Rb.endsWith("px")||ec("row-gap was not resolved to pixel value correctly",Rb,nm.WARN),"normal"===Rb?0:parseInt(null!=Rb?Rb:"0",10)}(0,getComputedStyle(La).rowGap,W));null!==Va&&b(Va)},m)}function Qk(b,g){return Math.round(b.getBoundingClientRect()[g])}function zl(b,g,m,I,W){void 0===I&&(I=ag);
var ia=(0,bi.useRef)(null),ua=(0,bi.useRef)(null),La=(0,bi.useRef)(null),Va=(0,bi.useRef)(!1),$a=(0,bi.useCallback)(function(lb){lb=lb.target;var ub=lb===window||lb===document,Rb=ub?window.pageYOffset||document.documentElement.scrollTop:lb.scrollTop,ec=ub?document.documentElement.scrollHeight:lb.scrollHeight,Vb=ub?window.innerHeight:lb.offsetHeight;lb=function(){b({scrollTop:Math.max(Rb,0),scrollHeight:ec,viewportHeight:Vb})};Va.current?(0,CG.flushSync)(lb):lb();Va.current=!1;null!==ua.current&&(Rb===
ua.current||0>=Rb||Rb===ec-Vb)&&(ua.current=null,g(!0),La.current&&(clearTimeout(La.current),La.current=null))},[b,g]);return(0,bi.useEffect)(function(){var lb=W||ia.current;return I(W||ia.current),$a({target:lb}),lb.addEventListener("scroll",$a,{passive:!0}),function(){I(null);lb.removeEventListener("scroll",$a)}},[ia,$a,m,I,W]),{scrollerRef:ia,scrollByCallback:function(lb){Va.current=!0;ia.current.scrollBy(lb)},scrollToCallback:function(lb){var ub=ia.current;if(ub&&!("offsetHeight"in ub&&0===ub.offsetHeight)){var Rb,
ec,Vb,tc="smooth"===lb.behavior;if(ub===window?(ec=Math.max(Qk(document.documentElement,"height"),document.documentElement.scrollHeight),Rb=window.innerHeight,Vb=document.documentElement.scrollTop):(ec=ub.scrollHeight,Rb=Qk(ub,"height"),Vb=ub.scrollTop),lb.top=Math.ceil(Math.max(Math.min(ec-Rb,lb.top),0)),1.01>Math.abs(Rb-ec)||lb.top===Vb)return b({scrollTop:Vb,scrollHeight:ec,viewportHeight:Rb}),void(tc&&g(!0));tc?(ua.current=lb.top,La.current&&clearTimeout(La.current),La.current=setTimeout(function(){La.current=
null;ua.current=null;g(!0)},1E3)):ua.current=null;ub.scrollTo(lb)}}}}function el(b,g,m,I,W){return void 0===I&&(I=Hi),void 0===W&&(W=Hi),{k:b,v:g,lvl:m,l:I,r:W}}function hl(b,g){if(b===Hi)return Hi;var m=b.k,I=b.l,W=b.r;if(g===m){if(I===Hi)return W;if(W===Hi)return I;g=Xh(I);return Mm(Ah(b,{k:g[0],v:g[1],l:Nm(I)}))}return Mm(Ah(b,g<m?{l:hl(I,g)}:{r:hl(W,g)}))}function Wj(b,g,m){return(void 0===m&&(m="k"),b===Hi)?[-Infinity,void 0]:b[m]===g?[b.k,b.v]:b[m]<g?(g=Wj(b.r,g,m),-Infinity===g[0]?[b.k,b.v]:
g):Wj(b.l,g,m)}function ti(b,g,m){return b===Hi?el(g,m,1):g===b.k?Ah(b,{k:g,v:m}):dg(Ji(Ah(b,g<b.k?{l:ti(b.l,g,m)}:{r:ti(b.r,g,m)})))}function pn(b,g,m){if(b===Hi)return[];var I=b.k,W=b.v,ia=b.r,ua=[];return I>g&&(ua=ua.concat(pn(b.l,g,m))),I>=g&&I<=m&&ua.push({k:I,v:W}),I<=m&&(ua=ua.concat(pn(ia,g,m))),ua}function Wk(b){return b===Hi?[]:[].concat(Wk(b.l),[{k:b.k,v:b.v}],Wk(b.r))}function Xh(b){return b.r===Hi?[b.k,b.v]:Xh(b.r)}function Nm(b){return b.r===Hi?b.l:Mm(Ah(b,{r:Nm(b.r)}))}function Ah(b,
g){return el(void 0!==g.k?g.k:b.k,void 0!==g.v?g.v:b.v,void 0!==g.lvl?g.lvl:b.lvl,void 0!==g.l?g.l:b.l,void 0!==g.r?g.r:b.r)}function Fi(b){return b===Hi||b.lvl>b.r.lvl}function Mm(b){var g=b.l,m=b.r,I=b.lvl;if(m.lvl>=I-1&&g.lvl>=I-1)return b;if(I>m.lvl+1){if(Fi(g))return Ji(Ah(b,{lvl:I-1}));if(g===Hi||g.r===Hi)throw Error("Unexpected empty nodes");return Ah(g.r,{l:Ah(g,{r:g.r.l}),r:Ah(b,{l:g.r.r,lvl:I-1}),lvl:I})}if(Fi(b))return dg(Ah(b,{lvl:I-1}));if(m===Hi||m.l===Hi)throw Error("Unexpected empty nodes");
g=m.l;var W=Fi(g)?m.lvl-1:m.lvl;return Ah(g,{l:Ah(b,{r:g.l,lvl:I-1}),r:dg(Ah(m,{l:g.r,lvl:W})),lvl:g.lvl+1})}function vm(b,g,m){return b===Hi?[]:Aj(pn(b,Wj(b,g)[0],m),function(I){return{index:I.k,value:I.v}})}function Aj(b,g){var m=b.length;if(0===m)return[];var I=g(b[0]),W=I.index;I=I.value;for(var ia=[],ua=1;ua<m;ua++){var La=g(b[ua]),Va=La.index;La=La.value;ia.push({start:W,end:Va-1,value:I});W=Va;I=La}return ia.push({start:W,end:Infinity,value:I}),ia}function dg(b){var g=b.r,m=b.lvl;return g===
Hi||g.r===Hi||g.lvl!==m||g.r.lvl!==m?b:Ah(g,{l:Ah(b,{r:g.l}),lvl:m+1})}function Ji(b){var g=b.l;return g===Hi||g.lvl!==b.lvl?b:Ah(g,{r:Ah(b,{l:g.r})})}function wm(b,g,m,I){void 0===I&&(I=0);for(var W=b.length-1;I<=W;){var ia=Math.floor((I+W)/2),ua=m(b[ia],g);if(0===ua)return ia;if(-1===ua){if(2>W-I)return ia-1;W=ia-1}else{if(W===I)return ia;I=ia+1}}throw Error("Failed binary finding record in array - "+b.join(",")+", searched for "+g);}function Cm(b){var g=b.size,m=b.startIndex,I=b.endIndex;return function(W){return W.start===
m&&(W.end===I||Infinity===W.end)&&W.value===g}}function y(b,g){b=b.index;return g===b?0:g<b?-1:1}function U(b,g){b=b.offset;return g===b?0:g<b?-1:1}function xa(b){return{index:b.index,value:b}}function ta(b,g,m,I){var W=0,ia=0,ua=0,La;0!==g?(ua=b[La=wm(b,g-1,y)].offset,ia=Wj(m,g-1),W=ia[0],ia=ia[1],b.length&&b[La].size===Wj(m,g)[1]&&--La,b=b.slice(0,La+1)):b=[];for(g=Bf(vm(m,g,Infinity));!(m=g()).done;)La=m.value,m=La.start,La=La.value,W=m-W,ua=W*ia+ua+W*I,b.push({offset:ua,size:La,index:m}),W=m,
ia=La;return{offsetTree:b,lastIndex:W,lastOffset:ua,lastSize:ia}}function Fa(b,g){var m=g[0],I=g[1],W=g[3];0<m.length&&(0,g[2])("received item sizes",m,nm.DEBUG);var ia=b.sizeTree;g=ia;var ua=0;if(0<I.length&&ia===Hi&&2===m.length){var La=m[0].size,Va=m[1].size;g=I.reduce(function(lb,ub){return ti(ti(lb,ub,La),ub+1,Va)},g)}else m=function(lb,ub){var Rb,ec=lb===Hi?0:Infinity;for(ub=Bf(ub);!(Rb=ub()).done;){var Vb=Rb.value;Rb=Vb.size;var tc=Vb.startIndex,oc=Vb.endIndex;if(ec=Math.min(ec,tc),lb===Hi)lb=
ti(lb,0,Rb);else{var Xb=vm(lb,tc-1,oc+1);if(!Xb.some(Cm(Vb))){var sc,Hc=Vb=!1;for(Xb=Bf(Xb);!(sc=Xb()).done;){var Rc=sc.value;sc=Rc.start;var Vc=Rc.end;Rc=Rc.value;Vb?(oc>=sc||Rb===Rc)&&(lb=hl(lb,sc)):(Hc=Rc!==Rb,Vb=!0);Vc>oc&&oc>=sc&&Rc!==Rb&&(lb=ti(lb,oc+1,Rc))}Hc&&(lb=ti(lb,tc,Rb))}}}return[lb,ec]}(g,m),g=m[0],ua=m[1];if(g===ia)return b;b=ta(b.offsetTree,ua,g,W);var $a=b.offsetTree;return{sizeTree:g,offsetTree:$a,lastIndex:b.lastIndex,lastOffset:b.lastOffset,lastSize:b.lastSize,groupOffsetTree:I.reduce(function(lb,
ub){return ti(lb,ub,ab(ub,$a,W))},Hi),groupIndices:I}}function ab(b,g,m){if(0===g.length)return 0;g=g[wm(g,b,y)];b-=g.index;b=g.size*b+(b-1)*m+g.offset;return 0<b?b+m:b}function pb(b,g,m){if(void 0!==b.groupIndex)return g.groupIndices[b.groupIndex]+1;b=tb("LAST"===b.index?m:b.index,g);return Math.max(0,b,Math.min(m,b))}function tb(b,g){if(g.groupOffsetTree===Hi)return b;for(var m=0;g.groupIndices[m]<=b+m;)m++;return b+m}function ac(b){b="number"==typeof b?{index:b}:b;return b.align||(b.align="start"),
b.behavior&&GG||(b.behavior="auto"),b.offset||(b.offset=0),b}function Ac(b){return!!b&&("smooth"===b?"smooth":"auto")}function Cc(b){return b.reduce(function(g,m){return g.groupIndices.push(g.totalCount),g.totalCount+=m+1,g},{totalCount:0,groupIndices:[]})}function Hd(b,g){return!(!b||b[0]!==g[0]||b[1]!==g[1])}function Pd(b,g){return!(!b||b.startIndex!==g.startIndex||b.endIndex!==g.endIndex)}function qd(b,g,m){return"number"==typeof b?"up"===m&&"top"===g||"down"===m&&"bottom"===g?b:0:"up"===m?"top"===
g?b.main:b.reverse:"bottom"===g?b.main:b.reverse}function Ce(b,g,m){if(0===b.length)return[];if(g.groupOffsetTree===Hi)return b.map(function(Va){return Ve({},Va,{index:Va.index+m,originalIndex:Va.index})});var I,W=[],ia=vm(g.groupOffsetTree,b[0].index,b[b.length-1].index),ua=void 0,La=0;for(b=Bf(b);!(I=b()).done;)I=I.value,(!ua||ua.end<I.index)&&(ua=ia.shift(),La=g.groupIndices.indexOf(ua.start)),W.push(Ve({},I.index===ua.start?{type:"group",index:La}:{index:I.index-(La+1)+m,groupIndex:La},{size:I.size,
offset:I.offset,originalIndex:I.index,data:I.data}));return W}function yf(b,g,m,I,W,ia){var ua=0,La=0;0<b.length&&(ua=b[0].offset,La=b[b.length-1],La=La.offset+La.size);var Va=m-W.lastIndex,$a=ua;I=W.lastOffset+Va*W.lastSize+(Va-1)*I-La;return{items:Ce(b,W,ia),topItems:Ce(g,W,ia),topListHeight:g.reduce(function(lb,ub){return ub.size+lb},0),offsetTop:ua,offsetBottom:I,top:$a,bottom:La,totalCount:m,firstItemIndex:ia}}function Eg(b){var g,m=!1;return function(){return m||(m=!0,g=b()),g}}function kj(b,
g){var m=(0,bi.useRef)(null),I=(0,bi.useCallback)(function(Va){if(null!==Va&&Va.offsetParent){var $a=Va.getBoundingClientRect();Va=$a.width;if(g){var lb=g.getBoundingClientRect();$a=$a.top-lb.top;lb=lb.height-Math.max(0,$a);$a+=g.scrollTop}else lb=window.innerHeight-Math.max(0,$a.top),$a=$a.top+window.pageYOffset;m.current={offsetTop:$a,visibleHeight:lb,visibleWidth:Va};b(m.current)}},[b,g]),W=dl(I),ia=W.callbackRef,ua=W.ref,La=(0,bi.useCallback)(function(){I(ua.current)},[I,ua]);return(0,bi.useEffect)(function(){if(g){g.addEventListener("scroll",
La);var Va=new ResizeObserver(La);return Va.observe(g),function(){g.removeEventListener("scroll",La);Va.unobserve(g)}}return window.addEventListener("scroll",La),window.addEventListener("resize",La),function(){window.removeEventListener("scroll",La);window.removeEventListener("resize",La)}},[La,g]),ia}function kg(b){return b}function Vg(b,g){var m=Jf();return di(m,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+g,"color: red;","color: inherit;","color: blue;")}),
Yf(m,b),m}function Hg(b,g){if("string"!=typeof b)return{context:g}}function ki(b){var g=b.usePublisher,m=b.useEmitter,I=b.useEmitterValue;return hh.memo(function(W){var ia=W.style,ua=W.children;W=Ml(W,TG);var La=g("scrollContainerState"),Va=I("ScrollerComponent"),$a=g("smoothScrollTargetReached"),lb=I("scrollerRef"),ub=I("context");La=zl(La,$a,Va,lb);$a=La.scrollerRef;lb=La.scrollByCallback;return m("scrollTo",La.scrollToCallback),m("scrollBy",lb),(0,bi.createElement)(Va,Ve({ref:$a,style:Ve({},$G,
ia),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},W,Hg(Va,ub)),ua)})}function Ph(b){var g=b.usePublisher,m=b.useEmitter,I=b.useEmitterValue;return hh.memo(function(W){var ia=W.style,ua=W.children;W=Ml(W,UG);var La=g("windowScrollContainerState"),Va=I("ScrollerComponent"),$a=g("smoothScrollTargetReached"),lb=I("totalListHeight"),ub=I("deviation"),Rb=I("customScrollParent"),ec=I("context");$a=zl(La,$a,Va,ag,Rb);var Vb=$a.scrollerRef;La=$a.scrollByCallback;$a=$a.scrollToCallback;
return DG(function(){return Vb.current=Rb||window,function(){Vb.current=null}},[Vb,Rb]),m("windowScrollTo",$a),m("scrollBy",La),(0,bi.createElement)(Va,Ve({style:Ve({position:"relative"},ia,0!==lb?{height:lb+ub}:{}),"data-virtuoso-scroller":!0},W,Hg(Va,ec)),ua)})}function bg(b,g,m){return Array.from({length:g-b+1}).map(function(I,W){return{index:W+b,data:null==m?void 0:m[W+b]}})}function Nf(b,g){return b&&b.column===g.column&&b.row===g.row}function Bh(b,g,m,I){var W=m.height;return void 0===W||0===
I.length?{top:0,bottom:0}:{top:dh(b,g,m,I[0].index),bottom:dh(b,g,m,I[I.length-1].index)+W}}function dh(b,g,m,I){var W=g.column;b=Kr(1,ku((b.width+W)/(m.width+W)));I=ku(I/b);m=I*m.height+Kr(0,I-1)*g.row;return 0<m?m+g.row:m}function lj(b,g,m){return"normal"===g||null!=g&&g.endsWith("px")||m(b+" was not resolved to pixel value correctly",g,nm.WARN),"normal"===g?0:parseInt(null!=g?g:"0",10)}function Gh(b,g){void 0!==g.strokeWidth&&(g.strokeWidth=Math.max(g.strokeWidth,1));void 0!==g.opacity&&(g.opacity=
Math.min(1,Math.max(g.opacity,0)));return g}function zj({strokeWidth:b,size:g,mode:m}){return"svg"===m?(0,rb.jsx)("rect",{className:"tl-binding-indicator",x:b,y:b,rx:2,ry:2,width:Math.max(0,g[0]-2*b),height:Math.max(0,g[1]-2*b),strokeWidth:4*b}):(0,rb.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 gl(){const b=xg();return"panning"===b.inputs.state||"pinching"===b.inputs.state}
function Dk({left:b,middle:g,right:m,stroke:I,strokeWidth:W}){return(0,rb.jsxs)("g",{children:[(0,rb.jsx)("path",{className:"tl-stroke-hitarea",d:`M ${b} L ${g} ${m}`}),(0,rb.jsx)("path",{d:`M ${b} L ${g} ${m}`,fill:"none",stroke:I,strokeWidth:W,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"})]})}function hm(b,g,m){g=G(b,g,b,m).points;if(!g)return console.warn("Could not find an intersection for the arrow head."),{left:b,right:b};g=(m=g[0])?Zd.rotWith(m,b,Math.PI/6):b;b=m?Zd.rotWith(m,
b,-Math.PI/6):b;return{left:g,right:b}}function Mo(b,g,m){const {left:I,right:W}=hm(b,g,m);return`M ${I} L ${b} ${W}`}function on(b,g,m,I,W){b=b.strokeWidth;var ia=Zd.dist(g,m);b=Math.min(ia/3,16*b);ia=[];ia.push(`M ${g} L ${m}`);I&&ia.push(Mo(g,m,b));W&&ia.push(Mo(m,g,b));return ia.join(" ")}function jh({id:b,bounds:g,labelSize:m,offset:I,scale:W=1}){return(0,rb.jsx)("defs",{children:(0,rb.jsxs)("mask",{id:b+"_clip",children:[(0,rb.jsx)("rect",{x:-100,y:-100,width:g.width+200,height:g.height+200,
fill:"white"}),(0,rb.jsx)("rect",{x:g.width/2-m[0]/2*W+((null==I?void 0:I[0])||0),y:g.height/2-m[1]/2*W+((null==I?void 0:I[1])||0),width:m[0]*W,height:m[1]*W,rx:4*W,ry:4*W,fill:"black"})]})})}function gn(b,g,m,I=W=>W){return b*I(.5-g*(.5-m))}function il(b){return[-b[0],-b[1]]}function Al(b,g){return[b[0]+g[0],b[1]+g[1]]}function kk(b,g){return[b[0]-g[0],b[1]-g[1]]}function Bl(b,g){return[b[0]*g,b[1]*g]}function an(b){return[b[1],-b[0]]}function qm(b,g){return b[0]===g[0]&&b[1]===g[1]}function Om(b){return b[0]*
b[0]+b[1]*b[1]}function Jk(b){var g=Math.hypot(b[0],b[1]);return[b[0]/g,b[1]/g]}function jl(b,g){return Math.hypot(b[1]-g[1],b[0]-g[0])}function am(b,g,m){let I=Math.sin(m);m=Math.cos(m);let W=b[0]-g[0];b=b[1]-g[1];return[W*m-b*I+g[0],W*I+b*m+g[1]]}function fn(b,g,m){return Al(b,Bl(kk(g,b),m))}function Rm(b,g,m){return Al(b,Bl(g,m))}function Zo(b,g={}){let {size:m=16,smoothing:I=.5,thinning:W=.5,simulatePressure:ia=!0,easing:ua=md=>md,start:La={},end:Va={},last:$a=!1}=g,{cap:lb=!0,easing:ub=md=>md*
(2-md)}=La,{cap:Rb=!0,easing:ec=md=>--md*md*md+1}=Va;if(0===b.length||0>=m)return[];var Vb=b[b.length-1].runningLength;let tc=!1===La.taper?0:!0===La.taper?Math.max(m,Vb):La.taper,oc=!1===Va.taper?0:!0===Va.taper?Math.max(m,Vb):Va.taper;var Xb=Math.pow(m*I,2);g=[];let sc=[];var Hc=b.slice(0,10).reduce((md,zd)=>{var Md=zd.pressure;ia&&(zd=Or(1,zd.distance/m),Md=Or(1,1-zd),Md=Or(1,md+.275*(Md-md)*zd));return(md+Md)/2},b[0].pressure),Rc=gn(m,W,b[b.length-1].pressure,ua),Vc;let Vd=b[0].vector;var ae=
b[0].point;let De=ae;var Oe=ae;let tf=De;var of=!1;for(var bf=0;bf<b.length;bf++){var {pressure:Ge}=b[bf];let {point:md,vector:zd,distance:Md,runningLength:Ae}=b[bf];if(bf<b.length-1&&3>Vb-Ae)continue;W?(ia&&(Rc=Or(1,Md/m),Ge=Or(1,1-Rc),Ge=Or(1,Hc+.275*(Ge-Hc)*Rc)),Rc=gn(m,W,Ge,ua)):Rc=m/2;void 0===Vc&&(Vc=Rc);var Fd=Ae<tc?ub(Ae/tc):1,Oc=Vb-Ae<oc?ec((Vb-Ae)/oc):1;Rc=Math.max(.01,Rc*Math.min(Fd,Oc));Oc=(bf<b.length-1?b[bf+1]:b[bf]).vector;let Ie=bf<b.length-1?zd[0]*Oc[0]+zd[1]*Oc[1]:1;Fd=null!==Ie&&
0>Ie;if(0>zd[0]*Vd[0]+zd[1]*Vd[1]&&!of||Fd){ae=Bl(an(Vd),Rc);for(let qf=1/13,ef=0;1>=ef;ef+=qf)Oe=am(kk(md,ae),md,Vs*ef),g.push(Oe),tf=am(Al(md,ae),md,Vs*-ef),sc.push(tf);ae=Oe;De=tf;Fd&&(of=!0)}else(of=!1,bf===b.length-1)?(Ge=Bl(an(zd),Rc),g.push(kk(md,Ge)),sc.push(Al(md,Ge))):(Hc=Bl(an(fn(Oc,zd,Ie)),Rc),Oe=kk(md,Hc),(1>=bf||Om(kk(ae,Oe))>Xb)&&(g.push(Oe),ae=Oe),tf=Al(md,Hc),(1>=bf||Om(kk(De,tf))>Xb)&&(sc.push(tf),De=tf),Hc=Ge,Vd=zd)}Vb=b[0].point.slice(0,2);Xb=1<b.length?b[b.length-1].point.slice(0,
2):Al(b[0].point,[1,1]);Oe=[];of=[];if(1===b.length){if(!tc&&!oc||$a){b=Rm(Vb,Jk(an(kk(Vb,Xb))),-(Vc||Rc));g=[];for(let md=1/13,zd=md;1>=zd;zd+=md)g.push(am(b,Vb,2*Vs*zd));return g}}else{if(!(tc||oc&&1===b.length))if(lb)for(let md=1/13,zd=md;1>=zd;zd+=md)Vc=am(sc[0],Vb,Vs*zd),Oe.push(Vc);else bf=kk(g[0],sc[0]),Vc=Bl(bf,.5),bf=Bl(bf,.51),Oe.push(kk(Vb,Vc),kk(Vb,bf),Al(Vb,bf),Al(Vb,Vc));Vc=an(il(b[b.length-1].vector));if(oc||tc&&1===b.length)of.push(Xb);else if(Rb){b=Rm(Xb,Vc,Rc);for(let md=1/29,zd=
md;1>zd;zd+=md)of.push(am(b,Xb,3*Vs*zd))}else of.push(Al(Xb,Bl(Vc,Rc)),Al(Xb,Bl(Vc,.99*Rc)),kk(Xb,Bl(Vc,.99*Rc)),kk(Xb,Bl(Vc,Rc)))}return g.concat(of,sc.reverse(),Oe)}function io(b,g={}){var m;let {streamline:I=.5,size:W=16,last:ia=!1}=g;if(0===b.length)return[];g=.15+.85*(1-I);b=Array.isArray(b[0])?b:b.map(({x:ub,y:Rb,pressure:ec=.5})=>[ub,Rb,ec]);if(2===b.length){var ua=b[1];b=b.slice(0,-1);for(var La=1;5>La;La++)b.push(fn(b[0],ua,La/4))}1===b.length&&(b=[...b,[...Al(b[0],[1,1]),...b[0].slice(2)]]);
ua=[{point:[b[0][0],b[0][1]],pressure:0<=b[0][2]?b[0][2]:.25,vector:[1,1],distance:0,runningLength:0}];La=!1;let Va=0,$a=ua[0],lb=b.length-1;for(let ub=1;ub<b.length;ub++){let Rb=ia&&ub===lb?b[ub].slice(0,2):fn($a.point,b[ub],g);if(qm($a.point,Rb))continue;let ec=jl(Rb,$a.point);if(Va+=ec,ub<lb&&!La){if(Va<W)continue;La=!0}$a={point:Rb,pressure:0<=b[ub][2]?b[ub][2]:.5,vector:Jk(kk($a.point,Rb)),distance:ec,runningLength:Va};ua.push($a)}return ua[0].vector=(null==(m=ua[1])?void 0:m.vector)||[0,0],
ua}function Jo(b,g=4/3){return(new vw(b)).exportAsSVG(g)}function Gl(b,g=4/3){return(new vw(b)).generatePreviewJsx(void 0,g)}function Oo({id:b,type:g,onRemove:m,showContent:I}){const W=xg(),{handlers:ia}=zG.default.useContext(Kn);return(0,rb.jsxs)("div",{className:"tl-shape-links-panel-item color-level relative",children:[(0,rb.jsx)("div",{className:"whitespace-pre break-all overflow-hidden text-ellipsis inline-flex",children:(0,rb.jsx)(mA,{id:b,showReferenceContent:I})}),(0,rb.jsx)("div",{className:"flex-1"}),
ia.getBlockPageName(b)!==W.currentPage.name&&(0,rb.jsx)(dc,{tooltip:"Open Page",type:"button",onClick:()=>null==ia?void 0:ia.redirectToPage(b),children:(0,rb.jsx)(Oh,{name:"open-as-page"})}),(0,rb.jsx)(dc,{tooltip:"Open Page in Right Sidebar",type:"button",onClick:()=>null==ia?void 0:ia.sidebarAddBlock(b,"B"===g?"block":"page"),children:(0,rb.jsx)(Oh,{name:"move-to-sidebar-right"})}),m&&(0,rb.jsx)(dc,{className:"tl-shape-links-panel-item-remove-button",tooltip:"Remove link",type:"button",onClick:m,
children:(0,rb.jsx)(Oh,{name:"x",className:"!translate-y-0"})})]})}function ro({options:b,value:g,onValueChange:m}){return(0,rb.jsx)(YA,{className:"tl-toggle-group-input",type:"single",value:g,onValueChange:m,children:b.map(I=>(0,rb.jsx)(fc,{content:I.tooltip,children:(0,rb.jsx)("div",{className:"inline-block",children:(0,rb.jsx)(ZA,{className:"tl-toggle-group-input-button",value:I.value,disabled:I.value===g,children:(0,rb.jsx)(Oh,{name:I.icon})})})},I.value))})}function bn({options:b,value:g,onValueChange:m}){return(0,rb.jsx)(YA,
{className:"tl-toggle-group-input",type:"multiple",value:g,onValueChange:m,children:b.map(I=>(0,rb.jsx)(ZA,{className:"tl-toggle-group-input-button",value:I.value,children:(0,rb.jsx)(Oh,{name:I.icon})},I.value))})}function cn(b){var {toggle:g=!0,pressed:m,onPressedChange:I,className:W,tooltip:ia}=b;b=Ya(b,["toggle","pressed","onPressedChange","className","tooltip"]);return(0,rb.jsx)(fc,{content:ia,children:(0,rb.jsx)("div",{className:"inline-block",children:(0,rb.jsx)(VH,Ga(te({},b),{"data-toggle":g,
className:"tl-toggle-input"+(W?" "+W:""),pressed:m,onPressedChange:I}))})})}function Kk(b,g){return b.filter(m=>{var I;return null==(I=xw[m.props.type])?void 0:I.includes(g)})}function Bn(b){return g=>"mouse"!==g.pointerType?b(g):void 0}function ho(b){b=b.match(/\.[0-9a-z]+$/i);if(!b)return"unknown";b=b[0].toLowerCase();return yI.includes(b)?"image":zI.includes(b)?"video":"unknown"}function Cn(...b){return(...g)=>vd(this,null,function*(){for(const m of b){const I=yield m(...g);if(I&&0<I.length)return I}return null})}
function po(b,g){return vd(this,null,function*(){return b.types.includes(g)?b instanceof DataTransfer?b.getData(g):yield(yield b.getType(g)).text():null})}function Rl(){const {handlers:b}=eB.useContext(Kn);return eB.useCallback((g,m)=>vd(this,null,function*(){if(m.shiftKey&&1===g.selectedShapesArray.length){var I=yield navigator.clipboard.read();let W;0<I.length&&(I=(yield(yield I[0].getType("text/plain")).text()).trim())&&(/^\(\(.*\)\)$/.test(I)&&40===I.length?(I=I.slice(2,-2),Wh(I)&&(W=I)):/^\[\[.*\]\]$/.test(I)&&
(W=I.slice(2,-2)));if(W){g.selectedShapesArray[0].update({refs:[W]});g.persist();return}}AI(g,m,b)}),[])}function Pm(){const b=Rl();return xI.useCallback((g,m)=>vd(this,[g,m],function*(I,{dataTransfer:W,point:ia}){b(I,{point:ia,shiftKey:!1,dataTransfer:W,fromDrop:!0})}),[])}function jo(){return BI.default.useCallback(b=>vd(this,null,function*(){setTimeout(()=>{b.selectTool("logseq-portal").selectedTool.transition("creating")},100)}),[])}var Ko=Object.create,Sm=Object.defineProperty,ol=Object.defineProperties,
no=Object.getOwnPropertyDescriptor,ko=Object.getOwnPropertyDescriptors,Dn=Object.getOwnPropertyNames,Dm=Object.getOwnPropertySymbols,Sn=Object.getPrototypeOf,rm=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable,Tn=(b,g,m)=>g in b?Sm(b,g,{enumerable:!0,configurable:!0,writable:!0,value:m}):b[g]=m,te=(b,g)=>{for(var m in g||={})rm.call(g,m)&&Tn(b,m,g[m]);if(Dm)for(m of Dm(g))$o.call(g,m)&&Tn(b,m,g[m]);return b},Ga=(b,g)=>ol(b,ko(g)),Ya=(b,g)=>{var m={},I;for(I in b)rm.call(b,
I)&&0>g.indexOf(I)&&(m[I]=b[I]);if(null!=b&&Dm)for(I of Dm(b))0>g.indexOf(I)&&$o.call(b,I)&&(m[I]=b[I]);return m},Ka=(b,g)=>function(){return g||(0,b[Dn(b)[0]])((g={exports:{}}).exports,g),g.exports},hb=(b,g,m,I)=>{if(g&&"object"===typeof g||"function"===typeof g)for(let W of Dn(g))rm.call(b,W)||W===m||Sm(b,W,{get:()=>g[W],enumerable:!(I=no(g,W))||I.enumerable});return b},vb=(b,g,m)=>(m=null!=b?Ko(Sn(b)):{},hb(!g&&b&&b.__esModule?m:Sm(m,"default",{value:b,enumerable:!0}),b)),Lb=(b,g,m,I)=>{for(var W=
1<I?void 0:I?no(g,m):g,ia=b.length-1,ua;0<=ia;ia--)if(ua=b[ia])W=(I?ua(g,m,W):ua(W))||W;I&&W&&Sm(g,m,W);return W},Qa=(b,g,m)=>{Tn(b,"symbol"!==typeof g?g+"":g,m);return m},vd=(b,g,m)=>new Promise((I,W)=>{var ia=Va=>{try{La(m.next(Va))}catch($a){W($a)}},ua=Va=>{try{La(m.throw(Va))}catch($a){W($a)}},La=Va=>Va.done?I(Va.value):Promise.resolve(Va.value).then(ia,ua);La((m=m.apply(b,g)).next())}),he=Ka({["../../node_modules/mousetrap/mousetrap.js"](b,g){(function(m,I,W){function ia(oc,Xb,sc){oc.addEventListener?
oc.addEventListener(Xb,sc,!1):oc.attachEvent("on"+Xb,sc)}function ua(oc){if("keypress"==oc.type){var Xb=String.fromCharCode(oc.which);oc.shiftKey||(Xb=Xb.toLowerCase());return Xb}return ub[oc.which]?ub[oc.which]:Rb[oc.which]?Rb[oc.which]:String.fromCharCode(oc.which).toLowerCase()}function La(oc){return"shift"==oc||"ctrl"==oc||"alt"==oc||"meta"==oc}function Va(oc,Xb){var sc,Hc=[];"+"===oc?oc=["+"]:(oc=oc.replace(/\+{2}/g,"+plus"),oc=oc.split("+"));for(sc=0;sc<oc.length;++sc){var Rc=oc[sc];Vb[Rc]&&
(Rc=Vb[Rc]);Xb&&"keypress"!=Xb&&ec[Rc]&&(Rc=ec[Rc],Hc.push("shift"));La(Rc)&&Hc.push(Rc)}oc=Rc;if(!Xb){if(!tc){tc={};for(var Vc in ub)95<Vc&&112>Vc||ub.hasOwnProperty(Vc)&&(tc[ub[Vc]]=Vc)}Xb=tc[oc]?"keydown":"keypress"}"keypress"==Xb&&Hc.length&&(Xb="keydown");return{key:Rc,modifiers:Hc,action:Xb}}function $a(oc,Xb){return null===oc||oc===I?!1:oc===Xb?!0:$a(oc.parentNode,Xb)}function lb(oc){function Xb(Ge){Ge=Ge||{};var Fd=!1,Oc;for(Oc in De)Ge[Oc]?Fd=!0:De[Oc]=0;Fd||(bf=!1)}function sc(Ge,Fd,Oc,
md,zd,Md){var Ae,Ie=[],qf=Oc.type;if(!ae._callbacks[Ge])return[];"keyup"==qf&&La(Ge)&&(Fd=[Ge]);for(Ae=0;Ae<ae._callbacks[Ge].length;++Ae){var ef=ae._callbacks[Ge][Ae];if((md||!ef.seq||De[ef.seq]==ef.level)&&qf==ef.action){var gf;(gf="keypress"==qf&&!Oc.metaKey&&!Oc.ctrlKey)||(gf=ef.modifiers,gf=Fd.sort().join(",")===gf.sort().join(","));gf&&(gf=md&&ef.seq==md&&ef.level==Md,(!md&&ef.combo==zd||gf)&&ae._callbacks[Ge].splice(Ae,1),Ie.push(ef))}}return Ie}function Hc(Ge,Fd,Oc,md){ae.stopCallback(Fd,
Fd.target||Fd.srcElement,Oc,md)||!1!==Ge(Fd,Oc)||(Fd.preventDefault?Fd.preventDefault():Fd.returnValue=!1,Fd.stopPropagation?Fd.stopPropagation():Fd.cancelBubble=!0)}function Rc(Ge){"number"!==typeof Ge.which&&(Ge.which=Ge.keyCode);var Fd=ua(Ge);if(Fd)if("keyup"==Ge.type&&tf===Fd)tf=!1;else{var Oc=ae,md=Oc.handleKey,zd=[];Ge.shiftKey&&zd.push("shift");Ge.altKey&&zd.push("alt");Ge.ctrlKey&&zd.push("ctrl");Ge.metaKey&&zd.push("meta");md.call(Oc,Fd,zd,Ge)}}function Vc(Ge,Fd,Oc,md){function zd(qf){return function(){bf=
qf;++De[Ge];clearTimeout(Oe);Oe=setTimeout(Xb,1E3)}}function Md(qf){Hc(Oc,qf,Ge);"keyup"!==md&&(tf=ua(qf));setTimeout(Xb,10)}for(var Ae=De[Ge]=0;Ae<Fd.length;++Ae){var Ie=Ae+1===Fd.length?Md:zd(md||Va(Fd[Ae+1]).action);Vd(Fd[Ae],Ie,md,Ge,Ae)}}function Vd(Ge,Fd,Oc,md,zd){ae._directMap[Ge+":"+Oc]=Fd;Ge=Ge.replace(/\s+/g," ");var Md=Ge.split(" ");1<Md.length?Vc(Ge,Md,Fd,Oc):(Oc=Va(Ge,Oc),ae._callbacks[Oc.key]=ae._callbacks[Oc.key]||[],sc(Oc.key,Oc.modifiers,{type:Oc.action},md,Ge,zd),ae._callbacks[Oc.key][md?
"unshift":"push"]({callback:Fd,modifiers:Oc.modifiers,action:Oc.action,seq:md,level:zd,combo:Ge}))}var ae=this;oc=oc||I;if(!(ae instanceof lb))return new lb(oc);ae.target=oc;ae._callbacks={};ae._directMap={};var De={},Oe,tf=!1,of=!1,bf=!1;ae._handleKey=function(Ge,Fd,Oc){var md=sc(Ge,Fd,Oc),zd;Fd={};var Md=0,Ae=!1;for(zd=0;zd<md.length;++zd)md[zd].seq&&(Md=Math.max(Md,md[zd].level));for(zd=0;zd<md.length;++zd)md[zd].seq?md[zd].level==Md&&(Ae=!0,Fd[md[zd].seq]=1,Hc(md[zd].callback,Oc,md[zd].combo,
md[zd].seq)):Ae||Hc(md[zd].callback,Oc,md[zd].combo);md="keypress"==Oc.type&&of;Oc.type!=bf||La(Ge)||md||Xb(Fd);of=Ae&&"keydown"==Oc.type};ae._bindMultiple=function(Ge,Fd,Oc){for(var md=0;md<Ge.length;++md)Vd(Ge[md],Fd,Oc)};ia(oc,"keypress",Rc);ia(oc,"keydown",Rc);ia(oc,"keyup",Rc)}if(m){var ub={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",
93:"meta",224:"meta"},Rb={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"\x3d",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ec={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","\x26":"7","*":"8","(":"9",")":"0",_:"-","+":"\x3d",":":";",'"':"'","\x3c":",","\x3e":".","?":"/","|":"\\"},Vb={option:"alt",command:"meta","return":"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},tc;for(W=1;20>W;++W)ub[111+W]="f"+W;for(W=
0;9>=W;++W)ub[W+96]=W.toString();lb.prototype.bind=function(oc,Xb,sc){oc=oc instanceof Array?oc:[oc];this._bindMultiple.call(this,oc,Xb,sc);return this};lb.prototype.unbind=function(oc,Xb){return this.bind.call(this,oc,function(){},Xb)};lb.prototype.trigger=function(oc,Xb){if(this._directMap[oc+":"+Xb])this._directMap[oc+":"+Xb]({},oc);return this};lb.prototype.reset=function(){this._callbacks={};this._directMap={};return this};lb.prototype.stopCallback=function(oc,Xb){if(-1<(" "+Xb.className+" ").indexOf(" mousetrap ")||
$a(Xb,this.target))return!1;if("composedPath"in oc&&"function"===typeof oc.composedPath){var sc=oc.composedPath()[0];sc!==oc.target&&(Xb=sc)}return"INPUT"==Xb.tagName||"SELECT"==Xb.tagName||"TEXTAREA"==Xb.tagName||Xb.isContentEditable};lb.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};lb.addKeycodes=function(oc){for(var Xb in oc)oc.hasOwnProperty(Xb)&&(ub[Xb]=oc[Xb]);tc=null};lb.init=function(){var oc=lb(I),Xb;for(Xb in oc)"_"!==Xb.charAt(0)&&(lb[Xb]=function(sc){return function(){return oc[sc].apply(oc,
arguments)}}(Xb))};lb.init();m.Mousetrap=lb;"undefined"!==typeof g&&g.exports&&(g.exports=lb);"function"===typeof define&&define.amd&&define(function(){return lb})}})("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null)}}),Je=Ka({["../../node_modules/rbush/rbush.min.js"](b,g){!function(m,I){"object"==typeof b&&"undefined"!=typeof g?g.exports=I():"function"==typeof define&&define.amd?define(I):(m=m||self).RBush=I()}(b,function(){function m(Xb,sc,Hc,Rc,Vc){!function bf(ae,
De,Oe,tf,of){for(;tf>Oe;){if(600<tf-Oe){var Ge=tf-Oe+1,Fd=De-Oe+1,Oc=Math.log(Ge),md=.5*Math.exp(2*Oc/3);Oc=.5*Math.sqrt(Oc*md*(Ge-md)/Ge)*(0>Fd-Ge/2?-1:1);bf(ae,De,Math.max(Oe,Math.floor(De-Fd*md/Ge+Oc)),Math.min(tf,Math.floor(De+(Ge-Fd)*md/Ge+Oc)),of)}Ge=ae[De];Fd=Oe;md=tf;I(ae,Oe,De);for(0<of(ae[tf],Ge)&&I(ae,Oe,tf);Fd<md;){I(ae,Fd,md);Fd++;for(md--;0>of(ae[Fd],Ge);)Fd++;for(;0<of(ae[md],Ge);)md--}0===of(ae[Oe],Ge)?I(ae,Oe,md):I(ae,++md,tf);md<=De&&(Oe=md+1);De<=md&&(tf=md-1)}}(Xb,sc,Hc||0,Rc||
Xb.length-1,Vc||W)}function I(Xb,sc,Hc){var Rc=Xb[sc];Xb[sc]=Xb[Hc];Xb[Hc]=Rc}function W(Xb,sc){return Xb<sc?-1:Xb>sc?1:0}function ia(Xb,sc){ua(Xb,0,Xb.children.length,sc,Xb)}function ua(Xb,sc,Hc,Rc,Vc){Vc||=Vb(null);Vc.minX=1/0;Vc.minY=1/0;Vc.maxX=-1/0;for(Vc.maxY=-1/0;sc<Hc;sc++){var Vd=Xb.children[sc];La(Vc,Xb.leaf?Rc(Vd):Vd)}return Vc}function La(Xb,sc){return Xb.minX=Math.min(Xb.minX,sc.minX),Xb.minY=Math.min(Xb.minY,sc.minY),Xb.maxX=Math.max(Xb.maxX,sc.maxX),Xb.maxY=Math.max(Xb.maxY,sc.maxY),
Xb}function Va(Xb,sc){return Xb.minX-sc.minX}function $a(Xb,sc){return Xb.minY-sc.minY}function lb(Xb){return(Xb.maxX-Xb.minX)*(Xb.maxY-Xb.minY)}function ub(Xb){return Xb.maxX-Xb.minX+(Xb.maxY-Xb.minY)}function Rb(Xb,sc){return Xb.minX<=sc.minX&&Xb.minY<=sc.minY&&sc.maxX<=Xb.maxX&&sc.maxY<=Xb.maxY}function ec(Xb,sc){return sc.minX<=Xb.maxX&&sc.minY<=Xb.maxY&&sc.maxX>=Xb.minX&&sc.maxY>=Xb.minY}function Vb(Xb){return{children:Xb,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function tc(Xb,
sc,Hc,Rc,Vc){for(var Vd=[sc,Hc];Vd.length;)if(!((Hc=Vd.pop())-(sc=Vd.pop())<=Rc)){var ae=sc+Math.ceil((Hc-sc)/Rc/2)*Rc;m(Xb,ae,sc,Hc,Vc);Vd.push(sc,ae,ae,Hc)}}var oc=function(Xb){void 0===Xb&&(Xb=9);this._maxEntries=Math.max(4,Xb);this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries));this.clear()};return oc.prototype.all=function(){return this._all(this.data,[])},oc.prototype.search=function(Xb){var sc=this.data,Hc=[];if(!ec(Xb,sc))return Hc;for(var Rc=this.toBBox,Vc=[];sc;){for(var Vd=0;Vd<
sc.children.length;Vd++){var ae=sc.children[Vd],De=sc.leaf?Rc(ae):ae;ec(Xb,De)&&(sc.leaf?Hc.push(ae):Rb(Xb,De)?this._all(ae,Hc):Vc.push(ae))}sc=Vc.pop()}return Hc},oc.prototype.collides=function(Xb){var sc=this.data;if(!ec(Xb,sc))return!1;for(var Hc=[];sc;){for(var Rc=0;Rc<sc.children.length;Rc++){var Vc=sc.children[Rc],Vd=sc.leaf?this.toBBox(Vc):Vc;if(ec(Xb,Vd)){if(sc.leaf||Rb(Xb,Vd))return!0;Hc.push(Vc)}}sc=Hc.pop()}return!1},oc.prototype.load=function(Xb){if(!Xb||!Xb.length)return this;if(Xb.length<
this._minEntries){for(var sc=0;sc<Xb.length;sc++)this.insert(Xb[sc]);return this}Xb=this._build(Xb.slice(),0,Xb.length-1,0);this.data.children.length?this.data.height===Xb.height?this._splitRoot(this.data,Xb):(this.data.height<Xb.height&&(sc=this.data,this.data=Xb,Xb=sc),this._insert(Xb,this.data.height-Xb.height-1,!0)):this.data=Xb;return this},oc.prototype.insert=function(Xb){return Xb&&this._insert(Xb,this.data.height-1),this},oc.prototype.clear=function(){return this.data=Vb([]),this},oc.prototype.remove=
function(Xb,sc){if(!Xb)return this;for(var Hc,Rc,Vc,Vd=this.data,ae=this.toBBox(Xb),De=[],Oe=[];Vd||De.length;){if(Vd||(Vd=De.pop(),Rc=De[De.length-1],Hc=Oe.pop(),Vc=!0),Vd.leaf){a:{var tf=Xb;var of=Vd.children,bf=sc;if(bf){for(var Ge=0;Ge<of.length;Ge++)if(bf(tf,of[Ge])){tf=Ge;break a}tf=-1}else tf=of.indexOf(tf)}if(-1!==tf)return Vd.children.splice(tf,1),De.push(Vd),this._condense(De),this}Vc||Vd.leaf||!Rb(Vd,ae)?Rc?(Hc++,Vd=Rc.children[Hc],Vc=!1):Vd=null:(De.push(Vd),Oe.push(Hc),Hc=0,Rc=Vd,Vd=
Vd.children[0])}return this},oc.prototype.toBBox=function(Xb){return Xb},oc.prototype.compareMinX=function(Xb,sc){return Xb.minX-sc.minX},oc.prototype.compareMinY=function(Xb,sc){return Xb.minY-sc.minY},oc.prototype.toJSON=function(){return this.data},oc.prototype.fromJSON=function(Xb){return this.data=Xb,this},oc.prototype._all=function(Xb,sc){for(var Hc=[];Xb;)Xb.leaf?sc.push.apply(sc,Xb.children):Hc.push.apply(Hc,Xb.children),Xb=Hc.pop();return sc},oc.prototype._build=function(Xb,sc,Hc,Rc){var Vc,
Vd=Hc-sc+1,ae=this._maxEntries;if(Vd<=ae)return ia(Vc=Vb(Xb.slice(sc,Hc+1)),this.toBBox),Vc;Rc||(Rc=Math.ceil(Math.log(Vd)/Math.log(ae)),ae=Math.ceil(Vd/Math.pow(ae,Rc-1)));(Vc=Vb([])).leaf=!1;Vc.height=Rc;Vd=Math.ceil(Vd/ae);ae=Vd*Math.ceil(Math.sqrt(ae));for(tc(Xb,sc,Hc,ae,this.compareMinX);sc<=Hc;sc+=ae){var De=Math.min(sc+ae-1,Hc);tc(Xb,sc,De,Vd,this.compareMinY);for(var Oe=sc;Oe<=De;Oe+=Vd)Vc.children.push(this._build(Xb,Oe,Math.min(Oe+Vd-1,De),Rc-1))}return ia(Vc,this.toBBox),Vc},oc.prototype._chooseSubtree=
function(Xb,sc,Hc,Rc){for(;Rc.push(sc),!sc.leaf&&Rc.length-1!==Hc;){for(var Vc=1/0,Vd=1/0,ae=void 0,De=0;De<sc.children.length;De++){var Oe=sc.children[De],tf=lb(Oe),of=(bf=Xb,Ge=Oe,(Math.max(Ge.maxX,bf.maxX)-Math.min(Ge.minX,bf.minX))*(Math.max(Ge.maxY,bf.maxY)-Math.min(Ge.minY,bf.minY))-tf);of<Vd?(Vd=of,Vc=tf<Vc?tf:Vc,ae=Oe):of===Vd&&tf<Vc&&(Vc=tf,ae=Oe)}sc=ae||sc.children[0]}var bf,Ge;return sc},oc.prototype._insert=function(Xb,sc,Hc){Hc=Hc?Xb:this.toBBox(Xb);var Rc=[],Vc=this._chooseSubtree(Hc,
this.data,sc,Rc);Vc.children.push(Xb);for(La(Vc,Hc);0<=sc&&Rc[sc].children.length>this._maxEntries;)this._split(Rc,sc),sc--;this._adjustParentBBoxes(Hc,Rc,sc)},oc.prototype._split=function(Xb,sc){var Hc=Xb[sc],Rc=Hc.children.length,Vc=this._minEntries;this._chooseSplitAxis(Hc,Vc,Rc);Rc=this._chooseSplitIndex(Hc,Vc,Rc);Rc=Vb(Hc.children.splice(Rc,Hc.children.length-Rc));Rc.height=Hc.height;Rc.leaf=Hc.leaf;ia(Hc,this.toBBox);ia(Rc,this.toBBox);sc?Xb[sc-1].children.push(Rc):this._splitRoot(Hc,Rc)},oc.prototype._splitRoot=
function(Xb,sc){this.data=Vb([Xb,sc]);this.data.height=Xb.height+1;this.data.leaf=!1;ia(this.data,this.toBBox)},oc.prototype._chooseSplitIndex=function(Xb,sc,Hc){for(var Rc,Vc,Vd,ae,De,Oe,tf,of=1/0,bf=1/0,Ge=sc;Ge<=Hc-sc;Ge++){var Fd=ua(Xb,0,Ge,this.toBBox),Oc=ua(Xb,Ge,Hc,this.toBBox),md=(Vc=Fd,Vd=Oc,ae=void 0,De=void 0,Oe=void 0,tf=void 0,ae=Math.max(Vc.minX,Vd.minX),De=Math.max(Vc.minY,Vd.minY),Oe=Math.min(Vc.maxX,Vd.maxX),tf=Math.min(Vc.maxY,Vd.maxY),Math.max(0,Oe-ae)*Math.max(0,tf-De));Fd=lb(Fd)+
lb(Oc);md<of?(of=md,Rc=Ge,bf=Fd<bf?Fd:bf):md===of&&Fd<bf&&(bf=Fd,Rc=Ge)}return Rc||Hc-sc},oc.prototype._chooseSplitAxis=function(Xb,sc,Hc){var Rc=Xb.leaf?this.compareMinX:Va,Vc=Xb.leaf?this.compareMinY:$a;this._allDistMargin(Xb,sc,Hc,Rc)<this._allDistMargin(Xb,sc,Hc,Vc)&&Xb.children.sort(Rc)},oc.prototype._allDistMargin=function(Xb,sc,Hc,Rc){Xb.children.sort(Rc);Rc=this.toBBox;for(var Vc=ua(Xb,0,sc,Rc),Vd=ua(Xb,Hc-sc,Hc,Rc),ae=ub(Vc)+ub(Vd),De=sc;De<Hc-sc;De++){var Oe=Xb.children[De];La(Vc,Xb.leaf?
Rc(Oe):Oe);ae+=ub(Vc)}for(Hc=Hc-sc-1;Hc>=sc;Hc--)Vc=Xb.children[Hc],La(Vd,Xb.leaf?Rc(Vc):Vc),ae+=ub(Vd);return ae},oc.prototype._adjustParentBBoxes=function(Xb,sc,Hc){for(;0<=Hc;Hc--)La(sc[Hc],Xb)},oc.prototype._condense=function(Xb){for(var sc=Xb.length-1,Hc=void 0;0<=sc;sc--)0===Xb[sc].children.length?0<sc?(Hc=Xb[sc-1].children).splice(Hc.indexOf(Xb[sc]),1):this.clear():ia(Xb[sc],this.toBBox)},oc})}}),da=Ka({["../../node_modules/fast-deep-equal/index.js"](b,g){g.exports=function ia(I,W){if(I===
W)return!0;if(I&&W&&"object"==typeof I&&"object"==typeof W){if(I.constructor!==W.constructor)return!1;var ua;if(Array.isArray(I)){var La=I.length;if(La!=W.length)return!1;for(ua=La;0!==ua--;)if(!ia(I[ua],W[ua]))return!1;return!0}if(I.constructor===RegExp)return I.source===W.source&&I.flags===W.flags;if(I.valueOf!==Object.prototype.valueOf)return I.valueOf()===W.valueOf();if(I.toString!==Object.prototype.toString)return I.toString()===W.toString();var Va=Object.keys(I);La=Va.length;if(La!==Object.keys(W).length)return!1;
for(ua=La;0!==ua--;)if(!Object.prototype.hasOwnProperty.call(W,Va[ua]))return!1;for(ua=La;0!==ua--;)if(La=Va[ua],!ia(I[La],W[La]))return!1;return!0}return I!==I&&W!==W}}}),va=Ka({["../../../node_modules/deepmerge/dist/cjs.js"](b,g){function m(ub,Rb){return!1!==Rb.clone&&Rb.isMergeableObject(ub)?Va(Array.isArray(ub)?[]:{},ub,Rb):ub}function I(ub,Rb,ec){return ub.concat(Rb).map(function(Vb){return m(Vb,ec)})}function W(ub){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(ub).filter(function(Rb){return ub.propertyIsEnumerable(Rb)}):
[]}function ia(ub){return Object.keys(ub).concat(W(ub))}function ua(ub,Rb){try{return Rb in ub}catch(ec){return!1}}function La(ub,Rb,ec){var Vb={};ec.isMergeableObject(ub)&&ia(ub).forEach(function(tc){Vb[tc]=m(ub[tc],ec)});ia(Rb).forEach(function(tc){if(!ua(ub,tc)||Object.hasOwnProperty.call(ub,tc)&&Object.propertyIsEnumerable.call(ub,tc))if(ua(ub,tc)&&ec.isMergeableObject(Rb[tc])){if(ec.customMerge){var oc=ec.customMerge(tc);oc="function"===typeof oc?oc:Va}else oc=Va;Vb[tc]=oc(ub[tc],Rb[tc],ec)}else Vb[tc]=
m(Rb[tc],ec)});return Vb}function Va(ub,Rb,ec){ec=ec||{};ec.arrayMerge=ec.arrayMerge||I;ec.isMergeableObject=ec.isMergeableObject||$a;ec.cloneUnlessOtherwiseSpecified=m;var Vb=Array.isArray(Rb),tc=Array.isArray(ub);return Vb!==tc?m(Rb,ec):Vb?ec.arrayMerge(ub,Rb,ec):La(ub,Rb,ec)}var $a=function(ub){var Rb;if(Rb=!!ub&&"object"===typeof ub)Rb=Object.prototype.toString.call(ub),Rb=!("[object RegExp]"===Rb||"[object Date]"===Rb||ub.$$typeof===lb);return Rb},lb="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):
60103;Va.all=function(ub,Rb){if(!Array.isArray(ub))throw Error("first argument should be an array");return ub.reduce(function(ec,Vb){return Va(ec,Vb,Rb)},{})};g.exports=Va}}),Xa=Ka({["../../node_modules/tslib/tslib.js"](b,g){var m,I,W,ia,ua,La,Va,$a,lb,ub,Rb,ec,Vb,tc,oc,Xb,sc,Hc,Rc,Vc,Vd,ae,De,Oe,tf;(function(of){function bf(Fd,Oc){Fd!==Ge&&("function"===typeof Object.create?Object.defineProperty(Fd,"__esModule",{value:!0}):Fd.__esModule=!0);return function(md,zd){return Fd[md]=Oc?Oc(md,zd):zd}}var Ge=
"object"===typeof wa?wa:"object"===typeof self?self:"object"===typeof this?this:{};"function"===typeof define&&define.amd?define("tslib",["exports"],function(Fd){of(bf(Ge,bf(Fd)))}):"object"===typeof g&&"object"===typeof g.exports?of(bf(Ge,bf(g.exports))):of(bf(Ge))})(function(of){var bf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Fd,Oc){Fd.__proto__=Oc}||function(Fd,Oc){for(var md in Oc)Object.prototype.hasOwnProperty.call(Oc,md)&&(Fd[md]=Oc[md])};m=function(Fd,Oc){function md(){this.constructor=
Fd}if("function"!==typeof Oc&&null!==Oc)throw new TypeError("Class extends value "+String(Oc)+" is not a constructor or null");bf(Fd,Oc);Fd.prototype=null===Oc?Object.create(Oc):(md.prototype=Oc.prototype,new md)};I=Object.assign||function(Fd){for(var Oc,md=1,zd=arguments.length;md<zd;md++){Oc=arguments[md];for(var Md in Oc)Object.prototype.hasOwnProperty.call(Oc,Md)&&(Fd[Md]=Oc[Md])}return Fd};W=function(Fd,Oc){var md={},zd;for(zd in Fd)Object.prototype.hasOwnProperty.call(Fd,zd)&&0>Oc.indexOf(zd)&&
(md[zd]=Fd[zd]);if(null!=Fd&&"function"===typeof Object.getOwnPropertySymbols){var Md=0;for(zd=Object.getOwnPropertySymbols(Fd);Md<zd.length;Md++)0>Oc.indexOf(zd[Md])&&Object.prototype.propertyIsEnumerable.call(Fd,zd[Md])&&(md[zd[Md]]=Fd[zd[Md]])}return md};ia=function(Fd,Oc,md,zd){var Md=arguments.length,Ae=3>Md?Oc:null===zd?zd=Object.getOwnPropertyDescriptor(Oc,md):zd,Ie;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)Ae=Reflect.decorate(Fd,Oc,md,zd);else for(var qf=Fd.length-
1;0<=qf;qf--)if(Ie=Fd[qf])Ae=(3>Md?Ie(Ae):3<Md?Ie(Oc,md,Ae):Ie(Oc,md))||Ae;return 3<Md&&Ae&&Object.defineProperty(Oc,md,Ae),Ae};ua=function(Fd,Oc){return function(md,zd){Oc(md,zd,Fd)}};La=function(Fd,Oc){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(Fd,Oc)};Va=function(Fd,Oc,md,zd){function Md(Ae){return Ae instanceof md?Ae:new md(function(Ie){Ie(Ae)})}return new (md||=Promise)(function(Ae,Ie){function qf(Rg){try{gf(zd.next(Rg))}catch(Sg){Ie(Sg)}}function ef(Rg){try{gf(zd["throw"](Rg))}catch(Sg){Ie(Sg)}}
function gf(Rg){Rg.done?Ae(Rg.value):Md(Rg.value).then(qf,ef)}gf((zd=zd.apply(Fd,Oc||[])).next())})};$a=function(Fd,Oc){function md(gf){return function(Rg){return zd([gf,Rg])}}function zd(gf){if(Ae)throw new TypeError("Generator is already executing.");for(;Md;)try{if(Ae=1,Ie&&(qf=gf[0]&2?Ie["return"]:gf[0]?Ie["throw"]||((qf=Ie["return"])&&qf.call(Ie),0):Ie.next)&&!(qf=qf.call(Ie,gf[1])).done)return qf;if(Ie=0,qf)gf=[gf[0]&2,qf.value];switch(gf[0]){case 0:case 1:qf=gf;break;case 4:return Md.label++,
{value:gf[1],done:!1};case 5:Md.label++;Ie=gf[1];gf=[0];continue;case 7:gf=Md.ops.pop();Md.trys.pop();continue;default:if(!(qf=Md.trys,qf=0<qf.length&&qf[qf.length-1])&&(6===gf[0]||2===gf[0])){Md=0;continue}if(3===gf[0]&&(!qf||gf[1]>qf[0]&&gf[1]<qf[3]))Md.label=gf[1];else if(6===gf[0]&&Md.label<qf[1])Md.label=qf[1],qf=gf;else if(qf&&Md.label<qf[2])Md.label=qf[2],Md.ops.push(gf);else{qf[2]&&Md.ops.pop();Md.trys.pop();continue}}gf=Oc.call(Fd,Md)}catch(Rg){gf=[6,Rg],Ie=0}finally{Ae=qf=0}if(gf[0]&5)throw gf[1];
return{value:gf[0]?gf[1]:void 0,done:!0}}var Md={label:0,sent:function(){if(qf[0]&1)throw qf[1];return qf[1]},trys:[],ops:[]},Ae,Ie,qf,ef;return ef={next:md(0),"throw":md(1),"return":md(2)},"function"===typeof Symbol&&(ef[Symbol.iterator]=function(){return this}),ef};lb=function(Fd,Oc){for(var md in Fd)"default"===md||Object.prototype.hasOwnProperty.call(Oc,md)||tf(Oc,Fd,md)};tf=Object.create?function(Fd,Oc,md,zd){void 0===zd&&(zd=md);var Md=Object.getOwnPropertyDescriptor(Oc,md);if(!Md||("get"in
Md?!Oc.__esModule:Md.writable||Md.configurable))Md={enumerable:!0,get:function(){return Oc[md]}};Object.defineProperty(Fd,zd,Md)}:function(Fd,Oc,md,zd){void 0===zd&&(zd=md);Fd[zd]=Oc[md]};ub=function(Fd){var Oc="function"===typeof Symbol&&Symbol.iterator,md=Oc&&Fd[Oc],zd=0;if(md)return md.call(Fd);if(Fd&&"number"===typeof Fd.length)return{next:function(){Fd&&zd>=Fd.length&&(Fd=void 0);return{value:Fd&&Fd[zd++],done:!Fd}}};throw new TypeError(Oc?"Object is not iterable.":"Symbol.iterator is not defined.");
};Rb=function(Fd,Oc){var md="function"===typeof Symbol&&Fd[Symbol.iterator];if(!md)return Fd;Fd=md.call(Fd);var zd,Md=[];try{for(;(void 0===Oc||0<Oc--)&&!(zd=Fd.next()).done;)Md.push(zd.value)}catch(Ie){var Ae={error:Ie}}finally{try{zd&&!zd.done&&(md=Fd["return"])&&md.call(Fd)}finally{if(Ae)throw Ae.error;}}return Md};ec=function(){for(var Fd=[],Oc=0;Oc<arguments.length;Oc++)Fd=Fd.concat(Rb(arguments[Oc]));return Fd};Vb=function(){for(var Fd=0,Oc=0,md=arguments.length;Oc<md;Oc++)Fd+=arguments[Oc].length;
Fd=Array(Fd);var zd=0;for(Oc=0;Oc<md;Oc++)for(var Md=arguments[Oc],Ae=0,Ie=Md.length;Ae<Ie;Ae++,zd++)Fd[zd]=Md[Ae];return Fd};tc=function(Fd,Oc,md){if(md||2===arguments.length)for(var zd=0,Md=Oc.length,Ae;zd<Md;zd++)!Ae&&zd in Oc||(Ae||=Array.prototype.slice.call(Oc,0,zd),Ae[zd]=Oc[zd]);return Fd.concat(Ae||Array.prototype.slice.call(Oc))};oc=function(Fd){return this instanceof oc?(this.v=Fd,this):new oc(Fd)};Xb=function(Fd,Oc,md){function zd(Sg){ef[Sg]&&(gf[Sg]=function(wi){return new Promise(function(Ik,
Tk){1<Rg.push([Sg,wi,Ik,Tk])||Md(Sg,wi)})})}function Md(Sg,wi){try{var Ik=ef[Sg](wi);Ik.value instanceof oc?Promise.resolve(Ik.value.v).then(Ae,Ie):qf(Rg[0][2],Ik)}catch(Tk){qf(Rg[0][3],Tk)}}function Ae(Sg){Md("next",Sg)}function Ie(Sg){Md("throw",Sg)}function qf(Sg,wi){(Sg(wi),Rg.shift(),Rg.length)&&Md(Rg[0][0],Rg[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var ef=md.apply(Fd,Oc||[]),gf,Rg=[];return gf={},zd("next"),zd("throw"),zd("return"),gf[Symbol.asyncIterator]=
function(){return this},gf};sc=function(Fd){function Oc(Md,Ae){md[Md]=Fd[Md]?function(Ie){return(zd=!zd)?{value:oc(Fd[Md](Ie)),done:"return"===Md}:Ae?Ae(Ie):Ie}:Ae}var md,zd;return md={},Oc("next"),Oc("throw",function(Md){throw Md;}),Oc("return"),md[Symbol.iterator]=function(){return this},md};Hc=function(Fd){function Oc(Ae){Md[Ae]=Fd[Ae]&&function(Ie){return new Promise(function(qf,ef){Ie=Fd[Ae](Ie);md(qf,ef,Ie.done,Ie.value)})}}function md(Ae,Ie,qf,ef){Promise.resolve(ef).then(function(gf){Ae({value:gf,
done:qf})},Ie)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zd=Fd[Symbol.asyncIterator],Md;return zd?zd.call(Fd):(Fd="function"===typeof ub?ub(Fd):Fd[Symbol.iterator](),Md={},Oc("next"),Oc("throw"),Oc("return"),Md[Symbol.asyncIterator]=function(){return this},Md)};Rc=function(Fd,Oc){Object.defineProperty?Object.defineProperty(Fd,"raw",{value:Oc}):Fd.raw=Oc;return Fd};var Ge=Object.create?function(Fd,Oc){Object.defineProperty(Fd,"default",{enumerable:!0,
value:Oc})}:function(Fd,Oc){Fd["default"]=Oc};Vc=function(Fd){if(Fd&&Fd.__esModule)return Fd;var Oc={};if(null!=Fd)for(var md in Fd)"default"!==md&&Object.prototype.hasOwnProperty.call(Fd,md)&&tf(Oc,Fd,md);Ge(Oc,Fd);return Oc};Vd=function(Fd){return Fd&&Fd.__esModule?Fd:{"default":Fd}};ae=function(Fd,Oc,md,zd){if("a"===md&&!zd)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof Oc?Fd!==Oc||!zd:!Oc.has(Fd))throw new TypeError("Cannot read private member from an object whose class did not declare it");
return"m"===md?zd:"a"===md?zd.call(Fd):zd?zd.value:Oc.get(Fd)};De=function(Fd,Oc,md,zd,Md){if("m"===zd)throw new TypeError("Private method is not writable");if("a"===zd&&!Md)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof Oc?Fd!==Oc||!Md:!Oc.has(Fd))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===zd?Md.call(Fd,md):Md?Md.value=md:Oc.set(Fd,md),md};Oe=function(Fd,Oc){if(null===Oc||"object"!==typeof Oc&&
"function"!==typeof Oc)throw new TypeError("Cannot use 'in' operator on non-object");return"function"===typeof Fd?Oc===Fd:Fd.has(Oc)};of("__extends",m);of("__assign",I);of("__rest",W);of("__decorate",ia);of("__param",ua);of("__metadata",La);of("__awaiter",Va);of("__generator",$a);of("__exportStar",lb);of("__createBinding",tf);of("__values",ub);of("__read",Rb);of("__spread",ec);of("__spreadArrays",Vb);of("__spreadArray",tc);of("__await",oc);of("__asyncGenerator",Xb);of("__asyncDelegator",sc);of("__asyncValues",
Hc);of("__makeTemplateObject",Rc);of("__importStar",Vc);of("__importDefault",Vd);of("__classPrivateFieldGet",ae);of("__classPrivateFieldSet",De);of("__classPrivateFieldIn",Oe)})}}),yb={};((b,g)=>{for(var m in g)Sm(b,m,{get:g[m],enumerable:!0})})(yb,{App:()=>GI,PreviewManager:()=>vw,generateJSXFromModel:()=>Gl,generateSVGFromModel:()=>Jo});Ta.exports=(b=>hb(Sm({},"__esModule",{value:!0}),b))(yb);var bc=(b=>{b.Yellow="yellow";b.Red="red";b.Pink="pink";b.Green="green";b.Blue="blue";b.Purple="purple";
b.Gray="gray";b.Default="";return b})(bc||{}),wc,Xc=new Uint8Array(16),nd=/^(?:[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,td=[];for(let b=0;256>b;++b)td.push((b+256).toString(16).slice(1));var Ud,we,Ye=0,vf=0,Of=function(b,g,m){m=g&&m||0;const I=g||Array(16);b=b||{};let W=b.node||Ud;var ia=void 0!==b.clockseq?b.clockseq:we;if(null==W||null==ia){var ua=b.random||(b.rng||p)();null==W&&(W=Ud=[ua[0]|1,ua[1],ua[2],ua[3],ua[4],ua[5]]);
null==ia&&(ia=we=(ua[6]<<8|ua[7])&16383)}ua=void 0!==b.msecs?b.msecs:Date.now();let La=void 0!==b.nsecs?b.nsecs:vf+1;const Va=ua-Ye+(La-vf)/1E4;0>Va&&void 0===b.clockseq&&(ia=ia+1&16383);(0>Va||ua>Ye)&&void 0===b.nsecs&&(La=0);if(1E4<=La)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");Ye=ua;vf=La;we=ia;ua+=122192928E5;b=(1E4*(ua&268435455)+La)%4294967296;I[m++]=b>>>24&255;I[m++]=b>>>16&255;I[m++]=b>>>8&255;I[m++]=b&255;b=ua/4294967296*1E4&268435455;I[m++]=b>>>8&255;I[m++]=b&255;I[m++]=
b>>>24&15|16;I[m++]=b>>>16&255;I[m++]=ia>>>8|128;I[m++]=ia&255;for(ia=0;6>ia;++ia)I[m+ia]=W[ia];return g||S(I)},mf=class{static clamp(b,g,m){return Math.max(g,"undefined"!==typeof m?Math.min(b,m):b)}static clampV(b,g,m){return b.map(I=>m?mf.clamp(I,g,m):mf.clamp(I,g))}static cross(b,g,m){return(g[0]-b[0])*(m[1]-b[1])-(m[0]-b[0])*(g[1]-b[1])}static snap(b,g=1){return[Math.round(b[0]/g)*g,Math.round(b[1]/g)*g]}},sd=mf;sd.neg=b=>[-b[0],-b[1]];sd.add=(b,g)=>[b[0]+g[0],b[1]+g[1]];sd.addScalar=(b,g)=>[b[0]+
g,b[1]+g];sd.sub=(b,g)=>[b[0]-g[0],b[1]-g[1]];sd.subScalar=(b,g)=>[b[0]-g,b[1]-g];sd.vec=(b,g)=>[g[0]-b[0],g[1]-b[1]];sd.mul=(b,g)=>[b[0]*g,b[1]*g];sd.mulV=(b,g)=>[b[0]*g[0],b[1]*g[1]];sd.div=(b,g)=>[b[0]/g,b[1]/g];sd.divV=(b,g)=>[b[0]/g[0],b[1]/g[1]];sd.per=b=>[b[1],-b[0]];sd.dpr=(b,g)=>b[0]*g[0]+b[1]*g[1];sd.cpr=(b,g)=>b[0]*g[1]-g[0]*b[1];sd.len2=b=>b[0]*b[0]+b[1]*b[1];sd.len=b=>Math.hypot(b[0],b[1]);sd.pry=(b,g)=>mf.dpr(b,g)/mf.len(g);sd.uni=b=>mf.div(b,mf.len(b));sd.normalize=b=>mf.uni(b);sd.tangent=
(b,g)=>mf.uni(mf.sub(b,g));sd.dist2=(b,g)=>mf.len2(mf.sub(b,g));sd.dist=(b,g)=>Math.hypot(b[1]-g[1],b[0]-g[0]);sd.fastDist=(b,g)=>{b=[g[0]-b[0],g[1]-b[1]];g=[Math.abs(b[0]),Math.abs(b[1])];let m=1/Math.max(g[0],g[1]);m*=1.29289-(g[0]+g[1])*m*.29289;return[b[0]*m,b[1]*m]};sd.ang=(b,g)=>Math.atan2(mf.cpr(b,g),mf.dpr(b,g));sd.angle=(b,g)=>Math.atan2(g[1]-b[1],g[0]-b[0]);sd.med=(b,g)=>mf.mul(mf.add(b,g),.5);sd.rot=(b,g=0)=>[b[0]*Math.cos(g)-b[1]*Math.sin(g),b[0]*Math.sin(g)+b[1]*Math.cos(g)];sd.rotWith=
(b,g,m=0)=>{if(0===m)return b;const I=Math.sin(m);m=Math.cos(m);const W=b[0]-g[0];b=b[1]-g[1];return[W*m-b*I+g[0],W*I+b*m+g[1]]};sd.isEqual=(b,g)=>b[0]===g[0]&&b[1]===g[1];sd.lrp=(b,g,m)=>mf.add(b,mf.mul(mf.sub(g,b),m));sd.int=(b,g,m,I,W=1)=>{m=(mf.clamp(m,I)-m)/(I-m);return mf.add(mf.mul(b,1-m),mf.mul(g,W))};sd.ang3=(b,g,m)=>{b=mf.vec(g,b);g=mf.vec(g,m);return mf.ang(b,g)};sd.abs=b=>[Math.abs(b[0]),Math.abs(b[1])];sd.rescale=(b,g)=>{const m=mf.len(b);return[g*b[0]/m,g*b[1]/m]};sd.isLeft=(b,g,m)=>
(g[0]-b[0])*(m[1]-b[1])-(m[0]-b[0])*(g[1]-b[1]);sd.clockwise=(b,g,m)=>0<mf.isLeft(b,g,m);sd.toFixed=b=>b.map(g=>Math.round(100*g)/100);sd.nearestPointOnLineThroughPoint=(b,g,m)=>mf.add(b,mf.mul(g,mf.pry(mf.sub(m,b),g)));sd.distanceToLineThroughPoint=(b,g,m)=>mf.dist(m,mf.nearestPointOnLineThroughPoint(b,g,m));sd.nearestPointOnLineSegment=(b,g,m,I=!0)=>{const W=mf.uni(mf.sub(g,b));m=mf.add(b,mf.mul(W,mf.pry(mf.sub(m,b),W)));if(I){if(m[0]<Math.min(b[0],g[0]))return b[0]<g[0]?b:g;if(m[0]>Math.max(b[0],
g[0]))return b[0]>g[0]?b:g;if(m[1]<Math.min(b[1],g[1]))return b[1]<g[1]?b:g;if(m[1]>Math.max(b[1],g[1]))return b[1]>g[1]?b:g}return m};sd.distanceToLineSegment=(b,g,m,I=!0)=>mf.dist(m,mf.nearestPointOnLineSegment(b,g,m,I));sd.nudge=(b,g,m)=>mf.isEqual(b,g)?b:mf.add(b,mf.mul(mf.uni(mf.sub(g,b)),m));sd.nudgeAtAngle=(b,g,m)=>[Math.cos(g)*m+b[0],Math.sin(g)*m+b[1]];sd.toPrecision=(b,g=4)=>[+b[0].toPrecision(g),+b[1].toPrecision(g)];sd.pointsBetween=(b,g,m=6)=>Array.from(Array(m)).map((I,W)=>{I=W/(m-1);
W=Math.min(1,.5+Math.abs(.5-I));return[...mf.lrp(b,g,I),W]});sd.slope=(b,g)=>b[0]===g[0]?NaN:(b[1]-g[1])/(b[0]-g[0]);sd.toAngle=b=>{b=Math.atan2(b[1],b[0]);return 0>b?b+2*Math.PI:b};sd.max=(...b)=>[Math.max(...b.map(g=>g[0])),Math.max(...b.map(g=>g[1]))];sd.min=(...b)=>[Math.min(...b.map(g=>g[0])),Math.min(...b.map(g=>g[1]))];var Zd=sd,We=class{static getRectangleSides(b,g,m=0){const I=[b[0]+g[0]/2,b[1]+g[1]/2],W=sd.rotWith(b,I,m),ia=sd.rotWith(sd.add(b,[g[0],0]),I,m),ua=sd.rotWith(sd.add(b,g),I,
m);b=sd.rotWith(sd.add(b,[0,g[1]]),I,m);return[["top",[W,ia]],["right",[ia,ua]],["bottom",[ua,b]],["left",[b,W]]]}static getBoundsSides(b){return We.getRectangleSides([b.minX,b.minY],[b.width,b.height])}static expandBounds(b,g){return{minX:b.minX-g,minY:b.minY-g,maxX:b.maxX+g,maxY:b.maxY+g,width:b.width+2*g,height:b.height+2*g}}static boundsCollide(b,g){return!(b.maxX<g.minX||b.minX>g.maxX||b.maxY<g.minY||b.minY>g.maxY)}static boundsContain(b,g){return Array.isArray(g)?b.minX<g[0]&&b.minY<g[1]&&b.maxY>
g[1]&&b.maxX>g[0]:b.minX<g.minX&&b.minY<g.minY&&b.maxY>g.maxY&&b.maxX>g.maxX}static boundsContained(b,g){return We.boundsContain(g,b)}static boundsAreEqual(b,g){return!(g.maxX!==b.maxX||g.minX!==b.minX||g.maxY!==b.maxY||g.minY!==b.minY)}static getBoundsFromPoints(b,g=0){let m=Infinity,I=Infinity,W=-Infinity,ia=-Infinity;if(2>b.length)I=m=0,ia=W=1;else for(const ua of b)m=Math.min(ua[0],m),I=Math.min(ua[1],I),W=Math.max(ua[0],W),ia=Math.max(ua[1],ia);return 0!==g?We.getBoundsFromPoints(b.map(ua=>sd.rotWith(ua,
[(m+W)/2,(I+ia)/2],g))):{minX:m,minY:I,maxX:W,maxY:ia,width:Math.max(1,W-m),height:Math.max(1,ia-I)}}static centerBounds(b,g){const m=We.getBoundsCenter(b);return We.translateBounds(b,[g[0]-m[0],g[1]-m[1]])}static snapBoundsToGrid(b,g){const m=Math.round(b.minX/g)*g,I=Math.round(b.minY/g)*g,W=Math.round(b.maxX/g)*g;b=Math.round(b.maxY/g)*g;return{minX:m,minY:I,maxX:W,maxY:b,width:Math.max(1,W-m),height:Math.max(1,b-I)}}static translateBounds(b,g){return{minX:b.minX+g[0],minY:b.minY+g[1],maxX:b.maxX+
g[0],maxY:b.maxY+g[1],width:b.width,height:b.height}}static multiplyBounds(b,g){const m=We.getBoundsCenter(b);return We.centerBounds({minX:b.minX*g,minY:b.minY*g,maxX:b.maxX*g,maxY:b.maxY*g,width:b.width*g,height:b.height*g},[m[0]*g,m[1]*g])}static divideBounds(b,g){const m=We.getBoundsCenter(b);return We.centerBounds({minX:b.minX/g,minY:b.minY/g,maxX:b.maxX/g,maxY:b.maxY/g,width:b.width/g,height:b.height/g},[m[0]/g,m[1]/g])}static getRotatedBounds(b,g=0){b=We.getRotatedCorners(b,g);let m=g=Infinity,
I=-Infinity,W=-Infinity;for(const ia of b)g=Math.min(ia[0],g),m=Math.min(ia[1],m),I=Math.max(ia[0],I),W=Math.max(ia[1],W);return{minX:g,minY:m,maxX:I,maxY:W,width:Math.max(1,I-g),height:Math.max(1,W-m),rotation:0}}static getRotatedEllipseBounds(b,g,m,I,W=0){var ia=Math.cos(W);const ua=Math.sin(W);W=Math.hypot(m*ia,I*ua);ia=Math.hypot(m*ua,I*ia);return{minX:b+m-W,minY:g+I-ia,maxX:b+m+W,maxY:g+I+ia,width:2*W,height:2*ia}}static getExpandedBounds(b,g){const m=Math.min(b.minX,g.minX),I=Math.min(b.minY,
g.minY),W=Math.max(b.maxX,g.maxX);b=Math.max(b.maxY,g.maxY);return{minX:m,minY:I,maxX:W,maxY:b,width:Math.abs(W-m),height:Math.abs(b-I)}}static getCommonBounds(b){if(2>b.length)return b[0];let g=b[0];for(let m=1;m<b.length;m++)g=We.getExpandedBounds(g,b[m]);return g}static getRotatedCorners(b,g=0){const m=[b.minX+b.width/2,b.minY+b.height/2];b=[[b.minX,b.minY],[b.maxX,b.minY],[b.maxX,b.maxY],[b.minX,b.maxY]];return g?b.map(I=>sd.rotWith(I,m,g)):b}static getTransformedBoundingBox(b,g,m,I=0,W=!1){const [ia,
ua]=[b.minX,b.minY],[La,Va]=[b.maxX,b.maxY];let [$a,lb]=[b.minX,b.minY],[ub,Rb]=[b.maxX,b.maxY];if("center"===g)return{minX:$a+m[0],minY:lb+m[1],maxX:ub+m[0],maxY:Rb+m[1],width:ub-$a,height:Rb-lb,scaleX:1,scaleY:1};const [ec,Vb]=sd.rot(m,-I);switch(g){case "top_edge":case "top_left_corner":case "top_right_corner":lb+=Vb;break;case "bottom_edge":case "bottom_left_corner":case "bottom_right_corner":Rb+=Vb}switch(g){case "left_edge":case "top_left_corner":case "bottom_left_corner":$a+=ec;break;case "right_edge":case "top_right_corner":case "bottom_right_corner":ub+=
ec}var tc=La-ia;const oc=Va-ua;var Xb=(ub-$a)/tc,sc=(Rb-lb)/oc;b=0>Xb;m=0>sc;var Hc=Math.abs(ub-$a),Rc=Math.abs(Rb-lb);if(W)switch(W=tc/oc,tc=W<Hc/Rc,sc=1/W*(0>sc?1:-1)*Hc,Xb=Rc*(0>Xb?1:-1)*W,g){case "top_left_corner":tc?lb=Rb+sc:$a=ub+Xb;break;case "top_right_corner":tc?lb=Rb+sc:ub=$a-Xb;break;case "bottom_right_corner":tc?Rb=lb-sc:ub=$a-Xb;break;case "bottom_left_corner":tc?Rb=lb-sc:$a=ub+Xb;break;case "bottom_edge":case "top_edge":Hc=($a+ub)/2;Rc*=W;$a=Hc-Rc/2;ub=Hc+Rc/2;break;case "left_edge":case "right_edge":Rc=
(lb+Rb)/2,Hc/=W,lb=Rc-Hc/2,Rb=Rc+Hc/2}if(0!==I%(2*Math.PI)){Hc=[0,0];Rc=sd.med([ia,ua],[La,Va]);Xb=sd.med([$a,lb],[ub,Rb]);switch(g){case "top_left_corner":Hc=sd.sub(sd.rotWith([ub,Rb],Xb,I),sd.rotWith([La,Va],Rc,I));break;case "top_right_corner":Hc=sd.sub(sd.rotWith([$a,Rb],Xb,I),sd.rotWith([ia,Va],Rc,I));break;case "bottom_right_corner":Hc=sd.sub(sd.rotWith([$a,lb],Xb,I),sd.rotWith([ia,ua],Rc,I));break;case "bottom_left_corner":Hc=sd.sub(sd.rotWith([ub,lb],Xb,I),sd.rotWith([La,ua],Rc,I));break;
case "top_edge":Hc=sd.sub(sd.rotWith(sd.med([$a,Rb],[ub,Rb]),Xb,I),sd.rotWith(sd.med([ia,Va],[La,Va]),Rc,I));break;case "left_edge":Hc=sd.sub(sd.rotWith(sd.med([ub,lb],[ub,Rb]),Xb,I),sd.rotWith(sd.med([La,ua],[La,Va]),Rc,I));break;case "bottom_edge":Hc=sd.sub(sd.rotWith(sd.med([$a,lb],[ub,lb]),Xb,I),sd.rotWith(sd.med([ia,ua],[La,ua]),Rc,I));break;case "right_edge":Hc=sd.sub(sd.rotWith(sd.med([$a,lb],[$a,Rb]),Xb,I),sd.rotWith(sd.med([ia,ua],[ia,Va]),Rc,I))}[$a,lb]=sd.sub([$a,lb],Hc);[ub,Rb]=sd.sub([ub,
Rb],Hc)}ub<$a&&([ub,$a]=[$a,ub]);Rb<lb&&([Rb,lb]=[lb,Rb]);return{minX:$a,minY:lb,maxX:ub,maxY:Rb,width:ub-$a,height:Rb-lb,scaleX:(ub-$a)/(La-ia||1)*(b?-1:1),scaleY:(Rb-lb)/(Va-ua||1)*(m?-1:1)}}static getTransformAnchor(b,g,m){let I=b;switch(b){case "top_left_corner":I=g&&m?"bottom_right_corner":g?"top_right_corner":m?"bottom_left_corner":"bottom_right_corner";break;case "top_right_corner":I=g&&m?"bottom_left_corner":g?"top_left_corner":m?"bottom_right_corner":"bottom_left_corner";break;case "bottom_right_corner":I=
g&&m?"top_left_corner":g?"bottom_left_corner":m?"top_right_corner":"top_left_corner";break;case "bottom_left_corner":I=g&&m?"top_right_corner":g?"bottom_right_corner":m?"top_left_corner":"top_right_corner"}return I}static getRelativeTransformedBoundingBox(b,g,m,I,W){I=b.minX+(I?g.maxX-m.maxX:m.minX-g.minX)/g.width*b.width;W=b.minY+(W?g.maxY-m.maxY:m.minY-g.minY)/g.height*b.height;const ia=m.width/g.width*b.width;b=m.height/g.height*b.height;return{minX:I,minY:W,maxX:I+ia,maxY:W+b,width:ia,height:b}}static getRotatedSize(b,
g){const m=sd.div(b,2);b=[[0,0],[b[0],0],b,[0,b[1]]].map(I=>sd.rotWith(I,m,g));b=We.getBoundsFromPoints(b);return[b.width,b.height]}static getBoundsCenter(b){return[b.minX+b.width/2,b.minY+b.height/2]}static getBoundsWithCenter(b){const g=We.getBoundsCenter(b);return Ga(te({},b),{midX:g[0],midY:g[1]})}static getCommonTopLeft(b){const g=[Infinity,Infinity];b.forEach(m=>{g[0]=Math.min(g[0],m[0]);g[1]=Math.min(g[1],m[1])});return g}static getTLSnapPoints(b,g,m){const I=te({},b);b=[0,0];const W=[],ia=
{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}},ua=["midX","minX","maxX"],La=["midY","minY","maxY"];g=g.map(Rb=>{const ec=ua.flatMap((tc,oc)=>ua.map((Xb,sc)=>{const Hc=I[tc]-Rb[Xb];return{f:tc,t:Xb,gap:Hc,distance:Math.abs(Hc),isCareful:0===oc||3===oc+sc}})),Vb=La.flatMap((tc,oc)=>La.map((Xb,sc)=>{const Hc=I[tc]-Rb[Xb];return{f:tc,t:Xb,gap:Hc,distance:Math.abs(Hc),
isCareful:0===oc||3===oc+sc}}));return[Rb,ec,Vb]});let Va=Infinity,$a=Infinity,lb=Infinity,ub=Infinity;g.forEach(([,Rb,ec])=>{Rb.forEach(Vb=>{Vb.distance<m&&Vb.distance<lb&&(lb=Vb.distance,Va=Vb.gap)});ec.forEach(Vb=>{Vb.distance<m&&Vb.distance<ub&&(ub=Vb.distance,$a=Vb.gap)})});g.forEach(([Rb,ec,Vb])=>{Infinity!==Va&&ec.forEach(tc=>{2>Math.abs(tc.gap-Va)&&(ia[tc.f]=Ga(te({},ia[tc.f]),{isSnapped:!0,to:Rb[tc.t],B:Rb,distance:tc.distance}))});Infinity!==$a&&Vb.forEach(tc=>{2>Math.abs(tc.gap-$a)&&(ia[tc.f]=
Ga(te({},ia[tc.f]),{isSnapped:!0,to:Rb[tc.t],B:Rb,distance:tc.distance}))})});b[0]=Infinity===Va?0:Va;b[1]=Infinity===$a?0:$a;I.minX-=b[0];I.midX-=b[0];I.maxX-=b[0];I.minY-=b[1];I.midY-=b[1];I.maxY-=b[1];ua.forEach(Rb=>{Rb=ia[Rb];if(Rb.isSnapped){var {id:ec,B:Vb}=Rb;Rb=I[ec];W.push("minX"===ec?[[Rb,I.midY],[Rb,Vb.minY],[Rb,Vb.maxY]]:[[Rb,I.minY],[Rb,I.maxY],[Rb,Vb.minY],[Rb,Vb.maxY]])}});La.forEach(Rb=>{Rb=ia[Rb];if(Rb.isSnapped){var {id:ec,B:Vb}=Rb;Rb=I[ec];W.push("midY"===ec?[[I.midX,Rb],[Vb.minX,
Rb],[Vb.maxX,Rb]]:[[I.minX,Rb],[I.maxX,Rb],[Vb.minX,Rb],[Vb.maxX,Rb]])}});return{offset:b,snapLines:W}}static ensureRatio(b,g){const {width:m,height:I}=b,W=te({},b);m/I<g?(W.width=I*g,W.maxX+=m-b.width):(W.height=m/g,W.maxY+=I-b.height);return W}static getDistributions(b,g){var m=b.map(ia=>{const ua=ia.getBounds();return{id:ia.id,point:[ua.minX,ua.minY],bounds:ua,center:ia.getCenter()}});b=m.length;var I=We.getCommonBounds(m.map(({bounds:ia})=>ia));const W=[];switch(g){case "horizontal":g=m.reduce((ia,
ua)=>ia+ua.bounds.width,0);if(g>I.width){const ia=m.sort(($a,lb)=>$a.bounds.minX-lb.bounds.minX)[0],ua=m.sort(($a,lb)=>lb.bounds.maxX-$a.bounds.maxX)[0];I=m.filter($a=>$a!==ia&&$a!==ua).sort(($a,lb)=>$a.center[0]-lb.center[0]);const La=(ua.center[0]-ia.center[0])/(b-1),Va=ia.center[0]+La;I.forEach(({id:$a,point:lb,bounds:ub},Rb)=>{W.push({id:$a,prev:lb,next:[Va+La*Rb-ub.width/2,ub.minY]})})}else{m=m.sort((La,Va)=>La.center[0]-Va.center[0]);let ia=I.minX;const ua=(I.width-g)/(b-1);m.forEach(({id:La,
point:Va,bounds:$a})=>{W.push({id:La,prev:Va,next:[ia,$a.minY]});ia+=$a.width+ua})}break;case "vertical":if(g=m.reduce((ia,ua)=>ia+ua.bounds.height,0),g>I.height){const ia=m.sort(($a,lb)=>$a.bounds.minY-lb.bounds.minY)[0],ua=m.sort(($a,lb)=>lb.bounds.maxY-$a.bounds.maxY)[0];I=m.filter($a=>$a!==ia&&$a!==ua).sort(($a,lb)=>$a.center[1]-lb.center[1]);const La=(ua.center[1]-ia.center[1])/(b-1),Va=ia.center[1]+La;I.forEach(({id:$a,point:lb,bounds:ub},Rb)=>{W.push({id:$a,prev:lb,next:[ub.minX,Va+La*Rb-ub.height/
2]})})}else{m=m.sort((La,Va)=>La.center[1]-Va.center[1]);let ia=I.minY;const ua=(I.height-g)/(b-1);m.forEach(({id:La,point:Va,bounds:$a})=>{W.push({id:La,prev:Va,next:[$a.minX,ia]});ia+=$a.height+ua})}}return W}static getPackedDistributions(b){const g=We.getCommonBounds(b.map(({bounds:W})=>W)),m=[g.minX,g.minY],I=Object.fromEntries(b.map(W=>[W.id,[W.bounds.minX,W.bounds.minY]]));b=b.filter(W=>{var ia,ua,La,Va;return!((null==(ua=null==(ia=W.props.handles)?void 0:ia.start)?0:ua.bindingId)||(null==(Va=
null==(La=W.props.handles)?void 0:La.end)?0:Va.bindingId))}).map(W=>{const ia=W.getBounds();return{id:W.id,w:ia.width+16,h:ia.height+16,x:ia.minX,y:ia.minY}});A(b);return b.map(({id:W,x:ia,y:ua})=>({id:W,prev:I[W],next:[ia+m[0],ua+m[1]]}))}},qh=class{static pointInCircle(b,g,m){return sd.dist(b,g)<=m}static pointInEllipse(b,g,m,I,W=0){W=W||0;var ia=Math.cos(W);W=Math.sin(W);g=sd.sub(b,g);b=ia*g[0]+W*g[1];ia=W*g[0]-ia*g[1];return 1>=b*b/(m*m)+ia*ia/(I*I)}static pointInRect(b,g){return!(b[0]<g[0]||
b[0]>b[0]+g[0]||b[1]<g[1]||b[1]>b[1]+g[1])}static pointInPolygon(b,g){let m=0;g.forEach((I,W)=>{W=g[(W+1)%g.length];I[1]<=b[1]?W[1]>b[1]&&0<sd.cross(I,W,b)&&(m+=1):W[1]<=b[1]&&0>sd.cross(I,W,b)&&--m});return 0!==m}static pointInBounds(b,g){return!(b[0]<g.minX||b[0]>g.maxX||b[1]<g.minY||b[1]>g.maxY)}static pointInPolyline(b,g,m=3){for(let I=1;I<g.length;I++)if(sd.distanceToLineSegment(g[I-1],g[I],b)<m)return!0;return!1}static _getSqSegDist(b,g,m){let I=g[0];g=g[1];let W=m[0]-I,ia=m[1]-g;if(0!==W||
0!==ia){const ua=((b[0]-I)*W+(b[1]-g)*ia)/(W*W+ia*ia);1<ua?(I=m[0],g=m[1]):0<ua&&(I+=W*ua,g+=ia*ua)}W=b[0]-I;ia=b[1]-g;return W*W+ia*ia}static _simplifyStep(b,g,m,I,W){let ia=I,ua=-1;for(let La=g+1;La<m;La++){const Va=qh._getSqSegDist(b[La],b[g],b[m]);Va>ia&&(ua=La,ia=Va)}-1<ua&&ia>I&&(1<ua-g&&qh._simplifyStep(b,g,ua,I,W),W.push(b[ua]),1<m-ua&&qh._simplifyStep(b,ua,m,I,W))}static simplify2(b,g=1){if(2>=b.length)return b;g*=g;var m=b[0],I=b[1];const W=[m];for(let ia=1,ua=b.length;ia<ua;ia++)I=b[ia],
(I[0]-m[0])*(I[0]-m[0])+(I[1]-m[1])*(I[1]-m[1])>g&&(W.push(I),m=I);m!==I&&W.push(I);m=W.length-1;I=[W[0]];qh._simplifyStep(W,0,m,g,I);I.push(W[m],b[b.length-1]);return I}static pointNearToPolyline(b,g,m=8){const I=g.length;for(let W=1;W<I;W++)if(sd.distanceToLineSegment(g[W-1],g[W],b)<m)return!0;return!1}},zh=qh;Qa(zh,"simplify",(b,g=1)=>{var m=b.length;const I=b[0],W=b[m-1],[ia,ua]=I,[La,Va]=W;if(2<m){let $a=0,lb=0;const ub=sd.len2([Va-ua,La-ia]);for(let Rb=1;Rb<m-1;Rb++){const [ec,Vb]=b[Rb],tc=
Math.pow(ec*(Va-ua)+ia*(Vb-Va)+La*(ua-Vb),2)/ub;$a>tc||($a=tc,lb=Rb)}if($a>g)return m=qh.simplify(b.slice(0,lb+1),g),b=qh.simplify(b.slice(lb+1),g),m.concat(b.slice(1))}return[I,W]});var bl=vb(he()),En=({target:b},g)=>{b=b&&b.tagName;return!!(b&&g&&g.includes(b))},vp=class{static registerShortcut(b,g){bl.default.bind(b,(m,I)=>{var W;m.preventDefault();En(m,["INPUT","TEXTAREA","SELECT"])||(null==(W=m.target)?0:W.isContentEditable)||g(m,I)},"keydown");return()=>{bl.default.unbind(b,"keydown")}}},fm=
Math.PI,Gm=fm/2,wg=2*fm,Nl={},Nk={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"},Si=class{static circleFromThreePoints(b,g,m){const [I,
W]=b,[ia,ua]=g,[La,Va]=m;g=I*(ua-Va)-W*(ia-La)+ia*Va-La*ua;b=-((I*I+W*W)*(Va-ua)+(ia*ia+ua*ua)*(W-Va)+(La*La+Va*Va)*(ua-W))/(2*g);g=-((I*I+W*W)*(ia-La)+(ia*ia+ua*ua)*(La-I)+(La*La+Va*Va)*(I-ia))/(2*g);return[b,g,Math.hypot(b-I,g-W)]}static perimeterOfEllipse(b,g){const m=Math.pow(b-g,2)/Math.pow(b+g,2);return fm*(b+g)*(1+3*m/(10+Math.sqrt(4-3*m)))}static shortAngleDist(b,g){b=(g-b)%wg;return 2*b%wg-b}static longAngleDist(b,g){return wg-Si.shortAngleDist(b,g)}static lerpAngles(b,g,m){return b+Si.shortAngleDist(b,
g)*m}static angleDelta(b,g){return Si.shortAngleDist(b,g)}static getSweep(b,g,m){return Si.angleDelta(Zd.angle(b,g),Zd.angle(b,m))}static clampRadians(b){return(wg+b)%wg}static snapAngleToSegments(b,g){g=wg/g;b=Math.floor((Si.clampRadians(b)+g/2)/g)*g%wg;b<fm&&(b+=wg);b>fm&&(b-=wg);return b}static isAngleBetween(b,g,m){if(m===b||m===g)return!0;g=(g-b+Gm)%Gm;return g<=fm!==(m-b+Gm)%Gm>g}static degreesToRadians(b){return b*fm/180}static radiansToDegrees(b){return 180*b/fm}static getArcLength(b,g,m,
I){b=Si.getSweep(b,m,I);return b/wg*wg*g}static getSweepFlag(b,g,m){m=Zd.angle(b,m);return 0<(Zd.angle(b,g)-m+3*fm)%wg-fm?0:1}static getLargeArcFlag(b,g,m){b=Zd.angle(m,b);g=(Zd.angle(m,g)-b+3*fm)%wg-fm;return Math.abs(g)>Gm?0:1}static getArcDashOffset(b,g,m,I,W){const ia=Si.getSweepFlag(b,m,I);g=Si.getArcLength(b,g,m,I);return-(0>ia?g:wg*b[2]-g)/2+W}static getEllipseDashOffset(b,g){return-(wg*b[2])/2+-g}static radiansToCardinalDirection(b){return b<.25*Math.PI?"north":b<.75*Math.PI?"east":b<1.25*
Math.PI?"south":b<1.75*Math.PI?"west":"north"}},Uj=class{static getPolygonCentroid(b){var g=b.map(m=>m[0]);b=b.map(m=>m[1]);g=Math.min(...g)+Math.max(...g);b=Math.min(...b)+Math.max(...b);return[g?g/2:0,b?b/2:0]}};Qa(Uj,"getEdges",b=>{const g=b.length;return b.map((m,I)=>[m,b[(I+1)%g]])});Qa(Uj,"getEdgeOutwardNormal",(b,g)=>Zd.per(Zd.uni(Zd.sub(g,b))));Qa(Uj,"getEdgeInwardNormal",(b,g)=>Zd.neg(Uj.getEdgeOutwardNormal(b,g)));Qa(Uj,"getOffsetEdge",(b,g,m)=>{m=Zd.mul(Zd.per(Zd.uni(Zd.sub(g,b))),m);return[Zd.add(b,
m),Zd.add(g,m)]});Qa(Uj,"getOffsetEdges",(b,g)=>b.map(([m,I])=>Uj.getOffsetEdge(m,I,g)));Qa(Uj,"getOffsetPolygon",(b,g)=>{if(1>b.length)throw Error("Expected at least one point.");if(1===b.length)return b=b[0],[Zd.add(b,[-g,-g]),Zd.add(b,[g,-g]),Zd.add(b,[g,g]),Zd.add(b,[-g,g])];if(2===b.length){const [m,I]=b;return[...Uj.getOffsetEdge(m,I,g),...Uj.getOffsetEdge(I,m,g)]}return Uj.getOffsetEdges(Uj.getEdges(b),g).flatMap((m,I,W)=>{{I=W[(I+1)%W.length];const ia=sd.slope(m[0],m[1]);W=sd.slope(I[0],I[1]);
ia!==W?Number.isNaN(ia)&&!Number.isNaN(W)?m=[m[0][0],(m[0][0]-I[0][0])*W+I[0][1]]:Number.isNaN(W)&&!Number.isNaN(ia)?m=[I[0][0],(I[0][0]-m[0][0])*ia+m[0][1]]:(m=(ia*m[0][0]-W*I[0][0]+I[0][1]-m[0][1])/(ia-W),m=[m,W*(m-I[0][0])+I[0][1]]):m=void 0}if(void 0===m)throw Error("Expected an intersection");return m})});Qa(Uj,"getPolygonVertices",(b,g,m=0,I=1)=>{b=Zd.div(b,2);const [W,ia]=[Math.max(1,b[0]-m),Math.max(1,b[1]-m)];m=[];for(let $a=0,lb=wg/g;$a<g;$a++){var ua=(-Gm+$a*lb)%wg,La=(-Gm+($a+1)*lb)%wg;
ua=Zd.add(b,[W*Math.cos(ua),ia*Math.sin(ua)]);La=Zd.add(b,[W*Math.cos(La),ia*Math.sin(La)]);var Va=Zd.med(ua,La);Va=Zd.nudge(Va,b,Zd.dist(b,Va)*(1-I));m.push(ua,Va,La)}return m});Qa(Uj,"getTriangleVertices",(b,g=0,m=1)=>{const [I,W]=b;var ia=1-m;b=[I/2,g/2];m=[I-g,W-g];g=[g/2,W-g];const ua=Uj.getPolygonCentroid([b,m,g]),La=Zd.med(b,m),Va=Zd.med(m,g),$a=Zd.med(g,b),lb=Zd.dist(La,ua)*ia,ub=Zd.dist(Va,ua)*ia;ia*=Zd.dist($a,ua);return[b,lb?Zd.nudge(La,ua,lb):La,m,ub?Zd.nudge(Va,ua,ub):Va,g,ia?Zd.nudge($a,
ua,ia):$a]});Qa(Uj,"getStarVertices",(b,g,m,I=1)=>{const W=Zd.div(g,2),ia=Zd.mul(W,I/2),ua=wg/m/2;return Array.from(Array(2*m)).map((La,Va)=>{La=-Gm+Va*ua;const [$a,lb]=Va%2?ia:W;return Zd.add(b,[$a*Math.cos(La),lb*Math.sin(La)])})});var qq=class{static getCurvedPathForPolygon(b){if(3>b.length)return"M -4, 0\n      a 4,4 0 1,0 8,0\n      a 4,4 0 1,0 -8,0";const g=["M",...b[0].slice(0,2),"Q"],m=b.length;for(let I=1;I<m;I++){const [W,ia]=b[I],[ua,La]=b[(I+1)%m];g.push(W,ia,(W+ua)/2,(ia+La)/2)}g.push("Z");
return g.join(" ")}static getCurvedPathForPoints(b){if(3>b.length)return"M -4, 0\n      a 4,4 0 1,0 8,0\n      a 4,4 0 1,0 -8,0";const g=["M",...b[0].slice(0,2),"Q"],m=b.length;for(let I=1;I<m-1;I++){const [W,ia]=b[I],[ua,La]=b[I+1];g.push(W,ia,(W+ua)/2,(ia+La)/2)}return g.join(" ")}static getSvgPathFromStroke(b,g=!0){const m=b.length;if(4>m)return"";let I=b[0],W=b[1];var ia=b[2];ia=`M${I[0].toFixed(2)},${I[1].toFixed(2)} Q${W[0].toFixed(2)},${W[1].toFixed(2)} ${((W[0]+ia[0])/2).toFixed(2)},${((W[1]+
ia[1])/2).toFixed(2)} T`;for(let ua=2,La=m-1;ua<La;ua++)I=b[ua],W=b[ua+1],ia+=`${((I[0]+W[0])/2).toFixed(2)},${((I[1]+W[1])/2).toFixed(2)} `;g&&(ia+="Z");return ia}static getSvgPathFromStrokePoints(b,g=!1){const m=b.length;if(4>m)return"";let I=b[0].point,W=b[1].point;var ia=b[2].point;ia=`M${I[0].toFixed(2)},${I[1].toFixed(2)} Q${W[0].toFixed(2)},${W[1].toFixed(2)} ${((W[0]+ia[0])/2).toFixed(2)},${((W[1]+ia[1])/2).toFixed(2)} T`;for(let ua=2,La=m-1;ua<La;ua++)I=b[ua].point,W=b[ua+1].point,ia+=`${((I[0]+
W[0])/2).toFixed(2)},${((I[1]+W[1])/2).toFixed(2)} `;g&&(ia+="Z");return ia}};Qa(qq,"TRIM_NUMBERS",/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g);var cm={},fr=Object.assign,mo=Object.getOwnPropertyDescriptor,dn=Object.defineProperty,Un=Object.prototype,pq=[];Object.freeze(pq);var nq={};Object.freeze(nq);var ps="undefined"!==typeof Proxy,os=Object.toString(),cg=function(){},lq="undefined"!==typeof Object.getOwnPropertySymbols,up="undefined"!==typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:lq?
function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:Object.getOwnPropertyNames,Vn=Object.getOwnPropertyDescriptors||function(b){var g={};up(b).forEach(function(m){g[m]=mo(b,m)});return g},Sl=Symbol("mobx-stored-annotations"),Zg=Symbol("mobx administration"),qo=function(){function b(m){void 0===m&&(m="Atom");this.name_=void 0;this.isBeingObserved_=this.isPendingUnobservation_=!1;this.observers_=new Set;this.lastAccessedBy_=this.diffValue_=0;this.lowestObserverState_=
Bd.NOT_TRACKING_;this.onBUOL=this.onBOL=void 0;this.name_=m}var g=b.prototype;g.onBO=function(){this.onBOL&&this.onBOL.forEach(function(m){return m()})};g.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(m){return m()})};g.reportObserved=function(){return Nb(this)};g.reportChanged=function(){ld();gc(this);Sd()};g.toString=function(){return this.name_};return b}(),tq=D("Atom",qo),No={identity:function(b,g){return b===g},structural:function(b,g){return sa(b,g)},"default":function(b,g){return Object.is?
Object.is(b,g):b===g?0!==b||1/b===1/g:b!==b&&g!==g},shallow:function(b,g){return sa(b,g,1)}},oo="override",oq=nb(),ap={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(ap);var mq=Wb("observable"),lo=Wb("observable.ref",{enhancer:fb}),er=Wb("observable.shallow",{enhancer:function(b,g,m){if(void 0===b||null===b||Xd(b)||jb(b)||Ip(b)||Iq(b))return b;if(Array.isArray(b))return yg.array(b,{name:m,deep:!1});if(H(b))return yg.object(b,void 0,{name:m,deep:!1});if(O(b))return yg.map(b,{name:m,
deep:!1});if(P(b))return yg.set(b,{name:m,deep:!1})}}),rq=Wb("observable.struct",{enhancer:function(b,g){return sa(b,g)?g:b}}),sq=Ua(mq);Object.assign(ad,sq);var cv={box:function(b,g){g=g||ap;return new gb(b,Jc(g),g.name,!0,g.equals)},array:function(b,g){g=g||ap;return(!1===Fe.useProxies||!1===g.proxy?ff:bb)(b,Jc(g),g.name)},map:function(b,g){g=g||ap;return new by(b,Jc(g),g.name)},set:function(b,g){g=g||ap;return new cy(b,Jc(g),g.name)},object:function(b,g,m){if(!1===Fe.useProxies||!1===(null==m?
void 0:m.proxy))m=Dd({},m);else{var I={},W,ia;ka();I=Dd(I,m);m=null!=(ia=(W=I[Zg]).proxy_)?ia:W.proxy_=new Proxy(I,kC)}return qc(m,b,g)},ref:Ua(lo),shallow:Ua(er),deep:sq,struct:Ua(rq)},yg=fr(ad,cv),ns=Bb("computed"),av=Bb("computed.struct",{equals:No.structural}),Gg=function(b,g){if(Y(g))return Ea(b,g,ns);if(H(b))return Ua(Bb("computed",b));g=H(g)?g:{};g.get=b;g.name||(g.name=b.name||"");return new Ic(g)};Object.assign(Gg,ns);Gg.struct=Ua(av);var xt,wp,gr=0,hr=1,T=null!=(xt=null==(wp=mo(function(){},
"name"))?void 0:wp.configurable)?xt:!1,la={value:"action",configurable:!0,writable:!1,enumerable:!1};var Da=Symbol.toPrimitive;var gb=function(b){function g(I,W,ia,ua,La){void 0===ia&&(ia="ObservableValue");void 0===La&&(La=No["default"]);ua=b.call(this,ia)||this;ua.enhancer=void 0;ua.hasUnreportedChange_=!1;ua.interceptors_=void 0;ua.changeListeners_=void 0;ua.value_=void 0;ua.dehancer=void 0;ua.enhancer=W;ua.name_=ia;ua.equals=La;ua.value_=W(I,void 0,ia);return ua}ea(g,b);var m=g.prototype;m.dehanceValue=
function(I){return void 0!==this.dehancer?this.dehancer(I):I};m.set=function(I){I=this.prepareNewValue_(I);I!==Fe.UNCHANGED&&this.setNewValue_(I)};m.prepareNewValue_=function(I){if(ce(this)){I=mc(this,{object:this,type:Qo,newValue:I});if(!I)return Fe.UNCHANGED;I=I.newValue}I=this.enhancer(I,this.value_,this.name_);return this.equals(this.value_,I)?Fe.UNCHANGED:I};m.setNewValue_=function(I){var W=this.value_;this.value_=I;this.reportChanged();Ne(this)&&cf(this,{type:Qo,object:this,newValue:I,oldValue:W})};
m.get=function(){this.reportObserved();return this.dehanceValue(this.value_)};m.intercept_=function(I){return pd(this,I)};m.observe_=function(I,W){W&&I({observableKind:"value",debugObjectName:this.name_,object:this,type:Qo,newValue:this.value_,oldValue:void 0});return Wf(this,I)};m.raw=function(){return this.value_};m.toJSON=function(){return this.get()};m.toString=function(){return this.name_+"["+this.value_+"]"};m.valueOf=function(){return X(this.get())};m[Da]=function(){return this.valueOf()};
return g}(qo),Ib=D("ObservableValue",gb);var rc=Symbol.toPrimitive;var Ic=function(){function b(m){this.dependenciesState_=Bd.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_=Bd.UP_TO_DATE_;this.unboundDepsCount_=0;this.value_=new Xf(null);this.triggeredBy_=this.name_=void 0;this.isRunningSetter_=this.isComputing_=!1;this.setter_=this.derivation=
void 0;this.isTracing_=Ee.NONE;this.onBUOL=this.onBOL=this.keepAlive_=this.requiresReaction_=this.equals_=this.scope_=void 0;m.get||n(31);this.derivation=m.get;this.name_=m.name||"ComputedValue";m.set&&(this.setter_=Nc("ComputedValue-setter",m.set));this.equals_=m.equals||(m.compareStructural||m.struct?No.structural:No["default"]);this.scope_=m.context;this.requiresReaction_=m.requiresReaction;this.keepAlive_=!!m.keepAlive}var g=b.prototype;g.onBecomeStale_=function(){qb(this)};g.onBO=function(){this.onBOL&&
this.onBOL.forEach(function(m){return m()})};g.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(m){return m()})};g.get=function(){this.isComputing_&&n(32,this.name_,this.derivation);if(0!==Fe.inBatch||0!==this.observers_.size||this.keepAlive_){if(Nb(this),Wc(this)){var m=Fe.trackingContext;this.keepAlive_&&!m&&(Fe.trackingContext=this);this.trackAndCompute()&&Yb(this);Fe.trackingContext=m}}else Wc(this)&&(this.warnAboutUntrackedRead_(),ld(),this.value_=this.computeValue_(!1),Sd());m=this.value_;
if(m instanceof Xf)throw m.cause;return m};g.set=function(m){if(this.setter_){this.isRunningSetter_&&n(33,this.name_);this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,m)}finally{this.isRunningSetter_=!1}}else n(34,this.name_)};g.trackAndCompute=function(){var m=this.value_,I=this.dependenciesState_===Bd.NOT_TRACKING_,W=this.computeValue_(!0);if(m=I||m instanceof Xf||W instanceof Xf||!this.equals_(m,W))this.value_=W;return m};g.computeValue_=function(m){this.isComputing_=!0;var I=xc(!1);
if(m)var W=hd(this,this.derivation,this.scope_);else if(!0===Fe.disableErrorBoundaries)W=this.derivation.call(this.scope_);else try{W=this.derivation.call(this.scope_)}catch(ia){W=new Xf(ia)}Fe.allowStateChanges=I;this.isComputing_=!1;return W};g.suspend_=function(){this.keepAlive_||(Nd(this),this.value_=void 0)};g.observe_=function(m,I){var W=this,ia=!0,ua=void 0;return Od(function(){var La=W.get();if(!ia||I){var Va=pc();m({observableKind:"computed",debugObjectName:W.name_,type:Qo,object:W,newValue:La,
oldValue:ua});Fe.trackingDerivation=Va}ia=!1;ua=La})};g.warnAboutUntrackedRead_=function(){};g.toString=function(){return this.name_+"["+this.derivation.toString()+"]"};g.valueOf=function(){return X(this.get())};g[rc]=function(){return this.valueOf()};return b}(),dd=D("ComputedValue",Ic),Bd;(function(b){b[b.NOT_TRACKING_=-1]="NOT_TRACKING_";b[b.UP_TO_DATE_=0]="UP_TO_DATE_";b[b.POSSIBLY_STALE_=1]="POSSIBLY_STALE_";b[b.STALE_=2]="STALE_"})(Bd||={});var Ee;(function(b){b[b.NONE=0]="NONE";b[b.LOG=1]=
"LOG";b[b.BREAK=2]="BREAK"})(Ee||={});var Xf=function(b){this.cause=void 0;this.cause=b},oh=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},jf=!0,Cg=!1,Fe=function(){var b=R();0<b.__mobxInstanceCount&&!b.__mobxGlobals&&(jf=!1);b.__mobxGlobals&&b.__mobxGlobals.version!==(new oh).version&&(jf=!1);if(jf){if(b.__mobxGlobals)return b.__mobxInstanceCount+=1,b.__mobxGlobals.UNCHANGED||(b.__mobxGlobals.UNCHANGED={}),b.__mobxGlobals;b.__mobxInstanceCount=1;return b.__mobxGlobals=new oh}setTimeout(function(){Cg||n(35)},
1);return new oh}(),Wg=function(){function b(m,I,W,ia){void 0===m&&(m="Reaction");this.requiresObservable_=this.errorHandler_=this.onInvalidate_=this.name_=void 0;this.observing_=[];this.newObserving_=[];this.dependenciesState_=Bd.NOT_TRACKING_;this.unboundDepsCount_=this.runId_=this.diffValue_=0;this.isRunning_=this.isTrackPending_=this.isScheduled_=this.isDisposed_=!1;this.isTracing_=Ee.NONE;this.name_=m;this.onInvalidate_=I;this.errorHandler_=W;this.requiresObservable_=ia}var g=b.prototype;g.onBecomeStale_=
function(){this.schedule_()};g.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Fe.pendingReactions.push(this),0<Fe.inBatch||Fe.isRunningReactions||Wd(mb))};g.isScheduled=function(){return this.isScheduled_};g.runReaction_=function(){if(!this.isDisposed_){ld();this.isScheduled_=!1;var m=Fe.trackingContext;Fe.trackingContext=this;if(Wc(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(I){this.reportExceptionInDerivation_(I)}}Fe.trackingContext=m;Sd()}};g.track=function(m){if(!this.isDisposed_){ld();
this.isRunning_=!0;var I=Fe.trackingContext;Fe.trackingContext=this;m=hd(this,m,void 0);Fe.trackingContext=I;this.isTrackPending_=this.isRunning_=!1;this.isDisposed_&&Nd(this);m instanceof Xf&&this.reportExceptionInDerivation_(m.cause);Sd()}};g.reportExceptionInDerivation_=function(m){var I=this;if(this.errorHandler_)this.errorHandler_(m,this);else{if(Fe.disableErrorBoundaries)throw m;Fe.suppressReactionErrors||console.error("[mobx] uncaught error in '"+this+"'",m);Fe.globalReactionErrorHandlers.forEach(function(W){return W(m,
I)})}};g.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ld(),Nd(this),Sd()))};g.getDisposer_=function(){var m=this.dispose.bind(this);m[Zg]=this;return m};g.toString=function(){return"Reaction["+this.name_+"]"};g.trace=function(m){void 0===m&&(m=!1);Cb(this,m)};return b}(),me=100,Wd=function(b){return b()},je=D("Reaction",Wg),af="action",kf=eb(af),Ih=eb("action.bound",{bound:!0}),ug=eb("autoAction",{autoAction:!0}),Ch=eb("autoAction.bound",{autoAction:!0,bound:!0}),hf=
Uc(!1);Object.assign(hf,kf);var yh=Uc(!0);Object.assign(yh,ug);hf.bound=Ua(Ih);yh.bound=Ua(Ch);var Lo=function(b){return b()},bv="onBO",nC="onBUO",oC=0;Sb.prototype=Object.create(Error.prototype);var $x=ra("flow"),mC=ra("flow.bound",{bound:!0}),ss=Object.assign(function(b,g){if(Y(g))return Ea(b,g,$x);var m=b.name||"\x3cunnamed flow\x3e";g=function(){var I=arguments,W=++oC,ia=hf(m+" - runid: "+W+" - init",b).apply(this,I),ua,La=void 0;I=new Promise(function(Va,$a){function lb(Vb){La=void 0;try{var tc=
hf(m+" - runid: "+W+" - yield "+ec++,ia.next).call(ia,Vb)}catch(oc){return $a(oc)}Rb(tc)}function ub(Vb){La=void 0;try{var tc=hf(m+" - runid: "+W+" - yield "+ec++,ia["throw"]).call(ia,Vb)}catch(oc){return $a(oc)}Rb(tc)}function Rb(Vb){if(ma(null==Vb?void 0:Vb.then))Vb.then(Rb,$a);else{if(Vb.done)return Va(Vb.value);La=Promise.resolve(Vb.value);return La.then(lb,ub)}}var ec=0;ua=$a;lb(void 0)});I.cancel=hf(m+" - runid: "+W+" - cancel",function(){try{if(La){var Va=La;ma(Va.cancel)&&Va.cancel()}var $a=
ia["return"](void 0),lb=Promise.resolve($a.value);lb.then(cg,cg);ma(lb.cancel)&&lb.cancel();ua(new Sb)}catch(ub){ua(ub)}});return I};g.isMobXFlow=!0;return g},$x);ss.bound=Ua(mC);var kC={has:function(b,g){return b[Zg].has_(g)},get:function(b,g){return b[Zg].get_(g)},set:function(b,g,m){var I;return Y(g)?null!=(I=b[Zg].set_(g,m,!0))?I:!0:!1},deleteProperty:function(b,g){var m;return Y(g)?null!=(m=b[Zg].delete_(g,!0))?m:!0:!1},defineProperty:function(b,g,m){var I;return null!=(I=b[Zg].defineProperty_(g,
m))?I:!0},ownKeys:function(b){return b[Zg].ownKeys_()},preventExtensions:function(b){n(13)}},Qo="update",lC={get:function(b,g){var m=b[Zg];return g===Zg?m:"length"===g?m.getArrayLength_():"string"!==typeof g||isNaN(g)?F(Gt,g)?Gt[g]:b[g]:m.get_(parseInt(g))},set:function(b,g,m){var I=b[Zg];"length"===g&&I.setArrayLength_(m);"symbol"===typeof g||isNaN(g)?b[g]=m:I.set_(parseInt(g),m);return!0},preventExtensions:function(){n(15)}},nv=function(){function b(m,I,W,ia){void 0===m&&(m="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_=W;this.legacyMode_=ia;this.atom_=new qo(m);this.enhancer_=function(ua,La){return I(ua,La,"ObservableArray[..]")}}var g=b.prototype;g.dehanceValue_=function(m){return void 0!==this.dehancer?this.dehancer(m):m};g.dehanceValues_=function(m){return void 0!==this.dehancer&&0<m.length?m.map(this.dehancer):m};g.intercept_=function(m){return pd(this,
m)};g.observe_=function(m,I){void 0===I&&(I=!1);I&&m({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 Wf(this,m)};g.getArrayLength_=function(){this.atom_.reportObserved();return this.values_.length};g.setArrayLength_=function(m){("number"!==typeof m||isNaN(m)||0>m)&&n("Out of range: "+m);var I=this.values_.length;if(m!==I)if(m>I){for(var W=Array(m-I),ia=0;ia<
m-I;ia++)W[ia]=void 0;this.spliceWithArray_(I,0,W)}else this.spliceWithArray_(m,I-m)};g.updateArrayLength_=function(m,I){m!==this.lastKnownLength_&&n(16);this.lastKnownLength_+=I;this.legacyMode_&&0<I&&qe(m+I+1)};g.spliceWithArray_=function(m,I,W){var ia=this,ua=this.values_.length;void 0===m?m=0:m>ua?m=ua:0>m&&(m=Math.max(0,ua+m));I=1===arguments.length?ua-m:void 0===I||null===I?0:Math.max(0,Math.min(I,ua-m));void 0===W&&(W=pq);if(ce(this)){var La=mc(this,{object:this.proxy_,type:"splice",index:m,
removedCount:I,added:W});if(!La)return pq;I=La.removedCount;W=La.added}W=0===W.length?W:W.map(function(Va){return ia.enhancer_(Va,void 0)});this.legacyMode_&&this.updateArrayLength_(ua,W.length-I);ua=this.spliceItemsIntoValues_(m,I,W);0===I&&0===W.length||this.notifyArraySplice_(m,W,ua);return this.dehanceValues_(ua)};g.spliceItemsIntoValues_=function(m,I,W){if(1E4>W.length){var ia;return(ia=this.values_).splice.apply(ia,[m,I].concat(W))}ia=this.values_.slice(m,m+I);var ua=this.values_.slice(m+I);
this.values_.length+=W.length-I;for(I=0;I<W.length;I++)this.values_[m+I]=W[I];for(I=0;I<ua.length;I++)this.values_[m+W.length+I]=ua[I];return ia};g.notifyArrayChildUpdate_=function(m,I,W){var ia=!this.owned_&&!1,ua=Ne(this);m=ua||ia?{observableKind:"array",object:this.proxy_,type:Qo,debugObjectName:this.atom_.name_,index:m,newValue:I,oldValue:W}:null;this.atom_.reportChanged();ua&&cf(this,m)};g.notifyArraySplice_=function(m,I,W){var ia=!this.owned_&&!1,ua=Ne(this);m=ua||ia?{observableKind:"array",
object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:m,removed:W,added:I,removedCount:W.length,addedCount:I.length}:null;this.atom_.reportChanged();ua&&cf(this,m)};g.get_=function(m){if(this.legacyMode_&&m>=this.values_.length)console.warn("[mobx] Out of bounds read: "+m);else return this.atom_.reportObserved(),this.dehanceValue_(this.values_[m])};g.set_=function(m,I){var W=this.values_;this.legacyMode_&&m>W.length&&n(17,m,W.length);if(m<W.length){var ia=W[m];if(ce(this)){I=mc(this,
{type:Qo,object:this.proxy_,index:m,newValue:I});if(!I)return;I=I.newValue}I=this.enhancer_(I,ia);I!==ia&&(W[m]=I,this.notifyArrayChildUpdate_(m,I,ia))}else{m=Array(m+1-W.length);for(ia=0;ia<m.length-1;ia++)m[ia]=void 0;m[m.length-1]=I;this.spliceWithArray_(W.length,0,m)}};return b}(),Gt={clear:function(){return this.splice(0)},replace:function(b){var g=this[Zg];return g.spliceWithArray_(0,g.values_.length,b)},toJSON:function(){return this.slice()},splice:function(b,g){for(var m=arguments.length,
I=Array(2<m?m-2:0),W=2;W<m;W++)I[W-2]=arguments[W];m=this[Zg];switch(arguments.length){case 0:return[];case 1:return m.spliceWithArray_(b);case 2:return m.spliceWithArray_(b,g)}return m.spliceWithArray_(b,g,I)},spliceWithArray:function(b,g,m){return this[Zg].spliceWithArray_(b,g,m)},push:function(){for(var b=this[Zg],g=arguments.length,m=Array(g),I=0;I<g;I++)m[I]=arguments[I];b.spliceWithArray_(b.values_.length,0,m);return b.values_.length},pop:function(){return this.splice(Math.max(this[Zg].values_.length-
1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var b=this[Zg],g=arguments.length,m=Array(g),I=0;I<g;I++)m[I]=arguments[I];b.spliceWithArray_(0,0,m);return b.values_.length},reverse:function(){Fe.trackingDerivation&&n(37,"reverse");this.replace(this.slice().reverse());return this},sort:function(){Fe.trackingDerivation&&n(37,"sort");var b=this.slice();b.sort.apply(b,arguments);this.replace(b);return this},remove:function(b){var g=this[Zg];b=g.dehanceValues_(g.values_).indexOf(b);
return-1<b?(this.splice(b,1),!0):!1}};Db("concat",db);Db("flat",db);Db("includes",db);Db("indexOf",db);Db("join",db);Db("lastIndexOf",db);Db("slice",db);Db("toString",db);Db("toLocaleString",db);Db("every",Eb);Db("filter",Eb);Db("find",Eb);Db("findIndex",Eb);Db("flatMap",Eb);Db("forEach",Eb);Db("map",Eb);Db("some",Eb);Db("reduce",hc);Db("reduceRight",hc);var qC=D("ObservableArrayAdministration",nv),rC={};var sC=Symbol.iterator;var tC=Symbol.toStringTag;var by=function(){function b(m,I,W){var ia=this;
void 0===I&&(I=Ma);void 0===W&&(W="ObservableMap");this.name_=this.enhancer_=void 0;this[Zg]=rC;this.dehancer=this.changeListeners_=this.interceptors_=this.keysAtom_=this.hasMap_=this.data_=void 0;this.enhancer_=I;this.name_=W;ma(Map)||n(18);this.keysAtom_=Za("ObservableMap.keys()");this.data_=new Map;this.hasMap_=new Map;Gb(!0,function(){ia.merge(m)})}var g=b.prototype;g.has_=function(m){return this.data_.has(m)};g.has=function(m){var I=this;if(!Fe.trackingDerivation)return this.has_(m);var W=this.hasMap_.get(m);
if(!W){var ia=W=new gb(this.has_(m),fb,"ObservableMap.key?",!1);this.hasMap_.set(m,ia);vc(ia,function(){return I.hasMap_["delete"](m)})}return W.get()};g.set=function(m,I){var W=this.has_(m);if(ce(this)){I=mc(this,{type:W?Qo:"add",object:this,newValue:I,name:m});if(!I)return this;I=I.newValue}W?this.updateValue_(m,I):this.addValue_(m,I);return this};g["delete"]=function(m){var I=this;if(ce(this)&&!mc(this,{type:"delete",object:this,name:m}))return!1;if(this.has_(m)){var W=Ne(this),ia=W?{observableKind:"map",
debugObjectName:this.name_,type:"delete",object:this,oldValue:this.data_.get(m).value_,name:m}:null;Kd(function(){var ua;I.keysAtom_.reportChanged();null==(ua=I.hasMap_.get(m))?void 0:ua.setNewValue_(!1);I.data_.get(m).setNewValue_(void 0);I.data_["delete"](m)});W&&cf(this,ia);return!0}return!1};g.updateValue_=function(m,I){var W=this.data_.get(m);I=W.prepareNewValue_(I);if(I!==Fe.UNCHANGED){var ia=Ne(this);m=ia?{observableKind:"map",debugObjectName:this.name_,type:Qo,object:this,oldValue:W.value_,
name:m,newValue:I}:null;W.setNewValue_(I);ia&&cf(this,m)}};g.addValue_=function(m,I){var W=this;Kd(function(){var La,Va=new gb(I,W.enhancer_,"ObservableMap.key",!1);W.data_.set(m,Va);I=Va.value_;null==(La=W.hasMap_.get(m))?void 0:La.setNewValue_(!0);W.keysAtom_.reportChanged()});var ia=Ne(this),ua=ia?{observableKind:"map",debugObjectName:this.name_,type:"add",object:this,name:m,newValue:I}:null;ia&&cf(this,ua)};g.get=function(m){return this.has(m)?this.dehanceValue_(this.data_.get(m).get()):this.dehanceValue_(void 0)};
g.dehanceValue_=function(m){return void 0!==this.dehancer?this.dehancer(m):m};g.keys=function(){this.keysAtom_.reportObserved();return this.data_.keys()};g.values=function(){var m=this,I=this.keys();return cb({next:function(){var W=I.next(),ia=W.done;W=W.value;return{done:ia,value:ia?void 0:m.get(W)}}})};g.entries=function(){var m=this,I=this.keys();return cb({next:function(){var W=I.next(),ia=W.done;W=W.value;return{done:ia,value:ia?void 0:[W,m.get(W)]}}})};g[sC]=function(){return this.entries()};
g.forEach=function(m,I){for(var W=Ha(this),ia;!(ia=W()).done;)ia=ia.value,m.call(I,ia[1],ia[0],this)};g.merge=function(m){var I=this;Ip(m)&&(m=new Map(m));Kd(function(){H(m)?ba(m).forEach(function(W){return I.set(W,m[W])}):Array.isArray(m)?m.forEach(function(W){return I.set(W[0],W[1])}):O(m)?(m.constructor!==Map&&n(19,m),m.forEach(function(W,ia){return I.set(ia,W)})):null!==m&&void 0!==m&&n(20,m)});return this};g.clear=function(){var m=this;Kd(function(){Ld(function(){for(var I=Ha(m.keys()),W;!(W=
I()).done;)m["delete"](W.value)})})};g.replace=function(m){var I=this;Kd(function(){for(var W=gd(m),ia=new Map,ua=!1,La=Ha(I.data_.keys()),Va;!(Va=La()).done;)if(Va=Va.value,!W.has(Va))if(I["delete"](Va))ua=!0;else{var $a=I.data_.get(Va);ia.set(Va,$a)}for(W=Ha(W.entries());!(La=W()).done;)Va=La.value,La=Va[0],$a=Va[1],Va=I.data_.has(La),I.set(La,$a),I.data_.has(La)&&($a=I.data_.get(La),ia.set(La,$a),Va||(ua=!0));if(!ua)if(I.data_.size!==ia.size)I.keysAtom_.reportChanged();else for(ua=I.data_.keys(),
W=ia.keys(),La=ua.next(),Va=W.next();!La.done;){if(La.value!==Va.value){I.keysAtom_.reportChanged();break}La=ua.next();Va=W.next()}I.data_=ia});return this};g.toString=function(){return"[object ObservableMap]"};g.toJSON=function(){return Array.from(this)};g.observe_=function(m,I){return Wf(this,m)};g.intercept_=function(m){return pd(this,m)};K(b,[{key:"size",get:function(){this.keysAtom_.reportObserved();return this.data_.size}},{key:tC,get:function(){return"Map"}}]);return b}(),Ip=D("ObservableMap",
by),uC={};var vC=Symbol.iterator;var wC=Symbol.toStringTag;var cy=function(){function b(m,I,W){void 0===I&&(I=Ma);void 0===W&&(W="ObservableSet");this.name_=void 0;this[Zg]=uC;this.data_=new Set;this.enhancer_=this.dehancer=this.interceptors_=this.changeListeners_=this.atom_=void 0;this.name_=W;ma(Set)||n(22);this.atom_=Za(this.name_);this.enhancer_=function(ia,ua){return I(ia,ua,W)};m&&this.replace(m)}var g=b.prototype;g.dehanceValue_=function(m){return void 0!==this.dehancer?this.dehancer(m):m};
g.clear=function(){var m=this;Kd(function(){Ld(function(){for(var I=Ha(m.data_.values()),W;!(W=I()).done;)m["delete"](W.value)})})};g.forEach=function(m,I){for(var W=Ha(this),ia;!(ia=W()).done;)ia=ia.value,m.call(I,ia,ia,this)};g.add=function(m){var I=this;if(ce(this)&&!mc(this,{type:"add",object:this,newValue:m}))return this;if(!this.has(m)){Kd(function(){I.data_.add(I.enhancer_(m,void 0));I.atom_.reportChanged()});var W=Ne(this),ia=W?{observableKind:"set",debugObjectName:this.name_,type:"add",object:this,
newValue:m}:null;W&&cf(this,ia)}return this};g["delete"]=function(m){var I=this;if(ce(this)&&!mc(this,{type:"delete",object:this,oldValue:m}))return!1;if(this.has(m)){var W=Ne(this),ia=W?{observableKind:"set",debugObjectName:this.name_,type:"delete",object:this,oldValue:m}:null;Kd(function(){I.atom_.reportChanged();I.data_["delete"](m)});W&&cf(this,ia);return!0}return!1};g.has=function(m){this.atom_.reportObserved();return this.data_.has(this.dehanceValue_(m))};g.entries=function(){var m=0,I=Array.from(this.keys()),
W=Array.from(this.values());return cb({next:function(){var ia=m;m+=1;return ia<W.length?{value:[I[ia],W[ia]],done:!1}:{done:!0}}})};g.keys=function(){return this.values()};g.values=function(){this.atom_.reportObserved();var m=this,I=0,W=Array.from(this.data_.values());return cb({next:function(){return I<W.length?{value:m.dehanceValue_(W[I++]),done:!1}:{done:!0}}})};g.replace=function(m){var I=this;Iq(m)&&(m=new Set(m));Kd(function(){Array.isArray(m)?(I.clear(),m.forEach(function(W){return I.add(W)})):
P(m)?(I.clear(),m.forEach(function(W){return I.add(W)})):null!==m&&void 0!==m&&n("Cannot initialize set from "+m)});return this};g.observe_=function(m,I){return Wf(this,m)};g.intercept_=function(m){return pd(this,m)};g.toJSON=function(){return Array.from(this)};g.toString=function(){return"[object ObservableSet]"};g[vC]=function(){return this.values()};K(b,[{key:"size",get:function(){this.atom_.reportObserved();return this.data_.size}},{key:wC,get:function(){return"Set"}}]);return b}(),Iq=D("ObservableSet",
cy),dy=Object.create(null),ey=function(){function b(m,I,W,ia){void 0===I&&(I=new Map);void 0===ia&&(ia=oq);this.pendingKeys_=this.appliedAnnotations_=this.isPlainObject_=this.proxy_=this.interceptors_=this.changeListeners_=this.keysAtom_=this.defaultAnnotation_=this.values_=this.target_=void 0;this.target_=m;this.values_=I;this.name_=W;this.defaultAnnotation_=ia;this.keysAtom_=new qo("ObservableObject.keys");this.isPlainObject_=H(this.target_)}var g=b.prototype;g.getObservablePropValue_=function(m){return this.values_.get(m).get()};
g.setObservablePropValue_=function(m,I){var W=this.values_.get(m);if(W instanceof Ic)return W.set(I),!0;if(ce(this)){I=mc(this,{type:Qo,object:this.proxy_||this.target_,name:m,newValue:I});if(!I)return null;I=I.newValue}I=W.prepareNewValue_(I);if(I!==Fe.UNCHANGED){var ia=Ne(this);m=ia?{type:Qo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:W.value_,name:m,newValue:I}:null;W.setNewValue_(I);ia&&cf(this,m)}return!0};g.get_=function(m){Fe.trackingDerivation&&
!F(this.target_,m)&&this.has_(m);return this.target_[m]};g.set_=function(m,I,W){void 0===W&&(W=!1);if(F(this.target_,m)){if(this.values_.has(m))return this.setObservablePropValue_(m,I);if(W)return Reflect.set(this.target_,m,I);this.target_[m]=I;return!0}return this.extend_(m,{value:I,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,W)};g.has_=function(m){if(!Fe.trackingDerivation)return m in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var I=this.pendingKeys_.get(m);
I||(I=new gb(m in this.target_,fb,"ObservableObject.key?",!1),this.pendingKeys_.set(m,I));return I.get()};g.make_=function(m,I){!0===I&&(I=this.defaultAnnotation_);if(!1!==I){if(!(m in this.target_)){var W;if(null!=(W=this.target_[Sl])&&W[m])return;n(1,I.annotationType_,this.name_+"."+m.toString())}for(W=this.target_;W&&W!==Un;){var ia=mo(W,m);if(ia){ia=I.make_(this,m,ia,W);if(0===ia)return;if(1===ia)break}W=Object.getPrototypeOf(W)}var ua;null==(ua=this.target_[Sl])?!0:delete ua[m]}};g.extend_=function(m,
I,W,ia){void 0===ia&&(ia=!1);!0===W&&(W=this.defaultAnnotation_);if(!1===W)return this.defineProperty_(m,I,ia);if(I=W.extend_(this,m,I,ia)){var ua;null==(ua=this.target_[Sl])?!0:delete ua[m]}return I};g.defineProperty_=function(m,I,W){void 0===W&&(W=!1);try{ld();var ia=this.delete_(m);if(!ia)return ia;if(ce(this)){var ua=mc(this,{object:this.proxy_||this.target_,name:m,type:"add",newValue:I.value});if(!ua)return null;var La=ua.newValue;I.value!==La&&(I=Z({},I,{value:La}))}if(W){if(!Reflect.defineProperty(this.target_,
m,I))return!1}else dn(this.target_,m,I);this.notifyPropertyAddition_(m,I.value)}finally{Sd()}return!0};g.defineObservableProperty_=function(m,I,W,ia){void 0===ia&&(ia=!1);try{ld();var ua=this.delete_(m);if(!ua)return ua;if(ce(this)){var La=mc(this,{object:this.proxy_||this.target_,name:m,type:"add",newValue:I});if(!La)return null;I=La.newValue}var Va=ke(m),$a={configurable:Fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:Va.get,set:Va.set};if(ia){if(!Reflect.defineProperty(this.target_,
m,$a))return!1}else dn(this.target_,m,$a);var lb=new gb(I,W,"ObservableObject.key",!1);this.values_.set(m,lb);this.notifyPropertyAddition_(m,lb.value_)}finally{Sd()}return!0};g.defineComputedProperty_=function(m,I,W){void 0===W&&(W=!1);try{ld();var ia=this.delete_(m);if(!ia)return ia;if(ce(this)&&!mc(this,{object:this.proxy_||this.target_,name:m,type:"add",newValue:void 0}))return null;I.name||(I.name="ObservableObject.key");I.context=this.proxy_||this.target_;var ua=ke(m),La={configurable:Fe.safeDescriptors?
this.isPlainObject_:!0,enumerable:!1,get:ua.get,set:ua.set};if(W){if(!Reflect.defineProperty(this.target_,m,La))return!1}else dn(this.target_,m,La);this.values_.set(m,new Ic(I));this.notifyPropertyAddition_(m,void 0)}finally{Sd()}return!0};g.delete_=function(m,I){void 0===I&&(I=!1);if(!F(this.target_,m))return!0;if(ce(this)&&!mc(this,{object:this.proxy_||this.target_,name:m,type:"remove"}))return null;try{var W,ia;ld();var ua=Ne(this),La=this.values_.get(m),Va=void 0;if(!La&&ua){var $a;Va=null==($a=
mo(this.target_,m))?void 0:$a.value}if(I){if(!Reflect.deleteProperty(this.target_,m))return!1}else delete this.target_[m];La&&(this.values_["delete"](m),La instanceof gb&&(Va=La.value_),gc(La));this.keysAtom_.reportChanged();null==(W=this.pendingKeys_)?void 0:null==(ia=W.get(m))?void 0:ia.set(m in this.target_);if(ua){var lb={type:"remove",observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:Va,name:m};ua&&cf(this,lb)}}finally{Sd()}return!0};g.observe_=function(m,
I){return Wf(this,m)};g.intercept_=function(m){return pd(this,m)};g.notifyPropertyAddition_=function(m,I){var W,ia,ua=Ne(this);ua&&(I=ua?{type:"add",observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:m,newValue:I}:null,ua&&cf(this,I));null==(W=this.pendingKeys_)?void 0:null==(ia=W.get(m))?void 0:ia.set(!0);this.keysAtom_.reportChanged()};g.ownKeys_=function(){this.keysAtom_.reportObserved();return up(this.target_)};g.keys_=function(){this.keysAtom_.reportObserved();
return Object.keys(this.target_)};return b}(),xC=D("ObservableObjectAdministration",ey),pC=Xe(0),jv=0,Xx=function(){};(function(b,g){Object.setPrototypeOf?Object.setPrototypeOf(b.prototype,g):void 0!==b.prototype.__proto__?b.prototype.__proto__=g:b.prototype=g})(Xx,Array.prototype);var kv=function(b,g,m){function I(ia,ua,La,Va){void 0===La&&(La="ObservableArray");void 0===Va&&(Va=!1);var $a=b.call(this)||this;ua=new nv(La,ua,Va,!0);ua.proxy_=pa($a);Q(pa($a),Zg,ua);ia&&ia.length&&(ua=xc(!0),$a.spliceWithArray(0,
0,ia),Fe.allowStateChanges=ua);Object.defineProperty(pa($a),"0",pC);return $a}ea(I,b);var W=I.prototype;W.concat=function(){this[Zg].atom_.reportObserved();for(var ia=arguments.length,ua=Array(ia),La=0;La<ia;La++)ua[La]=arguments[La];return Array.prototype.concat.apply(this.slice(),ua.map(function(Va){return jb(Va)?Va.slice():Va}))};W[m]=function(){var ia=this,ua=0;return cb({next:function(){return ua<ia.length?{value:ia[ua++],done:!1}:{done:!0,value:void 0}}})};K(I,[{key:"length",get:function(){return this[Zg].getArrayLength_()},
set:function(ia){this[Zg].setArrayLength_(ia)}},{key:g,get:function(){return"Array"}}]);return I}(Xx,Symbol.toStringTag,Symbol.iterator);Object.entries(Gt).forEach(function(b){var g=b[0];b=b[1];"concat"!==g&&M(kv.prototype,g,b)});qe(1E3);var Zx=Un.toString;["Symbol","Map","Set"].forEach(function(b){"undefined"===typeof R()[b]&&n("MobX requires global '"+b+"' to be available or polyfilled")});"object"===typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:uc,extras:{getDebugName:Ab},
$mobx:Zg});var rb=V(586),jm=class{constructor(b){Qa(this,"props");Qa(this,"aspectRatio");Qa(this,"type");Qa(this,"hideCloneHandles",!1);Qa(this,"hideResizeHandles",!1);Qa(this,"hideRotateHandle",!1);Qa(this,"hideContextBar",!1);Qa(this,"hideSelectionDetail",!1);Qa(this,"hideSelection",!1);Qa(this,"canChangeAspectRatio",!0);Qa(this,"canUnmount",!0);Qa(this,"canResize",[!0,!0]);Qa(this,"canScale",!0);Qa(this,"canFlip",!0);Qa(this,"canEdit",!1);Qa(this,"canBind",!1);Qa(this,"nonce");Qa(this,"bindingDistance",
4);Qa(this,"isDirty",!1);Qa(this,"lastSerialized");Qa(this,"getCenter",()=>We.getBoundsCenter(this.bounds));Qa(this,"getRotatedBounds",()=>{const {bounds:ia,props:{rotation:ua}}=this;return ua?We.getBoundsFromPoints(We.getRotatedCorners(ia,ua)):ia});Qa(this,"hitTestPoint",ia=>{var ua=this.rotatedBounds;if(!this.props.rotation)return zh.pointInBounds(ia,ua);ua=We.getRotatedCorners(ua,this.props.rotation);return zh.pointInPolygon(ia,ua)});Qa(this,"hitTestLineSegment",(ia,ua)=>{const La=We.getBoundsFromPoints([ia,
ua]),{rotatedBounds:Va,props:{rotation:$a=0}}=this;return We.boundsContain(Va,La)||$a?k(ia,ua,We.getRotatedCorners(this.bounds)).didIntersect:0<t(Va,ia,ua).length});Qa(this,"hitTestBounds",ia=>{const {rotatedBounds:ua,props:{rotation:La=0}}=this,Va=We.getRotatedCorners(this.bounds,La);return We.boundsContain(ia,ua)||0<z([ia.minX,ia.minY],[ia.width,ia.height],Va).length});Qa(this,"getExpandedBounds",()=>We.expandBounds(this.getBounds(),this.bindingDistance));Qa(this,"getBindingPoint",(ia,ua,La,Va)=>
{var $a=this.getBounds(),lb=this.getExpandedBounds();if(zh.pointInBounds(ia,lb)){var ub=C(ua,La,lb).filter(Rb=>Rb.didIntersect).map(Rb=>Rb.points[0]);if(ub.length)return La=this.getCenter(),ub=ub.sort((Rb,ec)=>Zd.dist(ec,ua)-Zd.dist(Rb,ua))[0],ub=Zd.med(ia,ub),Va?(Va=2>Zd.dist(ia,La)?La:ia,$a=0):(Va=2>Zd.distanceToLineSegment(ia,ub,La)?La:ub,$a=zh.pointInBounds(ia,$a)?this.bindingDistance:Math.max(this.bindingDistance,We.getBoundsSides($a).map(Rb=>Zd.distanceToLineSegment(Rb[1][0],Rb[1][1],ia)).sort((Rb,
ec)=>Rb-ec)[0])),lb=Zd.divV(Zd.sub(Va,[lb.minX,lb.minY]),[lb.width,lb.height]),{point:Zd.clampV(lb,0,1),distance:$a}}});Qa(this,"getSerialized",()=>Dc(Ga(te({},this.props),{type:this.type,nonce:this.nonce})));Qa(this,"getCachedSerialized",()=>{!this.isDirty&&this.lastSerialized||Kd(()=>{this.setIsDirty(!1);this.setLastSerialized(this.getSerialized())});if(this.lastSerialized)return this.lastSerialized;throw Error("Should not get here for getCachedSerialized");});Qa(this,"validateProps",ia=>ia);Qa(this,
"update",(ia,ua=!1,La=!1)=>{ua||this.isDirty||this.setIsDirty(!0);ua||La||this.incNonce();Object.assign(this.props,this.validateProps(ia));return this});Qa(this,"clone",()=>new this.constructor(this.serialized));Qa(this,"onResetBounds",ia=>this);Qa(this,"scale",[1,1]);Qa(this,"onResizeStart",ia=>{var ua;this.scale=[...(null!=(ua=this.props.scale)?ua:[1,1])];return this});Qa(this,"onResize",(ia,ua)=>{const {bounds:La,rotation:Va,scale:[$a,lb]}=ua;ia=[...this.scale];0>$a&&(ia[0]*=-1);0>lb&&(ia[1]*=
-1);this.update({point:[La.minX,La.minY],scale:ia,rotation:Va});return this});Qa(this,"onHandleChange",(ia,{id:ua,delta:La})=>{if(void 0!==ia.handles){var Va=Mq(ia.handles);Va[ua]=Ga(te({},Va[ua]),{point:Zd.add(La,ia.handles[ua].point)});var $a=We.getCommonTopLeft(Object.values(Va).map(lb=>lb.point));Object.values(Va).forEach(lb=>{lb.point=Zd.sub(lb.point,$a)});this.update({point:Zd.add(ia.point,$a),handles:Va})}});var g,m;const I=this.constructor.id,W=null!=(g=this.constructor.defaultProps)?g:{};
this.type=I;this.props=te(te({scale:[1,1]},W),b);this.nonce=null!=(m=b.nonce)?m:Date.now();pg(this)}get id(){return this.props.id}setNonce(b){this.nonce=b}incNonce(){this.nonce++}setIsDirty(b){this.isDirty=b}setLastSerialized(b){this.lastSerialized=b}get center(){return this.getCenter()}get bounds(){return this.getBounds()}get rotatedBounds(){return this.getRotatedBounds()}get serialized(){return this.getCachedSerialized()}getShapeSVGJsx(b){b=this.getBounds();const {stroke:g,strokeWidth:m,strokeType:I,
opacity:W,fill:ia,noFill:ua,borderRadius:La}=this.props;return(0,rb.jsx)("rect",{fill:ua?"none":zf(ia,"background"),stroke:zf(g,"stroke"),strokeWidth:null!=m?m:2,strokeDasharray:"dashed"===I?"8 2":void 0,fillOpacity:null!=W?W:.2,width:b.width,height:b.height,rx:La,ry:La})}};Qa(jm,"type");Lb([yg],jm.prototype,"props",2);Lb([yg],jm.prototype,"canResize",2);Lb([yg],jm.prototype,"nonce",2);Lb([yg],jm.prototype,"isDirty",2);Lb([yg],jm.prototype,"lastSerialized",2);Lb([Gg],jm.prototype,"id",1);Lb([hf],
jm.prototype,"setNonce",1);Lb([hf],jm.prototype,"incNonce",1);Lb([hf],jm.prototype,"setIsDirty",1);Lb([hf],jm.prototype,"setLastSerialized",1);Lb([Gg],jm.prototype,"center",1);Lb([Gg],jm.prototype,"bounds",1);Lb([Gg],jm.prototype,"rotatedBounds",1);Lb([Gg],jm.prototype,"serialized",1);Lb([hf],jm.prototype,"update",2);var tn=class extends jm{constructor(b={}){super(b);Qa(this,"canBind",!0);Qa(this,"getBounds",()=>{const [g,m]=this.props.point,[I,W]=this.props.size;return{minX:g,minY:m,maxX:g+I,maxY:m+
W,width:I,height:W}});Qa(this,"getRotatedBounds",()=>We.getBoundsFromPoints(We.getRotatedCorners(this.bounds,this.props.rotation)));Qa(this,"onResize",(g,m)=>{const {bounds:I,rotation:W,scale:[ia,ua]}=m;g=[...this.scale];0>ia&&(g[0]*=-1);0>ua&&(g[1]*=-1);this.update({point:[I.minX,I.minY],scale:g,rotation:W});return this.update({rotation:W,point:[I.minX,I.minY],size:[Math.max(1,I.width),Math.max(1,I.height)],scale:g})});Qa(this,"validateProps",g=>{void 0!==g.size&&(g.size[0]=Math.max(g.size[0],1),
g.size[1]=Math.max(g.size[1],1));return g});pg(this)}};Qa(tn,"id","box");Qa(tn,"defaultProps",{id:"box",type:"box",parentId:"page",point:[0,0],size:[100,100]});var lr=class extends jm{constructor(b={}){super(b);Qa(this,"getBounds",()=>{const {pointBounds:g,props:{point:m}}=this;return We.translateBounds(g,m)});Qa(this,"getRotatedBounds",()=>{const {props:{rotation:g,point:m},bounds:I,rotatedPoints:W}=this;return g?We.translateBounds(We.getBoundsFromPoints(W),m):I});Qa(this,"normalizedPoints",[]);
Qa(this,"isResizeFlippedX",!1);Qa(this,"isResizeFlippedY",!1);Qa(this,"onResizeStart",()=>{var g;const {bounds:m,props:{points:I}}=this;this.scale=[...(null!=(g=this.props.scale)?g:[1,1])];const W=[m.width,m.height];this.normalizedPoints=I.map(ia=>sd.divV(ia,W));return this});Qa(this,"onResize",(g,m)=>{const {bounds:I,scale:[W,ia]}=m,ua=[I.width,I.height];g=[...this.scale];0>W&&(g[0]*=-1);0>ia&&(g[1]*=-1);return this.update(W||ia?{point:[I.minX,I.minY],points:this.normalizedPoints.map(La=>sd.mulV(La,
ua).concat(La[2])),scale:g}:{point:[I.minX,I.minY],points:this.normalizedPoints.map(La=>sd.mulV(La,ua).concat(La[2]))})});Qa(this,"hitTestPoint",g=>{const {props:{points:m,point:I}}=this;return zh.pointNearToPolyline(sd.sub(g,I),m)});Qa(this,"hitTestLineSegment",(g,m)=>{const {bounds:I,props:{points:W,point:ia}}=this;if(zh.pointInBounds(g,I)||zh.pointInBounds(m,I)||0<t(I,g,m).length){const ua=sd.sub(g,ia),La=sd.sub(m,ia);return k(ua,La,W).didIntersect||!!W.find(Va=>5>sd.dist(ua,Va)||5>sd.dist(La,
Va))}return!1});Qa(this,"hitTestBounds",g=>{const {rotatedBounds:m,props:{points:I,point:W}}=this,ia=We.translateBounds(g,sd.neg(W));return We.boundsContain(g,m)||I.every(ua=>zh.pointInBounds(ua,ia))||We.boundsCollide(g,m)&&0<J([ia.minX,ia.minY],[ia.width,ia.height],I).length});pg(this)}get pointBounds(){const {props:{points:b}}=this;return We.getBoundsFromPoints(b)}get rotatedPoints(){const {props:{point:b,points:g,rotation:m},center:I}=this;if(!m)return g;const W=sd.sub(I,b);return g.map(ia=>sd.rotWith(ia,
W,m))}};Qa(lr,"id","draw");Qa(lr,"defaultProps",{id:"draw",type:"draw",parentId:"page",point:[0,0],points:[],isComplete:!1});Lb([Gg],lr.prototype,"pointBounds",1);Lb([Gg],lr.prototype,"rotatedPoints",1);var lv=class extends tn{constructor(b={}){super(b);Qa(this,"getBounds",()=>{const {props:{point:[g,m],size:[I,W]}}=this;return We.getRotatedEllipseBounds(g,m,I/2,W/2,0)});Qa(this,"getRotatedBounds",()=>{const {props:{point:[g,m],size:[I,W],rotation:ia}}=this;return We.getRotatedEllipseBounds(g,m,I/
2,W/2,ia)});Qa(this,"hitTestPoint",g=>{const {props:{size:m,rotation:I},center:W}=this;return zh.pointInEllipse(g,W,m[0],m[1],I||0)});Qa(this,"hitTestLineSegment",(g,m)=>{const {props:{size:[I,W],rotation:ia=0},center:ua}=this;return v(g,m,ua,I,W,ia).didIntersect});Qa(this,"hitTestBounds",g=>{const {props:{size:[m,I],rotation:W=0},rotatedBounds:ia}=this;var ua;if(!(ua=We.boundsContain(g,ia))){const {minX:La,minY:Va,width:$a,height:lb}=g;ua=0<u(this.center,m/2,I/2,W,[La,Va],[$a,lb]).length}return ua});
pg(this)}};Qa(lv,"id","ellipse");Qa(lv,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100]});var mv=class extends tn{constructor(b={}){super(b);Qa(this,"onResetBounds",g=>{const {clipping:m,size:I,point:W}=this.props;if(m){const [ia,ua,La,Va]=Array.isArray(m)?m:[m,m,m,m];return this.update({clipping:0,point:[W[0]-Va,W[1]-ia],size:[I[0]+(Va-ua),I[1]+(ia-La)]})}if(g.asset){const {size:[ia,ua]}=g.asset;this.update({clipping:0,point:[W[0]+I[0]/2-ia/2,W[1]+I[1]/2-ua/
2],size:[ia,ua]})}return this});Qa(this,"onResize",(g,m)=>{const {bounds:I,clip:W,scale:ia}=m;({clipping:m}=this.props);const {clipping:ua}=g;if(W){const {point:[La,Va],size:[$a,lb]}=g,[ub,Rb,ec,Vb]=ua?Array.isArray(ua)?ua:[ua,ua,ua,ua]:[0,0,0,0];m=[ub+(I.minY-Va),Rb+(I.maxX-(La+$a)),ec+(I.maxY-(Va+lb)),Vb+(I.minX-La)]}else void 0!==ua&&(m=Array.isArray(ua)?ua:[ua,ua,ua,ua],m=[m[0]*ia[1],m[1]*ia[0],m[2]*ia[1],m[3]*ia[0]]);if(m&&Array.isArray(m)){const La=m;La.every((Va,$a)=>0===$a||Va===La[$a-1])&&
(m=La[0])}return this.update({point:[I.minX,I.minY],size:[Math.max(1,I.width),Math.max(1,I.height)],clipping:m})});pg(this)}};Qa(mv,"id","ellipse");Qa(mv,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100],clipping:0,objectFit:"none",assetId:""});var Yx=class extends jm{constructor(b={}){super(b);Qa(this,"getBounds",()=>{const {points:g,props:{point:m}}=this;return We.translateBounds(We.getBoundsFromPoints(g),m)});Qa(this,"getRotatedBounds",()=>{const {rotatedPoints:g,
props:{point:m}}=this;return We.translateBounds(We.getBoundsFromPoints(g),m)});Qa(this,"normalizedHandles",[]);Qa(this,"onResizeStart",()=>{var g;const {props:{handles:m},bounds:I}=this;this.scale=[...(null!=(g=this.props.scale)?g:[1,1])];const W=[I.width,I.height];this.normalizedHandles=Object.values(m).map(ia=>sd.divV(ia.point,W));return this});Qa(this,"onResize",(g,m)=>{const {bounds:I,scale:[W,ia]}=m,{props:{handles:ua},normalizedHandles:La}=this,Va=[I.width,I.height];g=[...this.scale];0>W&&(g[0]*=
-1);0>ia&&(g[1]*=-1);return this.update({point:[I.minX,I.minY],handles:Object.values(ua).map(($a,lb)=>Ga(te({},$a),{point:sd.mulV(La[lb],Va)})),scale:g})});Qa(this,"hitTestPoint",g=>{const {points:m}=this;return zh.pointNearToPolyline(sd.sub(g,this.props.point),m)});Qa(this,"hitTestLineSegment",(g,m)=>{const {bounds:I,points:W,props:{point:ia}}=this;if(zh.pointInBounds(g,I)||zh.pointInBounds(m,I)||0<t(I,g,m).length){const ua=sd.sub(g,ia),La=sd.sub(m,ia);return k(ua,La,W).didIntersect||!!W.find(Va=>
5>sd.dist(ua,Va)||5>sd.dist(La,Va))}return!1});Qa(this,"hitTestBounds",g=>{const {rotatedBounds:m,points:I,props:{point:W}}=this,ia=We.translateBounds(g,sd.neg(W));return We.boundsContain(g,m)||I.every(ua=>zh.pointInBounds(ua,ia))||We.boundsCollide(g,m)&&0<J([ia.minX,ia.minY],[ia.width,ia.height],I).length});Qa(this,"validateProps",g=>{g.point&&(g.point=[0,0]);void 0!==g.handles&&1>Object.values(g.handles).length&&(g.handles=Yx.defaultProps.handles);return g});pg(this)}get points(){return Object.values(this.props.handles).map(b=>
b.point)}get centroid(){const {points:b}=this;return Uj.getPolygonCentroid(b)}get rotatedPoints(){const {centroid:b,props:{handles:g,rotation:m}}=this;return m?Object.values(g).map(I=>sd.rotWith(I.point,b,m)):this.points}},mr=Yx;Qa(mr,"id","polyline");Qa(mr,"defaultProps",{id:"polyline",type:"polyline",parentId:"page",point:[0,0],handles:{}});Lb([Gg],mr.prototype,"points",1);Lb([Gg],mr.prototype,"centroid",1);Lb([Gg],mr.prototype,"rotatedPoints",1);var ay=class extends mr{constructor(b={}){super(b);
Qa(this,"hideResizeHandles",!0);Qa(this,"hideRotateHandle",!0);Qa(this,"validateProps",g=>{g.point&&(g.point=[0,0]);void 0!==g.handles&&1>Object.values(g.handles).length&&(g.handles=ay.defaultProps.handles);return g});Qa(this,"getHandlesChange",(g,m)=>{var I=yi(g.handles,m);I=yi(I,{start:{point:Zd.toFixed(I.start.point)},end:{point:Zd.toFixed(I.end.point)}});if(!Zd.isEqual(I.start.point,I.end.point)){m={point:g.point,handles:Mq(I)};g=g.point;I=We.translateBounds(We.getBoundsFromPoints(Object.values(I).map(ia=>
ia.point)),m.point);var W=Zd.sub([I.minX,I.minY],g);Zd.isEqual(W,[0,0])||(Object.values(m.handles).forEach(ia=>{ia.point=Zd.toFixed(Zd.sub(ia.point,W))}),m.point=Zd.toFixed(Zd.add(m.point,W)));return m}});pg(this)}},us=ay;Qa(us,"id","line");Qa(us,"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 yp=class extends tn{constructor(b={}){super(b);Qa(this,"getRotatedBounds",()=>{const {rotatedVertices:g,
props:{point:m},offset:I}=this;return We.translateBounds(We.getBoundsFromPoints(g),sd.add(m,I))});Qa(this,"hitTestPoint",g=>{const {vertices:m}=this;return zh.pointInPolygon(sd.add(g,this.props.point),m)});Qa(this,"hitTestLineSegment",(g,m)=>{const {vertices:I,props:{point:W}}=this;return k(sd.sub(g,W),sd.sub(m,W),I).didIntersect});Qa(this,"hitTestBounds",g=>{const {rotatedBounds:m,offset:I,rotatedVertices:W,props:{point:ia}}=this,ua=We.translateBounds(g,sd.neg(sd.add(ia,I)));return We.boundsContain(g,
m)||W.every(La=>zh.pointInBounds(La,ua))||0<z([ua.minX,ua.minY],[ua.width,ua.height],W).length});Qa(this,"validateProps",g=>{g.point&&(g.point=[0,0]);void 0!==g.sides&&3>g.sides&&(g.sides=3);return g});pg(this)}get vertices(){return this.getVertices()}get pageVertices(){const {props:{point:b},vertices:g}=this;return g.map(m=>sd.add(m,b))}get centroid(){const {vertices:b}=this;return Uj.getPolygonCentroid(b)}get rotatedVertices(){const {vertices:b,centroid:g,props:{rotation:m}}=this;return m?b.map(I=>
sd.rotWith(I,g,m)):b}get offset(){const {props:{size:[b,g]}}=this,m=We.getBoundsCenter(We.getBoundsFromPoints(this.vertices));return sd.sub(sd.div([b,g],2),m)}getVertices(b=0){const {ratio:g,sides:m,size:I}=this.props;return 3===m?Uj.getTriangleVertices(I,b,g):Uj.getPolygonVertices(I,m,b,g)}};Qa(yp,"id","polygon");Qa(yp,"defaultProps",{id:"polygon",type:"polygon",parentId:"page",point:[0,0],size:[100,100],sides:5,ratio:1,isFlippedY:!1});Lb([Gg],yp.prototype,"vertices",1);Lb([Gg],yp.prototype,"pageVertices",
1);Lb([Gg],yp.prototype,"centroid",1);Lb([Gg],yp.prototype,"rotatedVertices",1);Lb([Gg],yp.prototype,"offset",1);var iv=class extends tn{constructor(b={}){super(b);Qa(this,"canEdit",!0);Qa(this,"canFlip",!1);pg(this)}};Qa(iv,"id","text");Qa(iv,"defaultProps",{id:"text",type:"text",parentId:"page",isSizeLocked:!0,point:[0,0],size:[16,32],text:""});var Dt=class extends tn{constructor(b={}){super(b);Qa(this,"canEdit",!1);Qa(this,"canFlip",!1);Qa(this,"getBounds",()=>We.getCommonBounds(this.shapes.map(g=>
g.getBounds())));pg(this);this.canResize=[!1,!1]}getShapes(){throw Error("will be implemented other places");}get shapes(){return this.getShapes()}};Qa(Dt,"id","group");Qa(Dt,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});Lb([Gg],Dt.prototype,"shapes",1);var nr=class{constructor(){Qa(this,"_id");Qa(this,"_initial");Qa(this,"_states");Qa(this,"_isActive",!1);Qa(this,"cursor");Qa(this,"_disposables",[]);Qa(this,"children",new Map([]));Qa(this,"registerStates",
m=>{m.forEach(I=>this.children.set(I.id,new I(this,this)));return this});Qa(this,"deregisterStates",m=>{m.forEach(I=>{var W;null==(W=this.children.get(I.id))?void 0:W.dispose();this.children.delete(I.id)});return this});Qa(this,"currentState",{});Qa(this,"transition",(m,I={})=>{if(0===this.children.size)throw Error(`Tool ${this.id} has no states, cannot transition to ${m}.`);const W=this.children.get(m),ia=this.currentState;if(!W)throw Error(`Could not find a state named ${m}.`);Kd(()=>{this.currentState?
(ia._events.onExit(Ga(te({},I),{toId:m})),ia.dispose(),W.registerKeyboardShortcuts(),this.setCurrentState(W),this._events.onTransition(Ga(te({},I),{fromId:ia.id,toId:m})),W._events.onEnter(Ga(te({},I),{fromId:ia.id}))):(this.currentState=W,W._events.onEnter(Ga(te({},I),{fromId:""})))});return this});Qa(this,"isIn",m=>{m=m.split(".").reverse();let I=this;for(;0<m.length;){const W=m.pop();if(!W)return!0;if(I.currentState.id===W){if(0===m.length)return!0;I=I.currentState}else break}return!1});Qa(this,
"isInAny",(...m)=>m.some(this.isIn));Qa(this,"forwardEvent",(m,...I)=>{var W,ia;(null==(ia=null==(W=this.currentState)?void 0:W._events)?0:ia[m])&&Kd(()=>{var ua;return null==(ua=this.currentState._events)?void 0:ua[m](...I)})});Qa(this,"_events",{onTransition:m=>{var I;null==(I=this.onTransition)?void 0:I.call(this,m)},onEnter:m=>{var I;this._isActive=!0;this.initial&&this.transition(this.initial,m);null==(I=this.onEnter)?void 0:I.call(this,m)},onExit:m=>{var I,W,ia;this._isActive=!1;null==(W=null==
(I=this.currentState)?void 0:I.onExit)?void 0:W.call(I,{toId:"parent"});null==(ia=this.onExit)?void 0:ia.call(this,m)},onPointerDown:(m,I)=>{var W;null==(W=this.onPointerDown)?void 0:W.call(this,m,I);this.forwardEvent("onPointerDown",m,I)},onPointerUp:(m,I)=>{var W;null==(W=this.onPointerUp)?void 0:W.call(this,m,I);this.forwardEvent("onPointerUp",m,I)},onPointerMove:(m,I)=>{var W;null==(W=this.onPointerMove)?void 0:W.call(this,m,I);this.forwardEvent("onPointerMove",m,I)},onPointerEnter:(m,I)=>{var W;
null==(W=this.onPointerEnter)?void 0:W.call(this,m,I);this.forwardEvent("onPointerEnter",m,I)},onPointerLeave:(m,I)=>{var W;null==(W=this.onPointerLeave)?void 0:W.call(this,m,I);this.forwardEvent("onPointerLeave",m,I)},onDoubleClick:(m,I)=>{var W;null==(W=this.onDoubleClick)?void 0:W.call(this,m,I);this.forwardEvent("onDoubleClick",m,I)},onKeyDown:(m,I)=>{var W;this._events.onModifierKey(m,I);null==(W=this.onKeyDown)?void 0:W.call(this,m,I);this.forwardEvent("onKeyDown",m,I)},onKeyUp:(m,I)=>{var W;
this._events.onModifierKey(m,I);null==(W=this.onKeyUp)?void 0:W.call(this,m,I);this.forwardEvent("onKeyUp",m,I)},onPinchStart:(m,I)=>{var W;null==(W=this.onPinchStart)?void 0:W.call(this,m,I);this.forwardEvent("onPinchStart",m,I)},onPinch:(m,I)=>{var W;null==(W=this.onPinch)?void 0:W.call(this,m,I);this.forwardEvent("onPinch",m,I)},onPinchEnd:(m,I)=>{var W;null==(W=this.onPinchEnd)?void 0:W.call(this,m,I);this.forwardEvent("onPinchEnd",m,I)},onModifierKey:(m,I)=>{switch(I.key){case "Shift":case "Alt":case "Ctrl":case "Meta":this._events.onPointerMove(m,
I)}}});Qa(this,"onEnter");Qa(this,"onExit");Qa(this,"onTransition");Qa(this,"onPointerDown");Qa(this,"onPointerUp");Qa(this,"onPointerMove");Qa(this,"onPointerEnter");Qa(this,"onPointerLeave");Qa(this,"onDoubleClick");Qa(this,"onKeyDown");Qa(this,"onKeyUp");Qa(this,"onPinchStart");Qa(this,"onPinch");Qa(this,"onPinchEnd");const b=this.constructor.initial,g=this.constructor.states;this._id=this.constructor.id;this._initial=b;this._states=g}dispose(){this._disposables.forEach(b=>b());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(b=>[b,...b.descendants])}setCurrentState(b){this.currentState=b}};Qa(nr,"id");Qa(nr,"shortcuts");Lb([yg],nr.prototype,"currentState",2);Lb([hf],nr.prototype,"setCurrentState",1);var hv=class extends nr{constructor(b,g){var m,I;super();Qa(this,"registerKeyboardShortcuts",
()=>{var W;null!=(W=this._shortcuts)&&W.length&&this._disposables.push(...this._shortcuts.map(({keys:ia,fn:ua})=>vp.registerShortcut(ia,La=>{this.isActive&&ua(this.root,this,La)})))});Qa(this,"_root");Qa(this,"_parent");Qa(this,"_shortcuts",[]);Qa(this,"children",new Map([]));Qa(this,"registerStates",W=>{W.forEach(ia=>this.children.set(ia.id,new ia(this,this._root)));return this});Qa(this,"deregisterStates",W=>{W.forEach(ia=>{var ua;null==(ua=this.children.get(ia.id))?void 0:ua.dispose();this.children.delete(ia.id)});
return this});this._parent=b;this._root=g;this.states&&0<this.states.length&&(this.registerStates(this.states),b=null!=(m=this.initial)?m:this.states[0].id,m=this.children.get(b))&&(this.setCurrentState(m),null==(I=this.currentState)?void 0:I._events.onEnter({fromId:"initial"}));this._shortcuts=this.constructor.shortcuts;pg(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]}};Qa(hv,"cursor");var xp=class extends hv{constructor(){super(...arguments);Qa(this,"isLocked",!1);Qa(this,"previous");Qa(this,"onEnter",({fromId:b})=>{this.previous=b;this.cursor&&this.app.cursors.setCursor(this.cursor)});Qa(this,"onTransition",b=>{({toId:b}=b);b=this.children.get(b);this.app.cursors.reset();b.cursor?this.app.cursors.setCursor(b.cursor):this.cursor&&this.app.cursors.setCursor(this.cursor)})}get app(){return this.root}},vi=class extends hv{get app(){return this.root}get tool(){return this.parent}},
Ux=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","crosshair");Qa(this,"creatingShape");Qa(this,"aspectRatio");Qa(this,"initialBounds",{});Qa(this,"onEnter",()=>{const {currentPage:b,inputs:{originPoint:g,currentPoint:m}}=this.app;var {Shape:I}=this.tool;I=new I({id:Of(),type:I.id,parentId:b.id,point:[...g],fill:this.app.settings.color,stroke:this.app.settings.color,size:Zd.abs(Zd.sub(m,g))});this.initialBounds={minX:g[0],minY:g[1],maxX:g[0]+1,maxY:g[1]+1,width:1,height:1};I.canChangeAspectRatio||
(I.aspectRatio?(this.aspectRatio=I.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=I;this.app.currentPage.addShapes(I);this.app.setSelectedShapes([I])});Qa(this,"onPointerMove",b=>{if(!b.order){if(!this.creatingShape)throw Error("Expected a creating shape.");({initialBounds:b}=this);var {currentPoint:g,originPoint:m,shiftKey:I}=
this.app.inputs;b=We.getTransformedBoundingBox(b,"bottom_right_corner",Zd.sub(g,m),0,I||this.creatingShape.props.isAspectRatioLocked||!this.creatingShape.canChangeAspectRatio);this.creatingShape.update({point:[b.minX,b.minY],size:[b.width,b.height]})}});Qa(this,"onPointerUp",()=>{this.tool.transition("idle");this.creatingShape&&this.app.setSelectedShapes([this.creatingShape]);this.app.transition("select");this.app.persist()});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":if(!this.creatingShape)throw Error("Expected a creating shape.");
this.app.deleteShapes([this.creatingShape]);this.tool.transition("idle")}})}};Qa(Ux,"id","creating");var Vx=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("pointing")});Qa(this,"onPinchStart",(...b)=>{var g,m;this.app.transition("select",{returnTo:this.app.currentState.id});null==(m=(g=this.app._events).onPinchStart)?void 0:m.call(g,...b)});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}})}};Qa(Vx,
"id","idle");var Wx=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))});Qa(this,"onPointerUp",()=>{this.tool.transition("idle")})}};Qa(Wx,"id","pointing");var bp=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","crosshair")}};Qa(bp,"id","box");Qa(bp,"states",[Vx,Wx,Ux]);Qa(bp,"initial","idle");
var Ax=class extends vi{constructor(){super(...arguments);Qa(this,"shape",{});Qa(this,"points",[[0,0,.5]]);Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onEnter",()=>{var b;const {Shape:g,previousShape:m}=this.tool;var {originPoint:I}=this.app.inputs;this.app.history.pause();if(this.app.inputs.shiftKey&&m){this.shape=m;var {shape:W}=this;var ia=W.props.points[W.props.points.length-1];const La=sd.sub(I,W.props.point).concat(null!=(b=I[2])?b:.5);this.points=
[...W.props.points,ia,ia];const Va=Math.ceil(sd.dist(ia,I)/16);for(let $a=0,lb=$a/(Va-1);$a<Va;$a++){b=this.points;I=b.push;W=sd.lrp(ia,La,lb);var ua=ia[2];I.call(b,W.concat.call(W,ua+(La[2]-ua)*lb))}this.addNextPoint(La)}else this.tool.previousShape=void 0,this.points=[[0,0,null!=(ia=I[2])?ia:.5]],this.shape=new g({id:Of(),type:g.id,parentId:this.app.currentPage.id,point:I.slice(0,2),points:this.points,isComplete:!1,fill:this.app.settings.color,stroke:this.app.settings.color}),this.app.currentPage.addShapes(this.shape)});
Qa(this,"onPointerMove",()=>{const {shape:b}=this,{currentPoint:g,previousPoint:m}=this.app.inputs;sd.isEqual(m,g)||this.addNextPoint(sd.sub(g,b.props.point).concat(g[2]))});Qa(this,"onPointerUp",()=>{if(!this.shape)throw Error("Expected a creating shape.");this.app.history.resume();this.shape.update({isComplete:!0,points:this.tool.simplify?zh.simplify2(this.points,this.tool.simplifyTolerance):this.shape.props.points});this.tool.previousShape=this.shape;this.tool.transition("idle");this.app.persist()});
Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":if(!this.shape)throw Error("Expected a creating shape.");this.app.deleteShapes([this.shape]);this.tool.transition("idle")}})}addNextPoint(b){const {shape:g}=this,m=sd.min(b,[0,0]);this.points.push(b);0>m[0]||0>m[1]?(this.points=this.points.map(I=>sd.sub(I,m).concat(I[2])),g.update({point:sd.add(g.props.point,m),points:this.points})):g.update({points:this.points})}};Qa(Ax,"id","creating");var Bx=class extends vi{constructor(){super(...arguments);
Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("creating")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}})}};Qa(Bx,"id","idle");var Cx=class extends vi{constructor(){super(...arguments);Qa(this,"origin",[0,0]);Qa(this,"prevDelta",[0,0]);Qa(this,"onEnter",b=>{this.prevDelta=b.info.delta;this.origin=b.info.point});Qa(this,"onPinch",b=>{this.app.viewport.pinchZoom(b.point,
b.delta,b.delta[2])});Qa(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};Qa(Cx,"id","pinching");var rs=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","crosshair");Qa(this,"simplify",!0);Qa(this,"simplifyTolerance",1);Qa(this,"previousShape");Qa(this,"onPinchStart",(b,g)=>{this.transition("pinching",{info:b,event:g})})}};Qa(rs,"id","draw");Qa(rs,"states",[Bx,Ax,Cx]);Qa(rs,"initial","idle");var Dx=class extends vi{constructor(){super(...arguments);Qa(this,"points",[[0,0,
.5]]);Qa(this,"hitShapes",new Set);Qa(this,"onEnter",()=>{const {originPoint:b}=this.app.inputs;this.points=[b];this.hitShapes.clear()});Qa(this,"onPointerMove",()=>{const {currentPoint:b,previousPoint:g}=this.app.inputs;sd.isEqual(g,b)||(this.points.push(b),this.app.shapesInViewport.filter(m=>m.hitTestLineSegment(g,b)).forEach(m=>this.hitShapes.add(m)),this.app.setErasingShapes(Array.from(this.hitShapes.values())))});Qa(this,"onPointerUp",()=>{this.app.deleteShapes(Array.from(this.hitShapes.values()));
this.tool.transition("idle")});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.setErasingShapes([]),this.tool.transition("idle")}})}};Qa(Dx,"id","erasing");var Ex=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("pointing")});Qa(this,"onPinchStart",(...b)=>{var g,m;this.app.transition("select",{returnTo:this.app.currentState.id});null==(m=(g=this.app._events).onPinchStart)?void 0:m.call(g,...b)});Qa(this,"onKeyDown",
(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}})}};Qa(Ex,"id","idle");var Fx=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",()=>{const {currentPoint:b}=this.app.inputs;this.app.setErasingShapes(this.app.shapesInViewport.filter(g=>g.hitTestPoint(b)))});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&(this.tool.transition("erasing"),this.app.setSelectedShapes([]))});Qa(this,"onPointerUp",()=>{const b=[...this.app.erasingShapes];
this.app.setErasingShapes([]);this.app.deleteShapes(b);this.tool.transition("idle")})}};Qa(Fx,"id","pointing");var Ct=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","crosshair")}};Qa(Ct,"id","erase");Qa(Ct,"states",[Ex,Fx,Dx]);Qa(Ct,"initial","idle");var ev=class extends vi{constructor(){super(...arguments);Qa(this,"handle",{});Qa(this,"handleId","end");Qa(this,"currentShape",{});Qa(this,"initialShape",{});Qa(this,"bindableShapeIds",[]);Qa(this,"startBindingShapeId");Qa(this,
"newStartBindingId","");Qa(this,"draggedBindingId","");Qa(this,"onPointerMove",()=>{const {inputs:{shiftKey:b,previousPoint:g,originPoint:m,currentPoint:I,modKey:W,altKey:ia}}=this.app;var ua=this.app.getShapeById(this.initialShape.id),{handles:La}=this.initialShape,Va=this.handleId,$a="start"===this.handleId?"end":"start";if(!Zd.isEqual(g,I)){var lb=Zd.sub(I,m);if(b){var ub=La[$a].point,Rb=Zd.add(La[Va].point,lb),ec=Zd.angle(ub,Rb);ub=Zd.rotWith(Rb,ub,Si.snapAngleToSegments(ec,24)-ec);lb=Zd.add(lb,
Zd.sub(ub,Rb))}lb=Zd.add(La[Va].point,lb);La={[Va]:Ga(te({},La[Va]),{point:Zd.toFixed(lb),bindingId:void 0})};var Vb=this.currentShape.getHandlesChange(this.initialShape,La);if(Vb){La=yi(ua.props,Vb);var tc={},oc;Va=La.handles[Va];$a=La.handles[$a];if(this.startBindingShapeId){var Xb;if(lb=this.app.getShapeById(this.startBindingShapeId)){Rb=lb.getCenter();ub=La.handles.end;var sc=Zd.add(La.handles.start.point,La.point);Zd.isEqual(sc,Rb)&&sc[1]++;ec=lb.hitTestPoint(I);sc=Zd.uni(Zd.sub(sc,Rb));const Hc=
void 0!==this.app.currentPage.bindings[this.newStartBindingId];W||lb.hitTestPoint(Zd.add(La.point,ub.point))||(Xb=Sc(ua.props,lb,"start",this.newStartBindingId,Rb,Rb,sc,ec));Xb&&!Hc?(tc[this.newStartBindingId]=Xb,La.handles.start.bindingId=Xb.id):!Xb&&Hc&&(console.log("removing start binding"),delete tc[this.newStartBindingId],La.handles.start.bindingId=void 0)}}if(!W){Xb=Zd.add($a.point,La.point);$a=Zd.add(Va.point,La.point);Va=Zd.uni(Zd.sub($a,Xb));const Hc=Zd.add(La.point,La.handles.start.point),
Rc=Zd.add(La.point,La.handles.end.point);lb=this.bindableShapeIds.map(Vc=>this.app.getShapeById(Vc)).sort((Vc,Vd)=>Vd.nonce-Vc.nonce).filter(Vc=>![Hc,Rc].every(Vd=>Vc.hitTestPoint(Vd)));for(const Vc of lb)if(oc=Sc(ua.props,Vc,this.handleId,this.draggedBindingId,$a,Xb,Va,ia))break}oc?(tc[this.draggedBindingId]=oc,La=yi(La,{handles:{[this.handleId]:{bindingId:this.draggedBindingId}}})):(ua=ua.props.handles[this.handleId].bindingId,void 0!==ua&&(delete tc[ua],La=yi(La,{handles:{[this.handleId]:{bindingId:void 0}}})));
Vb=this.currentShape.getHandlesChange(La,La.handles);Kd(()=>{var Hc;if(Vb){this.currentShape.update(Vb);this.app.currentPage.updateBindings(tc);const Rc=Object.values(null!=(Hc=Vb.handles)?Hc:{}).map(Vc=>Vc.bindingId).map(Vc=>this.app.currentPage.bindings[Vc]).filter(Boolean).flatMap(Vc=>[Vc.toId,Vc.fromId].filter(Boolean));this.app.setBindingShapes(Rc)}})}}});Qa(this,"onPointerUp",()=>{this.tool.transition("idle");this.currentShape&&this.app.setSelectedShapes([this.currentShape]);this.app.transition("select");
this.app.persist()});Qa(this,"onExit",()=>{this.app.clearBindingShape();this.app.history.resume();this.app.persist()});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.deleteShapes([this.currentShape]),this.tool.transition("idle")}})}};Qa(ev,"id","creating");var Gx=class extends ev{constructor(){super(...arguments);Qa(this,"onEnter",()=>{var b;this.app.history.pause();this.newStartBindingId=Of();this.draggedBindingId=Of();this.bindableShapeIds=this.app.currentPage.getBindableShapes();
var {Shape:g}=this.tool;const {originPoint:m}=this.app.inputs;g=new g(Ga(te({},g.defaultProps),{id:Of(),type:g.id,parentId:this.app.currentPage.id,point:m,fill:this.app.settings.color,stroke:this.app.settings.color}));this.initialShape=Dc(g.props);this.currentShape=g;this.app.currentPage.addShapes(g);this.app.setSelectedShapes([g]);if(this.startBindingShapeId=null==(b=this.bindableShapeIds.map(I=>this.app.getShapeById(I)).filter(I=>zh.pointInBounds(m,I.bounds))[0])?void 0:b.id)this.bindableShapeIds.splice(this.bindableShapeIds.indexOf(this.startBindingShapeId),
1),this.app.setBindingShapes([this.startBindingShapeId])})}};Qa(Gx,"id","creating");var Hx=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("pointing")});Qa(this,"onPinchStart",(...b)=>{var g,m;this.app.transition("select",{returnTo:this.app.currentState.id});null==(m=(g=this.app._events).onPinchStart)?void 0:m.call(g,...b)});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}});Qa(this,"onPointerEnter",
b=>{if(!b.order)switch(b.type){case "shape":this.app.setHoveredShape(b.shape.id);break;case "selection":"background"!==b.handle&&"center"!==b.handle&&this.tool.transition("hoveringSelectionHandle",b)}});Qa(this,"onPointerLeave",b=>{b.order||"shape"===b.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)})}};Qa(Hx,"id","idle");var Ix=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&(this.tool.transition("creating"),
this.app.setSelectedShapes(this.app.currentPage.shapes))})}};Qa(Ix,"id","pointing");var At=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","crosshair")}};Qa(At,"id","line");Qa(At,"states",[Hx,Ix,Gx]);Qa(At,"initial","idle");var rx=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","crosshair");Qa(this,"creatingShape");Qa(this,"aspectRatio");Qa(this,"initialBounds",{});Qa(this,"onEnter",()=>{const {currentPage:b,inputs:{originPoint:g}}=this.app,{Shape:m}=this.tool,
I=new m({id:Of(),type:m.id,parentId:b.id,point:[...g],text:"",size:[16,32],isSizeLocked:!0,fill:this.app.settings.color,stroke:this.app.settings.color});this.creatingShape=I;Kd(()=>{this.app.currentPage.addShapes(I);const {bounds:W}=I;I.update({point:Zd.sub(g,[W.width/2,W.height/2])});this.app.transition("select");this.app.setSelectedShapes([I]);this.app.currentState.transition("editingShape",{type:"shape",shape:this.creatingShape,order:0})})})}};Qa(rx,"id","creating");var sx=class extends vi{constructor(){super(...arguments);
Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("creating")});Qa(this,"onPinchStart",(...b)=>{var g,m;this.app.transition("select",{returnTo:this.app.currentState.id});null==(m=(g=this.app._events).onPinchStart)?void 0:m.call(g,...b)});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}})}};Qa(sx,"id","idle");var Bt=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","crosshair")}};Qa(Bt,"id","box");Qa(Bt,"states",[sx,rx]);Qa(Bt,"initial",
"idle");var iC=vb(Je()),jC=class extends iC.default{constructor(){super(...arguments);Qa(this,"toBBox",b=>b.rotatedBounds)}},tx=class extends vi{constructor(){super(...arguments);Qa(this,"initialSelectedIds",[]);Qa(this,"initialSelectedShapes",[]);Qa(this,"tree",new jC);Qa(this,"onEnter",()=>{const {selectedShapes:b,currentPage:g,selectedIds:m}=this.app;this.initialSelectedIds=Array.from(m.values());this.initialSelectedShapes=Array.from(b.values());this.tree.load(g.shapes)});Qa(this,"onExit",()=>
{this.initialSelectedIds=[];this.tree.clear()});Qa(this,"onPointerMove",()=>{const {inputs:{shiftKey:b,ctrlKey:g,originPoint:m,currentPoint:I}}=this.app,W=We.getBoundsFromPoints([I,m],0);this.app.setBrush(W);const ia=[...(new Set(this.tree.search(W).filter(ua=>g?We.boundsContain(W,ua.rotatedBounds):ua.hitTestBounds(W)).filter(ua=>"group"!==ua.type).map(ua=>{var La;return null!=(La=this.app.getParentGroup(ua))?La:ua})))];b?ia.every(ua=>this.initialSelectedShapes.includes(ua))?this.app.setSelectedShapes(this.initialSelectedShapes.filter(ua=>
!ia.includes(ua))):this.app.setSelectedShapes([...(new Set([...this.initialSelectedShapes,...ia]))]):this.app.setSelectedShapes(ia)});Qa(this,"onPointerUp",()=>{this.app.setBrush(void 0);this.tool.transition("idle")});Qa(this,"handleModifierKey",(b,g)=>{switch(g.key){case "Escape":this.app.setBrush(void 0),this.app.setSelectedShapes(this.initialSelectedIds),this.tool.transition("idle")}})}};Qa(tx,"id","brushing");var ux=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",b=>{var g;
const {selectedIds:m,selectedShapes:I,inputs:{shiftKey:W}}=this.app;if("shape"===b.type&&!I.has(b.shape)){const ia=null!=(g=this.app.getParentGroup(b.shape))?g:b.shape;W?this.app.setSelectedShapes([...Array.from(m.values()),ia.id]):this.app.setSelectedShapes([ia])}});Qa(this,"onPointerDown",()=>{this.tool.transition("idle")})}};Qa(ux,"id","contextMenu");var vx=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",b=>{"pinching"===b.fromId&&this.parent.returnTo&&this.app.transition(this.parent.returnTo)});
Qa(this,"onExit",()=>{});Qa(this,"onPointerEnter",b=>{if(!b.order)switch(b.type){case "shape":this.app.setHoveredShape(b.shape.id);break;case "selection":"background"!==b.handle&&"center"!==b.handle&&this.tool.transition("hoveringSelectionHandle",b);break;case "canvas":this.app.setHoveredShape(void 0)}});Qa(this,"onPointerDown",(b,g)=>{const {selectedShapes:m,inputs:{ctrlKey:I}}=this.app;if(2===g.button)this.tool.transition("contextMenu",b);else if(I)this.tool.transition("pointingCanvas");else switch(b.type){case "selection":switch(b.handle){case "center":break;
case "background":this.tool.transition("pointingBoundsBackground");break;case "rotate":this.tool.transition("pointingRotateHandle");break;default:this.tool.transition("pointingResizeHandle",b)}break;case "shape":if(m.has(b.shape))this.tool.transition("pointingSelectedShape",b);else{const {selectionBounds:W,inputs:ia}=this.app;W&&zh.pointInBounds(ia.currentPoint,W)?this.tool.transition("pointingShapeBehindBounds",b):this.tool.transition("pointingShape",b)}break;case "handle":this.tool.transition("pointingHandle",
b);break;case "canvas":this.tool.transition("pointingCanvas");break;case "minimap":this.tool.transition("pointingMinimap",te(te({},g),b))}});Qa(this,"onPointerLeave",b=>{b.order||"shape"===b.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onDoubleClick",b=>{if(!b.order&&1===this.app.selectedShapesArray.length){var g=this.app.selectedShapesArray[0];if(g.canEdit)switch(b.type){case "shape":this.tool.transition("editingShape",
b);break;case "selection":1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:g})}}});Qa(this,"onKeyDown",(b,g)=>{({selectedShapesArray:b}=this.app);switch(g.key){case "Enter":1===b.length&&b[0].canEdit&&this.tool.transition("editingShape",{type:"shape",shape:b[0],order:0});break;case "Escape":b.length&&this.app.setSelectedShapes([])}})}};Qa(vx,"id","idle");var wx=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",b=>{var g;const {selectedIds:m,
inputs:{shiftKey:I}}=this.app,W=null!=(g=this.app.getParentGroup(b.shape))?g:b.shape;I?this.app.setSelectedShapes([...Array.from(m.values()),W.id]):this.app.setSelectedShapes([W])});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("translating")});Qa(this,"onPointerUp",()=>{this.tool.transition("idle")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(wx,"id","pointingShape");var xx=class extends vi{constructor(){super(...arguments);
Qa(this,"cursor","move");Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("translating")});Qa(this,"onPointerUp",()=>{this.app.setSelectedShapes([]);this.tool.transition("idle")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(xx,"id","pointingBoundsBackground");var yx=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",()=>{var b;const {shiftKey:g}=this.app.inputs;g||(this.app.setSelectedShapes([]),
this.app.setEditingShape(),null==(b=window.getSelection())?void 0:b.removeAllRanges())});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("brushing")});Qa(this,"onPointerUp",()=>{this.app.inputs.shiftKey||this.app.setSelectedShapes([]);this.tool.transition("idle")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onDoubleClick",()=>{this.app.notify("canvas-dbclick",{point:this.app.inputs.originPoint})})}};
Qa(yx,"id","pointingCanvas");var zx=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","move");Qa(this,"isCloning",!1);Qa(this,"didClone",!1);Qa(this,"initialPoints",{});Qa(this,"initialShapePoints",{});Qa(this,"initialClonePoints",{});Qa(this,"clones",[]);Qa(this,"onEnter",()=>{var b;this.app.history.pause();const {allSelectedShapesArray:g,inputs:m}=this.app;this.initialPoints=this.initialShapePoints=Object.fromEntries(g.map(({id:I,props:{point:W}})=>[I,W.slice()]));document.querySelectorAll("input,textarea").forEach(I=>
I.blur());null==(b=document.getSelection())?void 0:b.empty();m.altKey?this.startCloning():this.moveSelectedShapesToPointer()});Qa(this,"onExit",()=>{this.app.history.resume();this.app.persist();this.isCloning=this.didClone=!1;this.clones=[];this.initialPoints={};this.initialShapePoints={};this.initialClonePoints={}});Qa(this,"onPointerMove",()=>{this.moveSelectedShapesToPointer()});Qa(this,"onPointerDown",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});Qa(this,"onPointerUp",
()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Alt":this.startCloning();break;case "Escape":this.app.allSelectedShapes.forEach(m=>{m.update({point:this.initialPoints[m.id]})}),this.tool.transition("idle")}});Qa(this,"onKeyUp",(b,g)=>{switch(g.key){case "Alt":if(!this.isCloning)throw Error("Expected to be cloning.");const {currentPage:m,allSelectedShapes:I}=this.app;m.removeShapes(...I);this.initialPoints=this.initialShapePoints;
this.app.setSelectedShapes(Object.keys(this.initialPoints));this.moveSelectedShapesToPointer();this.isCloning=!1}})}moveSelectedShapesToPointer(){const {inputs:{shiftKey:b,originPoint:g,currentPoint:m}}=this.app,{initialPoints:I}=this,W=sd.sub(m,g);b&&(Math.abs(W[0])<Math.abs(W[1])?W[0]=0:W[1]=0);Kd(()=>{this.app.allSelectedShapes.forEach(ia=>{ia.update({point:sd.add(I[ia.id],W)})})})}startCloning(){this.didClone||(this.clones=this.app.allSelectedShapesArray.map(b=>{const g=this.app.getShapeClass(b.type);
if(!g)throw Error("Could not find that shape class.");return new g(Ga(te({},b.serialized),{id:Of(),type:b.type,point:this.initialPoints[b.id],rotation:b.props.rotation}))}),this.initialClonePoints=Object.fromEntries(this.clones.map(({id:b,props:{point:g}})=>[b,g.slice()])),this.didClone=!0);this.app.allSelectedShapes.forEach(b=>{b.update({point:this.initialPoints[b.id]})});this.initialPoints=this.initialClonePoints;this.app.currentPage.addShapes(...this.clones);this.app.setSelectedShapes(Object.keys(this.initialClonePoints));
this.moveSelectedShapesToPointer();this.isCloning=!0}};Qa(zx,"id","translating");var Jx=class extends vi{constructor(){super(...arguments);Qa(this,"pointedSelectedShape");Qa(this,"onEnter",b=>{this.pointedSelectedShape=b.shape});Qa(this,"onExit",()=>{this.pointedSelectedShape=void 0});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("translating")});Qa(this,"onPointerUp",()=>{const {shiftKey:b,currentPoint:g}=this.app.inputs;var {selectedShapesArray:m}=
this.app;if(!this.pointedSelectedShape)throw Error("Expected a pointed selected shape");if(b)({selectedIds:m}=this.app),m=Array.from(m.values()),m.splice(m.indexOf(this.pointedSelectedShape.id),1),this.app.setSelectedShapes(m);else{if(1===m.length&&this.pointedSelectedShape.canEdit&&this.pointedSelectedShape instanceof tn&&zh.pointInBounds(g,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")});
Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(Jx,"id","pointingSelectedShape");var Kx=class extends vi{constructor(){super(...arguments);Qa(this,"info",{});Qa(this,"onEnter",b=>{this.info=b;this.updateCursor()});Qa(this,"onExit",()=>{this.app.cursors.reset()});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("resizing",this.info)});Qa(this,"onPointerUp",()=>{this.tool.transition("hoveringSelectionHandle",
this.info)});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}updateCursor(){this.app.cursors.setCursor(Nk[this.info.handle],this.app.selectionBounds.rotation)}};Qa(Kx,"id","pointingResizeHandle");var Lx=class extends vi{constructor(){super(...arguments);Qa(this,"isSingle",!1);Qa(this,"handle","bottom_right_corner");Qa(this,"snapshots",{});Qa(this,"initialCommonBounds",{});Qa(this,"selectionRotation",0);Qa(this,"resizeType","corner");Qa(this,"onEnter",b=>{var g,m;
const {history:I,selectedShapesArray:W,selectionBounds:ia}=this.app;if(!ia)throw Error("Expected a selected bounds.");this.handle=b.handle;this.resizeType="left_edge"===b.handle||"right_edge"===b.handle?"horizontal-edge":"top_edge"===b.handle||"bottom_edge"===b.handle?"vertical-edge":"corner";this.app.cursors.setCursor(Lx.CURSORS[b.handle],null==(g=this.app.selectionBounds)?void 0:g.rotation);I.pause();const ua=We.getBoundsFromPoints(W.map(La=>We.getBoundsCenter(La.bounds)));this.selectionRotation=
(this.isSingle=1===W.length)?null!=(m=W[0].props.rotation)?m:0:0;this.initialCommonBounds=te({},ia);this.snapshots=Object.fromEntries(W.map(La=>{const Va=te({},La.bounds),[$a,lb]=We.getBoundsCenter(Va);return[La.id,{props:La.serialized,bounds:Va,transformOrigin:[($a-this.initialCommonBounds.minX)/this.initialCommonBounds.width,(lb-this.initialCommonBounds.minY)/this.initialCommonBounds.height],innerTransformOrigin:[($a-ua.minX)/ua.width,(lb-ua.minY)/ua.height],isAspectRatioLocked:La.props.isAspectRatioLocked||
!(La.canChangeAspectRatio&&!La.props.rotation)}]}));W.forEach(La=>{var Va;null==(Va=La.onResizeStart)?void 0:Va.call(La,{isSingle:this.isSingle})})});Qa(this,"onExit",()=>{this.app.cursors.reset();this.snapshots={};this.initialCommonBounds={};this.selectionRotation=0;this.app.history.resume()});Qa(this,"onPointerMove",()=>{const {inputs:{altKey:b,shiftKey:g,ctrlKey:m,originPoint:I,currentPoint:W}}=this.app,{handle:ia,snapshots:ua,initialCommonBounds:La}=this;let Va=sd.sub(W,I);b&&(Va=sd.mul(Va,2));
const $a=this.app.selectedShapes.values().next().value;let lb=We.getTransformedBoundingBox(La,ia,Va,this.selectionRotation,g||this.isSingle&&(m?!("clipping"in $a.props):!$a.canChangeAspectRatio||$a.props.isAspectRatioLocked));b&&(lb=te(te({},lb),We.centerBounds(lb,We.getBoundsCenter(La))));const {scaleX:ub,scaleY:Rb}=lb;this.app.selectedShapes.forEach(ec=>{var Vb,tc;const {props:oc,bounds:Xb,transformOrigin:sc}=ua[ec.id];let Hc=We.getRelativeTransformedBoundingBox(lb,La,Xb,0>ub,0>Rb);if(ec.canResize.some(Vd=>
Vd)||ec.props.isSizeLocked||!this.isSingle){var Rc=[ub,Rb],Vc=null!=(Vb=oc.rotation)?Vb:0;Vb=We.getBoundsCenter(Hc);ec.canFlip||(Rc=sd.abs(Rc));ec.canScale||(Rc=null!=(tc=oc.scale)?tc:[1,1]);if(Vc&&0>ub&&0<=Rb||0>Rb&&0<=ub)Vc*=-1;ec.onResize(oc,{center:Vb,rotation:Vc,scale:Rc,bounds:Hc,type:ia,clip:m,transformOrigin:sc})}});this.updateCursor(ub,Rb)});Qa(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.selectedShapes.forEach(m=>
{m.update(te({},this.snapshots[m.id].props))}),this.tool.transition("idle")}})}updateCursor(b,g){var m,I,W,ia;const ua=0>b&&0<=g;b=0>g&&0<=b;switch(this.handle){case "top_left_corner":case "bottom_right_corner":ua||b?"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(m=this.app.selectionBounds)?void 0:m.rotation):"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==(I=this.app.selectionBounds)?void 0:I.rotation);break;case "top_right_corner":case "bottom_left_corner":ua||
b?"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==(W=this.app.selectionBounds)?void 0:W.rotation):"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(ia=this.app.selectionBounds)?void 0:ia.rotation)}}},fv=Lx;Qa(fv,"id","resizing");Qa(fv,"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 Mx=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","rotate");Qa(this,"handle","");Qa(this,"onEnter",b=>{this.app.history.pause();this.handle=b.handle;this.updateCursor()});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("rotating",{handle:this.handle})});Qa(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});Qa(this,"onPinchStart",
(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}updateCursor(){this.app.cursors.setCursor(Nk[this.handle],this.app.selectionRotation)}};Qa(Mx,"id","pointingRotateHandle");var Nx=class extends vi{constructor(){super(...arguments);Qa(this,"info",{});Qa(this,"onEnter",b=>{this.info=b});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("translating")});Qa(this,"onPointerUp",()=>{const {selectedIds:b,inputs:{shiftKey:g}}=
this.app;g?this.app.setSelectedShapes([...Array.from(b.values()),this.info.shape.id]):this.app.setSelectedShapes([this.info.shape.id]);this.tool.transition("idle")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(Nx,"id","pointingShapeBehindBounds");var gv=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","rotate");Qa(this,"snapshot",{});Qa(this,"initialCommonCenter",[0,0]);Qa(this,"initialCommonBounds",{});Qa(this,"initialAngle",0);Qa(this,
"initialSelectionRotation",0);Qa(this,"handle","");Qa(this,"onEnter",b=>{const {history:g,selectedShapesArray:m,selectionBounds:I}=this.app;if(!I)throw Error("Expected selected bounds.");g.pause();this.handle=b.handle;this.initialSelectionRotation=this.app.selectionRotation;this.initialCommonBounds=te({},I);this.initialCommonCenter=We.getBoundsCenter(I);this.initialAngle=sd.angle(this.initialCommonCenter,this.app.inputs.currentPoint);this.snapshot=Object.fromEntries(m.map(W=>[W.id,{point:[...W.props.point],
center:[...W.center],rotation:W.props.rotation,handles:"handles"in W?Mq(W.handles):void 0}]));this.updateCursor()});Qa(this,"onExit",()=>{this.app.history.resume();this.snapshot={}});Qa(this,"onPointerMove",()=>{const {selectedShapes:b,inputs:{shiftKey:g,currentPoint:m}}=this.app,{snapshot:I,initialCommonCenter:W,initialAngle:ia,initialSelectionRotation:ua}=this;let La=sd.angle(W,m)-ia;g&&(La=Si.snapAngleToSegments(La,24));b.forEach($a=>{var lb=I[$a.id];let ub=0;if(g){var {rotation:Rb=0}=lb;ub=Si.snapAngleToSegments(Rb,
24)-Rb}const ec=sd.sub(lb.center,lb.point);Rb=sd.rotWith(lb.center,W,La);if("handles"in $a){lb=lb.handles;const Vb=lb.map(oc=>sd.rotWith(oc.point,ec,La)),tc=We.getCommonTopLeft(Vb);$a.update({point:sd.add(tc,sd.sub(Rb,ec)),handles:lb.map((oc,Xb)=>Ga(te({},oc),{point:sd.sub(Vb[Xb],tc)}))})}else $a.update({point:sd.sub(Rb,ec),rotation:Si.clampRadians((lb.rotation||0)+La+ub)})});const Va=Si.clampRadians(ua+La);this.app.setSelectionRotation(g?Si.snapAngleToSegments(Va,24):Va);this.updateCursor()});Qa(this,
"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.selectedShapes.forEach(m=>{m.update(this.snapshot[m.id])}),this.tool.transition("idle")}})}updateCursor(){this.app.cursors.setCursor(Nk[this.handle],this.app.selectionRotation)}};Qa(gv,"id","rotating");var Ox=class extends vi{constructor(){super(...arguments);Qa(this,"onPinch",(b,g)=>{this.app.viewport.pinchZoom(b.point,b.delta,b.delta[2])});
Qa(this,"onPinchEnd",()=>{this.tool.transition("idle")});Qa(this,"onPointerDown",()=>{this.tool.transition("idle")})}};Qa(Ox,"id","pinching");var Px=class extends ev{constructor(){super(...arguments);Qa(this,"cursor","grabbing");Qa(this,"onEnter",b=>{this.app.history.pause();this.newStartBindingId=Of();this.draggedBindingId=Of();this.bindableShapeIds=this.app.currentPage.getBindableShapes();this.handleId=b.id;this.currentShape=b.shape;this.initialShape=Dc(this.currentShape.props);this.app.setSelectedShapes([this.currentShape])})}};
Qa(Px,"id","translatingHandle");var Qx=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","grabbing");Qa(this,"info",{});Qa(this,"onEnter",b=>{this.info=b});Qa(this,"onPointerMove",()=>{const {currentPoint:b,originPoint:g}=this.app.inputs;5<sd.dist(b,g)&&this.tool.transition("translatingHandle",this.info)});Qa(this,"onPointerUp",()=>{this.tool.transition("idle")});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(Qx,"id","pointingHandle");var Rx=
class extends vi{constructor(){super(...arguments);Qa(this,"handle");Qa(this,"onEnter",b=>{var g;this.app.cursors.setCursor(Nk[b.handle],null!=(g=this.app.selectionBounds.rotation)?g:0);this.handle=b.handle});Qa(this,"onExit",()=>{this.app.cursors.reset()});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onPointerDown",b=>{switch(b.type){case "selection":switch(b.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",
b);break;default:this.tool.transition("pointingResizeHandle",b)}}});Qa(this,"onPointerLeave",()=>{this.tool.transition("idle")});Qa(this,"onDoubleClick",b=>{var g;if(!b.order&&1===this.app.selectedShapes.size){var m=this.app.selectedShapes.values().next().value;if(m.canEdit)switch(b.type){case "shape":this.tool.transition("editingShape",b);break;case "selection":null==(g=m.onResetBounds)?void 0:g.call(m,{zoom:this.app.viewport.camera.zoom}),1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",
{type:"shape",target:m})}else m.onResetBounds({asset:m.props.assetId?this.app.assets[m.props.assetId]:void 0,zoom:this.app.viewport.camera.zoom}),this.tool.transition("idle")}})}};Qa(Rx,"id","hoveringSelectionHandle");var Sx=class extends vi{constructor(){super(...arguments);Qa(this,"editingShape",{});Qa(this,"onEnter",b=>{this.editingShape=b.shape;this.app.setEditingShape(b.shape)});Qa(this,"onExit",()=>{var b;if(this.editingShape&&"text"in this.editingShape.props){const g=this.editingShape.props.text.trim();
""===g&&"text"===this.editingShape.props.type?this.app.deleteShapes([this.editingShape]):(this.editingShape.onResetBounds(),this.editingShape.update({text:g}))}this.app.persist();this.app.setEditingShape();null==(b=document.querySelector(".tl-canvas"))?void 0:b.focus()});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})});Qa(this,"onPointerDown",b=>{switch(b.type){case "shape":if(b.shape===this.editingShape)break;this.tool.transition("idle",b);break;case "canvas":b.order||
this.tool.transition("idle",b)}});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":Kd(()=>{g.stopPropagation();this.app.setSelectedShapes([this.editingShape]);this.tool.transition("idle")})}})}};Qa(Sx,"id","editingShape");var Tx=class extends vi{constructor(){super(...arguments);Qa(this,"minimapZoom",1);Qa(this,"minimapRect",{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0});Qa(this,"getCameraPoint",b=>{const g=document.querySelector(".tl-preview-minimap svg");var m=document.querySelector(".tl-preview-minimap #minimap-camera-rect");
if(g&&m){const I=g.getBoundingClientRect();this.minimapRect.height=I.height;this.minimapRect.width=I.width;this.minimapRect.minX=I.left;this.minimapRect.minY=I.top;this.minimapRect.maxX=I.right;this.minimapRect.maxY=I.bottom;this.minimapZoom=+g.dataset.commonBoundWidth/this.minimapRect.width;b=sd.sub(b,[this.minimapRect.minX,this.minimapRect.minY]);m=m.getBoundingClientRect();m=sd.mul(sd.sub(b,[m.left+m.width/2,m.top+m.height/2]),this.minimapZoom);return sd.sub(this.app.viewport.camera.point,m)}});
Qa(this,"onEnter",b=>{(b=this.getCameraPoint([b.clientX,b.clientY]))?this.app.viewport.update({point:b}):this.tool.transition("idle")});Qa(this,"onPointerMove",(b,g)=>{(b=this.getCameraPoint([g.clientX,g.clientY]))&&this.app.viewport.update({point:b})});Qa(this,"onPointerUp",()=>{this.tool.transition("idle")})}};Qa(Tx,"id","pointingMinimap");var ir=class extends xp{constructor(){super(...arguments);Qa(this,"returnTo","");Qa(this,"onEnter",b=>{this.returnTo=null==b?void 0:b.returnTo})}};Qa(ir,"id",
"select");Qa(ir,"initial","idle");Qa(ir,"shortcut",["1","s"]);Qa(ir,"states",[vx,tx,ux,yx,wx,Nx,Jx,xx,Rx,Kx,Mx,Tx,Qx,Px,zx,fv,gv,gv,Ox,Sx]);var nx=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","grabbing");Qa(this,"originalScreenPoint",[]);Qa(this,"originalCameraPoint",[]);Qa(this,"prevState","idle");Qa(this,"onEnter",b=>{this.prevState=null==b?void 0:b.prevState;this.originalScreenPoint=this.app.inputs.currentScreenPoint;this.originalCameraPoint=this.app.viewport.camera.point});
Qa(this,"onPointerMove",(b,g)=>{b=Zd.sub(this.originalScreenPoint,this.app.inputs.currentScreenPoint);this.app.viewport.update({point:Zd.sub(this.originalCameraPoint,Zd.div(b,this.app.viewport.camera.zoom))})});Qa(this,"onPointerUp",()=>{var b;this.tool.transition(null!=(b=this.prevState)?b:"idle")})}};Qa(nx,"id","panning");var ox=class extends vi{constructor(){super(...arguments);Qa(this,"onEnter",b=>{this.parent.prevTool&&b.exit&&(this.app.setCurrentState(this.parent.prevTool),setTimeout(()=>{this.app.cursors.reset();
this.app.cursors.setCursor(this.parent.prevTool.cursor)}))});Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("panning")})}};Qa(ox,"id","idle");var px=class extends vi{constructor(){super(...arguments);Qa(this,"onPointerDown",(b,g)=>{b.order||this.tool.transition("panning",{prevState:"idleHold"})});Qa(this,"onPinchStart",(b,g)=>{this.tool.transition("pinching",{info:b,event:g})})}};Qa(px,"id","idleHold");var qx=class extends vi{constructor(){super(...arguments);Qa(this,"origin",[0,0]);
Qa(this,"prevDelta",[0,0]);Qa(this,"onEnter",b=>{this.prevDelta=b.info.delta;this.origin=b.info.point});Qa(this,"onPinch",b=>{this.app.viewport.pinchZoom(b.point,b.delta,b.delta[2])});Qa(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};Qa(qx,"id","pinching");var jr=class extends xp{constructor(){super(...arguments);Qa(this,"cursor","grab");Qa(this,"prevTool",null);Qa(this,"onEnter",b=>{this.prevTool=null==b?void 0:b.prevTool});Qa(this,"onKeyDown",(b,g)=>{switch(g.key){case "Escape":this.app.transition("select")}});
Qa(this,"onPinchStart",(b,g)=>{this.transition("pinching",{info:b,event:g})})}};Qa(jr,"id","move");Qa(jr,"shortcut",["2","m"]);Qa(jr,"states",[ox,px,nx,qx]);Qa(jr,"initial","idle");var im=class{constructor(b,g={}){Qa(this,"lastShapesNounces",null);Qa(this,"app");Qa(this,"id");Qa(this,"name");Qa(this,"shapes",[]);Qa(this,"bindings",{});Qa(this,"nonce",0);Qa(this,"bump",()=>{this.nonce++});Qa(this,"bringForward",La=>{const Va=this.parseShapesArg(La);Va.sort(($a,lb)=>this.shapes.indexOf(lb)-this.shapes.indexOf($a)).map($a=>
this.shapes.indexOf($a)).forEach($a=>{if($a!==this.shapes.length-1&&!Va.includes(this.shapes[$a+1])){var lb=this.shapes[$a];this.shapes[$a]=this.shapes[$a+1];this.shapes[$a+1]=lb}});this.app.persist();return this});Qa(this,"sendBackward",La=>{const Va=this.parseShapesArg(La);Va.sort(($a,lb)=>this.shapes.indexOf($a)-this.shapes.indexOf(lb)).map($a=>this.shapes.indexOf($a)).forEach($a=>{if(0!==$a&&!Va.includes(this.shapes[$a-1])){var lb=this.shapes[$a];this.shapes[$a]=this.shapes[$a-1];this.shapes[$a-
1]=lb}});this.app.persist();return this});Qa(this,"bringToFront",La=>{const Va=this.parseShapesArg(La);this.shapes=this.shapes.filter($a=>!Va.includes($a)).concat(Va);this.app.persist();return this});Qa(this,"sendToBack",La=>{const Va=this.parseShapesArg(La);this.shapes=Va.concat(this.shapes.filter($a=>!Va.includes($a)));this.app.persist();return this});Qa(this,"flip",(La,Va)=>{La=this.parseShapesArg(La);const $a=We.getCommonBounds(La.map(lb=>lb.bounds));La.forEach(lb=>{var ub;const Rb=We.getRelativeTransformedBoundingBox($a,
$a,lb.bounds,"horizontal"===Va,"vertical"===Va);if(lb.serialized)lb.onResize(lb.serialized,{bounds:Rb,center:We.getBoundsCenter(Rb),rotation:null!=(ub=lb.props.rotation)?ub:-0,type:"top_left_corner",scale:lb.canFlip&&lb.props.scale?"horizontal"===Va?[-lb.props.scale[0],1]:[1,-lb.props.scale[1]]:[1,1],clip:!1,transformOrigin:[.5,.5]})});this.app.persist();return this});Qa(this,"getShapeById",La=>this.shapes.find(Va=>Va.id===La));Qa(this,"cleanup",La=>{La=lc(this.bindings,La);const Va=new Set;let $a=
!1,lb=!1;const ub=Mq(this.bindings);La.forEach(Rb=>{var ec;if(this.bindings[Rb.id]){var Vb=this.getShapeById(Rb.toId),tc=this.getShapeById(Rb.fromId);Vb&&tc?Va.has(tc.id)||(Rb=this.updateArrowBindings(tc),Va.add(tc.id),Rb&&(tc=te(te({},tc.props),Rb),$a=!0,null==(ec=this.getShapeById(tc.id))?void 0:ec.update(tc,!1,!0))):(delete ub[Rb.id],lb=!0)}});Object.keys(ub).forEach(Rb=>{const ec=this.bindings[Rb];0===this.shapes.filter(Vb=>Vb.id===ec.fromId||Vb.id===ec.toId).length&&(delete ub[Rb],lb=!0)});lb&&
this.update({bindings:ub});($a||lb)&&this.app.persist(!0)});Qa(this,"updateArrowBindings",La=>{var Va,$a,lb,ub={start:Mq(La.props.handles.start),end:Mq(La.props.handles.end)},Rb={isBound:!1,handle:La.props.handles.start,point:Zd.add(La.props.handles.start.point,La.props.point)},ec={isBound:!1,handle:La.props.handles.end,point:Zd.add(La.props.handles.end.point,La.props.point)};if(La.props.handles.start.bindingId){var Vb=void 0!==(null==(Va=La.props.decorations)?void 0:Va.start);Va=La.props.handles.start;
var tc=this.bindings[La.props.handles.start.bindingId],oc=this.getShapeById(null==tc?void 0:tc.toId);if(oc){Rb=oc.getBounds();var Xb=oc.getExpandedBounds(),sc=We.expandBounds(Rb,Vb?tc.distance:1);const {minX:Hc,minY:Rc,width:Vc,height:Vd}=Xb,ae=Zd.add([Hc,Rc],Zd.mulV([Vc,Vd],Zd.rotWith(tc.point,[.5,.5],oc.props.rotation||0)));Rb={isBound:!0,hasDecoration:Vb,binding:tc,handle:Va,point:ae,target:oc,bounds:Rb,expandedBounds:Xb,intersectBounds:sc,center:oc.getCenter()}}}if(La.props.handles.end.bindingId&&
(Vb=void 0!==(null==($a=La.props.decorations)?void 0:$a.end),$a=La.props.handles.end,Va=this.bindings[La.props.handles.end.bindingId],tc=this.getShapeById(null==Va?void 0:Va.toId))){ec=tc.getBounds();oc=tc.getExpandedBounds();Xb=Vb?We.expandBounds(ec,Va.distance):ec;const {minX:Hc,minY:Rc,width:Vc,height:Vd}=oc;sc=Zd.add([Hc,Rc],Zd.mulV([Vc,Vd],Zd.rotWith(Va.point,[.5,.5],tc.props.rotation||0)));ec={isBound:!0,hasDecoration:Vb,binding:Va,handle:$a,point:sc,target:tc,bounds:ec,expandedBounds:oc,intersectBounds:Xb,
center:tc.getCenter()}}for(const Hc of["end","start"]){$a="start"===Hc?Rb:ec;const Rc="start"===Hc?ec:Rb;if($a.isBound)if($a.binding.distance){if(Vb=Zd.uni(Zd.sub($a.point,Rc.point)),Va=C(Rc.point,Vb,$a.intersectBounds,$a.target.props.rotation).filter(Vc=>Vc.didIntersect).map(Vc=>Vc.points[0]).sort((Vc,Vd)=>Zd.dist(Vc,Rc.point)-Zd.dist(Vd,Rc.point)),Va[0])if(tc=void 0,Rc.isBound&&(tc=C(Rc.point,Vb,Rc.intersectBounds,Rc.target.props.rotation).filter(Vc=>Vc.didIntersect).map(Vc=>Vc.points[0]).sort((Vc,
Vd)=>Zd.dist(Vc,Rc.point)-Zd.dist(Vd,Rc.point))[0]),Rc.isBound&&(2>Va.length||tc&&Va[0]&&10>Math.ceil(Zd.dist(Va[0],tc))||We.boundsContain($a.expandedBounds,Rc.expandedBounds)||We.boundsCollide($a.expandedBounds,Rc.expandedBounds)))Vb=Zd.uni(Zd.sub(Rc.point,$a.point)),Va=C($a.point,Vb,$a.bounds,$a.target.props.rotation).filter(Vc=>Vc.didIntersect).map(Vc=>Vc.points[0]),Va[0]&&(ub[Hc].point=Zd.toFixed(Zd.sub(Va[0],La.props.point)),ub["start"===Hc?"end":"start"].point=Zd.toFixed(Zd.add(Zd.sub(Va[0],
La.props.point),Zd.mul(Vb,Math.min(Zd.dist(Va[0],Rc.point),10*(We.boundsContain(Rc.bounds,$a.intersectBounds)?-1:1))))));else{if(!Rc.isBound&&(Va[0]&&10>Zd.dist(Va[0],Rc.point)||zh.pointInBounds(Rc.point,$a.intersectBounds)))return ub=Zd.uni(Zd.sub($a.center,Rc.point)),null==(lb=La.getHandlesChange)?void 0:lb.call(La,La.props,{[Hc]:Ga(te({},La.props.handles[Hc]),{point:Zd.toFixed(Zd.add(Zd.sub(Rc.point,La.props.point),Zd.mul(ub,10)))})});Va[0]&&(ub[Hc].point=Zd.toFixed(Zd.sub(Va[0],La.props.point)))}}else ub[Hc].point=
Zd.sub($a.point,La.props.point)}return La.getHandlesChange(La.props,ub)});const {id:m,name:I,shapes:W=[],bindings:ia={},nonce:ua}=g;this.id=m;this.name=I;this.bindings=Object.assign({},ia);this.app=b;this.nonce=ua||0;this.addShapes(...W);pg(this);Od(()=>{const La=0<this.shapes.length?Object.fromEntries(this.shapes.map(Va=>[Va.id,Va.nonce])):null;if(this.lastShapesNounces&&La){const Va=this.lastShapesNounces,$a=[...(new Set([...Object.keys(La),...Object.keys(Va)]))].filter(lb=>Va[lb]!==La[lb]);requestAnimationFrame(()=>
{this.cleanup($a)})}La&&(this.lastShapesNounces=La)})}get serialized(){return{id:this.id,name:this.name,shapes:this.shapes.map(b=>b.serialized).filter(b=>!!b).map(b=>Dc(b)),bindings:Mq(this.bindings),nonce:this.nonce}}get shapesById(){return Object.fromEntries(this.shapes.map(b=>[b.id,b]))}update(b){Object.assign(this,b);return this}updateBindings(b){Object.assign(this.bindings,b);return this}addShapes(...b){if(0!==b.length)return b="getBounds"in b[0]?b:b.map(g=>new (this.app.getShapeClass(g.type))(g)),
this.shapes.push(...b),this.bump(),b}parseShapesArg(b){return"string"===typeof b[0]?this.shapes.filter(g=>b.includes(g.id)):b}removeShapes(...b){const g=this.parseShapesArg(b);this.shapes=this.shapes.filter(m=>!g.includes(m));return g}getBindableShapes(){return this.shapes.filter(b=>b.canBind).sort((b,g)=>g.nonce-b.nonce).map(b=>b.id)}};Lb([yg],im.prototype,"id",2);Lb([yg],im.prototype,"name",2);Lb([yg],im.prototype,"shapes",2);Lb([yg],im.prototype,"bindings",2);Lb([Gg],im.prototype,"serialized",
1);Lb([Gg],im.prototype,"shapesById",1);Lb([yg],im.prototype,"nonce",2);Lb([hf],im.prototype,"bump",2);Lb([hf],im.prototype,"update",1);Lb([hf],im.prototype,"updateBindings",1);Lb([hf],im.prototype,"addShapes",1);Lb([hf],im.prototype,"removeShapes",1);Lb([hf],im.prototype,"bringForward",2);Lb([hf],im.prototype,"sendBackward",2);Lb([hf],im.prototype,"bringToFront",2);Lb([hf],im.prototype,"sendToBack",2);Lb([hf],im.prototype,"cleanup",2);var Ek=class{constructor(){Qa(this,"shiftKey",!1);Qa(this,"ctrlKey",
!1);Qa(this,"modKey",!1);Qa(this,"altKey",!1);Qa(this,"spaceKey",!1);Qa(this,"isPinching",!1);Qa(this,"currentScreenPoint",[0,0]);Qa(this,"currentPoint",[0,0]);Qa(this,"previousScreenPoint",[0,0]);Qa(this,"previousPoint",[0,0]);Qa(this,"originScreenPoint",[0,0]);Qa(this,"originPoint",[0,0]);Qa(this,"pointerIds",new Set);Qa(this,"state","idle");Qa(this,"containerOffset",[0,0]);Qa(this,"onPointerDown",(b,g)=>{this.pointerIds.add(g.pointerId);this.updateModifiers(g);this.originScreenPoint=this.currentScreenPoint;
this.originPoint=b;this.state="pointing"});Qa(this,"onPointerMove",(b,g)=>{"pinching"!==this.state&&("panning"===this.state&&(this.state="idle"),this.updateModifiers(g),this.previousPoint=this.currentPoint,this.currentPoint=b)});Qa(this,"onPointerUp",(b,g)=>{this.pointerIds.clear();this.updateModifiers(g);this.state="idle"});Qa(this,"onKeyDown",b=>{this.updateModifiers(b);switch(b.key){case " ":this.spaceKey=!0}});Qa(this,"onKeyUp",b=>{this.updateModifiers(b);switch(b.key){case " ":this.spaceKey=
!1}});Qa(this,"onPinchStart",(b,g)=>{this.updateModifiers(g);this.state="pinching"});Qa(this,"onPinch",(b,g)=>{"pinching"===this.state&&this.updateModifiers(g)});Qa(this,"onPinchEnd",(b,g)=>{"pinching"===this.state&&(this.updateModifiers(g),this.state="idle")});pg(this)}updateContainerOffset(b){Object.assign(this.containerOffset,b)}updateModifiers(b){b.isPrimary&&("clientX"in b&&(this.previousScreenPoint=this.currentScreenPoint,this.currentScreenPoint=Zd.sub([b.clientX,b.clientY],this.containerOffset)),
"shiftKey"in b&&(this.shiftKey=b.shiftKey,this.ctrlKey=b.ctrlKey,this.altKey=b.altKey,this.modKey=xk()?b.metaKey:b.ctrlKey))}};Lb([yg],Ek.prototype,"shiftKey",2);Lb([yg],Ek.prototype,"ctrlKey",2);Lb([yg],Ek.prototype,"modKey",2);Lb([yg],Ek.prototype,"altKey",2);Lb([yg],Ek.prototype,"spaceKey",2);Lb([yg],Ek.prototype,"isPinching",2);Lb([yg],Ek.prototype,"currentScreenPoint",2);Lb([yg],Ek.prototype,"currentPoint",2);Lb([yg],Ek.prototype,"previousScreenPoint",2);Lb([yg],Ek.prototype,"previousPoint",
2);Lb([yg],Ek.prototype,"originScreenPoint",2);Lb([yg],Ek.prototype,"originPoint",2);Lb([yg],Ek.prototype,"state",2);Lb([yg],Ek.prototype,"containerOffset",2);Lb([hf],Ek.prototype,"updateContainerOffset",1);Lb([hf],Ek.prototype,"updateModifiers",1);Lb([hf],Ek.prototype,"onPointerDown",2);Lb([hf],Ek.prototype,"onPointerMove",2);Lb([hf],Ek.prototype,"onPointerUp",2);Lb([hf],Ek.prototype,"onKeyDown",2);Lb([hf],Ek.prototype,"onKeyUp",2);Lb([hf],Ek.prototype,"onPinchStart",2);Lb([hf],Ek.prototype,"onPinch",
2);Lb([hf],Ek.prototype,"onPinchEnd",2);var gC=(b,g=100)=>-(Math.cos(Math.PI*sd.clamp(b/g,0,1))-1)/2,zt=class{constructor(){Qa(this,"bounds",{minX:0,minY:0,maxX:1080,maxY:720,width:1080,height:720});Qa(this,"camera",{point:[0,0],zoom:1});Qa(this,"updateBounds",b=>{this.bounds=b;return this});Qa(this,"panCamera",b=>this.update({point:sd.sub(this.camera.point,sd.div(b,this.camera.zoom))}));Qa(this,"update",({point:b,zoom:g})=>{void 0!==b&&(this.camera.point=b);void 0!==g&&(this.camera.zoom=g);return this});
Qa(this,"getPagePoint",b=>{const {camera:g,bounds:m}=this;return sd.sub(sd.div(sd.sub(b,[m.minX,m.minY]),g.zoom),g.point)});Qa(this,"getScreenPoint",b=>{const {camera:g}=this;return sd.mul(sd.add(b,g.point),g.zoom)});Qa(this,"onZoom",(b,g,m=!1)=>this.pinchZoom(b,[0,0],g,m));Qa(this,"pinchZoom",(b,g,m,I=!1)=>{var {camera:W}=this;g=sd.sub(W.point,sd.div(g,W.zoom));m=sd.clamp(m,zt.minZoom,zt.maxZoom);W=sd.div(b,W.zoom);b=sd.div(b,m);b=sd.toFixed(sd.add(g,sd.sub(b,W)));I?this.animateCamera({point:b,zoom:m}):
this.update({point:b,zoom:m});return this});Qa(this,"setZoom",(b,g=!1)=>{const {bounds:m}=this;this.onZoom([m.width/2,m.height/2],b,g)});Qa(this,"zoomIn",()=>{const {camera:b}=this;this.setZoom(b.zoom/.8,!0)});Qa(this,"zoomOut",()=>{const {camera:b}=this;this.setZoom(.8*b.zoom,!0)});Qa(this,"resetZoom",()=>{this.setZoom(1,!0);return this});Qa(this,"animateCamera",({point:b,zoom:g})=>this.animateToViewport({minX:-b[0],minY:-b[1],maxX:this.bounds.width/g-b[0],maxY:this.bounds.height/g-b[1],width:this.bounds.width/
g,height:this.bounds.height/g}));Qa(this,"animateToViewport",b=>{const g=performance.now(),m=te({},this.currentView),I=()=>{var W=performance.now()-g;W=gC(W);var ia=m.minX+(b.minX-m.minX)*W;this.update({point:[-ia,-(m.minY+(b.minY-m.minY)*W)],zoom:this.bounds.width/(m.maxX+(b.maxX-m.maxX)*W-ia)});1>W&&requestAnimationFrame(I)};I()});Qa(this,"zoomToBounds",({width:b,height:g,minX:m,minY:I})=>{const {bounds:W,camera:ia}=this;let ua=Math.min((W.width-100)/b,(W.height-100)/g);ua=Math.min(1,Math.max(zt.minZoom,
ia.zoom===ua||1>ia.zoom?Math.min(1,ua):ua));b=sd.add([-m,-I],[(W.width-b*ua)/2/ua,(W.height-g*ua)/2/ua]);this.animateCamera({point:b,zoom:ua})});pg(this)}get currentView(){const {bounds:b,camera:{point:g,zoom:m}}=this,I=b.width/m,W=b.height/m;return{minX:-g[0],minY:-g[1],maxX:I-g[0],maxY:W-g[1],width:I,height:W}}},Po=zt;Qa(Po,"minZoom",.1);Qa(Po,"maxZoom",4);Lb([yg],Po.prototype,"bounds",2);Lb([yg],Po.prototype,"camera",2);Lb([hf],Po.prototype,"updateBounds",2);Lb([hf],Po.prototype,"update",2);Lb([Gg],
Po.prototype,"currentView",1);var hC=class{constructor(b){Qa(this,"app");Qa(this,"editShape",g=>{this.app.transition("select").selectedTool.transition("editingShape",{shape:g});return this});Qa(this,"hoverShape",g=>{this.app.setHoveredShape(g);return this});Qa(this,"createShapes",(...g)=>{this.app.createShapes(g);return this});Qa(this,"updateShapes",(...g)=>{this.app.updateShapes(g);return this});Qa(this,"deleteShapes",(...g)=>{this.app.deleteShapes(g.length?g:this.app.selectedShapesArray);return this});
Qa(this,"selectShapes",(...g)=>{this.app.setSelectedShapes(g);return this});Qa(this,"deselectShapes",(...g)=>{const m="string"===typeof g[0]?g:g.map(I=>I.id);this.app.setSelectedShapes(this.app.selectedShapesArray.filter(I=>!m.includes(I.id)));return this});Qa(this,"flipHorizontal",(...g)=>{this.app.flipHorizontal(g);return this});Qa(this,"flipVertical",(...g)=>{this.app.flipVertical(g);return this});Qa(this,"selectAll",()=>{this.app.setSelectedShapes(this.app.currentPage.shapes.filter(g=>!this.app.shapesInGroups().includes(g)));
return this});Qa(this,"deselectAll",()=>{this.app.setSelectedShapes([]);return this});Qa(this,"zoomIn",()=>{this.app.viewport.zoomIn();return this});Qa(this,"zoomOut",()=>{this.app.viewport.zoomOut();return this});Qa(this,"resetZoom",()=>{this.app.viewport.resetZoom();return this});Qa(this,"zoomToFit",()=>{var {shapes:g}=this.app.currentPage;if(0===g.length)return this;g=We.getCommonBounds(g.map(m=>m.bounds));this.app.viewport.zoomToBounds(g);return this});Qa(this,"cameraToCenter",()=>{var {shapes:g}=
this.app.currentPage;if(0===g.length)return this;g=We.getCommonBounds(g.map(m=>m.bounds));this.app.viewport.update({point:Zd.add(Zd.neg(We.getBoundsCenter(g)),[this.app.viewport.currentView.width/2,this.app.viewport.currentView.height/2])});return this});Qa(this,"zoomToSelection",()=>{const {selectionBounds:g}=this.app;if(!g)return this;this.app.viewport.zoomToBounds(g);return this});Qa(this,"resetZoomToCursor",()=>{this.app.viewport.animateCamera({zoom:1,point:Zd.sub(this.app.inputs.originScreenPoint,
this.app.inputs.originPoint)});return this});Qa(this,"toggleGrid",()=>{const {settings:g}=this.app;g.update({showGrid:!g.showGrid});return this});Qa(this,"setColor",g=>{const {settings:m}=this.app;m.update({color:g});this.app.selectedShapesArray.forEach(I=>{I.update({fill:g,stroke:g})});this.app.persist();return this});Qa(this,"save",()=>{this.app.save();return this});Qa(this,"saveAs",()=>{this.app.save();return this});Qa(this,"undo",()=>{this.app.undo();return this});Qa(this,"redo",()=>{this.app.redo();
return this});Qa(this,"createNewLineBinding",(g,m)=>this.app.createNewLineBinding(g,m));Qa(this,"cloneShapes",({shapes:g,assets:m,bindings:I,point:W=[0,0]})=>{const ia=We.getCommonBounds(g.filter(Va=>"group"!==Va.type).map(Va=>{var $a,lb,ub,Rb,ec,Vb,tc,oc,Xb,sc,Hc,Rc,Vc,Vd,ae,De;return{minX:null!=(lb=null==($a=Va.point)?void 0:$a[0])?lb:W[0],minY:null!=(Rb=null==(ub=Va.point)?void 0:ub[1])?Rb:W[1],width:null!=(Vb=null==(ec=Va.size)?void 0:ec[0])?Vb:4,height:null!=(oc=null==(tc=Va.size)?void 0:tc[1])?
oc:4,maxX:(null!=(sc=null==(Xb=Va.point)?void 0:Xb[0])?sc:W[0])+(null!=(Rc=null==(Hc=Va.size)?void 0:Hc[0])?Rc:4),maxY:(null!=(Vd=null==(Vc=Va.point)?void 0:Vc[1])?Vd:W[1])+(null!=(De=null==(ae=Va.size)?void 0:ae[1])?De:4)}})),ua=g.map(Va=>Ga(te({},Va),{id:Of(),point:[W[0]+Va.point[0]-ia.minX,W[1]+Va.point[1]-ia.minY]}));ua.forEach(Va=>{var $a;Va.children&&0<(null==($a=Va.children)?void 0:$a.length)&&(Va.children=Va.children.map(lb=>{var ub;return null==(ub=ua[g.findIndex(Rb=>Rb.id===lb)])?void 0:
ub.id}).filter(Kg))});const La=[];ua.flatMap(Va=>{var $a;return Object.values(null!=($a=Va.handles)?$a:{})}).forEach(Va=>{if(Va.bindingId){var $a=I[Va.bindingId];if($a){var lb=g.findIndex(Rb=>Rb.id===$a.fromId);const ub=g.findIndex(Rb=>Rb.id===$a.toId);$a&&-1!==lb&&-1!==ub?(lb=Ga(te({},$a),{id:Of(),fromId:ua[lb].id,toId:ua[ub].id}),La.push(lb),Va.bindingId=lb.id):Va.bindingId=void 0}else console.warn("binding not found",Va.bindingId)}});m=m.filter(Va=>ua.some($a=>$a.assetId===Va.id));return{shapes:ua,
assets:m,bindings:La}});Qa(this,"getClonedShapesFromTldrString",(g,m)=>{try{{var I;const $a=null==(I=g.match(/<whiteboard-tldr>(.*)<\/whiteboard-tldr>/))?void 0:I[1];if($a){try{var W=JSON.parse($a)}catch(lb){W=null}var ia=W}else ia=void 0}g=ia;if(!g)return null;const {shapes:ua,bindings:La,assets:Va}=g;return this.cloneShapes({shapes:ua,bindings:La,assets:Va,point:m})}catch(ua){console.log(ua)}return null});Qa(this,"cloneShapesIntoCurrentPage",g=>{(g=this.cloneShapes(g))&&this.addClonedShapes(g);
return this});Qa(this,"addClonedShapes",g=>{const {shapes:m,assets:I,bindings:W}=g;0<I.length&&this.app.createAssets(I);0<m.length&&this.app.createShapes(m);this.app.currentPage.updateBindings(Object.fromEntries(W.map(ia=>[ia.id,ia])));this.app.selectedTool.transition("idle");return this});Qa(this,"addClonedShapesFromTldrString",(g,m)=>{(g=this.getClonedShapesFromTldrString(g,m))&&this.addClonedShapes(g);return this});Qa(this,"doGroup",(g=this.app.allSelectedShapesArray)=>{var m=[...g.filter(I=>"group"===
I.type),...g.map(I=>this.app.getParentGroup(I))].filter(Kg);this.app.currentPage.removeShapes(...m);g=g.filter(I=>"group"!==I.type);1<g.length&&(m=this.app.getShapeClass("group"),m=new m({id:Of(),type:m.id,parentId:this.app.currentPage.id,children:g.map(I=>I.id)}),this.app.currentPage.addShapes(m),this.app.setSelectedShapes([m]),this.app.bringForward(g));this.app.persist()});Qa(this,"unGroup",(g=this.app.allSelectedShapesArray)=>{g=[...g.filter(I=>"group"===I.type),...g.map(I=>this.app.getParentGroup(I))].filter(Kg);
const m=this.app.shapesInGroups(g);0<g.length&&(this.app.currentPage.removeShapes(...g),this.app.persist(),this.app.setSelectedShapes(m))});this.app=b}},kr=class{constructor(){Qa(this,"cursor","default");Qa(this,"rotation",0);Qa(this,"reset",()=>{this.cursor="default"});Qa(this,"setCursor",(b,g=0)=>{if(b!==this.cursor||g!==this.rotation)this.cursor=b,this.rotation=g});Qa(this,"setRotation",b=>{b!==this.rotation&&(this.rotation=b)});pg(this)}};Lb([yg],kr.prototype,"cursor",2);Lb([yg],kr.prototype,
"rotation",2);Lb([hf],kr.prototype,"reset",2);Lb([hf],kr.prototype,"setCursor",2);Lb([hf],kr.prototype,"setRotation",2);var cC=(b,g)=>{b=wk(b.pages[0],"nonce");g=wk(g.pages[0],"nonce");return!(0,ly.default)(b,g)},so=class{constructor(b){Qa(this,"app");Qa(this,"stack",[]);Qa(this,"pointer",0);Qa(this,"isPaused",!0);Qa(this,"pause",()=>{this.isPaused||(this.isPaused=!0)});Qa(this,"resume",()=>{this.isPaused&&(this.isPaused=!1)});Qa(this,"reset",()=>{this.stack=[this.app.serialized];this.pointer=0;this.resume();
this.app.notify("persist",null)});Qa(this,"persist",(g=!1)=>{if(!this.isPaused&&!this.creating){var {serialized:m}=this.app;0<this.stack.length&&!cC(this.stack[this.pointer],m)||(g?this.stack[this.pointer]=m:(this.pointer<this.stack.length&&(this.stack=this.stack.slice(0,this.pointer+1)),this.stack.push(m),this.pointer=this.stack.length-1),this.app.pages.forEach(I=>I.bump()),this.app.notify("persist",null))}});Qa(this,"setPointer",g=>{this.pointer=g;this.deserialize(this.stack[this.pointer]);this.app.notify("persist",
null)});Qa(this,"undo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.canUndo&&this.setPointer(this.pointer-1)});Qa(this,"redo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.canRedo&&this.setPointer(this.pointer+1)});Qa(this,"instantiateShape",g=>new (this.app.getShapeClass(g.type))(g));Qa(this,"deserialize",g=>{Kd(()=>{var m,{pages:I}=g;const W=this.isPaused;this.pause();const ia=[...this.app.selectedIds];try{const ua=new Map(this.app.pages),La=
[];for(const Va of I){const $a=ua.get(Va.id);if(void 0!==$a){const lb=new Map($a.shapes.map(ub=>[ub.props.id,ub]));I=[];for(const ub of Va.shapes){const Rb=lb.get(ub.id);void 0!==Rb?(Rb.nonce!==ub.nonce&&(Rb.update(ub,!0),Rb.nonce=ub.nonce,Rb.setLastSerialized(ub)),lb.delete(ub.id)):I.push(this.instantiateShape(ub))}0<lb.size&&!this.app.selectedTool.isInAny("creating","editingShape")&&$a.removeShapes(...lb.values());0<I.length&&$a.addShapes(...I);ua.delete(Va.id);$a.updateBindings(Va.bindings);$a.nonce=
null!=(m=Va.nonce)?m:0}else{const {id:lb,name:ub,shapes:Rb,bindings:ec,nonce:Vb}=Va;La.push(new im(this.app,{id:lb,name:ub,nonce:Vb,bindings:ec,shapes:Rb.map(tc=>this.instantiateShape(tc))}))}}0<La.length&&this.app.addPages(La);0<ua.size&&this.app.removePages(Array.from(ua.values()));this.app.setSelectedShapes(ia).setErasingShapes([])}catch(ua){console.warn(ua)}W||this.resume()})});this.app=b;pg(this)}get creating(){return"creating"===this.app.selectedTool.currentState.id}get canUndo(){return 0<this.pointer}get canRedo(){return this.pointer<
this.stack.length-1}};Lb([yg],so.prototype,"stack",2);Lb([yg],so.prototype,"pointer",2);Lb([Gg],so.prototype,"canUndo",1);Lb([Gg],so.prototype,"canRedo",1);Lb([hf],so.prototype,"reset",2);Lb([hf],so.prototype,"persist",2);Lb([hf],so.prototype,"setPointer",2);Lb([hf],so.prototype,"undo",2);Lb([hf],so.prototype,"redo",2);Lb([hf],so.prototype,"deserialize",2);var qs=class{constructor(){Qa(this,"mode","light");Qa(this,"showGrid",!0);Qa(this,"color","");pg(this)}update(b){Object.assign(this,b)}};Lb([yg],
qs.prototype,"mode",2);Lb([yg],qs.prototype,"showGrid",2);Lb([yg],qs.prototype,"color",2);Lb([hf],qs.prototype,"update",1);var eh=class extends nr{constructor(b,g,m){var I,W;super();Qa(this,"keybindingRegistered",!1);Qa(this,"uuid",Of());Qa(this,"api");Qa(this,"inputs",new Ek);Qa(this,"cursors",new kr);Qa(this,"viewport",new Po);Qa(this,"settings",new qs);Qa(this,"Tools",[]);Qa(this,"history",new so(this));Qa(this,"persist",this.history.persist);Qa(this,"undo",this.history.undo);Qa(this,"redo",this.history.redo);
Qa(this,"saving",!1);Qa(this,"saveState",()=>{this.history.isPaused||(this.saving=!0,requestAnimationFrame(()=>{this.saving&&(this.persist(),this.saving=!1)}))});Qa(this,"load",()=>{this.notify("load",null);return this});Qa(this,"save",()=>{this.notify("save",null);return this});Qa(this,"saveAs",()=>{this.notify("saveAs",null);return this});Qa(this,"pages",new Map([["page",new im(this,{id:"page",name:"page",shapes:[],bindings:{}})]]));Qa(this,"getPageById",ia=>{const ua=this.pages.get(ia);if(!ua)throw Error(`Could not find a page named ${ia}.`);
return ua});Qa(this,"getShapeById",(ia,ua=this.currentPage.id)=>{var La;return null==(La=this.getPageById(ua))?void 0:La.shapesById[ia]});Qa(this,"createShapes",ia=>{(ia=this.currentPage.addShapes(...ia))&&this.notify("create-shapes",ia);this.persist();return this});Qa(this,"updateShapes",ia=>{ia.forEach(ua=>{var La;return null==(La=this.getShapeById(ua.id))?void 0:La.update(ua)});this.persist();return this});Qa(this,"deleteShapes",ia=>{if(0===ia.length)return this;ia=ia.map(Va=>"string"===typeof Va?
this.getShapeById(Va):Va).filter(Kg);const ua=this.shapesInGroups(ia);ia.forEach(Va=>{this.getParentGroup(Va)&&ua.push(Va)});let La=new Set([...ia,...ua].map(Va=>Va.id));ua.forEach(Va=>{var $a;const lb=this.getParentGroup(Va);if(lb){const ub=null==($a=lb.props.children)?void 0:$a.filter(Rb=>Rb!==Va.id);!ub||1>=(null==ub?void 0:ub.length)?La.add(lb.id):lb.update({children:ub})}});ia=[...La].map(Va=>this.getShapeById(Va));this.setSelectedShapes(this.selectedShapesArray.filter(Va=>!La.has(Va.id)));(ia=
this.currentPage.removeShapes(...ia))&&this.notify("delete-shapes",ia);this.persist();return this});Qa(this,"bringForward",(ia=this.selectedShapesArray)=>{0<ia.length&&this.currentPage.bringForward(ia);return this});Qa(this,"sendBackward",(ia=this.selectedShapesArray)=>{0<ia.length&&this.currentPage.sendBackward(ia);return this});Qa(this,"sendToBack",(ia=this.selectedShapesArray)=>{0<ia.length&&this.currentPage.sendToBack(ia);return this});Qa(this,"bringToFront",(ia=this.selectedShapesArray)=>{0<
ia.length&&this.currentPage.bringToFront(ia);return this});Qa(this,"flipHorizontal",(ia=this.selectedShapesArray)=>{this.currentPage.flip(ia,"horizontal");return this});Qa(this,"flipVertical",(ia=this.selectedShapesArray)=>{this.currentPage.flip(ia,"vertical");return this});Qa(this,"align",(ia,ua=this.selectedShapesArray)=>{if(2>ua.length)return this;const La=ua.map(Rb=>{const ec=Rb.getBounds();return{id:Rb.id,point:[ec.minX,ec.minY],bounds:ec}}),Va=We.getCommonBounds(La.map(({bounds:Rb})=>Rb)),$a=
Va.minX+Va.width/2,lb=Va.minY+Va.height/2,ub=Object.fromEntries(La.map(({id:Rb,point:ec,bounds:Vb})=>[Rb,{prev:ec,next:{top:[ec[0],Va.minY],centerVertical:[ec[0],lb-Vb.height/2],bottom:[ec[0],Va.maxY-Vb.height],left:[Va.minX,ec[1]],centerHorizontal:[$a-Vb.width/2,ec[1]],right:[Va.maxX-Vb.width,ec[1]]}[ia]}]));ua.forEach(Rb=>{ub[Rb.id]&&Rb.update({point:ub[Rb.id].next})});this.persist();return this});Qa(this,"distribute",(ia,ua=this.selectedShapesArray)=>{if(2>ua.length)return this;const La=Object.fromEntries(We.getDistributions(ua,
ia).map(Va=>[Va.id,Va]));ua.forEach(Va=>{La[Va.id]&&Va.update({point:La[Va.id].next})});this.persist();return this});Qa(this,"packIntoRectangle",(ia=this.selectedShapesArray)=>{if(2>ia.length)return this;const ua=Object.fromEntries(We.getPackedDistributions(ia).map(La=>[La.id,La]));ia.forEach(La=>{ua[La.id]&&La.update({point:ua[La.id].next})});this.persist();return this});Qa(this,"assets",{});Qa(this,"removeUnusedAssets",()=>{const ia=this.getCleanUpAssets();Object.keys(this.assets).forEach(ua=>{ia.some(La=>
La.id===ua)||delete this.assets[ua]});this.persist();return this});Qa(this,"copy",()=>{if(0<this.selectedShapesArray.length&&!this.editingShape){const ua=this.allSelectedShapesArray;var ia=JSON.stringify({shapes:ua.map(Va=>Va.serialized),assets:this.getCleanUpAssets().filter(Va=>ua.some($a=>$a.props.assetId===Va.id)),bindings:Dc(this.currentPage.bindings)});ia=encodeURIComponent(`<whiteboard-tldr>${ia}</whiteboard-tldr>`);const La=this.selectedShapesArray.map(Va=>`((${Va.props.id}))`).join(" ");navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([ia],
{type:"text/html"}),"text/plain":new Blob([La],{type:"text/plain"})})])}});Qa(this,"paste",(ia,ua)=>{var La;this.editingShape||this.notify("paste",{point:this.inputs.currentPoint,shiftKey:!!ua,dataTransfer:null!=(La=null==ia?void 0:ia.clipboardData)?La:void 0})});Qa(this,"cut",()=>{this.copy();this.api.deleteShapes()});Qa(this,"drop",(ia,ua)=>{this.notify("drop",{dataTransfer:ia,point:ua?this.viewport.getPagePoint(ua):We.getBoundsCenter(this.viewport.currentView)})});Qa(this,"selectTool",this.transition);
Qa(this,"editingId");Qa(this,"setEditingShape",ia=>{this.editingId="string"===typeof ia?ia:null==ia?void 0:ia.id;return this});Qa(this,"clearEditingState",()=>{this.selectedTool.transition("idle");return this.setEditingShape()});Qa(this,"hoveredId");Qa(this,"setHoveredShape",ia=>{this.hoveredId="string"===typeof ia?ia:null==ia?void 0:ia.id;return this});Qa(this,"selectedIds",new Set);Qa(this,"selectedShapes",new Set);Qa(this,"selectionRotation",0);Qa(this,"setSelectedShapes",ia=>{var ua;const {selectedIds:La,
selectedShapes:Va}=this;La.clear();Va.clear();ia[0]&&"string"===typeof ia[0]?ia.forEach(lb=>La.add(lb)):ia.forEach(lb=>La.add(lb.id));const $a=this.currentPage.shapes.filter(lb=>La.has(lb.id));$a.forEach(lb=>Va.add(lb));this.selectionRotation=1===$a.length?null!=(ua=$a[0].props.rotation)?ua:0:0;0===ia.length&&this.setEditingShape();return this});Qa(this,"erasingIds",new Set);Qa(this,"erasingShapes",new Set);Qa(this,"setErasingShapes",ia=>{const {erasingIds:ua,erasingShapes:La}=this;ua.clear();La.clear();
ia[0]&&"string"===typeof ia[0]?ia.forEach(Va=>ua.add(Va)):ia.forEach(Va=>ua.add(Va.id));this.currentPage.shapes.filter(Va=>ua.has(Va.id)).forEach(Va=>La.add(Va));return this});Qa(this,"bindingIds");Qa(this,"setBindingShapes",ia=>{this.bindingIds=ia;return this});Qa(this,"clearBindingShape",()=>this.setBindingShapes());Qa(this,"createNewLineBinding",(ia,ua)=>{ia="string"===typeof ia?this.getShapeById(ia):ia;ua="string"===typeof ua?this.getShapeById(ua):ua;if((null==ia?0:ia.canBind)&&(null==ua?0:ua.canBind)&&
(ua=kd(ia,ua))){const [La,Va]=ua;this.createShapes([La]);this.currentPage.updateBindings(Object.fromEntries(Va.map($a=>[$a.id,$a])));this.persist();return!0}return!1});Qa(this,"brush");Qa(this,"setBrush",ia=>{this.brush=ia;return this});Qa(this,"setCamera",(ia,ua)=>{this.viewport.update({point:ia,zoom:ua});return this});Qa(this,"getPagePoint",ia=>{const {camera:ua}=this.viewport;return sd.sub(sd.div(ia,ua.zoom),ua.point)});Qa(this,"getScreenPoint",ia=>{const {camera:ua}=this.viewport;return sd.mul(sd.add(ia,
ua.point),ua.zoom)});Qa(this,"Shapes",new Map);Qa(this,"registerShapes",ia=>{ia.forEach(ua=>{if("group"===ua.id){const La=this;ua.prototype.getShapes=function(){var Va,$a;return null!=($a=null==(Va=this.props.children)?void 0:Va.map(lb=>La.getShapeById(lb)).filter(Boolean))?$a:[]}}return this.Shapes.set(ua.id,ua)})});Qa(this,"deregisterShapes",ia=>{ia.forEach(ua=>this.Shapes.delete(ua.id))});Qa(this,"getShapeClass",ia=>{if(!ia)throw Error("No shape type provided.");const ua=this.Shapes.get(ia);if(!ua)throw Error(`Could not find shape class for ${ia}`);
return ua});Qa(this,"wrapUpdate",ia=>{Kd(()=>{const ua=!this.history.isPaused;ua&&this.history.pause();ia();ua&&(this.history.resume(),this.persist())})});Qa(this,"subscriptions",new Set([]));Qa(this,"subscribe",(ia,ua)=>{if(void 0===ua)throw Error("Callback is required.");const La={event:ia,callback:ua};this.subscriptions.add(La);return()=>this.unsubscribe(La)});Qa(this,"unsubscribe",ia=>{this.subscriptions.delete(ia);return this});Qa(this,"notify",(ia,ua)=>{this.subscriptions.forEach(La=>{La.event===
ia&&La.callback(this,ua)});return this});Qa(this,"onTransition",()=>{});Qa(this,"onPointerDown",(ia,ua)=>{if(!this.editingShape&&1===ua.button&&!this.isIn("move"))this.temporaryTransitionToMove(ua);else if(2===ua.button&&!this.editingShape)this.transition("select");else if("clientX"in ua)this.inputs.onPointerDown([...this.viewport.getPagePoint([ua.clientX,ua.clientY]),.5],ua)});Qa(this,"onPointerUp",(ia,ua)=>{if(!this.editingShape&&1===ua.button&&this.isIn("move"))this.selectedTool.transition("idle",
{exit:!0}),ua.stopPropagation(),ua.preventDefault();else if("clientX"in ua)this.inputs.onPointerUp([...this.viewport.getPagePoint([ua.clientX,ua.clientY]),.5],ua)});Qa(this,"onPointerMove",(ia,ua)=>{if("clientX"in ua)this.inputs.onPointerMove([...this.viewport.getPagePoint([ua.clientX,ua.clientY]),.5],ua)});Qa(this,"onKeyDown",(ia,ua)=>{if(this.editingShape||" "!==ua.key||this.isIn("move"))this.inputs.onKeyDown(ua);else this.temporaryTransitionToMove(ua)});Qa(this,"onKeyUp",(ia,ua)=>{if(!this.editingShape&&
" "===ua.key&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),ua.stopPropagation(),ua.preventDefault();else this.inputs.onKeyUp(ua)});Qa(this,"onPinchStart",(ia,ua)=>{this.inputs.onPinchStart([...this.viewport.getPagePoint(ia.point),.5],ua)});Qa(this,"onPinch",(ia,ua)=>{this.inputs.onPinch([...this.viewport.getPagePoint(ia.point),.5],ua)});Qa(this,"onPinchEnd",(ia,ua)=>{this.inputs.onPinchEnd([...this.viewport.getPagePoint(ia.point),.5],ua)});this._states=[ir,jr];this.history.pause();
if(this.states&&0<this.states.length){this.registerStates(this.states);const ia=null!=(I=this.initial)?I:this.states[0].id;if(I=this.children.get(ia))this.currentState=I,null==(W=this.currentState)?void 0:W._events.onEnter({fromId:"initial"})}g&&this.registerShapes(g);m&&this.registerTools(m);this.history.resume();b&&this.history.deserialize(b);this.api=new hC(this);pg(this);this.notify("mount",null)}dispose(){super.dispose();this.keybindingRegistered=!1;return this}initKeyboardShortcuts(){if(!this.keybindingRegistered){var b=
this.constructor.shortcuts||[],g=Array.from(this.children.values()).filter(m=>m.constructor.shortcut).map(m=>({keys:m.constructor.shortcut,fn:(I,W,ia)=>{this.transition(m.id)}}));this._disposables.push(...[{keys:"shift+0",fn:()=>this.api.resetZoom()},{keys:"shift+1",fn:()=>this.api.zoomToFit()},{keys:"mod+shift+1",fn:()=>this.api.zoomToSelection()},{keys:"mod+-",fn:()=>this.api.zoomOut()},{keys:"mod+\x3d",fn:()=>this.api.zoomIn()},{keys:"mod+z",fn:()=>this.undo()},{keys:"mod+x",fn:()=>this.cut()},
{keys:"mod+shift+z",fn:()=>this.redo()},{keys:"[",fn:()=>this.sendBackward()},{keys:"shift+[",fn:()=>this.sendToBack()},{keys:"]",fn:()=>this.bringForward()},{keys:"shift+]",fn:()=>this.bringToFront()},{keys:"mod+a",fn:()=>{const {selectedTool:m}=this;"select"!==m.id&&this.selectTool("select");this.api.selectAll()}},{keys:"mod+shift+s",fn:()=>{this.saveAs();this.notify("saveAs",null)}},{keys:"mod+shift+v",fn:(m,I,W)=>{this.editingShape||(W.preventDefault(),this.paste(void 0,!0))}},{keys:["del","backspace"],
fn:()=>{this.editingShape||(this.api.deleteShapes(),this.selectedTool.transition("idle"))}},{keys:"mod+g",fn:()=>{this.api.doGroup()}},{keys:"mod+shift+g",fn:()=>{this.api.unGroup()}},...b,...g].map(({keys:m,fn:I})=>vp.registerShortcut(m,W=>{I(this,this,W)})));this.keybindingRegistered=!0}}loadDocumentModel(b){this.history.deserialize(b);b.assets&&0<b.assets.length&&this.addAssets(b.assets);return this}get serialized(){return{selectedIds:Array.from(this.selectedIds.values()),pages:Array.from(this.pages.values()).map(b=>
b.serialized),assets:this.getCleanUpAssets()}}get currentPageId(){return this.pages.keys().next().value}get currentPage(){return this.getPageById(this.currentPageId)}addPages(b){b.forEach(g=>this.pages.set(g.id,g));this.persist();return this}removePages(b){b.forEach(g=>this.pages.delete(g.id));this.persist();return this}shapesInGroups(b=this.shapes){return b.flatMap(g=>g.props.children).filter(Kg).map(g=>this.getShapeById(g)).filter(Kg)}getParentGroup(b){return this.shapes.find(g=>{var m;return null==
(m=g.props.children)?void 0:m.includes(b.id)})}addAssets(b){b.forEach(g=>this.assets[g.id]=g);this.persist();return this}removeAssets(b){"string"===typeof b[0]?b.forEach(g=>delete this.assets[g]):b.forEach(g=>delete this.assets[g.id]);this.persist();return this}getCleanUpAssets(){const b=new Set;this.pages.forEach(g=>g.shapes.forEach(m=>{m.props.assetId&&this.assets[m.props.assetId]&&b.add(this.assets[m.props.assetId])}));return Array.from(b)}createAssets(b){this.addAssets(b);this.notify("create-assets",
{assets:b});this.persist();return this}get selectedTool(){return this.currentState}registerTools(b){this.Tools=b;return this.registerStates(b)}get editingShape(){const {editingId:b,currentPage:g}=this;return b?g.shapes.find(m=>m.id===b):void 0}get hoveredShape(){const {hoveredId:b,currentPage:g}=this;return b?g.shapes.find(m=>m.id===b):void 0}get hoveredGroup(){const {hoveredShape:b}=this;return b?this.shapes.find(g=>{var m;return"group"===g.type&&(null==(m=g.props.children)?void 0:m.includes(b.id))}):
void 0}get selectedShapesArray(){const {selectedShapes:b,selectedTool:g}=this;return"select"!==g.id?[]:Array.from(b.values())}get allSelectedShapes(){return new Set(this.allSelectedShapesArray)}get allSelectedShapesArray(){const {selectedShapesArray:b}=this;return[...(new Set([...b,...this.shapesInGroups(b)]))]}setSelectionRotation(b){this.selectionRotation=b}get erasingShapesArray(){return Array.from(this.erasingShapes.values())}get bindingShapes(){var b;const g=1===this.selectedShapesArray.length?
this.selectedShapesArray.flatMap(I=>{var W;return Object.values(null!=(W=I.props.handles)?W:{})}).flatMap(I=>I.bindingId).filter(Kg).flatMap(I=>{var W,ia;return[null==(W=this.currentPage.bindings[I])?void 0:W.fromId,null==(ia=this.currentPage.bindings[I])?void 0:ia.toId]}).filter(Kg):[],m=[...(null!=(b=this.bindingIds)?b:[]),...g];return m?this.currentPage.shapes.filter(I=>null==m?void 0:m.includes(I.id)):void 0}get currentGrid(){const {zoom:b}=this.viewport.camera;return.15>b?128:1>b?32:8}get shapes(){const {currentPage:{shapes:b}}=
this;return Array.from(b.values())}get shapesInViewport(){const {selectedShapes:b,currentPage:g,viewport:{currentView:m}}=this;return g.shapes.filter(I=>!I.canUnmount||b.has(I)||We.boundsContain(m,I.rotatedBounds)||We.boundsCollide(m,I.rotatedBounds))}get selectionDirectionHint(){const {selectionBounds:b,viewport:{currentView:g}}=this;if(b&&!We.boundsContain(g,b)&&!We.boundsCollide(g,b)){var m=We.getBoundsCenter(b);return sd.clampV([(m[0]-g.minX-g.width/2)/g.width,(m[1]-g.minY-g.height/2)/g.height],
-1,1)}}get selectionBounds(){const {selectedShapesArray:b}=this;if(0!==b.length)return 1===b.length?Ga(te({},b[0].bounds),{rotation:b[0].props.rotation}):We.getCommonBounds(this.selectedShapesArray.map(g=>g.rotatedBounds))}get showSelection(){var b;const {selectedShapesArray:g}=this;return this.isIn("select")&&!this.isInAny("select.translating","select.pinching","select.rotating")&&(1===g.length&&!(null==(b=g[0])?0:b.hideSelection)||1<g.length)}get showSelectionDetail(){return this.isIn("select")&&
!this.isInAny("select.translating","select.pinching")&&0<this.selectedShapes.size&&!this.selectedShapesArray.every(b=>b.hideSelectionDetail)&&!1}get showSelectionRotation(){return this.showSelectionDetail&&this.isInAny("select.rotating","select.pointingRotateHandle")}get showContextBar(){const {selectedShapesArray:b}=this;return this.isInAny("select.idle","select.hoveringSelectionHandle")&&!this.isIn("select.contextMenu")&&0<b.length&&!b.every(g=>g.hideContextBar)}get showRotateHandles(){const {selectedShapesArray:b}=
this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingRotateHandle","select.pointingResizeHandle")&&0<b.length&&!b.some(g=>g.hideRotateHandle)}get showResizeHandles(){const {selectedShapesArray:b}=this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingShape","select.pointingSelectedShape","select.pointingRotateHandle","select.pointingResizeHandle")&&1===b.length&&!b.every(g=>g.hideResizeHandles)}temporaryTransitionToMove(b){b.stopPropagation();
b.preventDefault();this.transition("move",{prevTool:this.selectedTool});this.selectedTool.transition("idleHold")}};Qa(eh,"id","app");Qa(eh,"initial","select");Lb([Gg],eh.prototype,"serialized",1);Lb([yg],eh.prototype,"pages",2);Lb([Gg],eh.prototype,"currentPageId",1);Lb([Gg],eh.prototype,"currentPage",1);Lb([hf],eh.prototype,"addPages",1);Lb([hf],eh.prototype,"removePages",1);Lb([hf],eh.prototype,"createShapes",2);Lb([hf],eh.prototype,"updateShapes",2);Lb([hf],eh.prototype,"deleteShapes",2);Lb([yg],
eh.prototype,"assets",2);Lb([hf],eh.prototype,"addAssets",1);Lb([hf],eh.prototype,"removeAssets",1);Lb([hf],eh.prototype,"removeUnusedAssets",2);Lb([Gg],eh.prototype,"selectedTool",1);Lb([yg],eh.prototype,"editingId",2);Lb([Gg],eh.prototype,"editingShape",1);Lb([hf],eh.prototype,"setEditingShape",2);Lb([yg],eh.prototype,"hoveredId",2);Lb([Gg],eh.prototype,"hoveredShape",1);Lb([Gg],eh.prototype,"hoveredGroup",1);Lb([hf],eh.prototype,"setHoveredShape",2);Lb([yg],eh.prototype,"selectedIds",2);Lb([yg],
eh.prototype,"selectedShapes",2);Lb([yg],eh.prototype,"selectionRotation",2);Lb([Gg],eh.prototype,"selectedShapesArray",1);Lb([Gg],eh.prototype,"allSelectedShapes",1);Lb([Gg],eh.prototype,"allSelectedShapesArray",1);Lb([hf],eh.prototype,"setSelectedShapes",2);Lb([hf],eh.prototype,"setSelectionRotation",1);Lb([yg],eh.prototype,"erasingIds",2);Lb([yg],eh.prototype,"erasingShapes",2);Lb([Gg],eh.prototype,"erasingShapesArray",1);Lb([hf],eh.prototype,"setErasingShapes",2);Lb([yg],eh.prototype,"bindingIds",
2);Lb([Gg],eh.prototype,"bindingShapes",1);Lb([hf],eh.prototype,"setBindingShapes",2);Lb([hf],eh.prototype,"createNewLineBinding",2);Lb([yg],eh.prototype,"brush",2);Lb([hf],eh.prototype,"setBrush",2);Lb([hf],eh.prototype,"setCamera",2);Lb([Gg],eh.prototype,"currentGrid",1);Lb([Gg],eh.prototype,"shapes",1);Lb([Gg],eh.prototype,"shapesInViewport",1);Lb([Gg],eh.prototype,"selectionDirectionHint",1);Lb([Gg],eh.prototype,"selectionBounds",1);Lb([Gg],eh.prototype,"showSelection",1);Lb([Gg],eh.prototype,
"showSelectionDetail",1);Lb([Gg],eh.prototype,"showSelectionRotation",1);Lb([Gg],eh.prototype,"showContextBar",1);Lb([Gg],eh.prototype,"showRotateHandles",1);Lb([Gg],eh.prototype,"showResizeHandles",1);var dC=Function.prototype.toString,dv=Object.create,eC=Object.prototype.toString,fC=function(){function b(){this._keys=[];this._values=[]}b.prototype.has=function(g){return!!~this._keys.indexOf(g)};b.prototype.get=function(g){return this._values[this._keys.indexOf(g)]};b.prototype.set=function(g,m){this._keys.push(g);
this._values.push(m)};return b}(),bC="undefined"!==typeof WeakMap?Ue:ve,vD="g"===/test/g.flags?Hf:eg,zC="undefined"!==typeof Symbol?Qf:xf,AC=Object.defineProperty,CC=Object.getOwnPropertyDescriptor,gy=Object.getOwnPropertyNames,pv=Object.getOwnPropertySymbols,hy=Object.prototype,iy=hy.hasOwnProperty,DC=hy.propertyIsEnumerable,jy="function"===typeof pv,EC=jy?Pg:gy,FC=Array.isArray,ov=Object.assign,yC=Object.getPrototypeOf,fy={array:function(b,g){var m=new g.Constructor;g.cache.set(b,m);for(var I=0,
W=b.length;I<W;++I)m[I]=g.copier(b[I],g);return m},arrayBuffer:function(b,g){return b.slice(0)},blob:function(b,g){return b.slice(0,b.size,b.type)},dataView:function(b,g){return new g.Constructor(b.buffer.slice(0))},date:function(b,g){return new g.Constructor(b.getTime())},error:Rh,map:uh,object:jy?Zh:li,regExp:function(b,g){g=new g.Constructor(b.source,vD(b));g.lastIndex=b.lastIndex;return g},set:df},wD=ov({},fy,{array:function(b,g){var m=new g.Constructor;g.cache.set(b,m);return ei(b,m,g)},map:function(b,
g){return ei(b,uh(b,g),g)},object:function(b,g){var m=Kf(g.prototype);g.cache.set(b,m);return ei(b,m,g)},set:function(b,g){return ei(b,df(b,g),g)}});Sh(ov({},wD,{}));var HC=Sh({}),ly=vb(da()),GC=vb(va()),Mq=HC,In=class{static insertTextFirefox(b,g){b.setRangeText(g,b.selectionStart||0,b.selectionEnd||0,"end");b.dispatchEvent(new InputEvent("input",{data:g,inputType:"insertText",isComposing:!1}))}static insert(b,g){const m=b.ownerDocument,I=m.activeElement;I!==b&&b.focus();m.execCommand("insertText",
!1,g)||In.insertTextFirefox(b,g);I===m.body?b.blur():I instanceof HTMLElement&&I!==b&&I.focus()}static set(b,g){b.select();In.insert(b,g)}static getSelection(b){const {selectionStart:g,selectionEnd:m}=b;return b.value.slice(g?g:void 0,m?m:void 0)}static wrapSelection(b,g,m){const {selectionStart:I,selectionEnd:W}=b,ia=In.getSelection(b);In.insert(b,g+ia+(null!=m?m:g));b.selectionStart=(I||0)+g.length;b.selectionEnd=(W||0)+g.length}static replace(b,g,m){let I=0;b.value.replace(g,(...W)=>{const ia=
I+W[W.length-2],ua=W[0].length;b.selectionStart=ia;b.selectionEnd=ia+ua;W="string"===typeof m?m:m(...W);In.insert(b,W);b.selectionStart=ia;I+=W.length-ua;return W})}static findLineEnd(b,g){const m=b.lastIndexOf("\n",g-1)+1;return"\t"!==b.charAt(m)?g:m+1}static indent(b){var g;const {selectionStart:m,selectionEnd:I,value:W}=b;var ia=W.slice(m,I);if((ia=null==(g=/\n/g.exec(ia))?void 0:g.length)&&0<ia){g=W.lastIndexOf("\n",m-1)+1;var ua=b.value.slice(g,I-1);ia=ua.replace(/^|\n/g,`$&${In.INDENT}`);ua=
ia.length-ua.length;b.setSelectionRange(g,I-1);In.insert(b,ia);b.setSelectionRange(m+1,I+ua)}else In.insert(b,In.INDENT)}static unindent(b){const {selectionStart:g,selectionEnd:m,value:I}=b;var W=I.lastIndexOf("\n",g-1)+1;const ia=In.findLineEnd(I,m);var ua=b.value.slice(W,ia);const La=ua.replace(/(^|\n)(\t| {1,2})/g,"$1");ua=ua.length-La.length;b.setSelectionRange(W,ia);In.insert(b,La);W=(W=/\t| {1,2}/.exec(I.slice(W,g)))?W[0].length:0;b.setSelectionRange(g-W,Math.max(g-W,m-ua))}static normalizeText(b){return b.replace(In.fixNewLines,
"\n")}},Ar=In;Qa(Ar,"fixNewLines",/\r?\n|\r/g);Qa(Ar,"INDENT","  ");var Jp;"undefined"!==typeof window&&(Jp=Bj());var uv=new Map,xo=xk()?"⌘":"Ctrl",MC=class extends eh{},oy=vb(V(22)),LC=()=>{};/^((?!chrome|android).)*safari/i.test(navigator.userAgent);var ny=vb(V(22)),tv={},Es=vb(V(22)),KC=b=>{for(b=b.parentElement;b&&b!==document.body;){const {overflowY:g}=window.getComputedStyle(b);if(b.scrollHeight>b.clientHeight&&("auto"===g||"scroll"===g||"overlay"===g))return b;b=b.parentElement}return document},
sv=vb(V(22)),rv=new Map,JC={accent:"rgb(255, 0, 0)",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-selectedFill)",selectFill:"rgba(65, 132, 244, 0.05)",binding:"rgba(65, 132, 244, 0.5)",background:"var(--ls-primary-background-color)",foreground:"var(--ls-primary-text-color)",grid:"var(--ls-quaternary-background-color)"},IC=((b,...g)=>b.reduce((m,I,W)=>m+I+(W<g.length?g[W]:""),""))`
  .tl-container {
    --tl-cursor: inherit;
    --tl-zoom: 1;
    --tl-scale: calc(1 / var(--tl-zoom));
    --tl-padding: 64px;
    --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: var(--tl-cursor) !important;
    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-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);
  }
`,qv=vb(V(22)),my=vb(V(22)),Bv={},Hk={toVector(b,g){void 0===b&&(b=g);return Array.isArray(b)?b:[b,b]},add(b,g){return[b[0]+g[0],b[1]+g[1]]},sub(b,g){return[b[0]-g[0],b[1]-g[1]]},addTo(b,g){b[0]+=g[0];b[1]+=g[1]},subTo(b,g){b[0]-=g[0];b[1]-=g[1]}},ty={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"}},eD=["enter","leave"],fD=["gotpointercapture","lostpointercapture"],
vy=class{constructor(b,g,m){this.ctrl=b;this.args=g;this.key=m;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(b){this.ctrl.state[this.key]=b}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:b,
shared:g,ingKey:m,args:I}=this;g[m]=b._active=b.active=b._blocked=b._force=!1;b._step=[!1,!1];b.intentional=!1;b._movement=[0,0];b._distance=[0,0];b._direction=[0,0];b._delta=[0,0];b._bounds=[[-Infinity,Infinity],[-Infinity,Infinity]];b.args=I;b.axis=void 0;b.memo=void 0;b.elapsedTime=0;b.direction=[0,0];b.distance=[0,0];b.overflow=[0,0];b._movementBound=[!1,!1];b.velocity=[0,0];b.movement=[0,0];b.delta=[0,0];b.timeStamp=0}start(b){const g=this.state,m=this.config;g._active||(this.reset(),this.computeInitial(),
g._active=!0,g.target=b.target,g.currentTarget=b.currentTarget,g.lastOffset=m.from?Mh(m.from,g):g.offset,g.offset=g.lastOffset);g.startTime=g.timeStamp=b.timeStamp}computeValues(b){const g=this.state;g._values=b;g.values=this.config.transform(b)}computeInitial(){const b=this.state;b._initial=b._values;b.initial=b.values}compute(b){const {state:g,config:m,shared:I}=this;g.args=this.args;var W=0;if(b){g.event=b;m.preventDefault&&b.cancelable&&g.event.preventDefault();g.type=b.type;I.touches=this.ctrl.pointerIds.size||
this.ctrl.touchIds.size;I.locked=!!document.pointerLockElement;W=Object;var ia=W.assign,ua={};"buttons"in b&&(ua.buttons=b.buttons);if("shiftKey"in b){const {shiftKey:Rc,altKey:Vc,metaKey:Vd,ctrlKey:ae}=b;Object.assign(ua,{shiftKey:Rc,altKey:Vc,metaKey:Vd,ctrlKey:ae})}ia.call(W,I,ua);I.down=I.pressed=1===I.buttons%2||0<I.touches;W=b.timeStamp-g.timeStamp;g.timeStamp=b.timeStamp;g.elapsedTime=g.timeStamp-g.startTime}g._active&&(ia=g._delta.map(Math.abs),Hk.addTo(g._distance,ia));this.axisIntent&&this.axisIntent(b);
const [La,Va]=g._movement,[$a,lb]=m.threshold,{_step:ub,values:Rb}=g;m.hasCustomTransform?(!1===ub[0]&&(ub[0]=Math.abs(La)>=$a&&Rb[0]),!1===ub[1]&&(ub[1]=Math.abs(Va)>=lb&&Rb[1])):(!1===ub[0]&&(ub[0]=Math.abs(La)>=$a&&Math.sign(La)*$a),!1===ub[1]&&(ub[1]=Math.abs(Va)>=lb&&Math.sign(Va)*lb));g.intentional=!1!==ub[0]||!1!==ub[1];if(g.intentional){ia=[0,0];if(m.hasCustomTransform){const [Rc,Vc]=Rb;ia[0]=!1!==ub[0]?Rc-ub[0]:0;ia[1]=!1!==ub[1]?Vc-ub[1]:0}else ia[0]=!1!==ub[0]?La-ub[0]:0,ia[1]=!1!==ub[1]?
Va-ub[1]:0;this.restrictToAxis&&!g._blocked&&this.restrictToAxis(ia);ua=g.offset;var ec=g._active&&!g._blocked||g.active;ec&&(g.first=g._active&&!g.active,g.last=!g._active&&g.active,g.active=I[this.ingKey]=g._active,b&&(g.first&&("bounds"in m&&(g._bounds=Mh(m.bounds,g)),this.setup&&this.setup()),g.movement=ia,this.computeOffset()));var [Vb,tc]=g.offset,[[oc,Xb],[sc,Hc]]=g._bounds;g.overflow=[Vb<oc?-1:Vb>Xb?1:0,tc<sc?-1:tc>Hc?1:0];g._movementBound[0]=g.overflow[0]?!1===g._movementBound[0]?g._movement[0]:
g._movementBound[0]:!1;g._movementBound[1]=g.overflow[1]?!1===g._movementBound[1]?g._movement[1]:g._movementBound[1]:!1;g.offset=Eh(g._bounds,g.offset,g._active?m.rubberband||[0,0]:[0,0]);g.delta=Hk.sub(g.offset,ua);this.computeMovement();ec&&(!g.last||32<W)&&(g.delta=Hk.sub(g.offset,ua),b=g.delta.map(Math.abs),Hk.addTo(g.distance,b),g.direction=g.delta.map(Math.sign),g._direction=g._delta.map(Math.sign),!g.first&&0<W&&(g.velocity=[b[0]/W,b[1]/W]))}}emit(){const b=this.state;var g=this.shared;const m=
this.config;b._active||this.clean();if(!b._blocked&&b.intentional||b._force||m.triggerAllEvents)g=this.handler(Ag(Ag(Ag({},g),b),{},{[this.aliasKey]:b.values})),void 0!==g&&(b.memo=g)}clean(){this.eventStore.clean();this.timeoutStore.clean()}},Gs=class extends vy{constructor(...b){super(...b);Xg(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=Hk.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=
Hk.sub(this.state.offset,this.state.lastOffset)}axisIntent(b){const g=this.state,m=this.config;!g.axis&&b&&(b="object"===typeof m.axisThreshold?m.axisThreshold[Lh(b)]:m.axisThreshold,g.axis=Yi(g._movement,b));g._blocked=(m.lockDirection||!!m.axis)&&!g.axis||!!m.axis&&m.axis!==g.axis}restrictToAxis(b){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case "x":b[1]=0;break;case "y":b[0]=0}}},gD=b=>b,wy={enabled(b=!0){return b},eventOptions(b,g,m){return Ag(Ag({},m.shared.eventOptions),
b)},preventDefault(b=!1){return b},triggerAllEvents(b=!1){return b},rubberband(b=0){switch(b){case !0:return[.15,.15];case !1:return[0,0];default:return Hk.toVector(b)}},from(b){if("function"===typeof b)return b;if(null!=b)return Hk.toVector(b)},transform(b,g,m){b=b||m.shared.transform;this.hasCustomTransform=!!b;return b||gD},threshold(b){return Hk.toVector(b,0)}},Kq=Ag(Ag({},wy),{},{axis(b,g,{axis:m}){this.lockDirection="lock"===m;if(!this.lockDirection)return m},axisThreshold(b=0){return b},bounds(b=
{}){if("function"===typeof b)return ia=>Kq.bounds(b(ia));if("current"in b)return()=>b.current;if("function"===typeof HTMLElement&&b instanceof HTMLElement)return b;const {left:g=-Infinity,right:m=Infinity,top:I=-Infinity,bottom:W=Infinity}=b;return[[g,m],[I,W]]}}),xy={ArrowRight:(b=1)=>[10*b,0],ArrowLeft:(b=1)=>[-10*b,0],ArrowUp:(b=1)=>[0,-10*b],ArrowDown:(b=1)=>[0,10*b]},hD=class extends Gs{constructor(...b){super(...b);Xg(this,"ingKey","dragging")}reset(){super.reset();const b=this.state;b._pointerId=
void 0;b._pointerActive=!1;b._keyboardActive=!1;b._preventScroll=!1;b._delayed=!1;b.swipe=[0,0];b.tap=!1;b.canceled=!1;b.cancel=this.cancel.bind(this)}setup(){const b=this.state;if(b._bounds instanceof HTMLElement){const g=b._bounds.getBoundingClientRect(),m=b.currentTarget.getBoundingClientRect();b._bounds=Kq.bounds({left:g.left-m.left+b.offset[0],right:g.right-m.right+b.offset[0],top:g.top-m.top+b.offset[1],bottom:g.bottom-m.bottom+b.offset[1]})}}cancel(){const b=this.state;b.canceled||(b.canceled=
!0,b._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(b){const g=this.config,m=this.state;if(null==b.buttons||(Array.isArray(g.pointerButtons)?g.pointerButtons.includes(b.buttons):-1===g.pointerButtons||g.pointerButtons===b.buttons)){var I=this.ctrl.setEventIds(b);g.pointerCapture&&b.target.setPointerCapture(b.pointerId);
I&&1<I.size&&m._pointerActive||(this.start(b),this.setupPointer(b),m._pointerId=Rj(b),m._pointerActive=!0,this.computeValues(fi(b)),this.computeInitial(),g.preventScrollAxis&&"mouse"!==Lh(b)?(m._active=!1,this.setupScrollPrevention(b)):0<g.delay?(this.setupDelayTrigger(b),g.triggerAllEvents&&(this.compute(b),this.emit())):this.startPointerDrag(b))}}startPointerDrag(b){const g=this.state;g._active=!0;g._preventScroll=!0;g._delayed=!1;this.compute(b);this.emit()}pointerMove(b){const g=this.state,m=
this.config;if(g._pointerActive&&(g.type!==b.type||b.timeStamp!==g.timeStamp)){var I=Rj(b);if(void 0===g._pointerId||I===g._pointerId)I=fi(b),document.pointerLockElement===b.target?g._delta=[b.movementX,b.movementY]:(g._delta=Hk.sub(I,g._values),this.computeValues(I)),Hk.addTo(g._movement,g._delta),this.compute(b),g._delayed&&g.intentional?(this.timeoutStore.remove("dragDelay"),g.active=!1,this.startPointerDrag(b)):m.preventScrollAxis&&!g._preventScroll?g.axis&&(g.axis===m.preventScrollAxis||"xy"===
m.preventScrollAxis?(g._active=!1,this.clean()):(this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(b))):this.emit()}}pointerUp(b){this.ctrl.setEventIds(b);try{this.config.pointerCapture&&b.target.hasPointerCapture(b.pointerId)&&b.target.releasePointerCapture(b.pointerId)}catch(ua){}const g=this.state,m=this.config;if(g._active&&g._pointerActive){var I=Rj(b);if(void 0===g._pointerId||I===g._pointerId){this.state._pointerActive=!1;this.setActive();this.compute(b);var [W,ia]=g._distance;
g.tap=W<=m.tapsThreshold&&ia<=m.tapsThreshold;if(g.tap&&m.filterTaps)g._force=!0;else{const [ua,La]=g.direction,[Va,$a]=g.velocity,[lb,ub]=g.movement,[Rb,ec]=m.swipe.velocity,[Vb,tc]=m.swipe.distance;g.elapsedTime<m.swipe.duration&&(Math.abs(Va)>Rb&&Math.abs(lb)>Vb&&(g.swipe[0]=ua),Math.abs($a)>ec&&Math.abs(ub)>tc&&(g.swipe[1]=La))}this.emit()}}}pointerClick(b){!this.state.tap&&0<b.detail&&(b.preventDefault(),b.stopPropagation())}setupPointer(b){const g=this.config,m=g.device;g.pointerLock&&b.currentTarget.requestPointerLock();
g.pointerCapture||(this.eventStore.add(this.sharedConfig.window,m,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,m,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,m,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(b){this.state._preventScroll&&b.cancelable&&b.preventDefault()}setupScrollPrevention(b){this.state._preventScroll=
!1;"persist"in b&&"function"===typeof b.persist&&b.persist();const g=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",g);this.eventStore.add(this.sharedConfig.window,"touch","cancel",g);this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,b)}setupDelayTrigger(b){this.state._delayed=!0;this.timeoutStore.add("dragDelay",()=>{this.state._step=
[0,0];this.startPointerDrag(b)},this.config.delay)}keyDown(b){const g=xy[b.key];if(g){const m=this.state,I=b.shiftKey?10:b.altKey?.1:1;this.start(b);m._delta=g(I);m._keyboardActive=!0;Hk.addTo(m._movement,m._delta);this.compute(b);this.emit()}}keyUp(b){b.key in xy&&(this.state._keyboardActive=!1,this.setActive(),this.compute(b),this.emit())}bind(b){const g=this.config.device;b(g,"start",this.pointerDown.bind(this));this.config.pointerCapture&&(b(g,"change",this.pointerMove.bind(this)),b(g,"end",this.pointerUp.bind(this)),
b(g,"cancel",this.pointerUp.bind(this)),b("lostPointerCapture","",this.pointerUp.bind(this)));this.config.keys&&(b("key","down",this.keyDown.bind(this)),b("key","up",this.keyUp.bind(this)));this.config.filterTaps&&b("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},Lq="undefined"!==typeof window&&window.document&&window.document.createElement;try{var yy="constructor"in GestureEvent}catch(b){yy=!1}var iD=yy,Fs=Lq&&"ontouchstart"in window||Lq&&1<window.navigator.maxTouchPoints,zy=Lq&&
"ontouchstart"in window||Lq&&1<window.navigator.maxTouchPoints,uy=Lq&&"onpointerdown"in window,dD=Lq&&"exitPointerLock"in window.document,sy={mouse:0,touch:0,pen:8},$C=Ag(Ag({},Kq),{},{device(b,g,{pointer:{touch:m=!1,lock:I=!1,mouse:W=!1}={}}){this.pointerLock=I&&dD;return Fs&&m?"touch":this.pointerLock?"mouse":uy&&!W?"pointer":Fs?"touch":"mouse"},preventScrollAxis(b,g,{preventScroll:m}){this.preventScrollDelay="number"===typeof m?m:m||void 0===m&&b?250:void 0;if(zy&&!1!==m)return b?b:void 0!==m?
"y":void 0},pointerCapture(b,g,{pointer:{capture:m=!0,buttons:I=1,keys:W=!0}={}}){this.pointerButtons=I;this.keys=W;return!this.pointerLock&&"pointer"===this.device&&m},threshold(b,g,{filterTaps:m=!1,tapsThreshold:I=3,axis:W}){b=Hk.toVector(b,m?I:W?1:0);this.filterTaps=m;this.tapsThreshold=I;return b},swipe({velocity:b=.5,distance:g=50,duration:m=250}={}){return{velocity:this.transform(Hk.toVector(b)),distance:this.transform(Hk.toVector(g)),duration:m}},delay(b=0){switch(b){case !0:return 180;case !1:return 0;
default:return b}},axisThreshold(b){return b?Ag(Ag({},sy),b):sy}}),aD=class extends vy{constructor(...b){super(...b);Xg(this,"ingKey","pinching");Xg(this,"aliasKey","da")}init(){this.state.offset=[1,0];this.state.lastOffset=[1,0];this.state._pointerEvents=new Map}reset(){super.reset();const b=this.state;b._touchIds=[];b.canceled=!1;b.cancel=this.cancel.bind(this);b.turns=0}computeOffset(){const {type:b,movement:g,lastOffset:m}=this.state;this.state.offset="wheel"===b?Hk.add(g,m):[(1+g[0])*m[0],g[1]+
m[1]]}computeMovement(){const {offset:b,lastOffset:g}=this.state;this.state.movement=[b[0]/g[0],b[1]-g[1]]}axisIntent(){const b=this.state,[g,m]=b._movement;if(!b.axis){const I=30*Math.abs(g)-Math.abs(m);0>I?b.axis="angle":0<I&&(b.axis="scale")}}restrictToAxis(b){this.config.lockDirection&&("scale"===this.state.axis?b[1]=0:"angle"===this.state.axis&&(b[0]=0))}cancel(){const b=this.state;b.canceled||setTimeout(()=>{b.canceled=!0;b._active=!1;this.compute();this.emit()},0)}touchStart(b){this.ctrl.setEventIds(b);
var g=this.state;const m=this.ctrl.touchIds;g._active&&g._touchIds.every(I=>m.has(I))||2>m.size||(this.start(b),g._touchIds=Array.from(m).slice(0,2),g=Em(b,g._touchIds),this.pinchStart(b,g))}pointerStart(b){if(null==b.buttons||1===b.buttons%2){this.ctrl.setEventIds(b);b.target.setPointerCapture(b.pointerId);var g=this.state,m=g._pointerEvents,I=this.ctrl.pointerIds;g._active&&Array.from(m.keys()).every(W=>I.has(W))||(2>m.size&&m.set(b.pointerId,b),2>g._pointerEvents.size||(this.start(b),g=wj(...Array.from(m.values())),
this.pinchStart(b,g)))}}pinchStart(b,g){this.state.origin=g.origin;this.computeValues([g.distance,g.angle]);this.computeInitial();this.compute(b);this.emit()}touchMove(b){if(this.state._active){var g=Em(b,this.state._touchIds);this.pinchMove(b,g)}}pointerMove(b){var g=this.state._pointerEvents;g.has(b.pointerId)&&g.set(b.pointerId,b);this.state._active&&(g=wj(...Array.from(g.values())),this.pinchMove(b,g))}pinchMove(b,g){const m=this.state,I=g.angle-m._values[1];let W=0;270<Math.abs(I)&&(W+=Math.sign(I));
this.computeValues([g.distance,g.angle-360*W]);m.origin=g.origin;m.turns=W;m._movement=[m._values[0]/m._initial[0]-1,m._values[1]-m._initial[1]];this.compute(b);this.emit()}touchEnd(b){this.ctrl.setEventIds(b);this.state._active&&this.state._touchIds.some(g=>!this.ctrl.touchIds.has(g))&&(this.state._active=!1,this.compute(b),this.emit())}pointerEnd(b){const g=this.state;this.ctrl.setEventIds(b);try{b.target.releasePointerCapture(b.pointerId)}catch(m){}g._pointerEvents.has(b.pointerId)&&g._pointerEvents.delete(b.pointerId);
g._active&&2>g._pointerEvents.size&&(g._active=!1,this.compute(b),this.emit())}gestureStart(b){b.cancelable&&b.preventDefault();const g=this.state;g._active||(this.start(b),this.computeValues([b.scale,b.rotation]),g.origin=[b.clientX,b.clientY],this.compute(b),this.emit())}gestureMove(b){b.cancelable&&b.preventDefault();if(this.state._active){var g=this.state;this.computeValues([b.scale,b.rotation]);g.origin=[b.clientX,b.clientY];var m=g._movement;g._movement=[b.scale-1,b.rotation];g._delta=Hk.sub(g._movement,
m);this.compute(b);this.emit()}}gestureEnd(b){this.state._active&&(this.state._active=!1,this.compute(b),this.emit())}wheel(b){const g=this.config.modifierKey;if(!g||b[g])this.state._active?this.wheelChange(b):this.wheelStart(b),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelStart(b){this.start(b);this.wheelChange(b)}wheelChange(b){"uv"in b||b.cancelable&&b.preventDefault();const g=this.state;g._delta=[-Sj(b)[1]/100*g.offset[0],0];Hk.addTo(g._movement,g._delta);mi(g);this.state.origin=
[b.clientX,b.clientY];this.compute(b);this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(b){const g=this.config.device;g&&(b(g,"start",this[g+"Start"].bind(this)),b(g,"change",this[g+"Move"].bind(this)),b(g,"end",this[g+"End"].bind(this)),b(g,"cancel",this[g+"End"].bind(this)));this.config.pinchOnWheel&&b("wheel","",this.wheel.bind(this),{passive:!1})}},bD=Ag(Ag({},wy),{},{device(b,g,{shared:m,pointer:{touch:I=!1}={}}){if(m.target&&!Fs&&iD)return"gesture";
if(Fs&&I)return"touch";if(zy){if(uy)return"pointer";if(Fs)return"touch"}},bounds(b,g,{scaleBounds:m={},angleBounds:I={}}){const W=ua=>{ua=Mh(m,ua);ua=Object.assign({},{min:-Infinity,max:Infinity},ua||{});return[ua.min,ua.max]},ia=ua=>{ua=Mh(I,ua);ua=Object.assign({},{min:-Infinity,max:Infinity},ua||{});return[ua.min,ua.max]};return"function"!==typeof m&&"function"!==typeof I?[W(),ia()]:ua=>[W(ua),ia(ua)]},threshold(b,g,m){this.lockDirection="lock"===m.axis;return Hk.toVector(b,this.lockDirection?
[.1,3]:0)},modifierKey(b){return void 0===b?"ctrlKey":b},pinchOnWheel(b=!0){return b}}),YC=class extends Gs{constructor(...b){super(...b);Xg(this,"ingKey","moving")}move(b){this.config.mouseOnly&&"mouse"!==b.pointerType||(this.state._active?this.moveChange(b):this.moveStart(b),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(b){this.start(b);this.computeValues(fi(b));this.compute(b);this.computeInitial();this.emit()}moveChange(b){if(this.state._active){var g=fi(b),m=this.state;
m._delta=Hk.sub(g,m._values);Hk.addTo(m._movement,m._delta);this.computeValues(g);this.compute(b);this.emit()}}moveEnd(b){this.state._active&&(this.state._active=!1,this.compute(b),this.emit())}bind(b){b("pointer","change",this.move.bind(this));b("pointer","leave",this.moveEnd.bind(this))}},ZC=Ag(Ag({},Kq),{},{mouseOnly:(b=!0)=>b}),WC=class extends Gs{constructor(...b){super(...b);Xg(this,"ingKey","scrolling")}scroll(b){this.state._active||this.start(b);this.scrollChange(b);this.timeoutStore.add("scrollEnd",
this.scrollEnd.bind(this))}scrollChange(b){b.cancelable&&b.preventDefault();const g=this.state;var m,I;const {scrollX:W,scrollY:ia,scrollLeft:ua,scrollTop:La}=b.currentTarget;var Va=[null!==(m=null!==W&&void 0!==W?W:ua)&&void 0!==m?m:0,null!==(I=null!==ia&&void 0!==ia?ia:La)&&void 0!==I?I:0];g._delta=Hk.sub(Va,g._values);Hk.addTo(g._movement,g._delta);this.computeValues(Va);this.compute(b);this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(b){b("scroll",
"",this.scroll.bind(this))}},XC=Kq,SC=class extends Gs{constructor(...b){super(...b);Xg(this,"ingKey","wheeling")}wheel(b){this.state._active||this.start(b);this.wheelChange(b);this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(b){const g=this.state;g._delta=Sj(b);Hk.addTo(g._movement,g._delta);mi(g);this.compute(b);this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(b){b("wheel","",this.wheel.bind(this))}},TC=Kq,UC=class extends Gs{constructor(...b){super(...b);
Xg(this,"ingKey","hovering")}enter(b){this.config.mouseOnly&&"mouse"!==b.pointerType||(this.start(b),this.computeValues(fi(b)),this.compute(b),this.emit())}leave(b){if(!this.config.mouseOnly||"mouse"===b.pointerType){var g=this.state;if(g._active){g._active=!1;var m=fi(b);g._movement=g._delta=Hk.sub(m,g._values);this.computeValues(m);this.compute(b);g.delta=g.movement;this.emit()}}}bind(b){b("pointer","enter",this.enter.bind(this));b("pointer","leave",this.leave.bind(this))}},VC=Ag(Ag({},Kq),{},{mouseOnly:(b=
!0)=>b}),xv=new Map,wv=new Map,QC={key:"drag",engine:hD,resolver:$C},RC={key:"hover",engine:UC,resolver:VC},PC={key:"move",engine:YC,resolver:ZC},ip={key:"pinch",engine:aD,resolver:bD},yo={key:"scroll",engine:WC,resolver:XC},cD={key:"wheel",engine:SC,resolver:TC},vv=vb(V(22)),OC={target(b){if(b)return()=>"current"in b?b.current:b},enabled(b=!0){return b},window(b=Lq?window:void 0){return b},eventOptions({passive:b=!0,capture:g=!1}={}){return{passive:b,capture:g}},transform(b){return b}},xD=["target",
"eventOptions","window","enabled","transform"],Qy=class{constructor(b,g){Xg(this,"_listeners",new Set);this._ctrl=b;this._gestureKey=g}add(b,g,m,I,W){const ia=this._listeners,ua=Di(g,m),La=Ag(Ag({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),W);b.addEventListener(ua,I,La);const Va=()=>{b.removeEventListener(ua,I,La);ia.delete(Va)};ia.add(Va);return Va}clean(){this._listeners.forEach(b=>b());this._listeners.clear()}},qy=class{constructor(){Xg(this,"_timeouts",new Map)}add(b,
g,m=140,...I){this.remove(b);this._timeouts.set(b,window.setTimeout(g,m,...I))}remove(b){(b=this._timeouts.get(b))&&window.clearTimeout(b)}clean(){this._timeouts.forEach(b=>void window.clearTimeout(b));this._timeouts.clear()}},ry=class{constructor(b){Xg(this,"gestures",new Set);Xg(this,"_targetEventStore",new Qy(this));Xg(this,"gestureEventStores",{});Xg(this,"gestureTimeoutStores",{});Xg(this,"handlers",{});Xg(this,"config",{});Xg(this,"pointerIds",new Set);Xg(this,"touchIds",new Set);Xg(this,"state",
{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}});b.drag&&zg(this,"drag");b.wheel&&zg(this,"wheel");b.scroll&&zg(this,"scroll");b.move&&zg(this,"move");b.pinch&&zg(this,"pinch");b.hover&&zg(this,"hover")}setEventIds(b){if("touches"in b)return this.touchIds=new Set(Fl(b));if("pointerId"in b)return"pointerup"===b.type||"pointercancel"===b.type?this.pointerIds.delete(b.pointerId):"pointerdown"===b.type&&this.pointerIds.add(b.pointerId),this.pointerIds}applyHandlers(b,g){this.handlers=b;this.nativeHandlers=
g}applyConfig(b,g){this.config=fj(b,g,this.config)}clean(){this._targetEventStore.clean();for(const b of this.gestures)this.gestureEventStores[b].clean(),this.gestureTimeoutStores[b].clean()}effect(){this.config.shared.target&&this.bind();return()=>this._targetEventStore.clean()}bind(...b){var g=this.config.shared;const m={};let I;if(g.target&&(I=g.target(),!I))return;if(g.enabled){for(const W of this.gestures){const ia=this.config[W],ua=py(m,ia.eventOptions,!!I);ia.enabled&&(new (xv.get(W))(this,
b,W)).bind(ua)}g=py(m,g.eventOptions,!!I);for(const W in this.nativeHandlers)g(W,"",ia=>this.nativeHandlers[W](Ag(Ag({},this.state.shared),{},{event:ia,args:b})),void 0,!0)}for(const W in m)m[W]=Nh(...m[W]);if(!I)return m;for(const W in m){const {device:ia,capture:ua,passive:La}=Kh(W);this._targetEventStore.add(I,ia,"",m[W],{capture:ua,passive:La})}}},py=(b,g,m)=>(I,W,ia,ua={},La=!1)=>{var Va,$a;const lb=null!==(Va=ua.capture)&&void 0!==Va?Va:g.capture;ua=null!==($a=ua.passive)&&void 0!==$a?$a:g.passive;
I=La?I:yk(I,W,lb);m&&ua&&(I+="Passive");b[I]=b[I]||[];b[I].push(ia)},yv=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/,Jq=vb(V(22)),zv=vb(V(22)),Ry=vb(V(22)),Iy=vb(V(22)),yD=vb(V(22)),zD=vb(V(22)),AD=vb(V(22)),BD=vb(V(22)),CD={none:(b,g)=>"none",["default"]:(b,g)=>"default",pointer:(b,g)=>"pointer",crosshair:(b,g)=>"crosshair",move:(b,g)=>"move",wait:(b,g)=>"wait",progress:(b,g)=>"progress",grab:(b,g)=>qj('\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',
b,g),grabbing:(b,g)=>qj("\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",
b,g),text:(b,g)=>qj("\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",
b,g),["resize-edge"]:(b,g)=>qj("\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",b,g),["resize-corner"]:(b,g)=>qj("\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",
b,g),["ew-resize"]:(b,g)=>qj("\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",b,g),["ns-resize"]:(b,g)=>qj("\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",
b+90,g),["nesw-resize"]:(b,g)=>qj("\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",b,g),["nwse-resize"]:(b,g)=>qj("\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",
b+90,g),rotate:(b,g)=>qj('\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',
b+45,g),["nwse-rotate"]:(b,g)=>qj('\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',
b,g),["nesw-rotate"]:(b,g)=>qj('\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',
b+90,g),["senw-rotate"]:(b,g)=>qj('\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',
b+180,g),["swne-rotate"]:(b,g)=>qj('\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',
b+270,g)},DD=vb(V(22));vb(V(22));var Sy=V(22),Ty=vb(V(22));if(!V(22).useState)throw Error("mobx-react-lite requires React with Hooks support");if(!pg)throw Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var ED=V(31),Hs=vb(V(22)),Uy="undefined"===typeof FinalizationRegistry?void 0:FinalizationRegistry,FD=1E4,pD=function(b){var g="function"===typeof Symbol&&Symbol.iterator,m=g&&b[g],I=0;if(m)return m.call(b);if(b&&"number"===typeof b.length)return{next:function(){b&&I>=
b.length&&(b=void 0);return{value:b&&b[I++],done:!b}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.");},Hy=Uy?rg(Uy):bm(),qD=Hy.addReactionToTrack,nD=Hy.recordReactionAsCommitted,Gy=function(b,g){var m="function"===typeof Symbol&&b[Symbol.iterator];if(!m)return b;b=m.call(b);var I,W=[];try{for(;(void 0===g||0<g--)&&!(I=b.next()).done;)W.push(I.value)}catch(ua){var ia={error:ua}}finally{try{I&&!I.done&&(m=b["return"])&&m.call(b)}finally{if(ia)throw ia.error;}}return W},
oD=function(){return function(){}}(),zr=V(22),Dy="function"===typeof Symbol&&Symbol.for,Ey=Dy?Symbol.for("react.forward_ref"):"function"===typeof zr.forwardRef&&(0,zr.forwardRef)(function(b){return null}).$$typeof,Fy=Dy?Symbol.for("react.memo"):"function"===typeof zr.memo&&(0,zr.memo)(function(b){return null}).$$typeof,kD={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};Mi.displayName="Observer";V(22);V(22);V(22);(function(b){b||=Tj;Me({reactionScheduler:b})})(ED.unstable_batchedUpdates);
var lD=vb(V(22));rb=V(586);var zo=lD.forwardRef(function(b,g){var {children:m,opacity:I,centered:W,className:ia=""}=b,ua=Ya(b,["children","opacity","centered","className"]);return(0,rb.jsx)(Mi,{children:()=>(0,rb.jsx)("div",{ref:g,className:`tl-positioned-div ${ia}`,style:I?{opacity:I}:void 0,draggable:!1,children:(0,rb.jsx)("div",Ga(te({className:`tl-positioned-inner ${W?"tl-centered":""}`},ua),{children:m}))})})}),mD=vb(V(22));rb=V(586);var Zn=mD.forwardRef(function(b,g){var {id:m,className:I="",
style:W,children:ia}=b,ua=Ya(b,["id","className","style","children"]);return(0,rb.jsx)(Mi,{children:()=>(0,rb.jsx)("svg",{ref:g,style:W,className:`tl-positioned-svg ${I}`,children:(0,rb.jsx)("g",Ga(te({id:m,className:"tl-centered-g"},ua),{children:ia}))})})}),Is=vb(V(22)),Vy=vb(V(22)),It=vb(V(22));rb=V(586);var Kp=sf(function(b){var {id:g,bounds:m,zIndex:I,rotation:W=0,className:ia="",children:ua}=b;b=Ya(b,"id bounds zIndex rotation className children".split(" "));const La=It.useRef(null);It.useLayoutEffect(()=>
{La.current.style.transform=`translate(
        calc(${m.minX}px - var(--tl-padding)),
        calc(${m.minY}px - var(--tl-padding)))
        rotate(${W+(m.rotation||0)}rad)`},[m.minX,m.minY,W,m.rotation]);It.useLayoutEffect(()=>{const Va=La.current;Va.style.width=`calc(${Math.floor(m.width)}px + (var(--tl-padding) * 2))`;Va.style.height=`calc(${Math.floor(m.height)}px + (var(--tl-padding) * 2))`},[m.width,m.height]);It.useLayoutEffect(()=>{const Va=La.current;void 0!==I&&(Va.style.zIndex=I.toString())},[I]);return(0,rb.jsx)("div",Ga(te({id:g,ref:La,className:`tl-positioned ${ia}`,"aria-label":"container"},b),{children:ua}))}),
GD=vb(V(22));rb=V(586);var Cv=b=>b.stopPropagation(),HD=sf(function({shapes:b,hidden:g,bounds:m,rotation:I=0}){const {components:{ContextBar:W},viewport:{bounds:ia,camera:{point:[ua,La],zoom:Va}}}=Ki(),$a=GD.useRef(null);var lb=We.getRotatedBounds(m,I);lb=We.multiplyBounds(lb,Va);ok($a,m,I,10005);if(!W)throw Error("Expected a ContextBar component.");const ub=We.translateBounds(lb,[ua*Va,La*Va]);return(0,rb.jsx)("div",{ref:$a,className:"tl-counter-scaled-positioned","aria-label":"context-bar-container",
onPointerMove:Cv,onPointerUp:Cv,onPointerDown:Cv,children:(0,rb.jsx)(W,{hidden:g,shapes:b,bounds:m,offsets:{left:ub.minX,right:ia.width-ub.maxX,top:ub.minY,bottom:ia.height-ub.maxY,width:ub.width,height:ub.height},scaledBounds:lb,rotation:I})})}),Wy=vb(V(22));rb=V(586);var ID=sf(function({children:b}){const g=Wy.useRef(null),{viewport:m}=Ki();Wy.useEffect(()=>Od(()=>{const I=g.current;if(I){var {zoom:W,point:ia}=m.camera;I.style.setProperty("transform",`scale(${W}) translate3d(${ia[0]}px, ${ia[1]}px, 0)`)}}),
[]);return(0,rb.jsx)("div",{ref:g,className:"tl-absolute tl-layer",children:b})});rb=V(586);var Cy=sf(function({shape:b,isHovered:g=!1,isSelected:m=!1,isBinding:I=!1,isEditing:W=!1,meta:ia}){const {bounds:ua,props:{scale:La,rotation:Va=0},ReactIndicator:$a}=b;return(0,rb.jsx)(Kp,{"data-type":"Indicator",bounds:ua,rotation:Va,scale:La,zIndex:W?1E3:1E4,children:(0,rb.jsx)(Zn,{children:(0,rb.jsx)("g",{className:`tl-indicator-container ${m?"tl-selected":"tl-hovered"}`,children:(0,rb.jsx)($a,{isEditing:W,
isBinding:I,isHovered:g,isSelected:m,isErasing:!1,meta:ia})})})})}),Xy=vb(V(22));rb=V(586);var JD=sf(function({bounds:b,shape:g}){const {viewport:{camera:{zoom:m}},components:{QuickLinks:I}}=Ki();var W=xg();const ia=ek(g);if(!I)throw Error("Expected a QuickLinks component.");W=50>b.height*m||!W.selectedShapesArray.includes(g);return(0,rb.jsx)(Kp,{bounds:b,className:"tl-quick-links-container",children:(0,rb.jsx)(zo,{children:(0,rb.jsx)("span",Ga(te({style:{position:"absolute",top:"100%",pointerEvents:"all",
transformOrigin:"left top",paddingTop:"8px",transform:"scale(var(--tl-scale))",minWidth:"320px"}},ia),{onPointerDown:ua=>ua.stopPropagation(),children:(0,rb.jsx)(I,{className:"tl-backlinks-count "+(W?"tl-backlinks-count-rounded":""),id:g.id,shape:g})}))})})});rb=V(586);var KD=sf(function({bounds:b,shape:g}){const {viewport:{camera:{zoom:m}},components:{BacklinksCount:I}}=Ki();var W=xg();if(!I)throw Error("Expected a BacklinksCount component.");const ia=ua=>ua.stopPropagation();W=50>b.height*m||!W.selectedShapesArray.includes(g)||
g.hideSelection;return(0,rb.jsx)(Kp,{bounds:b,className:"tl-backlinks-count-container",children:(0,rb.jsx)(zo,{children:(0,rb.jsx)("span",{style:{position:"absolute",left:"100%",pointerEvents:"all",transformOrigin:"left top",transform:"translateY(6px) scale(var(--tl-scale))"},onPointerDown:ia,onWheelCapture:ia,title:"Shape Backlinks",children:(0,rb.jsx)(I,{className:"tl-backlinks-count "+(W?"tl-backlinks-count-rounded":""),id:g.id,shape:g})})})})}),LD=vb(V(22));rb=V(586);var MD=sf(function({bounds:b,
hidden:g,shapes:m,rotation:I=0,detail:W="size"}){const {components:{SelectionDetail:ia},viewport:{camera:{zoom:ua}}}=Ki(),La=LD.useRef(null),Va=We.multiplyBounds(b,ua);ok(La,b,I,10003);if(!ia)throw Error("Expected a SelectionDetail component.");return(0,rb.jsx)("div",{ref:La,className:`tl-counter-scaled-positioned ${g?"tl-fade-out":""}`,"aria-label":"bounds-detail-container",children:(0,rb.jsx)(ia,{shapes:m,bounds:b,scaledBounds:Va,zoom:ua,rotation:I,detail:W})})});rb=V(586);var ND=sf(function({shape:b,
isHovered:g=!1,isSelected:m=!1,isBinding:I=!1,isErasing:W=!1,isEditing:ia=!1,onEditingEnd:ua,asset:La,meta:Va,zIndex:$a}){const {bounds:lb,props:{rotation:ub,scale:Rb},ReactComponent:ec}=b,Vb=ek(b);return(0,rb.jsx)(Kp,{"data-shape-id":b.id,zIndex:$a,"data-type":"Shape",bounds:lb,rotation:ub,scale:Rb,children:(0,rb.jsx)(ec,{meta:Va,isEditing:ia,isBinding:I,isHovered:g,isSelected:m,isErasing:W,events:Vb,asset:La,onEditingEnd:ua})})});rb=V(586);var Yy=[[-1,.15,64],[.05,.375,16],[.15,1,4],[.7,2.5,1]],
OD=sf(function({size:b}){const {viewport:{camera:{point:g,zoom:m}}}=Ki();return(0,rb.jsxs)("svg",{className:"tl-grid",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[(0,rb.jsx)("defs",{children:Yy.map(([I,W,ia],ua)=>{ia=ia*b*m;var La=g[0]*m,Va=g[1]*m;La=0<La?La%ia:ia+La%ia;Va=0<Va?Va%ia:ia+Va%ia;I=Cl(m,[I,W],[0,1]);return(0,rb.jsx)("pattern",{id:`grid-${ua}`,width:ia,height:ia,patternUnits:"userSpaceOnUse",children:!(2<I||.1>I)&&(0,rb.jsx)("circle",{className:"tl-grid-dot",cx:La,cy:Va,
r:1.5,opacity:Math.max(0,Math.min(I,1))})},`grid-pattern-${ua}`)})}),Yy.map((I,W)=>(0,rb.jsx)("rect",{width:"100%",height:"100%",fill:`url(#grid-${W})`},`grid-rect-${W}`))]})}),Zy=sf(function({size:b}){return(0,rb.jsx)(OD,{size:b})});rb=V(586);var $y=sf(function({bounds:b}){const g=lk("background");return(0,rb.jsx)(Zn,Ga(te({},g),{children:(0,rb.jsx)("rect",{className:"tl-bounds-bg",width:Math.max(1,b.width),height:Math.max(1,b.height),pointerEvents:"all",rx:8,ry:8})}))});V(22);rb=V(586);var Jy=sf(function({scaledBounds:b,
shapes:g,detail:m="size",rotation:I=0}){var W;const ia=1===g.length?I:null!=(W=b.rotation)?W:0;return(0,rb.jsx)(zo,{centered:!0,children:(0,rb.jsx)("div",{className:"tl-bounds-detail",style:{transform:ia<Gm||ia>3*Gm?`rotate(${ia}rad) translateY(${b.height/2+24}px)`:`rotate(${Math.PI+ia}rad) translateY(${b.height/2+32}px)`,padding:"2px 3px",borderRadius:"1px"},children:1===g.length&&"line"===g[0].type?`${Zd.dist(g[0].props.handles.start.point,g[0].props.handles.end.point).toFixed()}`:"size"===m?`${b.width.toFixed()} \xD7 ${b.height.toFixed()}`:
`\u2220${Si.radiansToDegrees(Si.clampRadians(I)).toFixed()}\xB0`})})});rb=V(586);var rD={top_left_corner:"tl-cursor-nwse",top_right_corner:"tl-cursor-nesw",bottom_right_corner:"tl-cursor-nwse",bottom_left_corner:"tl-cursor-nesw"},Kt=sf(function({cx:b,cy:g,size:m,targetSize:I,corner:W,isHidden:ia}){const ua=lk(W);return(0,rb.jsxs)("g",Ga(te({opacity:ia?0:1},ua),{children:[(0,rb.jsx)("rect",{className:"tl-transparent "+(ia?"":rD[W]),"aria-label":`${W} target`,x:b-1.25*I,y:g-1.25*I,width:2.5*I,height:2.5*
I,pointerEvents:ia?"none":"all"}),(0,rb.jsx)("rect",{className:"tl-corner-handle","aria-label":`${W} handle`,x:b-m/2,y:g-m/2,width:m,height:m,pointerEvents:"none"})]}))});rb=V(586);var uD={top_edge:"tl-cursor-ns",right_edge:"tl-cursor-ew",bottom_edge:"tl-cursor-ns",left_edge:"tl-cursor-ew"},Lt=sf(function({x:b,y:g,width:m,height:I,targetSize:W,edge:ia,disabled:ua,isHidden:La}){const Va=lk(ia);return(0,rb.jsx)("rect",te({pointerEvents:La||ua?"none":"all",className:"tl-transparent tl-edge-handle "+
(La?"":uD[ia]),"aria-label":`${ia} target`,opacity:La?0:1,x:b-W,y:g-W,width:Math.max(1,m+2*W),height:Math.max(1,I+2*W)},Va))});V(22);rb=V(586);sf(function({cx:b,cy:g,size:m,targetSize:I,isHidden:W}){const ia=lk("rotate");return(0,rb.jsxs)("g",Ga(te({opacity:W?0:1},ia),{children:[(0,rb.jsx)("circle",{className:"tl-transparent ","aria-label":"rotate target",cx:b,cy:g,r:I,pointerEvents:W?"none":"all"}),(0,rb.jsx)("circle",{className:"tl-rotate-handle","aria-label":"rotate handle",cx:b,cy:g,r:m/2,pointerEvents:"none"})]}))});
V(22);rb=V(586);var Jt=sf(function({cx:b,cy:g,targetSize:m,corner:I,isHidden:W}){const ia=lk(I);return(0,rb.jsx)("g",Ga(te({opacity:W?0:1},ia),{children:(0,rb.jsx)("rect",{className:"tl-transparent","aria-label":`${I} target`,x:b-2.5*m,y:g-2.5*m,width:3*m,height:3*m,pointerEvents:W?"none":"all"})}))});rb=V(586);var Ny=sf(function({bounds:b,showResizeHandles:g,showRotateHandles:m,shapes:I}){var W,ia,ua=xg();let {width:La,height:Va}=b;var $a=ua.viewport.camera.zoom;b=8/$a;$a=6/$a;I=1===I.length?I[0].canResize:
[!0,!0];ua=null!=(ia=null==(W=ua.editingShape)?void 0:W.props.borderRadius)?ia:0;return(0,rb.jsxs)(Zn,{children:[(0,rb.jsx)("rect",{className:"tl-bounds-fg",width:Math.max(La,1),height:Math.max(Va,1),rx:ua,ry:ua,pointerEvents:"none"}),(0,rb.jsx)(Lt,{x:2*$a,y:0,width:La-4*$a,height:0,targetSize:$a,edge:"top_edge",disabled:!I[1],isHidden:!g}),(0,rb.jsx)(Lt,{x:La,y:2*$a,width:0,height:Va-4*$a,targetSize:$a,edge:"right_edge",disabled:!I[0],isHidden:!g}),(0,rb.jsx)(Lt,{x:2*$a,y:Va,width:La-4*$a,height:0,
targetSize:$a,edge:"bottom_edge",disabled:!I[1],isHidden:!g}),(0,rb.jsx)(Lt,{x:0,y:2*$a,width:0,height:Va-4*$a,targetSize:$a,edge:"left_edge",disabled:!I[0],isHidden:!g}),(0,rb.jsx)(Jt,{cx:0,cy:0,targetSize:$a,corner:"top_left_resize_corner",isHidden:!m}),(0,rb.jsx)(Jt,{cx:La+2*$a,cy:0,targetSize:$a,corner:"top_right_resize_corner",isHidden:!m}),(0,rb.jsx)(Jt,{cx:La+2*$a,cy:Va+2*$a,targetSize:$a,corner:"bottom_right_resize_corner",isHidden:!m}),(0,rb.jsx)(Jt,{cx:0,cy:Va+2*$a,targetSize:$a,corner:"bottom_left_resize_corner",
isHidden:!m}),(null==I?void 0:I.every(lb=>lb))&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)(Kt,{cx:0,cy:0,size:b,targetSize:$a,corner:"top_left_corner",isHidden:!g}),(0,rb.jsx)(Kt,{cx:La,cy:0,size:b,targetSize:$a,corner:"top_right_corner",isHidden:!g}),(0,rb.jsx)(Kt,{cx:La,cy:Va,size:b,targetSize:$a,corner:"bottom_right_corner",isHidden:!g}),(0,rb.jsx)(Kt,{cx:0,cy:Va,size:b,targetSize:$a,corner:"bottom_left_corner",isHidden:!g})]})]})});rb=V(586);var My=sf(function({bounds:b}){return(0,rb.jsx)(Kp,
{bounds:b,zIndex:10001,children:(0,rb.jsx)(Zn,{children:(0,rb.jsx)("rect",{className:"tl-brush",x:0,y:0,width:b.width,height:b.height})})})});rb=V(586);sf(function(){return(0,rb.jsx)(rb.Fragment,{})});rb=V(586);var Py=sf(function({shape:b,handle:g,id:m}){b=nl(b,m);const [I,W]=g.point;return(0,rb.jsxs)("g",Ga(te({className:"tl-handle","aria-label":"handle"},b),{transform:`translate(${I}, ${W})`,children:[(0,rb.jsx)("circle",{className:"tl-handle-bg",pointerEvents:"all"}),(0,rb.jsx)("circle",{className:"tl-counter-scaled tl-handle",
pointerEvents:"none",r:4})]}))}),Oy=vb(V(22));rb=V(586);var Av=sf(function({direction:b}){const {viewport:{bounds:g}}=Ki(),m=Oy.useRef(null);Oy.useLayoutEffect(()=>{const I=m.current;if(I){var W=[g.width/2,g.height/2],ia=We.getRectangleSides([12,12],[g.width-24,g.height-24]);for(const [,[ua,La]]of ia)ia=r(W,b,ua,La),ia.didIntersect&&(ia=ia.points[0],I.style.setProperty("transform",`translate(${ia[0]-6}px,${ia[1]-6}px) rotate(${Zd.toAngle(b)}rad)`))}},[b,g]);return(0,rb.jsx)("div",{ref:m,className:"tl-direction-indicator",
children:(0,rb.jsx)("svg",{height:12,width:12,children:(0,rb.jsx)("polygon",{points:"0,0 12,6 0,12"})})})});rb=V(586);var tD=sf(function({id:b,className:g,brush:m,shapes:I,assets:W,bindingShapes:ia,editingShape:ua,hoveredShape:La,hoveredGroup:Va,selectionBounds:$a,selectedShapes:lb,erasingShapes:ub,selectionDirectionHint:Rb,cursor:ec="default",cursorRotation:Vb=0,selectionRotation:tc=0,showSelection:oc=!0,showHandles:Xb=!0,showSelectionRotation:sc=!1,showResizeHandles:Hc=!0,showRotateHandles:Rc=!0,
showSelectionDetail:Vc=!0,showContextBar:Vd=!0,showGrid:ae=!0,gridSize:De=8,onEditingEnd:Oe=LC,theme:tf=Nl,children:of}){var bf;const Ge=Is.useRef(null),{viewport:Fd,components:Oc,meta:md}=Ki(),zd=xg(),Md=Is.useCallback(ef=>{zd.inputs.updateContainerOffset([ef.minX,ef.minY])},[]);Zj(tf,b);Ak(Ge);Pj(Ge,Fd,Md);zi(Ge);pk();Ol(Ge,ec,Vb);sm(Ge);Bk(Ge);b=jg();const Ae=(ec=1===(null==lb?void 0:lb.length)&&lb[0])&&"handles"in ec.props?null==lb?void 0:lb[0]:void 0,Ie=Is.useMemo(()=>new Set(lb||[]),[lb]),qf=
Is.useMemo(()=>new Set(ub||[]),[ub]);ec=1===(null==lb?void 0:lb.length)?lb[0]:void 0;Va=[...(new Set([Va,La]))].filter(Kg);return(0,rb.jsxs)("div",{ref:Ge,className:`tl-container ${null!=g?g:""}`,children:[(0,rb.jsxs)("div",Ga(te({tabIndex:-1,className:"tl-absolute tl-canvas"},b),{children:[ae&&Oc.Grid&&(0,rb.jsx)(Oc.Grid,{size:De}),(0,rb.jsxs)(ID,{children:[Oc.SelectionBackground&&lb&&$a&&oc&&(0,rb.jsx)(Kp,{"data-type":"SelectionBackground",bounds:$a,zIndex:2,children:(0,rb.jsx)(Oc.SelectionBackground,
{shapes:lb,bounds:$a,showResizeHandles:Hc,showRotateHandles:Rc})}),I&&I.map((ef,gf)=>(0,rb.jsx)(ND,{shape:ef,asset:W&&ef.props.assetId?W[ef.props.assetId]:void 0,isEditing:ef===ua,isHovered:ef===La,isBinding:null==ia?void 0:ia.includes(ef),isSelected:Ie.has(ef),isErasing:qf.has(ef),meta:md,zIndex:1E3+gf,onEditingEnd:Oe},"shape_"+ef.id)),!zd.isIn("select.pinching")&&(null==lb?void 0:lb.map(ef=>(0,rb.jsx)(Cy,{shape:ef,isEditing:ef===ua,isHovered:!1,isBinding:!1,isSelected:!0},"selected_indicator_"+
ef.id))),Va.map(ef=>ef!==ua&&(0,rb.jsx)(Cy,{shape:ef},"hovered_indicator_"+ef.id)),ec&&Oc.BacklinksCount&&(0,rb.jsx)(KD,{hidden:!1,bounds:ec.bounds,shape:ec}),La&&La!==ec&&Oc.QuickLinks&&(0,rb.jsx)(JD,{hidden:!1,bounds:La.bounds,shape:La}),m&&Oc.Brush&&(0,rb.jsx)(Oc.Brush,{bounds:m}),lb&&$a&&(0,rb.jsxs)(rb.Fragment,{children:[oc&&Oc.SelectionForeground&&(0,rb.jsx)(Kp,{"data-type":"SelectionForeground",bounds:$a,zIndex:ua&&lb.includes(ua)?1002:10002,children:(0,rb.jsx)(Oc.SelectionForeground,{shapes:lb,
bounds:$a,showResizeHandles:Hc,showRotateHandles:Rc})}),Xb&&Ae&&Oc.Handle&&(0,rb.jsx)(Kp,{"data-type":"onlySelectedShapeWithHandles",bounds:$a,zIndex:10003,children:(0,rb.jsx)(Zn,{children:Object.entries(null!=(bf=Ae.props.handles)?bf:{}).map(([ef,gf])=>Is.createElement(Oc.Handle,{key:`${gf.id}_handle_${gf.id}`,shape:Ae,handle:gf,id:ef}))})}),lb&&Oc.SelectionDetail&&(0,rb.jsx)(MD,{shapes:lb,bounds:$a,detail:sc?"rotation":"size",hidden:!Vc,rotation:tc},"detail"+lb.map(ef=>ef.id).join("")),lb&&Oc.ContextBar&&
(0,rb.jsx)(HD,{shapes:lb,hidden:!Vd,bounds:ec?ec.bounds:$a,rotation:ec?ec.props.rotation:0},"context"+lb.map(ef=>ef.id).join(""))]})]}),Rb&&$a&&lb&&(0,rb.jsx)(Av,{direction:Rb,bounds:$a,shapes:lb}),(0,rb.jsx)("div",{id:"tl-dev-tools-canvas-anchor"})]})),of]})}),Ly=vb(V(22)),Ky=vb(V(22));rb=V(586);sf(function({children:b}){const g=Ky.useRef(null),{viewport:m}=Ki();Ky.useEffect(()=>Od(()=>{const I=g.current;if(I){var {zoom:W,point:ia}=m.camera;I.style.setProperty("transform",`scale(${W}) translateX(${ia[0]}px) translateY(${ia[1]}px)`)}}),
[]);return(0,rb.jsx)("svg",{className:"tl-absolute tl-overlay",pointerEvents:"none",children:(0,rb.jsx)("g",{ref:g,pointerEvents:"none",children:b})})});rb=V(586);var sD=sf(function(b){const g=pj(b),m=Qj(b.id);en(g,b);hj(g,b);return(0,rb.jsx)(m.Provider,{value:g,children:b.children})});rb=V(586);var PD=sf(function({id:b="noid",viewport:g,inputs:m,callbacks:I=Nl,meta:W=Nl,components:ia=Nl,children:ua}){const [La,Va]=Ly.useState(()=>{const {Brush:lb,ContextBar:ub,DirectionIndicator:Rb,Grid:ec,Handle:Vb,
SelectionBackground:tc,SelectionDetail:oc,SelectionForeground:Xb}=ia,sc=Ya(ia,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return{id:b,viewport:g,inputs:m,callbacks:I,meta:W,components:Ga(te({},sc),{Brush:null===lb?void 0:My,ContextBar:ub,DirectionIndicator:null===Rb?void 0:Av,Grid:null===ec?void 0:Zy,Handle:null===Vb?void 0:Py,SelectionBackground:null===tc?void 0:$y,SelectionDetail:null===oc?void 0:Jy,SelectionForeground:null===
Xb?void 0:Ny})}});Ly.useLayoutEffect(()=>{const {Brush:lb,ContextBar:ub,DirectionIndicator:Rb,Grid:ec,Handle:Vb,SelectionBackground:tc,SelectionDetail:oc,SelectionForeground:Xb}=ia,sc=Ya(ia,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return Od(()=>{Va({id:b,viewport:g,inputs:m,callbacks:I,meta:W,components:Ga(te({},sc),{Brush:null===lb?void 0:My,ContextBar:ub,DirectionIndicator:null===Rb?void 0:Av,Grid:null===ec?void 0:Zy,Handle:null===
Vb?void 0:Py,SelectionBackground:null===tc?void 0:$y,SelectionDetail:null===oc?void 0:Jy,SelectionForeground:null===Xb?void 0:Ny})})})},[]);const $a=Cj(b);return(0,rb.jsx)($a.Provider,{value:La,children:ua})});rb=V(586);rb=V(586);var QD=sf(function(b){const g=xg();return(0,rb.jsx)(dm,te({viewport:g.viewport,inputs:g.inputs,callbacks:g._events,brush:g.brush,editingShape:g.editingShape,hoveredShape:g.hoveredShape,hoveredGroup:g.hoveredGroup,bindingShapes:g.bindingShapes,selectionDirectionHint:g.selectionDirectionHint,
selectionBounds:g.selectionBounds,selectedShapes:g.selectedShapesArray,erasingShapes:g.erasingShapesArray,shapes:g.shapes,assets:g.assets,showGrid:g.settings.showGrid,showSelection:g.showSelection,showSelectionRotation:g.showSelectionRotation,showResizeHandles:g.showResizeHandles,showRotateHandles:g.showRotateHandles,showSelectionDetail:g.showSelectionDetail,showContextBar:g.showContextBar,cursor:g.cursors.cursor,cursorRotation:g.cursors.rotation,selectionRotation:g.selectionRotation,onEditingEnd:g.clearEditingState},
b))});rb=V(586);var Br=vb(V(22)),Mt=vb(V(22));rb=V(586);var RD="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(" "),Oh=b=>{var {name:g,className:m}=b;b=Ya(b,["name","className"]);const I=RD.includes(g)?"tie tie-":"ti ti-";return(0,rb.jsx)("i",te({className:[I+g,m].join(" ")},
b))},gh=V(22),SD=V(22),Nq=V(22),un=V(22),Dv=V(22),TD=V(31),Jm=V(22),Oq=(0,Jm.forwardRef)((b,g)=>{var {children:m}=b;b=Ya(b,["children"]);const I=Jm.Children.toArray(m),W=I.find(Lk);if(W){const ia=W.props.children;m=I.map(ua=>ua===W?1<Jm.Children.count(ia)?Jm.Children.only(null):(0,Jm.isValidElement)(ia)?ia.props.children:null:ua);return(0,Jm.createElement)(Ev,re({},b,{ref:g}),(0,Jm.isValidElement)(ia)?(0,Jm.cloneElement)(ia,void 0,m):null)}return(0,Jm.createElement)(Ev,re({},b,{ref:g}),m)});Oq.displayName=
"Slot";var Ev=(0,Jm.forwardRef)((b,g)=>{const {children:m}=b;b=Ya(b,["children"]);return(0,Jm.isValidElement)(m)?(0,Jm.cloneElement)(m,Ga(te({},mg(b,m.props)),{ref:Zi(g,m.ref)})):1<Jm.Children.count(m)?Jm.Children.only(null):null});Ev.displayName="SlotClone";var az=({children:b})=>(0,Jm.createElement)(Jm.Fragment,null,b),tj="a button div h2 h3 img label li nav ol p span svg ul".split(" ").reduce((b,g)=>{const m=(0,Dv.forwardRef)((I,W)=>{var {asChild:ia}=I;I=Ya(I,["asChild"]);ia=ia?Oq:g;(0,Dv.useEffect)(()=>
{window[Symbol.for("radix-ui")]=!0},[]);return(0,Dv.createElement)(ia,re({},I,{ref:W}))});m.displayName=`Primitive.${g}`;return Ga(te({},b),{[g]:m})},{}),Fv=V(22),UD=V(22),bz,VD=(0,un.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Nt=(0,un.forwardRef)((b,g)=>{var m;const {disableOutsidePointerEvents:I=!1,onEscapeKeyDown:W,onPointerDownOutside:ia,onFocusOutside:ua,onInteractOutside:La,onDismiss:Va}=b,$a=Ya(b,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),
lb=(0,un.useContext)(VD),[ub,Rb]=(0,un.useState)(null),ec=null!==(m=null===ub||void 0===ub?void 0:ub.ownerDocument)&&void 0!==m?m:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Vb]=(0,un.useState)({});g=bh(g,Hc=>Rb(Hc));m=Array.from(lb.layers);var [tc]=[...lb.layersWithOutsidePointerEventsDisabled].slice(-1);tc=m.indexOf(tc);const oc=ub?m.indexOf(ub):-1;m=0<lb.layersWithOutsidePointerEventsDisabled.size;const Xb=oc>=tc;tc=rk(Hc=>{const Rc=Hc.target,Vc=[...lb.branches].some(Vd=>
Vd.contains(Rc));Xb&&!Vc&&(null===ia||void 0===ia||ia(Hc),null===La||void 0===La||La(Hc),Hc.defaultPrevented||null===Va||void 0===Va||Va())},ec);const sc=Dj(Hc=>{const Rc=Hc.target;[...lb.branches].some(Vc=>Vc.contains(Rc))||(null===ua||void 0===ua||ua(Hc),null===La||void 0===La||La(Hc),Hc.defaultPrevented||null===Va||void 0===Va||Va())},ec);If(Hc=>{oc===lb.layers.size-1&&(null===W||void 0===W||W(Hc),!Hc.defaultPrevented&&Va&&(Hc.preventDefault(),Va()))},ec);(0,un.useEffect)(()=>{if(ub)return I&&
(0===lb.layersWithOutsidePointerEventsDisabled.size&&(bz=ec.body.style.pointerEvents,ec.body.style.pointerEvents="none"),lb.layersWithOutsidePointerEventsDisabled.add(ub)),lb.layers.add(ub),ll(),()=>{I&&1===lb.layersWithOutsidePointerEventsDisabled.size&&(ec.body.style.pointerEvents=bz)}},[ub,ec,I,lb]);(0,un.useEffect)(()=>()=>{ub&&(lb.layers.delete(ub),lb.layersWithOutsidePointerEventsDisabled.delete(ub),ll())},[ub,lb]);(0,un.useEffect)(()=>{const Hc=()=>Vb({});document.addEventListener("dismissableLayer.update",
Hc);return()=>document.removeEventListener("dismissableLayer.update",Hc)},[]);return(0,un.createElement)(tj.div,re({},$a,{ref:g,style:te({pointerEvents:m?Xb?"auto":"none":void 0},b.style),onFocusCapture:Zf(b.onFocusCapture,sc.onFocusCapture),onBlurCapture:Zf(b.onBlurCapture,sc.onBlurCapture),onPointerDownCapture:Zf(b.onPointerDownCapture,tc.onPointerDownCapture)}))}),cz=vb(V(22)),WD=V(22),vn=(null===globalThis||void 0===globalThis?0:globalThis.document)?WD.useLayoutEffect:()=>{},XD=cz["useId".toString()]||
(()=>{}),YD=0,Wl=V(22),ZD=(b,g,m)=>vd(void 0,null,function*(){const {placement:I="bottom",strategy:W="absolute",middleware:ia=[],platform:ua}=m,La=yield null==ua.isRTL?void 0:ua.isRTL(g);let Va=yield ua.getElementRects({reference:b,floating:g,strategy:W}),{x:$a,y:lb}=sk(Va,I,La),ub=I,Rb={},ec=0;for(let Vb=0;Vb<ia.length;Vb++){const {name:tc,fn:oc}=ia[Vb],{x:Xb,y:sc,data:Hc,reset:Rc}=yield oc({x:$a,y:lb,initialPlacement:I,placement:ub,strategy:W,middlewareData:Rb,rects:Va,platform:ua,elements:{reference:b,
floating:g}});$a=null!=Xb?Xb:$a;lb=null!=sc?sc:lb;Rb=Ga(te({},Rb),{[tc]:te(te({},Rb[tc]),Hc)});Rc&&50>=ec&&(ec++,"object"==typeof Rc&&(Rc.placement&&(ub=Rc.placement),Rc.rects&&(Va=!0===Rc.rects?yield ua.getElementRects({reference:b,floating:g,strategy:W}):Rc.rects),{x:$a,y:lb}=sk(Va,ub,La)),Vb=-1)}return{x:$a,y:lb,placement:ub,strategy:W,middlewareData:Rb}}),Gv=Math.min,Hv=Math.max,dz=b=>({name:"arrow",options:b,fn(g){return vd(this,null,function*(){const {element:m,padding:I=0}=null!=b?b:{},{x:W,
y:ia,placement:ua,rects:La,platform:Va}=g;if(null==m)return{};const $a=al(I),lb={x:W,y:ia},ub=Ui(ua),Rb=ua.split("-")[1],ec=$k(ub);var Vb=yield Va.getDimensions(m);const tc="y"===ub?"top":"left",oc="y"===ub?"bottom":"right";var Xb=La.reference[ec]+La.reference[ub]-lb[ub]-La.floating[ec];const sc=lb[ub]-La.reference[ub];var Hc=yield null==Va.getOffsetParent?void 0:Va.getOffsetParent(m);let Rc=Hc?"y"===ub?Hc.clientHeight||0:Hc.clientWidth||0:0;0===Rc&&(Rc=La.floating[ec]);Hc=$a[tc];const Vc=Rc-Vb[ec]-
$a[oc];Vb=Rc/2-Vb[ec]/2+(Xb/2-sc/2);Xb=Hv(Hc,Gv(Vb,Vc));return{[ub]:lb[ub]-(0<("start"===Rb?$a[tc]:$a[oc])&&Vb!==Xb&&La.reference[ec]<=La.floating[ec]?Vb<Hc?Hc-Vb:Vc-Vb:0),data:{[ub]:Xb,centerOffset:Vb-Xb}}})}}),$D={left:"right",right:"left",bottom:"top",top:"bottom"},aE={start:"end",end:"start"},ez=["top","right","bottom","left"];ez.reduce((b,g)=>b.concat(g,g+"-start",g+"-end"),[]);var bE=function(b){return void 0===b&&(b={}),{name:"flip",options:b,fn(g){return vd(this,null,function*(){var m;const {placement:I,
middlewareData:W,rects:ia,initialPlacement:ua,platform:La,elements:Va}=g;var $a=b;const {mainAxis:lb=!0,crossAxis:ub=!0,fallbackPlacements:Rb,fallbackStrategy:ec="bestFit",flipAlignment:Vb=!0}=$a;$a=Ya($a,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]);const tc=ui(I);var oc=Rb||(tc!==ua&&Vb?function(Vd){const ae=ml(Vd);return[Mk(Vd),ae,Mk(ae)]}(ua):[ml(ua)]);oc=[ua,...oc];const Xb=yield Fm(g,$a),sc=[];$a=(null==(m=W.flip)?void 0:m.overflows)||[];if(lb&&sc.push(Xb[tc]),
ub){const {main:Vd,cross:ae}=Qm(I,ia,yield null==La.isRTL?void 0:La.isRTL(Va.floating));sc.push(Xb[Vd],Xb[ae])}if($a=[...$a,{placement:I,overflows:sc}],!sc.every(Vd=>0>=Vd)){var Hc,Rc;m=(null!=(Hc=null==(Rc=W.flip)?void 0:Rc.index)?Hc:0)+1;if(Hc=oc[m])return{data:{index:m,overflows:$a},reset:{placement:Hc}};Hc="bottom";switch(ec){case "bestFit":var Vc;(Rc=null==(Vc=$a.map(Vd=>[Vd,Vd.overflows.filter(ae=>0<ae).reduce((ae,De)=>ae+De,0)]).sort((Vd,ae)=>Vd[1]-ae[1])[0])?void 0:Vc[0].placement)&&(Hc=Rc);
break;case "initialPlacement":Hc=ua}if(I!==Hc)return{reset:{placement:Hc}}}return{}})}}},cE=function(b){b=void 0===b?{}:b;let {strategy:g="referenceHidden"}=b,m=Ya(b,["strategy"]);return{name:"hide",fn(I){return vd(this,null,function*(){var {rects:W}=I;switch(g){case "referenceHidden":return W=Fj(yield Fm(I,Ga(te({},m),{elementContext:"reference"})),W.reference),{data:{referenceHiddenOffsets:W,referenceHidden:Ck(W)}};case "escaped":return W=Fj(yield Fm(I,Ga(te({},m),{altBoundary:!0})),W.floating),
{data:{escapedOffsets:W,escaped:Ck(W)}};default:return{}}})}}},dE=function(b){return void 0===b&&(b=0),{name:"offset",options:b,fn(g){return vd(this,null,function*(){const {x:m,y:I}=g,W=yield function(ia,ua){return vd(this,null,function*(){const {placement:La,platform:Va,elements:$a}=ia;var lb=yield null==Va.isRTL?void 0:Va.isRTL($a.floating),ub=ui(La);const Rb=La.split("-")[1],ec="x"===Ui(La);ub=["left","top"].includes(ub)?-1:1;lb=lb&&ec?-1:1;const Vb="function"==typeof ua?ua(ia):ua;let {mainAxis:tc,
crossAxis:oc,alignmentAxis:Xb}="number"==typeof Vb?{mainAxis:Vb,crossAxis:0,alignmentAxis:null}:te({mainAxis:0,crossAxis:0,alignmentAxis:null},Vb);return Rb&&"number"==typeof Xb&&(oc="end"===Rb?-1*Xb:Xb),ec?{x:oc*lb,y:tc*ub}:{x:tc*ub,y:oc*lb}})}(g,b);return{x:m+W.x,y:I+W.y,data:W}})}}},eE=function(b){return void 0===b&&(b={}),{name:"shift",options:b,fn(g){return vd(this,null,function*(){const {x:m,y:I,placement:W}=g;var ia=b;const {mainAxis:ua=!0,crossAxis:La=!1,limiter:Va={fn:ec=>{let {x:Vb,y:tc}=
ec;return{x:Vb,y:tc}}}}=ia;var $a=Ya(ia,["mainAxis","crossAxis","limiter"]);ia={x:m,y:I};$a=yield Fm(g,$a);const lb=Ui(ui(W)),ub="x"===lb?"y":"x";let Rb=ia[lb];ia=ia[ub];ua&&(Rb=Hv(Rb+$a["y"===lb?"top":"left"],Gv(Rb,Rb-$a["y"===lb?"bottom":"right"])));La&&(ia=Hv(ia+$a["y"===ub?"top":"left"],Gv(ia,ia-$a["y"===ub?"bottom":"right"])));ia=Va.fn(Ga(te({},g),{[lb]:Rb,[ub]:ia}));return Ga(te({},ia),{data:{x:ia.x-m,y:ia.y-I}})})}}},fE=function(b){return void 0===b&&(b={}),{options:b,fn(g){const {x:m,y:I,
placement:W,rects:ia,middlewareData:ua}=g,{offset:La=0,mainAxis:Va=!0,crossAxis:$a=!0}=b;var lb={x:m,y:I};g=Ui(W);const ub="x"===g?"y":"x";let Rb=lb[g];lb=lb[ub];var ec="function"==typeof La?La(Ga(te({},ia),{placement:W})):La;ec="number"==typeof ec?{mainAxis:ec,crossAxis:0}:te({mainAxis:0,crossAxis:0},ec);if(Va){var Vb="y"===g?"height":"width",tc=ia.reference[g]-ia.floating[Vb]+ec.mainAxis;Vb=ia.reference[g]+ia.reference[Vb]-ec.mainAxis;Rb<tc?Rb=tc:Rb>Vb&&(Rb=Vb)}if($a){var oc,Xb,sc,Hc;const Rc="y"===
g?"width":"height";tc=["top","left"].includes(ui(W));Vb=ia.reference[ub]-ia.floating[Rc]+(tc&&null!=(oc=null==(Xb=ua.offset)?void 0:Xb[ub])?oc:0)+(tc?0:ec.crossAxis);oc=ia.reference[ub]+ia.reference[Rc]+(tc?0:null!=(sc=null==(Hc=ua.offset)?void 0:Hc[ub])?sc:0)-(tc?ec.crossAxis:0);lb<Vb?lb=Vb:lb>oc&&(lb=oc)}return{[g]:Rb,[ub]:lb}}}},fz=Math.min,Js=Math.max,Ot=Math.round,gE={getClippingRect:function(b){let {element:g,boundary:m,rootBoundary:I,strategy:W}=b;b=[...("clippingAncestors"===m?Dg(g):[].concat(m)),
I];b=b.reduce((ia,ua)=>{ua=ih(g,ua,W);return ia.top=Js(ua.top,ia.top),ia.right=fz(ua.right,ia.right),ia.bottom=fz(ua.bottom,ia.bottom),ia.left=Js(ua.left,ia.left),ia},ih(g,b[0],W));return{width:b.right-b.left,height:b.bottom-b.top,x:b.left,y:b.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(b){let {rect:g,offsetParent:m,strategy:I}=b;var W=Hj(m);const ia=rj(m);if(m===ia)return g;b={scrollLeft:0,scrollTop:0};var ua=0,La=0;(W||!W&&"fixed"!==I)&&(("body"!==Gj(m)||yj(ia))&&(b=gm(m)),
Hj(m))&&(W=sj(m,!0),ua=W.x+m.clientLeft,La=W.y+m.clientTop);return Ga(te({},g),{x:g.x-b.scrollLeft+ua,y:g.y-b.scrollTop+La})},isElement:Vj,getDimensions:uk,getOffsetParent:gj,getDocumentElement:rj,getElementRects:b=>{let {reference:g,floating:m,strategy:I}=b;b=gj(m);var W=Hj(b);const ia=rj(b);var ua;if(ua=W)ua=sj(b),ua=Ot(ua.width)!==b.offsetWidth||Ot(ua.height)!==b.offsetHeight;ua=sj(g,ua,"fixed"===I);let La={scrollLeft:0,scrollTop:0};var Va=0,$a=0;if(W||!W&&"fixed"!==I)(("body"!==Gj(b)||yj(ia))&&
(La=gm(b)),Hj(b))?(W=sj(b,!0),Va=W.x+b.clientLeft,$a=W.y+b.clientTop):ia&&(Va=qk(ia));return{reference:{x:ua.left+La.scrollLeft-Va,y:ua.top+La.scrollTop-$a,width:ua.width,height:ua.height},floating:Ga(te({},uk(m)),{x:0,y:0})}},getClientRects:b=>Array.from(b.getClientRects()),isRTL:b=>"rtl"===Ok(b).direction},hE=(b,g,m)=>ZD(b,g,te({platform:gE},m)),Jn=vb(V(22),1),gz=V(22),iE=vb(V(31),1),Iv="undefined"!==typeof document?gz.useLayoutEffect:gz.useEffect,jE=b=>{const {element:g,padding:m}=b;return{name:"arrow",
options:b,fn(I){if(Object.prototype.hasOwnProperty.call(g,"current")){if(null!=g.current)return dz({element:g.current,padding:m}).fn(I)}else if(g)return dz({element:g,padding:m}).fn(I);return{}}}},Jv=V(22),kE=(0,Jv.forwardRef)((b,g)=>{const {children:m,width:I=10,height:W=5}=b,ia=Ya(b,["children","width","height"]);return(0,Jv.createElement)(tj.svg,re({},ia,{ref:g,width:I,height:W,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),b.asChild?m:(0,Jv.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),
lE=V(22),[Kv,Cr]=og("Popper"),[mE,hz]=Kv("Popper"),Pt=(0,Wl.forwardRef)((b,g)=>{const {__scopePopper:m,virtualRef:I}=b;b=Ya(b,["__scopePopper","virtualRef"]);const W=hz("PopperAnchor",m),ia=(0,Wl.useRef)(null);g=bh(g,ia);(0,Wl.useEffect)(()=>{W.onAnchorChange((null===I||void 0===I?void 0:I.current)||ia.current)});return I?null:(0,Wl.createElement)(tj.div,re({},b,{ref:g}))}),[iz,jz]=Kv("PopperContent"),[nE,oE]=Kv("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),Lv=(0,Wl.forwardRef)((b,g)=>
{var m,I,W,ia,ua,La,Va,$a;const {__scopePopper:lb,side:ub="bottom",sideOffset:Rb=0,align:ec="center",alignOffset:Vb=0,arrowPadding:tc=0,collisionBoundary:oc=[],collisionPadding:Xb=0,sticky:sc="partial",hideWhenDetached:Hc=!1,avoidCollisions:Rc=!0}=b;b=Ya(b,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Vc=hz("PopperContent",lb),[Vd,ae]=(0,Wl.useState)(null);g=bh(g,Rr=>ae(Rr));const [De,Oe]=
(0,Wl.useState)(null);var tf=Oi(De),of=null!==(m=null===tf||void 0===tf?void 0:tf.width)&&void 0!==m?m:0;m=null!==(I=null===tf||void 0===tf?void 0:tf.height)&&void 0!==I?I:0;I=ub+("center"!==ec?"-"+ec:"");tf="number"===typeof Xb?Xb:te({top:0,right:0,bottom:0,left:0},Xb);const bf=Array.isArray(oc)?oc:[oc],Ge=0<bf.length;tf={padding:tf,boundary:bf.filter(Ig),altBoundary:Ge};const {reference:Fd,floating:Oc,strategy:md,x:zd,y:Md,placement:Ae,middlewareData:Ie,update:qf}=tg({strategy:"fixed",placement:I,
whileElementsMounted:Xj,middleware:[dE({mainAxis:Rb+m,alignmentAxis:Vb}),Rc?eE(te({mainAxis:!0,crossAxis:!1,limiter:"partial"===sc?fE():void 0},tf)):void 0,De?jE({element:De,padding:tc}):void 0,Rc?bE(te({},tf)):void 0,qE({arrowWidth:of,arrowHeight:m}),Hc?cE({strategy:"referenceHidden"}):void 0].filter(Sf)});vn(()=>{Fd(Vc.anchor)},[Fd,Vc.anchor]);const ef=null!==zd&&null!==Md,[gf,Rg]=jj(Ae);of=null===(W=Ie.arrow)||void 0===W?void 0:W.x;W=null===(ia=Ie.arrow)||void 0===ia?void 0:ia.y;ia=0!==(null===
(ua=Ie.arrow)||void 0===ua?void 0:ua.centerOffset);const [Sg,wi]=(0,Wl.useState)();vn(()=>{Vd&&wi(window.getComputedStyle(Vd).zIndex)},[Vd]);const {hasParent:Ik,positionUpdateFns:Tk}=oE("PopperContent",lb),Do=!Ik;(0,Wl.useLayoutEffect)(()=>{if(!Do)return Tk.add(qf),()=>{Tk.delete(qf)}},[Do,Tk,qf]);(0,Wl.useLayoutEffect)(()=>{Do&&ef&&Array.from(Tk).reverse().forEach(Rr=>requestAnimationFrame(Rr))},[Do,ef,Tk]);ua=Ga(te({"data-side":gf,"data-align":Rg},b),{ref:g,style:Ga(te({},b.style),{animation:ef?
void 0:"none",opacity:null!==(La=Ie.hide)&&void 0!==La&&La.referenceHidden?0:void 0})});return(0,Wl.createElement)("div",{ref:Oc,"data-radix-popper-content-wrapper":"",style:{position:md,left:0,top:0,transform:ef?`translate3d(${Math.round(zd)}px, ${Math.round(Md)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Sg,["--radix-popper-transform-origin"]:[null===(Va=Ie.transformOrigin)||void 0===Va?void 0:Va.x,null===($a=Ie.transformOrigin)||void 0===$a?void 0:$a.y].join(" ")}},(0,Wl.createElement)(iz,
{scope:lb,placedSide:gf,onArrowChange:Oe,arrowX:of,arrowY:W,shouldHideArrow:ia},Do?(0,Wl.createElement)(nE,{scope:lb,hasParent:!0,positionUpdateFns:Tk},(0,Wl.createElement)(tj.div,ua)):(0,Wl.createElement)(tj.div,ua)))}),pE={top:"bottom",right:"left",bottom:"top",left:"right"},kz=(0,Wl.forwardRef)(function(b,g){var {__scopePopper:m}=b;b=Ya(b,["__scopePopper"]);m=jz("PopperArrow",m);return(0,Wl.createElement)("span",{ref:m.onArrowChange,style:{position:"absolute",left:m.arrowX,top:m.arrowY,[pE[m.placedSide]]:0,
transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[m.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[m.placedSide],visibility:m.shouldHideArrow?"hidden":void 0}},(0,Wl.createElement)(kE,re({},b,{ref:g,style:Ga(te({},b.style),{display:"block"})})))}),qE=b=>({name:"transformOrigin",options:b,fn(g){var m,I,W,ia,ua;const {placement:La,rects:Va,middlewareData:$a}=
g,lb=(g=0!==(null===(m=$a.arrow)||void 0===m?void 0:m.centerOffset))?0:b.arrowWidth;m=g?0:b.arrowHeight;const [ub,Rb]=jj(La),ec={start:"0%",center:"50%",end:"100%"}[Rb],Vb=(null!==(I=null===(W=$a.arrow)||void 0===W?void 0:W.x)&&void 0!==I?I:0)+lb/2;I=(null!==(ia=null===(ua=$a.arrow)||void 0===ua?void 0:ua.y)&&void 0!==ia?ia:0)+m/2;ua=ia="";"bottom"===ub?(ia=g?ec:`${Vb}px`,ua=`${-m}px`):"top"===ub?(ia=g?ec:`${Vb}px`,ua=`${Va.floating.height+m}px`):"right"===ub?(ia=`${-m}px`,ua=g?ec:`${I}px`):"left"===
ub&&(ia=`${Va.floating.width+m}px`,ua=g?ec:`${I}px`);return{data:{x:ia,y:ua}}}}),Mv=b=>{const {__scopePopper:g,children:m}=b,[I,W]=(0,Wl.useState)(null);return(0,Wl.createElement)(mE,{scope:g,anchor:I,onAnchorChange:W},m)},lz=V(22),rE=vb(V(31)),mz=(0,lz.forwardRef)((b,g)=>{var m;const {container:I=null===globalThis||void 0===globalThis?void 0:null===(m=globalThis.document)||void 0===m?void 0:m.body}=b;b=Ya(b,["container"]);return I?rE.default.createPortal((0,lz.createElement)(tj.div,re({},b,{ref:g})),
I):null}),jp=V(22),sE=V(31),Ks=b=>{const {present:g,children:m}=b;b=nh(g);const I="function"===typeof m?m({present:b.isPresent}):jp.Children.only(m),W=bh(b.ref,I.ref);return"function"===typeof m||b.isPresent?(0,jp.cloneElement)(I,{ref:W}):null};Ks.displayName="Presence";var Qt=V(22),nz=V(22),oz=(0,nz.forwardRef)((b,g)=>(0,nz.createElement)(tj.span,re({},b,{ref:g,style:te({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",
wordWrap:"normal"},b.style)}))),[Rt]=og("Tooltip",[Cr]),St=Cr(),[tE,Nv]=Rt("TooltipProvider"),[uE,Ls]=Rt("Tooltip"),vE=(0,gh.forwardRef)((b,g)=>{var {__scopeTooltip:m}=b;const I=Ya(b,["__scopeTooltip"]),W=Ls("TooltipTrigger",m),ia=Nv("TooltipTrigger",m);m=St(m);const ua=(0,gh.useRef)(null);g=bh(g,ua,W.onTriggerChange);const La=(0,gh.useRef)(!1),Va=(0,gh.useRef)(!1),$a=(0,gh.useCallback)(()=>La.current=!1,[]);(0,gh.useEffect)(()=>()=>document.removeEventListener("pointerup",$a),[$a]);return(0,gh.createElement)(Pt,
re({asChild:!0},m),(0,gh.createElement)(tj.button,re({"aria-describedby":W.open?W.contentId:void 0,"data-state":W.stateAttribute},I,{ref:g,onPointerMove:Zf(b.onPointerMove,lb=>{"touch"===lb.pointerType||Va.current||ia.isPointerInTransitRef.current||(W.onTriggerEnter(),Va.current=!0)}),onPointerLeave:Zf(b.onPointerLeave,()=>{W.onTriggerLeave();Va.current=!1}),onPointerDown:Zf(b.onPointerDown,()=>{La.current=!0;document.addEventListener("pointerup",$a,{once:!0})}),onFocus:Zf(b.onFocus,()=>{if(!La.current)W.onOpen()}),
onBlur:Zf(b.onBlur,W.onClose),onClick:Zf(b.onClick,W.onClose)})))}),[wE,xE]=Rt("TooltipPortal",{forceMount:void 0}),yE=(0,gh.forwardRef)((b,g)=>{var m=xE("TooltipContent",b.__scopeTooltip);const {forceMount:I=m.forceMount,side:W="top"}=b;m=Ya(b,["forceMount","side"]);b=Ls("TooltipContent",b.__scopeTooltip);return(0,gh.createElement)(Ks,{present:I||b.open},b.disableHoverableContent?(0,gh.createElement)(pz,re({side:W},m,{ref:g})):(0,gh.createElement)(zE,re({side:W},m,{ref:g})))}),zE=(0,gh.forwardRef)((b,
g)=>{const m=Ls("TooltipContent",b.__scopeTooltip),I=Nv("TooltipContent",b.__scopeTooltip),W=(0,gh.useRef)(null);g=bh(g,W);const [ia,ua]=(0,gh.useState)(null),{trigger:La,onClose:Va}=m,$a=W.current,{onPointerInTransitChange:lb}=I,ub=(0,gh.useCallback)(()=>{ua(null);lb(!1)},[lb]),Rb=(0,gh.useCallback)((ec,Vb)=>{const tc=Ai({x:ec.clientX,y:ec.clientY},ec.currentTarget.getBoundingClientRect()),oc="right"===tc||"bottom"===tc?-5:5;ec="right"===tc||"left"===tc?{x:ec.clientX+oc,y:ec.clientY}:{x:ec.clientX,
y:ec.clientY+oc};Vb=Vb.getBoundingClientRect();const {top:Xb,right:sc,bottom:Hc,left:Rc}=Vb;Vb=Qi([ec,{x:Rc,y:Xb},{x:sc,y:Xb},{x:sc,y:Hc},{x:Rc,y:Hc}]);ua(Vb);lb(!0)},[lb]);(0,gh.useEffect)(()=>()=>ub(),[ub]);(0,gh.useEffect)(()=>{if(La&&$a){const ec=tc=>Rb(tc,$a),Vb=tc=>Rb(tc,La);La.addEventListener("pointerleave",ec);$a.addEventListener("pointerleave",Vb);return()=>{La.removeEventListener("pointerleave",ec);$a.removeEventListener("pointerleave",Vb)}}},[La,$a,Rb,ub]);(0,gh.useEffect)(()=>{if(ia){const ec=
Vb=>{var tc=Vb.target;Vb={x:Vb.clientX,y:Vb.clientY};tc=(null===La||void 0===La?void 0:La.contains(tc))||(null===$a||void 0===$a?void 0:$a.contains(tc));const {x:oc,y:Xb}=Vb;Vb=!1;for(let sc=0,Hc=ia.length-1;sc<ia.length;Hc=sc++){const Rc=ia[sc].x,Vc=ia[sc].y,Vd=ia[Hc].x,ae=ia[Hc].y;Vc>Xb!==ae>Xb&&oc<(Vd-Rc)*(Xb-Vc)/(ae-Vc)+Rc&&(Vb=!Vb)}Vb=!Vb;tc?ub():Vb&&(ub(),Va())};document.addEventListener("pointermove",ec);return()=>document.removeEventListener("pointermove",ec)}},[La,$a,ia,Va,ub]);return(0,gh.createElement)(pz,
re({},b,{ref:g}))}),[AE,BE]=Rt("Tooltip",{isInside:!1}),pz=(0,gh.forwardRef)((b,g)=>{const {__scopeTooltip:m,children:I,"aria-label":W,onEscapeKeyDown:ia,onPointerDownOutside:ua}=b;b=Ya(b,["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"]);const La=Ls("TooltipContent",m),Va=St(m),{onClose:$a}=La;(0,gh.useEffect)(()=>{document.addEventListener("tooltip.open",$a);return()=>document.removeEventListener("tooltip.open",$a)},[$a]);(0,gh.useEffect)(()=>{if(La.trigger){const lb=
ub=>{ub=ub.target;null!==ub&&void 0!==ub&&ub.contains(La.trigger)&&$a()};window.addEventListener("scroll",lb,{capture:!0});return()=>window.removeEventListener("scroll",lb,{capture:!0})}},[La.trigger,$a]);return(0,gh.createElement)(Nt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:ia,onPointerDownOutside:ua,onFocusOutside:lb=>lb.preventDefault(),onDismiss:$a},(0,gh.createElement)(Lv,re({"data-state":La.stateAttribute},Va,b,{ref:g,style:Ga(te({},b.style),{["--radix-tooltip-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}),
(0,gh.createElement)(az,null,I),(0,gh.createElement)(AE,{scope:m,isInside:!0},(0,gh.createElement)(oz,{id:La.contentId,role:"tooltip"},W||I))))}),CE=(0,gh.forwardRef)((b,g)=>{const {__scopeTooltip:m}=b;b=Ya(b,["__scopeTooltip"]);const I=St(m);return BE("TooltipArrow",m).isInside?null:(0,gh.createElement)(kz,re({},I,b,{ref:g}))}),DE=b=>{const {__scopeTooltip:g,delayDuration:m=700,skipDelayDuration:I=300,disableHoverableContent:W=!1,children:ia}=b,[ua,La]=(0,gh.useState)(!0),Va=(0,gh.useRef)(!1),$a=
(0,gh.useRef)(0);(0,gh.useEffect)(()=>{const lb=$a.current;return()=>window.clearTimeout(lb)},[]);return(0,gh.createElement)(tE,{scope:g,isOpenDelayed:ua,delayDuration:m,onOpen:(0,gh.useCallback)(()=>{window.clearTimeout($a.current);La(!1)},[]),onClose:(0,gh.useCallback)(()=>{window.clearTimeout($a.current);$a.current=window.setTimeout(()=>La(!0),I)},[I]),isPointerInTransitRef:Va,onPointerInTransitChange:(0,gh.useCallback)(lb=>{Va.current=lb},[]),disableHoverableContent:W},ia)},EE=b=>{const {__scopeTooltip:g,
children:m,open:I,defaultOpen:W=!1,onOpenChange:ia,disableHoverableContent:ua,delayDuration:La}=b,Va=Nv("Tooltip",b.__scopeTooltip);b=St(g);const [$a,lb]=(0,gh.useState)(null),ub=pl(),Rb=(0,gh.useRef)(0),ec=null!==ua&&void 0!==ua?ua:Va.disableHoverableContent,Vb=null!==La&&void 0!==La?La:Va.delayDuration,tc=(0,gh.useRef)(!1),[oc=!1,Xb]=Qg({prop:I,defaultProp:W,onChange:Vd=>{if(Vd)Va.onOpen(),document.dispatchEvent(new CustomEvent("tooltip.open"));else Va.onClose();null===ia||void 0===ia||ia(Vd)}}),
sc=(0,gh.useMemo)(()=>oc?tc.current?"delayed-open":"instant-open":"closed",[oc]),Hc=(0,gh.useCallback)(()=>{window.clearTimeout(Rb.current);tc.current=!1;Xb(!0)},[Xb]),Rc=(0,gh.useCallback)(()=>{window.clearTimeout(Rb.current);Xb(!1)},[Xb]),Vc=(0,gh.useCallback)(()=>{window.clearTimeout(Rb.current);Rb.current=window.setTimeout(()=>{tc.current=!0;Xb(!0)},Vb)},[Vb,Xb]);(0,gh.useEffect)(()=>()=>window.clearTimeout(Rb.current),[]);return(0,gh.createElement)(Mv,b,(0,gh.createElement)(uE,{scope:g,contentId:ub,
open:oc,stateAttribute:sc,trigger:$a,onTriggerChange:lb,onTriggerEnter:(0,gh.useCallback)(()=>{Va.isOpenDelayed?Vc():Hc()},[Va.isOpenDelayed,Vc,Hc]),onTriggerLeave:(0,gh.useCallback)(()=>{ec?Rc():window.clearTimeout(Rb.current)},[Rc,ec]),onOpen:Hc,onClose:Rc,disableHoverableContent:ec},m))},FE=vE,GE=b=>{const {__scopeTooltip:g,forceMount:m,children:I,container:W}=b;b=Ls("TooltipPortal",g);return(0,gh.createElement)(wE,{scope:g,forceMount:m},(0,gh.createElement)(Ks,{present:m||b.open},(0,gh.createElement)(mz,
{asChild:!0,container:W},I)))},HE=yE,IE=CE;rb=V(586);rb=V(586);var qz=vb(V(22));rb=V(586);var rz=({active:b,style:g,icon:m,otherIcon:I,onClick:W})=>{const [ia,ua]=qz.default.useState(!1);qz.default.useEffect(()=>{ua(!0);const La=setTimeout(()=>{ua(!1)},500);return()=>clearTimeout(La)},[b]);return(0,rb.jsx)("button",{"data-active":b,"data-recently-changed":ia,style:g,className:"tl-circle-button",onMouseDown:W,children:(0,rb.jsxs)("div",{className:"tl-circle-button-icons-wrapper","data-icons-count":I?
2:1,children:[I&&(0,rb.jsx)(Oh,{name:I}),(0,rb.jsx)(Oh,{name:m})]})})},ao=V(22),Ug=V(22),Uo=vb(V(22)),sz=V(22),JE=(0,sz.createContext)(void 0),KE=V(22),Ov=0,Lp=V(22),tz={bubbles:!1,cancelable:!0},Pv=(0,Lp.forwardRef)((b,g)=>{const {loop:m=!1,trapped:I=!1,onMountAutoFocus:W,onUnmountAutoFocus:ia}=b;b=Ya(b,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);const [ua,La]=(0,Lp.useState)(null),Va=ij(W),$a=ij(ia),lb=(0,Lp.useRef)(null);g=bh(g,ec=>La(ec));const ub=(0,Lp.useRef)({paused:!1,pause(){this.paused=
!0},resume(){this.paused=!1}}).current;(0,Lp.useEffect)(()=>{if(I){let ec=function(tc){!ub.paused&&ua&&(tc=tc.target,ua.contains(tc)?lb.current=tc:$b(lb.current,{select:!0}))},Vb=function(tc){!ub.paused&&ua&&(ua.contains(tc.relatedTarget)||$b(lb.current,{select:!0}))};document.addEventListener("focusin",ec);document.addEventListener("focusout",Vb);return()=>{document.removeEventListener("focusin",ec);document.removeEventListener("focusout",Vb)}}},[I,ua,ub.paused]);(0,Lp.useEffect)(()=>{if(ua){uz.add(ub);
const ec=document.activeElement;if(!ua.contains(ec)){const Vb=new CustomEvent("focusScope.autoFocusOnMount",tz);ua.addEventListener("focusScope.autoFocusOnMount",Va);ua.dispatchEvent(Vb);Vb.defaultPrevented||(zb(Pc(Pb(ua)),{select:!0}),document.activeElement===ec&&$b(ua))}return()=>{ua.removeEventListener("focusScope.autoFocusOnMount",Va);setTimeout(()=>{const Vb=new CustomEvent("focusScope.autoFocusOnUnmount",tz);ua.addEventListener("focusScope.autoFocusOnUnmount",$a);ua.dispatchEvent(Vb);Vb.defaultPrevented||
$b(null!==ec&&void 0!==ec?ec:document.body,{select:!0});ua.removeEventListener("focusScope.autoFocusOnUnmount",$a);uz.remove(ub)},0)}}},[ua,Va,$a,ub]);const Rb=(0,Lp.useCallback)(ec=>{if((m||I)&&!ub.paused){var Vb=document.activeElement;if("Tab"===ec.key&&!ec.altKey&&!ec.ctrlKey&&!ec.metaKey&&Vb){const oc=ec.currentTarget;var tc=oc;const Xb=Pb(tc),sc=sb(Xb,tc);tc=sb(Xb.reverse(),tc);const [Hc,Rc]=[sc,tc];Hc&&Rc?ec.shiftKey||Vb!==Rc?ec.shiftKey&&Vb===Hc&&(ec.preventDefault(),m&&$b(Rc,{select:!0})):
(ec.preventDefault(),m&&$b(Hc,{select:!0})):Vb===oc&&ec.preventDefault()}}},[m,I,ub.paused]);return(0,Lp.createElement)(tj.div,re({tabIndex:-1},b,{ref:g,onKeyDown:Rb}))}),uz=function(){let b=[];return{add(g){const m=b[0];g===m||null!==m&&void 0!==m&&m.pause();b=Bc(b,g);b.unshift(g)},remove(g){var m;b=Bc(b,g);null===(m=b[0])||void 0===m||m.resume()}}}(),Xl=V(22),LE={bubbles:!1,cancelable:!0},[Qv,vz,ME]=ja("RovingFocusGroup"),[NE,Tt]=og("RovingFocusGroup",[ME]),[OE,PE]=NE("RovingFocusGroup"),wz=(0,Xl.forwardRef)((b,
g)=>(0,Xl.createElement)(Qv.Provider,{scope:b.__scopeRovingFocusGroup},(0,Xl.createElement)(Qv.Slot,{scope:b.__scopeRovingFocusGroup},(0,Xl.createElement)(QE,re({},b,{ref:g}))))),QE=(0,Xl.forwardRef)((b,g)=>{const {__scopeRovingFocusGroup:m,orientation:I,loop:W=!1,dir:ia,currentTabStopId:ua,defaultCurrentTabStopId:La,onCurrentTabStopIdChange:Va,onEntryFocus:$a}=b,lb=Ya(b,"__scopeRovingFocusGroup orientation loop dir currentTabStopId defaultCurrentTabStopId onCurrentTabStopIdChange onEntryFocus".split(" ")),
ub=(0,Xl.useRef)(null);g=bh(g,ub);const Rb=Fb(ia),[ec=null,Vb]=Qg({prop:ua,defaultProp:La,onChange:Va}),[tc,oc]=(0,Xl.useState)(!1),Xb=ij($a),sc=vz(m),Hc=(0,Xl.useRef)(!1),[Rc,Vc]=(0,Xl.useState)(0);(0,Xl.useEffect)(()=>{const Vd=ub.current;if(Vd)return Vd.addEventListener("rovingFocusGroup.onEntryFocus",Xb),()=>Vd.removeEventListener("rovingFocusGroup.onEntryFocus",Xb)},[Xb]);return(0,Xl.createElement)(OE,{scope:m,orientation:I,dir:Rb,loop:W,currentTabStopId:ec,onItemFocus:(0,Xl.useCallback)(Vd=>
Vb(Vd),[Vb]),onItemShiftTab:(0,Xl.useCallback)(()=>oc(!0),[]),onFocusableItemAdd:(0,Xl.useCallback)(()=>Vc(Vd=>Vd+1),[]),onFocusableItemRemove:(0,Xl.useCallback)(()=>Vc(Vd=>Vd-1),[])},(0,Xl.createElement)(tj.div,re({tabIndex:tc||0===Rc?-1:0,"data-orientation":I},lb,{ref:g,style:te({outline:"none"},b.style),onMouseDown:Zf(b.onMouseDown,()=>{Hc.current=!0}),onFocus:Zf(b.onFocus,Vd=>{var ae=!Hc.current;if(Vd.target===Vd.currentTarget&&ae&&!tc&&(ae=new CustomEvent("rovingFocusGroup.onEntryFocus",LE),
Vd.currentTarget.dispatchEvent(ae),!ae.defaultPrevented)){Vd=sc().filter(Oe=>Oe.focusable);ae=Vd.find(Oe=>Oe.active);const De=Vd.find(Oe=>Oe.id===ec);Vd=[ae,De,...Vd].filter(Boolean).map(Oe=>Oe.ref.current);wd(Vd)}Hc.current=!1}),onBlur:Zf(b.onBlur,()=>oc(!1))})))}),xz=(0,Xl.forwardRef)((b,g)=>{const {__scopeRovingFocusGroup:m,focusable:I=!0,active:W=!1}=b,ia=Ya(b,["__scopeRovingFocusGroup","focusable","active"]),ua=pl(),La=PE("RovingFocusGroupItem",m),Va=La.currentTabStopId===ua,$a=vz(m),{onFocusableItemAdd:lb,
onFocusableItemRemove:ub}=La;(0,Xl.useEffect)(()=>{if(I)return lb(),()=>ub()},[I,lb,ub]);return(0,Xl.createElement)(Qv.ItemSlot,{scope:m,id:ua,focusable:I,active:W},(0,Xl.createElement)(tj.span,re({tabIndex:Va?0:-1,"data-orientation":La.orientation},ia,{ref:g,onMouseDown:Zf(b.onMouseDown,Rb=>{if(I)La.onItemFocus(ua);else Rb.preventDefault()}),onFocus:Zf(b.onFocus,()=>La.onItemFocus(ua)),onKeyDown:Zf(b.onKeyDown,Rb=>{if("Tab"===Rb.key&&Rb.shiftKey)La.onItemShiftTab();else if(Rb.target===Rb.currentTarget){var ec=
Tc(Rb,La.orientation,La.dir);if(void 0!==ec){Rb.preventDefault();let Vb=$a().filter(tc=>tc.focusable).map(tc=>tc.ref.current);if("last"===ec)Vb.reverse();else if("prev"===ec||"next"===ec)"prev"===ec&&Vb.reverse(),Rb=Vb.indexOf(Rb.currentTarget),Vb=La.loop?Rd(Vb,Rb+1):Vb.slice(Rb+1);setTimeout(()=>wd(Vb))}}})})))}),RE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},SE=function(b){return"undefined"===typeof document?null:(Array.isArray(b)?
b[0]:b).ownerDocument.body},Dr=new WeakMap,Ut=new WeakMap,Vt={},Rv=0,Sv=function(b,g,m){void 0===g&&(g=SE(b));void 0===m&&(m="data-aria-hidden");var I=Array.isArray(b)?b:[b];Vt[m]||(Vt[m]=new WeakMap);var W=Vt[m],ia=[],ua=new Set,La=function($a){$a&&!ua.has($a)&&(ua.add($a),La($a.parentNode))};I.forEach(La);var Va=function($a){!$a||0<=I.indexOf($a)||Array.prototype.forEach.call($a.children,function(lb){if(ua.has(lb))Va(lb);else{var ub=lb.getAttribute("aria-hidden");ub=null!==ub&&"false"!==ub;var Rb=
(Dr.get(lb)||0)+1,ec=(W.get(lb)||0)+1;Dr.set(lb,Rb);W.set(lb,ec);ia.push(lb);1===Rb&&ub&&Ut.set(lb,!0);1===ec&&lb.setAttribute(m,"true");ub||lb.setAttribute("aria-hidden","true")}})};Va(g);ua.clear();Rv++;return function(){ia.forEach(function($a){var lb=Dr.get($a)-1,ub=W.get($a)-1;Dr.set($a,lb);W.set($a,ub);lb||(Ut.has($a)||$a.removeAttribute("aria-hidden"),Ut.delete($a));ub||$a.removeAttribute(m)});Rv--;Rv||(Dr=new WeakMap,Dr=new WeakMap,Ut=new WeakMap,Vt={})}},TE=vb(Xa(),1),{__assign:Mp,__rest:yz,
__spreadArray:UE}=TE.default,zz=vb(V(22)),kp=vb(V(22)),VE=V(22),WE=vb(V(22)),Az=function(b){var g=b.sideCar;b=yz(b,["sideCar"]);if(!g)throw Error("Sidecar: please provide `sideCar` property to import the right car");g=g.read();if(!g)throw Error("Sidecar medium not found");return WE.createElement(g,Mp({},b))};Az.isSideCarExport=!0;var Bz=function(b){void 0===b&&(b={});var g=xe(null);g.options=Mp({async:!0,ssr:!1},b);return g}(),Tv=function(){},Wt=kp.forwardRef(function(b,g){var m=kp.useRef(null),I=
kp.useState({onScrollCapture:Tv,onWheelCapture:Tv,onTouchMoveCapture:Tv}),W=I[0];I=I[1];var ia=b.forwardProps,ua=b.children,La=b.className,Va=b.removeScrollBar,$a=b.enabled,lb=b.shards,ub=b.sideCar,Rb=b.noIsolation,ec=b.inert,Vb=b.allowPinchZoom,tc=b.as;tc=void 0===tc?"div":tc;b=yz(b,"forwardProps children className removeScrollBar enabled shards sideCar noIsolation inert allowPinchZoom as".split(" "));g=Cd([m,g]);W=Mp(Mp({},b),W);return kp.createElement(kp.Fragment,null,$a&&kp.createElement(ub,{sideCar:Bz,
removeScrollBar:Va,shards:lb,noIsolation:Rb,inert:ec,setCallbacks:I,allowPinchZoom:!!Vb,lockRef:m}),ia?kp.cloneElement(kp.Children.only(ua),Mp(Mp({},W),{ref:g})):kp.createElement(tc,Mp({},W,{className:La,ref:g}),ua))});Wt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wt.classNames={fullWidth:"width-before-scroll-bar",zeroRight:"right-scroll-bar-position"};var mm=vb(V(22)),Cz=vb(V(22)),XE=vb(V(22)),YE=function(){var b=0,g=null;return{add:function(m){if(0==b){if(document){var I=document.createElement("style");
I.type="text/css";var W="undefined"!==typeof __webpack_nonce__?__webpack_nonce__:void 0;W&&I.setAttribute("nonce",W)}else I=null;if(g=I)I=g,I.styleSheet?I.styleSheet.cssText=m:I.appendChild(document.createTextNode(m)),m=g,(document.head||document.getElementsByTagName("head")[0]).appendChild(m)}b++},remove:function(){b--;!b&&g&&(g.parentNode&&g.parentNode.removeChild(g),g=null)}}},ZE=function(){var b=YE();return function(g,m){XE.useEffect(function(){b.add(g);return function(){b.remove()}},[g&&m])}},
Dz=function(){var b=ZE();return function(g){b(g.styles,g.dynamic);return null}},$E={left:0,top:0,right:0,gap:0},aF=Dz(),bF=function(b,g,m,I){var W=b.left,ia=b.top,ua=b.right;b=b.gap;void 0===m&&(m="margin");return"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(I,";\n   padding-right: ").concat(b,"px ").concat(I,";\n  }\n  body {\n    overflow: hidden ").concat(I,";\n    overscroll-behavior: contain;\n    ").concat([g&&"position: relative ".concat(I,";"),"margin"===m&&"\n    padding-left: ".concat(W,
"px;\n    padding-top: ").concat(ia,"px;\n    padding-right: ").concat(ua,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(b,"px ").concat(I,";\n    "),"padding"===m&&"padding-right: ".concat(b,"px ").concat(I,";")].filter(Boolean).join(""),"\n  }\n  \n  .").concat("right-scroll-bar-position"," {\n    right: ").concat(b,"px ").concat(I,";\n  }\n  \n  .").concat("width-before-scroll-bar"," {\n    margin-right: ").concat(b,"px ").concat(I,";\n  }\n  \n  .").concat("right-scroll-bar-position",
" .").concat("right-scroll-bar-position"," {\n    right: 0 ").concat(I,";\n  }\n  \n  .").concat("width-before-scroll-bar"," .").concat("width-before-scroll-bar"," {\n    margin-right: 0 ").concat(I,";\n  }\n  \n  body {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(b,"px;\n  }\n")},cF=function(b){var g=b.noRelative,m=b.noImportant;b=b.gapMode;var I=void 0===b?"margin":b;b=Cz.useMemo(function(){var W=I;void 0===W&&(W="margin");if("undefined"===typeof window)W=$E;else{var ia=window.getComputedStyle(document.body),
ua=ia["padding"===W?"paddingTop":"marginTop"],La=ia["padding"===W?"paddingRight":"marginRight"];W=[parseInt(ia["padding"===W?"paddingLeft":"marginLeft"]||"",10)||0,parseInt(ua||"",10)||0,parseInt(La||"",10)||0];W={left:W[0],top:W[1],right:W[2],gap:Math.max(0,window.innerWidth-document.documentElement.clientWidth+W[2]-W[0])}}return W},[I]);return Cz.createElement(aF,{styles:bF(b,!g,I,m?"":"!important")})},Uv=!1;if("undefined"!==typeof window)try{var Xt=Object.defineProperty({},"passive",{get:function(){return Uv=
!0}});window.addEventListener("test",Xt,Xt);window.removeEventListener("test",Xt,Xt)}catch(b){Uv=!1}var Er=Uv?{passive:!1}:!1,Ez=function(b,g){var m=window.getComputedStyle(b);return"hidden"!==m[g]&&!(m.overflowY===m.overflowX&&"TEXTAREA"!==b.tagName&&"visible"===m[g])},Fz=function(b,g){do{"undefined"!==typeof ShadowRoot&&g instanceof ShadowRoot&&(g=g.host);if(Gz(b,g)){var m=Hz(b,g);if(m[1]>m[2])return!0}g=g.parentNode}while(g&&g!==document.body);return!1},Gz=function(b,g){return"v"===b?Ez(g,"overflowY"):
Ez(g,"overflowX")},Hz=function(b,g){return"v"===b?[g.scrollTop,g.scrollHeight,g.clientHeight]:[g.scrollLeft,g.scrollWidth,g.clientWidth]},Yt=function(b){return"changedTouches"in b?[b.changedTouches[0].clientX,b.changedTouches[0].clientY]:[0,0]},Iz=function(b){return b&&"current"in b?b.current:b},dF=function(b){return"\n  .block-interactivity-".concat(b," {pointer-events: none;}\n  .allow-interactivity-").concat(b," {pointer-events: all;}\n")},eF=0,Fr=[];Bz.useMedium(function(b){var g=mm.useRef([]),
m=mm.useRef([0,0]),I=mm.useRef(),W=mm.useState(eF++)[0],ia=mm.useState(function(){return Dz()})[0],ua=mm.useRef(b);mm.useEffect(function(){ua.current=b},[b]);mm.useEffect(function(){if(b.inert){document.body.classList.add("block-interactivity-".concat(W));var Vb=UE([b.lockRef.current],(b.shards||[]).map(Iz),!0).filter(Boolean);Vb.forEach(function(tc){return tc.classList.add("allow-interactivity-".concat(W))});return function(){document.body.classList.remove("block-interactivity-".concat(W));Vb.forEach(function(tc){return tc.classList.remove("allow-interactivity-".concat(W))})}}},
[b.inert,b.lockRef.current,b.shards]);var La=mm.useCallback(function(Vb,tc){if("touches"in Vb&&2===Vb.touches.length)return!ua.current.allowPinchZoom;var oc=Yt(Vb),Xb=m.current,sc="deltaX"in Vb?Vb.deltaX:Xb[0]-oc[0];Xb="deltaY"in Vb?Vb.deltaY:Xb[1]-oc[1];var Hc=Vb.target,Rc=Math.abs(sc)>Math.abs(Xb)?"h":"v";if("touches"in Vb&&"h"===Rc&&"range"===Hc.type)return!1;var Vc=Fz(Rc,Hc);if(!Vc)return!0;Vc?oc=Rc:(oc="v"===Rc?"h":"v",Vc=Fz(Rc,Hc));if(!Vc)return!1;!I.current&&"changedTouches"in Vb&&(sc||Xb)&&
(I.current=oc);if(!oc)return!0;oc=I.current||oc;Xb="h"===oc?sc:Xb;sc=window.getComputedStyle(tc).direction;sc="h"===oc&&"rtl"===sc?-1:1;Rc=sc*Xb;Vb=Vb.target;Xb=tc.contains(Vb);Hc=!1;Rc=0<Rc;var Vd=Vc=0;do{var ae=Hz(oc,Vb),De=ae[0];ae=ae[1]-ae[2]-sc*De;(De||ae)&&Gz(oc,Vb)&&(Vc+=ae,Vd+=De);Vb=Vb.parentNode}while(!Xb&&Vb!==document.body||Xb&&(tc.contains(Vb)||tc===Vb));Rc&&0===Vc?Hc=!0:Rc||0!==Vd||(Hc=!0);return Hc},[]),Va=mm.useCallback(function(Vb){if(Fr.length&&Fr[Fr.length-1]===ia){var tc="deltaY"in
Vb?[Vb.deltaX,Vb.deltaY]:Yt(Vb),oc=g.current.filter(function(Xb){var sc;if(sc=Xb.name===Vb.type&&Xb.target===Vb.target)Xb=Xb.delta,sc=Xb[0]===tc[0]&&Xb[1]===tc[1];return sc})[0];oc&&oc.should?Vb.cancelable&&Vb.preventDefault():oc||(oc=(ua.current.shards||[]).map(Iz).filter(Boolean).filter(function(Xb){return Xb.contains(Vb.target)}),(0<oc.length?La(Vb,oc[0]):!ua.current.noIsolation)&&Vb.cancelable&&Vb.preventDefault())}},[]),$a=mm.useCallback(function(Vb,tc,oc,Xb){var sc={name:Vb,delta:tc,target:oc,
should:Xb};g.current.push(sc);setTimeout(function(){g.current=g.current.filter(function(Hc){return Hc!==sc})},1)},[]),lb=mm.useCallback(function(Vb){m.current=Yt(Vb);I.current=void 0},[]),ub=mm.useCallback(function(Vb){$a(Vb.type,[Vb.deltaX,Vb.deltaY],Vb.target,La(Vb,b.lockRef.current))},[]),Rb=mm.useCallback(function(Vb){$a(Vb.type,Yt(Vb),Vb.target,La(Vb,b.lockRef.current))},[]);mm.useEffect(function(){Fr.push(ia);b.setCallbacks({onScrollCapture:ub,onWheelCapture:ub,onTouchMoveCapture:Rb});document.addEventListener("wheel",
Va,Er);document.addEventListener("touchmove",Va,Er);document.addEventListener("touchstart",lb,Er);return function(){Fr=Fr.filter(function(Vb){return Vb!==ia});document.removeEventListener("wheel",Va,Er);document.removeEventListener("touchmove",Va,Er);document.removeEventListener("touchstart",lb,Er)}},[]);var ec=b.removeScrollBar;return mm.createElement(mm.Fragment,null,b.inert?mm.createElement(ia,{styles:dF(W)}):null,ec?mm.createElement(cF,{gapMode:"margin"}):null)});var Zt=zz.forwardRef(function(b,
g){return zz.createElement(Wt,Mp({},b,{ref:g,sideCar:Az}))});Zt.classNames=Wt.classNames;var Vv=["Enter"," "],Jz=["ArrowUp","PageDown","End"],fF=["ArrowDown","PageUp","Home",...Jz];[...Vv];[...Vv];var [Wv,gF,hF]=ja("Menu"),[Pq,$t]=og("Menu",[hF,Cr,Tt]),Xv=Cr(),Kz=Tt(),[iF,au]=Pq("Menu"),[jF,Yv]=Pq("Menu"),Lz=(0,Ug.forwardRef)((b,g)=>{var {__scopeMenu:m}=b;b=Ya(b,["__scopeMenu"]);m=Xv(m);return(0,Ug.createElement)(Pt,re({},m,b,{ref:g}))}),[,kF]=Pq("MenuPortal",{forceMount:void 0}),[lF,Np]=Pq("MenuContent"),
Mz=(0,Ug.forwardRef)((b,g)=>{var m=kF("MenuContent",b.__scopeMenu);({forceMount:m=m.forceMount}=b);const I=Ya(b,["forceMount"]),W=au("MenuContent",b.__scopeMenu),ia=Yv("MenuContent",b.__scopeMenu);return(0,Ug.createElement)(Wv.Provider,{scope:b.__scopeMenu},(0,Ug.createElement)(Ks,{present:m||W.open},(0,Ug.createElement)(Wv.Slot,{scope:b.__scopeMenu},ia.modal?(0,Ug.createElement)(mF,re({},I,{ref:g})):(0,Ug.createElement)(nF,re({},I,{ref:g})))))}),mF=(0,Ug.forwardRef)((b,g)=>{const m=au("MenuContent",
b.__scopeMenu),I=(0,Ug.useRef)(null);g=bh(g,I);(0,Ug.useEffect)(()=>{const W=I.current;if(W)return Sv(W)},[]);return(0,Ug.createElement)(Nz,re({},b,{ref:g,trapFocus:m.open,disableOutsidePointerEvents:m.open,disableOutsideScroll:!0,onFocusOutside:Zf(b.onFocusOutside,W=>W.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>m.onOpenChange(!1)}))}),nF=(0,Ug.forwardRef)((b,g)=>{const m=au("MenuContent",b.__scopeMenu);return(0,Ug.createElement)(Nz,re({},b,{ref:g,trapFocus:!1,disableOutsidePointerEvents:!1,
disableOutsideScroll:!1,onDismiss:()=>m.onOpenChange(!1)}))}),Nz=(0,Ug.forwardRef)((b,g)=>{const {__scopeMenu:m,loop:I=!1,trapFocus:W,onOpenAutoFocus:ia,onCloseAutoFocus:ua,disableOutsidePointerEvents:La,onEscapeKeyDown:Va,onPointerDownOutside:$a,onFocusOutside:lb,onInteractOutside:ub,onDismiss:Rb,disableOutsideScroll:ec}=b,Vb=Ya(b,"__scopeMenu loop trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss disableOutsideScroll".split(" ")),
tc=au("MenuContent",m),oc=Yv("MenuContent",m),Xb=Xv(m),sc=Kz(m),Hc=gF(m),[Rc,Vc]=(0,Ug.useState)(null),Vd=(0,Ug.useRef)(null);g=bh(g,Vd,tc.onContentChange);const ae=(0,Ug.useRef)(0),De=(0,Ug.useRef)(""),Oe=(0,Ug.useRef)(0),tf=(0,Ug.useRef)(null),of=(0,Ug.useRef)("right"),bf=(0,Ug.useRef)(0),Ge=ec?Zt:Ug.Fragment,Fd=ec?{as:Oq,allowPinchZoom:!0}:void 0,Oc=zd=>{var Md,Ae;zd=De.current+zd;const Ie=Hc().filter(Sg=>!Sg.disabled),qf=document.activeElement,ef=null===(Md=Ie.find(Sg=>Sg.ref.current===qf))||
void 0===Md?void 0:Md.textValue;Md=Ie.map(Sg=>Sg.textValue);const gf=$e(Md,zd,ef),Rg=null===(Ae=Ie.find(Sg=>Sg.textValue===gf))||void 0===Ae?void 0:Ae.ref.current;(function Ik(wi){De.current=wi;window.clearTimeout(ae.current);""!==wi&&(ae.current=window.setTimeout(()=>Ik(""),1E3))})(zd);Rg&&setTimeout(()=>Rg.focus())};(0,Ug.useEffect)(()=>()=>window.clearTimeout(ae.current),[]);Tb();const md=(0,Ug.useCallback)(zd=>{var Md,Ae,Ie;if(Ie=of.current===(null===(Md=tf.current)||void 0===Md?void 0:Md.side)){if(Md=
null===(Ae=tf.current)||void 0===Ae?void 0:Ae.area){const {x:qf,y:ef}={x:zd.clientX,y:zd.clientY};zd=!1;for(let gf=0,Rg=Md.length-1;gf<Md.length;Rg=gf++){Ae=Md[gf].x;Ie=Md[gf].y;const Sg=Md[Rg].x,wi=Md[Rg].y;Ie>ef!==wi>ef&&qf<(Sg-Ae)*(ef-Ie)/(wi-Ie)+Ae&&(zd=!zd)}Md=zd}else Md=!1;Ie=Md}return Ie},[]);return(0,Ug.createElement)(lF,{scope:m,searchRef:De,onItemEnter:(0,Ug.useCallback)(zd=>{md(zd)&&zd.preventDefault()},[md]),onItemLeave:(0,Ug.useCallback)(zd=>{var Md;md(zd)||(null===(Md=Vd.current)||void 0===
Md||Md.focus(),Vc(null))},[md]),onTriggerLeave:(0,Ug.useCallback)(zd=>{md(zd)&&zd.preventDefault()},[md]),pointerGraceTimerRef:Oe,onPointerGraceIntentChange:(0,Ug.useCallback)(zd=>{tf.current=zd},[])},(0,Ug.createElement)(Ge,Fd,(0,Ug.createElement)(Pv,{asChild:!0,trapped:W,onMountAutoFocus:Zf(ia,zd=>{var Md;zd.preventDefault();null===(Md=Vd.current)||void 0===Md||Md.focus()}),onUnmountAutoFocus:ua},(0,Ug.createElement)(Nt,{asChild:!0,disableOutsidePointerEvents:La,onEscapeKeyDown:Va,onPointerDownOutside:$a,
onFocusOutside:lb,onInteractOutside:ub,onDismiss:Rb},(0,Ug.createElement)(wz,re({asChild:!0},sc,{dir:oc.dir,orientation:"vertical",loop:I,currentTabStopId:Rc,onCurrentTabStopIdChange:Vc,onEntryFocus:zd=>{oc.isUsingKeyboardRef.current||zd.preventDefault()}}),(0,Ug.createElement)(Lv,re({role:"menu","aria-orientation":"vertical","data-state":tc.open?"open":"closed","data-radix-menu-content":"",dir:oc.dir},Xb,Vb,{ref:g,style:te({outline:"none"},Vb.style),onKeyDown:Zf(Vb.onKeyDown,zd=>{var Md=zd.target.closest("[data-radix-menu-content]")===
zd.currentTarget;const Ae=zd.ctrlKey||zd.altKey||zd.metaKey,Ie=1===zd.key.length;Md&&("Tab"===zd.key&&zd.preventDefault(),!Ae&&Ie&&Oc(zd.key));zd.target===Vd.current&&fF.includes(zd.key)&&(zd.preventDefault(),Md=Hc().filter(qf=>!qf.disabled).map(qf=>qf.ref.current),Jz.includes(zd.key)&&Md.reverse(),Tf(Md))}),onBlur:Zf(b.onBlur,zd=>{zd.currentTarget.contains(zd.target)||(window.clearTimeout(ae.current),De.current="")}),onPointerMove:Zf(b.onPointerMove,Pe(zd=>{const Md=bf.current!==zd.clientX;zd.currentTarget.contains(zd.target)&&
Md&&(of.current=zd.clientX>bf.current?"right":"left",bf.current=zd.clientX)}))})))))))}),Oz=(0,Ug.forwardRef)((b,g)=>{const {disabled:m=!1,onSelect:I}=b,W=Ya(b,["disabled","onSelect"]),ia=(0,Ug.useRef)(null),ua=Yv("MenuItem",b.__scopeMenu),La=Np("MenuItem",b.__scopeMenu);g=bh(g,ia);const Va=(0,Ug.useRef)(!1);return(0,Ug.createElement)(oF,re({},W,{ref:g,disabled:m,onClick:Zf(b.onClick,()=>{const $a=ia.current;if(!m&&$a){const lb=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});$a.addEventListener("menu.itemSelect",
ub=>null===I||void 0===I?void 0:I(ub),{once:!0});Ti($a,lb);if(lb.defaultPrevented)Va.current=!1;else ua.onClose()}}),onPointerDown:$a=>{var lb;null===(lb=b.onPointerDown)||void 0===lb||lb.call(b,$a);Va.current=!0},onPointerUp:Zf(b.onPointerUp,$a=>{var lb;Va.current||null===(lb=$a.currentTarget)||void 0===lb||lb.click()}),onKeyDown:Zf(b.onKeyDown,$a=>{const lb=""!==La.searchRef.current;m||lb&&" "===$a.key||!Vv.includes($a.key)||($a.currentTarget.click(),$a.preventDefault())})}))}),oF=(0,Ug.forwardRef)((b,
g)=>{const {__scopeMenu:m,disabled:I=!1,textValue:W}=b,ia=Ya(b,["__scopeMenu","disabled","textValue"]),ua=Np("MenuItem",m),La=Kz(m),Va=(0,Ug.useRef)(null);g=bh(g,Va);const [$a,lb]=(0,Ug.useState)(!1),[ub,Rb]=(0,Ug.useState)("");(0,Ug.useEffect)(()=>{const ec=Va.current;if(ec){var Vb;Rb((null!==(Vb=ec.textContent)&&void 0!==Vb?Vb:"").trim())}},[ia.children]);return(0,Ug.createElement)(Wv.ItemSlot,{scope:m,disabled:I,textValue:null!==W&&void 0!==W?W:ub},(0,Ug.createElement)(xz,re({asChild:!0},La,{focusable:!I}),
(0,Ug.createElement)(tj.div,re({role:"menuitem","data-highlighted":$a?"":void 0,"aria-disabled":I||void 0,"data-disabled":I?"":void 0},ia,{ref:g,onPointerMove:Zf(b.onPointerMove,Pe(ec=>{if(I)ua.onItemLeave(ec);else ua.onItemEnter(ec),ec.defaultPrevented||ec.currentTarget.focus()})),onPointerLeave:Zf(b.onPointerLeave,Pe(ec=>ua.onItemLeave(ec))),onFocus:Zf(b.onFocus,()=>lb(!0)),onBlur:Zf(b.onBlur,()=>lb(!1))}))))});Pq("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});Pq("MenuItemIndicator",{checked:!1});
var pF=(0,Ug.forwardRef)((b,g)=>{b=Ya(b,["__scopeMenu"]);return(0,Ug.createElement)(tj.div,re({role:"separator","aria-orientation":"horizontal"},b,{ref:g}))});Pq("MenuSub");var Pz=b=>{const {__scopeMenu:g,open:m=!1,children:I,dir:W,onOpenChange:ia,modal:ua=!0}=b;b=Xv(g);const [La,Va]=(0,Ug.useState)(null),$a=(0,Ug.useRef)(!1),lb=ij(ia),ub=Fb(W);(0,Ug.useEffect)(()=>{const Rb=()=>{$a.current=!0;document.addEventListener("pointerdown",ec,{capture:!0,once:!0});document.addEventListener("pointermove",
ec,{capture:!0,once:!0})},ec=()=>$a.current=!1;document.addEventListener("keydown",Rb,{capture:!0});return()=>{document.removeEventListener("keydown",Rb,{capture:!0});document.removeEventListener("pointerdown",ec,{capture:!0});document.removeEventListener("pointermove",ec,{capture:!0})}},[]);return(0,Ug.createElement)(Mv,b,(0,Ug.createElement)(iF,{scope:g,open:m,onOpenChange:lb,content:La,onContentChange:Va},(0,Ug.createElement)(jF,{scope:g,onClose:(0,Ug.useCallback)(()=>lb(!1),[lb]),isUsingKeyboardRef:$a,
dir:ub,modal:ua},I)))},[qF]=og("DropdownMenu",[$t]),bu=$t(),[rF,Qz]=qF("DropdownMenu"),sF=(0,ao.forwardRef)((b,g)=>{const {__scopeDropdownMenu:m,disabled:I=!1}=b,W=Ya(b,["__scopeDropdownMenu","disabled"]),ia=Qz("DropdownMenuTrigger",m),ua=bu(m);return(0,ao.createElement)(Lz,re({asChild:!0},ua),(0,ao.createElement)(tj.button,re({type:"button",id:ia.triggerId,"aria-haspopup":"menu","aria-expanded":ia.open,"aria-controls":ia.open?ia.contentId:void 0,"data-state":ia.open?"open":"closed","data-disabled":I?
"":void 0,disabled:I},W,{ref:Zi(g,ia.triggerRef),onPointerDown:Zf(b.onPointerDown,La=>{I||0!==La.button||!1!==La.ctrlKey||(ia.onOpenToggle(),ia.open||La.preventDefault())}),onKeyDown:Zf(b.onKeyDown,La=>{if(!I){if(["Enter"," "].includes(La.key))ia.onOpenToggle();if("ArrowDown"===La.key)ia.onOpenChange(!0);["Enter"," ","ArrowDown"].includes(La.key)&&La.preventDefault()}})})))}),tF=(0,ao.forwardRef)((b,g)=>{var {__scopeDropdownMenu:m}=b;const I=Ya(b,["__scopeDropdownMenu"]),W=Qz("DropdownMenuContent",
m);m=bu(m);const ia=(0,ao.useRef)(!1);return(0,ao.createElement)(Mz,re({id:W.contentId,"aria-labelledby":W.triggerId},m,I,{ref:g,onCloseAutoFocus:Zf(b.onCloseAutoFocus,ua=>{var La;ia.current||null===(La=W.triggerRef.current)||void 0===La||La.focus();ia.current=!1;ua.preventDefault()}),onInteractOutside:Zf(b.onInteractOutside,ua=>{ua=ua.detail.originalEvent;const La=0===ua.button&&!0===ua.ctrlKey;ua=2===ua.button||La;if(!W.modal||ua)ia.current=!0}),style:Ga(te({},b.style),{["--radix-dropdown-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),
Ms=(0,ao.forwardRef)((b,g)=>{var {__scopeDropdownMenu:m}=b;b=Ya(b,["__scopeDropdownMenu"]);m=bu(m);return(0,ao.createElement)(Oz,re({},m,b,{ref:g}))}),uF=b=>{const {__scopeDropdownMenu:g,children:m,dir:I,open:W,defaultOpen:ia,onOpenChange:ua,modal:La=!0}=b;b=bu(g);const Va=(0,ao.useRef)(null),[$a=!1,lb]=Qg({prop:W,defaultProp:ia,onChange:ua});return(0,ao.createElement)(rF,{scope:g,triggerId:pl(),triggerRef:Va,contentId:pl(),open:$a,onOpenChange:lb,onOpenToggle:(0,ao.useCallback)(()=>lb(ub=>!ub),[lb]),
modal:La},(0,ao.createElement)(Pz,re({},b,{open:$a,onOpenChange:lb,dir:I,modal:La}),m))};rb=V(586);var vF=sf(function(){const b=xg(),g=m=>{m.preventDefault()};return(0,rb.jsxs)(uF,{children:[(0,rb.jsx)(sF,{className:"tl-button text-sm px-2 important",id:"tl-zoom",children:(100*b.viewport.camera.zoom).toFixed(0)+"%"}),(0,rb.jsxs)(tF,{onCloseAutoFocus:m=>m.preventDefault(),className:"tl-menu",id:"zoomPopup",sideOffset:12,children:[(0,rb.jsxs)(Ms,{className:"tl-menu-item",onSelect:g,onClick:b.api.zoomToFit,
children:["Zoom to drawing",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"1"})]})})]}),(0,rb.jsxs)(Ms,{className:"tl-menu-item",onSelect:g,onClick:b.api.zoomToSelection,disabled:0===b.selectedShapesArray.length,children:["Zoom to selection",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",
{children:xo})," ",(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"1"})]})})]}),(0,rb.jsxs)(Ms,{className:"tl-menu-item",onSelect:g,onClick:b.api.zoomIn,children:["Zoom in",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"+"})]})})]}),(0,rb.jsxs)(Ms,{className:"tl-menu-item",onSelect:g,onClick:b.api.zoomOut,children:["Zoom out",(0,rb.jsx)("div",
{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"-"})]})})]}),(0,rb.jsxs)(Ms,{className:"tl-menu-item",onSelect:g,onClick:b.api.resetZoom,children:["Reset zoom",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"0"})]})})]})]})]})}),Rz=V(22),Sz=["horizontal",
"vertical"],Qq=(0,Rz.forwardRef)((b,g)=>{const {decorative:m,orientation:I="horizontal"}=b;b=Ya(b,["decorative","orientation"]);const W=Sz.includes(I)?I:"horizontal";return(0,Rz.createElement)(tj.div,re({"data-orientation":W},m?{role:"none"}:{"aria-orientation":"vertical"===W?W:void 0,role:"separator"},b,{ref:g}))});Qq.propTypes={orientation(b,g,m){b=b[g];g=String(b);return b&&!Sz.includes(b)?Error(`Invalid prop \`orientation\` of value \`${g}\` supplied to \`${m}\`, expected one of:
  - horizontal
  - vertical

Defaulting to \`${"horizontal"}\`.`):null}};rb=V(586);var wF=sf(function(){const b=xg(),g=Mt.useCallback(()=>{b.api.undo()},[b]),m=Mt.useCallback(()=>{b.api.redo()},[b]),I=Mt.useCallback(()=>{b.api.zoomIn()},[b]),W=Mt.useCallback(()=>{b.api.zoomOut()},[b]);return(0,rb.jsxs)("div",{className:"tl-action-bar",children:[(0,rb.jsxs)("div",{className:"tl-toolbar tl-history-bar",children:[(0,rb.jsx)(dc,{tooltip:"Undo",onClick:g,children:(0,rb.jsx)(Oh,{name:"arrow-back-up"})}),(0,rb.jsx)(dc,{tooltip:"Redo",
onClick:m,children:(0,rb.jsx)(Oh,{name:"arrow-forward-up"})})]}),(0,rb.jsxs)("div",{className:"tl-toolbar tl-zoom-bar",children:[(0,rb.jsx)(dc,{tooltip:"Zoom in",onClick:I,id:"tl-zoom-in",children:(0,rb.jsx)(Oh,{name:"plus"})}),(0,rb.jsx)(dc,{tooltip:"Zoom out",onClick:W,id:"tl-zoom-out",children:(0,rb.jsx)(Oh,{name:"minus"})}),(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,rb.jsx)(vF,{})]})]})}),Rq=vb(V(22)),Zv=vb(V(31));rb=V(586);var cu=b=>`[${b.map(g=>{var m;return null!=
(m=null==g?void 0:g.toFixed(2))?m:"-"}).join(", ")}]`,xF=sf(function(){const b=xg(),g=Rq.default.useRef(),[,m]=Rq.default.useState(0);Rq.default.useEffect(()=>{g.current=document.createElement("div");g.current.style.display="contents";document.body.append(g.current);m(I=>I+1);return()=>{var I;null==(I=g.current)?void 0:I.remove()}},[]);Rq.default.useEffect(()=>{requestAnimationFrame(()=>{var I,W;null==(W=null==(I=g.current)?void 0:I.querySelector(`[data-item-index="${b.history.pointer}"]`))?void 0:
W.scrollIntoView()})},[b.history.pointer]);return g.current?Zv.default.createPortal((0,rb.jsx)("div",{className:"fixed z-[1000] left-4 max-w-[400px] top-4 overflow-scroll bg-gray-200 flex gap-2 p-2",children:b.history.stack.map((I,W)=>(0,rb.jsx)("div",{"data-item-index":W,style:{background:b.history.pointer===W?"pink":"grey"},onClick:()=>b.history.setPointer(W),className:"flex items-center rounded-lg px-2 h-[32px] whitespace-nowrap",children:I.pages[0].nonce},W))}),g.current):null});sf(()=>{var b;
const {viewport:{bounds:g,camera:{point:m,zoom:I}},inputs:W}=Ki(),ia=Rq.default.useRef(),ua=Rq.default.useRef();Rq.default.useEffect(()=>{var Va=document.getElementById("tl-dev-tools-canvas-anchor");ia.current=Va;Va=document.getElementById("tl-statusbar-anchor");ua.current=Va},[]);var La=[["Z",null!=(b=null==I?void 0:I.toFixed(2))?b:"null"],["MP",cu(W.currentPoint)],["MS",cu(W.currentScreenPoint)],["VP",cu(m)],["VBR",cu([g.maxX,g.maxY])]].map(Va=>Va.join("")).join("|");b=ia.current?Zv.default.createPortal((0,rb.jsx)("svg",
{className:"tl-renderer-dev-tools tl-grid",children:(0,rb.jsx)("circle",{cx:m[0]*I,cy:m[1]*I,r:"4",fill:"red"})}),ia.current):null;La=ua.current?Zv.default.createPortal((0,rb.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center"},children:La}),ua.current):null;return(0,rb.jsxs)(rb.Fragment,{children:[b,La,(0,rb.jsx)(xF,{})]})});var yF=vb(V(22)),zF=vb(V(22));rb=V(586);var Vo=sf(b=>{var {id:g,icon:m,tooltip:I}=b;b=Ya(b,["id","icon","tooltip"]);var W;const ia=xg(),ua=zF.useCallback(Va=>{(Va=Va.currentTarget.dataset.tool)&&
ia.selectTool(Va)},[ia]),La=(null==(W=[...ia.Tools,ir,jr])?void 0:W.find(Va=>Va.id===g)).shortcut;W=La?(0,rb.jsxs)(rb.Fragment,{children:[I,(0,rb.jsx)("span",{className:"ml-2 keyboard-shortcut",children:La.map((Va,$a)=>(0,rb.jsx)("code",{children:Va.toUpperCase()},$a)).reduce((Va,$a)=>[Va," | ",$a])})]}):I;return(0,rb.jsx)(dc,Ga(te({},b),{tooltipSide:"left",tooltip:W,"data-tool":g,"data-selected":g===ia.selectedTool.id,onClick:ua,children:"string"===typeof m?(0,rb.jsx)(Oh,{name:m}):m}))}),Tz=vb(V(22)),
Jj=V(22),[Uz]=og("Popover",[Cr]),du=Cr(),[AF,Ns]=Uz("Popover"),Vz=(0,Jj.forwardRef)((b,g)=>{var {__scopePopover:m}=b;const I=Ya(b,["__scopePopover"]),W=Ns("PopoverTrigger",m);m=du(m);g=bh(g,W.triggerRef);b=(0,Jj.createElement)(tj.button,re({type:"button","aria-haspopup":"dialog","aria-expanded":W.open,"aria-controls":W.contentId,"data-state":W.open?"open":"closed"},I,{ref:g,onClick:Zf(b.onClick,W.onOpenToggle)}));return W.hasCustomAnchor?b:(0,Jj.createElement)(Pt,re({asChild:!0},m),b)}),[,BF]=Uz("PopoverPortal",
{forceMount:void 0}),Wz=(0,Jj.forwardRef)((b,g)=>{var m=BF("PopoverContent",b.__scopePopover);({forceMount:m=m.forceMount}=b);const I=Ya(b,["forceMount"]);b=Ns("PopoverContent",b.__scopePopover);return(0,Jj.createElement)(Ks,{present:m||b.open},b.modal?(0,Jj.createElement)(CF,re({},I,{ref:g})):(0,Jj.createElement)(DF,re({},I,{ref:g})))}),CF=(0,Jj.forwardRef)((b,g)=>{const m=Ns("PopoverContent",b.__scopePopover),I=(0,Jj.useRef)(null);g=bh(g,I);const W=(0,Jj.useRef)(!1);(0,Jj.useEffect)(()=>{const ia=
I.current;if(ia)return Sv(ia)},[]);return(0,Jj.createElement)(Zt,{as:Oq,allowPinchZoom:!0},(0,Jj.createElement)(Xz,re({},b,{ref:g,trapFocus:m.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Zf(b.onCloseAutoFocus,ia=>{var ua;ia.preventDefault();W.current||null===(ua=m.triggerRef.current)||void 0===ua||ua.focus()}),onPointerDownOutside:Zf(b.onPointerDownOutside,ia=>{ia=ia.detail.originalEvent;const ua=0===ia.button&&!0===ia.ctrlKey;W.current=2===ia.button||ua},{checkForDefaultPrevented:!1}),onFocusOutside:Zf(b.onFocusOutside,
ia=>ia.preventDefault(),{checkForDefaultPrevented:!1})})))}),DF=(0,Jj.forwardRef)((b,g)=>{const m=Ns("PopoverContent",b.__scopePopover),I=(0,Jj.useRef)(!1);return(0,Jj.createElement)(Xz,re({},b,{ref:g,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:W=>{var ia;null===(ia=b.onCloseAutoFocus)||void 0===ia||ia.call(b,W);if(!W.defaultPrevented){var ua;I.current||null===(ua=m.triggerRef.current)||void 0===ua||ua.focus();W.preventDefault()}I.current=!1},onInteractOutside:W=>{var ia,ua;null===
(ia=b.onInteractOutside)||void 0===ia||ia.call(b,W);W.defaultPrevented||(I.current=!0);ia=W.target;(null===(ua=m.triggerRef.current)||void 0===ua?0:ua.contains(ia))&&W.preventDefault()}}))}),Xz=(0,Jj.forwardRef)((b,g)=>{const {__scopePopover:m,trapFocus:I,onOpenAutoFocus:W,onCloseAutoFocus:ia,disableOutsidePointerEvents:ua,onEscapeKeyDown:La,onPointerDownOutside:Va,onFocusOutside:$a,onInteractOutside:lb}=b;b=Ya(b,"__scopePopover trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside".split(" "));
const ub=Ns("PopoverContent",m),Rb=du(m);Tb();return(0,Jj.createElement)(Pv,{asChild:!0,loop:!0,trapped:I,onMountAutoFocus:W,onUnmountAutoFocus:ia},(0,Jj.createElement)(Nt,{asChild:!0,disableOutsidePointerEvents:ua,onInteractOutside:lb,onEscapeKeyDown:La,onPointerDownOutside:Va,onFocusOutside:$a,onDismiss:()=>ub.onOpenChange(!1)},(0,Jj.createElement)(Lv,re({"data-state":ub.open?"open":"closed",role:"dialog",id:ub.contentId},Rb,b,{ref:g,style:Ga(te({},b.style),{["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))))}),
Yz=(0,Jj.forwardRef)((b,g)=>{var {__scopePopover:m}=b;b=Ya(b,["__scopePopover"]);m=du(m);return(0,Jj.createElement)(kz,re({},m,b,{ref:g}))}),Zz=b=>{const {__scopePopover:g,children:m,open:I,defaultOpen:W,onOpenChange:ia,modal:ua=!1}=b;b=du(g);const La=(0,Jj.useRef)(null),[Va,$a]=(0,Jj.useState)(!1),[lb=!1,ub]=Qg({prop:I,defaultProp:W,onChange:ia});return(0,Jj.createElement)(Mv,b,(0,Jj.createElement)(AF,{scope:g,contentId:pl(),triggerRef:La,open:lb,onOpenChange:ub,onOpenToggle:(0,Jj.useCallback)(()=>
ub(Rb=>!Rb),[ub]),hasCustomAnchor:Va,onCustomAnchorAdd:(0,Jj.useCallback)(()=>$a(!0),[]),onCustomAnchorRemove:(0,Jj.useCallback)(()=>$a(!1),[]),modal:ua},m))};rb=V(586);var EF=sf(function(){const b=[{id:"box",icon:"square",tooltip:"Rectangle"},{id:"ellipse",icon:"circle",tooltip:"Circle"},{id:"polygon",icon:"triangle",tooltip:"Triangle"}],g=xg(),[m,I]=Tz.useState(()=>{var W;return(null!=(W=b.find(ia=>ia.id===g.selectedTool.id))?W:b[0]).id});Tz.useEffect(()=>{I(W=>{var ia,ua;return null!=(ua=null==
(ia=b.find(La=>La.id===g.selectedTool.id))?void 0:ia.id)?ua:W})},[g.selectedTool.id]);return(0,rb.jsxs)(Zz,{children:[(0,rb.jsx)(Vz,{asChild:!0,children:(0,rb.jsxs)("div",{className:"tl-geometry-tools-pane-anchor",children:[(0,rb.jsx)(Vo,te({},b.find(W=>W.id===m))),(0,rb.jsx)(Oh,{"data-selected":b.some(W=>W.id===g.selectedTool.id),className:"tl-popover-indicator",name:"chevron-down-left"})]})}),(0,rb.jsxs)(Wz,{className:"tl-popover-content",side:"left",sideOffset:15,children:[(0,rb.jsx)("div",{className:"tl-toolbar tl-geometry-toolbar",
children:b.map(W=>(0,rb.jsx)(Vo,te({},W),W.id))}),(0,rb.jsx)(Yz,{className:"tl-popover-arrow"})]})]})}),pi=V(22),$z=V(22),aA=["PageUp","PageDown"],bA=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],cA={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},[$v,FF,GF]=ja("Slider"),[dA]=og("Slider",[GF]),[HF,eu]=dA("Slider"),IF=(0,pi.forwardRef)((b,
g)=>{function m(bf){const Ge=gg(Oe,bf);ia(bf,Ge)}function I(bf){ia(bf,Vd.current)}function W(){Oe[Vd.current]!==of.current[Vd.current]&&oc(Oe)}function ia(bf,Ge,{commit:Fd}={commit:!1}){const Oc=(String($a).split(".")[1]||"").length;bf=lh(Math.round((bf-La)/$a)*$a+La,Oc);const md=Re(bf,[La,Va]);tf((zd=[])=>{const Md=Rf(zd,md,Ge);var Ae=Rb*$a;if(0<Ae){const Ie=Og(Md);Ae=Math.min(...Ie)>=Ae}else Ae=!0;return Ae?(Vd.current=Md.indexOf(md),(Ae=String(Md)!==String(zd))&&Fd&&oc(Md),Ae?Md:zd):zd})}const {name:ua,
min:La=0,max:Va=100,step:$a=1,orientation:lb="horizontal",disabled:ub=!1,minStepsBetweenThumbs:Rb=0,defaultValue:ec=[La],value:Vb,onValueChange:tc=()=>{},onValueCommit:oc=()=>{},inverted:Xb=!1}=b,sc=Ya(b,"name min max step orientation disabled minStepsBetweenThumbs defaultValue value onValueChange onValueCommit inverted".split(" ")),[Hc,Rc]=(0,pi.useState)(null);g=bh(g,bf=>Rc(bf));const Vc=(0,pi.useRef)(new Set),Vd=(0,pi.useRef)(0);var ae="horizontal"===lb;const De=Hc?!!Hc.closest("form"):!0;ae=ae?
JF:KF;const [Oe=[],tf]=Qg({prop:Vb,defaultProp:ec,onChange:bf=>{var Ge;null===(Ge=[...Vc.current][Vd.current])||void 0===Ge||Ge.focus();tc(bf)}}),of=(0,pi.useRef)(Oe);return(0,pi.createElement)(HF,{scope:b.__scopeSlider,disabled:ub,min:La,max:Va,valueIndexToChangeRef:Vd,thumbs:Vc.current,values:Oe,orientation:lb},(0,pi.createElement)($v.Provider,{scope:b.__scopeSlider},(0,pi.createElement)($v.Slot,{scope:b.__scopeSlider},(0,pi.createElement)(ae,re({"aria-disabled":ub,"data-disabled":ub?"":void 0},
sc,{ref:g,onPointerDown:Zf(sc.onPointerDown,()=>{ub||(of.current=Oe)}),min:La,max:Va,inverted:Xb,onSlideStart:ub?void 0:m,onSlideMove:ub?void 0:I,onSlideEnd:ub?void 0:W,onHomeKeyDown:()=>!ub&&ia(La,0,{commit:!0}),onEndKeyDown:()=>!ub&&ia(Va,Oe.length-1,{commit:!0}),onStepKeyDown:({event:bf,direction:Ge})=>{if(!ub){bf=aA.includes(bf.key)||bf.shiftKey&&bA.includes(bf.key);const Fd=Vd.current;ia(Oe[Fd]+$a*(bf?10:1)*Ge,Fd,{commit:!0})}}})))),De&&Oe.map((bf,Ge)=>(0,pi.createElement)(PF,{key:Ge,name:ua?
ua+(1<Oe.length?"[]":""):void 0,value:bf})))}),[eA,fA]=dA("Slider",{startEdge:"left",endEdge:"right",size:"width",direction:1}),JF=(0,pi.forwardRef)((b,g)=>{function m(sc){const Hc=Vb.current||Rb.getBoundingClientRect(),Rc=Lg([0,Hc.width],Xb?[I,W]:[W,I]);Vb.current=Hc;return Rc(sc-Hc.left)}const {min:I,max:W,dir:ia,inverted:ua,onSlideStart:La,onSlideMove:Va,onSlideEnd:$a,onStepKeyDown:lb}=b,ub=Ya(b,"min max dir inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),[Rb,ec]=(0,pi.useState)(null);
g=bh(g,sc=>ec(sc));const Vb=(0,pi.useRef)(),tc=Fb(ia),oc="ltr"===tc,Xb=oc&&!ua||!oc&&ua;return(0,pi.createElement)(eA,{scope:b.__scopeSlider,startEdge:Xb?"left":"right",endEdge:Xb?"right":"left",direction:Xb?1:-1,size:"width"},(0,pi.createElement)(gA,re({dir:tc,"data-orientation":"horizontal"},ub,{ref:g,style:Ga(te({},ub.style),{["--radix-slider-thumb-transform"]:"translateX(-50%)"}),onSlideStart:sc=>{sc=m(sc.clientX);null===La||void 0===La||La(sc)},onSlideMove:sc=>{sc=m(sc.clientX);null===Va||void 0===
Va||Va(sc)},onSlideEnd:()=>{Vb.current=void 0;null===$a||void 0===$a||$a()},onStepKeyDown:sc=>{const Hc=cA[Xb?"from-left":"from-right"].includes(sc.key);null===lb||void 0===lb||lb({event:sc,direction:Hc?-1:1})}})))}),KF=(0,pi.forwardRef)((b,g)=>{function m(Vb){const tc=Rb.current||ub.current.getBoundingClientRect(),oc=Lg([0,tc.height],ec?[W,I]:[I,W]);Rb.current=tc;return oc(Vb-tc.top)}const {min:I,max:W,inverted:ia,onSlideStart:ua,onSlideMove:La,onSlideEnd:Va,onStepKeyDown:$a}=b,lb=Ya(b,"min max inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),
ub=(0,pi.useRef)(null);g=bh(g,ub);const Rb=(0,pi.useRef)(),ec=!ia;return(0,pi.createElement)(eA,{scope:b.__scopeSlider,startEdge:ec?"bottom":"top",endEdge:ec?"top":"bottom",size:"height",direction:ec?1:-1},(0,pi.createElement)(gA,re({"data-orientation":"vertical"},lb,{ref:g,style:Ga(te({},lb.style),{["--radix-slider-thumb-transform"]:"translateY(50%)"}),onSlideStart:Vb=>{Vb=m(Vb.clientY);null===ua||void 0===ua||ua(Vb)},onSlideMove:Vb=>{Vb=m(Vb.clientY);null===La||void 0===La||La(Vb)},onSlideEnd:()=>
{Rb.current=void 0;null===Va||void 0===Va||Va()},onStepKeyDown:Vb=>{const tc=cA[ec?"from-bottom":"from-top"].includes(Vb.key);null===$a||void 0===$a||$a({event:Vb,direction:tc?-1:1})}})))}),gA=(0,pi.forwardRef)((b,g)=>{const {__scopeSlider:m,onSlideStart:I,onSlideMove:W,onSlideEnd:ia,onHomeKeyDown:ua,onEndKeyDown:La,onStepKeyDown:Va}=b,$a=Ya(b,"__scopeSlider onSlideStart onSlideMove onSlideEnd onHomeKeyDown onEndKeyDown onStepKeyDown".split(" ")),lb=eu("Slider",m);return(0,pi.createElement)(tj.span,
re({},$a,{ref:g,onKeyDown:Zf(b.onKeyDown,ub=>{"Home"===ub.key?(ua(ub),ub.preventDefault()):"End"===ub.key?(La(ub),ub.preventDefault()):aA.concat(bA).includes(ub.key)&&(Va(ub),ub.preventDefault())}),onPointerDown:Zf(b.onPointerDown,ub=>{const Rb=ub.target;Rb.setPointerCapture(ub.pointerId);ub.preventDefault();lb.thumbs.has(Rb)?Rb.focus():I(ub)}),onPointerMove:Zf(b.onPointerMove,ub=>{ub.target.hasPointerCapture(ub.pointerId)&&W(ub)}),onPointerUp:Zf(b.onPointerUp,ub=>{const Rb=ub.target;Rb.hasPointerCapture(ub.pointerId)&&
(Rb.releasePointerCapture(ub.pointerId),ia(ub))})}))}),LF=(0,pi.forwardRef)((b,g)=>{var {__scopeSlider:m}=b;b=Ya(b,["__scopeSlider"]);m=eu("SliderTrack",m);return(0,pi.createElement)(tj.span,re({"data-disabled":m.disabled?"":void 0,"data-orientation":m.orientation},b,{ref:g}))}),MF=(0,pi.forwardRef)((b,g)=>{var {__scopeSlider:m}=b;const I=Ya(b,["__scopeSlider"]),W=eu("SliderRange",m);m=fA("SliderRange",m);var ia=(0,pi.useRef)(null);g=bh(g,ia);var ua=W.values.length;ia=W.values.map(La=>Ni(La,W.min,
W.max));ua=1<ua?Math.min(...ia):0;ia=100-Math.max(...ia);return(0,pi.createElement)(tj.span,re({"data-orientation":W.orientation,"data-disabled":W.disabled?"":void 0},I,{ref:g,style:Ga(te({},b.style),{[m.startEdge]:ua+"%",[m.endEdge]:ia+"%"})}))}),NF=(0,pi.forwardRef)((b,g)=>{const m=FF(b.__scopeSlider),[I,W]=(0,pi.useState)(null);g=bh(g,ua=>W(ua));const ia=(0,pi.useMemo)(()=>I?m().findIndex(ua=>ua.ref.current===I):-1,[m,I]);return(0,pi.createElement)(OF,re({},b,{ref:g,index:ia}))}),OF=(0,pi.forwardRef)((b,
g)=>{const {__scopeSlider:m,index:I}=b,W=Ya(b,["__scopeSlider","index"]),ia=eu("SliderThumb",m),ua=fA("SliderThumb",m),[La,Va]=(0,pi.useState)(null);g=bh(g,ec=>Va(ec));var $a=Oi(La);const lb=ia.values[I],ub=void 0===lb?0:Ni(lb,ia.min,ia.max),Rb=Pf(I,ia.values.length);$a=($a=null===$a||void 0===$a?void 0:$a[ua.size])?mh($a,ub,ua.direction):0;(0,pi.useEffect)(()=>{if(La)return ia.thumbs.add(La),()=>{ia.thumbs.delete(La)}},[La,ia.thumbs]);return(0,pi.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",
position:"absolute",[ua.startEdge]:`calc(${ub}% + ${$a}px)`}},(0,pi.createElement)($v.ItemSlot,{scope:b.__scopeSlider},(0,pi.createElement)(tj.span,re({role:"slider","aria-label":b["aria-label"]||Rb,"aria-valuemin":ia.min,"aria-valuenow":lb,"aria-valuemax":ia.max,"aria-orientation":ia.orientation,"data-orientation":ia.orientation,"data-disabled":ia.disabled?"":void 0,tabIndex:ia.disabled?void 0:0},W,{ref:g,style:void 0===lb?{display:"none"}:b.style,onFocus:Zf(b.onFocus,()=>{ia.valueIndexToChangeRef.current=
I})}))))}),PF=b=>{const {value:g}=b;b=Ya(b,["value"]);const m=(0,pi.useRef)(null),I=ng(g);(0,pi.useEffect)(()=>{const W=m.current,ia=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(I!==g&&ia){const ua=new Event("input",{bubbles:!0});ia.call(W,g);W.dispatchEvent(ua)}},[I,g]);return(0,pi.createElement)("input",re({style:{display:"none"}},b,{ref:m,defaultValue:g}))},QF=IF,RF=LF,SF=MF,TF=NF,fu=vb(V(22));rb=V(586);var hA=sf(b=>{var {side:g,align:m,alignOffset:I,label:W,
arrow:ia,children:ua,border:La}=b;b=Ya(b,"side align alignOffset label arrow children border".split(" "));const Va=fu.useRef(null),[$a,lb]=fu.useState(!1),{viewport:{bounds:ub,camera:{point:Rb,zoom:ec}}}=xg(),[Vb,tc]=fu.useState(0);fu.useEffect(()=>{if(Va.current&&$a){var oc=Va.current.getBoundingClientRect();We.boundsContain(ub,{minX:oc.x,minY:oc.y,maxX:oc.right,maxY:oc.bottom,width:oc.width,height:oc.height})||tc(Xb=>Xb+1)}},[Rb[0],Rb[1],ec,$a]);return(0,rb.jsxs)(Zz,{onOpenChange:oc=>lb(oc),children:[(0,rb.jsx)(Vz,
Ga(te({},b),{"data-border":La,className:"tl-button tl-popover-trigger-button",children:W})),(0,rb.jsxs)(Wz,{ref:Va,className:"tl-popover-content",align:m,alignOffset:I,side:g,sideOffset:15,collisionBoundary:document.querySelector(".logseq-tldraw"),children:[ua,ia&&(0,rb.jsx)(Yz,{className:"tl-popover-arrow"})]},"popover-content-"+Vb)]})});rb=V(586);rb=V(586);var UF=sf(function(){const b=xg(),g=yF.useCallback(m=>{b.api.setColor(m)},[]);return(0,rb.jsx)("div",{className:"tl-primary-tools",children:(0,rb.jsxs)("div",
{className:"tl-toolbar tl-tools-floating-panel",children:[(0,rb.jsx)(Vo,{tooltip:"Select",id:"select",icon:"select-cursor"}),(0,rb.jsx)(Vo,{tooltip:"Move",id:"move",icon:b.isIn("move.panning")?"hand-grab":"hand-stop"}),(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"horizontal"}),(0,rb.jsx)(Vo,{tooltip:"Add block or page",id:"logseq-portal",icon:"circle-plus"}),(0,rb.jsx)(Vo,{tooltip:"Draw",id:"pencil",icon:"ballpen"}),(0,rb.jsx)(Vo,{tooltip:"Highlight",id:"highlighter",icon:"highlight"}),
(0,rb.jsx)(Vo,{tooltip:"Eraser",id:"erase",icon:"eraser"}),(0,rb.jsx)(Vo,{tooltip:"Connector",id:"line",icon:"connector"}),(0,rb.jsx)(Vo,{tooltip:"Text",id:"text",icon:"text"}),(0,rb.jsx)(EF,{}),(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"horizontal",style:{margin:"0 -4px"}}),(0,rb.jsx)(sg,{popoverSide:"left",color:b.settings.color,setColor:g})]})})});rb=V(586);sf(function(){const b=xg();return(0,rb.jsxs)("div",{className:"tl-statusbar",children:[b.selectedTool.id," | ",b.selectedTool.currentState.id,
(0,rb.jsx)("div",{style:{flex:1}}),(0,rb.jsx)("div",{id:"tl-statusbar-anchor",className:"flex gap-1"})]})});rb=V(586);var VF=sf(function(){return(0,rb.jsxs)(rb.Fragment,{children:[!1,!1,(0,rb.jsx)(UF,{}),(0,rb.jsx)(wF,{})]})}),Os=vb(V(22)),Sq=vb(V(22)),WF=vb(V(22)),Af=V(22),iA=V(31),XF=[" ","Enter","ArrowUp","ArrowDown"],YF=[" ","Enter"],[gu,aw,ZF]=ja("Select"),[Ps]=og("Select",[ZF]),[$F,Gr]=Ps("Select"),[aG,bG]=Ps("Select"),cG=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m,disabled:I=!1}=b;b=Ya(b,
["__scopeSelect","disabled"]);const W=Gr("SelectTrigger",m),ia=W.disabled||I;g=bh(g,W.onTriggerChange);const ua=aw(m),[La,Va,$a]=hg(lb=>{const ub=ua().filter(ec=>!ec.disabled),Rb=ub.find(ec=>ec.value===W.value);lb=$g(ub,lb,Rb);if(void 0!==lb)W.onValueChange(lb.value)});return(0,Af.createElement)(tj.button,re({type:"button",role:"combobox","aria-controls":W.contentId,"aria-expanded":W.open,"aria-required":W.required,"aria-autocomplete":"none",dir:W.dir,"data-state":W.open?"open":"closed",disabled:ia,
"data-disabled":ia?"":void 0,"data-placeholder":void 0===W.value?"":void 0},b,{ref:g,onClick:Zf(b.onClick,lb=>{lb.currentTarget.focus()}),onPointerDown:Zf(b.onPointerDown,lb=>{const ub=lb.target;ub.hasPointerCapture(lb.pointerId)&&ub.releasePointerCapture(lb.pointerId);0===lb.button&&!1===lb.ctrlKey&&(ia||(W.onOpenChange(!0),$a()),W.triggerPointerDownPosRef.current={x:Math.round(lb.pageX),y:Math.round(lb.pageY)},lb.preventDefault())}),onKeyDown:Zf(b.onKeyDown,lb=>{const ub=""!==La.current;lb.ctrlKey||
lb.altKey||lb.metaKey||1!==lb.key.length||Va(lb.key);ub&&" "===lb.key||!XF.includes(lb.key)||(ia||(W.onOpenChange(!0),$a()),lb.preventDefault())})}))}),dG=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m,children:I,placeholder:W}=b;b=Ya(b,["__scopeSelect","className","style","children","placeholder"]);const ia=Gr("SelectValue",m),{onValueNodeHasChildrenChange:ua}=ia,La=void 0!==I;g=bh(g,ia.onValueNodeChange);vn(()=>{ua(La)},[ua,La]);return(0,Af.createElement)(tj.span,re({},b,{ref:g,style:{pointerEvents:"none"}}),
void 0===ia.value&&void 0!==W?W:I)}),eG=(0,Af.forwardRef)((b,g)=>{const {children:m}=b;b=Ya(b,["__scopeSelect","children"]);return(0,Af.createElement)(tj.span,re({"aria-hidden":!0},b,{ref:g}),m||"▼")}),fG=(0,Af.forwardRef)((b,g)=>{const m=Gr("SelectContent",b.__scopeSelect),[I,W]=(0,Af.useState)();vn(()=>{W(new DocumentFragment)},[]);return(0,Af.createElement)(Af.Fragment,null,m.open?(0,Af.createElement)(gG,re({},b,{ref:g})):I?(0,iA.createPortal)((0,Af.createElement)(jA,{scope:b.__scopeSelect},(0,Af.createElement)(gu.Slot,
{scope:b.__scopeSelect},(0,Af.createElement)("div",null,b.children))),I):null)}),[jA,Hr]=Ps("SelectContent"),gG=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m,onCloseAutoFocus:I}=b;b=Ya(b,["__scopeSelect","onCloseAutoFocus"]);const W=Gr("SelectContent",m),[ia,ua]=(0,Af.useState)(null),[La,Va]=(0,Af.useState)(null),[$a,lb]=(0,Af.useState)(null);g=bh(g,Md=>Va(Md));const [ub,Rb]=(0,Af.useState)(null),[ec,Vb]=(0,Af.useState)(null),tc=aw(m),[oc,Xb]=(0,Af.useState)(!1),sc=(0,Af.useRef)(!0),Hc=(0,Af.useRef)(!1),
Rc=(0,Af.useRef)(!1);(0,Af.useEffect)(()=>{if(La)return Sv(La)},[La]);Tb();const [Vc,Vd]=(0,Af.useState)();vn(()=>{La&&Vd(window.getComputedStyle(La).zIndex)},[La]);const ae=(0,Af.useCallback)(Md=>{const [Ae,...Ie]=tc().map(gf=>gf.ref.current),[qf]=Ie.slice(-1),ef=document.activeElement;for(const gf of Md){if(gf===ef)break;null===gf||void 0===gf||gf.scrollIntoView({block:"nearest"});gf===Ae&&$a&&($a.scrollTop=0);gf===qf&&$a&&($a.scrollTop=$a.scrollHeight);null===gf||void 0===gf||gf.focus();if(document.activeElement!==
ef)break}},[tc,$a]),De=(0,Af.useCallback)(()=>{if(W.trigger&&W.valueNode&&ia&&La&&$a&&ub&&ec){var Md=W.trigger.getBoundingClientRect(),Ae=La.getBoundingClientRect(),Ie=W.valueNode.getBoundingClientRect(),qf=ec.getBoundingClientRect();"rtl"!==W.dir?(qf=Ie.left-(qf.left-Ae.left),Ie=Md.width+(Md.left-qf),Ae=Re(qf,[10,window.innerWidth-10-Math.max(Ie,Ae.width)]),ia.style.minWidth=Ie+"px",ia.style.left=Ae+"px"):(qf=window.innerWidth-Ie.right-(Ae.right-qf.right),Ie=Md.width+(window.innerWidth-Md.right-
qf),Ae=Re(qf,[10,window.innerWidth-10-Math.max(Ie,Ae.width)]),ia.style.minWidth=Ie+"px",ia.style.right=Ae+"px");const Ik=tc();Ae=window.innerHeight-20;var ef=$a.scrollHeight,gf=window.getComputedStyle(La);Ie=parseInt(gf.borderTopWidth,10);var Rg=parseInt(gf.paddingTop,10);qf=parseInt(gf.borderBottomWidth,10);gf=parseInt(gf.paddingBottom,10);var Sg=Ie+Rg+ef+gf+qf;ef=Math.min(5*ub.offsetHeight,Sg);var wi=window.getComputedStyle($a);gf=parseInt(wi.paddingTop,10);wi=parseInt(wi.paddingBottom,10);const Tk=
Md.top+Md.height/2-10,Do=Ae-Tk;Md=ub.offsetHeight/2;Rg=Ie+Rg+(ub.offsetTop+Md);Sg-=Rg;Rg<=Tk?(Ie=ub===Ik[Ik.length-1].ref.current,ia.style.bottom="0px",ia.style.height=Rg+Math.max(Do,Md+(Ie?wi:0)+(La.clientHeight-$a.offsetTop-$a.offsetHeight)+qf)+"px"):(qf=ub===Ik[0].ref.current,ia.style.top="0px",ia.style.height=Math.max(Tk,Ie+$a.offsetTop+(qf?gf:0)+Md)+Sg+"px",$a.scrollTop=Rg-Tk+$a.offsetTop);ia.style.margin="10px 0";ia.style.minHeight=ef+"px";ia.style.maxHeight=Ae+"px";Xb(!0);requestAnimationFrame(()=>
Hc.current=!0)}},[tc,W.trigger,W.valueNode,ia,La,$a,ub,ec,W.dir]);vn(()=>De(),[De]);const Oe=(0,Af.useCallback)(()=>ae([ub,La]),[ae,ub,La]);(0,Af.useEffect)(()=>{oc&&Oe()},[oc,Oe]);const tf=(0,Af.useCallback)(Md=>{Md&&!0===sc.current&&(De(),Oe(),sc.current=!1)},[De,Oe]),{onOpenChange:of,triggerPointerDownPosRef:bf}=W;(0,Af.useEffect)(()=>{if(La){var Md=0,Ae=0;const Ie=ef=>{var gf,Rg,Sg,wi;Md=Math.abs(Math.round(ef.pageX)-(null!==(gf=null===(Rg=bf.current)||void 0===Rg?void 0:Rg.x)&&void 0!==gf?gf:
0));Ae=Math.abs(Math.round(ef.pageY)-(null!==(Sg=null===(wi=bf.current)||void 0===wi?void 0:wi.y)&&void 0!==Sg?Sg:0))},qf=ef=>{10>=Md&&10>=Ae?ef.preventDefault():La.contains(ef.target)||of(!1);document.removeEventListener("pointermove",Ie);bf.current=null};null!==bf.current&&(document.addEventListener("pointermove",Ie),document.addEventListener("pointerup",qf,{capture:!0,once:!0}));return()=>{document.removeEventListener("pointermove",Ie);document.removeEventListener("pointerup",qf,{capture:!0})}}},
[La,of,bf]);(0,Af.useEffect)(()=>{const Md=()=>of(!1);window.addEventListener("blur",Md);window.addEventListener("resize",Md);return()=>{window.removeEventListener("blur",Md);window.removeEventListener("resize",Md)}},[of]);const [Ge,Fd]=hg(Md=>{const Ae=tc().filter(ef=>!ef.disabled),Ie=Ae.find(ef=>ef.ref.current===document.activeElement),qf=$g(Ae,Md,Ie);qf&&setTimeout(()=>qf.ref.current.focus())}),Oc=(0,Af.useCallback)((Md,Ae,Ie)=>{Ie=!Rc.current&&!Ie;if(void 0!==W.value&&W.value===Ae||Ie)Rb(Md),
Ie&&(Rc.current=!0)},[W.value]),md=(0,Af.useCallback)(()=>null===La||void 0===La?void 0:La.focus(),[La]),zd=(0,Af.useCallback)((Md,Ae,Ie)=>{Ie=!Rc.current&&!Ie;(void 0!==W.value&&W.value===Ae||Ie)&&Vb(Md)},[W.value]);return(0,Af.createElement)(jA,{scope:m,contentWrapper:ia,content:La,viewport:$a,onViewportChange:lb,itemRefCallback:Oc,selectedItem:ub,onItemLeave:md,itemTextRefCallback:zd,selectedItemText:ec,onScrollButtonChange:tf,isPositioned:oc,shouldExpandOnScrollRef:Hc,searchRef:Ge},(0,Af.createElement)(Zt,
{as:Oq,allowPinchZoom:!0},(0,Af.createElement)("div",{ref:ua,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Vc}},(0,Af.createElement)(Pv,{asChild:!0,trapped:W.open,onMountAutoFocus:Md=>{Md.preventDefault()},onUnmountAutoFocus:Zf(I,Md=>{var Ae;null===(Ae=W.trigger)||void 0===Ae||Ae.focus({preventScroll:!0});Md.preventDefault()})},(0,Af.createElement)(Nt,re({role:"listbox",id:W.contentId,"data-state":W.open?"open":"closed",dir:W.dir,onContextMenu:Md=>Md.preventDefault()},b,{ref:g,
style:te({display:"flex",flexDirection:"column",boxSizing:"border-box",maxHeight:"100%",outline:"none"},b.style),disableOutsidePointerEvents:!0,onFocusOutside:Md=>Md.preventDefault(),onDismiss:()=>W.onOpenChange(!1),onKeyDown:Zf(b.onKeyDown,Md=>{var Ae=Md.ctrlKey||Md.altKey||Md.metaKey;"Tab"===Md.key&&Md.preventDefault();Ae||1!==Md.key.length||Fd(Md.key);if(["ArrowUp","ArrowDown","Home","End"].includes(Md.key)){let Ie=tc().filter(qf=>!qf.disabled).map(qf=>qf.ref.current);["ArrowUp","End"].includes(Md.key)&&
(Ie=Ie.slice().reverse());["ArrowUp","ArrowDown"].includes(Md.key)&&(Ae=Ie.indexOf(Md.target),Ie=Ie.slice(Ae+1));setTimeout(()=>ae(Ie));Md.preventDefault()}})}))))))}),hG=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m}=b;b=Ya(b,["__scopeSelect"]);const I=Hr("SelectViewport",m);g=bh(g,I.onViewportChange);const W=(0,Af.useRef)(0);return(0,Af.createElement)(Af.Fragment,null,(0,Af.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,Af.createElement)(gu.Slot,{scope:m},(0,Af.createElement)(tj.div,re({"data-radix-select-viewport":"",role:"presentation"},b,{ref:g,style:te({position:"relative",flex:1,overflow:"auto"},b.style),onScroll:Zf(b.onScroll,ia=>{ia=ia.currentTarget;const {contentWrapper:ua,shouldExpandOnScrollRef:La}=I;if(null!==La&&void 0!==La&&La.current&&ua){var Va=Math.abs(W.current-ia.scrollTop);if(0<Va){var $a=window.innerHeight-20,lb=parseFloat(ua.style.minHeight);const ub=parseFloat(ua.style.height);lb=Math.max(lb,
ub);lb<$a&&(Va=lb+Va,$a=Math.min($a,Va),Va-=$a,ua.style.height=$a+"px","0px"===ua.style.bottom&&(ia.scrollTop=0<Va?Va:0,ua.style.justifyContent="flex-end"))}}W.current=ia.scrollTop})}))))});Ps("SelectGroup");var [iG,jG]=Ps("SelectItem"),kG=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m,value:I,disabled:W=!1,textValue:ia}=b;b=Ya(b,["__scopeSelect","value","disabled","textValue"]);const ua=Gr("SelectItem",m),La=Hr("SelectItem",m),Va=ua.value===I,[$a,lb]=(0,Af.useState)(null!==ia&&void 0!==ia?ia:""),
[ub,Rb]=(0,Af.useState)(!1);g=bh(g,tc=>{var oc;return null===(oc=La.itemRefCallback)||void 0===oc?void 0:oc.call(La,tc,I,W)});const ec=pl(),Vb=()=>{W||(ua.onValueChange(I),ua.onOpenChange(!1))};return(0,Af.createElement)(iG,{scope:m,value:I,disabled:W,textId:ec,isSelected:Va,onItemTextChange:(0,Af.useCallback)(tc=>{lb(oc=>{var Xb;return oc||(null!==(Xb=null===tc||void 0===tc?void 0:tc.textContent)&&void 0!==Xb?Xb:"").trim()})},[])},(0,Af.createElement)(gu.ItemSlot,{scope:m,value:I,disabled:W,textValue:$a},
(0,Af.createElement)(tj.div,re({role:"option","aria-labelledby":ec,"data-highlighted":ub?"":void 0,"aria-selected":Va&&ub,"data-state":Va?"checked":"unchecked","aria-disabled":W||void 0,"data-disabled":W?"":void 0,tabIndex:W?void 0:-1},b,{ref:g,onFocus:Zf(b.onFocus,()=>Rb(!0)),onBlur:Zf(b.onBlur,()=>Rb(!1)),onPointerUp:Zf(b.onPointerUp,Vb),onPointerMove:Zf(b.onPointerMove,tc=>{if(W){var oc;null===(oc=La.onItemLeave)||void 0===oc||oc.call(La)}else tc.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Zf(b.onPointerLeave,
tc=>{if(tc.currentTarget===document.activeElement){var oc;null===(oc=La.onItemLeave)||void 0===oc||oc.call(La)}}),onKeyDown:Zf(b.onKeyDown,tc=>{var oc;if(""===(null===(oc=La.searchRef)||void 0===oc?void 0:oc.current)||" "!==tc.key)YF.includes(tc.key)&&Vb()," "===tc.key&&tc.preventDefault()})}))))}),lG=(0,Af.forwardRef)((b,g)=>{var {__scopeSelect:m}=b;b=Ya(b,["__scopeSelect","className","style"]);const I=Gr("SelectItemText",m),W=Hr("SelectItemText",m),ia=jG("SelectItemText",m);m=bG("SelectItemText",
m);const [ua,La]=(0,Af.useState)(null);g=bh(g,Rb=>La(Rb),ia.onItemTextChange,Rb=>{var ec;return null===(ec=W.itemTextRefCallback)||void 0===ec?void 0:ec.call(W,Rb,ia.value,ia.disabled)});const Va=null===ua||void 0===ua?void 0:ua.textContent,$a=(0,Af.useMemo)(()=>(0,Af.createElement)("option",{key:ia.value,value:ia.value,disabled:ia.disabled},Va),[ia.disabled,ia.value,Va]),{onNativeOptionAdd:lb,onNativeOptionRemove:ub}=m;vn(()=>{lb($a);return()=>ub($a)},[lb,ub,$a]);return(0,Af.createElement)(Af.Fragment,
null,(0,Af.createElement)(tj.span,re({id:ia.textId},b,{ref:g})),ia.isSelected&&I.valueNode&&!I.valueNodeHasChildren?(0,iA.createPortal)(b.children,I.valueNode):null)}),mG=(0,Af.forwardRef)((b,g)=>{const m=Hr("SelectScrollUpButton",b.__scopeSelect),[I,W]=(0,Af.useState)(!1);g=bh(g,m.onScrollButtonChange);vn(()=>{if(m.viewport&&m.isPositioned){let ia=function(){W(0<ua.scrollTop)};const ua=m.viewport;ia();ua.addEventListener("scroll",ia);return()=>ua.removeEventListener("scroll",ia)}},[m.viewport,m.isPositioned]);
return I?(0,Af.createElement)(kA,re({},b,{ref:g,onAutoScroll:()=>{const {viewport:ia,selectedItem:ua}=m;ia&&ua&&(ia.scrollTop-=ua.offsetHeight)}})):null}),nG=(0,Af.forwardRef)((b,g)=>{const m=Hr("SelectScrollDownButton",b.__scopeSelect),[I,W]=(0,Af.useState)(!1);g=bh(g,m.onScrollButtonChange);vn(()=>{if(m.viewport&&m.isPositioned){let ia=function(){W(Math.ceil(ua.scrollTop)<ua.scrollHeight-ua.clientHeight)};const ua=m.viewport;ia();ua.addEventListener("scroll",ia);return()=>ua.removeEventListener("scroll",
ia)}},[m.viewport,m.isPositioned]);return I?(0,Af.createElement)(kA,re({},b,{ref:g,onAutoScroll:()=>{const {viewport:ia,selectedItem:ua}=m;ia&&ua&&(ia.scrollTop+=ua.offsetHeight)}})):null}),kA=(0,Af.forwardRef)((b,g)=>{const {__scopeSelect:m,onAutoScroll:I}=b;b=Ya(b,["__scopeSelect","onAutoScroll"]);const W=Hr("SelectScrollButton",m),ia=(0,Af.useRef)(null),ua=aw(m),La=(0,Af.useCallback)(()=>{null!==ia.current&&(window.clearInterval(ia.current),ia.current=null)},[]);(0,Af.useEffect)(()=>()=>La(),[La]);
vn(()=>{var Va;const $a=ua().find(lb=>lb.ref.current===document.activeElement);null===$a||void 0===$a||null===(Va=$a.ref.current)||void 0===Va||Va.scrollIntoView({block:"nearest"})},[ua]);return(0,Af.createElement)(tj.div,re({"aria-hidden":!0},b,{ref:g,style:te({flexShrink:0},b.style),onPointerMove:Zf(b.onPointerMove,()=>{var Va;null===(Va=W.onItemLeave)||void 0===Va||Va.call(W);null===ia.current&&(ia.current=window.setInterval(I,50))}),onPointerLeave:Zf(b.onPointerLeave,()=>{La()})}))}),lA=(0,Af.forwardRef)((b,
g)=>{const {value:m}=b;b=Ya(b,["value"]);const I=(0,Af.useRef)(null);g=bh(g,I);const W=ng(m);(0,Af.useEffect)(()=>{const ia=I.current,ua=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(W!==m&&ua){const La=new Event("change",{bubbles:!0});ua.call(ia,m);ia.dispatchEvent(La)}},[W,m]);return(0,Af.createElement)(oz,{asChild:!0},(0,Af.createElement)("select",re({},b,{ref:g,defaultValue:m})))});lA.displayName="BubbleSelect";var oG=b=>{const {__scopeSelect:g,children:m,
open:I,defaultOpen:W,onOpenChange:ia,value:ua,defaultValue:La,onValueChange:Va,dir:$a,name:lb,autoComplete:ub,disabled:Rb,required:ec}=b,[Vb,tc]=(0,Af.useState)(null),[oc,Xb]=(0,Af.useState)(null),[sc,Hc]=(0,Af.useState)(!1),Rc=Fb($a),[Vc=!1,Vd]=Qg({prop:I,defaultProp:W,onChange:ia}),[ae,De]=Qg({prop:ua,defaultProp:La,onChange:Va}),Oe=(0,Af.useRef)(null),tf=Vb?!!Vb.closest("form"):!0,[of,bf]=(0,Af.useState)(new Set),Ge=Array.from(of).map(Fd=>Fd.props.value).join(";");return(0,Af.createElement)($F,
{required:ec,scope:g,trigger:Vb,onTriggerChange:tc,valueNode:oc,onValueNodeChange:Xb,valueNodeHasChildren:sc,onValueNodeHasChildrenChange:Hc,contentId:pl(),value:ae,onValueChange:De,open:Vc,onOpenChange:Vd,dir:Rc,triggerPointerDownPosRef:Oe,disabled:Rb},(0,Af.createElement)(gu.Provider,{scope:g},(0,Af.createElement)(aG,{scope:b.__scopeSelect,onNativeOptionAdd:(0,Af.useCallback)(Fd=>{bf(Oc=>(new Set(Oc)).add(Fd))},[]),onNativeOptionRemove:(0,Af.useCallback)(Fd=>{bf(Oc=>{Oc=new Set(Oc);Oc.delete(Fd);
return Oc})},[])},m)),tf?(0,Af.createElement)(lA,{key:Ge,"aria-hidden":!0,required:ec,tabIndex:-1,name:lb,autoComplete:ub,value:ae,onChange:Fd=>De(Fd.target.value),disabled:Rb},void 0===ae?(0,Af.createElement)("option",{value:""}):null,Array.from(of)):null)},pG=cG,qG=dG,rG=eG,sG=b=>(0,Af.createElement)(mz,re({asChild:!0},b)),tG=fG,uG=hG,vG=kG,wG=lG,xG=mG,yG=nG;rb=V(586);var zG=vb(V(22)),Kn=vb(V(22)).default.createContext({}),AG=vb(V(22));rb=V(586);var mA=({id:b,showReferenceContent:g=!1})=>{var m;
const {handlers:{isWhiteboardPage:I,redirectToPage:W,sidebarAddBlock:ia,queryBlockByUUID:ua},renderers:{Breadcrumb:La,PageName:Va}}=AG.default.useContext(Kn);var $a="";let lb=Wh(b)?"B":"P",ub="";if(Wh(b)){$a=ua(b);if(!$a)return(0,rb.jsx)("span",{className:"p-2",children:"Invalid reference. Did you remove it?"});ub=$a.content;$a="whiteboard-shape"===(null==(m=$a.properties)?void 0:m["ls-type"])?"link-to-whiteboard":"link-to-block"}else $a=I(b)?"link-to-whiteboard":"link-to-page";m=ub&&23<ub.length?
ub.slice(0,20)+"...":ub;return(0,rb.jsxs)("button",{className:"inline-flex gap-1 items-center w-full",onPointerDown:Rb=>{Rb.stopPropagation();Rb.shiftKey?ia(b,"B"===lb?"block":"page"):W(b)},children:[(0,rb.jsx)(Oh,{name:$a}),(0,rb.jsx)("span",{className:"pointer-events-none block-link-reference-row",children:"P"===lb?(0,rb.jsx)(Va,{pageName:b}):(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)(La,{levelLimit:1,blockId:b,endSeparator:g}),g&&m]})})]})},zm=vb(V(22)),wn=V(22),BG=["children"],hu="undefined"!==
typeof document?wn.useLayoutEffect:wn.useEffect,hh=vb(V(22)),bi=V(22),CG=V(31),Qs,nm,DG="undefined"!=typeof document?bi.useLayoutEffect:bi.useEffect;!function(b){b[b.DEBUG=0]="DEBUG";b[b.INFO=1]="INFO";b[b.WARN=2]="WARN";b[b.ERROR=3]="ERROR"}(nm||={});var EG=((Qs={})[nm.DEBUG]="debug",Qs[nm.INFO]="log",Qs[nm.WARN]="warn",Qs[nm.ERROR]="error",Qs),Op=th(function(){var b=rf(nm.ERROR);return{log:rf(function(g,m,I){var W;void 0===I&&(I=nm.INFO);I>=(null!=(W=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?
W:b(4))&&console[EG[I]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",g,m)}),logLevel:b}},[],{singleton:!0}),xn=th(function(){var b=Jf(),g=Jf(),m=rf(0),I=Jf(),W=rf(0),ia=Jf(),ua=Jf(),La=rf(0),Va=rf(0),$a=rf(0),lb=rf(0),ub=Jf(),Rb=Jf(),ec=rf(!1),Vb=rf(!1);return Yf(Jd(b,Gf(function(tc){return tc.scrollTop})),g),Yf(Jd(b,Gf(function(tc){return tc.scrollHeight})),ua),Yf(g,W),{scrollContainerState:b,scrollTop:g,viewportHeight:ia,headerHeight:La,fixedHeaderHeight:Va,fixedFooterHeight:$a,
footerHeight:lb,scrollHeight:ua,smoothScrollTargetReached:I,react18ConcurrentRendering:Vb,scrollTo:ub,scrollBy:Rb,statefulScrollTop:W,deviation:m,scrollingInProgress:ec}},[],{singleton:!0}),Hi={lvl:0},bw=th(function(){return{recalcInProgress:rf(!1)}},[],{singleton:!0}),FG={offsetHeight:"height",offsetWidth:"width"},lp=th(function(b){var g=b[0].log,m=b[1].recalcInProgress;b=Jf();var I=Jf(),W=wh(I,0),ia=Jf(),ua=Jf(),La=rf(0),Va=rf([]),$a=rf(void 0),lb=rf(void 0),ub=rf(function(sc,Hc){return Qk(sc,FG[Hc])}),
Rb=rf(void 0),ec=rf(0),Vb={offsetTree:[],sizeTree:Hi,groupOffsetTree:Hi,lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},tc=wh(Jd(b,ue(Va,g,ec),ii(Fa,Vb),ye()),Vb);Yf(Jd(Va,ze(function(sc){return 0<sc.length}),ue(tc,ec),Gf(function(sc){var Hc=sc[0],Rc=sc[1],Vc=sc[2];sc=Hc.reduce(function(Vd,ae,De){return ti(Vd,ae,ab(ae,Rc.offsetTree,Vc)||De)},Hi);return Ve({},Rc,{groupIndices:Hc,groupOffsetTree:sc})})),tc);Yf(Jd(I,ue(tc),ze(function(sc){return sc[0]<sc[1].lastIndex}),Gf(function(sc){var Hc=sc[1];
return[{startIndex:sc[0],endIndex:Hc.lastIndex,size:Hc.lastSize}]})),b);Yf($a,lb);var oc=wh(Jd($a,Gf(function(sc){return void 0===sc})),!0);Yf(Jd(lb,ze(function(sc){return void 0!==sc&&tc(4).sizeTree===Hi}),Gf(function(sc){return[{startIndex:0,endIndex:0,size:sc}]})),b);Vb=uj(Jd(b,ue(tc),ii(function(sc,Hc){Hc=Hc[1];return{changed:Hc!==sc.sizes,sizes:Hc}},{changed:!1,sizes:Vb}),Gf(function(sc){return sc.changed})));di(Jd(La,ii(function(sc,Hc){return{diff:sc.prev-Hc,prev:Hc}},{diff:0,prev:0}),Gf(function(sc){return sc.diff})),
function(sc){0<sc?(m(0,!0),ia(0,sc)):0>sc&&ua(0,sc)});di(Jd(La,ue(g)),function(sc){0>sc[0]&&(0,sc[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:La},nm.ERROR)});g=uj(ia);Yf(Jd(ia,ue(tc),Gf(function(sc){var Hc=sc[0];sc=sc[1];if(0<sc.groupIndices.length)throw Error("Virtuoso: prepending items does not work with groups");return Wk(sc.sizeTree).reduce(function(Rc,Vc){var Vd=Vc.k;Vc=Vc.v;return{ranges:[].concat(Rc.ranges,
[{startIndex:Rc.prevIndex,endIndex:Vd+Hc-1,size:Rc.prevSize}]),prevIndex:Vd+Hc,prevSize:Vc}},{ranges:[],prevIndex:0,prevSize:sc.lastSize}).ranges})),b);var Xb=uj(Jd(ua,ue(tc,ec),Gf(function(sc){return ab(-sc[0],sc[1].offsetTree,sc[2])})));return Yf(Jd(ua,ue(tc,ec),Gf(function(sc){var Hc=sc[0],Rc=sc[1];sc=sc[2];if(0<Rc.groupIndices.length)throw Error("Virtuoso: shifting items does not work with groups");var Vc=Wk(Rc.sizeTree).reduce(function(Vd,ae){return ti(Vd,Math.max(0,ae.k+Hc),ae.v)},Hi);return Ve({},
Rc,{sizeTree:Vc},ta(Rc.offsetTree,0,Vc,sc))})),tc),{data:Rb,totalCount:I,sizeRanges:b,groupIndices:Va,defaultItemSize:lb,fixedItemSize:$a,unshiftWith:ia,shiftWith:ua,shiftWithOffset:Xb,beforeUnshiftWith:g,firstItemIndex:La,gap:ec,sizes:tc,listRefresh:Vb,statefulTotalCount:W,trackItemSizes:oc,itemSize:ub}},Qh(Op,bw),{singleton:!0}),GG="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style,Rs=th(function(b){function g(){oc&&(oc(),oc=null);sc&&(sc(),sc=null);Xb&&(clearTimeout(Xb),
Xb=null);La(0,!1)}var m=b[0],I=m.sizes,W=m.totalCount,ia=m.listRefresh;m=m.gap;var ua=b[1],La=ua.scrollingInProgress,Va=ua.viewportHeight,$a=ua.scrollTo,lb=ua.smoothScrollTargetReached,ub=ua.headerHeight,Rb=ua.footerHeight,ec=ua.fixedHeaderHeight;ua=ua.fixedFooterHeight;b=b[2].log;var Vb=Jf(),tc=rf(0),oc=null,Xb=null,sc=null;return Yf(Jd(Vb,ue(I,Va,W,tc,ub,Rb,b),ue(m,ec,ua),Gf(function(Hc){var Rc=Hc[0],Vc=Rc[0],Vd=Rc[1],ae=Rc[2],De=Rc[3],Oe=Rc[4],tf=Rc[5],of=Rc[6],bf=Rc[7],Ge=Hc[1];Rc=Hc[2];Hc=Hc[3];
var Fd=ac(Vc),Oc=Fd.align,md=Fd.behavior,zd=Fd.offset;--De;Fd=pb(Fd,Vd,De);tf=ab(Fd,Vd.offsetTree,Ge)+tf;"end"===Oc?(tf+=Rc+Wj(Vd.sizeTree,Fd)[1]-ae+Hc,Fd===De&&(tf+=of)):"center"===Oc?tf+=(Rc+Wj(Vd.sizeTree,Fd)[1]-ae+Hc)/2:tf-=Oe;zd&&(tf+=zd);var Md=function(Ie){g();Ie?(bf("retrying to scroll to",{location:Vc},nm.DEBUG),Vb(0,Vc)):bf("list did not change, scroll successful",{},nm.DEBUG)};if(g(),"smooth"===md){var Ae=!1;sc=di(ia,function(Ie){Ae=Ae||Ie});oc=Ci(lb,function(){Md(Ae)})}else oc=Ci(Jd(ia,
function(Ie){var qf=setTimeout(function(){Ie(!1)},150);return function(ef){ef&&(Ie(!0),clearTimeout(qf))}}),Md);Xb=setTimeout(function(){g()},1200);La(0,!0);return bf("scrolling from index to",{index:Fd,top:tf,behavior:md},nm.DEBUG),{top:tf,behavior:md}})),$a),{scrollToIndex:Vb,topListHeight:tc}},Qh(lp,xn,Op),{singleton:!0}),HG={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Ss=th(function(b){var g=b[0],m=g.scrollContainerState;
b=g.scrollTop;var I=g.viewportHeight,W=g.headerHeight,ia=g.footerHeight,ua=g.scrollBy;g=rf(!1);var La=rf(!0),Va=Jf(),$a=Jf(),lb=rf(4),ub=rf(0),Rb=wh(Jd(qi(Jd(de(b),sh(1),Jg(!0)),Jd(de(b),sh(1),Jg(!1),He(100))),ye()),!1),ec=wh(Jd(qi(Jd(ua,Jg(!0)),Jd(ua,Jg(!1),He(200))),ye()),!1);Yf(Jd(xi(de(b),de(ub)),Gf(function(Vb){return Vb[0]<=Vb[1]}),ye()),La);Yf(Jd(La,gk(50)),$a);I=uj(Jd(xi(m,de(I),de(W),de(ia),de(lb)),ii(function(Vb,tc){var oc,Xb,sc=tc[0],Hc=sc.scrollTop;sc=sc.scrollHeight;var Rc=tc[1],Vc={viewportHeight:Rc,
scrollTop:Hc,scrollHeight:sc};return Hc+Rc-sc>-tc[4]?(Hc>Vb.state.scrollTop?(oc="SCROLLED_DOWN",Xb=Vb.state.scrollTop-Hc):(oc="SIZE_DECREASED",Xb=Vb.state.scrollTop-Hc||Vb.scrollTopDelta),{atBottom:!0,state:Vc,atBottomBecause:oc,scrollTopDelta:Xb}):{atBottom:!1,notAtBottomBecause:Vc.scrollHeight>Vb.state.scrollHeight?"SIZE_INCREASED":Rc<Vb.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":Hc<Vb.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:Vc}},HG),ye(function(Vb,
tc){return Vb&&Vb.atBottom===tc.atBottom})));W=wh(Jd(m,ii(function(Vb,tc){var oc=tc.scrollTop,Xb=tc.scrollHeight;tc=tc.viewportHeight;return 1.01>Math.abs(Vb.scrollHeight-Xb)?{scrollTop:oc,scrollHeight:Xb,jump:0,changed:!1}:Vb.scrollTop!==oc&&1>Xb-(oc+tc)?{scrollHeight:Xb,scrollTop:oc,jump:Vb.scrollTop-oc,changed:!0}:{scrollHeight:Xb,scrollTop:oc,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),ze(function(Vb){return Vb.changed}),Gf(function(Vb){return Vb.jump})),0);Yf(Jd(I,Gf(function(Vb){return Vb.atBottom})),
g);Yf(Jd(g,gk(50)),Va);ia=rf("down");Yf(Jd(m,Gf(function(Vb){return Vb.scrollTop}),ye(),ii(function(Vb,tc){return ec(4)?{direction:Vb.direction,prevScrollTop:tc}:{direction:tc<Vb.prevScrollTop?"up":"down",prevScrollTop:tc}},{direction:"down",prevScrollTop:0}),Gf(function(Vb){return Vb.direction})),ia);Yf(Jd(m,gk(50),Jg("none")),ia);m=rf(0);return Yf(Jd(Rb,ze(function(Vb){return!Vb}),Jg(0)),m),Yf(Jd(b,gk(100),ue(Rb),ze(function(Vb){return!!Vb[1]}),ii(function(Vb,tc){return[Vb[1],tc[0]]},[0,0]),Gf(function(Vb){return Vb[1]-
Vb[0]})),m),{isScrolling:Rb,isAtTop:La,isAtBottom:g,atBottomState:I,atTopStateChange:$a,atBottomStateChange:Va,scrollDirection:ia,atBottomThreshold:lb,atTopThreshold:ub,scrollVelocity:m,lastJumpDueToItemResize:W}},Qh(xn)),Tq=th(function(b){var g=b[0].log;b=rf(!1);var m=uj(Jd(b,ze(function(I){return I}),ye()));return di(b,function(I){I&&g(4)("props updated",{},nm.DEBUG)}),{propsReady:b,didMount:m}},Qh(Op),{singleton:!0}),cw=th(function(b){var g=b[0],m=g.sizes,I=g.listRefresh;g=g.defaultItemSize;var W=
b[1].scrollTop,ia=b[2].scrollToIndex;b=b[3].didMount;var ua=rf(!0),La=rf(0);return Yf(Jd(b,ue(La),ze(function(Va){return!!Va[1]}),Jg(!1)),ua),di(Jd(xi(I,b),ue(ua,m,g),ze(function(Va){var $a=Va[1],lb=Va[3];return Va[0][1]&&(Va[2].sizeTree!==Hi||void 0!==lb)&&!$a}),ue(La)),function(Va){var $a=Va[1];setTimeout(function(){Ci(W,function(){ua(0,!0)});ia(0,$a)})}),{scrolledToInitialItem:ua,initialTopMostItemIndex:La}},Qh(lp,xn,Rs,Tq),{singleton:!0}),IG=th(function(b){function g(tc){Va(0,{index:"LAST",align:"end",
behavior:tc})}function m(tc){var oc=Ci(La,function(Xb){!tc||Xb.atBottom||"SIZE_INCREASED"!==Xb.notAtBottomBecause||Vb||(ub(4)("scrolling to bottom due to increased size",{},nm.DEBUG),g("auto"))});setTimeout(oc,100)}var I=b[0],W=I.totalCount,ia=I.listRefresh,ua=b[1];I=ua.isAtBottom;var La=ua.atBottomState,Va=b[2].scrollToIndex;ua=b[3].scrolledToInitialItem;var $a=b[4],lb=$a.propsReady;$a=$a.didMount;var ub=b[5].log;b=b[6].scrollingInProgress;var Rb=rf(!1),ec=Jf(),Vb=null;return di(Jd(xi(Jd(de(W),sh(1)),
$a),ue(de(Rb),I,ua,b),Gf(function(tc){var oc=tc[0],Xb=oc[0];oc=oc[1]&&tc[3];var sc="auto";oc&&(sc=tc[1],tc=tc[2]||tc[4],sc="function"==typeof sc?Ac(sc(tc)):tc&&Ac(sc),oc=oc&&!!sc);return{totalCount:Xb,shouldFollow:oc,followOutputBehavior:sc}}),ze(function(tc){return tc.shouldFollow})),function(tc){var oc=tc.totalCount,Xb=tc.followOutputBehavior;Vb&&(Vb(),Vb=null);Vb=Ci(ia,function(){ub(4)("following output to ",{totalCount:oc},nm.DEBUG);g(Xb);Vb=null})}),di(Jd(xi(de(Rb),W,lb),ze(function(tc){return tc[0]&&
tc[2]}),ii(function(tc,oc){oc=oc[1];return{refreshed:tc.value===oc,value:oc}},{refreshed:!1,value:0}),ze(function(tc){return tc.refreshed}),ue(Rb,W)),function(tc){m(!1!==tc[1])}),di(ec,function(){m(!1!==Rb(4))}),di(xi(de(Rb),La),function(tc){var oc=tc[1];tc[0]&&!oc.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===oc.notAtBottomBecause&&g("auto")}),{followOutput:Rb,autoscrollToBottom:ec}},Qh(lp,Ss,Rs,cw,Tq,Op,xn)),nA=th(function(b){var g=b[0],m=g.totalCount,I=g.groupIndices;g=g.sizes;var W=b[1];b=W.scrollTop;
W=W.headerHeight;var ia=Jf(),ua=Jf(),La=uj(Jd(ia,Gf(Cc)));return Yf(Jd(La,Gf(function(Va){return Va.totalCount})),m),Yf(Jd(La,Gf(function(Va){return Va.groupIndices})),I),Yf(Jd(xi(b,g,W),ze(function(Va){return Va[1].groupOffsetTree!==Hi}),Gf(function(Va){return Wj(Va[1].groupOffsetTree,Math.max(Va[0]-Va[2],0),"v")[0]}),ye(),Gf(function(Va){return[Va]})),ua),{groupCounts:ia,topItemsIndexes:ua}},Qh(lp,xn)),dw=th(function(b){var g=b[0];b=g.scrollTop;var m=g.viewportHeight,I=g.deviation,W=g.headerHeight,
ia=g.fixedHeaderHeight;g=Jf();var ua=rf(0),La=rf(0),Va=rf(0);b=wh(Jd(xi(de(b),de(m),de(W),de(g,Hd),de(Va),de(ua),de(ia),de(I),de(La)),Gf(function($a){var lb=$a[0],ub=$a[1],Rb=$a[2],ec=$a[3],Vb=ec[0];ec=ec[1];var tc=$a[4],oc=$a[6],Xb=$a[7],sc=$a[8],Hc=lb-Xb;$a=$a[5]+oc;var Rc=Math.max(Rb-Hc,0),Vc="none",Vd="number"==typeof sc?sc:sc.top||0;sc="number"==typeof sc?sc:sc.bottom||0;return Vb-=Xb,ec+=Rb+oc,Vb+(Rb+oc)>lb+$a-Vd&&(Vc="up"),ec-Xb<lb-Rc+ub+sc&&(Vc="down"),"none"!==Vc?[Math.max(Hc-Rb-qd(tc,"top",
Vc)-Vd,0),Hc-Rc-oc+ub+qd(tc,"bottom",Vc)+sc]:null}),ze(function($a){return null!=$a}),ye(Hd)),[0,0]);return{listBoundary:g,overscan:Va,topListHeight:ua,increaseViewportBy:La,visibleRange:b}},Qh(xn),{singleton:!0}),oA={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0},Ir=th(function(b){var g=b[0],m=g.sizes,I=g.totalCount,W=g.data,ia=g.firstItemIndex,ua=g.gap,La=b[1],Va=b[2],$a=Va.visibleRange;g=Va.listBoundary;Va=Va.topListHeight;var lb=b[3],
ub=lb.scrolledToInitialItem,Rb=lb.initialTopMostItemIndex;lb=b[4].topListHeight;var ec=b[5],Vb=b[6].didMount,tc=b[7].recalcInProgress;b=rf([]);var oc=Jf();Yf(La.topItemsIndexes,b);m=wh(Jd(xi(Vb,tc,de($a,Hd),de(I),de(m),de(Rb),ub,de(b),de(ia),de(ua),W),ze(function(Xb){return Xb[0]&&!Xb[1]}),Gf(function(Xb){var sc=Xb[2],Hc=sc[0],Rc=sc[1];sc=Xb[3];var Vc=Xb[5],Vd=Xb[6],ae=Xb[7],De=Xb[8],Oe=Xb[9],tf=Xb[10];Xb=Xb[4];var of=Xb.sizeTree,bf=Xb.offsetTree;if(0===sc||0===Hc&&0===Rc)return Ve({},oA,{totalCount:sc});
if(of===Hi)return yf(function(ef,gf,Rg){return gf.groupOffsetTree!==Hi?(ef=tb(ef,gf),[{index:Wj(gf.groupOffsetTree,ef)[0],size:0,offset:0},{index:ef,size:0,offset:0,data:Rg&&Rg[0]}]):[{index:ef,size:0,offset:0,data:Rg&&Rg[0]}]}("number"==typeof Vc?Vc:"LAST"===Vc.index?sc-1:Vc.index,Xb,tf),[],sc,Oe,Xb,De);Vc=[];if(0<ae.length){var Ge,Fd=ae[0],Oc=ae[ae.length-1],md=0;for(of=Bf(vm(of,Fd,Oc));!(Ge=of()).done;){var zd=Ge.value;Ge=zd.value;var Md=Math.min(zd.end,Oc);for(zd=Math.max(zd.start,Fd);zd<=Md;zd++)Vc.push({index:zd,
size:Ge,offset:md,data:tf&&tf[zd]}),md+=Ge}}if(!Vd)return yf([],Vc,sc,Oe,Xb,De);var Ae=0<ae.length?ae[ae.length-1]+1:0,Ie=function(ef,gf,Rg,Sg){return void 0===Sg&&(Sg=0),0<Sg&&(gf=Math.max(gf,ef[wm(ef,Sg,y)].offset)),Aj((Ik=Rg,Do=wm(wi=ef,gf,Tk=U),Rr=wm(wi,Ik,Tk,Do),wi.slice(Do,Rr+1)),xa);var wi,Ik,Tk,Do,Rr}(bf,Hc,Rc,Ae);if(0===Ie.length)return null;var qf=sc-1;return yf(Mj([],function(ef){for(var gf,Rg=Bf(Ie);!(gf=Rg()).done;){var Sg=gf.value,wi=Sg.value;gf=wi.offset;var Ik=Sg.start,Tk=wi.size;
wi.offset<Hc&&(wi=(Ik+=Math.floor((Hc-wi.offset+Oe)/(Tk+Oe)))-Sg.start,gf+=wi*Tk+wi*Oe);Ik<Ae&&(gf+=(Ae-Ik)*Tk,Ik=Ae);for(Sg=Math.min(Sg.end,qf);Ik<=Sg&&!(gf>=Rc);Ik++)ef.push({index:Ik,size:Tk,offset:gf,data:tf&&tf[Ik]}),gf+=Tk+Oe}}),Vc,sc,Oe,Xb,De)}),ze(function(Xb){return null!==Xb}),ye()),oA);return Yf(Jd(W,ze(function(Xb){return void 0!==Xb}),Gf(function(Xb){return Xb.length})),I),Yf(Jd(m,Gf(function(Xb){return Xb.topListHeight})),lb),Yf(lb,Va),Yf(Jd(m,Gf(function(Xb){return[Xb.top,Xb.bottom]})),
g),Yf(Jd(m,Gf(function(Xb){return Xb.items})),oc),Ve({listState:m,topItemsIndexes:b,endReached:uj(Jd(m,ze(function(Xb){return 0<Xb.items.length}),ue(I,W),ze(function(Xb){var sc=Xb[0].items;return sc[sc.length-1].originalIndex===Xb[1]-1}),Gf(function(Xb){return[Xb[1]-1,Xb[2]]}),ye(Hd),Gf(function(Xb){return Xb[0]}))),startReached:uj(Jd(m,gk(200),ze(function(Xb){var sc=Xb.items;return 0<sc.length&&sc[0].originalIndex===Xb.topItems.length}),Gf(function(Xb){return Xb.items[0].index}),ye())),rangeChanged:uj(Jd(m,
ze(function(Xb){return 0<Xb.items.length}),Gf(function(Xb){Xb=Xb.items;for(var sc=0,Hc=Xb.length-1;"group"===Xb[sc].type&&sc<Hc;)sc++;for(;"group"===Xb[Hc].type&&Hc>sc;)Hc--;return{startIndex:Xb[sc].index,endIndex:Xb[Hc].index}}),ye(Pd))),itemsRendered:oc},ec)},Qh(lp,nA,dw,cw,Rs,Ss,Tq,bw),{singleton:!0}),JG=th(function(b){var g=b[0],m=g.sizes,I=g.firstItemIndex,W=g.data;g=g.gap;var ia=b[1].listState;b=b[2].didMount;var ua=rf(0);return Yf(Jd(b,ue(ua),ze(function(La){return 0!==La[1]}),ue(m,I,g,W),
Gf(function(La){var Va=La[0][1],$a=La[1],lb=La[2],ub=La[3];La=La[4];var Rb=void 0===La?[]:La;La=0;if(0<$a.groupIndices.length)for(var ec,Vb=Bf($a.groupIndices);!((ec=Vb()).done||ec.value-La>=Va);)La++;Va+=La;return yf(Array.from({length:Va}).map(function(tc,oc){return{index:oc,size:0,offset:0,data:Rb[oc]}}),[],Va,ub,$a,lb)})),ia),{initialItemCount:ua}},Qh(lp,Ir,Tq),{singleton:!0}),pA=th(function(b){b=b[0].scrollVelocity;var g=rf(!1),m=Jf(),I=rf(!1);return Yf(Jd(b,ue(I,g,m),ze(function(W){return!!W[1]}),
Gf(function(W){var ia=W[0],ua=W[1],La=W[2];W=W[3];var Va=ua.enter;if(La){if((0,ua.exit)(ia,W))return!1}else if(Va(ia,W))return!0;return La}),ye()),g),di(Jd(xi(g,b,m),ue(I)),function(W){var ia=W[0];W=W[1];return ia[0]&&W&&W.change&&W.change(ia[1],ia[2])}),{isSeeking:g,scrollSeekConfiguration:I,scrollVelocity:b,scrollSeekRangeChanged:m}},Qh(Ss),{singleton:!0}),KG=th(function(b){b=b[0].topItemsIndexes;var g=rf(0);return Yf(Jd(g,ze(function(m){return 0<m}),Gf(function(m){return Array.from({length:m}).map(function(I,
W){return W})})),b),{topItemCount:g}},Qh(Ir)),ew=th(function(b){var g=b[0],m=g.footerHeight,I=g.headerHeight,W=g.fixedHeaderHeight;g=g.fixedFooterHeight;var ia=b[1].listState;b=Jf();m=wh(Jd(xi(m,g,I,W,ia),Gf(function(ua){var La=ua[4];return ua[0]+ua[1]+ua[2]+ua[3]+La.offsetBottom+La.bottom})),0);return Yf(de(m),b),{totalListHeight:m,totalListHeightChanged:b}},Qh(xn,Ir),{singleton:!0}),LG=Eg(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),MG=th(function(b){function g(oc){0<
oc?(I(0,{top:-oc,behavior:"auto"}),ia(0,0)):(ia(0,0),I(0,{top:-oc,behavior:"auto"}))}var m=b[0],I=m.scrollBy,W=m.scrollTop,ia=m.deviation,ua=m.scrollingInProgress,La=b[1];m=La.isScrolling;var Va=La.isAtBottom,$a=La.scrollDirection,lb=b[3],ub=lb.beforeUnshiftWith,Rb=lb.shiftWithOffset,ec=lb.sizes;lb=lb.gap;var Vb=b[4].log,tc=b[5].recalcInProgress;b=uj(Jd(b[2].listState,ue(La.lastJumpDueToItemResize),ii(function(oc,Xb){var sc=oc[1],Hc=Xb[0],Rc=Hc.items,Vc=Hc.totalCount;Hc=Hc.bottom+Hc.offsetBottom;
var Vd=0;return oc[2]===Vc&&0<sc.length&&0<Rc.length&&(0===Rc[0].originalIndex&&0===sc[0].originalIndex||0!=(Vd=Hc-oc[3])&&(Vd+=Xb[1])),[Vd,Rc,Vc,Hc]},[0,[],0,0]),ze(function(oc){return 0!==oc[0]}),ue(W,$a,ua,Va,Vb),ze(function(oc){return!oc[3]&&0!==oc[1]&&"up"===oc[2]}),Gf(function(oc){var Xb=oc[0][0];return(0,oc[5])("Upward scrolling compensation",{amount:Xb},nm.DEBUG),Xb})));return di(Jd(b,ue(ia,m)),function(oc){var Xb=oc[0],sc=oc[1];oc[2]&&LG()?ia(0,sc-Xb):g(-Xb)}),di(Jd(xi(wh(m,!1),ia,tc),ze(function(oc){return!oc[0]&&
!oc[2]&&0!==oc[1]}),Gf(function(oc){return oc[1]}),gk(1)),g),Yf(Jd(Rb,Gf(function(oc){return{top:-oc}})),I),di(Jd(ub,ue(ec,lb),Gf(function(oc){var Xb=oc[0];return Xb*oc[1].lastSize+Xb*oc[2]})),function(oc){ia(0,oc);requestAnimationFrame(function(){Lm(I,{top:oc});requestAnimationFrame(function(){ia(0,0);tc(0,!1)})})}),{deviation:ia}},Qh(xn,Ss,Ir,lp,Op,bw)),NG=th(function(b){var g=b[0].totalListHeight,m=b[1].didMount,I=b[2].scrollTo;b=rf(0);return di(Jd(m,ue(b),ze(function(W){return 0!==W[1]}),Gf(function(W){return{top:W[1]}})),
function(W){Ci(Jd(g,ze(function(ia){return 0!==ia})),function(){setTimeout(function(){I(0,W)})})}),{initialScrollTop:b}},Qh(ew,Tq,xn),{singleton:!0}),OG=th(function(b){var g=b[0].viewportHeight;b=b[1].totalListHeight;var m=rf(!1);return{alignToBottom:m,paddingTopAddition:wh(Jd(xi(m,g,b),ze(function(I){return I[0]}),Gf(function(I){return Math.max(0,I[1]-I[2])}),ye()),0)}},Qh(xn,ew),{singleton:!0}),qA=th(function(b){var g=b[0];b=g.scrollTo;g=g.scrollContainerState;var m=Jf(),I=Jf(),W=Jf(),ia=rf(!1),
ua=rf(void 0);return Yf(Jd(xi(m,I),Gf(function(La){var Va=La[0];return{scrollTop:Math.max(0,Va.scrollTop-La[1].offsetTop),scrollHeight:Va.scrollHeight,viewportHeight:Va.viewportHeight}})),g),Yf(Jd(b,ue(I),Gf(function(La){var Va=La[0];return Ve({},Va,{top:Va.top+La[1].offsetTop})})),W),{useWindowScroll:ia,customScrollParent:ua,windowScrollContainerState:m,windowViewportRect:I,windowScrollTo:W}},Qh(xn)),rA=["done","behavior","align"],PG=th(function(b){var g=b[0],m=g.sizes,I=g.totalCount;g=g.gap;var W=
b[1],ia=W.scrollTop,ua=W.viewportHeight,La=W.headerHeight,Va=W.fixedHeaderHeight,$a=W.fixedFooterHeight,lb=W.scrollingInProgress;b=b[2].scrollToIndex;W=Jf();return Yf(Jd(W,ue(m,ua,I,La,Va,$a,ia),ue(g),Gf(function(ub){var Rb=ub[0],ec=Rb[0],Vb=Rb[1],tc=Rb[2],oc=Rb[3],Xb=Rb[4],sc=Rb[5],Hc=Rb[6];Rb=Rb[7];var Rc=ub[1];ub=ec.done;var Vc=ec.behavior,Vd=ec.align,ae=Ml(ec,rA),De=null;ec=pb(ec,Vb,oc-1);Xb=ab(ec,Vb.offsetTree,Rc)+Xb+sc;return Xb<Rb+sc?De=Ve({},ae,{behavior:Vc,align:null!=Vd?Vd:"start"}):Xb+
Wj(Vb.sizeTree,ec)[1]>Rb+tc-Hc&&(De=Ve({},ae,{behavior:Vc,align:null!=Vd?Vd:"end"})),De?ub&&Ci(Jd(lb,sh(1),ze(function(Oe){return!1===Oe})),ub):ub&&ub(),De}),ze(function(ub){return null!==ub})),b),{scrollIntoView:W}},Qh(lp,xn,Rs,Ir,Op),{singleton:!0}),QG=["listState","topItemsIndexes"],RG=th(function(b){return Ve({},b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])},Qh(dw,JG,Tq,pA,ew,NG,OG,qA,PG)),sA=th(function(b){var g=b[0],m=g.totalCount,I=g.sizeRanges,W=g.fixedItemSize,ia=g.defaultItemSize,ua=g.trackItemSizes,
La=g.itemSize,Va=g.data,$a=g.firstItemIndex,lb=g.groupIndices,ub=g.statefulTotalCount;g=g.gap;var Rb=b[1],ec=Rb.initialTopMostItemIndex;Rb=Rb.scrolledToInitialItem;var Vb=b[2],tc=b[3],oc=b[4],Xb=oc.listState,sc=oc.topItemsIndexes;oc=Ml(oc,QG);var Hc=b[5].scrollToIndex,Rc=b[7].topItemCount,Vc=b[8].groupCounts,Vd=b[9];b=b[10];return Yf(oc.rangeChanged,Vd.scrollSeekRangeChanged),Yf(Jd(Vd.windowViewportRect,Gf(function(ae){return ae.visibleHeight})),Vb.viewportHeight),Ve({totalCount:m,data:Va,firstItemIndex:$a,
sizeRanges:I,initialTopMostItemIndex:ec,scrolledToInitialItem:Rb,topItemsIndexes:sc,topItemCount:Rc,groupCounts:Vc,fixedItemHeight:W,defaultItemHeight:ia,gap:g},tc,{statefulTotalCount:ub,listState:Xb,scrollToIndex:Hc,trackItemSizes:ua,itemSize:La,groupIndices:lb},oc,Vd,Vb,b)},Qh(lp,cw,xn,IG,Ir,Rs,MG,KG,nA,RG,Op)),tA=Eg(function(){if("undefined"==typeof document)return"sticky";var b=document.createElement("div");return b.style.position="-webkit-sticky","-webkit-sticky"===b.style.position?"-webkit-sticky":
"sticky"}),iu=hh.createContext(void 0),uA=hh.createContext(void 0),SG=["placeholder"],TG=["style","children"],UG=["style","children"],VG=th(function(){var b=rf(function(Va){return"Item "+Va}),g=rf(null),m=rf(function(Va){return"Group "+Va}),I=rf({}),W=rf(kg),ia=rf("div"),ua=rf(ag),La=function(Va,$a){return void 0===$a&&($a=null),wh(Jd(I,Gf(function(lb){return lb[Va]}),ye()),$a)};return{context:g,itemContent:b,groupContent:m,components:I,computeItemKey:W,headerFooterTag:ia,scrollerRef:ua,FooterComponent:La("Footer"),
HeaderComponent:La("Header"),TopItemListComponent:La("TopItemList"),ListComponent:La("List","div"),ItemComponent:La("Item","div"),GroupComponent:La("Group","div"),ScrollerComponent:La("Scroller","div"),EmptyPlaceholder:La("EmptyPlaceholder"),ScrollSeekPlaceholder:La("ScrollSeekPlaceholder")}}),WG=th(function(b){function g(W,ia,ua){Yf(Jd(W,ue(I.components),Gf(function(La){var Va,$a=La[0];La=La[1];return console.warn("react-virtuoso: "+ua+" property is deprecated. Pass components."+ia+" instead."),
Ve({},La,((Va={})[ia]=$a,Va))})),I.components)}var m=b[0],I=b[1];b={item:Vg(I.itemContent,"Rename the %citem%c prop to %citemContent."),group:Vg(I.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Vg(m.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Vg(m.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Vg(m.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:Jf(),
maxHeightCacheSize:Jf(),footer:Jf(),header:Jf(),HeaderContainer:Jf(),FooterContainer:Jf(),ItemContainer:Jf(),ScrollContainer:Jf(),GroupContainer:Jf(),ListContainer:Jf(),emptyComponent:Jf(),scrollSeek:Jf()};return di(b.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;")}),di(b.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),
di(b.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.")}),di(b.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.")}),di(b.scrollSeek,function(W){var ia=W.placeholder;
W=Ml(W,SG);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ia=Ve({},(0,I.components)(4),{ScrollSeekPlaceholder:ia});(0,I.components)(0,ia);(0,m.scrollSeekConfiguration)(0,W)}),g(b.footer,"Footer","footer"),g(b.header,"Header","header"),g(b.ItemContainer,"Item","ItemContainer"),g(b.ListContainer,"List","ListContainer"),g(b.ScrollContainer,"Scroller","ScrollContainer"),g(b.emptyComponent,
"EmptyPlaceholder","emptyComponent"),g(b.GroupContainer,"Group","GroupContainer"),Ve({},m,I,b)},Qh(sA,VG)),XG=function(b){return hh.createElement("div",{style:{height:b.height}})},YG={position:tA(),zIndex:1,overflowAnchor:"none"},ZG={overflowAnchor:"none"},vA=hh.memo(function(b){b=b.showTopList;b=void 0!==b&&b;var g=cj("listState"),m=bo("sizeRanges"),I=cj("useWindowScroll"),W=cj("customScrollParent"),ia=bo("windowScrollContainerState"),ua=bo("scrollContainerState");I=W||I?ia:ua;var La=cj("itemContent"),
Va=cj("context"),$a=cj("groupContent");ia=cj("trackItemSizes");ua=cj("itemSize");var lb=cj("log"),ub=bo("gap");m=ji(m,ua,ia,b?ag:I,lb,ub,W).callbackRef;W=hh.useState(0);var Rb=W[0],ec=W[1];fw("deviation",function(Rc){Rb!==Rc&&ec(Rc)});W=cj("EmptyPlaceholder");var Vb=cj("ScrollSeekPlaceholder")||XG;I=cj("ListComponent");var tc=cj("ItemComponent"),oc=cj("GroupComponent"),Xb=cj("computeItemKey"),sc=cj("isSeeking"),Hc=0<cj("groupIndices").length;ia=cj("paddingTopAddition");ia=b?{}:{boxSizing:"border-box",
paddingTop:g.offsetTop+ia,paddingBottom:g.offsetBottom,marginTop:Rb};return!b&&0===g.totalCount&&W?(0,bi.createElement)(W,Hg(W,Va)):(0,bi.createElement)(I,Ve({},Hg(I,Va),{ref:m,style:ia,"data-test-id":b?"virtuoso-top-item-list":"virtuoso-item-list"}),(b?g.topItems:g.items).map(function(Rc){var Vc=Rc.originalIndex,Vd=Xb(Vc+g.firstItemIndex,Rc.data,Va);return sc?(0,bi.createElement)(Vb,Ve({},Hg(Vb,Va),{key:Vd,index:Rc.index,height:Rc.size,type:Rc.type||"item"},"group"===Rc.type?{}:{groupIndex:Rc.groupIndex})):
"group"===Rc.type?(0,bi.createElement)(oc,Ve({},Hg(oc,Va),{key:Vd,"data-index":Vc,"data-known-size":Rc.size,"data-item-index":Rc.index,style:YG}),$a(Rc.index)):(0,bi.createElement)(tc,Ve({},Hg(tc,Va),{key:Vd,"data-index":Vc,"data-known-size":Rc.size,"data-item-index":Rc.index,"data-item-group-index":Rc.groupIndex,style:ZG}),Hc?La(Rc.index,Rc.groupIndex,Rc.data,Va):La(Rc.index,Rc.data,Va))}))}),$G={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Jr=
{width:"100%",height:"100%",position:"absolute",top:0},aH={width:"100%",position:tA(),top:0},bH=hh.memo(function(){var b=cj("HeaderComponent"),g=bo("headerHeight"),m=cj("headerFooterTag"),I=ch(function(ia){return g(Qk(ia,"height"))}),W=cj("context");return b?(0,bi.createElement)(m,{ref:I},(0,bi.createElement)(b,Hg(b,W))):null}),cH=hh.memo(function(){var b=cj("FooterComponent"),g=bo("footerHeight"),m=cj("headerFooterTag"),I=ch(function(ia){return g(Qk(ia,"height"))}),W=cj("context");return b?(0,bi.createElement)(m,
{ref:I},(0,bi.createElement)(b,Hg(b,W))):null}),dH=function(b){b=b.children;var g=(0,bi.useContext)(iu),m=bo("viewportHeight"),I=bo("fixedItemHeight"),W=ch(kh(m,function(ia){return Qk(ia,"height")}));return hh.useEffect(function(){g&&(m(g.viewportHeight),I(g.itemHeight))},[g,m,I]),hh.createElement("div",{style:Jr,ref:W,"data-viewport-type":"element"},b)},eH=function(b){b=b.children;var g=(0,bi.useContext)(iu),m=bo("windowViewportRect"),I=bo("fixedItemHeight"),W=cj("customScrollParent");W=kj(m,W);
return hh.useEffect(function(){g&&(I(g.itemHeight),m({offsetTop:0,visibleHeight:g.viewportHeight,visibleWidth:100}))},[g,m,I]),hh.createElement("div",{ref:W,style:Jr,"data-viewport-type":"window"},b)},fH=function(b){b=b.children;var g=cj("TopItemListComponent"),m=cj("headerHeight");m=Ve({},aH,{marginTop:m+"px"});var I=cj("context");return(0,bi.createElement)(g||"div",{style:m,context:I},b)},ju=yl(WG,{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"}},hh.memo(function(b){var g=cj("useWindowScroll"),m=0<cj("topItemsIndexes").length,I=cj("customScrollParent"),W=I||g?eH:dH;return hh.createElement(I||g?iH:hH,Ve({},b),hh.createElement(W,null,hh.createElement(bH,null),hh.createElement(vA,null),hh.createElement(cH,
null)),m&&hh.createElement(fH,null,hh.createElement(vA,{showTopList:!0})))})),gH=ju.Component,bo=ju.usePublisher,cj=ju.useEmitterValue,fw=ju.useEmitter,hH=ki({usePublisher:bo,useEmitterValue:cj,useEmitter:fw}),iH=Ph({usePublisher:bo,useEmitterValue:cj,useEmitter:fw}),wA={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},jH={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},xA=Math.round,yA=Math.ceil,ku=Math.floor,gw=Math.min,Kr=Math.max,
kH=th(function(b){var g=b[0],m=g.overscan,I=g.visibleRange,W=g.listBoundary,ia=b[1];g=ia.scrollTop;var ua=ia.viewportHeight,La=ia.scrollBy,Va=ia.scrollTo,$a=ia.smoothScrollTargetReached,lb=ia.scrollContainerState,ub=ia.footerHeight;ia=ia.headerHeight;var Rb=b[2],ec=b[3],Vb=b[4],tc=Vb.propsReady,oc=Vb.didMount,Xb=b[5];Vb=Xb.windowViewportRect;var sc=Xb.windowScrollTo,Hc=Xb.useWindowScroll,Rc=Xb.customScrollParent;Xb=Xb.windowScrollContainerState;b=b[6];var Vc=rf(0),Vd=rf(0),ae=rf(wA),De=rf({height:0,
width:0}),Oe=rf({height:0,width:0}),tf=Jf(),of=Jf(),bf=rf(0),Ge=rf(void 0),Fd=rf({row:0,column:0});Yf(Jd(xi(oc,Vd,Ge),ze(function(Oc){return 0!==Oc[1]}),Gf(function(Oc){return{items:bg(0,Oc[1]-1,Oc[2]),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),ae);Yf(Jd(xi(de(Vc),I,de(Fd,Nf),de(Oe,function(Oc,md){return Oc&&Oc.width===md.width&&Oc.height===md.height}),Ge),ue(De),Gf(function(Oc){var md=Oc[0],zd=md[0],Md=md[1],Ae=Md[0],Ie=Md[1],qf=md[2],ef=md[3],gf=md[4],Rg=Oc[1];Oc=qf.row;
var Sg=qf.column;md=ef.height;Md=ef.width;var wi=Rg.width;if(0===zd||0===wi)return wA;if(0===Md)return Ve({},jH,{items:bg(0,0,gf)});Sg=Kr(1,ku((wi+Sg)/(Md+Sg)));Ae=Sg*ku((Ae+Oc)/(md+Oc));Ie=Sg*yA((Ie+Oc)/(md+Oc))-1;Ie=gw(zd-1,Kr(Ie,Sg-1));Ae=bg(gw(Ie,Kr(0,Ae)),Ie,gf);ef=Bh(Rg,qf,ef,Ae);qf=ef.top;ef=ef.bottom;zd=yA(zd/Sg);return{items:Ae,offsetTop:qf,offsetBottom:zd*md+(zd-1)*Oc-ef,top:qf,bottom:ef,itemHeight:md,itemWidth:Md}})),ae);Yf(Jd(Ge,ze(function(Oc){return void 0!==Oc}),Gf(function(Oc){return Oc.length})),
Vc);Yf(Jd(De,Gf(function(Oc){return Oc.height})),ua);Yf(Jd(xi(De,Oe,ae,Fd),Gf(function(Oc){Oc=Bh(Oc[0],Oc[3],Oc[1],Oc[2].items);return[Oc.top,Oc.bottom]}),ye(Hd)),W);I=uj(Jd(de(ae),ze(function(Oc){return 0<Oc.items.length}),ue(Vc),ze(function(Oc){var md=Oc[0].items;return md[md.length-1].index===Oc[1]-1}),Gf(function(Oc){return Oc[1]-1}),ye()));W=uj(Jd(de(ae),ze(function(Oc){Oc=Oc.items;return 0<Oc.length&&0===Oc[0].index}),Jg(0),ye()));ua=uj(Jd(de(ae),ze(function(Oc){return 0<Oc.items.length}),Gf(function(Oc){Oc=
Oc.items;return{startIndex:Oc[0].index,endIndex:Oc[Oc.length-1].index}}),ye(Pd)));Yf(ua,ec.scrollSeekRangeChanged);Yf(Jd(tf,ue(De,Oe,Vc,Fd),Gf(function(Oc){var md=Oc[1],zd=Oc[2],Md=Oc[3],Ae=Oc[4],Ie=ac(Oc[0]);Oc=Ie.align;var qf=Ie.behavior,ef=Ie.offset;Ie=Ie.index;"LAST"===Ie&&(Ie=Md-1);Md=dh(md,Ae,zd,Kr(0,Ie,gw(Md-1,Ie)));return"end"===Oc?Md=xA(Md-md.height+zd.height):"center"===Oc&&(Md=xA(Md-md.height/2+zd.height/2)),ef&&(Md+=ef),{top:Md,behavior:qf}})),Va);oc=wh(Jd(ae,Gf(function(Oc){return Oc.offsetBottom+
Oc.bottom})),0);return Yf(Jd(Vb,Gf(function(Oc){return{width:Oc.visibleWidth,height:Oc.visibleHeight}})),De),Ve({data:Ge,totalCount:Vc,viewportDimensions:De,itemDimensions:Oe,scrollTop:g,scrollHeight:of,overscan:m,scrollBy:La,scrollTo:Va,scrollToIndex:tf,smoothScrollTargetReached:$a,windowViewportRect:Vb,windowScrollTo:sc,useWindowScroll:Hc,customScrollParent:Rc,windowScrollContainerState:Xb,deviation:bf,scrollContainerState:lb,footerHeight:ub,headerHeight:ia,initialItemCount:Vd,gap:Fd},ec,{gridState:ae,
totalListHeight:oc},Rb,{startReached:W,endReached:I,rangeChanged:ua,propsReady:tc},b)},Qh(dw,xn,Ss,pA,Tq,qA,Op)),lH=["placeholder"],mH=th(function(){var b=rf(function($a){return"Item "+$a}),g=rf({}),m=rf(null),I=rf("virtuoso-grid-item"),W=rf("virtuoso-grid-list"),ia=rf(kg),ua=rf("div"),La=rf(ag),Va=function($a,lb){return void 0===lb&&(lb=null),wh(Jd(g,Gf(function(ub){return ub[$a]}),ye()),lb)};return{context:m,itemContent:b,components:g,computeItemKey:ia,itemClassName:I,listClassName:W,headerFooterTag:ua,
scrollerRef:La,FooterComponent:Va("Footer"),HeaderComponent:Va("Header"),ListComponent:Va("List","div"),ItemComponent:Va("Item","div"),ScrollerComponent:Va("Scroller","div"),ScrollSeekPlaceholder:Va("ScrollSeekPlaceholder","div")}}),nH=th(function(b){function g(W,ia,ua){Yf(Jd(W,ue(I.components),Gf(function(La){var Va,$a=La[0];La=La[1];return console.warn("react-virtuoso: "+ua+" property is deprecated. Pass components."+ia+" instead."),Ve({},La,((Va={})[ia]=$a,Va))})),I.components)}var m=b[0],I=b[1];
b={item:Vg(I.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:Jf(),ScrollContainer:Jf(),ListContainer:Jf(),emptyComponent:Jf(),scrollSeek:Jf()};return di(b.scrollSeek,function(W){var ia=W.placeholder;W=Ml(W,lH);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ia=Ve({},(0,I.components)(4),{ScrollSeekPlaceholder:ia});(0,I.components)(0,ia);(0,m.scrollSeekConfiguration)(0,
W)}),g(b.ItemContainer,"Item","ItemContainer"),g(b.ListContainer,"List","ListContainer"),g(b.ScrollContainer,"Scroller","ScrollContainer"),Ve({},m,I,b)},Qh(kH,mH)),oH=hh.memo(function(){var b=sl("gridState"),g=sl("listClassName"),m=sl("itemClassName"),I=sl("itemContent"),W=sl("computeItemKey"),ia=sl("isSeeking"),ua=Ao("scrollHeight"),La=sl("ItemComponent"),Va=sl("ListComponent"),$a=sl("ScrollSeekPlaceholder"),lb=sl("context"),ub=Ao("itemDimensions"),Rb=Ao("gap"),ec=sl("log"),Vb=ch(function(tc){ua(tc.parentElement.parentElement.scrollHeight);
var oc=tc.firstChild;oc&&ub(oc.getBoundingClientRect());Rb({row:lj("row-gap",getComputedStyle(tc).rowGap,ec),column:lj("column-gap",getComputedStyle(tc).columnGap,ec)})});return(0,bi.createElement)(Va,Ve({ref:Vb,className:g},Hg(Va,lb),{style:{paddingTop:b.offsetTop,paddingBottom:b.offsetBottom}}),b.items.map(function(tc){var oc=W(tc.index,tc.data,lb);return ia?(0,bi.createElement)($a,Ve({key:oc},Hg($a,lb),{index:tc.index,height:b.itemHeight,width:b.itemWidth})):(0,bi.createElement)(La,Ve({},Hg(La,
lb),{className:m,"data-index":tc.index,key:oc}),I(tc.index,tc.data,lb))}))}),pH=hh.memo(function(){var b=sl("HeaderComponent"),g=Ao("headerHeight"),m=sl("headerFooterTag"),I=ch(function(ia){return g(Qk(ia,"height"))}),W=sl("context");return b?(0,bi.createElement)(m,{ref:I},(0,bi.createElement)(b,Hg(b,W))):null}),qH=hh.memo(function(){var b=sl("FooterComponent"),g=Ao("footerHeight"),m=sl("headerFooterTag"),I=ch(function(ia){return g(Qk(ia,"height"))}),W=sl("context");return b?(0,bi.createElement)(m,
{ref:I},(0,bi.createElement)(b,Hg(b,W))):null}),rH=function(b){b=b.children;var g=(0,bi.useContext)(uA),m=Ao("itemDimensions"),I=Ao("viewportDimensions"),W=ch(function(ia){I(ia.getBoundingClientRect())});return hh.useEffect(function(){g&&(I({height:g.viewportHeight,width:g.viewportWidth}),m({height:g.itemHeight,width:g.itemWidth}))},[g,I,m]),hh.createElement("div",{style:Jr,ref:W},b)},sH=function(b){b=b.children;var g=(0,bi.useContext)(uA),m=Ao("windowViewportRect"),I=Ao("itemDimensions"),W=sl("customScrollParent");
W=kj(m,W);return hh.useEffect(function(){g&&(I({height:g.itemHeight,width:g.itemWidth}),m({offsetTop:0,visibleHeight:g.viewportHeight,visibleWidth:g.viewportWidth}))},[g,m,I]),hh.createElement("div",{ref:W,style:Jr},b)},hw=yl(nH,{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"}},hh.memo(function(b){b=Ve({},b);var g=sl("useWindowScroll"),m=sl("customScrollParent"),I=m||g?sH:rH;return hh.createElement(m||g?uH:tH,Ve({},b),hh.createElement(I,null,hh.createElement(pH,null),hh.createElement(oH,null),hh.createElement(qH,null)))})),Ao=hw.usePublisher,sl=hw.useEmitterValue,zA=hw.useEmitter,tH=ki({usePublisher:Ao,useEmitterValue:sl,useEmitter:zA}),uH=Ph({usePublisher:Ao,useEmitterValue:sl,useEmitter:zA}),vH=th(function(){var b=rf(function(Va){return hh.createElement("td",
null,"Item $",Va)}),g=rf(null),m=rf(null),I=rf(null),W=rf({}),ia=rf(kg),ua=rf(ag),La=function(Va,$a){return void 0===$a&&($a=null),wh(Jd(W,Gf(function(lb){return lb[Va]}),ye()),$a)};return{context:g,itemContent:b,fixedHeaderContent:m,fixedFooterContent:I,components:W,computeItemKey:ia,scrollerRef:ua,TableComponent:La("Table","table"),TableHeadComponent:La("TableHead","thead"),TableFooterComponent:La("TableFoot","tfoot"),TableBodyComponent:La("TableBody","tbody"),TableRowComponent:La("TableRow","tr"),
ScrollerComponent:La("Scroller","div"),EmptyPlaceholder:La("EmptyPlaceholder"),ScrollSeekPlaceholder:La("ScrollSeekPlaceholder"),FillerRow:La("FillerRow")}}),wH=th(function(b){return Ve({},b[0],b[1])},Qh(sA,vH)),xH=function(b){return hh.createElement("tr",null,hh.createElement("td",{style:{height:b.height}}))},yH=function(b){return hh.createElement("tr",null,hh.createElement("td",{style:{height:b.height,padding:0,border:0}}))},zH=hh.memo(function(){var b=Kj("listState"),g=Bo("sizeRanges"),m=Kj("useWindowScroll"),
I=Kj("customScrollParent"),W=Bo("windowScrollContainerState"),ia=Bo("scrollContainerState");m=I||m?W:ia;var ua=Kj("itemContent");W=Kj("trackItemSizes");I=ji(g,Kj("itemSize"),W,m,Kj("log"),void 0,I);g=I.callbackRef;var La=I.ref;I=hh.useState(0);var Va=I[0],$a=I[1];jw("deviation",function(Xb){Va!==Xb&&(La.current.style.marginTop=Xb+"px",$a(Xb))});W=Kj("EmptyPlaceholder");var lb=Kj("ScrollSeekPlaceholder")||xH;m=Kj("FillerRow")||yH;I=Kj("TableBodyComponent");var ub=Kj("TableRowComponent"),Rb=Kj("computeItemKey"),
ec=Kj("isSeeking");ia=Kj("paddingTopAddition");var Vb=Kj("firstItemIndex"),tc=Kj("statefulTotalCount"),oc=Kj("context");if(0===tc&&W)return(0,bi.createElement)(W,Hg(W,oc));W=b.offsetTop+ia+Va;ia=b.offsetBottom;W=0<W?hh.createElement(m,{height:W,key:"padding-top"}):null;m=0<ia?hh.createElement(m,{height:ia,key:"padding-bottom"}):null;b=b.items.map(function(Xb){var sc=Xb.originalIndex,Hc=Rb(sc+Vb,Xb.data,oc);return ec?(0,bi.createElement)(lb,Ve({},Hg(lb,oc),{key:Hc,index:Xb.index,height:Xb.size,type:Xb.type||
"item"})):(0,bi.createElement)(ub,Ve({},Hg(ub,oc),{key:Hc,"data-index":sc,"data-known-size":Xb.size,"data-item-index":Xb.index,style:{overflowAnchor:"none"}}),ua(Xb.index,Xb.data,oc))});return(0,bi.createElement)(I,Ve({ref:g,"data-test-id":"virtuoso-item-list"},Hg(I,oc)),[W].concat(b,[m]))}),AH=function(b){b=b.children;var g=(0,bi.useContext)(iu),m=Bo("viewportHeight"),I=Bo("fixedItemHeight"),W=ch(kh(m,function(ia){return Qk(ia,"height")}));return hh.useEffect(function(){g&&(m(g.viewportHeight),I(g.itemHeight))},
[g,m,I]),hh.createElement("div",{style:Jr,ref:W,"data-viewport-type":"element"},b)},BH=function(b){b=b.children;var g=(0,bi.useContext)(iu),m=Bo("windowViewportRect"),I=Bo("fixedItemHeight"),W=Kj("customScrollParent");W=kj(m,W);return hh.useEffect(function(){g&&(I(g.itemHeight),m({offsetTop:0,visibleHeight:g.viewportHeight,visibleWidth:100}))},[g,m,I]),hh.createElement("div",{ref:W,style:Jr,"data-viewport-type":"window"},b)},iw=yl(wH,{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"}},hh.memo(function(b){var g=Kj("useWindowScroll"),m=Kj("customScrollParent"),I=Bo("fixedHeaderHeight"),W=Bo("fixedFooterHeight"),ia=Kj("fixedHeaderContent"),ua=Kj("fixedFooterContent"),La=Kj("context");I=ch(kh(I,function(ub){return Qk(ub,
"height")}));var Va=ch(kh(W,function(ub){return Qk(ub,"height")}));W=m||g?DH:CH;g=m||g?BH:AH;m=Kj("TableComponent");var $a=Kj("TableHeadComponent"),lb=Kj("TableFooterComponent");ia=ia?hh.createElement($a,Ve({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:I},Hg($a,La)),ia()):null;ua=ua?hh.createElement(lb,Ve({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:Va},Hg(lb,La)),ua()):null;return hh.createElement(W,Ve({},b),hh.createElement(g,null,hh.createElement(m,Ve({style:{borderSpacing:0}},
Hg(m,La)),[ia,hh.createElement(zH,{key:"TableBody"}),ua])))})),Bo=iw.usePublisher,Kj=iw.useEmitterValue,jw=iw.useEmitter,CH=ki({usePublisher:Bo,useEmitterValue:Kj,useEmitter:jw}),DH=Ph({usePublisher:Bo,useEmitterValue:Kj,useEmitter:jw}),AA=vb(V(22));rb=V(586);var Co=vb(V(22)),Ln=class{static insertTextFirefox(b,g){b.setRangeText(g,b.selectionStart||0,b.selectionEnd||0,"end");b.dispatchEvent(new InputEvent("input",{data:g,inputType:"insertText",isComposing:!1}))}static insert(b,g){const m=b.ownerDocument,
I=m.activeElement;I!==b&&b.focus();m.execCommand("insertText",!1,g)||Ln.insertTextFirefox(b,g);I===m.body?b.blur():I instanceof HTMLElement&&I!==b&&I.focus()}static set(b,g){b.select();Ln.insert(b,g)}static getSelection(b){const {selectionStart:g,selectionEnd:m}=b;return b.value.slice(g?g:void 0,m?m:void 0)}static wrapSelection(b,g,m){const {selectionStart:I,selectionEnd:W}=b,ia=Ln.getSelection(b);Ln.insert(b,g+ia+(null!=m?m:g));b.selectionStart=(I||0)+g.length;b.selectionEnd=(W||0)+g.length}static replace(b,
g,m){let I=0;b.value.replace(g,(...W)=>{const ia=I+W[W.length-2],ua=W[0].length;b.selectionStart=ia;b.selectionEnd=ia+ua;W="string"===typeof m?m:m(...W);Ln.insert(b,W);b.selectionStart=ia;I+=W.length-ua;return W})}static findLineEnd(b,g){const m=b.lastIndexOf("\n",g-1)+1;return"\t"!==b.charAt(m)?g:m+1}static indent(b){var g;const {selectionStart:m,selectionEnd:I,value:W}=b;var ia=W.slice(m,I);if((ia=null==(g=/\n/g.exec(ia))?void 0:g.length)&&0<ia){g=W.lastIndexOf("\n",m-1)+1;var ua=b.value.slice(g,
I-1);ia=ua.replace(/^|\n/g,"$\x26  ");ua=ia.length-ua.length;b.setSelectionRange(g,I-1);Ln.insert(b,ia);b.setSelectionRange(m+1,I+ua)}else Ln.insert(b,"  ")}static unindent(b){const {selectionStart:g,selectionEnd:m,value:I}=b;var W=I.lastIndexOf("\n",g-1)+1;const ia=Ln.findLineEnd(I,m);var ua=b.value.slice(W,ia);const La=ua.replace(/(^|\n)(\t| {1,2})/g,"$1");ua=ua.length-La.length;b.setSelectionRange(W,ia);Ln.insert(b,La);W=(W=/\t| {1,2}/.exec(I.slice(W,g)))?W[0].length:0;b.setSelectionRange(g-W,
Math.max(g-W,m-ua))}};rb=V(586);var lu=b=>b.stopPropagation(),mu=Co.memo(function({font:b,text:g,color:m,fontStyle:I,fontSize:W,fontWeight:ia,offsetX:ua=0,offsetY:La=0,scale:Va=1,isEditing:$a=!1,pointerEvents:lb=!1,onBlur:ub,onChange:Rb}){const ec=Co.useRef(null),Vb=Co.useRef(!1),tc=Co.useCallback(Vc=>{Rb(Ar.normalizeText(Vc.currentTarget.value))},[Rb]),oc=Co.useCallback(Vc=>{if("Escape"!==Vc.key)if("Tab"===Vc.key&&0===g.length)Vc.preventDefault();else{if("Meta"!==Vc.key&&!Vc.metaKey)Vc.stopPropagation();
else if("z"===Vc.key&&Vc.metaKey){Vc.shiftKey?document.execCommand("redo",!1):document.execCommand("undo",!1);Vc.stopPropagation();Vc.preventDefault();return}"Tab"===Vc.key&&(Vc.preventDefault(),Vc.shiftKey?Ln.unindent(Vc.currentTarget):Ln.indent(Vc.currentTarget),null==Rb?void 0:Rb(Ar.normalizeText(Vc.currentTarget.value)))}},[Rb]),Xb=Co.useCallback(Vc=>{$a&&(Vc.currentTarget.setSelectionRange(0,0),null==ub?void 0:ub())},[ub]),sc=Co.useCallback(Vc=>{$a&&Vb.current&&document.activeElement===Vc.currentTarget&&
Vc.currentTarget.select()},[$a]),Hc=Co.useCallback(Vc=>{$a&&Vc.stopPropagation()},[$a]);Co.useEffect(()=>{$a&&requestAnimationFrame(()=>{Vb.current=!0;const Vc=ec.current;Vc&&(Vc.focus(),Vc.select())})},[$a,ub]);const Rc=Co.useRef(null);Co.useLayoutEffect(()=>{const Vc=Rc.current;if(Vc){var Vd=oj(g,{fontFamily:"var(--ls-font-family)",fontSize:W,lineHeight:1,fontWeight:ia},4);Vc.style.transform=`scale(${Va}, ${Va}) translate(${ua}px, ${La}px)`;Vc.style.width=Vd[0]+1+"px";Vc.style.height=Vd[1]+1+"px"}},
[g,ia,W,La,ua,Va]);return(0,rb.jsx)("div",{className:"tl-text-label-wrapper",children:(0,rb.jsxs)("div",{className:"tl-text-label-inner-wrapper",ref:Rc,style:{font:b,fontStyle:I,fontSize:W,fontWeight:ia,color:m,pointerEvents:lb?"all":"none",userSelect:$a?"text":"none"},children:[$a?(0,rb.jsx)("textarea",{ref:ec,style:{font:b,color:m,fontStyle:I,fontSize:W,fontWeight:ia},className:"tl-text-label-textarea",name:"text",tabIndex:-1,autoComplete:"false",autoCapitalize:"false",autoCorrect:"false",autoSave:"false",
autoFocus:!0,placeholder:"",spellCheck:"true",wrap:"off",dir:"auto",datatype:"wysiwyg",defaultValue:g,color:m,onFocus:sc,onChange:tc,onKeyDown:oc,onBlur:Xb,onPointerDown:Hc,onContextMenu:lu,onCopy:lu,onPaste:lu,onCut:lu}):g,"​"]})})});rb=V(586);var EH={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Lr=class extends tn{constructor(){super(...arguments);Qa(this,"canEdit",!0);Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isBinding:m,isSelected:I,isEditing:W,onEditingEnd:ia})=>{const {props:{size:[ua,La],
stroke:Va,fill:$a,noFill:lb,strokeWidth:ub,strokeType:Rb,borderRadius:ec,opacity:Vb,label:tc,italic:oc,fontWeight:Xb,fontSize:sc}}=this;var Hc=tc||W?oj(tc,{fontFamily:"var(--ls-font-family)",fontSize:sc,lineHeight:1,fontWeight:Xb},4):[0,0];const Rc=Zd.mul(this.props.size,.5);Hc=Math.max(.5,Math.min(1,ua/Hc[0],La/Hc[1]));const Vc=this.getBounds(),Vd=AA.useMemo(()=>Zd.sub(Rc,Zd.toFixed([Vc.width/2,Vc.height/2])),[Vc,Hc,Rc]),ae=AA.useCallback(De=>{var Oe;null==(Oe=this.update)?void 0:Oe.call(this,{label:De})},
[tc]);return(0,rb.jsxs)("div",Ga(te({},b),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,rb.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",text:tc,color:zf(Va,"text"),offsetX:Vd[0],offsetY:Vd[1],fontSize:sc,scale:Hc,isEditing:W,onChange:ae,onBlur:ia,fontStyle:oc?"italic":"normal",fontWeight:Xb,pointerEvents:!!tc}),(0,rb.jsxs)(Zn,{opacity:g?.2:Vb,children:[m&&(0,rb.jsx)(zj,{mode:"svg",strokeWidth:ub,size:[ua,La]}),(0,rb.jsx)("rect",{className:I||!lb?"tl-hitarea-fill":"tl-hitarea-stroke",
x:ub/2,y:ub/2,rx:ec,ry:ec,width:Math.max(.01,ua-ub),height:Math.max(.01,La-ub),pointerEvents:"all"}),(0,rb.jsx)("rect",{x:ub/2,y:ub/2,rx:ec,ry:ec,width:Math.max(.01,ua-ub),height:Math.max(.01,La-ub),strokeWidth:ub,stroke:zf(Va,"stroke"),strokeDasharray:"dashed"===Rb?"8 2":void 0,fill:lb?"none":zf($a,"background")})]})]}))}));Qa(this,"setScaleLevel",b=>vd(this,null,function*(){this.update({scaleLevel:b,fontSize:EH[null!=b?b:"md"]});this.onResetBounds()}));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,
g],borderRadius:m}}=this;return(0,rb.jsx)("g",{children:(0,rb.jsx)("rect",{width:b,height:g,rx:m,ry:m,fill:"transparent"})})}));Qa(this,"validateProps",b=>{void 0!==b.size&&(b.size[0]=Math.max(b.size[0],1),b.size[1]=Math.max(b.size[1],1));void 0!==b.borderRadius&&(b.borderRadius=Math.max(0,b.borderRadius));return Gh(this,b)})}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}};Qa(Lr,"id","box");Qa(Lr,"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:""});Lb([Gg],Lr.prototype,"scaleLevel",1);Lb([hf],Lr.prototype,"setScaleLevel",2);var BA=vb(V(22));rb=V(586);var FH={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Mr=class extends lv{constructor(){super(...arguments);Qa(this,"canEdit",!0);Qa(this,"ReactComponent",sf(({isSelected:b,isErasing:g,events:m,isEditing:I,onEditingEnd:W})=>{const {size:[ia,ua],stroke:La,fill:Va,noFill:$a,
strokeWidth:lb,strokeType:ub,opacity:Rb,label:ec,italic:Vb,fontWeight:tc,fontSize:oc}=this.props;var Xb=ec||I?oj(ec,{fontFamily:"var(--ls-font-family)",fontSize:oc,lineHeight:1,fontWeight:tc},4):[0,0];const sc=Zd.mul(this.props.size,.5);Xb=Math.max(.5,Math.min(1,ia/Xb[0],ua/Xb[1]));const Hc=this.getBounds(),Rc=BA.useMemo(()=>Zd.sub(sc,Zd.toFixed([Hc.width/2,Hc.height/2])),[Hc,Xb,sc]),Vc=BA.useCallback(Vd=>{var ae;null==(ae=this.update)?void 0:ae.call(this,{label:Vd})},[ec]);return(0,rb.jsxs)("div",
Ga(te({},m),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,rb.jsx)(mu,{font:"18px / 1 var(--ls-font-family)",text:ec,color:zf(La,"text"),offsetX:Rc[0],offsetY:Rc[1],scale:Xb,isEditing:I,onChange:Vc,onBlur:W,fontStyle:Vb?"italic":"normal",fontSize:oc,fontWeight:tc,pointerEvents:!!ec}),(0,rb.jsxs)(Zn,Ga(te({},m),{opacity:g?.2:Rb,children:[(0,rb.jsx)("ellipse",{className:b||!$a?"tl-hitarea-fill":"tl-hitarea-stroke",cx:ia/2,cy:ua/2,rx:Math.max(.01,(ia-lb)/2),ry:Math.max(.01,(ua-lb)/
2)}),(0,rb.jsx)("ellipse",{cx:ia/2,cy:ua/2,rx:Math.max(.01,(ia-lb)/2),ry:Math.max(.01,(ua-lb)/2),strokeWidth:lb,stroke:zf(La,"stroke"),strokeDasharray:"dashed"===ub?"8 2":void 0,fill:$a?"none":zf(Va,"background")})]}))]}))}));Qa(this,"setScaleLevel",b=>vd(this,null,function*(){this.update({scaleLevel:b,fontSize:FH[null!=b?b:"md"]});this.onResetBounds()}));Qa(this,"ReactIndicator",sf(()=>{const {size:[b,g]}=this.props;return(0,rb.jsx)("g",{children:(0,rb.jsx)("ellipse",{cx:b/2,cy:g/2,rx:b/2,ry:g/2,
strokeWidth:2,fill:"transparent"})})}));Qa(this,"validateProps",b=>{void 0!==b.size&&(b.size[0]=Math.max(b.size[0],1),b.size[1]=Math.max(b.size[1],1));return Gh(this,b)})}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}getShapeSVGJsx(b){const {size:[g,m],stroke:I,fill:W,noFill:ia,strokeWidth:ua,strokeType:La,opacity:Va}=this.props;return(0,rb.jsxs)("g",{opacity:Va,children:[(0,rb.jsx)("ellipse",{className:ia?"tl-hitarea-stroke":"tl-hitarea-fill",cx:g/2,cy:m/2,rx:Math.max(.01,
(g-ua)/2),ry:Math.max(.01,(m-ua)/2)}),(0,rb.jsx)("ellipse",{cx:g/2,cy:m/2,rx:Math.max(.01,(g-ua)/2),ry:Math.max(.01,(m-ua)/2),strokeWidth:ua,stroke:zf(I,"stroke"),strokeDasharray:"dashed"===La?"8 2":void 0,fill:ia?"none":zf(W,"background")})]})}};Qa(Mr,"id","ellipse");Qa(Mr,"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:""});Lb([Gg],Mr.prototype,
"scaleLevel",1);Lb([hf],Mr.prototype,"setScaleLevel",2);rb=V(586);var kw=class extends Dt{constructor(){super(...arguments);Qa(this,"ReactComponent",sf(({events:b})=>{const g=this.getBounds(),m=xg(),I=m.selectedShapesArray.some(ia=>m.shapesInGroups([this]).includes(ia)),W=this.ReactIndicator;return(0,rb.jsxs)(Zn,Ga(te({},b),{children:[(0,rb.jsx)("rect",{className:"tl-hitarea-fill",x:1,y:1,width:Math.max(.01,g.width-2),height:Math.max(.01,g.height-2),pointerEvents:"all"}),I&&(0,rb.jsx)("g",{stroke:"var(--color-selectedFill)",
children:(0,rb.jsx)(W,{})})]}))}));Qa(this,"ReactIndicator",sf(()=>{const b=this.getBounds();return(0,rb.jsx)("rect",{strokeDasharray:"8 2",x:-8,y:-8,rx:4,ry:4,width:b.width+16,height:b.height+16,fill:"transparent"})}))}};Qa(kw,"id","group");Qa(kw,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});rb=V(586);var Ts=class extends lr{constructor(b={}){super(b);Qa(this,"ReactComponent",sf(({events:g,isErasing:m})=>{const {pointsPath:I,props:{stroke:W,strokeWidth:ia,
opacity:ua}}=this;return(0,rb.jsx)(Zn,Ga(te({},g),{opacity:m?.2:1,children:(0,rb.jsx)("path",{d:I,strokeWidth:16*ia,stroke:zf(W,"stroke"),fill:"none",pointerEvents:"all",strokeLinejoin:"round",strokeLinecap:"round",opacity:ua})}))}));Qa(this,"ReactIndicator",sf(()=>{const {pointsPath:g}=this;return(0,rb.jsx)("path",{d:g,fill:"none"})}));Qa(this,"validateProps",g=>{g=Gh(this,g);void 0!==g.strokeWidth&&(g.strokeWidth=Math.max(g.strokeWidth,1));return g});pg(this)}get pointsPath(){const {points:b}=this.props;
return qq.getCurvedPathForPoints(b)}getShapeSVGJsx(){const {pointsPath:b,props:{stroke:g,strokeWidth:m,opacity:I}}=this;return(0,rb.jsx)("path",{d:b,strokeWidth:16*m,stroke:zf(g,"stroke"),fill:"none",pointerEvents:"all",strokeLinejoin:"round",strokeLinecap:"round",opacity:I})}};Qa(Ts,"id","highlighter");Qa(Ts,"defaultProps",{id:"highlighter",parentId:"page",type:"highlighter",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:.5});Lb([Gg],Ts.prototype,
"pointsPath",1);var lw=vb(V(22));rb=V(586);var mw={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},Pp=class extends tn{constructor(){super(...arguments);Qa(this,"canChangeAspectRatio",!0);Qa(this,"canFlip",!1);Qa(this,"canEdit",!0);Qa(this,"htmlAnchorRef",lw.createRef());Qa(this,"setScaleLevel",b=>vd(this,null,function*(){var g;const m=Zd.mul(this.props.size,mw[null!=b?b:"md"]/mw[null!=(g=this.props.scaleLevel)?g:"md"]);this.update({scaleLevel:b});yield Oj();this.update({size:m})}));Qa(this,"onResetBounds",b=>
{var g;if(this.htmlAnchorRef.current){const m=this.htmlAnchorRef.current.getBoundingClientRect(),[I,W]=Zd.div([m.width,m.height],null!=(g=null==b?void 0:b.zoom)?g:1);this.update({size:[Math.max(Math.min(I||400,1400),10),Math.max(Math.min(W||400,1400),10)]})}return this});Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isEditing:m})=>{const {props:{html:I,scaleLevel:W}}=this,ia=gl(),ua=xg(),La=ua.selectedIds.has(this.id),Va=ia||La&&!m||"select"!==ua.selectedTool.id,$a=lw.useCallback(ub=>{Va||ub.stopPropagation()},
[Va]),lb=mw[null!=W?W:"md"];lw.useEffect(()=>{0===this.props.size[1]&&(this.onResetBounds({zoom:ua.viewport.camera.zoom}),ua.persist(!0))},[]);return(0,rb.jsx)(zo,Ga(te({style:{overflow:"hidden",pointerEvents:"all",opacity:g?.2:1}},b),{children:(0,rb.jsx)("div",{onWheelCapture:$a,onPointerDown:$a,onPointerUp:$a,className:"tl-html-container",style:{pointerEvents:ia||!m&&!La?"none":"all",overflow:m?"auto":"hidden",width:`calc(100% / ${lb})`,height:`calc(100% / ${lb})`,transform:`scale(${lb})`},children:(0,rb.jsx)("div",
{ref:this.htmlAnchorRef,className:"tl-html-anchor",dangerouslySetInnerHTML:{__html:I.trim()}})})}))}));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,g]}}=this;return(0,rb.jsx)("rect",{width:b,height:g,fill:"transparent"})}));Qa(this,"validateProps",b=>{void 0!==b.size&&(b.size[0]=Math.max(b.size[0],1),b.size[1]=Math.max(b.size[1],1));return Gh(this,b)})}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}};Qa(Pp,"id","html");Qa(Pp,"defaultProps",{id:"html",type:"html",parentId:"page",
point:[0,0],size:[600,0],html:""});Lb([Gg],Pp.prototype,"scaleLevel",1);Lb([hf],Pp.prototype,"setScaleLevel",2);var CA=vb(V(22));rb=V(586);var Uq=class extends tn{constructor(){super(...arguments);Qa(this,"frameRef",CA.createRef());Qa(this,"canEdit",!0);Qa(this,"onIFrameSourceChange",b=>{this.update({url:b})});Qa(this,"reload",()=>{var b,g;this.frameRef.current&&(this.frameRef.current.src=null==(g=null==(b=this.frameRef)?void 0:b.current)?void 0:g.src)});Qa(this,"ReactComponent",sf(({events:b,isErasing:g,
isEditing:m})=>{CA.useRef(null);return(0,rb.jsx)(zo,Ga(te({style:{overflow:"hidden",pointerEvents:"all",opacity:g?.2:1}},b),{children:(0,rb.jsx)("div",{className:"tl-iframe-container",style:{pointerEvents:m?"all":"none",userSelect:"none"},children:this.props.url&&(0,rb.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,rb.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"})})})}))}));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,g]}}=this;return(0,rb.jsx)("rect",{width:b,height:g,fill:"transparent",rx:8,ry:8})}))}};Qa(Uq,"id","iframe");Qa(Uq,"defaultProps",{id:"iframe",type:"iframe",parentId:"page",point:[0,0],size:[853,480],url:""});Lb([hf],Uq.prototype,"onIFrameSourceChange",2);Lb([hf],Uq.prototype,"reload",2);var GH=vb(V(22));rb=V(586);var nu=class extends mv{constructor(){super(...arguments);Qa(this,"ReactComponent",sf(({events:b,
isErasing:g,isBinding:m,asset:I})=>{const {props:{opacity:W,objectFit:ia,clipping:ua,size:[La,Va]}}=this,[$a,lb,ub,Rb]=Array.isArray(ua)?ua:[ua,ua,ua,ua],{handlers:ec}=GH.useContext(Kn);return(0,rb.jsxs)(zo,Ga(te({},b),{opacity:g?.2:W,children:[m&&(0,rb.jsx)(zj,{mode:"html",strokeWidth:4,size:[La,Va]}),(0,rb.jsx)("div",{"data-asset-loaded":!!I,className:"tl-image-shape-container",children:I?(0,rb.jsx)("img",{src:ec?ec.makeAssetUrl(I.src):I.src,draggable:!1,style:{position:"relative",top:-$a,left:-Rb,
width:La+(Rb-lb),height:Va+($a-ub),objectFit:ia}}):"Asset is missing"})]}))}));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,g]}}=this;return(0,rb.jsx)("rect",{width:b,height:g,fill:"transparent"})}))}getShapeSVGJsx({assets:b}){var g,m;const I=this.getBounds(),{assetId:W,clipping:ia}=this.props;if(b=b.find(ua=>ua.id===W)){Array.isArray(ia);const ua=null==(m=null==(g=window.logseq)?void 0:g.api)?void 0:m.make_asset_url;return(0,rb.jsx)("image",{width:I.width,height:I.height,href:ua?ua(b.src):
b.src})}return super.getShapeSVGJsx({})}};Qa(nu,"id","image");Qa(nu,"defaultProps",{id:"image1",parentId:"page",type:"image",point:[0,0],size:[100,100],opacity:1,assetId:"",clipping:0,objectFit:"fill",isAspectRatioLocked:!0});var nw=vb(V(22)),HH=vb(V(22));rb=V(586);rb=V(586);var DA={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},IH=HH.memo(function({style:b,start:g,end:m,decorationStart:I,decorationEnd:W,scaleLevel:ia}){const ua=Zd.dist(g,m);if(2>ua)return null;const {strokeWidth:La}=b,Va=1+La*DA[null!=ia?
ia:"md"]/10,$a="M"+Zd.toFixed(g)+"L"+Zd.toFixed(m);ia=Math.min(ua/3,La*DA[null!=ia?ia:"md"]);I=I?hm(g,m,ia):null;W=W?hm(m,g,ia):null;return(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)("path",{className:"tl-stroke-hitarea",d:$a}),(0,rb.jsx)("path",{d:$a,strokeWidth:Va,stroke:b.stroke,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"dashed"===b.strokeType?"8 4":void 0,pointerEvents:"stroke"}),I&&(0,rb.jsx)(Dk,{left:I.left,middle:g,right:I.right,stroke:b.stroke,strokeWidth:Va}),W&&(0,rb.jsx)(Dk,
{left:W.left,middle:m,right:W.right,stroke:b.stroke,strokeWidth:Va})]})});rb=V(586);rb=V(586);var JH={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Nr=class extends us{constructor(){super(...arguments);Qa(this,"hideSelection",!0);Qa(this,"canEdit",!0);Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isEditing:m,onEditingEnd:I})=>{const {stroke:W,handles:{start:ia,end:ua},opacity:La,label:Va,italic:$a,fontWeight:lb,fontSize:ub,id:Rb}=this.props,ec=Va||m?oj(Va,{fontFamily:"var(--ls-font-family)",fontSize:ub,
lineHeight:1,fontWeight:lb},6):[0,0],Vb=Zd.med(ia.point,ua.point);var tc=Zd.dist(ia.point,ua.point);tc=Math.max(.5,Math.min(1,Math.max(tc/(ec[1]+128),tc/(ec[0]+128))));const oc=this.getBounds(),Xb=nw.useMemo(()=>Zd.sub(Vb,Zd.toFixed([oc.width/2,oc.height/2])),[oc,tc,Vb]),sc=nw.useCallback(Hc=>{var Rc;null==(Rc=this.update)?void 0:Rc.call(this,{label:Hc})},[Va]);return(0,rb.jsxs)("div",Ga(te({},b),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,rb.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",
text:Va,fontSize:ub,color:zf(W,"text"),offsetX:Xb[0],offsetY:Xb[1],scale:tc,isEditing:m,onChange:sc,onBlur:I,fontStyle:$a?"italic":"normal",fontWeight:lb,pointerEvents:!!Va}),(0,rb.jsxs)(Zn,{opacity:g?.2:La,id:Rb+"_svg",children:[(0,rb.jsx)(jh,{id:Rb,bounds:oc,labelSize:ec,offset:Xb,scale:tc}),(0,rb.jsx)("g",{pointerEvents:"none",mask:Va||m?`url(#${Rb}_clip)`:"",children:this.getShapeSVGJsx({preview:!1})})]})]}))}));Qa(this,"setScaleLevel",b=>vd(this,null,function*(){this.update({scaleLevel:b,fontSize:JH[null!=
b?b:"md"]});this.onResetBounds()}));Qa(this,"ReactIndicator",sf(({isEditing:b})=>{const {id:g,decorations:m,label:I,strokeWidth:W,fontSize:ia,fontWeight:ua,handles:{start:La,end:Va}}=this.props,$a=this.getBounds(),lb=I||b?oj(I,{fontFamily:"var(--ls-font-family)",fontSize:ia,lineHeight:1,fontWeight:ua},6):[0,0],ub=Zd.med(La.point,Va.point);var Rb=Zd.dist(La.point,Va.point);Rb=Math.max(.5,Math.min(1,Math.max(Rb/(lb[1]+128),Rb/(lb[0]+128))));const ec=nw.useMemo(()=>Zd.sub(ub,Zd.toFixed([$a.width/2,$a.height/
2])),[$a,Rb,ub]);return(0,rb.jsxs)("g",{children:[(0,rb.jsx)("path",{mask:I?`url(#${g}_clip)`:"",d:on({strokeWidth:W},La.point,Va.point,null==m?void 0:m.start,null==m?void 0:m.end)}),I&&!b&&(0,rb.jsx)("rect",{x:$a.width/2-lb[0]/2*Rb+ec[0],y:$a.height/2-lb[1]/2*Rb+ec[1],width:lb[0]*Rb,height:lb[1]*Rb,rx:4*Rb,ry:4*Rb,fill:"transparent"})]})}));Qa(this,"validateProps",b=>Gh(this,b))}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}getShapeSVGJsx({preview:b}){const {stroke:g,fill:m,
strokeWidth:I,strokeType:W,decorations:ia,label:ua,scaleLevel:La,handles:{start:Va,end:$a}}=this.props,lb=Zd.med(Va.point,$a.point);return(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)(IH,{style:{stroke:zf(g,"text"),fill:m,strokeWidth:I,strokeType:W},scaleLevel:La,start:Va.point,end:$a.point,decorationStart:null==ia?void 0:ia.start,decorationEnd:null==ia?void 0:ia.end}),b&&(0,rb.jsx)(rb.Fragment,{children:(0,rb.jsx)("text",{style:{transformOrigin:"top left"},fontFamily:"Inter",fontSize:20,transform:`translate(${lb[0]}, ${lb[1]})`,
textAnchor:"middle",fill:zf(g,"text"),stroke:zf(g,"text"),children:ua})})]})}};Qa(Nr,"id","line");Qa(Nr,"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:""});Lb([Gg],Nr.prototype,"scaleLevel",1);Lb([hf],Nr.prototype,"setScaleLevel",2);var co=vb(V(22));rb=
V(586);var Us={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},KH=sf(({type:b,fill:g,opacity:m,children:I})=>{g="var(--ls-secondary-background-color)"!==g?zf(g,"background"):"var(--ls-tertiary-background-color)";return(0,rb.jsxs)("div",{className:`tl-logseq-portal-header tl-logseq-portal-header-${"P"===b?"page":"block"}`,children:[(0,rb.jsx)("div",{className:"absolute inset-0 tl-logseq-portal-header-bg",style:{opacity:m,background:"P"===b?g:`linear-gradient(0deg, transparent, ${g}`}}),(0,rb.jsx)("div",{className:"relative",
children:I})]})}),tl=class extends tn{constructor(b={}){var g;super(b);Qa(this,"hideRotateHandle",!0);Qa(this,"canChangeAspectRatio",!0);Qa(this,"canFlip",!0);Qa(this,"canEdit",!0);Qa(this,"persist",null);Qa(this,"initialHeightCalculated",!0);Qa(this,"getInnerHeight",null);Qa(this,"setCollapsed",m=>vd(this,null,function*(){var I;"B"===this.props.blockType?(this.update({compact:m}),this.canResize[1]=!m,m||(yield Oj(),this.onResetBounds()),null==(I=this.persist)?void 0:I.call(this)):(I=this.props.size[1],
this.canResize[1]=!m,console.log(m,m?this.getHeaderHeight():this.props.collapsedHeight,this.getHeaderHeight(),this.props.collapsedHeight),this.update({isAutoResizing:!m,collapsed:m,size:[this.props.size[0],m?this.getHeaderHeight():this.props.collapsedHeight],collapsedHeight:m?I:this.props.collapsedHeight}))}));Qa(this,"setScaleLevel",m=>vd(this,null,function*(){var I;const W=Zd.mul(this.props.size,Us[null!=m?m:"md"]/Us[null!=(I=this.props.scaleLevel)?I:"md"]);this.update({scaleLevel:m});yield Oj();
this.update({size:W})}));Qa(this,"onResetBounds",m=>{m=this.getAutoResizeHeight();null!==m&&1<Math.abs(m-this.props.size[1])&&(this.update({size:[this.props.size[0],m]}),this.initialHeightCalculated=!0);return this});Qa(this,"onResize",(m,I)=>{var W;const {bounds:ia,rotation:ua,scale:[La,Va]}=I;m=[...this.scale];0>La&&(m[0]*=-1);0>Va&&(m[1]*=-1);I=ia.height;this.props.isAutoResizing&&(I=null!=(W=this.getAutoResizeHeight())?W:I);return this.update({point:[ia.minX,ia.minY],size:[Math.max(1,ia.width),
Math.max(1,I)],scale:m,rotation:ua})});Qa(this,"PortalComponent",sf(({})=>{const {props:{pageId:m,fill:I,opacity:W}}=this,{renderers:ia}=co.useContext(Kn),ua=xg(),La=co.useRef(null),[,Va]=this.useComponentSize(La,this.props.compact?".tl-logseq-cp-container \x3e .single-block":".tl-logseq-cp-container \x3e .page");if(null==ia||!ia.Page)return null;const {Page:$a,Block:lb}=ia;co.useEffect(()=>{var ub,Rb;if(this.props.isAutoResizing){const ec=(null!=(Rb=null==(ub=this.getInnerHeight)?void 0:ub.call(this))?
Rb:Va)+this.getHeaderHeight();Va&&1<Math.abs(ec-this.props.size[1])&&(this.update({size:[this.props.size[0],ec]}),ua.persist(!0))}},[Va,this.props.isAutoResizing]);co.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();ua.persist(!0)})},[this.initialHeightCalculated]);return(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)("div",{className:"absolute inset-0 tl-logseq-cp-container-bg",style:{background:I&&"var(--ls-secondary-background-color)"!==I?`var(--ls-highlight-color-${I})`:
"var(--ls-secondary-background-color)",opacity:W}}),(0,rb.jsx)("div",{ref:La,className:"relative tl-logseq-cp-container",style:{overflow:this.props.isAutoResizing?"visible":"auto"},children:"B"===this.props.blockType&&this.props.compact?(0,rb.jsx)(lb,{blockId:m}):(0,rb.jsx)($a,{pageName:m})})]})}));Qa(this,"ReactComponent",sf(m=>{var I;const {events:W,isErasing:ia,isEditing:ua,isBinding:La}=m,{props:{opacity:Va,pageId:$a,fill:lb,scaleLevel:ub,strokeWidth:Rb,size:ec}}=this,Vb=xg(),{renderers:tc,handlers:oc}=
co.useContext(Kn);this.persist=()=>Vb.persist();const Xb=gl(),sc=Vb.selectedIds.has(this.id)&&1===Vb.selectedIds.size,Hc=Vb.isIn("logseq-portal.creating")&&!$a,Rc=(Xb||sc&&!ua||"select"!==Vb.selectedTool.id)&&!Hc,Vc=co.useCallback(Oc=>{Rc||Oc.stopPropagation()},[Rc]),Vd=1===Vb.selectedShapesArray.length&&Vb.selectedShapesArray.some(Oc=>"logseq-portal"===Oc.type&&Oc.props.id!==this.props.id&&$a&&Oc.props.pageId===$a),ae=Us[null!=ub?ub:"md"];co.useEffect(()=>this.props.collapsed&&ua?(this.update({size:[this.props.size[0],
this.props.collapsedHeight]}),()=>{this.update({size:[this.props.size[0],this.getHeaderHeight()]})}):()=>{},[ua,this.props.collapsed]);co.useEffect(()=>{if(Hc){const Oc=[Vb.viewport.bounds.width,Vb.viewport.bounds.height],md=Vb.viewport.getScreenPoint([this.bounds.minX,this.bounds.minY]);(md[0]>Oc[0]-400||md[1]>Oc[1]-240||1.5<Vb.viewport.camera.zoom||.5>Vb.viewport.camera.zoom)&&Vb.viewport.zoomToBounds(Ga(te({},this.bounds),{minY:this.bounds.maxY+25}))}},[Vb.viewport.bounds.height.toFixed(2)]);const De=
co.useCallback(Oc=>{this.initialHeightCalculated=!1;const md=Wh(Oc)?"B":"P";this.update({pageId:Oc,size:[400,320],blockType:md,compact:"B"===md});Vb.selectTool("select");Vb.history.resume();Vb.history.persist()},[]),Oe=this.PortalComponent;var tf=co.useMemo(()=>{var Oc;if($a&&"B"===this.props.blockType)return null==(Oc=null==oc?void 0:oc.queryBlockByUUID($a))?void 0:Oc.content},[null==oc?void 0:oc.queryBlockByUUID,$a]);tf="B"===this.props.blockType&&"string"!==typeof tf;const of=(!this.props.collapsed||
ua)&&!tf;if(null==tc||!tc.Page)return null;const {Breadcrumb:bf,PageName:Ge}=tc,Fd={width:`calc(100% / ${ae})`,height:`calc(100% / ${ae})`,opacity:ia?.2:1};1!==ae&&(Fd.transform=`scale(${ae})`);return(0,rb.jsxs)(zo,Ga(te({style:{pointerEvents:"all"}},W),{children:[La&&(0,rb.jsx)(zj,{mode:"html",strokeWidth:Rb,size:ec}),(0,rb.jsx)("div",{"data-inner-events":!Rc,onWheelCapture:Vc,onPointerDown:Vc,onPointerUp:Vc,style:{width:"100%",height:"100%",pointerEvents:Xb||!ua&&!sc?"none":"all"},children:Hc?(0,rb.jsx)(PA,
{onChange:De,onAddBlock:Oc=>{setTimeout(()=>{var md,zd,Md;Vb.api.editShape(this);null==(Md=null==(zd=null==(md=window.logseq)?void 0:md.api)?void 0:zd.edit_block)?void 0:Md.call(zd,Oc)})},placeholder:"Create or search your graph..."}):(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)("div",{className:"tl-logseq-portal-container","data-collapsed":this.collapsed,"data-page-id":$a,"data-portal-selected":Vd,"data-editing":ua,style:Fd,children:[!this.props.compact&&!tf&&(0,rb.jsx)(KH,{type:null!=(I=this.props.blockType)?
I:"P",fill:lb,opacity:Va,children:"P"===this.props.blockType?(0,rb.jsx)(Ge,{pageName:$a}):(0,rb.jsx)(bf,{blockId:$a})}),tf&&(0,rb.jsx)("div",{className:"tl-target-not-found",children:"Target not found"}),of&&(0,rb.jsx)(Oe,te({},m))]}),(0,rb.jsx)(rz,{active:!!this.collapsed,style:{opacity:sc?1:0},icon:"B"===this.props.blockType?"block":"page",onClick:()=>this.setCollapsed(!this.collapsed),otherIcon:"whiteboard-element"})]})})]}))}));Qa(this,"ReactIndicator",sf(()=>{const m=this.getBounds();return(0,rb.jsx)("rect",
{width:m.width,height:m.height,fill:"transparent",rx:8,ry:8})}));Qa(this,"validateProps",m=>{var I;if(void 0!==m.size){const W=Us[null!=(I=this.props.scaleLevel)?I:"md"];m.size[0]=Math.max(m.size[0],60*W);m.size[1]=Math.max(m.size[1],40*W)}return Gh(this,m)});pg(this);b.collapsed&&Object.assign(this.canResize,[!0,!1]);0===(null==(g=b.size)?void 0:g[1])&&(this.initialHeightCalculated=!1)}static isPageOrBlock(b){return b?/^\(\(.*\)\)$/.test(b)&&40===b.length?"B":"P":!1}get collapsed(){return"B"===this.props.blockType?
this.props.compact:this.props.collapsed}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}useComponentSize(b,g=""){const [m,I]=co.useState([0,0]),W=xg();co.useEffect(()=>{if(null==b?0:b.current){const ia=g?b.current.querySelector(g):b.current;if(ia){const ua=()=>{const {width:Va,height:$a}=ia.getBoundingClientRect(),lb=Zd.div([Va,$a],W.viewport.camera.zoom);I(lb);return lb};ua();this.getInnerHeight=()=>ua()[1];const La=new ResizeObserver(()=>{ua()});La.observe(ia);return()=>{La.disconnect()}}}return()=>
{}},[b,g]);return m}getHeaderHeight(){var b;const g=Us[null!=(b=this.props.scaleLevel)?b:"md"];return this.props.compact?0:40*g}getAutoResizeHeight(){return this.getInnerHeight?this.getHeaderHeight()+this.getInnerHeight():null}getShapeSVGJsx({}){var b,g,m;const I=this.getBounds();return(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?`var(--ls-highlight-color-${this.props.fill})`:"var(--ls-secondary-background-color)",
stroke:zf(this.props.fill,"background"),strokeWidth:null!=(b=this.props.strokeWidth)?b:2,fillOpacity:null!=(g=this.props.opacity)?g:.2,width:I.width,rx:8,ry:8,height:I.height}),!this.props.compact&&(0,rb.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?zf(this.props.fill,"background"):"var(--ls-tertiary-background-color)",fillOpacity:null!=(m=this.props.opacity)?m:.2,x:1,y:1,width:I.width-2,height:38,rx:8,ry:8}),(0,rb.jsx)("text",{style:{transformOrigin:"top left"},
transform:`translate(${I.width/2}, ${10+I.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:""})]})}};Qa(tl,"id","logseq-portal");Qa(tl,"defaultSearchQuery","");Qa(tl,"defaultSearchFilter",null);Qa(tl,"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});Lb([Gg],tl.prototype,"collapsed",1);Lb([hf],tl.prototype,"setCollapsed",2);Lb([Gg],tl.prototype,"scaleLevel",1);Lb([hf],tl.prototype,"setScaleLevel",2);var {min:Or,PI:LH}=Math,Vs=LH+1E-4;rb=V(586);var MH={easing:b=>Math.sin(b*Math.PI/2),simulatePressure:!0},NH={easing:b=>b*b,simulatePressure:!1},Ws=class extends lr{constructor(b={}){super(b);Qa(this,"ReactComponent",sf(({events:g,
isErasing:m})=>{const {props:{opacity:I}}=this;return(0,rb.jsx)(Zn,Ga(te({},g),{opacity:m?.2:I,children:this.getShapeSVGJsx()}))}));Qa(this,"ReactIndicator",sf(()=>{const {pointsPath:g}=this;return(0,rb.jsx)("path",{d:g})}));Qa(this,"validateProps",g=>{g=Gh(this,g);void 0!==g.strokeWidth&&(g.strokeWidth=Math.max(g.strokeWidth,1));return g});pg(this)}get pointsPath(){var b=this.props;if(2>b.points.length)var g="";else g=Ga(te({size:1+1.5*b.strokeWidth,thinning:.65,streamline:.65,smoothing:.65},.5===
b.points[1][2]?MH:NH),{last:b.isComplete}),b=io(b.points,g),g=qq.getSvgPathFromStroke(Zo(b,g));return g}getShapeSVGJsx(){const {pointsPath:b,props:{stroke:g,strokeWidth:m,strokeType:I}}=this;return(0,rb.jsx)("path",{pointerEvents:"all",d:b,strokeWidth:m/2,strokeLinejoin:"round",strokeLinecap:"round",stroke:zf(g,"text"),fill:zf(g,"text"),strokeDasharray:"dashed"===I?"12 4":void 0})}};Qa(Ws,"id","pencil");Qa(Ws,"defaultProps",{id:"pencil",parentId:"page",type:"pencil",point:[0,0],points:[],isComplete:!1,
stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});Lb([Gg],Ws.prototype,"pointsPath",1);var EA=vb(V(22));rb=V(586);var OH={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Pr=class extends yp{constructor(){super(...arguments);Qa(this,"canEdit",!0);Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isSelected:m,isEditing:I,onEditingEnd:W})=>{const {offset:[ia,ua],props:{stroke:La,fill:Va,noFill:$a,strokeWidth:lb,opacity:ub,strokeType:Rb,label:ec,italic:Vb,fontWeight:tc,fontSize:oc}}=this,
Xb=this.getVertices(lb/2).join();var sc=ec||I?oj(ec,{fontFamily:"var(--ls-font-family)",fontSize:oc,lineHeight:1,fontWeight:tc},4):[0,0];const Hc=[this.props.size[0]/2,2*this.props.size[1]/3];sc=Math.max(.5,Math.min(1,this.props.size[0]/(2*sc[0]),this.props.size[1]/(2*sc[1])));const Rc=this.getBounds(),Vc=EA.useMemo(()=>Zd.sub(Hc,Zd.toFixed([Rc.width/2,Rc.height/2])),[Rc,sc,Hc]),Vd=EA.useCallback(ae=>{var De;null==(De=this.update)?void 0:De.call(this,{label:ae})},[ec]);return(0,rb.jsxs)("div",Ga(te({},
b),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,rb.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",text:ec,fontSize:oc,color:zf(La,"text"),offsetX:Vc[0],offsetY:Vc[1]/sc,scale:sc,isEditing:I,onChange:Vd,onBlur:W,fontStyle:Vb?"italic":"normal",fontWeight:tc,pointerEvents:!!ec}),(0,rb.jsx)(Zn,{opacity:g?.2:ub,children:(0,rb.jsxs)("g",{transform:`translate(${ia}, ${ua})`,children:[(0,rb.jsx)("polygon",{className:m||!$a?"tl-hitarea-fill":"tl-hitarea-stroke",points:Xb}),(0,rb.jsx)("polygon",
{points:Xb,stroke:zf(La,"stroke"),fill:$a?"none":zf(Va,"background"),strokeWidth:lb,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Rb?"8 2":void 0})]})})]}))}));Qa(this,"setScaleLevel",b=>vd(this,null,function*(){this.update({scaleLevel:b,fontSize:OH[null!=b?b:"md"]});this.onResetBounds()}));Qa(this,"ReactIndicator",sf(()=>{const {offset:[b,g],props:{strokeWidth:m}}=this;return(0,rb.jsx)("g",{children:(0,rb.jsx)("polygon",{transform:`translate(${b}, ${g})`,points:this.getVertices(m/2).join()})})}));
Qa(this,"validateProps",b=>{void 0!==b.sides&&(b.sides=Math.max(b.sides,3));return Gh(this,b)})}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}getShapeSVGJsx(b){const {offset:[g,m],props:{stroke:I,fill:W,noFill:ia,strokeWidth:ua,opacity:La,strokeType:Va}}=this;b=this.getVertices(ua/2).join();return(0,rb.jsxs)("g",{transform:`translate(${g}, ${m})`,opacity:La,children:[(0,rb.jsx)("polygon",{className:ia?"tl-hitarea-stroke":"tl-hitarea-fill",points:b}),(0,rb.jsx)("polygon",{points:b,
stroke:zf(I,"stroke"),fill:ia?"none":zf(W,"background"),strokeWidth:ua,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Va?"8 2":void 0})]})}};Qa(Pr,"id","polygon");Qa(Pr,"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:""});Lb([Gg],Pr.prototype,"scaleLevel",1);Lb([hf],Pr.prototype,"setScaleLevel",2);var Wo=
vb(V(22));rb=V(586);var PH={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Qr=class extends iv{constructor(){super(...arguments);Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isEditing:m,onEditingEnd:I})=>{const {props:{opacity:W,fontFamily:ia,fontSize:ua,fontWeight:La,italic:Va,lineHeight:$a,text:lb,stroke:ub,padding:Rb}}=this,ec=Wo.useRef(null),Vb=Wo.useRef(!1),tc=Wo.useRef(null),oc=Wo.useCallback(Vc=>{const {isSizeLocked:Vd}=this.props;Vc=Ar.normalizeText(Vc.currentTarget.value);Vd?this.update({text:Vc,
size:this.getAutoSizedBoundingBox({text:Vc})}):this.update({text:Vc})},[]),Xb=Wo.useCallback(Vc=>{if("Escape"!==Vc.key)if("Tab"===Vc.key&&0===lb.length)Vc.preventDefault();else{if("Meta"!==Vc.key&&!Vc.metaKey)Vc.stopPropagation();else if("z"===Vc.key&&Vc.metaKey){Vc.shiftKey?document.execCommand("redo",!1):document.execCommand("undo",!1);Vc.stopPropagation();Vc.preventDefault();return}"Tab"===Vc.key&&(Vc.preventDefault(),Vc.shiftKey?Ln.unindent(Vc.currentTarget):Ln.indent(Vc.currentTarget),this.update({text:Ar.normalizeText(Vc.currentTarget.value)}))}},
[]),sc=Wo.useCallback(Vc=>{Vc.currentTarget.setSelectionRange(0,0);null==I?void 0:I()},[I]),Hc=Wo.useCallback(Vc=>{m&&Vb.current&&document.activeElement===Vc.currentTarget&&Vc.currentTarget.select()},[m]),Rc=Wo.useCallback(Vc=>{m&&Vc.stopPropagation()},[m]);Wo.useEffect(()=>{m?requestAnimationFrame(()=>{Vb.current=!0;const Vc=ec.current;Vc&&(Vc.focus(),Vc.select())}):null==I?void 0:I()},[m,I]);Wo.useLayoutEffect(()=>{if(0===this.props.size[0]||0===this.props.size[1])this.onResetBounds()},[]);return(0,rb.jsx)(zo,
Ga(te({},b),{opacity:g?.2:W,children:(0,rb.jsx)("div",{ref:tc,className:"tl-text-shape-wrapper","data-hastext":!!lb,"data-isediting":m,style:{fontFamily:ia,fontStyle:Va?"italic":"normal",fontSize:ua,fontWeight:La,padding:Rb,lineHeight:$a,color:zf(ub,"text")},children:m?(0,rb.jsx)("textarea",{ref:ec,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:lb,onFocus:Hc,onChange:oc,onKeyDown:Xb,onBlur:sc,onPointerDown:Rc}):(0,rb.jsxs)(rb.Fragment,{children:[lb,"​"]})})}))}));Qa(this,"setScaleLevel",b=>vd(this,null,function*(){this.update({scaleLevel:b,fontSize:PH[null!=b?b:"md"]});this.onResetBounds()}));Qa(this,"ReactIndicator",sf(({isEditing:b})=>{const {props:{borderRadius:g},bounds:m}=this;return b?null:(0,rb.jsx)("rect",{width:m.width,height:m.height,rx:g,ry:g,fill:"transparent"})}));Qa(this,"validateProps",b=>Gh(this,b));Qa(this,
"getBounds",()=>{const [b,g]=this.props.point,[m,I]=this.props.size;return{minX:b,minY:g,maxX:b+m,maxY:g+I,width:m,height:I}});Qa(this,"onResizeStart",({isSingle:b})=>{var g;if(!b)return this;this.scale=[...(null!=(g=this.props.scale)?g:[1,1])];return this.update({isSizeLocked:!1})});Qa(this,"onResetBounds",()=>{this.update({size:this.getAutoSizedBoundingBox(),isSizeLocked:!0});return this})}get scaleLevel(){var b;return null!=(b=this.props.scaleLevel)?b:"md"}getAutoSizedBoundingBox(b={}){const {text:g=
this.props.text,fontFamily:m=this.props.fontFamily,fontSize:I=this.props.fontSize,fontWeight:W=this.props.fontWeight,lineHeight:ia=this.props.lineHeight,padding:ua=this.props.padding}=b,[La,Va]=oj(g,{fontFamily:m,fontSize:I,lineHeight:ia,fontWeight:W},ua);return[La,Va]}getShapeSVGJsx(){var b=window.navigator.userAgent.toLowerCase();if(b.includes("webkit")&&!b.includes("chrome"))return super.getShapeSVGJsx(null);const {props:{text:g,stroke:m,fontSize:I,fontFamily:W}}=this;b=this.getBounds();return(0,rb.jsx)("foreignObject",
{width:b.width,height:b.height,children:(0,rb.jsx)("div",{style:{color:zf(m,"text"),fontSize:I,fontFamily:W,display:"contents"},children:g})})}};Qa(Qr,"id","text");Qa(Qr,"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});Lb([Gg],Qr.prototype,"scaleLevel",1);Lb([hf],Qr.prototype,
"setScaleLevel",2);var FA=vb(V(22));rb=V(586);var ou=class extends tn{constructor(){super(...arguments);Qa(this,"canFlip",!1);Qa(this,"canEdit",!0);Qa(this,"canChangeAspectRatio",!1);Qa(this,"ReactComponent",sf(({events:b,isErasing:g,asset:m,isEditing:I})=>{const {props:{opacity:W}}=this,ia=gl();var ua=xg();const La=ua.selectedIds.has(this.id),Va=ia||La&&!I||"select"!==ua.selectedTool.id;ua=FA.useCallback(lb=>{Va||lb.stopPropagation()},[Va]);const {handlers:$a}=FA.useContext(Kn);return(0,rb.jsx)(zo,
Ga(te({style:{overflow:"hidden",pointerEvents:"all",opacity:g?.2:W}},b),{children:(0,rb.jsx)("div",{onWheelCapture:ua,onPointerDown:ua,onPointerUp:ua,className:"tl-video-container",style:{pointerEvents:ia||!I&&!La?"none":"all",overflow:I?"auto":"hidden"},children:m&&(0,rb.jsx)("video",{controls:!0,src:$a?$a.makeAssetUrl(m.src):m.src})})}))}));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,g]}}=this;return(0,rb.jsx)("rect",{width:b,height:g,fill:"transparent"})}))}};Qa(ou,"id","video");Qa(ou,
"defaultProps",{id:"video1",parentId:"page",type:"video",point:[0,0],size:[100,100],opacity:1,assetId:"",clipping:0,isAspectRatioLocked:!0});rb=V(586);var GA=class extends tn{constructor(){super(...arguments);Qa(this,"aspectRatio",480/853);Qa(this,"canChangeAspectRatio",!1);Qa(this,"canFlip",!1);Qa(this,"canEdit",!0);Qa(this,"onYoutubeLinkChange",b=>{this.update({url:b,size:GA.defaultProps.size})});Qa(this,"ReactComponent",sf(({events:b,isErasing:g,isEditing:m})=>(0,rb.jsx)(zo,Ga(te({style:{overflow:"hidden",
pointerEvents:"all",opacity:g?.2:1}},b),{children:(0,rb.jsx)("div",{className:"rounded-lg w-full h-full relative overflow-hidden shadow-xl",style:{pointerEvents:m?"all":"none",userSelect:"none"},children:this.embedId?(0,rb.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,rb.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,rb.jsx)("div",{className:"w-full h-full flex items-center justify-center p-4",style:{backgroundColor:"var(--ls-primary-background-color)"},children:(0,rb.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 502 210.649",height:"210.65",width:"128",children:(0,rb.jsxs)("g",{children:[(0,rb.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,rb.jsx)("g",{children:(0,rb.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,rb.jsxs)("g",{fill:"#fff",children:[(0,rb.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,rb.jsx)("path",{d:"M268.763 169.537h-19.956V54.77h-20.956V35.835l62.869-.024v18.96h-21.957v114.766z"})]})]})})})})}))));Qa(this,"ReactIndicator",sf(()=>{const {props:{size:[b,g]}}=this;return(0,rb.jsx)("rect",{width:b,height:g,fill:"transparent",rx:8,ry:8})}));Qa(this,"validateProps",b=>{void 0!==b.size&&(b.size[0]=Math.max(b.size[0],1),b.size[1]=Math.max(b.size[0]*this.aspectRatio,1));return Gh(this,b)})}get embedId(){var b,g;const m=this.props.url,I=m.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);
return null!=(g=null!=(b=null==I?void 0:I[1])?b:m)?g:""}getShapeSVGJsx(){const b=this.getBounds(),g=this.embedId;return g?(0,rb.jsxs)("g",{children:[(0,rb.jsx)("image",{width:b.width,height:b.height,href:`https://img.youtube.com/vi/${g}/mqdefault.jpg`,className:"grayscale-[50%]"}),(0,rb.jsx)("svg",{x:b.width/4,y:b.height/4,width:b.width/2,height:b.height/2,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,rb.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({})}},Vq=GA;Qa(Vq,"id","youtube");Qa(Vq,"defaultProps",{id:"youtube",type:"youtube",parentId:"page",point:[0,0],size:[853,480],url:""});Lb([Gg],Vq.prototype,"embedId",1);Lb([hf],Vq.prototype,"onYoutubeLinkChange",2);rb=V(586);var HA=[Lr,Mr,Ts,nu,ou,Nr,Ws,Pr,Qr,Vq,Uq,Pp,tl,kw],ow=class extends bp{constructor(){super(...arguments);Qa(this,"Shape",Lr)}};Qa(ow,"id","box");Qa(ow,"shortcut",["9","r"]);var pw=class extends bp{constructor(){super(...arguments);
Qa(this,"Shape",Mr)}};Qa(pw,"id","ellipse");Qa(pw,"shortcut",["o"]);var qw=class extends Ct{};Qa(qw,"id","erase");Qa(qw,"shortcut",["6","e"]);var rw=class extends rs{constructor(){super(...arguments);Qa(this,"Shape",Ts);Qa(this,"simplify",!0);Qa(this,"simplifyTolerance",.618)}};Qa(rw,"id","highlighter");Qa(rw,"shortcut",["5","h"]);var sw=class extends At{constructor(){super(...arguments);Qa(this,"Shape",Nr)}};Qa(sw,"id","line");Qa(sw,"shortcut",["7","c"]);var tw=class extends rs{constructor(){super(...arguments);
Qa(this,"Shape",Ws);Qa(this,"simplify",!1)}};Qa(tw,"id","pencil");Qa(tw,"shortcut",["4","d"]);var IA=class extends bp{constructor(){super(...arguments);Qa(this,"Shape",Pr)}};Qa(IA,"id","polygon");var uw=class extends Bt{constructor(){super(...arguments);Qa(this,"Shape",Qr)}};Qa(uw,"id","text");Qa(uw,"shortcut",["8","t"]);var JA=class extends bp{constructor(){super(...arguments);Qa(this,"Shape",Vq)}};Qa(JA,"id","youtube");var KA=class extends vi{constructor(){super(...arguments);Qa(this,"creatingShape");
Qa(this,"offset",[0,0]);Qa(this,"onEnter",()=>{this.app.history.pause();Kd(()=>{const b=new tl({id:Of(),parentId:this.app.currentPage.id,point:Zd.sub(this.app.inputs.originPoint,this.offset),size:tl.defaultProps.size,fill:this.app.settings.color,stroke:this.app.settings.color});this.creatingShape=b;this.app.currentPage.addShapes(b);this.app.setEditingShape(b);this.app.setSelectedShapes([b])})});Qa(this,"onPointerDown",b=>{switch(b.type){case "shape":if(b.shape===this.creatingShape)break;this.app.selectTool("select");
break;case "canvas":b.order||this.app.selectTool("select")}});Qa(this,"onExit",()=>{var b;this.creatingShape&&(this.app.history.resume(),(null==(b=this.creatingShape)?0:b.props.pageId)?this.app.setSelectedShapes([this.creatingShape.id]):(this.app.deleteShapes([this.creatingShape.id]),this.app.setEditingShape()),this.creatingShape=void 0)})}};Qa(KA,"id","creating");var LA=class extends vi{constructor(){super(...arguments);Qa(this,"cursor","crosshair");Qa(this,"onPointerDown",b=>{this.tool.transition("creating")})}};
Qa(LA,"id","idle");var Xs=class extends xp{constructor(){super(...arguments);Qa(this,"Shape",tl);Qa(this,"onPinch",b=>{this.app.viewport.pinchZoom(b.point,b.delta,b.delta[2])})}};Qa(Xs,"id","logseq-portal");Qa(Xs,"shortcut",["3"]);Qa(Xs,"states",[LA,KA]);Qa(Xs,"initial","idle");var MA=class extends bp{constructor(){super(...arguments);Qa(this,"Shape",Pp)}};Qa(MA,"id","youtube");var NA=class extends bp{constructor(){super(...arguments);Qa(this,"Shape",Uq)}};Qa(NA,"id","iframe");var QH=vb(V(589));rb=
V(586);var RH=new Map(HA.map(b=>[b.id,b])),vw=class{constructor(b){Qa(this,"shapes");Qa(this,"pageId");Qa(this,"assets");b&&this.load(b)}load(b){const g=b.pages[0];this.pageId=null==g?void 0:g.id;this.assets=b.assets;this.shapes=null==g?void 0:g.shapes.map(m=>{var I=m.type;if(!I)throw Error("No shape type provided.");const W=RH.get(I);if(!W)throw Error(`Could not find shape class for ${I}`);return new W(m)}).filter(m=>"group"!==m.type)}generatePreviewJsx(b,g){var m,I;const W=[...(null!=(m=this.shapes)?
m:[]).map($a=>$a.getRotatedBounds())];(m=null==b?void 0:b.currentView)&&W.push(m);let ia=We.getCommonBounds(W);if(!ia)return null;ia=We.expandBounds(ia,16);ia=g?We.ensureRatio(ia,g):ia;const ua=$a=>[($a[0]-ia.minX).toFixed(2),($a[1]-ia.minY).toFixed(2)],[La,Va]=m?ua([m.minX,m.minY]):[0,0];return ia&&(0,rb.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg","data-common-bound-x":ia.minX.toFixed(2),"data-common-bound-y":ia.minY.toFixed(2),"data-common-bound-width":ia.width.toFixed(2),"data-common-bound-height":ia.height.toFixed(2),
viewBox:[0,0,ia.width,ia.height].join(" "),children:[(0,rb.jsx)("defs",{children:m&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)("rect",{id:this.pageId+"-camera-rect",transform:`translate(${La}, ${Va})`,width:m.width,height:m.height}),(0,rb.jsxs)("mask",{id:this.pageId+"-camera-mask",children:[(0,rb.jsx)("rect",{width:ia.width,height:ia.height,fill:"white"}),(0,rb.jsx)("use",{href:`#${this.pageId}-camera-rect`,fill:"black"})]})]})}),(0,rb.jsx)("g",{id:this.pageId+"-preview-shapes",children:null==
(I=this.shapes)?void 0:I.map($a=>{var lb,ub;const {bounds:Rb,props:{rotation:ec}}=$a,[Vb,tc]=ua([Rb.minX,Rb.minY]),oc=+(180*((null!=ec?ec:0)+(null!=(lb=Rb.rotation)?lb:0))/Math.PI).toFixed(2),[Xb,sc]=[(Rb.width/2).toFixed(2),(Rb.height/2).toFixed(2)];return(0,rb.jsx)("g",{transform:[`translate(${Vb}, ${tc})`,`rotate(${oc}, ${Xb}, ${sc})`].join(" "),children:$a.getShapeSVGJsx({assets:null!=(ub=this.assets)?ub:[]})},$a.id)})}),(0,rb.jsx)("rect",{mask:m?`url(#${this.pageId}-camera-mask)`:"",width:ia.width,
height:ia.height,fill:"transparent"}),m&&(0,rb.jsx)("use",{id:"minimap-camera-rect","data-x":La,"data-y":Va,"data-width":m.width,"data-height":m.height,href:`#${this.pageId}-camera-rect`,fill:"transparent",stroke:"red",strokeWidth:4/b.camera.zoom})]})}exportAsSVG(b){return(b=this.generatePreviewJsx(void 0,b))?QH.default.renderToString(b):""}},SH=vb(V(22));rb=V(586);var ww=SH.forwardRef((b,g)=>{var {value:m,className:I}=b;b=Ya(b,["autoResize","value","className"]);return(0,rb.jsx)("div",{className:"tl-input"+
(I?" "+I:""),children:(0,rb.jsxs)("div",{className:"tl-input-sizer",children:[(0,rb.jsx)("div",{className:"tl-input-hidden",children:m}),(0,rb.jsx)("input",te({ref:g,value:m,className:"tl-text-input",type:"text"},b))]})})});rb=V(586);var Qp=({type:b,active:g})=>(0,rb.jsx)("span",{className:"tl-type-tag","data-active":g,children:(0,rb.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"})[b]}`})}),OA=
(b,g)=>(0,rb.jsx)("span",{children:b.split(new RegExp(`(${g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$\x26")})`,"gi")).map((m,I)=>1===I%2?(0,rb.jsx)("mark",{className:"tl-highlighted",children:m}):m).map((m,I)=>(0,rb.jsx)(zm.default.Fragment,{children:m},I))}),TH=(b,g)=>{const {handlers:m}=zm.default.useContext(Kn),[I,W]=zm.default.useState(null),ia=Pl(b,200);zm.default.useEffect(()=>{let ua=!1;if(0<ia.length){const La={"pages?":!0,"blocks?":!0,"files?":!1};"B"===g?La["pages?"]=!1:"P"===g&&(La["blocks?"]=
!1);m.search(ia,La).then(Va=>{ua||W(Va)})}else W(null);return()=>{ua=!0}},[ia,null==m?void 0:m.search]);return I},PA=sf(({className:b,style:g,placeholder:m,onChange:I,onBlur:W,onAddBlock:ia})=>{const [ua,La]=zm.default.useState(tl.defaultSearchQuery),[Va,$a]=zm.default.useState(tl.defaultSearchFilter),lb=zm.default.useRef(null),{handlers:ub,renderers:Rb}=zm.default.useContext(Kn),ec=zm.default.useCallback(De=>{var Oe;I(De);null==(Oe=lb.current)?void 0:Oe.blur();De&&(tl.defaultSearchQuery="",tl.defaultSearchFilter=
null)},[]),Vb=zm.default.useCallback(De=>{if(De=null==ub?void 0:ub.addNewBlock(De))ec(De),null==ia?void 0:ia(De);return De},[ia]),tc=zm.default.useRef(null),[oc,Xb]=zm.default.useState(0),sc=TH(ua,Va),[Hc,Rc]=zm.default.useState("circle-plus"),[Vc,Vd]=zm.default.useState(!1);zm.default.useEffect(()=>{setTimeout(()=>{var De;null==(De=lb.current)?void 0:De.focus()})},[Va]);zm.default.useEffect(()=>{tl.defaultSearchQuery=ua;tl.defaultSearchFilter=Va},[ua,Va]);const ae=zm.default.useMemo(()=>{var De;
const Oe=[],tf=null==Rb?void 0:Rb.Breadcrumb;if(!tf||!ub)return[];ia&&Oe.push({actionIcon:"circle-plus",onChosen:()=>!!Vb(ua),element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)(Qp,{active:!0,type:"BA"}),0<ua.length?(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)("strong",{children:"New block:"}),ua]}):(0,rb.jsx)("strong",{children:"New block"})]})});(null==(De=null==sc?void 0:sc.pages)?0:De.some(of=>of.toLowerCase()===ua.toLowerCase()))||!ua||Oe.push({actionIcon:"circle-plus",
onChosen:()=>{ec(ua);return!0},element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)(Qp,{active:!0,type:"PA"}),(0,rb.jsx)("strong",{children:"New page:"}),ua]})},{actionIcon:"circle-plus",onChosen:()=>{null==ub?void 0:ub.addNewWhiteboard(ua);ec(ua);return!0},element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)(Qp,{active:!0,type:"WA"}),(0,rb.jsx)("strong",{children:"New whiteboard:"}),ua]})});0===ua.length&&null===Va&&Oe.push({actionIcon:"search",
onChosen:()=>{$a("B");return!0},element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)(Qp,{type:"BS"}),"Search only blocks"]})},{actionIcon:"search",onChosen:()=>{$a("P");return!0},element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)(Qp,{type:"PS"}),"Search only pages"]})});Va&&"P"!==Va||!sc||!sc.pages||Oe.push(...sc.pages.map(of=>({actionIcon:"search",onChosen:()=>{ec(of);return!0},element:(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",
children:[(0,rb.jsx)(Qp,{type:ub.isWhiteboardPage(of)?"WP":"P"}),OA(of,ua)]})})));Va&&"B"!==Va||!sc||!sc.blocks||Oe.push(...sc.blocks.filter(of=>of.content&&of.uuid).map(({content:of,uuid:bf})=>{const Ge=ub.queryBlockByUUID(bf);return{actionIcon:"search",onChosen:()=>{var Fd,Oc,md;return Ge?(ec(bf),null==(md=null==(Oc=null==(Fd=window.logseq)?void 0:Fd.api)?void 0:Oc.set_blocks_id)?void 0:md.call(Oc,[bf]),!0):!1},element:Ge?(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",
children:[(0,rb.jsx)(Qp,{type:"B"}),(0,rb.jsx)("div",{className:"tl-quick-search-option-breadcrumb",children:(0,rb.jsx)(tf,{blockId:bf})})]}),(0,rb.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,rb.jsx)("div",{className:"tl-quick-search-option-placeholder"}),OA(of,ua)]})]}):(0,rb.jsx)("div",{className:"tl-quick-search-option-row",children:"Cache is outdated. Please click the 'Re-index' button in the graph's dropdown menu."})}}));return Oe},[ua,Va,sc,null==Rb?void 0:Rb.Breadcrumb,
ub]);zm.default.useEffect(()=>{const De=Oe=>{var tf,of;let bf=oc;"ArrowDown"===Oe.key?bf=Math.min(ae.length-1,oc+1):"ArrowUp"===Oe.key?bf=Math.max(0,oc-1):"Enter"===Oe.key?(null==(tf=ae[oc])?void 0:tf.onChosen(),Oe.stopPropagation(),Oe.preventDefault()):"Backspace"===Oe.key&&0===ua.length?$a(null):"Escape"===Oe.key&&ec("");bf!==oc&&(tf=ae[bf],Xb(bf),Rc(tf.actionIcon),Oe.stopPropagation(),Oe.preventDefault(),(Oe=null==(of=tc.current)?void 0:of.querySelector(".tl-quick-search-option:nth-child("+(bf+
1)+")"))&&(null==Oe?void 0:Oe.scrollIntoViewIfNeeded(!1)))};document.addEventListener("keydown",De,!0);return()=>{document.removeEventListener("keydown",De,!0)}},[ae,oc,ua]);return(0,rb.jsxs)("div",{className:"tl-quick-search "+(null!=b?b:""),style:g,children:[(0,rb.jsx)(rz,{icon:Hc,onClick:()=>{var De;null==(De=ae[oc])?void 0:De.onChosen()}}),(0,rb.jsxs)("div",{className:"tl-quick-search-input-container",children:[Va&&(0,rb.jsxs)("div",{className:"tl-quick-search-input-filter",children:[(0,rb.jsx)(Qp,
{type:Va}),"B"===Va?"Search blocks":"Search pages",(0,rb.jsx)("div",{className:"tl-quick-search-input-filter-remove",onClick:()=>$a(null),children:(0,rb.jsx)(Oh,{name:"x"})})]}),(0,rb.jsx)(ww,{ref:lb,type:"text",value:ua,className:"tl-quick-search-input",placeholder:null!=m?m:"Create or search your graph...",onChange:De=>La(De.target.value),onKeyDown:De=>{"Enter"===De.key&&ec(ua);De.stopPropagation()},onFocus:()=>{Vd(!0)},onBlur:()=>{Vd(!1);null==W?void 0:W()}})]}),0<ae.length&&(0,rb.jsx)("div",{onWheelCapture:De=>
De.stopPropagation(),className:"tl-quick-search-options",ref:tc,style:{visibility:Vc?"visible":"hidden",pointerEvents:Vc?"all":"none"},children:(0,rb.jsx)(gH,{style:{height:40*Math.min(Math.max(1,ae.length),12)},totalCount:ae.length,itemContent:De=>{const {actionIcon:Oe,onChosen:tf,element:of}=ae[De];return(0,rb.jsx)("div",{"data-focused":De===oc,className:"tl-quick-search-option",tabIndex:0,onMouseEnter:()=>{Rc(Oe);Xb(De)},onMouseDownCapture:bf=>{tf()&&(bf.stopPropagation(),bf.preventDefault())},
children:of},De)}})})]})});rb=V(586);var UH=sf(function(b){var {pageId:g,portalType:m,refs:I,side:W,onRefsChange:ia}=b;b=Ya(b,"pageId portalType shapeType refs side onRefsChange".split(" "));const ua=I.length+(g?1:0),La=0===I.length,Va=lb=>{lb&&!I.includes(lb)&&La&&ia([...I,lb])},$a=!(!g||!m);return(0,rb.jsx)(hA,Ga(te({},b),{side:W,align:"start",alignOffset:-6,label:(0,rb.jsx)(fc,{content:"Link",sideOffset:14,children:(0,rb.jsxs)("div",{className:"flex gap-1 relative items-center justify-center px-1",
children:[(0,rb.jsx)(Oh,{name:0<ua?"link":"add-link"}),0<ua&&(0,rb.jsx)("div",{className:"tl-shape-links-count",children:ua})]})}),children:(0,rb.jsxs)("div",{className:"color-level rounded-lg","data-show-reference-panel":$a,children:[$a&&(0,rb.jsxs)("div",{className:"tl-shape-links-reference-panel",children:[(0,rb.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,rb.jsx)(Oh,{className:"opacity-50",name:"internal-link"}),"References"]}),(0,rb.jsx)(Oo,{type:m,id:g})]}),
(0,rb.jsxs)("div",{className:"tl-shape-links-panel color-level",children:[(0,rb.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,rb.jsx)(Oh,{className:"opacity-50",name:"add-link"}),"Link to any page or block"]}),La&&(0,rb.jsx)(PA,{style:{width:"calc(100% - 46px)",marginLeft:"46px"},placeholder:"Start typing to search...",onChange:Va}),0<I.length&&(0,rb.jsx)("div",{className:"flex flex-col items-stretch gap-2",children:I.map((lb,ub)=>(0,rb.jsx)(Oo,{id:lb,type:Wh(lb)?
"B":"P",onRemove:()=>{ia(I.filter((Rb,ec)=>ub!==ec))},showContent:!0},lb))})]})]})}))}),Sk=vb(V(22)),QA=V(22),RA=(0,QA.forwardRef)((b,g)=>{const {pressed:m,defaultPressed:I=!1,onPressedChange:W}=b,ia=Ya(b,["pressed","defaultPressed","onPressedChange"]),[ua=!1,La]=Qg({prop:m,onChange:W,defaultProp:I});return(0,QA.createElement)(tj.button,re({type:"button","aria-pressed":ua,"data-state":ua?"on":"off","data-disabled":b.disabled?"":void 0},ia,{ref:g,onClick:Zf(b.onClick,()=>{b.disabled||La(!ua)})}))}),
VH=RA,[SA]=og("ToggleGroup",[Tt]),TA=Tt(),WH=Sk.default.forwardRef((b,g)=>{const {type:m}=b;b=Ya(b,["type"]);if("single"===m)return Sk.default.createElement(XH,re({},b,{ref:g}));if("multiple"===m)return Sk.default.createElement(YH,re({},b,{ref:g}));throw Error("Missing prop `type` expected on `ToggleGroup`");}),[UA,VA]=SA("ToggleGroup"),XH=Sk.default.forwardRef((b,g)=>{const {value:m,defaultValue:I,onValueChange:W=()=>{}}=b,ia=Ya(b,["value","defaultValue","onValueChange"]),[ua,La]=Qg({prop:m,defaultProp:I,
onChange:W});return Sk.default.createElement(UA,{scope:b.__scopeToggleGroup,type:"single",value:ua?[ua]:[],onItemActivate:La,onItemDeactivate:Sk.default.useCallback(()=>La(""),[La])},Sk.default.createElement(WA,re({},ia,{ref:g})))}),YH=Sk.default.forwardRef((b,g)=>{const {value:m,defaultValue:I,onValueChange:W=()=>{}}=b,ia=Ya(b,["value","defaultValue","onValueChange"]),[ua=[],La]=Qg({prop:m,defaultProp:I,onChange:W}),Va=Sk.default.useCallback(lb=>La((ub=[])=>[...ub,lb]),[La]),$a=Sk.default.useCallback(lb=>
La((ub=[])=>ub.filter(Rb=>Rb!==lb)),[La]);return Sk.default.createElement(UA,{scope:b.__scopeToggleGroup,type:"multiple",value:ua,onItemActivate:Va,onItemDeactivate:$a},Sk.default.createElement(WA,re({},ia,{ref:g})))}),[ZH,$H]=SA("ToggleGroup"),WA=Sk.default.forwardRef((b,g)=>{const {__scopeToggleGroup:m,disabled:I=!1,rovingFocus:W=!0,orientation:ia,dir:ua,loop:La=!0}=b;var Va=Ya(b,"__scopeToggleGroup disabled rovingFocus orientation dir loop".split(" "));b=TA(m);const $a=Fb(ua);Va=te({role:"group",
dir:$a},Va);return Sk.default.createElement(ZH,{scope:m,rovingFocus:W,disabled:I},W?Sk.default.createElement(wz,re({asChild:!0},b,{orientation:ia,dir:$a,loop:La}),Sk.default.createElement(tj.div,re({},Va,{ref:g}))):Sk.default.createElement(tj.div,re({},Va,{ref:g})))}),aI=Sk.default.forwardRef((b,g)=>{var m=VA("ToggleGroupItem",b.__scopeToggleGroup);const I=$H("ToggleGroupItem",b.__scopeToggleGroup),W=TA(b.__scopeToggleGroup);m=m.value.includes(b.value);const ia=I.disabled||b.disabled;b=Ga(te({},b),
{pressed:m,disabled:ia});const ua=Sk.default.useRef(null);return I.rovingFocus?Sk.default.createElement(xz,re({asChild:!0},W,{focusable:!ia,active:m,ref:ua}),Sk.default.createElement(XA,re({},b,{ref:g}))):Sk.default.createElement(XA,re({},b,{ref:g}))}),XA=Sk.default.forwardRef((b,g)=>{const {__scopeToggleGroup:m,value:I}=b,W=Ya(b,["__scopeToggleGroup","value"]),ia=VA("ToggleGroupItem",m);b={role:"radio","aria-checked":b.pressed,"aria-pressed":void 0};return Sk.default.createElement(RA,re({},"single"===
ia.type?b:void 0,W,{ref:g,onPressedChange:ua=>{if(ua)ia.onItemActivate(I);else ia.onItemDeactivate(I)}}))}),YA=WH,ZA=aI;rb=V(586);rb=V(586);rb=V(586);var $A="Edit AutoResizing Swatch NoFill StrokeType ScaleLevel TextStyle YoutubeLink IFrameSource LogseqPortalViewMode ArrowMode Links".split(" "),bI=["Edit","YoutubeLink","IFrameSource","Links"],Mn=new Map,xw={"logseq-portal":"Swatch Edit LogseqPortalViewMode ScaleLevel AutoResizing Links".split(" "),youtube:["YoutubeLink","Links"],iframe:["IFrameSource",
"Links"],box:"Edit TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),ellipse:"Edit TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),polygon:"Edit TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),line:"Edit TextStyle Swatch ScaleLevel ArrowMode Links".split(" "),pencil:["Swatch","Links"],highlighter:["Swatch","Links"],text:"Edit TextStyle Swatch ScaleLevel AutoResizing Links".split(" "),html:["ScaleLevel","AutoResizing","Links"],image:["Links"],video:["Links"]};
Object.entries(xw).filter(([,b])=>b.includes("NoFill")&&b.includes("Swatch")).map(([b])=>b);var cI=sf(()=>{const {handlers:{isWhiteboardPage:b,redirectToPage:g}}=Sq.default.useContext(Kn),m=xg(),I=Kk(m.selectedShapesArray,"Edit")[0];return(0,rb.jsx)(dc,{type:"button",tooltip:"Edit",onClick:()=>{var W,ia,ua,La,Va,$a;m.api.editShape(I);if("logseq-portal"===I.props.type){let lb=I.props.pageId;"P"===I.props.blockType&&(b(lb)&&g(lb),lb=(null==(ua=null==(ia=null==(W=window.logseq)?void 0:W.api)?void 0:
ia.get_page_blocks_tree)?void 0:ua.call(ia,I.props.pageId).find(ub=>!("propertiesOrder"in ub))).uuid);null==($a=null==(Va=null==(La=window.logseq)?void 0:La.api)?void 0:Va.edit_block)?void 0:$a.call(Va,lb)}},children:(0,rb.jsx)(Oh,{name:"label"in I.props&&I.props.label||"text"in I.props&&I.props.text?"forms":"text"})})}),dI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"AutoResizing"),m=g.every(I=>I.props.isAutoResizing);return(0,rb.jsx)(cn,{tooltip:"Auto Resize",toggle:g.every(I=>"logseq-portal"===
I.props.type),className:"tl-button",pressed:m,onPressedChange:I=>{g.forEach(W=>{if("logseq-portal"===W.props.type)W.update({isAutoResizing:I});else W.onResetBounds({zoom:b.viewport.camera.zoom})});b.persist()},children:(0,rb.jsx)(Oh,{name:"dimensions"})})}),eI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"LogseqPortalViewMode"),m=g.every(I=>I.collapsed);return(0,rb.jsx)(ro,{title:"View Mode",options:[{value:"1",icon:"object-compact",tooltip:"Collapse"},{value:"0",icon:"object-expanded",tooltip:"Expand"}],
value:m?"1":"0",onValueChange:I=>{g.forEach(W=>{W.setCollapsed("1"===I?!0:!1)});b.persist()}})}),fI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"ScaleLevel"),m=1<(new Set(g.map(I=>I.scaleLevel))).size?"":g[0].scaleLevel;return(0,rb.jsx)(Ri,{tooltip:"Scale level",options:[{label:"Extra Small",value:"xs"},{label:"Small",value:"sm"},{label:"Medium",value:"md"},{label:"Large",value:"lg"},{label:"Extra Large",value:"xl"},{label:"Huge",value:"xxl"}],value:m,onValueChange:I=>{g.forEach(W=>{W.setScaleLevel(I)});
b.persist()}})}),gI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"IFrameSource")[0],m=Sq.default.useCallback(W=>{g.onIFrameSourceChange(W.target.value.trim().toLowerCase());b.persist()},[]),I=Sq.default.useCallback(()=>{g.reload()},[]);return(0,rb.jsxs)("span",{className:"flex gap-3",children:[(0,rb.jsx)(dc,{tooltip:"Reload",type:"button",onClick:I,children:(0,rb.jsx)(Oh,{name:"refresh"})}),(0,rb.jsx)(ww,{title:"Website Url",className:"tl-iframe-src",value:`${g.props.url}`,onChange:m}),(0,rb.jsx)(dc,
{tooltip:"Open website url",type:"button",onClick:()=>window.open(g.props.url),children:(0,rb.jsx)(Oh,{name:"external-link"})})]})}),hI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"YoutubeLink")[0],m=Sq.default.useCallback(I=>{g.onYoutubeLinkChange(I.target.value);b.persist()},[]);return(0,rb.jsxs)("span",{className:"flex gap-3",children:[(0,rb.jsx)(ww,{title:"YouTube Link",className:"tl-youtube-link",value:`${g.props.url}`,onChange:m}),(0,rb.jsx)(dc,{tooltip:"Open YouTube Link",type:"button",
onClick:()=>{var I,W,ia;return null==(ia=null==(W=null==(I=window.logseq)?void 0:I.api)?void 0:W.open_external_link)?void 0:ia.call(W,g.props.url)},children:(0,rb.jsx)(Oh,{name:"external-link"})})]})}),iI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"NoFill"),m=Sq.default.useCallback(W=>{g.forEach(ia=>ia.update({noFill:W}));b.persist()},[]),I=g.every(W=>W.props.noFill);return(0,rb.jsx)(cn,{tooltip:"Fill",className:"tl-button",pressed:I,onPressedChange:m,children:(0,rb.jsx)(Oh,{name:I?"droplet-off":
"droplet"})})}),jI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"Swatch"),m=Sq.default.useCallback(W=>{g.forEach(ia=>{ia.update({fill:W,stroke:W})});b.persist()},[]),I=Sq.default.useCallback(W=>{g.forEach(ia=>{ia.update({opacity:W})});b.persist()},[]);return(0,rb.jsx)(sg,{popoverSide:"top",color:g[0].props.noFill?g[0].props.stroke:g[0].props.fill,opacity:g[0].props.opacity,setOpacity:I,setColor:m})}),kI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"StrokeType"),m=g.every(I=>"dashed"===I.props.strokeType)?
"dashed":g.every(I=>"line"===I.props.strokeType)?"line":"mixed";return(0,rb.jsx)(ro,{title:"Stroke Type",options:[{value:"line",icon:"circle",tooltip:"Solid"},{value:"dashed",icon:"circle-dashed",tooltip:"Dashed"}],value:m,onValueChange:I=>{g.forEach(W=>{W.update({strokeType:I})});b.persist()}})}),lI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"ArrowMode");var m=g.every(W=>{var ia;return"arrow"===(null==(ia=W.props.decorations)?void 0:ia.start)});const I=g.every(W=>{var ia;return"arrow"===(null==
(ia=W.props.decorations)?void 0:ia.end)});m=[m?"start":null,I?"end":null].filter(Kg);return(0,rb.jsx)(bn,{title:"Arrow Head",options:[{value:"start",icon:"arrow-narrow-left"},{value:"end",icon:"arrow-narrow-right"}],value:m,onValueChange:W=>{g.forEach(ia=>{var ua=ia.update;var La={start:W.includes("start")?"arrow":null,end:W.includes("end")?"arrow":null};ua.call(ia,{decorations:La})});b.persist()}})}),mI=sf(()=>{const b=xg(),g=Kk(b.selectedShapesArray,"TextStyle"),m=g.every(W=>500<W.props.fontWeight),
I=g.every(W=>W.props.italic);return(0,rb.jsxs)("span",{className:"flex gap-1",children:[(0,rb.jsx)(cn,{tooltip:"Bold",className:"tl-button",pressed:m,onPressedChange:W=>{g.forEach(ia=>{ia.update({fontWeight:W?700:400});ia.onResetBounds()});b.persist()},children:(0,rb.jsx)(Oh,{name:"bold"})}),(0,rb.jsx)(cn,{tooltip:"Italic",className:"tl-button",pressed:I,onPressedChange:W=>{g.forEach(ia=>{ia.update({italic:W});ia.onResetBounds()});b.persist()},children:(0,rb.jsx)(Oh,{name:"italic"})})]})}),nI=sf(()=>
{var b;const g=xg(),m=g.selectedShapesArray[0];return(0,rb.jsx)(UH,{onRefsChange:I=>{m.update({refs:I});g.persist()},refs:null!=(b=m.props.refs)?b:[],shapeType:m.props.type,side:"right",pageId:"logseq-portal"===m.props.type?m.props.pageId:void 0,portalType:"logseq-portal"===m.props.type?m.props.blockType:void 0})});Mn.set("Edit",cI);Mn.set("AutoResizing",dI);Mn.set("LogseqPortalViewMode",eI);Mn.set("ScaleLevel",fI);Mn.set("YoutubeLink",hI);Mn.set("IFrameSource",gI);Mn.set("NoFill",iI);Mn.set("Swatch",
jI);Mn.set("StrokeType",kI);Mn.set("ArrowMode",lI);Mn.set("TextStyle",mI);Mn.set("Links",nI);var aB=b=>{var g;return(null!=(g=xw[b])?g:[]).filter(Kg)},oI=b=>{const g=b.map(I=>I.props.type),m=new Set(0<b.length?aB(g[0]):[]);for(let I=1;I<g.length&&0<m.size;I++){const W=aB(g[I]);m.forEach(ia=>{W.includes(ia)||m.delete(ia)})}1<b.length&&bI.forEach(I=>{m.has(I)&&m.delete(I)});return Array.from(m).sort((I,W)=>$A.indexOf(I)-$A.indexOf(W)).map(I=>Mn.get(I))};rb=V(586);var pI=sf(({shapes:b,offsets:g,hidden:m})=>
{const I=xg(),W=Os.useRef(null),ia=Os.useRef(null);Os.useLayoutEffect(()=>{setTimeout(()=>{const La=ia.current;if(La){var {offsetWidth:Va,offsetHeight:$a}=La;W.current=[Va,$a]}})});Os.useLayoutEffect(()=>{var La;const Va=ia.current;if(Va){var $a=null!=(La=W.current)?La:[0,0];La=0;if(116>g.top){var lb=g.height/2+40;140>g.bottom&&(lb+=g.bottom-140)}else lb=-(g.height/2+40);16>g.left+g.width/2-$a[0]/2?La+=-(g.left+g.width/2-$a[0]/2-16):16>g.right+g.width/2-$a[0]/2&&(La+=g.right+g.width/2-$a[0]/2-16);
var [ub,Rb]=[La,lb];Va.style.setProperty("transform",`translateX(${ub}px) translateY(${Rb}px)`)}},[g]);if(!I)return null;const ua=oI(b);return(0,rb.jsx)(zo,{centered:!0,children:0<ua.length&&(0,rb.jsx)("div",{ref:ia,className:"tl-toolbar tl-context-bar",style:{visibility:m?"hidden":"visible",pointerEvents:m?"none":"all"},children:ua.map((La,Va)=>(0,rb.jsxs)(Os.Fragment,{children:[(0,rb.jsx)(La,{}),Va<ua.length-1&&(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"vertical"})]},Va))})})}),
bB=vb(V(22)),ul=V(22),[qI]=og("ContextMenu",[$t]),Ys=$t(),[rI,cB]=qI("ContextMenu"),sI=(0,ul.forwardRef)((b,g)=>{const {__scopeContextMenu:m,disabled:I=!1}=b,W=Ya(b,["__scopeContextMenu","disabled"]),ia=cB("ContextMenuTrigger",m),ua=Ys(m),La=(0,ul.useRef)({x:0,y:0}),Va=(0,ul.useRef)({getBoundingClientRect:()=>DOMRect.fromRect(te({width:0,height:0},La.current))}),$a=(0,ul.useRef)(0),lb=(0,ul.useCallback)(()=>window.clearTimeout($a.current),[]);(0,ul.useEffect)(()=>lb,[lb]);(0,ul.useEffect)(()=>void(I&&
lb()),[I,lb]);return(0,ul.createElement)(ul.Fragment,null,(0,ul.createElement)(Lz,re({},ua,{virtualRef:Va})),(0,ul.createElement)(tj.span,re({"data-state":ia.open?"open":"closed","data-disabled":I?"":void 0},W,{ref:g,style:te({WebkitTouchCallout:"none"},b.style),onContextMenu:I?b.onContextMenu:Zf(b.onContextMenu,ub=>{lb();La.current={x:ub.clientX,y:ub.clientY};ia.onOpenChange(!0);ub.preventDefault()}),onPointerDown:I?b.onPointerDown:Zf(b.onPointerDown,Bn(ub=>{lb();$a.current=window.setTimeout(()=>
{La.current={x:ub.clientX,y:ub.clientY};ia.onOpenChange(!0)},700)})),onPointerMove:I?b.onPointerMove:Zf(b.onPointerMove,Bn(lb)),onPointerCancel:I?b.onPointerCancel:Zf(b.onPointerCancel,Bn(lb)),onPointerUp:I?b.onPointerUp:Zf(b.onPointerUp,Bn(lb))})))}),tI=(0,ul.forwardRef)((b,g)=>{var {__scopeContextMenu:m}=b;const I=Ya(b,["__scopeContextMenu"]),W=cB("ContextMenuContent",m);m=Ys(m);const ia=(0,ul.useRef)(!1);return(0,ul.createElement)(Mz,re({},m,I,{ref:g,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:ua=>
{var La;null===(La=b.onCloseAutoFocus)||void 0===La||La.call(b,ua);!ua.defaultPrevented&&ia.current&&ua.preventDefault();ia.current=!1},onInteractOutside:ua=>{var La;null===(La=b.onInteractOutside)||void 0===La||La.call(b,ua);ua.defaultPrevented||W.modal||(ia.current=!0)},style:Ga(te({},b.style),{["--radix-context-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),Km=(0,ul.forwardRef)((b,g)=>{var {__scopeContextMenu:m}=b;b=Ya(b,["__scopeContextMenu"]);m=Ys(m);return(0,ul.createElement)(Oz,
re({},m,b,{ref:g}))}),Wq=(0,ul.forwardRef)((b,g)=>{var {__scopeContextMenu:m}=b;b=Ya(b,["__scopeContextMenu"]);m=Ys(m);return(0,ul.createElement)(pF,re({},m,b,{ref:g}))}),uI=b=>{const {__scopeContextMenu:g,children:m,onOpenChange:I,dir:W,modal:ia=!0}=b,[ua,La]=(0,ul.useState)(!1);b=Ys(g);const Va=ij(I),$a=(0,ul.useCallback)(lb=>{La(lb);Va(lb)},[Va]);return(0,ul.createElement)(rI,{scope:g,open:ua,onOpenChange:$a,modal:ia},(0,ul.createElement)(Pz,re({},b,{dir:W,open:ua,onOpenChange:$a,modal:ia}),m))};
rb=V(586);var vI=sf(function({children:b,collisionRef:g}){var m,I,W,ia,ua,La,Va;const $a=xg(),lb=bB.useRef(null),ub=ec=>{ec();$a.transition("select")},Rb=bB.useMemo(()=>{var ec,Vb,tc;return(null==(tc=null==(Vb=null==(ec=null==window?void 0:window.logseq)?void 0:ec.api)?void 0:Vb.get_state_from_store)?void 0:tc.call(Vb,"ui/developer-mode?"))||!1},[]);return(0,rb.jsxs)(uI,{onOpenChange:ec=>{ec&&!$a.isIn("select.contextMenu")?$a.transition("select").selectedTool.transition("contextMenu"):!ec&&$a.isIn("select.contextMenu")&&
$a.selectedTool.transition("idle")},children:[(0,rb.jsx)(sI,{disabled:$a.editingShape&&0!==Object.keys($a.editingShape).length,children:b}),(0,rb.jsx)(tI,{className:"tl-menu tl-context-menu",ref:lb,onEscapeKeyDown:()=>$a.transition("select"),collisionBoundary:g.current,asChild:!0,tabIndex:-1,children:(0,rb.jsxs)("div",{children:[1<(null==(m=$a.selectedShapes)?void 0:m.size)&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)(Km,{children:[(0,rb.jsxs)("div",{className:"tl-menu-button-row pb-0",children:[(0,rb.jsx)(dc,
{tooltip:"Align left",onClick:()=>ub(()=>$a.align("left")),children:(0,rb.jsx)(Oh,{name:"layout-align-left"})}),(0,rb.jsx)(dc,{tooltip:"Align center horizontally",onClick:()=>ub(()=>$a.align("centerHorizontal")),children:(0,rb.jsx)(Oh,{name:"layout-align-center"})}),(0,rb.jsx)(dc,{tooltip:"Align right",onClick:()=>ub(()=>$a.align("right")),children:(0,rb.jsx)(Oh,{name:"layout-align-right"})}),(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,rb.jsx)(dc,{tooltip:"Distribute horizontally",
onClick:()=>ub(()=>$a.distribute("horizontal")),children:(0,rb.jsx)(Oh,{name:"layout-distribute-vertical"})})]}),(0,rb.jsxs)("div",{className:"tl-menu-button-row pt-0",children:[(0,rb.jsx)(dc,{tooltip:"Align top",onClick:()=>ub(()=>$a.align("top")),children:(0,rb.jsx)(Oh,{name:"layout-align-top"})}),(0,rb.jsx)(dc,{tooltip:"Align center vertically",onClick:()=>ub(()=>$a.align("centerVertical")),children:(0,rb.jsx)(Oh,{name:"layout-align-middle"})}),(0,rb.jsx)(dc,{tooltip:"Align bottom",onClick:()=>
ub(()=>$a.align("bottom")),children:(0,rb.jsx)(Oh,{name:"layout-align-bottom"})}),(0,rb.jsx)(Qq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,rb.jsx)(dc,{tooltip:"Distribute vertically",onClick:()=>ub(()=>$a.distribute("vertical")),children:(0,rb.jsx)(Oh,{name:"layout-distribute-horizontal"})})]})]}),(0,rb.jsx)(Wq,{className:"menu-separator"}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.packIntoRectangle),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"layout-grid"}),
"Pack into rectangle"]}),(0,rb.jsx)(Wq,{className:"menu-separator"})]}),0<(null==(I=$a.selectedShapes)?void 0:I.size)&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.zoomToSelection),children:["Zoom to fit",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"1"})]})})]}),(0,rb.jsx)(Wq,
{className:"menu-separator"})]}),($a.selectedShapesArray.some(ec=>"group"===ec.type||$a.getParentGroup(ec))||1<$a.selectedShapesArray.length)&&(0,rb.jsxs)(rb.Fragment,{children:[$a.selectedShapesArray.some(ec=>"group"===ec.type||$a.getParentGroup(ec))&&(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.unGroup),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"ungroup"}),"Ungroup",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",
children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"G"})]})})]}),1<$a.selectedShapesArray.length&&(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.doGroup),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"group"}),"Group",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"G"})]})})]}),
(0,rb.jsx)(Wq,{className:"menu-separator"})]}),0<(null==(W=$a.selectedShapes)?void 0:W.size)&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.cut),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"cut"}),"Cut",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"X"})]})})]}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>
ub($a.copy),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"copy"}),"Copy",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"C"})]})})]})]}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.paste),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"clipboard"}),"Paste",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",
{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"V"})]})})]}),1===(null==(ia=$a.selectedShapes)?void 0:ia.size)&&(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub(()=>$a.paste(void 0,!0)),children:["Paste as link",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"V"})]})})]}),
(0,rb.jsx)(Wq,{className:"menu-separator"}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.selectAll),children:["Select all",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:xo})," ",(0,rb.jsx)("code",{children:"A"})]})})]}),1<(null==(ua=$a.selectedShapes)?void 0:ua.size)&&(0,rb.jsx)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.deselectAll),children:"Deselect all"}),0<(null==(La=
$a.selectedShapes)?void 0:La.size)&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.api.deleteShapes),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"backspace"}),"Delete",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsx)("span",{className:"keyboard-shortcut",children:(0,rb.jsx)("code",{children:"Del"})})})]}),1<(null==(Va=$a.selectedShapes)?void 0:Va.size)&&(0,rb.jsxs)(rb.Fragment,{children:[(0,rb.jsx)(Wq,{className:"menu-separator"}),
(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.flipHorizontal),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"flip-horizontal"}),"Flip horizontally"]}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.flipVertical),children:[(0,rb.jsx)(Oh,{className:"tl-menu-icon",name:"flip-vertical"}),"Flip vertically"]})]}),(0,rb.jsx)(Wq,{className:"menu-separator"}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.bringToFront),children:["Move to front",(0,rb.jsx)("div",
{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"]"})]})})]}),(0,rb.jsxs)(Km,{className:"tl-menu-item",onClick:()=>ub($a.sendToBack),children:["Move to back",(0,rb.jsx)("div",{className:"tl-menu-right-slot",children:(0,rb.jsxs)("span",{className:"keyboard-shortcut",children:[(0,rb.jsx)("code",{children:"⇧"})," ",(0,rb.jsx)("code",{children:"["})]})})]}),Rb&&(0,rb.jsx)(Km,{className:"tl-menu-item",
onClick:()=>{1===$a.selectedShapesArray.length?console.log(Dc($a.selectedShapesArray[0].serialized)):console.log($a.selectedShapesArray.map(ec=>Dc(ec.serialized)))},children:"(Dev) Print shape props"})]})]})})]})}),dB=vb(V(22));rb=V(586);var wI=sf(({shape:b})=>{const g=xg(),{handlers:m}=dB.default.useContext(Kn),I=dB.default.useMemo(()=>{var W;const ia=[...(null!=(W=b.props.refs)?W:[])].map(ua=>[ua,!0]);"logseq-portal"===b.props.type&&b.props.pageId&&ia.unshift([b.props.pageId,!1]);return ia.filter(ua=>
ua[0].toLowerCase()!==g.currentPage.name&&m.getBlockPageName(ua[0])!==g.currentPage.name)},[b.props.type,b.props.parentId,b.props.refs]);return 0===I.length?null:(0,rb.jsx)("div",{className:"tl-quick-links",title:"Shape Quick Links",children:I.map(([W,ia])=>(0,rb.jsx)("div",{className:"tl-quick-links-row",children:(0,rb.jsx)(mA,{id:W,showReferenceContent:ia})},W))})}),xI=vb(V(22)),eB=vb(V(22)),yI=[".png",".svg",".jpg",".jpeg",".gif"],zI=[".mp4",".webm",".ogg"],AI=(b,g,m)=>vd(void 0,[b,g,m],function*(I,
{point:W,shiftKey:ia,dataTransfer:ua,fromDrop:La},Va){function $a(Oc,md){return vd(this,null,function*(){const zd=Object.values(I.assets).find(Md=>Md.src===Oc);return zd?zd:{id:Of(),type:md?"video":"image",src:Oc,size:yield vj(Va.makeAssetUrl(Oc),md)}})}function lb(Oc){return vd(this,null,function*(){const md=Oc.filter(zd=>"unknown"!==ho(zd.name)).map(zd=>vd(this,null,function*(){try{const Md=yield Va.saveAsset(zd);return yield $a(Md,"video"===ho(zd.name))}catch(Md){console.error(Md)}return null}));
return(yield Promise.all(md)).filter(Kg)})}function ub(Oc){return[Ga(te({},Pp.defaultProps),{html:Oc,point:[W[0],W[1]]})]}function Rb(Oc){return vd(this,null,function*(){return Cn(Vb,Xb,oc,tc,sc)(Oc)})}function ec(){return vd(this,null,function*(){const Oc=yield navigator.clipboard.read(),md=Cn(tc,sc);return(yield Promise.all(Oc.map(zd=>md(zd)))).flat().filter(Kg)})}function Vb(Oc){return vd(this,null,function*(){var md=Array.from(Oc.files);return 0<md.length?(Oe=md=yield lb(md),md.map((zd,Md)=>{const Ae=
Ga(te({},"video"===zd.type?ou.defaultProps:nu.defaultProps),{id:Of(),assetId:zd.id,opacity:1});zd.size&&Object.assign(Ae,{point:[W[0]-zd.size[0]/4+16*Md,W[1]-zd.size[1]/4+16*Md],size:Zd.div(zd.size,2)});return Ae})):null})}function tc(Oc){return vd(this,null,function*(){if(Oc.types.includes("text/plain")&&(ia||La))return null;const md=yield po(Oc,"text/html");return md?Cn(Hc,ub)(md):null})}function oc(Oc){return vd(this,null,function*(){var md,zd,Md,Ae,Ie,qf,ef=Oc.getData("block-uuid");if(ef){ef=
ef.trim();const gf=null==(Md=null==(zd=null==(md=window.logseq)?void 0:md.api)?void 0:zd.get_selected_blocks)?void 0:Md.call(zd);md=gf&&1<(null==gf?void 0:gf.length)?gf.map(Rg=>Rg.uuid):[ef];null==(qf=null==(Ie=null==(Ae=window.logseq)?void 0:Ae.api)?void 0:Ie.set_blocks_id)?void 0:qf.call(Ie,md);Ae=md.map(Rg=>Vd(`((${Rg}))`));return(yield Promise.all(Ae)).flat().filter(Kg).map((Rg,Sg)=>Ga(te({},Rg),{point:[W[0]+(tl.defaultProps.size[0]+16)*Sg,W[1]]}))}return null})}function Xb(Oc){return vd(this,
null,function*(){var md=Oc.getData("page-name");return md?(md=md.trim(),Vd(`[[${md}]]`)):null})}function sc(Oc){return vd(this,null,function*(){var md=yield po(Oc,"text/plain");return md?(md=md.trim(),Cn(Rc,Vc,Vd)(md)):null})}function Hc(Oc){if(Oc=I.api.getClonedShapesFromTldrString(decodeURIComponent(Oc),W)){const {shapes:md,assets:zd,bindings:Md}=Oc;tf.push(...zd);of.push(...Md);return md}return null}function Rc(Oc){return vd(this,null,function*(){try{new URL(Oc);var md=!0}catch(zd){md=!1}return!md||
ia||La?null:/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/.test(Oc)?[Ga(te({},Vq.defaultProps),{url:Oc,point:[W[0],W[1]]})]:[Ga(te({},Uq.defaultProps),{url:Oc,point:[W[0],W[1]]})]})}function Vc(Oc){return Oc.startsWith("\x3ciframe")?[Ga(te({},Pp.defaultProps),{html:Oc,point:[W[0],W[1]]})]:null}function Vd(Oc){return vd(this,null,function*(){if(/^\(\(.*\)\)$/.test(Oc)&&40===Oc.length){var md=Oc.slice(2,-2);if(Wh(md))return[Ga(te({},
tl.defaultProps),{point:[W[0],W[1]],size:[400,0],pageId:md,fill:I.settings.color,stroke:I.settings.color,blockType:"B"})]}else if(/^\[\[.*\]\]$/.test(Oc))return md=Oc.slice(2,-2),[Ga(te({},tl.defaultProps),{point:[W[0],W[1]],size:[400,0],pageId:md,fill:I.settings.color,stroke:I.settings.color,blockType:"P"})];return(md=null==Va?void 0:Va.addNewBlock(Oc))?[Ga(te({},tl.defaultProps),{size:[400,0],point:[W[0],W[1]],pageId:md,fill:I.settings.color,stroke:I.settings.color,blockType:"B",compact:!0})]:null})}
var ae,De;let Oe=[],tf=[];const of=[];I.cursors.setCursor("progress");let bf=[];try{ua?bf.push(...(null!=(ae=yield Rb(ua))?ae:[])):bf.push(...(null!=(De=yield ec())?De:[]))}catch(Oc){console.error(Oc)}const Ge=bf.map(Oc=>Ga(te({},Oc),{parentId:I.currentPageId,id:Wh(Oc.id)?Oc.id:Of()})),Fd=null==ua?void 0:ua.types.every(Oc=>"Files"===Oc);I.wrapUpdate(()=>{var Oc=[...Oe,...tf];0<Oc.length&&I.createAssets(Oc);0<Ge.length&&I.createShapes(Ge);I.currentPage.updateBindings(Object.fromEntries(of.map(md=>
[md.id,md])));if(1===I.selectedShapesArray.length&&1===Ge.length&&!La){Oc=I.selectedShapesArray[0];const md=I.getShapeById(Ge[0].id);I.createNewLineBinding(Oc,md)}I.setSelectedShapes(Ge.map(md=>md.id));I.selectedTool.transition("idle");I.cursors.setCursor("default");(La||Fd)&&I.packIntoRectangle()})}),BI=vb(V(22));rb=V(586);var CI=[ow,pw,IA,qw,rw,sw,tw,uw,JA,NA,MA,Xs],DI=b=>{const {renderers:g}=Br.useContext(Kn);return(0,rb.jsx)(g.BacklinksCount,Ga(te({},b),{options:{"portal?":!1}}))},EI=()=>{const b=
Br.useRef(null),g=xg(),m=Br.useMemo(()=>({ContextBar:pI,BacklinksCount:DI,QuickLinks:wI}),[]);return(0,rb.jsx)(vI,{collisionRef:b,children:(0,rb.jsx)("div",{ref:b,className:"logseq-tldraw logseq-tldraw-wrapper","data-tlapp":g.uuid,children:(0,rb.jsx)(QD,{components:m,children:(0,rb.jsx)(VF,{})})})})},FI=b=>{var {onPersist:g,model:m}=b;b=Ya(b,["onPersist","model"]);const I=Pm(),W=Rl(),ia=jo(),ua=Br.useCallback((La,Va)=>{(0,ly.default)(La.serialized,m)||(null==g?void 0:g(La,Va))},[m]);return(0,rb.jsx)(sD,
Ga(te({Shapes:HA,Tools:CI,onDrop:I,onPaste:W,onCanvasDBClick:ia,onPersist:ua,model:m},b),{children:(0,rb.jsx)(EI,{})}))},GI=function(b){var {renderers:g,handlers:m}=b;b=Ya(b,["renderers","handlers"]);const I={renderers:Br.useMemo(()=>Object.fromEntries(Object.entries(g).map(([W,ia])=>[W,Br.memo(ia)])),[]),handlers:m};return(0,rb.jsx)(Kn.Provider,{value:I,children:(0,rb.jsx)(FI,te({},b))})}};
'use strict';var T6c=function(a){return a},U6c=function(a){a=$APP.ID(a);return $APP.vn.j($APP.ZJ,a)},V6c=function(a){var b=$APP.ov.C($APP.RD(a));a=U6c(a);a=$APP.ng.j(function(d){return $APP.C.j(b,$APP.ov.C($APP.$B.C(d)))},a);var c=$APP.yh($APP.vn.j($APP.Ub,$APP.Sh.j(function(d){return $APP.gv.F(d,new $APP.O(null,2,5,$APP.Q,[$APP.aC,$APP.ov],null),null)},a)));a=$APP.vn.j(function(d){d=$APP.ov.C(d);return c.C?c.C(d):c.call(null,d)},a);return $APP.x(a)?$APP.A(a):null},W6c=function(){return $APP.Tm(null,
function(){return $APP.Tm(fetch("./whiteboard/onboarding.edn"),function(a){return $APP.Tm(a.text(),function(b){return $APP.Tm($APP.cxa(b),function(c){return $APP.Nm(c)})})})})},X6c=function(a){var b=$APP.YTa();return($APP.Nd(b)||$APP.C.j(1,$APP.rd(b))&&$APP.C.j(a,$APP.Xr.C($APP.A(b))))&&$APP.Xb($APP.gv.j($APP.u($APP.Iy),new $APP.O(null,1,5,$APP.Q,[$APP.P4b],null)))},Y6c=function(a){return null!=a?$APP.Wm($APP.Tm(null,function(){return $APP.Tm(W6c(),function(b){var c=$APP.Gf(b);b=$APP.H.j(c,$APP.nE);
c=$APP.H.j(c,$APP.ZB);var d=$APP.A(b);b=$APP.il.j($APP.su,$APP.Sh.j($APP.eab,$APP.ng.j($APP.ZJ,c)));d=$APP.fab(d);c=$APP.lQ.C(d);d=$APP.RE.C(d);a.cloneShapesIntoCurrentPage($APP.oj(new $APP.m(null,3,[$APP.dzb,b,$APP.lQ,c,$APP.RE,d],null)));$APP.Ky($APP.P4b,!0);b=$APP.oy($APP.c9b,!0);return $APP.Nm(b)})}),function(b){return console.warn("Failed to populate onboarding whiteboard",b)}):null},a7c=function(a,b){b=$APP.ir.G(b,$APP.E([new $APP.m(null,1,[$APP.jr,!0],null)]));b=$APP.Gf(b);var c=$APP.H.j(b,
Z6c),d=$APP.H.j(b,$APP.OG),e=$APP.H.j(b,$6c),f=$APP.Hy();return $APP.Tm(null,function(){return $APP.Tm($APP.n(d)?$APP.m6a(f,a,new $APP.m(null,1,[$APP.St,100],null)):null,function(g){return $APP.Tm($APP.n(c)?$APP.r6a(a,10):null,function(h){return $APP.Tm($APP.n(e)?$APP.s6a(a,100):null,function(l){return $APP.Nm($APP.oj(new $APP.m(null,3,[$APP.nE,h,$APP.ZB,g,$APP.a3a,l],null)))})})})})},b7c=function(a){return $APP.Sm($APP.yub($APP.Hy(),new $APP.O(null,1,5,$APP.Q,[$APP.ir.C(a)],null)),function(b){var c=
(c=$APP.x(b))?$APP.A(b):c;return $APP.n(c)?(b=$APP.D.F(c,0,null),$APP.D.F(c,1,null),c=$APP.D.F(c,2,null),$APP.Aub($APP.n(c)?c:b)):null})},l7c=function(a){return $APP.gh([c7c,d7c,e7c,$APP.mA,f7c,g7c,h7c,i7c,j7c,k7c],[function(b){return $APP.Xr.C($APP.jSa($APP.Hy(),$APP.dj(b)))},function(b){return $APP.lzb(b)},$APP.oE,a7c,b7c,T6c,function(b){var c=$APP.t,d=c.C,e=$APP.Nx(),f=$APP.RD(a),g=V6c(a);b=new $APP.m(null,6,[$APP.aC,$APP.rh($APP.n(g)?g:f,new $APP.O(null,1,5,$APP.Q,[$APP.ov],null)),$APP.Kz,e,$APP.iD,
$APP.n(b)?b:"",$APP.xC,$APP.Yr,$APP.GB,new $APP.m(null,1,[$APP.Xr,$APP.Wr.C?$APP.Wr.C(a):$APP.Wr.call(null,a)],null),$APP.$B,new $APP.m(null,1,[$APP.Xr,a],null)],null);$APP.RB(new $APP.O(null,1,5,$APP.Q,[b],null));return d.call(c,e)},function(b,c){return $APP.Hz($APP.Hy(),$APP.ov.C($APP.RD(b)),$APP.Uh.C(c))},function(b){var c=$APP.n($APP.Us(b))?$APP.Xr.C($APP.jSa($APP.Hy(),$APP.dj(b))):null;c=$APP.n(c)?c:b;var d=$APP.KD(c),e=$APP.oE(c);return $APP.n(d)?$APP.n(e)?$APP.BJ(c,new $APP.m(null,1,[$APP.AJ,
b],null)):$APP.zJ($APP.SD(b,!1)):null},function(b){return $APP.oj($APP.eD($APP.dj(b)))}])},k7c=new $APP.N(null,"queryBlockByUUID","queryBlockByUUID",2091812895),h7c=new $APP.N(null,"addNewBlock","addNewBlock",1426762680),$6c=new $APP.N(null,"files?","files?",-1267491104),c7c=new $APP.N(null,"getBlockPageName","getBlockPageName",-1656908032),m7c=new $APP.N(null,"renderers","renderers",-1460292282),n7c=new $APP.N(null,"model","model",331153215),o7c=new $APP.N(null,"onMount","onMount",-876858467),g7c=
new $APP.N(null,"makeAssetUrl","makeAssetUrl",217779988),p7c=new $APP.N(null,"onPersist","onPersist",-1848738852),q7c=new $APP.N(null,"Breadcrumb","Breadcrumb",-1351298906),j7c=new $APP.N(null,"redirectToPage","redirectToPage",87147838),d7c=new $APP.N(null,"addNewWhiteboard","addNewWhiteboard",554297706),f7c=new $APP.N(null,"saveAsset","saveAsset",-668047853),r7c=new $APP.N(null,"BacklinksCount","BacklinksCount",364670631),s7c=new $APP.N(null,"Block","Block",-1959785792),i7c=new $APP.N(null,"sidebarAddBlock",
"sidebarAddBlock",-1204903203),t7c=new $APP.N(null,"Page","Page",-1267059506),Z6c=new $APP.N(null,"pages?","pages?",-2065014049),u7c=new $APP.N(null,"PageName","PageName",-164991013),e7c=new $APP.N(null,"isWhiteboardPage","isWhiteboardPage",-134150579),v7c=new $APP.N(null,"BlockReference","BlockReference",-120254741);$APP.ida("tldraw");var w7c=$APP.bn(590);var x7c,y7c;$APP.rZc={};x7c=$APP.QR($APP.za(w7c,"App"));$APP.uZc=$APP.za(w7c,"generateJSXFromModel");
y7c=new $APP.m(null,6,[t7c,$APP.xs($APP.Bs,function(a){return(0,$APP.r9)(new $APP.m(null,2,[$APP.aK,$APP.SD($APP.za(a,"pageName"),!1),$APP.vyb,!0],null))},null,"frontend.extensions.tldraw/page-cp"),s7c,$APP.xs($APP.Bs,function(a){a=$APP.yi($APP.za(a,"blockId"));var b=$APP.LLa($APP.QZb);a=b.C?b.C(a):b.call(null,a);return $APP.ks(a)},null,"frontend.extensions.tldraw/block-cp"),q7c,$APP.xs($APP.Bs,function(a){return $APP.ks($APP.VU(new $APP.m(null,1,[$APP.IY,!0],null),$APP.Hy(),$APP.yi($APP.za(a,"blockId")),
new $APP.m(null,2,[$APP.BPb,$APP.za(a,"endSeparator"),$APP.CPb,$APP.za(a,"levelLimit",3)],null)))},null,"frontend.extensions.tldraw/breadcrumb"),u7c,$APP.xs($APP.Bs,function(a){return(0,$APP.BU)(new $APP.m(null,1,[$APP.IY,!0],null),new $APP.m(null,1,[$APP.Xr,$APP.za(a,"pageName")],null))},null,"frontend.extensions.tldraw/page-name-link"),r7c,function(a){return $APP.Tf.j($APP.xZc,$APP.Sh.j(function(b){return $APP.ir.G($APP.za(a,b),$APP.E([new $APP.m(null,1,[$APP.jr,!0],null)]))},new $APP.O(null,3,
5,$APP.Q,["id","className","options"],null)))},v7c,$APP.xs($APP.Bs,function(a){return(0,$APP.ONb)($APP.Ff,$APP.za(a,"blockId"),null)},null,"frontend.extensions.tldraw/block-reference")],null);
$APP.sZc=$APP.xs($APP.Bs,function(a,b){function c(l){var p=$APP.za(l,"api");return $APP.n(p)?$APP.Sm(d?Y6c(p):null,function(){$APP.GMa(l,b);return h.C?h.C(l):h.call(null,l)}):null}var d=X6c(a),e=$APP.rzb(a),f=$APP.Ls(null),g=$APP.D.F(f,0,null),h=$APP.D.F(f,1,null);$APP.Ms(function(){$APP.n($APP.n(g)?b:g)&&$APP.GMa(g,b);return function(){return $APP.Xc}},new $APP.O(null,2,5,$APP.Q,[b,g],null));return $APP.n(e)?$APP.W("div",{style:{overscrollBehavior:"none"},onBlur:function(l){l=$APP.za(l,"target").tagName;
var p=new $APP.uh(null,new $APP.m(null,2,["INPUT",null,"TEXTAREA",null],null),null);l=p.C?p.C(l):p.call(null,l);return $APP.n(l)?$APP.Jz():null},onWheel:$APP.gt,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.ks($APP.bS("Loading onboarding whiteboard ..."))]):null,$APP.ks(function(){var l=new $APP.m(null,5,[m7c,y7c,$APP.gy,l7c(a),o7c,c,p7c,function(p){return $APP.fzb(a,$APP.za(p,
"serialized"))},n7c,e],null);return x7c.C?x7c.C(l):x7c.call(null,l)}())]):null},null,"frontend.extensions.tldraw/tldraw-app");$APP.fb.Gi();
}).call(this);